pax_global_header00006660000000000000000000000064150167651310014517gustar00rootroot0000000000000052 comment=d23a7b9db932be706fecf5f4c9711fd4214bb64e jq-jq-1.8.0/000077500000000000000000000000001501676513100125475ustar00rootroot00000000000000jq-jq-1.8.0/.github/000077500000000000000000000000001501676513100141075ustar00rootroot00000000000000jq-jq-1.8.0/.github/ISSUE_TEMPLATE/000077500000000000000000000000001501676513100162725ustar00rootroot00000000000000jq-jq-1.8.0/.github/ISSUE_TEMPLATE/bug_report.md000066400000000000000000000016501501676513100207660ustar00rootroot00000000000000--- name: Bug report about: Create a report to help us improve --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Provide a minimal test case to reproduce the behavior. If the input is large, either attach it as a file, or [create a gist](https://gist.github.com) and link to it here. **Expected behavior** A clear and concise description of what you expected to happen. **Environment (please complete the following information):** - OS and Version: [e.g. macOS, Windows, Linux (please specify distro)] - jq version [e.g. 1.5] **Additional context** Add any other context about the problem here. jq-jq-1.8.0/.github/dependabot.yml000066400000000000000000000004261501676513100167410ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "pip" directory: "docs/" schedule: interval: "monthly" - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" groups: official-actions: patterns: ["actions/*"] jq-jq-1.8.0/.github/workflows/000077500000000000000000000000001501676513100161445ustar00rootroot00000000000000jq-jq-1.8.0/.github/workflows/ci.yml000066400000000000000000000303031501676513100172610ustar00rootroot00000000000000name: CI on: push: branches: - master tags: - "jq-*" pull_request: jobs: linux: strategy: fail-fast: false matrix: arch: - amd64 - arm64 - armel - armhf - i386 - mips - mips64 - mips64el - mips64r6 - mips64r6el - mipsel - mipsr6 - mipsr6el - powerpc - ppc64el - riscv64 - s390x include: - arch: amd64 CC: x86_64-linux-gnu - arch: arm64 CC: aarch64-linux-gnu - arch: armel CC: arm-linux-gnueabi - arch: armhf CC: arm-linux-gnueabihf - arch: i386 CC: i686-linux-gnu - arch: mips CC: mips-linux-gnu - arch: mips64 CC: mips64-linux-gnuabi64 - arch: mips64el CC: mips64el-linux-gnuabi64 - arch: mips64r6 CC: mipsisa64r6-linux-gnuabi64 - arch: mips64r6el CC: mipsisa64r6el-linux-gnuabi64 - arch: mipsel CC: mipsel-linux-gnu - arch: mipsr6 CC: mipsisa32r6-linux-gnu - arch: mipsr6el CC: mipsisa32r6el-linux-gnu - arch: powerpc CC: powerpc-linux-gnu - arch: ppc64el CC: powerpc64le-linux-gnu - arch: riscv64 CC: riscv64-linux-gnu - arch: s390x CC: s390x-linux-gnu runs-on: ${{ matrix.arch == 'i386' && 'ubuntu-22.04' || 'ubuntu-24.04' }} env: AR: ${{ matrix.CC }}-ar CHOST: ${{ matrix.CC }} CC: ${{ matrix.CC }}-gcc CPP: ${{ matrix.CC }}-cpp LDFLAGS: -s SUFFIX: linux-${{ matrix.arch }} steps: - name: Clone repository uses: actions/checkout@v4 with: submodules: true - name: Install packages run: | sudo apt-get update sudo apt-get install -y automake autoconf libtool crossbuild-essential-${{ matrix.arch }} - name: Build run: | autoreconf -i ./configure \ --host=${{ matrix.CC }} \ --disable-docs \ --with-oniguruma=builtin \ --enable-static \ --enable-all-static \ CFLAGS="-O2 -pthread -fstack-protector-all" make -j"$(nproc)" file ./jq cp ./jq jq-${{ env.SUFFIX }} - name: Test # Only run tests for amd64 matching the CI machine arch if: ${{ matrix.arch == 'amd64' }} run: | make check VERBOSE=yes git diff --exit-code - name: Upload Test Logs if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-logs-${{ env.SUFFIX }} retention-days: 7 path: | test-suite.log tests/*.log - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: jq-${{ env.SUFFIX }} path: jq-${{ env.SUFFIX }} if-no-files-found: error retention-days: 7 macos: strategy: fail-fast: false matrix: arch: - amd64 - arm64 include: - arch: amd64 target: x86_64-apple-darwin - arch: arm64 target: arm64-apple-darwin runs-on: macos-14 env: LDFLAGS: -dead_strip SUFFIX: macos-${{ matrix.arch }} steps: - name: Clone repository uses: actions/checkout@v4 with: submodules: true - name: Install packages run: | # brew update sometimes fails with "Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask failed!" brew update || brew update-reset brew install autoconf automake libtool - name: Set CC run: | echo "CC=clang -target ${{ matrix.target }}$(uname -r)" >> "$GITHUB_ENV" - name: Build run: | autoreconf -i ./configure \ --host="${{ matrix.target }}$(uname -r)" \ --disable-docs \ --with-oniguruma=builtin \ --disable-shared \ --enable-static \ --enable-all-static \ CFLAGS="-O2 -pthread -fstack-protector-all" make -j"$(sysctl -n hw.logicalcpu)" strip ./jq file ./jq cp ./jq jq-${{ env.SUFFIX }} - name: Test run: | make check VERBOSE=yes git diff --exit-code - name: Upload Test Logs if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-logs-${{ env.SUFFIX }} retention-days: 7 path: | test-suite.log tests/*.log - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: jq-${{ env.SUFFIX }} path: jq-${{ env.SUFFIX }} if-no-files-found: error retention-days: 7 windows: strategy: fail-fast: false matrix: arch: - amd64 - i386 include: - arch: amd64 msystem: UCRT64 - arch: i386 msystem: MINGW32 runs-on: windows-2022 env: LDFLAGS: -s SUFFIX: windows-${{ matrix.arch }} defaults: run: shell: msys2 {0} steps: - name: Prepare git config run: git config --system core.autocrlf false shell: bash - name: Clone repository uses: actions/checkout@v4 with: submodules: true - uses: msys2/setup-msys2@v2 with: update: true msystem: ${{ matrix.msystem }} install: >- base-devel git autoconf automake libtool pacboy: >- toolchain:p - name: Build run: | autoreconf -i ./configure \ --disable-docs \ --with-oniguruma=builtin \ --disable-shared \ --enable-static \ --enable-all-static \ CFLAGS="-O2 -pthread -fstack-protector-all" make -j$(nproc) file ./jq.exe cp ./jq.exe jq-${{ env.SUFFIX }}.exe - name: Test run: | make check VERBOSE=yes git diff --exit-code - name: Upload Test Logs if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-logs-${{ env.SUFFIX }} retention-days: 7 path: | test-suite.log tests/*.log - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: jq-${{ env.SUFFIX }} path: jq-${{ env.SUFFIX }}.exe if-no-files-found: error retention-days: 7 dist: runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@v4 with: submodules: true - name: Install packages run: | sudo apt-get update -qq sudo apt-get install -y automake autoconf - name: Create dist run: | autoreconf -i ./configure \ --disable-docs \ --with-oniguruma=builtin make distcheck make dist dist-zip git diff --exit-code - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: jq-dist if-no-files-found: error retention-days: 7 path: | jq-*.tar.gz jq-*.zip docker: runs-on: ubuntu-latest permissions: id-token: write contents: read attestations: write packages: write needs: linux steps: - name: Clone repository uses: actions/checkout@v4 - name: Download executables uses: actions/download-artifact@v4 with: pattern: jq-linux-* merge-multiple: true - name: Move executables run: | mkdir -p linux/{386,amd64,arm64,mips64le,ppc64le,riscv64,s390x} mv jq-linux-i386 linux/386/jq mv jq-linux-amd64 linux/amd64/jq mv jq-linux-arm64 linux/arm64/jq mv jq-linux-mips64el linux/mips64le/jq mv jq-linux-ppc64el linux/ppc64le/jq mv jq-linux-riscv64 linux/riscv64/jq mv jq-linux-s390x linux/s390x/jq chmod +x linux/*/jq - name: Create Dockerfile run: | cat <<'EOF' >Dockerfile FROM scratch ARG TARGETPLATFORM COPY AUTHORS COPYING $TARGETPLATFORM/jq / RUN ["/jq", "--version"] ENTRYPOINT ["/jq"] EOF - name: Docker metadata uses: docker/metadata-action@v5 id: metadata with: images: ghcr.io/${{ github.repository }} tags: > ${{ startsWith(github.ref, 'refs/tags/jq-') && format('type=match,pattern=jq-(.*),group=1,value={0}', github.ref_name) || 'type=sha,format=long' }} - name: Set up QEMU uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to GitHub Container Registry uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and release Docker image uses: docker/build-push-action@v6 id: build-push with: context: . push: ${{ startsWith(github.ref, 'refs/tags/jq-') }} provenance: false platforms: linux/386,linux/amd64,linux/arm64,linux/mips64le,linux/ppc64le,linux/riscv64,linux/s390x tags: ${{ steps.metadata.outputs.tags }} labels: ${{ steps.metadata.outputs.labels }} - name: Generate signed attestations if: startsWith(github.ref, 'refs/tags/jq-') uses: actions/attest-build-provenance@v2 with: subject-name: ghcr.io/${{ github.repository }} subject-digest: ${{ steps.build-push.outputs.digest }} push-to-registry: true release: runs-on: ubuntu-latest permissions: contents: write id-token: write attestations: write pull-requests: write environment: release needs: [linux, macos, windows, dist, docker] if: startsWith(github.ref, 'refs/tags/jq-') steps: - name: Clone repository uses: actions/checkout@v4 - name: Download artifacts uses: actions/download-artifact@v4 with: pattern: jq-* merge-multiple: true - name: Upload release env: TAG_NAME: ${{ github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | cp jq-linux-amd64 jq-linux64 cp jq-macos-amd64 jq-osx-amd64 cp jq-windows-amd64.exe jq-win64.exe sha256sum jq-* > sha256sum.txt gh release create "$TAG_NAME" --draft --title "jq ${TAG_NAME#jq-}" --generate-notes gh release upload "$TAG_NAME" --clobber jq-* sha256sum.txt - name: Generate signed attestations uses: actions/attest-build-provenance@v2 with: subject-path: jq-* - name: Import GPG key uses: crazy-max/ghaction-import-gpg@v6 with: gpg_private_key: ${{ secrets.JQ_RELEASE_GPG_PRIVATE_KEY }} passphrase: ${{ secrets.JQ_RELEASE_GPG_PASSPHRASE }} - name: Update signatures env: TAG_NAME: ${{ github.ref_name }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | sig_dir="sig/v${TAG_NAME#jq-}" mkdir -p "$sig_dir" mv sha256sum.txt "$sig_dir" for file in jq-*; do gpg --detach-sign --armor --batch --output "${sig_dir}/${file#*/}.asc" "$file" done git add sig git config user.name 'github-actions[bot]' git config user.email 'github-actions[bot]@users.noreply.github.com' title="Update signatures of ${TAG_NAME#jq-}" git commit -m "$title" branch="update-signatures-${TAG_NAME#jq-}" git push origin "HEAD:refs/heads/$branch" gh pr create --title "$title" --body "" --head "$branch" jq-jq-1.8.0/.github/workflows/decnum.yml000066400000000000000000000013551501676513100201460ustar00rootroot00000000000000name: decnum on: push: branches: - master pull_request: jobs: disabled: runs-on: ubuntu-24.04 steps: - name: Clone repository uses: actions/checkout@v4 with: submodules: true - name: Install packages run: | sudo apt-get update sudo apt-get install -y automake autoconf libtool - name: Build run: | autoreconf -i ./configure \ --disable-docs \ --disable-maintainer-mode \ --disable-decnum make -j"$(nproc)" make check file ./jq - name: Test run: | diff <(echo 100000000000000000000 | ./jq) <(echo 1e+20) git diff --exit-code jq-jq-1.8.0/.github/workflows/manpage.yml000066400000000000000000000030131501676513100202740ustar00rootroot00000000000000name: Building man page, man.test, manonig.test on: push: paths: - '.github/workflows/manpage.yml' - 'docs/**' - 'tests/man.test' - 'tests/manonig.test' - 'jq.1.prebuilt' pull_request: paths: - '.github/workflows/manpage.yml' - 'docs/**' - 'tests/man.test' - 'tests/manonig.test' - 'jq.1.prebuilt' jobs: manpages: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: pipenv - name: Install pipenv run: pip install pipenv - name: Install dependencies run: pipenv sync working-directory: docs - name: Validate manual schema run: pipenv run python3 validate_manual_schema.py content/manual/**/*.yml working-directory: docs - name: Configure run: | autoreconf -i ./configure --enable-docs - name: Build man page, man.test, manonig.test run: | mv jq.1.prebuilt jq.1.old rm -f tests/man.test manonig.test make jq.1.prebuilt tests/man.test tests/manonig.test - name: Make sure that jq.1.prebuilt, man.test, manonig.test are up to date run: | git diff --exit-code tests/man.test tests/manonig.test # skip build date in jq.1.prebuilt test -s jq.1.prebuilt diff -- <(tail -n +3 jq.1.old) <(tail -n +3 jq.1.prebuilt) jq-jq-1.8.0/.github/workflows/oniguruma.yml000066400000000000000000000036351501676513100207040ustar00rootroot00000000000000name: oniguruma on: push: branches: - master pull_request: # Since builtin oniguruma is tested in the CI workflow, # we test other options for --with-oniguruma here. jobs: installed: runs-on: ubuntu-24.04 steps: - name: Clone repository uses: actions/checkout@v4 - name: Install packages run: | sudo apt-get update sudo apt-get install -y automake autoconf libtool valgrind libonig-dev - name: Build run: | autoreconf -i ./configure \ --disable-docs \ --enable-valgrind \ --with-oniguruma=yes make -j"$(nproc)" file ./jq - name: Test run: | ./jq -n '"" | test("")' make check VERBOSE=yes git diff --exit-code - name: Upload Test Logs if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-logs-oniguruma-installed retention-days: 7 path: | test-suite.log tests/*.log disabled: runs-on: ubuntu-24.04 steps: - name: Clone repository uses: actions/checkout@v4 - name: Install packages run: | sudo apt-get update sudo apt-get install -y automake autoconf libtool valgrind - name: Build run: | autoreconf -i ./configure \ --disable-docs \ --enable-valgrind \ --with-oniguruma=no make -j"$(nproc)" file ./jq - name: Test run: | ! ./jq -n '"" | test("")' make check VERBOSE=yes git diff --exit-code - name: Upload Test Logs if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-logs-oniguruma-disabled retention-days: 7 path: | test-suite.log tests/*.log jq-jq-1.8.0/.github/workflows/scanbuild.yml000066400000000000000000000024661501676513100206430ustar00rootroot00000000000000name: Clang scan-build Static Analyzer Build on: push: branches: - master jobs: scan-build: runs-on: ubuntu-latest steps: - name: Clone repository uses: actions/checkout@v4 with: submodules: true - name: Install packages run: | sudo apt-get update -qq sudo apt-get install -y automake autoconf gdb valgrind clang clang-tools echo "CC=clang" >> "$GITHUB_ENV" - name: Build run: | autoreconf -i ./configure --enable-valgrind CFLAGS="-g -O0" scan-build --keep-going --exclude vendor/ make -j"$(nproc)" - name: Test run: | ulimit -c unlimited scan-build --keep-going --exclude vendor/ make -j"$(nproc)" check - name: Core dump stacks run: | if [[ -f core ]]; then gdb -batch -ex "thread apply all bt" \ "$(file core | sed "s/^[^']*'//; s/[ '].*$//")" core exit 1 fi - name: Test logs if: ${{ failure() }} run: | cat test-suite.log tests/*.log - name: Upload Logs uses: actions/upload-artifact@v4 with: name: Scan-Build Reports path: /tmp/scan-build* if-no-files-found: ignore retention-days: 7 jq-jq-1.8.0/.github/workflows/valgrind.yml000066400000000000000000000016741501676513100205050ustar00rootroot00000000000000name: valgrind on: push: branches: - master pull_request: jobs: linux: runs-on: ubuntu-24.04 steps: - name: Clone repository uses: actions/checkout@v4 with: submodules: true - name: Install packages run: | sudo apt-get update sudo apt-get install -y automake autoconf libtool valgrind - name: Build run: | autoreconf -i ./configure \ --disable-docs \ --enable-valgrind \ --with-oniguruma=builtin make -j"$(nproc)" file ./jq - name: Test run: | make check VERBOSE=yes git diff --exit-code - name: Upload Test Logs if: ${{ failure() }} uses: actions/upload-artifact@v4 with: name: test-logs-valgrind-linux retention-days: 7 path: | test-suite.log tests/*.log jq-jq-1.8.0/.github/workflows/website.yml000066400000000000000000000020451501676513100203320ustar00rootroot00000000000000name: Update website on: push: branches: - master paths: - 'docs/**' concurrency: website jobs: build: runs-on: ubuntu-latest defaults: run: working-directory: docs steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Python uses: actions/setup-python@v5 with: python-version: '3.11' cache: pipenv - name: Install pipenv run: pip install pipenv - name: Install dependencies run: pipenv sync - name: Build website run: pipenv run python3 build_website.py - name: Upload pages artifact uses: actions/upload-pages-artifact@v3 with: path: docs/output/ deploy: needs: build permissions: pages: write id-token: write environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: - name: Deploy to GitHub Pages uses: actions/deploy-pages@v4 id: deployment jq-jq-1.8.0/.gitmodules000066400000000000000000000001451501676513100147240ustar00rootroot00000000000000[submodule "vendor/oniguruma"] path = vendor/oniguruma url = https://github.com/kkos/oniguruma.git jq-jq-1.8.0/AUTHORS000066400000000000000000000244611501676513100136260ustar00rootroot00000000000000Created 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 AJ Jordan Aaron Peschel Adam Lindberg Alanscut Aleksey Tsalolikhin Alex Chamberlain Alex Jurkiewicz Alex Ozdemir Alex Wilson Alexandre Jasmin Allan Clark 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 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 Derrick Pallas Doug Luce Eiichi Sato Eli Schwartz Eloy Coto Eric Bréchemier Erik Brinkman Eugen Evan Zacks Fabian Dellwing 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 J Phani Mahesh J. B. Rainsberger Jack Pearkes Jakub Jirutka Jakub Wilk James Andariese James Pearson Hughes Jan Schulz 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> Juan Guerrero Kamontat Chantrachirathumrong <14089557+kamontat@users.noreply.github.com> 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> 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 van Dijk Philipp Hagemeister Ricardo Constantino Richard Groves Richard H Lee Riley Avron Rob Wills Robert Aboukhalil Roland C. Dowdeswell Roman Inflianskas Romero Malaquias Ryoichi KATO Rémy Léone SArpnt Samar Sunkaria Santiago Lapresta Sean Wei Sebastian Freundt Shaun Guth Shay Elkin Simon Elsbrock Stefan Stefan Seemayer Stephen Roantree Stephen Shaw Steven Ihde Steven Maude Steven Penny Thalia Archibald Thomas Bozeman th026106 Thomas R. Hall Thomas Sibley Tim McCormack Timothy John Perisho Eccleston Tom Wolf Tomas Halman Travis Gockel Tyler Rockwood Ulrich Eckhardt W-Mark Kubacki William Chargin Yasuhiro Matsumoto Yeikel Yoichi Nakayama Zhaohui Mei Zhiming Wang 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 trantor wellweek <148746285+wellweek@users.noreply.github.com> wllm-rbnt zstadler наб jq-jq-1.8.0/COPYING000066400000000000000000000142761501676513100136140ustar00rootroot00000000000000jq 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-jq-1.8.0/ChangeLog000066400000000000000000001010061501676513100143170ustar00rootroot000000000000002015-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-jq-1.8.0/Dockerfile000066400000000000000000000013111501676513100145350ustar00rootroot00000000000000FROM debian:12-slim AS builder ENV DEBIAN_FRONTEND=noninteractive \ DEBCONF_NONINTERACTIVE_SEEN=true \ LC_ALL=C.UTF-8 \ LANG=C.UTF-8 RUN apt-get update \ && apt-get install -y \ build-essential \ autoconf \ libtool \ git \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* WORKDIR /app COPY . /app RUN autoreconf -i \ && ./configure \ --disable-docs \ --with-oniguruma=builtin \ --enable-static \ --enable-all-static \ --prefix=/usr/local \ && make -j$(nproc) \ && make check VERBOSE=yes \ && make install-strip FROM scratch COPY --from=builder /app/AUTHORS /app/COPYING /usr/local/bin/jq / RUN ["/jq", "--version"] ENTRYPOINT ["/jq"] jq-jq-1.8.0/KEYS000066400000000000000000000006451501676513100132520ustar00rootroot00000000000000pub 4096R/71523402 2015-10-11 Key fingerprint = 4FD7 01D6 FA9B 3D2D F5AC 935D AF19 040C 7152 3402 uid jq Release Signing Key pub 2048R/D15684DB 2015-10-12 [expires: 2017-10-11] Key fingerprint = 7F6C 7BD3 0412 AFD5 8C1A 5007 EB26 A4F8 D156 84DB uid Nicolas Williams sub 2048R/9C9CCD6A 2015-10-12 [expires: 2017-10-11] jq-jq-1.8.0/Makefile.am000066400000000000000000000215121501676513100146040ustar00rootroot00000000000000 ### 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) echo "NOT building parser.c!" .l.c: $(AM_V_LEX) echo "NOT building lexer.c!" endif # 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 libjq_la_SOURCES = ${LIBJQ_SRC} libjq_la_LIBADD = -lm libjq_la_LDFLAGS = $(onig_LDFLAGS) -export-symbols-regex '^j[qv]_' -version-info 1:4:0 if WIN32 libjq_la_LIBADD += -lshlwapi libjq_la_LDFLAGS += -no-undefined endif include_HEADERS = src/jv.h src/jq.h AM_CPPFLAGS = -I$(srcdir)/src -I$(srcdir)/vendor ### Address sanitizer (ASan) if ENABLE_ASAN AM_CFLAGS += -fsanitize=address endif ### Undefined Behavior Sanitizer if ENABLE_UBSAN AM_CFLAGS += -fsanitize=undefined endif ### Code coverage with gcov if ENABLE_GCOV AM_CFLAGS += --coverage --no-inline endif ### Error injection for testing if ENABLE_ERROR_INJECTION lib_LTLIBRARIES += libinject_errors.la libinject_errors_la_SOURCES = src/inject_errors.c libinject_errors_la_LIBADD = -ldl libinject_errors_la_LDFLAGS = -module endif ### Building the jq binary # Remake the version.h header file if, and only if, the git ID has changed .PHONY: .FORCE .FORCE: generate_ver = ver="`{ $(srcdir)/scripts/version || echo '$(VERSION)' ; } | sed 's/.*/\x23define JQ_VERSION \"&\"/'`" .remake-version-h: .FORCE @ $(generate_ver); test "x`cat src/version.h 2>/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 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/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/utf8-truncate.jq 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-jq-1.8.0/NEWS.md000066400000000000000000000561201501676513100136510ustar00rootroot00000000000000# 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-jq-1.8.0/README.md000066400000000000000000000046021501676513100140300ustar00rootroot00000000000000# 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-jq-1.8.0/SECURITY.md000066400000000000000000000017161501676513100143450ustar00rootroot00000000000000# How to report security vulnerabilities in `jq` GitHub has a [mechanism for private disclosure of vulnerabilities](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability) to repository owners and authorized persons such as maintainers. The `jqlang/jq` repository now has this feature enabled. ## Reporting a Vulnerability See [Privately Reporting a Security Vulnerability](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing/privately-reporting-a-security-vulnerability). Click on [`jqlang/jq`](https://github.com/jqlang/jq)'s [Security page](https://github.com/jqlang/jq/security) and click on [Report a vulnerability](https://github.com/jqlang/jq/security/advisories/new). This will notify the owners and maintainers. After submitting you'll get an option to start a private clone of `jqlang/jq` for collaboration with the maintainers. jq-jq-1.8.0/build/000077500000000000000000000000001501676513100136465ustar00rootroot00000000000000jq-jq-1.8.0/compile-ios.sh000077500000000000000000000062361501676513100153350ustar00rootroot00000000000000#!/usr/bin/env bash # Mac C. compile-ios.sh for JQ. # Defaults set -e oniguruma='6.9.10' unset CFLAGS unset CXXFLAGS unset LDFLAGS # Parse args. usage(){ cat << EOF ${0##*/}: usage Description: This simple script builds oniguruma and jq for all *-apple-darwin devices. Arguments: --extra-cflags : Pass defines or includes to clang. --extra-ldflags : Pass libs or includes to ld64. --with-oniguruma : Change default version of onigurma from ${oniguruma}. EOF exit 1 } while (( $# )); do case "$1" in --with-oniguruma) shift; oniguruma="${1}" ;; --extra-cflags) shift; export CFLAGS_="${1}" ;; --extra-ldflags) shift; export LDFLAGS_="${1}" ;; --help) usage ;; *) echo -e "Unknown option: ${1}\n"; usage ;; esac shift done # Start building. echo "Building..." MAKEJOBS="$(sysctl -n hw.ncpu || echo 1)" CC_="$(xcrun -f clang || echo clang)" onig_url="https://github.com/kkos/oniguruma/releases/download/v${oniguruma}/onig-${oniguruma}.tar.gz" builddir="${TMPDIR:-/tmp}/${RANDOM:-'xxxxx'}-compile-ios-build" cwd="$(realpath ${PWD} 2>/dev/null || echo ${PWD})" t_exit() { cat << EOF A error as occurred. oniguruma location: ${builddir}/onig/onig-${oniguruma} jq location: ${cwd} Provide config.log and console logs when posting a issue. EOF } trap t_exit ERR # Onig. mkdir -p "${builddir}/onig" cd "${builddir}/" curl -L ${onig_url} | tar xz for arch in i386 x86_64 armv7 armv7s arm64; do if [[ "$arch" = "i386" || "$arch" = "x86_64" ]]; then SYSROOT=$(xcrun -f --sdk iphonesimulator --show-sdk-path) else SYSROOT=$(xcrun -f --sdk iphoneos --show-sdk-path) fi HOST="${arch}-apple-darwin" [[ "${arch}" = "arm64" ]] && HOST="aarch64-apple-darwin" CFLAGS="-arch ${arch} -miphoneos-version-min=9.0 -isysroot ${SYSROOT} ${CFLAGS_} -D_REENTRANT" LDFLAGS="-arch ${arch} -miphoneos-version-min=9.0 -isysroot ${SYSROOT} ${LDFLAGS_}" CC="${CC_} ${CFLAGS}" # ./configure; make install cd "${builddir}/onig-${oniguruma}" CC=${CC} LDFLAGS=${LDFLAGS} \ ./configure --host=${HOST} --build=$(./config.guess) --enable-shared=no --enable-static=yes --prefix=/ make -j${MAKEJOBS} install DESTDIR="${cwd}/ios/onig/${arch}" make clean # Jump back to JQ. cd ${cwd} [[ ! -f ./configure ]] && autoreconf -ivf CC=${CC} LDFLAGS=${LDFLAGS} \ ./configure --host=${HOST} --build=$(./config/config.guess) --enable-docs=no --enable-shared=no --enable-static=yes --prefix=/ --with-oniguruma=${cwd}/ios/onig/${arch} $(test -z ${BISON+x} || echo '--enable-maintainer-mode') make -j${MAKEJOBS} install DESTDIR="${cwd}/ios/jq/${arch}" make clean done mkdir -p "${cwd}/ios/dest/lib" # lipo, make a static lib. lipo -create -output ${cwd}/ios/dest/lib/libonig.a ${cwd}/ios/onig/{i386,x86_64,armv7,armv7s,arm64}/lib/libonig.a lipo -create -output ${cwd}/ios/dest/lib/libjq.a ${cwd}/ios/jq/{i386,x86_64,armv7,armv7s,arm64}/lib/libjq.a # Take the arm64 headers- the most common target. cp -r ${cwd}/ios/jq/arm64/include ${cwd}/ios/dest/ rm -rf ${cwd}/build/ios/{i386,x86_64,armv7,armv7s,arm64} echo "Output to ${cwd}/ios/dest" jq-jq-1.8.0/config/000077500000000000000000000000001501676513100140145ustar00rootroot00000000000000jq-jq-1.8.0/config/m4/000077500000000000000000000000001501676513100143345ustar00rootroot00000000000000jq-jq-1.8.0/config/m4/check-math-func.m4000066400000000000000000000003571501676513100175400ustar00rootroot00000000000000dnl 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-jq-1.8.0/config/m4/find-func-no-libs.m4000066400000000000000000000004361501676513100200130ustar00rootroot00000000000000dnl 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-jq-1.8.0/config/m4/find-func-no-libs2.m4000066400000000000000000000027651501676513100201040ustar00rootroot00000000000000dnl 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-jq-1.8.0/config/m4/find-func.m4000066400000000000000000000003361501676513100164510ustar00rootroot00000000000000dnl 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-jq-1.8.0/config/m4/misc.m4000066400000000000000000000002021501676513100155230ustar00rootroot00000000000000 dnl Shamelessly stolen from Heimdal AC_DEFUN([upcase],[`echo $1 | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`])dnl jq-jq-1.8.0/configure.ac000066400000000000000000000232311501676513100150360ustar00rootroot00000000000000m4_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 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]) 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]) AC_CONFIG_MACRO_DIRS([config/m4 m4]) AC_CONFIG_FILES([Makefile libjq.pc]) AC_OUTPUT jq-jq-1.8.0/docs/000077500000000000000000000000001501676513100134775ustar00rootroot00000000000000jq-jq-1.8.0/docs/Pipfile000066400000000000000000000003061501676513100150110ustar00rootroot00000000000000[[source]] name = "pypi" url = "https://pypi.org/simple" verify_ssl = true [dev-packages] [packages] jinja2 = "*" pyyaml = "*" markdown = "*" lxml = "*" jsonschema = "*" importlib_resources = "*" jq-jq-1.8.0/docs/Pipfile.lock000066400000000000000000001071211501676513100157430ustar00rootroot00000000000000{ "_meta": { "hash": { "sha256": "14036c3c9f103c52a0c5a53346ef33c2fbef409697f9eb314da51ccdd3aa9fb2" }, "pipfile-spec": 6, "requires": {}, "sources": [ { "name": "pypi", "url": "https://pypi.org/simple", "verify_ssl": true } ] }, "default": { "attrs": { "hashes": [ "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3", "sha256:75d7cefc7fb576747b2c81b4442d4d4a1ce0900973527c011d1030fd3bf4af1b" ], "markers": "python_version >= '3.8'", "version": "==25.3.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:d71497fef26351a33265337fa77ffeb82423f3ea21283cd9467bb03999266bc4", "sha256:fbadb6f8b144a8f8cf9f0b89ba94501d143e50411a1278633f56a7acf7fd5566" ], "index": "pypi", "markers": "python_version >= '3.8'", "version": "==4.23.0" }, "jsonschema-specifications": { "hashes": [ "sha256:0f38b83639958ce1152d02a7f062902c41c8fd20d558b0c34344292d417ae272", "sha256:a09a0680616357d9a0ecf05c12ad234479f549239d0f5b55f3deea67475da9bf" ], "markers": "python_version >= '3.9'", "version": "==2024.10.1" }, "lxml": { "hashes": [ "sha256:00b8686694423ddae324cf614e1b9659c2edb754de617703c3d29ff568448df5", "sha256:073eb6dcdf1f587d9b88c8c93528b57eccda40209cf9be549d469b942b41d70b", "sha256:09846782b1ef650b321484ad429217f5154da4d6e786636c38e434fa32e94e49", "sha256:0a01ce7d8479dce84fc03324e3b0c9c90b1ece9a9bb6a1b6c9025e7e4520e78c", "sha256:0be91891bdb06ebe65122aa6bf3fc94489960cf7e03033c6f83a90863b23c58b", "sha256:0cef4feae82709eed352cd7e97ae062ef6ae9c7b5dbe3663f104cd2c0e8d94ba", "sha256:0e108352e203c7afd0eb91d782582f00a0b16a948d204d4dec8565024fafeea5", "sha256:0ea0252b51d296a75f6118ed0d8696888e7403408ad42345d7dfd0d1e93309a7", "sha256:0fce1294a0497edb034cb416ad3e77ecc89b313cff7adbee5334e4dc0d11f422", "sha256:1320091caa89805df7dcb9e908add28166113dcd062590668514dbd510798c88", "sha256:142accb3e4d1edae4b392bd165a9abdee8a3c432a2cca193df995bc3886249c8", "sha256:14479c2ad1cb08b62bb941ba8e0e05938524ee3c3114644df905d2331c76cd57", "sha256:151d6c40bc9db11e960619d2bf2ec5829f0aaffb10b41dcf6ad2ce0f3c0b2325", "sha256:15a665ad90054a3d4f397bc40f73948d48e36e4c09f9bcffc7d90c87410e478a", "sha256:1a42b3a19346e5601d1b8296ff6ef3d76038058f311902edd574461e9c036982", "sha256:1af80c6316ae68aded77e91cd9d80648f7dd40406cef73df841aa3c36f6907c8", "sha256:1b717b00a71b901b4667226bba282dd462c42ccf618ade12f9ba3674e1fabc55", "sha256:1dc4ca99e89c335a7ed47d38964abcb36c5910790f9bd106f2a8fa2ee0b909d2", "sha256:20e16c08254b9b6466526bc1828d9370ee6c0d60a4b64836bc3ac2917d1e16df", "sha256:226046e386556a45ebc787871d6d2467b32c37ce76c2680f5c608e25823ffc84", "sha256:24974f774f3a78ac12b95e3a20ef0931795ff04dbb16db81a90c37f589819551", "sha256:24f6df5f24fc3385f622c0c9d63fe34604893bc1a5bdbb2dbf5870f85f9a404a", "sha256:27a9ded0f0b52098ff89dd4c418325b987feed2ea5cc86e8860b0f844285d740", "sha256:29f451a4b614a7b5b6c2e043d7b64a15bd8304d7e767055e8ab68387a8cacf4e", "sha256:2b31a3a77501d86d8ade128abb01082724c0dfd9524f542f2f07d693c9f1175f", "sha256:2c62891b1ea3094bb12097822b3d44b93fc6c325f2043c4d2736a8ff09e65f60", "sha256:2dc191e60425ad70e75a68c9fd90ab284df64d9cd410ba8d2b641c0c45bc006e", "sha256:31e63621e073e04697c1b2d23fcb89991790eef370ec37ce4d5d469f40924ed6", "sha256:32697d2ea994e0db19c1df9e40275ffe84973e4232b5c274f47e7c1ec9763cdd", "sha256:3a3178b4873df8ef9457a4875703488eb1622632a9cee6d76464b60e90adbfcd", "sha256:3b9c2754cef6963f3408ab381ea55f47dabc6f78f4b8ebb0f0b25cf1ac1f7609", "sha256:3d3c30ba1c9b48c68489dc1829a6eede9873f52edca1dda900066542528d6b20", "sha256:3e6d5557989cdc3ebb5302bbdc42b439733a841891762ded9514e74f60319ad6", "sha256:4025bf2884ac4370a3243c5aa8d66d3cb9e15d3ddd0af2d796eccc5f0244390e", "sha256:4291d3c409a17febf817259cb37bc62cb7eb398bcc95c1356947e2871911ae61", "sha256:4329422de653cdb2b72afa39b0aa04252fca9071550044904b2e7036d9d97fe4", "sha256:43d549b876ce64aa18b2328faff70f5877f8c6dede415f80a2f799d31644d776", "sha256:460508a4b07364d6abf53acaa0a90b6d370fafde5693ef37602566613a9b0779", "sha256:47fb24cc0f052f0576ea382872b3fc7e1f7e3028e53299ea751839418ade92a6", "sha256:48b4afaf38bf79109bb060d9016fad014a9a48fb244e11b94f74ae366a64d252", "sha256:497cab4d8254c2a90bf988f162ace2ddbfdd806fce3bda3f581b9d24c852e03c", "sha256:4aa412a82e460571fad592d0f93ce9935a20090029ba08eca05c614f99b0cc92", "sha256:4b7ce10634113651d6f383aa712a194179dcd496bd8c41e191cec2099fa09de5", "sha256:4cd915c0fb1bed47b5e6d6edd424ac25856252f09120e3e8ba5154b6b921860e", "sha256:4d885698f5019abe0de3d352caf9466d5de2baded00a06ef3f1216c1a58ae78f", "sha256:4f5322cf38fe0e21c2d73901abf68e6329dc02a4994e483adbcf92b568a09a54", "sha256:50441c9de951a153c698b9b99992e806b71c1f36d14b154592580ff4a9d0d877", "sha256:529024ab3a505fed78fe3cc5ddc079464e709f6c892733e3f5842007cec8ac6e", "sha256:53370c26500d22b45182f98847243efb518d268374a9570409d2e2276232fd37", "sha256:53d9469ab5460402c19553b56c3648746774ecd0681b1b27ea74d5d8a3ef5590", "sha256:56dbdbab0551532bb26c19c914848d7251d73edb507c3079d6805fa8bba5b706", "sha256:5a99d86351f9c15e4a901fc56404b485b1462039db59288b203f8c629260a142", "sha256:5cca36a194a4eb4e2ed6be36923d3cffd03dcdf477515dea687185506583d4c9", "sha256:5f11a1526ebd0dee85e7b1e39e39a0cc0d9d03fb527f56d8457f6df48a10dc0c", "sha256:61c7bbf432f09ee44b1ccaa24896d21075e533cd01477966a5ff5a71d88b2f56", "sha256:639978bccb04c42677db43c79bdaa23785dc7f9b83bfd87570da8207872f1ce5", "sha256:63e7968ff83da2eb6fdda967483a7a023aa497d85ad8f05c3ad9b1f2e8c84987", "sha256:664cdc733bc87449fe781dbb1f309090966c11cc0c0cd7b84af956a02a8a4729", "sha256:67ed8a40665b84d161bae3181aa2763beea3747f748bca5874b4af4d75998f87", "sha256:67f779374c6b9753ae0a0195a892a1c234ce8416e4448fe1e9f34746482070a7", "sha256:6854f8bd8a1536f8a1d9a3655e6354faa6406621cf857dc27b681b69860645c7", "sha256:696ea9e87442467819ac22394ca36cb3d01848dad1be6fac3fb612d3bd5a12cf", "sha256:6ef80aeac414f33c24b3815ecd560cee272786c3adfa5f31316d8b349bfade28", "sha256:72ac9762a9f8ce74c9eed4a4e74306f2f18613a6b71fa065495a67ac227b3056", "sha256:75133890e40d229d6c5837b0312abbe5bac1c342452cf0e12523477cd3aa21e7", "sha256:7605c1c32c3d6e8c990dd28a0970a3cbbf1429d5b92279e37fda05fb0c92190e", "sha256:773e27b62920199c6197130632c18fb7ead3257fce1ffb7d286912e56ddb79e0", "sha256:795f61bcaf8770e1b37eec24edf9771b307df3af74d1d6f27d812e15a9ff3872", "sha256:79d5bfa9c1b455336f52343130b2067164040604e41f6dc4d8313867ed540079", "sha256:7a62cc23d754bb449d63ff35334acc9f5c02e6dae830d78dab4dd12b78a524f4", "sha256:7be701c24e7f843e6788353c055d806e8bd8466b52907bafe5d13ec6a6dbaecd", "sha256:7ca56ebc2c474e8f3d5761debfd9283b8b18c76c4fc0967b74aeafba1f5647f9", "sha256:7ce1a171ec325192c6a636b64c94418e71a1964f56d002cc28122fceff0b6121", "sha256:891f7f991a68d20c75cb13c5c9142b2a3f9eb161f1f12a9489c82172d1f133c0", "sha256:8f82125bc7203c5ae8633a7d5d20bcfdff0ba33e436e4ab0abc026a53a8960b7", "sha256:91505d3ddebf268bb1588eb0f63821f738d20e1e7f05d3c647a5ca900288760b", "sha256:942a5d73f739ad7c452bf739a62a0f83e2578afd6b8e5406308731f4ce78b16d", "sha256:9454b8d8200ec99a224df8854786262b1bd6461f4280064c807303c642c05e76", "sha256:9459e6892f59ecea2e2584ee1058f5d8f629446eab52ba2305ae13a32a059530", "sha256:9776af1aad5a4b4a1317242ee2bea51da54b2a7b7b48674be736d463c999f37d", "sha256:97dac543661e84a284502e0cf8a67b5c711b0ad5fb661d1bd505c02f8cf716d7", "sha256:98a3912194c079ef37e716ed228ae0dcb960992100461b704aea4e93af6b0bb9", "sha256:9b4a3bd174cc9cdaa1afbc4620c049038b441d6ba07629d89a83b408e54c35cd", "sha256:9c886b481aefdf818ad44846145f6eaf373a20d200b5ce1a5c8e1bc2d8745410", "sha256:9ceaf423b50ecfc23ca00b7f50b64baba85fb3fb91c53e2c9d00bc86150c7e40", "sha256:a11a96c3b3f7551c8a8109aa65e8594e551d5a84c76bf950da33d0fb6dfafab7", "sha256:a3bcdde35d82ff385f4ede021df801b5c4a5bcdfb61ea87caabcebfc4945dc1b", "sha256:a7fb111eef4d05909b82152721a59c1b14d0f365e2be4c742a473c5d7372f4f5", "sha256:a81e1196f0a5b4167a8dafe3a66aa67c4addac1b22dc47947abd5d5c7a3f24b5", "sha256:a8c9b7f16b63e65bbba889acb436a1034a82d34fa09752d754f88d708eca80e1", "sha256:a8ef956fce64c8551221f395ba21d0724fed6b9b6242ca4f2f7beb4ce2f41997", "sha256:ab339536aa798b1e17750733663d272038bf28069761d5be57cb4a9b0137b4f8", "sha256:ac7ba71f9561cd7d7b55e1ea5511543c0282e2b6450f122672a2694621d63b7e", "sha256:aea53d51859b6c64e7c51d522c03cc2c48b9b5d6172126854cc7f01aa11f52bc", "sha256:aea7c06667b987787c7d1f5e1dfcd70419b711cdb47d6b4bb4ad4b76777a0563", "sha256:aefe1a7cb852fa61150fcb21a8c8fcea7b58c4cb11fbe59c97a0a4b31cae3c8c", "sha256:b0989737a3ba6cf2a16efb857fb0dfa20bc5c542737fddb6d893fde48be45433", "sha256:b108134b9667bcd71236c5a02aad5ddd073e372fb5d48ea74853e009fe38acb6", "sha256:b12cb6527599808ada9eb2cd6e0e7d3d8f13fe7bbb01c6311255a15ded4c7ab4", "sha256:b5aff6f3e818e6bdbbb38e5967520f174b18f539c2b9de867b1e7fde6f8d95a4", "sha256:b67319b4aef1a6c56576ff544b67a2a6fbd7eaee485b241cabf53115e8908b8f", "sha256:b7c86884ad23d61b025989d99bfdd92a7351de956e01c61307cb87035960bcb1", "sha256:b92b69441d1bd39f4940f9eadfa417a25862242ca2c396b406f9272ef09cdcaa", "sha256:bcb7a1096b4b6b24ce1ac24d4942ad98f983cd3810f9711bcd0293f43a9d8b9f", "sha256:bda3ea44c39eb74e2488297bb39d47186ed01342f0022c8ff407c250ac3f498e", "sha256:be2ba4c3c5b7900246a8f866580700ef0d538f2ca32535e991027bdaba944063", "sha256:c5681160758d3f6ac5b4fea370495c48aac0989d6a0f01bb9a72ad8ef5ab75c4", "sha256:c5d32f5284012deaccd37da1e2cd42f081feaa76981f0eaa474351b68df813c5", "sha256:c6364038c519dffdbe07e3cf42e6a7f8b90c275d4d1617a69bb59734c1a2d571", "sha256:c70e93fba207106cb16bf852e421c37bbded92acd5964390aad07cb50d60f5cf", "sha256:ca755eebf0d9e62d6cb013f1261e510317a41bf4650f22963474a663fdfe02aa", "sha256:cccd007d5c95279e529c146d095f1d39ac05139de26c098166c4beb9374b0f4d", "sha256:ce31158630a6ac85bddd6b830cffd46085ff90498b397bd0a259f59d27a12188", "sha256:ce9c671845de9699904b1e9df95acfe8dfc183f2310f163cdaa91a3535af95de", "sha256:d12832e1dbea4be280b22fd0ea7c9b87f0d8fc51ba06e92dc62d52f804f78ebd", "sha256:d2ed1b3cb9ff1c10e6e8b00941bb2e5bb568b307bfc6b17dffbbe8be5eecba86", "sha256:d5663bc1b471c79f5c833cffbc9b87d7bf13f87e055a5c86c363ccd2348d7e82", "sha256:d90b729fd2732df28130c064aac9bb8aff14ba20baa4aee7bd0795ff1187545f", "sha256:dc0af80267edc68adf85f2a5d9be1cdf062f973db6790c1d065e45025fa26140", "sha256:de5b4e1088523e2b6f730d0509a9a813355b7f5659d70eb4f319c76beea2e250", "sha256:de6f6bb8a7840c7bf216fb83eec4e2f79f7325eca8858167b68708b929ab2172", "sha256:df53330a3bff250f10472ce96a9af28628ff1f4efc51ccba351a8820bca2a8ba", "sha256:e094ec83694b59d263802ed03a8384594fcce477ce484b0cbcd0008a211ca751", "sha256:e794f698ae4c5084414efea0f5cc9f4ac562ec02d66e1484ff822ef97c2cadff", "sha256:e7bc6df34d42322c5289e37e9971d6ed114e3776b45fa879f734bded9d1fea9c", "sha256:eaf24066ad0b30917186420d51e2e3edf4b0e2ea68d8cd885b14dc8afdcf6556", "sha256:ecf4c4b83f1ab3d5a7ace10bafcb6f11df6156857a3c418244cef41ca9fa3e44", "sha256:ef5a7178fcc73b7d8c07229e89f8eb45b2908a9238eb90dcfc46571ccf0383b8", "sha256:f5cb182f6396706dc6cc1896dd02b1c889d644c081b0cdec38747573db88a7d7", "sha256:fa0e294046de09acd6146be0ed6727d1f42ded4ce3ea1e9a19c11b6774eea27c", "sha256:fb54f7c6bafaa808f27166569b1511fc42701a7713858dddc08afdde9746849e", "sha256:fd3be6481ef54b8cfd0e1e953323b7aa9d9789b94842d0e5b142ef4bb7999539" ], "index": "pypi", "markers": "python_version >= '3.6'", "version": "==5.4.0" }, "markdown": { "hashes": [ "sha256:794a929b79c5af141ef5ab0f2f642d0f7b1872981250230e72682346f7cc90dc", "sha256:7df81e63f0df5c4b24b7d156eb81e4690595239b7d70937d0409f1b0de319c6f" ], "index": "pypi", "markers": "python_version >= '3.9'", "version": "==3.8" }, "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:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc", "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741", "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206", "sha256:18aeb1bf9a78867dc38b259769503436b7c72f7a1f1f4c93ff9a17de54319b27", "sha256:1d4c7e777c441b20e32f52bd377e0c409713e8bb1386e1099c2415f26e479595", "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62", "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98", "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696", "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d", "sha256:4fb147e7a67ef577a588a0e2c17b6db51dda102c71de36f8549b6816a96e1867", "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47", "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486", "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6", "sha256:596106435fa6ad000c2991a98fa58eeb8656ef2325d7e158344fb33864ed87e3", "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007", "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938", "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c", "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735", "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d", "sha256:9046c58c4395dff28dd494285c82ba00b546adfc7ef001486fbf0324bc174fba", "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8", "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5", "sha256:afd7e57eddb1a54f0f1a974bc4391af8bcce0b444685d936840f125cf046d5bd", "sha256:b1275ad35a5d18c62a7220633c913e1b42d44b46ee12554e5fd39c70a243d6a3", "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0", "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515", "sha256:baa90d3f661d43131ca170712d903e6295d1f7a0f595074f151c0aed377c9b9c", "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c", "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924", "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34", "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43", "sha256:c8098ddcc2a85b61647b2590f825f3db38891662cfc2fc776415143f599bb859", "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673", "sha256:d858aa552c999bc8a8d57426ed01e40bef403cd8ccdd0fc5f6f04a00414cac2a", "sha256:f003ed9ad21d6a4713f0a9b5a7a0a79e08dd0f221aff4525a2be4c346ee60aab", "sha256:f22ac1c3cac4dbc50079e965eba2c1058622631e526bd9afd45fedd49ba781fa", "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c", "sha256:fca0e3a251908a499833aa292323f32437106001d436eca0e6e7833256674585", "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d", "sha256:fd66fc5d0da6d9815ba2cebeb4205f95818ff4b79c3ebe268e75d961704af52f" ], "index": "pypi", "version": "==6.0.1" }, "referencing": { "hashes": [ "sha256:df2e89862cd09deabbdba16944cc3f10feb6b3e6f18e902f7cc25609a34775aa", "sha256:e8699adbbf8b5c7de96d8ffa0eb5c158b3beafce084968e2ea8bb08c6794dcd0" ], "markers": "python_version >= '3.9'", "version": "==0.36.2" }, "rpds-py": { "hashes": [ "sha256:0047638c3aa0dbcd0ab99ed1e549bbf0e142c9ecc173b6492868432d8989a046", "sha256:006f4342fe729a368c6df36578d7a348c7c716be1da0a1a0f86e3021f8e98724", "sha256:041f00419e1da7a03c46042453598479f45be3d787eb837af382bfc169c0db33", "sha256:04ecf5c1ff4d589987b4d9882872f80ba13da7d42427234fce8f22efb43133bc", "sha256:04f2b712a2206e13800a8136b07aaedc23af3facab84918e7aa89e4be0260032", "sha256:0aeb3329c1721c43c58cae274d7d2ca85c1690d89485d9c63a006cb79a85771a", "sha256:0e374c0ce0ca82e5b67cd61fb964077d40ec177dd2c4eda67dba130de09085c7", "sha256:0f00c16e089282ad68a3820fd0c831c35d3194b7cdc31d6e469511d9bffc535c", "sha256:174e46569968ddbbeb8a806d9922f17cd2b524aa753b468f35b97ff9c19cb718", "sha256:1b221c2457d92a1fb3c97bee9095c874144d196f47c038462ae6e4a14436f7bc", "sha256:208b3a70a98cf3710e97cabdc308a51cd4f28aa6e7bb11de3d56cd8b74bab98d", "sha256:20f2712bd1cc26a3cc16c5a1bfee9ed1abc33d4cdf1aabd297fe0eb724df4272", "sha256:24795c099453e3721fda5d8ddd45f5dfcc8e5a547ce7b8e9da06fecc3832e26f", "sha256:2a0f156e9509cee987283abd2296ec816225145a13ed0391df8f71bf1d789e2d", "sha256:2b2356688e5d958c4d5cb964af865bea84db29971d3e563fb78e46e20fe1848b", "sha256:2c13777ecdbbba2077670285dd1fe50828c8742f6a4119dbef6f83ea13ad10fb", "sha256:2d3ee4615df36ab8eb16c2507b11e764dcc11fd350bbf4da16d09cda11fcedef", "sha256:2d53747da70a4e4b17f559569d5f9506420966083a31c5fbd84e764461c4444b", "sha256:32bab0a56eac685828e00cc2f5d1200c548f8bc11f2e44abf311d6b548ce2e45", "sha256:34d90ad8c045df9a4259c47d2e16a3f21fdb396665c94520dbfe8766e62187a4", "sha256:369d9c6d4c714e36d4a03957b4783217a3ccd1e222cdd67d464a3a479fc17796", "sha256:3a55fc10fdcbf1a4bd3c018eea422c52cf08700cf99c28b5cb10fe97ab77a0d3", "sha256:3d2d8e4508e15fc05b31285c4b00ddf2e0eb94259c2dc896771966a163122a0c", "sha256:3fab5f4a2c64a8fb64fc13b3d139848817a64d467dd6ed60dcdd6b479e7febc9", "sha256:43dba99f00f1d37b2a0265a259592d05fcc8e7c19d140fe51c6e6f16faabeb1f", "sha256:44d51febb7a114293ffd56c6cf4736cb31cd68c0fddd6aa303ed09ea5a48e029", "sha256:493fe54318bed7d124ce272fc36adbf59d46729659b2c792e87c3b95649cdee9", "sha256:4b28e5122829181de1898c2c97f81c0b3246d49f585f22743a1246420bb8d399", "sha256:4cd031e63bc5f05bdcda120646a0d32f6d729486d0067f09d79c8db5368f4586", "sha256:528927e63a70b4d5f3f5ccc1fa988a35456eb5d15f804d276709c33fc2f19bda", "sha256:564c96b6076a98215af52f55efa90d8419cc2ef45d99e314fddefe816bc24f91", "sha256:5db385bacd0c43f24be92b60c857cf760b7f10d8234f4bd4be67b5b20a7c0b6b", "sha256:5ef877fa3bbfb40b388a5ae1cb00636a624690dcb9a29a65267054c9ea86d88a", "sha256:5f6e3cec44ba05ee5cbdebe92d052f69b63ae792e7d05f1020ac5e964394080c", "sha256:5fc13b44de6419d1e7a7e592a4885b323fbc2f46e1f22151e3a8ed3b8b920405", "sha256:60748789e028d2a46fc1c70750454f83c6bdd0d05db50f5ae83e2db500b34da5", "sha256:60d9b630c8025b9458a9d114e3af579a2c54bd32df601c4581bd054e85258143", "sha256:619ca56a5468f933d940e1bf431c6f4e13bef8e688698b067ae68eb4f9b30e3a", "sha256:630d3d8ea77eabd6cbcd2ea712e1c5cecb5b558d39547ac988351195db433f6c", "sha256:63981feca3f110ed132fd217bf7768ee8ed738a55549883628ee3da75bb9cb78", "sha256:66420986c9afff67ef0c5d1e4cdc2d0e5262f53ad11e4f90e5e22448df485bf0", "sha256:675269d407a257b8c00a6b58205b72eec8231656506c56fd429d924ca00bb350", "sha256:6a4a535013aeeef13c5532f802708cecae8d66c282babb5cd916379b72110cf7", "sha256:6a727fd083009bc83eb83d6950f0c32b3c94c8b80a9b667c87f4bd1274ca30ba", "sha256:6e1daf5bf6c2be39654beae83ee6b9a12347cb5aced9a29eecf12a2d25fff664", "sha256:6eea559077d29486c68218178ea946263b87f1c41ae7f996b1f30a983c476a5a", "sha256:75a810b7664c17f24bf2ffd7f92416c00ec84b49bb68e6a0d93e542406336b56", "sha256:772cc1b2cd963e7e17e6cc55fe0371fb9c704d63e44cacec7b9b7f523b78919e", "sha256:78884d155fd15d9f64f5d6124b486f3d3f7fd7cd71a78e9670a0f6f6ca06fb2d", "sha256:79e8d804c2ccd618417e96720ad5cd076a86fa3f8cb310ea386a3e6229bae7d1", "sha256:7e80d375134ddb04231a53800503752093dbb65dad8dabacce2c84cccc78e964", "sha256:8097b3422d020ff1c44effc40ae58e67d93e60d540a65649d2cdaf9466030791", "sha256:8205ee14463248d3349131bb8099efe15cd3ce83b8ef3ace63c7e976998e7124", "sha256:8212ff58ac6dfde49946bea57474a386cca3f7706fc72c25b772b9ca4af6b79e", "sha256:823e74ab6fbaa028ec89615ff6acb409e90ff45580c45920d4dfdddb069f2120", "sha256:84e0566f15cf4d769dade9b366b7b87c959be472c92dffb70462dd0844d7cbad", "sha256:896c41007931217a343eff197c34513c154267636c8056fb409eafd494c3dcdc", "sha256:8aa362811ccdc1f8dadcc916c6d47e554169ab79559319ae9fae7d7752d0d60c", "sha256:8b3b397eefecec8e8e39fa65c630ef70a24b09141a6f9fc17b3c3a50bed6b50e", "sha256:8ebc7e65ca4b111d928b669713865f021b7773350eeac4a31d3e70144297baba", "sha256:9168764133fd919f8dcca2ead66de0105f4ef5659cbb4fa044f7014bed9a1797", "sha256:921ae54f9ecba3b6325df425cf72c074cd469dea843fb5743a26ca7fb2ccb149", "sha256:92558d37d872e808944c3c96d0423b8604879a3d1c86fdad508d7ed91ea547d5", "sha256:951cc481c0c395c4a08639a469d53b7d4afa252529a085418b82a6b43c45c240", "sha256:998c01b8e71cf051c28f5d6f1187abbdf5cf45fc0efce5da6c06447cba997034", "sha256:9abc80fe8c1f87218db116016de575a7998ab1629078c90840e8d11ab423ee25", "sha256:9be4f99bee42ac107870c61dfdb294d912bf81c3c6d45538aad7aecab468b6b7", "sha256:9c39438c55983d48f4bb3487734d040e22dad200dab22c41e331cee145e7a50d", "sha256:9d7e8ce990ae17dda686f7e82fd41a055c668e13ddcf058e7fb5e9da20b57793", "sha256:9ea7f4174d2e4194289cb0c4e172d83e79a6404297ff95f2875cf9ac9bced8ba", "sha256:a18fc371e900a21d7392517c6f60fe859e802547309e94313cd8181ad9db004d", "sha256:a36b452abbf29f68527cf52e181fced56685731c86b52e852053e38d8b60bc8d", "sha256:a5b66d1b201cc71bc3081bc2f1fc36b0c1f268b773e03bbc39066651b9e18391", "sha256:a824d2c7a703ba6daaca848f9c3d5cb93af0505be505de70e7e66829affd676e", "sha256:a88c0d17d039333a41d9bf4616bd062f0bd7aa0edeb6cafe00a2fc2a804e944f", "sha256:aa6800adc8204ce898c8a424303969b7aa6a5e4ad2789c13f8648739830323b7", "sha256:aad911555286884be1e427ef0dc0ba3929e6821cbeca2194b13dc415a462c7fd", "sha256:afc6e35f344490faa8276b5f2f7cbf71f88bc2cda4328e00553bd451728c571f", "sha256:b9a4df06c35465ef4d81799999bba810c68d29972bf1c31db61bfdb81dd9d5bb", "sha256:bb2954155bb8f63bb19d56d80e5e5320b61d71084617ed89efedb861a684baea", "sha256:bbc4362e06f950c62cad3d4abf1191021b2ffaf0b31ac230fbf0526453eee75e", "sha256:c0145295ca415668420ad142ee42189f78d27af806fcf1f32a18e51d47dd2052", "sha256:c30ff468163a48535ee7e9bf21bd14c7a81147c0e58a36c1078289a8ca7af0bd", "sha256:c347a20d79cedc0a7bd51c4d4b7dbc613ca4e65a756b5c3e57ec84bd43505b47", "sha256:c43583ea8517ed2e780a345dd9960896afc1327e8cf3ac8239c167530397440d", "sha256:c61a2cb0085c8783906b2f8b1f16a7e65777823c7f4d0a6aaffe26dc0d358dd9", "sha256:c9ca89938dff18828a328af41ffdf3902405a19f4131c88e22e776a8e228c5a8", "sha256:cc31e13ce212e14a539d430428cd365e74f8b2d534f8bc22dd4c9c55b277b875", "sha256:cdabcd3beb2a6dca7027007473d8ef1c3b053347c76f685f5f060a00327b8b65", "sha256:cf86f72d705fc2ef776bb7dd9e5fbba79d7e1f3e258bf9377f8204ad0fc1c51e", "sha256:d09dc82af2d3c17e7dd17120b202a79b578d79f2b5424bda209d9966efeed114", "sha256:d3aa13bdf38630da298f2e0d77aca967b200b8cc1473ea05248f6c5e9c9bdb44", "sha256:d69d003296df4840bd445a5d15fa5b6ff6ac40496f956a221c4d1f6f7b4bc4d9", "sha256:d6e109a454412ab82979c5b1b3aee0604eca4bbf9a02693bb9df027af2bfa91a", "sha256:d8551e733626afec514b5d15befabea0dd70a343a9f23322860c4f16a9430205", "sha256:d8754d872a5dfc3c5bf9c0e059e8107451364a30d9fd50f1f1a85c4fb9481164", "sha256:d8f9a6e7fd5434817526815f09ea27f2746c4a51ee11bb3439065f5fc754db58", "sha256:dbcbb6db5582ea33ce46a5d20a5793134b5365110d84df4e30b9d37c6fd40ad3", "sha256:e0f3ef95795efcd3b2ec3fe0a5bcfb5dadf5e3996ea2117427e524d4fbf309c6", "sha256:e13ae74a8a3a0c2f22f450f773e35f893484fcfacb00bb4344a7e0f4f48e1f97", "sha256:e274f62cbd274359eff63e5c7e7274c913e8e09620f6a57aae66744b3df046d6", "sha256:e838bf2bb0b91ee67bf2b889a1a841e5ecac06dd7a2b1ef4e6151e2ce155c7ae", "sha256:e8acd55bd5b071156bae57b555f5d33697998752673b9de554dd82f5b5352727", "sha256:e8e5ab32cf9eb3647450bc74eb201b27c185d3857276162c101c0f8c6374e098", "sha256:ebcb786b9ff30b994d5969213a8430cbb984cdd7ea9fd6df06663194bd3c450c", "sha256:ebea2821cdb5f9fef44933617be76185b80150632736f3d76e54829ab4a3b4d1", "sha256:ed0ef550042a8dbcd657dfb284a8ee00f0ba269d3f2286b0493b15a5694f9fe8", "sha256:eda5c1e2a715a4cbbca2d6d304988460942551e4e5e3b7457b50943cd741626d", "sha256:f5c0ed12926dec1dfe7d645333ea59cf93f4d07750986a586f511c0bc61fe103", "sha256:f6016bd950be4dcd047b7475fdf55fb1e1f59fc7403f387be0e8123e4a576d30", "sha256:f9e0057a509e096e47c87f753136c9b10d7a91842d8042c2ee6866899a717c0d", "sha256:fc1c892b1ec1f8cbd5da8de287577b455e388d9c328ad592eabbdcb6fc93bee5", "sha256:fc2c1e1b00f88317d9de6b2c2b39b012ebbfe35fe5e7bef980fd2a91f6100a07", "sha256:fd822f019ccccd75c832deb7aa040bb02d70a92eb15a2f16c7987b7ad4ee8d83" ], "markers": "python_version >= '3.9'", "version": "==0.24.0" }, "typing-extensions": { "hashes": [ "sha256:0a4ac55a5820789d87e297727d229866c9650f6521b64206413c4fbada24d95b", "sha256:c8dd92cc0d6425a97c18fbb9d1954e5ff92c1ca881a309c45f06ebc0b79058e5" ], "markers": "python_version >= '3.8'", "version": "==4.13.0" }, "zipp": { "hashes": [ "sha256:2c9958f6430a2040341a52eb608ed6dd93ef4392e02ffe219417c1b28b5dd1f4", "sha256:ac1bbe05fd2991f160ebce24ffbac5f6d11d83dc90891255885223d42b3cd931" ], "markers": "python_version >= '3.9'", "version": "==3.21.0" } }, "develop": {} } jq-jq-1.8.0/docs/README.md000066400000000000000000000020451501676513100147570ustar00rootroot00000000000000Documentation ============= 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-jq-1.8.0/docs/build_manpage.py000077500000000000000000000215221501676513100166450ustar00rootroot00000000000000#!/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 sys 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': self.__write_cmd('.TH "JQ" "1" "{}" "" ""'.format( date.today().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-jq-1.8.0/docs/build_mantests.py000077500000000000000000000015501501676513100170720ustar00rootroot00000000000000#!/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-jq-1.8.0/docs/build_website.py000077500000000000000000000047371501676513100167100ustar00rootroot00000000000000#!/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-jq-1.8.0/docs/content/000077500000000000000000000000001501676513100151515ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/download/000077500000000000000000000000001501676513100167605ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/download/default.yml000066400000000000000000000256231501676513100211370ustar00rootroot00000000000000headline: 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.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.7.1 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-amd64) or [ARM64](https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-macos-arm64). * jq 1.7 binaries for [AMD64](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-amd64) or [ARM64](https://github.com/jqlang/jq/releases/download/jq-1.7/jq-macos-arm64). * 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.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. They can be found under [sig/v1.x/sha256sum.txt](https://github.com/jqlang/jq/tree/master/sig). 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). Signatures can be found under [sig/v1.x/\*.asc](https://github.com/jqlang/jq/tree/master/sig). 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.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-jq-1.8.0/docs/content/index.yml000066400000000000000000000054341501676513100170110ustar00rootroot00000000000000headline: 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: 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-jq-1.8.0/docs/content/manual/000077500000000000000000000000001501676513100164265ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/dev/000077500000000000000000000000001501676513100172045ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/dev/manual.yml000066400000000000000000004375431501676513100212240ustar00rootroot00000000000000--- 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 contents 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 contents are to the texts 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 stder 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 be 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-jq-1.8.0/docs/content/manual/manual.yml000077700000000000000000000000001501676513100231142v1.7/manual.ymlustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/v1.3/000077500000000000000000000000001501676513100171155ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/v1.3/manual.yml000066400000000000000000001334551501676513100211300ustar00rootroot00000000000000--- 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-jq-1.8.0/docs/content/manual/v1.4/000077500000000000000000000000001501676513100171165ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/v1.4/manual.yml000066400000000000000000001650271501676513100211310ustar00rootroot00000000000000--- 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-jq-1.8.0/docs/content/manual/v1.5/000077500000000000000000000000001501676513100171175ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/v1.5/manual.yml000066400000000000000000003271431501676513100211310ustar00rootroot00000000000000--- 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-jq-1.8.0/docs/content/manual/v1.6/000077500000000000000000000000001501676513100171205ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/v1.6/manual.yml000066400000000000000000003703201501676513100211250ustar00rootroot00000000000000--- 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 contents 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 contents are 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`.) * `--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 stder 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-jq-1.8.0/docs/content/manual/v1.7/000077500000000000000000000000001501676513100171215ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/manual/v1.7/manual.yml000066400000000000000000004244351501676513100211350ustar00rootroot00000000000000--- 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 contents 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 contents are to the texts 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 stder 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 be 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-jq-1.8.0/docs/content/tutorial/000077500000000000000000000000001501676513100170145ustar00rootroot00000000000000jq-jq-1.8.0/docs/content/tutorial/default.yml000066400000000000000000000341641501676513100211730ustar00rootroot00000000000000headline: 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 happend 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 happend 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 happend 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-jq-1.8.0/docs/manual_schema.yml000066400000000000000000000024731501676513100170250ustar00rootroot00000000000000type: 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-jq-1.8.0/docs/public/000077500000000000000000000000001501676513100147555ustar00rootroot00000000000000jq-jq-1.8.0/docs/public/.htaccess000066400000000000000000000013371501676513100165570ustar00rootroot00000000000000DirectoryIndex 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-jq-1.8.0/docs/public/CNAME000066400000000000000000000000131501676513100155150ustar00rootroot00000000000000jqlang.org jq-jq-1.8.0/docs/public/css/000077500000000000000000000000001501676513100155455ustar00rootroot00000000000000jq-jq-1.8.0/docs/public/css/style.css000066400000000000000000000027501501676513100174230ustar00rootroot00000000000000main { 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 { display: none; } &[aria-expanded=true] .bi-chevron-right { 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-jq-1.8.0/docs/public/icon.png000066400000000000000000000115431501676513100164170ustar00rootroot00000000000000PNG  IHDR=2 pHYs7]7]F]tEXtSoftwarewww.inkscape.org<IDATxyLT?jP@TE-""n (BqAE5ƴnmZV+تiT(H#.h*UąbUD"ؑkU;9ϟzxι ,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}ѣhT Rӑ-|r888 :A0u#.]m۶-۫W/ٳo"3h 2֬Y#Jf?1m4<~XZE`u["2?HhqF0۲e /"2?Hh <(ncc#?.sD Q]]-e|!U“'O S$ \]]aa!&c4 lmm/!Cd|iBƍhnn6u(iӦI7`xyyyfW w܉dÄ Fc>}aÆڵkXZZb߾}mR貲2e?'f͚ 2ڵk ãGD_j,XpTCrڵ27b lذ$C:t-gggdm ]QQٳgUoٙ3gbƌF꿴 55{EAAA@^^.^j'O@1:Z-.]ڶPXXBTVV555jprr z u&ƁD DݙY|9~'zRIHH@rr2BBB﫩 HII3gD?1fL8!!!geeaΝ(++NC}}?^^^;w.ƌ61me.n:׏N<}5<ԩaeܳiOqMqqq1{l١aaaZYYܹspwwm9uuu_Ea*++.3ܻwnR*7XfxV\#''%%%677zq?bڞ4eIBTVVʞtI|x>(`'fOhN,]]]1l0} ?LIII\|+++=zqF?i&axpEQ0"u\ 999܀)Щ&ߟ# ~: XXX 99YWѷo_,[LR]p#WIIB⅜:skPqqq֭AmnNOOg:v ::ZhOnn.SyVŋܯ01p!Ǐ~ ~Ҙ3---8{,ScǢcǎ/6Z \o>466.?uT^վ tA^~)S3F`D*@o1(&`B;w&44NNN Fd>&NF`Ϟ=ʕ"VX Y7#(%ԋY ]VVsΉ.?be,ZoC{f)4kKjUh֣y߿T^ J1;'OeuBH4}tc5r\TT${\,祰`VB7662=}U0"rk׮LkkkΡRwLwZ*2HQ`ZB!9f#tss3SRn0h #RcԻwo}d뿾"f#ѣGQUU%|LLYJyBN9::gϞLuTU>|XwZeΝ;˚hLuFСClذA322die$ ̉R8s S)S>?)O.)DREff&sdskmm-222  ˜1cdeoLRÆ ;şl2I[|3=93gbΝy_:ϟ/WqU.i cL6J9ơ &MBee%sm۶1hfC[na…=Z-ƍ'KXOh5kor9R{MSS֮]kzE ]RR͛7n_-wʼn'DA}c)9ϥ͛qƍA+We 4k֬1*1֭[ѷoFvv ,&_xVRІ,[ L+ȅ pX555&B޽{LyÇ%M\e,j@І{xx`ѢE뿈 >LvG^/^(T^VVY Ԅ!Gv sѢEWhCr5XSSE &_J⻡:666+,){<(h:ETrb5EZ-s _D oJy0t "HIIMcWhkkkLˎ~:`HJJbΟ~Xj1b"/HLLDTT+vuuŒ%Kxb毓Jr5m*++CII ݗqM o0a?c̹#zիqy,X@їN9VxƢ3|}}ѧO_iiipw.)A]nZ[[xoEjj䙡G21ūp8vQ^^MMMlyyyFR,!iQSSÔU_|?F|2"##+)Ijǎu:gut111FW ؂ N'l׮]1|p#Off&6nz*.\^vv6Μ9\%k0:i;66VJKK_+mff&~핕?% ]^^.n777Y:Rhjjœ9segaʕzJN_+WM zjU K,1kBB?شi+ :IHɓ'Mgf2uch@477N5[peЮ];lݺmU=jdD_ڹn:Ǥ1U 6n:Rj4|嗪a16b~$4#3fw}gC+++]3ZjDV3ZHII1psʢ@}HXX~wV.---'N`Ȑ!ajXHEBҐ???YڴFTT7ߨXnX}}}Qݴ9 "%%999L߿? 777U#G}eĉ*yANBii)nݺzA;vD=Я_?aNd?~wACCc ̙3EW                                           -Bk~W- IENDB`jq-jq-1.8.0/docs/public/icon.svg000066400000000000000000000017561501676513100164370ustar00rootroot00000000000000 jq-jq-1.8.0/docs/public/jq.svg000066400000000000000000000020131501676513100161040ustar00rootroot00000000000000 jq-jq-1.8.0/docs/public/js/000077500000000000000000000000001501676513100153715ustar00rootroot00000000000000jq-jq-1.8.0/docs/public/js/manual-search.js000066400000000000000000000025251501676513100204530ustar00rootroot00000000000000(() => { 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-jq-1.8.0/docs/public/robots.txt000066400000000000000000000000261501676513100170240ustar00rootroot00000000000000User-agent: * Allow: /jq-jq-1.8.0/docs/templates/000077500000000000000000000000001501676513100154755ustar00rootroot00000000000000jq-jq-1.8.0/docs/templates/default.html.j2000066400000000000000000000022361501676513100203240ustar00rootroot00000000000000 {% 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-jq-1.8.0/docs/templates/index.html.j2000066400000000000000000000057761501676513100200230ustar00rootroot00000000000000 {% 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-jq-1.8.0/docs/templates/manual.html.j2000066400000000000000000000137621501676513100201630ustar00rootroot00000000000000 {% 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.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-jq-1.8.0/docs/templates/shared/000077500000000000000000000000001501676513100167435ustar00rootroot00000000000000jq-jq-1.8.0/docs/templates/shared/_footer.html.j2000066400000000000000000000014241501676513100216010ustar00rootroot00000000000000

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-jq-1.8.0/docs/templates/shared/_head.html.j2000066400000000000000000000031261501676513100212050ustar00rootroot00000000000000 {{ headline }} jq-jq-1.8.0/docs/templates/shared/_navbar.html.j2000066400000000000000000000061521501676513100215570ustar00rootroot00000000000000
Skip to main content {%- if navitem.startswith('manual') %} Skip to table of contents {%- endif %}
jq-jq-1.8.0/docs/validate_manual_schema.py000077500000000000000000000011101501676513100205130ustar00rootroot00000000000000#!/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-jq-1.8.0/jq.1.prebuilt000066400000000000000000003625401501676513100151020ustar00rootroot00000000000000. .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 contents 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 contents are to the texts 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 stder 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 be 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-jq-1.8.0/jq.spec000066400000000000000000000026271501676513100140440ustar00rootroot00000000000000# 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-jq-1.8.0/libjq.pc.in000066400000000000000000000003661501676513100146060ustar00rootroot00000000000000prefix=@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-jq-1.8.0/m4/000077500000000000000000000000001501676513100130675ustar00rootroot00000000000000jq-jq-1.8.0/m4/ax_compare_version.m4000066400000000000000000000146521501676513100172240ustar00rootroot00000000000000# =========================================================================== # 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-jq-1.8.0/m4/ax_prog_bison_version.m4000066400000000000000000000037351501676513100177370ustar00rootroot00000000000000# =========================================================================== # 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-jq-1.8.0/m4/ax_pthread.m4000066400000000000000000000540341501676513100154560ustar00rootroot00000000000000# =========================================================================== # 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-jq-1.8.0/scripts/000077500000000000000000000000001501676513100142365ustar00rootroot00000000000000jq-jq-1.8.0/scripts/crosscompile000077500000000000000000000015261501676513100166720ustar00rootroot00000000000000#!/bin/sh # This script is used to cross-compile binaries for # platforms other than the current one # Usage: $0 # is arbitrary, it is the name # of the directory which will be created to contain # the output binaries. # e.g. $0 win32 --host=i686-w64-mingw32 set -e cd `dirname "$0"`/../build jobs=-j4 case "X$1" in X-j*) jobs=$1; shift;; esac plat="$1" [ -z "$plat" ] && exit 1 shift case "$plat" in */*) echo "platform name must not be a path"; exit 1;; *..*) echo "platform name must not be a path"; exit 1;; *) plat=$PWD/$plat;; esac [ -d "$plat" ] || mkdir "$plat" rm -rf "$plat/tmp" mkdir "$plat/tmp" cd "$plat/tmp" ../../../configure "$@" make "$jobs" DESTDIR=$plat install set -x for jq in `find . -type f \( -name jq -o -name jq.exe \) -print`; do cp "$jq" .. done cd .. rm -rf tmp jq-jq-1.8.0/scripts/gen_utf8_tables.py000066400000000000000000000017501501676513100176640ustar00rootroot00000000000000#!/usr/bin/python # This program was used to generate jv_utf8_tables.gen.h mask = lambda n: (1 << n) - 1 def print_table(type, name, t): print("static const %s %s[] =" % (type, name)) for i in range(0,len(t),16): print ((" {" if i == 0 else " ") + ", ".join("0x%02x"%n for n in t[i:i+16]) + ("," if i + 16 < len(t) else "};")) def utf8info(c): if c < 0x80: return 1, mask(7) if 0x80 <= c <= 0xBF: return 255, mask(6) if 0xC0 <= c <= 0xC1: return 0, 0 if 0xC2 <= c <= 0xDF: return 2, mask(5) if 0xE0 <= c <= 0xEF: return 3, mask(4) if 0xF0 <= c <= 0xF4: return 4, mask(3) if 0xF4 <= c <= 0xFF: return 0, 0 table = lambda i: [utf8info(c)[i] for c in range(256)] print("#define UTF8_CONTINUATION_BYTE ((unsigned char)255)") print_table("unsigned char", "utf8_coding_length", table(0)) print_table("unsigned char", "utf8_coding_bits", table(1)) print_table("int", "utf8_first_codepoint", [0, 0x0, 0x80, 0x800, 0x10000]) jq-jq-1.8.0/scripts/version000077500000000000000000000004711501676513100156530ustar00rootroot00000000000000#!/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-jq-1.8.0/sig/000077500000000000000000000000001501676513100133315ustar00rootroot00000000000000jq-jq-1.8.0/sig/jq-release-new.key000066400000000000000000000032241501676513100166630ustar00rootroot00000000000000-----BEGIN PGP PUBLIC KEY BLOCK----- mQINBGTC/RUBEADN02309KT3tmV3Wo8fZwVo2G/0z4XSuuzhnpGo5lJfTQ+rAzth V4F9lrvakCUYhTrKe/d4Zv0uNWEV9Iz3G+raMLKY99X23OHoTBe4JLCCuV3nSEBF +SNAoUW9VTBuR5UHNZ9fLsGpqbJSYFx5oU0xfMHWKirriIWkq/u4iTbgzX5keJRG cCP9d3j5Hki7FSzHofzG5m/OBNIpTu2oYh+PuqlORmoaJ/bL/8ANa5CeFQHnkeHD 62zW1/lhuELUzFd0K+H/m4HmEv1u8XVMfnZM0cxSIAfJoV+vjlmmos6A18AHWqal C6yS0OYWXxB/JbAVMGRtdKfoFSjMmQWTEUEFmMmHOxdriH/QN6O5X0kq6ZVCJPEK 0unzJRQn27hHH3zsHXZyIjF/W+pXCp0jtaQqF4AQW8GDL5wP5glS3yfvtbQQfL/R qVSiU4SkM/5w6gwHPHR5jxibbHmuIqyIe0JjTNJJl9YvNcjM4rbIi6TZx8rh2BrP xY+j6gBr0/clnFxB3O2LsfxhWTnZ1lmJb0M6n+ih8+371JSvEupqe9px18FsuxnM 8oQ5jF6LVSTxfydSPtBpofLz3/oGGmDkMGzVN1gsTxHJ2dG2u7G/VUpMSU7OPoRJ a1rtNW4/Hgl9le09dQfus7grp70Lm6yaut60sbo0zPlAZdB57SDLwDSreQARAQAB tDdqcSBSZWxlYXNlIFNpZ25pbmcgS2V5IDxuby1zZW5kLWVtYWlsQGpxbGFuZy5n aXRodWIuaW8+iQJUBBMBCgA+FiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTC/RUC GwMFCQPCZwAFCwkIBwIGFQoJCAsCBBYCAwECHgECF4AACgkQ4aewjAfp7oYiTw/+ InD6e3o6Z8Cx1RNS37xZTgI2i+eA8N2m2drK8EybA5LOPjXEaSPeXDpOR0LkhiT2 uashRsHonNgrH3MfGxGa7C5rSbMiN0Lqp+IML4Z3x6PLLENGWYtZGk0Z3xfmm/HH WV565xPJ3JtFRDtx11XaRRRPNrNojEKAcc9C06YPVfnVmIPVhi3ah/x4K+qMalGt u1i+2OjC4+bdNkNhImnhOuQ+3EvxE7ocpEkI+z+8PnLFzjMXAnVslLf+oM1TmS2P rv2xIXGGet41f0ube0d2pLIZEwv3NLAdlRvTysBLoE3VwbWV91GEH5U5gkf+rkLJ cOBuZ4/mw+N3aVjMDD4sBiuNAY3WlwJf1otdzf/WB5JOsscgU2efs13Crjl4UQuz fPHzzGpTJiSrBmFFURshYnwJsKzftil62zKoBA982jpmWIrOdDPcTe8ypT59MTvx U/LelumomNfGHbNIbzZ2KBOS6hV38C7HrSqRRwV+lBenq6TTuiYT0BJaxPB1rPdT 39WS5JzllC5G5HmShzePrc9y+17+BIGyA+Cf1eOV0Jz8qtvgDvP2K7I0my0/+NJ0 U+fEFKul1TWgM5Jwqd0g6FBmjn2ZUuENyIk1nLcry6aRf3I4RLFopYzkbFf1u1PZ FP7L7aCLmof0hsMiOEd9yAgiq20kdU8jx+NwkFBpDnA= =ZgkJ -----END PGP PUBLIC KEY BLOCK----- jq-jq-1.8.0/sig/jq-release-old.key000066400000000000000000000045661501676513100166620ustar00rootroot00000000000000-----BEGIN PGP PUBLIC KEY BLOCK----- Comment: jq Release Signing Key 0xAF19040C71523402 mQINBFYayakBEADL6biudAZ3V1//e3gdWMN6lbz+m5o6avu1vnbtCul/MxOF2Ygd SeXCn5gV3+F+xdrA3/Mhv9cWXzzDTp0D2U75mHw1n4OcArFvKm/RV5yOlc/wvblp WfWd/hCIIZhdHpRWdCko2ByXx9XlBRn46nGyxCFScLcHbicPjq2kIpZ7oad29gs4 bThj65G5XS48FyqixGHy0o2S0nQXNIyB1XTPm4mwHNAeOMFaYj6nhb6b5vu+RhlK syirTGU7pZYd13FM5y9NZrbxfKnGz5bdKPgb4jRi3YmBTKRzlW4IZl3SGO3kPi9a wJR4vP+cf1eEAWulrt9i4DA3/3/lpPpFh5bSo7nKW49PdOjfLWzBLtCsVhJReF97 sSPVpNmf6RrfBXnPlEBw+aU4wGRbmpA9AGV2rKsvxZbU2AqDS93Pn6S0u4XNNnjH TGxe2P9gSEH+xNuEyFcDbt0XP6Te3vSE7oMGIPhXq1FKuXygEQGV2fXa2Dovxi+q YTvbtzG5PV5lQqeexoNMUHzgHVWib/NIt7JTkBflJt33re7oayZd5DSE5zy/4n5d LH9prYJWqVGgb92Lzlk6uYDp3ztBlFdoRR+6L25iUCPRq5yS7J4Rk3ahask2CsQc aANz5xkESnS5DcakDoVtbiC1UY8eM+vXui/UF2uYCTLrz+SIIZJHPQ0fdQARAQAB tC5qcSBSZWxlYXNlIFNpZ25pbmcgS2V5IDxqcUBzdGVkb2xhbi5naXRodWIuaW8+ iQI4BBMBAgAiBQJWGsmpAhsDBgsJCAcDAgYVCAIJCgsEFgIDAQIeAQIXgAAKCRCv GQQMcVI0AoHwD/4s1L10OiimSELwTZ3x+btmKdaFBdlUhjBZd/GDE3P1pV+63D2+ LhLpZLQ3yOrplUDHGBG02Hx7/lY2YE5rRVNMyR8FqD9aMrOwQE3uERjkwFQ7Q69r S6kFLiOxUWDXNQ0wXeZ/Na6uYi6AI/oCYWnDIO3lugDUoXtHanYqK1BvJsBEvWpe UB18VcqxBQuOMPD+xNzVDSFn1uYiKKBkv4XJNLHRqdLpwmAVcLDkKTHWEy+223CZ 4zwahQKw9wPdUlakXP7v+wIxzGXaGk0yJOsYVPykQ4AkoMgvqqxyx23d6hjncR1o 36muLAiL+qELZ/rxUytduaK1Owr8cNJgPzRAEbeSRdw2hZYyEnHgNPC3atUN0wIk khzP/GHMBYIU90CdiWjGvjJeHv047Ty4S9PEYPZLQx1s8cdIeozEFt/lTqFp+9Si f2DWUKHpzQ3wfUudTD4pzSy28XJ760Kq54f1cf2CWqp577xrxRfcKKoyufF8pwqf sAno03N6MpxiK0qVwZ/0Qb2BfAI2rpxxc98qhuErlBE8WjPj7M93eaHNMTtCqCIG Hke6kMjYuwGu8NK/O0SqGqsHoXxxIvlZNda9MCPJo9xl77dphurOq/D/d9rfy/Uk 5D8ssNUBhM3s6sQl27L1avnSS12UuRdGSQwU33XbAuNG7y0a/zRnX+GqE4kCHAQQ AQIABgUCVhrKpwAKCRD5uhQ7lf9tgo26D/0WFFkhmUjSV9K/q8zSSJhuQfzoeM+n Z2DfYBfKdawbJH9/Yfg1nIFzih2lnvzk/kx8WbLSDMb0sHn6ZUZ6cVoBvrBxSgah bwPF9M8Xf4J/oBYHq8ZYjPHOWnHbEPuoNzPreqOhtSLBtP5dfZlEI6DLR2+WKj22 EmHfmBFoKZ90N2MQWQLV98DAFfsxS7Bqc9xSCbh405qCIGr/4r4P0BaIdJ2jW/9k AHwnsmJnf5lI7dn8BEMYgM3vcG4dyaWNf+eoI3cJnq+Y782KoyFjof4t1bLF2H1C vbiJ9xWv4uCeTVlTwiVJFkSUxBgmsyVofcboHF7/06HtVXDpG/ihZEOoqNPKPD4d 56V2t0hEulUpyqfs0Ic8r+sGWgvDCSqAVrXak2n0ULJ+RkpRB6ekcgOY7HdYKX1H UifaytQSxjUBXfo9HAC0Br2fyGh9s5zBcnrIrWHxwQw/RCIIv9CkZB7s6/NFYBKw Q27xTpXjHnGoEHNAA2xSyMXw9VoH3qoze/1iraK0zSFGAXpmL57HMBnOrLj7oq+O tB/cLd9o4+XFJjXHGAsXoOD5cCADkgMSMcouvPFKySfK0Kz5ScWVSsc5FvG44j/L T1WvjBgIrNAeQJ2efPYVmg5f/ALkjgnKy+lkafBk4OwXtWZCTf+9vcOF7FQ2B6N+ 7qQPymxSJxBSEg== =AiyG -----END PGP PUBLIC KEY BLOCK----- jq-jq-1.8.0/sig/v1.3/000077500000000000000000000000001501676513100140205ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.3/jq-linux-x86.asc000066400000000000000000000014631501676513100167060ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzhJAAoJEK8ZBAxxUjQC8xMQAMgSl+2aYa/c/LuYKDWtVnHO G16rAq+oruc/IrEwEKqcwqTvK8M7xlAxUt5aPtAY0kRkvxadFtX8vZy1SEqAFcC5 sw7J+Oswl+5dJF0Y3j3I0hA6JuOe/+RP4r64pGlwQ0mVIJuTWqinzO9JqTOskeXy 5vSN50A0vFXzDu661UFr1v8q5+b8WhIrJhuOZtaPap33Gu9bS6fz93VBm4LE3a04 KjDydbNUoyA5HX4QVTgFON8oeVJevtqV3krnsU/ncOeTB0ThT9yywcq8HCbh7dqo EhfyATOmk3RZf3RsSAOG5CZ9cFjof6/SqVG8Cbp14MRVMkKi37mvHkqFER/WRtsv Ul1OzFfv8Jwv+cItTSB5c80kbbRfrqwf6NgZW9oTxZP3G3I5JjCTYhCaWlzO0wZ1 QAAJDBAv5GNB4rn9LXGdj2DhcCh00lJY83Bpup4LRc2RuJuJH7IUIkfRW4CAVoRd p6w5W4jYNdrrTkhfkNxSqi7FtKN23+eD2r0knPvhsWxyUcXrGhFqaImHmzQWIsX5 AviEK+nQUcuhTKolsN/97NPkRYUT9C4IVNdI8m1+EsAuwGodSvRrUwBIOoVQlYA7 MFLZZ23Su/8T5NnruP+iXmy0Y3Nf9W+GLHNn3H+9027zAs5Esd2Hy4R6W65BwWuI yYHFx8O6bi5ke72ByCUI =ru7X -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.3/jq-linux-x86_64.asc000066400000000000000000000014631501676513100172170ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzhxAAoJEK8ZBAxxUjQCb2EP/08Lgfoc0rDv5IirCjXIFWxM 8C56aVfaF/8gaG75SuN3QUVBuWx3VB60Cgh/msTFrZ/jkWr+tYArNzwNAjI8a9T8 nE40SJH3kvwVrr9ALSgk9fEvikfZVKwYTc0k4h1hBataE5Z+7Di7VYPUmdLTd/ih dcJfDe6zPcYmaW6fl0glP2GLaDuLI3vxAid0MzDS1RU52z+usc/fjXWmaJwPVp76 Sd8/Uz3X6ZiFwpkfhp6XTcqkQhMZd4GS9cjnPAdRp9HFLI7S2UJ4RNj/YQIHrhQL 5Ko3KdXEWeSvD8wcr8VcZ66NfmyCls0diEU+TUv1I7VmLzVQGx9/4/uVWpfxry9D 8MLEHEJTTDT5W3hX47g29JRFJzv8PUyugkpXjQrpSoFbe/3vRxZeQNO9rjTx9t3x hdkWIjbwTg8SGH0XK+UNfR50A3VlrlPDpW5Ju2Io7/OuKRWN4i6ktFx0akFMmHUV D5u/FhEux7kJCNHnF7a7YJ1Ys4OSPUzoH3z35zhyVcW+iiX7KIKHNamWaPBw3iYa MwYVKHT6NUQiVQbTZvWJZXGArEnwq/z6jAjRQNKoTjbcVoYJunY/DZcJjnRIux9T yYnTa7IbpWZmWZWQfnb8zuSoXnhaSHZItIeUklH4K03xjpEXW7pGPLPznyDoBQeC 1WVcwpviS/Y24eSmmxaA =MlHu -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.3/jq-osx-x86.asc000066400000000000000000000014631501676513100163600ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzh+AAoJEK8ZBAxxUjQCyb4QALrsqZ/QkI2a/uVPnwAh22B4 mtbplxOS8swCB4g56tG+JMuria9l1ACmpbc9eTJ/Q9z9LLwq3vBkpy0utAQp/iAQ ijZbTG7E3S/LtOzZ5MSbkGeyuDWu4YCI7DuxTZH+R43fiA/ShHUHf7rO/vofAjTu MZr7TpBRjut5htbkNrUKoYjK97hehvY0S3h1oqMSSuHS4Em9xMvv5bAsEn37+L3g o5Y5kHQ55Lu3qH1Uk87VMz+gtO4pxN+ZrNNrY2lX/hwnV7p5YDza2H0uOopBrTi4 X99x9JzdHoSrySRwS1ZDc+XYDgXP7JO9qDmNh18nXJlyCWFzDHajQS+4Hn0O5zM0 PHWasVC8tmxT0XXZlG1kPuaCkg0BFh1NXNjCUa7Ru9XHfOkaW4TyKGQa3eboyx56 q7MDvODUd3JSW4xmLJ7NFSYRCPMRiCMorQ8u8afy2OWt2W13M8OIH378dMcFoubW GB00i127dhuI95lwNsTV1seKO59bMbAJjP7ITqqDiOafg6AmTric6BJNakSsrc66 yCzhOfxqwfeRekPSirrf8nv9D7dW45yLEiXn9Irn+KghdL4KCLCB8dyc6OalITVF c01SK5xNzPRfFVzTqMdmi/dYpDL0KSMwg3O3DhPQ0LrRZDXKXj6A4KGAthpVLmRr IHj2hlGlr4hqLXUU1wE5 =I3PU -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.3/jq-osx-x86_64.asc000066400000000000000000000014631501676513100166710ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGziCAAoJEK8ZBAxxUjQCkGcQAMpxoK6aHzDIeVjp5kQ4MOFu dOE0xjXlPpudUfUORKqfsnPvvxJTvqlDrUhMq6d6S1Eic9ZAbfpmHGbw02tvQ7+4 hvyy/KbfBUcLZRIwZ1eej/rFUXd2fmxPwoj07SpTOgjKF+8duUzSlxBg+Kes77pj ZuMO3KUa3isaOp+kufh0+miAqHisEWzQWCfHBrVIwW63L2bf2ZSUvp4JqwfRKfr2 3hBfoll0M+iaLHr4/wGUIxRL+23afTtvQikyOXzB3rKXf+QmDePZ29isZVg94yi4 /XiDVmDM/6GpfI7u0fIoDcEgH+LE35HL/CT4zA8IzA/QwB5bCO1bPEA7DfDQq01R oghTvH5Qu0eu8tjap7EXAmch25nPys4NzPoIRnbu4i4wQUsFqGzmSFKEuU6pwDIm lsEBPbHRcGcaui2KidUNi7iQmje819KgRDhRxX65Bye9sKsD/HvMzQRce1RFYQg3 uqISuhWu8qj67J/ii2zFF+lo5HgHLqzXKcye1kY5KYq2dTIa3khq89Xkf3trsnNL IKZ+8P2eiVDjDr3UPIvVCX1JvNTdcQDMUlmoKk8g1qwuTp2PTi+c6FKicZGUMMnv o/hThK2JwnL/Iv0bJHvBU6aCXSnKLTLIdT02UvUppiN/GTMHsagvE0DRA1B1yFim /o/n4edysfzI1Pxe0b3c =ZOqW -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.3/jq-win32.exe.asc000066400000000000000000000014631501676513100166460ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGziHAAoJEK8ZBAxxUjQCG6cP/RNQd9g+Te+fgpFvnFDhAVyW EKZ+2B+V64m4GzrRFnGwBMqju4kFf0dZ4craagJ2gLVQ74FhvorMtphjX0MYgxtt wXyIqImlBake3GEkjUI6XW8QmlFmPix7+2fG4oEdLHwgE2/ii1DFlhTQgYYwH+Be z6wo6Nfl9OxykEHG1hl0A4AiHT1ubWogbjD87yZRO2M1rp2nHJu1TujqkjwWLXtr 0xVBSgtutfYRBvpPGhtLb4nqzkeW+lFW99A2aUo1KroyBdcrEKTJ4XMRqjYJLkSN 68e4gZqHmR6M1nA4h81bU26lhrN3LbYiOwBu67N5PnSOQE87zFPK6Dac4QyG7vzt pR2xht0QwwraxOeIrMrKs9vhUOKm9RDpNcD3z1xa+k6Qej+nP8A2zmMvUz3+C8F9 ITESyjk/28Eku5jEUs5Niz/znGvuU3A2fk/qHs7U0I8tvNWsxj29GCTzgPDoH3Vs sJKuSozoSqecBf+2x23PnGjGttL6BK6lo762qeVw6npCi/nqGFbMWpuopgJ2PiNP t2RdNzvX7v1V7ZfBOGl5iAeG/XJ18uD+hplCiUePN7Jv/3bpaJ9jlo//kIwddUP2 p89zfLPjeptAIxvkWph4ZL59pj7zsid7rSMd0WIOOqE61PKpl5jBgrdiBgKbcmJe AIRZewlOq/0l0cVtK10b =3nBK -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.3/jq-win64.exe.asc000066400000000000000000000014631501676513100166530ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGziKAAoJEK8ZBAxxUjQCP14P/jkKiLUgiZkXYVQs+hBJqJD2 rOsHVGmoxpjnQ8L9gUSxfZ0E80+1iTx/9JNWHs0xEKrvWKmCovfuQd8xfxZ30g5z wMa/7QWZtLdfIGkQje79WgA/+xDWSLa0T+dbcMjCwDdYPQyQE5Vf0I7qoNOj2Dcr CmkSMO6dtoilv/o2WX1x8Z1K5sqGMl64WyM5yR8sEMRBVuVqWRvELrv9+YMW2UYU yXj7tFwulyqZEoUBLlUxZhr7gjah31gBP2qqLeZhq/phdUsi9ckPusW3Un5SMaRf xEPo+y83Qrpusm9UDGsm3t90TWva3oMiExjFatFKuKvLbFCZRK0EIqdUOUMlptV6 kS3xKsvAq+vM53FfwcWx/9gcZQv5XTw7McmWZ9vZmHH24AUjuFFFZLoWxPg73Vek HaD5xTsxfYEqGRaJbYoSkSs39fw+tH0ajRoMVcZw2O2c94qAgzR/Qne9t2nQ0ypg hOzsIIdIxj9XZShkkVmlK8naf0YH0Wc3Yo3wBxkTy7QKVWtcF+x67wth2XjKHBbh lh9Gc3R/CUvRhk9gOSqHYAsy7lEIpFGjuIqYTZcXRO3BCJgjc3hV9jBiIy1iQWGg Kuh+egThw8U9z3PueP++yVjImze9Y/+78dc/rHAwXkFIysBs6vle/9ILDl5Komvv 91rFNBLkjvmJoRw4hUpG =WNFH -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.3/sha256sum.txt000066400000000000000000000007341501676513100163220ustar00rootroot00000000000000cf4b0b3e505958843375ac153d84ad6ee40196aa76ee373b0409f858b3cbf925 jq-linux-x86 dbacac81ebc00a7387e4c5e539a7a475981a1ac6ada20a2f6b1d8f950027751e jq-linux-x86_64 4095a48b50b754c8b3199b9c069fa9c3da0e737d8809af3205d1bf69f87cab6e jq-osx-x86 bce52800c943ff10d1ffd9c1a7e7aeddbc7bcecd7a2b05c6afb828399dbfa39f jq-osx-x86_64 c8e2ffb5b0536a50430ef9b4708a40686e4352db5c01ae90a98ba96660e5bc36 jq-win32.exe d041fdfd8b3aa3832eedf2aafad5002f2b47fb59373b71190a01422de825911f jq-win64.exe jq-jq-1.8.0/sig/v1.4/000077500000000000000000000000001501676513100140215ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.4/jq-linux-x86.asc000066400000000000000000000014631501676513100167070ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzjvAAoJEK8ZBAxxUjQC5KsQAMt1IwBrIn8dvTe44djO3QYk H/qaNSRgChJI81GA+B4suTcgh+PUJcHF1EWls7CCfjfp1haocikXpNSuY7mF+43M SMdz2ZA4+N542ratUTv7YlG/igIvz6IbDysjowU3QQsCcjthmO6OF/6fd2qRhggB 3K80AMESOBBi7TkFTLw1G4M8uU6VvN+LWrG6fOcPXoRLlqShGzskDqxpobL1+o6J Cf56Z+ZVLQ6DPjW2pxK2R88788DjoJ4j53wsBqzgnHMeGzWVzvQ836rYSD4dhpSn YopiAesAYLu0hJszHbJrigt/jUGsNekQ+/ihqGXhbtDVjpYLU7At42b2w2AgjNSK GFBJmICTQZapz4o/lCCli82PngGmIVqgf6fc7qZq+HHtrcBeNYjMHMPMJroGqanJ DhCnLmE1906RpJ3VvCM5Sd9lSQQpSVzmFAh5MMnprxvsAmDbL+Ty//a/cOU4WPAJ MgXH2REmeByg8EX6SPhtshxxdIQf0CX4uh2r1aHQFtg/sNPL/EWGcRq+DVbaz/8R TJCfu9Ov0GhJlZSMHbkN9cvrjeE5CNM+7Q66JbhOMp7uOo4I9+JyknNJP7L0Nvot IcC6qsw8jMINHexW3RSDbX6b2S+0BskojAxp6IYHv0y82aaJ5I3+4UD3A5+Q34iM g1kqYu4WnPOZ+cihvGKO =8ZEt -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/jq-linux-x86_64.asc000066400000000000000000000014631501676513100172200ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzjzAAoJEK8ZBAxxUjQCTVwQAKoTbAddyfciZzgaxSWqc0Yz f9njjvPHRtUfa0X5lDQghlpTrDY2CxqU71KknLgxW4VpnErf13KlVoMBvGJwCmU5 JcO2aE3iQDxpf6GnYa57caSsj2pR5Fi+/5nvxr2ovoCzGea3k61j7G+GV+znccAr K3c+03aq7p1LGfsqQSGPGH/nLnrqtcFonNVPxsaBuFpGMpaP4DuI+zhd5bGGo4g4 k23mWbOee/SEdYgiMNtVnkoQMZmSdae9O8VuTMoTSv8R2aLmDTrrLa/3z8m7rQAe rGQkaHhRg/fH6gLgBGJe7enqDgbNCmKp+zxfI6p5RbFvs5oH+M/wV1edG2KFUpI+ fv79Aj5XTVinNSCewrJLVHkzd328KhAeXzm319wJ0Q2sRbvO/3rhqslkRPCW9Uan uxo5dLMYqfzksy2Cwhv+c9r7Xfi7tjKidPLbwdz620eERquXSx7+kZLQyOw/mx6O ufnZKMDfhxZXt/KkNzraqkYKvZ6eO7r270ao7tdSZLDC+zELMGzIXINkOPXQDA0x m3Zz97jmfMQ6JwWU/1jCIOs+CpMueBYw3VyyqKNAUvYIjkw9A6SZFYhwcTc9k0Xh 0XSGZNjiKxTe1UJdBXG/nwNb6p5rMWwyesbiqvWiCIQ6aBX6SluODZsd4479bcVb 1fYsg+Lu9V7FiGY7ZlCz =oGfI -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/jq-osx-x86.asc000066400000000000000000000014631501676513100163610ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzjzAAoJEK8ZBAxxUjQCmKQQAIei/vszKSXY7gyirM1FmUEO jPEzjHPJvYOEIw06/I9Jkn8ufsTQYtP+S19C8kGLRcZIonlXZxqQmbYQUv02NqEn UDRlCxiQZiGLO6i54vBWi5VhB4VNWgEbrctQ6oR+mV6MXs7RZo+2SGEJT+r4z8om HpFGQkfdfwNRbAXkIDHCx259pzL1gy/YrWV/8F0VdAH70dmqidWCQ4Lt+oymUhno 0f9gBOwIFZJXJRhhGz8unHk9XHdDlrpdvEb5XpuU1Alvt3BKa8vJslbTY48a+nI8 3XsfQhAXItAhUIWHTq1dnqmJzDvFzkZVEQQ2Zt+e7HsA9TG4StLCaYCIorUp7fbo BbxS6I9TUCbp5YBa2EHiq65/jNBlRz8+GB1cjZ3oCTpQQUTd2pFR/fdXXKxvKerr 5Gxc2CZqaOGW30iLwvtowNt5y34nf33WCTtBAPpY44aD3TkFkHcQq0hnZQI9gpV3 eB5uUoLrr3znLVIs3IX4B2/L0cKP+Dbal7iDQ5nsmEHGBy5P3yOgLbHUg80pG+lX b2wQMTCyTrl/lahJY/0n2r31yBgmHHMBNmY0dWLsXwzemh4TlVQ6IiFl1rF1PPQC F7bhTHQh1/DrhW94C/uFU83O0LveTb/U0FobAMCMgrd9Ew3C+gwXOKP96DHx6mmY ldHhiLTbmjLbfiDMaWw4 =dzyb -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/jq-osx-x86_64.asc000066400000000000000000000014631501676513100166720ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzj0AAoJEK8ZBAxxUjQCeTYP/jt8hRyHNKtFfahjW50EcAab nSqUr5VXz80BL6vSrvixMoffv1RDFuzEZgFlYZGXErXjK7Rpo3NAE+e7EUH5vbgk kJaZjzGfw8Kx0ZCZFlmDmI5U93xYiSeIPPP8jaUEg/Al01CH/Y584bgNjyxi3zC5 RKO+/HTYd7KR5jAWNzKqV3tGvXJdi+a7Msw65OiJLRoVFX4ps/CGaI8Dh+vbbPi4 zPjG2DChoMdaRNxjQNcj/FW7M53rXIUHbXAmR1jDOSsTk16V3kX0eX9RSBsgTkjn b6/BrXnTMmTJR1osHIznuzuQ0sB84+k5CF1ZBwqYjmIr697qEl7r+bWODCN7NcJ+ Lo8re6lTAJZBqy7IKgPb6lwFg2tqd2P7UCv0Qx6dLUQGzqeUBDv5GDR5DjTQ1LqV CpyZbOFkA4UaKbmTp+DOGE5TV2D/hzUAcX/HzEo3RVAKSJIutlcxHpMyIazZbRQr RWNU4GiNr0Sbpl00oa6GU7OO/d+j+BFcEKrJ8Ud6zv0M4OCFkP0FW5CKxbl0aql2 y8cxcrdMmUhMwn/Jv7pX/N4Hqa4Jjzyy719LKRXp9yjtXV/AnEY2aQQqR+I1Q3VN DBvw7qLJe2hzQhacwOGDNHc7L5JgOC49wDw7L7MNlBGHPdEGKDMdEc/k+Nn/VnOU l2JS9gVb1lP3p1TPKSIG =PKfI -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/jq-solaris11-32.asc000066400000000000000000000014631501676513100171650ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzj1AAoJEK8ZBAxxUjQC7PUP/3J4uNx0zpw4SlnB+yBzrKqn Zk2JahOg8wWRFbMACjMAjTMGmi9vYlLQRjesdi9WdvvlD1iW12Pi9ogA8OzFRkH+ A6It1g74k63WVtyfNHfLTeh2euQsLUc1UJZ+36FPs7lxZPsJmAL4kB1M6aHy3w/K aZT+h4iZhFeC3/JFvLhd2j6/RDf+FkAiEbRlSXoNmeBTLnNo82liEinZFUvEsglO EIVyPBGp3mtlBE8sf6WGd57IpxV4bl1mXZAap1xPVpK8hrjwXS5t2midd11ENBmK UeKcvZpmFb6qLTiep9kaUljB6nOzTYyhg6S9gaJAUDl6Wam7gtBFTIMmndoGiwQO NV+Lsj3dVFz+7kO+sZx/acC0PXfnMO2o6zBTva1RpDoHJFLmKTnPDbUFl0rZtMB9 R+HBlqRR35PWKWC3ggYPzfU5bZOVp8G97WFJlKkf5hMWzKiNoiR4hAM6IZYn1rGB S31YKV1yvLIcI4mbhogBlfvXEcgqkQt4cZip16qqpy+X5n1zEA/w6cXcpushbhpf 8G6b27PysLT/u5wViSPklpN7x/SbS4rVGzLGPvN7hYR3FgaPqADDrkZYZEIpl6Zd +Gj1M4YjcSDwInnBeaSA+n41Cg9hbudM5R2cdyZzcViLgebnjyt80H+03TDRi/aT dGs6zbsjUQWFGqP+FpgT =bERX -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/jq-solaris11-64.asc000066400000000000000000000014631501676513100171720ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzj1AAoJEK8ZBAxxUjQCZ9UQAIlJSA4wU8lFakjVI1QfJ8AA v0FUY8KPmk2RgSHzeCRZaWuA0FJAOVNmJtW7kKT1Zg4iJ2f8enX+6QTRbWO5pges 6Ib8CltoSa1yS/RZOecyn4LtmJEkh22mhuOJdPzf7+6UmSGaMhE8yep5wg63i+GA o9vaQvllmiReR7qOjvI9cFYTdy/4iX+Nf4TBQPSJPBcXtwtH+iq72IzizgPo7fFd YoLz3V55DlAWBJsyMhVF4rgWcBcCOcMOwaZ/AsKVcKE7+NiPfFsZw0qqtBKAkYBP mKDheZmbX43rDp9Un17w3JbZZ6Uj7nglPpE8SVk9tlJJhznCmFg1ls8vdzkwjkht Cr8IlnFT8ZS3i7w9CLO8nCLuMYY2UECre/wELY915fwRGY+fP3EinO65/xBWxUdl zsq3DchIxKDorD3OiAduZIqC1ZW3XSSsiXzs2+PJwzW5ryvLxGSptVTTr35qVDdo 0igUW41pdwV1Mnltncah1+NOAWcSQzXx2E4dtPmGjEcTXSsGvt1vqTZtfFL60GKs nwONhA+mK/eMOjZ+rtJhHecpqB2moTixToq2RkOWmIhToq9jLWpOnswrUklIj5pC yxkdCU/OZDTYYU+AMXlGSQoiXems5typ+/oJsKVGPGHt6XkC+WTIX6Si1N4q7CFN 8qiYRPH8G2A1QOv5uj6L =+6XW -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/jq-win32.exe.asc000066400000000000000000000014631501676513100166470ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzj2AAoJEK8ZBAxxUjQCJygQAJfXI0fZjCgdicjtwN2RbKP4 nLpao2BLcEkHQFmbCZXKQzy/oAGBR5xupoDbIFShum7ZEYe88Bn5W1LrKa8ELJ1C 5EQGzEsxRe5jT6YsdAJfjjEIZiDL0U6HtSq2U08iNOIIuSC6sI0FElotMUOKYqKf oExRULIkDVfYKBQEmbbUEi/gJ0d6kD8AT0ts7VQU0Ad3jCZnDnFGLZvk4XCiL9wY OIjqmA/okDHuuD4+lgexiABxgYYtJFDIIunk02LPJ6R/S5Qn7mou+HgqBJo2g16P CFwTf+f/MxBNjQOhGJtS297tAJWjjRlkZyUOraYFa0eos8Drc9PpwjJyjgyuMiPt lvFa/Lx9kwnotP8cuzZV1GY7SV60NcItIKyeoTK1QNv/Qw6DeXJ8txSGOqo8x+bV LJxLRXNHseY6+C0/1WJCIz0PF4wt7tAXmqpA9wRBJWKRaLaLnshhDMDRR18d0Ejw /4oggqNc2S1J+lF5ziUyGYyL8HjtX4ngghMhvvWlmH+UDGQlwUA/R8G/u/ESHUXU bebc9bHbo9b5TAolkCbmb8/tT+ZFTZ7oAexYgOjsv9auB82ggMTlKnN0SJag7wUy owPgSReGONDlFJ3JKWL4HLvJT/UFvqV0dnbHMmlKlebvre9v3B1sV9hl1R5Sl5du T0dL3Ha3NTeppVXq+HRr =wUMJ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/jq-win64.exe.asc000066400000000000000000000014631501676513100166540ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzj2AAoJEK8ZBAxxUjQCao4QALTCDd7W7SZ8tyVNSmOsILmi 7OcRdEdw3WNEpIXhYIo/NX1Sddtq1KgzHAgRb1tR3imB4UwVQfxD2olgIgoJTaMj P5jnRBIK98ht4iPXFkFmz3zOCBHSH/pXTy0jMjG0uC9czT2OWMlazA+brqaMI6oD JtgJEPIK1HfRdv0EfYCToj5LLi6iz4PVukk7i+8dqW/xFt1Lqny2ehggBFaIpG5D FAuuDbvnmzHODy7xpzPnRgBttpo6bIsQriVHrw81IWyhQJOKefjdiETB6N84+Lox ylgvk4Y5JiIrFVSoQGxbo3FlFth0CZlLSE8GuNSekAqYd+TjPIgtBmaHPuQc00sy CSw+NuaOkhq3y+rSkJgr5b04KDfvDhce2vF9maXtVPVEQ/r62WXNuCUoBVyift1J ViA+Ko9RISDlypHQBUj9KaWAUxTe14pKkaVggkrbM5c1+fvmjxr+FAZVSrnz8EOF K0J2834mNKNZWTo36NZ033BzoWE40HtSG+iDo6vGXNbAp8pFdRrjSaBO+Lklw6o4 uMixmPDABielcUIaZiu23vW2qzOhuEIav5d7lu72XI+8ZdHrUymwra3EAs9Mmg7i 0NPAwMHOPjdliswo8rp2hY7Shd7oMyNqxWj8BaPLCsxl82ofoPAtTcI4HCW2JXt4 u2hOqXKZ5LihwcfgQHpO =By7M -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.4/sha256sum.txt000066400000000000000000000013201501676513100163130ustar00rootroot00000000000000998c41babeb57b4304e65b4eb73094279b3ab1e63801b6b4bddd487ce009b39d jq-1.4.tar.gz 1dee4bd2516f699723f373b2629c9173ce123b92c3a72520d0e25fcd8e3df45c jq-linux-x86 b9b63aa4b3cc85df8bdca884effb69d66e9ebd717454a9e212d9423ffe3e955f jq-linux-x86_64 6ab184edfa04d6f662a696d8594f19532ed78bc6fd05acf4cf506e789914300f jq-osx-x86 335a99a68eb9a1ecacfc947550003f103cfed627d3116c8bcae9ac11dd26d337 jq-osx-x86_64 2c1382b65a91fa27f2b9373331684de1e4ca577abeb724c3c79f4733af89b854 jq-solaris11-32 da5e4ab2879022f365b77b9babbcfbc01f30a98b884a31120031e218d676ac71 jq-solaris11-64 e08ca23dc637e8c0fe1577f592a9367e036f5b3f4c10b189c53943b0c8868866 jq-win32.exe 1c96fd65fd60763b92a28c7ee1290eeb974bc69b71b963d0e45cbfca1625565e jq-win64.exe jq-jq-1.8.0/sig/v1.5/000077500000000000000000000000001501676513100140225ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.5/jq-linux32-no-oniguruma.asc000066400000000000000000000014631501676513100210500ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzltAAoJEK8ZBAxxUjQCbHIQAMU3mjBvi24X5CfTkyOmDOb9 sxxsuTOiH8Zjiy+5NP7a1YLDD/yznLmuu4fm+XzCE8DYdzkq57jSyjr8rqN5poTM bk3+9P/Jf0Kae+tpTP8mjvtJ6bVPweV/Zg+m8YwE6/iUHQHi00AyQ6/obfXx7otn X9k2IIJATAvR7WJ+5+Uc390MkVNNvuINfuuLWdSPdIbwFf9lvZ2ZmwanrWo6Gzdr /TW3MCwZjWjENGQBYNTJwswTdWww5Mo7MrEK/eHEy4DlozJyyzwe5xsWRz+ERKSJ CXe3+DTSVoc4DVuFEhU3T+7jU+Fev0FOqLlu0jD64Ma7epk8/gP/gzzV8JmkX1tV xwqZAdlPl+wNs1ZQw+9dsTZiRIT/qQBxa4y7bunnjkxaSa2ovTz6EUaioeUk62z2 e6zXNh92ZfjNKJT8An0Diq8i1P5EDH3dBHX3+2b9Qc15SFXE8vdXLqjIvTzwZ7hw fkxF37eMPfc527YKvktVUuXKkx458ossrHaYdcFnVh+etl6T/hQASE8Kp5rgVd/g 5/P6/JrkrY3JTHM8qVC74YLqQh/w3xaiBzcz+za255EcKwU3qb8G0iPJ6i30yvCC l/Hj2IREDHyogPefgq8PYah5RvVXbiWJ/UKz+qm/vinm1DUU23F18Ezakxd0Q726 Ok76sclCtAR8SCEu/3eU =fBEA -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5/jq-linux32.asc000066400000000000000000000014631501676513100164320ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWKaLsAAoJEK8ZBAxxUjQCv7UQAIEPihgkz3swMhxQVsRSd/dy d8sQMup6KFP3jAOABLSYyi6MrmCZhejodNd276ydxSgB/6rPClPZC6kSQsrv8fyj 2CSaQOv1cItzPSObL39xNHAoj8LOkSbb+4jultfbntWU8iuAaBzrKc6jH9VR6zgJ YfeQun2LI8AqqBK0nClSwXLXFcjxmzR7KDwX5EPeBQdM1uG0iHO+CsZWKjC+pHPy WkNqOubVpo1zFFx6pTFmDNraPOxdLvMVMZ7fuHBbdv95NEi31CE4cmQzIhLd6BbX 0xrOfT5xsib/uqlyhtUMjcqdrVcex8hptdsxrh5w9cZyhAinmpIEt59yS7Sbcg1m Cs6EdXJjjRGk5KVlyjuZJYOZxtCmdOYrLZVp7Nv2swIrUebkqWnXUAQk7Jdu8XmV 2UzkhFvlWaTVb4dJ5s1zb6C9Yv9hqACsjXzM3vstcu2tiGmaH/TGCggqmubn72Ag Ok+YdhveZxnL8iF2odz7IdpC+kC/vVfCY9ndHv3Sf3i6uLuohuT2x45R3iz8GIMI ZuexdQGz/69blhw+ZsqVpxodgZIqnCOwIk2nTkrLOw2cJbtlDWh1s/9udW+nMmPJ Z2lzSP5A9jJzMCnkb5104LdpyqbGcUO016Tn1OKyLQNssViKlV/kcP/jZ4T0vuPI NIP2sEDPJQFBmsBmFR4B =f2Mr -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5/jq-linux64.asc000066400000000000000000000014631501676513100164370ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlxAAoJEK8ZBAxxUjQCFqIQAL2JdiZNp9GZm+SK115N5Twz mjI66fKWg+1ckSfiCdYwSzg0u7AFSECy+S8vq9WzSKsvIptGPJokIehnIrwpuw+l s7sfDA585XkRxpVoEwAdPalTRqXvmku8Sc4P1519K2DZDvtvWPY3N+tWIRE9jfcW 04KDTuWB35N8e+Mgg8z9P0NJiDanP6SUHp4r8Pc7KFQ/gOK4HKq9dFa3nsmkAq25 XJTFYPS6VU5tj/ZyTPNtMh1Nb0vp7+qeXGV+pBMwohmNoBFUyx65olwegD+dSswb Cfh59P+aWec7V6exJq7EW7ptIaZzp1LeoPfcABDjSOTEeez6ywIcsPnmfIjAh98e WovH2iiWH9XvLT6EC7gUcdlMJtvz46OkXilQAo0rK3X3pFX0T2aSqp/afdPtIvpK bErpQKt65XNsRprBkBlM1Jo6K7Cwh/SYKlbSJuvYvieORQ9w+0oqmYRCk7MZ7OOG Nxz3yEvEnzQPaXnSnJ/cK0xb9Yjj72LRV3Ors+ni9HfLm14xN7zBx+g6rudf9hy1 UFcvrxJSRFP5bZZxorWc6busisRi5E9sRQm/kGlTUUbrJrV1iae7h7s7+OqnY3aG H2lF4Gfb1eVsltQZ3DCRNiBiTD+3cmzEayD0ktHRnubOQCc331RoEwSNBsV02rkH 2ZijCFT/AmHOl/fqmX86 =b++s -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5/jq-osx-amd64.asc000066400000000000000000000014631501676513100166500ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlyAAoJEK8ZBAxxUjQCiLMQAKBpyaj6un1mLebzt4JDQmEf qzzYK/q5RLS0vGzcYAl/ylBPdbBv6j7oT2JfPA9YfZaUPOd5O6eqk6R8OVrEipNe kvfIMnzk5joo+LDomdZvOhv6A0f/Q6eKnlr8k36INQxtbQA/xzUAuQthoo5Xn5ze d7lEHcWCpyaRne3dC5W642qG6X1hUN27lfx4MRHfSvFsSS4YIyPQHPiKPkQ9BzyZ p2XmWLwNSQRaVQU/fG8LbcRFeu7CBIFlQ0IvRfARNvJGFO+Eu6JDNZg+w8b1GL4O Td3rEb5tiJ1LEZxe2HDUV/b7/k2BywrRGnMbLFbohtyr2BmFCAzqy6UySNA/DU3H 5owLGNw0F3tWHg9yqGkTMcMTp0nfIbNKbjQcfSWKO+9gkoNyn+o78ggerRJAAt0U 0vcoLbfTMBTRfxNHaRB0dd3YxbkHvr3tAY9A1sqkBGB0SJoZ6WkLsso2tBsivq/X K9x4pXY15LSKu8opFJ1PY82Ng2FdRlkYs1CDNB5IM52mp5IAgmxGzHCy4S/XRBCq i0RSwg5xwCRllqmfRkgHQDFT8lKOLwMnLrzqQVsBneddvT//A13pHAI+vsloHbiB PwNgEdbvFVrxMaY8ampzQZ7vw15qOGcmGTJolIEhPdxvP9J9zTcf5nzF4WSJPdMC IF2dukcTW+c/C37F5nQu =+j1U -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5/jq-win32.exe.asc000066400000000000000000000014631501676513100166500ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlyAAoJEK8ZBAxxUjQCopgQAIII75ovkAQmCS2aU5Ph2Yfk xLj40CVL7KThOWcfqKYy2Sv4+QV2dIjx14Uni/4w/dVGG0shtw1teUlfotBczR88 iyWvSVavbJLlyHESN7z4M4uApHikncNDlFJm/CuQWSVkGhtWvZZzJdoS/prypfai 1+sjtiDidNTZEJj5nfkvZ90UKpzNPJD8RGpsN5qvGyVnIYmXWZ1xe4pwKiNaUthJ 0wUBUcisTruZWCdSkV5cQMvb23sH8Qt+OZYgxJvx0Eq3+fG7Bh1J4YJLluMB1cSQ lqpOn7yJ4VptkgYeXoPMhbvN3I1/t+w43fL2P4jo5YTYuyVjxkS+VhEIGOgl7khN P0zzc1fdUw857dTP1/gXHTgMq3mWVAoQZnqcZEl1wnM155i+PYuN2kG0N2q4nt3p oQd58tZD/KmCV+QTegtt/gpavztxqWr6aagI+UynBfVKaOxY6AB+0+1oaQTX6iYK iqCqbhDi6ak8e7sXflAKrMhlnA4X+XCINdSwnYR96t/JY9tMFDiDapvbfgzdCi/D +0v7S8G0cu4pEjQw8rcotoPU2qF9cjMpmi2RsFDHpGsLv5r7avz5jDFxu9yEVMMd sp85aDh09bZfBACY4+t9m1AHCZO5LbkLremHv+nHA8ds/wiMmcCmRIgJQKvOA5l+ C/380YfJeepNvCnoIpr1 =NVrs -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5/jq-win64.exe.asc000066400000000000000000000014631501676513100166550ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIbBAABAgAGBQJWGzlzAAoJEK8ZBAxxUjQCW1AP9j8jyZcTFFzBAqLbxrn5Ljbj 6VXIDrutvXqcL1/KiPt2zT0deAqh08yCZh0RIQuq/o86nOXKumcK1E1jIcZPQ0p0 g3Pik4yvnJo7HCrJzzOXatfb9PokTEmM1Vo7qrJvQ1DPC8PyCS+fd2BLV4km2Uvp IMF3Wsa1nfRlcb/6Xmq/QJDhOG8MoIJ6Ldo+nFlCDqvKzGpQmmGo1gj3x32LkTUE aA8wtZ4RsCSEY959w5NVxhcX6H0iv0yzGtpOPRwaOOmymxuA0w7035P9TDrGExhU t3tMiTBWLucJgHPYH8XunBKjVzFDj8TT7gOq18MzuCJxUhPaJZZWAndFxQ8rxgNA ZUzmOpaX95DuRF9a5SMP8OpAOCOsM0lySCyJGWLoQ0Su55uaThLOVaDqBmXF13IU lviJ0DWPzDTPZ1Tn77kwhAWXglcsE6S2pBhkLID76kW2GtXVhatBPls0mE2Oe0AS p69dW/ynDuXyf0UjpcIH9UPVwsmXPX5LXztAh/2r6raW6VdnvGCjb2dWmPgFJP38 HuIKPnx6F3MeNSwKHlky3xfe7X4GNiciwTqbd6EEeIHGHMDbKSA91tuhbiBDGulC f+lGNWXPZTN+zqbUaDAArLno3vg+vQKhvvkdwfRhFYYqeFJwdKGXo5aEH5g/t/n0 8sewgmHKqlUa73LzABM= =WcIy -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5/sha256sum.txt000066400000000000000000000010441501676513100163170ustar00rootroot00000000000000c4d2bfec6436341113419debf479d833692cc5cdab7eb0326b5a4d4fbe9f493c jq-1.5.tar.gz 77c2e4dd9e92c58a662582a24109330a8a94562c50c52f837f59122a951b4ffd jq-1.5.zip 264118228c08abf4db8d9e907b9638914f3eadb5cd50dc1471a84463f7991be0 jq-linux32 c6b3a7d7d3e7b70c6f51b706a3b90bd01833846c54d32ca32f0027f00226ff6d jq-linux64 386e92c982a56fe4851468d7a931dfca29560cee306a0e66c6a1bd4065d3dac5 jq-osx-amd64 1860c77bc2816b74f91705b84c7fa0dad3a062b355f021aa8c8e427e388e23fc jq-win32.exe ebecd840ba47efbf66822868178cc721a151060937f7ac406e3d31bd015bde94 jq-win64.exe jq-jq-1.8.0/sig/v1.5rc1/000077500000000000000000000000001501676513100144305ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.5rc1/jq-linux-x86_64-static.asc000066400000000000000000000014631501676513100211140ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzk2AAoJEK8ZBAxxUjQCJ8cQAJJQoCwUiFf5MHqGHGaSC07L bKyvm2OmSzVscld2lb7MsTHRUJ3RR613CpuYsNEG/nVbtaUntzgmtyMWabuGap0I QRQb08by5wP5Mve7QCOxfO9o56k/m2MJluMFv2xdJrfbLBlJuffV8rTWCNSNFpaD MLTiMnSx0APGxEoN34wOZ7ZDL6yIb+7z3Ip9P8lni4f3B+fJGCwKr9Sr5NztZVGL fDwfTBDLHwgpPvXlddg+oEDqVoSodWW9LZYKVo3q0IrT1nI4TdCsc1Fautpz7Y31 J2rcZR5qwE9jy+fkm3+vX9Hbg/QlND07ZX21bJh1suE+1ggELrVwh1iCEfBIVEZN 3tat62QUePL5ymAaElbeX5nIxuNW8U5jP5fjtVu2uEZKRdPz0I1JcGzILi479TCK /AcBhoXvdvd6sXjqgNs8ZbNBoklNqwrbLw1ESzwzaGfKytvMIO8rN8E26CO82d0v 3gob2Bc9KE6+hdobdax/SdXzjdAsyL4fDezRQGk1LvLV3I5rLs6cdR2HRjbH2uFU auNQgDLTo1PAYgsTDvDUt61O6K1m2Fx4RZgc6pligHDxlcvPJw+DkSsU+QRD0ODk 2IYhdakVFOaG+OMcCfcLFJ/3mJnhmFl/VQVdLlrELy5r6NaQo7bkLL1asU9LJLlL N5ZHYSx7HvRCAz++hd3r =GYEt -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc1/jq-win32.exe.asc000066400000000000000000000014631501676513100172560ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzk5AAoJEK8ZBAxxUjQCJZ8QAIlRnnKW3A6yLpAGSNsQ/Rm1 34ElcCgwwGsQFaBz7ZjzYPwFNmbrQYi4uJA14Sh0MAWgJiIfjJs+nS2YiC/6etdh uCEg4NdYtF6kPlBMQ1MJN1+OLv7ACst3kajezpoCHraEQkcFgF4CSTq2zBVeSltp QxVJkMn6CM308cbimWI+wB8z//28Sxer7KyeIbZ9Mjt0YGHYsxIeNhPtDNgVzutd 4lYGS/YRbRKrVKje/20BCmU7QnyGnWIZDx3A8ofhGbLUnKX80eBuHLWUkruGbyL7 KMuXPbKAyqtMiGRziqiqkvKRe+aQc+kvJVNUYORnV/nSBFYqqp9WpaZGy0VrXcVS szAiIxPFULeAPBiycaLyPrs2sANnbLSaK5OYc/OQl3fQd8K4HycHn7gWzTrsSiJ0 O2u7YpIZwhnJusZQFbvicU5TEnTnUs68PkBRjI/MJYGna5CrE0dhEjxQ7xfqHds4 daBHctNOo/v/Wx6cUOklpdygZK0l0DWdNNgf4u0ID/qrI/r+F2WYTMO9FTxuquID AnOcKJAnW/uoDx3eEl/Xf92Be1pvsBSU2gwJZ97UYXT1DKPdsoO8ubUNTjDL2BCL 7mVQShAasKvCB416kg2v0NqR83v2iLzfERbmyZhhR67WwjSi23r9UXPjgBGsux6h 0uohePJ5f76elv2W/8rO =4Qhb -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc1/jq-win64.exe.asc000066400000000000000000000014631501676513100172630ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzk6AAoJEK8ZBAxxUjQC2tMP/jitj5yEkh4PL/apImNJBZSd PPRWhOgdBvSV5kycstS3ni/sU2ZcHtf122BLonIJHJN0cL/jVZypJNIZ2gNTA4sn pi85vNuwhEKYfgMbLnVG03KoMtdjZ/kPSJn8UK+5ShEwm9HgbLbe1Pp7XQJW1nAG hdNT6ldqbyZ0j74r0yekN516VdpPPVp1R5rDVxcZMOKNeTbNlX4juEK+BsKvp1gT /SWxC6Y048ogMT1YnVySnh6Q1/2/riIhlw2u26Is4MHP9Dc7wxNyegTU6UU4uAXd Ejg81FpkhRZzF876ZOEfjlDsKLAYIEAYd5ozq/VpCA+rB30Y20tOCPuhilnuWQ53 9Le9ybgfJOGwloh3vfU3O9fbQKrL6TjA+crK/OmZvjSsyj2ef98vjWdFG8fhUr4f HVTnmJcg6R7WIBHxVnxfT9D3hIV0+l8qCWu3TtTlfdGcXqI0NcY7Exee6WbNdmkj 0nESSddP2nEb1eCEw9IlVliZevJYqwNaSmcN92EWTzJEwj9g7+yK0XWs+ZfDNTUD +iQoFY+W/skSfNr5XCyj2wlSElIHUlQtCVZvrnbRz/QmjZfUMTBdKkkVucDGvldy YyauXVEIvhFdeY59E2FzoZpdn7LzyzGbg2dA2QwGI7WB39L1QnLMrRPOmBwMJRvc JBQycWmsgKzAre48vKpD =LnUB -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc1/sha256sum.txt000066400000000000000000000005121501676513100167240ustar00rootroot000000000000005c33ac16152344893f596d2c9f256b6cee6e925e53718c94d24049b640ea955f jq-1.5rc1.tar.gz dfbb2d073d2df9ee0bec44b60bd81e213b7881b27fc38d7438daee9eded2b75e jq-linux-x86_64-static bc370e22a11c85c525ba1965760faa5273aa3cd0ae69b030de4091fc776538b2 jq-win32.exe 6fb6f39d847df57b481d36941216c770ccf5f97c36e5373a0c93e63b5506c9f8 jq-win64.exe jq-jq-1.8.0/sig/v1.5rc2/000077500000000000000000000000001501676513100144315ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.5rc2/jq-linux-x86.asc000066400000000000000000000014631501676513100173170ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlUAAoJEK8ZBAxxUjQC6acQAIREc1GPBwDiL3STKWVEUYC5 r+Cti+tWisdNGvAapCdGcwcavZ06PM3lMejBpQ5v2WghvsXhFvxDnwyQHKhbjIdG Uw3btu3ykjabHfqi5L5neQjFJwK//zsan59VSTzRWxjPHpAEoFsEihddKdx8kWzI KfPx1sn7ftO5weFcl0MU9ks9kbADJpviAvCk1mxKeNbv5KE9EYiUMjEg0kW6JmBM rIJoWc4fUR7rHbnK8fKpEuBzPLRBppFOG+ma7dx/4tCMjZmzmGIzqrCwgRStoS6j mr1Ws1f+j4y9ZdCXqubDVpzesIQ5fWc99H3kNuzIHBku4o70OOaGKdqvi5JBSiJf E6hD6FrN0ugu92IvRHNG4Vkg1hfNiff97ZX4lEHicFy2Bbpql56yHc136wAlLkvN 8ns9xIE1APTZI6J/6lHfUDStWgKOlsgf51UuT/sJQeE0N2RscSJ7cxhR2F96RQ+Y Vb+hMg8QLA99B4OWbohkKR9eePoEjLz9u9kgG/AOJy24m76pjO3az8Xee9I4LFMp ws78NtQgGi+ZJ6JP4QsEx9ZakpdWGnpDgIskQE+LL7MH0mXR07CpXXEMTnEIBMj9 ll/pFQ7bFJiPSXZZhRQVSiNhL3a6DeLe/Ik9xY/djH4WAMuOpEQsbI3cRxOktp26 FsUWKNf6I+CrLaXbbrBB =lABc -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc2/jq-linux-x86_64.asc000066400000000000000000000014631501676513100176300ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlWAAoJEK8ZBAxxUjQCmrMP/1jfOkKVG7FZgArN0ZYBgJiR jP5L6/zlMG9SDecNnEVJ+PX7YdiBlnIQ7icV6iveBsSvkVyY1Mp+0ibzIePtNV8I 0SScmo4Da1gQwxaX8lKIfCTemOSvhxl0xqdOsYHq7nRxnxSmh4MFnDqXLS8ryW02 /N4NsFaUCjEvyFVfNjRGDwxyR3RhXr643p3vp+JZvZ8wLeZhM+ZXg0VDdXAFFVHJ EjIvedxV/IU4brVkqgRDPmAKdaVbLRezGl2uj7PYg1fcNXevUSHEY6bsxp9FSanU LWkD/0rElPdsV+B5ST2f3K7vTSjDOBA+6L3AEUR2tViCe/FOJGTMvVrJTG3/r7hh STARqZHX9q/1oEFQAZY1PX3mKCUrXKTBLkTWNWg78jtYXtV8JagQQPV5CcmaqPVA u0M5lNKDhgx5Qwy/Ap3FYkKtFHFuDxK6Y+px4J7hGRuH2casB1lYX+4YS4J8h4my 9dnmly/fpOI5nuONzXweX9zizNcmolqf9RAvWE0umurBj8Qyo5vMeEfiHVU3DSxw tIDAnT1bQv6s0mEBvFX2Fx6AJHc8wY4+iyu/fOMpSdMfbJ8lXeXYFH+SzV4uwseq c4j9eQ+Ab8SoCUMsFiS7KDAhsiMYk6rKn+aJthl/72GVBbnoLbYJs0frjlAsZmz+ ReXdr1sBmm2qFoJ43w+9 =UxxZ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc2/jq-osx-x86_64.asc000066400000000000000000000014631501676513100173020ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlXAAoJEK8ZBAxxUjQC3YwP/23mNNa+XscTIWHKPihfNoNn TIgGXP5znWOUmkNarIDl2ir5qi8oq6kBLoz917uz1X/KY3yB1rDoz+apB3Co1Ayh S+oRMeHUCE2V5OIBPsJyMHM3cgfdbVx3fNwZitpv4Tw7s9ilRG7SWD/2Ev2GKx/h Qn4j9JLrxJdvoSS488oyjK7rIXLSDM5R97qFS52Cl4beO0dJTdy8D7QOCF84soHb SUgrXZkNuzjs7qQRMJb60mhQeIkuUC55VoOUufoXTwpBZJNNoyqT1eNNlZXE884Z kvKJ2q0FYD7jh1Ct9KFr6gfx0HIjxMb2YYtCEilkKSCHG8JUHgCY5cpAMDZrVa5K ss9Iu+dkor96Qv7nyJ+zhjEscl1rpfvYKJbMLhC+M/lHpZc+5rtZBPFmZv8wedzB a3/hkyPpxp2YPa32CAZ4UVFE3h+lBLvT/PV5pB8UvYPbDrWzLx/V2aNLP1joZKH0 y4DECAVMAD2a3dv+xuee7ZJcmL4gK8a6sZbYuOWgnIjjGQ4W951Dz/CoiojqofKO 9QmcDiEOQQdnjpfuObSX6wNV3583z4GEHIuKLQiM7rtmIvzA2x1RCF/txZoxg9+T vwvyz+689ju/mIdUjdCGwPW6qljoMWRPXHJ11mD0CBTQmNEJiMbhE5lt/yH3/big mVPHv/DkOEM8pLdpMHlj =+eGW -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc2/jq-win32.exe.asc000066400000000000000000000014631501676513100172570ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlXAAoJEK8ZBAxxUjQCwSQP/3hRFwE5XzTNpBbMFiThq8GP xON/4/6H0ql/weVZPRyoVVuToKY+oym5j6IhwBp8eswQKMF0p5FpBjFJFFeXM9RC iSmYL7NGKSZJMLQHFLM37I/eDbaIOo4OobtzD0CAg8ZN8nlIHajxZ+vsmcuU/L6k nC5++MJEBWoUMYUdqII0F+ivlZFwngrnCgeLIVwWt55ojntbBjjs32S2gT8HugPz 11zAnx5C7KfDTnDNgMPFDPL3T/yVoyasVxidTB4sQrFeR2vns4F3uDugEBAWMb9A 3WRSzcuYdlrVOzB8WoHS3E0esEeuqtPIz7y3mvrvYsZcpIPpXaagmKALG8zZ7p87 /s9zpQdFWTe+boI6CdjG1+UKY/QhDAl3zalIQiqFSiBsbk/yhDtNug6oqGO/2fQw /xWlj3CmQsSMI9KjlrcIv2k4ugbYtIxVRvEJqqI8Qb47Lmav+F+VNhrwCcFdlMiD swD4xfT2Knfkx7OOfDv7fCRE7njBBOTumYu1o7G8HbZokSkAtS5sovrzLWEzXRPz lV4Of454G5Quif+MQIw0P55XgFCLLCEpcbt4vOtkCK/GaLuV2+JKoyJMoFEG2mAr T2ufop5Re1z0hvNe2VLsMhcUpSUKsFl4h1aM+YYhsOnlGG7uXA0bTAMmU1+n2uKE k/rOwLp4Lyh9gw78IB8T =A99j -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc2/jq-win64.exe.asc000066400000000000000000000014631501676513100172640ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJWGzlYAAoJEK8ZBAxxUjQC6bQP/3WzIL/KgnUmI3ziUJcaKgLx EOkMA7Ib5o5w75gg9img3pvYCLZnlf40TiRAhc/gQ+uIw8uLs2wqZFPSNE6G1U6i L2AQbcl4e7P4glvsd+PjXKz9lzCFyPtCgEeFA/T4UP07ef3yRpreFmYcW4A/5Saf WWn8nKyVL6vLS2vG4zZi6g61Rw9mlWFC6VeVLe+/IHMH3y6WtT71SDw3h0OFH+Ui DVSFXeu5Fiu/NEiZUyb2BLK/a817zhQ5xq2/mCoYrKLgLzbKaSuqMe47Qn6Yjkbo 82F+lDakDS3bsoIcvDkR2w8ABsPwPX+xDk8Z2Usyq2wcCEvSTKoB0AiczYfe6Eod uz66AoDZY/v3XXs9F3NWJqLRfRzu+fHcw9fvfzLET6gVkmbc5+Z7fDNXOtJlS2oT KKImd1vuEoffjgblera4Dg+v2f7rY7yFCQEsYGLnhyEb1/G4nb/MvQJ49NOB9AXJ pVvslWnwWJVy0pzo0VqjpldKGg2EAFcJ19+pgUOFFCF2Ax1HsvJhuxiyOKBDbn2q N8ivnjv79B62epIdUc/zGLP1In9yoQcDfenYlBI1PJL7nw4JdxFGBS5ajE/SftAD FwsuKvIlToO2s0bn+d6famRnxigWOhjr+/Bm/8AP7HAJdD3Jes6AJLsuUANNUfW6 aOU4u35qnEb1KZIrvozH =ZZtM -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.5rc2/sha256sum.txt000066400000000000000000000010621501676513100167260ustar00rootroot000000000000002fd209ca34d0891499bd32f59ec332b0b3048c449c388d428e5c5e8132a13e81 jq-1.5rc2.tar.gz fb7c57cbce7073ec18f669a313e956864dfafc58bb0c1a158881335ad7daeb58 jq-1.5rc2.zip 7ece904edef3f951ca0c6f68cdb14e782d52aa46624fe2de9cfabfbd98fe5797 jq-linux-x86 cced974e1f2c50d6203e09c2e3ede44075c4f35601233378deaf7bfedb2b4aa9 jq-linux-x86_64 25f930463c94414fbff1ba5d76a9547259073e8acb19f709880e913ab58586e1 jq-osx-x86_64 8bf6bad065dfe5bfaa4c22a9ca80fddf8bdffc06b8fc768040e4fd88fbe5f58a jq-win32.exe f8301b1279ac95e09fa9bfb1b38d411e68590bedcbe70d27ede7a70955d855dd jq-win64.exe jq-jq-1.8.0/sig/v1.6/000077500000000000000000000000001501676513100140235ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.6/jq-linux32.asc000066400000000000000000000015011501676513100164240ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEET9cB1vqbPS31rJNdrxkEDHFSNAIFAlvbqFAACgkQrxkEDHFS NAIQNRAArTVuw4JwSbxKzC4Y+ib1Vaz5d8ntQwmiR1FBJ5hbi5dMhqD81Kl4slU0 0IDBia7Bnvthk0/H+UZHjUdkCNW8rubg87zJOt8t5XXQmIK81cPgKhxqhPA6JPA8 RNmBGs5gAxycm8x4X0EMOVTsVqAfq8NYakO6MctRlv4ut3lXfWe+prIMBpFQZr7l CqvmBY8xhLF09LLBEB+RTjhDeW7E02cYFJIW9bbcvpECmnX/fJTjGwN6+Blaq4ln nJwODDZ61TGC2ZAYcAoqcA8bkU8ms0x7RCpZrRbYG4HJstSYM8RaxUxvtW2zn6Si 7FpMvrXnDn6MWr3wph96oRTEkKQsRhxoxo7zumaiKkaAGKjyN7fFx9z89QrKoxrO CAzGdHjt6YSmXH60ArGUWKGRilyvxieKddXD3fMJ5Sz/u+yHFRNDIuOQt+KZaOfC UlvKXQamexkXmK3PEl5ZPxcuK+G/NLFawPlLLHVvdLx6B5o4r94ycfLLYqzDCiby v0EDZrgVropUMUkJJMjSmioXoizK9KZ/fl5fj+2miHEZS+s+YwZ5aoPi5IvrFUhi sYz3wEKHp3aYzTPhPt3wBU9aaWoTradSCP4pt4eJV/VeVND+vygILdoD6xFWJoc4 BT2tBrUR6uqdQXaCn3BF0lCfI17fab1elYwBkh291wZeKF7qQ8Y= =cTl4 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.6/jq-linux64.asc000066400000000000000000000015011501676513100164310ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEET9cB1vqbPS31rJNdrxkEDHFSNAIFAlvbqF8ACgkQrxkEDHFS NAK+UhAAx+mFwf7XRYLznTU4HoDzW3yn/H+amvYpphvtcn/eB0GsZRpZ3+EIkMUe VF9Qxidw39tZeLROdX84iaYSu1bTpd6vAdx54rMUZyPVry6m5hqUD78LccPvIDCk EyFuRuAAqlRicyNuqtlr9BUBoI7Z2c4YOA3Y4oXlOXtleL3SXKXcGvhcWQ4owZp5 MN6tT/lNu6sj8l5v0Y4GxtfDg8YOap2s9MdaNNkAgt3O3J98gadAin+vQ34ekKWr zsB7QjZaAr8OSGyWCY7BTc7UJbsTIzFzSPvYGeIP2iCBSpR+qcM5/bgrE+Q4l2TA t+p6vF1UVo9MkhEhD/2Ru/ovjqRKIVKA0J5YvEzr2jWjSAWpc75y80rovqW/vjE4 GHBJootozgrUwe/ESTATzdyfFQG8Du8znnQp1Wv3upRPieCKiLiUkRZenOTvBIvW rHhgBR73vfhyD92exum4Z97hglwzjWJZRYohyKz+D0tYffH5lG4DV2pToREMqslq 9Yr3eGREMD/6j/zIsfzKxFeC/Ar+vmZrate9bUPwX7WYdwwbRcmx7zI6hIszFDnc RONpuJokLxcgfVC3Q8Tzo5cRsAJ0eiQwO/K3oU/ZSAjJkV17E+cy3KFm/C0BSvXx BHxK2D3vqCsbtlfkLurxzjvFKIAQtFO3yfSI5mIMnWfRCgvoHcU= =O93f -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.6/jq-osx-amd64.asc000066400000000000000000000015011501676513100166420ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEET9cB1vqbPS31rJNdrxkEDHFSNAIFAlvbqGUACgkQrxkEDHFS NAJT0hAAvuHiFUoXoHh6fJ16dY+ZvY4lWqAUap+mAWABuMpWGT0nfjq30eqvCY0e Vjk46ENJPNjCNQnxMRq3kWMqsaniWLgU/sbXK1Ws7RldhJbxjnL8y/jHtNHQtrKV +RhcJ3FhDzLSHOnIsTYYzHFZ1D+qeU+XMafVnnZSCj4SjEMZjzo9VyHJqyu+iG0w z2spLd6zFp1+6EtZkdv10NsiB69HhNxKUn0BUE2KOfasLpFZSoMN2OXNx9qatTJ0 l/+PKzSb8DkRh3uHtowyV7VHrPUQ8/WcyRqwNKMmJaB3WDDwsPJxgQT3sJVpVQaj 4d768B23NbR3LZbqPgczu50kn/6Q/DJTm7J/TNxKIOfnCsIMsiIhQ+oLe7/8c0ph xXhNZqzi06jB0kulmGus/YQY+Nojquzc+mMOysoxYo1iWscxWoK3GrImO3YMACk5 0zH6pHgLBlWZ/5ScKmvAn8tI/EfSUnsR/QMmFEZsc/80tkZBAJd3HPeamRtLqCon T8aSP+xwwzo1BFhtdVddYXlXFWIwtn9VhEYJvXN12eyhW+S+dKyUlJCdCAozkntD QxOILIc8RF4F3KvQTo+t91hbjyPGm760/iQgHU20UpRxaIkJylQ6p6rWsV1wEMMr QEENmAs0IyawgJGJ1Jr7AKOR1fqEqW2BJxQ9zi9re+dXOvVWMI0= =J3nx -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.6/jq-win32.exe.asc000066400000000000000000000015011501676513100166420ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEET9cB1vqbPS31rJNdrxkEDHFSNAIFAlvbqGgACgkQrxkEDHFS NAKFsQ//fWWzw7pWIt2v0vCn3VOAqWv0oB3+YEhqmYNv3UJ5cJBeOndR4C0kT2uH MnTIR5WCLw9iSiNkHUX+oiWT3Rw8i8oHkA1Ub8sIin1RksV0TosTQa++9XqdO92q HBBLUe1Y9BcIU0MgEKDtLXKwg6wqW6zAl0WI5/fIPT8Du7evhI32s9zVTMH4AahO ZUM+OXmNCRDVvVp5LS3fZR8E+R3+Mt2ZplGb+aLmoX+hvVTc15GfVtFLGMz2bF1p LVG2/qs9XQP9nCaPm/JCB1F04nHTAuUb5BzJtdJUpqBJGN8diQrxLigjyxKsPVNw 118r4Q/6FELTlMg9+6qOPal++ihjuCNWex5Mqz2+ZnANvtRYVx/5bF+DY848JmqP V2k0JF/pRnwaCd9ONzYjkWcCMeoAAvwPygl20NFBUgTHC/xdh/0j+glG0IUW7Wt8 2cJyG2OpGqR8CHTc0WDwV1SM937B9CuPjYANottrl2mDmdhhykO5gpDSjf7/is4y 9sWr4MqI62aI8xBVdLmTsF4kzoWfC5go4SAHvXlsBr7bMW90hkcuuY0giB0mWZng VQtRtpddKmhstLGoKMWf7TblX4uXA5Ym03LzvwhGl3PlwKh4HvkVYBE7EaSKuJ1g s3WxN0vP6mP1nMFF26fC9IapYWIcTXjyJ7Hmo0Okwn543E37cQk= =KfqY -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.6/jq-win64.exe.asc000066400000000000000000000015011501676513100166470ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEET9cB1vqbPS31rJNdrxkEDHFSNAIFAlvbqGsACgkQrxkEDHFS NAK2Sg/+O0nHwVg185EwKoORwL7TQ9V8VSV04Ska0lKJ0Biu0w0U8k+bkzhY5IZ5 IdNUZb5lhnPpLosCLlzHlWD3fNkBbpYLgxDrGDS7EujXcp8lI1WrwVNuY2Gbz7c3 09YAeF2ENnutS4KP0BUfdEVMlEqQIVpGldl5jKgHxlZ8nP80z6IpNL9FnX/qwkZu /fyRthz1XAEcDHfzBtSbJCJ58QoGwl4S96TsuLZnnBuNgNk97SIeiDzg7tN1FmF2 wyg7mPZhIdRaGfgRLCqO7+qFGiYS4esJj4SbLiWDREVKhqqnT5B/vF5SmshsssUm 6MH+eK0BAGIntTs0fIGtgkiiuZI4bJpkxgfr5P6/F85U2d1YAJSyJubVMJhxx1U3 vKjUYzj4ub9GieT80FFmNAbuUTOFY3y5ZLDl3WRXD23/FpXTxWvTMNWs/Ypt67iT SLcpC1iAETTsaAzLnPxPtwjApFJv/+Wy+CXZl1xAwDHH4vnSddRaSjjl9qsi7yNh U4KUAVzpHfgmsK0DY1P4wXbBEuXCVcUBhGIQ7z5/Bw0F943C1+tFz7MckQmbsvay O3+D8NeQGNb0wCIt/Ro/xIqSb8yrI4tL3+phnUxiZGxc0z6nTw1O9BdMRX6l5/5O 84QzUal8MoDWTy0pb1eqUaXp6Cek4c9Lqvc8WPq/csAE2jb/PGM= =xykx -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.6/sha256sum.txt000066400000000000000000000010441501676513100163200ustar00rootroot000000000000005de8c8e29aaa3fb9cc6b47bb27299f271354ebb72514e3accadc7d38b5bbaa72 jq-1.6.tar.gz e33f9219cd8c3851b411215dbac51d7fcca4a2b157964bfcfa56a1d718e2de14 jq-1.6.zip 319af6123aaccb174f768a1a89fb586d471e891ba217fe518f81ef05af51edd9 jq-linux32 af986793a515d500ab2d35f8d2aecd656e764504b789b66d7e1a0b727a124c44 jq-linux64 5c0a0a3ea600f302ee458b30317425dd9632d1ad8882259fcaf4e9b868b2b1ef jq-osx-amd64 0012cb4c0eb6eaf97b842e676e423a69a8fea95055d93830551b4a5a54494bd8 jq-win32.exe a51d36968dcbdeabb3142c6f5cf9b401a65dc3a095f3144bd0c118d5bb192753 jq-win64.exe jq-jq-1.8.0/sig/v1.7.1/000077500000000000000000000000001501676513100141635ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.7.1/jq-1.7.1.tar.gz.asc000066400000000000000000000015011501676513100171300ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBUACgkQ4aewjAfp 7oYyWw//fvi2FRb/BEHWj9WirM5aj9x3F2J1V3cLH97B9XeBFFw3slj7OtYxjb3o dm7GzMN9RKlQiI4MQ8nhrzePKeI6c6igURwylVxHgiRp2jENVxCDoZOydnfpEuPx lIPAmnGNW4mlYVLQSFRZmTunCSIISbtjO/TPxX2x41nBRdp9AhfUQ/MfR0Ioya4V UHx82ScB5jKejiZqLpEfbqNAonmpDkdM8OXV/wmCAy6ICXB70IjMPgjTWwl0NZdt 9Ao4q2nZ44G1qOAsDWxIPqG1f6pjmwDE2k/ugpqOaVrXFKMbzdavReicGclw+sPy KbZ2k6hcz+GkUC/SulDTc6Opa0lonewPKaynRxhVsTX6wGu1M4tsjBSxF8/WlcWM aUdwDNv2WDsQSFL5AtHsH/V2aBBh6699yS9gz12wzT3qQXO34Gh7uSg8GCTwFhzV RQbP0oFLSZCGCtVR8zjJbZAHLu0xp25oZWI66HArbuqqQmCrx83FIMPE8rGvM1+4 BeXuz+5gm8lG9JKxGB8klHRqP007XV5dLcYv01G+ITX0gpI+fNi9XTKDUR9W/LSO WP5P4LOH0N0nCvSPguaGSk5MdDs7SlD364uWfCkEReNDIxSUqNglk5U5vXzMi1Id hqC800IquRdKkPNolrJlu6IinSLcwld1EPR8HX596b5C0EQk/eU= =q9i8 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-1.7.1.zip.asc000066400000000000000000000015011501676513100165250ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBYACgkQ4aewjAfp 7obkuw/6Ahvl1j6xlRfZ3SwyWhQscwOBB1LWbIIVhJDOBVKv/XTe/Gx2x0kxMvZX jrEENi498I2mqQfie7Qw9ThhD8oWnvZLOsa2H1ijK7vcPjbVvPTuE4gvySWPhbIa tJid1kOBveJ6QJHptznfZzXhMuOUh3kS2lwyzKpru2Ke2hCkc5/qs45HjcRcsS9j XJTwr4QfCcPOuCeECdZM9I8s1JwmhUVNjyfcMXraFhl1d9lpb1K2pIUVMpxhp7i2 jSRrw0p4a0IWuGnBLhb22PVjHK+vVFxpHblBSqsEYWBwxjIfClIhLgXpQ2SSwUkF hPRvqOwLemyz+cU3qz/O164td4v7m6DG4cqjpJd2JJepjZVaXs1Tuj18ENhuAdCu OIRefytdtrBh27cb125yMGMBa+qMgNsQSmpZIXuys4HLFyJWWPtxnU6zIlcnkM/O G/QEGMWbAdpVx8dIe2SLXrdNJUv1NXMiRTsmd9dmUkAbAb2lQy7rLLP6b8oJZwV+ dsnB8cvftbLnKIAaLNzhfYieK7wtIZ1wNx5sJ+juz6EmpV2I0KdgbpNS2Qr2j6Dr /KZkaaDQtEX6RLuwQSU+m6odPYJvYryhGNKRgNJ5RTEpq0//sYeHUHsrzw2gOvQK R8l4Vj1lVbXKamwZj7c8WOS4gnNtMSvGCtSNTCbQNjMIdECVWHA= =X878 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-amd64.asc000066400000000000000000000015011501676513100173300ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBYACgkQ4aewjAfp 7oZ5QRAArt5MOnrI0UNfLl8GjEWwFMxtSh2gz9ykRxdaIqS+xjmuJOs9hm9j4iZx Nbs3EJkRBgi8CUZZJm6JxRJKkeIBOFn3NSf5Gel9yQH5VPmAkQZCLpGJGt/SGJwb uzeOI7u+lW+BSMixc3cxTHJgIpQ/WrKd6FAzlqNL6RN8wH0F9b+UALgLoCzgdtSO km71GNeyP091uIImFvkfjM0jbbksvAIqOYvQO1ZjKLbMBeDrFih4Bp7OiDDRyt9I XrzMiv8Tg0bOamOpNYd/TwcgnEBtZhsfzwu83Yv+VPKAj/v1852SCJxbji2nO2H2 JtbSg6FX+EnXWD1o9Pjii+31YW1U4C5TnimGsIwIzYKDjB7IFDDr89svj1pdSmv9 kYidSYLu68vo+/nxEGpmapJr0wOIh8ysapsdE/mFlYa6bHn9ocAMj2Xs0BdYphrp t7ha0nEKKPxu+c96CTP9kH4eE4zTNTb/PY4y8r8p1QOoGteq9aGOUfLjnJeCX6lC LmT9Bn/9RkZwKJ7TjlHUQIhht2Tf5d/Mtbu68pODU5ruyWf8ZvTDB0m6Ib1A1qiE nRsNAil5z683Gr54xahSlRiwv0loITTquPEs6lHky+IdZL6MSHjRa5xPGVZ/TS6O 1Y4wjE1Yogr7821VBV+aXHdDMzVDrJmYKdOdWQkqplXUODaid6k= =oOwG -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-arm64.asc000066400000000000000000000015011501676513100173460ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBcACgkQ4aewjAfp 7oZRHA//ZSNwkzFIJf2DFNtDjn239k8ekqMGqzJPcL6MtmzFd192Z9DCaMWt20og 0TE7aNbpVUES2h9o1iiMZjjXuJKl6MGob/qblxcOpXFEky02r6YSnHYUQFUuj80h C1FsS7fLqeew7daS341Ow2TVqWZE/5oB03DFM+WCt6gPbgQiizbiHoq0VKZ2nX4v 1iTeILybDtWHdumiCmoohgiiqffSzJhlZ3rpW/hjON3GxwsB0am6A1CzozsgoNl5 tiqX6iDbY/xdEbKp24gJsB9J82sFFI8S88c4sjMGo8aw7pXf1NSHpvw4nvddJxdg CU+Kft+6b8qIZ3KpCwvlMK5EgArUjpRnhLdBcMq7z2lpQaND4a4curBlfkZLh8lw S/EYf6/alWUmzjbvaNmcOCciKaKefLBmZQoI/VHMFL/mSB4GtvyfpQ8y7bhCW9HE avGbLK7K2uFHP5Id7DN8ndvrBFHoK8AHbJP4oI6TPSKDy+RKBmgsrXz1V0/9tqws 2a89BGILLVU35DweXZbMOFdNifp4OsuSYqTnQI2jrhSCxPc4+myfcQV6Seeu5RJM RYP4iWqf4aMkqVk3Wcv3WF+zSv5QOpdUUJhzjdcEGyyCkfvjL7FyqD3/0LFj47hp sUlsj5y3zCMEWe/SRKQaZWTSozSXyo9pd2R07N1G6SPNif1ZFuI= =eEDD -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-armel.asc000066400000000000000000000015011501676513100175150ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBcACgkQ4aewjAfp 7oZkpBAAlXeU7YhkkNNFoyn8PK4JMb8pNq2Nr6WiYkvIit9trpLdWEc6xpWrtaAC nnZHOznhzraj9nyBLYVFnrA1M+TC664xRSeNeV5T1rC1Z8TGZGaELK9nwyIjCweB fKnCMevBXZ47iukuLU34uC/mcB2HIjFILdoUobnm+NXd2TjwDmEJXCSiNMjO+NVw oR15/+Tnvrj+nKI/7cMEbH+9KW14czWhCZmqgeGOrzyA0emAUz94frN8ZjyuYFUt TzquB4dOfx7DrQ9ZW3IGMif2A2XzBCHrX0pJcyT62CLj5ABDwLhSQxhcg+xlbH7Y SfymtdR/+spyhpuBMfj7cBLkcBfw8zaAkXY7A+llrHn6bm7gxL6r2yrC47WtAFRy W62poU+EYr9664O59xOcTTQ8OJd8P88KnbM3zfp135xdTXYDr3EieW9pPJ/M6Yl6 PtFMCa8XzrftIa4Ger6E/KLQZT08w3TguvgHzn5eoF/ROqLp/yLNy4qClP2VwXrF eQghAc2JAN1vphyS2N+B0giAyoP8NzME9oXh8Qu6DrW68RxleUn3UwX2khhW7ScI vXxTGSOHjHmPzZDFAP9I8auyivLrH5dNGJU3ejTDLR+vl3/OhpOiGvSQcwhbfDbD R/mTasQ3/SIumkUJv2yhZP2mkW+l16q9Zdg4LLnb53+gU0sywZs= =ec2+ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-armhf.asc000066400000000000000000000015011501676513100175120ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBcACgkQ4aewjAfp 7oY9dA/+KI9wYxMpONbXQ5UPpPE+y5Lbavdz3aLymqwTTFI0o24ugYM8ZBQqNfDJ 0iujcpAr33dlRMPCPyUh49GXN+943GgLectbP1rCvQcgYiTO2LACa4lbnyqvoNgR mhywsOLBpp+TWXJpsZy6netXFIDc3YJhaHCo8GUXSdLOZrir96kjp/YJX1QMcBji NhJAbQkA3Qf4wryvwi9ZZ4hu8FWViSf5CVPnOzkw4/1T7MnaHHz2UJ8Zybu4zocp ioEnllpAs+leP9O1mEri/raKyeRuboJYAPN64P58lAqosJXNX+tZYwPkaVOTu/2q E8w3xExMblt092Vc5FZfABqXlv1LQEs8u07qlpHFGkCRq+BO9JGWK40VO+9HnIJz au+lfk4R3Vnd5Grz8138EO6LoYdHyL89T9gTNxRzMN+o/aNbt3jutxclrZaIEZE4 lnBdJop/aBXTnFE93pFaf2kxCEhtYUWefHitHkFxKPbnuEKt2YuiccOUCbCLIAw8 EvhLVMkyBWAhsCgsrtGpsje0qMizIMweOK8XpN7SV6jzONhasTPpbcZmfwEyghxP /2RgwTflH3x/wUf5F1IQzRKZAOmeds0I+QbHrCDLjUWsCvcr4tilw+GgmEbJ+toT mnfwFyccx34Egdi9cvHeqEhpSx6lOgXOU2SDALgUFMy799x1+FQ= =ybXX -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-i386.asc000066400000000000000000000015011501676513100171060ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBcACgkQ4aewjAfp 7obbXw//ZDXOSgumzEP1IWtqK/g1PWdC8wPiNoxG/vJAsbk/AAcFYZKE3oluGV6d GM0JBBy9T9L1OuUqwFN9je3RdLcAzdVWL83dURGDb8ydwffbnO4NjPGUU3VmQkkA z1fGDTeABY3tpUkaK4cmSfExkIeQ1jjTXkJ+OkQRinQPahTHgJG9wWyyBL/rWLxm kkLguQKvXPqbegVoimiJ10FyvM7WmpYP02IgvTksaY6B8r++WgW3uWWN66f/3DMK PsklkH1Bx7I7bKBOPUEKIbDkCOJHsyw/ChQ9hxQ6Fd0Vz9DylAjOCCPxAJzG+GLa Z5pL+OiPflFiaaTma97+Rn+cmlvSZDVGjaiURwqF/RyZeoFJwGBQGyctC8lO/OpH R4TzTPTep0bwBmRABmn3yXzuHWIzLMkpshBA/JPUig0bRrqJZ75VmC4K8epHdMib 12ELYwSLvDFxyXOm/2X2UTT2JgbHOldt2AiNsbqASKnuTlUTsgA0AfDi6lX5JXPN Lh0ksNzn9dqhT3qm0niIxn5JsMF1Jht8rStEJjNmCi58emwc0FrhU2jia8oTsKal d/2n+2TKn+ZpfwLoab23uKmePIRp9IA4EXATY45UV1rGUasnLgH3IRqRkv1DkIdH +oBi8OWyOdD9FbA4J6jwjEKKW/EHuzRYdnRcq4BxQ6UBP+zO5Fo= =TVW0 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mips.asc000066400000000000000000000015011501676513100173650ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBgACgkQ4aewjAfp 7oa1xBAAuBquVQgV+xLpvV23tB8+/rnkcQy7QBQci/aLxtzWovJJBQBWs67h17i/ 3RnkpQlEFCRAJK4fjzp8q9RKgOo5th89drnF4xAhg4a6tRj6TcbqBA5ufL1l3Tlq bpov33GWAKLAZLClAw0lK1trE+uz7ytp0BLJTPP3sZz56+qJwF/cmi1ykg5SLa2Q FaYU7Xc3kLm3GGLVaJP1IKd55veU+jFv3IcBK3tX/9R/lg29MPZ4Ld0Y7SOTeYvP eqxPhR9hrg09HUZpbH+7ZuwKT5lkj+6qKPjYERl+hbH243ZHVYaXtUjoPT5CoaaQ IRgbRWziXE6godv9xeJjdVV5BUDRNfIi9SBraxjzN/lDoCyLUMKLqhp5zkQjuFNc aY/ZvuYSuV4ChyKB//ty9jf5TyGKdVkDxXK3xgHiNgJRdlb54BNrKOW1vHQ12vKU P96OzgP8ZhY2nflFdZWts8Zo/O/evKVStLDpHjZDUE0KuQxAGGStewCYUEGgBhVV cf3+uJtE+sN6CwcTyH1CYXrbTCI0GgmhT9C3o69OvddY6lohDu6kVnjC14iB5yfL QvFdhWuyCtyuTK2/WfMHWyhn29HCWbyIJd9kRuaDkRZPj13O7y0zATJ1SX1Yf8+6 d5Ds6LOKGoHePI63C2WBRkqJC2vYHG/mlJWzm4oAN8Ea6Ye7lQ4= =iH+3 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mips64.asc000066400000000000000000000015011501676513100175370ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBgACgkQ4aewjAfp 7oYdNw/9GHNk4c6IcufD3HpAPZDsixFvLMrweTU5cx2XzMJPtjad/LiGx3feO1eF pf+2bLUTRCuzaxKxKxqqsYOdcrAjhN0lOsrWSh9IAhYoIwGswGOcDFirMMyxZCXP 4xHk3JYkcyOhGMV18GIHhh6VLSSmbaBoPBEEqiF/hjV9nR03mLaAitPsUU8cp7zA AHAYb6/REPMKxAWN4QbdTsj1OUT28c2LqDGhTmzkzYrdsSSHlv5++FGIE83nphsr 8SsNKv8Vgh6tGFcR5FD0zgox2nz62vSgUTNqHYOcvoxH6+d2Pv3O5R6FzuoLAdJG /iyQoyDFcpPNJSoxdzBskZr2VeI02rox+Bh2KX6jpnLQ0DfoLwGf+vtCoKJXYEdo SUN561po/7lT+DDTPxn9Ju/C2Gvy97vCEI5lhqm4PTirSNgxdsomJpXPr2d3u+6G 4l55mHQj2u4Af5ss8TwN+sY9adS8L35d1BtpaWNyu4SE/nJU6D0/RZl8YmBIppGz CmjjnXuTHtgSapCTl2k2uPKR+4zQxdf+qw8VAcXDThfHPIDqErCuHtyG/ajhHdky TsJiuLSzT9WZaKN6zKbSu4+PjDhixedcHeYovfyjT/2U1jQxvSeBZCd5McvPVmaX Lf7+hIC0pId5FHsn0ld/qlySaiPzoTp4AJDkKHwvgGNLnu+RwDY= =YK+C -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mips64el.asc000066400000000000000000000015011501676513100200600ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBgACgkQ4aewjAfp 7oY7qBAAyqF4oQDEsq3j63J1x0yC5o2oxa4cWuXYg4K08MxdewZM69IVZg6LzLEw ZWpyu1CT7r1+D2rW2HpGkG5BclxJufmDAbBNa7U7I6YF+hAdAPuX/ZfH69IB8+wU htRabb8igVWpYlzSMCtsES5G/jNfV3/paqGSdXjQrmO88gBt8SDNJnw5n04+Qseu 45U78K6/2kGftKovpSNWoVGeP75GYmL4RnWhLlZ0RrNEuuXz/G1zAPqkdx2slH7+ J+iCFb5qFnkZccR1r8LKk/1M2+3BRrjxVFNpNXnzChcuIliDA5oqUPba26PHpHYF lRKc1kD9AFidmGBletCZSvY0px4oJdN8bTEi5j+q5y1s+Phv6AfO8VVFFWC45SGG GMfWJb/FrS/lrqAWDqpRlEue8bML/io70p5KbiO2lHiU8pNiB/C7V342/sFMHAu1 TpLwbc/SlhNdfh5cBMDyIRLMsdg8d9FWOoi+6YieIfpUrcaKP5SkL0dShU8N5tSd vHvQW/k6Rcb47Uf+ZAX9my/KVheNxMDPXGL/aL6mWb70SDu0zLl5i6WIVWLH3BxM 5Dg0LmEcucPjwOzg/gD8uoHsjbTm796YFCiG9ofuIdp4Zd6Zlcap+3jK3EL4yUc6 cq2FD1L4C2aiHMlIdXN/X2Eo6AS85Qw8Yb2FlUIluGXcmQmSRnU= =UOsw -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mips64r6.asc000066400000000000000000000015011501676513100200070ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBgACgkQ4aewjAfp 7obE6A//RbqLt+bKyyspXvwznsEZjExPhDICNbGkRu4TWAFJoqSxnxCtQY+sET/6 iqYucuZg7OhTzk38qIu9Pys8WLK7vTgw4EhIiNielzWvZyb/w7h+CerpizAcUsI3 0MtI2c6C40jpYU5gLfp+9y/rKlby7SU7e3755lyKwEqq04GB4BSia8FkgtH5lDKo OHKM99x6Us8gUAPm2E1H1Gbi6zhj/P2qA9Zqkbff1I/hZFWwu+4YXrtPf6XMFnQF 1wrDf4oh+m1TxoNs3QIlGAaG/YTDeAfm+vqnnP33oAnuzxrjy7NFGv3X8wfzHeFG 0rLar4U61Vrg1JnTo3vXG1w+OiXcoQFjOS265kA/FqfuW8UgFOp63VhsaGERL5v/ Ewr/kP6zLBUhHbz4mpYQwYyWHYSa9IC53BuKgAHanz9KhzGe6EpF7vp/rGTrmqYo /6G+ZGujQHlsAr9mdrosIa+NfUFqDbAM6/e63WlGkaGtjcO1z4n86YgrUihBp+m4 LZwQy8KGhEyGEgOAiUbmJQLko5RFg9iuVhChHxxYSYNfcjgBGPEC+nwd9fpFxLVa zrbwfJ+/omz/Cha7EyPyDXEbVpn+tRZQ/9sYP03h1cElRAo2aM2EUDxlaL7L9KK0 q6ebin+sTp2Lzatxh0oyA3Eec2eU5DfLBsNL+Tl/kC8odjT1Ozw= =TZTi -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mips64r6el.asc000066400000000000000000000015011501676513100203300ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBkACgkQ4aewjAfp 7oagRw//ZpRanx2sf7B7L/eSUiVmijmrmTS74cCuUQpMn6u1kAR9PhV/6ZCJOxTJ 6kpThaA1cKnZ42eSVEzu+H02bxSeaLwA3xOyqiW0Mar/76DDP4NXTe3SQelQl2Ll 3SGJpLXR0Naxd//fXROlGZmWAbj97SOlvGRd5R+qDrHjcOVh/PbtZtCmcUV5qYdx H1DdOLQHHERkeyInifJpvOxsfUvlYHX1qQ8FQLckiBH78f/TKI1FDQwyNCz5tXc2 GD7kySwjwv44/UssuYzQ2t+Vlr9XEchgyMq4DzaoQSMuoey1FwxHgqOiF8eDgEVA 3/QGiQ8e4QRkfh8AHUjybGr4Nkd1X+0wsQpVgsF0sf9pQBoCIuHYUfPi9LXVaTy5 /MdxYTe6F5mP0GSjVmcA+H4TH2K0JWivpWws4uUwJj6TrZXNksMJ8l8hS6uf2sQd c5oifa9A/XwGEQGrLK0Vz60hv7i7DuCIegQI/wodFgNKfkUOs5qBKvwaR6rRc08x NlCMYDqdlHEx4Amt5Z0G1gH4NNlmyGpfvyKPWhz3eAlXi7FwfRW11qz8E0Ro+Nnr QnfqelxUxPsSDEfRmNFFwObBJjMp1eZ1kZib1Gwgz2ORicHsBZ9kyvtWZxvv0sXy yJ1Z1q3RVv25nnJ2t1NIkYsnD+pLIow3VJqeBtnl9FmJhFfJI9E= =LRGj -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mipsel.asc000066400000000000000000000015011501676513100177060ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBkACgkQ4aewjAfp 7oayQxAAoPqBsiSKPBMEyEOcwDijYKWG8DCb2WDocEKcRpJayp9SR9/sXnptif19 rqbw75MlMVK9iY9IjGo3iRzdJh2OPuH4DvrCyzaIrU7F/Qg7TtfjmzFMymydjp4p f7SlEphg+Y65xrMD8IcMFf0+7alNwZ0qwNyWafdUm9uMBEgo75Znivrub/nA8Z5x jmcHj2A0jJQuLrHP0kTLnCms+cAzxYd1h5m9grvOxVXrUV+j5jTP3C7JYKqq8v3i I4VMfE5IKgCAIl3NbE5DwcaNUi3ZsaDj+9x+VpXs2L5zVlZP0skFj3lZBtjNGI0v jzxaesX57Nkqh4hWj69/Z3S5cMaNDYBSCfTcx7ofBliV7QRkFSWkb2RLJt0dIjDA oq2UFes8kcWlX1suRXhQZ/4nN0CES+seu/sEhdjvu0hQZA2nidhMNgJLSKRcVTrF nzzwdQa5PhZcZCLmFI01bZ+bYhBoU3BjQAhrtOoCec6pNuwy2Qz7M9+zUsJNJF0/ 60NapnAMDGI/P9Ksszegk+Na+jdIcES7zclnUMUCsS+WC0nv1lZ+A4C2/vLEAG6A GENcACyTZkDSQrBGcknuJRa0aHNo5Df7/TxUq8ZSdGxR+MkpHW9v3p4SNxHjh12K a2YSOQ74068etFBD1/WR1hmSGPRDGlCoLULabdxYm7rcabcvnjY= =oHrQ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mipsr6.asc000066400000000000000000000015011501676513100176350ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBkACgkQ4aewjAfp 7oZQnBAAs6GVU25MB4umdvrlWbpI87bfoz3ObTVxQ10e1+ODF7WDW+LJDX6A/OC6 Bd1SNZ+YylbFxXIoZBU1gGINzj1xM1Lfp2PVlJBFXV2mZru+xarTFz6BiMu0R88L HDzRDwE0npW1QWESLG5M0VQCLzC1OXMmFueUexPE3YzdwjLDoTJbtma2QmaG5iAp BKFyn7SK29nfb0PNGo7+svPlcxNL61WDgo2Nw3uk6GATaWtb0WJ9ftQl84VOzRlP H7Bi6DstwfNsUJoPcQnTVuK8kyWuAwt5k8HRbFvAomcppQOJo/6SOnUQw7U+C9I6 kzKGw7JV61NuQBkybOlVkOKDpzyi+Hrj6IZu4a8eQY3wKyGt2ogAVEAKQlKHDqoG iBPImc6uv4ZOoA9B/HN0azQJmWd9YlnisVjjI3BF+erkR3L3YEmK8oP5gMHk3YdV N6x1hG2b5mT8d91dr1MrdH7u5feL3dhNTq+nErfWa2e1yQCWsVYiNlTv2B9SDpV0 lXAIGqu1UC5onR0oDagiI/gsqZMcBTsxntni3mg3039BXumglGjWdcSpMzHw2GKv MqllQVl8vMA1toIfqdU/MMC7WMPcJfkbtuWj5yTQDXMZ46Sj+JwFh0iPoxQmaO01 DYLjulnzK32y+1g7l2LBngBkxfHoEUNvVCLnYIwZInkApXrRr74= =lkML -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-mipsr6el.asc000066400000000000000000000015011501676513100201560ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBoACgkQ4aewjAfp 7oY2gBAAlty631YDQwiRcW2Q8y7smXRKliRExxBS/5ZPjSTSC/TkswRn9GGSEG+y jKPFMOe6g3U3in+/6ffwX7Cnd/gXzinYErmxwpaQtwtzSMdKzPTSuXoE/dggz+fh 2zN3M/ZbCpfSikMW6/ZUDXVqQY753e7JSJHARuLR43nuT9smJxo+V/IEG/u/56GR fP9IpC5Y6ORoapQRy4DzCsDMyys/W59NM43fH7yXrRKY9TzM1u3c8PL0ygdz4mrA mhjmwx5Zjn3NZyLPYv5wfZ26HWW9bHvWOXfvDnGet9MPe6U0zhtEbXsbzRG9qSvy JZ5fRu4qIf3WBbzmyFp1Xe51eApHCroo0aB03/+VjL39URaNoaAREd96rz2YUrkk 1LHXuu081LC71SzzPGoyXVMgCi9+WLIAKeSIHqFZz+mvyUfs86GakCGzVrgLfpMm QhWc2pUMD7moV56NngMEcgdK2HCh90vyI3NmsqiuTqLwHkXYH9Z4UZzp9HkW2nKu hIsivfx69VsMS7xzR9I5KbWkitven056fmIZ7sE9sLllIq32hzE5crSMP1GMAEdt /sRN+vjk/bzgV7Sj8AWdztk0huINFIGvr3Bby+uRluha6Mm08IxgHo1+omJerUSj g0D3v4tHHfu5yIQ5FjKRSwjMC3JWP0GMvK3y72YSMYnKHPuXG1I= =W0HK -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-powerpc.asc000066400000000000000000000015011501676513100200740ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBoACgkQ4aewjAfp 7oan/Q//R6T4D+3pQgSN51Ow3H71kLqb3oYx5kMZoDec7jAjPVhsV8bD4u3WnbhX sxOSmTtvKKse2UvED6wutx3skUlr3Z7lWGu9cfMxkN5lkVcDx8VDjHuUrC568PIE 8vXjry8AnDSyjBKFl27h8MSSKTaLXo82OC/bUWi0ZVNVivbuPGzKzOOaEMyl/E9A eZ8aXZyHNRjoqxLV2IIrNUbRcdY/b9DnzsR6PxUPBXRaERWhLcP4htH1uK0SH5Qw vhMLNpkMsyseQH2o4Flx7m4LcWi0XxHb1a1WvnGS2vXDAiEdkFJA4VAPR/0NoDGP w6QNp8cN4EB8cmJ80o4cUtssCnd3LSTUYVGUN64Xaq53qcCZM6G5DEgjlT1xgIk/ sFXGbayY0zCuwQpynn70OZtrZTzSGZ9zrJcxli3jkyRLuq2K1oaWqXBo4MrmgcFe LHbFCofVs9c2p2PaJnAjm0vNO2NTm2HuZLpfK1u65aFifILWMOwGDheyObyn83dS ZjVyWjuLzQpQWeApDe940R8Q7YmnzbD7a2k6Y6p0fQ7mecoJadniqbd+6mfcwb0s M+FrUqV1lKFx7af+c78QfeaomqKD0CIUyUcP0SCVOSFylJofyyxahTSoCbtJzyOp 0S33ARzlp32o7Uaya5iu7Oa7D1xJcvKaAd8eo4Ekbf65EJkOSP4= =V+MB -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-ppc64el.asc000066400000000000000000000015011501676513100176720ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBoACgkQ4aewjAfp 7oZYlBAAw2/5Lk30FlfsLp0S/R6PJ5BsrvsymkpYB1xMbfyy9x/uouSm/w35VK7x 08PUnqH0PLlrKa9za9vnPMZ4LNUPtTPKzIeFGX0JXkhUSNC/CRAntC46OKcgehzt xBljFEd14oVM3W12sJ9AMv8KRVQ71bqwQi7/+5pVFPLa9Ubsdb3BxSZ0NBlAdziu az/9JNqS3zLAtFUh8pOUOYGWUZ/467EOYkX+QJALtSAcjVPVkFS7xKCIB1kEneip WaA52RlUTMcJLvUxUzowlHlvW9y6XnVyOyH218xtVwn3N5PIz/zRyaMjOan0Wown WK26UF6q0qPX8fB2RkSiLWSzLtpAgT1nwu8HxqsbYMGavvLUVgLs4IyoeXDHi2hp YcXALUtZ7Zf8EWIztrYA6CeczsnyJO6FBOP5Ox8YTvnl3UCzjRGkr2gRtmpNnyL9 rdPQCKetIkJrNmELvmeUieSxAEooiGoLK6KML5HYN1w6A6KDpQqKDEKyxDTo9CrJ nF5sV1QOfOCoxu7Ak1lvSjp7h7/+IG9Qdc5/I1+LERFFViNTBx2UJbuOIMROnsmC HPIHVujg8CMW8rH3keLLcsctnhqidLZjuPH02Mo/klFIp5YX1Wv09obTSiWbtOyO pV5PSgqP4PZJ4ETAJ1XAVAFS/JpU6PO4Gwj3KOWrj/8WBn2Kbts= =90/0 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-riscv64.asc000066400000000000000000000015011501676513100177150ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBoACgkQ4aewjAfp 7oZ5zg/7BbacdVuS98S/ULD3dRkKPKuQ+YGiwnral2nlA22d4FISVI3zMG8WrF0C OWMSw2Mot2ohK+xAz13K5RfJubee4qEMjRW5LaoDir4SQxaDSjIs3toAL853LLV7 id20g7/TcVkjpdF5lpH0NighCGwE/Ap2EJakQJ79TVYPhmu1DJ8qkQYeo70fWMKf xYfAzsg23ocYSTAmxHjs8sclleYdU+68kqtNTb3GYkP23KqGEkBY19vAb31LQZBU Xpw2GqC3+e6XOfpqo3QPaqwZ4/5yMB8yzMwLDZHIIwQuPAbldtHAHbF0NexNAPjR 5GMi8MYlto28nVxFIcEV6Zoh5w5BZzuhJz08VcZWknSMRrpZSwjGN6W6gqy871fL EcwO7vupGmV1RkvJSqfPyteT+7hRzAdsWCoaeoEzq0l9+OL4yNeaG/3l3ctwdqFi n2nQ32MlyK6Cm7SfDSlwkNa1/fmCHNrHvKvcDTQKcz5TrW1WzOAgDFrB8tgH9lR+ reBN8Wf0A0gK1y2+/IqjMWdZOdkLsTT6nvnoO8jXI5jNJNbjTCdhN2fkLTnMzqAB NHTZS7YTTJk64Fao7mIgPrZaz9BCxG/8zlrHjwbp7oUGrQhWK3fsik/IN2wmDz0d SzO1fOHal3Qhk9KzA/9LFJYNJ5ekBc/vvHlkzGsVicY14rBp7J4= =tPAC -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux-s390x.asc000066400000000000000000000015011501676513100173030ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBsACgkQ4aewjAfp 7oaH4A//RR+lk5tOhS9mWh7lC2xP9YcrsaKrrdi/EheWKgmu0kRH0SuY03lQCIvU gBPoj78uauJYLrUc6VCm0DoFOgvcLilPGntSFYxU1SGR7PSpHVmEQwXjOI/8AGQ5 lln9Vt4dZ+45QD7r83pspZ0rNAVxMQl9yDJfDoYNIosd1f9mBF7Fk84nl/Np6e2u n44LwnxCe3M22Ik7tlk07YjMrX6DRkGww66PXOPZY95kLT6lF2PJRtfRXqgbS2pJ k847UcxtvrIJXc7tZ7ut2J0rfOaCqT/+udlnyH2Oe1xOKmujuTEzyq+yOp2eLYCq zh9D1gZtFg+ahgsEweWFO1doLUuYNG/kvXHYYbx7bin665h52PDF4fMhHm3Yawdv uG+VF9pnfGMBE9NkqzQGLST/BUxGZdmAz/yTEMnnr65EBMzYycu2TRjs1iTlYYEq ghfiX/GxWCqYQzA9xmZz2th2Pi+hRX5UihB8Mc5Ljnq6B738B00FTMyRVLtEx7Sd bsgHKIRvSZIGUjaPFAYGEyfQdYskRR/QYePj9zbUaCyHoT6dy5zhCNUkVX95dx16 cIUDMr9wUywTDf4NDu6Heh1Z/bY5AOSPsGwAdxXLkVHDRHCwz9HvAyDsrC7ZS6VT x9IIAA/ncZ2p1BIPq+tJdPkpa3qW2i7VD6bs+pPlQPTAVuzKzNY= =93Qg -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-linux64.asc000066400000000000000000000015011501676513100165710ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBsACgkQ4aewjAfp 7oYZ2xAAoC4NxfrG7LQBa53kg4zkgwYqYu1kwJaWLRgsCE2F736FQdyzCW39PHq6 P9a52VWPXzOhDpP3YDqxihuZ9jdUSHq0APosrHThNy6Jlvf4BkwsXFAY0eql9P8G TPB0Bz2pAuQ5kQH/0XvNsGEkt/N9q6B4LkI0i0mjzst7MdHZJ16zzWpsjso99V7B mk5BL7pBgW26kzxgojNyemyyZ2MiJPrxRaA7JFwjbl6XJeE/3v970ehx4BKHzO93 k/IGge3QkDP0OBuxxgaDzbxwQHrxi3crqOoz0Z6IoTNWaqaVEQX0QmZGtMTdAZTu zxPpN4pWkipXMrzYF2kfrYmgD+uf7cItvyexWyVHGjrdYdPbdma7s/JlU3rKwApU I3Qc/+kz98BrVyPRnfXwKvzbaK9wVCAiyj+CmKcqGkK0bHJKmdd7rhh+sZpJ5Ccq ZnNx7hLxLZpXLejeehlNAMSJqrgPAdJv97YPCaWtfbB7NwgSOIOPJgEpi3WSWOxR oWp4bkupRXUsWfG5KURf72OXqBY4Sym8/QGe9PrwCjnuj1NZ9ZrHWRu90bgSLJ8G hBpF0pAKvntpUE3pq4T8tnDny4nMauTcRC9UukU0BJnX2xp4xOdxv03RIJRC0SFZ +Nk+GzolN/iznfMgzpR06Qbq0Mvz2Ved8Dz6lha4S5p2nfsEoY8= =50K+ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-macos-amd64.asc000066400000000000000000000015011501676513100172730ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBsACgkQ4aewjAfp 7oa9zQ//a7sbhSBxUNKYxMtBF23sXGMRH/gpO+BL2cDAfAbTAelkuLQc52u8OMhM ElQzsvjKd+E0BSpD0RhUtewW9Qn5KsBErPPqCM5WuN6hBYzta42Xg+VTJ4STWt/a 93zKuYWTwhtdZAdTBGCQTR9DhhJMwlcwKdpE0gRiWlaDGNp+S4HcItsEGUzk5xXu +jvUoLkHVdH/sIqdY3b7URYKwhhOCP14/cu54Pab1yrhChDaIVGLCZdfKYrTwpfJ 8XQN0YQj1RK9SxWHCg94vLiUXCJ3AglxTDNMiH9wOa1HzOGRTRhiSF1ck0+AFgp6 JA3RJ48ooWh/7tJ0WZj/n0NPxz8CeQrKbwavpwSzKNp2NPimHpfAgSPuQaiIojd4 XHWL1ntprjLUOreyLs+78Xw8xGSVIxvXB58n8ofvQGEEolpGJeDQiRXneI3bN4hF nk5xbZf4RF+lD0ZLypZpXExBHvZ5WhYfG4EUMPL+PV/1FnO5OEv3bFGzBHM9OmwS yEWcv4rPl+v3BJuc0A1ugRkp6nDFVdF4/W7k54gsneCYR932u7RfaFh5BUazNcYK e2cV6xujOb8pzx9dXDSTsY6kwSVXma7Y5NbZmFGD7+rRDJgpbL3ozzsCL5Pnrb87 r3ClbTZDjEvZVvQ4ytte5Ujsw+qa5zyDMuxDE/Rq23zfax07qQY= =HroL -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-macos-arm64.asc000066400000000000000000000015011501676513100173110ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBsACgkQ4aewjAfp 7oaLSw/+KykP0a015aZ7nhJn2+sXBGWygAIZGrc1S93TlKWDpW1HPccjtt5XYlGB vvv638A3Prun5Fnv16IN3LHxBXZvgpH+mCChCKb8IZmB4mx2eMa2N7vwxYr7FiK+ ceTL1n5qrrGD2lcsVxQliUcuBwJ531PdK0vXKoPGNq/Kk0ChkIF1hbqHG7R4nnAp LZL2V5Bd0Ey4HmQfrEROKTOfKYHV/XB6rfaMm6I0DC5gjZT+9kMNmxqh7XU1335r 7QxvJh6kwA8f72A9WaXoX6NVN9doedz5jF2JHXur8MAht2Vjwy6drAFO3OcOMlwa 0h850AaIjrgcs7jstTVoVKG2xzbItUIVwMHPI9eUnHOk4yghO0sS3++EDLKKEUEp /bBHPvVMGH3r9EST3pw8NfxWkSUcZHNhqgjyw6Vve594dJ2cCFGmYfdePaBjtvdq c+DhFLql8XM6nZABv9iZjE8+xAlEZiDRap3LWYhZLEBzUzYOQRCOriirZ1g4GMuE rdb/ZB3O+JkynB8pN3HfyyBxMp1DRPP5ampBBYbUP7OTCNZ2AmkJoQ5a+ajR7Exl CGtHLNuypXjuqwyF3UCMGCrezZkLHUAuvEQntohD9MEv22AjZZQddrlhrZYxAP9K wJ+h/bNhLgsSRCuCFlbN96uIxcqUtcBJlA5ZLPhQ4DhDu9/JoxE= =4bmd -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-osx-amd64.asc000066400000000000000000000015011501676513100170020ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBwACgkQ4aewjAfp 7ob01BAAmWVoBhLGw2e7WLXIj8yfbPZsyRuCQFy162W9DLVlwNBxw2p1nKGhCf7k lb8m9P5gyAEQs6WL2pXEp0zFrhqviORS6M53KXptVuZ7QdmZnBjfeIGYrRBsX/vA WjUfEZ2aau2i0h0iZaOGCOzBbgNvqEVYOc3VRo0eRqhCwh5PlIJlzvHbrSAkF8Nx mbSXsIFgYKlBs2Ot27Sy/mE0p47drHGq9G1J0Hlgk/fVnprZtbCF7OiDr2VjcSYN 8rfpVuvNF/DkSO4v7j2/udOeRjpI5uVaegU+fbbNgsAUN7Em8WtpNXeDpvF1S80C hfbt9gOHuuIOhfOvtOjC8lfRN1bDiwmHroDO7coOgMwhR8ao+1rcJAI9dR2nDGB7 /aloUtHY+TWDwHojGKElrqx6eiG6/mBOGsnbBflGapJlgWa3/Y9oxwp4tGYyxjo4 fYzX6agzkZn6+CBAlAhTtlpMsRNf5DoLxb7sTJumYpMHMLBmSZoN/dlGvhED1RV/ gGK01ojmtuVdXCPTu0fSEjsVJ0/oKYRur5vML1o24+0DF5tSK0C1T17NKOiIPFxe RO2dEy5lelv8qe7NR/b4IEkpGi2mYyopKF5nyB6UQEpXZ5KI3sXdCtgNzRsW1Rw/ 2xqC+sLsowQHx5L3AlhjfxePVGi8aFPuEe6Zw7ly53GtLLDD5hQ= =mKjz -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-win64.exe.asc000066400000000000000000000015011501676513100170070ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBwACgkQ4aewjAfp 7oYyPA//ZK+85zRZi68hXu0mNUjG83t9jeeMqnjHT25FwXZ/vazeKiXxsBmtopo6 q/6WBvQCSWVpgIP2n4FbXwfv5TmPvN1sEoXDQQFWWC88bNI7Ek43xBvcg++rLq47 kuyFm0Tc5wAKiL1Cyph+NNXpdYv1bNjTlLO1u4QEMpma3hmRjeHZWz5jyWY2zo8x EP86Be8hXMy5f1fuaavmJrrsB+DZbDSyvZieuPvpBhOsFmAn/f1nTBzH9EoBvRm8 BjFqJTpCZMoETpygWeM3v3dJCjjuUyawc39KdbBgfhiwCZWc6YQTvxLIytbeb7Xz HdGEdpWMqbXkSZJmgS2ErU1p+duroCRXhSnF3eEoxXvFIjsDtSqcWivdId40gImf kFwhvQDpBHLBxSh4uq9NOkc2uzK+YHArrGqw+bJjtxlPX+IudfbQ55GHhx0V0YP2 7JE7IlxUY2Bbdvr7LwBGrATThSMK+QbabkWfwkYJ19FOXL5mzR27vKlhl3a0ax08 K+Q7v6GNv+v+3jjSKR3mKGzfr4947G7zfXVyIyK8Fcg6ujmYCJpqw+fY2bxUwOOl QtW3aylWvom62i+6M48h+FvCPK2v5Ccf/sZaT64zq9S4c+XaIZMXjpQYcanC8jAL 5iWgG5qUDqC9i1Hhl7l08ck4mg9XKCkCLYcXyuPY00hWoR+xnKs= =b9/B -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-windows-amd64.exe.asc000066400000000000000000000015011501676513100204430ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBwACgkQ4aewjAfp 7oYyPA//ZK+85zRZi68hXu0mNUjG83t9jeeMqnjHT25FwXZ/vazeKiXxsBmtopo6 q/6WBvQCSWVpgIP2n4FbXwfv5TmPvN1sEoXDQQFWWC88bNI7Ek43xBvcg++rLq47 kuyFm0Tc5wAKiL1Cyph+NNXpdYv1bNjTlLO1u4QEMpma3hmRjeHZWz5jyWY2zo8x EP86Be8hXMy5f1fuaavmJrrsB+DZbDSyvZieuPvpBhOsFmAn/f1nTBzH9EoBvRm8 BjFqJTpCZMoETpygWeM3v3dJCjjuUyawc39KdbBgfhiwCZWc6YQTvxLIytbeb7Xz HdGEdpWMqbXkSZJmgS2ErU1p+duroCRXhSnF3eEoxXvFIjsDtSqcWivdId40gImf kFwhvQDpBHLBxSh4uq9NOkc2uzK+YHArrGqw+bJjtxlPX+IudfbQ55GHhx0V0YP2 7JE7IlxUY2Bbdvr7LwBGrATThSMK+QbabkWfwkYJ19FOXL5mzR27vKlhl3a0ax08 K+Q7v6GNv+v+3jjSKR3mKGzfr4947G7zfXVyIyK8Fcg6ujmYCJpqw+fY2bxUwOOl QtW3aylWvom62i+6M48h+FvCPK2v5Ccf/sZaT64zq9S4c+XaIZMXjpQYcanC8jAL 5iWgG5qUDqC9i1Hhl7l08ck4mg9XKCkCLYcXyuPY00hWoR+xnKs= =b9/B -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/jq-windows-i386.exe.asc000066400000000000000000000015011501676513100202210ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmV6CBwACgkQ4aewjAfp 7ob8MA//QgPS+JnM7BzRWdC0xVKkt0QxcKBfJ/zktwY2Cex5Z5msRxU5uuEhNVq1 IgXvTaNqnGmSPpR4mZ/gwrshOoS8z3P2CsjumyXyB/UTn0Fyxqzmf9AZud/tpycI KaGqyjOWg7Ug6GcH4JGi9V5u0dGS0afIHR6vAgiZeIoHFNClY9pBv+WdxDJ8bC0y zf7+i78PfrcNUXqU5LE4gvNCqdmV2cp/6kR0t3VIj0imMLJt1MPTmh3N/lz2EB3b AJ5WcULsyl6Nc9Nw4vks7qwM8zKjvA/rEsawWvYDLlJO7eoQGf0fyhry1JY1XydB Z1rUxfl0Ybh5AXrUnzexSdio41shY7JFThQqBm4xd3gaosbJ/A/sN6rHG/ITn45a wAy2/ONDHevxT2oQSY43ZcNimMnoTLqX1rT/s16/96UhpbU98lok0oktKDBwDQ6E ZdOSYvhGVFOJ+Vwwtqtide+bPHMWSH79T9MKWHZ2ksSDFvTS+jrBMHcFdMUbj0BQ 7EJ/xrfSs2LE9rOm9oOL85LR8szKBhORpQykJvRWWUs3ydkZFNtfzJmB66MAQfgO iwa1ryy46782tyVv9uq8zdH3gV4k+orcaESCKvXpzUkVHudGsAYpHm7d0wEJq2ah QHfJbBB5qNyNUQMOnsTCYpyFaXWQnqdo+V+YkcuLCWFSKmI9plQ= =JoOo -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7.1/sha256sum.txt000066400000000000000000000041211501676513100164570ustar00rootroot00000000000000478c9ca129fd2e3443fe27314b455e211e0d8c60bc8ff7df703873deeee580c2 jq-1.7.1.tar.gz c9fab0ed0ce278dabc0606462ab9c4c3385bc801e958993dc0ed3ebedc15cddb jq-1.7.1.zip 5942c9b0934e510ee61eb3e30273f1b3fe2590df93933a93d7c58b81d19c8ff5 jq-linux-amd64 4dd2d8a0661df0b22f1bb9a1f9830f06b6f3b8f7d91211a1ef5d7c4f06a8b4a5 jq-linux-arm64 d6b86023e0848c93a618a74b6fd741ce62f5d557fd3c2c1d7870663713b2c174 jq-linux-armel 46d18f115cca638efed22b90342d52a84a25ab1bef570551d3a16f7eb065c298 jq-linux-armhf bc473fd4b385789e9ce3d02a4c8df74dc988a34b20fe4e1a80da997eb360b599 jq-linux-i386 5b7c362a354dda4f91bbfd26f7ed92c7cf7ceac28c022b1579c7c228149b55d2 jq-linux-mips 3d4b43d0ab571431fdfc786f951a0547a05f75aed5c076409ed2cb58b7244de1 jq-linux-mips64 604f5a87da0e17a1e8c12422eeacb47e93e3eca60c8fe17a35fbc629d425bdca jq-linux-mips64el 21de7590f4bfa078514a6d3186bd68746fe331eca4807d6ca0299fbba2d2212e jq-linux-mips64r6 30ce843d9910925f6ff3417ff13db469b5a73a2d727700cb4c3c12de8665c1be jq-linux-mips64r6el 5174f769b2a8a111743e316778aeb88ae4f8cada0caacb5c93ce6baf9287dcc5 jq-linux-mipsel f6d4a65deb9002cb59c00e80af6314846d2229ecafee53449228197f7b8d28ea jq-linux-mipsr6 e88b5bda2d0df0257033477fe53eb8544fb44c8275c814d4279ab7dab84b2e51 jq-linux-mipsr6el 761a9b3ad168e4ed0413c795f5546725be3ef1e1a11951f755524dc3f4a6442d jq-linux-powerpc 758841de8a905dd82cb036c9ff6fd6e598549c6f6106fe61795797ac87551af5 jq-linux-ppc64el 04426a00def567398f6190e830b35e026fbda2ea75157fac98e41b622832ff2b jq-linux-riscv64 868b7c3ca74224a02ddb613261ddfc2e43b12daaedd5eb58373dbdc7f2c5f924 jq-linux-s390x 5942c9b0934e510ee61eb3e30273f1b3fe2590df93933a93d7c58b81d19c8ff5 jq-linux64 4155822bbf5ea90f5c79cf254665975eb4274d426d0709770c21774de5407443 jq-macos-amd64 0bbe619e663e0de2c550be2fe0d240d076799d6f8a652b70fa04aea8a8362e8a jq-macos-arm64 4155822bbf5ea90f5c79cf254665975eb4274d426d0709770c21774de5407443 jq-osx-amd64 7451fbbf37feffb9bf262bd97c54f0da558c63f0748e64152dd87b0a07b6d6ab jq-win64.exe 7451fbbf37feffb9bf262bd97c54f0da558c63f0748e64152dd87b0a07b6d6ab jq-windows-amd64.exe e4efdd6a2c463ae714ed98fd5e874fe834a3a2380e17885bd4cda1c49e5166df jq-windows-i386.exe jq-jq-1.8.0/sig/v1.7/000077500000000000000000000000001501676513100140245ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.7/jq-1.7.tar.gz.asc000066400000000000000000000015011501676513100166320ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AdwACgkQ4aewjAfp 7oZfOg/+NgMw8mG2KY+jjR8vAHjb4txFNHteuEVsJrNXgRQyVvqbjIgylR9emfom drGnR5GNbRI/3CLlpuslqpoZfj8qpZp3DXdjccAsI44AvmsRC0QdkQI4Hjpxd57j od3/4cZUBsILrxqJWTfNC8AofnaJwdxlNHE+TWdm3i6zoTDiwHy8I5laTlK5ow6z yb311q6UTxhUyNiEwq8hfLPbL8F59j05vzsXhjWY0RCLTqSC2nNq0QBMPkPJs7d9 iBnebWcZ3EmpRowsbG18GSrmz9EJCpwwJSXJ0jn2Gt+HpEqyRub2/OioJGT/p2g/ KyN0J4vfyqbx+eUrT3zfgbDRmL9pEQdzjhO+K03CiKoldkEbZnuBWoNgaxu73b01 HGBacYh49kGjeWcAbtZIUGGiloVW2GZB/9Y6Ivag0ENYX7Q+/hbpjDicDaQkacfC AYKtHdWTx/UJQpSJk3v6h3h4TpUKJ5EZF7681PFWnStC57FlovN/E9dl18rbjqmb rn3GiE4lq9AeKfyUPH5Td1fmUrCQsEtGexfE7nTzI+LR6OyjW66ZluUEwAi78UM5 p3+IcE8BpHIPB++VtUa2tcCKEO8v7hCo43BnyBSGU5omPZGU+Cg+fG7HGxq0aMnI UW4mYy9ANb05Fa15meE4NEoaeUxvrL/D/FZ1zCyK4FixIQKt4yo= =bX9/ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-1.7.zip.asc000066400000000000000000000015011501676513100162270ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad0ACgkQ4aewjAfp 7oZobA//cHFLFqy8Eb1+uMhpmz9zGop5g73MpQYhZCW5P6yMiZRp5I1s7ZVBTo1Y 7hkR4v3fEdel9DdYWa8GegzHMeG/xfVmrid+4fDPJ6NCyLGIZue+3M4NLMfKCPkt 9eZGkN+XRpez0olHZLrMbMS8kIJ+1FNKZLjfMG6jBhX2TgsGBVKhqVAFiEu5f0hF kY008CUUHXZxbtZH9NF5exxKFuGHh3Sh+CK0x4gKsyDzlQho40lO95ew0Ag/jeyp 9MGpIYqLCIE54mssvKNlQ5Yo20ru0uslek7C/VkJ7JdtcH0GOIU1CSmf7wBuAsOt Rmsj8vhKlDD+dDqF4KlaPR0s9hK6m514vY/8EjFDsmckeP6jIKcXQpHfP7NJBgvX 6rsSDwpJaLnNGjsZLnlQ+bxB+8BFRvigiyhnwfhwOg/uawGt6hN3MNzS4vIqYjeT XzXyE+7Ne+V90tXbyvigGaQbV6wXsJrWKD+ThDQC2KbCWKS6PYG6OdwY3UbJzekq /FbvsczzNNCtEDPsutPZu1EuudOpzVXkxXB8nMIf8WdoKgFj2OFoSN6P1mlvMdxm g2ox3GDBcDCrLYh0TAQtnd9SzqQqRzeF7ajfRI3hLkFkcpScwVCcwng0IOC54uXF Rt/cQba8XIEjLssy1QSh5vBx5MjokigWEXrTx7Oc7qBnlRjjs+o= =2yGU -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-amd64.asc000066400000000000000000000015011501676513100171710ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad0ACgkQ4aewjAfp 7oaCSw/+IP4FMloDzX/7BJrbhLJj9Z5ND/uckO/zAWsGQx+gAOwDLg8N6pyc1jmj TFY66HNr7PoDuW52Nv7EuxyTVS7Wus8PNET2ncZ0x8tEKsn0PUqWvWlG/hA5cPH3 zR2IivMGmCZQ1n6cRWKtdds7EIbsbHVpBy3XuhsV2eIjBFmyJfxD9mkLz9smz+Mo yl9USlH4fo5Vv5q6K3L0WIKFgdhXk9wg0Scy/oyGQz4fOh+Ryw11yM7GzFNWMSwC XNdR9VARtfSlzjxcGsVe+0n8Whtj18RKr+Z2FG0K30AVBViXoWNGnAf07zk7zwoA LC3Kw+If4o21yzgHUACehlTZ8SH10F5q/aVn+9ylkDDUH8U5sOl5qW1uu8Rk+cMk ql2s+HuWLRC3rmdSxvtfTEqeTeJ9iENiW1bWau7qJYz4MFFd/BaJF7gEzv8nhF7O U4la2FJ+mRKDjQ6Am5HN9w6qw/NYadCFXmRHw2rKUSPgdXpXW6p/aon8YFNn+x8S Gb6lHyxN0TyqNdD7mr/dRhrQOsifEsKo/AXcMHlH5UgRpJ65mTWYbYwBjyZG5uSo JFbUmN+0EEetPtwG1Sy1brGY3KgOPLLI1CWhgWgdmdjvrw0sqIMv+pqrO4HFuh47 Z39+M6vhiQu5BwaVZ9N6EpdDFgwlGy408nxE2zIAaRaciARMD7k= =PHA0 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-arm64.asc000066400000000000000000000015011501676513100172070ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad4ACgkQ4aewjAfp 7oY6DBAAtrMSZcsZkftg7y/t/1m6iN/bV6z0TwyYHMVP0/aGz/NFAq0rqVVUTmSK RGSLcXNCH6SN3eURLduojIg8KkNZ4YJdSy+Gm8wbcGWCSoiUpN646NolB5PlTgGI +C7nFy+O/76bdTJEen3CR+7/waY8Fb6WOka4UtoR/zjujErJfqHtnF6qwcPvbsy8 IhfKNOXkKus5Ws98LJxaiONTklDphwc0+eZEuTUtefVw37Avebx5JpdqFCVNBdQw sigrnRu3b0ujVzdPMgLFFQ82PWY9MoMh4JULpbchgOxW8MUJLkYMIPNRDYEjaasT B9Vej+BCYnCWeW1PV24BG/oVelfx857YID64BXhQbVj6pnPMDpyYf/S8nKwpAdm8 ucqKbVH8AlzQ84ffTq/fUSTaHobN5XStEr9/iVvqFXoxcG+YT6vIHrV9buszIE60 QjsljjHF7yyM16wCb8shanfPTZzJ8rZ2Ou16PXNZFgVl5tGT7xtzN7lhkwn+UZoy QSi5vX6P2k3RPLkiscWnskAVb8sS5uHUSM8wJe/BGy55e535zXhKU4wW5NwG+cGM xYOvKSEzvOAvWBdr9+/xFWGgO7Np1MNnRY8q3IC0V4a4SkHvKvsKILeGZCrIiAkR fxIbGXU0ZfoBBholzsdZ0a3eVUrKkymyotgTcC5ZpKzyOAAwgN0= =aeiZ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-armel.asc000066400000000000000000000015011501676513100173560ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad4ACgkQ4aewjAfp 7oYIGQ//a99PHaBopVi7n62vsdjDxkOb/+vBZccEcVvnO9UZwNFwiZr7vNUQ20Ve kVp8MSWw0vj9STSyV1zJ1R6nTgDRFQnlCNyNc72VyMg8nswHjj75UfM7aU3+EiJG XF9EwYBIbn7KrQ7PIqA8wW2x34I1nc2igTFpHA9NDZbv3ODun74tmTdpncAfxP4y capjBtpLZlZMjhVM9eAqukbeHxTBIEfqEIjFLKEUCX+q9UWJPK8xqoOtcs2LtOU5 7CaM8mcD/b5yK9NNb1Ic4Ov/Mf8aJ9slJ1gyOH7BBISRReWSyAboIRBUN+xBPbJ1 7YLXwaYReavxTaq0dCbChHgB3InhTY4YdGXlNC+gAC/Mp25OtM+Q5Yig2JUK+VhJ 6BU++2LjmBoNQ2FiaqTpte22SsGocJmiJLhctrtyohQBeWb36QCvWfB7QP10xoy8 iiGAgqJDwSzyBwR6k9HWfT7nha7r9OJn5lOIQW0CK0M6/YDz+sECzGSarOBUnWmg McY3xu3xf9sZoA7zT3osFy2v6RzBZcxZWVdseo84qeZRWH2G4Uwi0GhYjyGAtpVs lqaFmfQGzKxQLcCKhudatpCa/+4b0T3F4WT3YRF59Mu62+n9cAFv9YUjSWK3zY19 tdxJMvMnk/fGa1LOcJrwkzEgt/3UOLtTxuxolt+gAjV7dV7umUM= =Y2Th -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-armhf.asc000066400000000000000000000015011501676513100173530ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad4ACgkQ4aewjAfp 7oasBRAAgM0rNNd1ENov9ASlI2kVmZ8f6mVG4p0ZUxfYHPyyXd2MrzWrkBqhDVfQ Vy/5moN/Ux9Lo2UyA3llEsrauq2fAhwaGA9u9TQcqS2lOAPZMw76lCWGIK1CCa6O +dUVWpG46/ENe5r6G0w48jf5F3jB5TAzBaQtR+87HNTbnZ2XaAwpl5N7pWU3d4zz H4A60jQoIuu17poUGi+RETncBbLJI8t+4e7vjJ3XwCvF/flLSR3b4xG0O2YHcx5C 9gO9PC5ObOYzwHId0xAAOQMkxMyck3m9b6Kl21UAAqqyAs9QOF0KZB0WreTUzrHw i+WMpZr9b8W4tEEMAm+lcwL8euUCDxZRY3l8UOai/uNIG1DWzroqGYEQBGzvVfo7 JHFIVKRWoCDg2GXEqS6mhWb54SXkfAgJXmqDwuOre5aBCajUh+Kbbv7jtIj85A4j yHw2I91EER53vGuSvbTet9D4NDcskF8w2T7Y/CpBmnQhnolpQgO0yUdopXiuAdDc Km/dHz50PEQxEfqVXQDEfJaywRkvsAKlhPbToZnaytSEACxfUoG4F4MPsElDRqzD TSjTD9fHyR9ftrfRuzsGyrKGqHnKUjmKRz25Dls0G3sspXPEC/uxJx4RvIpXsuYm +8fW3ILOX+sN+naE5J0lwUz40Y3ZCUbE4zh2PfaYWDnEct6tND4= =GENQ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-i386.asc000066400000000000000000000015011501676513100167470ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad8ACgkQ4aewjAfp 7obWbQ//a00dRznMlKxdOnjPJreeh3Fx5qtn+l6wYFVWBLIh6tbQmcnt/UyRP/e+ O7TBnZmA7z9anl1xpilM/lyizRs5rtmv+sbNb9d95Rb75fxL1hn34vk6+QtaUcZ+ xPP1X+gI4ZDLcfWrIAQwugfMTK3tE6DRRiyhZk9ZGqBfjkulgBRmogBFFCoH6K37 L8oDaA9JzGEBR4Rh4Au41MB1lEx8zSCmLLFQLtUTMo3LtxjUFQimbzi1n0zj/4ON c6pl7VI2kcWyIEfNfyXP5IFkZ5aHNhUtyfsUVVH1uD/U5nymq1V27px80ImW2BQO BkqLJ/L70cczaPbKZfyfCy6DTdioxPldVcxTQRFm51TVBGaW2nz47rhDedjzc3rf HXyRpqdgzMgBOWDzR3aWnIVgjp5yTN7we9mxG38CBcYaJNmyRNLqQdl6U/xafSd8 EWh7F9bMDNsXZjxPLewReLgvblR3Ahkp1GYGTq+OqKP8cg8JdGJLTZCC/jaxSFRF m2ocXZlHiE6DLhlYdgYsqMk6D4wSoals6HgF7cPJTocaRsakKDsuWvk4PpViTpzb KWaHF1AvW5LQ7+Hwu8BmvGeyS+ihOTVGU0gpDbQ7H3TR+j73GjXcya3+e8gASa4Z 7MjvWyF2NjSUJmj00pKIOnQ874uB2xmtxoeF8nV05Dt2nWTSCHs= =fQU6 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mips.asc000066400000000000000000000015011501676513100172260ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad8ACgkQ4aewjAfp 7oZGABAAivoO8yiLpLCtRaB6hzvBkaIk1XYf8FRyAeo5lu4guY42BiPkpeQkaWfH NCQ6V3+MnEPV5h37A4NWZWLaqhyoMagqwwoFvOhfvqDsyjrHQ1+h4mSTBbz+1XGe dw8ehEcqeKDwZpUaX/CMhKPZExWnHQLZCcTC3PdX7n+itZ+XVowUTBaAobawSqsl L4Y8Glmct+TTuy0/72D5IOFWPjpv5AeCuGgRrFGQIY9u1gcjG42PbtN4XUbC4VU+ rh/5KXo8yi3x5+FzcZW2XlN49aRg91Wu1WtlUur7xuoSC3byRrCgabHbnXp5bZk/ mwrbOkeR0YkQgqdBAE0eMMQLCSzkuhiIPmaSVQGrm2wr7E+GUhaWWa8DNt62phsw /mFVvMmTlUdaCx+6ncSBWheo4XiwTbqcCWU6mgh1ShkMlKMeNZIsg98WtfroJLnw Dheu54UOl+5Y9AEJkISsQ6AZt27FloclcIBvckjuC7xYtKkIFEgsanyXhbbQknA4 FwIEqyeK2PWn++oLyoMrS5EZXofInxQIiv/KIjdS+ZJGvh4ZBfYR8a0d6o3i9KNK WBKHoyirPFhDuoi6cMwBdsILZ8J95B8wlcMAw+FyqJ3fZEu7JtTQRTtNEaePhqoR BLDwxQYpTI187W4rtCOGn3cethEF7oeUAKYLRBm4VQ5sHxQ4i9I= =Wepb -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mips64.asc000066400000000000000000000015011501676513100174000ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5Ad8ACgkQ4aewjAfp 7oZAAA/8Dp5vcoFE3+S3lfCE1TWDLxL0atKQYCvi/rv0wcyUry9mDN2tSjCK47B0 COI7sSLa7yDrAePHKsY6ZC4cAgtwsRl1yH05+cktLCYjW2iQV6/CxX0vJ52wi2cM tXIzt/rdfSRWr0h8awwx1YjWo2AwVCbujVvhrrPk5WA3tR9Z8RYoKidWYnTBO3pR bw8TQ4h+CqkBivVJyJuGg6cafPvkxEdcxQw/ImmLQYgdc9epMZYOczroawKtXuMs z+2xULPHEFZfEmZshn/duM9k9zM9F2DHavE8mEH+DKc2I2z1C9yacpGHdPkM/XdW ALHMDod8ZhJ6sSO5hVtyUNjPzo9qFokLubYDYGxf4tiQLAjTnEBwC15vzK46TSu4 VPk4gUn/pa3qqrfJAWpKD9fu3vYf+MAB9/0ypY+4xeoUVlZJmBKnMzLKqSLtWDPB bS301XY0RlLvsZj8Sn6d0VhEqi1bOOvYtiOH+Zwusgaj2MJaOGKkovqhPbydizXE Vl4Z+FcAOGTsEzpYvnQSqRwwe2PYJaAvLOYHjJZEdaFOkVYN+10TKwCTMJeAcT4d Qq+I1L2c3Y7ZASQGCm2siq5y+10/YuXSsMDSfrdu+P1/GYdDFc6lWtE+z6cQ60NS 0pitGewDaoCY/S2ec9u6CEXmH4lLNRkf5P2gV2Mf/eUCW4HXHzE= =laVV -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mips64el.asc000066400000000000000000000015011501676513100177210ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeAACgkQ4aewjAfp 7oZvVw/+KprFveVbsG1rKxqioeqdN9MRweIHsM070GAoPcHKzCdhiT0MxtRZeRAR VCvcpncH2F6Fl2BCbg74cQA2QR+LZseD+pycQxCDSSnkmikLsEiOYpmLp7U6mZuq 7ao9IfB43WwtcEiUIUa2CeowER5j6LkMAfFMgIcA9RgR2byhE7yo6PfXw6sUBUDY uzd9e955g6P0n4a9h4jUziHYhPfhVAnxVQe70fMB/b/lCbbcGANf+tRftT7zmMMY h7r8YXgjhZSdEr8ZEGLqTZWTOK9Jf1vuTdM5oQryhZeCKyuLd+/K36iOEVR1SqDA OqkICQDxBpM+QuqVHh/85fT6EeJ8xo705xA9l6onUcgdGz/9bbrn2PpyhSvZ7ZNN 7/jx9BDYDdGocYr+zmCz5JTVZxkQ2Scp3+t9Pwfrnimt1mz1Rd6IjtPjCk2SxQo3 j4Hl3vphNr0N3Gn2xnXXer0UtgWdsbCjJHL03L1iCeBonlWJ/XibEDZzQAbWdW6a JYKx3Ncv8fPyF8VRUHL1kidoK/mTqiTwwXX7TQTys1Pj1BaOSpMzVwbL2WQK94rK r7DVh+Lc+iMLGsW61t2KUfzMKXf9q49gdi0ein9iGS/8/MWz037Z6B/wHEgn3tpV snsX0Y/GGfL+a98x1xCN/M0PkI40boLkC2GJEUJV/O0nVrYAlbQ= =w0GK -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mips64r6.asc000066400000000000000000000015011501676513100176500ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeAACgkQ4aewjAfp 7oZtDA//bbJBUS/KeWGONLxy1Bi6ilswaAGQXNCChQTMzCwXObRrHji36aa/8BPJ ATObGR6PvNO5XbIRY1Yl4/rZCGTOUqfWTqFOPtXUuJuZOSUXemIGpDkGOcchZMno jIc7s15/0zRrl6czpYDaA9Q7EPF3qE7nZeGRuvtWxZKqn9jD+SF5Lltm+qW2OXTC xNX79PY6hpCN1HYO/ogdZu9Z3i+gIKPmD7WH0uvxqib2T0qdWenVjL2WW0R/0hk5 4P4kR3L6DCz2Jywad8QO1AIubdwvUJhUlnDZ4eHpkslUoMcWxvKWkVoXZg+LoeMR x5MsDCgVhBlMI+59/N+CSdXglXiFL1YGVV4qM+nY4Wqc/3pWI9JdeadC1egQdXNw 8bkH/LJzdnil6fCJnkt15YDd0UXs0GqKOyJRx6+8+mDNOhnWpKxtBEHlKZOrd36j ImXSq1tvfvlV9pNj8uv+NS1eA3GT5ZO+ATf3QXQvibawSJbVAXonL6+a3ryY6uGG LvBNPt8Lin8+wjxfqD3CxCAlTUz72xPUKAWsXuA2F5aLh/9XsPOkcSO+vMLzcdc1 GpMD/wt3YrNrinr1YjGrp+RDYD3Q+P7YemDI8ZSMu6mkg4EoCL32X5hMBQBNaCCV 6id/F4dIj9padip/aodqCRzywxsrP4jRd2TH2VCCbge0iQpTbM8= =n+mq -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mips64r6el.asc000066400000000000000000000015011501676513100201710ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeAACgkQ4aewjAfp 7oZqgg/8CGg8e8wccgimQTr5DQdexc4f9YLwRTDhhdLihEhOksHjmx08/wqTmx7D EZNc5J8sr+SWwyTW7886bJZvxYTFrnkKxqHA5sTEepRvFiCMpTh4uzqmpqkuEKCh E+ATR6VnGhfU/VA4LtHAmnk7u5KJDamoJgAF6cbDhO2TkkahlCpG70ocY9zBTzcY 0QSAfr6kzLzYNesDkJOGdek4rKLplycJGVrIV7xI6z9Xn/XrE1Pf/OhPQnpftlFS 2YhVZUNjyEfvtBnZBBytoKM4PXwOyfUHjWh5OltHEmNK/EJ+2fah7dQQY6A512xs bSTxzkOhq+kAL1vb+DS+Kma6A84fBmbzkp+03zEc4bYZB0mzgZMg8sSZMZ87hEPu 3raSRKhSAZ5XAPZvPOVva9iBLn8cISK+e3occGBsdKWQnWrowLnCTpe9o7hrW1s/ 93Sj4PbeMSLY5IV2YLmfw7p7ASmHWnJE/kz5JzagVVjGYT+klcGf4EypcBzdON32 G09HZfiTra2H3wKjv4TkS1e57xnNhLuJs5CXxL/DUEGxPPBpokT8gSt7VfITu+8V ngLWkKhLUlzYvueV8Z/ndg5BzpzzCCTx/48KGFmKszSkpBbRiNCsNM/ApQTi2zAG FBjIahuee4M0gVwfqzkp1941s+6GRB/TWmIefSzPP0305rHt4xQ= =H52W -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mipsel.asc000066400000000000000000000015011501676513100175470ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeAACgkQ4aewjAfp 7oZebg/9FGfdkcHt7io0nphbSd0cnaZN8VSnkeCwwl2VXLGYcQHZU9q0wRQgg6k/ ldiIAgGlRfyfiR3UH3dal9l1r6rAH+GqZ6Tse8ohz2GvUwAMMhBnZioTmP8fYWEB FiumR7ZMxE75AVA74yrWpox7Hadlvl4jzoSoWFV41mW5jklU5VPbt0in0FUy+pQE zY/uvb97ayZTRO9UOg4f2EtgUyAWW2Lf0NYqfliL1XLT+QhApajxecxlkvhEP+yJ u5YrQ03YvteIg7fa2O8ZPeham8A7omcfRw8xbgpT8bFsmQgomAOSwChWb7uvrBBf rVK84Uc38JeuwfTfdQeXr9mfxYg/2aAtytzY6TKqVqERtve6EU37jk5povEaGTaB mfgA3G417W56zBaalU6TvLIN+Jad+PUHiy9NS8zme6bZ1jwVQMLvk8+faRJBE3jd oiQy4Xig1mHb0BbtHc+sk9f4Z0r5UXOjoZuMWi7svSi5FkHMhXKBPGMxSlyZEERx G0oU/XQm+neKiyIPsS45o1eJ39TvUb0KQ0+SZOey8mHLiyaZGyC58JdMc+zHTwb0 CTVxhz6wB2TpjTQOj/Z1RHeTvoB0L8j+WXyaZOULUQ53vbrTTF+SNaYWxsbVQpDk G+ndnl7j/A2wRw/dpB41M7ugbwIWHReFaZKSkuCQ/+ZngRKVFPQ= =ZGhW -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mipsr6.asc000066400000000000000000000015011501676513100174760ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeEACgkQ4aewjAfp 7oYC6BAAqP7mBGZYPE5yjMQeBzEFn7nzJSs5thp0Eqakor5x3RBrukI3eYgRgmMK FT9HcV4JJCP0bV1Wpi0BFVtLdWDhm4WN7Caq4NWoKEUoH8EQuNihNoxbOy2yArZS JpTnDD1i0lRSV9K/s1JCCFlzB0RInl77p1KKKWufa6g9iyzWjNmpQsxKBnzVHvbk 7vzF/XAHEyvBZPSz523EX6skU6+K2IYVUwZFmeXLqLCWoslz29SCg8Bf2qpCQSjd nRwc0CtUql17fYDZ7wH1eZXsDhSk6gkgfTrCiAiZRDBoCS1dLSPdAWvc6V/H78GD r7SmZDIx3SEkpMmqqCk9FUyrW83z8UMniqkt74n/rDJtir22zUSJeTe9DFJ8FssW pMkK3kUqzVK04urq3yws4tnRbchBsE0k70Zn/yr1I/hcc7ouSs/qZZY/H1PIQoRi moL0BI4VYvKZW+ieAITL8M2Mfo98poxU3dFKM7x0jTdtlG6wdbb3LhwLkJprZAP4 56o5VjyJ55I8nJt4FyB2q8EvDV2CDlsFYlxYhSaSuzlvJmIiPvVShKtJQTk1Vie8 wWS3TP1syyMVCqJ8kpWY+Gv8SOyk5GA7ZRjMkRQwbORfztVyl+5L+kReaQgqTuZy gOjWVJ2E8UGFGsrh4axS73u6lG6tuD21tB3ZK0QUqAy0iJ0URrQ= =hho1 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-mipsr6el.asc000066400000000000000000000015011501676513100200170ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeEACgkQ4aewjAfp 7oYLvw/+NJyU1VwwFl6QJdCauq5vPUKLzKxAZFNjfycmKQpmVjhQpzUOOHr8bhaG LVCGjdK7FM4j/shdzWLCLGiHcJYtABHpxgXM8xrrZ48LH9owQooGx6gJC61m/YPe RKMBeYXBKaFFv91AzsdpWIuQUp6mR3LnBGujcKjNdAuYV5MysekNlCQP+ib7CNii jrc5psQHDHj4UE29OXyizXnynKRO1KB1lJSYI9Ruh1+/N8rRgKkFvU9l1PRQrjad 8Vpj46DKK34Dp6Oo/y4YNznFPaLGYoyUfXpWm8f0yIXzzMwghcjU4AnewX5r8uQs Y3sBPPj/lnogzXxbUFjY1o2QUM05GyqmYAKFUc9B7PreOrheY3DL9ChN70vZi3tG 8x0KUtKFLsKTmy2PTQkmoeEoOPejBgPrhqVJmvcJv4xtqRuT0DyrfpJiTyOBfzIu NmJWXmNW+afSZBe6oNetbR9ZCSuPcmRZ8nk72/swXCv6FMtybMTwY2oEElyRge3B SJZJsheWETbEXHDEFSbDEM0B+2atl7y7oJMQDeNS8A9m7TIEO0whURsTH3tLHtma 5er34OAgAr49/PBy2HaT1ovHBKRfKixLplZciZWvG7cmDD+q2y6DpoF4cKO1IebB p1ZBmCQmdf2F5MqwZskt0jtVVEW+eKSC1b7nmtdT7aaX12cNFC4= =4zj/ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-powerpc.asc000066400000000000000000000015011501676513100177350ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeEACgkQ4aewjAfp 7oYHUg//Wcy0yGeuOddRfr/XoukiRS3PflkYVhFu2TaoebRB8YLLFL5MhmgsX0c4 tGzgR0//FKFNXEpqTeVKY0d6+HxgZMBdkYHnT5w7d7naOTIpLgPV7kUSjC13l9vy 3UCw6vgp+sWR3oaspJtIb+2G4PQaz8LWNEbLiVAtAtBY1U1QlL+7f2/e7TePyMDw qk6Wf0dptqFJb2yoHA39Y0yQBC7ZsXJf6BhQRHH4IOKv7sHgwGuQMrnRuRcihUX4 3GorS/tgjB6lbxwuzDC7X4ZFdm/mUZyzsjFimUp/g0WXFcGsFi7zQI2IqgeTuqSq vRxBp1YcFvbV8dFikiKEUYum/gcjj0CdXbYIJEqtB899l2U3V+R5q9u/FNXcbMn2 bR/K3Df82rd4149oH2+ANqpzXdRC2waTZXyjlAyPGugaybbBUuqq7JxnEFULpHIK FrZf3I8mQ++fFIz6QUFP1dBQ6UxTHArh6NIPg3AmMw0jmBbCe8iaW9IsWXdaKvLp hJK8Z6nkWKqBbA7Xd4zuRBdDhkeB8n+AkmXlaxa3U1JXrX8oURsgL1GJeG4oBgxE jr3+j0h0Y/5mlRGmUb8HlDwdi7nkeb/7mIwADLpEhFnr6vlgHJTY5sPapJPO6FmT HLY5FfnDG8mRpRZW3+3VwYa96CLTMEzQTu1BeiGWbMNV+8yizfs= =B5H2 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-ppc64el.asc000066400000000000000000000015011501676513100175330ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeIACgkQ4aewjAfp 7oaaBRAAweRRCx3/ECjMxS4rutshQLXri4/gyzMwZUkqWG2p8+G7Zujd36UZhHBV Y1khz24w9ovvKozu8jrB+8Qf1UYZZ2ZXPeD9kRwWwmAFoDsDpa0OiI4BduCrLJ+E P3rSbCUdX03AGS6fQgX1ORwAAXvw4FT2U0RQTdoJOh9zs7ZPy02fAmQw6H2vkoSN //mc84ieVoo0xkLMOJQNE+LEz7IqT/cGIFgvAgRit9FzbvSXJ8mCXcSXSDIIPPoY YUzGTB6coq8V8LFL+EIrDLczBgQXHIaTNuVz1faFWBWzeSNuRmoA+JbflWxdi8WT DmugSTSPON0cAtEj2rsq6/EN9m7GdJCJy8a97qI3/YqDVxPaeu0q3AnB86Nt2cam PrlSTMk6rP7H8VNRFUj2pO76uD05jCbmZ+JzXvkUzeZrPVTYc6LC0fRy1XZFlmaH z0o1I/xIXh/lxM/j8kOf5ZNFWragw18/TkNl8nankEoNIQ39nol3QlsABupJviab jx5o+ySqQAFPxqtJNi6CXs3nulZc5xu3sJtpyLO6u0oSKyVe1b3XaMLIXNADUJXE 2uRiUjZ1i/PVYDPyvP47UgHiOXzeD2iHeRwe9BWxXPmwuuKB+0S/xJwiQaSmsuWV fgXlsDjcNz/SA9BRarrFTdCCULakfDR8oYMU0RUvOaXClFkCFQo= =zmbq -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-riscv64.asc000066400000000000000000000015011501676513100175560ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeIACgkQ4aewjAfp 7obuBA//SDD+zfhAoxy1HF0JuKcew9aRbpZGhswWmkUoJnxaXGXr7IYc/yNOoXiI Y6dypkXhHeAcH+tvlM4YRsnkiXg8ySuRPv4+7JaKL7RrLhAFikXmk8pYz1l2r+El quO5NrC2bk4SbsYRFPPIgmo1C1FDYUhAHavXTSV/N6k6e4CnYjKq9JRAmcBoWrBN u2vhIRMIGwmmt3jUnQ+KZ18AdWAtjBRJXs3986Wl4QjJImKrw86KPCO0w2i05z25 seau6TClF/Xb6AD1kjyVfV28L+XNNrY0T2BS5fk2E2aU3LL5QUNHBJADiwet9ngg 9fibCViOAQy2SpomFqP9Mt8RCz9wLRGBwElZWJ2GCjuXjbkttTzxKfccTl0vLpRy tit1RwjwDwqyOGF5/HiluIzMybm4We80JAdWFCEgclqC2Cz3qqRX2HfV8SSMNMsY 84uK5meYgUfBC7vvyMe+XaIxXeaNhHM1Uv5GxgYgTQ1d0Q3Ye6Knf6oUasTgC3bN 6fdrSnSTblJWatwo0ATTVhu/ej5bO2AvHssW19P3JCh5rElT9YjQv/lnQNV3I01J AmLqD/xY6TRXDfk0/GUBKd5FIiZlvYZX41TkN02OOUFG9zKS6tHHzqzBBfTUhy+H Yv7Yqn/2WmffHegvh6gcr/oBCsYQiyeBlmHLVOfblEsvw8L740s= =E3X8 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-linux-s390x.asc000066400000000000000000000015011501676513100171440ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeIACgkQ4aewjAfp 7oYZFw//WlewxesQYR93j/Uaf1ct1IAfA4JUEE9z70e3QJvXK4r772ouaGqXl0ja plIMkapZ+frO8/pKZAMXNWxhbS8D1y/aZ3S/X7l5knPqmat0gQGRgyzd6Ll46f6Z 4nSHLaW1v48kLBKQIzluzfvtcudWAKtQ4YN6XWw61A2kLFS7MJaJ0M8ztgRflmhV t1Sij7goRH40V7B/VshzY+qLORmY2ItPEtszOS4jpxIOTBQAMXotmDbogjIxHiix 8LrS5tBosCKjcYZCUkkWVVoJPWwY9aVuHWXGCNrgtGR0r3wBlj/yUP2iDHJyrjtt hG7rK7U/zR9crmM5fRiKWOzTe2wBtbWQ4FKjerp6R9pYoWxHGSBq2+lju3hEdOWv XjBnMX8DyjH0LOgYm7VIMuIjzEd6NQOXLcN8sqB+M9GGTQqv0C6621tG1MK2c4m/ e2UvFs5EyPEqMT8FhxhaIIRpVAEGuPjINxRAoM5NUI8Iklscv9uETiy7rZxFU0j/ 3fwZBG0n7IodokAGnKt8tOiSAb4IL75HM0QplJ7N1g0oCzCWAu+aNpQ5fYMqXArg /ZEW+U+pge476RpEtCscKIrdN2RDgbbs/qdPxAUTGumI8jRXbz3kpwZqzMwkkjOX rAAsQd0CxFmMlTKP1JbeGKG5r0nXlwy1V6NIfHZBWqMcu68dyUs= =lEGP -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-macos-amd64.asc000066400000000000000000000015011501676513100171340ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeIACgkQ4aewjAfp 7oa5UxAArvjqfpysh/3fybXNbUtIUyusFuOI90P+y++AglxjOGM54vjotp1ps+9h I8ET9KZcevHbh1As9w/+W0ElN5rph4PEuYpiw6zi6Mgb8b2RVEPK/n4GEmgscbXW 2vth2ZpXGvDY/jHy6pBOwMPr6xRhObBipo2RbIJTfgKZo173vbeE+AlAdVG0kvQl keNox2ZppOQeFvFa8tXpbhi2YkN+uVL92laFiSgMIM5DtyXlqpN04lduucMvysQo wLkxKBiKzE3Ai0oPMchZu3VSamZMoHNdDbl05uvuEZh3q27e6orNP1kqtHz+qD1m xY5jr6diQ5hUtTESN9GxmpDQsVWveuCYh/y73s9N2Fb9OxKwLCESnTW9ZM8Q15iA wjyOSzOyh4w/p/DsXcQonKyoWDy90HiYy5jMr4DAVCRUy+MmhXk7ELQ7E74Thk3G GqVi6s+QOcaCoSMSw3GtLzgPxhNAF+0jaoRIK/Ma3uijzlY+Yr3AE39lQ1QgwPBe RHnmK4R1fhWiKwVRR+ZHfo3n3nFufnBodwEGULibeS6BgCgZdLi1OLc4MeSbXsBu o4cq7IUmy1pIesTsN/BqMPAs7zza+5HHwSpOteVAFNaTLp8FWK2CdeEEKHY3gsA2 LsOSUak7M7nXmz87oOvSwAo6QWrKRuWjsbzRa/kj11R5mLAuanM= =TgQ2 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-macos-arm64.asc000066400000000000000000000015011501676513100171520ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeMACgkQ4aewjAfp 7oaXeRAAzTQgBsNKXOoSMupn1SLM5F6yLJLwd2phJCdYGsyiKzAHLibVVljRrF+a N4gLANavOc2BSeI5Jaj227VWu1cW2xFUIHz00NtPS0pDAmHYTOKHECItqFKN6PVG frImLw59YDzuySsgcUyFfnje209tEGCSgNAdByYPHkbjD0Gj3TPYEfjMHwZp14PM MvXDoi8s/vxDYP/dZn49ErLmf6iQefBuf0nU9t5RXJOUlq3q2+XYZQeR6LbyR97p oR6XxCDQJwJxnxUnJ+1CsorinR1R0uhbWqRCMeVwvm0k467Z/NCcKOM0eOHe/fGj 6ssFRn4dCdcefh/mna3fxFEm09wI/u4DTD3CsCyfY7lNWtf2J2y7Zd6Rjtz90NA7 omo000dLYR7ksfeIFBgjaMj3w+rF+pru0/TPHSsNsqc0J3TkVeubzMphBA+wsTuu jRXusoFLDa+H/t7L7l5mcA5vvHLRGsmadVo4eXq+WBRdmAOGmyMaxmMyxsEkGZdx vhq8llkVOmfe+HTJhTFJTU6n6s/E7lf2Sn+27ZAkPgfB8VX2xl2u5FxGc2VuAQ9N OQdkmBCx2gxf1qD82Vlqa+OkWFPNATGMNOU7Po+bVUj//btrZH7N8sg429ES5/OO abxY/743cJFEhBjqCjU4dlC2QYn3QbOA0VqVmA+0uDOKvYCtGCI= =jtvY -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-windows-amd64.exe.asc000066400000000000000000000015011501676513100203040ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeMACgkQ4aewjAfp 7oYpAQ/+LIS4ARgvPVvvv4ph7ICz/kC2rOKoaXW19Ce9Vm3OrFX+9PXzfMIV1HAW uf+din1xX/00BqRz3XSam4UO/gruhxnj+76qU5Gc6P7yO6YIrEb8mDTuqsvXoSt0 2PWixwJaFXxyF+Qqo12KCO7W/Vyl0v9yHqOLkDY1qRn+XRcYZ9/7iA8N+PModgvW 7Um/XjWulNfPXxMUwEbW37Yv2YbidiUyV54b4kUHVhjqVPDQmMcoglyfWc/a5TjV tWYfBTkDEwlHZUkUIzysuykT6K0yhsl3fNekzc/zHAfFnBl5RgtFmAfFk9PL06hX HaCYpjhx59NRkxv9xIWu0eTk3GZmUcftDCRa6mDU4QD1vWFq899pEUfx06REBCMi wFqz//FL+eGqEgwlHY1rM2ZN8mHTnPt8wHn3lh3Yuk+J5WbfMoCANLHp3UnJRHly JRju7LxHFnRgxHSUPcgscZf5j4QBK4UYUvFnH4OAYMnGMp/JDJtAqE+D7jiMgNLY GGhEtxNnHzUy1xT7O9DOS6V2J5CZpJR3vGAYAXU8EXyLMnYffiGgVPrZJQ0Xw6oY Nm1wyWPs7O9PSqXfmQ+hX55Hbw6sztseyeNLymTjXz4fO7Yn/AvKGGtJ8gvE376e jFtcqbkqv44bYkXM3fj9xH4a2YEhgB4XENpGcDQzZ31FNm8WRvA= =CXvM -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/jq-windows-i386.exe.asc000066400000000000000000000015011501676513100200620ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmT5AeMACgkQ4aewjAfp 7obBcg//UDbVPVBKipTchOThYtZSGHoquIoYg/Qd0Bw8c1sLUmo0ntASsUZErMq1 bp3YNYPFDJhQAirAa/2SsNyXcTDjRE+AtZ22eQ42YfCX+wXz9zszMsL9ssb2t4Cl D+NpjmpN6EB3ZpqhNBNXMlp+ruSQO7oTyH13HekYIH8q2ejquKcuk7AlPAzJlzTl AsZOnei3mzeZ9nUXX8cVRfhTXb0F7mXLjqVl4eG8yDq7+a+VHTa9iNo/bWjYVm5Y +FGGTDidNA+MjjJBQ/T6AiwB+utpjjwpPWBWslYswqZrhqPIf3+DMmKc0gL2Tyjj FEzrlhZVcnS1/Lu6YMmurEZrooJK4xIxkQ9FX2I49o+cmcv0Z0dvGOdB+Nn90Q33 t5rmQackLqac231mqzQzCs+YeRe5mjkuLbq595xMb640KC++rk8EyCe5oDOf7UzQ brLxqcSa2bNs2bnkcV6m/c4hFrJmsBy/nes9QbgOP+qYz5aSIJqrgekyt7eIEhFI aKV8rKXBvQY7ie1FXXv5r5IXYI87wZwAn8YWupbfdfHbqL71FjEYcGPVBYbxF8mp ubjCqYrRDb3RlCWMkJW5V0EIlP2sXZuQGi3X3tOQkQtw2sNjjlG+hf8f3A6QBP+z LaJjAqFNVZWbCHkzdoolYMJpkE+gqjyzmiJcLRBtQh+Txut+nhk= =0O84 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7/sha256sum.txt000066400000000000000000000035421501676513100163260ustar00rootroot00000000000000402a0d6975d946e6f4e484d1a84320414a0ff8eb6cf49d2c11d144d4d344db62 jq-1.7.tar.gz ea21e5402983d0e351f37fee72c2d456192c734ff7835e504d3d079dbf483a4a jq-1.7.zip 2f312b9587b1c1eddf3a53f9a0b7d276b9b7b94576c85bda22808ca950569716 jq-linux-amd64 ab57ee39075db4a23f899d396ecef3c6e58f6aada35bfee472468210bd126940 jq-linux-arm64 5f9129fffb49ff28a3f66a337dcff83a846146ad16a52784c1bcc3e5f26f3173 jq-linux-armel dd9786221a3a0f250ed227706b7300a69579529ac4a059c874c35a9efead68b1 jq-linux-armhf 6e8f12833541c5cff94c556d72c12585821fb68bcf09acef56c854d107fd5a6e jq-linux-i386 1a2a5f3706bf1d192577c34e260ff1550c24d8a93d2aabb64e46c29acd6847a1 jq-linux-mips 7b344267ba082af3b585ba552c0597a15cc76eca682a0cce4324e947f1cb078c jq-linux-mips64 3fb0c8890d4c07a22e47d3c794aa019df72880a5b84dcd2c2d2cf95eb16dc837 jq-linux-mips64el f4a06ca04d946f736f3754bc9a89cbfea79fbccc82b731a7816554f242357cd4 jq-linux-mips64r6 08015dd24bf546285881a423d582accc0d653b61aa9b99a1399e1d2f25308d57 jq-linux-mips64r6el 22dfcbd361c7fb672b6cb7e6aa47fdb73ca54ae27fa9a0127e291a80ec2e64e7 jq-linux-mipsel 319253ef37d3df187057f6cc99803bd03f234dbaf575efd74d1542ce800ebd6e jq-linux-mipsr6 badb7001ba7e4b9f13a95d65f150d35489904381a3cab415459d0e7e7b788ec9 jq-linux-mipsr6el 3f7b76dc415ebae4208bca4d031cd91362c12f302c56c2de07379295502d6fe8 jq-linux-powerpc 2157b08ad830c013346ee70edabcfb0a21bbd62d2c470423d1aa636ddd51764f jq-linux-ppc64el ae5f88513882250066e5773e7dff5b54e78b28493b669e7e4d29352339a204d5 jq-linux-riscv64 60fee34cc93b29905e2f27b713bf95709b97df5845b64cd1541bee461eb0bf81 jq-linux-s390x 4b4568fb5c6cbb8f1a8f640ff601c6d2bbecf9fa8f2cf796c7482e7054a01c41 jq-macos-amd64 b8d313fd4f3bd8a0b338b9ddd1c006fccf9312dc609a20d2d6e4bad964aa99f9 jq-macos-arm64 2e9cc54d0a5d098e2007decec1dbb3c555ca2f5aabded7aec907fe0ffe401aab jq-windows-amd64.exe 9500d0300e28a930ab3430a101ca940038b8e82ca441f5c9a1fddaa9d1b770df jq-windows-i386.exe jq-jq-1.8.0/sig/v1.7rc1/000077500000000000000000000000001501676513100144325ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.7rc1/jq-1.7rc1.tar.gz.asc000066400000000000000000000015011501676513100176460ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxAACgkQ4aewjAfp 7obZsA/+L6N/p9+VrkfmdY7b+HTQ+0R+o3cnD40MfiwS2DMOi43fTp3GaXxctU8E UqPWO1CcV+prjK03fOvnbtRD04B3oCzQkNed9L//Nu6ZtMHZoi1sVMTQpVAC8MH0 WGWjM9axZYyh+ZFZ97CLm+y4OsY7f1yS1hEyaKEXcnK7M2BtLEVfiO+N+ll0guBU 068Uuf/2wXtjPR2Ol8AWUnyJcrcVtAgwheDT4vJackMbQDzanlbChyEMFTvJrZCN Cl2ug0PIcgVpwJcRAQuKE/26UEoN8wSpWgL4gFHyQBNwz/iPwM7ZBbT/h//i/aOe YbJ711yTtKcbPqWhI7pOyoSl//XPFK6sPMrYUPwHAcykY2nGLilhqaoE2BfTuthj 1Tc6KCz7CEqmouyjeTiKbTdht0hE3fIgZd7D9chtVf4tR59wNpdo26vFdJewSqf3 jrAhLoRt2koPP09atOtlxbBv1/tk7yKi+tSO9czhPaRAam9cHFC5ZfRkZ/6KKjSr 8x6h0eWF9XJMpAh/tNebZEhQxwIOuthQm/BpNG2e97nszVWmAVGIKIG9MyY/ktj4 oHUU7LoljUoB5IZtOeueNkkkktzvm3L7nUvXYE0ZUhKxg2LkAxk55n3hWGcqmYoP RlBHeLGuXr2IkA09biUB63g909gpGu9u95trCl3GcqpykFxxKh0= =T2uG -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-1.7rc1.zip.asc000066400000000000000000000015011501676513100172430ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxEACgkQ4aewjAfp 7oaSAxAAhK483fmOwxxGdpaoIGsRGhQ3RtX/GIVER9P8wD9aP9WjGKFxtlxTvv5J Et4FNBobPCRo89zspGjp+nZ8UC0ai5mH0gpZz17j9X/+zDKygA1jtrvv7f7s6jhm dZZMsDUZDjQvZOw6JoYOqwzzihP4O2oq3qjrqqcLQQCyKvT6nZto76huwYal5zj8 JYNP9JjmXFi2LOGz11qL/5nxXVp3uprdaAWwJmagiPFOhLg9MG7ndp4IhvyeHa9W XLLCLHMRoBAeglmABasthCFRlH1UDjbYIqswmya6nxbHi2RREptU+plXuM8LXJhB UAZx/i8CiFgcAOYCf5YYMoDBY1HW2W2pIL7Jyg40QOk2Pb3AXseWXKtqNh2aFVpk TbTXrfSpEerZKzncPphPie8Y091H3q7/g82r0RaLvsHgCPhSwvLeH2LKWndoXWoK h3h1FT9SuruDmOeD4B0N8U4rPaT5DHf01M4QZSXeJizkl1x2oi8E7Uv8bT+hi20y FGQHa7iyENQtmyynFqhB1Bkhu/lLMj+e1croPJxS03WUIIGp/iUjJJO78Fn8givU zcCNUDvMI3o1brZxcbxqgAlC5DIQ1hq7WF8lhnlVC1e0tmblmzDe6zc7bVUn/hcR djbGJphfo+04b+m/qJNZrQGuzjvPNaL6c17ta4Zm7SW82SvAIMY= =o6T7 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-amd64.asc000066400000000000000000000015011501676513100175770ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxEACgkQ4aewjAfp 7oaK6BAAtueni5q5AF+ISok5RcqIaz6UrWXt3oQiNd+MFJkpz6LML8uVWfbEwCBR rNbuJC/HKKhBkIRwnvRpHOd+MGZMo2M93eaMgCA5hN9tCvorbVHakeKEzbcn1mC4 CeK9BDDZEuacPX2ODVweFupsUWHm8pWMw8998/ujFIvOs/D0u5HhxT43gSdJzfXU GVDJzReikeE3neaUDGeqok6zd3P6IrY1vR08YRkaNEz7gcMgeZSC6AdA0LmsJvIA pm2b2Wb4s5D7jJ4LThbPcEZ/LV9IhLKvCxHPscKX5odfXPGWUshmBUl/fp1H21MN qQmMR9o1G0Bo3T/KRdXrZqVowAH2RV4Mkte+a9Kml3qzSSNkbYY5uKWG/2atAoXF QwvlrcV7DwffBJOiDfKqmlUM03bBKrNCnxycCtTc32X/UngzF422mg2zLDFYEagy Jy9FQI8H6FTokw/atSpxOypaD49jHl8rlX2jEzKLnycQNRpUIOkdzUVZ+fhMFplr ZWBagyUtO6iJmalWJmbnCxn5ZUBbghNN0U6r+Hk4GNQ9RmSGIbbkTCtRHws3UVHd 7qgr8j9xPwoC1mnH/HGx+bAlqnmtlTP4UFX58NBewFs2OyGaXh8IRquEkYisR45b PVXAedSRGP9h4uS8NmWVoGIcjdNL+p3nV6Qx1JsjvqPesp0Liwc= =eqiS -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-arm64.asc000066400000000000000000000015011501676513100176150ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxEACgkQ4aewjAfp 7oYWKw//SQvepElA99x9XFFCH2L6t+RqDMWahTQPCzhgUD6kzTsr84fnrASCN0S5 OqdN3qtv6b36y6ynoVoF+L1sBCPOpTtvLeOgHtXVXNjpmYftA0XXYOwhjiGDvc3o unL99rPgyv1dPs8V4kvGi+4wCqieLXmC812DJc1lU6thJqM8fkwPt1+ym362bFM8 CmJZQTGNPKqV3M1g8PAHbdRqskl3EIfs458t07qC6wG0dqX9MApiITpsJ0pJeLF0 k1m/JDFhOdwqSffQz1BkwnPDlpGrIiaZHVhOUz4rCZi99cwrPJcvPZHE2uQQQAq/ UAFYrHXRQcoMd/iMovLYgDvI8tsFBZ3bpsozL0Vr7waJ/clIf1ovRfaDXoyp87UN v62y8PQRgs5gsorzMlgaS3yAkU4WmMl/u+r7hZHHcD2Kqj3X4V2vZgcJD308rtl0 e8/BLl5byoP3gWbykf56Lea6ieyWotnV606CR4fGevmW27pGq8Yr1H9MOi+yidZp qmglCLysnXrP8562awX0WEn+7c1Z0RqhpLbw+MuB5to1VpjTPQ0kkLSVvdVItaio EtaxFmQrwAz438Jz5zENJSxYpxmL2gZ0E/lXxfli1adAWHjaGmraGEENC44hBmVH OnJ3G47lnd09v5/BfWO67aJzN2UR4LDmUYea3vj0MWaJC3SkHMc= =7+Aw -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-armel.asc000066400000000000000000000015011501676513100177640ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp 7oYNxA/+PHvmlCmGu4t4mgMfI/PI/o3zFRse5k9/TGqRTjV4bVtvnXJem36GJOyQ mIgfB/QEwbagEqDAX+zs70uzxl/+q+c4/UDzWM4jz2Kblxa++Wx1AeBxy+fQFwiR izgwlA826KAW1vB9M6ylLIb1txD/kheEObh/OMQiNO++CLuQaQRP0jDLdYUOWrZX rzpO3gqCGBWwrpxb4t01yNPYLniGcKIGJl3y854RzUqAXA+hqIzcsoNowqyazdFz 9jM1e7JH3xToBy+xQkOOlRh8X//QUKEzSfLRWwGE/FXRnjLSF/sVNrlCsKS9OUus ChY9K1lq+TRTSi/Kzl+gIWZdVBLhCFF98wC5xwmC+x2o6vzCJozgbmyRRFNDCg6Y qvwI7RlTaZz0qNPfBu+EEz0RTkLTuhyNR7wiywWNAGB+ksxCtVspjqu1wmfYWIBM N1gWTHQ2oHBi9/uRmtllt+PinhLL/CnJCWwfOTDziR6TmEOA+FieiCsJHjrzVxdD NkGGGlmT7VxJcwkBQ+4BXVGoLmYRmj3C1FCeX+PPEfsUGpi1gBh5k7dnBOyzJO4Z yhlDz9UOF++GRYvR93kakqbxJdd0pG+iZMh5QNpkpJxtmdUZbKRu49ZxNx8K2yIF mSdMrwRBq/2p0orB73EX54v2TayxhWjjMm+Pfq+XDr8yFVnG3yo= =xo2h -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-armhf.asc000066400000000000000000000015011501676513100177610ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp 7obqrA//SR6Y+axdJGq9fQJEQnXTwQywHvFR+/bG92tUDlPPTBp+YmNfk6Rfyygz aqjQDePJvxzIAcMsZhHdiyJUk7AMNXruVsSQK1Z2LEBwYlnVi5t5abyHkvZ6hcsn Uy+I7bhZ8fJrIUYNEydA+KygziKb8QVnRND0dNb1F6MWp/pRXWfv1jfw3iuCNpb2 vYtXpTVB5QEbkqi+tXvAZHLWqIbazLLG1zaHSpYBi5afhBZSaZyBDcDJ93xDmDCO Af/UTFQK9h8Q0PWt3aXEBMLd8M7qT66SwbMSveYohBcgxDChoZp0r2Ysy1avXEFc rKNNUPiUnRXCJido3qNpX07b7K1wGRMak5wN8gKM4OCsDyNEerRhEBZP0eVwNqiq uZdez0civ/1PVoW84+P67jK9kw1CMP7E2v5tHQKRelHMhxzDCeKShiMyFpex+4X6 wBdu2V1Bn32/mlLOvMa6XGoqBBGb0xOAxVmJppaHcGbgje7zn5XE3M9mNR9k8s+A E3KFosKRkItAgTLZyCy5jSbYYynALxfF0dXkM8RchJH9XLJp5zIiDYxm9nAMhk1Z DmRDHX+DuEwLk7mAI6eVYvgbMxjrrX3HNlwadWyL+9u8eT/OMqCjIAPQjQCsjh1g SWFutFAuMcmXWgtz3jFrAnleL2g3XdJpbAst3TJm4WvJUucRXMQ= =vNoM -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-i386.asc000066400000000000000000000015011501676513100173550ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp 7oaTRhAAwV64hEwV+kfjTgHVoBfjjztLYfZT/ZYMbGWjIJ4JdTtBcT1jMhdLYfQ4 ACsPcaGfb5nGmA8B4oPS7mCz4wLZCCVCNG0bYoBgWrm8AVcoLeytsx19iBlkCICW 73vki8UcvmtYHF0lwKxyD650nrUZDPB4hLQJxNrluOxHa1K1lfsoZgpZkPLXp9p8 fxNqmx0a87JFT1fcVmN/nYmFM14DWohR4IpG1qfI1HpXFOGngEfZrK/DKfajKXnv eNymIXhJ82dd97hN1eCTSrvee7Fa+xKGQpWtfffe+cTsdLtVq8KH1HRz5QxZZcCG RmJElICBadUfEQDoasi74XUER6NfLKtqWfwXMFsUDj7ABZi3a8tTSwgaa7QuwsM3 WyrenZgr04v0xAx0P2paZrbU0HzCrANzW/AzJE6fF4Cn8mB6k6tm8NLPoRDEVWga 68nF5ZhLeIiVOzcO8PGBB+vZ5f2ni0kW2rEjbPf6r5Ixmx/8OnSbMhfCHsJB08VC K+u5UY3eTvJnY9ykAmFds92FILAa1lhJ3XLUkE/+vgsLVRyZ4Pw+CqWVdHh+N2Jb y0AwwyFvFJQgaNrNh3VJPtNWu8fFWfr2gFJOuHUDJQ1YZ2IewOk1HMrnGJI/AVml O3i3oiP/HV49WHboUtdeekqDQq0isewOQOcma0ParceC+uTgn+o= =+6c1 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mips.asc000066400000000000000000000015011501676513100176340ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxIACgkQ4aewjAfp 7obugRAAgEZOs0LxDS8hjwpDdOgMJ17FrndBgouih3Pl3yFJDWalPLY+GoOU+ZKH 18JhwfWBBmuDqUiq4awmhFPPOSo98Cw5bBa9XXpIltYNeZnv3L/3rL19E20kQQV0 0ZjJwvEpsuUKWFPMIVx+7fkKZjD+W45rdCmTlT4W3hVPa+loZx1xEa32ZRlPWlyK NuFFImRrESADd+Q3nZeaBWoTBi0Ec5RraPVHDB9PVAIx2nyjnxeLXRL/T+Wn3psr 7g2nC+2mH+e44QqQ0NBGmLlSOfJID8JaH4dOJs7eDVlG05KXGcGKM6j/gEEbfZqj lnxAAJO+iyW/gWFPDRO77DR2H0ATRvvWoSV9zi/eYcZcqT6T94gSWd/wX3GqNE9/ IbERzYbSNUTsfWdHIleZ4GDw6FvjQrLywenDuEvGuDQO3eEvbS/5Ydt7DH+RIQWG U5lv9YitMcKLXUOaNEELEL3IExdoYxri9+LU0b0hJhHk/plo6b08bSlVzSqG0Ra2 fWYdpsyPMgeEPvt2sGVjIcW8j4m9PPfJJGIjghLT6Lix5fnEv9gsf6CZOLt2uBh4 +RN6so0vHXbrEz1cB3WaIFRu5Ey6xZPw+WgTJnHJE2ESGxfgGW9VFgKDgZ7Fb4CN PZon+o9ZuWgBFfGjSQsaOEHuRa7OyswxcUNC4ZLrDZcTvS02cV8= =rD+N -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mips64.asc000066400000000000000000000015011501676513100200060ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxMACgkQ4aewjAfp 7oYswhAArfV8OeY4on4twFOIrnV1a7S+bxc6UwTT9F74nzyG1dTLmJi7SRGMQg2O kbdJdRKidNmrDr6uTQzTw2+q0uYzjq2l5Zjsza///KB0/6oS85D+9oFK/X4bmlFM 5xZu+4ZQNjw8NjyHSQpHcV4DAz7haeSUorvr9AR/5x/Mr0rPQrRPXOKzbgXXOkiS LX/6yyTmBFQ6LedrEqYulaVw9nJTY+l4mWBr+xuA8B+G+VsG8IV53OjyhhXE0RB/ 4xt20mqtQLvuc7VSEL9kd+Qpv/cq+7TgFabIEe/09GgZbQcU/yXGIURoj9lLjSzh j46NKIk1MvML7h/RwY3JZ7CqJcRFmDJMBSjuSLsKV5cq3tkGw7An0QV2WPeOXHg1 qG8YNkLaG1mnRZjEFM1m+czt4vHqFeppJKpmrHgA5Am8VGcrORzJ0A0nPesQfv/+ 5PyprSeUZZt7PMt3v5rnEfS0VUr/+SmHAY0LVAgALcZjZaddEo8wFFU5uK4RNWrN SPUCW0x4sZq7ctpBP4YYAq21o3xqWd9x3e/ikchenI47algbA9uWQpBB6GWVfyzo 8wkT2wHCAr6abZFWVdaFzv1EPUkL6BMZ2giswKD56CQjFCaOPIMBEXqLr2BmFj2L 2YcYTvFeQz/A4SokXy9gcqOiWabZQzSG2iFXiiyoi/8ovcZd8HQ= =FEgZ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mips64el.asc000066400000000000000000000015011501676513100203270ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxMACgkQ4aewjAfp 7oZ9pg//Tro3RosTB+zEFStPN9afpd7s1ZRR5xpkfp7gCfxJVyCr9PF9jgp3ZKCi dwD+3TBawM+ruaTWcAObR8dfRVMoFudl+PEj2zl7aG/LwkRawNs3X4tJCIrhx2/k o2uZaDO1t11cDNgIoTvviNxp5KXTaOdIZvwQlAl83tr/TK4r+olAnv81RX2z8KoB 4gMJPFRWBnv24S2i4cmiw+ktadw9xCouc/iEp91TGSiDJxTADTLYgUxDaG7xg4+a pucfW2eW4itR7YGSg8ru2+QdPAWWwjn0sG+vZmCkOm62NPqdXX8bGoN70bBzog9h MonU89BcrONHd+vWZos9bXvj4hIHkZybKLe8SvLH/7vyoEoNsZCHzekuRzEsDaqo ZUQlp5ySN+FFvENHZ1uicIe2kwpVJqZsYNHHIMu6ggCm9fELs1UKqBUEY6fSrCXO XSf6L31BPYxuzr1R/tegwZw7+UWros3GF2Ptc5eTRJANPFVnXyrEcgXIFc9CuJ8g HwzbMdJMwyEOUqOutE165Pe5Ny4SIPb/SbEfQNQ/EgI1VvJntcLee8k4+xlqx0lP vk7yEC80NIz/pTrTpY/38EO06xX4SudxjZD3vEYJ0/gkv+xs+flOW+KmWWnXeP0B d0YJRTvOzgGz65zghKN6xLSp8YWcD4zCNcWMQLesBRrlZgtLnWE= =h+hI -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mips64r6.asc000066400000000000000000000015011501676513100202560ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxMACgkQ4aewjAfp 7oZGVxAAmN/9DKMfAavBxKPqiVrfNH2E9DBRDRNvLg9qDRRJ6UTMCV5hiH4KrIa0 b/Afknew8IKDVFWL6cGBdnA2iBezGSTraOmZOqsrwJC3wqnXC7LT8RVGcURKKDz9 5WMMs6jRJGKwzzIr25NUjeBFFGRuRhe5lI/1vtYdgCpWDXeKhBYkF/JqlCLw79/f IlLm8ClS5VJKWBbFDKyitW5PiNZsQGiEorECdkjY7C4REoWwbvCQ9bPcVCwEDh6w wVnXccSFhehPcOyonqWPLxmruYWS9yeOn6UBV9/PqgdYYkUF3plfWpRbg4x7lf3c dqUTWZAgRgG1UDyQUTg2tvprLmGIoZ7qloBuyXj+5ENhISgjWUZN7cWXAripIfV1 I7LqKH3/4kN+NlXXKnxVJEq8TiIXzkkBUBDMGt3nZ6F4m0lTykv1Z08dNBj5Eaj6 /7Za1bTaqiFZRHvzDP5/YAH913cxUG56P5RHpvRDmP8WHKJ6qnbRTvSl4vHCAvEc KKbR7B1YRatghoViSSQMGCNXV98GkLx6ix/jmz8rY5/OcXZA+xlhydSWiodM5gi+ ZF+p9Ue3yE+Ea3xVSN2AX46HkkVTVl95zn67iO903VLvKryicFJROBdL6y5+x4d0 I4RSSmVpX2sIb1cnB4ZDUQN1xM/nqzKGACLRq7XdJ3rLbBanJfU= =dz6H -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mips64r6el.asc000066400000000000000000000015011501676513100205770ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp 7oYYEw/6A3lR6zrPHRg5ogawiyDICdfHSO8Dfm5ho1l9N+O9D0w74j1yOeULyBaC JLT9H11AR6Q6T0Q7uF/UCekgScQfKf2KmiCK95a5laVP8QBXCFarS1SHKup5A4qy Ogp5XXb+H2m+iv6jStXoBu3h9rsJwYv8YRgpokeiR/sSgUh348lDhFyuNfAljvpJ 9W6jwfwYU5JQNiemFVYhJosSBeY1SwuAz9y6fj9XU46taw/mOdSxEaDqU2k4XWJU sRONHuJ5VzgHE4q0ookOEkFuf1xgr2OZgviZYQOLmRR3HdULtmLSUQW7w/GPy6hs I+CDpTfO8uAVO2W21iRwQuHzuuWcGjN7JKTmWSI3DFN6WLPRChoe0CmEuY36PeNA I5gD3frBcpI01duq1w7KKIJ2luWtwq2J/IeHwlkq6IGSzmM/ys/UT01dYnCQROmc /63RRryN9/gYYD7SZ/udeGvkRUTpWJi7RxQBaUTqgBFVlM+Q2diF9XffiHyB36Ef 2zMzh5dWbSohN2TDKkgf+10+5n3g/rrgb5k8Rgm2XSwdyRVvBU/8/egPMpmbhl+9 9LPixGljkryTALLk4pImyzqt8MRfMRnQ1vA23jw2Z6DoYpqbOpPODnlmVRdqk3eo U19lFNg30HgauAS27SRbhL5DsHRwAEqB7ItCR959pg2o42VpjoU= =ni4/ -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mipsel.asc000066400000000000000000000015011501676513100201550ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp 7oYhQA//bBoU9oPJXhliOhh7egjUX5w0g+ncS8uCJHhQd1zQZtsrlpA4HwFrx7r4 yggGkG9lB2FsMG08la8xglqKix1Vkmc1zCHkufvvbywal78x5rguJrew2bRXR8lH GtfamPQVjo5seQGD1WspbD3bKBewg3JoxveCA3TbCbnWNeIT7lcuPDp8x4Np/wPj edmFH9/yEt4aF3o1ISZem/MmveI9LLi9isCzL68SeGNnQJeNHp5ot3Oj5umjx04A /X+/ZHJ3iB3cifdfrnvzgpu3hTPaTjnHHn8ZOIU/5rOEBkaDyGHiB5B/lMXTd5kH SkYqSN6fdxPOma1682fXSQAkzp0zvb9gf7mUrHmbjCGKdhOXRw3K1HezO+KLcTTm YacYdu858UyoIjhOBrtstNY5NebEyY1yaM1+if4/EYgBOAiO1Ov66slqXu9dtR4m 4ybhieGanfbviMss3HeJbfB7bvFtGqSjOKHTm48qszTgclgTpL7cxtVXGlGvocrR LtIJFJkBukXCkMxd7acvTbpdPEsmnzzhSyP0d6aYfcwCXOr1sR709qEtXDYXQpRI j+xVW1ZPOpGZhq+FLCzH+JbyQq9vYptL90qMY4Cfr0VL9ODtu6Powid1EbC5Zm9A Q4JU1uu0M2EzJMA+TTXV09od50Mp2Xii3Nm9CaK8lwi8DEcVDw8= =wmsq -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mipsr6.asc000066400000000000000000000015011501676513100201040ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp 7oaOTA//XTU4w2GxJJPstaq4GxLvz5/c4a1myMzRvZFRJa6XHzMxzOlBF3jix/qN GNXqzC6gOejNERKo8eHHGdVJ/LEMW6mWk3JBFTa/Nwm76oMCLSx4J6vY2w4hvM43 cGwpb28sBNEgqpEcZMtHjtR3wvRz00I3+Ph3cEUZuD2Rmw86yWE8zzZWxT1L7Tt+ Bvmuu/7XWC9Tv7KsX+VA3CjcWg9hO8EW1sCHQ8uyBB/c8mhGYGhc9lPOyiAjqC3J dNrjE16a03zxXo0q5od56mgGo272huK2+vij73B4ybsUxNGrgGPN8b95vtFNb8Wi NkLd2jaUrlDo1CO/M4/YffYM3F0NnUvfGulcLIyeo6FZ4cGmtQzlOCfkAOuv+vXe mCqlkCQ7LW8kOUm60g4Q7O3FSNTigQuSOelxv4cxhJepKL5qqAZ7gFCbAUrNbAjG N4ITjfIfluQ6P0joYV+Zz8yQ7kxS7k65QtBRMjhtkxG2aVoyge3iyhBgVCXy4m+9 GFOkvHu5oR0lm1IZhds8Eeub0QOsMn+BzXT64HvPa6zA1hWabeRMM1q6b0t7xT3q fR8PBxHixzcniF7Dw6E5OoIl6R8kE5HZ9WtKtup4RyI93m9B+Ku4yXOt9hTSMN2+ JsFf+MiELh3ohMvbtpriybdNQiVAn25KSYa+/g4aAj0CLQIH++4= =Kf+E -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-mipsr6el.asc000066400000000000000000000015011501676513100204250ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxQACgkQ4aewjAfp 7oaVvQ//W2Vkt4uifSMnnHEvaa5f4S0uTtKgpPSaPUGWrAQAS55e39D8hDGgPDbu AxTap0BSd+4BW4lKrpJTAGKY+m8lyQS/qyJPA16D6Y6YfYyR+JYxyXZLp8otimR5 NyW4PIw3CA7FEsVMfwBsYe8+byp4wtsv+VVN0JBZHqLMH9TtAEpUMVEQXe2mZI28 WH5ZY7j40MXeItwqQ+Ogov/0GHifS5N0j7KDU7J/8wpB4kLCDoQ9tLXu9d38oO/7 CToHYGR310urjagHG6We4WuZ7k/Euc1sfvTHZ/Rwg14x6oGKoMbGbt8Dj2839ihs LiO/7ggfcp2jUGvUpSaYYOfcCVRYqFTK/QwWmkvhTMhGRoN+y3VdQTX09VzVhI6g eEY0RCO9bC+M+gGWXheFiqeEznIKlwDhO33e1qCRMDH3h9pBUlxrlF9466B/u0uP DXCGo+lAC/NbYUkuYTWtKoi8Q7Sef9EAI4wZ2Y6eYGMxRI8dSrqVKioaLLE/MP9n uyjv05lwHv6+tntb8sjBv9mpkMGdwh2YOr/XNq4+ITssKrcZMw+yoHJ1htyaPYhh Sl0WA5H+q7iM2hU7Qs0jKGGvEDK1Bo6eaCPsnAjR081E8WxFcIsDA6rHuRuzcJ1A 9BO1mu5Tx0B/8kx0vNKYXmIly/a+hMdJX8k2/SWqoy/US9CEWq8= =TMTU -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-powerpc.asc000066400000000000000000000015011501676513100203430ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxUACgkQ4aewjAfp 7oZOKRAAvZ8ktOLXbfHw3SEB0hvngcNpfQwbpAy1LJL1DE3BvEWW5X5a7g4xaJGS UMbBQ1+W5kbR4LNuxYt7WJ29N5jkKis/pw82UK2AS6l0wayecMYcvn5395WdHYZx qzH22F3Y0n/cA5p9GDDD6bu7cis/tZkrLh5WHt1FWFe9SuGbQy8nNPr6pVda+pxy e14uiEuP6+ocrkTKn0Wj/cKTIMO4ftYG0Zw9a1MdsQhWxZitM7BiT14DjXX7qGj6 LgoZ3mwNuY4K6HfcX7mhqG2byc5NYDLxSBT2jDuQXLBtfra0a+E56urFDtG19+jT 828pwyc3zD8JoCQ8h6TDYtjawBr72DCLYQjkbDKB8JqnH/cGHRtdGxHsaFZQunsM DT3uly6+3/qd/KI3vEST12m+jKJI9VT8PxAX4vS/C1IZDevZSegb/kbWmXUT/CJf LfqEeh7K0voJD6a8fX9RemV68pefgc3l8v3pYdSonBt5M2Oh5cSVGuz2gk09WZTE a3cINVWbouI2Mzxq9aX+NjsEWJFWVao9xPn072Fg3+mG3RMhzYVnnr18C+qipwS0 IdumQgDO3vaW3GP6H9PYuvCL2HUjB+wpy6E6ww4NkeAtNgP/suYQBbbcdVS+kNAS 5q3aWGGEnThVBMtjzpljNjaB1dL68of4Lr9Q6MKKkSBt2og0Zy4= =KA5g -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-ppc64el.asc000066400000000000000000000015011501676513100201410ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxUACgkQ4aewjAfp 7oa/tg//f4A7W7rlZJBgx853rxABl4XuEAzU2UrkK2sstFvhjP4E7XmXpPdTCZcS X3w20qrqKErRZe8ZsmgqV70rNTyCVOBcOM6TFGst0ax62+XY9y35bn9nXipEH31k 6GmxNsXw4AW8Qf9lsXIfmMuFOe35UovSAN0QLFqEtJFnIOT743Krl1XVuvaS8pU1 z3OpmSW4stwu4u9BcEMA530TYHyeRPn6qsH5MYcJ06WjDmSIAHAO6rROHYhlyD7d vBVzW8o22jtY7L0eemnYxqndk/Xd1CkJgjeKFqEcmhNFXsyaHalN9aEfR2qRRrG4 AFrUw4DjrWtHSo5H9P7Vx51K48GFdt6hFOyRz5mPSTQWafAcB6Nnf+V4Mf5YKLrU djRTepI2sRgxPVQiLcFk8gNlQwLMR7QnCg15j77Kr6jU8AuEPAA9XH8et9vz4Hc/ cw+qoQrlvFPeILLvbCA59Y6/Q++Si4MdunT93XwqYNr/kg9sGKCRDkA4dChmrV0F hztSLWyKpOqPRgITzsD5Y57HiFUgnZ2ncYFPN1U/dY2Hw2VtyKrhNOqdQCMwyG0h cjjGrSBrXZ15a88KKLTTTKJRDLgtpfd7n+f360GQQGwYjIHiT2uM5QPePdCgaemd TTXYwnV1vs2HDKeq3poNHpGVff3rpmU9bjvZY0+v7o92Du0zdc8= =Gyv6 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-riscv64.asc000066400000000000000000000015011501676513100201640ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxUACgkQ4aewjAfp 7oaOfA//VtiV34TobBZjv8FNEYKn6C/MPUlsYLVHjGh3bFAso6q6LOCyV7QuwqZL FG7a7Ex5DxH/R03Aoc9Lgofy3rwVLozLKQk+K6wL1atXdX9u1AWEd3S5lS6IuBBr vl1mDL0H2ceVgdF8W3kd8Xi5RYb4VyWbgiez4bzNzGg5S479EeOb59Twyb4uIu8U NTEPTfpX5FsjbutHjh8m0dz9Jj2meIeYSf/DetU7r3DnGgKTBS4XriedjQBhtglz 6vMLCi38Ch6p4mZqN9+phYb2r4MRT35xOBbIKV0SYKy6W7BcXhQJt0KxmuxBlfph XfL/xg6pBXyvNHBZNgG3uNU0FBGuNSdZgJMBthIO0aIvLlhuIT4CMXTH78/9rvri KN1ThfR6X8RfXEHxfk389C8Ripzc1BDSc6n+dxt0+zBeY4DWJoJ1SoUGxMxIvfDl 2HhwMTnYxJW/IkqMNEUMJvhubc4W7CyF4/1Pz2mwkFkjvLMcx8DrcMk/HuvjPeX6 iHnh23ekqe1B8YAOYaisTxMx8EovekW7WhtuMn0Pwuw0enlI2LeAgJ2p7wr5al5c gY8dzLLQOgHUZXkBGPE2THaVxY19zB02XGVfYbGyh3F7ebL58xPdYfzhNlLnczxc 1vKrhqsDMPx1qD0xvEg5TUyze0SuW8VdJ6Gt4ND8wgK1H+zVqAo= =m7XW -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-linux-s390x.asc000066400000000000000000000015011501676513100175520ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxYACgkQ4aewjAfp 7oaYpRAAqc2L7/D8ovoShhAqLOhDmrmi8luSOjgStZTWJxr8Y/hA8nNjhQXwYqgF MsbuAwhmw9m8QfrZIpB8Pax3o4asZfTC8pkRtavpvwvhwINNflsp8YbARxE3WAns TzwZjPBpMYFb4kf8JwiRw0EHAhHlwI3WZFXdN+ZZ9Ut1xU1nrpOG1Y8fz8JA2Rc1 faTTrbIB0o1OpT5RHfOW94+w4Xc3WNuJ6Vlw9riCDYAu4aZhZs/IepJeVfZ/wJMc UObn0n7WMTjZwkcWg611x7Pr0r2xol2THZY/21EwqmroBQfeqR+clR+GWIchoKE4 zJ0eV1oRBmbuBCmUdjZIqaYXYDdraT5NU6+JOoxJzlouBD68tcItGh6Cw6UBLgpx r88lrKok5xqqPc6CenFkfnv1HS+TKtyXEtSDO1mkOtEWCobsc/VYvhzvSicRl8Fd lQg7UFZFl8MExXs6WSMK/J6s4mZRf9xUNpTdPbL5HbgUqgP9fU1ifPxCrzZv8UjS XENM4UnkaHp0yw+m1c0KrMjS0+iojCKAMnXrYZ5cCi/aXU0jLJ+fsnP8IRD8hRgW vx66ClTd4ryizy8maLh5ZYPgJJ1X8j1PNQ4c7wdr7ytx9Uv6lBYvf2Owsh9OORcZ A7zXUkqd6/M6upLWDVhP9gDGRXOBPtLkUWqj2royaRAIUYvm5DE= =Awkp -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-macos-amd64.asc000066400000000000000000000015011501676513100175420ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxYACgkQ4aewjAfp 7oYJnxAAiVFOgXbHMk6VIgrEAushAy3LoUEaeqpx6PFURTtCJoXIwTFNlK/w4S3t cvCU7eTCCscDtc6+/zdxWyKulLaQrPiMJitE7dcAu9nXqd4FwgO4+G2OspXp5omq QGoQG0FQ97lfrUpoYTFIFSWzqk84dz02RoDzTRvr8EHkn8C21AMr9AUQJZjhYL1Y aGj5zTabeiJpoH82yVMvT4trm44CdfSuFp6VspiOaYlRNz8DrvcP4y324DoGxPMU bdILU84CAsx/qfniWCXegOx+8Tlx8T3rhyvUqJp0iAB9okdShAy4e0Lyelfo/X4l oxPXhC17NCcS6Tj5b1WF6rvkpvrp8fJxOQujoveC+MBCtVuqGGBhAHIVoVquXm2L Tpc7P795ZhVmvM4SqYzJ8qHUD71PNqyZNjo75UIC/qQfe5fMu43dQ91dZIT3BiKu lNftjsb56ZsBiXbxzS9Xh/9Vf0FKt/gxPyS8c+hlL2Dg89tQEf61a8dGEnPj0+C9 u/ip8Jmh2/zHNIKhjYx0zuPbh1Smd2RZaRDwzaPMpUzqdIs8YtzWm0QZiY+J60ns srQq4cZpo5E7NWF99elGATTIkcNCtqw4I1FWWzYxA74BfBheQCiOkAzxxxeZllgB xPYuyBJzk0Ni+zc95veYKv6eqCNBJOl2M3ZWyAtTmIXDDluQr3c= =Nyie -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-macos-arm64.asc000066400000000000000000000015011501676513100175600ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxYACgkQ4aewjAfp 7obN/A//VLsnKXzNlKKqJUqExJoGGnowthgG7Uz5/KEdSdF2nE3vyXS+30WnEfQM N+TKZDmFqmBzsVkg7khUfMOyyLWxrxt1fKDYmSWKurg4w5khxdvzIEKAfL6481Z0 x1CxW6h1FC+tENcPlxUmpVbqff7w1Kg2FJ4FEFJGvHXodHKntF/TWN5hBTBG52DW +bWU0LpEbeQcKHyy1aiqEN3M/fgTd5U39SUu9eb0EelkgnK+tseq+kwCy2+5WRAY YQbh7egR2oMaBPFxSlpootcmH3BVDZIntJyPu/LLRR/Xv1YTKgQKnljOGn3mbcca jRrJxfyyV1aI7qpGhyJlmAuu2Q3i7WY00xS5Io7q15mjgOLmKDotyuKfT3hbwSbL 35m4okL2n7+IrwL2JhVtJanjQ8DZc0Q5WR6C8heYQaLiOBFw7DSY0F0JH/aI1FAl C4ad/0BkAab0cDUz/AoxGeVEkAOQL2R9pd/ccpPPeAI6jU58L0L7BI5HMiujNnPZ kV/RtP7XO9VY3eOxHl5+RdLwS6eCiku6cxSEuBaTeAhRWgkowtaIkPXcK+TH4HQ9 ya+iZnKrsANumuI1Pq1PlE0vk0vbn9UyzNejERrEcM4SyOX8enSYmovDclC0/E7L DC/XMVhKo1/DZBVVO+y/+6tzsZnxVyNvDe/+gWAirXQUkJ1xuVE= =zPgv -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-windows-amd64.exe.asc000066400000000000000000000015011501676513100207120ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxYACgkQ4aewjAfp 7oZD/xAAtQXaY5ikPT543IIIWbavqtCguBZ1GcSfwu9P3qXO8KCBKu0wwJm5G0SP /Z8Qf5qX4IdykNdwt6Z9NO50JoIAap7N9Ivr68Ajc8N9X/mH3nxcJ54xEeg8vC8t cDwpRrofpHxB9S+QdL2EDoD7W/w15+6lqI8lbTkGvKI6ZfSsbIGIJKpQqBpVeCe4 b1mV2sZg/nzkTc8Q/RBzGUgEPixd2pF3ttaC3RQxXLj7Jj3SFZQv9AZEaeiIELZr 7sZ8jAiKA48V/b9/Kdx6FT488oOirJ6YGR6zWTFFm1Hixiv/ebFjbnzi4p4yK6YT QtWx6HxmL3ZaXM2mebfISa4GAR8urV3VCvhZGB8wPr3KmlAm2M5OQFwXesz71r39 /VxF/gF37sFHslYCWPbGDC1qTX4FXeq9mpAwQqv5IAUmA4/SX6WBM2EoUM1wUVfc D17lsnuXAbM6ND/ZWnwCaB4eln9bfVTQ3g+12KwvxyLCYAtDN7YDeZPDBpjj3Au4 20v1H/9S/EZ2JNp87ilkk3nKnN/gWW6+lVTyCDF+JQsD0vI1e6oAS39nHW/hcvMa O3LT9FlTbqw5M9mrjQoCsKtmo+6qjLh69O1QTGTqd2oDLI8QxOF8RsPdOOIObMJV 569E8v1q+49pDzNof5Ze8kxcz+9a5pzlohGlftBBFf5KZ9yKK8Q= =sEHj -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/jq-windows-i386.exe.asc000066400000000000000000000015011501676513100204700ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTHKxcACgkQ4aewjAfp 7oaNNQ/9E0ExP05tfo8wX465tmMXF2t165e4aBWzyRor1qPNW+Evs+hU3pPtmISJ 1elHtwoQ/lsR7hzL7Hji9jxIFoiCVL7OdrHarLvrMJ6sAQVNt82iZWqUBI4ZeaSJ OfoNZPUh4AgSozIg3YnwSUvUoGaQoTcLJqHa438MqBScEsDw55++GV+7EcnMOXcY AOZfAEJIXFUzqo4+oZmJrANbizWgHjU0leYRbL4mQ5USotRgcsW+QRVh5/qnonIA v0c5YalRPO+hLhHgA5ZhBF2pjbbmx3KpEd+6X0Wd8RFT7BBMqAs26bMG5at/wZDm KFllhQcr20GUUotSOT7N+QcyfbG+pR5TFTDxgyoN/UxhYLMt/LBtT0RKqRBHCoUV YYpePBSzCc85vR98MFqjZuCCSKo9COfMtc8asbo+W782XvRVw+Vn7qvcQcU1AWo9 sXVHqnWQDILlQMU2wa0NTWroEYnNE5mOcCa1fN/gQh8Uqf09iHq4YaQw1Xi75dY7 04nKFwAAsBpmE6Vzg7VvWyZjw17qUWmEfEInbAybnsZhC6yIxy6kmoTWJuLEvGAk nDhoMJ6+5ZXGJwjWpC6gTnRFjUsQt9tFxD8QB2Nr4Okqy9sImek3Ke5uG4IteQ79 eRge9DTBpXzIkNG/CRNZ2dcszkNfLKptqiC41930xkWI14ovIu4= =m/AX -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc1/sha256sum.txt000066400000000000000000000035211501676513100167310ustar00rootroot00000000000000a6a7837cb46c61a8666467fef06754fe53b95c1626b5416ada58edfe1393dac3 jq-1.7rc1.tar.gz a552843335c2939741ae4b52979d6a3ef6057de5518fd4d9547d9847a6fee897 jq-1.7rc1.zip df823ab1c7c9dbe4bca47c5ce900cb71573fd4a522411eb38dc8dbfab339ba5c jq-linux-amd64 ce66388d20c6cc69d95b24f50b03157660c60c164db23f58e403d0fdd6b2e0e1 jq-linux-arm64 46360984be3ec632d642f77a3dbd4730e77089f847db2c7b7c648f4032e7fbb1 jq-linux-armel 0ad30037a0ec8ecd15ab0323aa402d9f4d5ca93c4fa1318b9f08cc8ddd739f98 jq-linux-armhf f75abe58677fa16ce1a93215e4448ff3920faaa78da2c6238b2f9484e193f4a2 jq-linux-i386 9407f122e820e0e5a0819a322d8232bd1e9146347c658ba903eb85768fbdde8e jq-linux-mips addd2e0da5c34c975da6d5ef12629606b978ca823b99ab7e8bde7dd8440a9706 jq-linux-mips64 89c3b6daaf87ae7a70d0d8e8aab4e9026e097fc8e4dd950c33689ba6360f6a96 jq-linux-mips64el d2cf17cc238e57a9373ae69e6ed7ae3eb918e0a0a76972909ef9e2387db5a0d7 jq-linux-mips64r6 d07023b4fb28fea0240c0c37e774e854c9378bc606dffa4c183bfdbd1d08d37f jq-linux-mips64r6el 5aa162cdd5fa3568cc1550e4ca4dde7f9231460877d016717a0475a79571ea03 jq-linux-mipsel 2ce97d0afe6d6420d2f0515a10e64858e50434f38f71597b7a2f703a12cf500d jq-linux-mipsr6 3f9ea2de719988c13bb355225faeb7d05bc04c362fe96fd8333e3f7450d37514 jq-linux-mipsr6el d127e6d3c5271784ae5a5673869d55e352fee3ef6ffde66c9a08be4627b6caa6 jq-linux-powerpc 5cfcf735ee21ba01151bc9e03540bc5dc373df5a7ce2389bd9ecdef4e82301c8 jq-linux-ppc64el 7db74136fe72b143b311567c9b63a16107aef7237299fc3a5749987b778ce84f jq-linux-riscv64 b7dfc2af6d1a84957987a1051f4d20276655433b2e8a5e085db75f6683d7a52b jq-linux-s390x 299dc32bc6fdf2e085e70f7efaed72da8b66fb4287b323106c2174dcc8248357 jq-macos-amd64 e159d0a02bb5f41930f8d9775777a2dde5d9e6747666e285c00d5729305a882a jq-macos-arm64 56c0361bccbd325bd1ffe607b64f955c30fbb800fef0d58c5ef69e2a242ce577 jq-windows-amd64.exe 9357fb09f158c880e5bd67d971bb98a33a2c0a1ffc33e859533a89b28c914a76 jq-windows-i386.exe jq-jq-1.8.0/sig/v1.7rc2/000077500000000000000000000000001501676513100144335ustar00rootroot00000000000000jq-jq-1.8.0/sig/v1.7rc2/jq-1.7rc2.tar.gz.asc000066400000000000000000000015011501676513100176500ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjWsACgkQ4aewjAfp 7oYA3BAAu7vKxnZDddirByDQuxC0wDtHDWQy6A165Ec8nrCagA3F20n0RMZfEd2v jsD9QQA0eakqKkpWTjdWJISCw5G8LE8HINab1fuuyYvqpq5G9+4u8QZaVGkq3N70 bsV6OuXjGKvMPeKd04xVm9pxI1BAp2cnB5KKjh1BHFwKbs/slamLJtCNshoh8hyz dd82Ol8PqQm4dOLssLJr4DbkHyW8NiiJ56j5K67IuSi4QznCaUlpz+7ixOGW9hH7 APv8kfj9jx+ilba4yMPRdutCcFL3Ofuy3qJ5rc8dbkoqyh98wyWoGc0zeUSzp17I og7mkHPssNKApSrakJcMKFZtg8bvjNaT7j4UgClym70H36BYeeK86b3lakDMhy7C FgI3zwDBGlNibnFt/waVyK1CEfUdw9SoBZyOpjk/chXXgo7GWLcLp/a/IryyxXSh zIWjs8hYXpD2FgX6gskTaP84slp4V4Z3pnXo0ZBUL2+BWfHcnl4WHoavsSWeGazk NAnZpdSkLuuNA+V4Ttb2L8bSFkUyr7WvBX+9cdfF7RyxdNiN3sgPQXoZ7B9gy62m z8ewsPnsyP2tqvMQ7wAEu+W/7f0ma4lbzXoCdz44AzRn6+elfAjG4qeEx7gLTS5F usg6BzV8580zUnkJ+uZtLouVNTS/UNlCOP2CmmWYVNSxYavQFM4= =VGRg -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-1.7rc2.zip.asc000066400000000000000000000015011501676513100172450ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjWwACgkQ4aewjAfp 7oaq2A//UMaOubG63DStzbiRczF569BKwlGrKfawF085rADbVkhoplgP021Bc7/s y7H/fjGcX5AzeK9cXwYaMFzAaW9okOe79nexSq/VWIsZtWN2PnWOb1JzwFjfRfI+ 29iBdnSK9q7OTvON/jyvPWfkS8eEeCXYIb7WneRh6SGv+xfOd3PWS1EM+HwWFb/u WCFmG0x5Z+7BuGd8ouqSqKjxt/rBW1+GoDtW/Ui/DG+Sv2JvTTagBVCn5Uc0xuqt CHgkkd0GeA4+bCbPrRDUXmhpQH3wintv5vVxHDG/ypqOwh2O8BHu1lX2lHSL7kf8 UUckHe7p00iiNt06pI64QvTpIcqfDkakW2lM5McSbKqH8lUe7RFRQciQqGLeeLRF ffCkANNNMT+hbhv9y2YyZ6aLrV4zGDXjL0kD0cCxx0HO0w85AD26X1ShRG9EFG+f cnXDPPG+dP5fHyHojfLYShmdmTkJqCBqMQR0Qp9DXdmD0+Z41/oeMNz/E4YxYzbX JEk+QNY5lyU3h5FZAAfWNDQ3csG2WmpAgvB+tU32SbGAtCb58JQQ/T8p0rrNhJQ8 gAoWJ5h07rm2cynlWkXQlGPQaEzNkJ4GIkJ08UxxLMNXHrGb4c65zcXyAdcA+VIq DdyJe0L7hYsuwiM3bf6oWqTgswOcGISv6AsEbIycV41PxIYEDdA= =3ty5 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-amd64.asc000066400000000000000000000015011501676513100176000ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW0ACgkQ4aewjAfp 7oZjYg/9GR9ZjA7up8kNyuclXqg7PhgaXSj8udySPtBDIZvzt47duyg1UCWyL2X3 7pGO+LkdvNvAlEVU45LcWbxtvVn7g7bIi32KTKZBvWhyKO/gCbmhtRgZJbTqzCzE saVJPa8QszWMCg5OAO42w9Jw1htYKZFyKO1ni/jJRtey+c2SixEv4SAAWkF1ZD56 EZTiykoQLgMjsZ2wy4jMr0k2isHQ0J/hgMcXHj1fmJEdDxFdIqeG5/0jcPZZiGUF sD+2Wejdjy0YZ8++BPYMCEKlxB7GeVF67B5oPtE2U1I1lcdWg5E3j4VuK3wHrTzN fEjDIWKnHsSoKvCbFlwMZO4Cc/KF7edTxzuMefI2w3pAOxXWMxEqjECr4F/K6gbf U9ZLi9UkSw8LE3xzEdLZ8lQIAyOD6VDZm1+A9VN2O3wB+6M79suZkMsd7fGGsZv9 KnjdFC5AiHZ3Lxg3gw8zYI+rqPkta7mqGOCMvERXiMacRNdO51ejim6+ecVEA1tS eW02K77H+ki2cU1wXmxVnVYW1i2+62UfzbaFFLHMsEw57wV7AyB/aqfhimAbGILV PpIMY+/CpF+po1AWWYg7OaaKPFidzcmy4vaGDQfALwJO1h1dAfDpoxUNehK83/+1 WOS2uL2wHH59UJDCZAEQaOyPQscf6oQRw+KTCZAVbdfrM3Hvtew= =TncH -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-arm64.asc000066400000000000000000000015011501676513100176160ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW0ACgkQ4aewjAfp 7oaRow//YL78Y832kaPxltfd/EvsXjQZxq61ub6lI2mZ7D1IJ/x9jGRGU+xbXWYv FdEkpL9LhVZcKVSClQDWaVT6i3DdkXoU2RN0Paufu9KQ5OxRcAyuAu1SELs3WrPT 5d05FVm1UDmi2/0SmpuoqdSRNMKzKda0hAzmjySye1TFsjvyR3XD/qxoFszoh/p3 TFeV1J5E6HWVxHCkKG9EM0NRhMN3Uf9p5nZsD+0fIFPa+hSu9E18ej3Ex59p4/sJ Qbrq4m/M9oIYmDpfULau2fOZGvuSYrt8/4+jn5AoDkW9puA03ZGxKjLdqt5soIX+ DQQEQy44fJBAMYyJ2Dm8D76UPN7WaOdB7iYplNfr9gZ1ABzbtanlHTpCeLuurX00 rslhnO5qZPnHnYh26vVUkc6L0GYgEpp04aLx3FJAh7WwPndgTC0o18Wx4vsYx/FW fNOnKJysD7M6Derw9zcmw/hzSHSYcNdkDPo5LXzvotBvIGhrqOCv+Rtl7gLEnM+Y Num6d9yDShafjdJcy6LJBFeGSaWz92+aN8RKopPC3U4OaJsHAQXELnCXOUlsWubK lFhbeIMApAlA9dhpOLer6YGH+cQvG6GBCIDFy6QNAuegitKR8CKwcjLUYsehAGxy SS/4s+rdanNiU9eReZk/qMqQCuo47mgnb1Xogj2pmR7OcDmmaUQ= =YnRB -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-armel.asc000066400000000000000000000015011501676513100177650ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW0ACgkQ4aewjAfp 7oaRlA/+OxePpJptW73+EfZ5stUnWt7UjXRVbKGvorM/oFTY+Xrjuw1mVLDmsLNK o0daIEJQAfNr3xBZsa5tMifKKvI8ftPuTNl1No1OwVfmQ+lGsYjEym60YRahvDfE XdKqw9oK6nl1ekufb1pmlOC7ivRnKBv8U9xJX6MV47S9nZIpLLIfQa5p51RehOgD vv8sryD6UrBjeSPI2DtQ16W9SPErhDRvrF5sUbTD5vlEp7DVabcrKdKY0++42SrN D+FtO0ogQ1cgzWYrn8Cg2Zd5803qmQUOo+fiq5HoJtNcJqx8jfPad2beYkgsXTkN /XyYEhhqkcvl+U6K+nxBzy+NKUHQ5siiJLeuk0vlXDOy+we8MA2yvPZvpnQGHNmF 7nVpEC2X7tR3cPp+JgUJTyALpZxVqYCtFBxME2EHAuPN8xzspmHbPD7Zes0u6R16 jF9UA5QtpKa5E/5wFkfJadIyCQddsls9yIJB/NPaEyK+noy6n5Te8tmJcOgSe8uj 0LcTHFNHb6KLDR5qa45fk/jlIyUvmy1kHXa1KdpVoWL5W62EcYPt0FCdoP3ObVdM yUW4Zr8gy1ZkTE/AIxV5m+JAoNEk6bOzLJtc1ati9EwG9MqqYjirTa2AlpHrMenp xyFdji2CXM6Itw/zQg7WFucV7mZq25JCKHmS9PjgxxcUKxDFq44= =nQw8 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-armhf.asc000066400000000000000000000015011501676513100177620ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW0ACgkQ4aewjAfp 7obcOg//Zlie2MupZ/uVGcK+UbSOve0A3XMqmHOA0L33HL4U3+zlLecKT+NlSvqw f0Rm1/XSfaIPeBbkBdpl2bbq+3fX5p66Tin0XJN49c7/xf+qsuR2TjEOOGoDvwR8 XciUGK5D65WBWwWZmKfswpz81hK4B3q0bedSGpZf2f0D+pWnR8Cxn1tf+QTu1lY9 oCvIHMryVy18HfwaLm4z9xlACSTuHoMBBb6wsnUD1LdeQSntAp8nyA3hJSXEUlsj zcOQursEdOqwQnqOWQeoSYPPKPd782KOi9dkW47pm1/9GbZHvBmTgsAAIKez/cXq nzkxs7GRvcKoujQpyURbStWNK1l0ZoQhCHYSvGzBKJJ/aqzSFXaJ2ub4lQ3lzyQp FL9+ldiMRMMm36zeGx2UXhPx2WsLYjBeovQR/MduDgO7sSbAJCN7sCc1ng9BDwIz cGtCt7/bvrWYHpfP896bBZKs0cyRxR0Dmfazh53dTjSgB4Aq0u82jk4ncRx6v6xQ 6ntLgtzIq6tH4A5iavNgI0XILstzxoNoY1galuubisCkIyyqKVc6ZOroWe2WcGJo N50KMzuicDGkkvnC7F9Tymgh+JsyKx4lm1Pw/WLIMZ6qKNTClBtEQF7nWumjHnzr 1LmBpZfGFNKxemwkhxfs8FuPPNJfLJUAFXJ7J5kEX71HScYuI5I= =b81T -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-i386.asc000066400000000000000000000015011501676513100173560ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW4ACgkQ4aewjAfp 7oaN4g/9FzEvJOiew8AkVn2aobiHbeNkTv7atguGu24bMCaT2rtrxmnpCjDLWrFc 60QdL3iOhpnQdt97xDlJqZZVVrRsLnMphaHYplBsJat8/aGJRGUXZrhDmLIWmbbH DLQA6vvhsZGL0K3EO/YlV3ekybgPmMGC4t88jt94o43IlIqaJFJeFDWDSCdVGrib D3bmr/OSusddUvew2ETr6wmXUnahjESir2//oE88gaac7+V3GWsSTPNFMXJBG/oY V0wDjcvomz8Sy8IhYQnvLrKZcJoiVDXbmTZpW+vGpHLOzcVEeUQyaLQh7CDVBFyo v+ycCg+r9FeIgB4IMfxkj1jGeQiZyXj4GZgeWiNvGSTH7278lO3jiirYbE+Qeyf8 vpUfdzJH89wdy9HbAv1XceV6ZcXt8BWn7fQSSUtwau+OfewRxp7EIOoqNSCQDHBC OO3XAz+a/RvbfUbas6DpoFpBfaqn0l5hCE+4hzBA5pWo05vBRVh7OD+6svH6inxz VFCeyulip8TWGFzJNxAdKc2ysQy8ZnGSv1H6lcuGVlkYIHPSmOcLJXqSnweUaYSp xGS2DXJ81bV+sRLcWuNqrvkvKkHP64w7hDzQ30KSns6dJWWMzXvCRUN68IMAqmkE 6jpvlQXFrKG5cXIgVNCsz3qyKliweXY0HNwZKVHG3nWLMKo8ssU= =58pE -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mips.asc000066400000000000000000000015011501676513100176350ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW4ACgkQ4aewjAfp 7oafaw/+I8b27K4a4QuWrUco1Vc0UMztaZogujLeaaH+0EAHLKm5W1teEI+29HJH 1AT1kPIL1g78FBOOIRFzj9ATSHIDk8jNxIV286F2742OWt94YP9G8fQvwiKKsDVt TeR27Uv5TwEg89VI/wGAnlo7zAWJZ7Pw7w5OzrDxjBYrepzq61iLJmvOhB5t35s6 Dw/dbb6hQMVMTYnwJPh63lvteheoRIKnSU7MTsE7zldh5Ei2Mk8xS5grfvo8U1La oudWaaLGePRKoo/zzZdAu5+m+pCB3rD30+/ZJddIUxT8Ogx8cHZp3vlksqc7RQrD SvieNj2BDLwAq72TwxYSh1ySptapk14q7iLwjWHOHNMlPNUsKJuXvEzm54YQOECb OuZX7oG+hkGfLRBfqu0osqVtS1iT3rshCcewO9HpJYJ7bxt9hWLPoh+xFIyiO0yp ayVlqF5X/we+vGkHoYBYGUMecPcOWgOH8/7zXdHSvoFz2H349A54K2jMNptGlHyr hiGFVhjeVSIkGvlD4cOfhvNc3PqqQEwgkCmGCgSbP+5qio8eISJc04k6LgJLsza+ al1oHtBW1t7xBaX7afgA9PB8Zct3KrXSq8NZngA+JjAaWvL99Sh75J5L0aHZWid1 zAYgt5CFPTsGGmRMIiktkD8z6iz4ql1ubyex9figk14/P5+G6Jk= =C9q0 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mips64.asc000066400000000000000000000015011501676513100200070ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW4ACgkQ4aewjAfp 7oaiEA//YRVMbcuLL4sxFtUiGnNbdvfD/Rxam6g1wq88JXjyn/0WYzRxy6IvIoVU uMYwWISk+utGUZ9P3OwbwZI8heCQt3IqmjuVlGEZrUYAmHdL9A20edYJ9lvlEzZQ YMQT0ABRTxvFtBdJr3j9cDXud82MQNtR68Z0QppbFLbk5QAok5na9Eymv42xT2uw 8zAZadP8NsN931hgSbfOjyn0XSleyNllvMh+5LnBZHwK2QpEnkYcO3ZbITJ1PPAx r/De2plyhKy6NXxMbITf+wanjFMZ5US3qnTaO4nU3NaPd0HeVxY5NSJg/MgBKyY9 NIWe6PXk2bTmR2wYagACt0wyiqZamQheAptZeILTSQp9anqgtwSXqCqEXWj+hvKl q1aQJ9nliPZyGc/ZJXXMt1lTHNyL/jOBCB9S9bRtf+dx7hZck434XgUtt+LdBbx8 RsGSTIcghaJfULFypC9cLoeRdiqdNvfYO3beTfJGvM6H12+b01kPZJdNZxj6A4TF zhFN3O2HDPxUmZ5g9u50lOQ2IU+2zkQH38mBZNTh97aUAhMdNWGvJJ8c4573R0wH sfIDJ7HUpt9dsseMWqBbcSjVDsX+TwiXYhsQibvUtDST/zCruxsl/Aq//EscMnal J28471+VPjvV8OGkadb1eOhBjF6wr6JQGrkupdxZLk/C5yFT/vc= =+1F7 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mips64el.asc000066400000000000000000000015011501676513100203300ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW8ACgkQ4aewjAfp 7oYJug/+IWh6qL8ULTs2HAF9Cq3U3URl+6VBcrNipOnuw9dYjA0etFbYU1g9k60o MgNhnJq2wEcOAVawSDCzsk85OietUL58S7XM/KyFv+iFI4p1aO5px8tblFnKxRQO foDgkRlu/aEyU0kAvk0Qk1mWLFt3fqVNHllr9qdgbAl+qwcbE2VwIPF1PWsd2LDm RwyJrOR7UUbWAxRzsdi82rdJIzD2UNs4Y4tfixRWEludaSWsFSE6o9mZKsn2/itp ES5eobuXhN2hWAKr4qxhqNJgAoJeYcezf5atjB38qboSgX8mQPn8y3azn4Q+wA/Q 2J/gOmgs37lLT2tiCe8iAmqR6pTgjsNJXmMYpMpt5ncS6QJHU2AZ48l8vfoWxIaT MQTh8n3lahONWaBNEOEOGBpfNYzMFp//lAJ8ZelqxoPc81syRnMFsi50kz0f2HKV XS6fhQ6tljr6yho5GJjxFwweQ+xFGJC2PXYzVS1J63UArdYJiSYGHRRakTYnRdBJ fY2ldT4XO6sD1WX3IUZDI0wyYAOEBkdiqHrJJ0quGgTT2NtwdgtUD0B3p9Flm/ZM hlQ2Uq5sfHZZgm8yuhyEOjllUZdZyUQnO2JsJke5WH2XEuIGSonozDcANsvOBIYp Gqbfb9tX1Y+oW2T2OSpxHnfrKMwB5gCDpcFpFVKo0iXLmwv4k2k= =CG3D -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mips64r6.asc000066400000000000000000000015011501676513100202570ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW8ACgkQ4aewjAfp 7obsOBAAuNkYtXZ5OExp1uWaCbE9Vi9wVFttYteTcO6l49kZFfn1+FipPhQXWhWf ZvoPprjzaPgz46slcEOXgpYrwyfkwKDESRbwWvZYiSJmE73NN2Pbh6UPo0y7/4kO aoUz10RKO976yFnjofUes0KOa0BKG3NdDvtf7/papYFZd4Vhq1ggVcWclIzQvOI9 nBIAaGuqUwRKMrfffpbt/3l9/7Eq0LxxpvReNW30GBVpLEbV62mCeCEuXBY2AOoW UW7WghRgTPrm4k4g6f+vxi+w1AixASvefWUNDuoCQb42n4M3Iqy5+bFMLU/GAimi 03U0LQAum1WTnkW0ssYEWbBtK/kMgqX6b7UT9106n4wXW54p/kTVCPeL7T705Lbo rgw3yTr1heiYDGtkwKPjim3D0QmL/VxuJP7gp8q3mc5sHflXwOq/l+876FWc5iLl RX4MO7TrXZhblr7M8IJO4XoAuhQNYIPyZUw7JwDFirskB5Ort8poFx7wg84+QNiV axCJnFWISqgDvFMVYPGbs1rYh8lZEKSxt0XXVOzJq+/xebq+7EOEuF5uue75xGXy PpzvOLWVa2V5IoG8LMEySFgHPUpvd04KWTnkPTKzWLhEH71xZn0XpGdne9qPD+v5 PtfqPjeViDr+D4D29L8CSsBaHm2S0D7AVCUZgs044OeT0r5G16o= =rlii -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mips64r6el.asc000066400000000000000000000015011501676513100206000ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjW8ACgkQ4aewjAfp 7oaeBhAAndt09nSXzcXEn0rWrpX16wE7sLV/Ih+vthE+4cmxPuQR4qgFZRnCQSpt dtmS3IEs2iAPz41fwVTuKQeb02PnwttqaeZEeyQqoV9ishLx2Vid60F/75yHsEbh Pn7HXSCYLcHLpMd36yiXCXkFzdgfJWnR85VS8QS7QGo2QNUGRWL3XD10xAfY7Ith yal3nQ1Nt++LZ6bJ4hFOa0RWrcnsKV/DRwtiEPSTM1CvIhtgMHyKREfnCefuwspD Rx7UsJHrwoUD6FozPYX1XQ/QugGWNBhfK63GHCUznf0WQlzS1enIbuQD5AxhFTxL ygra2D6fW9zWJQ8txTVXAaKDgPNZYTMlJLO3JopGg3ayjLj09KU9Z57g4KF9xhgU TeS2rafoo4/eAGpufhy6Fedg38VmZ/STGl1oQjYm5VLFye1aslA46SKG+HB3L04X kiIcfSK4KEK+ZDBhsA9oDe8533UUn753egxTUA5H5dPj5uJ4Edl+V0ehUJL1qnBD +bmP2yLw4urJyL7CKjVHJpapa/+3h/S3Bqy7DsmHmy4nMUq9cUscvcSXV8CZGPic z+3x5qFlTvQOSz1WgBZ5la1TN5oJC4Le0Yzt2eqs8vCfK3VFQK+lvnnVDp8016MQ mVbj05QvGDOaQ00T/rgy6Hu6JMeT6icpH8RNMS/NSxpaHS1oJUw= =5xbX -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mipsel.asc000066400000000000000000000015011501676513100201560ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXAACgkQ4aewjAfp 7oZMNQ//SEvMy+dV3A5xsL56rAcVvy7S0j5TTftDBBwzIU73uGJy45D8PorFdxIk dOSwY0rke4THNRSzIhQ6qYWTtgbKVGRS5i7G8+jcpWuTpPbxjSolcNMhcHyahWHj S+xI9oi+qMszjRJ93AHighwBSMMb4pG6+bqqDNAlASKH2QNcd+1jJ11V617RR+8H lwkZwHQ2nTqXUaae7x3Iag5WvVJAsFiVbxBAjEl+gagXz8YakbOHvZP1mxA2/tq/ pCOGCfobGK3DQi+Og1ZwF7WpihIr8+3mwhzlTezyvjc9rbgpqKyN0piKraGMfm0y +hEvnoR35wuTWLiTaMCfqEYZ5xiZJVPFp3dHPl1bgZyc+gbFgAUXt3NghQGFHxui TnQmeAdO8QGPXH3ORineV4etrqk69GJSD/N4W2OTEhzm4ONqSmTo4jbA+nuP7Qef DJfByeON9aldX+OU5XNmCyoQS90gmDi+LP+nx524Y+zsDhbwcVaNEHT8KuotW4dL SMVJQHj5WGdVtIAXc0CgDsKQt+YeK3hwJlMs7c3Yh6/VmmpVJSCppoz9QrEOWIiW AioYKXcQF2ZkKoEzxdQ774AT1GDCz2zN+840byidsAPBAgw7FdH81KZFnWQdCTjA GaM3iwCJueVzcyVNNWUEDX+kQEtOeIOawrMfnwpNSJzdy2qPsGM= =aL7x -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mipsr6.asc000066400000000000000000000015011501676513100201050ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXAACgkQ4aewjAfp 7oYtMxAAgxpmJf2N4mv0vpCK/hdCIlHWhxfSntJOpvDUK7inQgjjeSh/XHBD0tVG eEuyfAtRewJI1V0u0rEdKQI0F7gVf0jQkjUENzw78hN+Oj57rWkelUsrJYuvdJPU aZlZR2hHrX+NgH6uzuBv4+L6c5+5svlSIJVDBFJjE7z73co5jQwe064c6e9hMroY VdzHmNgCep6Oaj7l+b0aSWiBj6oe1urip8+Qn6tKw2ZuRfyHRXtx75h87zLgqzM/ 2kB444eUYHr7w3G7VwGT7kMA/scP+aA2h3Lu7CvbfxrJVTpwdNP7u2G1wDD0LDQ6 xH2xukFeyRzzPhNwabCFClsiFMcztuoaB/9whAUKySSv11kZjJK43euQZ+sv/6Sx wsezBNYZwug3JNJVTZX0GzOX85Fzo5oNLNMehWe6S9bSbELZQZPBqSR3OSPifWYi lyklDSQ9noGY8SuruMBUtxmaNn2Z5EcK5KfkaiN0ekmmBQ2puCMIwF9swCx8CA5O QJ8GILTHq+m45UiDws0ps/HHQp+hqBqqQS2qU1AaRpF6d7cLD1OC4Hk/xgTAVdFx +mukbvVZGEjMmqQutNSZvyh/5s74hPQ9R9JUscSWm6O+oWrBjiE07aKwa4vStlr/ AZXQqvuH5Qu8x0QdbD3vyUCo2gkgXqj+fSJ2WTnvlPQfuxc0ZA8= =J7wD -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-mipsr6el.asc000066400000000000000000000015011501676513100204260ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXAACgkQ4aewjAfp 7obVdw//T5ChinMxNF/49x+LNLEjUrxgRHav3zJCLHKBSBP6poSWoKpv343raZqU xTvLKUPXRfrgPxDlKhyaDyjAstk44ioKsff+5oCkn4mGia+SBnAIIIxhEtUJ379a U4KgKSAX2JgP8WN61mLxOUxLRjsmAuHwA1qA+4lAyC5JIESuVakwGySHcNDLETao g9GzBw4sNhdfen3TB/HIPwtDJGUf+esNbyHZPz8IgZQbPkfuNRMIzdz82eHv4el+ J1S8Jz4l5h7YWObRIw+E2d2TCzhP5LjMwxXYzi4oyrRTBbUiV/q416cAhno+VQNE dLTJwtElAD4BQloJJJOkCr0hgC8LzsQxPIrnzrZGfimi6cGs7zujFL3f9K29aXKX QU/9wMan6rL5s6LnmV8+MFonuvk8iNimmibuyHXCFdmYsJQEatdhfDzBJs1Iaj3X F/Q44GlB+ZCVKxhkOO2xkfcj7p3mLSp72sl91tQuXlYUsSrHBFHVJ5yXmbzaIwsk dtcXnCPP7mErTYsiABGtXSgXaQdR6YOr/Ha+FSkwlmpnwcMS70AiM+dhcrRUVy6f MteMdoEMf/DAcYsSMoER4ekmZzR+QMdrjU1AOMsfxZFFFmbgKlyFPH1VpJkvJ5kl AakWaC7pGXQl8XlyFYxTAZi7xM8zqvb5yRQDplx+VSfc7DI5yyA= =3o73 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-powerpc.asc000066400000000000000000000015011501676513100203440ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXEACgkQ4aewjAfp 7oZSuxAAqd+uHc8MsxCj7ksmuDXsDA6JN+7+VXdEHS9EqYQpi2BSlxHUYMrUahS5 /idpVDNFg/GM47R3P670yIGZ3heAdj7RxLMO5EK0YKMAePk7yvz8jmizGbxGEXkL nLxEHQh/yuMOYUrozNnsdkCNsWFpskYCfN+yOHexy9mqzn1TxbhY8GgnDHb4DDVE DltK3o9aAkhxzQVqmX0TGfGHcNqOsbPTKF9f/5ndOvc/iQMEgN7REPRfKLwc6ef7 8hciSayz9q64UAGFrZj/eFDjMaGf/uFDe0LOhJWDoIgj8aDcYGTD6Z2SjHAT0fq3 KGthbNHTi5aI6DYfInrcLW1jYMlslTW1WUJWZTxQ+/4YuS2vVF/08A3TjlIbMNyY wDwiSnHKkBr33oJ94N9e40U1ITMHzD0FEX7ErVw272zdBYvKWR51wUAkjWvDPPZj VCgLowQ7OtPRd0DJs0HNcxTWMHcKqpvr0m6f3YlXfO0u43JLAKAZgYB/gXE1xxg9 NQ5bQyOxIEeDEK1vie5oGHOscBHbMCrCuBp1qA/RS3lwjEU8qh8ZY2Vd84drtLY+ 75MaBZnSVtQmkIP+dg2nOywuxzajbsV78NNC2y9FgMux10ye+wXwYeNaeXU+b6rM wlV3TcKFjWXCJmWPJ9jEAtR586fsb4nvl750OkgbXVIyzIeGUSA= =09U6 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-ppc64el.asc000066400000000000000000000015011501676513100201420ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXEACgkQ4aewjAfp 7oYobhAAu4A9jdAiJhP0pzHyt7aC66o3EQAY6rldxtEthtykKqkvAVU52V80BcA8 omvLdPaNWNvk0ZzdhEc76Okv7lEACYIy/U4nzp7R6nR/ToFkyM6EehMvoo+Q7f32 6/f1/UdN2s2xuM36guXnpTq5ZDB92DdBs/73p/mXVXhAwAZI4XtbEBZ/eddsAxHe pc8ZVjnrs5dNLi3EMbmOwct9AAk72NtCkDgOVtT6w+bDgCCbpF0QGbiwWSu3IMKA lGW58N6ljDS5MOuTfcFqpE+ALLyD+Ns0e7CcPVDmoHOr+PY8WCyN8Zer6wuudmw2 xriO4n8nHGWCDxd8b8Lyjdl95sH89Bunv6xFQUrIKvueEACx3uGGmV5DWmtXOrDz UWZUphcIEtFZ6tvO5wCgOG1cJ+XTNgB7D1rnnbfrevLCvF3Xge1BfjpFs5RzfBiY QC8KlvNzBwm7uqjA/5EgI1WOgp+oTzr7fUoOC7045X1FAljTAinl2ILaAGMFFPTq juoTTyVo+yBN38B9Ja0NJfW0eVrgCtEJhjWFCJPlOkhowZ/Pl8quyC8N9dLMw4Uh OtJHzW2kQ1P8es0wns18agbhAHHUBkueh0CUCTxO0z7+lKk5PN2ULwGJrWg1FK4S 0Snz2u8jsY5q5SLT3JFnYKZGbJIudwa5M2Zrz1/KXuVbXU3lgoQ= =wGGb -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-riscv64.asc000066400000000000000000000015011501676513100201650ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXEACgkQ4aewjAfp 7obE1g//VMSgxnrqPspE6iXW4NzCubxL4JCCmj4DqIloOzy3ML8Pm8cW5+OFSimf QZI1RBS8WipBFbRmxxLJBJ8MGwRODhN4uL43MQTas4POhf+IfbtoWKHR0Khvgj2I uxFzGEV00QQZV0hzA6lMoYKGyxNPvRaUQFgt8SKFcZx3+TuwLQCfMOLEcsVO/Sxh LwewRuDp0HXx4SJq1YwkkStBoGcIcQJZZexQ54O3ofi29aw+NpseLJ4NXaf0GrDh 4cYX+lxz+KnSbjuRyLheq/phmnhcvg+TSmCSOqa7v8JfClgKvnSuCeCOs/yL4g9P PFOFgVm47zWzDemXfRqtV9KYV+SOMI9tyBU1odZVAdvDjyvclInSqQNmY/OsXrT5 CTw6Vs+DnNohCPoNBHpzCOas0zEaBbo4/LB4p7VadQi1yUJ8UiaNdNOGaKQHmgoC bm7iUPoku4LWSM6I9gzcoxSPHmfecGd8Zo9UbLBbmwnLjXp9AIQeqMhKzrdszWky BQe6GvKFUIJT8GdNJQ6V3+Xz/mpzXpCw4Pr5Ux+lZEmOZNI4udyfSVIuKPF8krZ7 DLlacnXbBbbQIOP+MH/VXePpyymGPgTavj8boDjUqGEaquH1kpL+STYV8FuBDdTn eDGP2K5lWVfAprDYqSfSPCgeDKYktaZ9uS+TPKtTnYRoRrpHC+Q= =FI9V -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-linux-s390x.asc000066400000000000000000000015011501676513100175530ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXEACgkQ4aewjAfp 7oZTlA/+MlIsps95JKTfx9ZVtM40oBRhgCABWaBH0AP5u2CL08zCm18+xCSy+rJB 0Of5ngd4Xbwoc1ph5notSJj0qg5cj1bhTklSw64Sr0Fz7tArx86jK67/XBBtcyv0 iAOAuI+RlNoWqd5mS1fFyQaUUOn/xUksxkDDnkEojTDt5xBLc2xA1BdxbaOZg900 NEzm3jb7M8wRTeGcroRXwCIqJ38iA7+d6xpM9B5gY1c5TQZwaZE8k5aZXOysl/rF UXJwBOy3BlATlJghmkhbnVH0w7d4/2+5F65HYDPM7+Tb+RUKrMQrQxd4+6lJMuHc vf1kLJnCjQsj9eFG0AtBa4wB5ILCdIIS54eIqZjo6q/NKj1TGtSNopka/NbU9B9P jXw/58DNRyJgYmkf2S/M26mJjheJ92gSdnZKCguAQz72NR5szWNc2RWGKaD62wQ0 GamcM9vBdT+Y7xJohCz7HGLmRPCfed1nm71w/5pyUZwMZclOb9gJq4kNgQUXZjt4 b5yTcCbeeAYWHYu2DNYrMcNCPVqY21bfm0DKrCOxYHPtZu+vqKS/RRJFryp59jsE GuULV4y2tJcvrIMo0bP3WibTRc4ct4i8bIkUOxRml/lkEpbidFp2Nxn1EEMEx2li z9vaLcF5Nb7X75T4r3Fg2P+Hg/h+QikW865BdnZ+qybVCuzwAnE= =MhhT -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-macos-amd64.asc000066400000000000000000000015011501676513100175430ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXIACgkQ4aewjAfp 7oaAQg//VgTyJXxd+WVws5H+BOzEImq9cIAhNHbshroozoQG4TagZotVZ7aP+fKE Bn4MLM4WHSBLTCwM2TuXaJF7xtBwM8rCZ3RQF9LAhamygZW3XWVHdHcoC3PevXMH XQ7oZmf6UcceH1dYNBWOukNYL93ilvp1STq/rYKKvO40GRt0L+ujbauov6iJ5BXS RJRV6jyhv2ERHXvWqSnloyYvHlj4samqhxY6rgheutPxcZ+QYfKzzU//G4Hbi9IW EBaQ8t1a/vGBW5l5UFWSfXAVSm1ajvNZ5iKMfEKecvAdZjJthdxSsv+fA5ab41zt GErc+A9FsaKWRlr/xlbjNUkBVtCRGarsc7Hhu85RaG/viWe5jthE4Nncd3G4maKL UQ7xeAsoS0B/n8vkwpjw+1VEq0nNghmV96P/0bxNVVEjq9d2Nnmg3bjODIXNGXnn 6Y21afNKF7eSmH5zrKsngMuSyIK/iOhM1sbWrsiSRJrUtmGbSMnnFHBzXJkejI6B ZNOhd2rR431Y8f39Cm7I/Y0qcBiBOLRvj5zyJbBpXjXZcplJgwA6xFFfSHtPs+aY 184Ej6NJctgKOrKWbFjZf2M1wJljF6/75Sum7wX+brR/aGOXms0Uf0ZwSaxjwEoW Es/Ksn3aknwnWHAYpRCcsxpRPtvyXjEw7k3Y7nlCoGDtocsLTko= =H/j5 -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-macos-arm64.asc000066400000000000000000000015011501676513100175610ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXIACgkQ4aewjAfp 7oYH3RAAnZQsUk5PGEau/jKGeMbFagmV6Rja8WXNKYIVDmTIjpvI1Hx23ckrVfVa USMVhaHr0/zUbJS9ljuE/gfEhFD5mdyS45GDgh5SdfrpC7r6b18ZCtk9Ogf8z8GJ wnZ2lF15rKZU3lXeRxN4/W2a2s50nZwKwChusnGBUyWCopAEEOPm4RurbyV9XXpD NPbRKLT50SGOEQpOWY5KJ+1N0JufbjYz1Bxv+ssg9hHCt7S3tvK+Lqp+D/nRfea+ 2gXv9VM/wQSvDyFvnpLO4QqGB8qD8JUPABIwu6kOISTsGbGlZ18hdb2bwkgodXvl YC/+OuHBKJqNtcg3IoOsB765NI/CvXIRYgbfjqP6y2QR36JPP/4UDZleavL2EFc2 ghoSfN3Xs594iu3An959t9bNEP2Wwtr+yVdwyZMepgvo5ciVZ0404aFqHcu4Ey2K /2PranGCZYxwvmUNhIrPciLMrOPfMONbVVQ6nf6EUEP/UxhkQM5Y/4WUHBffHb9z 53zrvIMK/7YTxVBoLUjI4rObCIdZ4FzXlg3z8cbcDlA8zEgHD7sOuawBOfm2KUsA tMk8RJpvmjxRNO1Cy9GcflZUXLbM1QtkJ+rtUWGZqr81EKXOZHEwCmJrxXPQyIai vO35JLyp4IUwyuSJTNDhkMj1CMUENbQCruSUvmwT7dAn/ApegwA= =HcGo -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-windows-amd64.exe.asc000066400000000000000000000015011501676513100207130ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXIACgkQ4aewjAfp 7obsIRAAtPSwpIh9P1Xeiv6FHWb76TfzKjfBqPHfDU/9NV4CfN088tEUfoey8PNG xGF830yggia6e+bM5zxNPJApc8b3y1ifehn0XFJg/cx1qG7U2GoDo+hBQDCV7P8v XZsPHMC0FZ6jE8F4QGFklQMcLUZ6IDpo3lvpQ9iCsMOWdMuOGS4s4Qy/ZuFYD7G8 8b1hvBsqjpRr1BehdEpVV3FUNz0paSxMlDh/64yBP4Glf0mo8Me3LjctfmOA/6sW VVRK/qf1x1rJhJ2lBPiLAh1QCv6EwAiNsw6TBqp+xLaoxWZg3nS7kmVE0WPGnAqK /e/O13eqO6ARpjp5cTkBuI2mqzzaThFJGWrCHFdirG2dtFkIQabR5BTNwSE1Y+d4 FhAD29B0hiwRRAvXqfaoAS4hHjuy1Ubk8mTnnPMsdGwnuu5tzECekwIzoMQowsJx GRutu2irMAy+RArDLjZu7jgi8sHRWZ9+yceHKzpANQRBZWbnuGJDz1OQpc0X/hgp sonQaYTIRHEd4yLBA53O+p4VYHE9HaGk5jkYm05/sVWjC5OT3V5AwiPjDO5h1C/s XT3mwQ7cA9Y9dnwabLs8uVOhn4vWxuJ9mJoKAGwyj99uT1oSHb25WbTi4RaWWcEA pDqHOR++BOch4vlKxtIqSFNFAY6sBXI9BNXl0uBVrWYkY5UuwLA= =TYAB -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/jq-windows-i386.exe.asc000066400000000000000000000015011501676513100204710ustar00rootroot00000000000000-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEuNEmQbLVV2S3XP+l4aewjAfp7oYFAmTrjXMACgkQ4aewjAfp 7oZqQg/+P9dWjfwa1aCH01fw8EfyvOc6cUoYY5TAr+vEfftkOzA50NmE6ABCyy8w YL2xbe0L7Bswf0codofT2/l32sI8cByX8Aay7dJx9+n0p91LW5+PKN0m15No3Dpb 9IOn4Ak6UKyOo5o5nds0U5q7nCEJAD2V1/szq8qQmyWvWTFA+aQgwwKuxsqX2TIx DYnPZpeQAZjqLoYw2o3ZjI1NxhE4dlCjTtf5NMb41VFWlp6DuGeiVJ5pWd25JC1b lnngEIs/AFUUKhR0yeba8DqEEe56WjQIoRauCDfcFoP1q6As5mAFV7cY5SK2+f8s HXJM1K7mezJ+z9LERvfLD2BY//ZKSzEQU1ObpZkujiPoRYyxEXWwi5Yji4ZJy0a4 +trPU3NpigoGR7iowwvv0bTWHwx3cRjnsQhmw5V6oxVmxQgwQh09HFmBtEZN6e85 dwb06fCviVDX66J0U51cyIoXIc+/V2aJR+LYjPutMV2HjZhQoKymnpGdW9SKeH+a QmJstQgWzAcj8Ky6FP1hrsvubBbm/0CkIfiZRC0QyvaDwNL8ZuqnN3VreoVvBTCR yQ9IGg7vwP0sgKR9mi62K9hrrbogpLxTlxL1bazWogMxJy/SH6Ii1GT9HS2Gq6G+ 4FN8UuQZILlUBg6upxTUFYRVvdw0rjbBGs9rTtSu6Ib+gE/Tu8g= =/2EB -----END PGP SIGNATURE----- jq-jq-1.8.0/sig/v1.7rc2/sha256sum.txt000066400000000000000000000035211501676513100167320ustar00rootroot0000000000000094e908a84fda47e548355539553f6c2f038636ef6c1558dd0cb65a4d789f33e7 jq-1.7rc2.tar.gz 80b4cf6356a8182e57ccda9f2a357b846f6ddd65093ad201a590d8c2dee5dc92 jq-1.7rc2.zip f53b2c8533928c7866a3e6ed0e16401c323bcf77a761bc578114ce253c73e865 jq-linux-amd64 7a02f9d4c6fa890dc3bc87a591d1d5e8675e95efa65d098272006f200248808d jq-linux-arm64 9730f028999299a0644c5c77ce83686f78bb512f829e91046ac564692860eaad jq-linux-armel 743abf247ac5e2c133d75fc6e402cc49a3ae00d1cbad826974553b3812122831 jq-linux-armhf cc0f1cb7f64d5987f0de7d15472ea21db6b95c5cbc9ecccfc97f52e8b3e9c3d8 jq-linux-i386 16e61275535115d81e1a82c4d20d5c38b27df8a18d6cd7abe6fd4da370d6eb8e jq-linux-mips d07eee7484b0851bccf3b4a371679d2119cfd7624f55b2d3593c9d88bcedb353 jq-linux-mips64 4c01094443b5e1c026cb21e5dc9f22b02676d14a1755d1289317c09448040c73 jq-linux-mips64el f2ff6e66401c0eac4b04aaaaa4988f793b364652cf71bf7099315b60ee62259e jq-linux-mips64r6 9f2d14031282bc6f22ad117b16e2a1071b8e81c012cfdaa2caf4680b366575c9 jq-linux-mips64r6el df17797707ddea48cbdac681de2ae092482f79ea3a1bed5d979391b82573863d jq-linux-mipsel 63f8837e53fd67bd04df19d0cf68d02d90441421fef8f60d9999d4c1039855bf jq-linux-mipsr6 d6815e4b374ed6ae3552df148df1d42019acdfc7e032d02228a3e94893a7c2ad jq-linux-mipsr6el 74004dc56d5dc0f3537726d35da0f0c67c2b282fcecfa0fa56a9455fd703eb26 jq-linux-powerpc 9cf7089f0a2864b7a0e090e6bb7e23b8ff7bd4154fc63c44a327d1380b48c416 jq-linux-ppc64el 04ec542d7f1ab2aaa5ae9c3f3d49701f64ebcf7c03bd87091d607e794cf5234f jq-linux-riscv64 94ebf5b62a3be0f2606ca2dc837f3368044b467a26e609d53362fc79ab9ac197 jq-linux-s390x badfa24d3ff1c8e5570a31380b5b6349edbecb29785aebe4b051c60c6ff2c5ba jq-macos-amd64 9df6253fc8178f6fae8d30083cb926ff67cad12bed2bdff9ea6c06304f785061 jq-macos-arm64 8f39c01f1fdb9556b13b9c6625336b0bd34f45c037546772c2d8cdee3d43f73b jq-windows-amd64.exe cc2b4b741422eb98da1101a7b55b775f57aaa5f05e56bbadd28e7c70b3484e9d jq-windows-i386.exe jq-jq-1.8.0/src/000077500000000000000000000000001501676513100133365ustar00rootroot00000000000000jq-jq-1.8.0/src/builtin.c000066400000000000000000001757451501676513100151730ustar00rootroot00000000000000#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[15]; 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[15],errbuf2[15]; 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) { if (jv_equal(jv_copy(x), y)) { 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) { return jv_bool(jv_equal(a, b)); } jv binop_notequal(jv a, jv b) { return jv_bool(!jv_equal(a, b)); } 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); 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)) { return jv_bool(jv_contains(a, b)); } 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); #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); 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)); } #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[255] = { 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 }; 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); int unreserved[128] = {0}; const char* p = CHARS_ALPHANUM "-_.~"; while (*p) unreserved[(int)*p++] = 1; jv line = jv_string(""); const char* s = jv_string_value(input); for (int i=0; i> 7 & 1 && unicode[0] >> (7-b) & 1)) { if (*(s++) != '%') { jv_free(line); return type_error(input, errmsg); } for (int i=0; i<2; i++) { unicode[b] <<= 4; char c = *(s++); if ('0' <= c && c <= '9') unicode[b] |= c - '0'; else if ('a' <= c && c <= 'f') unicode[b] |= c - 'a' + 10; else if ('A' <= c && c <= 'F') unicode[b] |= c - 'A' + 10; else { jv_free(line); return type_error(input, errmsg); } } b++; } if (!jvp_utf8_is_valid((const char *)unicode, (const char *)unicode+b)) { jv_free(line); return type_error(input, errmsg); } line = jv_string_append_buf(line, (const char *)unicode, b); } } 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 == 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); } 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) { 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), 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); #ifndef HAVE_STRPTIME if (strcmp(fmt, "%Y-%m-%dT%H:%M:%SZ")) { return ret_error2(a, b, jv_string("strptime/1 only supports ISO 8601 on this platform")); } #endif 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); 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")); a = tm2jv(tmp); return jv_array_set(a, 5, jv_number(jv_number_value(jv_array_get(jv_copy(a), 5)) + (fsecs - floor(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")); a = tm2jv(tmp); return jv_array_set(a, 5, jv_number(jv_number_value(jv_array_get(jv_copy(a), 5)) + (fsecs - floor(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")); a = tm2jv(tmp); return jv_array_set(a, 5, jv_number(jv_number_value(jv_array_get(jv_copy(a), 5)) + (fsecs - floor(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")); a = tm2jv(tmp); return jv_array_set(a, 5, jv_number(jv_number_value(jv_array_get(jv_copy(a), 5)) + (fsecs - floor(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); size_t max_size = strlen(fmt) + 100; char *buf = jv_mem_alloc(max_size); #ifdef __APPLE__ /* 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 size_t n = strftime(buf, max_size, fmt, &tm); #ifdef __APPLE__ if (tz) { setenv("TZ", tz, 1); free(tz); } else { unsetenv("TZ"); } #endif jv_free(b); /* POSIX doesn't provide errno values for strftime() failures; weird */ if ((n == 0 && *fmt) || 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); } 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); 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) || 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-jq-1.8.0/src/builtin.h000066400000000000000000000006541501676513100151620ustar00rootroot00000000000000#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-jq-1.8.0/src/builtin.jq000066400000000000000000000226261501676513100153500ustar00rootroot00000000000000def 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 .[:$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-jq-1.8.0/src/bytecode.c000066400000000000000000000112041501676513100152760ustar00rootroot00000000000000#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-jq-1.8.0/src/bytecode.h000066400000000000000000000033331501676513100153070ustar00rootroot00000000000000#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-jq-1.8.0/src/compile.c000066400000000000000000001256241501676513100151440ustar00rootroot00000000000000#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(const char* name, const char* as, int is_data) { inst* i = inst_new(DEPS); jv meta = jv_object(); if (as != NULL) meta = jv_object_set(meta, jv_string("as"), jv_string(as)); meta = jv_object_set(meta, jv_string("is_data"), is_data ? jv_true() : jv_false()); meta = jv_object_set(meta, jv_string("relpath"), jv_string(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(LOADV, 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(LOADV, 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); 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); 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-jq-1.8.0/src/compile.h000066400000000000000000000072211501676513100151410ustar00rootroot00000000000000#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(const char* name, const char *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-jq-1.8.0/src/exec_stack.h000066400000000000000000000065141501676513100156260ustar00rootroot00000000000000#ifndef EXEC_STACK_H #define EXEC_STACK_H #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) { int old_mem_length = -(s->bound) + ALIGNMENT; char* old_mem_start = (s->mem_end != NULL) ? (s->mem_end - old_mem_length) : NULL; int new_mem_length = align_round_up((old_mem_length + sz + 256) * 2); 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 = -(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-jq-1.8.0/src/execute.c000066400000000000000000001075671501676513100151640ustar00rootroot00000000000000#include #include #include #include #include #include #include #include "exec_stack.h" #include "bytecode.h" #include "jv_alloc.h" #include "jq_parser.h" #include "locfile.h" #include "jv.h" #include "jq.h" #include "parser.h" #include "builtin.h" #include "util.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[15]; 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[15]; 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[15]; 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); 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) return jv_string_fmt("jq: error: %s", jv_string_value(msg)); msg = jv_dump_string(msg, JV_PRINT_INVALID); if (jv_get_kind(msg) == JV_KIND_STRING) return jv_string_fmt("jq: error: %s", jv_string_value(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), kk), jv_object_get(v, 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); 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-jq-1.8.0/src/inject_errors.c000066400000000000000000000054521501676513100163600ustar00rootroot00000000000000#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-jq-1.8.0/src/jq.h000066400000000000000000000047661501676513100141360ustar00rootroot00000000000000#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-jq-1.8.0/src/jq_parser.h000066400000000000000000000003201501676513100154700ustar00rootroot00000000000000#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-jq-1.8.0/src/jq_test.c000066400000000000000000000374731501676513100151710ustar00rootroot00000000000000#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); #ifdef HAVE_PTHREAD static void run_jq_pthread_tests(void); #endif int jq_testsuite(jv libdirs, int verbose, int argc, char* argv[]) { FILE *testdata = stdin; int skip = -1; int take = -1; jv_test(); if (argc > 0) { for(int i = 0; i < argc; i++) { if (!strcmp(argv[i], "--skip")) { skip = atoi(argv[i+1]); i++; } else if (!strcmp(argv[i], "--take")) { take = atoi(argv[i+1]); i++; } else { testdata = fopen(argv[i], "r"); if (!testdata) { perror("fopen"); exit(1); } } } } run_jq_tests(libdirs, verbose, testdata, skip, take); run_jq_start_state_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), rand() & ~(JV_PRINT_COLOR|JV_PRINT_REFCOUNT)); jv reparsed = jv_parse_sized(jv_string_value(as_string), jv_string_length_bytes(jv_copy(as_string))); assert(jv_equal(jv_copy(expected), jv_copy(reparsed))); 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]"); } /// 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-jq-1.8.0/src/jv.c000066400000000000000000001521231501676513100141250ustar00rootroot00000000000000/* * 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 "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; } static void jvp_invalid_free(jv x) { assert(JVP_HAS_KIND(x, JV_KIND_INVALID)); if (JVP_HAS_FLAGS(x, JVP_FLAGS_INVALID_MSG) && jvp_refcnt_dec(x.u.ptr)) { jv_free(((jvp_invalid*)x.u.ptr)->errmsg); jv_mem_free(x.u.ptr); } } /* * 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) { jvp_literal_number* n = jvp_literal_number_alloc(strlen(literal)); 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 void jvp_array_free(jv a) { assert(JVP_HAS_KIND(a, JV_KIND_ARRAY)); if (jvp_refcnt_dec(a.u.ptr)) { jvp_array* array = jvp_array_ptr(a); for (int i=0; ilength; i++) { jv_free(array->elements[i]); } jv_mem_free(array); } } 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; jvp_array_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_array_equal(jv a, jv b) { 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_array_contains(jv a, jv b) { int r = 1; jv_array_foreach(b, bi, belem) { int ri = 0; jv_array_foreach(a, ai, aelem) { if (jv_contains(aelem, jv_copy(belem))) { ri = 1; break; } } jv_free(belem); if (!ri) { r = 0; 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) { if (!jv_equal(jv_array_get(jv_copy(a), ai + bi), belem)) 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; uint32_t maxlength = length * 3 + 1; // worst case: all bad bytes, each becomes a 3-byte U+FFFD 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 (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 const uint32_t HASH_SEED = 0x432A9843; 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 = 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 (res_len >= INT_MAX) { 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); } 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 void jvp_object_free(jv o) { assert(JVP_HAS_KIND(o, JV_KIND_OBJECT)); if (jvp_refcnt_dec(o.u.ptr)) { for (int i=0; istring) != JV_KIND_NULL) { jvp_string_free(slot->string); jv_free(slot->value); } } jv_mem_free(jvp_object_ptr(o)); } } 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); jvp_object_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)) { *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 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 if (!jv_equal(jv_copy(slot->value), jv_copy(*slot2))) return 0; len1++; } return len1 == len2; } static int jvp_object_contains(jv a, jv b) { 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 = jv_contains(a_val, b_val); if (!r) 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); 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; } jv jv_object_merge_recursive(jv a, jv b) { assert(JVP_HAS_KIND(a, JV_KIND_OBJECT)); assert(JVP_HAS_KIND(b, JV_KIND_OBJECT)); 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)) { a = jv_object_set(a, k, jv_object_merge_recursive(elem, v)); } else { jv_free(elem); a = jv_object_set(a, k, v); } if (!jv_is_valid(a)) break; } jv_free(b); return a; } /* * 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; } void jv_free(jv j) { switch(JVP_KIND(j)) { case JV_KIND_ARRAY: jvp_array_free(j); break; case JV_KIND_STRING: jvp_string_free(j); break; case JV_KIND_OBJECT: jvp_object_free(j); break; case JV_KIND_INVALID: jvp_invalid_free(j); break; case JV_KIND_NUMBER: jvp_number_free(j); break; } } int jv_get_refcnt(jv j) { if (JVP_IS_ALLOCATED(j)) { return j.u.ptr->count; } else { return 1; } } /* * Higher-level operations */ int jv_equal(jv a, jv b) { 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); break; case JV_KIND_STRING: r = jvp_string_equal(a, b); break; case JV_KIND_OBJECT: r = jvp_object_equal(a, b); break; default: r = 1; break; } } jv_free(a); jv_free(b); return r; } 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; } int jv_contains(jv a, jv b) { 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); } else if (JVP_HAS_KIND(a, JV_KIND_ARRAY)) { r = jvp_array_contains(a, b); } 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; } jq-jq-1.8.0/src/jv.h000066400000000000000000000246701501676513100141370ustar00rootroot00000000000000#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-jq-1.8.0/src/jv_alloc.c000066400000000000000000000105671501676513100153040ustar00rootroot00000000000000#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-jq-1.8.0/src/jv_alloc.h000066400000000000000000000006141501676513100153010ustar00rootroot00000000000000#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-jq-1.8.0/src/jv_aux.c000066400000000000000000000554441501676513100150120ustar00rootroot00000000000000#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; } 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 (jvp_number_is_nan(k)) { v = jv_null(); } else { 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 { /* * If k is a short string it's probably from a jq .foo expression or * similar, in which case putting it in the invalid msg may help the * user. The length 30 is arbitrary. */ if (jv_get_kind(k) == JV_KIND_STRING && jv_string_length_bytes(jv_copy(k)) < 30) { v = jv_invalid_with_msg(jv_string_fmt("Cannot index %s with string \"%s\"", jv_kind_name(jv_get_kind(t)), jv_string_value(k))); } else { v = jv_invalid_with_msg(jv_string_fmt("Cannot index %s with %s", jv_kind_name(jv_get_kind(t)), jv_kind_name(jv_get_kind(k)))); } 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); 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 (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); jv_free(key); 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 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); while (j < jv_array_length(jv_copy(paths)) && jv_equal(jv_copy(key), jv_array_get(jv_array_get(jv_copy(paths), j), start))) j++; // 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; } 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= 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 = jv_cmp(xa, xb); i++; } break; } case JV_KIND_OBJECT: { jv keys_a = jv_keys(jv_copy(a)); jv keys_b = jv_keys(jv_copy(b)); r = jv_cmp(jv_copy(keys_a), keys_b); 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 = jv_cmp(xa, xb); if (r) break; } } jv_free(keys_a); break; } } jv_free(a); jv_free(b); return r; } struct sort_entry { jv object; jv key; int index; }; 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)); // 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) { 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)); 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++) { if (jv_equal(jv_copy(curr_key), jv_copy(entries[i].key))) { 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)); struct sort_entry* entries = sort_items(objects, keys); jv ret = jv_array(); jv curr_key = jv_invalid(); for (int i = 0; i < n; i++) { if (jv_equal(jv_copy(curr_key), jv_copy(entries[i].key))) { 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-jq-1.8.0/src/jv_dtoa.c000066400000000000000000002553631501676513100151460ustar00rootroot00000000000000 /**************************************************************** * * 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-jq-1.8.0/src/jv_dtoa.h000066400000000000000000000011331501676513100151330ustar00rootroot00000000000000#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-jq-1.8.0/src/jv_dtoa_tsd.c000066400000000000000000000023731501676513100160070ustar00rootroot00000000000000#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 = malloc(sizeof(struct dtoa_context)); jvp_dtoa_context_init(ctx); if (pthread_setspecific(dtoa_ctx_key, ctx) != 0) { fprintf(stderr, "error: cannot set thread specific data"); abort(); } } return ctx; } jq-jq-1.8.0/src/jv_dtoa_tsd.h000066400000000000000000000001441501676513100160060ustar00rootroot00000000000000#ifndef JV_DTOA_TSD_H #define JV_DTOA_TSD_H struct dtoa_context *tsd_dtoa_context_get(void); #endif jq-jq-1.8.0/src/jv_file.c000066400000000000000000000045051501676513100151240ustar00rootroot00000000000000#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. const int max_utf8_len = 4; char buf[4096+max_utf8_len]; while (!feof(file) && !ferror(file)) { size_t n = fread(buf, 1, sizeof(buf)-max_utf8_len, file); int len = 0; if (n == 0) continue; if (jvp_utf8_backtrack(buf+(n-1), buf, &len) && len > 0 && !feof(file) && !ferror(file)) { n += fread(buf+n, 1, len, file); } if (raw) { data = jv_string_append_buf(data, buf, n); } 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; } } } 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-jq-1.8.0/src/jv_parse.c000066400000000000000000000653241501676513100153250ustar00rootroot00000000000000#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->tokenbuf = 0; 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 void tokenadd(struct jv_parser* p, char c) { assert(p->tokenpos <= p->tokenlen); if (p->tokenpos >= (p->tokenlen - 1)) { p->tokenlen = p->tokenlen*2 + 256; p->tokenbuf = jv_mem_realloc(p->tokenbuf, p->tokenlen); } assert(p->tokenpos < p->tokenlen); p->tokenbuf[p->tokenpos++] = c; } 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: 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 { 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), 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-jq-1.8.0/src/jv_print.c000066400000000000000000000305531501676513100153430ustar00rootroot00000000000000#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" #ifndef MAX_PRINT_DEPTH #define MAX_PRINT_DEPTH (256) #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) { x = jv_dump_string(x, 0); const char *str = jv_string_value(x); const size_t len = strlen(str); strncpy(outbuf, str, bufsize); if (len > bufsize - 1 && bufsize >= 4) { // Indicate truncation with '...' without breaking UTF-8. const char *s = jvp_utf8_backtrack(outbuf + bufsize - 4, outbuf, NULL); if (s) bufsize = s + 4 - outbuf; strcpy(outbuf + bufsize - 4, "..."); } else { outbuf[bufsize - 1] = '\0'; } jv_free(x); return outbuf; } jq-jq-1.8.0/src/jv_private.h000066400000000000000000000001631501676513100156600ustar00rootroot00000000000000#ifndef JV_PRIVATE #define JV_PRIVATE int jvp_number_cmp(jv, jv); int jvp_number_is_nan(jv); #endif //JV_PRIVATE jq-jq-1.8.0/src/jv_thread.h000066400000000000000000000033661501676513100154650ustar00rootroot00000000000000#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-jq-1.8.0/src/jv_unicode.c000066400000000000000000000111621501676513100156300ustar00rootroot00000000000000#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 (start >= min && (length = utf8_coding_length[(unsigned char)*start]) == UTF8_CONTINUATION_BYTE) { 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 (in + length > end) { /* 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-jq-1.8.0/src/jv_unicode.h000066400000000000000000000006771501676513100156460ustar00rootroot00000000000000#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-jq-1.8.0/src/jv_utf8_tables.h000066400000000000000000000064471501676513100164410ustar00rootroot00000000000000#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-jq-1.8.0/src/lexer.c000066400000000000000000002201411501676513100146210ustar00rootroot00000000000000#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-jq-1.8.0/src/lexer.h000066400000000000000000000401531501676513100146310ustar00rootroot00000000000000#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-jq-1.8.0/src/lexer.l000066400000000000000000000107041501676513100146340ustar00rootroot00000000000000%{ #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-jq-1.8.0/src/libm.h000066400000000000000000000075551501676513100144460ustar00rootroot00000000000000#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-jq-1.8.0/src/linker.c000066400000000000000000000361101501676513100147670ustar00rootroot00000000000000#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 "parser.h" #include "util.h" #include "compile.h" #include "jv_alloc.h" struct lib_loading_state { char **names; block *defs; 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)) { 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 (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->names[state_idx],jv_string_value(resolved)) == 0) break; } if (state_idx < lib_state->ct) { // Found jv_free(resolved); // Bind the library to the program bk = block_bind_library(lib_state->defs[state_idx], 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++; } goto out; } else if (is_data) { // import "foo" as $bar; program = gen_const_global(jv_copy(data), as); } 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) { 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); } } state_idx = lib_state->ct++; lib_state->names = jv_mem_realloc(lib_state->names, lib_state->ct * sizeof(const char *)); lib_state->defs = jv_mem_realloc(lib_state->defs, lib_state->ct * sizeof(block)); lib_state->names[state_idx] = strdup(jv_string_value(lib_path)); lib_state->defs[state_idx] = program; out: *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,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("", NULL, 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.names[i]); if (nerrors == 0 && !block_is_const(lib_state.defs[i])) libs = block_join(libs, lib_state.defs[i]); else block_free(lib_state.defs[i]); } free(lib_state.names); free(lib_state.defs); if (nerrors) block_free(program); else *out_block = block_drop_unreferenced(block_join(libs, program)); return nerrors; } jq-jq-1.8.0/src/linker.h000066400000000000000000000002411501676513100147700ustar00rootroot00000000000000#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-jq-1.8.0/src/locfile.c000066400000000000000000000051361501676513100151240ustar00rootroot00000000000000#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, l->linemap[startline+1] - 1); assert(end > loc.start); 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-jq-1.8.0/src/locfile.h000066400000000000000000000011021501676513100151160ustar00rootroot00000000000000#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-jq-1.8.0/src/main.c000066400000000000000000000634731501676513100144430ustar00rootroot00000000000000#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 #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 __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)); 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-jq-1.8.0/src/opcode_list.h000066400000000000000000000023321501676513100160130ustar00rootroot00000000000000OP(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-jq-1.8.0/src/parser.c000066400000000000000000004252201501676513100150030ustar00rootroot00000000000000/* 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[15]; 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, 450, 457, 465, 476, 481, 487, 490, 495, 499, 506, 509, 515, 522, 525, 528, 534, 537, 540, 546, 549, 552, 560, 564, 567, 570, 573, 576, 579, 582, 585, 588, 592, 598, 601, 604, 607, 610, 613, 616, 619, 622, 625, 628, 631, 634, 637, 640, 643, 646, 649, 652, 655, 658, 661, 664, 671, 674, 677, 680, 683, 687, 690, 694, 712, 716, 720, 723, 735, 740, 741, 742, 743, 746, 749, 754, 759, 762, 767, 770, 775, 779, 782, 787, 790, 795, 798, 803, 806, 809, 812, 815, 818, 826, 832, 835, 838, 841, 844, 847, 850, 853, 856, 859, 862, 865, 868, 871, 874, 877, 880, 883, 889, 892, 895, 900, 903, 906, 909, 913, 918, 922, 926, 930, 934, 942, 948, 951 }; #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" { jv v = block_const((yyvsp[-2].blk)); // XXX Make gen_import take only blocks and the int is_data so we // don't have to free so much stuff here (yyval.blk) = gen_import(jv_string_value(v), jv_string_value((yyvsp[0].literal)), 1); block_free((yyvsp[-2].blk)); jv_free((yyvsp[0].literal)); jv_free(v); } #line 2853 "src/parser.c" break; case 42: /* ImportWhat: "import" ImportFrom "as" IDENT */ #line 450 "src/parser.y" { jv v = block_const((yyvsp[-2].blk)); (yyval.blk) = gen_import(jv_string_value(v), jv_string_value((yyvsp[0].literal)), 0); block_free((yyvsp[-2].blk)); jv_free((yyvsp[0].literal)); jv_free(v); } #line 2865 "src/parser.c" break; case 43: /* ImportWhat: "include" ImportFrom */ #line 457 "src/parser.y" { jv v = block_const((yyvsp[0].blk)); (yyval.blk) = gen_import(jv_string_value(v), NULL, 0); block_free((yyvsp[0].blk)); jv_free(v); } #line 2876 "src/parser.c" break; case 44: /* ImportFrom: String */ #line 465 "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 2890 "src/parser.c" break; case 45: /* FuncDef: "def" IDENT ':' Query ';' */ #line 476 "src/parser.y" { (yyval.blk) = gen_function(jv_string_value((yyvsp[-3].literal)), gen_noop(), (yyvsp[-1].blk)); jv_free((yyvsp[-3].literal)); } #line 2899 "src/parser.c" break; case 46: /* FuncDef: "def" IDENT '(' Params ')' ':' Query ';' */ #line 481 "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 2908 "src/parser.c" break; case 47: /* Params: Param */ #line 487 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 2916 "src/parser.c" break; case 48: /* Params: Params ';' Param */ #line 490 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 2924 "src/parser.c" break; case 49: /* Param: BINDING */ #line 495 "src/parser.y" { (yyval.blk) = gen_param_regular(jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } #line 2933 "src/parser.c" break; case 50: /* Param: IDENT */ #line 499 "src/parser.y" { (yyval.blk) = gen_param(jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } #line 2942 "src/parser.c" break; case 51: /* StringStart: FORMAT QQSTRING_START */ #line 506 "src/parser.y" { (yyval.literal) = (yyvsp[-1].literal); } #line 2950 "src/parser.c" break; case 52: /* StringStart: QQSTRING_START */ #line 509 "src/parser.y" { (yyval.literal) = jv_string("text"); } #line 2958 "src/parser.c" break; case 53: /* String: StringStart QQString QQSTRING_END */ #line 515 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); jv_free((yyvsp[-2].literal)); } #line 2967 "src/parser.c" break; case 54: /* QQString: %empty */ #line 522 "src/parser.y" { (yyval.blk) = gen_const(jv_string("")); } #line 2975 "src/parser.c" break; case 55: /* QQString: QQString QQSTRING_TEXT */ #line 525 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-1].blk), gen_const((yyvsp[0].literal)), '+'); } #line 2983 "src/parser.c" break; case 56: /* QQString: QQString QQSTRING_INTERP_START Query QQSTRING_INTERP_END */ #line 528 "src/parser.y" { (yyval.blk) = gen_binop((yyvsp[-3].blk), gen_format((yyvsp[-1].blk), jv_copy((yyvsp[-4].literal))), '+'); } #line 2991 "src/parser.c" break; case 57: /* ElseBody: "elif" Query "then" Query ElseBody */ #line 534 "src/parser.y" { (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } #line 2999 "src/parser.c" break; case 58: /* ElseBody: "else" Query "end" */ #line 537 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } #line 3007 "src/parser.c" break; case 59: /* ElseBody: "end" */ #line 540 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3015 "src/parser.c" break; case 60: /* Term: '.' */ #line 546 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3023 "src/parser.c" break; case 61: /* Term: ".." */ #line 549 "src/parser.y" { (yyval.blk) = gen_call("recurse", gen_noop()); } #line 3031 "src/parser.c" break; case 62: /* Term: "break" BINDING */ #line 552 "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 3044 "src/parser.c" break; case 63: /* Term: "break" error */ #line 560 "src/parser.y" { FAIL((yyloc), "break requires a label to break to"); (yyval.blk) = gen_noop(); } #line 3053 "src/parser.c" break; case 64: /* Term: Term FIELD '?' */ #line 564 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-2].blk), gen_const((yyvsp[-1].literal))); } #line 3061 "src/parser.c" break; case 65: /* Term: FIELD '?' */ #line 567 "src/parser.y" { (yyval.blk) = gen_index_opt(gen_noop(), gen_const((yyvsp[-1].literal))); } #line 3069 "src/parser.c" break; case 66: /* Term: Term '.' String '?' */ #line 570 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3077 "src/parser.c" break; case 67: /* Term: '.' String '?' */ #line 573 "src/parser.y" { (yyval.blk) = gen_index_opt(gen_noop(), (yyvsp[-1].blk)); } #line 3085 "src/parser.c" break; case 68: /* Term: Term FIELD */ #line 576 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-1].blk), gen_const((yyvsp[0].literal))); } #line 3093 "src/parser.c" break; case 69: /* Term: FIELD */ #line 579 "src/parser.y" { (yyval.blk) = gen_index(gen_noop(), gen_const((yyvsp[0].literal))); } #line 3101 "src/parser.c" break; case 70: /* Term: Term '.' String */ #line 582 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3109 "src/parser.c" break; case 71: /* Term: '.' String */ #line 585 "src/parser.y" { (yyval.blk) = gen_index(gen_noop(), (yyvsp[0].blk)); } #line 3117 "src/parser.c" break; case 72: /* Term: '.' error */ #line 588 "src/parser.y" { FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields"); (yyval.blk) = gen_noop(); } #line 3126 "src/parser.c" break; case 73: /* Term: '.' IDENT error */ #line 592 "src/parser.y" { jv_free((yyvsp[-1].literal)); FAIL((yyloc), "try .[\"field\"] instead of .field for unusually named fields"); (yyval.blk) = gen_noop(); } #line 3136 "src/parser.c" break; case 74: /* Term: Term '[' Query ']' '?' */ #line 598 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-4].blk), (yyvsp[-2].blk)); } #line 3144 "src/parser.c" break; case 75: /* Term: Term '[' Query ']' */ #line 601 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3152 "src/parser.c" break; case 76: /* Term: Term '.' '[' Query ']' '?' */ #line 604 "src/parser.y" { (yyval.blk) = gen_index_opt((yyvsp[-5].blk), (yyvsp[-2].blk)); } #line 3160 "src/parser.c" break; case 77: /* Term: Term '.' '[' Query ']' */ #line 607 "src/parser.y" { (yyval.blk) = gen_index((yyvsp[-4].blk), (yyvsp[-1].blk)); } #line 3168 "src/parser.c" break; case 78: /* Term: Term '[' ']' '?' */ #line 610 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH_OPT)); } #line 3176 "src/parser.c" break; case 79: /* Term: Term '[' ']' */ #line 613 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), gen_op_simple(EACH)); } #line 3184 "src/parser.c" break; case 80: /* Term: Term '.' '[' ']' '?' */ #line 616 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-4].blk), gen_op_simple(EACH_OPT)); } #line 3192 "src/parser.c" break; case 81: /* Term: Term '.' '[' ']' */ #line 619 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-3].blk), gen_op_simple(EACH)); } #line 3200 "src/parser.c" break; case 82: /* Term: Term '[' Query ':' Query ']' '?' */ #line 622 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-6].blk), (yyvsp[-4].blk), (yyvsp[-2].blk), INDEX_OPT); } #line 3208 "src/parser.c" break; case 83: /* Term: Term '[' Query ':' ']' '?' */ #line 625 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), gen_const(jv_null()), INDEX_OPT); } #line 3216 "src/parser.c" break; case 84: /* Term: Term '[' ':' Query ']' '?' */ #line 628 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), gen_const(jv_null()), (yyvsp[-2].blk), INDEX_OPT); } #line 3224 "src/parser.c" break; case 85: /* Term: Term '[' Query ':' Query ']' */ #line 631 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), INDEX); } #line 3232 "src/parser.c" break; case 86: /* Term: Term '[' Query ':' ']' */ #line 634 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-4].blk), (yyvsp[-2].blk), gen_const(jv_null()), INDEX); } #line 3240 "src/parser.c" break; case 87: /* Term: Term '[' ':' Query ']' */ #line 637 "src/parser.y" { (yyval.blk) = gen_slice_index((yyvsp[-4].blk), gen_const(jv_null()), (yyvsp[-1].blk), INDEX); } #line 3248 "src/parser.c" break; case 88: /* Term: Term '?' */ #line 640 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[-1].blk), gen_op_simple(BACKTRACK)); } #line 3256 "src/parser.c" break; case 89: /* Term: LITERAL */ #line 643 "src/parser.y" { (yyval.blk) = gen_const((yyvsp[0].literal)); } #line 3264 "src/parser.c" break; case 90: /* Term: String */ #line 646 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3272 "src/parser.c" break; case 91: /* Term: FORMAT */ #line 649 "src/parser.y" { (yyval.blk) = gen_format(gen_noop(), (yyvsp[0].literal)); } #line 3280 "src/parser.c" break; case 92: /* Term: '-' Term */ #line 652 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[0].blk), gen_call("_negate", gen_noop())); } #line 3288 "src/parser.c" break; case 93: /* Term: '(' Query ')' */ #line 655 "src/parser.y" { (yyval.blk) = (yyvsp[-1].blk); } #line 3296 "src/parser.c" break; case 94: /* Term: '[' Query ']' */ #line 658 "src/parser.y" { (yyval.blk) = gen_collect((yyvsp[-1].blk)); } #line 3304 "src/parser.c" break; case 95: /* Term: '[' ']' */ #line 661 "src/parser.y" { (yyval.blk) = gen_const(jv_array()); } #line 3312 "src/parser.c" break; case 96: /* Term: '{' DictPairs '}' */ #line 664 "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 3324 "src/parser.c" break; case 97: /* Term: "reduce" Expr "as" Patterns '(' Query ';' Query ')' */ #line 671 "src/parser.y" { (yyval.blk) = gen_reduce((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3332 "src/parser.c" break; case 98: /* Term: "foreach" Expr "as" Patterns '(' Query ';' Query ';' Query ')' */ #line 674 "src/parser.y" { (yyval.blk) = gen_foreach((yyvsp[-9].blk), (yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk)); } #line 3340 "src/parser.c" break; case 99: /* Term: "foreach" Expr "as" Patterns '(' Query ';' Query ')' */ #line 677 "src/parser.y" { (yyval.blk) = gen_foreach((yyvsp[-7].blk), (yyvsp[-5].blk), (yyvsp[-3].blk), (yyvsp[-1].blk), gen_noop()); } #line 3348 "src/parser.c" break; case 100: /* Term: "if" Query "then" Query ElseBody */ #line 680 "src/parser.y" { (yyval.blk) = gen_cond((yyvsp[-3].blk), (yyvsp[-1].blk), (yyvsp[0].blk)); } #line 3356 "src/parser.c" break; case 101: /* Term: "if" Query "then" error */ #line 683 "src/parser.y" { FAIL((yyloc), "Possibly unterminated 'if' statement"); (yyval.blk) = (yyvsp[-2].blk); } #line 3365 "src/parser.c" break; case 102: /* Term: "try" Expr "catch" Expr */ #line 687 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3373 "src/parser.c" break; case 103: /* Term: "try" Expr "catch" error */ #line 690 "src/parser.y" { FAIL((yyloc), "Possibly unterminated 'try' statement"); (yyval.blk) = (yyvsp[-2].blk); } #line 3382 "src/parser.c" break; case 104: /* Term: "try" Expr */ #line 694 "src/parser.y" { (yyval.blk) = gen_try((yyvsp[0].blk), gen_op_simple(BACKTRACK)); } #line 3390 "src/parser.c" break; case 105: /* Term: '$' '$' '$' BINDING */ #line 712 "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 3399 "src/parser.c" break; case 106: /* Term: BINDING */ #line 716 "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 3408 "src/parser.c" break; case 107: /* Term: "$__loc__" */ #line 720 "src/parser.y" { (yyval.blk) = gen_loc_object(&(yyloc), locations); } #line 3416 "src/parser.c" break; case 108: /* Term: IDENT */ #line 723 "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 3433 "src/parser.c" break; case 109: /* Term: IDENT '(' Args ')' */ #line 735 "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 3443 "src/parser.c" break; case 110: /* Term: '(' error ')' */ #line 740 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3449 "src/parser.c" break; case 111: /* Term: '[' error ']' */ #line 741 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3455 "src/parser.c" break; case 112: /* Term: Term '[' error ']' */ #line 742 "src/parser.y" { (yyval.blk) = (yyvsp[-3].blk); } #line 3461 "src/parser.c" break; case 113: /* Term: '{' error '}' */ #line 743 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3467 "src/parser.c" break; case 114: /* Args: Arg */ #line 746 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3475 "src/parser.c" break; case 115: /* Args: Args ';' Arg */ #line 749 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3483 "src/parser.c" break; case 116: /* Arg: Query */ #line 754 "src/parser.y" { (yyval.blk) = gen_lambda((yyvsp[0].blk)); } #line 3491 "src/parser.c" break; case 117: /* RepPatterns: RepPatterns "?//" Pattern */ #line 759 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), gen_destructure_alt((yyvsp[0].blk))); } #line 3499 "src/parser.c" break; case 118: /* RepPatterns: Pattern */ #line 762 "src/parser.y" { (yyval.blk) = gen_destructure_alt((yyvsp[0].blk)); } #line 3507 "src/parser.c" break; case 119: /* Patterns: RepPatterns "?//" Pattern */ #line 767 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3515 "src/parser.c" break; case 120: /* Patterns: Pattern */ #line 770 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3523 "src/parser.c" break; case 121: /* Pattern: BINDING */ #line 775 "src/parser.y" { (yyval.blk) = gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal))); jv_free((yyvsp[0].literal)); } #line 3532 "src/parser.c" break; case 122: /* Pattern: '[' ArrayPats ']' */ #line 779 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP)); } #line 3540 "src/parser.c" break; case 123: /* Pattern: '{' ObjPats '}' */ #line 782 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-1].blk), gen_op_simple(POP)); } #line 3548 "src/parser.c" break; case 124: /* ArrayPats: Pattern */ #line 787 "src/parser.y" { (yyval.blk) = gen_array_matcher(gen_noop(), (yyvsp[0].blk)); } #line 3556 "src/parser.c" break; case 125: /* ArrayPats: ArrayPats ',' Pattern */ #line 790 "src/parser.y" { (yyval.blk) = gen_array_matcher((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3564 "src/parser.c" break; case 126: /* ObjPats: ObjPat */ #line 795 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3572 "src/parser.c" break; case 127: /* ObjPats: ObjPats ',' ObjPat */ #line 798 "src/parser.y" { (yyval.blk) = BLOCK((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3580 "src/parser.c" break; case 128: /* ObjPat: BINDING */ #line 803 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[0].literal)), gen_op_unbound(STOREV, jv_string_value((yyvsp[0].literal)))); } #line 3588 "src/parser.c" break; case 129: /* ObjPat: BINDING ':' Pattern */ #line 806 "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 3596 "src/parser.c" break; case 130: /* ObjPat: IDENT ':' Pattern */ #line 809 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3604 "src/parser.c" break; case 131: /* ObjPat: Keyword ':' Pattern */ #line 812 "src/parser.y" { (yyval.blk) = gen_object_matcher(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3612 "src/parser.c" break; case 132: /* ObjPat: String ':' Pattern */ #line 815 "src/parser.y" { (yyval.blk) = gen_object_matcher((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3620 "src/parser.c" break; case 133: /* ObjPat: '(' Query ')' ':' Pattern */ #line 818 "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 3633 "src/parser.c" break; case 134: /* ObjPat: error ':' Pattern */ #line 826 "src/parser.y" { FAIL((yyloc), "May need parentheses around object key expression"); (yyval.blk) = (yyvsp[0].blk); } #line 3642 "src/parser.c" break; case 135: /* Keyword: "as" */ #line 832 "src/parser.y" { (yyval.literal) = jv_string("as"); } #line 3650 "src/parser.c" break; case 136: /* Keyword: "def" */ #line 835 "src/parser.y" { (yyval.literal) = jv_string("def"); } #line 3658 "src/parser.c" break; case 137: /* Keyword: "module" */ #line 838 "src/parser.y" { (yyval.literal) = jv_string("module"); } #line 3666 "src/parser.c" break; case 138: /* Keyword: "import" */ #line 841 "src/parser.y" { (yyval.literal) = jv_string("import"); } #line 3674 "src/parser.c" break; case 139: /* Keyword: "include" */ #line 844 "src/parser.y" { (yyval.literal) = jv_string("include"); } #line 3682 "src/parser.c" break; case 140: /* Keyword: "if" */ #line 847 "src/parser.y" { (yyval.literal) = jv_string("if"); } #line 3690 "src/parser.c" break; case 141: /* Keyword: "then" */ #line 850 "src/parser.y" { (yyval.literal) = jv_string("then"); } #line 3698 "src/parser.c" break; case 142: /* Keyword: "else" */ #line 853 "src/parser.y" { (yyval.literal) = jv_string("else"); } #line 3706 "src/parser.c" break; case 143: /* Keyword: "elif" */ #line 856 "src/parser.y" { (yyval.literal) = jv_string("elif"); } #line 3714 "src/parser.c" break; case 144: /* Keyword: "reduce" */ #line 859 "src/parser.y" { (yyval.literal) = jv_string("reduce"); } #line 3722 "src/parser.c" break; case 145: /* Keyword: "foreach" */ #line 862 "src/parser.y" { (yyval.literal) = jv_string("foreach"); } #line 3730 "src/parser.c" break; case 146: /* Keyword: "end" */ #line 865 "src/parser.y" { (yyval.literal) = jv_string("end"); } #line 3738 "src/parser.c" break; case 147: /* Keyword: "and" */ #line 868 "src/parser.y" { (yyval.literal) = jv_string("and"); } #line 3746 "src/parser.c" break; case 148: /* Keyword: "or" */ #line 871 "src/parser.y" { (yyval.literal) = jv_string("or"); } #line 3754 "src/parser.c" break; case 149: /* Keyword: "try" */ #line 874 "src/parser.y" { (yyval.literal) = jv_string("try"); } #line 3762 "src/parser.c" break; case 150: /* Keyword: "catch" */ #line 877 "src/parser.y" { (yyval.literal) = jv_string("catch"); } #line 3770 "src/parser.c" break; case 151: /* Keyword: "label" */ #line 880 "src/parser.y" { (yyval.literal) = jv_string("label"); } #line 3778 "src/parser.c" break; case 152: /* Keyword: "break" */ #line 883 "src/parser.y" { (yyval.literal) = jv_string("break"); } #line 3786 "src/parser.c" break; case 153: /* DictPairs: %empty */ #line 889 "src/parser.y" { (yyval.blk) = gen_noop(); } #line 3794 "src/parser.c" break; case 154: /* DictPairs: DictPair */ #line 892 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3802 "src/parser.c" break; case 155: /* DictPairs: DictPair ',' DictPairs */ #line 895 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3810 "src/parser.c" break; case 156: /* DictPair: IDENT ':' DictExpr */ #line 900 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3818 "src/parser.c" break; case 157: /* DictPair: Keyword ':' DictExpr */ #line 903 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const((yyvsp[-2].literal)), (yyvsp[0].blk)); } #line 3826 "src/parser.c" break; case 158: /* DictPair: String ':' DictExpr */ #line 906 "src/parser.y" { (yyval.blk) = gen_dictpair((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3834 "src/parser.c" break; case 159: /* DictPair: String */ #line 909 "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 3843 "src/parser.c" break; case 160: /* DictPair: BINDING ':' DictExpr */ #line 913 "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 3853 "src/parser.c" break; case 161: /* DictPair: BINDING */ #line 918 "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 3862 "src/parser.c" break; case 162: /* DictPair: IDENT */ #line 922 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))), gen_index(gen_noop(), gen_const((yyvsp[0].literal)))); } #line 3871 "src/parser.c" break; case 163: /* DictPair: "$__loc__" */ #line 926 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_string("__loc__")), gen_loc_object(&(yyloc), locations)); } #line 3880 "src/parser.c" break; case 164: /* DictPair: Keyword */ #line 930 "src/parser.y" { (yyval.blk) = gen_dictpair(gen_const(jv_copy((yyvsp[0].literal))), gen_index(gen_noop(), gen_const((yyvsp[0].literal)))); } #line 3889 "src/parser.c" break; case 165: /* DictPair: '(' Query ')' ':' DictExpr */ #line 934 "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 3902 "src/parser.c" break; case 166: /* DictPair: error ':' DictExpr */ #line 942 "src/parser.y" { FAIL((yylsp[-2]), "May need parentheses around object key expression"); (yyval.blk) = (yyvsp[0].blk); } #line 3911 "src/parser.c" break; case 167: /* DictExpr: DictExpr '|' DictExpr */ #line 948 "src/parser.y" { (yyval.blk) = block_join((yyvsp[-2].blk), (yyvsp[0].blk)); } #line 3919 "src/parser.c" break; case 168: /* DictExpr: Expr */ #line 951 "src/parser.y" { (yyval.blk) = (yyvsp[0].blk); } #line 3927 "src/parser.c" break; #line 3931 "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 954 "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-jq-1.8.0/src/parser.h000066400000000000000000000152761501676513100150160ustar00rootroot00000000000000/* 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-jq-1.8.0/src/parser.y000066400000000000000000000542261501676513100150350ustar00rootroot00000000000000%{ #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[15]; 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 { jv v = block_const($2); // XXX Make gen_import take only blocks and the int is_data so we // don't have to free so much stuff here $$ = gen_import(jv_string_value(v), jv_string_value($4), 1); block_free($2); jv_free($4); jv_free(v); } | "import" ImportFrom "as" IDENT { jv v = block_const($2); $$ = gen_import(jv_string_value(v), jv_string_value($4), 0); block_free($2); jv_free($4); jv_free(v); } | "include" ImportFrom { jv v = block_const($2); $$ = gen_import(jv_string_value(v), NULL, 0); block_free($2); jv_free(v); } 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-jq-1.8.0/src/util.c000066400000000000000000001105711501676513100144640ustar00rootroot00000000000000/*- * 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" #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)); while (!(res = fgets(state->buf, sizeof(state->buf), 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', sizeof(state->buf)); if (p != NULL) state->current_line++; if (p == NULL && state->parser != NULL) { /* * There should be no NULs in JSON texts (but JSON text * sequences are another story). */ state->buf_valid_len = strlen(state->buf); } else 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 = sizeof(state->buf) - 1; i > 0; i--) { if (state->buf[i] == '\0') break; } state->buf_valid_len = i; } else if (p == NULL) { state->buf_valid_len = sizeof(state->buf) - 1; } 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-jq-1.8.0/src/util.h000066400000000000000000000030741501676513100144700ustar00rootroot00000000000000#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-jq-1.8.0/tests/000077500000000000000000000000001501676513100137115ustar00rootroot00000000000000jq-jq-1.8.0/tests/base64.test000066400000000000000000000013701501676513100156770ustar00rootroot00000000000000# 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...) is not valid base64 data" # invalid base64 (too many bytes, QUJD = "ABCD" . | try @base64d catch . "QUJDa" "string (\"QUJDa\") trailing base64 byte found" jq-jq-1.8.0/tests/base64test000077500000000000000000000001421501676513100156200ustar00rootroot00000000000000#!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/base64.test jq-jq-1.8.0/tests/jq-f-test.sh000077500000000000000000000001661501676513100160650ustar00rootroot00000000000000#!/bin/sh # this next line is ignored by jq, which otherwise does not continue comments \ exec jq -nef "$0" "$@" true jq-jq-1.8.0/tests/jq.test000066400000000000000000001367351501676513100152430ustar00rootroot00000000000000# 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] [foreach range(5) as $x (0; .+$x | select($x!=2); [$x,.])] null [[0,0],[1,1],[3,4],[4,8]] [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 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" [{"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 reduce range(5) as $x (0; .+$x | select($x!=2)) null 8 # 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] # 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" {"a":[{"b":5}]} "Cannot index number with string \"b\"" "Cannot index object with number" {"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"] [(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]] # 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"] # strptime tests are in optional.test 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] # 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"] # 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-string" "string (\"very-long-...) cannot be negated" try (.-.) catch . "very-long-string" "string (\"very-long-...) and string (\"very-long-...) cannot be subtracted" "x" * range(0; 12; 2) + "☆" * 5 | 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" 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\":{...) 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" # 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"] 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 jq-jq-1.8.0/tests/jq_fuzz_compile.c000066400000000000000000000010721501676513100172550ustar00rootroot00000000000000#include #include #include #include "jq.h" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { // Creat null-terminated string char *null_terminated = (char *)malloc(size + 1); memcpy(null_terminated, (char *)data, size); null_terminated[size] = '\0'; // Fuzzer entrypoint jq_state *jq = NULL; jq = jq_init(); if (jq != NULL) { if (jq_compile(jq, null_terminated)) { jq_dump_disassembly(jq, 2); } } jq_teardown(&jq); // Free the null-terminated string free(null_terminated); return 0; } jq-jq-1.8.0/tests/jq_fuzz_execute.cpp000066400000000000000000000022771501676513100176370ustar00rootroot00000000000000#include #include #include "jq.h" #include "jv.h" // Fuzzer inspired by /src/jq_test.c // The goal is to have the fuzzer execute the functions: // jq_compile -> jv_parse -> jq_next. extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { FuzzedDataProvider fdp(data, size); std::string prog_payload = fdp.ConsumeRandomLengthString(); std::string parse_payload1 = fdp.ConsumeRandomLengthString(); std::string parse_payload2 = fdp.ConsumeRandomLengthString(); jq_state *jq = NULL; jq = jq_init(); if (jq != NULL) { jq_set_attr(jq, jv_string("JQ_ORIGIN"), jv_string("/tmp/")); if (jq_compile(jq, prog_payload.c_str())) { // Process to jv_parse and then jv_next jv input = jv_parse(parse_payload1.c_str()); if (jv_is_valid(input)) { jq_start(jq, input, 0); jv next = jv_parse(parse_payload2.c_str()); if (jv_is_valid(next)) { jv actual = jq_next(jq); jv_free(actual); } jv_free(next); } else { // Only free if input is invalid as otherwise jq_teardown // frees it. jv_free(input); } } } jq_teardown(&jq); return 0; } jq-jq-1.8.0/tests/jq_fuzz_fixed.cpp000066400000000000000000000211151501676513100172640ustar00rootroot00000000000000#include #include #include "jq.h" #include "jv.h" const char *jq_progs[] = { ". / \", \"", ".[]", "$ENV.PAGER", ".[0]", ". < 0.12345678901234567890123456788", ".[] == 1", ".[] | (1 / .)?", "10 / . * 3", "[1,2,empty,3]", "1, empty, 2", "[.,1]|until(.[0] < 1; [.[0] - 1, .[1] * .[0]])|.[1]", ".[-2:]", ".[-2]", ".[2]", "[ .[] | . * 2]", ".[2:4]", "(. + 2) * 5", ".[:3]", ".[4,2]", "42 and \"a string\"", "4 - .a", ". < 5", ".. | .a?", "[.[] | .a?]", ".a + 1", "{a: 1} + {b: 2} + {c: 3} + {a: 42}", ".a + .b", ".a = .b", ".a |= .b", "add", "all", ".a + null", "any", ".[] as [$a, $b] | {a: $a, b: $b}", ". as [$a, $b, {c: $c}] | $a + $b + $c", ".[] as {$a, $b, c: {$d}} ?// {$a, $b, c: [{$e}]} | {$a, $b, $d, $e}", ".[] as {$a, $b, c: {$d, $e}} ?// {$a, $b, c: [{$d, $e}]} | {$a, $b, " "$d, $e}", ".[] as [$a] ?// [$b] | if $a != null then error(\"err: \\($a)\") else " "{$a,$b} end", ". as $big | [$big, $big + 1] | map(. > " "10000000000000000000000000000000)", ". as $dot|fromstream($dot|tostream)|.==$dot", ". as $i|[(.*2|. as $i| $i), $i]", "ascii_upcase", ".bar as $x | .foo | . + $x", "@base64", "@base64d", ". == {\"b\": {\"d\": (4 + 1e-20), \"c\": 3}, \"a\":1}", "bsearch(0)", "bsearch(4) as $ix | if $ix < 0 then .[-(1+$ix)] = 4 else . end", "capture(\"(?[a-z]+)-(?[0-9]+)\")", "capture(\"(?[a-z]+)-(?[0-9]+)\")", "combinations", "combinations(2)", "contains(\"bar\")", "contains([\"baz\", \"bar\"])", "contains([\"bazzzzz\", \"bar\"])", "contains({foo: 12, bar: [{barp: 15}]})", "def addvalue(f): f as $x | map(. + $x); addvalue(.[0])", "def addvalue(f): . + [f]; map(addvalue(.[0]))", "def while(cond; update): def _while: if cond then ., (update | " "_while) else empty end; _while; [while(.<100; .*2)]", "del(.[1, 2])", "del(.foo)", "delpaths([[\"a\",\"b\"]])", "empty // 42", "[.[]|endswith(\"foo\")]", "env.PAGER", "explode", ". == false", "(false, null, 1) // 42", "(false, null, 1) | . // 42", "flatten", "flatten(1)", "floor", ".[\"foo\"]", ".[\"foo\"]?", ".foo", ".foo?", ".foo[]", "[.foo?]", ".foo += 1", ".foo // 42", ".foo, .bar", "foreach .[] as $item (0; . + $item)", "foreach .[] as $item (0; . + $item; [$item, . * 2])", "foreach .[] as $item (0; . + 1; {index: ., $item})", "fromdate", "from_entries", "fromstream(1|truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]]))", "getpath([\"a\",\"b\"])", "[getpath([\"a\",\"b\"], [\"a\",\"c\"])]", "group_by(.foo)", "[.[] | gsub(\", \"; \":\")]", "gsub(\"$\"; \"a\"; \"g\")", "gsub(\"^\"; \"a\")", "[gsub(\"(?.)\"; \"\\(.a|ascii_upcase)\", \"\\(.a|ascii_downcase)\", " "\"c\")]", "gsub(\"^.*?a\"; \"b\")", "gsub(\"^.*a\"; \"b\")", "gsub(\"a\";\"b\")", "gsub(\"\"; \"a\"; \"g\")", "gsub(\"\"; \"a\"; \"g\")", "gsub(\"[^a-z]*(?[a-z]*)\"; \"Z\\(.x)\")", "gsub(\"\\b(?.)\"; \"\\(.x|ascii_downcase)\")", "gsub(\"(?\\d)\"; \":\\(.d);\")", "gsub(\"^\"; \"\"; \"g\")", "[gsub(\"p\"; \"a\", \"b\")]", "gsub(\"(?=u)\"; \"u\")", "gsub(\"(.*)\"; \"\"; \"x\")", "gsub(\"(?.)[^a]*\"; \"+\\(.x)-\")", "gsub(\"(?.)(?[0-9])\"; \"\\(.x|ascii_downcase)\\(.y)\")", "@html", "if . == 0 then \"zero\" elif . == 1 then \"one\" else \"many\" " "end", "implode", "index(\", \")", "index(1)", "index([1,2])", "indices(\", \")", "indices(1)", "indices([1,2])", ".[] | (infinite * .) < 0", "infinite, nan | type", ".[] | in({\"foo\": 42})", "inside({\"foo\": 12, \"bar\":[1,2,{\"barp\":12, \"blip\":13}]})", "inside({\"foo\": 12, \"bar\":[1,2,{\"barp\":12, \"blip\":13}]})", "inside(\"foobar\")", "inside([\"foobar\", \"foobaz\", \"blarp\"])", "inside([\"foobar\", \"foobaz\", \"blarp\"])", "isempty(.[])", "isempty(.[])", "isempty(empty)", "join(\" \")", "join(\", \")", "keys", "keys", ".[] | length", "[limit(3;.[])]", "[.[]|ltrimstr(\"foo\")]", "map(., .)", "map(.+1)", "map([., . == 1]) | tojson", "map(abs)", "map(has(2))", "map(has(\"foo\"))", "map(in([0,1]))", "map(select(. >= 2))", "map(type)", "map_values(.+1)", "map_values(. // empty)", "match(\"(abc)+\"; \"g\")", "[match(\"a\"; \"gi\")]", "[match(\".+?\\b\")]", "[match([\"(bar)\"])]", "match(\"foo\")", "[match([\"foo (?bar)? foo\", \"ig\"])]", "match(\"foo (?bar)? foo\"; \"ig\")", "match([\"foo\", \"ig\"])", "[match(\"\"; \"g\")]", "[ match(\".\"; \"g\")] | length", "[match(\"( )*\"; \"gn\")]", "max_by(.foo)", "min", ".[] | .name", ".[]|numbers", "[path(..)]", "path(.a[0].b)", "[paths]", "[paths(type == \"number\")]", "pick(.[2], .[0], .[0])", "pick(.a, .b.c, .x)", "[range(0; 10; -1)]", "[range(0; 10; 3)]", "[range(0; -5; -1)]", "[range(2; 4)]", "range(2; 4)", "[range(4)]", "[range(.)]|[first, last, nth(5)]", "recurse", "recurse(. * .; . < 20)", "recurse(.foo[])", "reduce .[] as [$i,$j] (0; . + $i * $j)", "reduce .[] as $item (0; . + $item)", "reduce .[] as {$x,$y} (null; .x += $x | .y += [$y])", "[repeat(.*2, error)?]", "reverse", "rindex(\", \")", "rindex(1)", "rindex([1,2])", "[.[]|rtrimstr(\"foo\")]", "[.[] | scan(\", \")]", "[.[] | scan(\"b+\"; \"i\")]", "scan(\"c\")", ".[] | select(.id == \"second\")", "(..|select(type==\"boolean\")) |= if . then 1 else 0 end", "setpath([0,\"a\"]; 1)", "setpath([\"a\",\"b\"]; 1)", "setpath([\"a\",\"b\"]; 1)", "@sh \"echo \\(.)\"", "sort", "sort_by(.foo)", "sort_by(.foo, .bar)", "split(\", *\"; null)", "splits(\", *\")", "sqrt", "[.[]|startswith(\"foo\")]", "strptime(\"%Y-%m-%dT%H:%M:%SZ\")", "strptime(\"%Y-%m-%dT%H:%M:%SZ\")|mktime", "[sub(\"(?.)\"; \"\\(.a|ascii_upcase)\", \"\\(.a|ascii_downcase)\")]", "[sub(\"(?.)\"; \"\\(.a|ascii_upcase)\", \"\\(.a|ascii_downcase)\", " "\"c\")]", "[sub(\"a\"; \"b\", \"c\")]", "sub(\"[^a-z]*(?[a-z]+)\"; \"Z\\(.x)\"; \"g\")", "[.[]|[[sub(\", *\";\":\")], [gsub(\", *\";\":\")], [scan(\", *\")]]]", "[.[]|[[sub(\", +\";\":\")], [gsub(\", +\";\":\")], [scan(\", +\")]]]", "sub(\"^(?.)\"; \"Head=\\(.head) Tail=\")", "[test(\"ā\")]", ".[] | test(\"a b c # spaces are ignored\"; \"ix\")", "test(\"foo\")", "to_entries", "[., tojson]", "[.[]|tojson]", "[.[]|tojson|fromjson]", ".[] | tonumber", "[.[] | tonumber?]", ".[] | tostring", "[.[]|tostring]", "transpose", "[true, false | not]", "(true, false) or false", "(true, true) and (true, false)", "truncate_stream([[0],1],[[1,0],2],[[1,0]],[[1]])", "[.[]|try .a]", "unique", "unique_by(.foo)", "unique_by(length)", ".user, .projects[]", "[.user, .projects[]]", "{(.user): .titles}", "{user, title: .titles[]}", "utf8bytelength", "walk(if type == \"array\" then sort else . end)", "walk( if type == \"object\" then with_entries( .key |= sub( \"^_+\"; " "\"\") ) else . end )", "[while(.<100; .*2)]", "with_entries(.key |= \"KEY_\" + .)", ". - [\"xml\", \"yaml\"]", }; // Fuzzer inspired by /src/jq_test.c // The goal is to have the fuzzer execute the functions: // jq_compile -> jv_parse -> jq_next. extern "C" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { FuzzedDataProvider fdp(data, size); std::string parse_payload1 = fdp.ConsumeRandomLengthString(); std::string parse_payload2 = fdp.ConsumeRandomLengthString(); int idx = fdp.ConsumeIntegralInRange( 0, (sizeof(jq_progs) / sizeof(char *)) - 1); jq_state *jq = NULL; jq = jq_init(); if (jq != NULL) { jq_set_attr(jq, jv_string("JQ_ORIGIN"), jv_string("/tmp/")); if (jq_compile(jq, jq_progs[idx])) { // Process to jv_parse and then jv_next jv input = jv_parse(parse_payload1.c_str()); if (jv_is_valid(input)) { jq_start(jq, input, 0); jv next = jv_parse(parse_payload2.c_str()); if (jv_is_valid(next)) { jv actual = jq_next(jq); jv_free(actual); } jv_free(next); } else { // Only free if input is invalid as otherwise jq_teardown // frees it. jv_free(input); } } } jq_teardown(&jq); return 0; } jq-jq-1.8.0/tests/jq_fuzz_load_file.c000066400000000000000000000010741501676513100175450ustar00rootroot00000000000000#include #include #include #include "jv.h" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { // Create file with fuzzer data char filename[256]; sprintf(filename, "/tmp/libfuzzer.%d", getpid()); FILE *fp = fopen(filename, "wb"); if (!fp) { return 0; } fwrite(data, size, 1, fp); fclose(fp); // Fuzz the two version of jv_load_file jv data1 = jv_load_file(filename, 1); jv_free(data1); jv data2 = jv_load_file(filename, 0); jv_free(data2); // Clean up fuzz file unlink(filename); return 0; } jq-jq-1.8.0/tests/jq_fuzz_parse.c000066400000000000000000000007101501676513100167350ustar00rootroot00000000000000#include #include #include #include "jv.h" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { // Creat null-terminated string char *null_terminated = (char *)malloc(size + 1); memcpy(null_terminated, (char *)data, size); null_terminated[size] = '\0'; // Fuzzer entrypoint jv res = jv_parse(null_terminated); jv_free(res); // Free the null-terminated string free(null_terminated); return 0; } jq-jq-1.8.0/tests/jq_fuzz_parse_extended.c000066400000000000000000000013041501676513100206150ustar00rootroot00000000000000#include #include #include #include "jv.h" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { if (size < 8) { return 0; } int fuzz_flags = *(int*)data; data += 4; size -= 4; int dump_flags = *(int*)data; data += 4; size -= 4; // Creat null-terminated string char *null_terminated = (char *)malloc(size + 1); memcpy(null_terminated, (char *)data, size); null_terminated[size] = '\0'; // Fuzzer entrypoint jv res = jv_parse_custom_flags(null_terminated, fuzz_flags); if (jv_is_valid(res)) { jv_dump(res, dump_flags); } else { jv_free(res); } // Free the null-terminated string free(null_terminated); return 0; } jq-jq-1.8.0/tests/jq_fuzz_parse_stream.c000066400000000000000000000007531501676513100203170ustar00rootroot00000000000000#include #include #include #include "jv.h" int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) { // Creat null-terminated string char *null_terminated = (char *)malloc(size + 1); memcpy(null_terminated, (char *)data, size); null_terminated[size] = '\0'; // Fuzzer entrypoint jv res = jv_parse_custom_flags(null_terminated, JV_PARSE_STREAMING); jv_free(res); // Free the null-terminated string free(null_terminated); return 0; } jq-jq-1.8.0/tests/jqtest000077500000000000000000000001361501676513100151510ustar00rootroot00000000000000#!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/jq.test jq-jq-1.8.0/tests/local.supp000066400000000000000000000003741501676513100157200ustar00rootroot00000000000000{ 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-jq-1.8.0/tests/man.test000066400000000000000000000325171501676513100153750ustar00rootroot00000000000000. "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-jq-1.8.0/tests/manonig.test000066400000000000000000000032661501676513100162510ustar00rootroot00000000000000split(", ") "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-jq-1.8.0/tests/manonigtest000077500000000000000000000001511501676513100161640ustar00rootroot00000000000000#!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQBASEDIR/tests/manonig.test jq-jq-1.8.0/tests/mantest000077500000000000000000000002651501676513100153150ustar00rootroot00000000000000#!/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-jq-1.8.0/tests/modules/000077500000000000000000000000001501676513100153615ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/a.jq000066400000000000000000000000421501676513100161310ustar00rootroot00000000000000module {version:1.7}; def a: "a"; jq-jq-1.8.0/tests/modules/b/000077500000000000000000000000001501676513100156025ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/b/b.jq000066400000000000000000000000301501676513100163500ustar00rootroot00000000000000def a: "b"; def b: "c"; jq-jq-1.8.0/tests/modules/c/000077500000000000000000000000001501676513100156035ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/c/c.jq000066400000000000000000000012611501676513100163610ustar00rootroot00000000000000module {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-jq-1.8.0/tests/modules/c/d.jq000066400000000000000000000000201501676513100163520ustar00rootroot00000000000000def meh: "meh"; jq-jq-1.8.0/tests/modules/data.json000066400000000000000000000000561501676513100171660ustar00rootroot00000000000000{ "this": "is a test", "that": "is too" } jq-jq-1.8.0/tests/modules/home1/000077500000000000000000000000001501676513100163725ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/home1/.jq000066400000000000000000000001071501676513100170030ustar00rootroot00000000000000def foo: "baz"; def f: "wat"; def f: "foo"; def g: "bar"; def fg: f+g; jq-jq-1.8.0/tests/modules/home2/000077500000000000000000000000001501676513100163735ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/home2/.jq/000077500000000000000000000000001501676513100170635ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/home2/.jq/g.jq000066400000000000000000000000121501676513100176360ustar00rootroot00000000000000def g: 1; jq-jq-1.8.0/tests/modules/lib/000077500000000000000000000000001501676513100161275ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/lib/jq/000077500000000000000000000000001501676513100165415ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/lib/jq/e/000077500000000000000000000000001501676513100167655ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/lib/jq/e/e.jq000066400000000000000000000000201501676513100175350ustar00rootroot00000000000000def bah: "bah"; jq-jq-1.8.0/tests/modules/lib/jq/f.jq000066400000000000000000000000241501676513100173160ustar00rootroot00000000000000def f: "f is here"; jq-jq-1.8.0/tests/modules/shadow1.jq000066400000000000000000000000241501676513100172570ustar00rootroot00000000000000def e: 1; def e: 2; jq-jq-1.8.0/tests/modules/shadow2.jq000066400000000000000000000000121501676513100172550ustar00rootroot00000000000000def e: 3; jq-jq-1.8.0/tests/modules/syntaxerror/000077500000000000000000000000001501676513100177615ustar00rootroot00000000000000jq-jq-1.8.0/tests/modules/syntaxerror/syntaxerror.jq000066400000000000000000000000051501676513100227100ustar00rootroot00000000000000wat; jq-jq-1.8.0/tests/modules/test_bind_order.jq000066400000000000000000000002551501676513100210650ustar00rootroot00000000000000import "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-jq-1.8.0/tests/modules/test_bind_order0.jq000066400000000000000000000000321501676513100211360ustar00rootroot00000000000000def sym0: 0; def sym1: 0; jq-jq-1.8.0/tests/modules/test_bind_order1.jq000066400000000000000000000000321501676513100211370ustar00rootroot00000000000000def sym1: 1; def sym2: 1; jq-jq-1.8.0/tests/modules/test_bind_order2.jq000066400000000000000000000000151501676513100211410ustar00rootroot00000000000000def sym2: 2; jq-jq-1.8.0/tests/no-main-program.jq000066400000000000000000000000121501676513100172410ustar00rootroot00000000000000def a: .; jq-jq-1.8.0/tests/onig.supp000066400000000000000000000003571501676513100155630ustar00rootroot00000000000000{ 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-jq-1.8.0/tests/onig.test000066400000000000000000000115031501676513100155460ustar00rootroot00000000000000# 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-jq-1.8.0/tests/onigtest000077500000000000000000000001401501676513100154660ustar00rootroot00000000000000#!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/onig.test jq-jq-1.8.0/tests/optional.test000066400000000000000000000012611501676513100164370ustar00rootroot00000000000000# See tests/jq.test and the jq manual for more information. # strptime() is not available on mingw/WIN32 [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) # This date range 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] # Regression test for #3276 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-jq-1.8.0/tests/optionaltest000077500000000000000000000001441501676513100163630ustar00rootroot00000000000000#!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/optional.test jq-jq-1.8.0/tests/setup000077500000000000000000000017001501676513100147750ustar00rootroot00000000000000#!/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-jq-1.8.0/tests/shtest000077500000000000000000000625541501676513100151650ustar00rootroot00000000000000#!/bin/sh -x . "${0%/*}/setup" "$@" msys=false mingw=false case "$(uname -s)" in MSYS*) msys=true;; MINGW*) mingw=true;; esac JQ_NO_B=$JQ JQ="$JQ -b" 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 ## 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 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 # Check $NO_COLOR test_no_color=true $msys && test_no_color=false $mingw && 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 # 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 exit 0 jq-jq-1.8.0/tests/torture/000077500000000000000000000000001501676513100154155ustar00rootroot00000000000000jq-jq-1.8.0/tests/torture/input0.json000066400000000000000000000002271501676513100175300ustar00rootroot000000000000000 12 true false null [] {} [{}] [[]] [0,01,[12,22,[34,[45,56],7]],[]] {"a":[1]} {"a":[{}]} {"a":[{},[],[[]]]} {"a":[{"b":[]}]} {"a":[{"b":[]},{},[2]]} jq-jq-1.8.0/tests/uri.test000066400000000000000000000016011501676513100154070ustar00rootroot00000000000000# Tests are groups of three lines: program, input, expected output # Blank lines and lines starting with # are ignored @uri "<>&'\"\t" "%3C%3E%26%27%22%09" # decoding encoded output results in same text (@uri|@urid) "<>&'\"\t" "<>&'\"\t" # testing variable length unicode characters @uri "a \u03bc \u2230 \ud83d\ude0e" "a%20%CE%BC%20%E2%88%B0%20%F0%9F%98%8E" @urid "a%20%CE%BC%20%E2%88%B0%20%F0%9F%98%8E" "a \u03bc \u2230 \ud83d\ude0e" ### invalid uri strings # unicode character should be length 4 (not 3) . | try @urid catch . "%F0%93%81" "string (\"%F0%93%81\") 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" # trailing utf-8 octets must be formatted like 10xxxxxx # 'C0' = 11000000 invalid . | try @urid catch . "%F0%C0%81%8E" "string (\"%F0%C0%81%8E\") is not a valid uri encoding" jq-jq-1.8.0/tests/uritest000077500000000000000000000001371501676513100153370ustar00rootroot00000000000000#!/bin/sh . "${0%/*}/setup" "$@" $VALGRIND $Q $JQ -L "$mods" --run-tests $JQTESTDIR/uri.test jq-jq-1.8.0/tests/utf8-truncate.jq000066400000000000000000000100331501676513100167530ustar00rootroot00000000000000def fill:"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; def e:"日本語"; e == "日本語" jq-jq-1.8.0/tests/utf8test000077500000000000000000000003231501676513100154230ustar00rootroot00000000000000#!/bin/sh . "${0%/*}/setup" "$@" if [ "$($VALGRIND $Q $JQ -nf $JQTESTDIR/utf8-truncate.jq)" != "true" ]; then echo "UTF-8 byte sequences that span the jv_load_file read buffer are mangled" exit 1 fi exit 0 jq-jq-1.8.0/tests/yes-main-program.jq000066400000000000000000000000141501676513100174270ustar00rootroot00000000000000def a: .; 0 jq-jq-1.8.0/vendor/000077500000000000000000000000001501676513100140445ustar00rootroot00000000000000jq-jq-1.8.0/vendor/decNumber/000077500000000000000000000000001501676513100157505ustar00rootroot00000000000000jq-jq-1.8.0/vendor/decNumber/ICU-license.html000066400000000000000000000037461501676513100207100ustar00rootroot00000000000000 ICU License - ICU 1.8.1 and later

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.
jq-jq-1.8.0/vendor/decNumber/decBasic.c000066400000000000000000005467371501676513100176370ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decBasic.c -- common base code for Basic decimal types */ /* ------------------------------------------------------------------ */ /* 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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 code that is shared between decDouble and */ /* decQuad (but not decSingle). The main arithmetic operations are */ /* here (Add, Subtract, Multiply, FMA, and Division operators). */ /* */ /* Unlike decNumber, parameterization takes place at compile time */ /* rather than at runtime. The parameters are set in the decDouble.c */ /* (etc.) files, which then include this one to produce the compiled */ /* code. The functions here, therefore, are code shared between */ /* multiple formats. */ /* */ /* This must be included after decCommon.c. */ /* ------------------------------------------------------------------ */ // Names here refer to decFloat rather than to decDouble, etc., and // the functions are in strict alphabetical order. // The compile-time flags SINGLE, DOUBLE, and QUAD are set up in // decCommon.c #if !defined(QUAD) #error decBasic.c must be included after decCommon.c #endif #if SINGLE #error Routines in decBasic.c are for decDouble and decQuad only #endif /* Private constants */ #define DIVIDE 0x80000000 // Divide operations [as flags] #define REMAINDER 0x40000000 // .. #define DIVIDEINT 0x20000000 // .. #define REMNEAR 0x10000000 // .. /* Private functions (local, used only by routines in this module) */ static decFloat *decDivide(decFloat *, const decFloat *, const decFloat *, decContext *, uInt); static decFloat *decCanonical(decFloat *, const decFloat *); static void decFiniteMultiply(bcdnum *, uByte *, const decFloat *, const decFloat *); static decFloat *decInfinity(decFloat *, const decFloat *); static decFloat *decInvalid(decFloat *, decContext *); static decFloat *decNaNs(decFloat *, const decFloat *, const decFloat *, decContext *); static Int decNumCompare(const decFloat *, const decFloat *, Flag); static decFloat *decToIntegral(decFloat *, const decFloat *, decContext *, enum rounding, Flag); static uInt decToInt32(const decFloat *, decContext *, enum rounding, Flag, Flag); /* ------------------------------------------------------------------ */ /* decCanonical -- copy a decFloat, making canonical */ /* */ /* result gets the canonicalized df */ /* df is the decFloat to copy and make canonical */ /* returns result */ /* */ /* This is exposed via decFloatCanonical for Double and Quad only. */ /* This works on specials, too; no error or exception is possible. */ /* ------------------------------------------------------------------ */ static decFloat * decCanonical(decFloat *result, const decFloat *df) { uInt encode, precode, dpd; // work uInt inword, uoff, canon; // .. Int n; // counter (down) if (df!=result) *result=*df; // effect copy if needed if (DFISSPECIAL(result)) { if (DFISINF(result)) return decInfinity(result, df); // clean Infinity // is a NaN DFWORD(result, 0)&=~ECONNANMASK; // clear ECON except selector if (DFISCCZERO(df)) return result; // coefficient continuation is 0 // drop through to check payload } // return quickly if the coefficient continuation is canonical { // declare block #if DOUBLE uInt sourhi=DFWORD(df, 0); uInt sourlo=DFWORD(df, 1); if (CANONDPDOFF(sourhi, 8) && CANONDPDTWO(sourhi, sourlo, 30) && CANONDPDOFF(sourlo, 20) && CANONDPDOFF(sourlo, 10) && CANONDPDOFF(sourlo, 0)) return result; #elif QUAD uInt sourhi=DFWORD(df, 0); uInt sourmh=DFWORD(df, 1); uInt sourml=DFWORD(df, 2); uInt sourlo=DFWORD(df, 3); if (CANONDPDOFF(sourhi, 4) && CANONDPDTWO(sourhi, sourmh, 26) && CANONDPDOFF(sourmh, 16) && CANONDPDOFF(sourmh, 6) && CANONDPDTWO(sourmh, sourml, 28) && CANONDPDOFF(sourml, 18) && CANONDPDOFF(sourml, 8) && CANONDPDTWO(sourml, sourlo, 30) && CANONDPDOFF(sourlo, 20) && CANONDPDOFF(sourlo, 10) && CANONDPDOFF(sourlo, 0)) return result; #endif } // block // Loop to repair a non-canonical coefficent, as needed inword=DECWORDS-1; // current input word uoff=0; // bit offset of declet encode=DFWORD(result, inword); for (n=DECLETS-1; n>=0; n--) { // count down declets of 10 bits dpd=encode>>uoff; uoff+=10; if (uoff>32) { // crossed uInt boundary inword--; encode=DFWORD(result, inword); uoff-=32; dpd|=encode<<(10-uoff); // get pending bits } dpd&=0x3ff; // clear uninteresting bits if (dpd<0x16e) continue; // must be canonical canon=BIN2DPD[DPD2BIN[dpd]]; // determine canonical declet if (canon==dpd) continue; // have canonical declet // need to replace declet if (uoff>=10) { // all within current word encode&=~(0x3ff<<(uoff-10)); // clear the 10 bits ready for replace encode|=canon<<(uoff-10); // insert the canonical form DFWORD(result, inword)=encode; // .. and save continue; } // straddled words precode=DFWORD(result, inword+1); // get previous precode&=0xffffffff>>(10-uoff); // clear top bits DFWORD(result, inword+1)=precode|(canon<<(32-(10-uoff))); encode&=0xffffffff<>(10-uoff); // insert canonical DFWORD(result, inword)=encode; // .. and save } // n return result; } // decCanonical /* ------------------------------------------------------------------ */ /* decDivide -- divide operations */ /* */ /* result gets the result of dividing dfl by dfr: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* op is the operation selector */ /* returns result */ /* */ /* op is one of DIVIDE, REMAINDER, DIVIDEINT, or REMNEAR. */ /* ------------------------------------------------------------------ */ #define DIVCOUNT 0 // 1 to instrument subtractions counter #define DIVBASE ((uInt)BILLION) // the base used for divide #define DIVOPLEN DECPMAX9 // operand length ('digits' base 10**9) #define DIVACCLEN (DIVOPLEN*3) // accumulator length (ditto) static decFloat * decDivide(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set, uInt op) { decFloat quotient; // for remainders bcdnum num; // for final conversion uInt acc[DIVACCLEN]; // coefficent in base-billion .. uInt div[DIVOPLEN]; // divisor in base-billion .. uInt quo[DIVOPLEN+1]; // quotient in base-billion .. uByte bcdacc[(DIVOPLEN+1)*9+2]; // for quotient in BCD, +1, +1 uInt *msua, *msud, *msuq; // -> msu of acc, div, and quo Int divunits, accunits; // lengths Int quodigits; // digits in quotient uInt *lsua, *lsuq; // -> current acc and quo lsus Int length, multiplier; // work uInt carry, sign; // .. uInt *ua, *ud, *uq; // .. uByte *ub; // .. uInt uiwork; // for macros uInt divtop; // top unit of div adjusted for estimating #if DIVCOUNT static uInt maxcount=0; // worst-seen subtractions count uInt divcount=0; // subtractions count [this divide] #endif // calculate sign num.sign=(DFWORD(dfl, 0)^DFWORD(dfr, 0)) & DECFLOAT_Sign; if (DFISSPECIAL(dfl) || DFISSPECIAL(dfr)) { // either is special? // NaNs are handled as usual if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); // one or two infinities if (DFISINF(dfl)) { if (DFISINF(dfr)) return decInvalid(result, set); // Two infinities bad if (op&(REMAINDER|REMNEAR)) return decInvalid(result, set); // as is rem // Infinity/x is infinite and quiet, even if x=0 DFWORD(result, 0)=num.sign; return decInfinity(result, result); } // must be x/Infinity -- remainders are lhs if (op&(REMAINDER|REMNEAR)) return decCanonical(result, dfl); // divides: return zero with correct sign and exponent depending // on op (Etiny for divide, 0 for divideInt) decFloatZero(result); if (op==DIVIDEINT) DFWORD(result, 0)|=num.sign; // add sign else DFWORD(result, 0)=num.sign; // zeros the exponent, too return result; } // next, handle zero operands (x/0 and 0/x) if (DFISZERO(dfr)) { // x/0 if (DFISZERO(dfl)) { // 0/0 is undefined decFloatZero(result); DFWORD(result, 0)=DECFLOAT_qNaN; set->status|=DEC_Division_undefined; return result; } if (op&(REMAINDER|REMNEAR)) return decInvalid(result, set); // bad rem set->status|=DEC_Division_by_zero; DFWORD(result, 0)=num.sign; return decInfinity(result, result); // x/0 -> signed Infinity } num.exponent=GETEXPUN(dfl)-GETEXPUN(dfr); // ideal exponent if (DFISZERO(dfl)) { // 0/x (x!=0) // if divide, result is 0 with ideal exponent; divideInt has // exponent=0, remainders give zero with lower exponent if (op&DIVIDEINT) { decFloatZero(result); DFWORD(result, 0)|=num.sign; // add sign return result; } if (!(op&DIVIDE)) { // a remainder // exponent is the minimum of the operands num.exponent=MINI(GETEXPUN(dfl), GETEXPUN(dfr)); // if the result is zero the sign shall be sign of dfl num.sign=DFWORD(dfl, 0)&DECFLOAT_Sign; } bcdacc[0]=0; num.msd=bcdacc; // -> 0 num.lsd=bcdacc; // .. return decFinalize(result, &num, set); // [divide may clamp exponent] } // 0/x // [here, both operands are known to be finite and non-zero] // extract the operand coefficents into 'units' which are // base-billion; the lhs is high-aligned in acc and the msu of both // acc and div is at the right-hand end of array (offset length-1); // the quotient can need one more unit than the operands as digits // in it are not necessarily aligned neatly; further, the quotient // may not start accumulating until after the end of the initial // operand in acc if that is small (e.g., 1) so the accumulator // must have at least that number of units extra (at the ls end) GETCOEFFBILL(dfl, acc+DIVACCLEN-DIVOPLEN); GETCOEFFBILL(dfr, div); // zero the low uInts of acc acc[0]=0; acc[1]=0; acc[2]=0; acc[3]=0; #if DOUBLE #if DIVOPLEN!=2 #error Unexpected Double DIVOPLEN #endif #elif QUAD acc[4]=0; acc[5]=0; acc[6]=0; acc[7]=0; #if DIVOPLEN!=4 #error Unexpected Quad DIVOPLEN #endif #endif // set msu and lsu pointers msua=acc+DIVACCLEN-1; // [leading zeros removed below] msuq=quo+DIVOPLEN; //[loop for div will terminate because operands are non-zero] for (msud=div+DIVOPLEN-1; *msud==0;) msud--; // the initial least-significant unit of acc is set so acc appears // to have the same length as div. // This moves one position towards the least possible for each // iteration divunits=(Int)(msud-div+1); // precalculate lsua=msua-divunits+1; // initial working lsu of acc lsuq=msuq; // and of quo // set up the estimator for the multiplier; this is the msu of div, // plus two bits from the unit below (if any) rounded up by one if // there are any non-zero bits or units below that [the extra two // bits makes for a much better estimate when the top unit is small] divtop=*msud<<2; if (divunits>1) { uInt *um=msud-1; uInt d=*um; if (d>=750000000) {divtop+=3; d-=750000000;} else if (d>=500000000) {divtop+=2; d-=500000000;} else if (d>=250000000) {divtop++; d-=250000000;} if (d) divtop++; else for (um--; um>=div; um--) if (*um) { divtop++; break; } } // >1 unit #if DECTRACE {Int i; printf("----- div="); for (i=divunits-1; i>=0; i--) printf("%09ld ", (LI)div[i]); printf("\n");} #endif // now collect up to DECPMAX+1 digits in the quotient (this may // need OPLEN+1 uInts if unaligned) quodigits=0; // no digits yet for (;; lsua--) { // outer loop -- each input position #if DECCHECK if (lsua=lsua;) msua--; accunits=(Int)(msua-lsua+1); // [maybe 0] // subtraction is only necessary and possible if there are as // least as many units remaining in acc for this iteration as // there are in div if (accunitsdiv: subtraction necessary at this position for (ud=msud, ua=msua; ud>div; ud--, ua--) if (*ud!=*ua) break; // [now at first mismatch or lsu] if (*ud>*ua) break; // next time... if (*ud==*ua) { // all compared equal *lsuq+=1; // increment result msua=lsua; // collapse acc units *msua=0; // .. to a zero break; } // subtraction necessary; estimate multiplier [see above] // if both *msud and *msua are small it is cost-effective to // bring in part of the following units (if any) to get a // better estimate (assume some other non-zero in div) #define DIVLO 1000000U #define DIVHI (DIVBASE/DIVLO) #if DECUSE64 if (divunits>1) { // there cannot be a *(msud-2) for DECDOUBLE so next is // an exact calculation unless DECQUAD (which needs to // assume bits out there if divunits>2) uLong mul=(uLong)*msua * DIVBASE + *(msua-1); uLong div=(uLong)*msud * DIVBASE + *(msud-1); #if QUAD if (divunits>2) div++; #endif mul/=div; multiplier=(Int)mul; } else multiplier=*msua/(*msud); #else if (divunits>1 && *msuadivunits // msud is one unit 'lower' than msua, so estimate differently #if DECUSE64 uLong mul; // as before, bring in extra digits if possible if (divunits>1 && *msua>DIVSHIFTA); carry=(uInt)(((uLong)hop*DIVMAGIC)>>DIVSHIFTB); // the estimate is now in hi; now calculate sub-hi*10**9 // to get the remainder (which will be =DIVBASE) { lo-=DIVBASE; // correct by +1 carry++; } } #else // 32-bit uInt hi; // calculate multiplier*(*ud) into hi and lo LONGMUL32HI(hi, *ud, multiplier); // get the high word lo=multiplier*(*ud); // .. and the low lo+=carry; // add the old hi carry=hi+(lo=DIVBASE) { // split is needed hop=(carry<<3)+(lo>>DIVSHIFTA); // hi:lo/2**29 LONGMUL32HI(carry, hop, DIVMAGIC); // only need the high word // [DIVSHIFTB is 32, so carry can be used directly] // the estimate is now in carry; now calculate hi:lo-est*10**9; // happily the top word of the result is irrelevant because it // will always be zero so this needs only one multiplication lo-=(carry*DIVBASE); // the correction here will be at most +1; do it if (lo>=DIVBASE) { lo-=DIVBASE; carry++; } } #endif if (lo>*ua) { // borrow needed *ua+=DIVBASE; carry++; } *ua-=lo; } // ud loop if (carry) *ua-=carry; // accdigits>divdigits [cannot borrow] } // inner loop // the outer loop terminates when there is either an exact result // or enough digits; first update the quotient digit count and // pointer (if any significant digits) #if DECTRACE if (*lsuq || quodigits) printf("*lsuq=%09ld\n", (LI)*lsuq); #endif if (quodigits) { quodigits+=9; // had leading unit earlier lsuq--; if (quodigits>DECPMAX+1) break; // have enough } else if (*lsuq) { // first quotient digits const uInt *pow; for (pow=DECPOWERS; *lsuq>=*pow; pow++) quodigits++; lsuq--; // [cannot have >DECPMAX+1 on first unit] } if (*msua!=0) continue; // not an exact result // acc is zero iff used all of original units and zero down to lsua // (must also continue to original lsu for correct quotient length) if (lsua>acc+DIVACCLEN-DIVOPLEN) continue; for (; msua>lsua && *msua==0;) msua--; if (*msua==0 && msua==lsua) break; } // outer loop // all of the original operand in acc has been covered at this point // quotient now has at least DECPMAX+2 digits // *msua is now non-0 if inexact and sticky bits // lsuq is one below the last uint of the quotient lsuq++; // set -> true lsu of quo if (*msua) *lsuq|=1; // apply sticky bit // quo now holds the (unrounded) quotient in base-billion; one // base-billion 'digit' per uInt. #if DECTRACE printf("DivQuo:"); for (uq=msuq; uq>=lsuq; uq--) printf(" %09ld", (LI)*uq); printf("\n"); #endif // Now convert to BCD for rounding and cleanup, starting from the // most significant end [offset by one into bcdacc to leave room // for a possible carry digit if rounding for REMNEAR is needed] for (uq=msuq, ub=bcdacc+1; uq>=lsuq; uq--, ub+=9) { uInt top, mid, rem; // work if (*uq==0) { // no split needed UBFROMUI(ub, 0); // clear 9 BCD8s UBFROMUI(ub+4, 0); // .. *(ub+8)=0; // .. continue; } // *uq is non-zero -- split the base-billion digit into // hi, mid, and low three-digits #define divsplit9 1000000 // divisor #define divsplit6 1000 // divisor // The splitting is done by simple divides and remainders, // assuming the compiler will optimize these [GCC does] top=*uq/divsplit9; rem=*uq%divsplit9; mid=rem/divsplit6; rem=rem%divsplit6; // lay out the nine BCD digits (plus one unwanted byte) UBFROMUI(ub, UBTOUI(&BIN2BCD8[top*4])); UBFROMUI(ub+3, UBTOUI(&BIN2BCD8[mid*4])); UBFROMUI(ub+6, UBTOUI(&BIN2BCD8[rem*4])); } // BCD conversion loop ub--; // -> lsu // complete the bcdnum; quodigits is correct, so the position of // the first non-zero is known num.msd=bcdacc+1+(msuq-lsuq+1)*9-quodigits; num.lsd=ub; // make exponent adjustments, etc if (lsuamaxcount) { // new high-water nark maxcount=divcount; printf("DivNewMaxCount: %ld\n", (LI)maxcount); } #endif if (op&DIVIDE) return decFinalize(result, &num, set); // all done // Is DIVIDEINT or a remainder; there is more to do -- first form // the integer (this is done 'after the fact', unlike as in // decNumber, so as not to tax DIVIDE) // The first non-zero digit will be in the first 9 digits, known // from quodigits and num.msd, so there is always space for DECPMAX // digits length=(Int)(num.lsd-num.msd+1); //printf("Length exp: %ld %ld\n", (LI)length, (LI)num.exponent); if (length+num.exponent>DECPMAX) { // cannot fit decFloatZero(result); DFWORD(result, 0)=DECFLOAT_qNaN; set->status|=DEC_Division_impossible; return result; } if (num.exponent>=0) { // already an int, or need pad zeros for (ub=num.lsd+1; ub<=num.lsd+num.exponent; ub++) *ub=0; num.lsd+=num.exponent; } else { // too long: round or truncate needed Int drop=-num.exponent; if (!(op&REMNEAR)) { // simple truncate num.lsd-=drop; if (num.lsd re-round digit uByte reround; // reround value *(num.msd-1)=0; // in case of left carry, or make 0 if (drop 0] reround=*roundat; for (ub=roundat+1; ub<=num.lsd; ub++) { if (*ub!=0) { reround=DECSTICKYTAB[reround]; break; } } // check stickies if (roundat>num.msd) num.lsd=roundat-1; else { num.msd--; // use the 0 .. num.lsd=num.msd; // .. at the new MSD place } if (reround!=0) { // discarding non-zero uInt bump=0; // rounding is DEC_ROUND_HALF_EVEN always if (reround>5) bump=1; // >0.5 goes up else if (reround==5) // exactly 0.5000 .. bump=*(num.lsd) & 0x01; // .. up iff [new] lsd is odd if (bump!=0) { // need increment // increment the coefficient; this might end up with 1000... ub=num.lsd; for (; UBTOUI(ub-3)==0x09090909; ub-=4) UBFROMUI(ub-3, 0); for (; *ub==9; ub--) *ub=0; // at most 3 more *ub+=1; if (ub9 #error Exponent may overflow when doubled for Multiply #endif #if MULACCLEN!=(MULACCLEN/4)*4 // This assumption is used below only for initialization #error MULACCLEN is not a multiple of 4 #endif static void decFiniteMultiply(bcdnum *num, uByte *bcdacc, const decFloat *dfl, const decFloat *dfr) { uInt bufl[MULOPLEN]; // left coefficient (base-billion) uInt bufr[MULOPLEN]; // right coefficient (base-billion) uInt *ui, *uj; // work uByte *ub; // .. uInt uiwork; // for macros #if DECUSE64 uLong accl[MULACCLEN]; // lazy accumulator (base-billion+) uLong *pl; // work -> lazy accumulator uInt acc[MULACCLEN]; // coefficent in base-billion .. #else uInt acc[MULACCLEN*2]; // accumulator in base-billion .. #endif uInt *pa; // work -> accumulator //printf("Base10**9: OpLen=%d MulAcclen=%d\n", OPLEN, MULACCLEN); /* Calculate sign and exponent */ num->sign=(DFWORD(dfl, 0)^DFWORD(dfr, 0)) & DECFLOAT_Sign; num->exponent=GETEXPUN(dfl)+GETEXPUN(dfr); // [see assertion above] /* Extract the coefficients and prepare the accumulator */ // the coefficients of the operands are decoded into base-billion // numbers in uInt arrays (bufl and bufr, LSD at offset 0) of the // appropriate size. GETCOEFFBILL(dfl, bufl); GETCOEFFBILL(dfr, bufr); #if DECTRACE && 0 printf("CoeffbL:"); for (ui=bufl+MULOPLEN-1; ui>=bufl; ui--) printf(" %08lx", (LI)*ui); printf("\n"); printf("CoeffbR:"); for (uj=bufr+MULOPLEN-1; uj>=bufr; uj--) printf(" %08lx", (LI)*uj); printf("\n"); #endif // start the 64-bit/32-bit differing paths... #if DECUSE64 // zero the accumulator #if MULACCLEN==4 accl[0]=0; accl[1]=0; accl[2]=0; accl[3]=0; #else // use a loop // MULACCLEN is a multiple of four, asserted above for (pl=accl; pl1 may be // needed. Values of A and B are chosen to satisfy the constraints // just mentioned while minimizing the maximum error (and hence the // maximum correction), as shown in the following table: // // Type OPLEN A B maxX maxError maxCorrection // --------------------------------------------------------- // DOUBLE 2 29 32 <2*10**18 0.63 1 // QUAD 4 30 31 <4*10**18 1.17 2 // // In the OPLEN==2 case there is most choice, but the value for B // of 32 has a big advantage as then the calculation of the // estimate requires no shifting; the compiler can extract the high // word directly after multiplying magic*hop. #define MULMAGIC 2305843009U // 2**61/10**9 [both cases] #if DOUBLE #define MULSHIFTA 29 #define MULSHIFTB 32 #elif QUAD #define MULSHIFTA 30 #define MULSHIFTB 31 #else #error Unexpected type #endif #if DECTRACE printf("MulAccl:"); for (pl=accl+MULACCLEN-1; pl>=accl; pl--) printf(" %08lx:%08lx", (LI)(*pl>>32), (LI)(*pl&0xffffffff)); printf("\n"); #endif for (pl=accl, pa=acc; pl=MULTBASE) { // *pl holds a binary number which needs to be split hop=(uInt)(*pl>>MULSHIFTA); est=(uInt)(((uLong)hop*MULMAGIC)>>MULSHIFTB); // the estimate is now in est; now calculate hi:lo-est*10**9; // happily the top word of the result is irrelevant because it // will always be zero so this needs only one multiplication lo=(uInt)(*pl-((uLong)est*MULTBASE)); // low word of result // If QUAD, the correction here could be +2 if (lo>=MULTBASE) { lo-=MULTBASE; // correct by +1 est++; #if QUAD // may need to correct by +2 if (lo>=MULTBASE) { lo-=MULTBASE; est++; } #endif } // finally place lo as the new coefficient 'digit' and add est to // the next place up [this is safe because this path is never // taken on the final iteration as *pl will fit] *pa=lo; *(pl+1)+=est; } // *pl needed split else { // *pl1 may be // needed. Values of A and B are chosen to satisfy the constraints // just mentioned while minimizing the maximum error (and hence the // maximum correction), as shown in the following table: // // Type OPLEN A B maxX maxError maxCorrection // --------------------------------------------------------- // DOUBLE 2 29 32 <2*10**18 0.63 1 // QUAD 4 30 31 <4*10**18 1.17 2 // // In the OPLEN==2 case there is most choice, but the value for B // of 32 has a big advantage as then the calculation of the // estimate requires no shifting; the high word is simply // calculated from multiplying magic*hop. #define MULMAGIC 2305843009U // 2**61/10**9 [both cases] #if DOUBLE #define MULSHIFTA 29 #define MULSHIFTB 32 #elif QUAD #define MULSHIFTA 30 #define MULSHIFTB 31 #else #error Unexpected type #endif #if DECTRACE printf("MulHiLo:"); for (pa=acc+MULACCLEN-1; pa>=acc; pa--) printf(" %08lx:%08lx", (LI)*(pa+MULACCLEN), (LI)*pa); printf("\n"); #endif for (pa=acc;; pa++) { // each low uInt uInt hi, lo; // words of exact multiply result uInt hop, estlo; // work #if QUAD uInt esthi; // .. #endif lo=*pa; hi=*(pa+MULACCLEN); // top 32 bits // hi and lo now hold a binary number which needs to be split #if DOUBLE hop=(hi<<3)+(lo>>MULSHIFTA); // hi:lo/2**29 LONGMUL32HI(estlo, hop, MULMAGIC);// only need the high word // [MULSHIFTB is 32, so estlo can be used directly] // the estimate is now in estlo; now calculate hi:lo-est*10**9; // happily the top word of the result is irrelevant because it // will always be zero so this needs only one multiplication lo-=(estlo*MULTBASE); // esthi=0; // high word is ignored below // the correction here will be at most +1; do it if (lo>=MULTBASE) { lo-=MULTBASE; estlo++; } #elif QUAD hop=(hi<<2)+(lo>>MULSHIFTA); // hi:lo/2**30 LONGMUL32HI(esthi, hop, MULMAGIC);// shift will be 31 .. estlo=hop*MULMAGIC; // .. so low word needed estlo=(esthi<<1)+(estlo>>MULSHIFTB); // [just the top bit] // esthi=0; // high word is ignored below lo-=(estlo*MULTBASE); // as above // the correction here could be +1 or +2 if (lo>=MULTBASE) { lo-=MULTBASE; estlo++; } if (lo>=MULTBASE) { lo-=MULTBASE; estlo++; } #else #error Unexpected type #endif // finally place lo as the new accumulator digit and add est to // the next place up; this latter add could cause a carry of 1 // to the high word of the next place *pa=lo; *(pa+1)+=estlo; // esthi is always 0 for DOUBLE and QUAD so this is skipped // *(pa+1+MULACCLEN)+=esthi; if (*(pa+1)=acc; pa--) printf(" %09ld", (LI)*pa); printf("\n"); #endif // Now convert to BCD for rounding and cleanup, starting from the // most significant end pa=acc+MULACCLEN-1; if (*pa!=0) num->msd=bcdacc+LEADZEROS;// drop known lead zeros else { // >=1 word of leading zeros num->msd=bcdacc; // known leading zeros are gone pa--; // skip first word .. for (; *pa==0; pa--) if (pa==acc) break; // .. and any more leading 0s } for (ub=bcdacc;; pa--, ub+=9) { if (*pa!=0) { // split(s) needed uInt top, mid, rem; // work // *pa is non-zero -- split the base-billion acc digit into // hi, mid, and low three-digits #define mulsplit9 1000000 // divisor #define mulsplit6 1000 // divisor // The splitting is done by simple divides and remainders, // assuming the compiler will optimize these where useful // [GCC does] top=*pa/mulsplit9; rem=*pa%mulsplit9; mid=rem/mulsplit6; rem=rem%mulsplit6; // lay out the nine BCD digits (plus one unwanted byte) UBFROMUI(ub, UBTOUI(&BIN2BCD8[top*4])); UBFROMUI(ub+3, UBTOUI(&BIN2BCD8[mid*4])); UBFROMUI(ub+6, UBTOUI(&BIN2BCD8[rem*4])); } else { // *pa==0 UBFROMUI(ub, 0); // clear 9 BCD8s UBFROMUI(ub+4, 0); // .. *(ub+8)=0; // .. } if (pa==acc) break; } // BCD conversion loop num->lsd=ub+8; // complete the bcdnum .. #if DECTRACE decShowNum(num, "postmult"); decFloatShow(dfl, "dfl"); decFloatShow(dfr, "dfr"); #endif return; } // decFiniteMultiply /* ------------------------------------------------------------------ */ /* decFloatAbs -- absolute value, heeding NaNs, etc. */ /* */ /* result gets the canonicalized df with sign 0 */ /* df is the decFloat to abs */ /* set is the context */ /* returns result */ /* */ /* This has the same effect as decFloatPlus unless df is negative, */ /* in which case it has the same effect as decFloatMinus. The */ /* effect is also the same as decFloatCopyAbs except that NaNs are */ /* handled normally (the sign of a NaN is not affected, and an sNaN */ /* will signal) and the result will be canonical. */ /* ------------------------------------------------------------------ */ decFloat * decFloatAbs(decFloat *result, const decFloat *df, decContext *set) { if (DFISNAN(df)) return decNaNs(result, df, NULL, set); decCanonical(result, df); // copy and check DFBYTE(result, 0)&=~0x80; // zero sign bit return result; } // decFloatAbs /* ------------------------------------------------------------------ */ /* decFloatAdd -- add two decFloats */ /* */ /* result gets the result of adding dfl and dfr: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* ------------------------------------------------------------------ */ #if QUAD // Table for testing MSDs for fastpath elimination; returns the MSD of // a decDouble or decQuad (top 6 bits tested) ignoring the sign. // Infinities return -32 and NaNs return -128 so that summing the two // MSDs also allows rapid tests for the Specials (see code below). const Int DECTESTMSD[64]={ 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 8, 9, -32, -128, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 8, 9, -32, -128}; #else // The table for testing MSDs is shared between the modules extern const Int DECTESTMSD[64]; #endif decFloat * decFloatAdd(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { bcdnum num; // for final conversion Int bexpl, bexpr; // left and right biased exponents uByte *ub, *us, *ut; // work uInt uiwork; // for macros #if QUAD uShort uswork; // .. #endif uInt sourhil, sourhir; // top words from source decFloats // [valid only through end of // fastpath code -- before swap] uInt diffsign; // non-zero if signs differ uInt carry; // carry: 0 or 1 before add loop Int overlap; // coefficient overlap (if full) Int summ; // sum of the MSDs // the following buffers hold coefficients with various alignments // (see commentary and diagrams below) uByte acc[4+2+DECPMAX*3+8]; uByte buf[4+2+DECPMAX*2]; uByte *umsd, *ulsd; // local MSD and LSD pointers #if DECLITEND #define CARRYPAT 0x01000000 // carry=1 pattern #else #define CARRYPAT 0x00000001 // carry=1 pattern #endif /* Start decoding the arguments */ // The initial exponents are placed into the opposite Ints to // that which might be expected; there are two sets of data to // keep track of (each decFloat and the corresponding exponent), // and this scheme means that at the swap point (after comparing // exponents) only one pair of words needs to be swapped // whichever path is taken (thereby minimising worst-case path). // The calculated exponents will be nonsense when the arguments are // Special, but are not used in that path sourhil=DFWORD(dfl, 0); // LHS top word summ=DECTESTMSD[sourhil>>26]; // get first MSD for testing bexpr=DECCOMBEXP[sourhil>>26]; // get exponent high bits (in place) bexpr+=GETECON(dfl); // .. + continuation sourhir=DFWORD(dfr, 0); // RHS top word summ+=DECTESTMSD[sourhir>>26]; // sum MSDs for testing bexpl=DECCOMBEXP[sourhir>>26]; bexpl+=GETECON(dfr); // here bexpr has biased exponent from lhs, and vice versa diffsign=(sourhil^sourhir)&DECFLOAT_Sign; // now determine whether to take a fast path or the full-function // slow path. The slow path must be taken when: // -- both numbers are finite, and: // the exponents are different, or // the signs are different, or // the sum of the MSDs is >8 (hence might overflow) // specialness and the sum of the MSDs can be tested at once using // the summ value just calculated, so the test for specials is no // longer on the worst-case path (as of 3.60) if (summ<=8) { // MSD+MSD is good, or there is a special if (summ<0) { // there is a special // Inf+Inf would give -64; Inf+finite is -32 or higher if (summ<-64) return decNaNs(result, dfl, dfr, set); // one or two NaNs // two infinities with different signs is invalid if (summ==-64 && diffsign) return decInvalid(result, set); if (DFISINF(dfl)) return decInfinity(result, dfl); // LHS is infinite return decInfinity(result, dfr); // RHS must be Inf } // Here when both arguments are finite; fast path is possible // (currently only for aligned and same-sign) if (bexpr==bexpl && !diffsign) { uInt tac[DECLETS+1]; // base-1000 coefficient uInt encode; // work // Get one coefficient as base-1000 and add the other GETCOEFFTHOU(dfl, tac); // least-significant goes to [0] ADDCOEFFTHOU(dfr, tac); // here the sum of the MSDs (plus any carry) will be <10 due to // the fastpath test earlier // construct the result; low word is the same for both formats encode =BIN2DPD[tac[0]]; encode|=BIN2DPD[tac[1]]<<10; encode|=BIN2DPD[tac[2]]<<20; encode|=BIN2DPD[tac[3]]<<30; DFWORD(result, (DECBYTES/4)-1)=encode; // collect next two declets (all that remains, for Double) encode =BIN2DPD[tac[3]]>>2; encode|=BIN2DPD[tac[4]]<<8; #if QUAD // complete and lay out middling words encode|=BIN2DPD[tac[5]]<<18; encode|=BIN2DPD[tac[6]]<<28; DFWORD(result, 2)=encode; encode =BIN2DPD[tac[6]]>>4; encode|=BIN2DPD[tac[7]]<<6; encode|=BIN2DPD[tac[8]]<<16; encode|=BIN2DPD[tac[9]]<<26; DFWORD(result, 1)=encode; // and final two declets encode =BIN2DPD[tac[9]]>>6; encode|=BIN2DPD[tac[10]]<<4; #endif // add exponent continuation and sign (from either argument) encode|=sourhil & (ECONMASK | DECFLOAT_Sign); // create lookup index = MSD + top two bits of biased exponent <<4 tac[DECLETS]|=(bexpl>>DECECONL)<<4; encode|=DECCOMBFROM[tac[DECLETS]]; // add constructed combination field DFWORD(result, 0)=encode; // complete // decFloatShow(result, ">"); return result; } // fast path OK // drop through to slow path } // low sum or Special(s) /* Slow path required -- arguments are finite and might overflow, */ /* or require alignment, or might have different signs */ // now swap either exponents or argument pointers if (bexpl<=bexpr) { // original left is bigger Int bexpswap=bexpl; bexpl=bexpr; bexpr=bexpswap; // printf("left bigger\n"); } else { const decFloat *dfswap=dfl; dfl=dfr; dfr=dfswap; // printf("right bigger\n"); } // [here dfl and bexpl refer to the datum with the larger exponent, // of if the exponents are equal then the original LHS argument] // if lhs is zero then result will be the rhs (now known to have // the smaller exponent), which also may need to be tested for zero // for the weird IEEE 754 sign rules if (DFISZERO(dfl)) { decCanonical(result, dfr); // clean copy // "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 '-'." if (diffsign && DFISZERO(result)) { DFWORD(result, 0)&=~DECFLOAT_Sign; // assume sign 0 if (set->round==DEC_ROUND_FLOOR) DFWORD(result, 0)|=DECFLOAT_Sign; } return result; } // numfl is zero // [here, LHS is non-zero; code below assumes that] // Coefficients layout during the calculations to follow: // // Overlap case: // +------------------------------------------------+ // acc: |0000| coeffa | tail B | | // +------------------------------------------------+ // buf: |0000| pad0s | coeffb | | // +------------------------------------------------+ // // Touching coefficients or gap: // +------------------------------------------------+ // acc: |0000| coeffa | gap | coeffb | // +------------------------------------------------+ // [buf not used or needed; gap clamped to Pmax] // lay out lhs coefficient into accumulator; this starts at acc+4 // for decDouble or acc+6 for decQuad so the LSD is word- // aligned; the top word gap is there only in case a carry digit // is prefixed after the add -- it does not need to be zeroed #if DOUBLE #define COFF 4 // offset into acc #elif QUAD UBFROMUS(acc+4, 0); // prefix 00 #define COFF 6 // offset into acc #endif GETCOEFF(dfl, acc+COFF); // decode from decFloat ulsd=acc+COFF+DECPMAX-1; umsd=acc+4; // [having this here avoids #if DECTRACE {bcdnum tum; tum.msd=umsd; tum.lsd=ulsd; tum.exponent=bexpl-DECBIAS; tum.sign=DFWORD(dfl, 0) & DECFLOAT_Sign; decShowNum(&tum, "dflx");} #endif // if signs differ, take ten's complement of lhs (here the // coefficient is subtracted from all-nines; the 1 is added during // the later add cycle -- zeros to the right do not matter because // the complement of zero is zero); these are fixed-length inverts // where the lsd is known to be at a 4-byte boundary (so no borrow // possible) carry=0; // assume no carry if (diffsign) { carry=CARRYPAT; // for +1 during add UBFROMUI(acc+ 4, 0x09090909-UBTOUI(acc+ 4)); UBFROMUI(acc+ 8, 0x09090909-UBTOUI(acc+ 8)); UBFROMUI(acc+12, 0x09090909-UBTOUI(acc+12)); UBFROMUI(acc+16, 0x09090909-UBTOUI(acc+16)); #if QUAD UBFROMUI(acc+20, 0x09090909-UBTOUI(acc+20)); UBFROMUI(acc+24, 0x09090909-UBTOUI(acc+24)); UBFROMUI(acc+28, 0x09090909-UBTOUI(acc+28)); UBFROMUI(acc+32, 0x09090909-UBTOUI(acc+32)); UBFROMUI(acc+36, 0x09090909-UBTOUI(acc+36)); #endif } // diffsign // now process the rhs coefficient; if it cannot overlap lhs then // it can be put straight into acc (with an appropriate gap, if // needed) because no actual addition will be needed (except // possibly to complete ten's complement) overlap=DECPMAX-(bexpl-bexpr); #if DECTRACE printf("exps: %ld %ld\n", (LI)(bexpl-DECBIAS), (LI)(bexpr-DECBIAS)); printf("Overlap=%ld carry=%08lx\n", (LI)overlap, (LI)carry); #endif if (overlap<=0) { // no overlap possible uInt gap; // local work // since a full addition is not needed, a ten's complement // calculation started above may need to be completed if (carry) { for (ub=ulsd; *ub==9; ub--) *ub=0; *ub+=1; carry=0; // taken care of } // up to DECPMAX-1 digits of the final result can extend down // below the LSD of the lhs, so if the gap is >DECPMAX then the // rhs will be simply sticky bits. In this case the gap is // clamped to DECPMAX and the exponent adjusted to suit [this is // safe because the lhs is non-zero]. gap=-overlap; if (gap>DECPMAX) { bexpr+=gap-1; gap=DECPMAX; } ub=ulsd+gap+1; // where MSD will go // Fill the gap with 0s; note that there is no addition to do ut=acc+COFF+DECPMAX; // start of gap for (; ut DECPMAX *ub=(uByte)(!DFISZERO(dfr)); // make sticky digit } else { // need full coefficient GETCOEFF(dfr, ub); // decode from decFloat ub+=DECPMAX-1; // new LSD... } ulsd=ub; // save new LSD } // no overlap possible else { // overlap>0 // coefficients overlap (perhaps completely, although also // perhaps only where zeros) if (overlap==DECPMAX) { // aligned ub=buf+COFF; // where msd will go #if QUAD UBFROMUS(buf+4, 0); // clear quad's 00 #endif GETCOEFF(dfr, ub); // decode from decFloat } else { // unaligned ub=buf+COFF+DECPMAX-overlap; // where MSD will go // Fill the prefix gap with 0s; 8 will cover most common // unalignments, so start with direct assignments (a loop is // then used for any remaining -- the loop (and the one in a // moment) is not then on the critical path because the number // of additions is reduced by (at least) two in this case) UBFROMUI(buf+4, 0); // [clears decQuad 00 too] UBFROMUI(buf+8, 0); if (ub>buf+12) { ut=buf+12; // start any remaining for (; ut=acc+4; ut-=4, us-=4) { // big-endian add loop // bcd8 add carry+=UBTOUI(us); // rhs + carry if (carry==0) continue; // no-op carry+=UBTOUI(ut); // lhs // Big-endian BCD adjust (uses internal carry) carry+=0x76f6f6f6; // note top nibble not all bits // apply BCD adjust and save UBFROMUI(ut, (carry & 0x0f0f0f0f) - ((carry & 0x60606060)>>4)); carry>>=31; // true carry was at far left } // add loop #else for (; ut>=acc+4; ut-=4, us-=4) { // little-endian add loop // bcd8 add carry+=UBTOUI(us); // rhs + carry if (carry==0) continue; // no-op [common if unaligned] carry+=UBTOUI(ut); // lhs // Little-endian BCD adjust; inter-digit carry must be manual // because the lsb from the array will be in the most-significant // byte of carry carry+=0x76767676; // note no inter-byte carries carry+=(carry & 0x80000000)>>15; carry+=(carry & 0x00800000)>>15; carry+=(carry & 0x00008000)>>15; carry-=(carry & 0x60606060)>>4; // BCD adjust back UBFROMUI(ut, carry & 0x0f0f0f0f); // clear debris and save // here, final carry-out bit is at 0x00000080; move it ready // for next word-add (i.e., to 0x01000000) carry=(carry & 0x00000080)<<17; } // add loop #endif #if DECTRACE {bcdnum tum; printf("Add done, carry=%08lx, diffsign=%ld\n", (LI)carry, (LI)diffsign); tum.msd=umsd; // acc+4; tum.lsd=ulsd; tum.exponent=0; tum.sign=0; decShowNum(&tum, "dfadd");} #endif } // overlap possible // ordering here is a little strange in order to have slowest path // first in GCC asm listing if (diffsign) { // subtraction if (!carry) { // no carry out means RHS=umsd+BNEXT) { // unaligned // eight will handle most unaligments for Double; 16 for Quad UBFROMUI(umsd+BNEXT, 0x09090909-UBTOUI(umsd+BNEXT)); UBFROMUI(umsd+BNEXT+4, 0x09090909-UBTOUI(umsd+BNEXT+4)); #if DOUBLE #define BNEXTY (BNEXT+8) #elif QUAD UBFROMUI(umsd+BNEXT+8, 0x09090909-UBTOUI(umsd+BNEXT+8)); UBFROMUI(umsd+BNEXT+12, 0x09090909-UBTOUI(umsd+BNEXT+12)); #define BNEXTY (BNEXT+16) #endif if (ulsd>=umsd+BNEXTY) { // very unaligned ut=umsd+BNEXTY; // -> continue for (;;ut+=4) { UBFROMUI(ut, 0x09090909-UBTOUI(ut)); // invert four digits if (ut>=ulsd-3) break; // all done } } } // complete the ten's complement by adding 1 for (ub=ulsd; *ub==9; ub--) *ub=0; *ub+=1; } // borrowed else { // carry out means RHS>=LHS num.sign=DFWORD(dfr, 0) & DECFLOAT_Sign; // all done except for the special IEEE 754 exact-zero-result // rule (see above); while testing for zero, strip leading // zeros (which will save decFinalize doing it) (this is in // diffsign path, so carry impossible and true umsd is // acc+COFF) // Check the initial coefficient area using the fast macro; // this will often be all that needs to be done (as on the // worst-case path when the subtraction was aligned and // full-length) if (ISCOEFFZERO(acc+COFF)) { umsd=acc+COFF+DECPMAX-1; // so far, so zero if (ulsd>umsd) { // more to check umsd++; // to align after checked area for (; UBTOUI(umsd)==0 && umsd+3round==DEC_ROUND_FLOOR) num.sign=DECFLOAT_Sign; } } // [else was not zero, might still have leading zeros] } // subtraction gave positive result } // diffsign else { // same-sign addition num.sign=DFWORD(dfl, 0)&DECFLOAT_Sign; #if DOUBLE if (carry) { // only possible with decDouble *(acc+3)=1; // [Quad has leading 00] umsd=acc+3; } #endif } // same sign num.msd=umsd; // set MSD .. num.lsd=ulsd; // .. and LSD num.exponent=bexpr-DECBIAS; // set exponent to smaller, unbiassed #if DECTRACE decFloatShow(dfl, "dfl"); decFloatShow(dfr, "dfr"); decShowNum(&num, "postadd"); #endif return decFinalize(result, &num, set); // round, check, and lay out } // decFloatAdd /* ------------------------------------------------------------------ */ /* decFloatAnd -- logical digitwise AND of two decFloats */ /* */ /* result gets the result of ANDing dfl and dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result, which will be canonical with sign=0 */ /* */ /* The operands must be positive, finite with exponent q=0, and */ /* comprise just zeros and ones; if not, Invalid operation results. */ /* ------------------------------------------------------------------ */ decFloat * decFloatAnd(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { if (!DFISUINT01(dfl) || !DFISUINT01(dfr) || !DFISCC01(dfl) || !DFISCC01(dfr)) return decInvalid(result, set); // the operands are positive finite integers (q=0) with just 0s and 1s #if DOUBLE DFWORD(result, 0)=ZEROWORD |((DFWORD(dfl, 0) & DFWORD(dfr, 0))&0x04009124); DFWORD(result, 1)=(DFWORD(dfl, 1) & DFWORD(dfr, 1))&0x49124491; #elif QUAD DFWORD(result, 0)=ZEROWORD |((DFWORD(dfl, 0) & DFWORD(dfr, 0))&0x04000912); DFWORD(result, 1)=(DFWORD(dfl, 1) & DFWORD(dfr, 1))&0x44912449; DFWORD(result, 2)=(DFWORD(dfl, 2) & DFWORD(dfr, 2))&0x12449124; DFWORD(result, 3)=(DFWORD(dfl, 3) & DFWORD(dfr, 3))&0x49124491; #endif return result; } // decFloatAnd /* ------------------------------------------------------------------ */ /* decFloatCanonical -- copy a decFloat, making canonical */ /* */ /* result gets the canonicalized df */ /* df is the decFloat to copy and make canonical */ /* returns result */ /* */ /* This works on specials, too; no error or exception is possible. */ /* ------------------------------------------------------------------ */ decFloat * decFloatCanonical(decFloat *result, const decFloat *df) { return decCanonical(result, df); } // decFloatCanonical /* ------------------------------------------------------------------ */ /* decFloatClass -- return the class of a decFloat */ /* */ /* df is the decFloat to test */ /* returns the decClass that df falls into */ /* ------------------------------------------------------------------ */ enum decClass decFloatClass(const decFloat *df) { Int exp; // exponent if (DFISSPECIAL(df)) { if (DFISQNAN(df)) return DEC_CLASS_QNAN; if (DFISSNAN(df)) return DEC_CLASS_SNAN; // must be an infinity if (DFISSIGNED(df)) return DEC_CLASS_NEG_INF; return DEC_CLASS_POS_INF; } if (DFISZERO(df)) { // quite common if (DFISSIGNED(df)) return DEC_CLASS_NEG_ZERO; return DEC_CLASS_POS_ZERO; } // is finite and non-zero; similar code to decFloatIsNormal, here // [this could be speeded up slightly by in-lining decFloatDigits] exp=GETEXPUN(df) // get unbiased exponent .. +decFloatDigits(df)-1; // .. and make adjusted exponent if (exp>=DECEMIN) { // is normal if (DFISSIGNED(df)) return DEC_CLASS_NEG_NORMAL; return DEC_CLASS_POS_NORMAL; } // is subnormal if (DFISSIGNED(df)) return DEC_CLASS_NEG_SUBNORMAL; return DEC_CLASS_POS_SUBNORMAL; } // decFloatClass /* ------------------------------------------------------------------ */ /* decFloatClassString -- return the class of a decFloat as a string */ /* */ /* df is the decFloat to test */ /* returns a constant string describing the class df falls into */ /* ------------------------------------------------------------------ */ const char *decFloatClassString(const decFloat *df) { enum decClass eclass=decFloatClass(df); 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 } // decFloatClassString /* ------------------------------------------------------------------ */ /* decFloatCompare -- compare two decFloats; quiet NaNs allowed */ /* */ /* result gets the result of comparing dfl and dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result, which may be -1, 0, 1, or NaN (Unordered) */ /* ------------------------------------------------------------------ */ decFloat * decFloatCompare(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int comp; // work // NaNs are handled as usual if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); // numeric comparison needed comp=decNumCompare(dfl, dfr, 0); decFloatZero(result); if (comp==0) return result; DFBYTE(result, DECBYTES-1)=0x01; // LSD=1 if (comp<0) DFBYTE(result, 0)|=0x80; // set sign bit return result; } // decFloatCompare /* ------------------------------------------------------------------ */ /* decFloatCompareSignal -- compare two decFloats; all NaNs signal */ /* */ /* result gets the result of comparing dfl and dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result, which may be -1, 0, 1, or NaN (Unordered) */ /* ------------------------------------------------------------------ */ decFloat * decFloatCompareSignal(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int comp; // work // NaNs are handled as usual, except that all NaNs signal if (DFISNAN(dfl) || DFISNAN(dfr)) { set->status|=DEC_Invalid_operation; return decNaNs(result, dfl, dfr, set); } // numeric comparison needed comp=decNumCompare(dfl, dfr, 0); decFloatZero(result); if (comp==0) return result; DFBYTE(result, DECBYTES-1)=0x01; // LSD=1 if (comp<0) DFBYTE(result, 0)|=0x80; // set sign bit return result; } // decFloatCompareSignal /* ------------------------------------------------------------------ */ /* decFloatCompareTotal -- compare two decFloats with total ordering */ /* */ /* result gets the result of comparing dfl and dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* returns result, which may be -1, 0, or 1 */ /* ------------------------------------------------------------------ */ decFloat * decFloatCompareTotal(decFloat *result, const decFloat *dfl, const decFloat *dfr) { Int comp; // work uInt uiwork; // for macros #if QUAD uShort uswork; // .. #endif if (DFISNAN(dfl) || DFISNAN(dfr)) { Int nanl, nanr; // work // morph NaNs to +/- 1 or 2, leave numbers as 0 nanl=DFISSNAN(dfl)+DFISQNAN(dfl)*2; // quiet > signalling if (DFISSIGNED(dfl)) nanl=-nanl; nanr=DFISSNAN(dfr)+DFISQNAN(dfr)*2; if (DFISSIGNED(dfr)) nanr=-nanr; if (nanl>nanr) comp=+1; else if (nanl*uc) comp=sigl; // difference found else comp=-sigl; // .. break; } } } // same NaN type and sign } else { // numeric comparison needed comp=decNumCompare(dfl, dfr, 1); // total ordering } decFloatZero(result); if (comp==0) return result; DFBYTE(result, DECBYTES-1)=0x01; // LSD=1 if (comp<0) DFBYTE(result, 0)|=0x80; // set sign bit return result; } // decFloatCompareTotal /* ------------------------------------------------------------------ */ /* decFloatCompareTotalMag -- compare magnitudes with total ordering */ /* */ /* result gets the result of comparing abs(dfl) and abs(dfr) */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* returns result, which may be -1, 0, or 1 */ /* ------------------------------------------------------------------ */ decFloat * decFloatCompareTotalMag(decFloat *result, const decFloat *dfl, const decFloat *dfr) { decFloat a, b; // for copy if needed // copy and redirect signed operand(s) if (DFISSIGNED(dfl)) { decFloatCopyAbs(&a, dfl); dfl=&a; } if (DFISSIGNED(dfr)) { decFloatCopyAbs(&b, dfr); dfr=&b; } return decFloatCompareTotal(result, dfl, dfr); } // decFloatCompareTotalMag /* ------------------------------------------------------------------ */ /* decFloatCopy -- copy a decFloat as-is */ /* */ /* result gets the copy of dfl */ /* dfl is the decFloat to copy */ /* returns result */ /* */ /* This is a bitwise operation; no errors or exceptions are possible. */ /* ------------------------------------------------------------------ */ decFloat * decFloatCopy(decFloat *result, const decFloat *dfl) { if (dfl!=result) *result=*dfl; // copy needed return result; } // decFloatCopy /* ------------------------------------------------------------------ */ /* decFloatCopyAbs -- copy a decFloat as-is and set sign bit to 0 */ /* */ /* result gets the copy of dfl with sign bit 0 */ /* dfl is the decFloat to copy */ /* returns result */ /* */ /* This is a bitwise operation; no errors or exceptions are possible. */ /* ------------------------------------------------------------------ */ decFloat * decFloatCopyAbs(decFloat *result, const decFloat *dfl) { if (dfl!=result) *result=*dfl; // copy needed DFBYTE(result, 0)&=~0x80; // zero sign bit return result; } // decFloatCopyAbs /* ------------------------------------------------------------------ */ /* decFloatCopyNegate -- copy a decFloat as-is with inverted sign bit */ /* */ /* result gets the copy of dfl with sign bit inverted */ /* dfl is the decFloat to copy */ /* returns result */ /* */ /* This is a bitwise operation; no errors or exceptions are possible. */ /* ------------------------------------------------------------------ */ decFloat * decFloatCopyNegate(decFloat *result, const decFloat *dfl) { if (dfl!=result) *result=*dfl; // copy needed DFBYTE(result, 0)^=0x80; // invert sign bit return result; } // decFloatCopyNegate /* ------------------------------------------------------------------ */ /* decFloatCopySign -- copy a decFloat with the sign of another */ /* */ /* result gets the result of copying dfl with the sign of dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* returns result */ /* */ /* This is a bitwise operation; no errors or exceptions are possible. */ /* ------------------------------------------------------------------ */ decFloat * decFloatCopySign(decFloat *result, const decFloat *dfl, const decFloat *dfr) { uByte sign=(uByte)(DFBYTE(dfr, 0)&0x80); // save sign bit if (dfl!=result) *result=*dfl; // copy needed DFBYTE(result, 0)&=~0x80; // clear sign .. DFBYTE(result, 0)=(uByte)(DFBYTE(result, 0)|sign); // .. and set saved return result; } // decFloatCopySign /* ------------------------------------------------------------------ */ /* decFloatDigits -- return the number of digits in a decFloat */ /* */ /* df is the decFloat to investigate */ /* returns the number of significant digits in the decFloat; a */ /* zero coefficient returns 1 as does an infinity (a NaN returns */ /* the number of digits in the payload) */ /* ------------------------------------------------------------------ */ // private macro to extract a declet according to provided formula // (form), and if it is non-zero then return the calculated digits // depending on the declet number (n), where n=0 for the most // significant declet; uses uInt dpd for work #define dpdlenchk(n, form) dpd=(form)&0x3ff; \ if (dpd) return (DECPMAX-1-3*(n))-(3-DPD2BCD8[dpd*4+3]) // next one is used when it is known that the declet must be // non-zero, or is the final zero declet #define dpdlendun(n, form) dpd=(form)&0x3ff; \ if (dpd==0) return 1; \ return (DECPMAX-1-3*(n))-(3-DPD2BCD8[dpd*4+3]) uInt decFloatDigits(const decFloat *df) { uInt dpd; // work uInt sourhi=DFWORD(df, 0); // top word from source decFloat #if QUAD uInt sourmh, sourml; #endif uInt sourlo; if (DFISINF(df)) return 1; // A NaN effectively has an MSD of 0; otherwise if non-zero MSD // then the coefficient is full-length if (!DFISNAN(df) && DECCOMBMSD[sourhi>>26]) return DECPMAX; #if DOUBLE if (sourhi&0x0003ffff) { // ends in first dpdlenchk(0, sourhi>>8); sourlo=DFWORD(df, 1); dpdlendun(1, (sourhi<<2) | (sourlo>>30)); } // [cannot drop through] sourlo=DFWORD(df, 1); // sourhi not involved now if (sourlo&0xfff00000) { // in one of first two dpdlenchk(1, sourlo>>30); // very rare dpdlendun(2, sourlo>>20); } // [cannot drop through] dpdlenchk(3, sourlo>>10); dpdlendun(4, sourlo); // [cannot drop through] #elif QUAD if (sourhi&0x00003fff) { // ends in first dpdlenchk(0, sourhi>>4); sourmh=DFWORD(df, 1); dpdlendun(1, ((sourhi)<<6) | (sourmh>>26)); } // [cannot drop through] sourmh=DFWORD(df, 1); if (sourmh) { dpdlenchk(1, sourmh>>26); dpdlenchk(2, sourmh>>16); dpdlenchk(3, sourmh>>6); sourml=DFWORD(df, 2); dpdlendun(4, ((sourmh)<<4) | (sourml>>28)); } // [cannot drop through] sourml=DFWORD(df, 2); if (sourml) { dpdlenchk(4, sourml>>28); dpdlenchk(5, sourml>>18); dpdlenchk(6, sourml>>8); sourlo=DFWORD(df, 3); dpdlendun(7, ((sourml)<<2) | (sourlo>>30)); } // [cannot drop through] sourlo=DFWORD(df, 3); if (sourlo&0xfff00000) { // in one of first two dpdlenchk(7, sourlo>>30); // very rare dpdlendun(8, sourlo>>20); } // [cannot drop through] dpdlenchk(9, sourlo>>10); dpdlendun(10, sourlo); // [cannot drop through] #endif } // decFloatDigits /* ------------------------------------------------------------------ */ /* decFloatDivide -- divide a decFloat by another */ /* */ /* result gets the result of dividing dfl by dfr: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* ------------------------------------------------------------------ */ // This is just a wrapper. decFloat * decFloatDivide(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { return decDivide(result, dfl, dfr, set, DIVIDE); } // decFloatDivide /* ------------------------------------------------------------------ */ /* decFloatDivideInteger -- integer divide a decFloat by another */ /* */ /* result gets the result of dividing dfl by dfr: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* ------------------------------------------------------------------ */ decFloat * decFloatDivideInteger(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { return decDivide(result, dfl, dfr, set, DIVIDEINT); } // decFloatDivideInteger /* ------------------------------------------------------------------ */ /* decFloatFMA -- multiply and add three decFloats, fused */ /* */ /* result gets the result of (dfl*dfr)+dff with a single rounding */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* dff is the final decFloat (fhs) */ /* set is the context */ /* returns result */ /* */ /* ------------------------------------------------------------------ */ decFloat * decFloatFMA(decFloat *result, const decFloat *dfl, const decFloat *dfr, const decFloat *dff, decContext *set) { // The accumulator has the bytes needed for FiniteMultiply, plus // one byte to the left in case of carry, plus DECPMAX+2 to the // right for the final addition (up to full fhs + round & sticky) #define FMALEN (ROUNDUP4(1+ (DECPMAX9*18+1) +DECPMAX+2)) uByte acc[FMALEN]; // for multiplied coefficient in BCD // .. and for final result bcdnum mul; // for multiplication result bcdnum fin; // for final operand, expanded uByte coe[ROUNDUP4(DECPMAX)]; // dff coefficient in BCD bcdnum *hi, *lo; // bcdnum with higher/lower exponent uInt diffsign; // non-zero if signs differ uInt hipad; // pad digit for hi if needed Int padding; // excess exponent uInt carry; // +1 for ten's complement and during add uByte *ub, *uh, *ul; // work uInt uiwork; // for macros // handle all the special values [any special operand leads to a // special result] if (DFISSPECIAL(dfl) || DFISSPECIAL(dfr) || DFISSPECIAL(dff)) { decFloat proxy; // multiplication result proxy // NaNs are handled as usual, giving priority to sNaNs if (DFISSNAN(dfl) || DFISSNAN(dfr)) return decNaNs(result, dfl, dfr, set); if (DFISSNAN(dff)) return decNaNs(result, dff, NULL, set); if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); if (DFISNAN(dff)) return decNaNs(result, dff, NULL, set); // One or more of the three is infinite // infinity times zero is bad decFloatZero(&proxy); if (DFISINF(dfl)) { if (DFISZERO(dfr)) return decInvalid(result, set); decInfinity(&proxy, &proxy); } else if (DFISINF(dfr)) { if (DFISZERO(dfl)) return decInvalid(result, set); decInfinity(&proxy, &proxy); } // compute sign of multiplication and place in proxy DFWORD(&proxy, 0)|=(DFWORD(dfl, 0)^DFWORD(dfr, 0))&DECFLOAT_Sign; if (!DFISINF(dff)) return decFloatCopy(result, &proxy); // dff is Infinite if (!DFISINF(&proxy)) return decInfinity(result, dff); // both sides of addition are infinite; different sign is bad if ((DFWORD(dff, 0)&DECFLOAT_Sign)!=(DFWORD(&proxy, 0)&DECFLOAT_Sign)) return decInvalid(result, set); return decFloatCopy(result, &proxy); } /* Here when all operands are finite */ // First multiply dfl*dfr decFiniteMultiply(&mul, acc+1, dfl, dfr); // The multiply is complete, exact and unbounded, and described in // mul with the coefficient held in acc[1...] // now add in dff; the algorithm is essentially the same as // decFloatAdd, but the code is different because the code there // is highly optimized for adding two numbers of the same size fin.exponent=GETEXPUN(dff); // get dff exponent and sign fin.sign=DFWORD(dff, 0)&DECFLOAT_Sign; diffsign=mul.sign^fin.sign; // note if signs differ fin.msd=coe; fin.lsd=coe+DECPMAX-1; GETCOEFF(dff, coe); // extract the coefficient // now set hi and lo so that hi points to whichever of mul and fin // has the higher exponent and lo points to the other [don't care, // if the same]. One coefficient will be in acc, the other in coe. if (mul.exponent>=fin.exponent) { hi=&mul; lo=&fin; } else { hi=&fin; lo=&mul; } // remove leading zeros on both operands; this will save time later // and make testing for zero trivial (tests are safe because acc // and coe are rounded up to uInts) for (; UBTOUI(hi->msd)==0 && hi->msd+3lsd;) hi->msd+=4; for (; *hi->msd==0 && hi->msdlsd;) hi->msd++; for (; UBTOUI(lo->msd)==0 && lo->msd+3lsd;) lo->msd+=4; for (; *lo->msd==0 && lo->msdlsd;) lo->msd++; // if hi is zero then result will be lo (which has the smaller // exponent), which also may need to be tested for zero for the // weird IEEE 754 sign rules if (*hi->msd==0) { // hi is zero // "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 '-'." if (diffsign) { if (*lo->msd==0) { // lo is zero lo->sign=0; if (set->round==DEC_ROUND_FLOOR) lo->sign=DECFLOAT_Sign; } // diffsign && lo=0 } // diffsign return decFinalize(result, lo, set); // may need clamping } // numfl is zero // [here, both are minimal length and hi is non-zero] // (if lo is zero then padding with zeros may be needed, below) // if signs differ, take the ten's complement of hi (zeros to the // right do not matter because the complement of zero is zero); the // +1 is done later, as part of the addition, inserted at the // correct digit hipad=0; carry=0; if (diffsign) { hipad=9; carry=1; // exactly the correct number of digits must be inverted for (uh=hi->msd; uhlsd-3; uh+=4) UBFROMUI(uh, 0x09090909-UBTOUI(uh)); for (; uh<=hi->lsd; uh++) *uh=(uByte)(0x09-*uh); } // ready to add; note that hi has no leading zeros so gap // calculation does not have to be as pessimistic as in decFloatAdd // (this is much more like the arbitrary-precision algorithm in // Rexx and decNumber) // padding is the number of zeros that would need to be added to hi // for its lsd to be aligned with the lsd of lo padding=hi->exponent-lo->exponent; // printf("FMA pad %ld\n", (LI)padding); // the result of the addition will be built into the accumulator, // starting from the far right; this could be either hi or lo, and // will be aligned ub=acc+FMALEN-1; // where lsd of result will go ul=lo->lsd; // lsd of rhs if (padding!=0) { // unaligned // if the msd of lo is more than DECPMAX+2 digits to the right of // the original msd of hi then it can be reduced to a single // digit at the right place, as it stays clear of hi digits // [it must be DECPMAX+2 because during a subtraction the msd // could become 0 after a borrow from 1.000 to 0.9999...] Int hilen=(Int)(hi->lsd-hi->msd+1); // length of hi Int lolen=(Int)(lo->lsd-lo->msd+1); // and of lo if (hilen+padding-lolen > DECPMAX+2) { // can reduce lo to single // make sure it is virtually at least DECPMAX from hi->msd, at // least to right of hi->lsd (in case of destructive subtract), // and separated by at least two digits from either of those // (the tricky DOUBLE case is when hi is a 1 that will become a // 0.9999... by subtraction: // hi: 1 E+16 // lo: .................1000000000000000 E-16 // which for the addition pads to: // hi: 1000000000000000000 E-16 // lo: .................1000000000000000 E-16 Int newexp=MINI(hi->exponent, hi->exponent+hilen-DECPMAX)-3; // printf("FMA reduce: %ld\n", (LI)reduce); lo->lsd=lo->msd; // to single digit [maybe 0] lo->exponent=newexp; // new lowest exponent padding=hi->exponent-lo->exponent; // recalculate ul=lo->lsd; // .. and repoint } // padding is still > 0, but will fit in acc (less leading carry slot) #if DECCHECK if (padding<=0) printf("FMA low padding: %ld\n", (LI)padding); if (hilen+padding+1>FMALEN) printf("FMA excess hilen+padding: %ld+%ld \n", (LI)hilen, (LI)padding); // printf("FMA padding: %ld\n", (LI)padding); #endif // padding digits can now be set in the result; one or more of // these will come from lo; others will be zeros in the gap for (; ul-3>=lo->msd && padding>3; padding-=4, ul-=4, ub-=4) { UBFROMUI(ub-3, UBTOUI(ul-3)); // [cannot overlap] } for (; ul>=lo->msd && padding>0; padding--, ul--, ub--) *ub=*ul; for (;padding>0; padding--, ub--) *ub=0; // mind the gap } // addition now complete to the right of the rightmost digit of hi uh=hi->lsd; // dow do the add from hi->lsd to the left // [bytewise, because either operand can run out at any time] // carry was set up depending on ten's complement above // first assume both operands have some digits for (;; ub--) { if (uhmsd || ulmsd) break; *ub=(uByte)(carry+(*uh--)+(*ul--)); carry=0; if (*ub<10) continue; *ub-=10; carry=1; } // both loop if (ulmsd) { // to left of lo for (;; ub--) { if (uhmsd) break; *ub=(uByte)(carry+(*uh--)); // [+0] carry=0; if (*ub<10) continue; *ub-=10; carry=1; } // hi loop } else { // to left of hi for (;; ub--) { if (ulmsd) break; *ub=(uByte)(carry+hipad+(*ul--)); carry=0; if (*ub<10) continue; *ub-=10; carry=1; } // lo loop } // addition complete -- now handle carry, borrow, etc. // use lo to set up the num (its exponent is already correct, and // sign usually is) lo->msd=ub+1; lo->lsd=acc+FMALEN-1; // decShowNum(lo, "lo"); if (!diffsign) { // same-sign addition if (carry) { // carry out *ub=1; // place the 1 .. lo->msd--; // .. and update } } // same sign else { // signs differed (subtraction) if (!carry) { // no carry out means hisign=hi->sign; // sign is lhs sign for (ul=lo->msd; ullsd-3; ul+=4) UBFROMUI(ul, 0x09090909-UBTOUI(ul)); for (; ul<=lo->lsd; ul++) *ul=(uByte)(0x09-*ul); // [leaves ul at lsd+1] // complete the ten's complement by adding 1 [cannot overrun] for (ul--; *ul==9; ul--) *ul=0; *ul+=1; } // borrowed else { // carry out means hi>=lo // sign to use is lo->sign // all done except for the special IEEE 754 exact-zero-result // rule (see above); while testing for zero, strip leading // zeros (which will save decFinalize doing it) for (; UBTOUI(lo->msd)==0 && lo->msd+3lsd;) lo->msd+=4; for (; *lo->msd==0 && lo->msdlsd;) lo->msd++; if (*lo->msd==0) { // must be true zero (and diffsign) lo->sign=0; // assume + if (set->round==DEC_ROUND_FLOOR) lo->sign=DECFLOAT_Sign; } // [else was not zero, might still have leading zeros] } // subtraction gave positive result } // diffsign #if DECCHECK // assert no left underrun if (lo->msdmsd)); } #endif return decFinalize(result, lo, set); // round, check, and lay out } // decFloatFMA /* ------------------------------------------------------------------ */ /* decFloatFromInt -- initialise a decFloat from an Int */ /* */ /* result gets the converted Int */ /* n is the Int to convert */ /* returns result */ /* */ /* The result is Exact; no errors or exceptions are possible. */ /* ------------------------------------------------------------------ */ decFloat * decFloatFromInt32(decFloat *result, Int n) { uInt u=(uInt)n; // copy as bits uInt encode; // work DFWORD(result, 0)=ZEROWORD; // always #if QUAD DFWORD(result, 1)=0; DFWORD(result, 2)=0; #endif if (n<0) { // handle -n with care // [This can be done without the test, but is then slightly slower] u=(~u)+1; DFWORD(result, 0)|=DECFLOAT_Sign; } // Since the maximum value of u now is 2**31, only the low word of // result is affected encode=BIN2DPD[u%1000]; u/=1000; encode|=BIN2DPD[u%1000]<<10; u/=1000; encode|=BIN2DPD[u%1000]<<20; u/=1000; // now 0, 1, or 2 encode|=u<<30; DFWORD(result, DECWORDS-1)=encode; return result; } // decFloatFromInt32 /* ------------------------------------------------------------------ */ /* decFloatFromUInt -- initialise a decFloat from a uInt */ /* */ /* result gets the converted uInt */ /* n is the uInt to convert */ /* returns result */ /* */ /* The result is Exact; no errors or exceptions are possible. */ /* ------------------------------------------------------------------ */ decFloat * decFloatFromUInt32(decFloat *result, uInt u) { uInt encode; // work DFWORD(result, 0)=ZEROWORD; // always #if QUAD DFWORD(result, 1)=0; DFWORD(result, 2)=0; #endif encode=BIN2DPD[u%1000]; u/=1000; encode|=BIN2DPD[u%1000]<<10; u/=1000; encode|=BIN2DPD[u%1000]<<20; u/=1000; // now 0 -> 4 encode|=u<<30; DFWORD(result, DECWORDS-1)=encode; DFWORD(result, DECWORDS-2)|=u>>2; // rarely non-zero return result; } // decFloatFromUInt32 /* ------------------------------------------------------------------ */ /* decFloatInvert -- logical digitwise INVERT of a decFloat */ /* */ /* result gets the result of INVERTing df */ /* df is the decFloat to invert */ /* set is the context */ /* returns result, which will be canonical with sign=0 */ /* */ /* The operand must be positive, finite with exponent q=0, and */ /* comprise just zeros and ones; if not, Invalid operation results. */ /* ------------------------------------------------------------------ */ decFloat * decFloatInvert(decFloat *result, const decFloat *df, decContext *set) { uInt sourhi=DFWORD(df, 0); // top word of dfs if (!DFISUINT01(df) || !DFISCC01(df)) return decInvalid(result, set); // the operand is a finite integer (q=0) #if DOUBLE DFWORD(result, 0)=ZEROWORD|((~sourhi)&0x04009124); DFWORD(result, 1)=(~DFWORD(df, 1)) &0x49124491; #elif QUAD DFWORD(result, 0)=ZEROWORD|((~sourhi)&0x04000912); DFWORD(result, 1)=(~DFWORD(df, 1)) &0x44912449; DFWORD(result, 2)=(~DFWORD(df, 2)) &0x12449124; DFWORD(result, 3)=(~DFWORD(df, 3)) &0x49124491; #endif return result; } // decFloatInvert /* ------------------------------------------------------------------ */ /* decFloatIs -- decFloat tests (IsSigned, etc.) */ /* */ /* df is the decFloat to test */ /* returns 0 or 1 in a uInt */ /* */ /* Many of these could be macros, but having them as real functions */ /* is a little cleaner (and they can be referred to here by the */ /* generic names) */ /* ------------------------------------------------------------------ */ uInt decFloatIsCanonical(const decFloat *df) { if (DFISSPECIAL(df)) { if (DFISINF(df)) { if (DFWORD(df, 0)&ECONMASK) return 0; // exponent continuation if (!DFISCCZERO(df)) return 0; // coefficient continuation return 1; } // is a NaN if (DFWORD(df, 0)&ECONNANMASK) return 0; // exponent continuation if (DFISCCZERO(df)) return 1; // coefficient continuation // drop through to check payload } { // declare block #if DOUBLE uInt sourhi=DFWORD(df, 0); uInt sourlo=DFWORD(df, 1); if (CANONDPDOFF(sourhi, 8) && CANONDPDTWO(sourhi, sourlo, 30) && CANONDPDOFF(sourlo, 20) && CANONDPDOFF(sourlo, 10) && CANONDPDOFF(sourlo, 0)) return 1; #elif QUAD uInt sourhi=DFWORD(df, 0); uInt sourmh=DFWORD(df, 1); uInt sourml=DFWORD(df, 2); uInt sourlo=DFWORD(df, 3); if (CANONDPDOFF(sourhi, 4) && CANONDPDTWO(sourhi, sourmh, 26) && CANONDPDOFF(sourmh, 16) && CANONDPDOFF(sourmh, 6) && CANONDPDTWO(sourmh, sourml, 28) && CANONDPDOFF(sourml, 18) && CANONDPDOFF(sourml, 8) && CANONDPDTWO(sourml, sourlo, 30) && CANONDPDOFF(sourlo, 20) && CANONDPDOFF(sourlo, 10) && CANONDPDOFF(sourlo, 0)) return 1; #endif } // block return 0; // a declet is non-canonical } uInt decFloatIsFinite(const decFloat *df) { return !DFISSPECIAL(df); } uInt decFloatIsInfinite(const decFloat *df) { return DFISINF(df); } uInt decFloatIsInteger(const decFloat *df) { return DFISINT(df); } uInt decFloatIsLogical(const decFloat *df) { return DFISUINT01(df) & DFISCC01(df); } uInt decFloatIsNaN(const decFloat *df) { return DFISNAN(df); } uInt decFloatIsNegative(const decFloat *df) { return DFISSIGNED(df) && !DFISZERO(df) && !DFISNAN(df); } uInt decFloatIsNormal(const decFloat *df) { Int exp; // exponent if (DFISSPECIAL(df)) return 0; if (DFISZERO(df)) return 0; // is finite and non-zero exp=GETEXPUN(df) // get unbiased exponent .. +decFloatDigits(df)-1; // .. and make adjusted exponent return (exp>=DECEMIN); // < DECEMIN is subnormal } uInt decFloatIsPositive(const decFloat *df) { return !DFISSIGNED(df) && !DFISZERO(df) && !DFISNAN(df); } uInt decFloatIsSignaling(const decFloat *df) { return DFISSNAN(df); } uInt decFloatIsSignalling(const decFloat *df) { return DFISSNAN(df); } uInt decFloatIsSigned(const decFloat *df) { return DFISSIGNED(df); } uInt decFloatIsSubnormal(const decFloat *df) { if (DFISSPECIAL(df)) return 0; // is finite if (decFloatIsNormal(df)) return 0; // it is Use |A| */ /* A=0 -> -Infinity (Division by zero) */ /* A=Infinite -> +Infinity (Exact) */ /* A=1 exactly -> 0 (Exact) */ /* NaNs are propagated as usual */ /* ------------------------------------------------------------------ */ decFloat * decFloatLogB(decFloat *result, const decFloat *df, decContext *set) { Int ae; // adjusted exponent if (DFISNAN(df)) return decNaNs(result, df, NULL, set); if (DFISINF(df)) { DFWORD(result, 0)=0; // need +ve return decInfinity(result, result); // canonical +Infinity } if (DFISZERO(df)) { set->status|=DEC_Division_by_zero; // as per 754 DFWORD(result, 0)=DECFLOAT_Sign; // make negative return decInfinity(result, result); // canonical -Infinity } ae=GETEXPUN(df) // get unbiased exponent .. +decFloatDigits(df)-1; // .. and make adjusted exponent // ae has limited range (3 digits for DOUBLE and 4 for QUAD), so // it is worth using a special case of decFloatFromInt32 DFWORD(result, 0)=ZEROWORD; // always if (ae<0) { DFWORD(result, 0)|=DECFLOAT_Sign; // -0 so far ae=-ae; } #if DOUBLE DFWORD(result, 1)=BIN2DPD[ae]; // a single declet #elif QUAD DFWORD(result, 1)=0; DFWORD(result, 2)=0; DFWORD(result, 3)=(ae/1000)<<10; // is <10, so need no DPD encode DFWORD(result, 3)|=BIN2DPD[ae%1000]; #endif return result; } // decFloatLogB /* ------------------------------------------------------------------ */ /* decFloatMax -- return maxnum of two operands */ /* */ /* result gets the chosen decFloat */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* If just one operand is a quiet NaN it is ignored. */ /* ------------------------------------------------------------------ */ decFloat * decFloatMax(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int comp; if (DFISNAN(dfl)) { // sNaN or both NaNs leads to normal NaN processing if (DFISNAN(dfr) || DFISSNAN(dfl)) return decNaNs(result, dfl, dfr, set); return decCanonical(result, dfr); // RHS is numeric } if (DFISNAN(dfr)) { // sNaN leads to normal NaN processing (both NaN handled above) if (DFISSNAN(dfr)) return decNaNs(result, dfl, dfr, set); return decCanonical(result, dfl); // LHS is numeric } // Both operands are numeric; numeric comparison needed -- use // total order for a well-defined choice (and +0 > -0) comp=decNumCompare(dfl, dfr, 1); if (comp>=0) return decCanonical(result, dfl); return decCanonical(result, dfr); } // decFloatMax /* ------------------------------------------------------------------ */ /* decFloatMaxMag -- return maxnummag of two operands */ /* */ /* result gets the chosen decFloat */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* Returns according to the magnitude comparisons if both numeric and */ /* unequal, otherwise returns maxnum */ /* ------------------------------------------------------------------ */ decFloat * decFloatMaxMag(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int comp; decFloat absl, absr; if (DFISNAN(dfl) || DFISNAN(dfr)) return decFloatMax(result, dfl, dfr, set); decFloatCopyAbs(&absl, dfl); decFloatCopyAbs(&absr, dfr); comp=decNumCompare(&absl, &absr, 0); if (comp>0) return decCanonical(result, dfl); if (comp<0) return decCanonical(result, dfr); return decFloatMax(result, dfl, dfr, set); } // decFloatMaxMag /* ------------------------------------------------------------------ */ /* decFloatMin -- return minnum of two operands */ /* */ /* result gets the chosen decFloat */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* If just one operand is a quiet NaN it is ignored. */ /* ------------------------------------------------------------------ */ decFloat * decFloatMin(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int comp; if (DFISNAN(dfl)) { // sNaN or both NaNs leads to normal NaN processing if (DFISNAN(dfr) || DFISSNAN(dfl)) return decNaNs(result, dfl, dfr, set); return decCanonical(result, dfr); // RHS is numeric } if (DFISNAN(dfr)) { // sNaN leads to normal NaN processing (both NaN handled above) if (DFISSNAN(dfr)) return decNaNs(result, dfl, dfr, set); return decCanonical(result, dfl); // LHS is numeric } // Both operands are numeric; numeric comparison needed -- use // total order for a well-defined choice (and +0 > -0) comp=decNumCompare(dfl, dfr, 1); if (comp<=0) return decCanonical(result, dfl); return decCanonical(result, dfr); } // decFloatMin /* ------------------------------------------------------------------ */ /* decFloatMinMag -- return minnummag of two operands */ /* */ /* result gets the chosen decFloat */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* Returns according to the magnitude comparisons if both numeric and */ /* unequal, otherwise returns minnum */ /* ------------------------------------------------------------------ */ decFloat * decFloatMinMag(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int comp; decFloat absl, absr; if (DFISNAN(dfl) || DFISNAN(dfr)) return decFloatMin(result, dfl, dfr, set); decFloatCopyAbs(&absl, dfl); decFloatCopyAbs(&absr, dfr); comp=decNumCompare(&absl, &absr, 0); if (comp<0) return decCanonical(result, dfl); if (comp>0) return decCanonical(result, dfr); return decFloatMin(result, dfl, dfr, set); } // decFloatMinMag /* ------------------------------------------------------------------ */ /* decFloatMinus -- negate value, heeding NaNs, etc. */ /* */ /* result gets the canonicalized 0-df */ /* df is the decFloat to minus */ /* set is the context */ /* returns result */ /* */ /* This has the same effect as 0-df where the exponent of the zero is */ /* the same as that of df (if df is finite). */ /* The effect is also the same as decFloatCopyNegate except that NaNs */ /* are handled normally (the sign of a NaN is not affected, and an */ /* sNaN will signal), the result is canonical, and zero gets sign 0. */ /* ------------------------------------------------------------------ */ decFloat * decFloatMinus(decFloat *result, const decFloat *df, decContext *set) { if (DFISNAN(df)) return decNaNs(result, df, NULL, set); decCanonical(result, df); // copy and check if (DFISZERO(df)) DFBYTE(result, 0)&=~0x80; // turn off sign bit else DFBYTE(result, 0)^=0x80; // flip sign bit return result; } // decFloatMinus /* ------------------------------------------------------------------ */ /* decFloatMultiply -- multiply two decFloats */ /* */ /* result gets the result of multiplying dfl and dfr: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* ------------------------------------------------------------------ */ decFloat * decFloatMultiply(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { bcdnum num; // for final conversion uByte bcdacc[DECPMAX9*18+1]; // for coefficent in BCD if (DFISSPECIAL(dfl) || DFISSPECIAL(dfr)) { // either is special? // NaNs are handled as usual if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); // infinity times zero is bad if (DFISINF(dfl) && DFISZERO(dfr)) return decInvalid(result, set); if (DFISINF(dfr) && DFISZERO(dfl)) return decInvalid(result, set); // both infinite; return canonical infinity with computed sign DFWORD(result, 0)=DFWORD(dfl, 0)^DFWORD(dfr, 0); // compute sign return decInfinity(result, result); } /* Here when both operands are finite */ decFiniteMultiply(&num, bcdacc, dfl, dfr); return decFinalize(result, &num, set); // round, check, and lay out } // decFloatMultiply /* ------------------------------------------------------------------ */ /* decFloatNextMinus -- next towards -Infinity */ /* */ /* result gets the next lesser decFloat */ /* dfl is the decFloat to start with */ /* set is the context */ /* returns result */ /* */ /* This is 754 nextdown; Invalid is the only status possible (from */ /* an sNaN). */ /* ------------------------------------------------------------------ */ decFloat * decFloatNextMinus(decFloat *result, const decFloat *dfl, decContext *set) { decFloat delta; // tiny increment uInt savestat; // saves status enum rounding saveround; // .. and mode // +Infinity is the special case if (DFISINF(dfl) && !DFISSIGNED(dfl)) { DFSETNMAX(result); return result; // [no status to set] } // other cases are effected by sutracting a tiny delta -- this // should be done in a wider format as the delta is unrepresentable // here (but can be done with normal add if the sign of zero is // treated carefully, because no Inexactitude is interesting); // rounding to -Infinity then pushes the result to next below decFloatZero(&delta); // set up tiny delta DFWORD(&delta, DECWORDS-1)=1; // coefficient=1 DFWORD(&delta, 0)=DECFLOAT_Sign; // Sign=1 + biased exponent=0 // set up for the directional round saveround=set->round; // save mode set->round=DEC_ROUND_FLOOR; // .. round towards -Infinity savestat=set->status; // save status decFloatAdd(result, dfl, &delta, set); // Add rules mess up the sign when going from +Ntiny to 0 if (DFISZERO(result)) DFWORD(result, 0)^=DECFLOAT_Sign; // correct set->status&=DEC_Invalid_operation; // preserve only sNaN status set->status|=savestat; // restore pending flags set->round=saveround; // .. and mode return result; } // decFloatNextMinus /* ------------------------------------------------------------------ */ /* decFloatNextPlus -- next towards +Infinity */ /* */ /* result gets the next larger decFloat */ /* dfl is the decFloat to start with */ /* set is the context */ /* returns result */ /* */ /* This is 754 nextup; Invalid is the only status possible (from */ /* an sNaN). */ /* ------------------------------------------------------------------ */ decFloat * decFloatNextPlus(decFloat *result, const decFloat *dfl, decContext *set) { uInt savestat; // saves status enum rounding saveround; // .. and mode decFloat delta; // tiny increment // -Infinity is the special case if (DFISINF(dfl) && DFISSIGNED(dfl)) { DFSETNMAX(result); DFWORD(result, 0)|=DECFLOAT_Sign; // make negative return result; // [no status to set] } // other cases are effected by sutracting a tiny delta -- this // should be done in a wider format as the delta is unrepresentable // here (but can be done with normal add if the sign of zero is // treated carefully, because no Inexactitude is interesting); // rounding to +Infinity then pushes the result to next above decFloatZero(&delta); // set up tiny delta DFWORD(&delta, DECWORDS-1)=1; // coefficient=1 DFWORD(&delta, 0)=0; // Sign=0 + biased exponent=0 // set up for the directional round saveround=set->round; // save mode set->round=DEC_ROUND_CEILING; // .. round towards +Infinity savestat=set->status; // save status decFloatAdd(result, dfl, &delta, set); // Add rules mess up the sign when going from -Ntiny to -0 if (DFISZERO(result)) DFWORD(result, 0)^=DECFLOAT_Sign; // correct set->status&=DEC_Invalid_operation; // preserve only sNaN status set->status|=savestat; // restore pending flags set->round=saveround; // .. and mode return result; } // decFloatNextPlus /* ------------------------------------------------------------------ */ /* decFloatNextToward -- next towards a decFloat */ /* */ /* result gets the next decFloat */ /* dfl is the decFloat to start with */ /* dfr is the decFloat to move toward */ /* set is the context */ /* returns result */ /* */ /* This is 754-1985 nextafter, as modified during revision (dropped */ /* from 754-2008); status may be set unless the result is a normal */ /* number. */ /* ------------------------------------------------------------------ */ decFloat * decFloatNextToward(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { decFloat delta; // tiny increment or decrement decFloat pointone; // 1e-1 uInt savestat; // saves status enum rounding saveround; // .. and mode uInt deltatop; // top word for delta Int comp; // work if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); // Both are numeric, so Invalid no longer a possibility comp=decNumCompare(dfl, dfr, 0); if (comp==0) return decFloatCopySign(result, dfl, dfr); // equal // unequal; do NextPlus or NextMinus but with different status rules if (comp<0) { // lhsround; // save mode set->round=DEC_ROUND_CEILING; // .. round towards +Infinity deltatop=0; // positive delta } else { // lhs>rhs, do NextMinus, see above for commentary if (DFISINF(dfl) && !DFISSIGNED(dfl)) { // +Infinity special case DFSETNMAX(result); return result; } saveround=set->round; // save mode set->round=DEC_ROUND_FLOOR; // .. round towards -Infinity deltatop=DECFLOAT_Sign; // negative delta } savestat=set->status; // save status // Here, Inexact is needed where appropriate (and hence Underflow, // etc.). Therefore the tiny delta which is otherwise // unrepresentable (see NextPlus and NextMinus) is constructed // using the multiplication of FMA. decFloatZero(&delta); // set up tiny delta DFWORD(&delta, DECWORDS-1)=1; // coefficient=1 DFWORD(&delta, 0)=deltatop; // Sign + biased exponent=0 decFloatFromString(&pointone, "1E-1", set); // set up multiplier decFloatFMA(result, &delta, &pointone, dfl, set); // [Delta is truly tiny, so no need to correct sign of zero] // use new status unless the result is normal if (decFloatIsNormal(result)) set->status=savestat; // else goes forward set->round=saveround; // restore mode return result; } // decFloatNextToward /* ------------------------------------------------------------------ */ /* decFloatOr -- logical digitwise OR of two decFloats */ /* */ /* result gets the result of ORing dfl and dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result, which will be canonical with sign=0 */ /* */ /* The operands must be positive, finite with exponent q=0, and */ /* comprise just zeros and ones; if not, Invalid operation results. */ /* ------------------------------------------------------------------ */ decFloat * decFloatOr(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { if (!DFISUINT01(dfl) || !DFISUINT01(dfr) || !DFISCC01(dfl) || !DFISCC01(dfr)) return decInvalid(result, set); // the operands are positive finite integers (q=0) with just 0s and 1s #if DOUBLE DFWORD(result, 0)=ZEROWORD |((DFWORD(dfl, 0) | DFWORD(dfr, 0))&0x04009124); DFWORD(result, 1)=(DFWORD(dfl, 1) | DFWORD(dfr, 1))&0x49124491; #elif QUAD DFWORD(result, 0)=ZEROWORD |((DFWORD(dfl, 0) | DFWORD(dfr, 0))&0x04000912); DFWORD(result, 1)=(DFWORD(dfl, 1) | DFWORD(dfr, 1))&0x44912449; DFWORD(result, 2)=(DFWORD(dfl, 2) | DFWORD(dfr, 2))&0x12449124; DFWORD(result, 3)=(DFWORD(dfl, 3) | DFWORD(dfr, 3))&0x49124491; #endif return result; } // decFloatOr /* ------------------------------------------------------------------ */ /* decFloatPlus -- add value to 0, heeding NaNs, etc. */ /* */ /* result gets the canonicalized 0+df */ /* df is the decFloat to plus */ /* set is the context */ /* returns result */ /* */ /* This has the same effect as 0+df where the exponent of the zero is */ /* the same as that of df (if df is finite). */ /* The effect is also the same as decFloatCopy except that NaNs */ /* are handled normally (the sign of a NaN is not affected, and an */ /* sNaN will signal), the result is canonical, and zero gets sign 0. */ /* ------------------------------------------------------------------ */ decFloat * decFloatPlus(decFloat *result, const decFloat *df, decContext *set) { if (DFISNAN(df)) return decNaNs(result, df, NULL, set); decCanonical(result, df); // copy and check if (DFISZERO(df)) DFBYTE(result, 0)&=~0x80; // turn off sign bit return result; } // decFloatPlus /* ------------------------------------------------------------------ */ /* decFloatQuantize -- quantize a decFloat */ /* */ /* result gets the result of quantizing dfl to match dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs), which sets the exponent */ /* set is the context */ /* returns result */ /* */ /* Unless there is an error or the result is infinite, the exponent */ /* of result is guaranteed to be the same as that of dfr. */ /* ------------------------------------------------------------------ */ decFloat * decFloatQuantize(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int explb, exprb; // left and right biased exponents uByte *ulsd; // local LSD pointer uByte *ub, *uc; // work Int drop; // .. uInt dpd; // .. uInt encode; // encoding accumulator uInt sourhil, sourhir; // top words from source decFloats uInt uiwork; // for macros #if QUAD uShort uswork; // .. #endif // the following buffer holds the coefficient for manipulation uByte buf[4+DECPMAX*3+2*QUAD]; // + space for zeros to left or right #if DECTRACE bcdnum num; // for trace displays #endif /* Start decoding the arguments */ sourhil=DFWORD(dfl, 0); // LHS top word explb=DECCOMBEXP[sourhil>>26]; // get exponent high bits (in place) sourhir=DFWORD(dfr, 0); // RHS top word exprb=DECCOMBEXP[sourhir>>26]; if (EXPISSPECIAL(explb | exprb)) { // either is special? // NaNs are handled as usual if (DFISNAN(dfl) || DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); // one infinity but not both is bad if (DFISINF(dfl)!=DFISINF(dfr)) return decInvalid(result, set); // both infinite; return canonical infinity with sign of LHS return decInfinity(result, dfl); } /* Here when both arguments are finite */ // complete extraction of the exponents [no need to unbias] explb+=GETECON(dfl); // + continuation exprb+=GETECON(dfr); // .. // calculate the number of digits to drop from the coefficient drop=exprb-explb; // 0 if nothing to do if (drop==0) return decCanonical(result, dfl); // return canonical // the coefficient is needed; lay it out into buf, offset so zeros // can be added before or after as needed -- an extra heading is // added so can safely pad Quad DECPMAX-1 zeros to the left by // fours #define BUFOFF (buf+4+DECPMAX) GETCOEFF(dfl, BUFOFF); // decode from decFloat // [now the msd is at BUFOFF and the lsd is at BUFOFF+DECPMAX-1] #if DECTRACE num.msd=BUFOFF; num.lsd=BUFOFF+DECPMAX-1; num.exponent=explb-DECBIAS; num.sign=sourhil & DECFLOAT_Sign; decShowNum(&num, "dfl"); #endif if (drop>0) { // [most common case] // (this code is very similar to that in decFloatFinalize, but // has many differences so is duplicated here -- so any changes // may need to be made there, too) uByte *roundat; // -> re-round digit uByte reround; // reround value // printf("Rounding; drop=%ld\n", (LI)drop); // there is at least one zero needed to the left, in all but one // exceptional (all-nines) case, so place four zeros now; this is // needed almost always and makes rounding all-nines by fours safe UBFROMUI(BUFOFF-4, 0); // Three cases here: // 1. new LSD is in coefficient (almost always) // 2. new LSD is digit to left of coefficient (so MSD is // round-for-reround digit) // 3. new LSD is to left of case 2 (whole coefficient is sticky) // Note that leading zeros can safely be treated as useful digits // [duplicate check-stickies code to save a test] // [by-digit check for stickies as runs of zeros are rare] if (dropstatus|=DEC_Inexact; // next decide whether to increment the coefficient if (set->round==DEC_ROUND_HALF_EVEN) { // fastpath slowest case if (reround>5) bump=1; // >0.5 goes up else if (reround==5) // exactly 0.5000 .. bump=*ulsd & 0x01; // .. up iff [new] lsd is odd } // r-h-e else switch (set->round) { case DEC_ROUND_DOWN: { // no change break;} // r-d case DEC_ROUND_HALF_DOWN: { if (reround>5) bump=1; break;} // r-h-d case DEC_ROUND_HALF_UP: { if (reround>=5) bump=1; break;} // r-h-u case DEC_ROUND_UP: { if (reround>0) bump=1; break;} // r-u case DEC_ROUND_CEILING: { // same as _UP for positive numbers, and as _DOWN for negatives if (!(sourhil&DECFLOAT_Sign) && reround>0) bump=1; break;} // r-c case DEC_ROUND_FLOOR: { // same as _UP for negative numbers, and as _DOWN for positive // [negative reround cannot occur on 0] if (sourhil&DECFLOAT_Sign && reround>0) bump=1; break;} // r-f case DEC_ROUND_05UP: { if (reround>0) { // anything out there is 'sticky' // bump iff lsd=0 or 5; this cannot carry so it could be // effected immediately with no bump -- but the code // is clearer if this is done the same way as the others if (*ulsd==0 || *ulsd==5) bump=1; } break;} // r-r default: { // e.g., DEC_ROUND_MAX set->status|=DEC_Invalid_context; #if DECCHECK printf("Unknown rounding mode: %ld\n", (LI)set->round); #endif break;} } // switch (not r-h-e) // printf("ReRound: %ld bump: %ld\n", (LI)reround, (LI)bump); if (bump!=0) { // need increment // increment the coefficient; this could give 1000... (after // the all nines case) ub=ulsd; for (; UBTOUI(ub-3)==0x09090909; ub-=4) UBFROMUI(ub-3, 0); // now at most 3 digits left to non-9 (usually just the one) for (; *ub==9; ub--) *ub=0; *ub+=1; // [the all-nines case will have carried one digit to the // left of the original MSD -- just where it is needed] } // bump needed } // inexact rounding // now clear zeros to the left so exactly DECPMAX digits will be // available in the coefficent -- the first word to the left was // cleared earlier for safe carry; now add any more needed if (drop>4) { UBFROMUI(BUFOFF-8, 0); // must be at least 5 for (uc=BUFOFF-12; uc>ulsd-DECPMAX-3; uc-=4) UBFROMUI(uc, 0); } } // need round (drop>0) else { // drop<0; padding with -drop digits is needed // This is the case where an error can occur if the padded // coefficient will not fit; checking for this can be done in the // same loop as padding for zeros if the no-hope and zero cases // are checked first if (-drop>DECPMAX-1) { // cannot fit unless 0 if (!ISCOEFFZERO(BUFOFF)) return decInvalid(result, set); // a zero can have any exponent; just drop through and use it ulsd=BUFOFF+DECPMAX-1; } else { // padding will fit (but may still be too long) // final-word mask depends on endianess #if DECLITEND static const uInt dmask[]={0, 0x000000ff, 0x0000ffff, 0x00ffffff}; #else static const uInt dmask[]={0, 0xff000000, 0xffff0000, 0xffffff00}; #endif // note that here zeros to the right are added by fours, so in // the Quad case this could write 36 zeros if the coefficient has // fewer than three significant digits (hence the +2*QUAD for buf) for (uc=BUFOFF+DECPMAX;; uc+=4) { UBFROMUI(uc, 0); if (UBTOUI(uc-DECPMAX)!=0) { // could be bad // if all four digits should be zero, definitely bad if (uc<=BUFOFF+DECPMAX+(-drop)-4) return decInvalid(result, set); // must be a 1- to 3-digit sequence; check more carefully if ((UBTOUI(uc-DECPMAX)&dmask[(-drop)%4])!=0) return decInvalid(result, set); break; // no need for loop end test } if (uc>=BUFOFF+DECPMAX+(-drop)-4) break; // done } ulsd=BUFOFF+DECPMAX+(-drop)-1; } // pad and check leading zeros } // drop<0 #if DECTRACE num.msd=ulsd-DECPMAX+1; num.lsd=ulsd; num.exponent=explb-DECBIAS; num.sign=sourhil & DECFLOAT_Sign; decShowNum(&num, "res"); #endif /*------------------------------------------------------------------*/ /* At this point the result is DECPMAX digits, ending at ulsd, so */ /* fits the encoding exactly; there is no possibility of error */ /*------------------------------------------------------------------*/ encode=((exprb>>DECECONL)<<4) + *(ulsd-DECPMAX+1); // make index encode=DECCOMBFROM[encode]; // indexed by (0-2)*16+msd // the exponent continuation can be extracted from the original RHS encode|=sourhir & ECONMASK; encode|=sourhil&DECFLOAT_Sign; // add the sign from LHS // finally encode the coefficient // private macro to encode a declet; this version can be used // because all coefficient digits exist #define getDPD3q(dpd, n) ub=ulsd-(3*(n))-2; \ dpd=BCD2DPD[(*ub*256)+(*(ub+1)*16)+*(ub+2)]; #if DOUBLE getDPD3q(dpd, 4); encode|=dpd<<8; getDPD3q(dpd, 3); encode|=dpd>>2; DFWORD(result, 0)=encode; encode=dpd<<30; getDPD3q(dpd, 2); encode|=dpd<<20; getDPD3q(dpd, 1); encode|=dpd<<10; getDPD3q(dpd, 0); encode|=dpd; DFWORD(result, 1)=encode; #elif QUAD getDPD3q(dpd,10); encode|=dpd<<4; getDPD3q(dpd, 9); encode|=dpd>>6; DFWORD(result, 0)=encode; encode=dpd<<26; getDPD3q(dpd, 8); encode|=dpd<<16; getDPD3q(dpd, 7); encode|=dpd<<6; getDPD3q(dpd, 6); encode|=dpd>>4; DFWORD(result, 1)=encode; encode=dpd<<28; getDPD3q(dpd, 5); encode|=dpd<<18; getDPD3q(dpd, 4); encode|=dpd<<8; getDPD3q(dpd, 3); encode|=dpd>>2; DFWORD(result, 2)=encode; encode=dpd<<30; getDPD3q(dpd, 2); encode|=dpd<<20; getDPD3q(dpd, 1); encode|=dpd<<10; getDPD3q(dpd, 0); encode|=dpd; DFWORD(result, 3)=encode; #endif return result; } // decFloatQuantize /* ------------------------------------------------------------------ */ /* decFloatReduce -- reduce finite coefficient to minimum length */ /* */ /* result gets the reduced decFloat */ /* df is the source decFloat */ /* set is the context */ /* returns result, which will be canonical */ /* */ /* This removes all possible trailing zeros from the coefficient; */ /* some may remain when the number is very close to Nmax. */ /* Special values are unchanged and no status is set unless df=sNaN. */ /* Reduced zero has an exponent q=0. */ /* ------------------------------------------------------------------ */ decFloat * decFloatReduce(decFloat *result, const decFloat *df, decContext *set) { bcdnum num; // work uByte buf[DECPMAX], *ub; // coefficient and pointer if (df!=result) *result=*df; // copy, if needed if (DFISNAN(df)) return decNaNs(result, df, NULL, set); // sNaN // zeros and infinites propagate too if (DFISINF(df)) return decInfinity(result, df); // canonical if (DFISZERO(df)) { uInt sign=DFWORD(df, 0)&DECFLOAT_Sign; decFloatZero(result); DFWORD(result, 0)|=sign; return result; // exponent dropped, sign OK } // non-zero finite GETCOEFF(df, buf); ub=buf+DECPMAX-1; // -> lsd if (*ub) return result; // no trailing zeros for (ub--; *ub==0;) ub--; // terminates because non-zero // *ub is the first non-zero from the right num.sign=DFWORD(df, 0)&DECFLOAT_Sign; // set up number... num.exponent=GETEXPUN(df)+(Int)(buf+DECPMAX-1-ub); // adjusted exponent num.msd=buf; num.lsd=ub; return decFinalize(result, &num, set); } // decFloatReduce /* ------------------------------------------------------------------ */ /* decFloatRemainder -- integer divide and return remainder */ /* */ /* result gets the remainder of dividing dfl by dfr: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* ------------------------------------------------------------------ */ decFloat * decFloatRemainder(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { return decDivide(result, dfl, dfr, set, REMAINDER); } // decFloatRemainder /* ------------------------------------------------------------------ */ /* decFloatRemainderNear -- integer divide to nearest and remainder */ /* */ /* result gets the remainder of dividing dfl by dfr: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* This is the IEEE remainder, where the nearest integer is used. */ /* ------------------------------------------------------------------ */ decFloat * decFloatRemainderNear(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { return decDivide(result, dfl, dfr, set, REMNEAR); } // decFloatRemainderNear /* ------------------------------------------------------------------ */ /* decFloatRotate -- rotate the coefficient of a decFloat left/right */ /* */ /* result gets the result of rotating dfl */ /* dfl is the source decFloat to rotate */ /* dfr is the count of digits to rotate, an integer (with q=0) */ /* set is the context */ /* returns result */ /* */ /* The digits of the coefficient of dfl are rotated to the left (if */ /* dfr is positive) or to the right (if dfr is negative) without */ /* adjusting the exponent or the sign of dfl. */ /* */ /* dfr must be in the range -DECPMAX through +DECPMAX. */ /* NaNs are propagated as usual. An infinite dfl is unaffected (but */ /* dfr must be valid). No status is set unless dfr is invalid or an */ /* operand is an sNaN. The result is canonical. */ /* ------------------------------------------------------------------ */ #define PHALF (ROUNDUP(DECPMAX/2, 4)) // half length, rounded up decFloat * decFloatRotate(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int rotate; // dfr as an Int uByte buf[DECPMAX+PHALF]; // coefficient + half uInt digits, savestat; // work bcdnum num; // .. uByte *ub; // .. if (DFISNAN(dfl)||DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); if (!DFISINT(dfr)) return decInvalid(result, set); digits=decFloatDigits(dfr); // calculate digits if (digits>2) return decInvalid(result, set); // definitely out of range rotate=DPD2BIN[DFWORD(dfr, DECWORDS-1)&0x3ff]; // is in bottom declet if (rotate>DECPMAX) return decInvalid(result, set); // too big // [from here on no error or status change is possible] if (DFISINF(dfl)) return decInfinity(result, dfl); // canonical // handle no-rotate cases if (rotate==0 || rotate==DECPMAX) return decCanonical(result, dfl); // a real rotate is needed: 0 < rotate < DECPMAX // reduce the rotation to no more than half to reduce copying later // (for QUAD in fact half + 2 digits) if (DFISSIGNED(dfr)) rotate=-rotate; if (abs(rotate)>PHALF) { if (rotate<0) rotate=DECPMAX+rotate; else rotate=rotate-DECPMAX; } // now lay out the coefficient, leaving room to the right or the // left depending on the direction of rotation ub=buf; if (rotate<0) ub+=PHALF; // rotate right, so space to left GETCOEFF(dfl, ub); // copy half the digits to left or right, and set num.msd if (rotate<0) { memcpy(buf, buf+DECPMAX, PHALF); num.msd=buf+PHALF+rotate; } else { memcpy(buf+DECPMAX, buf, PHALF); num.msd=buf+rotate; } // fill in rest of num num.lsd=num.msd+DECPMAX-1; num.sign=DFWORD(dfl, 0)&DECFLOAT_Sign; num.exponent=GETEXPUN(dfl); savestat=set->status; // record decFinalize(result, &num, set); set->status=savestat; // restore return result; } // decFloatRotate /* ------------------------------------------------------------------ */ /* decFloatSameQuantum -- test decFloats for same quantum */ /* */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* returns 1 if the operands have the same quantum, 0 otherwise */ /* */ /* No error is possible and no status results. */ /* ------------------------------------------------------------------ */ uInt decFloatSameQuantum(const decFloat *dfl, const decFloat *dfr) { if (DFISSPECIAL(dfl) || DFISSPECIAL(dfr)) { if (DFISNAN(dfl) && DFISNAN(dfr)) return 1; if (DFISINF(dfl) && DFISINF(dfr)) return 1; return 0; // any other special mixture gives false } if (GETEXP(dfl)==GETEXP(dfr)) return 1; // biased exponents match return 0; } // decFloatSameQuantum /* ------------------------------------------------------------------ */ /* decFloatScaleB -- multiply by a power of 10, as per 754 */ /* */ /* result gets the result of the operation */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs), am integer (with q=0) */ /* set is the context */ /* returns result */ /* */ /* This computes result=dfl x 10**dfr where dfr is an integer in the */ /* range +/-2*(emax+pmax), typically resulting from LogB. */ /* Underflow and Overflow (with Inexact) may occur. NaNs propagate */ /* as usual. */ /* ------------------------------------------------------------------ */ #define SCALEBMAX 2*(DECEMAX+DECPMAX) // D=800, Q=12356 decFloat * decFloatScaleB(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { uInt digits; // work Int expr; // dfr as an Int if (DFISNAN(dfl)||DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); if (!DFISINT(dfr)) return decInvalid(result, set); digits=decFloatDigits(dfr); // calculate digits #if DOUBLE if (digits>3) return decInvalid(result, set); // definitely out of range expr=DPD2BIN[DFWORD(dfr, 1)&0x3ff]; // must be in bottom declet #elif QUAD if (digits>5) return decInvalid(result, set); // definitely out of range expr=DPD2BIN[DFWORD(dfr, 3)&0x3ff] // in bottom 2 declets .. +DPD2BIN[(DFWORD(dfr, 3)>>10)&0x3ff]*1000; // .. #endif if (expr>SCALEBMAX) return decInvalid(result, set); // oops // [from now on no error possible] if (DFISINF(dfl)) return decInfinity(result, dfl); // canonical if (DFISSIGNED(dfr)) expr=-expr; // dfl is finite and expr is valid *result=*dfl; // copy to target return decFloatSetExponent(result, set, GETEXPUN(result)+expr); } // decFloatScaleB /* ------------------------------------------------------------------ */ /* decFloatShift -- shift the coefficient of a decFloat left or right */ /* */ /* result gets the result of shifting dfl */ /* dfl is the source decFloat to shift */ /* dfr is the count of digits to shift, an integer (with q=0) */ /* set is the context */ /* returns result */ /* */ /* The digits of the coefficient of dfl are shifted to the left (if */ /* dfr is positive) or to the right (if dfr is negative) without */ /* adjusting the exponent or the sign of dfl. */ /* */ /* dfr must be in the range -DECPMAX through +DECPMAX. */ /* NaNs are propagated as usual. An infinite dfl is unaffected (but */ /* dfr must be valid). No status is set unless dfr is invalid or an */ /* operand is an sNaN. The result is canonical. */ /* ------------------------------------------------------------------ */ decFloat * decFloatShift(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { Int shift; // dfr as an Int uByte buf[DECPMAX*2]; // coefficient + padding uInt digits, savestat; // work bcdnum num; // .. uInt uiwork; // for macros if (DFISNAN(dfl)||DFISNAN(dfr)) return decNaNs(result, dfl, dfr, set); if (!DFISINT(dfr)) return decInvalid(result, set); digits=decFloatDigits(dfr); // calculate digits if (digits>2) return decInvalid(result, set); // definitely out of range shift=DPD2BIN[DFWORD(dfr, DECWORDS-1)&0x3ff]; // is in bottom declet if (shift>DECPMAX) return decInvalid(result, set); // too big // [from here on no error or status change is possible] if (DFISINF(dfl)) return decInfinity(result, dfl); // canonical // handle no-shift and all-shift (clear to zero) cases if (shift==0) return decCanonical(result, dfl); if (shift==DECPMAX) { // zero with sign uByte sign=(uByte)(DFBYTE(dfl, 0)&0x80); // save sign bit decFloatZero(result); // make +0 DFBYTE(result, 0)=(uByte)(DFBYTE(result, 0)|sign); // and set sign // [cannot safely use CopySign] return result; } // a real shift is needed: 0 < shift < DECPMAX num.sign=DFWORD(dfl, 0)&DECFLOAT_Sign; num.exponent=GETEXPUN(dfl); num.msd=buf; GETCOEFF(dfl, buf); if (DFISSIGNED(dfr)) { // shift right // edge cases are taken care of, so this is easy num.lsd=buf+DECPMAX-shift-1; } else { // shift left -- zero padding needed to right UBFROMUI(buf+DECPMAX, 0); // 8 will handle most cases UBFROMUI(buf+DECPMAX+4, 0); // .. if (shift>8) memset(buf+DECPMAX+8, 0, 8+QUAD*18); // all other cases num.msd+=shift; num.lsd=num.msd+DECPMAX-1; } savestat=set->status; // record decFinalize(result, &num, set); set->status=savestat; // restore return result; } // decFloatShift /* ------------------------------------------------------------------ */ /* decFloatSubtract -- subtract a decFloat from another */ /* */ /* result gets the result of subtracting dfr from dfl: */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result */ /* */ /* ------------------------------------------------------------------ */ decFloat * decFloatSubtract(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { decFloat temp; // NaNs must propagate without sign change if (DFISNAN(dfr)) return decFloatAdd(result, dfl, dfr, set); temp=*dfr; // make a copy DFBYTE(&temp, 0)^=0x80; // flip sign return decFloatAdd(result, dfl, &temp, set); // and add to the lhs } // decFloatSubtract /* ------------------------------------------------------------------ */ /* decFloatToInt -- round to 32-bit binary integer (4 flavours) */ /* */ /* df is the decFloat to round */ /* set is the context */ /* round is the rounding mode to use */ /* returns a uInt or an Int, rounded according to the name */ /* */ /* Invalid will always be signaled if df is a NaN, is Infinite, or is */ /* outside the range of the target; Inexact will not be signaled for */ /* simple rounding unless 'Exact' appears in the name. */ /* ------------------------------------------------------------------ */ uInt decFloatToUInt32(const decFloat *df, decContext *set, enum rounding round) { return decToInt32(df, set, round, 0, 1);} uInt decFloatToUInt32Exact(const decFloat *df, decContext *set, enum rounding round) { return decToInt32(df, set, round, 1, 1);} Int decFloatToInt32(const decFloat *df, decContext *set, enum rounding round) { return (Int)decToInt32(df, set, round, 0, 0);} Int decFloatToInt32Exact(const decFloat *df, decContext *set, enum rounding round) { return (Int)decToInt32(df, set, round, 1, 0);} /* ------------------------------------------------------------------ */ /* decFloatToIntegral -- round to integral value (two flavours) */ /* */ /* result gets the result */ /* df is the decFloat to round */ /* set is the context */ /* round is the rounding mode to use */ /* returns result */ /* */ /* No exceptions, even Inexact, are raised except for sNaN input, or */ /* if 'Exact' appears in the name. */ /* ------------------------------------------------------------------ */ decFloat * decFloatToIntegralValue(decFloat *result, const decFloat *df, decContext *set, enum rounding round) { return decToIntegral(result, df, set, round, 0);} decFloat * decFloatToIntegralExact(decFloat *result, const decFloat *df, decContext *set) { return decToIntegral(result, df, set, set->round, 1);} /* ------------------------------------------------------------------ */ /* decFloatXor -- logical digitwise XOR of two decFloats */ /* */ /* result gets the result of XORing dfl and dfr */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) */ /* set is the context */ /* returns result, which will be canonical with sign=0 */ /* */ /* The operands must be positive, finite with exponent q=0, and */ /* comprise just zeros and ones; if not, Invalid operation results. */ /* ------------------------------------------------------------------ */ decFloat * decFloatXor(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { if (!DFISUINT01(dfl) || !DFISUINT01(dfr) || !DFISCC01(dfl) || !DFISCC01(dfr)) return decInvalid(result, set); // the operands are positive finite integers (q=0) with just 0s and 1s #if DOUBLE DFWORD(result, 0)=ZEROWORD |((DFWORD(dfl, 0) ^ DFWORD(dfr, 0))&0x04009124); DFWORD(result, 1)=(DFWORD(dfl, 1) ^ DFWORD(dfr, 1))&0x49124491; #elif QUAD DFWORD(result, 0)=ZEROWORD |((DFWORD(dfl, 0) ^ DFWORD(dfr, 0))&0x04000912); DFWORD(result, 1)=(DFWORD(dfl, 1) ^ DFWORD(dfr, 1))&0x44912449; DFWORD(result, 2)=(DFWORD(dfl, 2) ^ DFWORD(dfr, 2))&0x12449124; DFWORD(result, 3)=(DFWORD(dfl, 3) ^ DFWORD(dfr, 3))&0x49124491; #endif return result; } // decFloatXor /* ------------------------------------------------------------------ */ /* decInvalid -- set Invalid_operation result */ /* */ /* result gets a canonical NaN */ /* set is the context */ /* returns result */ /* */ /* status has Invalid_operation added */ /* ------------------------------------------------------------------ */ static decFloat *decInvalid(decFloat *result, decContext *set) { decFloatZero(result); DFWORD(result, 0)=DECFLOAT_qNaN; set->status|=DEC_Invalid_operation; return result; } // decInvalid /* ------------------------------------------------------------------ */ /* decInfinity -- set canonical Infinity with sign from a decFloat */ /* */ /* result gets a canonical Infinity */ /* df is source decFloat (only the sign is used) */ /* returns result */ /* */ /* df may be the same as result */ /* ------------------------------------------------------------------ */ static decFloat *decInfinity(decFloat *result, const decFloat *df) { uInt sign=DFWORD(df, 0); // save source signword decFloatZero(result); // clear everything DFWORD(result, 0)=DECFLOAT_Inf | (sign & DECFLOAT_Sign); return result; } // decInfinity /* ------------------------------------------------------------------ */ /* decNaNs -- handle NaN argument(s) */ /* */ /* result gets the result of handling dfl and dfr, one or both of */ /* which is a NaN */ /* dfl is the first decFloat (lhs) */ /* dfr is the second decFloat (rhs) -- may be NULL for a single- */ /* operand operation */ /* set is the context */ /* returns result */ /* */ /* 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 decFloat *decNaNs(decFloat *result, const decFloat *dfl, const decFloat *dfr, decContext *set) { // handle sNaNs first if (dfr!=NULL && DFISSNAN(dfr) && !DFISSNAN(dfl)) dfl=dfr; // use RHS if (DFISSNAN(dfl)) { decCanonical(result, dfl); // propagate canonical sNaN DFWORD(result, 0)&=~(DECFLOAT_qNaN ^ DECFLOAT_sNaN); // quiet set->status|=DEC_Invalid_operation; return result; } // one or both is a quiet NaN if (!DFISNAN(dfl)) dfl=dfr; // RHS must be NaN, use it return decCanonical(result, dfl); // propagate canonical qNaN } // decNaNs /* ------------------------------------------------------------------ */ /* decNumCompare -- numeric comparison of two decFloats */ /* */ /* dfl is the left-hand decFloat, which is not a NaN */ /* dfr is the right-hand decFloat, which is not a NaN */ /* tot is 1 for total order compare, 0 for simple numeric */ /* returns -1, 0, or +1 for dfldfr */ /* */ /* No error is possible; status and mode are unchanged. */ /* ------------------------------------------------------------------ */ static Int decNumCompare(const decFloat *dfl, const decFloat *dfr, Flag tot) { Int sigl, sigr; // LHS and RHS non-0 signums Int shift; // shift needed to align operands uByte *ub, *uc; // work uInt uiwork; // for macros // buffers +2 if Quad (36 digits), need double plus 4 for safe padding uByte bufl[DECPMAX*2+QUAD*2+4]; // for LHS coefficient + padding uByte bufr[DECPMAX*2+QUAD*2+4]; // for RHS coefficient + padding sigl=1; if (DFISSIGNED(dfl)) { if (!DFISSIGNED(dfr)) { // -LHS +RHS if (DFISZERO(dfl) && DFISZERO(dfr) && !tot) return 0; return -1; // RHS wins } sigl=-1; } if (DFISSIGNED(dfr)) { if (!DFISSIGNED(dfl)) { // +LHS -RHS if (DFISZERO(dfl) && DFISZERO(dfr) && !tot) return 0; return +1; // LHS wins } } // signs are the same; operand(s) could be zero sigr=-sigl; // sign to return if abs(RHS) wins if (DFISINF(dfl)) { if (DFISINF(dfr)) return 0; // both infinite & same sign return sigl; // inf > n } if (DFISINF(dfr)) return sigr; // n < inf [dfl is finite] // here, both are same sign and finite; calculate their offset shift=GETEXP(dfl)-GETEXP(dfr); // [0 means aligned] // [bias can be ignored -- the absolute exponent is not relevant] if (DFISZERO(dfl)) { if (!DFISZERO(dfr)) return sigr; // LHS=0, RHS!=0 // both are zero, return 0 if both same exponent or numeric compare if (shift==0 || !tot) return 0; if (shift>0) return sigl; return sigr; // [shift<0] } else { // LHS!=0 if (DFISZERO(dfr)) return sigl; // LHS!=0, RHS=0 } // both are known to be non-zero at this point // if the exponents are so different that the coefficients do not // overlap (by even one digit) then a full comparison is not needed if (abs(shift)>=DECPMAX) { // no overlap // coefficients are known to be non-zero if (shift>0) return sigl; return sigr; // [shift<0] } // decode the coefficients // (shift both right two if Quad to make a multiple of four) #if QUAD UBFROMUI(bufl, 0); UBFROMUI(bufr, 0); #endif GETCOEFF(dfl, bufl+QUAD*2); // decode from decFloat GETCOEFF(dfr, bufr+QUAD*2); // .. if (shift==0) { // aligned; common and easy // all multiples of four, here for (ub=bufl, uc=bufr; ub*uc) return sigl; // difference found if (*ub<*uc) return sigr; // .. } } } // aligned else if (shift>0) { // lhs to left ub=bufl; // RHS pointer // pad bufl so right-aligned; most shifts will fit in 8 UBFROMUI(bufl+DECPMAX+QUAD*2, 0); // add eight zeros UBFROMUI(bufl+DECPMAX+QUAD*2+4, 0); // .. if (shift>8) { // more than eight; fill the rest, and also worth doing the // lead-in by fours uByte *up; // work uByte *upend=bufl+DECPMAX+QUAD*2+shift; for (up=bufl+DECPMAX+QUAD*2+8; upbufl+shift-4) break; } } // check remaining leading digits for (; ub*uc) return sigl; // difference found if (*ub<*uc) return sigr; // .. } } // mismatch if (uc==bufr+QUAD*2+DECPMAX-4) break; // all checked } } // shift>0 else { // shift<0) .. RHS is to left of LHS; mirror shift>0 uc=bufr; // RHS pointer // pad bufr so right-aligned; most shifts will fit in 8 UBFROMUI(bufr+DECPMAX+QUAD*2, 0); // add eight zeros UBFROMUI(bufr+DECPMAX+QUAD*2+4, 0); // .. if (shift<-8) { // more than eight; fill the rest, and also worth doing the // lead-in by fours uByte *up; // work uByte *upend=bufr+DECPMAX+QUAD*2-shift; for (up=bufr+DECPMAX+QUAD*2+8; upbufr-shift-4) break; } } // check remaining leading digits for (; uc*uc) return sigl; // difference found if (*ub<*uc) return sigr; // .. } } // mismatch if (ub==bufl+QUAD*2+DECPMAX-4) break; // all checked } } // shift<0 // Here when compare equal if (!tot) return 0; // numerically equal // total ordering .. exponent matters if (shift>0) return sigl; // total order by exponent if (shift<0) return sigr; // .. return 0; } // decNumCompare /* ------------------------------------------------------------------ */ /* decToInt32 -- local routine to effect ToInteger conversions */ /* */ /* df is the decFloat to convert */ /* set is the context */ /* rmode is the rounding mode to use */ /* exact is 1 if Inexact should be signalled */ /* unsign is 1 if the result a uInt, 0 if an Int (cast to uInt) */ /* returns 32-bit result as a uInt */ /* */ /* Invalid is set is df is a NaN, is infinite, or is out-of-range; in */ /* these cases 0 is returned. */ /* ------------------------------------------------------------------ */ static uInt decToInt32(const decFloat *df, decContext *set, enum rounding rmode, Flag exact, Flag unsign) { Int exp; // exponent uInt sourhi, sourpen, sourlo; // top word from source decFloat .. uInt hi, lo; // .. penultimate, least, etc. decFloat zero, result; // work Int i; // .. /* Start decoding the argument */ sourhi=DFWORD(df, 0); // top word exp=DECCOMBEXP[sourhi>>26]; // get exponent high bits (in place) if (EXPISSPECIAL(exp)) { // is special? set->status|=DEC_Invalid_operation; // signal return 0; } /* Here when the argument is finite */ if (GETEXPUN(df)==0) result=*df; // already a true integer else { // need to round to integer enum rounding saveround; // saver uInt savestatus; // .. saveround=set->round; // save rounding mode .. savestatus=set->status; // .. and status set->round=rmode; // set mode decFloatZero(&zero); // make 0E+0 set->status=0; // clear decFloatQuantize(&result, df, &zero, set); // [this may fail] set->round=saveround; // restore rounding mode .. if (exact) set->status|=savestatus; // include Inexact else set->status=savestatus; // .. or just original status } // only the last four declets of the coefficient can contain // non-zero; check for others (and also NaN or Infinity from the // Quantize) first (see DFISZERO for explanation): // decFloatShow(&result, "sofar"); #if DOUBLE if ((DFWORD(&result, 0)&0x1c03ff00)!=0 || (DFWORD(&result, 0)&0x60000000)==0x60000000) { #elif QUAD if ((DFWORD(&result, 2)&0xffffff00)!=0 || DFWORD(&result, 1)!=0 || (DFWORD(&result, 0)&0x1c003fff)!=0 || (DFWORD(&result, 0)&0x60000000)==0x60000000) { #endif set->status|=DEC_Invalid_operation; // Invalid or out of range return 0; } // get last twelve digits of the coefficent into hi & ho, base // 10**9 (see GETCOEFFBILL): sourlo=DFWORD(&result, DECWORDS-1); lo=DPD2BIN0[sourlo&0x3ff] +DPD2BINK[(sourlo>>10)&0x3ff] +DPD2BINM[(sourlo>>20)&0x3ff]; sourpen=DFWORD(&result, DECWORDS-2); hi=DPD2BIN0[((sourpen<<2) | (sourlo>>30))&0x3ff]; // according to request, check range carefully if (unsign) { if (hi>4 || (hi==4 && lo>294967295) || (hi+lo!=0 && DFISSIGNED(&result))) { set->status|=DEC_Invalid_operation; // out of range return 0; } return hi*BILLION+lo; } // signed if (hi>2 || (hi==2 && lo>147483647)) { // handle the usual edge case if (lo==147483648 && hi==2 && DFISSIGNED(&result)) return 0x80000000; set->status|=DEC_Invalid_operation; // truly out of range return 0; } i=hi*BILLION+lo; if (DFISSIGNED(&result)) i=-i; return (uInt)i; } // decToInt32 /* ------------------------------------------------------------------ */ /* decToIntegral -- local routine to effect ToIntegral value */ /* */ /* result gets the result */ /* df is the decFloat to round */ /* set is the context */ /* rmode is the rounding mode to use */ /* exact is 1 if Inexact should be signalled */ /* returns result */ /* ------------------------------------------------------------------ */ static decFloat * decToIntegral(decFloat *result, const decFloat *df, decContext *set, enum rounding rmode, Flag exact) { Int exp; // exponent uInt sourhi; // top word from source decFloat enum rounding saveround; // saver uInt savestatus; // .. decFloat zero; // work /* Start decoding the argument */ sourhi=DFWORD(df, 0); // top word exp=DECCOMBEXP[sourhi>>26]; // get exponent high bits (in place) if (EXPISSPECIAL(exp)) { // is special? // NaNs are handled as usual if (DFISNAN(df)) return decNaNs(result, df, NULL, set); // must be infinite; return canonical infinity with sign of df return decInfinity(result, df); } /* Here when the argument is finite */ // complete extraction of the exponent exp+=GETECON(df)-DECBIAS; // .. + continuation and unbias if (exp>=0) return decCanonical(result, df); // already integral saveround=set->round; // save rounding mode .. savestatus=set->status; // .. and status set->round=rmode; // set mode decFloatZero(&zero); // make 0E+0 decFloatQuantize(result, df, &zero, set); // 'integrate'; cannot fail set->round=saveround; // restore rounding mode .. if (!exact) set->status=savestatus; // .. and status, unless exact return result; } // decToIntegral jq-jq-1.8.0/vendor/decNumber/decCommon.c000066400000000000000000002515621501676513100200330ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decCommon.c -- common code for all three fixed-size types */ /* ------------------------------------------------------------------ */ /* 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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 code that is shared between all the formats */ /* (decSingle, decDouble, and decQuad); it includes set and extract */ /* of format components, widening, narrowing, and string conversions. */ /* */ /* Unlike decNumber, parameterization takes place at compile time */ /* rather than at runtime. The parameters are set in the decDouble.c */ /* (etc.) files, which then include this one to produce the compiled */ /* code. The functions here, therefore, are code shared between */ /* multiple formats. */ /* ------------------------------------------------------------------ */ // Names here refer to decFloat rather than to decDouble, etc., and // the functions are in strict alphabetical order. // Constants, tables, and debug function(s) are included only for QUAD // (which will always be compiled if DOUBLE or SINGLE are used). // // Whenever a decContext is used, only the status may be set (using // OR) or the rounding mode read; all other fields are ignored and // untouched. // names for simpler testing and default context #if DECPMAX==7 #define SINGLE 1 #define DOUBLE 0 #define QUAD 0 #define DEFCONTEXT DEC_INIT_DECIMAL32 #elif DECPMAX==16 #define SINGLE 0 #define DOUBLE 1 #define QUAD 0 #define DEFCONTEXT DEC_INIT_DECIMAL64 #elif DECPMAX==34 #define SINGLE 0 #define DOUBLE 0 #define QUAD 1 #define DEFCONTEXT DEC_INIT_DECIMAL128 #else #error Unexpected DECPMAX value #endif /* Assertions */ #if DECPMAX!=7 && DECPMAX!=16 && DECPMAX!=34 #error Unexpected Pmax (DECPMAX) value for this module #endif // Assert facts about digit characters, etc. #if ('9'&0x0f)!=9 #error This module assumes characters are of the form 0b....nnnn // where .... are don't care 4 bits and nnnn is 0000 through 1001 #endif #if ('9'&0xf0)==('.'&0xf0) #error This module assumes '.' has a different mask than a digit #endif // Assert ToString lay-out conditions #if DECSTRING DECSTRING #error Exponent form can be too long for ToString to lay out safely #endif #if DECEMAXD > 4 #error Exponent form is too long for ToString to lay out // Note: code for up to 9 digits exists in archives [decOct] #endif /* Private functions used here and possibly in decBasic.c, etc. */ static decFloat * decFinalize(decFloat *, bcdnum *, decContext *); static Flag decBiStr(const char *, const char *, const char *); /* Macros and private tables; those which are not format-dependent */ /* are only included if decQuad is being built. */ /* ------------------------------------------------------------------ */ /* Combination field lookup tables (uInts to save measurable work) */ /* */ /* DECCOMBEXP - 2 most-significant-bits of exponent (00, 01, or */ /* 10), shifted left for format, or DECFLOAT_Inf/NaN */ /* DECCOMBWEXP - The same, for the next-wider format (unless QUAD) */ /* DECCOMBMSD - 4-bit most-significant-digit */ /* [0 if the index is a special (Infinity or NaN)] */ /* DECCOMBFROM - 5-bit combination field from EXP top bits and MSD */ /* (placed in uInt so no shift is needed) */ /* */ /* DECCOMBEXP, DECCOMBWEXP, and DECCOMBMSD are indexed by the sign */ /* and 5-bit combination field (0-63, the second half of the table */ /* identical to the first half) */ /* DECCOMBFROM is indexed by expTopTwoBits*16 + msd */ /* */ /* DECCOMBMSD and DECCOMBFROM are not format-dependent and so are */ /* only included once, when QUAD is being built */ /* ------------------------------------------------------------------ */ static const uInt DECCOMBEXP[64]={ 0, 0, 0, 0, 0, 0, 0, 0, 1< DPD #define DEC_BIN2DPD 1 // 0-999 -> DPD #define DEC_BIN2BCD8 1 // 0-999 -> ddd, len #define DEC_DPD2BCD8 1 // DPD -> ddd, len #define DEC_DPD2BIN 1 // DPD -> 0-999 #define DEC_DPD2BINK 1 // DPD -> 0-999000 #define DEC_DPD2BINM 1 // DPD -> 0-999000000 #include "decDPD.h" // source of the lookup tables #endif /* ----------------------------------------------------------------- */ /* 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, targ is the same */ /* length as str1 and str2, and each character of targ is in one */ /* of 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 /* ------------------------------------------------------------------ */ /* decFinalize -- adjust and store a final result */ /* */ /* df is the decFloat format number which gets the final result */ /* num is the descriptor of the number to be checked and encoded */ /* [its values, including the coefficient, may be modified] */ /* set is the context to use */ /* returns df */ /* */ /* The num descriptor may point to a bcd8 string of any length; this */ /* string may have leading insignificant zeros. If it has more than */ /* DECPMAX digits then the final digit can be a round-for-reround */ /* digit (i.e., it may include a sticky bit residue). */ /* */ /* The exponent (q) may be one of the codes for a special value and */ /* can be up to 999999999 for conversion from string. */ /* */ /* No error is possible, but Inexact, Underflow, and/or Overflow may */ /* be set. */ /* ------------------------------------------------------------------ */ // Constant whose size varies with format; also the check for surprises static uByte allnines[DECPMAX]= #if SINGLE {9, 9, 9, 9, 9, 9, 9}; #elif DOUBLE {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; #elif QUAD {9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9}; #endif static decFloat * decFinalize(decFloat *df, bcdnum *num, decContext *set) { uByte *ub; // work uInt dpd; // .. uInt uiwork; // for macros uByte *umsd=num->msd; // local copy uByte *ulsd=num->lsd; // .. uInt encode; // encoding accumulator Int length; // coefficient length #if DECCHECK Int clen=ulsd-umsd+1; #if QUAD #define COEXTRA 2 // extra-long coefficent #else #define COEXTRA 0 #endif if (clen<1 || clen>DECPMAX*3+2+COEXTRA) printf("decFinalize: suspect coefficient [length=%ld]\n", (LI)clen); if (num->sign!=0 && num->sign!=DECFLOAT_Sign) printf("decFinalize: bad sign [%08lx]\n", (LI)num->sign); if (!EXPISSPECIAL(num->exponent) && (num->exponent>1999999999 || num->exponent<-1999999999)) printf("decFinalize: improbable exponent [%ld]\n", (LI)num->exponent); // decShowNum(num, "final"); #endif // A special will have an 'exponent' which is very positive and a // coefficient < DECPMAX length=(uInt)(ulsd-umsd+1); // coefficient length if (!NUMISSPECIAL(num)) { Int drop; // digits to be dropped // skip leading insignificant zeros to calculate an exact length // [this is quite expensive] if (*umsd==0) { for (; umsd+3exponent); // drop can now be > digits for bottom-clamp (subnormal) cases if (drop>0) { // rounding needed // (decFloatQuantize has very similar code to this, so any // changes may need to be made there, too) uByte *roundat; // -> re-round digit uByte reround; // reround value // printf("Rounding; drop=%ld\n", (LI)drop); num->exponent+=drop; // always update exponent // Three cases here: // 1. new LSD is in coefficient (almost always) // 2. new LSD is digit to left of coefficient (so MSD is // round-for-reround digit) // 3. new LSD is to left of case 2 (whole coefficient is sticky) // [duplicate check-stickies code to save a test] // [by-digit check for stickies as runs of zeros are rare] if (dropstatus|=DEC_Inexact; // if adjusted exponent [exp+digits-1] is < EMIN then num is // subnormal -- so raise Underflow if (num->exponentexponent+(ulsd-umsd+1)-1)status|=DEC_Underflow; // next decide whether increment of the coefficient is needed if (set->round==DEC_ROUND_HALF_EVEN) { // fastpath slowest case if (reround>5) bump=1; // >0.5 goes up else if (reround==5) // exactly 0.5000 .. bump=*ulsd & 0x01; // .. up iff [new] lsd is odd } // r-h-e else switch (set->round) { case DEC_ROUND_DOWN: { // no change break;} // r-d case DEC_ROUND_HALF_DOWN: { if (reround>5) bump=1; break;} // r-h-d case DEC_ROUND_HALF_UP: { if (reround>=5) bump=1; break;} // r-h-u case DEC_ROUND_UP: { if (reround>0) bump=1; break;} // r-u case DEC_ROUND_CEILING: { // same as _UP for positive numbers, and as _DOWN for negatives if (!num->sign && reround>0) bump=1; break;} // r-c case DEC_ROUND_FLOOR: { // same as _UP for negative numbers, and as _DOWN for positive // [negative reround cannot occur on 0] if (num->sign && reround>0) bump=1; break;} // r-f case DEC_ROUND_05UP: { if (reround>0) { // anything out there is 'sticky' // bump iff lsd=0 or 5; this cannot carry so it could be // effected immediately with no bump -- but the code // is clearer if this is done the same way as the others if (*ulsd==0 || *ulsd==5) bump=1; } break;} // r-r default: { // e.g., DEC_ROUND_MAX set->status|=DEC_Invalid_context; #if DECCHECK printf("Unknown rounding mode: %ld\n", (LI)set->round); #endif break;} } // switch (not r-h-e) // printf("ReRound: %ld bump: %ld\n", (LI)reround, (LI)bump); if (bump!=0) { // need increment // increment the coefficient; this might end up with 1000... // (after the all nines case) ub=ulsd; for(; ub-3>=umsd && UBTOUI(ub-3)==0x09090909; ub-=4) { UBFROMUI(ub-3, 0); // to 00000000 } // [note ub could now be to left of msd, and it is not safe // to write to the left of the msd] // now at most 3 digits left to non-9 (usually just the one) for (; ub>=umsd; *ub=0, ub--) { if (*ub==9) continue; // carry *ub+=1; break; } if (ubexponent++; } else { // if coefficient is shorter than Pmax then num is // subnormal, so extend it; this is safe as drop>0 // (or, if the coefficient was supplied above, it could // not be 9); this may make the result normal. ulsd++; *ulsd=0; // [exponent unchanged] #if DECCHECK if (num->exponent!=DECQTINY) // sanity check printf("decFinalize: bad all-nines extend [^%ld, %ld]\n", (LI)num->exponent, (LI)(ulsd-umsd+1)); #endif } // subnormal extend } // had all-nines } // bump needed } // inexact rounding length=ulsd-umsd+1; // recalculate (may be 0) // The coefficient will now fit and has final length unless overflow // decShowNum(num, "rounded"); // if exponent is >=emax may have to clamp, overflow, or fold-down if (num->exponent>DECEMAX-(DECPMAX-1)) { // is edge case // printf("overflow checks...\n"); if (*ulsd==0 && ulsd==umsd) { // have zero num->exponent=DECEMAX-(DECPMAX-1); // clamp to max } else if ((num->exponent+length-1)>DECEMAX) { // > Nmax // Overflow -- these could go straight to encoding, here, but // instead num is adjusted to keep the code cleaner Flag needmax=0; // 1 for finite result set->status|=(DEC_Overflow | DEC_Inexact); 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 (num->sign) needmax=1; // Infinity iff non-negative break;} // r-c case DEC_ROUND_FLOOR: { if (!num->sign) needmax=1; // Infinity iff negative break;} // r-f default: break; // Infinity in all other cases } if (!needmax) { // easy .. set Infinity num->exponent=DECFLOAT_Inf; *umsd=0; // be clean: coefficient to 0 ulsd=umsd; // .. } else { // return Nmax umsd=allnines; // use constant array ulsd=allnines+DECPMAX-1; num->exponent=DECEMAX-(DECPMAX-1); } } else { // no overflow but non-zero and may have to fold-down Int shift=num->exponent-(DECEMAX-(DECPMAX-1)); if (shift>0) { // fold-down needed // fold down needed; must copy to buffer in order to pad // with zeros safely; fortunately this is not the worst case // path because cannot have had a round uByte buffer[ROUNDUP(DECPMAX+3, 4)]; // [+3 allows uInt padding] uByte *s=umsd; // source uByte *t=buffer; // safe target uByte *tlsd=buffer+(ulsd-umsd)+shift; // target LSD // printf("folddown shift=%ld\n", (LI)shift); for (; s<=ulsd; s+=4, t+=4) UBFROMUI(t, UBTOUI(s)); for (t=tlsd-shift+1; t<=tlsd; t+=4) UBFROMUI(t, 0); // pad 0s num->exponent-=shift; umsd=buffer; ulsd=tlsd; } } // fold-down? length=ulsd-umsd+1; // recalculate length } // high-end edge case } // finite number /*------------------------------------------------------------------*/ /* At this point the result will properly fit the decFloat */ /* encoding, and it can be encoded with no possibility of error */ /*------------------------------------------------------------------*/ // Following code does not alter coefficient (could be allnines array) // fast path possible when DECPMAX digits if (length==DECPMAX) { return decFloatFromBCD(df, num->exponent, umsd, num->sign); } // full-length // slower path when not a full-length number; must care about length // [coefficient length here will be < DECPMAX] if (!NUMISSPECIAL(num)) { // is still finite // encode the combination field and exponent continuation uInt uexp=(uInt)(num->exponent+DECBIAS); // biased exponent uInt code=(uexp>>DECECONL)<<4; // top two bits of exp // [msd==0] // look up the combination field and make high word encode=DECCOMBFROM[code]; // indexed by (0-2)*16+msd encode|=(uexp<<(32-6-DECECONL)) & 0x03ffffff; // exponent continuation } else encode=num->exponent; // special [already in word] encode|=num->sign; // add sign // private macro to extract a declet, n (where 0<=n=umsd) dpd=BCD2DPD[(*ub*256)+(*(ub+1)*16)+*(ub+2)]; \ else {dpd=*(ub+2); if (ub+1==umsd) dpd+=*(ub+1)*16; dpd=BCD2DPD[dpd];} // place the declets in the encoding words and copy to result (df), // according to endianness; in all cases complete the sign word // first #if DECPMAX==7 getDPDt(dpd, 1); encode|=dpd<<10; getDPDt(dpd, 0); encode|=dpd; DFWORD(df, 0)=encode; // just the one word #elif DECPMAX==16 getDPDt(dpd, 4); encode|=dpd<<8; getDPDt(dpd, 3); encode|=dpd>>2; DFWORD(df, 0)=encode; encode=dpd<<30; getDPDt(dpd, 2); encode|=dpd<<20; getDPDt(dpd, 1); encode|=dpd<<10; getDPDt(dpd, 0); encode|=dpd; DFWORD(df, 1)=encode; #elif DECPMAX==34 getDPDt(dpd,10); encode|=dpd<<4; getDPDt(dpd, 9); encode|=dpd>>6; DFWORD(df, 0)=encode; encode=dpd<<26; getDPDt(dpd, 8); encode|=dpd<<16; getDPDt(dpd, 7); encode|=dpd<<6; getDPDt(dpd, 6); encode|=dpd>>4; DFWORD(df, 1)=encode; encode=dpd<<28; getDPDt(dpd, 5); encode|=dpd<<18; getDPDt(dpd, 4); encode|=dpd<<8; getDPDt(dpd, 3); encode|=dpd>>2; DFWORD(df, 2)=encode; encode=dpd<<30; getDPDt(dpd, 2); encode|=dpd<<20; getDPDt(dpd, 1); encode|=dpd<<10; getDPDt(dpd, 0); encode|=dpd; DFWORD(df, 3)=encode; #endif // printf("Status: %08lx\n", (LI)set->status); // decFloatShow(df, "final2"); return df; } // decFinalize /* ------------------------------------------------------------------ */ /* decFloatFromBCD -- set decFloat from exponent, BCD8, and sign */ /* */ /* df is the target decFloat */ /* exp is the in-range unbiased exponent, q, or a special value in */ /* the form returned by decFloatGetExponent */ /* bcdar holds DECPMAX digits to set the coefficient from, one */ /* digit in each byte (BCD8 encoding); the first (MSD) is ignored */ /* if df is a NaN; all are ignored if df is infinite. */ /* All bytes must be in 0-9; results are undefined otherwise. */ /* sig is DECFLOAT_Sign to set the sign bit, 0 otherwise */ /* returns df, which will be canonical */ /* */ /* No error is possible, and no status will be set. */ /* ------------------------------------------------------------------ */ decFloat * decFloatFromBCD(decFloat *df, Int exp, const uByte *bcdar, Int sig) { uInt encode, dpd; // work const uByte *ub; // .. if (EXPISSPECIAL(exp)) encode=exp|sig;// specials already encoded else { // is finite // encode the combination field and exponent continuation uInt uexp=(uInt)(exp+DECBIAS); // biased exponent uInt code=(uexp>>DECECONL)<<4; // top two bits of exp code+=bcdar[0]; // add msd // look up the combination field and make high word encode=DECCOMBFROM[code]|sig; // indexed by (0-2)*16+msd encode|=(uexp<<(32-6-DECECONL)) & 0x03ffffff; // exponent continuation } // private macro to extract a declet, n (where 0<=n>2; DFWORD(df, 0)=encode; encode=dpd<<30; getDPDb(dpd, 2); encode|=dpd<<20; getDPDb(dpd, 1); encode|=dpd<<10; getDPDb(dpd, 0); encode|=dpd; DFWORD(df, 1)=encode; #elif DECPMAX==34 getDPDb(dpd,10); encode|=dpd<<4; getDPDb(dpd, 9); encode|=dpd>>6; DFWORD(df, 0)=encode; encode=dpd<<26; getDPDb(dpd, 8); encode|=dpd<<16; getDPDb(dpd, 7); encode|=dpd<<6; getDPDb(dpd, 6); encode|=dpd>>4; DFWORD(df, 1)=encode; encode=dpd<<28; getDPDb(dpd, 5); encode|=dpd<<18; getDPDb(dpd, 4); encode|=dpd<<8; getDPDb(dpd, 3); encode|=dpd>>2; DFWORD(df, 2)=encode; encode=dpd<<30; getDPDb(dpd, 2); encode|=dpd<<20; getDPDb(dpd, 1); encode|=dpd<<10; getDPDb(dpd, 0); encode|=dpd; DFWORD(df, 3)=encode; #endif // decFloatShow(df, "fromB"); return df; } // decFloatFromBCD /* ------------------------------------------------------------------ */ /* decFloatFromPacked -- set decFloat from exponent and packed BCD */ /* */ /* df is the target decFloat */ /* exp is the in-range unbiased exponent, q, or a special value in */ /* the form returned by decFloatGetExponent */ /* packed holds DECPMAX packed decimal digits plus a sign nibble */ /* (all 6 codes are OK); the first (MSD) is ignored if df is a NaN */ /* and all except sign are ignored if df is infinite. For DOUBLE */ /* and QUAD the first (pad) nibble is also ignored in all cases. */ /* All coefficient nibbles must be in 0-9 and sign in A-F; results */ /* are undefined otherwise. */ /* returns df, which will be canonical */ /* */ /* No error is possible, and no status will be set. */ /* ------------------------------------------------------------------ */ decFloat * decFloatFromPacked(decFloat *df, Int exp, const uByte *packed) { uByte bcdar[DECPMAX+2]; // work [+1 for pad, +1 for sign] const uByte *ip; // .. uByte *op; // .. Int sig=0; // sign // expand coefficient and sign to BCDAR #if SINGLE op=bcdar+1; // no pad digit #else op=bcdar; // first (pad) digit ignored #endif for (ip=packed; ip>4; *op++=(uByte)(*ip&0x0f); // [final nibble is sign] } op--; // -> sign byte if (*op==DECPMINUS || *op==DECPMINUSALT) sig=DECFLOAT_Sign; if (EXPISSPECIAL(exp)) { // Infinity or NaN if (!EXPISINF(exp)) bcdar[1]=0; // a NaN: ignore MSD else memset(bcdar+1, 0, DECPMAX); // Infinite: coefficient to 0 } return decFloatFromBCD(df, exp, bcdar+1, sig); } // decFloatFromPacked /* ------------------------------------------------------------------ */ /* decFloatFromPackedChecked -- set from exponent and packed; checked */ /* */ /* df is the target decFloat */ /* exp is the in-range unbiased exponent, q, or a special value in */ /* the form returned by decFloatGetExponent */ /* packed holds DECPMAX packed decimal digits plus a sign nibble */ /* (all 6 codes are OK); the first (MSD) must be 0 if df is a NaN */ /* and all digits must be 0 if df is infinite. For DOUBLE and */ /* QUAD the first (pad) nibble must be 0. */ /* All coefficient nibbles must be in 0-9 and sign in A-F. */ /* returns df, which will be canonical or NULL if any of the */ /* requirements are not met (if this case df is unchanged); that */ /* is, the input data must be as returned by decFloatToPacked, */ /* except that all six sign codes are acccepted. */ /* */ /* No status will be set. */ /* ------------------------------------------------------------------ */ decFloat * decFloatFromPackedChecked(decFloat *df, Int exp, const uByte *packed) { uByte bcdar[DECPMAX+2]; // work [+1 for pad, +1 for sign] const uByte *ip; // .. uByte *op; // .. Int sig=0; // sign // expand coefficient and sign to BCDAR #if SINGLE op=bcdar+1; // no pad digit #else op=bcdar; // first (pad) digit here #endif for (ip=packed; ip>4; if (*op>9) return NULL; op++; *op=(uByte)(*ip&0x0f); // [final nibble is sign] if (*op>9 && ip sign byte if (*op<=9) return NULL; // bad sign if (*op==DECPMINUS || *op==DECPMINUSALT) sig=DECFLOAT_Sign; #if !SINGLE if (bcdar[0]!=0) return NULL; // bad pad nibble #endif if (EXPISNAN(exp)) { // a NaN if (bcdar[1]!=0) return NULL; // bad msd } // NaN else if (EXPISINF(exp)) { // is infinite Int i; for (i=0; iDECEMAX-DECPMAX+1) return NULL; if (exp first character of decimal part const char *c; // work uByte *ub; // .. uInt uiwork; // for macros bcdnum num; // collects data for finishing uInt error=DEC_Conversion_syntax; // assume the worst uByte buffer[ROUNDUP(DECSTRING+11, 8)]; // room for most coefficents, // some common rounding, +3, & pad #if DECTRACE // printf("FromString %s ...\n", string); #endif for(;;) { // once-only 'loop' num.sign=0; // assume non-negative num.msd=buffer; // MSD is here always // detect and validate the coefficient, including any leading, // trailing, or embedded '.' // [could test four-at-a-time here (saving 10% for decQuads), // but that risks storage violation because the position of the // terminator is unknown] for (c=string;; c++) { // -> input character if (((unsigned)(*c-'0'))<=9) continue; // '0' through '9' is good if (*c=='\0') break; // most common non-digit if (*c=='.') { if (dotchar!=NULL) break; // not first '.' dotchar=c; // record offset into decimal part continue;} if (c==string) { // first in string... if (*c=='-') { // valid - sign cfirst++; num.sign=DECFLOAT_Sign; continue;} if (*c=='+') { // valid + sign cfirst++; continue;} } // *c is not a digit, terminator, or a valid +, -, or '.' break; } // c loop digits=(uInt)(c-cfirst); // digits (+1 if a dot) if (digits>0) { // had digits and/or dot const char *clast=c-1; // note last coefficient char position Int exp=0; // exponent accumulator if (*c!='\0') { // something follows the coefficient uInt edig; // unsigned work // had some digits and more to come; expect E[+|-]nnn now const char *firstexp; // exponent first non-zero if (*c!='E' && *c!='e') break; c++; // to (optional) sign if (*c=='-' || *c=='+') c++; // step over sign (c=clast+2) if (*c=='\0') break; // no digits! (e.g., '1.2E') for (; *c=='0';) c++; // skip leading zeros [even last] firstexp=c; // remember start [maybe '\0'] // gather exponent digits edig=(uInt)*c-(uInt)'0'; if (edig<=9) { // [check not bad or terminator] exp+=edig; // avoid initial X10 c++; for (;; c++) { edig=(uInt)*c-(uInt)'0'; if (edig>9) break; exp=exp*10+edig; } } // if not now on the '\0', *c must not be a digit if (*c!='\0') break; // (this next test must be after the syntax checks) // if definitely more than the possible digits for format then // the exponent may have wrapped, so simply set it to a certain // over/underflow value if (c>firstexp+DECEMAXD) exp=DECEMAX*2; if (*(clast+2)=='-') exp=-exp; // was negative } // exponent part if (dotchar!=NULL) { // had a '.' digits--; // remove from digits count if (digits==0) break; // was dot alone: bad syntax exp-=(Int)(clast-dotchar); // adjust exponent // [the '.' can now be ignored] } num.exponent=exp; // exponent is good; store it // Here when whole string has been inspected and syntax is good // cfirst->first digit or dot, clast->last digit or dot error=0; // no error possible now // if the number of digits in the coefficient will fit in buffer // then it can simply be converted to bcd8 and copied -- decFinalize // will take care of leading zeros and rounding; the buffer is big // enough for all canonical coefficients, including 0.00000nn... ub=buffer; if (digits<=(Int)(sizeof(buffer)-3)) { // [-3 allows by-4s copy] c=cfirst; if (dotchar!=NULL) { // a dot to worry about if (*(c+1)=='.') { // common canonical case *ub++=(uByte)(*c-'0'); // copy leading digit c+=2; // prepare to handle rest } else for (; c<=clast;) { // '.' could be anywhere // as usual, go by fours when safe; NB it has been asserted // that a '.' does not have the same mask as a digit if (c<=clast-3 // safe for four && (UBTOUI(c)&0xf0f0f0f0)==CHARMASK) { // test four UBFROMUI(ub, UBTOUI(c)&0x0f0f0f0f); // to BCD8 ub+=4; c+=4; continue; } if (*c=='.') { // found the dot c++; // step over it .. break; // .. and handle the rest } *ub++=(uByte)(*c++-'0'); } } // had dot // Now no dot; do this by fours (where safe) for (; c<=clast-3; c+=4, ub+=4) UBFROMUI(ub, UBTOUI(c)&0x0f0f0f0f); for (; c<=clast; c++, ub++) *ub=(uByte)(*c-'0'); num.lsd=buffer+digits-1; // record new LSD } // fits else { // too long for buffer // [This is a rare and unusual case; arbitrary-length input] // strip leading zeros [but leave final 0 if all 0's] if (*cfirst=='.') cfirst++; // step past dot at start if (*cfirst=='0') { // [cfirst always -> digit] for (; cfirst LSD for (; c<=clast; c++) { // inspect remaining chars if (*c!='0') { // sticky bit needed if (*c=='.') continue; // [ignore] *ub=DECSTICKYTAB[*ub]; // update round-for-reround break; // no need to look at more } } num.lsd=ub; // record LSD // adjust exponent for dropped digits num.exponent+=digits-(Int)(ub-buffer+1); } // too long for buffer } // digits and/or dot else { // no digits or dot were found // only Infinities and NaNs are allowed, here if (*c=='\0') break; // nothing there is bad buffer[0]=0; // default a coefficient of 0 num.lsd=buffer; // .. if (decBiStr(c, "infinity", "INFINITY") || decBiStr(c, "inf", "INF")) num.exponent=DECFLOAT_Inf; else { // should be a NaN num.exponent=DECFLOAT_qNaN; // assume quiet NaN if (*c=='s' || *c=='S') { // probably an sNaN num.exponent=DECFLOAT_sNaN; // effect the 's' c++; // and step over it } 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 (no dots), expected // -> start of integer, and skip leading 0s [including plain 0] for (cfirst=c; *cfirst=='0';) cfirst++; if (*cfirst!='\0') { // not empty or all-0, payload // payload found; check all valid digits and copy to buffer as bcd8 ub=buffer; for (c=cfirst;; c++, ub++) { if ((unsigned)(*c-'0')>9) break; // quit if not 0-9 if (c-cfirst==DECPMAX-1) break; // too many digits *ub=(uByte)(*c-'0'); // good bcd8 } if (*c!='\0') break; // not all digits, or too many num.lsd=ub-1; // record new LSD } } // NaN or sNaN error=0; // syntax is OK } // digits=0 (special expected) break; // drop out } // [for(;;) once-loop] // decShowNum(&num, "fromStr"); if (error!=0) { set->status|=error; num.exponent=DECFLOAT_qNaN; // set up quiet NaN num.sign=0; // .. with 0 sign buffer[0]=0; // .. and coefficient num.lsd=buffer; // .. // decShowNum(&num, "oops"); } // decShowNum(&num, "dffs"); decFinalize(result, &num, set); // round, check, and lay out // decFloatShow(result, "fromString"); return result; } // decFloatFromString /* ------------------------------------------------------------------ */ /* decFloatFromWider -- conversion from next-wider format */ /* */ /* result is the decFloat format number which gets the result of */ /* the conversion */ /* wider is the decFloatWider format number which will be narrowed */ /* set is the context */ /* returns result */ /* */ /* Narrowing can cause rounding, overflow, etc., but not Invalid */ /* operation (sNaNs are copied and do not signal). */ /* ------------------------------------------------------------------ */ // narrow-to is not possible for decQuad format numbers; simply omit #if !QUAD decFloat * decFloatFromWider(decFloat *result, const decFloatWider *wider, decContext *set) { bcdnum num; // collects data for finishing uByte bcdar[DECWPMAX]; // room for wider coefficient uInt widerhi=DFWWORD(wider, 0); // top word Int exp; GETWCOEFF(wider, bcdar); num.msd=bcdar; // MSD is here always num.lsd=bcdar+DECWPMAX-1; // LSD is here always num.sign=widerhi&0x80000000; // extract sign [DECFLOAT_Sign=Neg] // decode the wider combination field to exponent exp=DECCOMBWEXP[widerhi>>26]; // decode from wider combination field // if it is a special there's nothing to do unless sNaN; if it's // finite then add the (wider) exponent continuation and unbias if (EXPISSPECIAL(exp)) exp=widerhi&0x7e000000; // include sNaN selector else exp+=GETWECON(wider)-DECWBIAS; num.exponent=exp; // decShowNum(&num, "dffw"); return decFinalize(result, &num, set);// round, check, and lay out } // decFloatFromWider #endif /* ------------------------------------------------------------------ */ /* decFloatGetCoefficient -- get coefficient as BCD8 */ /* */ /* df is the decFloat from which to extract the coefficient */ /* bcdar is where DECPMAX bytes will be written, one BCD digit in */ /* each byte (BCD8 encoding); if df is a NaN the first byte will */ /* be zero, and if it is infinite they will all be zero */ /* returns the sign of the coefficient (DECFLOAT_Sign if negative, */ /* 0 otherwise) */ /* */ /* No error is possible, and no status will be set. If df is a */ /* special value the array is set to zeros (for Infinity) or to the */ /* payload of a qNaN or sNaN. */ /* ------------------------------------------------------------------ */ Int decFloatGetCoefficient(const decFloat *df, uByte *bcdar) { if (DFISINF(df)) memset(bcdar, 0, DECPMAX); else { GETCOEFF(df, bcdar); // use macro if (DFISNAN(df)) bcdar[0]=0; // MSD needs correcting } return GETSIGN(df); } // decFloatGetCoefficient /* ------------------------------------------------------------------ */ /* decFloatGetExponent -- get unbiased exponent */ /* */ /* df is the decFloat from which to extract the exponent */ /* returns the exponent, q. */ /* */ /* No error is possible, and no status will be set. If df is a */ /* special value the first seven bits of the decFloat are returned, */ /* left adjusted and with the first (sign) bit set to 0 (followed by */ /* 25 0 bits). e.g., -sNaN would return 0x7e000000 (DECFLOAT_sNaN). */ /* ------------------------------------------------------------------ */ Int decFloatGetExponent(const decFloat *df) { if (DFISSPECIAL(df)) return DFWORD(df, 0)&0x7e000000; return GETEXPUN(df); } // decFloatGetExponent /* ------------------------------------------------------------------ */ /* decFloatSetCoefficient -- set coefficient from BCD8 */ /* */ /* df is the target decFloat (and source of exponent/special value) */ /* bcdar holds DECPMAX digits to set the coefficient from, one */ /* digit in each byte (BCD8 encoding); the first (MSD) is ignored */ /* if df is a NaN; all are ignored if df is infinite. */ /* sig is DECFLOAT_Sign to set the sign bit, 0 otherwise */ /* returns df, which will be canonical */ /* */ /* No error is possible, and no status will be set. */ /* ------------------------------------------------------------------ */ decFloat * decFloatSetCoefficient(decFloat *df, const uByte *bcdar, Int sig) { uInt exp; // for exponent uByte bcdzero[DECPMAX]; // for infinities // Exponent/special code is extracted from df if (DFISSPECIAL(df)) { exp=DFWORD(df, 0)&0x7e000000; if (DFISINF(df)) { memset(bcdzero, 0, DECPMAX); return decFloatFromBCD(df, exp, bcdzero, sig); } } else exp=GETEXPUN(df); return decFloatFromBCD(df, exp, bcdar, sig); } // decFloatSetCoefficient /* ------------------------------------------------------------------ */ /* decFloatSetExponent -- set exponent or special value */ /* */ /* df is the target decFloat (and source of coefficient/payload) */ /* set is the context for reporting status */ /* exp is the unbiased exponent, q, or a special value in the form */ /* returned by decFloatGetExponent */ /* returns df, which will be canonical */ /* */ /* No error is possible, but Overflow or Underflow might occur. */ /* ------------------------------------------------------------------ */ decFloat * decFloatSetExponent(decFloat *df, decContext *set, Int exp) { uByte bcdcopy[DECPMAX]; // for coefficient bcdnum num; // work num.exponent=exp; num.sign=decFloatGetCoefficient(df, bcdcopy); // extract coefficient if (DFISSPECIAL(df)) { // MSD or more needs correcting if (DFISINF(df)) memset(bcdcopy, 0, DECPMAX); bcdcopy[0]=0; } num.msd=bcdcopy; num.lsd=bcdcopy+DECPMAX-1; return decFinalize(df, &num, set); } // decFloatSetExponent /* ------------------------------------------------------------------ */ /* decFloatRadix -- returns the base (10) */ /* */ /* df is any decFloat of this format */ /* ------------------------------------------------------------------ */ uInt decFloatRadix(const decFloat *df) { if (df) return 10; // to placate compiler return 10; } // decFloatRadix /* The following function is not available if DECPRINT=0 */ #if DECPRINT /* ------------------------------------------------------------------ */ /* decFloatShow -- printf a decFloat in hexadecimal and decimal */ /* df is the decFloat to show */ /* tag is a tag string displayed with the number */ /* */ /* This is a debug aid; the precise format of the string may change. */ /* ------------------------------------------------------------------ */ void decFloatShow(const decFloat *df, const char *tag) { char hexbuf[DECBYTES*2+DECBYTES/4+1]; // NB blank after every fourth char buff[DECSTRING]; // for value in decimal Int i, j=0; for (i=0; ibytes[DECBYTES-1-i]); #else sprintf(&hexbuf[j], "%02x", df->bytes[i]); #endif j+=2; // the next line adds blank (and terminator) after final pair, too if ((i+1)%4==0) {strcpy(&hexbuf[j], " "); j++;} } decFloatToString(df, buff); printf(">%s> %s [big-endian] %s\n", tag, hexbuf, buff); return; } // decFloatShow #endif /* ------------------------------------------------------------------ */ /* decFloatToBCD -- get sign, exponent, and BCD8 from a decFloat */ /* */ /* df is the source decFloat */ /* exp will be set to the unbiased exponent, q, or to a special */ /* value in the form returned by decFloatGetExponent */ /* bcdar is where DECPMAX bytes will be written, one BCD digit in */ /* each byte (BCD8 encoding); if df is a NaN the first byte will */ /* be zero, and if it is infinite they will all be zero */ /* returns the sign of the coefficient (DECFLOAT_Sign if negative, */ /* 0 otherwise) */ /* */ /* No error is possible, and no status will be set. */ /* ------------------------------------------------------------------ */ Int decFloatToBCD(const decFloat *df, Int *exp, uByte *bcdar) { if (DFISINF(df)) { memset(bcdar, 0, DECPMAX); *exp=DFWORD(df, 0)&0x7e000000; } else { GETCOEFF(df, bcdar); // use macro if (DFISNAN(df)) { bcdar[0]=0; // MSD needs correcting *exp=DFWORD(df, 0)&0x7e000000; } else { // finite *exp=GETEXPUN(df); } } return GETSIGN(df); } // decFloatToBCD /* ------------------------------------------------------------------ */ /* decFloatToEngString -- conversion to numeric string, engineering */ /* */ /* df is the decFloat format number to convert */ /* string is the string where the result will be laid out */ /* */ /* string must be at least DECPMAX+9 characters (the worst case is */ /* "-0.00000nnn...nnn\0", which is as long as the exponent form when */ /* DECEMAXD<=4); this condition is asserted above */ /* */ /* No error is possible, and no status will be set */ /* ------------------------------------------------------------------ */ char * decFloatToEngString(const decFloat *df, char *string){ uInt msd; // coefficient MSD Int exp; // exponent top two bits or full uInt comb; // combination field char *cstart; // coefficient start char *c; // output pointer in string char *s, *t; // .. (source, target) Int pre, e; // work const uByte *u; // .. uInt uiwork; // for macros [one compiler needs // volatile here to avoid bug, but // that doubles execution time] // Source words; macro handles endianness uInt sourhi=DFWORD(df, 0); // word with sign #if DECPMAX==16 uInt sourlo=DFWORD(df, 1); #elif DECPMAX==34 uInt sourmh=DFWORD(df, 1); uInt sourml=DFWORD(df, 2); uInt sourlo=DFWORD(df, 3); #endif c=string; // where result will go if (((Int)sourhi)<0) *c++='-'; // handle sign comb=sourhi>>26; // sign+combination field msd=DECCOMBMSD[comb]; // decode the combination field exp=DECCOMBEXP[comb]; // .. if (EXPISSPECIAL(exp)) { // special if (exp==DECFLOAT_Inf) { // infinity strcpy(c, "Inf"); strcpy(c+3, "inity"); return string; // easy } if (sourhi&0x02000000) *c++='s'; // sNaN strcpy(c, "NaN"); // complete word c+=3; // step past // quick exit if the payload is zero #if DECPMAX==7 if ((sourhi&0x000fffff)==0) return string; #elif DECPMAX==16 if (sourlo==0 && (sourhi&0x0003ffff)==0) return string; #elif DECPMAX==34 if (sourlo==0 && sourml==0 && sourmh==0 && (sourhi&0x00003fff)==0) return string; #endif // otherwise drop through to add integer; set correct exp etc. exp=0; msd=0; // setup for following code } else { // complete exponent; top two bits are in place exp+=GETECON(df)-DECBIAS; // .. + continuation and unbias } /* convert the digits of the significand to characters */ cstart=c; // save start of coefficient if (msd) *c++=(char)('0'+(char)msd); // non-zero most significant digit // Decode the declets. After extracting each declet, it is // decoded to a 4-uByte sequence by table lookup; the four uBytes // are the three encoded BCD8 digits followed by a 1-byte length // (significant digits, except that 000 has length 0). This allows // us to left-align the first declet with non-zero content, then // the remaining ones are full 3-char length. Fixed-length copies // are used because variable-length memcpy causes a subroutine call // in at least two compilers. (The copies are length 4 for speed // and are safe because the last item in the array is of length // three and has the length byte following.) #define dpd2char(dpdin) u=&DPD2BCD8[((dpdin)&0x3ff)*4]; \ if (c!=cstart) {UBFROMUI(c, UBTOUI(u)|CHARMASK); c+=3;} \ else if (*(u+3)) { \ UBFROMUI(c, UBTOUI(u+3-*(u+3))|CHARMASK); c+=*(u+3);} #if DECPMAX==7 dpd2char(sourhi>>10); // declet 1 dpd2char(sourhi); // declet 2 #elif DECPMAX==16 dpd2char(sourhi>>8); // declet 1 dpd2char((sourhi<<2) | (sourlo>>30)); // declet 2 dpd2char(sourlo>>20); // declet 3 dpd2char(sourlo>>10); // declet 4 dpd2char(sourlo); // declet 5 #elif DECPMAX==34 dpd2char(sourhi>>4); // declet 1 dpd2char((sourhi<<6) | (sourmh>>26)); // declet 2 dpd2char(sourmh>>16); // declet 3 dpd2char(sourmh>>6); // declet 4 dpd2char((sourmh<<4) | (sourml>>28)); // declet 5 dpd2char(sourml>>18); // declet 6 dpd2char(sourml>>8); // declet 7 dpd2char((sourml<<2) | (sourlo>>30)); // declet 8 dpd2char(sourlo>>20); // declet 9 dpd2char(sourlo>>10); // declet 10 dpd2char(sourlo); // declet 11 #endif if (c==cstart) *c++='0'; // all zeros, empty -- make "0" if (exp==0) { // integer or NaN case -- easy *c='\0'; // terminate return string; } /* non-0 exponent */ e=0; // assume no E pre=(Int)(c-cstart)+exp; // length+exp [c->LSD+1] // [here, pre-exp is the digits count (==1 for zero)] if (exp>0 || pre<-5) { // need exponential form e=pre-1; // calculate E value pre=1; // assume one digit before '.' if (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 (!DFISZERO(df)) pre+=adj; else { // is zero if (adj!=0) { // 0.00Esnn needed e=e+3; pre=-(2-adj); } } // zero } // engineering adjustment } // exponential form // printf("e=%ld pre=%ld exp=%ld\n", (LI)e, (LI)pre, (LI)exp); /* modify the coefficient, adding 0s, '.', and E+nn as needed */ if (pre>0) { // ddd.ddd (plain), perhaps with E // or dd00 padding for engineering char *dotat=cstart+pre; if (dotat=dotat; s-=4, t-=4) UBFROMUI(t, UBTOUI(s)); *dotat='.'; c++; // length increased by one } // need dot? else for (; c0 else { /* -5<=pre<=0: here for plain 0.ddd or 0.000ddd forms (may have E, but only for 0.00E+3 kind of case -- with plenty of spare space in this case */ pre=-pre+2; // gap width, including "0." t=cstart+ROUNDDOWN4(c-cstart)+pre; // preferred first target point // backoff if too far to the right if (t>string+DECSTRING-5) t=string+DECSTRING-5; // adjust to fit // now shift the entire coefficient to the right, being careful not // to access to the left of string [cannot use memcpy] for (s=t-pre; s>=string; s-=4, t-=4) UBFROMUI(t, UBTOUI(s)); // for Quads and Singles there may be a character or two left... s+=3; // where next would come from for(; s>=cstart; s--, t--) *(t+3)=*(s); // now have fill 0. through 0.00000; use overlaps to avoid tests if (pre>=4) { memcpy(cstart+pre-4, "0000", 4); memcpy(cstart, "0.00", 4); } else { // 2 or 3 *(cstart+pre-1)='0'; memcpy(cstart, "0.", 2); } c+=pre; // to end } // finally add the E-part, if needed; it will never be 0, and has // a maximum length of 3 or 4 digits (asserted above) if (e!=0) { memcpy(c, "E+", 2); // starts with E, assume + c++; if (e<0) { *c='-'; // oops, need '-' e=-e; // uInt, please } c++; // Three-character exponents are easy; 4-character a little trickier #if DECEMAXD<=3 u=&BIN2BCD8[e*4]; // -> 3 digits + length byte // copy fixed 4 characters [is safe], starting at non-zero // and with character mask to convert BCD to char UBFROMUI(c, UBTOUI(u+3-*(u+3))|CHARMASK); c+=*(u+3); // bump pointer appropriately #elif DECEMAXD==4 if (e<1000) { // 3 (or fewer) digits case u=&BIN2BCD8[e*4]; // -> 3 digits + length byte UBFROMUI(c, UBTOUI(u+3-*(u+3))|CHARMASK); // [as above] c+=*(u+3); // bump pointer appropriately } else { // 4-digits Int thou=((e>>3)*1049)>>17; // e/1000 Int rem=e-(1000*thou); // e%1000 *c++=(char)('0'+(char)thou); // the thousands digit u=&BIN2BCD8[rem*4]; // -> 3 digits + length byte UBFROMUI(c, UBTOUI(u)|CHARMASK);// copy fixed 3+1 characters [is safe] c+=3; // bump pointer, always 3 digits } #endif } *c='\0'; // terminate //printf("res %s\n", string); return string; } // decFloatToEngString /* ------------------------------------------------------------------ */ /* decFloatToPacked -- convert decFloat to Packed decimal + exponent */ /* */ /* df is the source decFloat */ /* exp will be set to the unbiased exponent, q, or to a special */ /* value in the form returned by decFloatGetExponent */ /* packed is where DECPMAX nibbles will be written with the sign as */ /* final nibble (0x0c for +, 0x0d for -); a NaN has a first nibble */ /* of zero, and an infinity is all zeros. decDouble and decQuad */ /* have a additional leading zero nibble, leading to result */ /* lengths of 4, 9, and 18 bytes. */ /* returns the sign of the coefficient (DECFLOAT_Sign if negative, */ /* 0 otherwise) */ /* */ /* No error is possible, and no status will be set. */ /* ------------------------------------------------------------------ */ Int decFloatToPacked(const decFloat *df, Int *exp, uByte *packed) { uByte bcdar[DECPMAX+2]; // work buffer uByte *ip=bcdar, *op=packed; // work pointers if (DFISINF(df)) { memset(bcdar, 0, DECPMAX+2); *exp=DECFLOAT_Inf; } else { GETCOEFF(df, bcdar+1); // use macro if (DFISNAN(df)) { bcdar[1]=0; // MSD needs clearing *exp=DFWORD(df, 0)&0x7e000000; } else { // finite *exp=GETEXPUN(df); } } // now pack; coefficient currently at bcdar+1 #if SINGLE ip++; // ignore first byte #else *ip=0; // need leading zero #endif // set final byte to Packed BCD sign value bcdar[DECPMAX+1]=(DFISSIGNED(df) ? DECPMINUS : DECPPLUS); // pack an even number of bytes... for (; op>26; // sign+combination field msd=DECCOMBMSD[comb]; // decode the combination field exp=DECCOMBEXP[comb]; // .. if (!EXPISSPECIAL(exp)) { // finite // complete exponent; top two bits are in place exp+=GETECON(df)-DECBIAS; // .. + continuation and unbias } else { // IS special if (exp==DECFLOAT_Inf) { // infinity strcpy(c, "Infinity"); return string; // easy } if (sourhi&0x02000000) *c++='s'; // sNaN strcpy(c, "NaN"); // complete word c+=3; // step past // quick exit if the payload is zero #if DECPMAX==7 if ((sourhi&0x000fffff)==0) return string; #elif DECPMAX==16 if (sourlo==0 && (sourhi&0x0003ffff)==0) return string; #elif DECPMAX==34 if (sourlo==0 && sourml==0 && sourmh==0 && (sourhi&0x00003fff)==0) return string; #endif // otherwise drop through to add integer; set correct exp etc. exp=0; msd=0; // setup for following code } /* convert the digits of the significand to characters */ cstart=c; // save start of coefficient if (msd) *c++=(char)('0'+(char)msd); // non-zero most significant digit // Decode the declets. After extracting each declet, it is // decoded to a 4-uByte sequence by table lookup; the four uBytes // are the three encoded BCD8 digits followed by a 1-byte length // (significant digits, except that 000 has length 0). This allows // us to left-align the first declet with non-zero content, then // the remaining ones are full 3-char length. Fixed-length copies // are used because variable-length memcpy causes a subroutine call // in at least two compilers. (The copies are length 4 for speed // and are safe because the last item in the array is of length // three and has the length byte following.) #define dpd2char(dpdin) u=&DPD2BCD8[((dpdin)&0x3ff)*4]; \ if (c!=cstart) {UBFROMUI(c, UBTOUI(u)|CHARMASK); c+=3;} \ else if (*(u+3)) { \ UBFROMUI(c, UBTOUI(u+3-*(u+3))|CHARMASK); c+=*(u+3);} #if DECPMAX==7 dpd2char(sourhi>>10); // declet 1 dpd2char(sourhi); // declet 2 #elif DECPMAX==16 dpd2char(sourhi>>8); // declet 1 dpd2char((sourhi<<2) | (sourlo>>30)); // declet 2 dpd2char(sourlo>>20); // declet 3 dpd2char(sourlo>>10); // declet 4 dpd2char(sourlo); // declet 5 #elif DECPMAX==34 dpd2char(sourhi>>4); // declet 1 dpd2char((sourhi<<6) | (sourmh>>26)); // declet 2 dpd2char(sourmh>>16); // declet 3 dpd2char(sourmh>>6); // declet 4 dpd2char((sourmh<<4) | (sourml>>28)); // declet 5 dpd2char(sourml>>18); // declet 6 dpd2char(sourml>>8); // declet 7 dpd2char((sourml<<2) | (sourlo>>30)); // declet 8 dpd2char(sourlo>>20); // declet 9 dpd2char(sourlo>>10); // declet 10 dpd2char(sourlo); // declet 11 #endif if (c==cstart) *c++='0'; // all zeros, empty -- make "0" //[This fast path is valid but adds 3-5 cycles to worst case length] //if (exp==0) { // integer or NaN case -- easy // *c='\0'; // terminate // return string; // } e=0; // assume no E pre=(Int)(c-cstart)+exp; // length+exp [c->LSD+1] // [here, pre-exp is the digits count (==1 for zero)] if (exp>0 || pre<-5) { // need exponential form e=pre-1; // calculate E value pre=1; // assume one digit before '.' } // exponential form /* modify the coefficient, adding 0s, '.', and E+nn as needed */ if (pre>0) { // ddd.ddd (plain), perhaps with E char *dotat=cstart+pre; if (dotat=dotat; s-=4, t-=4) UBFROMUI(t, UBTOUI(s)); *dotat='.'; c++; // length increased by one } // need dot? // finally add the E-part, if needed; it will never be 0, and has // a maximum length of 3 or 4 digits (asserted above) if (e!=0) { memcpy(c, "E+", 2); // starts with E, assume + c++; if (e<0) { *c='-'; // oops, need '-' e=-e; // uInt, please } c++; // Three-character exponents are easy; 4-character a little trickier #if DECEMAXD<=3 u=&BIN2BCD8[e*4]; // -> 3 digits + length byte // copy fixed 4 characters [is safe], starting at non-zero // and with character mask to convert BCD to char UBFROMUI(c, UBTOUI(u+3-*(u+3))|CHARMASK); c+=*(u+3); // bump pointer appropriately #elif DECEMAXD==4 if (e<1000) { // 3 (or fewer) digits case u=&BIN2BCD8[e*4]; // -> 3 digits + length byte UBFROMUI(c, UBTOUI(u+3-*(u+3))|CHARMASK); // [as above] c+=*(u+3); // bump pointer appropriately } else { // 4-digits Int thou=((e>>3)*1049)>>17; // e/1000 Int rem=e-(1000*thou); // e%1000 *c++=(char)('0'+(char)thou); // the thousands digit u=&BIN2BCD8[rem*4]; // -> 3 digits + length byte UBFROMUI(c, UBTOUI(u)|CHARMASK); // copy fixed 3+1 characters [is safe] c+=3; // bump pointer, always 3 digits } #endif } *c='\0'; // add terminator //printf("res %s\n", string); return string; } // pre>0 /* -5<=pre<=0: here for plain 0.ddd or 0.000ddd forms (can never have E) */ // Surprisingly, this is close to being the worst-case path, so the // shift is done by fours; this is a little tricky because the // rightmost character to be written must not be beyond where the // rightmost terminator could be -- so backoff to not touch // terminator position if need be (this can make exact alignments // for full Doubles, but in some cases needs care not to access too // far to the left) pre=-pre+2; // gap width, including "0." t=cstart+ROUNDDOWN4(c-cstart)+pre; // preferred first target point // backoff if too far to the right if (t>string+DECSTRING-5) t=string+DECSTRING-5; // adjust to fit // now shift the entire coefficient to the right, being careful not // to access to the left of string [cannot use memcpy] for (s=t-pre; s>=string; s-=4, t-=4) UBFROMUI(t, UBTOUI(s)); // for Quads and Singles there may be a character or two left... s+=3; // where next would come from for(; s>=cstart; s--, t--) *(t+3)=*(s); // now have fill 0. through 0.00000; use overlaps to avoid tests if (pre>=4) { memcpy(cstart+pre-4, "0000", 4); memcpy(cstart, "0.00", 4); } else { // 2 or 3 *(cstart+pre-1)='0'; memcpy(cstart, "0.", 2); } *(c+pre)='\0'; // terminate return string; } // decFloatToString /* ------------------------------------------------------------------ */ /* decFloatToWider -- conversion to next-wider format */ /* */ /* source is the decFloat format number which gets the result of */ /* the conversion */ /* wider is the decFloatWider format number which will be narrowed */ /* returns wider */ /* */ /* Widening is always exact; no status is set (sNaNs are copied and */ /* do not signal). The result will be canonical if the source is, */ /* and may or may not be if the source is not. */ /* ------------------------------------------------------------------ */ // widening is not possible for decQuad format numbers; simply omit #if !QUAD decFloatWider * decFloatToWider(const decFloat *source, decFloatWider *wider) { uInt msd; /* Construct and copy the sign word */ if (DFISSPECIAL(source)) { // copy sign, combination, and first bit of exponent (sNaN selector) DFWWORD(wider, 0)=DFWORD(source, 0)&0xfe000000; msd=0; } else { // is finite number uInt exp=GETEXPUN(source)+DECWBIAS; // get unbiased exponent and rebias uInt code=(exp>>DECWECONL)<<29; // set two bits of exp [msd=0] code|=(exp<<(32-6-DECWECONL)) & 0x03ffffff; // add exponent continuation code|=DFWORD(source, 0)&0x80000000; // add sign DFWWORD(wider, 0)=code; // .. and place top word in wider msd=GETMSD(source); // get source coefficient MSD [0-9] } /* Copy the coefficient and clear any 'unused' words to left */ #if SINGLE DFWWORD(wider, 1)=(DFWORD(source, 0)&0x000fffff)|(msd<<20); #elif DOUBLE DFWWORD(wider, 2)=(DFWORD(source, 0)&0x0003ffff)|(msd<<18); DFWWORD(wider, 3)=DFWORD(source, 1); DFWWORD(wider, 1)=0; #endif return wider; } // decFloatToWider #endif /* ------------------------------------------------------------------ */ /* decFloatVersion -- return package version string */ /* */ /* returns a constant string describing this package */ /* ------------------------------------------------------------------ */ const char *decFloatVersion(void) { return DECVERSION; } // decFloatVersion /* ------------------------------------------------------------------ */ /* decFloatZero -- set to canonical (integer) zero */ /* */ /* df is the decFloat format number to integer +0 (q=0, c=+0) */ /* returns df */ /* */ /* No error is possible, and no status can be set. */ /* ------------------------------------------------------------------ */ decFloat * decFloatZero(decFloat *df){ DFWORD(df, 0)=ZEROWORD; // set appropriate top word #if DOUBLE || QUAD DFWORD(df, 1)=0; #if QUAD DFWORD(df, 2)=0; DFWORD(df, 3)=0; #endif #endif // decFloatShow(df, "zero"); return df; } // decFloatZero /* ------------------------------------------------------------------ */ /* Private generic function (not format-specific) for development use */ /* ------------------------------------------------------------------ */ // This is included once only, for all to use #if QUAD && (DECCHECK || DECTRACE) /* ---------------------------------------------------------------- */ /* decShowNum -- display bcd8 number in debug form */ /* */ /* num is the bcdnum to display */ /* tag is a string to label the display */ /* ---------------------------------------------------------------- */ void decShowNum(const bcdnum *num, const char *tag) { const char *csign="+"; // sign character uByte *ub; // work uInt uiwork; // for macros if (num->sign==DECFLOAT_Sign) csign="-"; printf(">%s> ", tag); if (num->exponent==DECFLOAT_Inf) printf("%sInfinity", csign); else if (num->exponent==DECFLOAT_qNaN) printf("%sqNaN", csign); else if (num->exponent==DECFLOAT_sNaN) printf("%ssNaN", csign); else { // finite char qbuf[10]; // for right-aligned q char *c; // work const uByte *u; // .. Int e=num->exponent; // .. exponent strcpy(qbuf, "q="); c=&qbuf[2]; // where exponent will go // lay out the exponent if (e<0) { *c++='-'; // add '-' e=-e; // uInt, please } #if DECEMAXD>4 #error Exponent form is too long for ShowNum to lay out #endif if (e==0) *c++='0'; // 0-length case else if (e<1000) { // 3 (or fewer) digits case u=&BIN2BCD8[e*4]; // -> 3 digits + length byte UBFROMUI(c, UBTOUI(u+3-*(u+3))|CHARMASK); // [as above] c+=*(u+3); // bump pointer appropriately } else { // 4-digits Int thou=((e>>3)*1049)>>17; // e/1000 Int rem=e-(1000*thou); // e%1000 *c++=(char)('0'+(char)thou); // the thousands digit u=&BIN2BCD8[rem*4]; // -> 3 digits + length byte UBFROMUI(c, UBTOUI(u)|CHARMASK); // copy fixed 3+1 characters [is safe] c+=3; // bump pointer, always 3 digits } *c='\0'; // add terminator printf("%7s c=%s", qbuf, csign); } if (!EXPISSPECIAL(num->exponent) || num->msd!=num->lsd || *num->lsd!=0) { for (ub=num->msd; ub<=num->lsd; ub++) { // coefficient... printf("%1x", *ub); if ((num->lsd-ub)%3==0 && ub!=num->lsd) printf(" "); // 4-space } } printf("\n"); } // decShowNum #endif jq-jq-1.8.0/vendor/decNumber/decContext.c000066400000000000000000000577431501676513100202340ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* 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-jq-1.8.0/vendor/decNumber/decContext.h000066400000000000000000000310241501676513100202210ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* 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-jq-1.8.0/vendor/decNumber/decDPD.h000066400000000000000000002730661501676513100172220ustar00rootroot00000000000000/* ------------------------------------------------------------------------ */ /* Binary Coded Decimal and Densely Packed Decimal conversion lookup tables */ /* [Automatically generated -- do not edit. 2008.06.21] */ /* ------------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2008. All rights reserved. */ /* ------------------------------------------------------------------------ */ /* For details, see DPDecimal.html on the General Decimal Arithmetic page. */ /* */ /* This include file defines several DPD and BCD conversion tables: */ /* */ /* uint16_t BCD2DPD[2458]; -- BCD -> DPD (0x999 => 2457) */ /* uint16_t BIN2DPD[1000]; -- Bin -> DPD (999 => 2457) */ /* uint8_t BIN2CHAR[4001]; -- Bin -> CHAR (999 => '\3' '9' '9' '9') */ /* uint8_t BIN2BCD8[4000]; -- Bin -> bytes (999 => 9 9 9 3) */ /* uint16_t DPD2BCD[1024]; -- DPD -> BCD (0x3FF => 0x999) */ /* uint16_t DPD2BIN[1024]; -- DPD -> BIN (0x3FF => 999) */ /* uint32_t DPD2BINK[1024]; -- DPD -> BIN * 1000 (0x3FF => 999000) */ /* uint32_t DPD2BINM[1024]; -- DPD -> BIN * 1E+6 (0x3FF => 999000000) */ /* uint8_t DPD2BCD8[4096]; -- DPD -> bytes (x3FF => 9 9 9 3) */ /* */ /* In all cases the result (10 bits or 12 bits, or binary) is right-aligned */ /* in the table entry. BIN2CHAR entries are a single byte length (0 for */ /* value 0) followed by three digit characters; a trailing terminator is */ /* included to allow 4-char moves always. BIN2BCD8 and DPD2BCD8 entries */ /* are similar with the three BCD8 digits followed by a one-byte length */ /* (again, length=0 for value 0). */ /* */ /* To use a table, its name, prefixed with DEC_, must be defined with a */ /* value of 1 before this header file is included. For example: */ /* #define DEC_BCD2DPD 1 */ /* This mechanism allows software to only include tables that are needed. */ /* ------------------------------------------------------------------------ */ #if defined(DEC_BCD2DPD) && DEC_BCD2DPD==1 && !defined(DECBCD2DPD) #define DECBCD2DPD const uint16_t BCD2DPD[2458]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, 0, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 0, 0, 0, 0, 0, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 0, 0, 0, 0, 0, 0, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 0, 0, 0, 0, 0, 0, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 0, 0, 0, 0, 0, 0, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 0, 0, 0, 0, 0, 0, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 0, 0, 0, 0, 0, 0, 10, 11, 42, 43, 74, 75, 106, 107, 78, 79, 0, 0, 0, 0, 0, 0, 26, 27, 58, 59, 90, 91, 122, 123, 94, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 0, 0, 0, 0, 0, 0, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 0, 0, 0, 0, 0, 0, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 0, 0, 0, 0, 0, 0, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 0, 0, 0, 0, 0, 0, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 0, 0, 0, 0, 0, 0, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 0, 0, 0, 0, 0, 0, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 0, 0, 0, 0, 0, 0, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 0, 0, 0, 0, 0, 0, 138, 139, 170, 171, 202, 203, 234, 235, 206, 207, 0, 0, 0, 0, 0, 0, 154, 155, 186, 187, 218, 219, 250, 251, 222, 223, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 0, 0, 0, 0, 0, 0, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 0, 0, 0, 0, 0, 0, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 0, 0, 0, 0, 0, 0, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 0, 0, 0, 0, 0, 0, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 0, 0, 0, 0, 0, 0, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 0, 0, 0, 0, 0, 0, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 0, 0, 0, 0, 0, 0, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 0, 0, 0, 0, 0, 0, 266, 267, 298, 299, 330, 331, 362, 363, 334, 335, 0, 0, 0, 0, 0, 0, 282, 283, 314, 315, 346, 347, 378, 379, 350, 351, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 0, 0, 0, 0, 0, 0, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 0, 0, 0, 0, 0, 0, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 0, 0, 0, 0, 0, 0, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 0, 0, 0, 0, 0, 0, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 0, 0, 0, 0, 0, 0, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 0, 0, 0, 0, 0, 0, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 0, 0, 0, 0, 0, 0, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 0, 0, 0, 0, 0, 0, 394, 395, 426, 427, 458, 459, 490, 491, 462, 463, 0, 0, 0, 0, 0, 0, 410, 411, 442, 443, 474, 475, 506, 507, 478, 479, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 0, 0, 0, 0, 0, 0, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 0, 0, 0, 0, 0, 0, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 0, 0, 0, 0, 0, 0, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 0, 0, 0, 0, 0, 0, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 0, 0, 0, 0, 0, 0, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 0, 0, 0, 0, 0, 0, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 0, 0, 0, 0, 0, 0, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 0, 0, 0, 0, 0, 0, 522, 523, 554, 555, 586, 587, 618, 619, 590, 591, 0, 0, 0, 0, 0, 0, 538, 539, 570, 571, 602, 603, 634, 635, 606, 607, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 0, 0, 0, 0, 0, 0, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 0, 0, 0, 0, 0, 0, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 0, 0, 0, 0, 0, 0, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 0, 0, 0, 0, 0, 0, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 0, 0, 0, 0, 0, 0, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 0, 0, 0, 0, 0, 0, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 0, 0, 0, 0, 0, 0, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 0, 0, 0, 0, 0, 0, 650, 651, 682, 683, 714, 715, 746, 747, 718, 719, 0, 0, 0, 0, 0, 0, 666, 667, 698, 699, 730, 731, 762, 763, 734, 735, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 0, 0, 0, 0, 0, 0, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 0, 0, 0, 0, 0, 0, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 0, 0, 0, 0, 0, 0, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 0, 0, 0, 0, 0, 0, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 0, 0, 0, 0, 0, 0, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 0, 0, 0, 0, 0, 0, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 0, 0, 0, 0, 0, 0, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 0, 0, 0, 0, 0, 0, 778, 779, 810, 811, 842, 843, 874, 875, 846, 847, 0, 0, 0, 0, 0, 0, 794, 795, 826, 827, 858, 859, 890, 891, 862, 863, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 0, 0, 0, 0, 0, 0, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 0, 0, 0, 0, 0, 0, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 0, 0, 0, 0, 0, 0, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 0, 0, 0, 0, 0, 0, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 0, 0, 0, 0, 0, 0, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 0, 0, 0, 0, 0, 0, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 0, 0, 0, 0, 0, 0, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 0, 0, 0, 0, 0, 0, 906, 907, 938, 939, 970, 971, 1002, 1003, 974, 975, 0, 0, 0, 0, 0, 0, 922, 923, 954, 955, 986, 987, 1018, 1019, 990, 991, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12, 13, 268, 269, 524, 525, 780, 781, 46, 47, 0, 0, 0, 0, 0, 0, 28, 29, 284, 285, 540, 541, 796, 797, 62, 63, 0, 0, 0, 0, 0, 0, 44, 45, 300, 301, 556, 557, 812, 813, 302, 303, 0, 0, 0, 0, 0, 0, 60, 61, 316, 317, 572, 573, 828, 829, 318, 319, 0, 0, 0, 0, 0, 0, 76, 77, 332, 333, 588, 589, 844, 845, 558, 559, 0, 0, 0, 0, 0, 0, 92, 93, 348, 349, 604, 605, 860, 861, 574, 575, 0, 0, 0, 0, 0, 0, 108, 109, 364, 365, 620, 621, 876, 877, 814, 815, 0, 0, 0, 0, 0, 0, 124, 125, 380, 381, 636, 637, 892, 893, 830, 831, 0, 0, 0, 0, 0, 0, 14, 15, 270, 271, 526, 527, 782, 783, 110, 111, 0, 0, 0, 0, 0, 0, 30, 31, 286, 287, 542, 543, 798, 799, 126, 127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 140, 141, 396, 397, 652, 653, 908, 909, 174, 175, 0, 0, 0, 0, 0, 0, 156, 157, 412, 413, 668, 669, 924, 925, 190, 191, 0, 0, 0, 0, 0, 0, 172, 173, 428, 429, 684, 685, 940, 941, 430, 431, 0, 0, 0, 0, 0, 0, 188, 189, 444, 445, 700, 701, 956, 957, 446, 447, 0, 0, 0, 0, 0, 0, 204, 205, 460, 461, 716, 717, 972, 973, 686, 687, 0, 0, 0, 0, 0, 0, 220, 221, 476, 477, 732, 733, 988, 989, 702, 703, 0, 0, 0, 0, 0, 0, 236, 237, 492, 493, 748, 749, 1004, 1005, 942, 943, 0, 0, 0, 0, 0, 0, 252, 253, 508, 509, 764, 765, 1020, 1021, 958, 959, 0, 0, 0, 0, 0, 0, 142, 143, 398, 399, 654, 655, 910, 911, 238, 239, 0, 0, 0, 0, 0, 0, 158, 159, 414, 415, 670, 671, 926, 927, 254, 255}; #endif #if defined(DEC_DPD2BCD) && DEC_DPD2BCD==1 && !defined(DECDPD2BCD) #define DECDPD2BCD const uint16_t DPD2BCD[1024]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 128, 129, 2048, 2049, 2176, 2177, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 144, 145, 2064, 2065, 2192, 2193, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 130, 131, 2080, 2081, 2056, 2057, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 146, 147, 2096, 2097, 2072, 2073, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 132, 133, 2112, 2113, 136, 137, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 148, 149, 2128, 2129, 152, 153, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 134, 135, 2144, 2145, 2184, 2185, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 150, 151, 2160, 2161, 2200, 2201, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 384, 385, 2304, 2305, 2432, 2433, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 400, 401, 2320, 2321, 2448, 2449, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 386, 387, 2336, 2337, 2312, 2313, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 402, 403, 2352, 2353, 2328, 2329, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 388, 389, 2368, 2369, 392, 393, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 404, 405, 2384, 2385, 408, 409, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 390, 391, 2400, 2401, 2440, 2441, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 406, 407, 2416, 2417, 2456, 2457, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 640, 641, 2050, 2051, 2178, 2179, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 656, 657, 2066, 2067, 2194, 2195, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 642, 643, 2082, 2083, 2088, 2089, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 658, 659, 2098, 2099, 2104, 2105, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 644, 645, 2114, 2115, 648, 649, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 660, 661, 2130, 2131, 664, 665, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 646, 647, 2146, 2147, 2184, 2185, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 662, 663, 2162, 2163, 2200, 2201, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 896, 897, 2306, 2307, 2434, 2435, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 912, 913, 2322, 2323, 2450, 2451, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 898, 899, 2338, 2339, 2344, 2345, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 914, 915, 2354, 2355, 2360, 2361, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 900, 901, 2370, 2371, 904, 905, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 916, 917, 2386, 2387, 920, 921, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 902, 903, 2402, 2403, 2440, 2441, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 918, 919, 2418, 2419, 2456, 2457, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1152, 1153, 2052, 2053, 2180, 2181, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1168, 1169, 2068, 2069, 2196, 2197, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1154, 1155, 2084, 2085, 2120, 2121, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1170, 1171, 2100, 2101, 2136, 2137, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1156, 1157, 2116, 2117, 1160, 1161, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1172, 1173, 2132, 2133, 1176, 1177, 1120, 1121, 1122, 1123, 1124, 1125, 1126, 1127, 1128, 1129, 1158, 1159, 2148, 2149, 2184, 2185, 1136, 1137, 1138, 1139, 1140, 1141, 1142, 1143, 1144, 1145, 1174, 1175, 2164, 2165, 2200, 2201, 1280, 1281, 1282, 1283, 1284, 1285, 1286, 1287, 1288, 1289, 1408, 1409, 2308, 2309, 2436, 2437, 1296, 1297, 1298, 1299, 1300, 1301, 1302, 1303, 1304, 1305, 1424, 1425, 2324, 2325, 2452, 2453, 1312, 1313, 1314, 1315, 1316, 1317, 1318, 1319, 1320, 1321, 1410, 1411, 2340, 2341, 2376, 2377, 1328, 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1426, 1427, 2356, 2357, 2392, 2393, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1412, 1413, 2372, 2373, 1416, 1417, 1360, 1361, 1362, 1363, 1364, 1365, 1366, 1367, 1368, 1369, 1428, 1429, 2388, 2389, 1432, 1433, 1376, 1377, 1378, 1379, 1380, 1381, 1382, 1383, 1384, 1385, 1414, 1415, 2404, 2405, 2440, 2441, 1392, 1393, 1394, 1395, 1396, 1397, 1398, 1399, 1400, 1401, 1430, 1431, 2420, 2421, 2456, 2457, 1536, 1537, 1538, 1539, 1540, 1541, 1542, 1543, 1544, 1545, 1664, 1665, 2054, 2055, 2182, 2183, 1552, 1553, 1554, 1555, 1556, 1557, 1558, 1559, 1560, 1561, 1680, 1681, 2070, 2071, 2198, 2199, 1568, 1569, 1570, 1571, 1572, 1573, 1574, 1575, 1576, 1577, 1666, 1667, 2086, 2087, 2152, 2153, 1584, 1585, 1586, 1587, 1588, 1589, 1590, 1591, 1592, 1593, 1682, 1683, 2102, 2103, 2168, 2169, 1600, 1601, 1602, 1603, 1604, 1605, 1606, 1607, 1608, 1609, 1668, 1669, 2118, 2119, 1672, 1673, 1616, 1617, 1618, 1619, 1620, 1621, 1622, 1623, 1624, 1625, 1684, 1685, 2134, 2135, 1688, 1689, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1639, 1640, 1641, 1670, 1671, 2150, 2151, 2184, 2185, 1648, 1649, 1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1686, 1687, 2166, 2167, 2200, 2201, 1792, 1793, 1794, 1795, 1796, 1797, 1798, 1799, 1800, 1801, 1920, 1921, 2310, 2311, 2438, 2439, 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, 1817, 1936, 1937, 2326, 2327, 2454, 2455, 1824, 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1922, 1923, 2342, 2343, 2408, 2409, 1840, 1841, 1842, 1843, 1844, 1845, 1846, 1847, 1848, 1849, 1938, 1939, 2358, 2359, 2424, 2425, 1856, 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1924, 1925, 2374, 2375, 1928, 1929, 1872, 1873, 1874, 1875, 1876, 1877, 1878, 1879, 1880, 1881, 1940, 1941, 2390, 2391, 1944, 1945, 1888, 1889, 1890, 1891, 1892, 1893, 1894, 1895, 1896, 1897, 1926, 1927, 2406, 2407, 2440, 2441, 1904, 1905, 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, 1942, 1943, 2422, 2423, 2456, 2457}; #endif #if defined(DEC_BIN2DPD) && DEC_BIN2DPD==1 && !defined(DECBIN2DPD) #define DECBIN2DPD const uint16_t BIN2DPD[1000]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 10, 11, 42, 43, 74, 75, 106, 107, 78, 79, 26, 27, 58, 59, 90, 91, 122, 123, 94, 95, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 138, 139, 170, 171, 202, 203, 234, 235, 206, 207, 154, 155, 186, 187, 218, 219, 250, 251, 222, 223, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 266, 267, 298, 299, 330, 331, 362, 363, 334, 335, 282, 283, 314, 315, 346, 347, 378, 379, 350, 351, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 464, 465, 466, 467, 468, 469, 470, 471, 472, 473, 480, 481, 482, 483, 484, 485, 486, 487, 488, 489, 496, 497, 498, 499, 500, 501, 502, 503, 504, 505, 394, 395, 426, 427, 458, 459, 490, 491, 462, 463, 410, 411, 442, 443, 474, 475, 506, 507, 478, 479, 512, 513, 514, 515, 516, 517, 518, 519, 520, 521, 528, 529, 530, 531, 532, 533, 534, 535, 536, 537, 544, 545, 546, 547, 548, 549, 550, 551, 552, 553, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 576, 577, 578, 579, 580, 581, 582, 583, 584, 585, 592, 593, 594, 595, 596, 597, 598, 599, 600, 601, 608, 609, 610, 611, 612, 613, 614, 615, 616, 617, 624, 625, 626, 627, 628, 629, 630, 631, 632, 633, 522, 523, 554, 555, 586, 587, 618, 619, 590, 591, 538, 539, 570, 571, 602, 603, 634, 635, 606, 607, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 656, 657, 658, 659, 660, 661, 662, 663, 664, 665, 672, 673, 674, 675, 676, 677, 678, 679, 680, 681, 688, 689, 690, 691, 692, 693, 694, 695, 696, 697, 704, 705, 706, 707, 708, 709, 710, 711, 712, 713, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 736, 737, 738, 739, 740, 741, 742, 743, 744, 745, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 650, 651, 682, 683, 714, 715, 746, 747, 718, 719, 666, 667, 698, 699, 730, 731, 762, 763, 734, 735, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 784, 785, 786, 787, 788, 789, 790, 791, 792, 793, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 816, 817, 818, 819, 820, 821, 822, 823, 824, 825, 832, 833, 834, 835, 836, 837, 838, 839, 840, 841, 848, 849, 850, 851, 852, 853, 854, 855, 856, 857, 864, 865, 866, 867, 868, 869, 870, 871, 872, 873, 880, 881, 882, 883, 884, 885, 886, 887, 888, 889, 778, 779, 810, 811, 842, 843, 874, 875, 846, 847, 794, 795, 826, 827, 858, 859, 890, 891, 862, 863, 896, 897, 898, 899, 900, 901, 902, 903, 904, 905, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 928, 929, 930, 931, 932, 933, 934, 935, 936, 937, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 976, 977, 978, 979, 980, 981, 982, 983, 984, 985, 992, 993, 994, 995, 996, 997, 998, 999, 1000, 1001, 1008, 1009, 1010, 1011, 1012, 1013, 1014, 1015, 1016, 1017, 906, 907, 938, 939, 970, 971, 1002, 1003, 974, 975, 922, 923, 954, 955, 986, 987, 1018, 1019, 990, 991, 12, 13, 268, 269, 524, 525, 780, 781, 46, 47, 28, 29, 284, 285, 540, 541, 796, 797, 62, 63, 44, 45, 300, 301, 556, 557, 812, 813, 302, 303, 60, 61, 316, 317, 572, 573, 828, 829, 318, 319, 76, 77, 332, 333, 588, 589, 844, 845, 558, 559, 92, 93, 348, 349, 604, 605, 860, 861, 574, 575, 108, 109, 364, 365, 620, 621, 876, 877, 814, 815, 124, 125, 380, 381, 636, 637, 892, 893, 830, 831, 14, 15, 270, 271, 526, 527, 782, 783, 110, 111, 30, 31, 286, 287, 542, 543, 798, 799, 126, 127, 140, 141, 396, 397, 652, 653, 908, 909, 174, 175, 156, 157, 412, 413, 668, 669, 924, 925, 190, 191, 172, 173, 428, 429, 684, 685, 940, 941, 430, 431, 188, 189, 444, 445, 700, 701, 956, 957, 446, 447, 204, 205, 460, 461, 716, 717, 972, 973, 686, 687, 220, 221, 476, 477, 732, 733, 988, 989, 702, 703, 236, 237, 492, 493, 748, 749, 1004, 1005, 942, 943, 252, 253, 508, 509, 764, 765, 1020, 1021, 958, 959, 142, 143, 398, 399, 654, 655, 910, 911, 238, 239, 158, 159, 414, 415, 670, 671, 926, 927, 254, 255}; #endif #if defined(DEC_DPD2BIN) && DEC_DPD2BIN==1 && !defined(DECDPD2BIN) #define DECDPD2BIN const uint16_t DPD2BIN[1024]={ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 80, 81, 800, 801, 880, 881, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 90, 91, 810, 811, 890, 891, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 82, 83, 820, 821, 808, 809, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 92, 93, 830, 831, 818, 819, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 84, 85, 840, 841, 88, 89, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 94, 95, 850, 851, 98, 99, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 86, 87, 860, 861, 888, 889, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 96, 97, 870, 871, 898, 899, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 180, 181, 900, 901, 980, 981, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 190, 191, 910, 911, 990, 991, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 182, 183, 920, 921, 908, 909, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 192, 193, 930, 931, 918, 919, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 184, 185, 940, 941, 188, 189, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 194, 195, 950, 951, 198, 199, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 186, 187, 960, 961, 988, 989, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 196, 197, 970, 971, 998, 999, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 280, 281, 802, 803, 882, 883, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 290, 291, 812, 813, 892, 893, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 282, 283, 822, 823, 828, 829, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 292, 293, 832, 833, 838, 839, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 284, 285, 842, 843, 288, 289, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 294, 295, 852, 853, 298, 299, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 286, 287, 862, 863, 888, 889, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 296, 297, 872, 873, 898, 899, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 380, 381, 902, 903, 982, 983, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 390, 391, 912, 913, 992, 993, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 382, 383, 922, 923, 928, 929, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 392, 393, 932, 933, 938, 939, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 384, 385, 942, 943, 388, 389, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 394, 395, 952, 953, 398, 399, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 386, 387, 962, 963, 988, 989, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 396, 397, 972, 973, 998, 999, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 480, 481, 804, 805, 884, 885, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 490, 491, 814, 815, 894, 895, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 482, 483, 824, 825, 848, 849, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 492, 493, 834, 835, 858, 859, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 484, 485, 844, 845, 488, 489, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 494, 495, 854, 855, 498, 499, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 486, 487, 864, 865, 888, 889, 470, 471, 472, 473, 474, 475, 476, 477, 478, 479, 496, 497, 874, 875, 898, 899, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 580, 581, 904, 905, 984, 985, 510, 511, 512, 513, 514, 515, 516, 517, 518, 519, 590, 591, 914, 915, 994, 995, 520, 521, 522, 523, 524, 525, 526, 527, 528, 529, 582, 583, 924, 925, 948, 949, 530, 531, 532, 533, 534, 535, 536, 537, 538, 539, 592, 593, 934, 935, 958, 959, 540, 541, 542, 543, 544, 545, 546, 547, 548, 549, 584, 585, 944, 945, 588, 589, 550, 551, 552, 553, 554, 555, 556, 557, 558, 559, 594, 595, 954, 955, 598, 599, 560, 561, 562, 563, 564, 565, 566, 567, 568, 569, 586, 587, 964, 965, 988, 989, 570, 571, 572, 573, 574, 575, 576, 577, 578, 579, 596, 597, 974, 975, 998, 999, 600, 601, 602, 603, 604, 605, 606, 607, 608, 609, 680, 681, 806, 807, 886, 887, 610, 611, 612, 613, 614, 615, 616, 617, 618, 619, 690, 691, 816, 817, 896, 897, 620, 621, 622, 623, 624, 625, 626, 627, 628, 629, 682, 683, 826, 827, 868, 869, 630, 631, 632, 633, 634, 635, 636, 637, 638, 639, 692, 693, 836, 837, 878, 879, 640, 641, 642, 643, 644, 645, 646, 647, 648, 649, 684, 685, 846, 847, 688, 689, 650, 651, 652, 653, 654, 655, 656, 657, 658, 659, 694, 695, 856, 857, 698, 699, 660, 661, 662, 663, 664, 665, 666, 667, 668, 669, 686, 687, 866, 867, 888, 889, 670, 671, 672, 673, 674, 675, 676, 677, 678, 679, 696, 697, 876, 877, 898, 899, 700, 701, 702, 703, 704, 705, 706, 707, 708, 709, 780, 781, 906, 907, 986, 987, 710, 711, 712, 713, 714, 715, 716, 717, 718, 719, 790, 791, 916, 917, 996, 997, 720, 721, 722, 723, 724, 725, 726, 727, 728, 729, 782, 783, 926, 927, 968, 969, 730, 731, 732, 733, 734, 735, 736, 737, 738, 739, 792, 793, 936, 937, 978, 979, 740, 741, 742, 743, 744, 745, 746, 747, 748, 749, 784, 785, 946, 947, 788, 789, 750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 794, 795, 956, 957, 798, 799, 760, 761, 762, 763, 764, 765, 766, 767, 768, 769, 786, 787, 966, 967, 988, 989, 770, 771, 772, 773, 774, 775, 776, 777, 778, 779, 796, 797, 976, 977, 998, 999}; #endif #if defined(DEC_DPD2BINK) && DEC_DPD2BINK==1 && !defined(DECDPD2BINK) #define DECDPD2BINK const uint32_t DPD2BINK[1024]={ 0, 1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 80000, 81000, 800000, 801000, 880000, 881000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000, 18000, 19000, 90000, 91000, 810000, 811000, 890000, 891000, 20000, 21000, 22000, 23000, 24000, 25000, 26000, 27000, 28000, 29000, 82000, 83000, 820000, 821000, 808000, 809000, 30000, 31000, 32000, 33000, 34000, 35000, 36000, 37000, 38000, 39000, 92000, 93000, 830000, 831000, 818000, 819000, 40000, 41000, 42000, 43000, 44000, 45000, 46000, 47000, 48000, 49000, 84000, 85000, 840000, 841000, 88000, 89000, 50000, 51000, 52000, 53000, 54000, 55000, 56000, 57000, 58000, 59000, 94000, 95000, 850000, 851000, 98000, 99000, 60000, 61000, 62000, 63000, 64000, 65000, 66000, 67000, 68000, 69000, 86000, 87000, 860000, 861000, 888000, 889000, 70000, 71000, 72000, 73000, 74000, 75000, 76000, 77000, 78000, 79000, 96000, 97000, 870000, 871000, 898000, 899000, 100000, 101000, 102000, 103000, 104000, 105000, 106000, 107000, 108000, 109000, 180000, 181000, 900000, 901000, 980000, 981000, 110000, 111000, 112000, 113000, 114000, 115000, 116000, 117000, 118000, 119000, 190000, 191000, 910000, 911000, 990000, 991000, 120000, 121000, 122000, 123000, 124000, 125000, 126000, 127000, 128000, 129000, 182000, 183000, 920000, 921000, 908000, 909000, 130000, 131000, 132000, 133000, 134000, 135000, 136000, 137000, 138000, 139000, 192000, 193000, 930000, 931000, 918000, 919000, 140000, 141000, 142000, 143000, 144000, 145000, 146000, 147000, 148000, 149000, 184000, 185000, 940000, 941000, 188000, 189000, 150000, 151000, 152000, 153000, 154000, 155000, 156000, 157000, 158000, 159000, 194000, 195000, 950000, 951000, 198000, 199000, 160000, 161000, 162000, 163000, 164000, 165000, 166000, 167000, 168000, 169000, 186000, 187000, 960000, 961000, 988000, 989000, 170000, 171000, 172000, 173000, 174000, 175000, 176000, 177000, 178000, 179000, 196000, 197000, 970000, 971000, 998000, 999000, 200000, 201000, 202000, 203000, 204000, 205000, 206000, 207000, 208000, 209000, 280000, 281000, 802000, 803000, 882000, 883000, 210000, 211000, 212000, 213000, 214000, 215000, 216000, 217000, 218000, 219000, 290000, 291000, 812000, 813000, 892000, 893000, 220000, 221000, 222000, 223000, 224000, 225000, 226000, 227000, 228000, 229000, 282000, 283000, 822000, 823000, 828000, 829000, 230000, 231000, 232000, 233000, 234000, 235000, 236000, 237000, 238000, 239000, 292000, 293000, 832000, 833000, 838000, 839000, 240000, 241000, 242000, 243000, 244000, 245000, 246000, 247000, 248000, 249000, 284000, 285000, 842000, 843000, 288000, 289000, 250000, 251000, 252000, 253000, 254000, 255000, 256000, 257000, 258000, 259000, 294000, 295000, 852000, 853000, 298000, 299000, 260000, 261000, 262000, 263000, 264000, 265000, 266000, 267000, 268000, 269000, 286000, 287000, 862000, 863000, 888000, 889000, 270000, 271000, 272000, 273000, 274000, 275000, 276000, 277000, 278000, 279000, 296000, 297000, 872000, 873000, 898000, 899000, 300000, 301000, 302000, 303000, 304000, 305000, 306000, 307000, 308000, 309000, 380000, 381000, 902000, 903000, 982000, 983000, 310000, 311000, 312000, 313000, 314000, 315000, 316000, 317000, 318000, 319000, 390000, 391000, 912000, 913000, 992000, 993000, 320000, 321000, 322000, 323000, 324000, 325000, 326000, 327000, 328000, 329000, 382000, 383000, 922000, 923000, 928000, 929000, 330000, 331000, 332000, 333000, 334000, 335000, 336000, 337000, 338000, 339000, 392000, 393000, 932000, 933000, 938000, 939000, 340000, 341000, 342000, 343000, 344000, 345000, 346000, 347000, 348000, 349000, 384000, 385000, 942000, 943000, 388000, 389000, 350000, 351000, 352000, 353000, 354000, 355000, 356000, 357000, 358000, 359000, 394000, 395000, 952000, 953000, 398000, 399000, 360000, 361000, 362000, 363000, 364000, 365000, 366000, 367000, 368000, 369000, 386000, 387000, 962000, 963000, 988000, 989000, 370000, 371000, 372000, 373000, 374000, 375000, 376000, 377000, 378000, 379000, 396000, 397000, 972000, 973000, 998000, 999000, 400000, 401000, 402000, 403000, 404000, 405000, 406000, 407000, 408000, 409000, 480000, 481000, 804000, 805000, 884000, 885000, 410000, 411000, 412000, 413000, 414000, 415000, 416000, 417000, 418000, 419000, 490000, 491000, 814000, 815000, 894000, 895000, 420000, 421000, 422000, 423000, 424000, 425000, 426000, 427000, 428000, 429000, 482000, 483000, 824000, 825000, 848000, 849000, 430000, 431000, 432000, 433000, 434000, 435000, 436000, 437000, 438000, 439000, 492000, 493000, 834000, 835000, 858000, 859000, 440000, 441000, 442000, 443000, 444000, 445000, 446000, 447000, 448000, 449000, 484000, 485000, 844000, 845000, 488000, 489000, 450000, 451000, 452000, 453000, 454000, 455000, 456000, 457000, 458000, 459000, 494000, 495000, 854000, 855000, 498000, 499000, 460000, 461000, 462000, 463000, 464000, 465000, 466000, 467000, 468000, 469000, 486000, 487000, 864000, 865000, 888000, 889000, 470000, 471000, 472000, 473000, 474000, 475000, 476000, 477000, 478000, 479000, 496000, 497000, 874000, 875000, 898000, 899000, 500000, 501000, 502000, 503000, 504000, 505000, 506000, 507000, 508000, 509000, 580000, 581000, 904000, 905000, 984000, 985000, 510000, 511000, 512000, 513000, 514000, 515000, 516000, 517000, 518000, 519000, 590000, 591000, 914000, 915000, 994000, 995000, 520000, 521000, 522000, 523000, 524000, 525000, 526000, 527000, 528000, 529000, 582000, 583000, 924000, 925000, 948000, 949000, 530000, 531000, 532000, 533000, 534000, 535000, 536000, 537000, 538000, 539000, 592000, 593000, 934000, 935000, 958000, 959000, 540000, 541000, 542000, 543000, 544000, 545000, 546000, 547000, 548000, 549000, 584000, 585000, 944000, 945000, 588000, 589000, 550000, 551000, 552000, 553000, 554000, 555000, 556000, 557000, 558000, 559000, 594000, 595000, 954000, 955000, 598000, 599000, 560000, 561000, 562000, 563000, 564000, 565000, 566000, 567000, 568000, 569000, 586000, 587000, 964000, 965000, 988000, 989000, 570000, 571000, 572000, 573000, 574000, 575000, 576000, 577000, 578000, 579000, 596000, 597000, 974000, 975000, 998000, 999000, 600000, 601000, 602000, 603000, 604000, 605000, 606000, 607000, 608000, 609000, 680000, 681000, 806000, 807000, 886000, 887000, 610000, 611000, 612000, 613000, 614000, 615000, 616000, 617000, 618000, 619000, 690000, 691000, 816000, 817000, 896000, 897000, 620000, 621000, 622000, 623000, 624000, 625000, 626000, 627000, 628000, 629000, 682000, 683000, 826000, 827000, 868000, 869000, 630000, 631000, 632000, 633000, 634000, 635000, 636000, 637000, 638000, 639000, 692000, 693000, 836000, 837000, 878000, 879000, 640000, 641000, 642000, 643000, 644000, 645000, 646000, 647000, 648000, 649000, 684000, 685000, 846000, 847000, 688000, 689000, 650000, 651000, 652000, 653000, 654000, 655000, 656000, 657000, 658000, 659000, 694000, 695000, 856000, 857000, 698000, 699000, 660000, 661000, 662000, 663000, 664000, 665000, 666000, 667000, 668000, 669000, 686000, 687000, 866000, 867000, 888000, 889000, 670000, 671000, 672000, 673000, 674000, 675000, 676000, 677000, 678000, 679000, 696000, 697000, 876000, 877000, 898000, 899000, 700000, 701000, 702000, 703000, 704000, 705000, 706000, 707000, 708000, 709000, 780000, 781000, 906000, 907000, 986000, 987000, 710000, 711000, 712000, 713000, 714000, 715000, 716000, 717000, 718000, 719000, 790000, 791000, 916000, 917000, 996000, 997000, 720000, 721000, 722000, 723000, 724000, 725000, 726000, 727000, 728000, 729000, 782000, 783000, 926000, 927000, 968000, 969000, 730000, 731000, 732000, 733000, 734000, 735000, 736000, 737000, 738000, 739000, 792000, 793000, 936000, 937000, 978000, 979000, 740000, 741000, 742000, 743000, 744000, 745000, 746000, 747000, 748000, 749000, 784000, 785000, 946000, 947000, 788000, 789000, 750000, 751000, 752000, 753000, 754000, 755000, 756000, 757000, 758000, 759000, 794000, 795000, 956000, 957000, 798000, 799000, 760000, 761000, 762000, 763000, 764000, 765000, 766000, 767000, 768000, 769000, 786000, 787000, 966000, 967000, 988000, 989000, 770000, 771000, 772000, 773000, 774000, 775000, 776000, 777000, 778000, 779000, 796000, 797000, 976000, 977000, 998000, 999000}; #endif #if defined(DEC_DPD2BINM) && DEC_DPD2BINM==1 && !defined(DECDPD2BINM) #define DECDPD2BINM const uint32_t DPD2BINM[1024]={0, 1000000, 2000000, 3000000, 4000000, 5000000, 6000000, 7000000, 8000000, 9000000, 80000000, 81000000, 800000000, 801000000, 880000000, 881000000, 10000000, 11000000, 12000000, 13000000, 14000000, 15000000, 16000000, 17000000, 18000000, 19000000, 90000000, 91000000, 810000000, 811000000, 890000000, 891000000, 20000000, 21000000, 22000000, 23000000, 24000000, 25000000, 26000000, 27000000, 28000000, 29000000, 82000000, 83000000, 820000000, 821000000, 808000000, 809000000, 30000000, 31000000, 32000000, 33000000, 34000000, 35000000, 36000000, 37000000, 38000000, 39000000, 92000000, 93000000, 830000000, 831000000, 818000000, 819000000, 40000000, 41000000, 42000000, 43000000, 44000000, 45000000, 46000000, 47000000, 48000000, 49000000, 84000000, 85000000, 840000000, 841000000, 88000000, 89000000, 50000000, 51000000, 52000000, 53000000, 54000000, 55000000, 56000000, 57000000, 58000000, 59000000, 94000000, 95000000, 850000000, 851000000, 98000000, 99000000, 60000000, 61000000, 62000000, 63000000, 64000000, 65000000, 66000000, 67000000, 68000000, 69000000, 86000000, 87000000, 860000000, 861000000, 888000000, 889000000, 70000000, 71000000, 72000000, 73000000, 74000000, 75000000, 76000000, 77000000, 78000000, 79000000, 96000000, 97000000, 870000000, 871000000, 898000000, 899000000, 100000000, 101000000, 102000000, 103000000, 104000000, 105000000, 106000000, 107000000, 108000000, 109000000, 180000000, 181000000, 900000000, 901000000, 980000000, 981000000, 110000000, 111000000, 112000000, 113000000, 114000000, 115000000, 116000000, 117000000, 118000000, 119000000, 190000000, 191000000, 910000000, 911000000, 990000000, 991000000, 120000000, 121000000, 122000000, 123000000, 124000000, 125000000, 126000000, 127000000, 128000000, 129000000, 182000000, 183000000, 920000000, 921000000, 908000000, 909000000, 130000000, 131000000, 132000000, 133000000, 134000000, 135000000, 136000000, 137000000, 138000000, 139000000, 192000000, 193000000, 930000000, 931000000, 918000000, 919000000, 140000000, 141000000, 142000000, 143000000, 144000000, 145000000, 146000000, 147000000, 148000000, 149000000, 184000000, 185000000, 940000000, 941000000, 188000000, 189000000, 150000000, 151000000, 152000000, 153000000, 154000000, 155000000, 156000000, 157000000, 158000000, 159000000, 194000000, 195000000, 950000000, 951000000, 198000000, 199000000, 160000000, 161000000, 162000000, 163000000, 164000000, 165000000, 166000000, 167000000, 168000000, 169000000, 186000000, 187000000, 960000000, 961000000, 988000000, 989000000, 170000000, 171000000, 172000000, 173000000, 174000000, 175000000, 176000000, 177000000, 178000000, 179000000, 196000000, 197000000, 970000000, 971000000, 998000000, 999000000, 200000000, 201000000, 202000000, 203000000, 204000000, 205000000, 206000000, 207000000, 208000000, 209000000, 280000000, 281000000, 802000000, 803000000, 882000000, 883000000, 210000000, 211000000, 212000000, 213000000, 214000000, 215000000, 216000000, 217000000, 218000000, 219000000, 290000000, 291000000, 812000000, 813000000, 892000000, 893000000, 220000000, 221000000, 222000000, 223000000, 224000000, 225000000, 226000000, 227000000, 228000000, 229000000, 282000000, 283000000, 822000000, 823000000, 828000000, 829000000, 230000000, 231000000, 232000000, 233000000, 234000000, 235000000, 236000000, 237000000, 238000000, 239000000, 292000000, 293000000, 832000000, 833000000, 838000000, 839000000, 240000000, 241000000, 242000000, 243000000, 244000000, 245000000, 246000000, 247000000, 248000000, 249000000, 284000000, 285000000, 842000000, 843000000, 288000000, 289000000, 250000000, 251000000, 252000000, 253000000, 254000000, 255000000, 256000000, 257000000, 258000000, 259000000, 294000000, 295000000, 852000000, 853000000, 298000000, 299000000, 260000000, 261000000, 262000000, 263000000, 264000000, 265000000, 266000000, 267000000, 268000000, 269000000, 286000000, 287000000, 862000000, 863000000, 888000000, 889000000, 270000000, 271000000, 272000000, 273000000, 274000000, 275000000, 276000000, 277000000, 278000000, 279000000, 296000000, 297000000, 872000000, 873000000, 898000000, 899000000, 300000000, 301000000, 302000000, 303000000, 304000000, 305000000, 306000000, 307000000, 308000000, 309000000, 380000000, 381000000, 902000000, 903000000, 982000000, 983000000, 310000000, 311000000, 312000000, 313000000, 314000000, 315000000, 316000000, 317000000, 318000000, 319000000, 390000000, 391000000, 912000000, 913000000, 992000000, 993000000, 320000000, 321000000, 322000000, 323000000, 324000000, 325000000, 326000000, 327000000, 328000000, 329000000, 382000000, 383000000, 922000000, 923000000, 928000000, 929000000, 330000000, 331000000, 332000000, 333000000, 334000000, 335000000, 336000000, 337000000, 338000000, 339000000, 392000000, 393000000, 932000000, 933000000, 938000000, 939000000, 340000000, 341000000, 342000000, 343000000, 344000000, 345000000, 346000000, 347000000, 348000000, 349000000, 384000000, 385000000, 942000000, 943000000, 388000000, 389000000, 350000000, 351000000, 352000000, 353000000, 354000000, 355000000, 356000000, 357000000, 358000000, 359000000, 394000000, 395000000, 952000000, 953000000, 398000000, 399000000, 360000000, 361000000, 362000000, 363000000, 364000000, 365000000, 366000000, 367000000, 368000000, 369000000, 386000000, 387000000, 962000000, 963000000, 988000000, 989000000, 370000000, 371000000, 372000000, 373000000, 374000000, 375000000, 376000000, 377000000, 378000000, 379000000, 396000000, 397000000, 972000000, 973000000, 998000000, 999000000, 400000000, 401000000, 402000000, 403000000, 404000000, 405000000, 406000000, 407000000, 408000000, 409000000, 480000000, 481000000, 804000000, 805000000, 884000000, 885000000, 410000000, 411000000, 412000000, 413000000, 414000000, 415000000, 416000000, 417000000, 418000000, 419000000, 490000000, 491000000, 814000000, 815000000, 894000000, 895000000, 420000000, 421000000, 422000000, 423000000, 424000000, 425000000, 426000000, 427000000, 428000000, 429000000, 482000000, 483000000, 824000000, 825000000, 848000000, 849000000, 430000000, 431000000, 432000000, 433000000, 434000000, 435000000, 436000000, 437000000, 438000000, 439000000, 492000000, 493000000, 834000000, 835000000, 858000000, 859000000, 440000000, 441000000, 442000000, 443000000, 444000000, 445000000, 446000000, 447000000, 448000000, 449000000, 484000000, 485000000, 844000000, 845000000, 488000000, 489000000, 450000000, 451000000, 452000000, 453000000, 454000000, 455000000, 456000000, 457000000, 458000000, 459000000, 494000000, 495000000, 854000000, 855000000, 498000000, 499000000, 460000000, 461000000, 462000000, 463000000, 464000000, 465000000, 466000000, 467000000, 468000000, 469000000, 486000000, 487000000, 864000000, 865000000, 888000000, 889000000, 470000000, 471000000, 472000000, 473000000, 474000000, 475000000, 476000000, 477000000, 478000000, 479000000, 496000000, 497000000, 874000000, 875000000, 898000000, 899000000, 500000000, 501000000, 502000000, 503000000, 504000000, 505000000, 506000000, 507000000, 508000000, 509000000, 580000000, 581000000, 904000000, 905000000, 984000000, 985000000, 510000000, 511000000, 512000000, 513000000, 514000000, 515000000, 516000000, 517000000, 518000000, 519000000, 590000000, 591000000, 914000000, 915000000, 994000000, 995000000, 520000000, 521000000, 522000000, 523000000, 524000000, 525000000, 526000000, 527000000, 528000000, 529000000, 582000000, 583000000, 924000000, 925000000, 948000000, 949000000, 530000000, 531000000, 532000000, 533000000, 534000000, 535000000, 536000000, 537000000, 538000000, 539000000, 592000000, 593000000, 934000000, 935000000, 958000000, 959000000, 540000000, 541000000, 542000000, 543000000, 544000000, 545000000, 546000000, 547000000, 548000000, 549000000, 584000000, 585000000, 944000000, 945000000, 588000000, 589000000, 550000000, 551000000, 552000000, 553000000, 554000000, 555000000, 556000000, 557000000, 558000000, 559000000, 594000000, 595000000, 954000000, 955000000, 598000000, 599000000, 560000000, 561000000, 562000000, 563000000, 564000000, 565000000, 566000000, 567000000, 568000000, 569000000, 586000000, 587000000, 964000000, 965000000, 988000000, 989000000, 570000000, 571000000, 572000000, 573000000, 574000000, 575000000, 576000000, 577000000, 578000000, 579000000, 596000000, 597000000, 974000000, 975000000, 998000000, 999000000, 600000000, 601000000, 602000000, 603000000, 604000000, 605000000, 606000000, 607000000, 608000000, 609000000, 680000000, 681000000, 806000000, 807000000, 886000000, 887000000, 610000000, 611000000, 612000000, 613000000, 614000000, 615000000, 616000000, 617000000, 618000000, 619000000, 690000000, 691000000, 816000000, 817000000, 896000000, 897000000, 620000000, 621000000, 622000000, 623000000, 624000000, 625000000, 626000000, 627000000, 628000000, 629000000, 682000000, 683000000, 826000000, 827000000, 868000000, 869000000, 630000000, 631000000, 632000000, 633000000, 634000000, 635000000, 636000000, 637000000, 638000000, 639000000, 692000000, 693000000, 836000000, 837000000, 878000000, 879000000, 640000000, 641000000, 642000000, 643000000, 644000000, 645000000, 646000000, 647000000, 648000000, 649000000, 684000000, 685000000, 846000000, 847000000, 688000000, 689000000, 650000000, 651000000, 652000000, 653000000, 654000000, 655000000, 656000000, 657000000, 658000000, 659000000, 694000000, 695000000, 856000000, 857000000, 698000000, 699000000, 660000000, 661000000, 662000000, 663000000, 664000000, 665000000, 666000000, 667000000, 668000000, 669000000, 686000000, 687000000, 866000000, 867000000, 888000000, 889000000, 670000000, 671000000, 672000000, 673000000, 674000000, 675000000, 676000000, 677000000, 678000000, 679000000, 696000000, 697000000, 876000000, 877000000, 898000000, 899000000, 700000000, 701000000, 702000000, 703000000, 704000000, 705000000, 706000000, 707000000, 708000000, 709000000, 780000000, 781000000, 906000000, 907000000, 986000000, 987000000, 710000000, 711000000, 712000000, 713000000, 714000000, 715000000, 716000000, 717000000, 718000000, 719000000, 790000000, 791000000, 916000000, 917000000, 996000000, 997000000, 720000000, 721000000, 722000000, 723000000, 724000000, 725000000, 726000000, 727000000, 728000000, 729000000, 782000000, 783000000, 926000000, 927000000, 968000000, 969000000, 730000000, 731000000, 732000000, 733000000, 734000000, 735000000, 736000000, 737000000, 738000000, 739000000, 792000000, 793000000, 936000000, 937000000, 978000000, 979000000, 740000000, 741000000, 742000000, 743000000, 744000000, 745000000, 746000000, 747000000, 748000000, 749000000, 784000000, 785000000, 946000000, 947000000, 788000000, 789000000, 750000000, 751000000, 752000000, 753000000, 754000000, 755000000, 756000000, 757000000, 758000000, 759000000, 794000000, 795000000, 956000000, 957000000, 798000000, 799000000, 760000000, 761000000, 762000000, 763000000, 764000000, 765000000, 766000000, 767000000, 768000000, 769000000, 786000000, 787000000, 966000000, 967000000, 988000000, 989000000, 770000000, 771000000, 772000000, 773000000, 774000000, 775000000, 776000000, 777000000, 778000000, 779000000, 796000000, 797000000, 976000000, 977000000, 998000000, 999000000}; #endif #if defined(DEC_BIN2CHAR) && DEC_BIN2CHAR==1 && !defined(DECBIN2CHAR) #define DECBIN2CHAR const uint8_t BIN2CHAR[4001]={ '\0','0','0','0', '\1','0','0','1', '\1','0','0','2', '\1','0','0','3', '\1','0','0','4', '\1','0','0','5', '\1','0','0','6', '\1','0','0','7', '\1','0','0','8', '\1','0','0','9', '\2','0','1','0', '\2','0','1','1', '\2','0','1','2', '\2','0','1','3', '\2','0','1','4', '\2','0','1','5', '\2','0','1','6', '\2','0','1','7', '\2','0','1','8', '\2','0','1','9', '\2','0','2','0', '\2','0','2','1', '\2','0','2','2', '\2','0','2','3', '\2','0','2','4', '\2','0','2','5', '\2','0','2','6', '\2','0','2','7', '\2','0','2','8', '\2','0','2','9', '\2','0','3','0', '\2','0','3','1', '\2','0','3','2', '\2','0','3','3', '\2','0','3','4', '\2','0','3','5', '\2','0','3','6', '\2','0','3','7', '\2','0','3','8', '\2','0','3','9', '\2','0','4','0', '\2','0','4','1', '\2','0','4','2', '\2','0','4','3', '\2','0','4','4', '\2','0','4','5', '\2','0','4','6', '\2','0','4','7', '\2','0','4','8', '\2','0','4','9', '\2','0','5','0', '\2','0','5','1', '\2','0','5','2', '\2','0','5','3', '\2','0','5','4', '\2','0','5','5', '\2','0','5','6', '\2','0','5','7', '\2','0','5','8', '\2','0','5','9', '\2','0','6','0', '\2','0','6','1', '\2','0','6','2', '\2','0','6','3', '\2','0','6','4', '\2','0','6','5', '\2','0','6','6', '\2','0','6','7', '\2','0','6','8', '\2','0','6','9', '\2','0','7','0', '\2','0','7','1', '\2','0','7','2', '\2','0','7','3', '\2','0','7','4', '\2','0','7','5', '\2','0','7','6', '\2','0','7','7', '\2','0','7','8', '\2','0','7','9', '\2','0','8','0', '\2','0','8','1', '\2','0','8','2', '\2','0','8','3', '\2','0','8','4', '\2','0','8','5', '\2','0','8','6', '\2','0','8','7', '\2','0','8','8', '\2','0','8','9', '\2','0','9','0', '\2','0','9','1', '\2','0','9','2', '\2','0','9','3', '\2','0','9','4', '\2','0','9','5', '\2','0','9','6', '\2','0','9','7', '\2','0','9','8', '\2','0','9','9', '\3','1','0','0', '\3','1','0','1', '\3','1','0','2', '\3','1','0','3', '\3','1','0','4', '\3','1','0','5', '\3','1','0','6', '\3','1','0','7', '\3','1','0','8', '\3','1','0','9', '\3','1','1','0', '\3','1','1','1', '\3','1','1','2', '\3','1','1','3', '\3','1','1','4', '\3','1','1','5', '\3','1','1','6', '\3','1','1','7', '\3','1','1','8', '\3','1','1','9', '\3','1','2','0', '\3','1','2','1', '\3','1','2','2', '\3','1','2','3', '\3','1','2','4', '\3','1','2','5', '\3','1','2','6', '\3','1','2','7', '\3','1','2','8', '\3','1','2','9', '\3','1','3','0', '\3','1','3','1', '\3','1','3','2', '\3','1','3','3', '\3','1','3','4', '\3','1','3','5', '\3','1','3','6', '\3','1','3','7', '\3','1','3','8', '\3','1','3','9', '\3','1','4','0', '\3','1','4','1', '\3','1','4','2', '\3','1','4','3', '\3','1','4','4', '\3','1','4','5', '\3','1','4','6', '\3','1','4','7', '\3','1','4','8', '\3','1','4','9', '\3','1','5','0', '\3','1','5','1', '\3','1','5','2', '\3','1','5','3', '\3','1','5','4', '\3','1','5','5', '\3','1','5','6', '\3','1','5','7', '\3','1','5','8', '\3','1','5','9', '\3','1','6','0', '\3','1','6','1', '\3','1','6','2', '\3','1','6','3', '\3','1','6','4', '\3','1','6','5', '\3','1','6','6', '\3','1','6','7', '\3','1','6','8', '\3','1','6','9', '\3','1','7','0', '\3','1','7','1', '\3','1','7','2', '\3','1','7','3', '\3','1','7','4', '\3','1','7','5', '\3','1','7','6', '\3','1','7','7', '\3','1','7','8', '\3','1','7','9', '\3','1','8','0', '\3','1','8','1', '\3','1','8','2', '\3','1','8','3', '\3','1','8','4', '\3','1','8','5', '\3','1','8','6', '\3','1','8','7', '\3','1','8','8', '\3','1','8','9', '\3','1','9','0', '\3','1','9','1', '\3','1','9','2', '\3','1','9','3', '\3','1','9','4', '\3','1','9','5', '\3','1','9','6', '\3','1','9','7', '\3','1','9','8', '\3','1','9','9', '\3','2','0','0', '\3','2','0','1', '\3','2','0','2', '\3','2','0','3', '\3','2','0','4', '\3','2','0','5', '\3','2','0','6', '\3','2','0','7', '\3','2','0','8', '\3','2','0','9', '\3','2','1','0', '\3','2','1','1', '\3','2','1','2', '\3','2','1','3', '\3','2','1','4', '\3','2','1','5', '\3','2','1','6', '\3','2','1','7', '\3','2','1','8', '\3','2','1','9', '\3','2','2','0', '\3','2','2','1', '\3','2','2','2', '\3','2','2','3', '\3','2','2','4', '\3','2','2','5', '\3','2','2','6', '\3','2','2','7', '\3','2','2','8', '\3','2','2','9', '\3','2','3','0', '\3','2','3','1', '\3','2','3','2', '\3','2','3','3', '\3','2','3','4', '\3','2','3','5', '\3','2','3','6', '\3','2','3','7', '\3','2','3','8', '\3','2','3','9', '\3','2','4','0', '\3','2','4','1', '\3','2','4','2', '\3','2','4','3', '\3','2','4','4', '\3','2','4','5', '\3','2','4','6', '\3','2','4','7', '\3','2','4','8', '\3','2','4','9', '\3','2','5','0', '\3','2','5','1', '\3','2','5','2', '\3','2','5','3', '\3','2','5','4', '\3','2','5','5', '\3','2','5','6', '\3','2','5','7', '\3','2','5','8', '\3','2','5','9', '\3','2','6','0', '\3','2','6','1', '\3','2','6','2', '\3','2','6','3', '\3','2','6','4', '\3','2','6','5', '\3','2','6','6', '\3','2','6','7', '\3','2','6','8', '\3','2','6','9', '\3','2','7','0', '\3','2','7','1', '\3','2','7','2', '\3','2','7','3', '\3','2','7','4', '\3','2','7','5', '\3','2','7','6', '\3','2','7','7', '\3','2','7','8', '\3','2','7','9', '\3','2','8','0', '\3','2','8','1', '\3','2','8','2', '\3','2','8','3', '\3','2','8','4', '\3','2','8','5', '\3','2','8','6', '\3','2','8','7', '\3','2','8','8', '\3','2','8','9', '\3','2','9','0', '\3','2','9','1', '\3','2','9','2', '\3','2','9','3', '\3','2','9','4', '\3','2','9','5', '\3','2','9','6', '\3','2','9','7', '\3','2','9','8', '\3','2','9','9', '\3','3','0','0', '\3','3','0','1', '\3','3','0','2', '\3','3','0','3', '\3','3','0','4', '\3','3','0','5', '\3','3','0','6', '\3','3','0','7', '\3','3','0','8', '\3','3','0','9', '\3','3','1','0', '\3','3','1','1', '\3','3','1','2', '\3','3','1','3', '\3','3','1','4', '\3','3','1','5', '\3','3','1','6', '\3','3','1','7', '\3','3','1','8', '\3','3','1','9', '\3','3','2','0', '\3','3','2','1', '\3','3','2','2', '\3','3','2','3', '\3','3','2','4', '\3','3','2','5', '\3','3','2','6', '\3','3','2','7', '\3','3','2','8', '\3','3','2','9', '\3','3','3','0', '\3','3','3','1', '\3','3','3','2', '\3','3','3','3', '\3','3','3','4', '\3','3','3','5', '\3','3','3','6', '\3','3','3','7', '\3','3','3','8', '\3','3','3','9', '\3','3','4','0', '\3','3','4','1', '\3','3','4','2', '\3','3','4','3', '\3','3','4','4', '\3','3','4','5', '\3','3','4','6', '\3','3','4','7', '\3','3','4','8', '\3','3','4','9', '\3','3','5','0', '\3','3','5','1', '\3','3','5','2', '\3','3','5','3', '\3','3','5','4', '\3','3','5','5', '\3','3','5','6', '\3','3','5','7', '\3','3','5','8', '\3','3','5','9', '\3','3','6','0', '\3','3','6','1', '\3','3','6','2', '\3','3','6','3', '\3','3','6','4', '\3','3','6','5', '\3','3','6','6', '\3','3','6','7', '\3','3','6','8', '\3','3','6','9', '\3','3','7','0', '\3','3','7','1', '\3','3','7','2', '\3','3','7','3', '\3','3','7','4', '\3','3','7','5', '\3','3','7','6', '\3','3','7','7', '\3','3','7','8', '\3','3','7','9', '\3','3','8','0', '\3','3','8','1', '\3','3','8','2', '\3','3','8','3', '\3','3','8','4', '\3','3','8','5', '\3','3','8','6', '\3','3','8','7', '\3','3','8','8', '\3','3','8','9', '\3','3','9','0', '\3','3','9','1', '\3','3','9','2', '\3','3','9','3', '\3','3','9','4', '\3','3','9','5', '\3','3','9','6', '\3','3','9','7', '\3','3','9','8', '\3','3','9','9', '\3','4','0','0', '\3','4','0','1', '\3','4','0','2', '\3','4','0','3', '\3','4','0','4', '\3','4','0','5', '\3','4','0','6', '\3','4','0','7', '\3','4','0','8', '\3','4','0','9', '\3','4','1','0', '\3','4','1','1', '\3','4','1','2', '\3','4','1','3', '\3','4','1','4', '\3','4','1','5', '\3','4','1','6', '\3','4','1','7', '\3','4','1','8', '\3','4','1','9', '\3','4','2','0', '\3','4','2','1', '\3','4','2','2', '\3','4','2','3', '\3','4','2','4', '\3','4','2','5', '\3','4','2','6', '\3','4','2','7', '\3','4','2','8', '\3','4','2','9', '\3','4','3','0', '\3','4','3','1', '\3','4','3','2', '\3','4','3','3', '\3','4','3','4', '\3','4','3','5', '\3','4','3','6', '\3','4','3','7', '\3','4','3','8', '\3','4','3','9', '\3','4','4','0', '\3','4','4','1', '\3','4','4','2', '\3','4','4','3', '\3','4','4','4', '\3','4','4','5', '\3','4','4','6', '\3','4','4','7', '\3','4','4','8', '\3','4','4','9', '\3','4','5','0', '\3','4','5','1', '\3','4','5','2', '\3','4','5','3', '\3','4','5','4', '\3','4','5','5', '\3','4','5','6', '\3','4','5','7', '\3','4','5','8', '\3','4','5','9', '\3','4','6','0', '\3','4','6','1', '\3','4','6','2', '\3','4','6','3', '\3','4','6','4', '\3','4','6','5', '\3','4','6','6', '\3','4','6','7', '\3','4','6','8', '\3','4','6','9', '\3','4','7','0', '\3','4','7','1', '\3','4','7','2', '\3','4','7','3', '\3','4','7','4', '\3','4','7','5', '\3','4','7','6', '\3','4','7','7', '\3','4','7','8', '\3','4','7','9', '\3','4','8','0', '\3','4','8','1', '\3','4','8','2', '\3','4','8','3', '\3','4','8','4', '\3','4','8','5', '\3','4','8','6', '\3','4','8','7', '\3','4','8','8', '\3','4','8','9', '\3','4','9','0', '\3','4','9','1', '\3','4','9','2', '\3','4','9','3', '\3','4','9','4', '\3','4','9','5', '\3','4','9','6', '\3','4','9','7', '\3','4','9','8', '\3','4','9','9', '\3','5','0','0', '\3','5','0','1', '\3','5','0','2', '\3','5','0','3', '\3','5','0','4', '\3','5','0','5', '\3','5','0','6', '\3','5','0','7', '\3','5','0','8', '\3','5','0','9', '\3','5','1','0', '\3','5','1','1', '\3','5','1','2', '\3','5','1','3', '\3','5','1','4', '\3','5','1','5', '\3','5','1','6', '\3','5','1','7', '\3','5','1','8', '\3','5','1','9', '\3','5','2','0', '\3','5','2','1', '\3','5','2','2', '\3','5','2','3', '\3','5','2','4', '\3','5','2','5', '\3','5','2','6', '\3','5','2','7', '\3','5','2','8', '\3','5','2','9', '\3','5','3','0', '\3','5','3','1', '\3','5','3','2', '\3','5','3','3', '\3','5','3','4', '\3','5','3','5', '\3','5','3','6', '\3','5','3','7', '\3','5','3','8', '\3','5','3','9', '\3','5','4','0', '\3','5','4','1', '\3','5','4','2', '\3','5','4','3', '\3','5','4','4', '\3','5','4','5', '\3','5','4','6', '\3','5','4','7', '\3','5','4','8', '\3','5','4','9', '\3','5','5','0', '\3','5','5','1', '\3','5','5','2', '\3','5','5','3', '\3','5','5','4', '\3','5','5','5', '\3','5','5','6', '\3','5','5','7', '\3','5','5','8', '\3','5','5','9', '\3','5','6','0', '\3','5','6','1', '\3','5','6','2', '\3','5','6','3', '\3','5','6','4', '\3','5','6','5', '\3','5','6','6', '\3','5','6','7', '\3','5','6','8', '\3','5','6','9', '\3','5','7','0', '\3','5','7','1', '\3','5','7','2', '\3','5','7','3', '\3','5','7','4', '\3','5','7','5', '\3','5','7','6', '\3','5','7','7', '\3','5','7','8', '\3','5','7','9', '\3','5','8','0', '\3','5','8','1', '\3','5','8','2', '\3','5','8','3', '\3','5','8','4', '\3','5','8','5', '\3','5','8','6', '\3','5','8','7', '\3','5','8','8', '\3','5','8','9', '\3','5','9','0', '\3','5','9','1', '\3','5','9','2', '\3','5','9','3', '\3','5','9','4', '\3','5','9','5', '\3','5','9','6', '\3','5','9','7', '\3','5','9','8', '\3','5','9','9', '\3','6','0','0', '\3','6','0','1', '\3','6','0','2', '\3','6','0','3', '\3','6','0','4', '\3','6','0','5', '\3','6','0','6', '\3','6','0','7', '\3','6','0','8', '\3','6','0','9', '\3','6','1','0', '\3','6','1','1', '\3','6','1','2', '\3','6','1','3', '\3','6','1','4', '\3','6','1','5', '\3','6','1','6', '\3','6','1','7', '\3','6','1','8', '\3','6','1','9', '\3','6','2','0', '\3','6','2','1', '\3','6','2','2', '\3','6','2','3', '\3','6','2','4', '\3','6','2','5', '\3','6','2','6', '\3','6','2','7', '\3','6','2','8', '\3','6','2','9', '\3','6','3','0', '\3','6','3','1', '\3','6','3','2', '\3','6','3','3', '\3','6','3','4', '\3','6','3','5', '\3','6','3','6', '\3','6','3','7', '\3','6','3','8', '\3','6','3','9', '\3','6','4','0', '\3','6','4','1', '\3','6','4','2', '\3','6','4','3', '\3','6','4','4', '\3','6','4','5', '\3','6','4','6', '\3','6','4','7', '\3','6','4','8', '\3','6','4','9', '\3','6','5','0', '\3','6','5','1', '\3','6','5','2', '\3','6','5','3', '\3','6','5','4', '\3','6','5','5', '\3','6','5','6', '\3','6','5','7', '\3','6','5','8', '\3','6','5','9', '\3','6','6','0', '\3','6','6','1', '\3','6','6','2', '\3','6','6','3', '\3','6','6','4', '\3','6','6','5', '\3','6','6','6', '\3','6','6','7', '\3','6','6','8', '\3','6','6','9', '\3','6','7','0', '\3','6','7','1', '\3','6','7','2', '\3','6','7','3', '\3','6','7','4', '\3','6','7','5', '\3','6','7','6', '\3','6','7','7', '\3','6','7','8', '\3','6','7','9', '\3','6','8','0', '\3','6','8','1', '\3','6','8','2', '\3','6','8','3', '\3','6','8','4', '\3','6','8','5', '\3','6','8','6', '\3','6','8','7', '\3','6','8','8', '\3','6','8','9', '\3','6','9','0', '\3','6','9','1', '\3','6','9','2', '\3','6','9','3', '\3','6','9','4', '\3','6','9','5', '\3','6','9','6', '\3','6','9','7', '\3','6','9','8', '\3','6','9','9', '\3','7','0','0', '\3','7','0','1', '\3','7','0','2', '\3','7','0','3', '\3','7','0','4', '\3','7','0','5', '\3','7','0','6', '\3','7','0','7', '\3','7','0','8', '\3','7','0','9', '\3','7','1','0', '\3','7','1','1', '\3','7','1','2', '\3','7','1','3', '\3','7','1','4', '\3','7','1','5', '\3','7','1','6', '\3','7','1','7', '\3','7','1','8', '\3','7','1','9', '\3','7','2','0', '\3','7','2','1', '\3','7','2','2', '\3','7','2','3', '\3','7','2','4', '\3','7','2','5', '\3','7','2','6', '\3','7','2','7', '\3','7','2','8', '\3','7','2','9', '\3','7','3','0', '\3','7','3','1', '\3','7','3','2', '\3','7','3','3', '\3','7','3','4', '\3','7','3','5', '\3','7','3','6', '\3','7','3','7', '\3','7','3','8', '\3','7','3','9', '\3','7','4','0', '\3','7','4','1', '\3','7','4','2', '\3','7','4','3', '\3','7','4','4', '\3','7','4','5', '\3','7','4','6', '\3','7','4','7', '\3','7','4','8', '\3','7','4','9', '\3','7','5','0', '\3','7','5','1', '\3','7','5','2', '\3','7','5','3', '\3','7','5','4', '\3','7','5','5', '\3','7','5','6', '\3','7','5','7', '\3','7','5','8', '\3','7','5','9', '\3','7','6','0', '\3','7','6','1', '\3','7','6','2', '\3','7','6','3', '\3','7','6','4', '\3','7','6','5', '\3','7','6','6', '\3','7','6','7', '\3','7','6','8', '\3','7','6','9', '\3','7','7','0', '\3','7','7','1', '\3','7','7','2', '\3','7','7','3', '\3','7','7','4', '\3','7','7','5', '\3','7','7','6', '\3','7','7','7', '\3','7','7','8', '\3','7','7','9', '\3','7','8','0', '\3','7','8','1', '\3','7','8','2', '\3','7','8','3', '\3','7','8','4', '\3','7','8','5', '\3','7','8','6', '\3','7','8','7', '\3','7','8','8', '\3','7','8','9', '\3','7','9','0', '\3','7','9','1', '\3','7','9','2', '\3','7','9','3', '\3','7','9','4', '\3','7','9','5', '\3','7','9','6', '\3','7','9','7', '\3','7','9','8', '\3','7','9','9', '\3','8','0','0', '\3','8','0','1', '\3','8','0','2', '\3','8','0','3', '\3','8','0','4', '\3','8','0','5', '\3','8','0','6', '\3','8','0','7', '\3','8','0','8', '\3','8','0','9', '\3','8','1','0', '\3','8','1','1', '\3','8','1','2', '\3','8','1','3', '\3','8','1','4', '\3','8','1','5', '\3','8','1','6', '\3','8','1','7', '\3','8','1','8', '\3','8','1','9', '\3','8','2','0', '\3','8','2','1', '\3','8','2','2', '\3','8','2','3', '\3','8','2','4', '\3','8','2','5', '\3','8','2','6', '\3','8','2','7', '\3','8','2','8', '\3','8','2','9', '\3','8','3','0', '\3','8','3','1', '\3','8','3','2', '\3','8','3','3', '\3','8','3','4', '\3','8','3','5', '\3','8','3','6', '\3','8','3','7', '\3','8','3','8', '\3','8','3','9', '\3','8','4','0', '\3','8','4','1', '\3','8','4','2', '\3','8','4','3', '\3','8','4','4', '\3','8','4','5', '\3','8','4','6', '\3','8','4','7', '\3','8','4','8', '\3','8','4','9', '\3','8','5','0', '\3','8','5','1', '\3','8','5','2', '\3','8','5','3', '\3','8','5','4', '\3','8','5','5', '\3','8','5','6', '\3','8','5','7', '\3','8','5','8', '\3','8','5','9', '\3','8','6','0', '\3','8','6','1', '\3','8','6','2', '\3','8','6','3', '\3','8','6','4', '\3','8','6','5', '\3','8','6','6', '\3','8','6','7', '\3','8','6','8', '\3','8','6','9', '\3','8','7','0', '\3','8','7','1', '\3','8','7','2', '\3','8','7','3', '\3','8','7','4', '\3','8','7','5', '\3','8','7','6', '\3','8','7','7', '\3','8','7','8', '\3','8','7','9', '\3','8','8','0', '\3','8','8','1', '\3','8','8','2', '\3','8','8','3', '\3','8','8','4', '\3','8','8','5', '\3','8','8','6', '\3','8','8','7', '\3','8','8','8', '\3','8','8','9', '\3','8','9','0', '\3','8','9','1', '\3','8','9','2', '\3','8','9','3', '\3','8','9','4', '\3','8','9','5', '\3','8','9','6', '\3','8','9','7', '\3','8','9','8', '\3','8','9','9', '\3','9','0','0', '\3','9','0','1', '\3','9','0','2', '\3','9','0','3', '\3','9','0','4', '\3','9','0','5', '\3','9','0','6', '\3','9','0','7', '\3','9','0','8', '\3','9','0','9', '\3','9','1','0', '\3','9','1','1', '\3','9','1','2', '\3','9','1','3', '\3','9','1','4', '\3','9','1','5', '\3','9','1','6', '\3','9','1','7', '\3','9','1','8', '\3','9','1','9', '\3','9','2','0', '\3','9','2','1', '\3','9','2','2', '\3','9','2','3', '\3','9','2','4', '\3','9','2','5', '\3','9','2','6', '\3','9','2','7', '\3','9','2','8', '\3','9','2','9', '\3','9','3','0', '\3','9','3','1', '\3','9','3','2', '\3','9','3','3', '\3','9','3','4', '\3','9','3','5', '\3','9','3','6', '\3','9','3','7', '\3','9','3','8', '\3','9','3','9', '\3','9','4','0', '\3','9','4','1', '\3','9','4','2', '\3','9','4','3', '\3','9','4','4', '\3','9','4','5', '\3','9','4','6', '\3','9','4','7', '\3','9','4','8', '\3','9','4','9', '\3','9','5','0', '\3','9','5','1', '\3','9','5','2', '\3','9','5','3', '\3','9','5','4', '\3','9','5','5', '\3','9','5','6', '\3','9','5','7', '\3','9','5','8', '\3','9','5','9', '\3','9','6','0', '\3','9','6','1', '\3','9','6','2', '\3','9','6','3', '\3','9','6','4', '\3','9','6','5', '\3','9','6','6', '\3','9','6','7', '\3','9','6','8', '\3','9','6','9', '\3','9','7','0', '\3','9','7','1', '\3','9','7','2', '\3','9','7','3', '\3','9','7','4', '\3','9','7','5', '\3','9','7','6', '\3','9','7','7', '\3','9','7','8', '\3','9','7','9', '\3','9','8','0', '\3','9','8','1', '\3','9','8','2', '\3','9','8','3', '\3','9','8','4', '\3','9','8','5', '\3','9','8','6', '\3','9','8','7', '\3','9','8','8', '\3','9','8','9', '\3','9','9','0', '\3','9','9','1', '\3','9','9','2', '\3','9','9','3', '\3','9','9','4', '\3','9','9','5', '\3','9','9','6', '\3','9','9','7', '\3','9','9','8', '\3','9','9','9', '\0'}; #endif #if defined(DEC_DPD2BCD8) && DEC_DPD2BCD8==1 && !defined(DECDPD2BCD8) #define DECDPD2BCD8 const uint8_t DPD2BCD8[4096]={ 0,0,0,0, 0,0,1,1, 0,0,2,1, 0,0,3,1, 0,0,4,1, 0,0,5,1, 0,0,6,1, 0,0,7,1, 0,0,8,1, 0,0,9,1, 0,8,0,2, 0,8,1,2, 8,0,0,3, 8,0,1,3, 8,8,0,3, 8,8,1,3, 0,1,0,2, 0,1,1,2, 0,1,2,2, 0,1,3,2, 0,1,4,2, 0,1,5,2, 0,1,6,2, 0,1,7,2, 0,1,8,2, 0,1,9,2, 0,9,0,2, 0,9,1,2, 8,1,0,3, 8,1,1,3, 8,9,0,3, 8,9,1,3, 0,2,0,2, 0,2,1,2, 0,2,2,2, 0,2,3,2, 0,2,4,2, 0,2,5,2, 0,2,6,2, 0,2,7,2, 0,2,8,2, 0,2,9,2, 0,8,2,2, 0,8,3,2, 8,2,0,3, 8,2,1,3, 8,0,8,3, 8,0,9,3, 0,3,0,2, 0,3,1,2, 0,3,2,2, 0,3,3,2, 0,3,4,2, 0,3,5,2, 0,3,6,2, 0,3,7,2, 0,3,8,2, 0,3,9,2, 0,9,2,2, 0,9,3,2, 8,3,0,3, 8,3,1,3, 8,1,8,3, 8,1,9,3, 0,4,0,2, 0,4,1,2, 0,4,2,2, 0,4,3,2, 0,4,4,2, 0,4,5,2, 0,4,6,2, 0,4,7,2, 0,4,8,2, 0,4,9,2, 0,8,4,2, 0,8,5,2, 8,4,0,3, 8,4,1,3, 0,8,8,2, 0,8,9,2, 0,5,0,2, 0,5,1,2, 0,5,2,2, 0,5,3,2, 0,5,4,2, 0,5,5,2, 0,5,6,2, 0,5,7,2, 0,5,8,2, 0,5,9,2, 0,9,4,2, 0,9,5,2, 8,5,0,3, 8,5,1,3, 0,9,8,2, 0,9,9,2, 0,6,0,2, 0,6,1,2, 0,6,2,2, 0,6,3,2, 0,6,4,2, 0,6,5,2, 0,6,6,2, 0,6,7,2, 0,6,8,2, 0,6,9,2, 0,8,6,2, 0,8,7,2, 8,6,0,3, 8,6,1,3, 8,8,8,3, 8,8,9,3, 0,7,0,2, 0,7,1,2, 0,7,2,2, 0,7,3,2, 0,7,4,2, 0,7,5,2, 0,7,6,2, 0,7,7,2, 0,7,8,2, 0,7,9,2, 0,9,6,2, 0,9,7,2, 8,7,0,3, 8,7,1,3, 8,9,8,3, 8,9,9,3, 1,0,0,3, 1,0,1,3, 1,0,2,3, 1,0,3,3, 1,0,4,3, 1,0,5,3, 1,0,6,3, 1,0,7,3, 1,0,8,3, 1,0,9,3, 1,8,0,3, 1,8,1,3, 9,0,0,3, 9,0,1,3, 9,8,0,3, 9,8,1,3, 1,1,0,3, 1,1,1,3, 1,1,2,3, 1,1,3,3, 1,1,4,3, 1,1,5,3, 1,1,6,3, 1,1,7,3, 1,1,8,3, 1,1,9,3, 1,9,0,3, 1,9,1,3, 9,1,0,3, 9,1,1,3, 9,9,0,3, 9,9,1,3, 1,2,0,3, 1,2,1,3, 1,2,2,3, 1,2,3,3, 1,2,4,3, 1,2,5,3, 1,2,6,3, 1,2,7,3, 1,2,8,3, 1,2,9,3, 1,8,2,3, 1,8,3,3, 9,2,0,3, 9,2,1,3, 9,0,8,3, 9,0,9,3, 1,3,0,3, 1,3,1,3, 1,3,2,3, 1,3,3,3, 1,3,4,3, 1,3,5,3, 1,3,6,3, 1,3,7,3, 1,3,8,3, 1,3,9,3, 1,9,2,3, 1,9,3,3, 9,3,0,3, 9,3,1,3, 9,1,8,3, 9,1,9,3, 1,4,0,3, 1,4,1,3, 1,4,2,3, 1,4,3,3, 1,4,4,3, 1,4,5,3, 1,4,6,3, 1,4,7,3, 1,4,8,3, 1,4,9,3, 1,8,4,3, 1,8,5,3, 9,4,0,3, 9,4,1,3, 1,8,8,3, 1,8,9,3, 1,5,0,3, 1,5,1,3, 1,5,2,3, 1,5,3,3, 1,5,4,3, 1,5,5,3, 1,5,6,3, 1,5,7,3, 1,5,8,3, 1,5,9,3, 1,9,4,3, 1,9,5,3, 9,5,0,3, 9,5,1,3, 1,9,8,3, 1,9,9,3, 1,6,0,3, 1,6,1,3, 1,6,2,3, 1,6,3,3, 1,6,4,3, 1,6,5,3, 1,6,6,3, 1,6,7,3, 1,6,8,3, 1,6,9,3, 1,8,6,3, 1,8,7,3, 9,6,0,3, 9,6,1,3, 9,8,8,3, 9,8,9,3, 1,7,0,3, 1,7,1,3, 1,7,2,3, 1,7,3,3, 1,7,4,3, 1,7,5,3, 1,7,6,3, 1,7,7,3, 1,7,8,3, 1,7,9,3, 1,9,6,3, 1,9,7,3, 9,7,0,3, 9,7,1,3, 9,9,8,3, 9,9,9,3, 2,0,0,3, 2,0,1,3, 2,0,2,3, 2,0,3,3, 2,0,4,3, 2,0,5,3, 2,0,6,3, 2,0,7,3, 2,0,8,3, 2,0,9,3, 2,8,0,3, 2,8,1,3, 8,0,2,3, 8,0,3,3, 8,8,2,3, 8,8,3,3, 2,1,0,3, 2,1,1,3, 2,1,2,3, 2,1,3,3, 2,1,4,3, 2,1,5,3, 2,1,6,3, 2,1,7,3, 2,1,8,3, 2,1,9,3, 2,9,0,3, 2,9,1,3, 8,1,2,3, 8,1,3,3, 8,9,2,3, 8,9,3,3, 2,2,0,3, 2,2,1,3, 2,2,2,3, 2,2,3,3, 2,2,4,3, 2,2,5,3, 2,2,6,3, 2,2,7,3, 2,2,8,3, 2,2,9,3, 2,8,2,3, 2,8,3,3, 8,2,2,3, 8,2,3,3, 8,2,8,3, 8,2,9,3, 2,3,0,3, 2,3,1,3, 2,3,2,3, 2,3,3,3, 2,3,4,3, 2,3,5,3, 2,3,6,3, 2,3,7,3, 2,3,8,3, 2,3,9,3, 2,9,2,3, 2,9,3,3, 8,3,2,3, 8,3,3,3, 8,3,8,3, 8,3,9,3, 2,4,0,3, 2,4,1,3, 2,4,2,3, 2,4,3,3, 2,4,4,3, 2,4,5,3, 2,4,6,3, 2,4,7,3, 2,4,8,3, 2,4,9,3, 2,8,4,3, 2,8,5,3, 8,4,2,3, 8,4,3,3, 2,8,8,3, 2,8,9,3, 2,5,0,3, 2,5,1,3, 2,5,2,3, 2,5,3,3, 2,5,4,3, 2,5,5,3, 2,5,6,3, 2,5,7,3, 2,5,8,3, 2,5,9,3, 2,9,4,3, 2,9,5,3, 8,5,2,3, 8,5,3,3, 2,9,8,3, 2,9,9,3, 2,6,0,3, 2,6,1,3, 2,6,2,3, 2,6,3,3, 2,6,4,3, 2,6,5,3, 2,6,6,3, 2,6,7,3, 2,6,8,3, 2,6,9,3, 2,8,6,3, 2,8,7,3, 8,6,2,3, 8,6,3,3, 8,8,8,3, 8,8,9,3, 2,7,0,3, 2,7,1,3, 2,7,2,3, 2,7,3,3, 2,7,4,3, 2,7,5,3, 2,7,6,3, 2,7,7,3, 2,7,8,3, 2,7,9,3, 2,9,6,3, 2,9,7,3, 8,7,2,3, 8,7,3,3, 8,9,8,3, 8,9,9,3, 3,0,0,3, 3,0,1,3, 3,0,2,3, 3,0,3,3, 3,0,4,3, 3,0,5,3, 3,0,6,3, 3,0,7,3, 3,0,8,3, 3,0,9,3, 3,8,0,3, 3,8,1,3, 9,0,2,3, 9,0,3,3, 9,8,2,3, 9,8,3,3, 3,1,0,3, 3,1,1,3, 3,1,2,3, 3,1,3,3, 3,1,4,3, 3,1,5,3, 3,1,6,3, 3,1,7,3, 3,1,8,3, 3,1,9,3, 3,9,0,3, 3,9,1,3, 9,1,2,3, 9,1,3,3, 9,9,2,3, 9,9,3,3, 3,2,0,3, 3,2,1,3, 3,2,2,3, 3,2,3,3, 3,2,4,3, 3,2,5,3, 3,2,6,3, 3,2,7,3, 3,2,8,3, 3,2,9,3, 3,8,2,3, 3,8,3,3, 9,2,2,3, 9,2,3,3, 9,2,8,3, 9,2,9,3, 3,3,0,3, 3,3,1,3, 3,3,2,3, 3,3,3,3, 3,3,4,3, 3,3,5,3, 3,3,6,3, 3,3,7,3, 3,3,8,3, 3,3,9,3, 3,9,2,3, 3,9,3,3, 9,3,2,3, 9,3,3,3, 9,3,8,3, 9,3,9,3, 3,4,0,3, 3,4,1,3, 3,4,2,3, 3,4,3,3, 3,4,4,3, 3,4,5,3, 3,4,6,3, 3,4,7,3, 3,4,8,3, 3,4,9,3, 3,8,4,3, 3,8,5,3, 9,4,2,3, 9,4,3,3, 3,8,8,3, 3,8,9,3, 3,5,0,3, 3,5,1,3, 3,5,2,3, 3,5,3,3, 3,5,4,3, 3,5,5,3, 3,5,6,3, 3,5,7,3, 3,5,8,3, 3,5,9,3, 3,9,4,3, 3,9,5,3, 9,5,2,3, 9,5,3,3, 3,9,8,3, 3,9,9,3, 3,6,0,3, 3,6,1,3, 3,6,2,3, 3,6,3,3, 3,6,4,3, 3,6,5,3, 3,6,6,3, 3,6,7,3, 3,6,8,3, 3,6,9,3, 3,8,6,3, 3,8,7,3, 9,6,2,3, 9,6,3,3, 9,8,8,3, 9,8,9,3, 3,7,0,3, 3,7,1,3, 3,7,2,3, 3,7,3,3, 3,7,4,3, 3,7,5,3, 3,7,6,3, 3,7,7,3, 3,7,8,3, 3,7,9,3, 3,9,6,3, 3,9,7,3, 9,7,2,3, 9,7,3,3, 9,9,8,3, 9,9,9,3, 4,0,0,3, 4,0,1,3, 4,0,2,3, 4,0,3,3, 4,0,4,3, 4,0,5,3, 4,0,6,3, 4,0,7,3, 4,0,8,3, 4,0,9,3, 4,8,0,3, 4,8,1,3, 8,0,4,3, 8,0,5,3, 8,8,4,3, 8,8,5,3, 4,1,0,3, 4,1,1,3, 4,1,2,3, 4,1,3,3, 4,1,4,3, 4,1,5,3, 4,1,6,3, 4,1,7,3, 4,1,8,3, 4,1,9,3, 4,9,0,3, 4,9,1,3, 8,1,4,3, 8,1,5,3, 8,9,4,3, 8,9,5,3, 4,2,0,3, 4,2,1,3, 4,2,2,3, 4,2,3,3, 4,2,4,3, 4,2,5,3, 4,2,6,3, 4,2,7,3, 4,2,8,3, 4,2,9,3, 4,8,2,3, 4,8,3,3, 8,2,4,3, 8,2,5,3, 8,4,8,3, 8,4,9,3, 4,3,0,3, 4,3,1,3, 4,3,2,3, 4,3,3,3, 4,3,4,3, 4,3,5,3, 4,3,6,3, 4,3,7,3, 4,3,8,3, 4,3,9,3, 4,9,2,3, 4,9,3,3, 8,3,4,3, 8,3,5,3, 8,5,8,3, 8,5,9,3, 4,4,0,3, 4,4,1,3, 4,4,2,3, 4,4,3,3, 4,4,4,3, 4,4,5,3, 4,4,6,3, 4,4,7,3, 4,4,8,3, 4,4,9,3, 4,8,4,3, 4,8,5,3, 8,4,4,3, 8,4,5,3, 4,8,8,3, 4,8,9,3, 4,5,0,3, 4,5,1,3, 4,5,2,3, 4,5,3,3, 4,5,4,3, 4,5,5,3, 4,5,6,3, 4,5,7,3, 4,5,8,3, 4,5,9,3, 4,9,4,3, 4,9,5,3, 8,5,4,3, 8,5,5,3, 4,9,8,3, 4,9,9,3, 4,6,0,3, 4,6,1,3, 4,6,2,3, 4,6,3,3, 4,6,4,3, 4,6,5,3, 4,6,6,3, 4,6,7,3, 4,6,8,3, 4,6,9,3, 4,8,6,3, 4,8,7,3, 8,6,4,3, 8,6,5,3, 8,8,8,3, 8,8,9,3, 4,7,0,3, 4,7,1,3, 4,7,2,3, 4,7,3,3, 4,7,4,3, 4,7,5,3, 4,7,6,3, 4,7,7,3, 4,7,8,3, 4,7,9,3, 4,9,6,3, 4,9,7,3, 8,7,4,3, 8,7,5,3, 8,9,8,3, 8,9,9,3, 5,0,0,3, 5,0,1,3, 5,0,2,3, 5,0,3,3, 5,0,4,3, 5,0,5,3, 5,0,6,3, 5,0,7,3, 5,0,8,3, 5,0,9,3, 5,8,0,3, 5,8,1,3, 9,0,4,3, 9,0,5,3, 9,8,4,3, 9,8,5,3, 5,1,0,3, 5,1,1,3, 5,1,2,3, 5,1,3,3, 5,1,4,3, 5,1,5,3, 5,1,6,3, 5,1,7,3, 5,1,8,3, 5,1,9,3, 5,9,0,3, 5,9,1,3, 9,1,4,3, 9,1,5,3, 9,9,4,3, 9,9,5,3, 5,2,0,3, 5,2,1,3, 5,2,2,3, 5,2,3,3, 5,2,4,3, 5,2,5,3, 5,2,6,3, 5,2,7,3, 5,2,8,3, 5,2,9,3, 5,8,2,3, 5,8,3,3, 9,2,4,3, 9,2,5,3, 9,4,8,3, 9,4,9,3, 5,3,0,3, 5,3,1,3, 5,3,2,3, 5,3,3,3, 5,3,4,3, 5,3,5,3, 5,3,6,3, 5,3,7,3, 5,3,8,3, 5,3,9,3, 5,9,2,3, 5,9,3,3, 9,3,4,3, 9,3,5,3, 9,5,8,3, 9,5,9,3, 5,4,0,3, 5,4,1,3, 5,4,2,3, 5,4,3,3, 5,4,4,3, 5,4,5,3, 5,4,6,3, 5,4,7,3, 5,4,8,3, 5,4,9,3, 5,8,4,3, 5,8,5,3, 9,4,4,3, 9,4,5,3, 5,8,8,3, 5,8,9,3, 5,5,0,3, 5,5,1,3, 5,5,2,3, 5,5,3,3, 5,5,4,3, 5,5,5,3, 5,5,6,3, 5,5,7,3, 5,5,8,3, 5,5,9,3, 5,9,4,3, 5,9,5,3, 9,5,4,3, 9,5,5,3, 5,9,8,3, 5,9,9,3, 5,6,0,3, 5,6,1,3, 5,6,2,3, 5,6,3,3, 5,6,4,3, 5,6,5,3, 5,6,6,3, 5,6,7,3, 5,6,8,3, 5,6,9,3, 5,8,6,3, 5,8,7,3, 9,6,4,3, 9,6,5,3, 9,8,8,3, 9,8,9,3, 5,7,0,3, 5,7,1,3, 5,7,2,3, 5,7,3,3, 5,7,4,3, 5,7,5,3, 5,7,6,3, 5,7,7,3, 5,7,8,3, 5,7,9,3, 5,9,6,3, 5,9,7,3, 9,7,4,3, 9,7,5,3, 9,9,8,3, 9,9,9,3, 6,0,0,3, 6,0,1,3, 6,0,2,3, 6,0,3,3, 6,0,4,3, 6,0,5,3, 6,0,6,3, 6,0,7,3, 6,0,8,3, 6,0,9,3, 6,8,0,3, 6,8,1,3, 8,0,6,3, 8,0,7,3, 8,8,6,3, 8,8,7,3, 6,1,0,3, 6,1,1,3, 6,1,2,3, 6,1,3,3, 6,1,4,3, 6,1,5,3, 6,1,6,3, 6,1,7,3, 6,1,8,3, 6,1,9,3, 6,9,0,3, 6,9,1,3, 8,1,6,3, 8,1,7,3, 8,9,6,3, 8,9,7,3, 6,2,0,3, 6,2,1,3, 6,2,2,3, 6,2,3,3, 6,2,4,3, 6,2,5,3, 6,2,6,3, 6,2,7,3, 6,2,8,3, 6,2,9,3, 6,8,2,3, 6,8,3,3, 8,2,6,3, 8,2,7,3, 8,6,8,3, 8,6,9,3, 6,3,0,3, 6,3,1,3, 6,3,2,3, 6,3,3,3, 6,3,4,3, 6,3,5,3, 6,3,6,3, 6,3,7,3, 6,3,8,3, 6,3,9,3, 6,9,2,3, 6,9,3,3, 8,3,6,3, 8,3,7,3, 8,7,8,3, 8,7,9,3, 6,4,0,3, 6,4,1,3, 6,4,2,3, 6,4,3,3, 6,4,4,3, 6,4,5,3, 6,4,6,3, 6,4,7,3, 6,4,8,3, 6,4,9,3, 6,8,4,3, 6,8,5,3, 8,4,6,3, 8,4,7,3, 6,8,8,3, 6,8,9,3, 6,5,0,3, 6,5,1,3, 6,5,2,3, 6,5,3,3, 6,5,4,3, 6,5,5,3, 6,5,6,3, 6,5,7,3, 6,5,8,3, 6,5,9,3, 6,9,4,3, 6,9,5,3, 8,5,6,3, 8,5,7,3, 6,9,8,3, 6,9,9,3, 6,6,0,3, 6,6,1,3, 6,6,2,3, 6,6,3,3, 6,6,4,3, 6,6,5,3, 6,6,6,3, 6,6,7,3, 6,6,8,3, 6,6,9,3, 6,8,6,3, 6,8,7,3, 8,6,6,3, 8,6,7,3, 8,8,8,3, 8,8,9,3, 6,7,0,3, 6,7,1,3, 6,7,2,3, 6,7,3,3, 6,7,4,3, 6,7,5,3, 6,7,6,3, 6,7,7,3, 6,7,8,3, 6,7,9,3, 6,9,6,3, 6,9,7,3, 8,7,6,3, 8,7,7,3, 8,9,8,3, 8,9,9,3, 7,0,0,3, 7,0,1,3, 7,0,2,3, 7,0,3,3, 7,0,4,3, 7,0,5,3, 7,0,6,3, 7,0,7,3, 7,0,8,3, 7,0,9,3, 7,8,0,3, 7,8,1,3, 9,0,6,3, 9,0,7,3, 9,8,6,3, 9,8,7,3, 7,1,0,3, 7,1,1,3, 7,1,2,3, 7,1,3,3, 7,1,4,3, 7,1,5,3, 7,1,6,3, 7,1,7,3, 7,1,8,3, 7,1,9,3, 7,9,0,3, 7,9,1,3, 9,1,6,3, 9,1,7,3, 9,9,6,3, 9,9,7,3, 7,2,0,3, 7,2,1,3, 7,2,2,3, 7,2,3,3, 7,2,4,3, 7,2,5,3, 7,2,6,3, 7,2,7,3, 7,2,8,3, 7,2,9,3, 7,8,2,3, 7,8,3,3, 9,2,6,3, 9,2,7,3, 9,6,8,3, 9,6,9,3, 7,3,0,3, 7,3,1,3, 7,3,2,3, 7,3,3,3, 7,3,4,3, 7,3,5,3, 7,3,6,3, 7,3,7,3, 7,3,8,3, 7,3,9,3, 7,9,2,3, 7,9,3,3, 9,3,6,3, 9,3,7,3, 9,7,8,3, 9,7,9,3, 7,4,0,3, 7,4,1,3, 7,4,2,3, 7,4,3,3, 7,4,4,3, 7,4,5,3, 7,4,6,3, 7,4,7,3, 7,4,8,3, 7,4,9,3, 7,8,4,3, 7,8,5,3, 9,4,6,3, 9,4,7,3, 7,8,8,3, 7,8,9,3, 7,5,0,3, 7,5,1,3, 7,5,2,3, 7,5,3,3, 7,5,4,3, 7,5,5,3, 7,5,6,3, 7,5,7,3, 7,5,8,3, 7,5,9,3, 7,9,4,3, 7,9,5,3, 9,5,6,3, 9,5,7,3, 7,9,8,3, 7,9,9,3, 7,6,0,3, 7,6,1,3, 7,6,2,3, 7,6,3,3, 7,6,4,3, 7,6,5,3, 7,6,6,3, 7,6,7,3, 7,6,8,3, 7,6,9,3, 7,8,6,3, 7,8,7,3, 9,6,6,3, 9,6,7,3, 9,8,8,3, 9,8,9,3, 7,7,0,3, 7,7,1,3, 7,7,2,3, 7,7,3,3, 7,7,4,3, 7,7,5,3, 7,7,6,3, 7,7,7,3, 7,7,8,3, 7,7,9,3, 7,9,6,3, 7,9,7,3, 9,7,6,3, 9,7,7,3, 9,9,8,3, 9,9,9,3}; #endif #if defined(DEC_BIN2BCD8) && DEC_BIN2BCD8==1 && !defined(DECBIN2BCD8) #define DECBIN2BCD8 const uint8_t BIN2BCD8[4000]={ 0,0,0,0, 0,0,1,1, 0,0,2,1, 0,0,3,1, 0,0,4,1, 0,0,5,1, 0,0,6,1, 0,0,7,1, 0,0,8,1, 0,0,9,1, 0,1,0,2, 0,1,1,2, 0,1,2,2, 0,1,3,2, 0,1,4,2, 0,1,5,2, 0,1,6,2, 0,1,7,2, 0,1,8,2, 0,1,9,2, 0,2,0,2, 0,2,1,2, 0,2,2,2, 0,2,3,2, 0,2,4,2, 0,2,5,2, 0,2,6,2, 0,2,7,2, 0,2,8,2, 0,2,9,2, 0,3,0,2, 0,3,1,2, 0,3,2,2, 0,3,3,2, 0,3,4,2, 0,3,5,2, 0,3,6,2, 0,3,7,2, 0,3,8,2, 0,3,9,2, 0,4,0,2, 0,4,1,2, 0,4,2,2, 0,4,3,2, 0,4,4,2, 0,4,5,2, 0,4,6,2, 0,4,7,2, 0,4,8,2, 0,4,9,2, 0,5,0,2, 0,5,1,2, 0,5,2,2, 0,5,3,2, 0,5,4,2, 0,5,5,2, 0,5,6,2, 0,5,7,2, 0,5,8,2, 0,5,9,2, 0,6,0,2, 0,6,1,2, 0,6,2,2, 0,6,3,2, 0,6,4,2, 0,6,5,2, 0,6,6,2, 0,6,7,2, 0,6,8,2, 0,6,9,2, 0,7,0,2, 0,7,1,2, 0,7,2,2, 0,7,3,2, 0,7,4,2, 0,7,5,2, 0,7,6,2, 0,7,7,2, 0,7,8,2, 0,7,9,2, 0,8,0,2, 0,8,1,2, 0,8,2,2, 0,8,3,2, 0,8,4,2, 0,8,5,2, 0,8,6,2, 0,8,7,2, 0,8,8,2, 0,8,9,2, 0,9,0,2, 0,9,1,2, 0,9,2,2, 0,9,3,2, 0,9,4,2, 0,9,5,2, 0,9,6,2, 0,9,7,2, 0,9,8,2, 0,9,9,2, 1,0,0,3, 1,0,1,3, 1,0,2,3, 1,0,3,3, 1,0,4,3, 1,0,5,3, 1,0,6,3, 1,0,7,3, 1,0,8,3, 1,0,9,3, 1,1,0,3, 1,1,1,3, 1,1,2,3, 1,1,3,3, 1,1,4,3, 1,1,5,3, 1,1,6,3, 1,1,7,3, 1,1,8,3, 1,1,9,3, 1,2,0,3, 1,2,1,3, 1,2,2,3, 1,2,3,3, 1,2,4,3, 1,2,5,3, 1,2,6,3, 1,2,7,3, 1,2,8,3, 1,2,9,3, 1,3,0,3, 1,3,1,3, 1,3,2,3, 1,3,3,3, 1,3,4,3, 1,3,5,3, 1,3,6,3, 1,3,7,3, 1,3,8,3, 1,3,9,3, 1,4,0,3, 1,4,1,3, 1,4,2,3, 1,4,3,3, 1,4,4,3, 1,4,5,3, 1,4,6,3, 1,4,7,3, 1,4,8,3, 1,4,9,3, 1,5,0,3, 1,5,1,3, 1,5,2,3, 1,5,3,3, 1,5,4,3, 1,5,5,3, 1,5,6,3, 1,5,7,3, 1,5,8,3, 1,5,9,3, 1,6,0,3, 1,6,1,3, 1,6,2,3, 1,6,3,3, 1,6,4,3, 1,6,5,3, 1,6,6,3, 1,6,7,3, 1,6,8,3, 1,6,9,3, 1,7,0,3, 1,7,1,3, 1,7,2,3, 1,7,3,3, 1,7,4,3, 1,7,5,3, 1,7,6,3, 1,7,7,3, 1,7,8,3, 1,7,9,3, 1,8,0,3, 1,8,1,3, 1,8,2,3, 1,8,3,3, 1,8,4,3, 1,8,5,3, 1,8,6,3, 1,8,7,3, 1,8,8,3, 1,8,9,3, 1,9,0,3, 1,9,1,3, 1,9,2,3, 1,9,3,3, 1,9,4,3, 1,9,5,3, 1,9,6,3, 1,9,7,3, 1,9,8,3, 1,9,9,3, 2,0,0,3, 2,0,1,3, 2,0,2,3, 2,0,3,3, 2,0,4,3, 2,0,5,3, 2,0,6,3, 2,0,7,3, 2,0,8,3, 2,0,9,3, 2,1,0,3, 2,1,1,3, 2,1,2,3, 2,1,3,3, 2,1,4,3, 2,1,5,3, 2,1,6,3, 2,1,7,3, 2,1,8,3, 2,1,9,3, 2,2,0,3, 2,2,1,3, 2,2,2,3, 2,2,3,3, 2,2,4,3, 2,2,5,3, 2,2,6,3, 2,2,7,3, 2,2,8,3, 2,2,9,3, 2,3,0,3, 2,3,1,3, 2,3,2,3, 2,3,3,3, 2,3,4,3, 2,3,5,3, 2,3,6,3, 2,3,7,3, 2,3,8,3, 2,3,9,3, 2,4,0,3, 2,4,1,3, 2,4,2,3, 2,4,3,3, 2,4,4,3, 2,4,5,3, 2,4,6,3, 2,4,7,3, 2,4,8,3, 2,4,9,3, 2,5,0,3, 2,5,1,3, 2,5,2,3, 2,5,3,3, 2,5,4,3, 2,5,5,3, 2,5,6,3, 2,5,7,3, 2,5,8,3, 2,5,9,3, 2,6,0,3, 2,6,1,3, 2,6,2,3, 2,6,3,3, 2,6,4,3, 2,6,5,3, 2,6,6,3, 2,6,7,3, 2,6,8,3, 2,6,9,3, 2,7,0,3, 2,7,1,3, 2,7,2,3, 2,7,3,3, 2,7,4,3, 2,7,5,3, 2,7,6,3, 2,7,7,3, 2,7,8,3, 2,7,9,3, 2,8,0,3, 2,8,1,3, 2,8,2,3, 2,8,3,3, 2,8,4,3, 2,8,5,3, 2,8,6,3, 2,8,7,3, 2,8,8,3, 2,8,9,3, 2,9,0,3, 2,9,1,3, 2,9,2,3, 2,9,3,3, 2,9,4,3, 2,9,5,3, 2,9,6,3, 2,9,7,3, 2,9,8,3, 2,9,9,3, 3,0,0,3, 3,0,1,3, 3,0,2,3, 3,0,3,3, 3,0,4,3, 3,0,5,3, 3,0,6,3, 3,0,7,3, 3,0,8,3, 3,0,9,3, 3,1,0,3, 3,1,1,3, 3,1,2,3, 3,1,3,3, 3,1,4,3, 3,1,5,3, 3,1,6,3, 3,1,7,3, 3,1,8,3, 3,1,9,3, 3,2,0,3, 3,2,1,3, 3,2,2,3, 3,2,3,3, 3,2,4,3, 3,2,5,3, 3,2,6,3, 3,2,7,3, 3,2,8,3, 3,2,9,3, 3,3,0,3, 3,3,1,3, 3,3,2,3, 3,3,3,3, 3,3,4,3, 3,3,5,3, 3,3,6,3, 3,3,7,3, 3,3,8,3, 3,3,9,3, 3,4,0,3, 3,4,1,3, 3,4,2,3, 3,4,3,3, 3,4,4,3, 3,4,5,3, 3,4,6,3, 3,4,7,3, 3,4,8,3, 3,4,9,3, 3,5,0,3, 3,5,1,3, 3,5,2,3, 3,5,3,3, 3,5,4,3, 3,5,5,3, 3,5,6,3, 3,5,7,3, 3,5,8,3, 3,5,9,3, 3,6,0,3, 3,6,1,3, 3,6,2,3, 3,6,3,3, 3,6,4,3, 3,6,5,3, 3,6,6,3, 3,6,7,3, 3,6,8,3, 3,6,9,3, 3,7,0,3, 3,7,1,3, 3,7,2,3, 3,7,3,3, 3,7,4,3, 3,7,5,3, 3,7,6,3, 3,7,7,3, 3,7,8,3, 3,7,9,3, 3,8,0,3, 3,8,1,3, 3,8,2,3, 3,8,3,3, 3,8,4,3, 3,8,5,3, 3,8,6,3, 3,8,7,3, 3,8,8,3, 3,8,9,3, 3,9,0,3, 3,9,1,3, 3,9,2,3, 3,9,3,3, 3,9,4,3, 3,9,5,3, 3,9,6,3, 3,9,7,3, 3,9,8,3, 3,9,9,3, 4,0,0,3, 4,0,1,3, 4,0,2,3, 4,0,3,3, 4,0,4,3, 4,0,5,3, 4,0,6,3, 4,0,7,3, 4,0,8,3, 4,0,9,3, 4,1,0,3, 4,1,1,3, 4,1,2,3, 4,1,3,3, 4,1,4,3, 4,1,5,3, 4,1,6,3, 4,1,7,3, 4,1,8,3, 4,1,9,3, 4,2,0,3, 4,2,1,3, 4,2,2,3, 4,2,3,3, 4,2,4,3, 4,2,5,3, 4,2,6,3, 4,2,7,3, 4,2,8,3, 4,2,9,3, 4,3,0,3, 4,3,1,3, 4,3,2,3, 4,3,3,3, 4,3,4,3, 4,3,5,3, 4,3,6,3, 4,3,7,3, 4,3,8,3, 4,3,9,3, 4,4,0,3, 4,4,1,3, 4,4,2,3, 4,4,3,3, 4,4,4,3, 4,4,5,3, 4,4,6,3, 4,4,7,3, 4,4,8,3, 4,4,9,3, 4,5,0,3, 4,5,1,3, 4,5,2,3, 4,5,3,3, 4,5,4,3, 4,5,5,3, 4,5,6,3, 4,5,7,3, 4,5,8,3, 4,5,9,3, 4,6,0,3, 4,6,1,3, 4,6,2,3, 4,6,3,3, 4,6,4,3, 4,6,5,3, 4,6,6,3, 4,6,7,3, 4,6,8,3, 4,6,9,3, 4,7,0,3, 4,7,1,3, 4,7,2,3, 4,7,3,3, 4,7,4,3, 4,7,5,3, 4,7,6,3, 4,7,7,3, 4,7,8,3, 4,7,9,3, 4,8,0,3, 4,8,1,3, 4,8,2,3, 4,8,3,3, 4,8,4,3, 4,8,5,3, 4,8,6,3, 4,8,7,3, 4,8,8,3, 4,8,9,3, 4,9,0,3, 4,9,1,3, 4,9,2,3, 4,9,3,3, 4,9,4,3, 4,9,5,3, 4,9,6,3, 4,9,7,3, 4,9,8,3, 4,9,9,3, 5,0,0,3, 5,0,1,3, 5,0,2,3, 5,0,3,3, 5,0,4,3, 5,0,5,3, 5,0,6,3, 5,0,7,3, 5,0,8,3, 5,0,9,3, 5,1,0,3, 5,1,1,3, 5,1,2,3, 5,1,3,3, 5,1,4,3, 5,1,5,3, 5,1,6,3, 5,1,7,3, 5,1,8,3, 5,1,9,3, 5,2,0,3, 5,2,1,3, 5,2,2,3, 5,2,3,3, 5,2,4,3, 5,2,5,3, 5,2,6,3, 5,2,7,3, 5,2,8,3, 5,2,9,3, 5,3,0,3, 5,3,1,3, 5,3,2,3, 5,3,3,3, 5,3,4,3, 5,3,5,3, 5,3,6,3, 5,3,7,3, 5,3,8,3, 5,3,9,3, 5,4,0,3, 5,4,1,3, 5,4,2,3, 5,4,3,3, 5,4,4,3, 5,4,5,3, 5,4,6,3, 5,4,7,3, 5,4,8,3, 5,4,9,3, 5,5,0,3, 5,5,1,3, 5,5,2,3, 5,5,3,3, 5,5,4,3, 5,5,5,3, 5,5,6,3, 5,5,7,3, 5,5,8,3, 5,5,9,3, 5,6,0,3, 5,6,1,3, 5,6,2,3, 5,6,3,3, 5,6,4,3, 5,6,5,3, 5,6,6,3, 5,6,7,3, 5,6,8,3, 5,6,9,3, 5,7,0,3, 5,7,1,3, 5,7,2,3, 5,7,3,3, 5,7,4,3, 5,7,5,3, 5,7,6,3, 5,7,7,3, 5,7,8,3, 5,7,9,3, 5,8,0,3, 5,8,1,3, 5,8,2,3, 5,8,3,3, 5,8,4,3, 5,8,5,3, 5,8,6,3, 5,8,7,3, 5,8,8,3, 5,8,9,3, 5,9,0,3, 5,9,1,3, 5,9,2,3, 5,9,3,3, 5,9,4,3, 5,9,5,3, 5,9,6,3, 5,9,7,3, 5,9,8,3, 5,9,9,3, 6,0,0,3, 6,0,1,3, 6,0,2,3, 6,0,3,3, 6,0,4,3, 6,0,5,3, 6,0,6,3, 6,0,7,3, 6,0,8,3, 6,0,9,3, 6,1,0,3, 6,1,1,3, 6,1,2,3, 6,1,3,3, 6,1,4,3, 6,1,5,3, 6,1,6,3, 6,1,7,3, 6,1,8,3, 6,1,9,3, 6,2,0,3, 6,2,1,3, 6,2,2,3, 6,2,3,3, 6,2,4,3, 6,2,5,3, 6,2,6,3, 6,2,7,3, 6,2,8,3, 6,2,9,3, 6,3,0,3, 6,3,1,3, 6,3,2,3, 6,3,3,3, 6,3,4,3, 6,3,5,3, 6,3,6,3, 6,3,7,3, 6,3,8,3, 6,3,9,3, 6,4,0,3, 6,4,1,3, 6,4,2,3, 6,4,3,3, 6,4,4,3, 6,4,5,3, 6,4,6,3, 6,4,7,3, 6,4,8,3, 6,4,9,3, 6,5,0,3, 6,5,1,3, 6,5,2,3, 6,5,3,3, 6,5,4,3, 6,5,5,3, 6,5,6,3, 6,5,7,3, 6,5,8,3, 6,5,9,3, 6,6,0,3, 6,6,1,3, 6,6,2,3, 6,6,3,3, 6,6,4,3, 6,6,5,3, 6,6,6,3, 6,6,7,3, 6,6,8,3, 6,6,9,3, 6,7,0,3, 6,7,1,3, 6,7,2,3, 6,7,3,3, 6,7,4,3, 6,7,5,3, 6,7,6,3, 6,7,7,3, 6,7,8,3, 6,7,9,3, 6,8,0,3, 6,8,1,3, 6,8,2,3, 6,8,3,3, 6,8,4,3, 6,8,5,3, 6,8,6,3, 6,8,7,3, 6,8,8,3, 6,8,9,3, 6,9,0,3, 6,9,1,3, 6,9,2,3, 6,9,3,3, 6,9,4,3, 6,9,5,3, 6,9,6,3, 6,9,7,3, 6,9,8,3, 6,9,9,3, 7,0,0,3, 7,0,1,3, 7,0,2,3, 7,0,3,3, 7,0,4,3, 7,0,5,3, 7,0,6,3, 7,0,7,3, 7,0,8,3, 7,0,9,3, 7,1,0,3, 7,1,1,3, 7,1,2,3, 7,1,3,3, 7,1,4,3, 7,1,5,3, 7,1,6,3, 7,1,7,3, 7,1,8,3, 7,1,9,3, 7,2,0,3, 7,2,1,3, 7,2,2,3, 7,2,3,3, 7,2,4,3, 7,2,5,3, 7,2,6,3, 7,2,7,3, 7,2,8,3, 7,2,9,3, 7,3,0,3, 7,3,1,3, 7,3,2,3, 7,3,3,3, 7,3,4,3, 7,3,5,3, 7,3,6,3, 7,3,7,3, 7,3,8,3, 7,3,9,3, 7,4,0,3, 7,4,1,3, 7,4,2,3, 7,4,3,3, 7,4,4,3, 7,4,5,3, 7,4,6,3, 7,4,7,3, 7,4,8,3, 7,4,9,3, 7,5,0,3, 7,5,1,3, 7,5,2,3, 7,5,3,3, 7,5,4,3, 7,5,5,3, 7,5,6,3, 7,5,7,3, 7,5,8,3, 7,5,9,3, 7,6,0,3, 7,6,1,3, 7,6,2,3, 7,6,3,3, 7,6,4,3, 7,6,5,3, 7,6,6,3, 7,6,7,3, 7,6,8,3, 7,6,9,3, 7,7,0,3, 7,7,1,3, 7,7,2,3, 7,7,3,3, 7,7,4,3, 7,7,5,3, 7,7,6,3, 7,7,7,3, 7,7,8,3, 7,7,9,3, 7,8,0,3, 7,8,1,3, 7,8,2,3, 7,8,3,3, 7,8,4,3, 7,8,5,3, 7,8,6,3, 7,8,7,3, 7,8,8,3, 7,8,9,3, 7,9,0,3, 7,9,1,3, 7,9,2,3, 7,9,3,3, 7,9,4,3, 7,9,5,3, 7,9,6,3, 7,9,7,3, 7,9,8,3, 7,9,9,3, 8,0,0,3, 8,0,1,3, 8,0,2,3, 8,0,3,3, 8,0,4,3, 8,0,5,3, 8,0,6,3, 8,0,7,3, 8,0,8,3, 8,0,9,3, 8,1,0,3, 8,1,1,3, 8,1,2,3, 8,1,3,3, 8,1,4,3, 8,1,5,3, 8,1,6,3, 8,1,7,3, 8,1,8,3, 8,1,9,3, 8,2,0,3, 8,2,1,3, 8,2,2,3, 8,2,3,3, 8,2,4,3, 8,2,5,3, 8,2,6,3, 8,2,7,3, 8,2,8,3, 8,2,9,3, 8,3,0,3, 8,3,1,3, 8,3,2,3, 8,3,3,3, 8,3,4,3, 8,3,5,3, 8,3,6,3, 8,3,7,3, 8,3,8,3, 8,3,9,3, 8,4,0,3, 8,4,1,3, 8,4,2,3, 8,4,3,3, 8,4,4,3, 8,4,5,3, 8,4,6,3, 8,4,7,3, 8,4,8,3, 8,4,9,3, 8,5,0,3, 8,5,1,3, 8,5,2,3, 8,5,3,3, 8,5,4,3, 8,5,5,3, 8,5,6,3, 8,5,7,3, 8,5,8,3, 8,5,9,3, 8,6,0,3, 8,6,1,3, 8,6,2,3, 8,6,3,3, 8,6,4,3, 8,6,5,3, 8,6,6,3, 8,6,7,3, 8,6,8,3, 8,6,9,3, 8,7,0,3, 8,7,1,3, 8,7,2,3, 8,7,3,3, 8,7,4,3, 8,7,5,3, 8,7,6,3, 8,7,7,3, 8,7,8,3, 8,7,9,3, 8,8,0,3, 8,8,1,3, 8,8,2,3, 8,8,3,3, 8,8,4,3, 8,8,5,3, 8,8,6,3, 8,8,7,3, 8,8,8,3, 8,8,9,3, 8,9,0,3, 8,9,1,3, 8,9,2,3, 8,9,3,3, 8,9,4,3, 8,9,5,3, 8,9,6,3, 8,9,7,3, 8,9,8,3, 8,9,9,3, 9,0,0,3, 9,0,1,3, 9,0,2,3, 9,0,3,3, 9,0,4,3, 9,0,5,3, 9,0,6,3, 9,0,7,3, 9,0,8,3, 9,0,9,3, 9,1,0,3, 9,1,1,3, 9,1,2,3, 9,1,3,3, 9,1,4,3, 9,1,5,3, 9,1,6,3, 9,1,7,3, 9,1,8,3, 9,1,9,3, 9,2,0,3, 9,2,1,3, 9,2,2,3, 9,2,3,3, 9,2,4,3, 9,2,5,3, 9,2,6,3, 9,2,7,3, 9,2,8,3, 9,2,9,3, 9,3,0,3, 9,3,1,3, 9,3,2,3, 9,3,3,3, 9,3,4,3, 9,3,5,3, 9,3,6,3, 9,3,7,3, 9,3,8,3, 9,3,9,3, 9,4,0,3, 9,4,1,3, 9,4,2,3, 9,4,3,3, 9,4,4,3, 9,4,5,3, 9,4,6,3, 9,4,7,3, 9,4,8,3, 9,4,9,3, 9,5,0,3, 9,5,1,3, 9,5,2,3, 9,5,3,3, 9,5,4,3, 9,5,5,3, 9,5,6,3, 9,5,7,3, 9,5,8,3, 9,5,9,3, 9,6,0,3, 9,6,1,3, 9,6,2,3, 9,6,3,3, 9,6,4,3, 9,6,5,3, 9,6,6,3, 9,6,7,3, 9,6,8,3, 9,6,9,3, 9,7,0,3, 9,7,1,3, 9,7,2,3, 9,7,3,3, 9,7,4,3, 9,7,5,3, 9,7,6,3, 9,7,7,3, 9,7,8,3, 9,7,9,3, 9,8,0,3, 9,8,1,3, 9,8,2,3, 9,8,3,3, 9,8,4,3, 9,8,5,3, 9,8,6,3, 9,8,7,3, 9,8,8,3, 9,8,9,3, 9,9,0,3, 9,9,1,3, 9,9,2,3, 9,9,3,3, 9,9,4,3, 9,9,5,3, 9,9,6,3, 9,9,7,3, 9,9,8,3, 9,9,9,3}; #endif jq-jq-1.8.0/vendor/decNumber/decDouble.c000066400000000000000000000156561501676513100200170ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decDouble.c -- decDouble operations module */ /* ------------------------------------------------------------------ */ /* 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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 decDouble operations (including conversions) */ /* ------------------------------------------------------------------ */ #include "decContext.h" // public includes #include "decDouble.h" // .. /* Constant mappings for shared code */ #define DECPMAX DECDOUBLE_Pmax #define DECEMIN DECDOUBLE_Emin #define DECEMAX DECDOUBLE_Emax #define DECEMAXD DECDOUBLE_EmaxD #define DECBYTES DECDOUBLE_Bytes #define DECSTRING DECDOUBLE_String #define DECECONL DECDOUBLE_EconL #define DECBIAS DECDOUBLE_Bias #define DECLETS DECDOUBLE_Declets #define DECQTINY (-DECDOUBLE_Bias) // parameters of next-wider format #define DECWBYTES DECQUAD_Bytes #define DECWPMAX DECQUAD_Pmax #define DECWECONL DECQUAD_EconL #define DECWBIAS DECQUAD_Bias /* Type and function mappings for shared code */ #define decFloat decDouble // Type name #define decFloatWider decQuad // Type name // Utilities and conversions (binary results, extractors, etc.) #define decFloatFromBCD decDoubleFromBCD #define decFloatFromInt32 decDoubleFromInt32 #define decFloatFromPacked decDoubleFromPacked #define decFloatFromPackedChecked decDoubleFromPackedChecked #define decFloatFromString decDoubleFromString #define decFloatFromUInt32 decDoubleFromUInt32 #define decFloatFromWider decDoubleFromWider #define decFloatGetCoefficient decDoubleGetCoefficient #define decFloatGetExponent decDoubleGetExponent #define decFloatSetCoefficient decDoubleSetCoefficient #define decFloatSetExponent decDoubleSetExponent #define decFloatShow decDoubleShow #define decFloatToBCD decDoubleToBCD #define decFloatToEngString decDoubleToEngString #define decFloatToInt32 decDoubleToInt32 #define decFloatToInt32Exact decDoubleToInt32Exact #define decFloatToPacked decDoubleToPacked #define decFloatToString decDoubleToString #define decFloatToUInt32 decDoubleToUInt32 #define decFloatToUInt32Exact decDoubleToUInt32Exact #define decFloatToWider decDoubleToWider #define decFloatZero decDoubleZero // Computational (result is a decFloat) #define decFloatAbs decDoubleAbs #define decFloatAdd decDoubleAdd #define decFloatAnd decDoubleAnd #define decFloatDivide decDoubleDivide #define decFloatDivideInteger decDoubleDivideInteger #define decFloatFMA decDoubleFMA #define decFloatInvert decDoubleInvert #define decFloatLogB decDoubleLogB #define decFloatMax decDoubleMax #define decFloatMaxMag decDoubleMaxMag #define decFloatMin decDoubleMin #define decFloatMinMag decDoubleMinMag #define decFloatMinus decDoubleMinus #define decFloatMultiply decDoubleMultiply #define decFloatNextMinus decDoubleNextMinus #define decFloatNextPlus decDoubleNextPlus #define decFloatNextToward decDoubleNextToward #define decFloatOr decDoubleOr #define decFloatPlus decDoublePlus #define decFloatQuantize decDoubleQuantize #define decFloatReduce decDoubleReduce #define decFloatRemainder decDoubleRemainder #define decFloatRemainderNear decDoubleRemainderNear #define decFloatRotate decDoubleRotate #define decFloatScaleB decDoubleScaleB #define decFloatShift decDoubleShift #define decFloatSubtract decDoubleSubtract #define decFloatToIntegralValue decDoubleToIntegralValue #define decFloatToIntegralExact decDoubleToIntegralExact #define decFloatXor decDoubleXor // Comparisons #define decFloatCompare decDoubleCompare #define decFloatCompareSignal decDoubleCompareSignal #define decFloatCompareTotal decDoubleCompareTotal #define decFloatCompareTotalMag decDoubleCompareTotalMag // Copies #define decFloatCanonical decDoubleCanonical #define decFloatCopy decDoubleCopy #define decFloatCopyAbs decDoubleCopyAbs #define decFloatCopyNegate decDoubleCopyNegate #define decFloatCopySign decDoubleCopySign // Non-computational #define decFloatClass decDoubleClass #define decFloatClassString decDoubleClassString #define decFloatDigits decDoubleDigits #define decFloatIsCanonical decDoubleIsCanonical #define decFloatIsFinite decDoubleIsFinite #define decFloatIsInfinite decDoubleIsInfinite #define decFloatIsInteger decDoubleIsInteger #define decFloatIsLogical decDoubleIsLogical #define decFloatIsNaN decDoubleIsNaN #define decFloatIsNegative decDoubleIsNegative #define decFloatIsNormal decDoubleIsNormal #define decFloatIsPositive decDoubleIsPositive #define decFloatIsSignaling decDoubleIsSignaling #define decFloatIsSignalling decDoubleIsSignalling #define decFloatIsSigned decDoubleIsSigned #define decFloatIsSubnormal decDoubleIsSubnormal #define decFloatIsZero decDoubleIsZero #define decFloatRadix decDoubleRadix #define decFloatSameQuantum decDoubleSameQuantum #define decFloatVersion decDoubleVersion #include "decNumberLocal.h" // local includes (need DECPMAX) #include "decCommon.c" // non-arithmetic decFloat routines #include "decBasic.c" // basic formats routines jq-jq-1.8.0/vendor/decNumber/decDouble.h000066400000000000000000000243241501676513100200140ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decDouble.h -- Decimal 64-bit format 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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(DECDOUBLE) #define DECDOUBLE #define DECDOUBLENAME "decimalDouble" /* Short name */ #define DECDOUBLETITLE "Decimal 64-bit datum" /* Verbose name */ #define DECDOUBLEAUTHOR "Mike Cowlishaw" /* Who to blame */ /* parameters for decDoubles */ #define DECDOUBLE_Bytes 8 /* length */ #define DECDOUBLE_Pmax 16 /* maximum precision (digits) */ #define DECDOUBLE_Emin -383 /* minimum adjusted exponent */ #define DECDOUBLE_Emax 384 /* maximum adjusted exponent */ #define DECDOUBLE_EmaxD 3 /* maximum exponent digits */ #define DECDOUBLE_Bias 398 /* bias for the exponent */ #define DECDOUBLE_String 25 /* maximum string length, +1 */ #define DECDOUBLE_EconL 8 /* exponent continuation length */ #define DECDOUBLE_Declets 5 /* count of declets */ /* highest biased exponent (Elimit-1) */ #define DECDOUBLE_Ehigh (DECDOUBLE_Emax + DECDOUBLE_Bias - (DECDOUBLE_Pmax-1)) /* Required includes */ #include "decContext.h" #include "decQuad.h" /* The decDouble decimal 64-bit type, accessible by all sizes */ typedef union { uint8_t bytes[DECDOUBLE_Bytes]; /* fields: 1, 5, 8, 50 bits */ uint16_t shorts[DECDOUBLE_Bytes/2]; uint32_t words[DECDOUBLE_Bytes/4]; #if DECUSE64 uint64_t longs[DECDOUBLE_Bytes/8]; #endif } decDouble; /* ---------------------------------------------------------------- */ /* Routines -- implemented as decFloat routines in common files */ /* ---------------------------------------------------------------- */ /* Utilities and conversions, extractors, etc.) */ extern decDouble * decDoubleFromBCD(decDouble *, int32_t, const uint8_t *, int32_t); extern decDouble * decDoubleFromInt32(decDouble *, int32_t); extern decDouble * decDoubleFromPacked(decDouble *, int32_t, const uint8_t *); extern decDouble * decDoubleFromPackedChecked(decDouble *, int32_t, const uint8_t *); extern decDouble * decDoubleFromString(decDouble *, const char *, decContext *); extern decDouble * decDoubleFromUInt32(decDouble *, uint32_t); extern decDouble * decDoubleFromWider(decDouble *, const decQuad *, decContext *); extern int32_t decDoubleGetCoefficient(const decDouble *, uint8_t *); extern int32_t decDoubleGetExponent(const decDouble *); extern decDouble * decDoubleSetCoefficient(decDouble *, const uint8_t *, int32_t); extern decDouble * decDoubleSetExponent(decDouble *, decContext *, int32_t); extern void decDoubleShow(const decDouble *, const char *); extern int32_t decDoubleToBCD(const decDouble *, int32_t *, uint8_t *); extern char * decDoubleToEngString(const decDouble *, char *); extern int32_t decDoubleToInt32(const decDouble *, decContext *, enum rounding); extern int32_t decDoubleToInt32Exact(const decDouble *, decContext *, enum rounding); extern int32_t decDoubleToPacked(const decDouble *, int32_t *, uint8_t *); extern char * decDoubleToString(const decDouble *, char *); extern uint32_t decDoubleToUInt32(const decDouble *, decContext *, enum rounding); extern uint32_t decDoubleToUInt32Exact(const decDouble *, decContext *, enum rounding); extern decQuad * decDoubleToWider(const decDouble *, decQuad *); extern decDouble * decDoubleZero(decDouble *); /* Computational (result is a decDouble) */ extern decDouble * decDoubleAbs(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleAdd(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleAnd(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleDivide(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleDivideInteger(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleFMA(decDouble *, const decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleInvert(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleLogB(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleMax(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleMaxMag(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleMin(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleMinMag(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleMinus(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleMultiply(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleNextMinus(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleNextPlus(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleNextToward(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleOr(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoublePlus(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleQuantize(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleReduce(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleRemainder(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleRemainderNear(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleRotate(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleScaleB(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleShift(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleSubtract(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleToIntegralValue(decDouble *, const decDouble *, decContext *, enum rounding); extern decDouble * decDoubleToIntegralExact(decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleXor(decDouble *, const decDouble *, const decDouble *, decContext *); /* Comparisons */ extern decDouble * decDoubleCompare(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleCompareSignal(decDouble *, const decDouble *, const decDouble *, decContext *); extern decDouble * decDoubleCompareTotal(decDouble *, const decDouble *, const decDouble *); extern decDouble * decDoubleCompareTotalMag(decDouble *, const decDouble *, const decDouble *); /* Copies */ extern decDouble * decDoubleCanonical(decDouble *, const decDouble *); extern decDouble * decDoubleCopy(decDouble *, const decDouble *); extern decDouble * decDoubleCopyAbs(decDouble *, const decDouble *); extern decDouble * decDoubleCopyNegate(decDouble *, const decDouble *); extern decDouble * decDoubleCopySign(decDouble *, const decDouble *, const decDouble *); /* Non-computational */ extern enum decClass decDoubleClass(const decDouble *); extern const char * decDoubleClassString(const decDouble *); extern uint32_t decDoubleDigits(const decDouble *); extern uint32_t decDoubleIsCanonical(const decDouble *); extern uint32_t decDoubleIsFinite(const decDouble *); extern uint32_t decDoubleIsInfinite(const decDouble *); extern uint32_t decDoubleIsInteger(const decDouble *); extern uint32_t decDoubleIsLogical(const decDouble *); extern uint32_t decDoubleIsNaN(const decDouble *); extern uint32_t decDoubleIsNegative(const decDouble *); extern uint32_t decDoubleIsNormal(const decDouble *); extern uint32_t decDoubleIsPositive(const decDouble *); extern uint32_t decDoubleIsSignaling(const decDouble *); extern uint32_t decDoubleIsSignalling(const decDouble *); extern uint32_t decDoubleIsSigned(const decDouble *); extern uint32_t decDoubleIsSubnormal(const decDouble *); extern uint32_t decDoubleIsZero(const decDouble *); extern uint32_t decDoubleRadix(const decDouble *); extern uint32_t decDoubleSameQuantum(const decDouble *, const decDouble *); extern const char * decDoubleVersion(void); /* decNumber conversions; these are implemented as macros so as not */ /* to force a dependency on decimal64 and decNumber in decDouble. */ /* decDoubleFromNumber returns a decimal64 * to avoid warnings. */ #define decDoubleToNumber(dq, dn) decimal64ToNumber((decimal64 *)(dq), dn) #define decDoubleFromNumber(dq, dn, set) decimal64FromNumber((decimal64 *)(dq), dn, set) #endif jq-jq-1.8.0/vendor/decNumber/decNumber.c000066400000000000000000014077401501676513100200350ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* 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; b0 */ /* 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-jq-1.8.0/vendor/decNumber/decNumberLocal.h000066400000000000000000001155631501676513100210130ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decNumber package local type, tuning, and macro definitions */ /* ------------------------------------------------------------------ */ /* 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 */ /* ------------------------------------------------------------------ */ /* This header file is included by all modules in the decNumber */ /* library, and contains local type definitions, tuning parameters, */ /* etc. It should not need to be used by application programs. */ /* decNumber.h or one of decDouble (etc.) must be included first. */ /* ------------------------------------------------------------------ */ #if !defined(DECNUMBERLOC) #define DECNUMBERLOC #define DECVERSION "decNumber 3.68" /* Package Version [16 max.] */ #define DECNLAUTHOR "Mike Cowlishaw" /* Who to blame */ #include /* 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-jq-1.8.0/vendor/decNumber/decPacked.c000066400000000000000000000242011501676513100177560ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Packed Decimal conversion module */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2002. 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 Packed Decimal format */ /* numbers. Conversions are supplied to and from decNumber, which in */ /* turn supports: */ /* conversions to and from string */ /* arithmetic routines */ /* utilities. */ /* Conversions from decNumber to and from densely packed decimal */ /* formats are provided by the decimal32 through decimal128 modules. */ /* ------------------------------------------------------------------ */ #include // for NULL #include "decNumber.h" // base number library #include "decPacked.h" // packed decimal #include "decNumberLocal.h" // decNumber local types, etc. /* ------------------------------------------------------------------ */ /* decPackedFromNumber -- convert decNumber to BCD Packed Decimal */ /* */ /* bcd is the BCD bytes */ /* length is the length of the BCD array */ /* scale is the scale result */ /* dn is the decNumber */ /* returns bcd, or NULL if error */ /* */ /* The number is converted to a BCD packed decimal byte array, */ /* right aligned in the bcd array, whose length is indicated by the */ /* second parameter. The final 4-bit nibble in the array will be a */ /* sign nibble, C (1100) for + and D (1101) for -. Unused bytes and */ /* nibbles to the left of the number are set to 0. */ /* */ /* scale is set to the scale of the number (this is the exponent, */ /* negated). To force the number to a specified scale, first use the */ /* decNumberRescale routine, which will round and change the exponent */ /* as necessary. */ /* */ /* If there is an error (that is, the decNumber has too many digits */ /* to fit in length bytes, or it is a NaN or Infinity), NULL is */ /* returned and the bcd and scale results are unchanged. Otherwise */ /* bcd is returned. */ /* ------------------------------------------------------------------ */ uByte * decPackedFromNumber(uByte *bcd, Int length, Int *scale, const decNumber *dn) { const Unit *up=dn->lsu; // Unit array pointer uByte obyte, *out; // current output byte, and where it goes Int indigs=dn->digits; // digits processed uInt cut=DECDPUN; // downcounter per Unit uInt u=*up; // work uInt nib; // .. #if DECDPUN<=4 uInt temp; // .. #endif if (dn->digits>length*2-1 // too long .. ||(dn->bits & DECSPECIAL)) return NULL; // .. or special -- hopeless if (dn->bits&DECNEG) obyte=DECPMINUS; // set the sign .. else obyte=DECPPLUS; *scale=-dn->exponent; // .. and scale // loop from lowest (rightmost) byte out=bcd+length-1; // -> final byte for (; out>=bcd; out--) { if (indigs>0) { if (cut==0) { up++; u=*up; cut=DECDPUN; } #if DECDPUN<=4 temp=(u*6554)>>16; // fast /10 nib=u-X10(temp); u=temp; #else nib=u%10; // cannot use *6554 trick :-( u=u/10; #endif obyte|=(nib<<4); indigs--; cut--; } *out=obyte; obyte=0; // assume 0 if (indigs>0) { if (cut==0) { up++; u=*up; cut=DECDPUN; } #if DECDPUN<=4 temp=(u*6554)>>16; // as above obyte=(uByte)(u-X10(temp)); u=temp; #else obyte=(uByte)(u%10); u=u/10; #endif indigs--; cut--; } } // loop return bcd; } // decPackedFromNumber /* ------------------------------------------------------------------ */ /* decPackedToNumber -- convert BCD Packed Decimal to a decNumber */ /* */ /* bcd is the BCD bytes */ /* length is the length of the BCD array */ /* scale is the scale associated with the BCD integer */ /* dn is the decNumber [with space for length*2 digits] */ /* returns dn, or NULL if error */ /* */ /* The BCD packed decimal byte array, together with an associated */ /* scale, is converted to a decNumber. The BCD array is assumed full */ /* of digits, and must be ended by a 4-bit sign nibble in the least */ /* significant four bits of the final byte. */ /* */ /* The scale is used (negated) as the exponent of the decNumber. */ /* Note that zeros may have a sign and/or a scale. */ /* */ /* The decNumber structure is assumed to have sufficient space to */ /* hold the converted number (that is, up to length*2-1 digits), so */ /* no error is possible unless the adjusted exponent is out of range, */ /* no sign nibble was found, or a sign nibble was found before the */ /* final nibble. In these error cases, NULL is returned and the */ /* decNumber will be 0. */ /* ------------------------------------------------------------------ */ decNumber * decPackedToNumber(const uByte *bcd, Int length, const Int *scale, decNumber *dn) { const uByte *last=bcd+length-1; // -> last byte const uByte *first; // -> first non-zero byte uInt nib; // work nibble Unit *up=dn->lsu; // output pointer Int digits; // digits count Int cut=0; // phase of output decNumberZero(dn); // default result last=&bcd[length-1]; nib=*last & 0x0f; // get the sign if (nib==DECPMINUS || nib==DECPMINUSALT) dn->bits=DECNEG; else if (nib<=9) return NULL; // not a sign nibble // skip leading zero bytes [final byte is always non-zero, due to sign] for (first=bcd; *first==0;) first++; digits=(last-first)*2+1; // calculate digits .. if ((*first & 0xf0)==0) digits--; // adjust for leading zero nibble if (digits!=0) dn->digits=digits; // count of actual digits [if 0, // leave as 1] // check the adjusted exponent; note that scale could be unbounded dn->exponent=-*scale; // set the exponent if (*scale>=0) { // usual case if ((dn->digits-*scale-1)<-DECNUMMAXE) { // underflow decNumberZero(dn); return NULL;} } else { // -ve scale; +ve exponent // need to be careful to avoid wrap, here, also BADINT case if ((*scale<-DECNUMMAXE) // overflow even without digits || ((dn->digits-*scale-1)>DECNUMMAXE)) { // overflow decNumberZero(dn); return NULL;} } if (digits==0) return dn; // result was zero // copy the digits to the number's units, starting at the lsu // [unrolled] for (;;) { // forever // left nibble first nib=(unsigned)(*last & 0xf0)>>4; // got a digit, in nib if (nib>9) {decNumberZero(dn); return NULL;} if (cut==0) *up=(Unit)nib; else *up=(Unit)(*up+nib*DECPOWERS[cut]); digits--; if (digits==0) break; // got them all cut++; if (cut==DECDPUN) { up++; cut=0; } last--; // ready for next nib=*last & 0x0f; // get right nibble if (nib>9) {decNumberZero(dn); return NULL;} // got a digit, in nib if (cut==0) *up=(Unit)nib; else *up=(Unit)(*up+nib*DECPOWERS[cut]); digits--; if (digits==0) break; // got them all cut++; if (cut==DECDPUN) { up++; cut=0; } } // forever return dn; } // decPackedToNumber jq-jq-1.8.0/vendor/decNumber/decPacked.h000066400000000000000000000056321501676513100177720ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Packed Decimal conversion module header */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2005. 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(DECPACKED) #define DECPACKED #define DECPNAME "decPacked" /* Short name */ #define DECPFULLNAME "Packed Decimal conversions" /* Verbose name */ #define DECPAUTHOR "Mike Cowlishaw" /* Who to blame */ #define DECPACKED_DefP 32 /* default precision */ #ifndef DECNUMDIGITS #define DECNUMDIGITS DECPACKED_DefP /* size if not already defined*/ #endif #include "decNumber.h" /* context and number library */ /* Sign nibble constants */ #if !defined(DECPPLUSALT) #define DECPPLUSALT 0x0A /* alternate plus nibble */ #define DECPMINUSALT 0x0B /* alternate minus nibble */ #define DECPPLUS 0x0C /* preferred plus nibble */ #define DECPMINUS 0x0D /* preferred minus nibble */ #define DECPPLUSALT2 0x0E /* alternate plus nibble */ #define DECPUNSIGNED 0x0F /* alternate plus nibble (unsigned) */ #endif /* ---------------------------------------------------------------- */ /* decPacked public routines */ /* ---------------------------------------------------------------- */ /* Conversions */ uint8_t * decPackedFromNumber(uint8_t *, int32_t, int32_t *, const decNumber *); decNumber * decPackedToNumber(const uint8_t *, int32_t, const int32_t *, decNumber *); #endif jq-jq-1.8.0/vendor/decNumber/decQuad.c000066400000000000000000000150501501676513100174630ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decQuad.c -- decQuad operations module */ /* ------------------------------------------------------------------ */ /* 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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 decQuad operations (including conversions) */ /* ------------------------------------------------------------------ */ /* Constant mappings for shared code */ #define DECPMAX DECQUAD_Pmax #define DECEMIN DECQUAD_Emin #define DECEMAX DECQUAD_Emax #define DECEMAXD DECQUAD_EmaxD #define DECBYTES DECQUAD_Bytes #define DECSTRING DECQUAD_String #define DECECONL DECQUAD_EconL #define DECBIAS DECQUAD_Bias #define DECLETS DECQUAD_Declets #define DECQTINY (-DECQUAD_Bias) /* Type and function mappings for shared code */ #define decFloat decQuad // Type name // Utilities and conversions (binary results, extractors, etc.) #define decFloatFromBCD decQuadFromBCD #define decFloatFromInt32 decQuadFromInt32 #define decFloatFromPacked decQuadFromPacked #define decFloatFromPackedChecked decQuadFromPackedChecked #define decFloatFromString decQuadFromString #define decFloatFromUInt32 decQuadFromUInt32 #define decFloatFromWider decQuadFromWider #define decFloatGetCoefficient decQuadGetCoefficient #define decFloatGetExponent decQuadGetExponent #define decFloatSetCoefficient decQuadSetCoefficient #define decFloatSetExponent decQuadSetExponent #define decFloatShow decQuadShow #define decFloatToBCD decQuadToBCD #define decFloatToEngString decQuadToEngString #define decFloatToInt32 decQuadToInt32 #define decFloatToInt32Exact decQuadToInt32Exact #define decFloatToPacked decQuadToPacked #define decFloatToString decQuadToString #define decFloatToUInt32 decQuadToUInt32 #define decFloatToUInt32Exact decQuadToUInt32Exact #define decFloatToWider decQuadToWider #define decFloatZero decQuadZero // Computational (result is a decFloat) #define decFloatAbs decQuadAbs #define decFloatAdd decQuadAdd #define decFloatAnd decQuadAnd #define decFloatDivide decQuadDivide #define decFloatDivideInteger decQuadDivideInteger #define decFloatFMA decQuadFMA #define decFloatInvert decQuadInvert #define decFloatLogB decQuadLogB #define decFloatMax decQuadMax #define decFloatMaxMag decQuadMaxMag #define decFloatMin decQuadMin #define decFloatMinMag decQuadMinMag #define decFloatMinus decQuadMinus #define decFloatMultiply decQuadMultiply #define decFloatNextMinus decQuadNextMinus #define decFloatNextPlus decQuadNextPlus #define decFloatNextToward decQuadNextToward #define decFloatOr decQuadOr #define decFloatPlus decQuadPlus #define decFloatQuantize decQuadQuantize #define decFloatReduce decQuadReduce #define decFloatRemainder decQuadRemainder #define decFloatRemainderNear decQuadRemainderNear #define decFloatRotate decQuadRotate #define decFloatScaleB decQuadScaleB #define decFloatShift decQuadShift #define decFloatSubtract decQuadSubtract #define decFloatToIntegralValue decQuadToIntegralValue #define decFloatToIntegralExact decQuadToIntegralExact #define decFloatXor decQuadXor // Comparisons #define decFloatCompare decQuadCompare #define decFloatCompareSignal decQuadCompareSignal #define decFloatCompareTotal decQuadCompareTotal #define decFloatCompareTotalMag decQuadCompareTotalMag // Copies #define decFloatCanonical decQuadCanonical #define decFloatCopy decQuadCopy #define decFloatCopyAbs decQuadCopyAbs #define decFloatCopyNegate decQuadCopyNegate #define decFloatCopySign decQuadCopySign // Non-computational #define decFloatClass decQuadClass #define decFloatClassString decQuadClassString #define decFloatDigits decQuadDigits #define decFloatIsCanonical decQuadIsCanonical #define decFloatIsFinite decQuadIsFinite #define decFloatIsInfinite decQuadIsInfinite #define decFloatIsInteger decQuadIsInteger #define decFloatIsLogical decQuadIsLogical #define decFloatIsNaN decQuadIsNaN #define decFloatIsNegative decQuadIsNegative #define decFloatIsNormal decQuadIsNormal #define decFloatIsPositive decQuadIsPositive #define decFloatIsSignaling decQuadIsSignaling #define decFloatIsSignalling decQuadIsSignalling #define decFloatIsSigned decQuadIsSigned #define decFloatIsSubnormal decQuadIsSubnormal #define decFloatIsZero decQuadIsZero #define decFloatRadix decQuadRadix #define decFloatSameQuantum decQuadSameQuantum #define decFloatVersion decQuadVersion /* And now the code itself */ #include "decContext.h" // public includes #include "decQuad.h" // .. #include "decNumberLocal.h" // local includes (need DECPMAX) #include "decCommon.c" // non-arithmetic decFloat routines #include "decBasic.c" // basic formats routines jq-jq-1.8.0/vendor/decNumber/decQuad.h000066400000000000000000000257241501676513100175010ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decQuad.h -- Decimal 128-bit format 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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 include file is always included by decSingle and decDouble, */ /* and therefore also holds useful constants used by all three. */ #if !defined(DECQUAD) #define DECQUAD #define DECQUADNAME "decimalQuad" /* Short name */ #define DECQUADTITLE "Decimal 128-bit datum" /* Verbose name */ #define DECQUADAUTHOR "Mike Cowlishaw" /* Who to blame */ /* parameters for decQuads */ #define DECQUAD_Bytes 16 /* length */ #define DECQUAD_Pmax 34 /* maximum precision (digits) */ #define DECQUAD_Emin -6143 /* minimum adjusted exponent */ #define DECQUAD_Emax 6144 /* maximum adjusted exponent */ #define DECQUAD_EmaxD 4 /* maximum exponent digits */ #define DECQUAD_Bias 6176 /* bias for the exponent */ #define DECQUAD_String 43 /* maximum string length, +1 */ #define DECQUAD_EconL 12 /* exponent continuation length */ #define DECQUAD_Declets 11 /* count of declets */ /* highest biased exponent (Elimit-1) */ #define DECQUAD_Ehigh (DECQUAD_Emax + DECQUAD_Bias - (DECQUAD_Pmax-1)) /* Required include */ #include "decContext.h" /* The decQuad decimal 128-bit type, accessible by all sizes */ typedef union { uint8_t bytes[DECQUAD_Bytes]; /* fields: 1, 5, 12, 110 bits */ uint16_t shorts[DECQUAD_Bytes/2]; uint32_t words[DECQUAD_Bytes/4]; #if DECUSE64 uint64_t longs[DECQUAD_Bytes/8]; #endif } decQuad; /* ---------------------------------------------------------------- */ /* Shared constants */ /* ---------------------------------------------------------------- */ /* sign and special values [top 32-bits; last two bits are don't-care for Infinity on input, last bit don't-care for NaNs] */ #define DECFLOAT_Sign 0x80000000 /* 1 00000 00 Sign */ #define DECFLOAT_NaN 0x7c000000 /* 0 11111 00 NaN generic */ #define DECFLOAT_qNaN 0x7c000000 /* 0 11111 00 qNaN */ #define DECFLOAT_sNaN 0x7e000000 /* 0 11111 10 sNaN */ #define DECFLOAT_Inf 0x78000000 /* 0 11110 00 Infinity */ #define DECFLOAT_MinSp 0x78000000 /* minimum special value */ /* [specials are all >=MinSp] */ /* Sign nibble constants */ #if !defined(DECPPLUSALT) #define DECPPLUSALT 0x0A /* alternate plus nibble */ #define DECPMINUSALT 0x0B /* alternate minus nibble */ #define DECPPLUS 0x0C /* preferred plus nibble */ #define DECPMINUS 0x0D /* preferred minus nibble */ #define DECPPLUSALT2 0x0E /* alternate plus nibble */ #define DECPUNSIGNED 0x0F /* alternate plus nibble (unsigned) */ #endif /* ---------------------------------------------------------------- */ /* Routines -- implemented as decFloat routines in common files */ /* ---------------------------------------------------------------- */ /* Utilities and conversions, extractors, etc.) */ extern decQuad * decQuadFromBCD(decQuad *, int32_t, const uint8_t *, int32_t); extern decQuad * decQuadFromInt32(decQuad *, int32_t); extern decQuad * decQuadFromPacked(decQuad *, int32_t, const uint8_t *); extern decQuad * decQuadFromPackedChecked(decQuad *, int32_t, const uint8_t *); extern decQuad * decQuadFromString(decQuad *, const char *, decContext *); extern decQuad * decQuadFromUInt32(decQuad *, uint32_t); extern int32_t decQuadGetCoefficient(const decQuad *, uint8_t *); extern int32_t decQuadGetExponent(const decQuad *); extern decQuad * decQuadSetCoefficient(decQuad *, const uint8_t *, int32_t); extern decQuad * decQuadSetExponent(decQuad *, decContext *, int32_t); extern void decQuadShow(const decQuad *, const char *); extern int32_t decQuadToBCD(const decQuad *, int32_t *, uint8_t *); extern char * decQuadToEngString(const decQuad *, char *); extern int32_t decQuadToInt32(const decQuad *, decContext *, enum rounding); extern int32_t decQuadToInt32Exact(const decQuad *, decContext *, enum rounding); extern int32_t decQuadToPacked(const decQuad *, int32_t *, uint8_t *); extern char * decQuadToString(const decQuad *, char *); extern uint32_t decQuadToUInt32(const decQuad *, decContext *, enum rounding); extern uint32_t decQuadToUInt32Exact(const decQuad *, decContext *, enum rounding); extern decQuad * decQuadZero(decQuad *); /* Computational (result is a decQuad) */ extern decQuad * decQuadAbs(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadAdd(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadAnd(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadDivide(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadDivideInteger(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadFMA(decQuad *, const decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadInvert(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadLogB(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadMax(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadMaxMag(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadMin(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadMinMag(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadMinus(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadMultiply(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadNextMinus(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadNextPlus(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadNextToward(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadOr(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadPlus(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadQuantize(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadReduce(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadRemainder(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadRemainderNear(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadRotate(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadScaleB(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadShift(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadSubtract(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadToIntegralValue(decQuad *, const decQuad *, decContext *, enum rounding); extern decQuad * decQuadToIntegralExact(decQuad *, const decQuad *, decContext *); extern decQuad * decQuadXor(decQuad *, const decQuad *, const decQuad *, decContext *); /* Comparisons */ extern decQuad * decQuadCompare(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadCompareSignal(decQuad *, const decQuad *, const decQuad *, decContext *); extern decQuad * decQuadCompareTotal(decQuad *, const decQuad *, const decQuad *); extern decQuad * decQuadCompareTotalMag(decQuad *, const decQuad *, const decQuad *); /* Copies */ extern decQuad * decQuadCanonical(decQuad *, const decQuad *); extern decQuad * decQuadCopy(decQuad *, const decQuad *); extern decQuad * decQuadCopyAbs(decQuad *, const decQuad *); extern decQuad * decQuadCopyNegate(decQuad *, const decQuad *); extern decQuad * decQuadCopySign(decQuad *, const decQuad *, const decQuad *); /* Non-computational */ extern enum decClass decQuadClass(const decQuad *); extern const char * decQuadClassString(const decQuad *); extern uint32_t decQuadDigits(const decQuad *); extern uint32_t decQuadIsCanonical(const decQuad *); extern uint32_t decQuadIsFinite(const decQuad *); extern uint32_t decQuadIsInteger(const decQuad *); extern uint32_t decQuadIsLogical(const decQuad *); extern uint32_t decQuadIsInfinite(const decQuad *); extern uint32_t decQuadIsNaN(const decQuad *); extern uint32_t decQuadIsNegative(const decQuad *); extern uint32_t decQuadIsNormal(const decQuad *); extern uint32_t decQuadIsPositive(const decQuad *); extern uint32_t decQuadIsSignaling(const decQuad *); extern uint32_t decQuadIsSignalling(const decQuad *); extern uint32_t decQuadIsSigned(const decQuad *); extern uint32_t decQuadIsSubnormal(const decQuad *); extern uint32_t decQuadIsZero(const decQuad *); extern uint32_t decQuadRadix(const decQuad *); extern uint32_t decQuadSameQuantum(const decQuad *, const decQuad *); extern const char * decQuadVersion(void); /* decNumber conversions; these are implemented as macros so as not */ /* to force a dependency on decimal128 and decNumber in decQuad. */ /* decQuadFromNumber returns a decimal128 * to avoid warnings. */ #define decQuadToNumber(dq, dn) decimal128ToNumber((decimal128 *)(dq), dn) #define decQuadFromNumber(dq, dn, set) decimal128FromNumber((decimal128 *)(dq), dn, set) #endif jq-jq-1.8.0/vendor/decNumber/decSingle.c000066400000000000000000000070151501676513100200140ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decSingle.c -- decSingle operations module */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2008. 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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 decSingle operations (including conversions) */ /* ------------------------------------------------------------------ */ #include "decContext.h" // public includes #include "decSingle.h" // public includes /* Constant mappings for shared code */ #define DECPMAX DECSINGLE_Pmax #define DECEMIN DECSINGLE_Emin #define DECEMAX DECSINGLE_Emax #define DECEMAXD DECSINGLE_EmaxD #define DECBYTES DECSINGLE_Bytes #define DECSTRING DECSINGLE_String #define DECECONL DECSINGLE_EconL #define DECBIAS DECSINGLE_Bias #define DECLETS DECSINGLE_Declets #define DECQTINY (-DECSINGLE_Bias) // parameters of next-wider format #define DECWBYTES DECDOUBLE_Bytes #define DECWPMAX DECDOUBLE_Pmax #define DECWECONL DECDOUBLE_EconL #define DECWBIAS DECDOUBLE_Bias /* Type and function mappings for shared code */ #define decFloat decSingle // Type name #define decFloatWider decDouble // Type name // Utility (binary results, extractors, etc.) #define decFloatFromBCD decSingleFromBCD #define decFloatFromPacked decSingleFromPacked #define decFloatFromPackedChecked decSingleFromPackedChecked #define decFloatFromString decSingleFromString #define decFloatFromWider decSingleFromWider #define decFloatGetCoefficient decSingleGetCoefficient #define decFloatGetExponent decSingleGetExponent #define decFloatSetCoefficient decSingleSetCoefficient #define decFloatSetExponent decSingleSetExponent #define decFloatShow decSingleShow #define decFloatToBCD decSingleToBCD #define decFloatToEngString decSingleToEngString #define decFloatToPacked decSingleToPacked #define decFloatToString decSingleToString #define decFloatToWider decSingleToWider #define decFloatZero decSingleZero // Non-computational #define decFloatRadix decSingleRadix #define decFloatVersion decSingleVersion #include "decNumberLocal.h" // local includes (need DECPMAX) #include "decCommon.c" // non-basic decFloat routines // [Do not include decBasic.c for decimal32] jq-jq-1.8.0/vendor/decNumber/decSingle.h000066400000000000000000000115411501676513100200200ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* decSingle.h -- Decimal 32-bit format module header */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2008. 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 included in the package as decNumber.pdf. This */ /* document is also available in HTML, together with 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(DECSINGLE) #define DECSINGLE #define DECSINGLENAME "decSingle" /* Short name */ #define DECSINGLETITLE "Decimal 32-bit datum" /* Verbose name */ #define DECSINGLEAUTHOR "Mike Cowlishaw" /* Who to blame */ /* parameters for decSingles */ #define DECSINGLE_Bytes 4 /* length */ #define DECSINGLE_Pmax 7 /* maximum precision (digits) */ #define DECSINGLE_Emin -95 /* minimum adjusted exponent */ #define DECSINGLE_Emax 96 /* maximum adjusted exponent */ #define DECSINGLE_EmaxD 3 /* maximum exponent digits */ #define DECSINGLE_Bias 101 /* bias for the exponent */ #define DECSINGLE_String 16 /* maximum string length, +1 */ #define DECSINGLE_EconL 6 /* exponent continuation length */ #define DECSINGLE_Declets 2 /* count of declets */ /* highest biased exponent (Elimit-1) */ #define DECSINGLE_Ehigh (DECSINGLE_Emax + DECSINGLE_Bias - (DECSINGLE_Pmax-1)) /* Required includes */ #include "decContext.h" #include "decQuad.h" #include "decDouble.h" /* The decSingle decimal 32-bit type, accessible by all sizes */ typedef union { uint8_t bytes[DECSINGLE_Bytes]; /* fields: 1, 5, 6, 20 bits */ uint16_t shorts[DECSINGLE_Bytes/2]; uint32_t words[DECSINGLE_Bytes/4]; } decSingle; /* ---------------------------------------------------------------- */ /* Routines -- implemented as decFloat routines in common files */ /* ---------------------------------------------------------------- */ /* Utilities (binary argument(s) or result, extractors, etc.) */ extern decSingle * decSingleFromBCD(decSingle *, int32_t, const uint8_t *, int32_t); extern decSingle * decSingleFromPacked(decSingle *, int32_t, const uint8_t *); extern decSingle * decSingleFromPackedChecked(decSingle *, int32_t, const uint8_t *); extern decSingle * decSingleFromString(decSingle *, const char *, decContext *); extern decSingle * decSingleFromWider(decSingle *, const decDouble *, decContext *); extern int32_t decSingleGetCoefficient(const decSingle *, uint8_t *); extern int32_t decSingleGetExponent(const decSingle *); extern decSingle * decSingleSetCoefficient(decSingle *, const uint8_t *, int32_t); extern decSingle * decSingleSetExponent(decSingle *, decContext *, int32_t); extern void decSingleShow(const decSingle *, const char *); extern int32_t decSingleToBCD(const decSingle *, int32_t *, uint8_t *); extern char * decSingleToEngString(const decSingle *, char *); extern int32_t decSingleToPacked(const decSingle *, int32_t *, uint8_t *); extern char * decSingleToString(const decSingle *, char *); extern decDouble * decSingleToWider(const decSingle *, decDouble *); extern decSingle * decSingleZero(decSingle *); /* (No Arithmetic routines for decSingle) */ /* Non-computational */ extern uint32_t decSingleRadix(const decSingle *); extern const char * decSingleVersion(void); /* decNumber conversions; these are implemented as macros so as not */ /* to force a dependency on decimal32 and decNumber in decSingle. */ /* decSingleFromNumber returns a decimal32 * to avoid warnings. */ #define decSingleToNumber(dq, dn) decimal32ToNumber((decimal32 *)(dq), dn) #define decSingleFromNumber(dq, dn, set) decimal32FromNumber((decimal32 *)(dq), dn, set) #endif jq-jq-1.8.0/vendor/decNumber/decimal128.c000066400000000000000000000623751501676513100177620ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal 128-bit format module */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2008. 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 decimal128 format numbers. */ /* Conversions are supplied to and from decNumber and String. */ /* */ /* This is used when decNumber provides operations, either for all */ /* operations or as a proxy between decNumber and decSingle. */ /* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ #include // [for memset/memcpy] #include // [for printf] #define DECNUMDIGITS 34 // make decNumbers with space for 34 #include "decNumber.h" // base number library #include "decNumberLocal.h" // decNumber local types, etc. #include "decimal128.h" // our primary include /* Utility routines and tables [in decimal64.c] */ // DPD2BIN and the reverse are renamed to prevent link-time conflict // if decQuad is also built in the same executable #define DPD2BIN DPD2BINx #define BIN2DPD BIN2DPDx extern const uInt COMBEXP[32], COMBMSD[32]; extern const uShort DPD2BIN[1024]; extern const uShort BIN2DPD[1000]; // [not used] extern const uByte BIN2CHAR[4001]; extern void decDigitsFromDPD(decNumber *, const uInt *, Int); extern void decDigitsToDPD(const decNumber *, uInt *, Int); #if DECTRACE || DECCHECK void decimal128Show(const decimal128 *); // for debug extern void decNumberShow(const decNumber *); // .. #endif /* Useful macro */ // Clear a structure (e.g., a decNumber) #define DEC_clear(d) memset(d, 0, sizeof(*d)) /* ------------------------------------------------------------------ */ /* decimal128FromNumber -- convert decNumber to decimal128 */ /* */ /* ds is the target decimal128 */ /* dn is the source number (assumed valid) */ /* set is the context, used only for reporting errors */ /* */ /* The set argument is used only for status reporting and for the */ /* rounding mode (used if the coefficient is more than DECIMAL128_Pmax*/ /* digits or an overflow is detected). If the exponent is out of the */ /* valid range then Overflow or Underflow will be raised. */ /* After Underflow a subnormal result is possible. */ /* */ /* DEC_Clamped is set if the number has to be 'folded down' to fit, */ /* by reducing its exponent and multiplying the coefficient by a */ /* power of ten, or if the exponent on a zero had to be clamped. */ /* ------------------------------------------------------------------ */ decimal128 * decimal128FromNumber(decimal128 *d128, const decNumber *dn, decContext *set) { uInt status=0; // status accumulator Int ae; // adjusted exponent decNumber dw; // work decContext dc; // .. uInt comb, exp; // .. uInt uiwork; // for macros uInt targar[4]={0,0,0,0}; // target 128-bit #define targhi targar[3] // name the word with the sign #define targmh targar[2] // name the words #define targml targar[1] // .. #define targlo targar[0] // .. // If the number has too many digits, or the exponent could be // out of range then reduce the number under the appropriate // constraints. This could push the number to Infinity or zero, // so this check and rounding must be done before generating the // decimal128] ae=dn->exponent+dn->digits-1; // [0 if special] if (dn->digits>DECIMAL128_Pmax // too many digits || ae>DECIMAL128_Emax // likely overflow || aeround; // use supplied rounding decNumberPlus(&dw, dn, &dc); // (round and check) // [this changes -0 to 0, so enforce the sign...] dw.bits|=dn->bits&DECNEG; status=dc.status; // save status dn=&dw; // use the work number } // maybe out of range if (dn->bits&DECSPECIAL) { // a special value if (dn->bits&DECINF) targhi=DECIMAL_Inf<<24; else { // sNaN or qNaN if ((*dn->lsu!=0 || dn->digits>1) // non-zero coefficient && (dn->digitsbits&DECNAN) targhi|=DECIMAL_NaN<<24; else targhi|=DECIMAL_sNaN<<24; } // a NaN } // special else { // is finite if (decNumberIsZero(dn)) { // is a zero // set and clamp exponent if (dn->exponent<-DECIMAL128_Bias) { exp=0; // low clamp status|=DEC_Clamped; } else { exp=dn->exponent+DECIMAL128_Bias; // bias exponent if (exp>DECIMAL128_Ehigh) { // top clamp exp=DECIMAL128_Ehigh; status|=DEC_Clamped; } } comb=(exp>>9) & 0x18; // msd=0, exp top 2 bits .. } else { // non-zero finite number uInt msd; // work Int pad=0; // coefficient pad digits // the dn is known to fit, but it may need to be padded exp=(uInt)(dn->exponent+DECIMAL128_Bias); // bias exponent if (exp>DECIMAL128_Ehigh) { // fold-down case pad=exp-DECIMAL128_Ehigh; exp=DECIMAL128_Ehigh; // [to maximum] status|=DEC_Clamped; } // [fastpath for common case is not a win, here] decDigitsToDPD(dn, targar, pad); // save and clear the top digit msd=targhi>>14; targhi&=0x00003fff; // create the combination field if (msd>=8) comb=0x18 | ((exp>>11) & 0x06) | (msd & 0x01); else comb=((exp>>9) & 0x18) | msd; } targhi|=comb<<26; // add combination field .. targhi|=(exp&0xfff)<<14; // .. and exponent continuation } // finite if (dn->bits&DECNEG) targhi|=0x80000000; // add sign bit // now write to storage; this is endian if (DECLITEND) { // lo -> hi UBFROMUI(d128->bytes, targlo); UBFROMUI(d128->bytes+4, targml); UBFROMUI(d128->bytes+8, targmh); UBFROMUI(d128->bytes+12, targhi); } else { // hi -> lo UBFROMUI(d128->bytes, targhi); UBFROMUI(d128->bytes+4, targmh); UBFROMUI(d128->bytes+8, targml); UBFROMUI(d128->bytes+12, targlo); } if (status!=0) decContextSetStatus(set, status); // pass on status // decimal128Show(d128); return d128; } // decimal128FromNumber /* ------------------------------------------------------------------ */ /* decimal128ToNumber -- convert decimal128 to decNumber */ /* d128 is the source decimal128 */ /* dn is the target number, with appropriate space */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decNumber * decimal128ToNumber(const decimal128 *d128, decNumber *dn) { uInt msd; // coefficient MSD uInt exp; // exponent top two bits uInt comb; // combination field Int need; // work uInt uiwork; // for macros uInt sourar[4]; // source 128-bit #define sourhi sourar[3] // name the word with the sign #define sourmh sourar[2] // and the mid-high word #define sourml sourar[1] // and the mod-low word #define sourlo sourar[0] // and the lowest word // load source from storage; this is endian if (DECLITEND) { sourlo=UBTOUI(d128->bytes ); // directly load the low int sourml=UBTOUI(d128->bytes+4 ); // then the mid-low sourmh=UBTOUI(d128->bytes+8 ); // then the mid-high sourhi=UBTOUI(d128->bytes+12); // then the high int } else { sourhi=UBTOUI(d128->bytes ); // directly load the high int sourmh=UBTOUI(d128->bytes+4 ); // then the mid-high sourml=UBTOUI(d128->bytes+8 ); // then the mid-low sourlo=UBTOUI(d128->bytes+12); // then the low int } comb=(sourhi>>26)&0x1f; // combination field decNumberZero(dn); // clean number if (sourhi&0x80000000) dn->bits=DECNEG; // set sign if negative msd=COMBMSD[comb]; // decode the combination field exp=COMBEXP[comb]; // .. if (exp==3) { // is a special if (msd==0) { dn->bits|=DECINF; return dn; // no coefficient needed } else if (sourhi&0x02000000) dn->bits|=DECSNAN; else dn->bits|=DECNAN; msd=0; // no top digit } else { // is a finite number dn->exponent=(exp<<12)+((sourhi>>14)&0xfff)-DECIMAL128_Bias; // unbiased } // get the coefficient sourhi&=0x00003fff; // clean coefficient continuation if (msd) { // non-zero msd sourhi|=msd<<14; // prefix to coefficient need=12; // process 12 declets } else { // msd=0 if (sourhi) need=11; // declets to process else if (sourmh) need=10; else if (sourml) need=7; else if (sourlo) need=4; else return dn; // easy: coefficient is 0 } //msd=0 decDigitsFromDPD(dn, sourar, need); // process declets // decNumberShow(dn); return dn; } // decimal128ToNumber /* ------------------------------------------------------------------ */ /* to-scientific-string -- conversion to numeric string */ /* to-engineering-string -- conversion to numeric string */ /* */ /* decimal128ToString(d128, string); */ /* decimal128ToEngString(d128, string); */ /* */ /* d128 is the decimal128 format number to convert */ /* string is the string where the result will be laid out */ /* */ /* string must be at least 24 characters */ /* */ /* No error is possible, and no status can be set. */ /* ------------------------------------------------------------------ */ char * decimal128ToEngString(const decimal128 *d128, char *string){ decNumber dn; // work decimal128ToNumber(d128, &dn); decNumberToEngString(&dn, string); return string; } // decimal128ToEngString char * decimal128ToString(const decimal128 *d128, char *string){ uInt msd; // coefficient MSD Int exp; // exponent top two bits or full uInt comb; // combination field char *cstart; // coefficient start char *c; // output pointer in string const uByte *u; // work char *s, *t; // .. (source, target) Int dpd; // .. Int pre, e; // .. uInt uiwork; // for macros uInt sourar[4]; // source 128-bit #define sourhi sourar[3] // name the word with the sign #define sourmh sourar[2] // and the mid-high word #define sourml sourar[1] // and the mod-low word #define sourlo sourar[0] // and the lowest word // load source from storage; this is endian if (DECLITEND) { sourlo=UBTOUI(d128->bytes ); // directly load the low int sourml=UBTOUI(d128->bytes+4 ); // then the mid-low sourmh=UBTOUI(d128->bytes+8 ); // then the mid-high sourhi=UBTOUI(d128->bytes+12); // then the high int } else { sourhi=UBTOUI(d128->bytes ); // directly load the high int sourmh=UBTOUI(d128->bytes+4 ); // then the mid-high sourml=UBTOUI(d128->bytes+8 ); // then the mid-low sourlo=UBTOUI(d128->bytes+12); // then the low int } c=string; // where result will go if (((Int)sourhi)<0) *c++='-'; // handle sign comb=(sourhi>>26)&0x1f; // combination field msd=COMBMSD[comb]; // decode the combination field exp=COMBEXP[comb]; // .. if (exp==3) { if (msd==0) { // infinity strcpy(c, "Inf"); strcpy(c+3, "inity"); return string; // easy } if (sourhi&0x02000000) *c++='s'; // sNaN strcpy(c, "NaN"); // complete word c+=3; // step past if (sourlo==0 && sourml==0 && sourmh==0 && (sourhi&0x0003ffff)==0) return string; // zero payload // otherwise drop through to add integer; set correct exp exp=0; msd=0; // setup for following code } else exp=(exp<<12)+((sourhi>>14)&0xfff)-DECIMAL128_Bias; // unbiased // convert 34 digits of significand to characters cstart=c; // save start of coefficient if (msd) *c++='0'+(char)msd; // non-zero most significant digit // Now decode the declets. After extracting each one, it is // decoded to binary and then to a 4-char sequence by table lookup; // the 4-chars are a 1-char length (significant digits, except 000 // has length 0). This allows us to left-align the first declet // with non-zero content, then remaining ones are full 3-char // length. We use fixed-length memcpys because variable-length // causes a subroutine call in GCC. (These are length 4 for speed // and are safe because the array has an extra terminator byte.) #define dpd2char u=&BIN2CHAR[DPD2BIN[dpd]*4]; \ if (c!=cstart) {memcpy(c, u+1, 4); c+=3;} \ else if (*u) {memcpy(c, u+4-*u, 4); c+=*u;} dpd=(sourhi>>4)&0x3ff; // declet 1 dpd2char; dpd=((sourhi&0xf)<<6) | (sourmh>>26); // declet 2 dpd2char; dpd=(sourmh>>16)&0x3ff; // declet 3 dpd2char; dpd=(sourmh>>6)&0x3ff; // declet 4 dpd2char; dpd=((sourmh&0x3f)<<4) | (sourml>>28); // declet 5 dpd2char; dpd=(sourml>>18)&0x3ff; // declet 6 dpd2char; dpd=(sourml>>8)&0x3ff; // declet 7 dpd2char; dpd=((sourml&0xff)<<2) | (sourlo>>30); // declet 8 dpd2char; dpd=(sourlo>>20)&0x3ff; // declet 9 dpd2char; dpd=(sourlo>>10)&0x3ff; // declet 10 dpd2char; dpd=(sourlo)&0x3ff; // declet 11 dpd2char; if (c==cstart) *c++='0'; // all zeros -- make 0 if (exp==0) { // integer or NaN case -- easy *c='\0'; // terminate return string; } /* non-0 exponent */ e=0; // assume no E pre=c-cstart+exp; // [here, pre-exp is the digits count (==1 for zero)] if (exp>0 || pre<-5) { // need exponential form e=pre-1; // calculate E value pre=1; // assume one digit before '.' } // exponential form /* modify the coefficient, adding 0s, '.', and E+nn as needed */ s=c-1; // source (LSD) if (pre>0) { // ddd.ddd (plain), perhaps with E char *dotat=cstart+pre; if (dotat=dotat; s--, t--) *t=*s; // open the gap; leave t at gap *t='.'; // insert the dot c++; // length increased by one } // finally add the E-part, if needed; it will never be 0, and has // a maximum length of 4 digits if (e!=0) { *c++='E'; // starts with E *c++='+'; // assume positive if (e<0) { *(c-1)='-'; // oops, need '-' e=-e; // uInt, please } if (e<1000) { // 3 (or fewer) digits case u=&BIN2CHAR[e*4]; // -> length byte memcpy(c, u+4-*u, 4); // copy fixed 4 characters [is safe] c+=*u; // bump pointer appropriately } else { // 4-digits Int thou=((e>>3)*1049)>>17; // e/1000 Int rem=e-(1000*thou); // e%1000 *c++='0'+(char)thou; u=&BIN2CHAR[rem*4]; // -> length byte memcpy(c, u+1, 4); // copy fixed 3+1 characters [is safe] c+=3; // bump pointer, always 3 digits } } *c='\0'; // add terminator //printf("res %s\n", string); return string; } // pre>0 /* -5<=pre<=0: here for plain 0.ddd or 0.000ddd forms (can never have E) */ t=c+1-pre; *(t+1)='\0'; // can add terminator now for (; s>=cstart; s--, t--) *t=*s; // shift whole coefficient right c=cstart; *c++='0'; // always starts with 0. *c++='.'; for (; pre<0; pre++) *c++='0'; // add any 0's after '.' //printf("res %s\n", string); return string; } // decimal128ToString /* ------------------------------------------------------------------ */ /* to-number -- conversion from numeric string */ /* */ /* decimal128FromString(result, string, set); */ /* */ /* result is the decimal128 format number which gets the result of */ /* the conversion */ /* *string is the character string which should contain a valid */ /* number (which may be a special value) */ /* set is the context */ /* */ /* The context is supplied to this routine is used for error handling */ /* (setting of status and traps) and for the rounding mode, only. */ /* If an error occurs, the result will be a valid decimal128 NaN. */ /* ------------------------------------------------------------------ */ decimal128 * decimal128FromString(decimal128 *result, const char *string, decContext *set) { decContext dc; // work decNumber dn; // .. decContextDefault(&dc, DEC_INIT_DECIMAL128); // no traps, please dc.round=set->round; // use supplied rounding decNumberFromString(&dn, string, &dc); // will round if needed decimal128FromNumber(result, &dn, &dc); if (dc.status!=0) { // something happened decContextSetStatus(set, dc.status); // .. pass it on } return result; } // decimal128FromString /* ------------------------------------------------------------------ */ /* decimal128IsCanonical -- test whether encoding is canonical */ /* d128 is the source decimal128 */ /* returns 1 if the encoding of d128 is canonical, 0 otherwise */ /* No error is possible. */ /* ------------------------------------------------------------------ */ uInt decimal128IsCanonical(const decimal128 *d128) { decNumber dn; // work decimal128 canon; // .. decContext dc; // .. decContextDefault(&dc, DEC_INIT_DECIMAL128); decimal128ToNumber(d128, &dn); decimal128FromNumber(&canon, &dn, &dc);// canon will now be canonical return memcmp(d128, &canon, DECIMAL128_Bytes)==0; } // decimal128IsCanonical /* ------------------------------------------------------------------ */ /* decimal128Canonical -- copy an encoding, ensuring it is canonical */ /* d128 is the source decimal128 */ /* result is the target (may be the same decimal128) */ /* returns result */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decimal128 * decimal128Canonical(decimal128 *result, const decimal128 *d128) { decNumber dn; // work decContext dc; // .. decContextDefault(&dc, DEC_INIT_DECIMAL128); decimal128ToNumber(d128, &dn); decimal128FromNumber(result, &dn, &dc);// result will now be canonical return result; } // decimal128Canonical #if DECTRACE || DECCHECK /* Macros for accessing decimal128 fields. These assume the argument is a reference (pointer) to the decimal128 structure, and the decimal128 is in network byte order (big-endian) */ // Get sign #define decimal128Sign(d) ((unsigned)(d)->bytes[0]>>7) // Get combination field #define decimal128Comb(d) (((d)->bytes[0] & 0x7c)>>2) // Get exponent continuation [does not remove bias] #define decimal128ExpCon(d) ((((d)->bytes[0] & 0x03)<<10) \ | ((unsigned)(d)->bytes[1]<<2) \ | ((unsigned)(d)->bytes[2]>>6)) // Set sign [this assumes sign previously 0] #define decimal128SetSign(d, b) { \ (d)->bytes[0]|=((unsigned)(b)<<7);} // Set exponent continuation [does not apply bias] // This assumes range has been checked and exponent previously 0; // type of exponent must be unsigned #define decimal128SetExpCon(d, e) { \ (d)->bytes[0]|=(uByte)((e)>>10); \ (d)->bytes[1] =(uByte)(((e)&0x3fc)>>2); \ (d)->bytes[2]|=(uByte)(((e)&0x03)<<6);} /* ------------------------------------------------------------------ */ /* decimal128Show -- display a decimal128 in hexadecimal [debug aid] */ /* d128 -- the number to show */ /* ------------------------------------------------------------------ */ // Also shows sign/cob/expconfields extracted void decimal128Show(const decimal128 *d128) { char buf[DECIMAL128_Bytes*2+1]; Int i, j=0; if (DECLITEND) { for (i=0; ibytes[15-i]); } printf(" D128> %s [S:%d Cb:%02x Ec:%02x] LittleEndian\n", buf, d128->bytes[15]>>7, (d128->bytes[15]>>2)&0x1f, ((d128->bytes[15]&0x3)<<10)|(d128->bytes[14]<<2)| (d128->bytes[13]>>6)); } else { for (i=0; ibytes[i]); } printf(" D128> %s [S:%d Cb:%02x Ec:%02x] BigEndian\n", buf, decimal128Sign(d128), decimal128Comb(d128), decimal128ExpCon(d128)); } } // decimal128Show #endif jq-jq-1.8.0/vendor/decNumber/decimal128.h000066400000000000000000000103771501676513100177620ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal 128-bit format module header */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2005. 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(DECIMAL128) #define DECIMAL128 #define DEC128NAME "decimal128" /* Short name */ #define DEC128FULLNAME "Decimal 128-bit Number" /* Verbose name */ #define DEC128AUTHOR "Mike Cowlishaw" /* Who to blame */ /* parameters for decimal128s */ #define DECIMAL128_Bytes 16 /* length */ #define DECIMAL128_Pmax 34 /* maximum precision (digits) */ #define DECIMAL128_Emax 6144 /* maximum adjusted exponent */ #define DECIMAL128_Emin -6143 /* minimum adjusted exponent */ #define DECIMAL128_Bias 6176 /* bias for the exponent */ #define DECIMAL128_String 43 /* maximum string length, +1 */ #define DECIMAL128_EconL 12 /* exp. continuation length */ /* highest biased exponent (Elimit-1) */ #define DECIMAL128_Ehigh (DECIMAL128_Emax+DECIMAL128_Bias-DECIMAL128_Pmax+1) /* check enough digits, if pre-defined */ #if defined(DECNUMDIGITS) #if (DECNUMDIGITS=34 for safe use #endif #endif #ifndef DECNUMDIGITS #define DECNUMDIGITS DECIMAL128_Pmax /* size if not already defined*/ #endif #ifndef DECNUMBER #include "decNumber.h" /* context and number library */ #endif /* Decimal 128-bit type, accessible by bytes */ typedef struct { uint8_t bytes[DECIMAL128_Bytes]; /* decimal128: 1, 5, 12, 110 bits*/ } decimal128; /* special values [top byte excluding sign bit; last two bits are */ /* don't-care for Infinity on input, last bit don't-care for NaN] */ #if !defined(DECIMAL_NaN) #define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */ #define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */ #define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */ #endif /* ---------------------------------------------------------------- */ /* Routines */ /* ---------------------------------------------------------------- */ /* String conversions */ decimal128 * decimal128FromString(decimal128 *, const char *, decContext *); char * decimal128ToString(const decimal128 *, char *); char * decimal128ToEngString(const decimal128 *, char *); /* decNumber conversions */ decimal128 * decimal128FromNumber(decimal128 *, const decNumber *, decContext *); decNumber * decimal128ToNumber(const decimal128 *, decNumber *); /* Format-dependent utilities */ uint32_t decimal128IsCanonical(const decimal128 *); decimal128 * decimal128Canonical(decimal128 *, const decimal128 *); #endif jq-jq-1.8.0/vendor/decNumber/decimal32.c000066400000000000000000000540331501676513100176640ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal 32-bit format module */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2008. 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 decimal32 format numbers. */ /* Conversions are supplied to and from decNumber and String. */ /* */ /* This is used when decNumber provides operations, either for all */ /* operations or as a proxy between decNumber and decSingle. */ /* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ #include // [for memset/memcpy] #include // [for printf] #define DECNUMDIGITS 7 // make decNumbers with space for 7 #include "decNumber.h" // base number library #include "decNumberLocal.h" // decNumber local types, etc. #include "decimal32.h" // our primary include /* Utility tables and routines [in decimal64.c] */ // DPD2BIN and the reverse are renamed to prevent link-time conflict // if decQuad is also built in the same executable #define DPD2BIN DPD2BINx #define BIN2DPD BIN2DPDx extern const uInt COMBEXP[32], COMBMSD[32]; extern const uShort DPD2BIN[1024]; extern const uShort BIN2DPD[1000]; extern const uByte BIN2CHAR[4001]; extern void decDigitsToDPD(const decNumber *, uInt *, Int); extern void decDigitsFromDPD(decNumber *, const uInt *, Int); #if DECTRACE || DECCHECK void decimal32Show(const decimal32 *); // for debug extern void decNumberShow(const decNumber *); // .. #endif /* Useful macro */ // Clear a structure (e.g., a decNumber) #define DEC_clear(d) memset(d, 0, sizeof(*d)) /* ------------------------------------------------------------------ */ /* decimal32FromNumber -- convert decNumber to decimal32 */ /* */ /* ds is the target decimal32 */ /* dn is the source number (assumed valid) */ /* set is the context, used only for reporting errors */ /* */ /* The set argument is used only for status reporting and for the */ /* rounding mode (used if the coefficient is more than DECIMAL32_Pmax */ /* digits or an overflow is detected). If the exponent is out of the */ /* valid range then Overflow or Underflow will be raised. */ /* After Underflow a subnormal result is possible. */ /* */ /* DEC_Clamped is set if the number has to be 'folded down' to fit, */ /* by reducing its exponent and multiplying the coefficient by a */ /* power of ten, or if the exponent on a zero had to be clamped. */ /* ------------------------------------------------------------------ */ decimal32 * decimal32FromNumber(decimal32 *d32, const decNumber *dn, decContext *set) { uInt status=0; // status accumulator Int ae; // adjusted exponent decNumber dw; // work decContext dc; // .. uInt comb, exp; // .. uInt uiwork; // for macros uInt targ=0; // target 32-bit // If the number has too many digits, or the exponent could be // out of range then reduce the number under the appropriate // constraints. This could push the number to Infinity or zero, // so this check and rounding must be done before generating the // decimal32] ae=dn->exponent+dn->digits-1; // [0 if special] if (dn->digits>DECIMAL32_Pmax // too many digits || ae>DECIMAL32_Emax // likely overflow || aeround; // use supplied rounding decNumberPlus(&dw, dn, &dc); // (round and check) // [this changes -0 to 0, so enforce the sign...] dw.bits|=dn->bits&DECNEG; status=dc.status; // save status dn=&dw; // use the work number } // maybe out of range if (dn->bits&DECSPECIAL) { // a special value if (dn->bits&DECINF) targ=DECIMAL_Inf<<24; else { // sNaN or qNaN if ((*dn->lsu!=0 || dn->digits>1) // non-zero coefficient && (dn->digitsbits&DECNAN) targ|=DECIMAL_NaN<<24; else targ|=DECIMAL_sNaN<<24; } // a NaN } // special else { // is finite if (decNumberIsZero(dn)) { // is a zero // set and clamp exponent if (dn->exponent<-DECIMAL32_Bias) { exp=0; // low clamp status|=DEC_Clamped; } else { exp=dn->exponent+DECIMAL32_Bias; // bias exponent if (exp>DECIMAL32_Ehigh) { // top clamp exp=DECIMAL32_Ehigh; status|=DEC_Clamped; } } comb=(exp>>3) & 0x18; // msd=0, exp top 2 bits .. } else { // non-zero finite number uInt msd; // work Int pad=0; // coefficient pad digits // the dn is known to fit, but it may need to be padded exp=(uInt)(dn->exponent+DECIMAL32_Bias); // bias exponent if (exp>DECIMAL32_Ehigh) { // fold-down case pad=exp-DECIMAL32_Ehigh; exp=DECIMAL32_Ehigh; // [to maximum] status|=DEC_Clamped; } // fastpath common case if (DECDPUN==3 && pad==0) { targ=BIN2DPD[dn->lsu[0]]; if (dn->digits>3) targ|=(uInt)(BIN2DPD[dn->lsu[1]])<<10; msd=(dn->digits==7 ? dn->lsu[2] : 0); } else { // general case decDigitsToDPD(dn, &targ, pad); // save and clear the top digit msd=targ>>20; targ&=0x000fffff; } // create the combination field if (msd>=8) comb=0x18 | ((exp>>5) & 0x06) | (msd & 0x01); else comb=((exp>>3) & 0x18) | msd; } targ|=comb<<26; // add combination field .. targ|=(exp&0x3f)<<20; // .. and exponent continuation } // finite if (dn->bits&DECNEG) targ|=0x80000000; // add sign bit // now write to storage; this is endian UBFROMUI(d32->bytes, targ); // directly store the int if (status!=0) decContextSetStatus(set, status); // pass on status // decimal32Show(d32); return d32; } // decimal32FromNumber /* ------------------------------------------------------------------ */ /* decimal32ToNumber -- convert decimal32 to decNumber */ /* d32 is the source decimal32 */ /* dn is the target number, with appropriate space */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decNumber * decimal32ToNumber(const decimal32 *d32, decNumber *dn) { uInt msd; // coefficient MSD uInt exp; // exponent top two bits uInt comb; // combination field uInt sour; // source 32-bit uInt uiwork; // for macros // load source from storage; this is endian sour=UBTOUI(d32->bytes); // directly load the int comb=(sour>>26)&0x1f; // combination field decNumberZero(dn); // clean number if (sour&0x80000000) dn->bits=DECNEG; // set sign if negative msd=COMBMSD[comb]; // decode the combination field exp=COMBEXP[comb]; // .. if (exp==3) { // is a special if (msd==0) { dn->bits|=DECINF; return dn; // no coefficient needed } else if (sour&0x02000000) dn->bits|=DECSNAN; else dn->bits|=DECNAN; msd=0; // no top digit } else { // is a finite number dn->exponent=(exp<<6)+((sour>>20)&0x3f)-DECIMAL32_Bias; // unbiased } // get the coefficient sour&=0x000fffff; // clean coefficient continuation if (msd) { // non-zero msd sour|=msd<<20; // prefix to coefficient decDigitsFromDPD(dn, &sour, 3); // process 3 declets return dn; } // msd=0 if (!sour) return dn; // easy: coefficient is 0 if (sour&0x000ffc00) // need 2 declets? decDigitsFromDPD(dn, &sour, 2); // process 2 declets else decDigitsFromDPD(dn, &sour, 1); // process 1 declet return dn; } // decimal32ToNumber /* ------------------------------------------------------------------ */ /* to-scientific-string -- conversion to numeric string */ /* to-engineering-string -- conversion to numeric string */ /* */ /* decimal32ToString(d32, string); */ /* decimal32ToEngString(d32, string); */ /* */ /* d32 is the decimal32 format number to convert */ /* string is the string where the result will be laid out */ /* */ /* string must be at least 24 characters */ /* */ /* No error is possible, and no status can be set. */ /* ------------------------------------------------------------------ */ char * decimal32ToEngString(const decimal32 *d32, char *string){ decNumber dn; // work decimal32ToNumber(d32, &dn); decNumberToEngString(&dn, string); return string; } // decimal32ToEngString char * decimal32ToString(const decimal32 *d32, char *string){ uInt msd; // coefficient MSD Int exp; // exponent top two bits or full uInt comb; // combination field char *cstart; // coefficient start char *c; // output pointer in string const uByte *u; // work char *s, *t; // .. (source, target) Int dpd; // .. Int pre, e; // .. uInt uiwork; // for macros uInt sour; // source 32-bit // load source from storage; this is endian sour=UBTOUI(d32->bytes); // directly load the int c=string; // where result will go if (((Int)sour)<0) *c++='-'; // handle sign comb=(sour>>26)&0x1f; // combination field msd=COMBMSD[comb]; // decode the combination field exp=COMBEXP[comb]; // .. if (exp==3) { if (msd==0) { // infinity strcpy(c, "Inf"); strcpy(c+3, "inity"); return string; // easy } if (sour&0x02000000) *c++='s'; // sNaN strcpy(c, "NaN"); // complete word c+=3; // step past if ((sour&0x000fffff)==0) return string; // zero payload // otherwise drop through to add integer; set correct exp exp=0; msd=0; // setup for following code } else exp=(exp<<6)+((sour>>20)&0x3f)-DECIMAL32_Bias; // unbiased // convert 7 digits of significand to characters cstart=c; // save start of coefficient if (msd) *c++='0'+(char)msd; // non-zero most significant digit // Now decode the declets. After extracting each one, it is // decoded to binary and then to a 4-char sequence by table lookup; // the 4-chars are a 1-char length (significant digits, except 000 // has length 0). This allows us to left-align the first declet // with non-zero content, then remaining ones are full 3-char // length. We use fixed-length memcpys because variable-length // causes a subroutine call in GCC. (These are length 4 for speed // and are safe because the array has an extra terminator byte.) #define dpd2char u=&BIN2CHAR[DPD2BIN[dpd]*4]; \ if (c!=cstart) {memcpy(c, u+1, 4); c+=3;} \ else if (*u) {memcpy(c, u+4-*u, 4); c+=*u;} dpd=(sour>>10)&0x3ff; // declet 1 dpd2char; dpd=(sour)&0x3ff; // declet 2 dpd2char; if (c==cstart) *c++='0'; // all zeros -- make 0 if (exp==0) { // integer or NaN case -- easy *c='\0'; // terminate return string; } /* non-0 exponent */ e=0; // assume no E pre=c-cstart+exp; // [here, pre-exp is the digits count (==1 for zero)] if (exp>0 || pre<-5) { // need exponential form e=pre-1; // calculate E value pre=1; // assume one digit before '.' } // exponential form /* modify the coefficient, adding 0s, '.', and E+nn as needed */ s=c-1; // source (LSD) if (pre>0) { // ddd.ddd (plain), perhaps with E char *dotat=cstart+pre; if (dotat=dotat; s--, t--) *t=*s; // open the gap; leave t at gap *t='.'; // insert the dot c++; // length increased by one } // finally add the E-part, if needed; it will never be 0, and has // a maximum length of 3 digits (E-101 case) if (e!=0) { *c++='E'; // starts with E *c++='+'; // assume positive if (e<0) { *(c-1)='-'; // oops, need '-' e=-e; // uInt, please } u=&BIN2CHAR[e*4]; // -> length byte memcpy(c, u+4-*u, 4); // copy fixed 4 characters [is safe] c+=*u; // bump pointer appropriately } *c='\0'; // add terminator //printf("res %s\n", string); return string; } // pre>0 /* -5<=pre<=0: here for plain 0.ddd or 0.000ddd forms (can never have E) */ t=c+1-pre; *(t+1)='\0'; // can add terminator now for (; s>=cstart; s--, t--) *t=*s; // shift whole coefficient right c=cstart; *c++='0'; // always starts with 0. *c++='.'; for (; pre<0; pre++) *c++='0'; // add any 0's after '.' //printf("res %s\n", string); return string; } // decimal32ToString /* ------------------------------------------------------------------ */ /* to-number -- conversion from numeric string */ /* */ /* decimal32FromString(result, string, set); */ /* */ /* result is the decimal32 format number which gets the result of */ /* the conversion */ /* *string is the character string which should contain a valid */ /* number (which may be a special value) */ /* set is the context */ /* */ /* The context is supplied to this routine is used for error handling */ /* (setting of status and traps) and for the rounding mode, only. */ /* If an error occurs, the result will be a valid decimal32 NaN. */ /* ------------------------------------------------------------------ */ decimal32 * decimal32FromString(decimal32 *result, const char *string, decContext *set) { decContext dc; // work decNumber dn; // .. decContextDefault(&dc, DEC_INIT_DECIMAL32); // no traps, please dc.round=set->round; // use supplied rounding decNumberFromString(&dn, string, &dc); // will round if needed decimal32FromNumber(result, &dn, &dc); if (dc.status!=0) { // something happened decContextSetStatus(set, dc.status); // .. pass it on } return result; } // decimal32FromString /* ------------------------------------------------------------------ */ /* decimal32IsCanonical -- test whether encoding is canonical */ /* d32 is the source decimal32 */ /* returns 1 if the encoding of d32 is canonical, 0 otherwise */ /* No error is possible. */ /* ------------------------------------------------------------------ */ uInt decimal32IsCanonical(const decimal32 *d32) { decNumber dn; // work decimal32 canon; // .. decContext dc; // .. decContextDefault(&dc, DEC_INIT_DECIMAL32); decimal32ToNumber(d32, &dn); decimal32FromNumber(&canon, &dn, &dc);// canon will now be canonical return memcmp(d32, &canon, DECIMAL32_Bytes)==0; } // decimal32IsCanonical /* ------------------------------------------------------------------ */ /* decimal32Canonical -- copy an encoding, ensuring it is canonical */ /* d32 is the source decimal32 */ /* result is the target (may be the same decimal32) */ /* returns result */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decimal32 * decimal32Canonical(decimal32 *result, const decimal32 *d32) { decNumber dn; // work decContext dc; // .. decContextDefault(&dc, DEC_INIT_DECIMAL32); decimal32ToNumber(d32, &dn); decimal32FromNumber(result, &dn, &dc);// result will now be canonical return result; } // decimal32Canonical #if DECTRACE || DECCHECK /* Macros for accessing decimal32 fields. These assume the argument is a reference (pointer) to the decimal32 structure, and the decimal32 is in network byte order (big-endian) */ // Get sign #define decimal32Sign(d) ((unsigned)(d)->bytes[0]>>7) // Get combination field #define decimal32Comb(d) (((d)->bytes[0] & 0x7c)>>2) // Get exponent continuation [does not remove bias] #define decimal32ExpCon(d) ((((d)->bytes[0] & 0x03)<<4) \ | ((unsigned)(d)->bytes[1]>>4)) // Set sign [this assumes sign previously 0] #define decimal32SetSign(d, b) { \ (d)->bytes[0]|=((unsigned)(b)<<7);} // Set exponent continuation [does not apply bias] // This assumes range has been checked and exponent previously 0; // type of exponent must be unsigned #define decimal32SetExpCon(d, e) { \ (d)->bytes[0]|=(uByte)((e)>>4); \ (d)->bytes[1]|=(uByte)(((e)&0x0F)<<4);} /* ------------------------------------------------------------------ */ /* decimal32Show -- display a decimal32 in hexadecimal [debug aid] */ /* d32 -- the number to show */ /* ------------------------------------------------------------------ */ // Also shows sign/cob/expconfields extracted - valid bigendian only void decimal32Show(const decimal32 *d32) { char buf[DECIMAL32_Bytes*2+1]; Int i, j=0; if (DECLITEND) { for (i=0; ibytes[3-i]); } printf(" D32> %s [S:%d Cb:%02x Ec:%02x] LittleEndian\n", buf, d32->bytes[3]>>7, (d32->bytes[3]>>2)&0x1f, ((d32->bytes[3]&0x3)<<4)| (d32->bytes[2]>>4)); } else { for (i=0; ibytes[i]); } printf(" D32> %s [S:%d Cb:%02x Ec:%02x] BigEndian\n", buf, decimal32Sign(d32), decimal32Comb(d32), decimal32ExpCon(d32)); } } // decimal32Show #endif jq-jq-1.8.0/vendor/decNumber/decimal32.h000066400000000000000000000103071501676513100176650ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal 32-bit format module header */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2006. 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(DECIMAL32) #define DECIMAL32 #define DEC32NAME "decimal32" /* Short name */ #define DEC32FULLNAME "Decimal 32-bit Number" /* Verbose name */ #define DEC32AUTHOR "Mike Cowlishaw" /* Who to blame */ /* parameters for decimal32s */ #define DECIMAL32_Bytes 4 /* length */ #define DECIMAL32_Pmax 7 /* maximum precision (digits) */ #define DECIMAL32_Emax 96 /* maximum adjusted exponent */ #define DECIMAL32_Emin -95 /* minimum adjusted exponent */ #define DECIMAL32_Bias 101 /* bias for the exponent */ #define DECIMAL32_String 15 /* maximum string length, +1 */ #define DECIMAL32_EconL 6 /* exp. continuation length */ /* highest biased exponent (Elimit-1) */ #define DECIMAL32_Ehigh (DECIMAL32_Emax+DECIMAL32_Bias-DECIMAL32_Pmax+1) /* check enough digits, if pre-defined */ #if defined(DECNUMDIGITS) #if (DECNUMDIGITS=7 for safe use #endif #endif #ifndef DECNUMDIGITS #define DECNUMDIGITS DECIMAL32_Pmax /* size if not already defined*/ #endif #ifndef DECNUMBER #include "decNumber.h" /* context and number library */ #endif /* Decimal 32-bit type, accessible by bytes */ typedef struct { uint8_t bytes[DECIMAL32_Bytes]; /* decimal32: 1, 5, 6, 20 bits*/ } decimal32; /* special values [top byte excluding sign bit; last two bits are */ /* don't-care for Infinity on input, last bit don't-care for NaN] */ #if !defined(DECIMAL_NaN) #define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */ #define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */ #define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */ #endif /* ---------------------------------------------------------------- */ /* Routines */ /* ---------------------------------------------------------------- */ /* String conversions */ decimal32 * decimal32FromString(decimal32 *, const char *, decContext *); char * decimal32ToString(const decimal32 *, char *); char * decimal32ToEngString(const decimal32 *, char *); /* decNumber conversions */ decimal32 * decimal32FromNumber(decimal32 *, const decNumber *, decContext *); decNumber * decimal32ToNumber(const decimal32 *, decNumber *); /* Format-dependent utilities */ uint32_t decimal32IsCanonical(const decimal32 *); decimal32 * decimal32Canonical(decimal32 *, const decimal32 *); #endif jq-jq-1.8.0/vendor/decNumber/decimal64.c000066400000000000000000001131701501676513100176670ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal 64-bit format 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 decimal64 format numbers. */ /* Conversions are supplied to and from decNumber and String. */ /* */ /* This is used when decNumber provides operations, either for all */ /* operations or as a proxy between decNumber and decSingle. */ /* */ /* Error handling is the same as decNumber (qv.). */ /* ------------------------------------------------------------------ */ #include // [for memset/memcpy] #include // [for printf] #define DECNUMDIGITS 16 // make decNumbers with space for 16 #include "decNumber.h" // base number library #include "decNumberLocal.h" // decNumber local types, etc. #include "decimal64.h" // our primary include /* Utility routines and tables [in decimal64.c]; externs for C++ */ // DPD2BIN and the reverse are renamed to prevent link-time conflict // if decQuad is also built in the same executable #define DPD2BIN DPD2BINx #define BIN2DPD BIN2DPDx extern const uInt COMBEXP[32], COMBMSD[32]; extern const uShort DPD2BIN[1024]; extern const uShort BIN2DPD[1000]; extern const uByte BIN2CHAR[4001]; extern void decDigitsFromDPD(decNumber *, const uInt *, Int); extern void decDigitsToDPD(const decNumber *, uInt *, Int); #if DECTRACE || DECCHECK void decimal64Show(const decimal64 *); // for debug extern void decNumberShow(const decNumber *); // .. #endif /* Useful macro */ // Clear a structure (e.g., a decNumber) #define DEC_clear(d) memset(d, 0, sizeof(*d)) /* define and include the tables to use for conversions */ #define DEC_BIN2CHAR 1 #define DEC_DPD2BIN 1 #define DEC_BIN2DPD 1 // used for all sizes #include "decDPD.h" // lookup tables /* ------------------------------------------------------------------ */ /* decimal64FromNumber -- convert decNumber to decimal64 */ /* */ /* ds is the target decimal64 */ /* dn is the source number (assumed valid) */ /* set is the context, used only for reporting errors */ /* */ /* The set argument is used only for status reporting and for the */ /* rounding mode (used if the coefficient is more than DECIMAL64_Pmax */ /* digits or an overflow is detected). If the exponent is out of the */ /* valid range then Overflow or Underflow will be raised. */ /* After Underflow a subnormal result is possible. */ /* */ /* DEC_Clamped is set if the number has to be 'folded down' to fit, */ /* by reducing its exponent and multiplying the coefficient by a */ /* power of ten, or if the exponent on a zero had to be clamped. */ /* ------------------------------------------------------------------ */ decimal64 * decimal64FromNumber(decimal64 *d64, const decNumber *dn, decContext *set) { uInt status=0; // status accumulator Int ae; // adjusted exponent decNumber dw; // work decContext dc; // .. uInt comb, exp; // .. uInt uiwork; // for macros uInt targar[2]={0, 0}; // target 64-bit #define targhi targar[1] // name the word with the sign #define targlo targar[0] // and the other // If the number has too many digits, or the exponent could be // out of range then reduce the number under the appropriate // constraints. This could push the number to Infinity or zero, // so this check and rounding must be done before generating the // decimal64] ae=dn->exponent+dn->digits-1; // [0 if special] if (dn->digits>DECIMAL64_Pmax // too many digits || ae>DECIMAL64_Emax // likely overflow || aeround; // use supplied rounding decNumberPlus(&dw, dn, &dc); // (round and check) // [this changes -0 to 0, so enforce the sign...] dw.bits|=dn->bits&DECNEG; status=dc.status; // save status dn=&dw; // use the work number } // maybe out of range if (dn->bits&DECSPECIAL) { // a special value if (dn->bits&DECINF) targhi=DECIMAL_Inf<<24; else { // sNaN or qNaN if ((*dn->lsu!=0 || dn->digits>1) // non-zero coefficient && (dn->digitsbits&DECNAN) targhi|=DECIMAL_NaN<<24; else targhi|=DECIMAL_sNaN<<24; } // a NaN } // special else { // is finite if (decNumberIsZero(dn)) { // is a zero // set and clamp exponent if (dn->exponent<-DECIMAL64_Bias) { exp=0; // low clamp status|=DEC_Clamped; } else { exp=dn->exponent+DECIMAL64_Bias; // bias exponent if (exp>DECIMAL64_Ehigh) { // top clamp exp=DECIMAL64_Ehigh; status|=DEC_Clamped; } } comb=(exp>>5) & 0x18; // msd=0, exp top 2 bits .. } else { // non-zero finite number uInt msd; // work Int pad=0; // coefficient pad digits // the dn is known to fit, but it may need to be padded exp=(uInt)(dn->exponent+DECIMAL64_Bias); // bias exponent if (exp>DECIMAL64_Ehigh) { // fold-down case pad=exp-DECIMAL64_Ehigh; exp=DECIMAL64_Ehigh; // [to maximum] status|=DEC_Clamped; } // fastpath common case if (DECDPUN==3 && pad==0) { uInt dpd[6]={0,0,0,0,0,0}; uInt i; Int d=dn->digits; for (i=0; d>0; i++, d-=3) dpd[i]=BIN2DPD[dn->lsu[i]]; targlo =dpd[0]; targlo|=dpd[1]<<10; targlo|=dpd[2]<<20; if (dn->digits>6) { targlo|=dpd[3]<<30; targhi =dpd[3]>>2; targhi|=dpd[4]<<8; } msd=dpd[5]; // [did not really need conversion] } else { // general case decDigitsToDPD(dn, targar, pad); // save and clear the top digit msd=targhi>>18; targhi&=0x0003ffff; } // create the combination field if (msd>=8) comb=0x18 | ((exp>>7) & 0x06) | (msd & 0x01); else comb=((exp>>5) & 0x18) | msd; } targhi|=comb<<26; // add combination field .. targhi|=(exp&0xff)<<18; // .. and exponent continuation } // finite if (dn->bits&DECNEG) targhi|=0x80000000; // add sign bit // now write to storage; this is now always endian if (DECLITEND) { // lo int then hi UBFROMUI(d64->bytes, targar[0]); UBFROMUI(d64->bytes+4, targar[1]); } else { // hi int then lo UBFROMUI(d64->bytes, targar[1]); UBFROMUI(d64->bytes+4, targar[0]); } if (status!=0) decContextSetStatus(set, status); // pass on status // decimal64Show(d64); return d64; } // decimal64FromNumber /* ------------------------------------------------------------------ */ /* decimal64ToNumber -- convert decimal64 to decNumber */ /* d64 is the source decimal64 */ /* dn is the target number, with appropriate space */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decNumber * decimal64ToNumber(const decimal64 *d64, decNumber *dn) { uInt msd; // coefficient MSD uInt exp; // exponent top two bits uInt comb; // combination field Int need; // work uInt uiwork; // for macros uInt sourar[2]; // source 64-bit #define sourhi sourar[1] // name the word with the sign #define sourlo sourar[0] // and the lower word // load source from storage; this is endian if (DECLITEND) { sourlo=UBTOUI(d64->bytes ); // directly load the low int sourhi=UBTOUI(d64->bytes+4); // then the high int } else { sourhi=UBTOUI(d64->bytes ); // directly load the high int sourlo=UBTOUI(d64->bytes+4); // then the low int } comb=(sourhi>>26)&0x1f; // combination field decNumberZero(dn); // clean number if (sourhi&0x80000000) dn->bits=DECNEG; // set sign if negative msd=COMBMSD[comb]; // decode the combination field exp=COMBEXP[comb]; // .. if (exp==3) { // is a special if (msd==0) { dn->bits|=DECINF; return dn; // no coefficient needed } else if (sourhi&0x02000000) dn->bits|=DECSNAN; else dn->bits|=DECNAN; msd=0; // no top digit } else { // is a finite number dn->exponent=(exp<<8)+((sourhi>>18)&0xff)-DECIMAL64_Bias; // unbiased } // get the coefficient sourhi&=0x0003ffff; // clean coefficient continuation if (msd) { // non-zero msd sourhi|=msd<<18; // prefix to coefficient need=6; // process 6 declets } else { // msd=0 if (!sourhi) { // top word 0 if (!sourlo) return dn; // easy: coefficient is 0 need=3; // process at least 3 declets if (sourlo&0xc0000000) need++; // process 4 declets // [could reduce some more, here] } else { // some bits in top word, msd=0 need=4; // process at least 4 declets if (sourhi&0x0003ff00) need++; // top declet!=0, process 5 } } //msd=0 decDigitsFromDPD(dn, sourar, need); // process declets return dn; } // decimal64ToNumber /* ------------------------------------------------------------------ */ /* to-scientific-string -- conversion to numeric string */ /* to-engineering-string -- conversion to numeric string */ /* */ /* decimal64ToString(d64, string); */ /* decimal64ToEngString(d64, string); */ /* */ /* d64 is the decimal64 format number to convert */ /* string is the string where the result will be laid out */ /* */ /* string must be at least 24 characters */ /* */ /* No error is possible, and no status can be set. */ /* ------------------------------------------------------------------ */ char * decimal64ToEngString(const decimal64 *d64, char *string){ decNumber dn; // work decimal64ToNumber(d64, &dn); decNumberToEngString(&dn, string); return string; } // decimal64ToEngString char * decimal64ToString(const decimal64 *d64, char *string){ uInt msd; // coefficient MSD Int exp; // exponent top two bits or full uInt comb; // combination field char *cstart; // coefficient start char *c; // output pointer in string const uByte *u; // work char *s, *t; // .. (source, target) Int dpd; // .. Int pre, e; // .. uInt uiwork; // for macros uInt sourar[2]; // source 64-bit #define sourhi sourar[1] // name the word with the sign #define sourlo sourar[0] // and the lower word // load source from storage; this is endian if (DECLITEND) { sourlo=UBTOUI(d64->bytes ); // directly load the low int sourhi=UBTOUI(d64->bytes+4); // then the high int } else { sourhi=UBTOUI(d64->bytes ); // directly load the high int sourlo=UBTOUI(d64->bytes+4); // then the low int } c=string; // where result will go if (((Int)sourhi)<0) *c++='-'; // handle sign comb=(sourhi>>26)&0x1f; // combination field msd=COMBMSD[comb]; // decode the combination field exp=COMBEXP[comb]; // .. if (exp==3) { if (msd==0) { // infinity strcpy(c, "Inf"); strcpy(c+3, "inity"); return string; // easy } if (sourhi&0x02000000) *c++='s'; // sNaN strcpy(c, "NaN"); // complete word c+=3; // step past if (sourlo==0 && (sourhi&0x0003ffff)==0) return string; // zero payload // otherwise drop through to add integer; set correct exp exp=0; msd=0; // setup for following code } else exp=(exp<<8)+((sourhi>>18)&0xff)-DECIMAL64_Bias; // convert 16 digits of significand to characters cstart=c; // save start of coefficient if (msd) *c++='0'+(char)msd; // non-zero most significant digit // Now decode the declets. After extracting each one, it is // decoded to binary and then to a 4-char sequence by table lookup; // the 4-chars are a 1-char length (significant digits, except 000 // has length 0). This allows us to left-align the first declet // with non-zero content, then remaining ones are full 3-char // length. We use fixed-length memcpys because variable-length // causes a subroutine call in GCC. (These are length 4 for speed // and are safe because the array has an extra terminator byte.) #define dpd2char u=&BIN2CHAR[DPD2BIN[dpd]*4]; \ if (c!=cstart) {memcpy(c, u+1, 4); c+=3;} \ else if (*u) {memcpy(c, u+4-*u, 4); c+=*u;} dpd=(sourhi>>8)&0x3ff; // declet 1 dpd2char; dpd=((sourhi&0xff)<<2) | (sourlo>>30); // declet 2 dpd2char; dpd=(sourlo>>20)&0x3ff; // declet 3 dpd2char; dpd=(sourlo>>10)&0x3ff; // declet 4 dpd2char; dpd=(sourlo)&0x3ff; // declet 5 dpd2char; if (c==cstart) *c++='0'; // all zeros -- make 0 if (exp==0) { // integer or NaN case -- easy *c='\0'; // terminate return string; } /* non-0 exponent */ e=0; // assume no E pre=c-cstart+exp; // [here, pre-exp is the digits count (==1 for zero)] if (exp>0 || pre<-5) { // need exponential form e=pre-1; // calculate E value pre=1; // assume one digit before '.' } // exponential form /* modify the coefficient, adding 0s, '.', and E+nn as needed */ s=c-1; // source (LSD) if (pre>0) { // ddd.ddd (plain), perhaps with E char *dotat=cstart+pre; if (dotat=dotat; s--, t--) *t=*s; // open the gap; leave t at gap *t='.'; // insert the dot c++; // length increased by one } // finally add the E-part, if needed; it will never be 0, and has // a maximum length of 3 digits if (e!=0) { *c++='E'; // starts with E *c++='+'; // assume positive if (e<0) { *(c-1)='-'; // oops, need '-' e=-e; // uInt, please } u=&BIN2CHAR[e*4]; // -> length byte memcpy(c, u+4-*u, 4); // copy fixed 4 characters [is safe] c+=*u; // bump pointer appropriately } *c='\0'; // add terminator //printf("res %s\n", string); return string; } // pre>0 /* -5<=pre<=0: here for plain 0.ddd or 0.000ddd forms (can never have E) */ t=c+1-pre; *(t+1)='\0'; // can add terminator now for (; s>=cstart; s--, t--) *t=*s; // shift whole coefficient right c=cstart; *c++='0'; // always starts with 0. *c++='.'; for (; pre<0; pre++) *c++='0'; // add any 0's after '.' //printf("res %s\n", string); return string; } // decimal64ToString /* ------------------------------------------------------------------ */ /* to-number -- conversion from numeric string */ /* */ /* decimal64FromString(result, string, set); */ /* */ /* result is the decimal64 format number which gets the result of */ /* the conversion */ /* *string is the character string which should contain a valid */ /* number (which may be a special value) */ /* set is the context */ /* */ /* The context is supplied to this routine is used for error handling */ /* (setting of status and traps) and for the rounding mode, only. */ /* If an error occurs, the result will be a valid decimal64 NaN. */ /* ------------------------------------------------------------------ */ decimal64 * decimal64FromString(decimal64 *result, const char *string, decContext *set) { decContext dc; // work decNumber dn; // .. decContextDefault(&dc, DEC_INIT_DECIMAL64); // no traps, please dc.round=set->round; // use supplied rounding decNumberFromString(&dn, string, &dc); // will round if needed decimal64FromNumber(result, &dn, &dc); if (dc.status!=0) { // something happened decContextSetStatus(set, dc.status); // .. pass it on } return result; } // decimal64FromString /* ------------------------------------------------------------------ */ /* decimal64IsCanonical -- test whether encoding is canonical */ /* d64 is the source decimal64 */ /* returns 1 if the encoding of d64 is canonical, 0 otherwise */ /* No error is possible. */ /* ------------------------------------------------------------------ */ uInt decimal64IsCanonical(const decimal64 *d64) { decNumber dn; // work decimal64 canon; // .. decContext dc; // .. decContextDefault(&dc, DEC_INIT_DECIMAL64); decimal64ToNumber(d64, &dn); decimal64FromNumber(&canon, &dn, &dc);// canon will now be canonical return memcmp(d64, &canon, DECIMAL64_Bytes)==0; } // decimal64IsCanonical /* ------------------------------------------------------------------ */ /* decimal64Canonical -- copy an encoding, ensuring it is canonical */ /* d64 is the source decimal64 */ /* result is the target (may be the same decimal64) */ /* returns result */ /* No error is possible. */ /* ------------------------------------------------------------------ */ decimal64 * decimal64Canonical(decimal64 *result, const decimal64 *d64) { decNumber dn; // work decContext dc; // .. decContextDefault(&dc, DEC_INIT_DECIMAL64); decimal64ToNumber(d64, &dn); decimal64FromNumber(result, &dn, &dc);// result will now be canonical return result; } // decimal64Canonical #if DECTRACE || DECCHECK /* Macros for accessing decimal64 fields. These assume the argument is a reference (pointer) to the decimal64 structure, and the decimal64 is in network byte order (big-endian) */ // Get sign #define decimal64Sign(d) ((unsigned)(d)->bytes[0]>>7) // Get combination field #define decimal64Comb(d) (((d)->bytes[0] & 0x7c)>>2) // Get exponent continuation [does not remove bias] #define decimal64ExpCon(d) ((((d)->bytes[0] & 0x03)<<6) \ | ((unsigned)(d)->bytes[1]>>2)) // Set sign [this assumes sign previously 0] #define decimal64SetSign(d, b) { \ (d)->bytes[0]|=((unsigned)(b)<<7);} // Set exponent continuation [does not apply bias] // This assumes range has been checked and exponent previously 0; // type of exponent must be unsigned #define decimal64SetExpCon(d, e) { \ (d)->bytes[0]|=(uByte)((e)>>6); \ (d)->bytes[1]|=(uByte)(((e)&0x3F)<<2);} /* ------------------------------------------------------------------ */ /* decimal64Show -- display a decimal64 in hexadecimal [debug aid] */ /* d64 -- the number to show */ /* ------------------------------------------------------------------ */ // Also shows sign/cob/expconfields extracted void decimal64Show(const decimal64 *d64) { char buf[DECIMAL64_Bytes*2+1]; Int i, j=0; if (DECLITEND) { for (i=0; ibytes[7-i]); } printf(" D64> %s [S:%d Cb:%02x Ec:%02x] LittleEndian\n", buf, d64->bytes[7]>>7, (d64->bytes[7]>>2)&0x1f, ((d64->bytes[7]&0x3)<<6)| (d64->bytes[6]>>2)); } else { // big-endian for (i=0; ibytes[i]); } printf(" D64> %s [S:%d Cb:%02x Ec:%02x] BigEndian\n", buf, decimal64Sign(d64), decimal64Comb(d64), decimal64ExpCon(d64)); } } // decimal64Show #endif /* ================================================================== */ /* Shared utility routines and tables */ /* ================================================================== */ // define and include the conversion tables to use for shared code #if DECDPUN==3 #define DEC_DPD2BIN 1 #else #define DEC_DPD2BCD 1 #endif #include "decDPD.h" // lookup tables // The maximum number of decNumberUnits needed for a working copy of // the units array is the ceiling of digits/DECDPUN, where digits is // the maximum number of digits in any of the formats for which this // is used. decimal128.h must not be included in this module, so, as // a very special case, that number is defined as a literal here. #define DECMAX754 34 #define DECMAXUNITS ((DECMAX754+DECDPUN-1)/DECDPUN) /* ------------------------------------------------------------------ */ /* Combination field lookup tables (uInts to save measurable work) */ /* */ /* COMBEXP - 2-bit most-significant-bits of exponent */ /* [11 if an Infinity or NaN] */ /* COMBMSD - 4-bit most-significant-digit */ /* [0=Infinity, 1=NaN if COMBEXP=11] */ /* */ /* Both are indexed by the 5-bit combination field (0-31) */ /* ------------------------------------------------------------------ */ const uInt COMBEXP[32]={0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0, 1, 1, 2, 2, 3, 3}; const uInt COMBMSD[32]={0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 8, 9, 8, 9, 0, 1}; /* ------------------------------------------------------------------ */ /* decDigitsToDPD -- pack coefficient into DPD form */ /* */ /* dn is the source number (assumed valid, max DECMAX754 digits) */ /* targ is 1, 2, or 4-element uInt array, which the caller must */ /* have cleared to zeros */ /* shift is the number of 0 digits to add on the right (normally 0) */ /* */ /* The coefficient must be known small enough to fit. The full */ /* coefficient is copied, including the leading 'odd' digit. This */ /* digit is retrieved and packed into the combination field by the */ /* caller. */ /* */ /* The target uInts are altered only as necessary to receive the */ /* digits of the decNumber. When more than one uInt is needed, they */ /* are filled from left to right (that is, the uInt at offset 0 will */ /* end up with the least-significant digits). */ /* */ /* shift is used for 'fold-down' padding. */ /* */ /* No error is possible. */ /* ------------------------------------------------------------------ */ #if DECDPUN<=4 // 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) #endif void decDigitsToDPD(const decNumber *dn, uInt *targ, Int shift) { Int cut; // work Int n; // output bunch counter Int digits=dn->digits; // digit countdown uInt dpd; // densely packed decimal value uInt bin; // binary value 0-999 uInt *uout=targ; // -> current output uInt uInt uoff=0; // -> current output offset [from right] const Unit *inu=dn->lsu; // -> current input unit Unit uar[DECMAXUNITS]; // working copy of units, iff shifted #if DECDPUN!=3 // not fast path Unit in; // current unit #endif if (shift!=0) { // shift towards most significant required // shift the units array to the left by pad digits and copy // [this code is a special case of decShiftToMost, which could // be used instead if exposed and the array were copied first] const Unit *source; // .. Unit *target, *first; // .. uInt next=0; // work source=dn->lsu+D2U(digits)-1; // where msu comes from target=uar+D2U(digits)-1+D2U(shift);// where upper part of first cut goes cut=DECDPUN-MSUDIGITS(shift); // where to slice if (cut==0) { // unit-boundary case for (; source>=dn->lsu; source--, target--) *target=*source; } else { first=uar+D2U(digits+shift)-1; // where msu will end up for (; source>=dn->lsu; source--, target--) { // split the source Unit and accumulate remainder for next #if DECDPUN<=4 uInt quot=QUOT10(*source, cut); uInt rem=*source-quot*DECPOWERS[cut]; next+=quot; #else uInt rem=*source%DECPOWERS[cut]; next+=*source/DECPOWERS[cut]; #endif if (target<=first) *target=(Unit)next; // write to target iff valid next=rem*DECPOWERS[DECDPUN-cut]; // save remainder for next Unit } } // shift-move // propagate remainder to one below and clear the rest for (; target>=uar; target--) { *target=(Unit)next; next=0; } digits+=shift; // add count (shift) of zeros added inu=uar; // use units in working array } /* now densely pack the coefficient into DPD declets */ #if DECDPUN!=3 // not fast path in=*inu; // current unit cut=0; // at lowest digit bin=0; // [keep compiler quiet] #endif for(n=0; digits>0; n++) { // each output bunch #if DECDPUN==3 // fast path, 3-at-a-time bin=*inu; // 3 digits ready for convert digits-=3; // [may go negative] inu++; // may need another #else // must collect digit-by-digit Unit dig; // current digit Int j; // digit-in-declet count for (j=0; j<3; j++) { #if DECDPUN<=4 Unit temp=(Unit)((uInt)(in*6554)>>16); dig=(Unit)(in-X10(temp)); in=temp; #else dig=in%10; in=in/10; #endif if (j==0) bin=dig; else if (j==1) bin+=X10(dig); else /* j==2 */ bin+=X100(dig); digits--; if (digits==0) break; // [also protects *inu below] cut++; if (cut==DECDPUN) {inu++; in=*inu; cut=0;} } #endif // here there are 3 digits in bin, or have used all input digits dpd=BIN2DPD[bin]; // write declet to uInt array *uout|=dpd<>(10-uoff); // collect top bits } // n declets return; } // decDigitsToDPD /* ------------------------------------------------------------------ */ /* decDigitsFromDPD -- unpack a format's coefficient */ /* */ /* dn is the target number, with 7, 16, or 34-digit space. */ /* sour is a 1, 2, or 4-element uInt array containing only declets */ /* declets is the number of (right-aligned) declets in sour to */ /* be processed. This may be 1 more than the obvious number in */ /* a format, as any top digit is prefixed to the coefficient */ /* continuation field. It also may be as small as 1, as the */ /* caller may pre-process leading zero declets. */ /* */ /* When doing the 'extra declet' case care is taken to avoid writing */ /* extra digits when there are leading zeros, as these could overflow */ /* the units array when DECDPUN is not 3. */ /* */ /* The target uInts are used only as necessary to process declets */ /* declets into the decNumber. When more than one uInt is needed, */ /* they are used from left to right (that is, the uInt at offset 0 */ /* provides the least-significant digits). */ /* */ /* dn->digits is set, but not the sign or exponent. */ /* No error is possible [the redundant 888 codes are allowed]. */ /* ------------------------------------------------------------------ */ void decDigitsFromDPD(decNumber *dn, const uInt *sour, Int declets) { uInt dpd; // collector for 10 bits Int n; // counter Unit *uout=dn->lsu; // -> current output unit Unit *last=uout; // will be unit containing msd const uInt *uin=sour; // -> current input uInt uInt uoff=0; // -> current input offset [from right] #if DECDPUN!=3 uInt bcd; // BCD result uInt nibble; // work Unit out=0; // accumulator Int cut=0; // power of ten in current unit #endif #if DECDPUN>4 uInt const *pow; // work #endif // Expand the densely-packed integer, right to left for (n=declets-1; n>=0; n--) { // count down declets of 10 bits dpd=*uin>>uoff; uoff+=10; if (uoff>32) { // crossed uInt boundary uin++; uoff-=32; // [if using this code for wider, check this] dpd|=*uin<<(10-uoff); // get waiting bits } dpd&=0x3ff; // clear uninteresting bits #if DECDPUN==3 if (dpd==0) *uout=0; else { *uout=DPD2BIN[dpd]; // convert 10 bits to binary 0-999 last=uout; // record most significant unit } uout++; } // n #else // DECDPUN!=3 if (dpd==0) { // fastpath [e.g., leading zeros] // write out three 0 digits (nibbles); out may have digit(s) cut++; if (cut==DECDPUN) {*uout=out; if (out) {last=uout; out=0;} uout++; cut=0;} if (n==0) break; // [as below, works even if MSD=0] cut++; if (cut==DECDPUN) {*uout=out; if (out) {last=uout; out=0;} uout++; cut=0;} cut++; if (cut==DECDPUN) {*uout=out; if (out) {last=uout; out=0;} uout++; cut=0;} continue; } bcd=DPD2BCD[dpd]; // convert 10 bits to 12 bits BCD // now accumulate the 3 BCD nibbles into units nibble=bcd & 0x00f; if (nibble) out=(Unit)(out+nibble*DECPOWERS[cut]); cut++; if (cut==DECDPUN) {*uout=out; if (out) {last=uout; out=0;} uout++; cut=0;} bcd>>=4; // if this is the last declet and the remaining nibbles in bcd // are 00 then process no more nibbles, because this could be // the 'odd' MSD declet and writing any more Units would then // overflow the unit array if (n==0 && !bcd) break; nibble=bcd & 0x00f; if (nibble) out=(Unit)(out+nibble*DECPOWERS[cut]); cut++; if (cut==DECDPUN) {*uout=out; if (out) {last=uout; out=0;} uout++; cut=0;} bcd>>=4; nibble=bcd & 0x00f; if (nibble) out=(Unit)(out+nibble*DECPOWERS[cut]); cut++; if (cut==DECDPUN) {*uout=out; if (out) {last=uout; out=0;} uout++; cut=0;} } // n if (cut!=0) { // some more left over *uout=out; // write out final unit if (out) last=uout; // and note if non-zero } #endif // here, last points to the most significant unit with digits; // inspect it to get the final digits count -- this is essentially // the same code as decGetDigits in decNumber.c dn->digits=(last-dn->lsu)*DECDPUN+1; // floor of digits, plus // must be at least 1 digit #if DECDPUN>1 if (*last<10) return; // common odd digit or 0 dn->digits++; // must be 2 at least #if DECDPUN>2 if (*last<100) return; // 10-99 dn->digits++; // must be 3 at least #if DECDPUN>3 if (*last<1000) return; // 100-999 dn->digits++; // must be 4 at least #if DECDPUN>4 for (pow=&DECPOWERS[4]; *last>=*pow; pow++) dn->digits++; #endif #endif #endif #endif return; } //decDigitsFromDPD jq-jq-1.8.0/vendor/decNumber/decimal64.h000066400000000000000000000104131501676513100176700ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal 64-bit format module header */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2000, 2005. 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(DECIMAL64) #define DECIMAL64 #define DEC64NAME "decimal64" /* Short name */ #define DEC64FULLNAME "Decimal 64-bit Number" /* Verbose name */ #define DEC64AUTHOR "Mike Cowlishaw" /* Who to blame */ /* parameters for decimal64s */ #define DECIMAL64_Bytes 8 /* length */ #define DECIMAL64_Pmax 16 /* maximum precision (digits) */ #define DECIMAL64_Emax 384 /* maximum adjusted exponent */ #define DECIMAL64_Emin -383 /* minimum adjusted exponent */ #define DECIMAL64_Bias 398 /* bias for the exponent */ #define DECIMAL64_String 24 /* maximum string length, +1 */ #define DECIMAL64_EconL 8 /* exp. continuation length */ /* highest biased exponent (Elimit-1) */ #define DECIMAL64_Ehigh (DECIMAL64_Emax+DECIMAL64_Bias-DECIMAL64_Pmax+1) /* check enough digits, if pre-defined */ #if defined(DECNUMDIGITS) #if (DECNUMDIGITS=16 for safe use #endif #endif #ifndef DECNUMDIGITS #define DECNUMDIGITS DECIMAL64_Pmax /* size if not already defined*/ #endif #ifndef DECNUMBER #include "decNumber.h" /* context and number library */ #endif /* Decimal 64-bit type, accessible by bytes */ typedef struct { uint8_t bytes[DECIMAL64_Bytes]; /* decimal64: 1, 5, 8, 50 bits*/ } decimal64; /* special values [top byte excluding sign bit; last two bits are */ /* don't-care for Infinity on input, last bit don't-care for NaN] */ #if !defined(DECIMAL_NaN) #define DECIMAL_NaN 0x7c /* 0 11111 00 NaN */ #define DECIMAL_sNaN 0x7e /* 0 11111 10 sNaN */ #define DECIMAL_Inf 0x78 /* 0 11110 00 Infinity */ #endif /* ---------------------------------------------------------------- */ /* Routines */ /* ---------------------------------------------------------------- */ /* String conversions */ decimal64 * decimal64FromString(decimal64 *, const char *, decContext *); char * decimal64ToString(const decimal64 *, char *); char * decimal64ToEngString(const decimal64 *, char *); /* decNumber conversions */ decimal64 * decimal64FromNumber(decimal64 *, const decNumber *, decContext *); decNumber * decimal64ToNumber(const decimal64 *, decNumber *); /* Format-dependent utilities */ uint32_t decimal64IsCanonical(const decimal64 *); decimal64 * decimal64Canonical(decimal64 *, const decimal64 *); #endif jq-jq-1.8.0/vendor/decNumber/decnumber.pdf000066400000000000000000053162761501676513100204330ustar00rootroot00000000000000%PDF-1.4 %äüöß 2 0 obj <> stream xmRMk0W\wfe?RC48N;n5gi{Blt9-^Hh+)U-ƣI<=oq8MG7U' ;gU4CAup 2b %zS'ԁXʺ@ KCdR%u杔n?-JpMҲBZ`I  :h&2 58Ƥ 6B-4k4o8U"F`)I"" Թae>9(sb2]:H2]exTdFO`".ѩh_9J9JݏArjdxSP*o_+ endstream endobj 3 0 obj 488 endobj 13 0 obj <> stream xMKK0$M0 4m wq!B\檥{6W$Μ& _r|yz k ԭxWc^?t{f.v(tR.( "'&+N2hfB,SM B+\"'S/4Hfnꦰ7P6+ H'6L~oxb5ѯfMc2ÞÃA?/T endstream endobj 14 0 obj 242 endobj 17 0 obj <> stream x[]}_a ol6HEd):E[^)rc[%88>/wމ8ȝvΫCv/_/_>)׏/<0ߧ,x4vR~[oUoary05u et };58>c x0-i4;0HB 5e/tx _ޘ,Ѵ%:[Up3?v~|mhHF'CvN Tz *mpa܀ 2^ ?(5~q¤Dz#r'n4,&PZ֔e65t`z{0;B:8к A _=BIs08y)옖t.z,~s3^Fhdxu΃qH0eE S# `[DHD\fD5ᆽ@M#鳈C@#!€xC "1?6I2GYV++Y0gǕ܄HipąKN}J'JY b*'mUlĔ6Dl+S*T 7dR#Y8A/HMr,zm-9G2YB"Zfb5vϱٽ&$[zJM遛e?I>Tuܢׇ>7HvTbN%Ԝ O>"La'D7 @VcUiwf-%sL\W!lgh $n^aբ.ƭtE2u(W(OxcŗF= -ӴY7QƇޮP+-"O)YjWqV#i‘<"VƱRꊬO8bPX854qIJ .4[ LL4;)-ej-\7OI/9&8CV >sij)^Ç5bjIWrZV|El\I|.me+QWkQey҆RKs&3| ΖTtdKӌIyLm[nY'lb=އ-/$l5?{@yѭtLE%t\yƺ.9UY4' ,STGúLiʑ'3b/3&մ$LS 0h~D BXǰo|QaX>y,l o72`$.Jd%.n̞m#\dݫ:$jŲ-ZDzgKJ;V^tebeKPp#iBWtl)l݇㦢h/[t5l),ej[TuH.96 [y?;Jsԃ\%X;^yY"1ݨՃ": '&?;^EfFҲ<;?g[J6TK[m9-9[G)a<YnR\mv|-
hxjvFTrvN+:sw33#iY83g[)3ڝ+̬\X {,Mi%8컴Bi%\vUV2bos! [JE{:6E.Moa匇bMP0J |#IW-~6R.Ą ؽgmȮ4,fMخlpѴVF1[_AE)J4.B)ˍ%s&{m_x]Kl+GaVvRTW `[n CȎ[1TpOp; H1CG1+01#S,?<@5Z 吐J 8 Vnf6 -%X&vRl9%`x6AJ'e(:ʧ*7E3Zf.m\G`$;| .?\ř->Ӵ ?mAAz{A Eq3 kfP?׽ endstream endobj 18 0 obj 2272 endobj 162 0 obj <> stream xUM0WX3%6I%X)Ղ(IC+lj=<=Oxw9Nls[f?gu6j8pU o=U0xvmBLexx->KCdc@]&2t)ӈ3j#D셠f6Bzpbnǿ{-1F.xۥ ;N+,8jVouMW`-Yzt endstream endobj 163 0 obj 562 endobj 185 0 obj <> stream x\K$ϯhM0*(u |]#xYψ|thWBhv*32wL/wO׿>۞}Ӌ<ż[|7_oźn0K|la+}x&RW};>٣Z9> rey~pk PV!J:'MY*nxI^zP7b>J u|^H%2n(XsE#:=:,U,EPevY@MGAU :W3QK3ŒdG/AB5I/(_a}rg~@G\~+S `A[dv!r<޸1_0gPa*̝\dEU dO-kB=zgF%L(L I`T=csYC,+G. =7X"9I#-a jߩ$a|?"~8LRn)ʆT(3j^uօŭIc(;"srSdTuvC9ZЎ(~EUN܍9'@d(I .vy隰:΅[d(8tP]LsJ@{$4@ʮn3.پ`$qƘS~z: lHCZFCOE:71[A0\ȡ!VAm`;P`ޅsɏ(bkKyzB ń7zY&~>+m~z8(VǎQ׋.y2ԯnH ^J:֨=@;FWRyeMCDn1_D&a&ƴ%$< ݀v8B'hH?-V+*Bs)xAq)DQY &VM#$J[/"hea Bp!b˪ׄV:EVWɝKSYKtRܩ3QDސ$ >UrHY #zH'ҦNDCCbGxyt].ؖ@"T-wev>$0|i4IY =ĐbE*E6bF􈲂)*FoI AS^"fc* x*"(Ͻ6uUqA8H[AE58W*{bTMqȧO\/R^*g#])z?2T/+,,V#|ׇCTXg;E3Ӓ %* :GA1!V[c] )V~  ^w[[WhֈyA (J5 1^E8 zTigW'yX W%!8MXDDt/F-wuc%\b{',q G[ٛN;5ւ/8CdG\[ژ競1+vgk*@me鮙5(g 2MU-QI20N6n ])-PnII* qw@wck&PR59@ϊT%ed RMj#XۛVRG*Xž!3iZ8gmo5zeIBBN(s\R'[2*nJM NR.kNLTd&%5!6JUzF尝q ׬7`8vimzT6He73iJ҅mI R#Pz#{SU)ۑLmҽޥmڧG@QXkJ8P%WԒ!p//M/1tuKIɄS*ALE[9)iRspdg6.8dљ\`#¯nbm~ug$y{Ee2Dw>) Ckowt-Uhe^!ㅣۢC:?jM/;8Ro o􃞣≲wD8=<2N`I#5sYoQ!b$'ي%8Q8Dc{ś4_R6C&0cs*Q!4 e9vD1S)ƋꌽXW;*_`BtEv']c2>_5ިo_{,ځSֱ pyIc; ԕNkv0' &9́H#,cDH1[EȥXa;(J$A[$# Or J$v0*(*oӀ:^mHw.Cu1h쩋hT$r$IK>i,!qjHͰi_ezK^)s=cXHтu';TJbt !Hij7Bڲ9^`݋Z3a\f8^Yr7- xMQ!rd'r?]^G}rVΰptOiONǝ jJ$.O.P0&boJgH5%;_8ҞgȻZ Ffy& uRE`|0rXy+0WftdjIɹ޶G{S\#cg$Pg:HbX{*fOe12Sܙ&!bB4p;Ä]R6UOy[6vE،j4H*ύ@&8J} (JE3cFZ<~|YN8:hX*P LA:(ͪQQvhMS8: vXPR$q9!#S;5.ǥCy2\H:ǃN)m'P*1k+lok,Bc 3wG)lZ&bI r~wwSw܈xHp×op\4؃F 1!AQw6ڻZɿUSj;rƸL4 W3Ʋdu2Tڡ ދ]Xw(6j-oi>_>~~r@ Ft/{u9BGS\\5b&ؼ_N:ɛ9&~ZkF >"o|&FL;pݳUOHXE>6Vp@m3PĀ}K1zI~ B{7.AԆ>+" ."7]*LkU5ȧS0pq5*آ9a}xk:J_(I%X,QY_rN䤔* N@Um\U{q ?.*|UԮz6?=c#NHl>|PYf endstream endobj 186 0 obj 3741 endobj 206 0 obj <> stream x\Y$~_7AVޕP4m?H֬ef;^̲LWWfeF|ŕӁ?mwݴt'80>ft=wtO]w^pM¿O}:?? #{iv?_=e:O$b!'B^/d>OfF[.? Or=b/z"W7|a@) M̏^aޢ$+ln\$ap}, Ţ#y$adOJ4_'Gj08~>垎~B\O?ͤkp rS t7fg7$!&ލHuΨѲl<թVEI$?'+qFlR6ņ?ᑮəT7]az Z O/*.g4n&Se@v0yz)(̛JNsr2,.*ɍ ,ݱBtqހÏp\>+GvlRrZ^%L8 \#F-7.wpwȩQ(yp⑦J^`@qXu ~' 22\ 7"HKsSk}{=SqP_?^cTLC̼WC-X9+h2'm$4u o bA2oAԶ r ؐ ,HhlAsׂ\Ӷ pl`CoCBU"'rVC/aEI߄AҍAN.aC|vsKqK^R+0eګh%w*܎$9=(Ѧk13vrDu-t)x*515Dp"aE|[S[OQI"ƴق%9R~ i1ʚY/"YYU VX212~!6ꊐ^'-a$()0GzŅ4&/fr"\I/[ked*N,KxE6UDc<}#8šYgxPL{ʵW%xk]r`Xj#">UQ_Q`L'wsNo`Xw :`  '-SMzxO.nl41P3D$Hr@MK@s. W=2g28?CM8B;@Qnl>;lI<ǩZg/`qDEpk)m41d;Yr}f@{':1]CY 6[pp72b1W9'0ZC \S(*wfMJBd1H7!Oo ›%wqQ;=!FRڶOl͈qJgTu`'Vã_(qZ-Lz;UX ` S!O:8ZƚXTSX8H;9U,dleoc@u6Ѐa. S/>'W^{r vmC:Ga%,zB9I]'C[mF@6nnvbS߳hfr( s8Z h fggfVөG\CrߔL}%KH%)4*&))˄q#䙚 Bw4v'Ʋ *[=JhHʧ'GX@?it>Q Y Ls&H@?3EdSAjPE.倆I L+0smV^;8j#O _IЊ r&bR "N}Y4WwRg!Z:\֞)yƘ.%x#277Xkoo.TUVBQh̙?ǚ72gԁcNl.p. \]$BqfFUCo~YNۆD?q[kwh@yVqBERI`RJs,Kd&dMD ];#du$h]%i0CxP0 gc];eu#!5pXB:p%$[XfAjo$X q +y-rjȃ|\_:=wIϡa9²7YV7OLpbN:S=`.ch BHw~ʺ<~ZS%Pru"~cdJUP) 8e 8Z6.*MU灮 JULVq FV-jN{^p2{#prS(N6jP=֪ ׫Z:Tph⿳f% c_,Ϣ޵`WB!i/Ĝi=T^-d6! '5yA07N1Y$9mx`hCT^Sj=CѼx6xպt" Wç8;MUp0Q#:1Ry _mOoeEr+L\z`DYTn1Vfܾz~DEvu 8l,8l=+5He'{e), cڕ8?~|{կBRgYo9-BV>s<L1EWb5;;+&)L9\*O)I&JKM;fp]Rey~[b҄yңK]Ƚ`؃M:QH7UdrO~*ӉYw7k&LI).Luk&{\5jJ-EWSOF'mS/݅A&4A NmqˇC% ZYں]Șne9#S:0чovj6 endstream endobj 207 0 obj 3480 endobj 268 0 obj <> stream xYMk$7W4౾ZjA0= ÒB6;1$>URI*nj cwT*U$l{8}}[s8ՈFTk^?4wg7J߾8~;5bNMݝ.wRC8|ifH\~q6ϗΗOˉvo{qfWhx{K;H!8iPz Rb TvcD椯^K:6Nj20㧚+1{ZMjnAoM0FuG? G)|^&#.2ĵF#'xMYB)H !tTz+hhmhPdjJexq07w5}4O 1elWUtM0VL3+I{Ȁ otyFmtIcQO?9ѢܢE%=8D/Zh;<ՋmP\"oE"¾i]mD9q KU}`wɺ$NTh)1ު`VTс ]wE9|.T1,,r]Tm%m;5D 0]LZ\,O2oGFϙ3ƺdKno 0TTG*DP V,$ﯙs3(KeӔ8LQ0Xͨ K؃uJ]C~t5ٹA޶N{ri *+נU!N'j!!UL+[+[Z.JDeг5(&5)d@(yw HVjFBXࢹ®-Gvkו+"h)Cy/ddTّl>WK9fS.I`P^g Sh)³ Ou;wQ"aqC20͈p04:'ѕWz8`s)Јy^&PCOign&Z$[s!;f1Π-$~'\=b?N{z덅ȈC!M,Ou}VWkc$S1~ ;Y Y[=5}d9X h<[XŹƿTޢT<)|2Ӈ0S+ endstream endobj 269 0 obj 1935 endobj 288 0 obj <> stream x33T((1 endstream endobj 289 0 obj 14 endobj 291 0 obj <> stream x[[+~_a[`|tW m ه<dw&!I}J*]=ˆqwK|UIO/_zz;8idH[ A).V fs+ O+{???vQ^W|]3̅a˥ Wvp<"xŹ. |Sa2oŃх @|ZWl5+%l= f&T.#5n^k+K4Y"U+'nvSXiD߄"-3HTzw?GOD?3>E3&l]sj4ϹT$ƞ+rWDLS"{0!@NTslXAy ى6E؛J '4D1jyPj}We\mpKg'{YZ}KoP=la)[uER7Yؚ #\ie!N3(sDNXXNy os]8;THIW>NmmW+.B3s+g_wh┵ >(hh@)^HR;ZKAIRޖ5e,5]֦0!9 &gaƐ,I>QGZz ps\?KbdAժ1Y ҹzrE|T}ڔLA[ZB?pVJR,A2h#H.=Q%,%( QbBwb\C>t,gjEXAu3ƅrS:n!u:@N'g7 2ϝNYdZ0X$$,:^Uh~/ ៲f8J+g;tUU(W]Iy8* >|@I2_ۈ/{4úyjy < MP4 ZNs hJERa;} PzU][6^uKis7ㆁ`0uWc@G`<ߡKa"NJT lh#71OGL Gtꝧ 9pcF&\$0 CУmb=en\A"e@UWi>0 ݚ%t h `td%[18*KȔGt7XrfN/.EjYG)T7vWVRcV,5nj:b9u;9MT}jWq1y:<2$TGu^,n#mN_԰^qp黕0U k*Gv1lђm+=lg{Rfvz!oLta*y=jC_Q*6[$&K.u j>8oh7 JY}ҩhL_1Bnwp@pRьZl,_?ꡣSrfYp&;<n޽|"Q=3AkF ĝ `Jv؍`J {0ݩыxX'vyŝY<+28s wa ׍@OGI[)H;%t渋 X6A»⠍ &KeYo)&Sa_?~LYaevI #x] endstream endobj 292 0 obj 3318 endobj 325 0 obj <> stream xXKFWr ]5mِ=,rrdgIl}*I-#u׻N6no?}9;niD#vhwXy}i~9׷o@}V9\6&)V5)˧NVw0Ce'~нCߺdoo{+",@ۛ$.Hƃq{Si>$mpp \*ҧ%IN0^8H(lm)ҸH$3 ԅoHEXz7AXL oH#a$0.oNYBQ΢UFgNVɴKFQ -B_W+IUR̄L+ZOSò-"I@eq{LOO r Ng؃ǞC FҜh`hc@+uVowN }!=iBk¸,x5ThRؒ!:6>:sSܩN?bI4w)TU/Rd),ޫP>D~O G<(vUaMtkBX*3% OPJ)ȁr:d%U#)vQpdf ՅtVoM2;R&FZ@TwdޑqeP nXrb"VrNwhz|Xp,PYְ(Fƺ *&ٙy|c'?Qv_+ZCӵgådtՒq88ycAeW|E$vś1cbȼIc%Lq'Z(2ENK-VV56m!SKLwJ)Mք׆L6rV` 0& ?ϛl̥^ȱ]&O%5w=7B|@juRYգrR-Y+L̖X!]jaK╿xknVx~Y>C b 9rMB2yXe@ XPW 'jyx[Ẹ!f3 6 \xYe*!C`dyukuS9|*tcz 8iq,D*)BdXjxk+%gy;K6G͕( ֛:$|8襤o"]sݹ $:G,d$:E@6 endstream endobj 326 0 obj 1503 endobj 334 0 obj <> stream x\[,7~_1oHwwKfgq|j|b}//a4}98| 7ef2Z0ɯg}l4Yi|u-gq߽<>|?Jo|xw>~>ĹW~aw&pv= L#l9|\^F7NqY\U!8{gV4p{aG7Y!%3ݧtA0+.y%qb2M3u? Lt962M?Yo?}W*[Z9l 3UM\lLt9޼UQ uOa𧒋~11* γJZzZmfx݁pMY$q{R=(Z$XgޞC}zJ6Dfn%~6vW<0ꁣ\4on̪EF$p3!{H!}V*oYN JH';W[(x3rЭ̲ 8>&{f (RJ+pZ>ʪQ+ DJpDmz~|ҖEGq#w]*e\$7ZCޚa:&sG$crvJ 7]DF Ƭu}/?+ ~}}-~I8~ľ txo+1EAx}MHxD! |CRUHs';X-F,01op`SwX^;8h>&G$<Y"p3BwxELw^˖f8| hUv!ֻ  ~h8$Vƽ7#_NYZ?K'߂qGFc%Jτ]i.1&ٲ;j/ P{ cMHxD#|n@ҌA*X݄䈄$K69bf&$eu;M>!`,]Cyf * : @^4 1AڝRO^`\g2Tm9?y [?b"W݄=KT#x 5k%\1Uׁ=Š쇫J&XG$ @d"5>T7~S"؀~^xN° A¶RJ-:Lڗl>dCĀ"d;'Qڽ,XxLwDI7{ܭDU$̝' /v\lGjH3wgʦFs0=zҦɽ[Nif~&&69PL,A76OWaF'vڟg:CwMtߋTRqf{C7 FknEHd$_I(Cr9s=^:Ty:] L0M킱p͞6/s26UҢ"ݓZXY$v+ t[ƀ{FHfᄊ"H"u=(&) ƳL_3DOJ_'S9'w6,̧Oͻl!9 x̼iuHJQrgUeT^2*XP2A&$,j}56d*MUBU{4S\qzaaܩ-" |(!π'/ u [LUPxj@l-kn7aגbrDme.\Օ:r+GRؔ5XʥU2p.22hoʏ'"~ ;7~791T"L_2hr#b!^Oij?oa%gt ;wF\b$G6?@\LR'J1:&H e쁳eAsls}GnUlm>9V5JSA&>1OO͞=1•97-\^Kohy,x[xPV'{%Ωxg`n2rG'mKpAtB*d&۩I[xyvTUv.]ljqc)Bn^4+=~kS~_{$+|$[EW8X[f)eyz"Y8h/MG>C=#M؃vQ3bş(-.ezLH]^& %\͔6}Ë=5|f_(zn,=]%rsq;H%zzR@gw^ɓe nnm[6c %^r0Fv}W`(N  y?tbY.62c fzT_m~cڍ˅s=2ɼs`r\|,G;W_ ,%WjӴ 6Mo?T=P L|W?vJ){N ZMԪ&{*eL!^1bĎ>;$!Y%_=) endstream endobj 335 0 obj 3520 endobj 375 0 obj <> stream x\I#[pgHU%$|0@xq}"Y)Ո1O4 稢\rUrWG&b BM S+q]ݱ|*xg͌6nLaos+l{V9j@w!jQw!`wR ;d]BNO0! ,V›!:\?wIR[`5WS4ǑgwPv O֗BSy_ "\,r g0[kx&s`iNѢ 7 8V8嬟b߱<8;0ky6f뫠܄lKDYaXKP9JNP{Z VSyɗBh1̧ܶȒ cYhx`Ӱų(T=\DJ& ix?@b?T?SKpl6hg`[ە-6L@6'6 ^0.-{}+[O`\lXT_=1`Lh][T|%"W0>01N:IZ=50ǻZG&Wn<-#0r 6}l#~|ly?-n{8r1ZKjΔFuBR!JTor`qd/rCR!e?ւ782Ȇ(h`QZ{w(sO (q)v 08> 3$ڡN1i)f^[~oa{`'=+54u'Vj[QƎgN4e3f6E.bMM[~CMfԲY @jǼ#ptmn=bdN.GQMIA;0ycvQ?Rk@ `RhXnHG&65 uQyΚ3;gLSoZ{ƛ-m]_v>b4 [0ѥSiX髋|sCc? : ,&6ׇ粈WecU:Q1md7=N|f|y/itGubzV Ng$=SlQ)0Z-6L6/xC-gbrpW蠌SC;犺;oEw!a 4j3݃kenGp-3G۱,$o =b,a3>F { cm5"S0C`XײlR.!]tE!ҥJl4\y‹1Bc0HG ʵ M5ӏ~N0Ef$( {0Ww3 z?zg]geMU[:PD<*N& l9UR^~_,6`l)gKOS섨hwDW[tQ6g.d* I)`GR{BJ+yO#Gpɪ{LĢ1߻m9Q/SRTm.~Hjc%?=#zu`NC^諾Kq2%ADۖxtyyvNMU&}@onSi`7ŏQH̗ü/wV^ǹ('$bN޾{|߫0ß]Ɣ_d'S"-# T+E@WS&h{*NN"+;"J5Es|ѥ_&곩2ՕQ{Q< endstream endobj 376 0 obj 3228 endobj 414 0 obj <> stream x\Y~ׯhۂFw4 >,aîW2k{%[;"#ȫz f`:#+28"kzy˛$f1O4|8|ӛ|x|wt:~ >|rVث9)uzkrZp)8{Gk+k< qp~2 47a~9DFŐQ 1BxF>I"#³3; B'NQ|Fjti1_H"pV$%]ӤB,aZ #z!¼QO;'@M#]+K*2 7K#TX"t﫜pmaʯnN%872}c |zNA{Kukïd PZM_a-uM9FY ęf*!ǩ\UWgBrKO=GÎ*NJU ki9r@7 dqU> ivƩ(KRDN_t#5 '魢0/Y)kR\z50~bhχ$ #kXM'[ǝg4!4O婀^H$&]%Hu0""eSrm:P:Ӳ3bXʳ칄exi<85́ӑf ;YzZj uƇˋ1H!Hf\&afikPA:\] Rz Ĭ)M2w^:Ѥ( ZZaxiDʍYS&FMfd[':J5 ~׎HA"!Un[ɐ'bPUVS";$y(W[gQ&=%9&gN%gPxBSf״g L86ĭ]`]+zR=qՈ 9C@YJV^GI)xp2)Doܞ >ޛ !J;!_(Quo- RؘpC 缜E3 ӿ~×YMoVt}A)sjs h=(aQĒjk7gJPۻVq!{NˋK9+axG:?)q3G]wTa Am!Vl}AFp"hG(L %Vx8*&>Wb`LmLDwgރiG(L Pf*R"m,EtTy_BḅJwjG(LPYA7^\ҖZ w f^&HWYJ pF&o Zh6^=j9چq9OCo!dC/nP2Ws$Z*R}-NkQ( ]'xO<tyv0soSH>I/&ɏ#y_0݁0|C! (,#J[()9=m~\+ˁma]g+G(HuCp=KTܦgݖQ'Zd7z؇*JW]?[;R CS-BJOcS`zOKTwm5m Qӓ^U]AosP'# ZOP؏ߚP\KGpHM{b2>u0UJ=9e+Yk[>p1T#VZA_ԹryKc/(z.buL;ƽ1=vD{8D?Uļ] V5u1wxg!J%Fզ G' 498tGm9chgk0+ijWj#Fa5p(&rKlU)mKZ]^W.,HSQŊNJ$X^1; jhH#:e9xҰtŴ`iMbM)=J=/F4l,sܡϧ=el(I^04$lE_;[R(!sM+9Jsd;`wV6fh]Kx84<a*)96b|1˄b*sZ"nDwҤM?Rג=\d)e#0LYZO)_~(j17;sa1׼b!=Βԁuz<Ӑen_F*L\@:PX@e2bQ5kǓ_洴 -._'OQ<TP֤>tX: 9U7_P״S"Ot (sc{%~il ܬW̃L|:^r8ɬ`ͽtKV>8Z20hg%q}A9ۅ(ye"H\IǕ~O Ϲ mvh:ɕx_wQp!DܙV(G;<~'Aӳ+ߣ@K9}5J 3::%=:pۘw 6jv@袦{Дᅑ/x/"yrx/q7N)yS(qVg54!^ qIӣh(<%G%*XD?ccx~ endstream endobj 415 0 obj 3918 endobj 448 0 obj <> stream x\Y~_ѐU4Vw`%v<Y88>VS&=ҩ/zze|嗿~9]Z>4W~RVu>}|淧>_-z+/pAiX`&?}|'~x?KefLzъOBj>5aFZ~a %%,~Qgm.O$}/w6֥MUĉ1Og$//<)xd// osf_]0|al\p߯avcŞ l[%?'wƯoVwKᓻ?no.q,& L0g{Lt؍.` {I<;Y0BWYoN86NH|ks6ti'k*s/+03۟"l="ʵ(ˍ0 ų oԤsdaAW:QGp%jM:l :ϱo/LnL\|.3!f(&]0zg R y ĄB!wpT,0K.=8> DxQ)YR+)ĮD Hu.V'٣%.,=O~:EܪpJC?9#$4~ޑQ6P3ʖDU}^wNI\{t$`/&x?@y'qUi;$ҏcR[29\c.=*$w׮e>aԏ:Zx[>_\1[?*۾Ԗ,fbO7Ŀ.ߝu8r)+̌+Т(i7&6@]&+خ^Hc`)+u9ty2m| 2yn:uk΅Zh6՝ V[Htј'G-!MM[VF/CB[YG %@zv6~;MDaMh$ e1n04,@IS|W&ZnNYd 1D(^DC-HO1a r"9GcHǎ&dwaF@Vy,kY`34/yJ@FiRkd^ٝ=;h ycmukx%Vz̊d&QxA}DTP  bDxҵ%AlYC`<1OXgs#>͌%+)X(l\ =ȮpE3y*:@unQq>Ҹ1I*qG/\K-6dSQKr2y9,ZNt1V"sr!ogY1Qo@qftsihc-VpU =P+a̢jGFѭ˞;0Z zh? MEd2Y/hţ!Uƒ5xcf0DS^rM O/ݤ;|=ei}2ϙT{L: ?oJk^UC+TZV=u\$])G$MMn]q7S]ehnjhJ.~> Lx#hJ|rkwQmZUŋdSÁE< 2z-] `BxƘ<SI*˂XgtIHe^wuYkNQh?^Ҵϋ֓1dHYe:BoFH񖄶O=󿔱bg.`ߊk fasM~Cz.W=}$; Cj.`HҤ"&)%[aPrY6;>7=#ۋP%Qo(<kU*]-ޞJUJhDs0G4;a[9#1͑МilHӨP4aC&`'f=QO#DsDdSm%# !-X` { Ln9$  ^ܐ,f6?eJh%#Y)4M^Vն;[YY ImKhFynVX)uJouxgLawUuf ڒ݁ЌNRY xt,z71yi/3^>PVB= H_mF&~HjKVXBsn $ZzAx%~0J~rmw ImIKh&|^ ,k\%HI]9HP]-`=E7B 'oE [Ip^acrs*Qc@fKroZ"5yw9Ha||'@NИCR[<ǠW6SXd in:bi~QUO"uvM1J`O}}=JBC@d endstream endobj 449 0 obj 4181 endobj 481 0 obj <> stream xZK#G ϯh-`O @{Xa!䐐e!ɿz aqU'铪ɑN?=_>O|&2#G>iÏ÷O7/0=-߭9k}>Vєaz~맷0gq"|`' <||'"ެÍ~;tfNΉP~6'b"a3%@ LX@=Y{"${5V' ?Π[qZ։Iy(O4N^@}QvbU~'E,PKp,j&)x>38gK'o `. a9δ#,,=-GlL bĚMseV7E20 3 _*aKʖه]`b +:h4/D)) <00gFɅZ(Iӎ-~FIG5U~©ƛT`t*Tq=x>oJEIF`\)m"B.|'|Qa Cm1e>o.I,\ }"3de]G .j`ESǵHҜ#@AI"hLedQٻ( ^B6UЉ,eqVE`7 vS6 G3) }gKN]8X]8܂dv.ȠkZo,»8NI+ͯ+ITRtuF\P2AxPBCzH)yM˜ɨlI (sl bb9^9B;0$wvQaBmV]쌯tm˵̣ |}[It϶]'Au.@&O)EeSH=&EYsh~mGd MKNO'$ X-52-҈LUMV#kK3nb r?8S!$F)}嚔xX=t=Fms@o4rxI?VQnpDQ JXa7з{8.Z#N.; ċ!|EW74.띟rt$'&cNJ*Qɂgt)@DaD CmBR7,z:(un:T+$A,!qYsC=nddn?n8rWut.<Ʋ[Xnd=Ήr@$.ީDwph3aY> stream x\Y$G~_oH3[yWI?XZ6^#^`1{"<3++qӇ/?7tp^LEܤ^ӗO??Fv> u=˟n0w$ogmh`oA*NZSX WE}\nV8tuXO?+9|$Ky1aI$_q<``.1 ᒔ<˳95チpvyy r]9 qaam؂Bwgә-/OGJqY2t` w?^>uY]\@&M h&ЍK'x,T=o?{اL#½/ON&g W5\&&Y!dl6Ik &_Mp#_~aX% ŕ`zN^]+Ч೅7a_lJ?J;H_%W\x2ݍƜځ)#DtQ%6 cEɸPEĀdbrʱXZwfW[kpJc:+mxb~7"& JԔM먺L#'|E;_-.vhus3"{WB bFFXB/A5``ֵ+RFNvu kSfgyO)02&h+UVŔ1G(fťf[QdCotֵ̹@1CȲNNn2+sT4F|[}Jb[bErBq"ӗr?~˿Ҙ9j7ni}5䨀 -:uĖt|`Y2nrNx(do*ϐB?~CXFp}c!?鿲w7b3n@g{ۦNv vZ<0Nf-hB]jX^.O}.Wzg"Q•XĽZ(SXj-]SFɼ fG+a0\Ӎa<0y?{GM=ĉos7~Н4gΧ}`g5 6MᓼOyAR*x龝ޢ݁H9zBOT߫RQ4@_&|:Bv=[C0O=qۢz-J耔^WӥguulFoꁷreinv-=f{t(FntoQ@| Xuk5EW~{yI#uC* h;`S|^>' XzIe eXI̊ ޢH9:U$C{C:{#b=hthih4g2=E*hH2+%ۓw9K)3Mf2Co B;޿̕s13fAluI334%=د_WcjlLi,5M"- endstream endobj 511 0 obj 3991 endobj 548 0 obj <> stream xXKF 0Kr1HrdgIl}TOlW\' ˧zi7᯦m6ʪhy~j}|>\ߜvsu {Ep]]"TxeoO &ŗ"9 s Bl/m{zs7fHZxDw,'`cٰ]VKg\nX<O,[LTxG cVCY22ldү)ڼXXbШ4hn~54a@o@҄=*}KRu$NmPiKhݟ oPpܾmɖ endstream endobj 549 0 obj 1401 endobj 558 0 obj <> stream x\K#ϯ[%& %$|00@xm8dAl>[j5zUC^/wr}3DNNBWvRNϟNח;~p>fr"mۋH׷NӉ\IR("g)0 D?A.T%"f^q9eRWJ ~ R\( bo_~ 5J-'*DɍD!7"(^NWMtڕL=d(%x#eΈi(9X 0vk:_yuJ>s|ns*yІ߉#w#Ft3=Sy0Bi,-qBJ_\5צ`֢p X|AP(H+)]z,fnݩvݯw ` ^>ȌϪM^hO.C&|/8'(,ƀN3 'X\2/=wC=aPf,4s~S-{ w (lb5aX LLtЅ 5\6UNN=i\ۇ{Uyrͼx7 v"7Q"gk3td3tiؖIw"`N6!"A˒.) 1Z{FFOQuM}7 r9΃)&PbK@qHucDM0 3n{~ϙZ jjbnS1mnV+w踙t|@2wPØk:."+?IWDK #Ą~%hkfh=hw#1X_3ip==ALU?.ibn6;tjNCQ[=@ 1h:0qr-qٽfn3;-BG$d$yU긟kfϻcg౨- Ѕ̃ r#Ş, Wn|J姜vZfn;g-BAom2%Z/}bj!y^w^.{Xˤ*CѼ+ b`MmU0}qsMyKŭ J(4+>; lT[l_DX[ִ 8#*GҮkr9qk˝uJoL[R7Cٹ6U*k(&wd5:S*nQ@oJxn4:kڰ8>MUHv?Y)n*u=Ѭk]2qV)U9S}4$*E4n\yS W GFi~aK\j Ar { 9l#~{]7Ш!LF#eL%$h*rh R`UUoxj&xjƻfSkGP[=9U~oh"[:3/ f"47Z}9ӊ~owZI0?f3 Wu_{Vs{δMj[;@`4'3fl(L,4g4ӂ2&4(`g)eR#QQ T=?e?KՌ|h9-/I/SdNsExK'N8Xڜ[Ƅr&CS3FIkR}N9+rx:]k|+c&cQ0̟-W=Iy8M'{ը_ndz)_PHNMTM#HIW`Y+e:""d+07TmR* zZ{PZA^g!l% 5(yŨ'xn;0Ue@Y)> stream x[K# ϯbA-! |:a;f8>b=1 mlG?E~Ӈ?n_NO:{Ջ8Q OO_q鎟32r>4(6LǷTf\φI+`\ب)e3R-BqPPY?w_O_U'`x<'N;\X g&!7l8$|Innpqۑ]c ϭ] gWX0 [zlgW]^7#$QJ ,"mR,J鯶W=ebtS+]}]Ѷ6=uD<$ Oże9XWuR*B)ɥh,u;{ *\UY,edh?ŎVhfW8[z7}D$؀RyO ]VnBrD IE쏶!𸘄|}Q0PH!殒Q6o9/U ;4'J&G$$o_E=rO3!6^lo">Ѹ [;vPuKC+ DO"`1$G *ftPiiE 9`1:ݠ2n%,{I'J&0G$$UI{Nk[GO L޳U:U`;u$&Gy+ITGl<ؚd4զaBL =mpw3HP%5"np${\%Z$$$D˕X, ٞ{>A]xOk*W$0,p0u3Q.ez7>"A',15EUŌNI;:]n}DN}V4QGVoWwro7(dT݄$\!#);Vd* HDa nTw$f\MR#r4O}nDOeƎB9΃{z4'8_OA#̓ErfPcIǟ$z@ 35̓qqI!`|泟v7^7#EkuV=XfD1)波|n+fv!y݄KCbpu -L\D>^'7 tvCRMA S~= [4e,,V]5&gs9#d ؚKAo;esyg,)+@ eį.5ī+:0vbN ޏFҮ8s հl`etLY7eIơָWJ)&2ɐߊln2I c5.bY]6Q7˄ӯ~E2\[[Y/M, !H=y=$ॼ@rxNt$SR, 0!sSf! u UE䷧b]m̷- "32gGOE.72)ܟ!03򢊝`Ygpez[]61.Edt[|D6b9Mm"Asߖ?fV;*LYERJskYu\ j8vؘ}IŻȱZ96T/y֊#z*~kE{e=SaUZDYͩ 9xX7kaa].^)4MeFe=Kͫ7s(UUH s .^Z]/rͥtA~1?3aQ ^TˊA>[ܛҝY㣡!G`A_)-9ɞ(^.qj~<.1ʯ 㮏!Rl)>k[nU»Wff?ۙ6| (IJEo=DL!Q72Gέ -C6,d ZfaPa|tf/UitkT>czAٟ/+܅F{aɘתVE'n qzKv# b,m endstream endobj 601 0 obj 2953 endobj 634 0 obj <> stream x\Kϯh 37EtI ;^b'lߧCU*%BO}?~ׯ7ȉ4򅟴/ӟ?ϟq=姧ۓTA ~8}z,' ~|? Eժ)_1)5WFݕfD %TKh)Z-.˳:c"/;[SR_t{ o_hisj/ҍ(BJE噝*jr _ƉnQ}۵#Dq-9MuLdyc߷U{X3l3L芊1^s ~3fiOQсMx"9spd~,I87o׸C4IQ=P"w_赦Fc}tnj(߾yvV욞/aMI[]9$_{ɫ2%讔j55 Qf4Zс&8AhCTwa+=e ]تJᡞ81=ɶ hc=@ yS77;nVH}8mih L27g\c~J?nd fjMWCC1 !5!Z؝#@y"87N9N("܎RГ4;c i,9*9uZ؁&s[c9, 4u! S=HDG5fR;F4iy`1ЄAя"R, gfkl5t0ɘ7`gG+ ` ~}uǵW2pE_؟9:m ts6XkT)N"k+ThFQݴٹX;sI\( 7jg?\GG\#Mgu}= m-?+sH\lWLj19Wggq(.X#!ɊYG #t@CclU!x)!ѥ.՞Z{_yMxN28hw:Ճ~9+iڙluؾ<мu4+cL: \q'n0fs6jY{^V@2侼î: y<$d.ā.\˵p `k}5dRW9pqhڼD_ڵjEّ-bmw>7Tۂ0}PHD{Et^`-E nɢm,TD [M#󽞣S` <*masew(5gv@y"ygpwz '#1 nzX|JLů}>@&Ʒ¾u/[jg6}SwcmDص[qxrcnJjoNxNUAˋ`Z6$kCIle%W`0ga]vMJT4qO՞nǸ (;+$jfjxRpIPԒpdt@N`skdUs(r#+#r0* ײ㱋\LL^~>?"88k\|.l^rnb8BnR^5Mh}Ω'YʌMhMVCS[>_Á@u&T(˔,B7* @Xb"N zy#c<Fs9 V*[6󦱳ul;YGl&٦R#XȖ0aPͷ"?^Y U'_s.gtR<iƴ5!V%#ً-wQ2 $ 19¤@xڼ"[߼[l=}:VSW{(I%BW}`:5tbIvidճ4P2IN;t)*t0E84õѼ] -~{?]I endstream endobj 635 0 obj 3552 endobj 672 0 obj <> stream x[]#}[-0ma>,yH!!n}*m/w[*:uJfG~|9\Ys`vQwlzmX ͂8lv&0^ E`E5XIOu}ՔՂg|I-i/(t13؂ g+=}8 1> !3wfDvkqLr E3z)8嘆|e24fWz)DWfX1,Yc  KdsH$f&d}Ɍb0mg[ 06` 6=jg!7[MmGt60KOAQrWZ=<.{dl1Mۓ\<oysmS-B$k2!+!kGon R7Wra3%= rR+ ۉhT91a5؎NJ6NM& nkC4U$!a+tA|_ҳ;}K(%:mn,,Ւ.!P~hsئܰꓹs&sLt3Wsi~n$a/XR<z̞gV;ؒ=BZZ7 }JRUK˙T U0Z{h3ZAF”zxx_4h;]v\Qɹo=_חWJi5{>·Ǧ%'o#xAAn$zOXg£.<\ VFlhu /+!8!,ۻU\D.7z 'oPj0BLY7״Q٩&)ervN&̚iE#*RUE⥷F]ھ0ETBV68^&  D6-û>CIZdȠ+D%Pf>ALzGiNVdo3G[_:~h[?`n6O;-=[q;O`Ė%#65QdYMwsVsn6ţsnGoջx} MϯuAkTX+S#GF{Q9|ha=G.'ܘGn;2=mFZYC6vX;FM7;U\uvL)!6}@I`lw֊T+~-\/eq5vj#;IN(M҃s~5 7]I[:K3M_P-q4> stream x\[#~?B7Nu@g$%vN.q$Wf4kYVLߪFzzs0Aymq>/nxowt>\C _^>I $7wNJI3~r]ݴ8kg-ؤxYh}_æo>~8> W?9;iz& n>S>a>-gsbdEL&\Kx^gfqCіt7s 8MvF]v:.c {L~2&_ЌY/q t =\U]\9 +VVtn'[xTRa2p,8(>)%㿙,8l2]I/㠒9qpZ1 { QЕLVJ([ Df({H {ÊfoԠ$ah*%¯hOxYY&R?S_vHހ'90:B[H3C@\8 ,m%/+%>N3Kx&P2SZ1"=Y>Hn@ GrZg\pj-a/(alJ8VDnO7.v"QwWgS:枸>x$svMߞV=Q#njkjk^vj2 "oyGw470e GkY.;εp@3X 4&WIؘp1ӂ'!\9BbO&=' qoӜrrk>H/篿{caC'`XDH5G(fC-t&xw =Oڅ}=U' }Kꓩl%_OuKN{tiCd@8WضsomG434 Bu˘鋒Av5ٞw0JKM ;JPu#V dijuE^gμfBh|G$~NQ [(!0>FcgBձ4byO A cNYPv\=": o~+˱5JG0\Mk2հ FI#1[BMy"9w=_u]YE٣OJd{VlKFI]W,|XAo]jdsO,CW5Ҁx!6ez~tE9RjRC!iH%I%D1h"gF "SVQ$$l\ߝ@D&lm'6;" ':/,ΨS5w酸˜B4to=q/^(1ICNuPT`O5 䴖рK IjȆ3}jlZgUbKcAEnٔK aq@3)%w")&5$ZH,>SY;+E}G č!, f$]- fev&Q6 (K̓vB Q{c(L'~% sNPm-bK͜Y˓6N`ԩϥW\3{ʱ:*"Ǹp *bnt bt,"Ei`H8 1pY6< XAw'l"!OՂɸ2j oF+$G%s+lG_-':=/R%lTkXxG9u| *j.R) oLU^qR9^3z7Q ri@ j h-LS]\D4l"Ϝ3SџcO[m<נԴTIg~|jQεwhpk\*R]=+Fo8Bu H ><= w@4.*'Ra`5aHy'A"ڃnCbYT{@θ? u]tsGߛQ?cEzʇM+H6S?zԍcO]$h%o29#,Qg9P#UAQuǏ,9u,p \UF j\%qͳ.V,v\pu(%P+RVё©Ǚyca S1`fjA5Z+ww'a-xݿZcfScH"+X:R98p|ܟ6Ӑ;3@~#03 ZBc;?,laA| w&ˈX3G'҉+Xs+H:X8>>cV#BYXWrCϩG`ϒHa~cOaBqju*TҴ%տJkPX *S.*R]^neƒtj3aANS8zo g ITOlMJhs[VNȸ !\%w) kF,&a=!dʌ)]p@wLEQ u,7 /`@ ɘiViچ"f}6C { YtMZϺ'^Arj-y6Nה y- 9J&qQ3 B#솓A5'P?J#O6Z'mS2;` wS<YjK7< :CuFoT)$_Lx\˯ciƺfWd d֥^+`t/EJK9{͡/S/l8o89DL90[cShǔ4(cm"I  5uJ)G0BM@?SߟPW( $m<BO@&xk!lQ!GB1 Z睒YٶdYa&\b8DUQ1vzjН8ɚ=P;0, ~Ahʄ&t'L_'uɎ>7S;khFYXNYv9)%M: כ3 = zR}0p.|VJtew5 Ԓ>S$w v [ q8˔=8Q|Vٿ+|=2άx?TB@GGz=ҒB Jl}b u6wa5z2NR?ބ{g5}svq1`B ,S}Z}u/JMy endstream endobj 711 0 obj 3420 endobj 788 0 obj <> stream x\Y$~_7杕4 6A026F3"3z2Xfw+boϗ_>p;7qNɃum9~z??xw;.@ފ V?mG+̈́'H_g#2uY`Q|pLIi3-te$OFHը3m#Yr2N mAޢ%$VRB=VwV j\*"Iw?}3{E];(j%X1q8A8q?=*0nH \pꪌOEIgRm~ir{paVZeUV[jFӟ'7K `9hܟNΆ%kPU2޺ ‹N]!߂ 6Ddz2 δ%}a'LK6JfΥDQ_a`wmp !^?+S[(S/لMByִ9WiO(:n珃CZ9| wN.>tUF2Ub Wh-ś('3-عK.dU/3s#{6ګσ yZ٪y)ĭ:ƱPU3 gqYb*^GvU9'QZ08H=wY•i8̍>?^E)+uA h| K@QWf\sjeE726'6͜iLї_ʬhu޹,R !T \}.VTjwQ*R%moM(OӋddYT8ѺRf2SL45kDQ:EwP#W(O%5ܠ8^6S誔b 7pRPKC\g(qAH6!-^;}VO&4`n̜t39 )S ~)4h${"%V9&0c?X)yiЁBC jjyi٩Γ-S>K m<mԄIrL7JTjaه;WC'Zb^yGe,b'>b5 `Ard= RKO`Yb?R"5*Ȑl^5zK+don!H,%@AvMUʆa! lT`N#s ,E}]aЃvZ( Q 5$ܨQ k&"m$2Pʘ=ΡD/c9," 'oiߟKnЯ3DT6H %eJG*-sxV 늡2ߔ$7w6'nX< F.A+"aצ'Z[++hVǶdGK F4&JK]mO1.v5p}04n q0#X(=)'/7dhVR*iK3-eN;TMɯr^HBzތoah7"CF@J!pfَVw>mϧ#NTL0m}zbU%"*Taq6Xx4vP>'*ԮP}Wcqٻb'1m38jKp6ʦ0;VP]BS#C`E&X2]2L1`O\Uع#)\{,>!pcVE$ABޮ7+=S\NٸxQ"O`} ۩dɽC pKBHk γJ&ʒ -XtVѽRۓh|=^]KIK #0; o'.ꡂGZPhKzK JY)b^)񼥢mmIu2&Q質[EURZRv;) 4B K7@|@oHD.͕= u }iuyHJmbZ(()\VFdk;.3xh}58e٣SM.*v*=+T0 H5{~Ky PQ# INzEyDwCrMX:Cc%"bҦ-S\>p2I+bēhSkzKβSsi b ;i7 @RmB9g|;-vf6uxӖq̀E7> stream x\ۊ#}К{J6އ}h`{gzamޑJ_,ՕU'NȚpOo0AM(f_~z?}Ǘ_a8.k }1qTq:}po灟^.#brWay(: ;'E`g [uӒyG fv}66\EYlapݣ`F||??Ƃ +8L6+`܂oKrdy>yyr .dDxb|6㉱Hū?=D86c(qFN#Lwd6tHCJPB)ɕ𿎻X\q3@/8 1 7Eؤ?Q1Xd4)*"ȌhUjӼ :nM OA:iu}d#|4!F!s@y@r$7}eF#U-O9yJ>'f^E;}'3glDcj+ Q|" =M#^)9nA.& K6H1JWo+%n6:ely`%/4<`Bpd`^&@#o0̪筽r_%TY%i7g F*/ʊrSf2T`eQ3ΌEk2ԮH9] /w2uq&@7ӐVVh?44f+h,[ {;*ȍIN$w` e5K8$B '*F:ߌ;UحbU-I0(6dڋ|H`mVts<",Mw".=OL\>*%{><+d33_I 'e$%HB_nv"Yʂ~CG'dmz]$ܽ0eerKLAWTW;V?~t$k$r| sL%n5J67)N\IPi Y,` "3:i頝<ӂA+0z5;i97^phZ9I/Ey;*eqLâxP[RnjҐ :N 'Y 1L6!fQ5(;mTɓ(eAEңKt]9 vx{x{~zӬ߄=i9JS#jR~?ufG0[/JE L;)/x&}G`7DH3sR3Vidri_Jt6shnN8] -<kdg>ڗN$)0ͶowZb8|^3Nc}<͗l)ᕛ.fUn6T38K5辣>>J^aYxqQ΀2pa cc[7< fWTtʑNsur/\tLT6#tȆAV `-Jc0Vsطn=Uy> iߎ?NJ^ 5sFo endstream endobj 825 0 obj 3537 endobj 877 0 obj <> stream x\Kk$W40w4 n5 v^3c#niwX0Vveddd uYuȴ(')^^bn$8ǧ?6go7G*O25Rk 4BfT{.Is0dqH=ԁ%>^zbI(cs~4t$=2ߪgхH 冲 Sj(M$|r"pjY e.g3Z\XS2%:dvvQ,PǑMRR)!su]v0)s|D}HrLƁ0yT2j{ zo`/مzi WU[ #1%.-ɃZ fK˜R>5x~%āe3!8R'u''Wrn`>sRhe.zָ fE.#!3ftRzZ`E8sg5)m^p)fkz5fk`L[ M 115j7ǤAt]C_̞?,mٍz=^@,BUxj_m>Wnb84 `3ɝU>;<-V%o yo &h^b'"v?Zq A7b7hιU8Fd(0G8--g.¹l]B!Tz$>&^OQԁ^,b 4(k"0xlY^D[I+ӀI؁_NqRpHs}(r!@EϧvW@%;2F}&>YPW-db\\(ۉH!YV~ec:%KPFB߅S @)'=@-W LM @ taw8U@O@{ݚ{b.(?yi,IE>)3ą3(atc2잁 2 ;#aD{b, q`<OȽ> R++ Gm Ww9TX #_EN(7aq*qH9įr/a﹠B-/7x Fݩ/S^YaG%<36)Z%!62'{)Q{oqa< $"1r:;He<7< Hyus%i73'PR1Z,(~ߟO/ϟ^x^xgtY(s[4q6 z.h$"jgɌ08#& Wf<'vXt \2ՉXvH6T=T 8tM9Qa9Q&)跧nj:GE8f eSTU+Q|% RDCKLtGG5eIyOᠵ′"H/kx<lpƂp| <$l~n:RҪKpz if7DۗUA&j$׎fEr_k|qDK);03J&{Zzf#+:?s)Qصzm^8 PU1yU+h 4ל6Rҫ+cXII$ɠG(̊ev7O#m$R.n?Ldqdu r<5P-]3&(M1hVmf su6:"rl+?:|*=,|W}Ry(c6 : ⼈VXO_)S:nI{XW-Fn$Kdƛ~__]oer! I4_LF1mZc4E-(3V\@ϮsCs_{;IcoO=E{C۲qz;SFD澩ZmkzKK8֪kْt7>-?b ڭbv왵6]X=-:E )tJ^q'N!B-R0[DZ. @8d9k=b/n ( #EהG kaٹJUaXhlwO·\!M5m+Y4cՈ bD[e)h @^ Z9n)Ur֨xZwUa ,%]gҝʛM 3q.+nS͚<-?0ji=ݛR!4 ގk7Ԡv=4rbm*  Nt 7"i(Jt#ts[cAc{'HaLk[SVńraE ޱ4ը/ܺkDF{_ZyrI!pf$0ҰY2܀M3ysL Zuu; D<&%ǜoRsB9W[j*ׯ?Vu[r_1xwd6unmA>F(AuV퉭-5 Kfې4 qR<]N,j:} ~ъh\~XH{@I &Wu] _"0Y5 /6P$o$xe7b$YI~FKw5ͶmJX -kl1fq8c(I\X1ԯ.Po@L[ຽ[91˚@s[/_z"2# 4>_ie]v}ef3/=A-` s74_9,`zWatގ}oakX~*-.Xqye#GX`N|=s31Φy O_@M0i15շ |5zUo𶸓iJcٽ5!M=Uku7 a"%X4ge+cC@YT ^Cόe5rl;@V+=Ny-~,MjxnҪMHj_U5o̪:nϩĭU|5jߐO]͔KngSS_/Zwr|[8eAiYh5ڽƶZox8"y^,kދūyB bB~8rB'e iCVHkW ;H÷Wpx" QHرagHlQD(ү V$60^-f5ʠIHs2 MEpLǝѭޭ'*FPcGo |Q·? RGp3YfiHS ֶ 9aq@%YHl6[5vUm;ϟ=6coo?QOm endstream endobj 878 0 obj 3928 endobj 920 0 obj <> stream x[݋$ !oYMtuI.7d3俏d]ꚙ%aa$K>~ܽywjNALojzuvvH/x|N <⟏;=9~݃V[cقUzxxu蒁 Ga9YaӛI vnr/zIOFCuM1~|!sGLI!ARuK-5h/,1HU%*1f]3 e=}tWeY A[%ϜJUR$-! )qjze B8:6ߧI%W#6t^9+쪵6ZO ~?kУR؋T+ XzmH;TEvȎ>XגҨV$Inػ@;,# ȡ9:ϻ ~w]vP+$".ׯoPj,u iDr((X'3g|)9Җ+Ew\8it% 4TP$#%XA>OؙV꒛̜ -,yGiΐF0Ghh{^&U@T%I .m'qӇG9-/J en5@xIiK뎼hi=j=G\%y':ٲ(h!Sާh|-21Hd? z8+RѩWUI# ů} ӊyY'JPrL[oY'FkbkVH{dڥAR:bt^Glco-M _{̔SalP ۢb(IeAsTE|<"dž4@hBPduf˕ 0㕏R7gt-@ۇ|7Zv}:-+[OAypH- 8F܀\ʩz.cSvOzb;X@" $W C+I'r'{AZT"GRڳDU{erK+y[f>ȑUb.ba,ᕛS)L`Bt_nJu>;SuYA \b1_VSp"SdbiԍWհL36O\n6|å-/l 4mلl51#u084US"!a&v"~L^v6OFXS/\`I +8F( N"f4Cwt  s(PkY^HXd}ؾ2Q ^)2;+Eҥ~1 ҕ\sB1 ߨJڳ?DJY\-y\^Qֶ)mFP\X"!} ӁA1B5I֥CpbGl EVtS* Rp>L*L+5*YޗѝŔV 9;\w k$JWvK9ڭ~UcҹYf DoJ*\W T؋=eꅄ^#D/4FrVGҷ۠6?q~9 gxGj/}TvU ,#*/]`<óȻlIS*0'4O .}~Eu5Y5#hKVZz`᯾uW44ׇI > stream x\Yk$~ׯh5w%*5a`c;򪪖m1NDUP`mdG(h᫕,(sbaIK{bLhhf-h0WQUށJК?BSyZ1*,#6l걂dm7o\T lF\kOrFX-u2r vEk5ޒa,W)`A_H9X[hsFR-qG\jp-et`(0$I0!HNΣe8M! Cgn-4Z>2t2m6P96Vf3_* UYNzd ¢=>> Yx?iP9|k]|Trv ̌h33̣i>}>; 9o:mG3 [gY!+z{Aٗ B@:C4M)F/)x;?Gʉ- UXn;C;:qUބ4" {ZP+j\Q2\)p<'zS4HnvYR ē{h%ǒ8$>8&XPMǭalmOڝFWzԑfRn5 X%2dS>TN'*w`\s-hm)qTP)Xd:HcX1 4x({:/+,gF]("cOfS⭅/8KSϥBN"U^nS}Z,_<:t!x]϶ĸU"|0:a3} [IJi_IkdQGUoiYt +A*uj !o$s&&xeEh2zZ]#7i@NP3iBzhN'KFY:! ʋO C䑷~=m-RJ0^a.Y`%f9y!9ۺT` )5vBh?2͍0_0FdU|f,k[ /C4{&`ߨLKǎQQ^(@lӊ(*艬pW=h]N1 ?ў/ BمQNR^Z#TU;K e=̌jfjΡp\Y# S8T!eIu5l,:.܆ٲF8U6u 3OqJd|OK# Epn^Yܣ`[KAfsp'thJPl#rHwGB㼭]+ݪIhnh *_1&YCэ+vPv4gnV*/4vRgCnFF}!n~G"JXG#W򋼲/D}!F 7ؗz.FuOЈ'&Gp,tCd$nHwP~ZP)Z&Vsʻdo%l/cg XvJ2^UC]bߒ~9Bɦm_Py7`t`H5|e8rﰾϱϰ.-+WKJ6Qv*Rf]7Jh.cFJ )Eesa[At[ZύL ZFJi٫Zx,m\m#1wDt#)YmP6Hz_|U,=JpyhXt`>2 8s2ǫ ܀Ȁp7sPee\7t<.ߞ }gj endstream endobj 969 0 obj 2910 endobj 1030 0 obj <> stream x[K$ϯhгJ(fu |eV`;"ݵt0tuefdd_dOwO?otIY(NƊߞ?^7|,Xy C῟44?wwWqb׋Lr SZt ba_L?<>|YM"Ӛuj Vf0,Gݕn " ,~x*?=3"QN~qj3vnG"I@W%_ `s~X:r104"< $_Rrqvv&AhXɪW8S!Î#fCV2 j=3XjFC JVr2v&> ȗdsxjÑEr?# @2nTHY [GKI5 SyEz_,i/4]2_cNMni{`2I!+!jKˢ sgjhr6Z };&5̟T:m2^y+2 7Q|SYAw֭J#j/M<\q!f@۽Sw*bETNN.@ԩ=WM~ĩqj+/ރtAE#)rD ⼶v8J:tᎻ +Íڸ;Kb!NqE%RMcG^X!KgcfZ[dL)9vI*jcM>aޠSKpSҡ }/|2 *ٖѰ;ѣ9ܪLF̐8WFCsUtԢF8L)xV*k5A-}%Rx>Sʐ?B8G`dx1xH)W JzB Ɛu* H~)7n%Ph7|22nZqP*L m㿁~Q~vsW,‰KI1NX^l0%xq Cy~4 +|\W&)zvq/pX$چ7]?Ld6>QlWAU2Y`ʸM?'SڔFPU ,S)h܄ 4.p #Te NvLڹu\bf(d1 41U0Mć%9[ 1Q$S')Zw*Ӹvm§{T |~4r\սʧ ,oB=V׏ d"5)I(;3!'ag6ϭ&i?es>ᖀHW $aف"9+l:bXUBL4_ 5%u團τr%EywSqN܄]XZ>bڔn )-3;2v f1!ԱzjB4O.D96`k Z,s"&bzf EC9Ԟ\&y xU0|=eY3ٙ+v6i{RFT>X{mYoKrH+" 9ߣٱ9^-(a( . $m/}oo o?3u2:t][i qǤ2a#,$aP˜s<"J DP!ٖPФ̖bQRfȫ-S#%5@`r7dRW9cӠs ;F1D`F>F͚ACht8bC5q!I nr=ikC/2g3 m>CSz8K=FjTzNpeP*D;~EZCJ\pV)k1g*ط1U{ͼ]TE p |e@_tJ swdք`SL|9qHǔneϐr-aX,kGW]`ڍ$}O^qRˍ&Kٌ+؉5^jjKVlswsО٘D䣽~b+f"?;2CpĜ$ \SӚ 2VLf,)I zrB<"!5cXF@^=Mt^y=0ŸĖ40.+蛈W$>/+7mxmbcZ I,T]0H,xuefږԽc E钋Q .[:7~{"چ}UdҫВ?h<^,H}a_j{'Tˊ=GȈ"nЪTjũ0`?G\DNR"u GfV꘩u>@A ce@mPQ#Έr֪Fx`ݠ2 Ƽ >´6СړlHb/I#HybPǷ`jE-…O'pXg.wl endstream endobj 1031 0 obj 3262 endobj 1071 0 obj <> stream xYY#7~h[jA`m>,&$>[|LfI aǣVR}_|^W6a(6A#6m|y:ӛ??l[=94wC߯vUH`sz<1} (pZ<BI-H x jR B(kt`NZtLt~ mǏqlZYtǶwL'(>Vn/ӊUX!6kJك긠]ڞ{c@Q'=Z0Ǡ܁tIPQ^cp `6pENI=}U4r8D@IPTBEše 0G592K ]N ݖ~~1w/vmD{ ݳepktxȅ'wi3y^䮜[Ԙ}; ! A5JS XfT2]2Lq|qZRg9C Kt !o >ՃEF;x}ȞNIS/}ZNC\DwYnoogӢuHOnx|#@&Y]:d.'8ϮB#1c(W 2eQF` !1mǪG4Tvy s[K d%I$pY|AD:nKW=VYIM<hűEe Jr*JހjJ ŷ=0Sh9N*Ci!;*̪V ^vLkU' Eg-I@ɱS\teK*jB;ysNTV}p$/-~RvXĕ~[yC3Zy8>Q]ohί03D;j_@#1c=s%OL=//iaK!?ecJQ5Yd Z]@}ppQ K]E0([~ n >K)QÓEEQV+c Y% Xr5)\KKU-+rRq/&OB: L5m.:)~:KCt_L@HP%qxi;"R80DW~DoEKh0c˜곶z'q+ԪHA7:t@o(J+ѓʤ-qUSc䌚ЄSrpg#_8^+,dƽ0Ȉ٬-uה_ endstream endobj 1072 0 obj 1403 endobj 1105 0 obj <> stream x\ݏ$7b$ސfF# y8 @8 vޅD۝i_}<ӿ|ϟNO_󴜖y2yP'}o׷Ot#?ӻ7n1O_]OWsz?~vޭIƯ7ȟ7ߤ }ϧ_廟oY3<4: gV*.ӢgyYGm)W}]z"TTa_sfq\-|JS8HAVyO,(|t O{|s%-<=W{oKӥmkœm [8}6w&U}r`~_}7׭J& 77ǂ~=%>> drET"ztwϊJ(=s DBmu?By`DĆx/r: -AdɊ"ϽwQ:*ᒗp +E&9(eM6"AdV?l:c#=D'gV$C.|'0"N6CLڛ\~(q5B$"eUTյ.ܕFob`U ZWSAVTTL.|&̛f[&1o-OS[fahmvU'*L渏8HI]4@,Ҁt|`0S>-k]kDۄt`رܐPY6k\((#9iCΚ;k\: Mxh `rTg@7eB]SǜF4fԂ2 1= ֒/$k\^_nHF(@@IB4 o};F*[70]7E_4HcZT6nJQ0baalou'ҟwbT\f|&mYuCiP.򳹽y 'Y&֭NR4} Xl YN6a~VOmgM'2vP9f)6PŝM|\floogʕ!,5(J>rbK0&Uk]"Xq T\h]HXH!XVͭnȳ933E_$41 !Ao)S!eB~^H M2Ťy /tu,B8@۲5:p3tzU#ΜU <ІZ@{$&gz-a#2!{ F/ݳkM^w{WEy{P<15j8іkVDو'˿YۃB̃Ryz3xg f9bIO3;Lf~={xj>|xO66oe yx="{Z 52uܡD רzã>Gu!%袨Rt̾LM=Ww t8:jrUz̯^yZq,ƨQEfaVS<*k-[_^㊐j7} 0ϩz5u%9dSNPcIuOwf E"9ծ T H@.Nx5RGFHLIXuA0)5hȺl3pW?oc?ϟB.'*k6S6vm4!,۳ \ܸMP Y`ZՑ;]0ޘ5>1%I<_J1sO>~WzŊ;SMҹ]fuphn>;xGg3,q /@hJzC 3tTTʾ٧VezPPS̟ 5'u<4YKCCUaֹxXzGWCt۴dmfe葀^P+RbX-DX^pJΰوɶ nu3N9apJ{v~I/u%EQFv2ӱARA z%voF3@ CSM99)9ف֌`i0L-T%) ֱQ&[!.:iB^ &–%lisGD)Vt#J+_ʰa_0_+x QgJ kCN a$BrVp9"鞅8A,!Bw\;hHIs#e_Jh/5iئFs91i[X8q&c/qzL|d/˻{IɖsxlIY'fneƵ^S^fi-;5XYjnЭ{OCH4*&RѫiܞO="צ?\jtWTBRl;Yr33})tlXg9.I`{#v>Gb]'aNp&H ǥ-(zoyj! oVmjP9ۤ!pA!^"E `A jN[Bc 8})(U~^gw++wM|M%OuL[ wvܯ>p} =AqIƇi~֖-lxسάZh.ncN#Tԕ#ifOn Y`2A7"חv>u-y*~~F=F`^YM >IifP\}~ДU0} 4`ՎR| ]U-6mU8@pwoѮkM ԤS-f].=$udsoJ댄Q.".u'(e @jꨖ^|z%{.ҾQ 5f𧃻 GuSo&65hQ"Rz606ef)r: ){xυ Ig:ݣ}A:$> Yu/G( M*j ]Xԛę'RuvPE90vkH*3TZ,UD]VQ't(SbX J&9[+!mG.T_ׅogϒQ.AioхQ>gӢ_vNAļ!rD@ 5zBRIVϒ[j׊C]9BVSB==qךǨPH][Cx3UJ YFbK{{'g-؎W+P}ͱ5x`:X$4R]p˩^&dOp#띭/ ÈdUwnbw {34)_uTZ@z0H q^Mmw4H㧑H1O."-#e=f ֨F%V`?y&huDK^񀙇H Nn٥D]a"9"Ή m'PPlvT3L_x^e~YkvUp  v(tߪ[Q*M~^tKvUo|_PܹCwD,Dx\xc> stream x\Y#~_!BU -6އ?,~X`;ȣJ՞PwK#"ȬeO~Ƿÿaӓ<+÷_~8|y^^?^t^P8 5\<˧ÇY:)'!Ҥ^Wx+Y ?*M +Gq;I,5Ӎ?ODܣJ sߜ/qgPͲ(?7nQ)}Oc`7?z#"$a^&О,SS(UTWff>Fh+tdhRszQF([QyAĤe:{hoz? [jFªq1FtTU65Qrx]ɞ3L'II2/<6 Et{3B LYüݤ ZC0V[6#VW?xa/ IvnʺUni+!EZ97:1a{ԁ3ZԤ$iRׁt4gZ> dY!.'GvH1B]66ipL6 yl>H'Є"@N%Qh= X%1 dpq )IlC*OI§X hkCh & B-z.N<:l<ɰ#1L͞7qT:G( HHôCbHg@&D__50mQ&I?KLQ n)D 15k.:q]g;5 3dEJ&&PVbPqy!$e!UGN:$cH38)|&Q 6($WtE%oJ$ Q_FeױJ̐2Vq Qd߭2Nj9eそhz&yHvRqxiDF$\B¼{sNd]m!) ԵSnU{-)Ƴd"JAI^Ųfeۃ&\:wfsa=96 CZK,-,=Nʚ7҄ss$m8n.|!9F0í=J@qk-MPwt(#h']Ŭk\ʝ֗`]2sSW M-^P ~fS`CoI'T>r"tԑHj` |*ۘ /Qr+!6\:ZzCtEePQ|6M@Ci`̦mtY`ܫ^M,AL&~ue|G{ʂxy1oW1)qQ1&bF&^R%DɤVCsJ۪YcXDu#b^=0 TL(:qIQFV2E"},k!־`9;,^WQoDw:ou{kUBg)+ {,_#qfCqh_F((aR{LwEZ4^Гz]]{Tq=1ͫ3 ƦuUuLjJYWԭuDCp-[Fo߿A>nke}rq1Lxw|wbt *rS\Dx(-#! j:jD,gD ϥ,-4vA*qFOwV#&hF;d+7׈1ࢲW-\D#7q ^Is8 8ϗ\VA KKZF>$d3:fmh9IGZq|H50vPʼPURX\rٹu%1ea뛕ۣB'Rot&EISFF.`Ӥ0k2:*^Jm>ht9vH9-w:)aFmSCV37Y܈RͰR(m0B[[}{k)}D@ОLR۹k2v|vH;Di6M0*1j.ȝ԰ѡf-x$W,\!i` fITr[ߑ^mPxٜ=R>0(=%͖ ۝Q[ޭi񄿽Sws)C%bf1W'FuД)3ol\ն=#V@wUE\:(PzoTsWwvRH) yz$&r?MI4$btb%ͭ]|:7yP%ҏ`MtKHЃ|庙j]*9(}Ě<.RK8:xEhڮx:ƙ'7~jES+UUjmG }ԊZ.hۗoYq*li(1=EgY9\+v­ VFt'<<Ec"}a#OqfR8x6JJ$lh*}? N&:-K$ *DO6IMLyϤEٞ#;sJ-OY9uS-n}6L' s>ց5Wo]D<$27so?Q? endstream endobj 1145 0 obj 3505 endobj 1173 0 obj <> stream x\I,(PR{ Z03cƆ1~ ֮)Kw3:)E|Œ5^\OۯwʪWq0V·o?///ӗnzO+r}{Q-0}5_')Y>I}H?gq'#~o6܉0a'X؉n'urIF3&VZȇQVon$w)p> sn~/Ă$ă&1ٰ ng>(p7* |rOl>sq>曃Uqqt?/SuHa:D&8y9Oa񪻻A_^fLHRϯP2cܲF^gD+i ;h5ڼQ6ܥ`2\nP\DۤH3 /ISbf k6s/뺣l`RJ%gRJ>\{[˦P/Ý2 p&6V00bsX{L..jqA!⣅v UQqE??$TKOp?ę($纩[:((b~g5K4+!lVAE%;E@TRwEsәӇ,8-Esg"_n ŝ GiƭƝb 90Jl;}s/E Me,̦)&ps̀yAH mkVӍp`x^wC̞XX}hA;n{'~aU`($o;3㎲ڹFt`q8y[1hA`$+{d\T4߀7 ,:3.2j13.1a`@4q6NjUQxd_-rDcCngёws$V X9oiIOgq`45(|*-q[`o&7fH( fCNeCi5 0"d GY1%+\!5S[C~1m -H/=RK ,JS4а 5Pos0fi`c(~&fXVYVrU(IVt$uAUzPr z[1w)ʏ+0Ԯ#[ O9b]7tg\ ;4;emwSHA}%An\LvT_3ؽ7jK;%ؙWCuli,x(2X(_c9E: %=i7D. O_i[j˫RwvZkauYVsk_V~쑵m ߛdu">_{`xnS,.(g3m p6ֶZD0txs+*cj*K=~R}Pg`-h? j 5T$*CDsQJݒƦXn u V M7¦_`N9IW#,nQ tM05sj/ Ub{"hz `IqE)c55}"*pkfX|%ix4`-XҏrEY=? <7y)&=*bbi5imlk/ɂ$b@C=H|!{׍#G̴ ^1vH'-[j4J ,{V\2P:^ WywZ!08܋h)O\횁6!hF 1cdza,gqT(w\ ?թ,52ADnЖ%~ ;-?Kɧ{ T=^"dEu赲*f I4mڪSbNv;'z}sYjCpDP\nxҽg EW;xMϤ Y"8 pw E=z zzJeۆ#WhdsvE>,CZ̙{;erzsF+Yycޮg!` Btce'g.o[ ԭ s8pi&JI8v3r Q|SQY,{A%MYJ9V?GYɾVus8GP׼ ]f#)i׭7Q-#i /H4ʱ4+Z2!$ ^3}um3ߓ}?|+\ξdgZ$[ϗvBnXK_HtaFӖ s";jͬ~ dͬl=è ) ^dCŒq>F@m#J>I\%CW+ow/ ^}V6;)Lm!t4ƳE}<{8"̖A SbXa*ĥ[=w<"utx8_+tjYȻ~jǓM|׿jgDx?з0 m%q%SIzR,~=^|r}8?7O endstream endobj 1174 0 obj 3854 endobj 1219 0 obj <> stream x\K$ϯh0*(fl`5ʖl{G#23zVZ5Sș7O?xxt`sT|᏿=|x߼黟Ϻa:/i(<<<<.on U|r봜:I)Γ9.r:=.OBBM(Wj<ɮr4Gx p)>Ӓ_k\`o6=$-.@3^t]^~p}y>_ޯj>QJef:5%龜$ikn$uH K r F:$=d7?ο0 d**>"?X9UpE-HQ&?Xe8ՠ3ݹ 'P~6,UVdx"PszC*~i0G;քnW "OS evW|%2$egI S5Aox܏Bpa/qRo?fUSXD-*xgzrq)yֲx#lTtAHYͲz \5 K^ĢĔ%Evو+ʞ.W(b H+ Є9$M\+!+D7Se삽4ӓ8`+~_ݮ/Ue@JgL#L>| bA  ^3zwi/Gof'YYKGcpg"8pɱ2,O.-9!C7- /B8CR" BQMf>/ Gl[Nm頻(My+AMMo?OHg\uяY{d(O ޳‚m԰#@SeG:!]ϑ|ToA\w*Y ֲetm7qftC0H$3碕3ahDQ4a|g^¯$|]}.!mLR95v8=F[V* K˒O\/eHGtC4b;4cI,0J6 =EuL%v٪VqY> ˡVƞS{Ѻ8,%*{XG o t"6:j u jRuF':{eT>dXJP0c&@z9P:_}uFrWLi.(ܜEREl7LAx"@0~E1L&ZTG4>f [^yu1C;T#uQbTH-htKJۚs#Mt^w(3E.F[_w/=;:[Iޢ ;U-}q'K%yWbP4R<l{[i]ׁ_W/MWo|W {(9]|Pj΂!$H a3MtSj8.7=$ފbԴC\ w](N/*IuݒA؀,<3+|^KGF ⩡s)K~vB lQmfXzL([˙Eg⽹Zvn(]چ)txu}xÅ\c6fx!W+4٤4x ~!o@ϣ;'6]sL Z(_+Ўzh174"8ɸ9*t3tR!rF8cY*Qs2}gYaJ,I|'$SFU>d JNqW 5@ wmڲgW>p$t9$BKz[ k07HlP'WՆ4L:fkg^+% ޖI\<2C%ߐ\(/Rm=8LA|ϑmE /}g.iȒfSIMS%]5UC*fҺµnSw˔`71"M6e&7K\"wh(Q~-C!C-]B)_FT˳9Ly|$f`D1mvbHl.Qh{@nf!QF󼺃ivԟ3ÜK};"6 Lt׬duپۨډUJ.A#NY~w0O )rV7;ݙJšAS*k&*yjd@9Ojv(ɇڶ{T* Kp&N[/x.{E/x {f)#fBK"25$KhWqӾzL(~'?19{]$ٷꯂE:GލȚϘ REŔ=JrれΠ qx0=KP;A@9z^oMMybތ̷ѪѭmT Yʺ1;!@H "5Yz?}ˠ-GE4q^N[kݸ3 @2ks)hEk6 /*=GlL`p,ywfVw =w_G7E+G¯ohöl\N Z?52he4125m`ޘ*f IuW7oM_87ؤ=`KTv{1Ȳiȴ> stream x\[$I~?7{V4F}0ʪ:{#yQd9S]y^v{}OWN0$|w??||>ou>j.- ~sy=}{xo߽?(|3.ә.ς]^/GO./Xc-SE7Z_S=WW/AUKC1&dz;(V>G7Me^ ׍Y> ܟAk??~r{M8jQJ{SoDP5C)FH3au G軙M =!n򮕶hkYRV249 f;2c3I7VEDKql&AQ?Cv~EĚuR4 3XwmF8e߮oW˓䊛3~ĭz5A: gakr`)9 S) n[ଠt&pfs,9Qү/22m_!nZ 3@Ce3h-zBΐЃh]w~l8žTo#aM\ (wsFGg`i'Ih*f'~2Fn&:>J~vj%Mt쒑Ia#ys?-/Y< jeU&~:CFNuyCxP 8CC3#gvҸ T%xBE̖c<Ö aZzL@-nb}j7{IMMv}G>&~ OНÆIr3%&n  38) 7룧> x&XhfhЉ e.-#9VXRG{tل~8]wsjx>Rxm$@WP?ogg75AY<V&d܆g+>NیtMw /PT#:I' $KNnp99Fw/6^f1΅,vJVyslfǶ5C8Ԛʖm:F l^ְ;B9 ˯,,K4K[?%Q|q+!}&_.28\13zV=kSqȣAA_ {BH&{sH4~_tBaTLΈ)2װ].؝MC&BU`<`]NexGU-Proܷb*EkvWCa2jS-d Gfn{ 0:b K6x dUH$ȩiNAH݄ lfR񩆑,? Y~YFch9c@.dvոRi=Խ5|::k>]~,cH! 6$I|6 O@Yw8tɾr3RHrCAJ9(48Mf|isVW~!xgΣDLij( ty% %o303!fH0D60C P3)l7;Y`zj6iok?=9̨vS4}fϑR If"c;A{"ٛx8fe=Żl޺kqq/ `_ڲm%JyzMeKYsgŎ$HI욚`cDeͣuU?R`#+jYϽdt9NFUe*+;,,#twۛmb+"d~vQap1_dOM6"HuR`4qܷqVc\CVF&|+\.wͶ A8+]AE&j vlRG0+ҥe|(S9!w ;0RQ7uRtHEg!YMrZ;+eΧU&n%)Yu8P^Um\CpUU}GU K $-E-%j$Y.t-q  _oT%+ACVgfVcY!qBi'_qXG<dEo_/v*dwI->{Y90"njOd.s$QS1AL׵Wӆ،M4Ip yV7HN 'LnkC?O7,Vjh 6yEz/t@%s7y endstream endobj 1262 0 obj 3404 endobj 1303 0 obj <> stream x\K$(P5z+IAwea >lﮱ6l{G-2TWP(⋧O?O×w؁A;}i:|t~w_.v>,qO/O m:p߼٨>lYz>jv9/Xqֳ|Գ2>%R|f0?&+2|>:Na xC837_Pg."B;WOקk^Ǘ #NkuyIk3evHCv??g߉ݜw٤/,1\aVQr.]i}^a#j,ȸ<^1q|='Ƿb$E? y*/6J  Aԍ߶4G5~h#wz%\ˈv#-{NmِWAԉ ˦CedQJ9Gy4"h Q٨l [Z@!* hծ!b!g0W{ҫHt^Ga-ֳn+݅KYG,YET}mp+G$Lx c.hR/-?DFc=^x w2cL\rJ*κ|aR7Fw|DZ,0 ."( Fy$T_ "j??LbOHDBHЎU#*NeϞԋ]!5aQV5W0K>,0!3r/h*HĊyMJ>:x4+WRklPeOk޲j. k{sQ6~C|)! s-_٧đ/zփgvdxR N_w9ٮ]0{o1mr\-C+ZrBف@B<*${ufQ : lI*K*Hhߡ!8d`kqzZکJ@s%sɘ*=-'hPJ*M޻z,}yCǞ1'n-C7TM|eG[uIZ|H/ IxK\'{55c~oאLWnf-RoLȎGU^;}o)ScYsfJZZ#aW<7\'Q3-i(̵Lx$fkrѤP6]v4n~|E% 3(*AIXr Dѵ J6!aq폦/A{/6 F#qKڞ ܡY8 Ӑ#'ω-:bСL;D8t姽9,#28.uEAmؚ4HVv–6!&oTX:ALûn4LtIҏqĬׂk_`28ˀ-9=f G)焙DkL rt~h)(K^iVH|H2r, gH{)"g{rlle3MHs)JoQKbN8 դKay|P2d=ۅd96e"kؽ> -&Gtί9<@uD 6\+;36W"Y& O:ӳ.)oK^?$I~:rck k!zClt UPJ *CNiJ8ݤ,{Fnm V -J'|v8% o9ݨ*j:G=Anݩ[/e4Ȥvgu?)%Xs}?>=V/0NO(!-|_c6_a\*V;5Vn_4g9w,l}B@oSU4\wI .ක_q ]S"Iѱl!]@ɍqBNrFH«ZZ5:v xNo>&K$<|]պ@Va.\m"ffNJF//No}fl+2s-lu,燄Cd6s{KѤ乊ҭD%!HkL{/r]zҭon}Mo+zԦiܻŔ Qq-EuFFllW*`Tꏾmwǭm euWW!v8 r2u0C*݄3:7@kɋs! w*-5ڍW +:+0_LĠΟ yYsx%>d6.w DCqCUTY]gu枾[TH4>,)1(1Wb#)m=WܥG)NIs%&b`b׸)tk2+py1"z. tPj|Bma?mZ0> stream x\[,~_1] mI~0Y!N'9HSllanI~U%m_Ow9|s|mVlrcg6כ+,9a?tx}FZ.͇|"Ŏ/N-l{ ӻgoiǥS?_0=E0~l~-?)Lŭ{ywOקoK~~L/&0l,"oh*Q ?c@rd>᱉ o?׌g\#ע:ďPg'By <Ǽ@EUԒY! \kF%.ˡIOb/Q7wb1~4qoOŸjQN.o32":QR,⸓ 䦵$sޅ%y͋'Փv`O"i1܊H[x́g#dѰx,88qI~Fs@zssϛOǩi~sG% 떥Vh6 bS,9m![!sZ ҆bxD<i$/H%cpP,Mk'msg+/14$2Df"&Gp2l>.fw@6Ҝ"~PKljHcA_)n2 Z~֑> AQ8# -XS;X,%>q ̣ǘ_XcYa-Yg={f=7e=P5z杘bna(!\S1 #.kBa~#c2" ݯ9e!'$<􅪆v vEȝg<+xgC FWS;҅v:6A^tZ+Oq%a lҼ*^' hpt;^' `cXX{ 5mF 7Gc/p9t"lMdGLS\ 6&oPu֕/@kG #wnJfES$NÕPφifkOޚMX ^@-'{Na-Zν0XJMW'PEҶ#05Tz)_"#F¦8CYr$cM%F%Ԛpz6&Y$W[˜{8*֢Sᛪ ( Y\B#LÚhIFtvP1_Ԭ)`^]c"Q-|Q|Zecꜟ7ÑYWMxH5Zc쭘R ]yh rYHq(ȊMwFSCJ uq%k-',1 umTTŠ=Ggm=%ȱ%W2$6Upqh}}7$.rjJHorao*rzXNsj_y^)q -bLY0d?pKRAo+P<:r2w{غ<$ÊGF\ ƅ!fM$.TܙEf^ GJP}yԾ$uvt|όkGWNhLZ [;yA~BH -T/'d -SrlR]@Y`Mt/A _w_R)X焔l"-xD?䒸y SGMZPpaٚ)݅qO&Q4v߉oeޘˌ'VFu򉗶G cIa3-y +:U@q(7edΜiSֱBT%jXWSιkso\۷.qZrGrxJӈ h~37ŬBAhm("(]EyQ3,qW`ICYA')cq5|ۦj{cm)wzR/Ճk—f[+S4j&w)}fg=ُpGl=:5XŽ}n QDyqIrRXԭp&Spwա aԶù_*{DM$*$oԇCê $}X+=:Kvj.{YZtfZ\,1J>QPN< ^7c~^ )T8-a|HHӠ@:p>Zok%ctYR&o0EXDb[x04WzTUz.\ "<ɾ#nSζ m$1> / i$mw馔 Q jIpᩊqC$]_&n(_,w6T ex+(q%ִ#Dz7@5R;s NC90ÕigXOnAȵa|L񳔘 XVb]cC +zIVgrn04o? Ca%\rEܲ^ hhK{Ma%툘[NVꆓ _'̨2rZnEVm !͜y*Br 1KC7)ExveTv)1KPmS*J8ex y*~zAʶ zKYUS#,ӦYDA|Nv0x7HVۻ`eN(УV*]uqR2싣ÒN-1m\.s~.gXgwQ endstream endobj 1326 0 obj 3209 endobj 1351 0 obj <> stream x\K$(P=z+.l|X|>xg(%UfUWP+a?}ӿAY(çO/4}ߧ=^ -ÇpdԬ&磝Ť^#ƻ|_^b֓Zf9ld,)|}P|Y `3l g?r v ֓U3n?+?{/ן7_?/ʋwe@Kى }bb&)|_ek8N|Wؚ)]a4Enг// N~V/ Y/ <集YDX{ōn ̇Ї{ 9K߽ʢ*7D Q=^}_@p#uųin)֤[-լ${I}AɄUQW:3Ӓ5m_zBn<zXoScg(XМaaszPhV 1Oo+s2+.GSԳmlņj6r QD!tzKfq WO '5=)4 o٠GM'[] o6=@AC=_ HGvP7}+nx+ R8th[ (i')8!iHdo bÆ@S"oӼ*jʉⴺi!'Q`qc #yx<`IjGpP#< $NYƜnJe9dUzSFLgq4w<Q.-~UlipǺD@MR_H7qUTlVR_P \^QgukZVe7J¥7,1g*~s*TZ QUf+9ʹݍsVt$[Pz>-|H.kxK ˸K\3Ck}\2ַ4i$ޫ4 XH9(> 0k3D.80[FkIxʎE~US~}2<8fN~I1[!8@ށc~ʊ r$.y(t`֌09O%og-=ۀOF3xN.l Ԅ:=Rřlv_{^ʭ*(nev*pov7µ4@;esr_%>yP0B4Xj=G٪z*~cU+K3T.=eNMFh/PM|߅ _.o].;y8|Q;Hʈ*=iJp)ikҨ>Y %)x %@yTFӠXsi%j3-w9ĵV ߕ̣ZS (u]gX >أ%Iu9>wlҌ-UbUC֝5^Blt:&MG> stream x\Y#~_!ۂz*J6އ ~Θal{GyU{KYq|q'v~_/u?(X4~O=v-,_NiXiӇgv?t9iR:q}>lO_0܉ %l{I6%O Kx,ĸ=Wdac0;O6LIG8+.?˻* 6?I8soI+4imVR$ܓg$RلY5AB8ϟez$tbq;l' )`$}J Z8t]0QXwYIwspGAéM"Y6\=rLBkK0[)xSB6P4H&Yz>&rbCI&@ dZXn,La`|: K)WB5IX*J x\فA |ۅDKwzz8P&?h`W6i-E33l#+1{KR A )$9}/td"+A6 ~̮D/ctm3/t=AWp`yKBвhM5& !b6a@51NJ-Iwv#^|r Ԯ8=CLOOs~8D& endstream endobj 1373 0 obj 4361 endobj 1401 0 obj <> stream x\[,I~_s*U4TO>, >+pGfFTU]9]Օȸ|ELO/?}?_4=˓Y̳:E=ϧ?קOop+9ri^_oQ刺=?FqB>/N$?^ez,/.;U_U Oq wӳuvx.wOoOvILhezoZaWXm&kiroS#+iۑH=̉XKޣw@(koF.\ `8N$^빠sKǰ{&e#L8"cBj6yUfA@r^L+BRwLVkK`)7.VӗaFg{=Y<67 [VaaRw*/zno3 N_ 2A.WGp_WoijToiqU^0uX⭰VXa\V1\:H3ӳ&(h8aZQ-LlRKă[@g0h<~% 8CX*~'{_i[۪D_/GV4t]ϋP(KS VLZV4߮؛J{a3h0e|Oދ$\6(ALÇ tmFz 9+ƦٴKz3[?'̩74˾@V~E\ m*VHq8;\`5  2 c0xy4;m<>wkgPOAV,n1K\4>=2 zha;utnꠓ}6x2IJLK(箝(xsR9JO෪.0|t]DЏd$W-Fr ޽_?~_ה@'5xc1^L3ǍQʱ@# " I~Z3i (@jEعݮ Ů fd nyI>8xX l;Qpy%s$rWCaׇcfkA|.VniNj n=KP'Th8x2Ȅ셋Ƶ@*98&m֮0R_e O&Rv1,y7G|=8Of)H%ǰAş?5KJX0ǧPĚ t=uZYϞ988܎5HEP7lqa]A}2JȌ]ժ: {%_1Y~h: W4w}s;IHJ8\L+D.3W1> !&z_Yٳ4/Ôi΃;2T4 [(fm#b\j(A`t?gZ#]UL 8/mDuH=)&@EtNVxH#ೠGB//]IR]wvn Vɾz O`]ͻ-֣tޤ:#2S?pT*p4@N) y_ *aN(-}@(#uNQYYi"aO ɲꎧCap+zd -2&_ Y)B;ο%hg9wY(GO{zLl$ȃm4q}bFZPNF,v\ 1< 'ݱ0Iލ74E5Qr,9e`f4l!ܦm+g 5q<^[ǭo#E-03G "Q@U+zƞIPT)T{fhTO~+43עCީ6K(rGNiyyRUw('6m,ema@[ֽ(wA'3\AnҼ`X )tMIDؿq} rzf2XjHk0=+B=.) m'<6qtJ1_wJQ8 uƘ}IN\v?dN% 1(ԍHa|%Fi9f`. 50>t|sPr9 ;ZXbĺ#`25fEQ35a3s[ AdvtZ8d!; fώ6Ia5t1 rRtc@4|_TCV>xֲgS5ߤ FRv+S9?jRCӱͶp~ƒmk.iŷ%{bhz)pUGWkk.?!C?!gslP gM)0G~C[[HCΠ#6zvBm"2-#Mf}~t 1KQ6Ixpi}?3r˜*aܭm1v Ei*hSO#xUr Hdux%jr#z<`gK.&UQzwgKm%A F} eǁHHt%8`ZZcIW=bfA9J N[@lq:XS'dַhQUP3u&4|3 udؚanXXfci@2,d%9"3q {:nq]u6/KXM:FH۬/] JPg ''SJZFeG_vX0[4qǚ n>.l>nδ;P`Miee;7`wlJ:A7F%sfZS3 pC"Bwd|܆̒?1H\aX2ïesѲhe[Z\Y>jRCHKh}0}946#Ldgs Ceu8m?QW8n=yw3 ^ȆV@zȿ b|遵"ML9¿%j\񆳬5V1HZj槰%Ciw(q/S27mkeqfVe-\ EorG  1v^٪+Kn}$)o4UfO=S6Wessa0vNz!8C}jmw" UͶ h[d*MZrxci({‘cfn^HF"v_od ts+R;o1Y=ϚT[G2yTLf/6 l~Aw7mSry9 bh*tuI,.I0.qqCΎ~ xS='J_rj]iv酩|KjI}oj#/;8×G_|S~~ (IDD|6~GPbݍ~wltue`(cTUri/k};޷`g؊Uࠃk%.0g)Wп㱜MbFa92Mc[`"ZETN;xcqS]w3/-Ͷ=o endstream endobj 1402 0 obj 3849 endobj 1422 0 obj <> stream x\Y#~_!ۂz*(jаlYv0`;"ȫJR6MwUq~jwpO˷؎=Y>O/w?~_ ?sY>|{ys Iixw?>\6a/~^/^d"p<>_ty}ڒbG v\4Wsh;Y%.FX3[e/}ڑv 8P8_y !%U)q ߸ ;渾'x'5|Lʭ2Q~Y ğÐ+fT kGIi@}sAL 2TR}EDHPQv7頺bF 3 #0IKFg ?F;j"*qp2jFZ;St/Ts3S#B/1Z7ni5~Ro-όmf}1Hhْ+`X"JMUpq /!\mo ΢gQ#T3*3S"I`w`j\"4E;|1_J#{gjJNp@1QI˧$dBV*&$n%}|h}3bQRءU)Bt*D$Dܘ3L?V~Hq;4>ȻOшr=Eز4u :%5H2+@ō(*#n rnRaQR۳gͥC/RFO;:;'TN&_d[6JNS'=K?"."1j̲|KZ.;&[%7~Tx%Χ4 ![ 0z_ns|~oJ̩fX?.'ɪEuх|c*4DGBs-dV,ҽ`V"KIamKlU z[q)V{jvisSwHPĎԙZN1}G[ԩ"8nV$ azq0yÅ0V *YyN"۔#w:J9[/u.|?8źzB}cxQ7Ds?F {h[M>mk:5=Oʬ@!5.`ߋu7g8qwբ%n| )|k]p 8UL@Jqq: |B+>W0V;wX՘7F>A8Vt[+gWqDgTUSqeS lezߏi3̝c}LJ±:ҧ 1\c-dSyCD&?iARkzTW0NxkiW8X H$E4:raJ!$.oޙgRkow;J0ԤMaq❣\q&Ѩ~ 1,{<ՙX>Y+ǒ-<$}3 )L6OJ"F*o_ WUe5Y"l@?nG\pel&VՑvх%AuB E4W^ $Aӈ b (EcO883*AWafiWX6^$>(Z27el>I ӹ0 ,\'(UWk\)nTW) Urun&,7";+m9a v˛"lW8Qo[[\h3I_>-K6Z$3nYLUҦ\=ʹ'7T) ~+M=$8[N9 'A/l+0iK9Z_>S[ݷ_I͌0` aM|rз[l/qD~ ߿><{צѿV m { kDV8@o@qϦf(oGZ3ij"v[ouKkm`\]^ob*z ̺*epނl%-J4NN(%!<ÉԐeSZ~kz6`c7ج@4g89Z]*߷E=R8hu6pRw뇍I܊jb3fUa[R"w]!ڳϕE8=R)3w2Lпב}O\;%"clZ}\Qjz-<-ORk]_4DL_=5xGnxP%M O#qs8HƦΌ۞z羡>pѣov$b]VB2%8 3tp˥Fy@.q4Q&w QŒڡ6t}+~WoHV;9ױmxԖliB#PXj]*ZcXS7i2X09H֨+îo\[/߻[d656|м u_a}^Uj}RwݎȄ4gL1>Hp xzPUBˠToicoKf"Rgפ[n`mx]`P!6ndj@WsBL.&R=+@G pn-gZ;qC,%-^n}_j endstream endobj 1423 0 obj 3402 endobj 1443 0 obj <> stream x\I$_{r*( :`|1#,5r~#|0RXXj؉ϟwt8$z'yFߑ|Hמ(LG0/sp{!\Wis1hh'] D>А~.\g~[N.3;@190C ]α@\@&"Utq >-o 2s[̰fct p|B1g X³o,έpq|xI<\0kmEtF ёg k4S Pђtdp_{#L4WGmW 8q!47sEiN'&k eCT.)+'JgO5+(d>oݥQQ2Gaq(~)=0QpA}4D9y Dd]Yf<&";aKVT&LN3ZW.Tf#Na֔Z& S`{"@=5r @wgE PyJ[cصq\υ9sp[- !K_Jq ~ +dLpnw"q9NWjd3ٰ={OG-tpA3`^?"4%ʱ3_%iNⶺ%57p"c@@Q#N!@' GCqmMQ$_GӇw\UV-Q}/BّdA<: ##blFkF΂dɝg)27RV^;%Z>2IjB*"ςnEg5LP0ƙRȥyH8 {J8J8`A-|13D8VT|vdPӞc 4E!d$bJ9WKLtLL*0ZW.U!14g= 8{5Ei~(vpyw`Y:qrH ՜BA@O ܈DCVH% r' .˙* s++mm`Gv랮fIRPcڪ9Fg BzIAO\԰ &b#Rpc'AUs6+L^=ظ8N ^/]KVHODMwՅ}$;=%lUm*̑&( R8UF`*Ѹa8(-Xrt@Pz.nd/Ɉa!˙ j[4$i8P)>hD)a}BE:EI'x7l{w {)]1)2 #M)a^Ch꾑Hݩ[ WW0ɨr,߫j)K,{r^~:'.Y`phf<\k^6,$UG_ ڋfMk n{0Q0Moܽx=F6\Wj~ΥÝם+S2o=seg~~H޴`ң ^g['U2 ʱ6!H5' E5C:~ܝ$]s遲eg*/*@"Gkg$g\s$wn C:|Ņ6Pt ;b5kꟿZ39 H{(:djh3ϕ2)}”$X1=D猅YbK58BU lG.vl#1 ~B O|g}S~Q ^Ң5y:dFDWn0d{Z%o0 {hk[*XP>+w#'{nIeϬ8g4By4˔ i{ţ'Tos @#C$`vxj䡢xu+{QMv[6څvhO6_VRD `ӲYk[h7ܫS]dGWgsĺЂk Xk7Ct~,yQWlI8ZLn~=v)~?pk`q$@ffL&J#ad94 s?fY lU~qɕT=o)A endstream endobj 1444 0 obj 3218 endobj 1481 0 obj <> stream x[Y#~_!AʻJ6B> ~yFVfh=i-222/"CÎm_~O/7nͰeNlqyo7{~4}e3~ KOJJn~|8 c>Nl|Ԭ2935qyk'6|05oz<%qtOOx8>=|??<zWuyVlcYg(hj/~qڀ1SB*0_= Z"+ BKGQEI%kcD ;1OlP[%>EdzEɯN#xie| ˶3ycV˨1Y0qٲI`9 RL{ȡ.${3+ `5׎yH6R*C8E`}ٌ,:S4#ɀЊ/FaH#z)i%S86Z3prFAeeZʳ 3ŭW_վƿzZ+/ֽY&nt,O%a=(W0z1\LwG4L0?G:S܄G"CC}!'ږ]r_Vܖ؎vɘUx4$Ӽ_t3p1qRN%b.l@A%789l"d_Z}]v&ݠ7Nnb gH ]Xe-C)c@/ %؀FyJ3MK/deb:5K;G/ Q"Оԏs"lbHH f0ܮ*H 3(M(J:] 0{%ڶj 9sV7fne0cB+`kyK֫X{:!xhP$ơgrx] $\ QFDs2kGe$\%G%wZ2#m4>,)Ţ\FHC 1XYX$d_[}]`5ﯽkFJ XJ#Z6c>LcuV ,7 D`zV> W/<(Ǖ_ C55~!#0;}j: قzؔ Zd|#_qe(DVwZs6붝x]L[O88vCRjMZ&fNf/Y[*ZGX'פ=Rb@9mF^d',[2xڒҽj V)Բ jYa42]Բ[DEgYs4ʟ^y`.bYٙǘX[McsuȱC= :X͐"iD)}́``*ՉxAqf5| TK#rd#r_ˆ\\{ YCKwYnM7W5__Yܿzxo=NDݣ`*D4:kX\~UۿSⒽfC>g-2|z(.v$l59`B]A:odqpl*3Xuܬ{#ɅXfgQ_6BXHߎ!wx6jB&+H&uwG{Ͷ"D?7R֊+zdYkEt]sC,NSsG"7s3I NI͊!-,m()UnfWSSd=ڟI3D%-/d/>.{FnёlYmpv VvtS7-˱=?4͞~8^]dEVBpuYlo\̠Yƺ׋XwS[Lĵ !PԿ.uft*1XB)v.$g^6OZ6?'F}zXh"q HۊҨ2(<->cyo7AJ endstream endobj 1482 0 obj 2694 endobj 1527 0 obj <> stream x[[+~_![@:]}a`H~0,!!$>ij>!XG3UW}}ճÁ˟/Wp;iva}z}LJ37b>|uߧ?=F5݇˸c fl+-v͍Pf>N| on?<__~Ň~?qŬb~ŀ+vٰi8v?<{> ռ-2뉹S-CE!\N)fW8pqq`&>)`a pr+~9uo0v7_OF>\f61hh@ ?k20)/ɭ/tܿ=ĩɲ0E!Il]ʄC1O8_|ߞ{N?~|yAAZc8:;挮PJjStQX az~n!џI cm ,ϊ?vzA){ɱ1-Ũev=!U[n|+Keldi Kh}~5 HEʼn&'nC2\i!Drh0(OQYs Υ?jk1$ke!3XF UTFЈlɬ+3P&!ɠ6-nxAːφE6=B̵;C ސBv`7B#0X7 bd1Ӧ YJLD=xL>LCJiSz,2"[[DXF86.pyAJihJ;"dM# h`PF&U=bgZ3 A%aDqcz~CnDrLk3̖`CQS W"Fyf0)k?DUvllgrݭ#urVk+wܧR$De V%v,s ct^:ֲmhbgRv{nIN|rI2^/(̷ՈݲOm9v! LW7y7!AxB?!zבvO2`aGD&E(g'=YT*)HRwPR[ J6%V>gKml)Վ3R V'R0 )Wٍc x89xridd$M( VK @ s:8^qAfLgpH\>"'O,`ʜ[Ž5߽YEߞNENEx|R`rk"?2BWĜ5WO#/<5(F1O7dW`#M<"<.]˶TP\>f3 4X[*_zG%ΘhzuZ*HYm*vȇ*p1`1 %i)7RkD|5@lO ._a3t|c^e>#xL9A&"/A_jۥ[&*.N_ R%lB I-e:,uRԏ볚8zsY&Rjw[2VڇCC:?u,֪g>J-s]qih@Jl$S월-vd`㙦__XoJwzE7*`/"ɻK|2QX&-?? CJi%TiWb({=(ԛ8PuҩN\--b oPbĨ/я6J|ڴ6YɛJ/ e#-HQuFOv7 =6p7$[nB 10=ʢaVSy,¼ dT#K-r"N-\-RIAb.QcxЦcyZDr;C F ٖF/qWQDt#ɴPާZ 7Ҳ ޺.~Mo|/Ev}ugˊ^ÒyB kOF8Lr3`y≠W\8W[B_L_y_usP1WZ`܉u!aITEy20vUHҨ g֗B8/O֙dvJJ $?[ޓT;7CSe%fHJ$Mó.UJL)fY}[(_vaJz 3^^L)فRfP0F΄OZ O! E/0-7ڴ S[Lʶ#Q5@ ]"- Q7(2Lst񥐨 *|t a:Z[7|+fFt'eMܨ }ZtNFQ(rŽ6xT['ۑZ2 =g݌Eh:/ yE*ˡ+̱%gfAK^US>bG$lؗeOV~KGqw_ endstream endobj 1528 0 obj 2661 endobj 1588 0 obj <> stream x[݋7boV}²ڴ<46=hwFjG9$^kFͬRE/o_t_ݼ^YUn*º>U?|]ߨ~v꾿6H`D7@vo_vF3vJtV+ݙ?}?N=.?ʦ!2PD둁jw{dC! ]C$JTԴQW+d-Ğ~ڝb릷#a(Gu_lc!AnܯM`H"vT W(cK\9'd)9Ж螂M#IP3{KdE;vwhGY䀋vT#\IHOC88+ F2qdx^!,h< 6)f\з 'C8<>ܼ?ЬLˊg'?~"G:#pdhGfD3POǓ ,XBafgpl](!m#T)3w~TA={ 3Z 57f kqH}(PocG\r,{'s%ih1E'0q<ڒ6S᢬P b8ZVt@[bC2|d`p:(6owK#Aϣ[LCT=޷lOi9mԎCs! "20%3"ZY6~_rX'M d"o/RD¼[8lqOԛ9 .mIm1wM&$05Q)F˚2+Kښ.Q9am Ӧ7qKr4i4}_ endstream endobj 1589 0 obj 2050 endobj 1646 0 obj <> stream x[Ko$ W4b3 >ږdžlo$aYJ텁Q,#U;7wOr09=ag->s?Opxu~s$΢0qāMGlNF7+^-(~E4w!ss-9.Mۥ &PbvhNuF5)٩h>` xM/XqH3[(Lُv͕>dXV@TGaK7}ՙl*cqwKO), N] 5 hi2Aeصc"b ʿgHX,5]2 gHIYv:4 lSU=|%{ɂD:t+ZPD s h|(q8V `u(xF+w۴ l79a4-un$N|]nT&sg$?uվe3?uLY^yeGro6"=#>$n = 7@([hyHc%X IƵsXr$CNDg_ {_ Dfeʸ3 J ,SRZf0m5r9KS"xG:{0S=$RgR$Vhi)ktK$мad iOJvQJ/∫;"Y?Ɣ7iq.T9PG]4@d'乲.N36Y>&gQܥE' Y-i1Fⶪ0ĶTIߖacqcjzbV.B1yV6yV* cC !Pȍ,Fu^3ש꿪:u[W* v TTիFaA/\B? ד{i>%kV~g[WhC4t$sYlSoV25PO5{w_Fs-_ s[Wmz/:Rt'E.eE\(6唉J6(ߓ^-ؑy jnN4UGk-VHQ~/b91Xy9wR w6xeB<oI${-Lͪ''\y`</vkHl8.:ͦ7:u\^및ć Cpܗf^! ܻ}*8yo9d|&hX1.<*j̈́>2;8l~**M6ˆ3R wE:DZѕΙ6?r<8pM |^#1vw+EUl>RTi[HqQyEFiX R2w#CBSf#6iѶs=NJ$Tt!Ό"&&fp_қ-LtQbR4Ej7wKf~-5E:Z Ν~|]9zTTAfp@5$,JiH WjZa MUɺ :t^Jbmĝ S:ͯ?HDfyMHcjt82{u"f6w5XЅܸ Dbȓ_tvڬ5VUzX-@ ovgfc B4%*3 :!=#s}4g\[u1$^]\4Ir@8kƙyh[^97mfldAe!Vwa$~F!x@ Q\B:Umyʩ_vT736H{^daHm4k䥄Z+v,IUZbsQxE$p0l: ~]3/c發/я{+#+k!tΘDT+b+ 3af,2`t-_.`3R ,F0ijׁٜp~I9S]yJ %a48WG-wݪgB&Kk2_ ğg endstream endobj 1647 0 obj 2629 endobj 1693 0 obj <> stream x\K$(P=w *l=,455wzUfM{(RRHE'iGrû?^HBGvP=/? w_-])Sa/x 1}=Z8<`X2.k=k EY(~2O[ [ɉi6z=AP<295;`?$c/Hq( moO%3,F pY[dU$L)gI%q"^KJ-%iyV5+R$[Q&>,a$޵f؇7| :X|N"zAKH?xaB?g'\H)Q^䧵d#TBK zD !Eޛ/Y\oYHSy۴()}vaEާLhqU%*ymk3&LWFO q>aj 8(|ވEM$-"O^M;T.BY%͖dE9u\d@=b&<ǹZ+cWP^Oz&<*W~嘅9NBiUBΥQ?*ܛTpDwWExffEλ F.b XWO,Iմp6WXֿj uйbwUz;V;R}[+5#NwkFm #l9HC|& S6qO8θי uC%B5"t$~ɏ&busVY+K¡n63>P֑-Ydc_Wj 2Tp!D'sL ¹J  ą"CJ"!ȋ H]*Ё=y!jb"ī9f񑌷VIlij8'X)nYxְ"e-/$#ۯlŵYʆ5Bzn$ *+/Ey&vk<̯mtye!kJXulf3tKjr\B'D8wvdH$nTHoxg2e`Ja츉9> stream xXKFWr ]ؒMÂa!٬7$n&TKղcnˀ5WF4bN5Sy4on6Gw|~ ۏ؈?i)=97A+N®kjlZƃxŞ pnsh392lHsMSLSìF"JyLHO)ͅ)+M<H ܶ_ZYph)`E>q"J7>y$k3e.ˁ.шN7#jBT/1JU2QYhao#-`FQd3bgg #&z5T3D  @Upҙȍxs"(9LyqOsC9;p]4L8,i)Ʃ&žn^{L$u*颟.߫K280Փ]S!\%9(w5fR`.wnN7$Éu˺N{O],mFnpe CA7qp_CL)UbB"&qj*0\ /2owH/'kS1*1HpL MuK jPGNt7r&D:pQ h$ xWEq|ۧ<: ي5f=5ViuQS J+<(L'@TYĊ:x' eije?Q~v=-^P3 ř7z kmh.~69Z\~;lī9L&)z R~\>夹B4]RwPB;><]~~ {]Z6Hw0:Z ˃BjVj/ XfaPcҋ _i޿kh#wC|A͘nYڦRR2'ŮgMPD"ۥ$?rYeɳ/#gٷ4weXKT;{$6#aa N}p5] -k&kVoZo\ endstream endobj 1757 0 obj 1303 endobj 1774 0 obj <> stream x\K$ϯhM0Jhzu |%ޑ|TU.f*+32/;?}7ʪ'q0V<͇|uxp}͏w\ywx~yPn0חn;jyRGN*Ջf"'.rb'-Bj!ɷL_lb>]MKE+#N}0>4}6Փ a8=OȏKG'\G-3v{7ųiwo LAؙ]%>:|k` K:7 ђR'eW&& C9+/aLZ{La pI l>]ixgsݣ^ѻ>hI6x2h#pO8*M1อl=G_ kYfn (R`HCFqAԙ($ty@s0^73 _j#1Utok\t8IQܐPD>Dscwג\FUd@Cm]=GܕdR$7$ a7Gjcg,Qݩ9a"GSW"ћUF[ 'ʿWqQ~V:'3)K)]vitٜ*W3::]N \:F6Aqedcl*ΚQ"%4sFd+>Ÿ<aFBB#bG.!dhݠ*Xac~p8H|ï`^߿; (uQ6'tfxnpiLL0! Cg9BI ۽9kjM5B--C#"Hsضq>a_=i\xR @8u9 9RMwvی5=k<9wuflQT[,3ݬuHi/$bA\$3%!W[pyP{:v#g; [t׈opD5aZrvB(:ruZk^rs%ӄO5[JZ. >LgD(hH.G}%YK+,F*;D [U\78A o PfǖgIH xRH_ 3 '"$be1rIt$\GOaQ@vH _$d&*Ro:SWuyi5Bޟ2TScNf A*BG+F;RвI)"rRTM3:Bj\S-&02ӽvz,mwi]Vw$y&IX/*{kݰ5 F+L T-(mԭ%,uh(+1/9Xlmzi@bAM;gbh1eW'jZ(ɳXZR&9KH6Z:nTj ^ ٲWz n~s&k~*P?},ɋ&U){+K$pqѬvqq&Y^#gn05D61ԡ\4N1j8ꡪfGRCa5IBlfDG}6l"Zy?Y&ЗxkV['i+OJ,6l=Bʶֽ{A>Q=k_E0 XȈ吝9ZիIV]6~l/f 7NIwBH3G̺l!,x8SGJQy7*Vb9~cZw:AG3~y}-P(n yψ%zXlW8cE 3; m2.Hddl Y E QRgc01BT͡kn -~Jr7f]Lv=5M↸<qtM[;}> stream x\Y$~_7CVU4m?H2+{`;"#jVFB0鮼"⨝_>~0=ʃỴ:E=·~{p߽o͏tzt>?_P__P|\/AwOr֧I$R s><3I{># ]t>.'1: q >.񧸆(擼KӅɞ'~K؏iaMƏAHJyM:޽Ow^N8/ dX6DyRK-Y@Z*-u/C"v)"֩a9]`%^n])YD'uN\ rŻT:jgV,Z3p 7$AWY (KZ5ʜs|2,Aip戡D2q-t8n:*bep< !߈s$q0`9H Jz霗.O:B[ʎ D^0AL( Jk3i-ovfD#_{فK۾t;!41T VLzØ^\sR-N(B\szqAKo u1n[ tI<bЀXl~XOQSJ&ED]FP"M~H0 ( tTp*.gF^G Pm ٢Z0i1iCԷ6ˍBR[J*^".M 8 eI:j@d"^4\T쯷uYPc;hbiYsqcD{; {_;E};ٻO8ͺ4D[Ϩ ^1ث7Svb7yf*/DPՊ&\\h-k"qa SкڭmBT0תhai ;DEGW&%=*MTLx)&vDޙW\>D+)cO!"4B/EB+?3)f;ԗhF)& r@lgsx6Re!Ph"8( xэ 8JA .mXEwaa=W*tĜ4|- XbK|U- ,J2Hԛ]a%nH#t\զ=4Ԅ`”3n(}~.N&0X}Ii-zɜtiw؋HDz>§  Cs BGMb6~g C7.5.uqZr:IXqs9 qo-φ;O{ί0 "M xaQ3PP)JKaEmag<W(D#J8Kɕ)&b5'x&!閭T2JѠL/yJT i<[0Sj>vŋ@c\zTY$AP4 G5XQb3DwθG9&jZx;tCX=_W+fO땇QD#` d{# lW3G}z4#<ʒwdc7T GCKH_)fUh;]r,Z_kCV*w.ppNRHM<=epN,)~ 譢6-ԮTi7hZP46`^p[8]Pë]tߦAݙ̕M2k^2]|j0עIѐqDF[Ip^̂H~ik[\Nhb՝]v\Y+SmpM,$rN9h%Us4+饬'edNbv9)~oܠ{i@o6mpb*Vm.#{C9_qr=N)tꂾ>v l9IFڧԻT/Ȫ5օ׺mjOⓙ̔LᲬ{w,ӴWr&!Ɇf1/(פkVd-EO=ǟ,Ms=6R:c*IEEi[Ҍޒ1YBq^{ m!xinAZ˾ qK}s D *ai%mTmg&2ȻRTV)Fc׫Xv򄫳S׃{\:c\ѣ*loi|\,s ?wP'7ʿ[F-}|p?\|{4X54:dy;l Zg噺fNS{NW^o#MRUBS elCxG0ڵ cCulgPE\& <4oݧvWW)vh]E& ZSFo6:8Fok%b ʋu[jVߓʷ@=(LhBpѺ6SȰ=[ƦUhφOm̓mi %PWɺw$e_Daۈ@waCD( 7ȈzׯzhWǜ%0)=-tdTe;2bbK=7Ӄ:|5ENJ\ͳs8 =ig9(M079֡϶~׻ endstream endobj 1810 0 obj 3669 endobj 1850 0 obj <> stream x[Y$~_7CVޕP4m?H2+{=`;"ȫzgfh"vzx矾?vn: vƊüx>~ϻx|:/OJCwܽ=~1㞱pmE>÷a,? 7c` ~~ c X9>X0oC؄=гf?*Q _|ˤ{j-8>agȣY\Xb+ y|u?2%N?=8bxEY)&/ӥ| dž%! ߐk9nT?= ,u=@鸷 CD"d֪J1' :Qs6N&43Y[[_V:,QN-H} w0i1sJZJV%'TWmoa>ra$%~T$J <1] 8j#LC3kTcTGgAi1;a`69`=Z}|Z,8 uUc 7 ,(j6tZq j=Ni<A&/1UcLn 39Hm֊qDޜLHÈ}| . q`x@Qjq Ħ U:A: UNpZhU(uŤWQeW3/1 jKr1 %w$[>g7޼* kVhٯaE%#O3j=515/YdB_x]A܉rqt]5ܣ2@\m94=h0[DvLOg͆ /43bA,R0Y Vڽ cF{>0#ó`{zfxob O]X7S*za(7k>Pd7X3Olfnm|?Ja2+ mJY9\`~+e20quA*BŽ3H(|J@W͝LԒx,o{dsjrHTӸ}sۀ?K|ys'dRhQK:az4W}d ®]B#H/֢C#>z|Chj+kvqJD/k^5#eu!er,fid¬3lLfʳg"aIIηUI\g oUIqn I &BIIU?n:B˧d?GMlTXnk]f"P^:N1}2T/_5z>" 1&>P]%ʸk)vUKsלh»q|Fg o=EXd_"3('^_Qd )D}3*H8; >.5\i<(&QAfV-2xŪIvh|JgO R\bY㥀ɋKHlZ6x)kn ,̻q{fljҋFVǩ0Qϐaʇ]|UtLJ۔LvyH* lRa(qI,FFo νeݹ W{QRG,KB]Ӻe0>dL,֕8\i\^d'L\)UΚ׌Jr ALǓ6Ҋe&4BJ+9 [ Oƛ3 _) |gKgk%ްr+GԄ< -ˮ“ʤ_Uf]m d3Yz64ŠC7'!$'gTf2ҳuCoxż_> 5qI~yr lܮ endstream endobj 1851 0 obj 2998 endobj 1901 0 obj <> stream xXK6 W譀3"@b'h a=,zf>0N);[H"Y")#?b _?^aG%*Jz++mS=○6z~w:} ů]wjvDǰ>?mMIܶ}uw@uI{;ZwbmݡDmM`lRE0Mwi:ogwp9?\6CfӚ6ۊ2H A/\wʻ P@4ښ+IrjCU JF r)s4ɅظXncOPiy|0G5F Ô#h@~Z? u՛xVN!Btx; M8FK/0hdЙ%(}:\WΊcN1"MY@.AleT"=:Ddꦔ3r7mQv!35W)l?I0p4NpYm&+}(MHLdf<~kUŨbU+ ]ڲyD_ ˨oJ7l'k_T+8gaF !c4-:kf љe>-Q8%hBiFp9,చqJJh]01z/z;olr”ڷJ;#g濿4oXTa鎻9Jt=iu@s1qdiׯ B.˩Etp9 J!)&_cLdqzC8q?pp -"5Ӄ Y .&zWd endstream endobj 1902 0 obj 1251 endobj 1927 0 obj <> stream x\Y~ׯhŒ*haA^YHXGDU52COu9Yo?O$iZg}r~O_?~ ||~I\.{?_dac>Idz5l>ti%>7˟?ˇw?z>wJpa;O.ORȳ syRg1xgN mۉoRN|-gzyZJ?ƽby~ɇE™Tt˝ Ǩb`y%Kw_3]V` 9jJCiagzP/ bq}=lL⟷^I'BrLGJ唁oӋ&-/}#J/̧DE]'.pN(SFz\x䧌٢X`wU2a\06qMY]?\u. Ʊ_٥ǰBqV/0%)ĩQ^RwUɴ}/l<C-sklz *4X>75D򌒨JQw cM 3ibgͣ6OZha5*UZʙ㑢 BW/#I]ߝ؏gncbNv5>Z0KAףIOIc,re k JSDE굗y5]B=Jul[^O*M]V c7; bw$0a;Yvx?V c.zzN^A1,7t rztW$o mER2%930ߗEQ rs^4ٌo7 ! dfD|;R2D%a$~G%.)uZDc;l7L Z !xv\T\s7샜Ll+Uَ$!S@V2\DYJ3*?%IQm cׁ5'5{kL<嗒F:#We:;AWĂ2 !y 62\{SPV;tO񣁔$Rj.O, o8D[noF =4O b н!d骪۠4KTУhNT%BPO O/]h-PBcE$6-36T)D38yIQ*މTOlȒ[)$5 Z{H_4]v+i[Jt_ {㌤N[\d>ZĄ߲h/qǪ[vDlXv ?4I˔(yФ|Bu <,< {R u]={!9gWfàwqG`be 5OuK^w9"k4^,s Fk[x}P jR.91d-%Bl{( *U@!5YL )qYX]K4DN[oV5R4gjPg:Ǭ,ҐKijc`Zآ 1.K{<Ɵkt{~ߡhRWw[&r7 AqOia':Nd]5vK?S馔G( .2v$&jdF:*f6RrSvK|WԽn5iV֊C2Z~]C=SJnw㸎8R}qG:Nh\t 5eF#/e"DwgIh@ʂkIMrݤ[ni(^p^C,2D<{2I׌C4$^e6FHCšq*/nOlfψ"h,GS3Q;mi@Ưl~Y=HL'ܦ#K&5|A ?U,DPɍlf\du=VҶѤf\ҠhOegg~s*&b{f.Ê8/t?O uϯ>+K^W%A,>l_Dw_Ub_UCJQ. 6+uK&r8d 7-ͽ&chM:dS\ŖJiy*n|CZ W[Qn$ ]Yu#tWngvNfs"El,YyboixgзT)3xa-v91EeMenlei׈OkH`p,0FXeoW\,Sr|i N=Txp:tMt.lu4*JQy0硪ڇj tNK]NskXpڕDUykթ?HNܲqQu;ԚRXMnӜKJ0˗_^?}LҐ{47.MHljԖYKwPQ,glSE?wd.G5ޖIavy ?~eQ2PxŖ D_7g¾ /|Dx_eI)Z\#q@#TJ![^T!H0Gw4%tk^NƩO{aW0-_},ʻ ʆr1Uq.wq|L$xd|o* ?}`z\ B(VfpL을 k->\5/' :V@o=᪑B3<OЈjTs2{6m-pO9/xiM;u1Kй5lATQKvpK5ˠ2\7J{6)孳C㞇D 8̔0{`'Dm }Up Q}Sԋa.n]ØImѶIr}#-@}T{JP_pQRKD7{eKmou+DʇgՁҦPYxڴGVo8OAߓ$aWd\oG̸P8<*ѓVe1䟕)aC`5~,Nxe7t|> stream x\[~_17Q_-00! a<:8$BTW$ͱnuK"~pp^auz?wr=?|zN5 _ty}F 2^8|?^)c!8o ( xwm r‡9u! e .XLA%u_T{l.sr١s}}hx];Svȗ d%qn @-%у@3p xjs]B[J/D>/bfTX-%mu]oΩz.>\:Xoɺ/3CucEC/['qZ.sKvX\+) qԙC.Pr)Q? 9⁦##KU sl 2 .%2*xBѲei n%h0(w<2`AU FwݔX6sP=G=@Wj%uؘQz [X*n PZ#hc5%BYx 2nMף2j Lj0Y'c09?& l--Ӳ-鲢,bq,˽zH?H7=JlC~=S:H|hflV*ڜ9JQB`F$ZdxgC !߃w∹.%#WXH9ӬչU*o$]8 5.ua3EPS}0MmAuK`Cejbb㳧|Qc/["$ nc2=0Amy)+Zg;`N뚏 $MB&IJVU*^ocDW:+u%CXN)*$, NfJyL6 ,S̳iyZ‡deܥ&ed#RR+O 6S\vf퓊, P]<9̳d8۵=\iV]sm5cW XL,-c;tx(fcB׹tPOe"*I:ݡجĈ#*OJ|O[iIi`M~'+w`F_ S1љ. [fMdA xd?+6@@aR yWlW0Zd+fMiXpo'4bv.D5nWJĐ Y>W^Lrޙ~Yޛ9Zj2SKad_zu%ic" *FO,RL <բJwGP”rh{j1$ l<u3vi,#>.cɍUTI13FGًxg`s:VwaHFzg.Lӥnl1CYž>3WߜY/y-Nx~ W$į=`E>qK["1arm7>\ۍU}1pjOh3;P4DC\u׮ا{>t.0BOvMpm3s Q!v\0m8$cRLk^`.vKvζ[,yA)ySFus"r24 s+΃N2*(+.W1ob U0-6"%~ ~_QD endstream endobj 1972 0 obj 4215 endobj 2016 0 obj <> stream x[Kk$W4Кw%4 nl=,||jf#*Ycl4RU>##""kzd<|x˧z|<0G~PV=q>|}9O}/__>ta:/}Ai训~`ϟNaԗ ?}_q@1`D)La`< {hRQE+>((G ~s[Y7iz—|m|/hԉ DWlF ~gv vҭ3نa'fNs0CM욷8ݨCH^#pJ4G[fYO gsHONP8 Cy0A^f~%1%7h͜OЏ).̱c-PЁG(8gRtl@{- ɨN#zb*E{Л-_K8eLؑvb(M3Q6) ŀh)(Y4P^=N]VAAZqY@-VZtl_w}3qI+0m(=n(ک[աS#7K.3zx2, c`uSg%8_7 Z3,U&~y[w0"˽'NJ 3"+[ LD̷"U+ɮF k >;r1TXpi\Q\7VuDBe8,; ce.W$rKҋ!۔HVR)H`ͮgL'J-%hLb>RϒnR*>8Qpڡ={ Tp(4 $ CڜcV(pgR2͍3`@OgÔ&/GPc(ָ`J4XDvM{z+G9)ђZs>cf Y:$Z= ʸdb:[' djM.Gx묻 F]cU>L(٭% %,ECz~HIqwzѻFɣ9,fЀ,d?f ܏1IqUiD:ھEѴ-34@t4uɊb>0Q^Rg.$]k*D>MY#A,uxJ&xw[:l㜜$͆ |ka #cTn0堪BAZ{ %M:c^"KA3_JZX7a-AtBkdq N*$ q [3lw|iL&eh뻙sLnÓ vť*GD<ַ"qL euoy&{Cp" k=k0@+ByZ݋ȍI 5{ 09&wNs9 Z%=(r2ڡګjptnV:v)ىP>pb=9V!&^A\AUG7bri+xph\wThx77̴2m{C% 27LbEQ8ݔ6K',XjA H v"5D`3+BDU MI3n ؒaۆcF' JkvLݩhe0K '\[&:-t{ϰ7 Mepӊn;%L'cjrVx{EmaKmo38x2vaֹ4 \L,Ȼ{X{5A;y^ɬw[g5, ̘oYLJ43peM?jx\rSMP*}SO9.d9R3> 9tcIئ2 |/j(FE{0g,WqanU|=3< 1`w$k>}d&@E6@Ӈiƽ/Lrb,$@(dք&P|$.ǩR0//I!.I>6pcL֒c.٩RR_r/ːGٓkk18T%:Wčݙt6O) <#s$6K3'ʞFs^CpX϶˳4:f?J6%Wѹ"WO ᾎFoe b9,)B׋xR,<`Q k;Ns(Uw?1χw>}zp7 endstream endobj 2017 0 obj 3355 endobj 2050 0 obj <> stream x[K$(mzV&$ ݕ؆=,4`|>6l{GHJ9[e[)E"x6{>|x/O/o {=Gy|.^U [->0ixr/}{:]8j#W(^b^ajJm!% l^,s?rxՊV1⋸bZ-,,3\sXWqA밀4-,b1zWӷ7}oI HJ{%f6gu^mp\ZžpD@y6ώE7A9TOpCZP#-}(@>;Ɠ,uR@f\O![yW~w*[wm[F4 3k:뤂Hh M)oFgKua6K{IjùtPV]RYbNs_zrj ִGx9R-.Kͻtᚡ[n K{yۢ#oq胻Kap\ Gs=q9J+$XyckC0™qMTZEƒv΀gD!_K|u"r3RBgy(rVH Y ܍CL\T(-" `2)|zws9-mi0o aP6enW+}`pvZy.oǃȝQ_n#=@^QR.#c{:S'5WfﱝRJ+_l^1l~5mV+.y8a/5LO L5c,Ҥi3CDs`V~ xs:! aFZ0X"ʼCpch5k]}숃zszAN џ37* m hC6$PR'̃t̋4(MZ@9^l}D͝ ~'6*ί<'n )d7q޽i9i\B;a:z7AA01vmmBx"3nj6yC{EY!a}lJ SP+GɡC\_.Cc fF)"U#U77VW[OSAOL1Ŝ.@-Ja}.;\Ҽ|@-(?c#lIf~Ym+Oӝn23~z`)b2~Ls8(g2EyСRiO5u*@0e)A p~ѳ+ iUU6Y$b(ӿ-^9*XPdBQq7Q*5]78D=%s,S| Ͷ٩}/HaG 45n\tT&\؛*n\PlR/c-r2Y!VZe[{فF8 G`({3PzW& g>iS.R&luQ6 endstream endobj 2051 0 obj 2675 endobj 2074 0 obj <> stream x\Y$Y~_wT傊0P0( sz݃ CUw=whv|x?޾$z'yE`>ܧF-l"F‡Rˑ}9 ['X77]-4bZ?KqELgpi3>,</?wW;IbړDIA`Euf,2~^ݧλ:֐e_,d=`[ ʹvv傁 e&µѡ sV)>40})$k~daHNFY8` IבƄ`nje.s!<\?)a˒ar0I0lJRyYV7DYe\P J3gUmb:,wqWazgTș|Mp3yQNzdDƋ(9^E爵~ Q)¸(@c"H1DPΐJ)$|޵VB]wp0#Ze0pZaЦI:;Ջjb+A`=3ᆒ*J.3#\-(Q'':!B]S"M_ٵ;J1DA 3MW[ ̞#\F2LlaGAWc h8SZTy!zffrzFb:6!-R@pJJ)089;[`ڲrgM#8!p+i詈N/~!,į`63w8_u]ePKw @㭽]KH1%F"vԼ*ZF]ƈdq>$TrrRƆ`=s 3bIV<0FjnFE°A*m*ÖMf4 3"iV|V =j &WSURpiI3Mtci;=㑂(T4 M˕%zD+mI*.HGpA)D,lN%PL'q-N,mڔڽf/ioRD`S`;j'CSɳ[^-S$cV\E|VAU"9.Ew\tlaEa,@Z)jܙ Gٺk0CIq~n3k.nC"TpW&qqL1)##kydn <6t⃘SG%56)FM:D^̀?+4[s4˕l9{z~F5 `7s-1aPc--[V*6!%J,E[mcv'x<ºώQ?G'>D-dhgR)rIrK\ c^jzkܿ^!T9Suiz뎸n1MNSo딞GRxadp|nt 53:G[6N2:G H:5dcWi*Xnۓ"N E Z*(Q++l+((d~-`()XUR-'7ij3> ڛsNDXcQ]O MlbG/KbMpu-B*y' BHrTx"^BWz I=Lŧ|]^ 0N 28aW/޸YAʹ)d};)=^ o!!;ס5I;vrbҫX%3 1e*ĈEmKեjxۇANe Z$c*%DM5W>jl"-<=--I@.](gy,zRQ{ "S '|WDRٛ'[:9*4ӆkmJNLl@^.GFat)!QST ͓(ehXWa$r,BY((ǰiހtӦG Z!B>'(c#筪17Jc םزQDaWae] /zgkL_%?-Ekq~M,n Z0>  J2t7c4x]W',kUkH#WB!2˚k.jb*xx`UPic};# ii7s#A=m^oieTq(16Ўצ9Yk뢲1}pM׳p<.` mS%~&hlN?G Jppqw4ohQd5.bkiz&lN ]w/ӂXX?ȽH]RQ쐢%A˞FEODΚ4j\${9Lpt=V>,ƙ3S9~L|!/-+--w60W65?ػQgNcTԢcs7^(:z=j&;BۓK=ʵ@+U`MKD7IZ R!C>E0cW$Hr*{xIaC,Er<1 EcQh܌B; )}M Q8oQZe|RRX,_/_H$9*қޟ/u͓ {DU[/'vi2&ߔmNJG5 P;+ ۵3\mOyJ/CBy L~؇j+V&D4kbZf-ر֘3b4ƿ̖Yߚr 0"}s\1/3@qh endstream endobj 2075 0 obj 3473 endobj 2099 0 obj <> stream x\K$ϯh0Jhvgu |-/GUh%|nw+2/˓8O?~ݟÿNiy'͓:9ӧoO_ |r/isiӠ0\/"X4sˣxLV L_|ZeYZJK$i) uN~4_I1Zj ío#N#loD(|JcG\PJ6q[b8mRҡ&W:>j6r&n5ͣ&:9x^ateQ^.<4*8pK;ʼnn`,!aHZ%Ƨ|!mLK":YDgdf-jHآM}D [fL3U#x4Q\ď,}Y^Cy>O4> 6RB2Of /HUWL:w_jE@Tb43eSm&ZwÇp)ĔQQDvfr +Ļ4 &S509Ybs?:N<5e-GoZ޺WM61vD[.LS3->;vUÇeL< ӭ ^_"쎴u_ʶ;F4%/{rF8C?@AMHמq@ZF+6%T$]0^\Tu_5.F=|PD+ݾ[6wjHaG ○VS{/Ӊlp8:±czb&]+TJFzຯa}hmQ:Aǭ&e() N̝\Zz`ln'+R+;[rK.aRj@` xAQޝTfD da i ƫ?W,ZC"98Ƨ`G5 B!p|`%`Z׸\|LS"OF%=ίY^/rEcino\nmAvͥ[ 7Hv֬ Fܐv] x7/zc;Ta汳rY'ώ&dЙrC- Ӱʧx;,MjI 6(jY6JƠFŒńoYzkC:*8ɥ0ibc([*߾4z ʸ.gRUZ}kH5&H2 Y@} ^i4N H|4ϷQG5L1pSF[^|*XƲt&Nhx=&,yf)A] 9.6lPlq P*C[ 6ט E`LqTHӨfEŵ5VV @F(;4c|F߰_n>lB[T}WN$a`E ʷ޼m}V{ 3:?RK.H@ɴF+|5FK}ƼެpWFx797S)/x!u_s@fڪJA<. SCj։ bjozWh>OfT׮OO)C>U$Ě!q4U2ySDFJ:9;`*P'څ^(j65kKLWZ4L-RoK`fOr6ٚ$ Ԯ*q)R[mȞ0nuUm0By>C6Q?xLhbDG 0 n4,:(/ EKX]aݹᜅռo)SoaZцl`UyĘiO@h:ԎFChV&?c^ `m1-ٔx"T']s^Qjr 9}v] C-m+\+>D/sX.v݈URQTHIgc'VM= r3*:%CZo.8Ԅ/Sbw_]̻45wf1@ v z &Y7 8"9h_ ,5kFȒ3+qΜ#c.nr`̺wA/K[/f-%5q^弇f[7Z;أ|Twx{/SŞ@  r u #_+FTy[M~Ts76!GnKVQ>KFsFΜ1/8ן.: y4Gb^WKO ]&:X&VxQ8}BMXXՌ=gh=>0XDF/Rk^"ʿKa;yɍҴDZys0([ Hœd:Z%)y xpRKxxOg$" ]AtˁT`OHqΩèwOmeWEdϚYfgŒ҉g׋Qb3wmLj!9&:O4͚N_+&iGx\Jv$EqMG^Ĝ/bbOVud2Vk2kC+nT,cGw8S̝Hk;a;{D0[tiRq:+k<#kv%k-U>AY弾֖6#AHJ rNCxj޵>;ׅpڷZƞեkJhXk3$_'T%n8d>~6b$G7c)N9@kRe~`7ar} GYR5d]sՕzzڴEAXC?8/lJ/Լ,$mFI_oU%dIf3޴k|D,9T_؎tFбMw-oqФ]qCnCU0 9Dp2 |{L(9_8塰Ju%`GmT-)9R"<]:-}gRLu04Z|74#_L)Kj3vF1<{p$?#+VoH`#LJ3vOxe:~Aݵϔf#'Mץ`H"`l%+mTÂ-wdYzpMSsf 9'ڗT]ig9/$Gc<Q:w1y)m$Q8ˢ@i̳˞$uF \n0VV9KXHw,Ƈk7Obk6Icc)RA(mD93_>) Bb\ɇcg`"@[Gi( 1Ֆ9mSۍ? p&^^:]k_&ܗ endstream endobj 2100 0 obj 3558 endobj 2123 0 obj <> stream x[K$(5z+IA ۰v>xawB̬zm+KRF""aG~ӇO7|8uy(g~?ٙ]NbWOLًgNffV0~&_0D"c9=˙9e9nO_W2sK"4j\UWs",_̒슲~"PsTjQu 6i,*% O9$]{m z~E/UNT܎8u4_]@s% nvb?>Ĕi4Gl%Þ+/NLG{^ὄRpR0,t9E0:`쌕eZTgX$7Fej|wjq1v#6.NcaIF‡]à>)eaE >O9Cq#ań#tlC\>xu &rR-:x XA溎$Z1#ܣd (#JQDϘ`g{z&n`ufC*V2tryC ըVJKgq?iÀy1 dNGs9YBTLu j*9UHg2bOـ4$6"L#vhkf#3:kJľ!ڤiy+Q*86G*bM#TlvսZYeI)pF&JWK)HY"@7vaC~,Y ].2 wJ)2 ̥Zq,t(r*m9Yd֔"´)y4Ա-c ${YGqd֏/%/NLrLS$?)s,s(pn 9dąi %mD=5@ÑLcj v%.[PERw\ dQfTF "=d;|?$Q_g@Qb5H[ȦB#T6L kS68i`}RG"Pς[I2DwcfؚՄk)2vR.K+Ie$ ^Ż .q & < Ƨ~Ŀ|DH2 Z8Ao'#hQ4@#pp ҙ l17OEFqגk @z(2g{ A.UsQoC}f@ zz ʍ!ED˒-uD\GMs]B{mbFi9:3.Va \ `4=+li0KFG"`2% 3}7 endstream endobj 2124 0 obj 2786 endobj 2145 0 obj <> stream xZKFW+w#ؖM["ԐE"m.63/Y3W[ny;oΜ_?s{_YmDm䦮>|]}\նO]fOvUa&UOǺZN~hTkthּ5Ghw< R Syq3;EK}G֩$Md' V܍#U(8,EyU,n$OnX1#7ҍ1#ƂG?VP9P,u&HreUsX6W,tLHWV<5f%g`9@,]A?WQ@NSrb(IqZ'ttGv_>;1IUI}nFiBJ&kJJN`'FNwp)zJ^F\5h Ὂޝ0a>')atR豘K|.x.=SFP zS0 1OHu{l= ,c聫@N.9Srk #qO`h*kbsq) 9C؀:H|"@-y2[xTq&4Դ}b-O!sdYqS/We47iDt]oK/74Js"'Z91ӝ/-Чjge\N<}rQ6iH|@- XQ]ayq*n-A[yEŪ э抗\~Qwݘ 9-3݈W8N.bkny)QcԖt.tW kdXgY^@R *fI|wf#2[N 3,ebHK~~qQ b=s0qrxyjrC9SiD2nƺ\^)Vh+WH78w"E\;i!ѓm *I|w"rPNBv5*1E!H}1~gB;[JwFϔnޒLe!#^`gE5+\I{$s?LI٥YķB?~L1 a7 Ήe*GSB**SsFkmX)_Vc<^݆~@cxV I\ɶ:H|@-ٌ d7c_!y8qt/xc X خ/Ikq "O(-Y v4Y, 4FJ-d8u/N+< endstream endobj 2146 0 obj 1793 endobj 2169 0 obj <> stream x[K#_a.`*AQ`l,.b"̄d!ɿ9z$Ywz siUyN"'zˇOt|s}ǁȉ'~І7b?|sz rY?\^_4ep@),\ج8b9Yݗğ.]$4S0M 3f g3.\ό&5 [H,[+F]A:8(d%L%J |+9@Q;rqWr&W{ەݍp$|45DÚ_hL!Wψ8\9[^ھÀZ*sHhݭ@/Tf^"ziw(PVdg&pؕ, fɅלqUn ({'0]=ݛq6(v `kjYs_(&;fb@LBoa#ݟ?):Z\+J12:ܫAXL,[gLnL_hIq/ʼ8&$.yA=Hb!, I,n33}ThWCT+bYMx g$x */ Fb邉|k<`@ڲ+9J}C?jۮMRpyB+볒eެ[[ÞNVM ]ZN j͠3+C&8nu܆sFoPFt_gǢ@RVf}YXɗXAI=e5Am}h[Y ipDԼ)XB~IK L5ݜoH4sMٴnȒ yKu&L8$FMSj BMq1hd 42Z ^c%+e&U[{h$l!Ғe+cE,#NZPlk(_H 7%q[u[Yw:K8@r!"+ݢYPӌ4?P̮Z\*ƥ3ᯬ@CoCmpV '{#RB8ʒyW[ظyd?5V*Vx˫CO^ GԠ@p\HeGm}6L p0oR[%B C !SY*&BQpXfц`cEZcTINNP@8 bN#'o1^D v̚wf'QwA68>d:EC(bBB:9*:J9lLՁ[`'ϟ?ޞs %ޞ禯5uʕF\ ~xX1{D ]rȘ<)l4]>Me>|t P(lQQDDi9DɤJ>˥Tgۯ|SOkY՟FEQ\J%TП3U0|QFC&C6bJj˦j,U\ujOmH{҈F*mH710_"UM,w~.q|Nz'G/DHjҍ3MY<@1͇}g FwMeRe[e[BQ1,*fi/ajM4VQ(QMg8Y?cle um.o]Sd3_{m:jPk{@H+jkxMRU0K8j@!w8FZҺj@gX4(7C0]hVR޾478 7Bc`3A~0}+Z-)H*6K ȟ2؞[n6گ ΖIFٗ@\D7egA)TΥGoאg,> +E@fJ}w`*J@%E0l zA߶$ >Тg>7|+QIH)/0Z/9RUZhtl}@5{Z$C/->Ƃ }FݴRT]QB ľAppT zLiB|!Q?XRt~ÅZ\xdMw(1b`Ɉ`X>Mti*,m*aZ;L8V}\ѿ1U3{no endstream endobj 2170 0 obj 2783 endobj 2191 0 obj <> stream x\K$ϯhMгJ( fu | Z,g䫪G=ø;+(G~Ç_~/rz;GqN?ʓuq9}x//߫u۶k|ϯ-돧9|QZv5rRۙZ? sx^6nX`Y5Ljq*|M,`8fw f*?>>|N?_~'_?tL>=pL T _rW2{\i80@!1V)0jxp.&yK8B9Vo'aPtQk%!VDh%ʀ]PLE>2`7OI< -T8 fx*z\Z#x Vip ĦI +ijV-h]c`8<3 Ս7&1S)J&ƞ,/?83xՉ3܃r._'|x6K46Ղ !G':) ??q!qc1fBíqؚYӱv7#lB3]-V~dǞ$36\pUv~p0$9>*F1 NaZݠf6~ ® }hvv!!&`?s(5) fv&a\C;Vbt&8H nr}탈^lQ?$Qײ,@os^dxϗ Ф"J1Ky4Vw0RnQ"bp@_B%ga<'lAMt*D0$ ,v a,^ Z#b L8[ֵJF\>hUxl |BS vAqĴ+uc 0K00Hn E*DJMM͒)bu6A&8Uу r|peZ`x]Ո=5o̍厌ۈ.f}$6// D:BsQ',DC 9'qҭ6Addž d(TA=8%U*)(aMrT9h$(@-r!c,\(g! Ef"f#[KN'IZzS ,@ō, K*%EgtL}6vN aîUxMPJaUN m\8n0 e~,Z0 );F؉OQXV-U[RB ݲB)rND qMa2Ƣ:{w3-Y(~ׂ(+Wj1s6JVLz7) N(g\Hq:Ƣg|M}A-Cq~GNE9$1 lʊYK# 8,iՕt;$L ~hzpd V %6v{#\`2|2\7+d39Eaͪل'@q7xVtr( 5~s`tD;}cLKsւ@ԉ2תD@+w1rH,/&R,na`x4SL^6T 8]i)[.kۣuO\IBgw6: zy䕑s؂<\:oZ{Q0vvgޡBK~π^xV;zf%iAi\vvVؒh.zw;ī̷(]х 4IFn9p $:tvV秄(z93TO(&|8˗2>k p!'QWDAMM/:j+ }zhO(+uzK=}Z=ST`VI) ˆynSbԹ*b>OR6F 뮼sEhQv^8ϼĥsi fEXTn wfS e|V*I{ #_ 3)̪Ae]m{3itE6k:.pJ$ ,RArАOmF1;)/"RA 37_Hu1d>둓a67xNrZ:|[b"dF0&qݐ HKK.Sug㳧BXNTy7\JHIw$h^|ޡ`Sj4庭zAx[.\% %陶NJ"{&Qen&: z❪r?4{@~&sd-ᶽnzM fLL.}gu=Y]iOW .)ZUS!*AxHC*m]uxղ-SĎ~=kκmݮ *Λ8XNVrdVBw G%p:;-I`ښ,|܋oQkZGWrmbc1~5wZ-{Ʀ<]g _섢,-a%6sis/|̜pަ/wZ_FC?Kts&"Ed/„Oa$ǷJ&IN#ܱdqQ`X<WsԒ]hBKȒy0akᓊ<TaI`-`P> stream x\K$(=z+EAwfazRR*{f,[3Bx~*/~~/./߬ {X'ǟ.+|wzn->A`o?^>ܗ 0_7q5>=jJz%-_q_qP ^,7_zU0xch|u|DjM^o߆=Oi|y@`a1^Q` :s1P3Ea/ ?L!?ɖqզ,pҪtP"IoRۚ#rCi؀R=G=,*Y|&lw X!Tp]!Jڳ NFFɾK2"^<+t vN_;u^ZHjzWd:ҀI×wǭűh" LVVFsuBs[tSn6儉0snѴ8O =0^`OE-TI2YH3 [+7}8`%,7)=H(Κ`ӑgCSz qDkTX$eGǎ _3Oɑv`^deĤV{lͤo)s+J3 Mq8s7n0MΝg9|-C]4(Іz _Pez8w1GlFcQ2&f-٬;j4 G qarحD(-c-  @'5E?ka1j # ׸]F46&Sޛ.M [[;Ay xϘVUd Z\'bAz\+!tϔyyV7VL{>)UZٽT!͋ `_a.x*Q4!*d^YJ6zcz4١g'3i\xg|aG3B+DUfRX5::< ^$9@ h)i Kc;^u^)9hU,'+Ij9$bHXch2ƥJQ| j'OxG ز]{0环KX_K>L[ʩa]m;;ŐZ>;vÑ2`v@>$_,(a`T+JwdJ ?jë"qq*D4/r˪,Z]!g=3QjCl#i%q[|&E&SFa`ףO}$ y8PUҖ@FHY`<&=[͛+ oua/lq^ J؞㘡s azļtB[K 拉Az=ScC_5E2Qc<4&YXBȤG2Q=uM&=cace0%(xpC;ᖏ!kxQi=8ĝ 5`)Ͽα˼RC ^՘VBFXHaSq*OtÝIP}H2#;$8s݋au =g _Д˰8jIQY㻥%5Ar}0K>xmi(ݥq} Sw}h>4<uq{~$ 2#{[1 4%BZ\ri6GE>p5Ai-7G7@QFie]/o+R8Ы% 4Jn))Ns|OfrgcaQ}q1W272%G׃Xr׶ *nYrSui1v N5.́Ą6]n;?Ym~bw^Ok[ #WM+~r|׉CmmeftsŤN;}|D> stream x\K# M DA$aa;cֆ< |Efe{2,JUp={韇0LnR?>>ݏﮇa/0h`&rxwB?ٚV|g{+YAF6|tzVg ٍ0 8>?w*atv8eYmi,_ɿB4O_oO'@t `n@J6Yy0.5= #'uXIDoqspvsQ[7{Ž,4m#hzu/)i ,a9!n.!&>`7Ret9+#(J $i4w6AHѧr5h$]v=R_Rl*!PW{yz/5_0;4p6 RLn2.~I?n7) :K,I-<-\A@A~΀ش - `4چApz|l 蛘RepqZo5mTAhp )dOlf^:˝{a<ƹЎƻfg%IZ*+g>1_! DL%M)?W\yMZ6?t'֘̐WN@݉^F2))9 T)(V@%MdeFS[&u԰0_'9LIb h60 ,2$cɽ3ϕ+8)zA7H8kҘJ!2E])I0~+:wtY) p. O *%FgHP>SdcA| rRRʡ!9rL5ĘFCb=$Re6 g/^\2sֱ 1c$7&뭋 3IF)I>[<Ɗ,!ӕ  䍼c2BK 8eZIg}LcTI[ȠIǐUba} j,dyx%(qM cD.V$s,^kO@ٻv\^@BT0vNHɛQĚ]c#`-H.A ;!׮ln73\wLhaL1 kYq}K(+ړ+ў6Z߻1ZEs7Z[\y%A$ϿcFwR2evrQ]Ɏd b })my(I*-6[]z5pA1mUu2XTGIHeedn*  t7-Wkf,?ډ vs Zf{ZA-,-҈\c嘗i*~ |cpΛgi0B}=" AG @9 R9D{g&RnAM5N%RUP3|D5_2Az2.AGmojT ui: $C.e*q;Aם7hv1N10b *B6 Q,`"XW<iT{WIM^yvFmZRG^M+Q94sQ2Khr5ǽ2A/rCX+Jia(&>p-۸T_o7 Z26|0ՂDʡ;jʷ\ƄMGfP s$.uebԗa߄~Ya]nO_>~>Q_WkPnMz b`ՌIY^) 7ؔ[Hwm~_`42 ׸q BSʸJ"Vl;n%e<_Ns8oC~[)&lkp ~pE:u^>Е kޯ.TDXT)ȅ-MRoʪ~ShӚ6? abZ>g7͕DiM~B`Fb?Ь84 endstream endobj 2238 0 obj 3469 endobj 2263 0 obj <> stream x\Y~!oS{I Uwp!CN!f ɿ9Ԧm/a0g$UJ/?'vbgqҳ>˓y:}>}t~o'v^ >=i ,Ӈt{bE-F_b$(uy拹_b5^8>$EtExvr,w~ĄE̋l {,ݚ-q~[ mbwO/=o_ӯ?Odw6 +홖cY! ( (0/.ȅ_ `[/6(WSp~-q[H2[nk\H oOJqq6 5h6.(@0)bHp9JKMVYij>j¥_ReP!迷QȿkNXEEgl VE\RJ+ 1ܬJwHYI;,%$GH4[NEׅ79hOuPjϤfR԰6Ó #fLn,ߙ= OY~÷6C{tp:#rq%pCEL,e̜ϔ+tcֿ~y~sxJbAy\{_Iѓdh`\ĐJl%ԕf~j\Gqx5[`(oF.4z!%ICt҉ƑLCh3-?#sHk R[0 Ax}'%Уu~:ԣ6=4Й_P)Ѝ n<~-:pfB.b)" X&I\k b)`(#Ud-'M OiJpbIZ{:iGMYihbEF!?h`u=F~+=c r\U [ٽ$uۅ}V7uֺ5~I8mlt{Yjظ.5 TJbsFNm GeL'D)d/ԉn'=[*ie 5Xc08{Ek0ÙHL}e5^7~Q8XkAdaqsRSؼJIST(rKj{yu`֪.C%%$9ՕZ`92)YY6;W^&*P\poϙrB+b9nKp^gq^hjLVK=Z ;9EF5J$L ;$kp|gc=30Ҳ2.{q+M_gRGJ"PN9D{"  t.5c<= !r!ހE٘$9,(uFXDH2"{#3Ŧ^1nj]4oN26 `K@A;oKCy P$Z4AS7{)*"J6maL$ik̔rNI(> E26[RH\Dsq@*(~1,r#.%%&'{+bPeSUKbߥorm֜KJ[{R64NEqer6O!"+nHp\S!41ga0pM_gяV+t|/;YqucرbxLSQ2R%?-6au+38Mv^))[6 +F*q3#w)az=O3CzZ;)*0)pcF׬GO:@=-[oZh՛m{ =j8ue-t* hs>;ðO?X|f(i3qB q m}!OUN3M9sìq_VrBExdni {9AؗD3IRZ>nⅭ؅M&6ӡY6eubeȉTWNW>ǘK>"schOlq@jh%;y=y~Z+V]3,Vl?^9uBUˬ5uRYr W@`n. (3S]N е%`䬦g#hH&IΏ\!71:۫w޸e  s|+ <ɯWU:4Z#c8!Sjwҧ&?()|Mk-9M׷Bp\0I[_+u9$V}0Uݓhݑd=h23XOٛ>Ǿv9Z)> +J}5L[W*h W7P~qާKB>w_w#a"V+@,JѝcoȨ Rwŵ| ۿY%6Nzo@j&CRLtDz407.Yz9x# Czv>7Ul-spWcr/?̍bA¸u5w6р?h If3[?%1Hį^P> stream x[K$(P=B ]/l|0>]cl,CJEe̬OBoMeGWy˧O7Ar} >>}s |#r~Y vRAJ?^ɚNVuz=ʓ΄G*2U\z+Q9Y^GpZ“eUpR_pF0LQ~^n/ߦý~ğ)%{J1销g&*%x$uظ4a-|#L[U**M{}:ԫo$(\K9[ ,٬^]|&%܁Pqk>_|qH.݂]tHꍹ~-~l],r/)_[B,+jXmz#l?iMZ nVp) p~NeU?ߠ/0pBgA/As8F9Gz^wg*UEK+S4sX>FPqK >Ѭ9xJ פ{:|'RKjI34{4 EuDQ |[ )ٝaVӝ}$>/W|e82{(&Qf#w,S[m4c&ýDP5nZܩBc(G[zXN7,N Du(@.2;%ACI4`jFkO-dEStdcn c8@uڰ&SֲJ]/Y_5vSD\ ݎd(NzOXm/Y$ SLH; 1_\8$<rcu6|`s2ݔ#9?+о^i:NWu5BA о gI>@ K`(63:n9,:ϸ*ܥ~zZT67+[=Zfa6AINk DUcH#i[n~B5SkOlɀ>eGԐ4ւM$ԌPjB yk:zѐ5oL6vG#T(Wf:m1 {4@"YV)m0vg2T',(fKyF .Q.87Bt ea{EȔOxe6] R9 Â:[XMHH&Rx Yx' ["ֺ$1VՄw_֘L0^N&^U^ 5]?cٟZl,L̓])4]g hL)T9ṼSNpCҝ] f f\خC K"wS1FH z : v{s 2М5\D\LOh5y/PQ7ވup\|R LGh(!q(d*'ii=p,z>XK%sV 6wa O#w*yWZ0Hrr$SArk%ip Xz ;O);B9h3?c81 B C--yyE8%{JdBtp9;7Cqdc',+`mdXwt?9|:TYwP+ŖlX }Ӛ :#!"QW%|k%cO5eWI7ջe5-WH-e]2٣7 Hћ A&yY1,Iy5xDɧQ6pD+%CiiԳp5 ƂKtہE|v Vc66A}Y5  NnK&P .$ԡ+WSWY4 5Gr0zBYLuz16 I]~rhL9ߍ5Vи$OmWt ?z4^Ԯ*.<)u/: -9?%^?wԈ\ !%/ђϔQwJɷe/·sכCsOUyRaejFsI'HcWɥSأc>H d酧#A60>cڴ􌐎ʟ.^s*OM~p721>PRLYu9BvhZk(T U4 }3N^tJOF@-; \ KCWV<&Ҏ|, A#"*> Q;}ۤjlY[<|[- L&Bkprԥuwc!bɊ&B\'.]"¹uMp|Et!B<&U~`ܒ?HoӃ#o+*ZVl b/K>Y)hC$GDK$29[U tLe?J\HuuIp?zImlr(ڍxcO;p\mgcПU:!' w8{ftq$I y\ATOj}/}<2x!?]wʐF[W@ۤ[yN}!OSY A(+$cDr5Ch*~k endstream endobj 2288 0 obj 3254 endobj 2310 0 obj <> stream xTM0Wz[#H  {=QCKC$&Dd͛H6wO^??~)t ʵFE-֍:; a}}蕎q_P92Y2 m#/ƕ ~W.#&NMļ6~>VzȺ?w|; 47ze> stream x[[+~_!țau0V3N ~y=I%' I}շi}1юZuWU=H~?pnyȑG~І×^.o<nz y =/}8??L:k"χO@?J(Y;_iRےH,B4#*nIؖCR05I5-y\3Br[; iA"rz:3^AOB`*.sX(Q [ +\/vU8p3u 5%M8NKq $@ k4JNY*9ܞ QdJ/,0lM+("&"q["D-%kBiVY$N6,6+MS\B- EumZ n.`IC6z]N,ێ?X4Vt;KAѱ̓Onoe!뇐Od.9*fe@eϨ00o|ʇ9C{9` pȿHi&j'0VSyK! uOq0,c' y!w]Q̅m* R |)q>?Ȕoq7^(Q`bUs!x>:;0 "%Yc`-:E>u/IxdڅFKt1*\BB_랙j >{.a%͇h|s&q"Z 54"nL /^9o󼧦JQT3)š^58]DǟLwy{}y}Wd|v1.JAjhRER֌uC R 'N tj1Ith&.9T1Q .!.)>ضȚJzXv@[X#;+[6mȎ[rrJv|[vL{K$#S|I#&q38t%~ Zi7DN'KG%r-fEoC=$$`K[:~8K- DPmv^˜:ԣRmz3}3KnILX/DLrJlj[lLc/O{:#bJjqvˉ*+}o58B&&1$ѐi=q9q+bڴLaЧNȑY711FWqp݁kC$Ikj)4D o 셗Fie'Aˎ!Cl ;fk.vC6Pp ̛ś,ʶYcNi.\{*:E$dP+\701Yf\7 '%›j,(D`aNOgU*k%q~]/G3&}?[0ι t*$-{gtS.XWSr% 1i$Ӯ(KT hJQ1[ILVAyzeC?6̷<Ѥn($ 9|#|:)Pk_W7q5keO7"q(ZEHpp\݅FZ"q`+>py*Εֹ;VTlJ`O}#ᵏ-qHke\"Zs+61-a5ϓ-ժmQk%I&1woߺcWTTV1w+ CRUL|HGBq &9?zq}\z !0H)VnF 9LJ]S""I+"4 3}ݨwkWx5./$ tT\@)MJuau1@[eb:Վ^Pg xW^6i<nn_TET wX (*{f3eԗ|+fT:KIu"W|tEhsߐŠ y J_E=&+=}#'mvi0!LKA#nØ80=Ej"_!GE&%2iEKW2Rծkc%nX\8: W]lke/abrش1rýg[jSDܪ#2]()%/Zc.DE`B3dM͸TGݣI5/ Փ[X]me2p9q7%n#Β[ϐ[+Lws_z3Ր h6[#0qk5aBa="KwyX<=|bkwI> TEZr潪RiØ #J[8ʑFKVuWGIoWDΧ蜋tκ]/bmb!{ϞqT3Έ}O{`E)f``%@HJWI㸮)7jcDa-'b1l9Pv`V56)WzGl\如bs39ZWʎg^h 8W6uJS=A{'k=)>ooo/IO4;%4_㲅י^؈cm:AdW=+-KN׷|,\@5BOW4[#Moٵ  OBC/X#%|Óhq g7fXk6v3=q1To Yĕ>g,H1 1;K}_D$y H?3"RgyF> stream x\K$ϯhгJ(f{u `|eVzwD>#_U=`K0̌"HMχwO?÷txj}a:Lzc|ͯ.+>ߖWoχtz>??<>( # ݋80vx'Lϓ<2ZeNGkxWgNGx?'鏯{>|yן?|z?l(Qz:5cO-FjePj~q [1` ,œ^'G'2B؄#Q/FY'4r3Óg3q$i] j(£ħ~#[ˉq!s y:>'X/鶔a=(qq#a) f9>+8o^8Hd]Pܲs* eF[ b G3p\hA@`7!2 x#"G-G8h$:pEllMb3 *>Gt(L4tp0O~% DMr$JH5jPLQfz wf5|$nZs;rq.,sG|ftlzQe?]~hK~*Y- C!Y>I6ݝW2Y..*}b/5A8H8P@E9ro1h xSaXD,FbBrp6bhgXr$`!6t xzAa@wh%둅/ L[47?*CQ=8BOS )DsG2adsԵ8fL %> i O9 $a1z{i *)No5eQ8H::CNը}p Bkn_בcx < ;d!OoiZS0'+KCP (HXϓW oG\M*2"9rG'|$*s[kAk B| `Py\G;LQ~{&A),;--Qee\: ރb vEZ9X*]yB7YLr}FTr~e)-VޓS:@Z5={B"۰f*f8'U0򘗇:b,{r*Kd Dv6Fȑ\b`FJJD2m3MrE-%EFd)ɦot,T@& !"Wb+ ݴ=F&JaRut}rnzFuO3ץD(u$!_yHfg"Uo2Ϊ ~ 6t@wP<@m&fM9M}Я26$Uݽ:Jm_]BWK&G9`dɕek% IJ ]iXTQy4<&=P@t3i.v!cj9`VSʘB?UUTU# A_l|Сqqc2395!@oDɹW9?NщRaUckE\8R=Fw,8Yx5V%L1 ]DSlkC̼[]%I#l5懑Ŧ'Y{d =UvіÌA if6: c`Oa)+6,`/:cw$Ut'`]TG61~q-!cY4d@f)ȗ ! Q݀}sxYىO|?(֣_0`i^ >SnY j,~.#pֺdvw 1#?ħ1i憣x,_W7*&e~|Ń]ACvU욫='~aR墢JɄ+*~j*+R-UR.[YXQNRi^8 X{ΝIs8HY I LOS2Asm]eN'Sӟѹ:nngj]e3b7ϐwkfOt>7e/~F6B\L*mALxdTm#JjyzKRBiB}*yĝ}횿h' lE6W7a,ڙ:1nr:s7G4`#w> Ԣlr5kjdU^fKEVkƱNTbk|T)rhvw¦^]4Q pA[W3 $#l\:s.TyMfJM|{{v`O۝knMRuYrJN3\w1TdzR-EonYc,q8{ryuQW+bq/l혹LoAq Mxív/u&o}챪7QF~c4~C\F@kqn z6c[ls +.Ԅe;"]:/j%2r7HrixxqO[j Wgȴ}WvsV.qإT٫XfXH9gO$r˽$>F̪C>6r|-,OΉ룾Μ:xm]Xhu?Av)sړpu%/Hgkf 4Q)-j'$^mz&RZ\TreJ3]_܌RE3{K.eLJ*0gd xGTkZg ^y;M%n' fyGvZ0 4˵2*j7R2q8IdHGEtzs4'3#3x> stream xXˊ6Wje1TU$Y "dd$4$ܫ,+!m=㜣b'>qx:?_^[}`;A;}u4o/+O[2y,i=>\QdI Ӎpä,'bjo>d<> FW3aPa.܆W^q85>fqSI"a(JbBb1䑏OcTZ fDdX;I[Rzqit6%fX5F _VxВ po{3"kTL' ['$!K)tDG@II`8zEZ\+b3C$ hXcR4BMUv@ "i ;\5nu(l61va$ _G070y!dohʗ)}њZXĊ@U /$1B&H5ll71H #Ƭ#)G-A+h~TG(8, %) Peѵ+ɝ6C7`wPV҂=kvfzv2uNIVZh?CHׅ;'BI:N{ "GRH+*^j J*Ju .XP*9ƋH$I7ܿTnEِeDG3۬q%X׼ǖf3 Rh0c+5Ij %,E`]ZPZg [tK] WS /t[c-Ղ告1Ӫ}FsIm87fƸ+w#Q0&敽gNB_%¤@λ2T#|2x0A pk E6%SI@Mv5+Ôeߐ+5/\8bȒ7ysCE9mF "d9U2kIHjTI >ֿXv> $5h]&C&LSE2b.|vԔ΋kH .x g[`g> stream x\[+~_![`uz@iIB`8;>qHS}1V]WY"|zwӷ|Og ^.Eܢ_ ~7x|ANk';NXx}|/FYO:-$$|/,)O|nק_)_;oK5m郔a[ZQ\9=-Uד9*qz^r>I}:^/K>-eaPo+n\.>Jv Kt\Z4ix+a./{|Kں^ҹH(ﯻ;%./F ˄ ÎRT&,h@{xAYD"Y0ʤeI}(0SWeJ߉S'Fʾ~yszƋq8x5]+O=vbܕZ2&|/ZZQ_dzx2Ft@,3ȪQY@5j BL$=[p_@^LVu%5X˺ĬFͅAtp׸f}uc`:TٲSbz5&rUUtѕY \a͔ AS Fo,c$TFknಇ/#_KJlg`" B QCFDAIq7Mh~bЉF5]:=*zmF|~u蕦a|;ع4X='3)ć67g!ZT/*B!z\mIzYPb+0b4ߺC/-?}ٿq"EO>1mVXf zwyGRo`Gx,r̔K\Ŏ0oEWH”g0ǏJ)E+#xQȵK\幄Y!4|Yi=g 2}` ҥoŝ(bqVZ Ѯ46:cؽ\Νdppn5o ޼vdGd3/PqhhWbB; ,OȐ 'CR5PF90qf&Y֐vmjn[@z%lrSKd*r.ZÎe*3VR_r5Z#Фo*a6wh?ʎ*wq*?mdqG>OW:rNKXKG Ϡ Qj?<2dwg%T!@'`(HL` X4fzϥJZBC)$M#N}:S^<њVkzH] SW=++Jih#s{6vFVNMlb,ى#@HesQz c uLs72hxL/s.MS[ ta5٢Ā9V'S2i51L2 w 1%-km#|h𻕝;pS:s 7^+1OGx*GnnIv3>3{D)~#ԋKvIQtv~"9>q/ȮO:Wޘz邆{b馽0Xr7_yFyHjU:Ui2r1I)=`w!dMH*j aYv2ƕܭciZ!eW4`#CɥCoQmEip7@ bf9zL˩{wQexBqW@G\R$۠Bk0ah"G}!:ӈ'Fj)7=0 rqjZd۲`6R #XaLЈ-h {t@.@[zǢNҐoK WXq"mD橴6sWrύ\Y@BbCni)qw5D)r龜zt\96-v׺S$1zftS%p ,Qn5vYQCqCs` ;4edPu7ٙUL="O(3g`V# /s`y`> stream x\Y#~_!Bk*Jm ~X1kL}Yg!NvdqꓱY~g}pmg.ೕ?]J>܎:lG8ۑOYv>q_Nt4p)051> g'&k|Ğ8qŭ^M3`wOWasÞkGI \TOp) %L%!y L'q\I9Hς,{K2Dµq@Yܫ5BK@V$/ZVm+{}:pA؂-8H^>,CΣ(5 0*)Ώ *Y|Ӧ0߳FW|KTBa8i}t,$w:rdr =f }E֣->|CGw P5#[gHba\ !-2~GH=/>~~{J?8`2R8sTJi%Zz"ֈtAttZJ;1"YD ٪2g)Q*/"JF_E(L<}\{4&~ $eM@uk>A96Ag{4^>}u`#k9 vNgVI\oIN$}.AspJp35!W\Bl?rfrcɛy/X9 sAcR#4c-2Dhx߭єZ}[Nmqfx\WqM E2*Iq*ȁkl}Oխ60^2y22=[d`uʲBavPpQC.y<ƾǧ9ӼUWH>r.!vk&u1}N|&8< qX)0?vzעrAHU6|r\A38ADoB֫y&s(q8cR%t;EAa_j9(*TX*<ѣM>Va 1e 4m }[ɦ-{}8'ro+ iGcz?sU1Bҏ"ЅQC9Tj۾@&CJpnD욯]w}jSy/g?Ȼ5rMԿ(/T4*DZlIF u$$JK#7VB׈I8w9٠ɊOlӈ-_KŸ=pTf ڹ40SPB3 TA邹fE\M=al#{k:#LEQڿ=a`wT,vLPI҂ikPͲ8hOnؑnk( ̛iVqfm#i znٵ55#|f򜮏|瘉IxsϢ6a>0Ȋ&UCa_aP7 /q0GUu> stream x[Y#~_!BkJm؇}XǬ1x<`;ȣJ1,ÂWʊ㋈/ؑ㧿ϟ߮O<;v(r7OWO;_/_^ߞ,m9pNYaZ%j_>ٜ+ _p!7dYOs_t}{.? O,e}Q.y<%ř+Sgqb??N݉/g.O\S;@JZoaN !pJ8{b/躵 ýxQx~3WZ!`/HI^4}7:3H^/_ A$K##H6b[ ;T}GJԉ<+Si [V yi`̗|AN*$_bbKE5cCWpr>ŏQ[Ţ9U܅g ث5H#]Y,c,x B3gͺ$۔-;$y4NՊ)u3/nsNJ-Y\@aFj˭8\REPHq3vfM~\xy ܑCjQX /fDJHRd;F6ڵ*79 iH J?X(xq7Is't;G/ Nu %.BXAMk u=;YV,UhPt)fQju+Ih?kӆm6z=y/WNC(,;~ӇE䍅k,xK};=nWMA9_IC P0 Z;>8z=Ć]R ',\,3R( "g"VA4JQ+>ӕ`P(8Qֈ̵ )D`w0睶~D*^j#l xӵ)i˶-!}ZW\-WX?3凂4 j,ZD.sDVgj,S,6(yEHџyhcEnp^ȅFEВ{AP &o |H~6%/";8/m.}0Z(k'x4 JQLc6-Sr[zZwDmeh':AݡKX…5nrj'^dEm3[G*fe5# bHmg!kh_<60#X : nxD4l-TnWժ-d<=d̫ʞlUJ&%Nj[RIZY Kc'3W _ܑ`Sk]W24~BXX֌cBiqT pDc-*.p1S IXEIvQO!3+B-6ٵ"t˰)߉_HAO,L}zdGP,`W |8%j y]OSaM_d_7nɁ1wv;^"|rrv{VUYј9-]eلC01o4rz0{˕+H<RHѯ8}#$#r^S"JA*CLgEPk"= P)> stream x[ۊ$}(BR%$UYլa3fmCwdVL)ЉG*q?}|{~};\ZuqTif}<}:×;\?|ߟO [9ÇyP?.FY|kc>?ý^U⬰opuYóT~mf;x-֞b_Ÿpf 0|Jga%~pⓛ^~ Vg0ؽ)O\/?"Og #@24Y+UB'U5I}p/2^]dxBڮ8.#xׯi(ЉE[x&>z~^By c! MJq [ `0mT V + :hfbӹ <3oKR`q2oPUȲ>+d9^N X-vS:m.SL4ˤ+<`~:Z Sx tyjt% 8|!Fuqg3>Ebkq~0{V|l}-iSbQ0jd#(S{Pq$p c^1p).1Zvvp0Sǚ{e\:$ wye@pu #)F僖pƐѥء ݣF{s(#O%|1 _7qha#s$Hɟexc䚼\I繄tJ|+K6Ws4*Ұ^5AV%6XIK*Y %að >XvГGY{YcJ 1fØi/CW,MS+2%9 HP%>wsTG4EM4R >NV\y'Ŋ]EgY%-1q1 - Si6R=Q"\EJ@?D*L %S(J" Ȁr ]_nhIP]֌hS?浲)YmNۢcls8%re? "UƮ8Ai^$y8#%^Kv'wR`iT?26MQCKl!9ܤ* 7eaJQPR*tE͙crg֥k.ľk;IW"gT&QA:޳"BU1V*dbD! ѱd[`$fvO5UcoN@;Ȯ4zR^kG:l%GQ6dL{abCͶ9T*?kQ[Gm\wXNG3?wjMt,YMAuѾ]|<^?2a0fRۇ?S2YKrfdp'),sU X<̞cAQoE@֖ *]^ KMq^f蓃YP[Y"|t2۫ lG#AULWs QDxM$[wre\SiIQ/1Xи` ,=ݚвP;dzKܛY;Myv2Z"%tVIG]뽱m&st@3C'[E mڈݙ@޵ȼ7.–.{᠂4ՉEN ;YED7NS&_Z;JJ8kx~Ofߨ t;{`Saw,f |ۧ&EG#Mv%jPTӀLlp@d66Uxn®4 5MMR[}n. _13 QJz/x)v!s*J&ghS:i>y(s/?+uyH8zܔ+ LQ%RNnv/-@wjr6R6 XvwkNpWY7_}xOAn״Wx\|')H+ bk@ endstream endobj 2543 0 obj 3150 endobj 2558 0 obj <> stream x\[~ׯз>u dI4IimM %g7$i`xGoHΒ!GA{y}OW_w܋xP{w~?՗>^~ye/WB?uig'pbypo/^wo9d/a1G?u6 堥DD9u0M>L /tW&fPq>hRi{W>;aj*귻{{/;+D}3ǿ^}n?&Z IovaoRUȢ42 [#$k~QϨZI}76TJTZʩ4d,TZl*fLfQfc)ɥ`N٨.LB ,%cTL)Gi2RaJD*-d4zf :E)h&r4KY'RaJL*-d63F nKQ(f@R5זY8#8J^™PGTNQ2wx ly 4e<, 4' qT3 0ivT&=pMs4Hh(]30 4eAx$|ɾ›xS2 QnL[}ɘSZAkf aczs47iЗh_H%TB~}<;$ʵTDP*(#8Rz#] |#&X$ TE M,_I5 ITJLa7F?_q1/q1K^O zfK}W¯AWi?/-SxVίլu kt6HJ^OQmG6By+ |6_9+|ˋkl?\ZtSk=7̥zvߨztKpa^K%RN% ][.ڄ9Γ aAZ~>;^WL+FU_"溏-:+җYq$u\cf<򋦅58TO^Qh#r y(|K!'# ׀|&$iEco|:qʾkcC}AOXj"[ۛKoLVatbK߅갊u-Kr1pM}uwE!,};aݹOoa59TOI ,eKDcB=~3s=ٸXᶰtAfo~"Y.m_AoXU~")!Dp}JyUǩ B >ÉLG`.n飰x<̼+q:P]}²`߀ϋKo#21DLvH*qC&c!f Wl;&&c4\?LƩBL 6w8]ְ+07LDFtY2SQUڞ[)vA O*t|&8oZY?X{ $CA2yuiר00p~@:4pޓ^FfCV@}$v9*f_m[#ء3@94iQG߲^维0l0`.WM%\ Bֺ%7LBrj.$~Q3wQ::yg!6@pzŵF5IS 4[JuC༘se5Ȫ)B{olsFm=pI~S֤'ݲgdIH)< K^2)wfDNEȉ$K)ID3=;pb֑0쑈B ERb;"0I7FbGEK JK9<Z#(f̤RNfSi0+CNfA0Kd&r2JYʌXfri)GF2D! #z0 @XQBR1"G|G kSES; J4 HYbiع*4n`͊" _p,@< _p+7I uPH2OQrQ\29slYaZ!Z.J'@21r0 |{@\frOK= n&ҒnOYX Y "CO!c׆$зW@.RJsIj kGXq삗31hGC@tG`BG~˖.*Tѻ~[.QklY)7VBFB|[!$5V}@kkq~c*Y t@<;9W ޼HJK'Ow],q@jx4TB3­a`Xu{^ygՈtBX!:Zw/'{SL%NNJ t‰NL0Re'QSS)ϔ ?.gCX_&-ijBov:jxÏv> stream x\Kܸ3$!`'H=8`Fělq *% %W$KjG׿v_N0g8u_>t?|}>|Zm͠V@ΌEDu5}dnw4)I(G%RD/NS?'gݻ?u֎Z : Y=~Lh]jRqL\uY;K Y;S΁#qވN5 R+AS+#s+_ 0H0d8abQʆc+ʭ\s+!V2Z V4엯ɆAb V.'é ٲ(@)h(r9έhęލ-YJ5#[b(1JFR+Ԋ9L4 3Ld(r9N`L-1؊r+ DfFvA)rB92^D,uC(cFr( i. GhQXvc%#@Řncj$$s+ TF㱍DB! 㩍 $*" "Ր@xfcJPxdc%*HpiR+Y` fÖa@Ab}c1)(X,od iu\ dcXlӥn l]u&މI}Wh|TKȱ&UBK{|ٴӓvNڻ}{ˮMTg" ~-݁2y#v.^/%N\=G"}88sCk?WิP}-6.qoY5hYZrƝ`ZWฤ)YI '0Tim p*~?Jo|ڹxz{4*ս{bs?,;^OoEBQ}@so}V*|js_s>a iz\YOzO[Rc =OPF0?tF2W4ҿ(F5-mi.چwؚ{(|7;E FWwJñ4=K1Έgߊ 1yݢK_Xu:1%Xfh[1C2yO.'N>%-_u4_l=vY;, HNQCxZ 5yp6#U8xsâF])(/ 6`k?*B9'q>Yah^04aֺ4jrυz %>"X.nKfFsȨdBW8 c] V_ڮT7:Qv2n!ܡL7(?aIJ%d@b: 9Q0a DT ϘMa9<n6|f}l QsEȣ)c"}=(2tu ;C>͵绹tr`p.t\*BGt\w"Y~{I9k$J6%A6-ʀ=C_3@x> /t;D 'vaI:Ġ! Dl(N`|nC`D`Dw膶wzPDi p޲lB*9Kӟ,~dW|xnHdud'C do{X;A ɮ[=Y#ud'C!ܡ-V0ڥ%.y`^bQ~"^t0$f8X? w"墾e1~-#^,F_@M5h?$Ij!Vm۳bQ`DM5e3VK!Cl f}>-1t?%+9e@"'3QP%WU#>63݇|;&kEΫFwϚlvYӚ|vJX*, ~=RCBP8O>Q`D5߆u潫P%R1yH%f@>KՉPZyJ۪&F>3aCh٪ǩks[klfZ{LWH0Y=At7 B8Cl"~mb Y0?Ntt'NRpnh{~$ !&c|AF?!s\1BsZ~N |fYbRklz#Be=7QG2Dd`h{q%B2 do}64xdx2;tCۻ;VZ2`xRDJzܾ!L*٥=GdD9B#"t+u~ALc8b&IL"0qh۞-؉ f֯ e-'ސt!BA+xnPNvCnʀ\aO1r1>~0 0~VU"(,{dx7Gb8J."b\hӹU3k 6p-Ɖ!y8\8!s(Ppnh{x&5"@=pTR_(?%,_a_Ww}*b#;Ð aeou%Nr1ަ7hh›X4uCڇ!=GID?Pm{xdFRHI!$OG$ HH&hQfم  7IH+,(kZn 5ti_b$cKV>]D[;;WD"uFmOD`a|/iL"!ܡ zfmn#F(}v{q7o~u؇:j7n'[/޲ƞ\ȬvCm>_aꔻ|TvSkYѧ\fݿ#c endstream endobj 2678 0 obj 3039 endobj 2773 0 obj <> stream x\[~ׯзxy[Y^<$>@>$Ӧ45ߗrZ.wJ8ߐīgO?|͟>_y}gw{6{?aӻ]Cߘ՗^B?^\+G{Iz:z?ǠdQuŸ C9>e5MD 0TTyRǗ/[NYC/#^=v]aTܓ~Lj/_H? J~ -!#}U>?BK&8368)c3frm|;6r9=FJfAbfR.g4u*Ei2JTdv*f]? $*lJ)Cfc 1sTJ&r)\1s2d6Tz"%fJL.r6K!514!RƤS&&e@R5MX$0|' KS yD!rxL2H쁰 y 290Ht9V9 !2@Lzp9 !NAB@O `(rxQ5#9.2:73 QM[&6'SOhfVڼަemfV2cJV`|.!fX"T.%L9C9r)l8RL=.ʟ ȪHKSNLT SD".Uz'2)_JS7߾+ݝOHxx.1~gj07{й_qL}p0puo]Rܡ;U`̠OqN,5Y7(;ݔ*wA%0LZ>6߃ͦ^W!0p*Yot#yye!J4]bj.1F"tG@K5g\a[zʎ#L"d< x*9J> [}M׸ ïQ8ճW;DH~lu|$LpЗY)U;j0,qѣP'kWVy5v^](/*(jFZ$ - ]Tښ 6tq&48Dng)H^:Qɢjمƙ8t-tc DxjopM˾ڛ˲wVq#C8nXCӻ2yQ2JWHG1_-  \7;TIιͥ 2&~ C%r ᷱoNV'mWMR1V[oMD{T 4nٹ\i$5"NBpZf.e%( \gl>m kR/* ;'}#~\"x24nѹaa))OpB)xwlu޺g}C}J0&+ʏk} |t1vӍNt-T2IBToÙq0 /Ph:tg]J@lGfHqdԡRS)!s)Sϧht J,\l6F~nƠR)ɥ\fsi0=d6T ѥm+HƈR&BR5MX0$0F|' KS U:k6=P21@ *79 49֬9 <a,@<Rg zFs Dq+^gGKG~SrJrs*/v;I!hg~;yXKſIӷ.B;8x3 MR*BgppT/%7krHg #`"`-)?zDL/|MaC6Mąqk˪{Rg4vyʛGfuޗlK/p٪ݘOK8"ܶ:V7Ip&Buu_RtZ⨭ P L# "{x'KT,@ck PmD۹եab0ACNZ܋ PaJp Px,]?^`Xa&kok A ?Sf0Rk[lc?ceG 怴C \9Eqajt+޷-t(o:l4-+um~ԇ&B[vn,!o v^t*MpB{r%v$P&{fa.2.\m&8X,Ӭ1GǮ.{> SUݏ9 R'r N\<ܸl'wHKկrou!a G+$j8DTKð*Mm IJD]|NK^0p88Mɍx"Xu:vQ#^oc~ENe  qKܺDckF8%i۲sWd'|!Hsw.W//PXAT`tkt.jt^3L/l9>>emԕDF5@ vUHjD!x¯[`sW-WՈt$B8aw{ک j#mBx{w]m?AwVn>wT5;<73‡O,KE7^M=h'絁qaef(Pj endstream endobj 2774 0 obj 3785 endobj 2892 0 obj <> stream x][,~_1[Vw0;3 <<8 >q$Q]$)@=.U}*Usg?|˷_7קbO2Ӵ7=ף??x78 (MCKp;?=e9Mũ?>nέNe_Bl@jO3)cw/d slĉEa1/S\1w҂yMk?4$ KnXiL 2I#2u%RΤˤW K/1BԆ[12+ۙqE4GeHU^bTze;1.x^[12+ۙq%Q}]a-{Q8"cxa*S/1*^b`tSOievAջICe&W3KL&1Ɩ`̽(vf{P1jƩ^NK/]2 &|. RCKi6hxIK"&pMĩEkV.p)P85!-5 ]q) %nEHV\!A7pB*j$@8R!phEpÅ $(F2x#+.!?QOVAAsR $sf+cR\*#ª\=ڊCu88nCS}CmґMށʡڸ=}ݓw}?}h$g҃/@|ݒxU:!LuKrx&uKUY9nI31[DT׭3q(X}@X-yp gM'A%9<'fojU]cT?|p?~s4\.o'Gۇe]1_>{w'y/tzKQ 0}>/b΃<۳1l<\&<^Ƴ.&7+4+@a%|x;!a6?_~׭[γv^4⦌y@₠ܠLPB(;0+ے N|.ђtsIZw$p$\K>z'c#JC,Hz#+o3Ӣ T!B1#% ƌpo#x%t(M;_l>? g1^jAdn vEb !.N# X1p 4>ՒWOExskø eベ}1yjw&\)Q8Jőw:XϞh#b8 {u})gbtkqP=od8brn,0R͏O8 nxf>KK:Oy ({m"7M 14eMfr[;3.E_͔f!N{ҵ&6b}OLg *Ȟ/f/fNWcBɍDwvvᨽ*wD";pdcSb)e4qSn~\9#-e[弎Fa3i`Pc`:{\ 5S.: f0TP0v)7͠P]C͔*C0 ݿ\(a!(rx:6檓2UNX2:;>%*>}xqbYwDKR/QBGhvGqc?DL7Ssy1m/Nf!c{.zqj&SEHbKwGmR;ATOX=DvJ|s> ,:vKc)m)w᥂jB#x:#cKSY!ޮlKJOGbKw.k3P*DBB<(0pI~}j9 ƸJU_1hRU9FS#fBB&"HimLe02EWnJ \QL1; "bS!(Y ޖ)Իpˋ-8!QNWQZ2>>Q=@R1jC!z1 cfB(bHymQe0FN:4@TQC1یl.}蔇@*K:)9bzP>96aW8Ju9|V# A,>fbi 4]3#.9qb2$x@$ٌ _aю<|_蘬*, ܵ r ɵ^WhQB<@EíگF͚Q*BF*}w#h)Ű_KE:ߗl3fS,!lOAL3!LEŀl3Z5)wlNƣp=BBx+|40Berk_o_;،%ia[E|9Fpȍ 6h8! ܾA$+N3 BQNܩMI.ح#h\o\ F54x)"7"o_ C~]a^#^ h4{ \ݘjto>2b腺),nܐ.Ma9¢yyMTn- ĉjs˴5Jr"‰ F&ϠW=;z8<Jך^P!'; #T>]{rؖ }_/n u-W".'b;oJ)=^'69m2w/߰\, 1vjUV ,.T>ؕUj/1dpQBTs"kpjmpF͎ҖFcH7ubS12MoT8}K'3Cڛwnp\-,-7'GqֹEs? ,{$c.!wwQEYi>\2U3hhR@b~GS`BBmX ^a@iҳNVw.KG U82K;mrmܺ6qfE~_y8SJ)06bH Chg͋q aC&;KtSbd+`1;A^.K5i5x/zK$&2YC.#geeXV%fMHkS[% ,t:B#SKywLZG ;۲宸˟u@hWD \IydJGTPʍ&lňҒ Xkڊ7yd*8dx}ylp A/<:8@JƵX fC]w ,ҿHݒ:7/՝"Zi+7Bի \ZR\ w'%(u^9Y + 82mKV\go κ>i;vq64ҭ}@Cz`k[6{QThƤ?S6DsvjQk}_ ww5vQxB\=WTB6u$p`wtvznrU츤7nb=1uBrhYę S{,k{7:ze~}2iH$ 'iU)9n"c C_]!BNel{arTe-WI 㻮iŵp _*BAY=[GncƴUVM-U$#] k>l.=beǂ43 G;a.4;vQ#k`>"41܃4(H'dlvZ4H}cGn;6 ^~Fv?OG endstream endobj 2893 0 obj 4487 endobj 3006 0 obj <> stream xVK0W 74P^PPp1PgFt8 ޓ$M_E{}礴eWsyz3n}PB[NU Ɗ#OkyzO?ֿ un~O_aj:^ %=9_aLw=ᔍLM\Q^m\N*W_=M}' A/|g X]pQB$6xa$@rc]gFRtcD<ibFap'|u^Ԩ i+[dbčY~OHLͻCFmeW|.Nwtkwqb}35lD#ZXD2TQeSg%^M78$Y jf9zR&UJq ZA7zư*XMְ.YYԸeA`XBQaӷc%u߯O %;u[ `:w2C{ʐR[f rߠh/Wqdq'l+ʢ\dfu> fR` -/IC[vTY9uưwB #kHiZvY9|T%_@P*,4(uΦ%nUH<"iыFuAge 櫲xX or0C/E͝To<0ji: [Ƭ\Ϯ4|u#6# < BG;P@-5)jxz 0'!Ak`EfQhuH2л z=C4y\S!Eh(q;IM endstream endobj 3007 0 obj 829 endobj 3012 0 obj <> stream xZI,(PZSPteU16aa{clx`;B%xbzݿ^>}ן×;Sz{5rӷ;u<ι//ag}Nkؽ^:ޥ|-=~VG}>ZCmS+x96d0? ӿF?a( 7;$G8ǽ;7D#> 37׼}6hiJ/,=Q4 rXƒZg+TfJ+,ij6R$-roqMpq,H7-6pQƦplT.G ` !oo!u% ~,9di?Y>[`ǰ5%MSN8%MOJgpH[,) Ʌf@mIY)Kd =ۇqr_R`&NM']L,#۷#Hg|'ԬԳt1}6[;xB? N :cvSIJ;(\ɀm,8U#T Hz=LH:JY)rr#e0ֿzYa^r:t;C M֦KR7&BR7?#>_Goi74Y 񮦍Ӻ߈ډ|bDQn4iV⌙kKsE_Eę3dʲ4SIz@>gg'ClO ;P HKTD3hω57o q$ҍhck1CkhZZ!\ѵhB{C_ds+$]?ڝH-mShdio \3m/PP^ͱj\*"Zo]%pP$6Pۑ}F5Y8n#| iܙe'"-<ɞ+!D:[# \A i\=Z5>q/5 ) =}/蜫6ӑ3<~M=WX-.M81کxdraNLl^osxyM,lVJ ZN8F Z($f?vEز$C+X-F0es<D[\^U}E2*>]겸Q(A7$> 0NΣG'Cumʆy%s:t< 6z@ U;&h)f=j<6ؓ'u7=XW[6Kf'qդ|d< l] ~I,Ȫ/LiԜ;[ Ir9&f~PK"dqk۲΋Ǒ^U*_t \v[>T|"(_7Rʷp|Dܕ 0Ctqi4""J\\lS|xszJmnaO( Uݒ{=~Ǯ:cy] Cg\{Ojp>B6-ٻ8Mqȶ4̉gJk"'6)3ny %CZI$2iϙ1 )7rfHXDDʹyӠ(M"&Xg:m Z GݐNaF(0Z{T(]&-:Tj3YPb.{ | PVZ/'<T _&}pcVA`111YH<7{[rN9 0.ho-ɟ:pwD 0g%QjQ2p;WB+?>qEGmv'|-drl#A}(^+Z$hc#RZF0肕M5 0+[ޯ[dS!2=,N^,^PͺS|od,RXUrS'k&0.hx.MXP{JKL?1%xm"t)po4zAn,Dn,$P\ȍҀ+>uIrkE5MЭnֶw9Q-A$CpTBJ%ڻ`'<SCKFQjR$y|UD+.We-&S0'G]%H:2L$ֹJff˩ [=9i6 '<%":{-něX,`1qJ5 \26}Եt0%5룼eaAgfClV$[ &|լc =SI#s8Arn'K8̖nϟR{fEr)JXeek΁Hֹ㈀Ե䇸Wliun:w_!6+])aqbh'Rv5o4[ &^-Ki7FK0Jz?{l)ׯJ5}S:3+A ݍR%Xl/\._Kw*]V1΢}cI/ʊX[EkU-]ư_w*f v>w{jp$N(AW}17B Gw1LȀ$t-qtƥ&vKn_= endstream endobj 3013 0 obj 2659 endobj 3059 0 obj <> stream x[K$ϯhнJ( zu `[ 2^l{G32jV:ީ|㋈/ ;>^Z^}NÅUq2V\ӧoO釗;?7_-y~_^^F/C;}qbj>ix|Ӡ?j6#`#Vߍw=ohV0۰g'6sPYLL`ŖL$,''֒a' RV~֯qXgWNCr[ +M >``QmgJP|M۱; \Sxdtr (ubSV@hdh u8q9O-V4)[pCzڱ֨&ywnzݘq3_Njnh xq+l]i!FZ.B3{0b c2cube[$Df%#\$D9$q kٰ㍞YkߎZlؒd^+RS3Hr)*Ml|$QwLόFT[ŖiSs>t:7jZ)eof+.f#Wqwo{ QNPSdXe~ Ꮩ w AJu'ޓ_@H`60L7V1d| K#4Yߕ0;U``& pvI!$Ӄ2ы--b}U. , U~*B+) AԸ]Uaϒ"*z/V%:924Ew(P)u tf3RSoPt)W#-K'\0jmDis$T𱔋.-  yH63/% S">X `[)Ġؕ@^[uzH$LPh?4D H'9ErUl,$lvKK yȔ\gJ 4T瘯+5uhpV\&Oi!d"۬XmB/3+^g%P"8*A.&{R3q4OdQ n &z~A3KJP0] 4k|^DʙoE𡭜cw(GMfF{]qdž3jojw&mlWх]iyC[;T6c% 9t7 "p(ȞiGI`CK!I"F5JikfU=lK<ƅ?)0lƩŝ$:8 %!\`/8M7`Iom Ý 7^֕7e2[j>OrײT{5ΤW*qG.C=[,ZL=E5q(oJ)!F]Un*CGYũh;.Djzs)\Z:N9o,OMk6PzU5Aâ 4Kģ; 4·z !?ݜNM,K ~,"!"Y <VBHHxXi/kd#D dVu0fזVAvz`{-T$9ʪu` ļi!g#uCw@Yw~#&}yYu`% |2A"y(Sɿ2*lnB(&/ ,C*F<9 pE˰V*]H'4~#E0,XxoސDR}U?.IycrE*:)h:\fWa G@63${8Qy~! /h~;2Bקz endstream endobj 3060 0 obj 3146 endobj 3112 0 obj <> stream x\I,I_QNb Hր hЋƅݢ {N'ʪ-JCY3FW~˧/wrx;WqNʃuu9|/y~W__l.q/o/ m9pOvUr;,Z ߎv5WcVnbl~El¿&jUx9w|or/b*yX帬 ^a58ƏvDؖ43L%+Oror}:|`wL#j9 r@-0_=sF|+{cj;鲡f)%3?QHJ.7 YO/s"`-ecH3\[U"kZ$3Ƈ &3xQCh1HA&ϙDE#`O +ٸ<9KQ0U$L$RZ8.[Yf"܀x,P<@⣋P~=2S1&jg(/XR([n(ڌ4 BAܑ"EǕ^Ε^,zTˈ $zEh4ef{p ^@e9jSH;n0}ؕ Z̓%Cŷ'v.BPi'RTE\2B4U*mb| Da2'e23AAO]uW*$D#T^"0ޔҞĞRA%)ޒ엒yG}%Z;Gc8^p`FJ{uEry1%.EqU"M5 ŀ2:wj|$:qTkdS`tccxZMZ/<dD%(ٜd)UE"[)F)'Ǖ+/)t%E F~Tt2y> V}Z XL593.S%'I,B墵+I<%.ϡ 4e"]Yѫ \6*~v/ ;i4EEd*!mi%`A`-+$< 5%=6'4rc&l:#4\ 7g)ALJr'(6}ge0EznVn&;pN}L]SGƸvMp"ҡ. Ɔe o^E^꠺N!y-CTiN ]rEK%Ӱ]h&.=n룔X~),?%O$d./FW[TE"?p Z}NP$8:2?e<tn'$ws2'a0B2VXeNyT=[;u'OW{4bĽL=]6L-=,<N%TO% 1ӈJ7 AǙ70 =_n`sz[F(ͽE|T]צbCv\i`/M3;| 17'SpW]ӖYJ)Ul7K^qrc>mqqzK04Q|$@j٭\m51"CPv5+Ulaf)- }THCrSO μIGZR"qϭHh'F&T"@ VgAIaW3`S9戳Γӻ %S"7gIYk~G!2U ':hS0 ~H #>A&h ma #Nuj|+iIeaߘ"xw֨:F)a^lig:}N"ɮYTӷQr4`Jq),cqEegb1ȷRvtڻ2NXKWAęݫacC[I16 `"Hl6s Zk6lun&yi$g)(Ew~Q!mceiOG /E$</ ;ؘyU:k(-W[)minj٨H1 eN+HSђWYstWȣ{A6wxܫ+u1&K=\c<V=w*Bh_$T€=ٹDF|, rrK bU {VNӇw?Q[Qr_yMWy&h0$ 5#_$~d7p_D;I͑4&hr94OSUS>a:͆um>]vj>xj4(#LJfZzȢU6D-X9wM)=zwo<nԓ2cK&1wt&1?m8pAn2)M:n+ ߮jl63(}37_YaU6/T3do] Sz$߀wm 7keU3jEZޕ߻Ǯ̛)ςMA)|lk‡).6n0 3Y2f 9<љ3nId3Un=g>OBhonb' o.sݮQ[J`]Gu*G؍kֵn %+!\[I"`Cdisp+<_!pl Oq7#uڞ5>c|ܞO+}]l kcm%oVQgNz0&ӵ'PnsahuR\ǧYMh U`߀]S:J vRNHQ;]"~}"5 endstream endobj 3113 0 obj 3453 endobj 3166 0 obj <> stream x[K$ (5 (mBlﮱ6l{KT2{0`j23" 'O^>/˗wק؉I;}'y9}oOxOo?o?o'8}Ӣa9N~0}39|a À/\^ZŅY_wncV.xW/¯/q|G"+_@_Fǯ<2f5Q(Zmy^W?\LYfO%d|*[Ztg[ȧ[h8l!7PZ=POIZWBe@eˮTGU!Fdl'jzKg%Hr,I=3]g~Q0hІ볺*.V "܇[V-AUx] VxL /2Lsǯx o X(z }}I/x_0?'>sx k 1`y e:0`>Uҕ8$kV|eq:\Hqc|$adP9N`x_ ke"*X~n] Hh ÿ28;bH0! !0<,DHv6Õ^ A"aVk>rE\zuD׊ q*Zhcyۈ5zoRPNv-hWAQ+ !cs3s0ʸR2AlF"5 GfXe xCHB $AlaŇs{ܽʀdWԭ8'9H*!|̓_Sep$NJ]db92Ƃ(%]cQP٣O1\%玴 1h[\:Z̼BLWmظ| زQ"+O\=oV<[`na 8ǣ,&|v0+N(ǐ G2³<ʈdwpXkHop S ˂=/ 4|/>zSfo97{Slrk=-& ѯ'% 1GlW/%JVj|tO׶ZYCJ3GG %Cԧ= N|D;V iFyyT5{xd˕ZZ!FN v;[J6 )lP8PhOSrQ3İޫ{MXOF]XbLӜRV a4R`T9mp[Ǒjϧ=./nG}6I{^S瞚:Nt4~ ȀRA)>7i\U}hdPJ=em^D*fl'v(=9!ܭ+Er 9*l,W볬 !A)p)zvM(B>i Ej2îě`6ѹ/ɰA->s'*sܵ9Y\ڝD R(r9%g]&ň;"GHޱJxʣBWYHu}>C"8#[Ws7RS%F!Ip0$5[/AdOZټ^j@=l:N:: ~sc%@.X'9]m ]vסyA,3S Aɚ?UɌ5_.rǪBcNUF?nW( /b8\+EHF*4v"HS?qRܥKO[ endstream endobj 3167 0 obj 3172 endobj 3220 0 obj <> stream x\[,~_1i[04̒$p1$)n%g11sfgZRꫯJ3ӿ>?޾<4y2޼e>>t?}|~%ϟz횆?}rBoNIwI,}<} B:B<ۢ:ٜ'˳JK`ȳߋKCWy<35Ψ"ik5]@'a/-|ïqB\n>I\f׃:Q)kRKOB$}}ڬ\\ƙQf"˟>~7e Xz,[vaDg(g(fJHFW( ) M땨QMΣN5JHP[TQ]7(^pV|O^TfaqsE\--vS\ K "_;;pabrV"Rb//`΀:32|AD sg{ w.|`.x*\-fEer:;,/׽p[~& s7r^TعCQ.9L*l2Ye? owzd^X28R݌2 [pTDXԠLJՙ`UnLd_P`r.{vC_0pUЁ_EhQ UBd2K5k^5&A+YGJIxCǑ4+\<b+AA7)ޛsԛNt?u\90Q91gF)iPԇCŀ [Kz_X,]cগ&QTp HU'VQ-=W 6︋tHw1RPƑJ 25PV%B$IWE5v`p9yhdK{k=;3~'2 g~O/^ ezks7z DDCHgm+ta$ċ_hq٬;BgxsSxmIѳIdHEÀ$,jL^!KI!|()[xi΀"*!&kz!@ҭhn.W* l 'hV(*\@?ι uă^['k!F+ *bv =6X-wKH\0juPKIWp.{IƆJ%6GHb߷F"DR ҰH a}&?*)WtRta +Dהb PiR P$d5_kZ Q$!`#ռJUMTI%so51cܮ vrwu+e`QS##wTD@= A.E|kC>rd:pYX.Tć"r 잋R +~Q76zӴ;{7m{$$ФzBO{r {Zcz.uȤ ~,ѳ 5;!HYXG}D;>4D[? k,嫺F[1޴Dc-ldvS7ndY12mw]d N@3DRZᏗeb=zΓZԿ;<5>nGhz|CKNŻ MƮSpi7X:v4b|f{ l8{ك*NߞIH: lIJE1=|Zn+p0-ؚVjMhIQНƅFM-9{ĥLLLLt  iu)(ZE'i nz;uF-w=ȂdZ5rp&sxd!f ^}\<0Bl#fFFɡLA1jhθyF#!,t2QS4RDbgo#a s*mdh@3l +2ngFPUb9vz]+ jdk;*&6;2EBGeI;h i #68NlI22"Z%dDCړNBn,'c8f)dq[W9Ѩ-]`(kA$ `b̾]qo# (\/E  ˳Kq֠B}H0mDM̄ joBߌF졖Qkz q^ƥD}lÅ( Yvc{1t#;FGb_ 4qdDEEx_܁FkS+R`I S% t/SߘmҒۙ(\ /Տm)9\>zԍ# [E}Xn&PjnCpfXxj^ٷ8rA Mb%ƾ ސs~ JlA Fdx,up2NS$+q\,uO-ViL J I?)9]B^;)ߊ`\GqZo}:G 鞈埈J4)-(*j)CQَb _dQLvMB)r gF\x 6 endstream endobj 3221 0 obj 4082 endobj 3266 0 obj <> stream x\[,I~_0s4tW>, Š˂G䥪kY>tW""2j?Otj}牝؛8i:~_~|y_>Ͽ?OrPO}}X~oO_݉g/{y||Ǩ<m43xDT/MM6 /\=$Յ뢧<;G&;O@.]*CGL!ٕg`XQ9I Q-dEvH9>Щs"xV &((tJE @~! MSDja4[[`#>@E˱Db8LS*B'rlh -7/wDJ1G23Wq 2@uk=Hܱ3I?$bsHXH)bwT##v^,XO:"G)nN8$-Ϳ[U-QXC -GI'X|w|3M GaN5M.pV0L5jŇRZ_]yEo=дi%44@Hl WmSm`ڰ7wN`/J^Yo0W 0 [{–8;hDŽ;[ggEx{'= <. \XE__WXP@fs4NhVHufU<R`/K9ƾ`t7"%"\֔ \lY PF:} ' /Xh<&8py||aU@\ɟ{0ΖҎ5S)LضsΧԗ,Key? Ӹ~{D>JyK0RK/KQť\LmMMD'֦)Ίh񆋍dh!# g>$\0h#4<5P./vRj#^[89+CHĨme9 þUB2!~W3jc),)=Y`^) 2ZE<#挩γ'SDXfmaT]Wa"aGNÎË}Ԝ,D#POqɑKR+\5BWO&0zw".pM. p*3G*/:d'@[`8jHJtR3xl?'gs$NL*az=UϽTӑKiM|2%r|I*SΐŬ<}<>Iٿ=ܡ,CF(l6@ޡeꯟ"Na\zYa$)[I?>ˡ^n,%v= Nf%gV*IX%7DնZ;mNM[4rSrԋL׼p ؠO,sC4p1@RJ}n*R,h*&yKh*frF9|62X\Mx)M: EZ; +^{5;+Bڰ]D.ٍAl5yy|ljBNJGb=65i~WN=|/-68uW\RB.SV=FGPO)t7ތXoMf˾H~8Nh|ձ͞ f[grT"Mϡдx=hjjU م&%2S\f<Կa&_<_iP%8, MTHEm!i}%o,=sK+Gcv7eZ,CCoOHM5axYfA,M7\ʎp5kibƾD*IǏ6qڮqADBHltRz[z{f~23F,Zgoߎ]}ϛf%g͢Zz)~.믻|}^k]_b~2B}&)lk}"޳mD7נV0T0Up}A2F遻sxoKʮ h1p鐚+[&Pr1!֑B kERV0䝃HvR-<2M赼%.} -MڴȰQɁK)2np5AWK(Y3~r~O&?2(134ᾭ24aN=3j2er8_pLJF.>g(& endstream endobj 3267 0 obj 3569 endobj 3316 0 obj <> stream x\[#~?BA H#$y0yc;8, I}V7dH0 ڕ4]ׯ*oΟßpj{ǁQGyN᧷+w>>}z`z[y|q.`8wOwy7'.w}LĮڅsGu0.l%n¥M_?mQ1$: —Ux*wo ҟBjؖ?4{%WqbY(o5IOW ++wO ERX */6-,ُ`\ e# {I-+x17u #r+ƛ 6()[]ƆT+\Ky4'<4yרMDhI؊EJlB2[(.'QLW8V|edj.YZEaWn@Ry\o s^ЎPm}"+EMnI!6g#0-mcD c})Ȕ;~~jCVaL]vjze'# K<(gL.>wgAJ)X~ZۻdRDH҈z-UM{Lc$B̢y*L5RN*)۫T: .\ E-]p!A]*-xt-ZIL[>5&1B4v#7>r4q/ bΪDCt0\:+T#>JCA` l,&{'o2EKoA'!65 1@,cFs lRP*ӌ+q:̢Yo!6Ŕ1b!ϡT18.Y:>&5. -Q36Z|UPiÈ[E[j-b!` V@{qBk ;f E,F!"g`@u}V\0 2TM\r}"Õ@8DB| ")DV <7T$FJ4db#x1~=Z@ecLX,Z7^?';jJlW R,1`@W'vKYJBh) I>'l tCs"9!=zp}ud_) "'1-Hg8LTE=z3Y-\#@1*抲|D3"ft<&p oë*kfd>IuA1'5x UQE@6K깰w[QK7 jBU9 YwN&A&c:|`_-u'/dU8]w+P5h"K`ɵ-Pv])ִ*;|~#bRkrǴ&!{)G(*V*W&kK`"sHyx7C3Wz%.ڬbP|x6Dڋ0umm hh*MILGyuW;H{Rr5]̩M9uSjb+ͱ^!wK8_iGFEdբS^gA\MdL2ID8}6;~^N uc1`r]q^,f+&7is /\/+Tpѻ«fJC/*yZ._{w*m%dnĔ956nfWm2|_VAug&Qə%ޗEffxm5F|JRL“ 6Jg8cwC(fFN%b݃%hh tA RCOߣFCU02੉bNE2b 65% -p۷_kaYk(w`ɰODV?xj8Oo8pS <ބ6eWƒvg\p*-fK/d5NfUї2zBǖrHײ2ۺ<9*c2I:bV?͵qБ< ,w1)=3HB3:sb>g`"&~,e.\[$lgc4'6}nׇ endstream endobj 3317 0 obj 3886 endobj 3369 0 obj <> stream x[Y$~_7C杕4TuaA0% ewDWX3ӕGDח%v}~ӏ7ۿN⠝>Ƀupn{>fv`¿/{{x[4b8O޾m0;(pG3"FQܑOEH'^LĘ6 G`EsI~O2!G oEX'xKHG"7gXˌ2"%H"58Z u+$$3ĕ m h!7…C-#$'BX*tKpLI*:pJeJ,n,ՄC͂:s,Ktrwr\bLjqGDZ84ΫvqODV RB; Y9ˋN% YX)Իr]Zo nV Κu 9ǒ3d_r2!Bp~$6٠/lvG3q\^UR{Zc;yG!ڕ]cb~'QJ$_.GWy0l)KR۽'߂Bi*>w%Tilk57&VP&֋z dBSDs%(!a6۶nWX&U"gܜY=haH̹Uq ,;FjD=HHr5) }VKN>ǵT'50ŵG 6IBM ]VZ{vV17M!g6cb31d bt|IR4f=Hbx~4'T h^q2rS:T~US193 mUr'5;MRǸwɱK+%VM&#PDsNj|E}V1% CDJ'!nPBw9AVӊ*kVjn2 Ng6jג]zU90U^6 {o֘Sl$VU*>-7 ֖*4 +&+q@tұҞQ.㒆ӆu6|aQDi [oܮ:H-`H~ek"GsA^n3y^2/G ibYGa ip,P!ڗjelM,ߓɦL& GػXIya됿6nTbK*2)Q*jTX¥ (1BS,mM?l4Vaz^IUA(]]<0H"D%:*%5ddJOg6YUN# B03lkJR2Ꙭ ?Ru J@Qgz %pmz^Л4bY}5l3#p,$T!L֕hO1%x.n+9-(:L F E6 ,iS0KCdD_#[j$=I')\"E-*wCbǸ!; s]1mH2}WyvAw.KrǓ E+gĹw`-µ3$wɓ*bP{JXK% zv LlPV\jAo4] ,0!Pz/szz5>$DCD ~vsLRxJfq01Srx `#}T TPꛛՂg+T./2frTpڦ 2.\K)  *4ַP_)er>>#izˍX\x_.^H:^K(wLKQGuBI1~*z|mWiSTl/ѽ!О'GhqK^N=Kd=8Ƶn^cho'q9zsՈ/w6EГ}ܥTWvxp%8HWMU(dݏٚmWM^EFFz`,,=0^Ĥ _z#'lZfr\3}Sskd>2_\jǚ!?8"2z0~HmnFg2h7,kC}4323n2n0nnI)n@eP9 endstream endobj 3370 0 obj 2990 endobj 3404 0 obj <> stream x\j$}W4͠[%4 Rw aa.6xm1;oUUYY [RU'.%q>=돟_qGx~â :36"x"uJa`-Zxg'7h8‘7R5"ȞaS~e@EL.#pmvS綫 b\p磜G><)dV9N6)ezo>տ$U=q hN\,-M3H4qkiS'0J{[oBzY>K`PiF nwtҡÁ,yx8j( T$.'|GEKߊ2hA!G'lEl)%f dP*4'G_.zi4$=ɝ 5ض a (!YwֳĬ/I6d a%*z@BkzMtϊ'9`<:*k_lILPxMI8GVP=Td`I(_Qe;y3Ā *pXJpҿL#U}N[If0dz$TJ~ KA S)AuGrJ:xX;u9YGƻ{"ȠvoT:͸rLB 1E4Z|=r@]ٗSP,!XOh椸Zᴵx"V)QoS 1/|a)SlnvjZIj4w '-U d=1F[5KPVٜ Wk)OEBMB"U"DoO'a&*yCx#vTD\HU\/5QVGSR? S0C9=W,n#]aQX1EqrU`k(P $rC v6m}>q<_}wk^^ ί;L*Wˤ[f-9˺&tVqjͤhigCe;iڎu{І k=.bȵ:BV܀8n7|cgвϱC0|5b}V-v& eaG2/]YN712i磀PIk%7.d Mj Aa *V8HIqӔl=ƮZ',16Ibtbj0V)#t; s,@m,@ [_iMs4i.p 9>#fp/?:^Eҙ{XvS) ,9*+~sJ''~/9 #/җ) ɐfɕ[lcd /|#LV'GSl:T<%Tb UzU#O.t cJ5HyLK,.ZScLԧxsT'YU`6u׽n xJs;z)!0 q7NKH~bboj~}1gWͷSG`0C,Y5sl8 a/C X.~4=ABWw4"lp14  oiZ \_k[+"4LQEc2Q\pG3BmNJR Xφavw+lnJn;eLrҧ9̂@Jb3F NXt~\ƺ:>p}8j/PbH+IIPӬZ5'VWPwva$F壸aċhTl{m+Wj®^29(Ab[j|86d[Έ0lI/(k'цɕ2.r!xWqy8F7J&gkY?YS KY23qv%*15 z.;mjPM~b^Pn xlE[#_cׯ|%lhE;z=pzwxnpqiE(ٜ"Wf|N?ulTp5U1],/ARëųCqxw!bIUMrfTmns vaQ> endstream endobj 3405 0 obj 2933 endobj 3549 0 obj <> stream x]ۊ$}({(5~X0.6xmkϷn*TVVTUЉPH'=?>~?}˯o_u`ʪ'q0V ]`ט`1z+ֽ| w6^Ü1 fmٓib.{ G^KPpPWmO v@5ƺtdLj7~:{oH rѨg !TL5*ywK0c]PS?{}ڇ25R:j7aK-1`"?ȃUE$[Tib34_RU٘mW7-H(_ E\ G9sA#.qнwNW|cNNxK^K7q'B.!5S. h Ci z5SF.crB]Q:/hk ( }Pt0Ryk"/+m[W2V9.3TTM=u ZLj[u]Ɖi-D{c};t]FZֽU!S-"c,]1rpO=Ub(T]>.wy&B#7{k%,JaܻfiQY9-{ݙIW\aԲ.Ec@^4iOvD>eeA TH"'mtbKZBBC` )hJ`r* pی[v:!WV CB’ĥzI]..es~꒙H¼i8m܊ԴEZX3掃'p]A3JV<<\+a M I A[Z2Nئ7R ydie域~¤l²Y_XV L 6r-%щ>=ʣ/ QU՗eHpzCg4ܸ@P!M ^Ll$Jf:gˡ悷;HЕ,Crg݂ (&ïKbR2[xuSܭiײTHE t()8C*.k<H]p<}MZ@t%ėB" nᾡ%7$M&hG~O_5tC=ˈAFu3l}V ˙-ϫiW=JL¦8R724vVb+ue}u%V]"U^<qJ+.ru?O'GiU~ .i)dzd^sҎ[ R@ˬN!PPSnDt`~I#]0`fr!)-NM]A^ݵ ImkMnz]bk*vܻe $=?|h9-p8h'^ .菐ж]ZZ'Hr7Ol]}ݬ٫S(qV"T~Whʹ$)iMuENq"1q*l ) [Z_'B"J+$}|ެn.ؒ{hca޾1`+mMƍ4fe64 %TM' h~}v1Rj\T6VCEh }ow }F%~ R\$.CHJ H琛@HiH D Ϭb @$\(k0:0V&>N!}𖬘6W!%SRCj.>w$0W$n%+,,kFޘ씽zD3)ph(ƚjxʱ4v>->ϧp{~ Lq ڼ i@h_"꟒8"`.si8?& ~f y0/R!:1?q<4˱cQ53GI+m۱#Z"Gc#gϗ to_HML0(ZU#Q!F/_xK a#YWCI+ɘn8go2yo2AO i+DQ鉢 <ڕ!ye k-էL.X{wEM2W/LizH?fTYUK)͝ t m@q}_jTr[p?˟:N\$(2%RNL{H'h dC6X%Oӽ䧝7AĴFLËu:gyoĹ 3FO{PU-}3:ZCg#\Zv" s@[u3k:ެy@}IK[$Q.ZL~m!n#!,܊%>]fҿ4hOf[Ϝ6!*W#4@,ІĀ˲ý/RYwFo4+0@{i`6$8PTaeYN -T;sCWNg$#ܴd.K-GiH&~}ڨ\#<5Oo=SfB#ڗʎZa?LhO$8v$%]X;E>+gG ߔF8>3],5z.jMہ~Fj5WydAеh^"%Z.K{}W|y"qT}C!%|ڲ.(luh7q0Ӓp(^ڸBPtf%o0ڭcj$,5/3=k`7JcesؗJmoT=JoYwԞ31ADB!Zrfy i]={_h3v k4(;X=ߙNDx>z8oJ,:6奢Dea\KKqÓnϛȔy->ti땄 C!%b`46Bf7r A-11L r 1> oM-7Zw=H3˦ԫiJ"NSGr57KL5~g68J_<?j6Sv6Wt(ӮB0p4B[__d endstream endobj 3550 0 obj 3706 endobj 3763 0 obj <> stream x͝]#Wrn 8À/L.xm!CS_]-խ1 Yytsղ'~ç_?؁=<^>u_ëo~ ??}{NF/vװܿç7yG~fh$?#bGyco'sʽY<=# ~|ia ׌/woazs^_8!B1a+lFc4ҍ,z4Fc{wF4iHT̆ #Jo8oJ-6 IMqNغl'6nNn\qCqZ.,z>ktG7Edl" ch BkQIf>Qv͇:syPjfRAo(Y=A1><8]&8|ca}RX]%HEDʇW#&Qޖg.|&MJh D/>S< |hE=k/ |\+mRo/Vڮ"+q]cꮹ-#bo/e132 Kcۋy3a ]^v +^S!jTʑ +ZSg`:=n o[CBi@SW)Vmic݅0YNq`c/im}%9Xby)V[&;J,ԋ=8Ǿ50چɖabn iM[(/ya7N^_ksGJH)vqc[<3N:Yy_0.g;ѴPw\Ӷ[.g-^ BA/x1rxI*|;8IbLyR C#]<DZ-"BvVD iTb6o>[!Up}o r<|+K[o~SYM1b4̳!B ߈WiCPDŰ5*6ɮԔ,3 ,B& ox0&k6/ӧhZXPd>ED]B q`S,[ojb_P6]iJ9}69G+e tɯƱA+} QU[RcZ,pE|y8Q0olVr4%]J_-YD6V~A}[L?4 ~`T(H JL"5hf:FdT˳461%d(Y,ۘ-|gXfqФfT5gJ(SeBOJyd +]Zv'(Q|૬aStY掉e\WYIP2Qzy!Sq)Bn7`{R7n7`QA&(7`cOoޞ4`(+ٲk৐ek4ePoo/)dbq' |>cN:`!<a"\胺qյb^֝. У"Ű[2VG 𣴘2 bN IݭS. 135!SqmXOI[z> stream x]>ECvV%ɖ MN \BÑޑ@\Hmʲ ==nS驪T-ߧooO>xo;}|_^?~O)|I\./x嗧rWtN$N?pE3 ]HO 7y/НECouB_>D/)y j.ÿ_]0/?Zo 2!1ҞzkY%.Ls҂ 4Xq7J~+O, s_P`mjVJ2iφL=8jiF|HxT,YDT*_dq-.dpں-omK-"L&)?חZeUԦlj,*zOcajs{o|F´YУOs~4-d47f1NHS ^"UwzIɰ LLY:^2&0oƮ llQҺܖ0q&><ُ3* ,&㘬UU=UcWÄ &e/8~ (9&yQ.9"hΆw$l6RN=C Lzӵ4 {,k5g[֍iu) kh_!4 |#8x+h @g[M{LL24}l$qKi"AF ;K;na~„uHx v#KZ,6Hsl)H}~bYя~\MI&$Z#e%œ\5N1,LkC$w2301r!^(>AC[6[&Zĥ,ۖ¼HHGpQЄrޜ"W+*?4Rim &P2ɱu.'K,H5Q8itmhbp;Lpi9>|qD72^0!FN &K"Ĉ,syԺ{S} ڈHh^Y)\^Z vY)ΌTPU\0vɎ Y!\ #5PX)y $=Y E (oc"V,n#8Čdis3\!}KQ ose%RC7еa\2A=j]|":b1N*X\-&sfFj9h_!̒ 3lF,d *GN-]c%(gcX^vJ"DГX mKz ǐ jԑ};fEH f5ސ۹Y+ .wWLF>!WloeC3ܡ2@ j`F3Wv#=@>1[K"Zk`f} GZk Gҍ%d$|0§1\+DzUĊZưp4ՑRh^05x N2}\}w _ 0c;_w+|Pp%Y!rǣԽGpK he;gMfNZNl*h ѴZ'Vu¥_M+kE;s_U **'+&Trf=6ILw u1yNѰxvwoұJIGvI `I?)uBvm\)\MM;&Th\mv 3tbJ4<36Nj)4ƥ@:&M@J$VZD sDT+!T]$1ږRIWn1s>柘S _z$#! c ``nLcߞXahAacݫΉRrvuH`jn]Kkb센ٟ Բs}H7Hs|h'5|R ߩ6p6 ELo&gu!wʮDo pH 5qy9/H!^ ȭ N%ß%&R&  Rmf^w$W{$0 %u ̥4~XLb@X4T I4-uyDhK4hAz hf",y|8 7!i p9'ZygM >kT }:~FytV734Sy(z aZu m(-+0xGJ*Tcq)҆FMW$ס!-̥}[~18ЎnHr.Џn30'穮ԧ]N` m;W;sf5y(pDTm 2pH!<&+#& V^{ CgU 5fڼ nsȗװhtkj,)E@8V@ dy@zբP "Tbu:!aZ:ǁ> zǣz,;s05k'؁jP d7''ԋ`rL*C[Wc y 0Q<']`ox;Tnn,&tߜ_n_OHXE?o/H7ȋ3Ϲp!6JY97ܝCκo_[}!yntywј;P|*ndlT۷o>wdߝs缣 endstream endobj 3983 0 obj 3683 endobj 4200 0 obj <> stream xŝ[#WfVlKݰ5^h⇵wv ?y+U*"+C%30 RT̓S#|?/ߝu,f4F<~9_^/xAN/_^ޟ16~M@ Q89}RGOopfs^ߟO__|%a_}TF?\I!=srxI!ӻQ" }rL UeM**5Ҏ-UFIYSP5{aP}*nYZ}^!m).ޥByPV>&N -кgx26Kf*2Tٔ_;5J2fΊ`|f)&-Rz+ݞ%/c|mܛ^knjK%!I֞at_Ky$.}A/Lḯ,/uƒ>/z=mh[͗ɐP-{d_)ɞ/!u$[q-铞7*!ܹA}NKv 733xr_@>B(h4ŭJ;Qx3o&cZ  *3xYr9uQo.JaBs~ahjZ:ZLje7JWh5F''f}KBzAvLZp1AsގP˖lӥ>eKFviCQx,*6W Ce|:^vl} S\;EŎ1ĥ+WgyI+}a,0ޫG}GWQ`9EL (]of! ,k ?2`w8OjbCaࡽ@5cPۣো3hF fd/YYƎ'v380 ڱNC.ŶQ1QeYgN07gvA߅J:a EwE=prW,O, j7 `p w uiq =*$[L# `37qK~,]5N~$ϛe.[q5ijY0=S:Z@[IP> 7MccBt!VDV&_3,[zWәW`) 7 S[ !! H*1=oZl$"bD:CpsN6ǃnY=q/GK_ʎ1&coZ-tpdOLϜxpĶ(.]RuJD%lbQ> w4HyYK=@SqQ21M 4X n&HkШl&2N<5-8H*Ki+HCxp3la'1-LԩvXVxNhm qSZD3qZ[M3ࡸL n2z{vܷI8 79`7S yYLn4z!A,2$*z?Isji6X6JGC$LB헫<6JGfGwU<1$qmf L Mv<NDmd5bw#Ӿr:gix+p6SFNUMxj& f`a"Hu51$huTeH bt>iμg%)Djka9S?P{x--1!)C0OeTN^1]hrbЕxb-Ӣr> stream x\ۊ}hAW%4 X/AjyʨΓU55Mwlj ^?/O駇gJ y>$.[~#} >Iq*E 9 uyG?)},KZ]` 7ea2?P+ oN.%gϟL@$"8w䬝cY9F#cH3{R0(=cq^<K}2prۋ+\ SlAG}$1&딤NoHAsLL.)(&=*:h  _xwM ̽7歏=|IM;VWAb.xVWBgG*-|WNޘ+Bږ:T̺y@A2Mhbew>TBbLA 1F}BdG/TLOqv-dϿAuݙamv/0!VUj&1фڛT!x )|47U) xFTEGknqH}dTf$C 7gOkFPegm6{B ͯJ+A+S2JkאjB[Ys" ay%J!QNm7+14$3*K ۥg (. $6+/UtRlw3 SbOCKL-"sʯ=ѐ( uUHU$n~̕V$Mw^-c\M ioEEFC{`me$b$tE|_=9L"193ɹxs<),"[{@ &neNO QPh2:vϿt(R&3h{(6%amɴ_/cj3f lեe@l71-k(ʥɅ4MvʧKc,mMl7>NOswVʅ.敐mϦuu V\b["\.G4Ma\P\fyAi"O5sڞdw1PG&,3 C:^0>M%3~Lripx3bp=QESih-}CĄk &[6Hlj4_Ke)૑PJ2ӷoFעEEwk";sd|U͕C#cC$3 ^Zܣ'K"6SrwG4ć1&sVhvb,eVCP<ȇSzv1/[ݘcj84:00h@j}-ԙb$Նe"YֱqR@7JںpX~P Uf[AFՌMIW:pk\>l#1Y/pHBb3睘R؞VQTUVTJDI&*vlmɄ#6؊DY$*vlxInEewŒP;縱Ҹ:oE5CWٱ}-˵v2_cbc&[(]'ﭨ;QEMz7Bʺc$yfـ!Ξ Rdf,Wtf!!Ⱥ=䟌ȬsOKC f6V=VHI; ?!919~:S\>W+]0r4=)OgR@N y+2&*Fs=bryO@BC D 6\2n7@A=k_b $;MTzFv cC6NĥDx3܂6>9J,&kـRPF$iw?q>XhÁm.>MGr ̜dB.O( ^XeoMn_f(:Bܑ'^EԠov"[Έ6}|5e`Nfǎ=5͵[!6khyu Vc`Yz;y,^W0`a EKcΐw!~$5XI VzZYS(ȡШTfe^I%V1gGY&2{:UWuJg%$ Ť=;Ed'nVoGYm:L;pQCX8_6#G(C̱9ccMu̇/S} pCǾJT, (&Au{e g$ҳA Ώȸ듵ܾVqUb\ X Iq-i.ߝO5ma)ր缨n]F%FHk%C~-:kttBCUse, fRxkH$~y+oטHnen vX^u&z- 2F Z@0^.\ط˩3^ n̢ȽRl=U!Rh{J˸hُ {Cba6Aa#c1tZ$rBÅ1۳<^>prS) _R#Ξ ݥ*S-E~Ϗ[^%9빍D \N2 lgG9`v@4Os/TA,N2f )\7j$d;̌bEA; J%O `=Stλ3tw3 endstream endobj 4420 0 obj 3441 endobj 4607 0 obj <> stream x\ۊ$}(az nX/ㇱwvk{cuTd*Je0=}K "BG߇O_Ozz;G~RN=qў|>_^?~O~O_>}n'v</<<=Xey4N_Y^~X>Aii?Og/nzg?# ȋgY33+..{aQ<];d>ٛ/gop~0Qb7_9Z@/+Ǖ_n~IX !"DP]l*x&7|{ $kC' DυWmu#.3,EOC <R !įVܦ[3p毗,?<2`bLIGTu^~xa+6@0w`̣ooDR*v9n)<θ`gp|0iNqŊx`ʸ<40bIsinw@6KŬ G\\ | 4<' 9kp)yur̗$iP~CT-2,`H&`c>cYQDxG(X*J)M~ u^#M7OrH%@Srr'^מ[ۄzP{M^n^~yډޞ '`iΑUft7Y%Ywِ);̯h_9r:)-(\zYWsj< I|t$MNP*yAQ~9CwAS$_tE~yvd8TT#ߗѰ]$$ѭ;`L5@h0qppQW2V)0|ԇv`$@LhiԼsLElL#]qZC_$8RX%4,iֈ4<5ݽTb%&HFWzǻNɘ脄0%:TNJEP1d>u2 }VY+>KI+Pn=(I'!$v'䌄B4zO[-/z`Ȝ"9#ԮzA,nMs [{lQ5tonOzn$I(=N˺ ߔ+S9SyC F)GI􏰛nM+ ~eaP׽ ^bo⎅ )Ed`!yfUxsMb]fwI.JY|o&ݽQa/9rȘLzu,y_G ʄ4m NV+ uߧah2bۦ+*mpa*dK>ȶ нX' By;||udt*%АN/({۩Th&k^3gHXu.YHEgǒcǶHxL1xn]X´6 vá6 _oB5E!Aftm"juuM}|]Dt~T *a/|hzQ4 {HZ\(6 jھraxE҂/HZȰRq, ,(2b,(,X `XuFP#Bd1I:#"2.)p :){Ȓr *"l$qdl>c{sD20r9~"AZmIF:-` -eMt}.;Scs/F2K8xT)-jZ@Bim: Mbjā?-:Vg|H(cs 8u$7IQ\) fU)ت;D欧0d)zZZ1Q7ZZ,L8QDrV(z/wI3nhrX n w=w/=Ҫ@υ6:ZN [34 h0ʯ\dE30njNsXf|8fEtŖtiUkFR L4MZID&nDi:T5/)XT]s0&`5hp˟o+Z`T19bvurќsXpmq"PL * V-oEˏql@VB5Hf9$Ȓ(s.k(=)+ސeu nwHhErXhI# 9g\΃ZjrK.tYCWA @}Z]?V.ISBKtA[.`hSb-nH ° U3bNd:.~o0NڸCo̒ڗ A [KoZ-te-^Ѫ*^ׄ7,of4oj.5<>0C AwҒhaҦ72v(e/`jZ.T4Ѽ]YEZ6C2ht~ ߗ(@\"`:ԩXDLKiUuJ~=#xI0 %N3mf޹P:e¦%ZEFΰӺػzSd ғ8 0m~?Y뉎U#<|墧T&#4#%pEE|< *#mn+VQ kE+'өRrudh2 [4a5M>ix.`9S*“# -90V@gPPdy(!hs8w؄wchs7x1q4|ԻS9[$rv> stream x\]k%}=*} ̅6l`C5a$;$M2lH~~Jݪnx3#Nx>|__OO^u' O&urA=ӗϧ?3o~#||IOwOwNϾxN N?|U |Lzw]g|?2pҞQ)ί#l◽qXD\񑋇j䞏iy \;s|0 2ⒾE{ח}pK! ZM@[m 8A/k)GcQJQְ&@^PR)9@{ ΚX e>]pl~|5YF&Jχ$LKL¯2p8M1fR;ix04iȴ+oK'H\BKYBZRH '>,F D=F<4 ߰sƺ B#g^p,D"Ay[< fG}0F|=x~]ns{E dH4|$:gw꼕Uo"xeqfy":#MR>J.: s/K&"(0u4ߠfNpb> 0_)c#C+%Bh44}ci). Bυ>\)kCYéY[[lZwjɒ(QI t}zO`3T<_Rvӂlāb ŁЊ,6kL;9;R-I5#:zI{- /ʖKG(suVkmvHi5(agvkY>'olf6\}UM|& ,6?)J$qaoSJmN[kh3\Rc$p‡iw h{ og+^EKhByȺ DiTMP~L_hx-SH D|ռ8I6⊵/NTݭ`Uqʖ*Ѣ4rv҅lɲ~V|0.qq\]#np-ں5֗Luɿ 1vp%8YmUҪ!6}p<7!ӓ8V\hK69tSOtOtl9spoЯ=*-DfmBJPa/shkxeCvحYeh{ua]IGە^EKD QI1 I:qie ' 856}==ˠ';{~HzhhuKŲ$#/n蜶U8}$hxfQHےD%*ʗLo,LuZosYLN% `KG8R7, SVj՛5b<1.+t) Mm %_S'p7C4iJÎ+EG/tvрꑄ\B]d8,TP ȻE 'i1oG2*uʌAj|+y'c)Ć/ %V!}e]M 'yK V { K;rv7P*k<2WF`Yݾ^/ mY' =KXPL@b _l`ϛ^u֓okvk=U+%PɦGC-3U T|;VOMElT^IT)1y;ػ /$)d~+TJZfbj lT*w0G%a O*X75b"IGKk ,AH08R 9{ZK%#F8 K!g(ĝ .t8:XFQ:Q {%:8A,Eeebq nH: \u0MqFo|b2M@QVK> XQɚ13ޤ2R3!Go,lJ3*!Mr~6R >2KÆ$[Q!sՓr.maG(,wZc:+,>N y&#sI罸x0lf#㲪=$݀IWba2AC=ѕ'lLS*cBk Y&,ڣU&v4QAJe(CpUp,80d~':RR!m݀o1I ӪuxwAw0 ^-[6\pv]\Aaό=_Tn07nЗ6TT,uP=6=:y?YaFA[k;(/yv3msxcr*9c=+et5#qZ !G;w}n拷=ˈHМ 2Lb:Pmc39멇DޔQg4nՐ> stream xۊF)3lwU ;'p!&Xcdؐ<~ORK*Y͂vwi_o?\xڽoD%PiXYۺ^__T6G:ӻ?i__*ѶCZ~6ִvk$+iFx޼*jrv5T^ +)hA[lk3=}&餥WΦ _,bmi?XD ?\:E,4!y(a5B&p>5q OLs}{ bRBnPXx}Y9.*){P(=} w|FPo %Rҟ':BNbYCrh~E0}N[=M[=к$W K5]űZy%tEm)6̣ t1nuz% +\Pı@oմuF^mr= ɂ'ĭy)"x!yh_GE9jz&JcF;1 ,X嬝R yEFhk:>a}-`$O+."& &I'5 5TT;^ۗ 028cT&P"Ƈd H=zAVhdqt&\SqjML6v/۝̘ M;gyEv]fҬRvYYqʔKhDj encC^sk˵] ,d("O(%Kdqza+"'A]yAa)tL~=A$di$1&w(1Yi#!nYKX $uEClbYV aHrx7fFihJ=,hOkQτkjJNUnoE'֑xh:m4舘b4G' Ϻ 'JTuFix~N'n"f^ޅ|E+J Qe NT2;O1fǥ's'lPE;Ua|fCysIv hcK( z'ɰ[Qf\w`~ZQ:_pl"T{ֽS.o-fmF(tsR]mB+ec RgN/P[jҪʙQqe;] 5aD$hT?cW$ endstream endobj 4988 0 obj 1224 endobj 5171 0 obj <> stream xZ xSו=ɖ7fe flٖA[dMlɶJ20HJ q2(SgRJ 0ShB&iMI&)KZ ؘ{ߓ~~}3V](I4!d-RwL !"7.)oa=BĢP?gjek7}5)&Dh̆$'ȡ+?]q~#a|F{_c}kEhA6?FHN^(n"W z͇ž#/'ĢAcqLCEHZ]B>)!/>a+q \p{I?>"= ]-d7VxIN0PWx G,r?#<W Y#[tW5od~=$m!9D:CMsE "Kz&$"&$<4 "f@݋[ueN>@=W-֌s9Mo_XF*T*p~16YqV9miN:hg!QC F N0͹ i./)l_T%ƨ'K3K#vIu+1!O $OHB#Xa_fMI3ӍB0>#Խ$q˧U, Y(ǭ7R$L7 gi5a#wN!̒V5z kj2񩔮N A/ &LoGLǎg.RL #g%&3b1̚9sLZ݌3k23:VhoFpWn[C/8o߾B?]igX;#W?B\;+Sߑ7K!ושݙ2FgO4d)'#1g E 3tpnv3M4#+kz1ǚ7Cm  vO.6 {ܱkW/9ׂLz}2qwnzpޕȪɓ?\KXd&I )+R HuIlL$;AMKj?žb## kVX֜DO.1 B.L7N3sg)/s?~ᅓW6H?WQd.}'w4ct挮lL٩ۗ dd7CN6Kq$ :sFeG#0F CiC^/\9>u~Yۉ/v=ާޅUn5s?5EYo623ĉ3nGZTHزa7n{n8u]g7gЫkW]}xGwv=g5xC/vt惓OV1`=mnʓEEvD"L*";<Ox]z.@7qE_ ,P'N=<8x!QLDDey Ԁ2'GZ\VG xkHVFXÞ.GC&:*:w3eEf]n7^\aDs+'mp ;PK)*u5ӈ! T[!廾U'c eRpo|,kD,7%(ۂawD6WM&xM*i*u4xp=17ͳ"FvB\ >PG-Zj-*dнŤxF>yX\"fb!W2W31!^ZC\ƅ =&<\Y[k+l  dǾ"/;.p(8ȵf<^Samz!۫6הW-̕P)W٫N4媪)9aZf;XJ٬DVpTYrG]m mT{Mتm*[ϝ素-aU[- a-쐹HDm!Sgzff5Ռ5VF.a(ֲ* C)ګ-r:V? jlkEYy;lN.#UnymM8r1y6?evg"{"[zQpY>QŸdɫQk`Zkdy}V4zBQV"W6I*W` Uxk?]n nl SIل=Fؖk$66ow<A| Rg|bc(E7[jѰwz$#kxpaO$'w^avq$@S0WC5FҨ̍1`57DIxI3^ģD&I#bj@ LD G$ز~dPlExσo,ǧ%#\…z|f5b ׁ_?k5zOI22h!ډYوYȿe^|č3L/LX}׳k rf;j}M?'?fyc(&>{lD ,[ pQ=jcf5F(G|o%F.GIzV݈'0 2]7G8Fqe#õL&lxޘlU0Qp>襕@Dy5l|؃eׇZ8'mZP1f|lpD1!mZe<\PێqXq0"|m{UVfQǘSІVuq>!00OߌQSd17dvs^ u.{@K,\#=5z`m>0XOql5 ԛˆnSfY3¼*˷q&6.3^1*5)# Zƫ{PWy{Q8kE+.Ѳ1Ҍr,u,͢7CF"񪌭ᧈGנ-k#ZnGmSF9,>k%vA-'_CLaQ:q|PTv1{?Om;[8S]Y"refU]:|Zy C%+8% r|סo&1q99 ɩJZx, ϼ Z5ˬ=`@R_\w∓Ɗcvc3[P=9"*.rC^=Y9#׍$fmhvW1sy|6TGm(o(h籖*6WjjkȆ1[;[1C3XJEXg_6<h|zIPE-7e7eF}Z9~ (wp6o7a7+wH#MʯC?/*m)L90oyj/?/mUo),VU+9cRA n5A~( ;'WM_D,2nW2I'|L'4?.|vOJVBVc/D x[e$q#"JP~ Er1g/e5|v13 \D\Zxatq \,\>_(2/?Q#O\bo^|2>>>n=~7V‡,(G/hhx~K y;S 3ם2_QxkSV&r5b9p›?KoRޠ:5Je^鄗;^pr5H ?pbWtO(;p ˀp^矻Wz_y,=w/Jk%(g%ͣ0{sP^ eF<{DM5M*3BYHg-Mi`a$Y*Ma-Jd(JKݚp'B2|& nc0 i&1a:S(Fb pz(*YRA/[FH#2Q ۩zYJ6 S9 )L01 Ye )-M2Qȕ C|FS܎02v40( #J̗ 3 eCF܈ HGt FX`0A.-5YJK4 w)]RCDHf5KDA)$fAthZKA28 @ w6o> endobj 5174 0 obj <> stream x]n ;Oq{؈1n? A%#|B'M2&q?+bq.#^@n@i#k,v] endstream endobj 5175 0 obj <> endobj 5176 0 obj <> stream xԼ{|Ž(>3Үޫ꽲ޖ,ɖd[7qw!OLHҘR hIhˣS' =Bm B{ggg2dDCCګw_F|zq._ʷ#B\~Q,'.[n) BO/>7@-|tpbȏ@6nZ恧~9kn/B^š/{{? >B7]s: h}e~䡽 0\I-hQ7MfdN[x}@0"X(}}LNq<}=::>\ƏK0:t#ַaEOø77qlQ -]ax~t /=x {X8*ʟ*TVw;N<7puܵ|V4q |:-t {Oq=\ _$*+*Uޅ(Zhڄ6w`UD-_ܨ9Y*m̈́/K;aQ^b/.|/o737½oh*mГ m"W{Cϣq|dwɫm.ND@`]0_F>LpfN"\-z;{_[y5Dž5_eeAˈR -+2Z~.h  ݂v^ởC/ߠGaWۯ } <~ J/RW4If6!}ϭqCp=M\s5wjվ,$¥+g''z&~?&M;?UWceaa > vcL ^ Z_2VUp pmCKVeuv}a}|pb4HH!Ʌp''d3Уd?9L^\kp}rq s|;_ʿ? i44j~ie+>}_{F ¥kBE|ϑU|@~v fLKr_i.'9wrWpWU&69\Dž4m.T?SO/%$o)$ZFW;[5oQيܭܭgQAAKljX|܉VEit57|O'wz5A.!O{j(@q'pԏT ~" Vkp \Q#'&'2Gc\ cB7bv&! i]@M~(ּ!..DyK^Fmµݎw<&2_Q|%aPK7m Zw?]1i]|P>wµB[ڃ_؍L>P;t {Q;ozķ&"˘0\V/xB/+*@vVn܉VW\֣%ǀnCh,פ"ؗG t{.z Q p?] hgGofR'/0os1T;#k`9}# |5S>RKKR=KJ;jo(]e謈2W]_QFYzK 0Ţ}H[inxƝ KWܩ\l V;wΎ(w\3Z4Hʝ]}S?ZyNz#66mf;.ث;ZyXU+L:fB gVJh)-fV#"k;"4jyVkG1beTFkGIL*#PWTVF(\\`@=~^%c>GɏpH/AEtW>6sέ=+7x^Ͽ.W~7o|pyuِ/#!H!+ |p-u;A#ˣ%uz>|NxD'󉤘œ)JxOx$<>>ֆTp& dQ,V`i4ER什4n-&a!%vu]v1l@,fy;hQ$W,ֲ,Hʱ;(cxU܋zp gThZLR3R'hR|d2=@+hSNLGvn< chށ*>3}ptOdTDDAƶֶjܐƑլ[SA:S*h '<3`xcç3 v~XueYj(qW&)*L˼maw˸O=IY#.Xl3NA< |Ir:xl:\. MS`^'$b8U?mZ}}/zgLvvf}:!'ءVO O(h۾ zFX!Vd-sUU^#' #6+ 1 C.G+3h 5M3h ̵F#Y3f.6mMe) 1JH׻${%nkVuCs {lhF@C:ǽz-Os3qi"=66fIUp0/O!갥*V5Æa.˞wں:Qdz> Ȑ q_mbC*ٖAu1G%%sV* NiPZi^ayOD̳ TS5nK B.2Ӣ5X-v!nD#-.k=@ ZBeT 8}stok= ^f6R äǰ0KёA rk ahH udj%OdSDNOtA}8'"͉܌Ry!]Jȡ`,ā1[ 1 $ܣ#ul|`k=Yo37~㘑snnP,r(+eGccYMwe$Z7?@%KKIzQaC?V.S۷M h WX5NBAwwI6#1/i)Je eeK5U##D{ @a4S;(Z ]n(rQL`J=ܔzvX|/zƇ^ZzOv}?y&#NŬxV,i>3,E!ioNpάF.zZeZ s|H?Džn9PZ5Ip"YdflvATPC5;V+!|1I OADG4?Eih0Pzdg kѱ 848:T6E5JEaDOU;>ӀqDG(IaZ.Zd6U°cGaGz{Ml0ң0>c[-zPuNQe7._Q;Pf'EV>[i=K\ݫ䋼tZA'5y.vNwAkM[)'u;t?^D /N4qu~n6[ZJ.%d}>tӏu#?SzxLH8&ӹIVށ.'VvnsvN߯y +xl 4zCk+9؇lqMm].uq^I^%#r%x\Ԋ?0;yQmyj6s,3wҌt$:KsgsAU\41.MchwhTzΕ69TZ20Hic/jmwt3BSs[ )m2b8(ou붯!7oab;~L#y6/L{k /meU$?h,Pu.zqнߵ|v ˍr79op}6w Ng< z8MNQŚćӰF )k~wZ#Fwvi˩9<0MOZqa%Vq]"c(Fn^dTR5q,VS1trMG9Yzj ӌ9Nb>[-W.dRv`VGAMbJ+0:rFm7= TPY痬e@CO5P@{,j AtWm~u۫7ʒU3wi='o:3\?_u>giAhAdiF,XHk";:r9wY8c8w8H>秡BYPxdo .c8i4نTwuvP*ie)p;J")XBɮ^~ ߓF`ڽ lj]s "RL_~h\4Z-h!^$Dg'%!Wbw$H ecHce_|3fX64un]LHT)uZ5 S; ;;bwćI׃:'b1=HKnkPR"᠂R AK }L(*Ǣ(:!J:R$PX"/z},eC=x#6RP?-Vs$PHQe FZ|%!?Z* 6M3x=0.KEF:U_ۃxW=x8W9yR,1,SI`,ƞ~N^58VCqnk"'>}:WP%O&Ihr0 Sx(QJJ))55KK wԔq ĉSSqe^(jw\:EH5TMCHAp&[U ҄f*1UNˈ) Pvj2f/<Ȭi@qj2>Z9/@-fg#Nsc4r^g+Pp BYBG0@ #儫'DW&zw[v2mb1-EΉf$3yOqd^D)y,amʊ|ZSfl 0D3$| eF0N8ZA 5rD"2̒@KiJkv1fy:"^b2vf s8hh0〘)thZ6iX5rDմe4]瘶ୠKWYO 'ݜ}"ն"v3kvcs{`Lu8&"i=Cz&c#3NۈaIƸuq;?3GLF}5A)Ιz!ٛb3S@]W9A~J#_)J׭R)`f:->0DB͝B&ZoiĄ%E7j&^\k8S%^h~KA Q/f]bovTz8K$De5Qv-47i&V/ uk$0Ǫ.Rhf6%Z>RPґ#[*)]Ɠ!6[V53ICYvWj>O C0u;D/^66z{{d Lo [3.ry|C & =Z>bKϹ6+I2?|-6%33 7nn~,d}=1%6ѳB8 P>lv{Uk< zC^,y9ZyE+lhd- ig(oDN1d,0E 1_I):T@A>;@V_SoJeBbA=ã0j#H^K$CccoS̠n2wmI3)PcCzΖmE[ ; wMu.naڱ# ͂yy-m[aXoMe []$ԱTlϦπc։C@A@ wm%m$*}FNaf#ol4e(/W˛d.'oŐv0@J0oZyCv7Pd40g~Qe ņb1^!֘{t0*;ʍj.+B0$pO [B/L1hj95&TmHO)U8+tڤ&pJqF <xvJ u攦#{Kks+DH:hK얐ɏ"4e?j . 6:ڴ~ʜ` xW__OY 0 MtLoզ{4KU/EO#[C BPR$iXbc@=c€-{j?F\UK'@:9_6`V,I.ˍi~m72g-o]嫭/]8eڲMņém/:![5箦~zDV,ykŐ|8х|pf%P=<}S"WnOVc1F(2+RKvrZ\\> sDž0W$!8?x]oU0 c纗)]aҸl҇2ğrVtcbK GPxF⍤o%oYF<]8ł@ H_8+:+&~=VݘGq$qN3m/+=exUmmO{ 7LzrpAwpq7 Ҧu%k>MOo^6zM䗵n* 2>j4 dS=uYKuz7,R^CHpk{QT[buN?㾙~:BMz]_M&i](uD8D:mZf}/3Ih5@"Dj,[LO jĶTO k!/sFA5 juS0hUږ!F}(3\o`#D_zv͏Zܘ;J%5%HD; zZD׬7N<]eLoeWjć 6MϏM.MQW$z*5{a(Y+)f*QK]bRۦ]bcX)Ҕt%ND9Anܟx.\g<GaH,iէF+cbzйe :)(tj,jGI"iu8-`eP(IyܟߓVTaWuRlmvɎlafZg:'w;S KLڞ/} ]onƫ:@,`h@<[‘0ZbXԬ4 7A@H H3=]00zb6Oi+H Sdx;`߿W(*F=6E"M" LK=cRtpbW_{ ۦd7:Ɉ:zfm:rys~KOī]Y2r";arttߘ~d0g&Zimoz=$81tAS=ᜮCXwz&h<<.:Sz<"#3ߡc5:!ğO?6ɮXl={^մpRlvr"gK.Ob*KLKJ'g=˹vZ֚6HA.mZ28-?nV k9CܯQҪUS F?L   R 2 Wgu3b}SZ'3?.}vU30C9+jd[%lzj_W=s@jQ >0HmeBÌ̆NK,LzQnTV%sS*ԛh4%_S+ݾ kRlOCD-^23YO7 ?>GDeB:o 3s7,t$''-7hc,Nju2M%uF,] #@]R-SЈ:anYO';+#we  ׹Z|!()ϧ?G'm$䈚sPt:==+3P?^kSl2#wx0{jk J{מ~7Q'Q^g+mmM03!o,oeД64eą_T+ZB̂ gTk% uvQzV,NlJlKp 9{ǥ wh>獶]ݤۦ#:@HYy Utd;J B98Z-3ۤD,*Q-_ǡTPNYSADB&f!P$Cԝ^2bc!AvWkl#k4 )xHVR$eDS)/YkQO T^+۱)9gJ(PxI!v5[ZN!o7͜>]k@%=_tf]%&|h%ExԱQi|x/je0K Fk,ig@`/Sab$5UKџ8:qhnHmߞ1czF.:IG=Mx϶ `a<ρT?» >aI#R0ثZ6R;)q=?vϼZ;&IG#SAO6f˫jB:Y<|5y#^ظشڸN9!s.r9ry U;ο:9e+@}3\`$@ E&!;Fv>bk}!5T/u8E-'^Pu!m60؋UmG "x 0ׂz!nMDfeW[5 _ϞaTҵkɆ늹(T?'䏗~m?tC!}wtѐ/|pDd'WcT'%( tn[34q: Q>!lu],p{j7ksL:ԐG7zP|[]/)q%$1AbRd.eeQ&:D,?~Tj`=k6~ħOK #MU) `'5&fНl S|՘mjg~_(Pf6.\6l} 3ם0O+notiwZBS2PߏdLG3V%Jn'ܶ%Mn!O=F'q\ @8`H+=܂֪c].GXP3(!n]]] JUYq}53$۲U|C!uX[r16ϰXZl_\PTۖ{ǺۮI۬\_vKăfEX-2)}ʝkKmtۦNDa[Zq+9ƋGY l PfS|\G7V 7}'.ԉb7>xT,b][KH.c`;ئȶ'͖ RB7.i4B#RQ*ŌD"_0: #H .$bCk..9cQ(Ye2jSpCC0GqM.FyZFzF<='=<-o=ϐfT@^Mbq?`rTFmdQ 7i Rozk[;R @9#;5iykU ,[sG f9>&\P"tGDܾ,o=rFG#D"Vu-&hMZ1TNӳ)JWvS_Hb'e!:GLK!Cc6wh CLSXĩvS,eh}~"™JA\ʬ73٪ET`pUl;:٨. 'U,:ɼ*UNV&zÛp9uM3TȪ=3uVTL$+S2B? G  qscqK';wAe]Q8W7UHpVDTQr@]K* P03i!@$ G9ӁȌTp6$eE3S-r*)"!6g 0QoF31:J핬p^eTKK*[pH ieE+fD. -^D /"h,bq*.[3JV?Mnc6)*lFw]6=z:"r\M+"S"u Fbxc;_dQg1-a"B`;3ϳ9$;\l  ov{ˤo>o>-U q͞l\X6h™ͥ% :r‚i:K~,Xv+?ғ I4j@eҹ1ߴeod3cr>4P*-KMc{Fmzn=HRvF s>Qq!RZ.fiPԙ@537hE}Rut#;M\i6@\ʙ̡J? F.;TR%Z:ۥ@֜@chHXaJ[_O4OHaoii 2e^Fbݒ)?meȫpN)Ps{/N,bK'9>+5c:"1ydsScH?'}!zNBM_Qa2(,~BkF*&MLٓ=A>{3ӝѭ\I0bJBs& f7ʿ_\lfNUR")MeL!]w^1>$[O>Kj@F4/&bq14AR)^9K nR1A@bڪc hB3rսʭY¶Ss:{kb"{A66X._adV۾6뢑}s}+yˋ7 8WKL3ndY"T\$M<$+SW\ ]SkʽEyH6w{8: .)fL1;ej;RUK|Zq\OH!?ld|c ZM7S7a${/s$_jr&^sQ3 g#K4VDE-""wEC%+r1U*k`V`ʰmJMQ1HJrڧXk]+K,=vtDFJ J\@tr*ίSAH Tݕ3Y~i*/F"YvEa"WE^ʾT!S}ԇe(5Iq|I# Ue&{8-pn?hewJ:Qz|qWNF~f/}uFe64ΜfW z~Ƣ7Ttn$.X~!T,odq:d/ e ,A+% ZU_%^^%_%^k-÷Y0{^9Gjt-x^./}nuX~<ُ&xgdmНPdD*GuCPQ}0]ɰ)|y 7@ h2V[>~%dċH a4q^Ż;$/IhZUvu&V' '&p:1>>6Nj[$6pMZSbI0@-馋W@L+7>PcFkFf"ξ=hpIF= H|0^=A35Xeeer=ܹ?*¶ЖSSoގ&_#| x<.AYXܳ4+ڠm{+'39 {\ԕOÕ?eM3=dBc#Z{~t'ՏgE Y-`LʁA8l~LU7ص4p7#\3}Jfʮnhފ|g8MSkFۚVl{kz z!e,6EB E(-uCƔ Cp7/Nc!̲DCl(D e H`XझdJ:bkiq:`La\uB^]g0u)dazcsHaAp/|M€zqyu}&sR$9&+WH%i,$e'g z`,}n:FW37]]Nzi2;,>3pK>`R}].\NtfEn+," Od.1izz@35*q%\?[v򒀠{%jV@ 1Jip:`0x)&z.rDml㸠ΐ [0(UEp/ 8;$~OϪ% M@`Psʔڜ%sލ"z,aO(NlBAo%` D4f=2a5L,!OtY-7VFR([(]W/4cMgɈxQ o78L-&[чjhPgS YwJLÈ]#6Dfvos쮾cwO>}3g^zf|풬Ubƿ}R6&0 c fE"" 85&Mþ :2>;/)}KsM/`?xK\ٱg %)xruJ9+4[x 1'Wsc Y뜢8aIߡ~Z@O萚S9g™Y:Y/faWvwv_:O"qgiw(3o: DqZdݕM83%D$Lod Q F[}8Nl`F0 i1`bdcPii.66Cw1q#9)x#(G$=3g=亏FRqY'6{7.Cl8kkC >6v3jkM\+y;(DJ^[έxF#U k6EӑDtN=#}0z b<95f%[$819sunt{$V1ESTX 8zfJ`}d*NWVk;u=RVETGEIB]J\PȽE;VcGG4zq[heKj_?nb?thT[ ~cjQ.)嚧-_Ug&[;=Q֝/,']j7`-FIЬ략n=s+kaڱq޹cz?җE&l6CR}hj64:@B RVV`uzdT0!ALKgITW5yz˸0_VVF?'=^*/Mm-g.SzPGNrnkهIm ^㑔 rZX<O>S Ҽ^Q>#aYb6Qf2rJ-!bfߝAc0A(c00=ޞ#i]64(iC ZH߭??S4G3:B=psGɻmkztLIkYlш5= f {`qFO`TK"{yPuT$""j'<ѳ~W#hD!YSt/=1IK@PV`V,Q>UO9ĢƜ)\Sqc{zW;?4sM'TMk\veDZzSw=8IyCvngL}*ǾI_o< Ҩ}:uznw6;NOah>gct_Z*.Og߸q*f0C8A,VBTBM 8)^śKte]ź&؏ 4@~rȞ!{z42C"3a t<]pd.b|ۦcOŞEg#+{xev#٣U0A3Q#PU}-e C#O @>$AE&uI~Al m+6' >N cӫ_~7߯i]Z H^Ƕ8Pj/{\>UX>gtYkρnsU_ {ʷ%dU\ Em)-pԋOXmsރ}4}dD`=;Qx? xgKNl Q]3?IBcYbp/1EF;C<B,#ꗅnx_uٖ*/;-+t ]VCrx8Ou9=p#3AF =`rEy +y 3ug͓jreunrtqj8Y6Է7`ORid!*E PJĺ4}ZxK/zGA~דg\'c_RgS5tKtvWDOw[u~$ST89.-;b+n76\5-}>-ݖݶ{=V[U濴ߏ_Y :8h]1D;ql 'fQ@F{d-"Hr5gU3ա 4vپN۝SE5l /*>|ϮߕɌ/h15`CK_]-% m.AFZ}F,0A q/1LPQ2_v*3[-@6aAD&(ХAg|4udJ4J~:…E̔yJ%c7tLNS&0Ŵ7uL[L4|:> [$T\'qܦk0aETdv#xX1qdob͔D+Z؁{=P80I%OW`K*@V@B+( #c/6e qk䨑ޑK*Z_ |.fܥ :<,^]Dԫ{rF#q  ~x`2OahQU<c7²!f8F&C܃.\`F[w,y>2naEH5їfHLX[*]>e>f%h taa8h5`X!m; ;]G 4:{~cxS?OT7G#/*$<^lS*7o5Z}zFb6BTzo|P hy@[m6ʂ]CA*{}ԟdc_|OJ #5vKGI\$uɈrk#^F/ P;ĭ/׫?Qc K ׸"TC[puΪw!fm3 ?D ט=s&0@"C<0H *--LyMXtZ[FLR0YI$ZBO!F[ $ZԖJX LB[3 KaߵРx)`Gĩ-ܗ ?UE'C֑Q\ڶVv;G k❼KHZ\Q!l ZXcvO4V;]K+o77;7z7Rr>pݟ< O& 5$3TN/ 4H$JڽfʩrgU vbη;?t S*:C ;T̒iCV+PpJ)(2]G(HCT*FLD$;k9mD6}ÍSWFbB%,n4:T_}åw+OT [QVԢڻp>`kZ/h<T c@Ij:oA5~"ep:}Ⱥ `cRP[FauXbRi"&KEԚ1+vw7uE~ъ@AWe匉g>fn 3Ȩ١ξAWQ ͆YU!mJj&6,f85E.YJ z U- cQlCwXdg> 0 5cZ]4괜 YH @j\N>Zf"q[G\{ qڴPrP3g\\7"VaIbyBͥ7כLpFTtR\Y\Zh#D/n>OUU>>h4dp`p(0LP Blh,$ݮb*]@$OHO>ѷc|8]WoFw?.-kS/aTj*yq<|]ZH@$Y}}"0@!1W8ЋzlQ<7EiZu#>Xb޼z!}aoN2c;7MsuyiaFr|jfb`P©J!2+˕j[\ O%ߖޔ29x#777JR䫨ox9'LbaD.y r9'y@۟$їElvh1_|w%$nLaT'U'!qKO(@Hj̉<~S{H G-Izve1?H$.Ƣmybv$9d桡Apo!/≬)YtU=>ӻm,#`]C_%ڪ>Q(^_̟"V:BT:1W;RUvg|* u>mNbA͘zoMS.G@Ա< bY+Nt: \ *G)9폞2Q#ޭ_68#WL=p^Rp( SSEiŵ;).?:wQ6-桄zx<dKSm]r%9ė9ҹ-G /^S,#30Xҗ׼<>חΆeu'娽Y^)Sa?{G[4̿z$.<{>0"{u+j8+@d+bs{V)DȸQkUF5= zh)4)}DӍC1 5 yj4=h0 5c-+@A ~ق;v}~z]G9+f)[0!H.XW>>W ;yѸUAJsphqI6CdON-@_| cpӇ0,uopU,?Jiɟ~9^;_QMWpJ̊ d AC[g}8 Lns0{Rq(YM%st5#숒1ҟWD\^crZGQjS躖K*B96ELHSΘ+NII5rM{͍|ycbcSlЎ.[̹FK߮9SCO1߂&#q8Tylv#i}<(Gd"5G Fci2Lf.CUdp E$XNT$esWP?s™syC EsePUѪh% GQ0 !aGG_ 'LQ=T TS?@kj&M'Oʁ' >hl+i%' 5fNb[E쉃F-SQ+]@=)֓IbRK0FL 1d2Wa_ʖ Q0Re XeÿbA ~LY/ì3˰Q my#r1)W7"!`7QcRNIm21OH/}f#9hl &?gђH7ⶱm7[R =H̜h3?7\DQǔ%SP 'Lf5eX69(5f62`o 36٪m BnhL4 ;% jˌ4e4p8c>J1V202b(M L rs. %c:wE fFkSAQ ”T>kh)cp?#` 8D_;9K0 v 3 l'͖!Tpx# UuB wE#ȢW ׊$J;0\7v@3V ,KveI4؃z 6,uR !${Y944ZBlhֆq[~DC48`>śAɔŦ6|LIL ꨤ$I%OUvah]eP3b/YۜC7:U籺UfZ_= ʅyp)yd_f!= ̟E}X"6!bۍ½u1#Vt[;-qӞk&nV#D C{D3,&@Cq9˔ooni㜬@֪ƥlseYq+êx, P΄T}zDwqn%Ǩޟ{eՎ8 US& Q(Ӈ>Qݎ" *##jUY>E_DRӍv[I<l A zZ"F &]5%,ǚI`=1Ulzx7@ta2n;iStæ 6!@].8ṕI2ҲE MW%JIp>͗ԇU7sc-qUXB\3aQHrͪ/DgdX8_itCuIY<4Tx4 e!u$R^0~܉% ^d;(F,b(yz:F)bh}jF~pCR9X!< Q'~H(ގ  p!?&ji"qc VJwaF|^.B `4`PZ% tivrz&P̪Q!٦(9рvA;P /S,K#`J粳Ρ;ȡυ&J ظ}W" ^WhU:^AFR -r=Gx7jrpn5N:c $ ,vYOw]?xk}zZ La 8әA{<°m CqhT|?oUMS :]lԔcWotVSn+5v Ftzè}+[8ڣ׋#z|T @]WAH%2$δ*L&ZpKp{zpaMJk?~쨮-wե3;2J RTxh.tg饗,=DЗTԎQshWYն!?Y{Gp>PjG |Yv U6JS"A@C@_V,fhD5hCS4wv0+~tnkE%w |GÀҠ `-,ܠM<9I$aYvr("D) @]#d'enep ~ȂèG|Vh!dSqmUYL`*$ϷU,4qS;(40 pB%MF(?= hO'#'{x0i!V@qOP&aC3rBnB"AQPiMmsi9MdUSk9,d $J/ ]=8Յlc.EHF#1mFsڈ7RUQ^O"jdFY4TzaCF`T,JZtn/h5S*<1L5ܚ%q50Z7-Wy 0})Ju;;鶦;'T5ٌa?T]MM&fCt0gvէmc>ytngjcMBv?ӿf"-9)*p V-P}]rhb@p ڋ$a$fE(1Gz@~ሀ7dD@4ZOOOZDա9x vމ>!+Ds9šP뤝,jue*Ņ:k pINa{n {>XV[#8$^5i$X:e3@AJMͰr'n67VқM>~'mև啻'r*iEnVP+t55gcN`8s,RV%ĺl6H=u(u?sU&R۹0CT扇.j2F{\?kjRƮxW"qۈj׸oܾ|o9zς{ _Zx[MP<'.Ly͏GWkg&LO]yE.N#^AC;ppT0WAY xCC6v>Z8XJ@=}1hj8 >WF8NN,l`me),NR2):b=EF_d0pg9jm-T{_Dv1C˴*ˁǣi mfh?.-~C%ӹ_8ʹҁv;G%<=\@U,. / H1b B!l]pC6P)LfЮEht/g0\`fW#JA[GŅ-!Lg?]Z䨻 9xBX gI nhP>r Lc߄ ZpY.~PgO l'pBl*="DX( Z6^?hd͡UU+.}ʷJL? Ч']G؃Χ]ϱI$wPIjaa۞i]fe6|\{sT TV++A =ͱR Z'z6•| vƢXu<@6-am*~Ez̾7g,E̺* z;dMIJD Xw͎C0 P*NdG6^*[GYYnF&c>9ԮηGIy h^vGm J,A6a-{bX{9ޫX9J^c'E Hɣi LxVx^]/1_oHDH+o؛Vk E[ϳRϘdl*+WkDZS 3t')D 0P/cͽL|;s|T׽ A Air8`yPD^2HeWkBF#aH}6}ù2s6+%_&6E 6JKXO<nK?Rܘ=W9${De-mՃyԒWA^t"-_Nȟf^\eziq݇C-p6*ətL٭VhꜶ5׼yOhQh=bTOB/Ta5J= La[cϥR#]5rl䫅_' }..2wx/z_qUmew#R S YGJV.=*ĿRyPzW#}7FSx{@`֡㓩@:dփ:AKOPƀ˟c| N\OJqhѢkJ)F(HhYӄyAttJofw}P^עFgg-i=_^G5Zh|">),< h13^3Ɩ9S(O3t>z5&'\>}$^f>W=V|o3Wӭ/#uG=}? ~=d%F'ŲEeG#ҷfVX*~R9*jٚ =~7r(vTG9}O6IXqc4 '`ҫ?2eʱ?6kZǴg)tk󮙮/Ϛ=B˔ 5G]ɋ>E>\EeI -LS@vi4|/,ph@Z~ۋ4TH v"jKEwHS@žTig_+ "-g,0r"+t;y_X[EZs;CFKH'#[ ";z\"ʐH2tE.Ҩ 4*CPFe(|H2PQiT,Ҩ 5V|iBkpBk~?NZyӏ 4Z2BΙKh+RBvkMQK:>H09YB'c DO0+WhYôV>w;8J`kVN]`-Zzfg=cVz1IH#`5,o'[(@goDet| +(DB;W N5~sP ^_̧Qh-8{'Xv]`9zJsw+W)\FioI,FK/)e5V}8wﺖQ:ՉwPzɹ'E{3J*.TkI:uNaj9s ݄u92hj8k7@W)O!%Z!s?.Ak Tw)z -sz9Mj᯦Ght#2Zgw_)4&xYI|Si~c679ֱ1cDMBO*nToBooF:OW~ԨC; %`A?;p-_G+@z5|ktJt' g덕q=}7 ZE9|tOmhٍhahɠ чP>cZg҅haP>k}kXc(IG D}(#(.mP`1}w~ bO?>t\BK-4EԽ5!}+<(J+QFIQqm=oYُt+*Ү7c;q.6i`nC8ۗv nNlXm*a;KF54uAcv%l]j|ш:ma0ۄ4ilLځRe%syΖ~# !4.kihf!/G܀=OK}"&x)QIƱ:%?odG[U:*)>}X[WnҎxŧ1-@b f@cVszE^th:#3*[G_,dr3 hU>^-3TuՄ<#2}O@DmDZo<:2]ˮ*Ӿlim_WIqi9{54twኺR*Nʣ%L8 O>d7CC@,FGU ^7nx")`D"uHB`uҧ+@uS=}@ 6Y^uTÀ]Wf5ҧёM˭ܤ/[yԈ>elKv6M-m@hEiڵv}ަj7m~Z{֓Oܱ6'  L`IK`Ux/ T}D(.=m>r ڒ?Pџ~ZG nHp ?IJL npZ$!Hw^:/*[3kGP,h]rOUZ +R )QWLSbJkLAk_`~Hkۉ6]_yۯ+_S8vA!OƨKU~*TKUb ?ˑu tw#V$njIbee2Ψ\{V5ڨ|b?lv(3 8AwPMND9+oW "[V& ?Bw=cN 3k-i5eiǘ.QO+_UBT+N J6l^^Ktlbhb=D.lw+, NE/*m8'w[gak-Le7B%_R]U\-u9Tr"p=T{jlB+KRzAy Q9M}KRl'BרEl~3jKA_8QnӾn{K%JX>5ѕt]aSQ~vGs49;NYq:v)9A]j{m6U^;%;rRJvs>ɒͮ`丿LWοAɔ[l_\'zz7>z&ÓK{؎=Cfe^x#;l W3zydLlʘaZߔI}ӗcD"~Y$I_/K{_gX@dHVd/ YaB P{I-Ռh+E2ikm5KHPnjwܵL4D]$ХCPлDxaX0]yF,h$'4Zƻ1/:<Zb6ҳ^W8|>S8<:,ّq67kq_ad11 hKKƢqk$:FLO\yLc3XZH>&JR$Z.\ɽ{o 0i36 HxF\,=qÐ&c֘3|>w LfRNKQc.lSXq3*Ns0$t|' 1~^?h@'0T_|l3;@^9\x&;rl6lX kE:kbn[wUrXYɱ\tQ.8)hN= YT4?4> endobj 5179 0 obj <> stream x]ˎ@E /'n7#!$"!m[HY8uݪ?v6)N1Xm7m='oՐ->۱U>O349~_&mw_~N1 -vS^du\s5|nqYf~N9_sgCo}8V5fXaŮ20|VjТp ZЎC{ն.+Ё1x\<_B 5BYBI4we?r jx Kxb0!Ӏį5_C_/K[='6CK~A}K~\O~QM~fK~_kY,?m_c]> s -jJ5> -V{_T^woB~.='E#8.?#̎^s%~ {7Ɠk_{%טďɿGW~k''9=f'~AFXoR^?q^Iua ]'~@~C7 endstream endobj 5180 0 obj <> endobj 5181 0 obj <> stream xܼy`T7~ιwܙkfM2d!@ ,oBE@$.⮠QE[vշb5ůEk yϹ3 `{r2 f3,]44 ˞רZ;wIp|KW-`9+W/">kWͿi͟xߊٸ~E}Tܾn7; uCn@> ^ObF-K2BRkl`(\dyEe*]U]īNOzK_ZT=>xoi-y*phiXր0ȂX@60 0` ƭ݀+*|>< n_u`x #@ %T;Ng ,8=©T\ 6]e n3n׀60,h)aj4 !O10VH$p2ul?8A'i>8=t1K+.x ޅN؆< s@ V'v߀rx- 娗 Y|v5O#{ xs88~i{hoZQ_?. 4Yzcx|wRo$RO(lǣ 0S& |ƛCEjA+- IL0|G %Q݂GmCer'+pSr9>G/ЗD}Uxp (0 x \#6# np7 ߢ;{# zhcdG -X|zLEo<Q 8" x 4-G RvK>HPI+ȷsC~x l.Lcs7"㬀A؄ixg9p>\   1Ȅg/w\d^XΆp $,QO3+;{1^!bQUF4MDSA[CQ,zDoQ-)&jAHJ=IB {;L~^BN, a:--bxWD, II&Ia)9yFSRG M@1:y|vR~XOX͈4TX7Kq%6ѯh|t'\{Z1;I/hrXƲ[,CKP'+}b0~B}3,)]0E0dx~6Baji702zp5u@;ѱ/ޛI2_񳽃~v>Z 3()z,Auӿ IEt9EIxn (;{a~OS -??F$ȣOui|o"JQ5#1Ћb( t+uuX.Q.[TFFT(G+ct g={QD3 _緈nG`s=l2xY0ݝSxMv`7iÚ0XNJmjV_ ֚:goƺE Y -؃G07 ljx [Ӄ=ϱޛepq(CS- xG #ut<Ǣp(۬3Nh*B.J"BDczzwܸi{Wtq1W'H{G##!ʂl,jz~u3pFog@ { n|ɴ繚zƬ_4_B>;z<G \UZ]srP R~m$OC/4yFSnE{zwT&"F q-#ovDtߕcu"ʅޅg淓{h#=ܦ~&nWRMe.?yƕ{dގE1[EhJ!O^RMgrW;ʻ{<<0eŸ(| ,M^wO>vDl5.{b#H#jMT]YY4O Z˔arBDf=.$3EjfQ ^PÿvYaYln{D~a|yuR|H00CHd4HB;ϡy0.\`I3i LsÍ3mzH{GcFt >}10H6-{QqTo3\MJmiU_3TaGϠTCVJ؋9q1CCX9]czyv\+rP\>=uWzP r}#A6Acp ĒZ̳@DGT,Q98WM`Bu0 p7I֭ :sa/E-ňwީxLҟ穿_sBi x 7 v3F&҉)6PCWjDfgT*_=coGkaB  @AiD\o  w\I9pa4 ^oeV#U#Xb$[ Ss rPf0}5S毿osKsJl㟹nSńeRp/<ٹΨ#䭐pX?L2k#ا'?7^'i!͋g,mBI?L# ApBw!' rpb( a8.PGrMQND asrѴՃW w)u뼫c\z+PH9w>'^}e&Vy @kdz T\LQG&dR+l(2 GQì ?g)E7_O><Gr? Xl1NM'^PEʫ]SVVKYGCiRx*u ,˱Yys9DBHd̀ Qoa~!̢%Sj&n<pyMPl++9"XtŒbb+ȺMi<Nt[yVy&y{L|K \(57ܒ??*ͤhŅr4ϰd43揧m_NY>-Z g!Ao{e"|'<{pW4sŒ&lc" hqWMۥ)ƷI= B(Bv`= ځH,vVPWV|:k1 Wo(єPfo(Vj!r,o*PN'.3VQ}Vޫk.S#;@3 ?pae!JGTb! $` b'yh&[ĠKtt{&I1`9eI:ZRsDYJFWW1nٗ*6<1qjue0bZ^8֥;[*"4'h6q<ͫ:Wr[Qfw͗< ӫJcqmu$ڕ/ˍ? ڧ0/?sR dYrSmZfg1tr,xz~Elm.Rty2#KEKi$dJC)^)GkHСq\+t)֩Eڐrs{uq=ⒸkkOWÆsUMPN\`=ϗSʻʑYR8胟6r|pP=Rfp{p[Uph} G #7+7 >v<\+Kbؠю0ԙ3{3AE{3[1k"BzLra@ԭ˓"Q{ZhZB7^+|,-2jH.5kMvaF anv y.,IH'2ORF>Q"8cMi$A#Qa2 E.RB};6[M6+z%3p8 Ť `s],_t.HGv$+WLBFMA ۫WXqɥߡ_;9kie::p <_a~cӘH7U:YB21N,mϒ^LO?E?U#i+YPL*YTfpn+/׫vkcIDAU18 ` fÎ?΄+4AM>""?2 'tDGd $L2L^AZ*%)I(.Flu7$dv/Hn9n톁4޿|k_Xs7 7V۷-[ּ4n#mᦲnΡ`'+Bce ZcR4AQH/ t2 096I=3&d$l I$B `7/:?Pvm&%J1B0rF G/#&tǸ9n]oX0V޽eQ/FMIwj='=8l|i!OQq(@ w}mڸ6t7[SJhB#nr V%X#Q$(íw8V,v0\%452irJx[D@{kRBJ^] b -5=098G|ÝWE+ oŌ*,y1%DN]o]<EJ} 3q6aT4dJ87$ ) jҳ*!SmXNos9&,\W.88z3ұr:YA6Xb^ez)TL:d"\c* QM]=?0?x:zxqOR+g0YF] B(9h˥:gq S砛W$d 29eHF2MS/FsY!2 h>eضC0.bbP$6%:-:}ƭ}ayj17xohi0/=v>@Gch{ ']]sL7$xc-c2 6n6jU`j| .kD|m}ʺ=[DEd<<:ɜ}uMJ@S8E)V A@!(R\?H_+S5 h''.Cox%2TÜbɐ"*& wy?ε7{ 7v_o/}x7<6 cY.Z{̶3Ϯ~ukGgؾjm'0Wwc$h=njVff(+68d`ȴcJճtH([yw2 9ľ]hdGpwdvLXou6~lK3lж(hh|q>o| 6={q)J1f_I9K"-~tO,냎 >[w ՂU&L"|}vNS-~7z]>UBǖȏ~T|4xqK7DC cW6MHNr(tBz*|mzg U -\hPo5!O |0Qwh 5b|r>KcʐDOR 񴄠p op%3=Qy$~Hr:z9 T-_&u<a[\i,U{dz)S4oΙ`)Yy|u|ehjYlVHu겒 XI&%o6:~KU&\U;F9˞~Yj)#WY;mbx\Z9UouH`Ҵ)CGh'0}Խ4iǫrrfyFfc#-ZZY?^__?^O׻ML4GU|睉*}QIϤiPUnǕ_* $T9/ +k+#km$TZ{xpa!0|? 'Zߝ D2:Inl!qϙlpi"Q_xT CgPJ-eA8ȕۂvP*UIJZJ[Aq).89:b]Ɠʍ}Ogd"[o2/>9 Cyyeeղ*qǒ% WX nna:`"Uz|?onvkkFEIz:$ D~M2=| ,W8VAT"GB<^Co "0UQg,rZ'i(V*FТْ"Q.+ƾcPxLc֦`cPx+g[GaQZ 8AB6"^F/%#Cd\/eau10FiGm 6SlOxo4vciG6{#N }) uFU UTk?z%7npaԟ7l jmثX@ P|0Jd4E?-:.in-|Z0KMi\v:B@Z$aai(li~8?h6:Cf#5B R+]Dӭ> ! W|U&uaǤ;eX JcI,!ȇ FUCj  ObL^YHDv PHUJ[<}쐍QæSj2sʯo&}ksmZW|gu:R:6OPYFcN0|ȏz{ZihhN3G3EKL,Kqw3A7qSu /fR5'N䨧y+$D++MLʜ9$=<+Q,oET뫪lgMА9Q9jߑ%>1pMӢ0Lh ? A.`Lu'b`3yh rute\آ3=քHQX佰˹\Ӱ;/矇/yU=~#t|w]Ia|5f%cTV?x"W 8~OWyV?&núLd_.NEHPƉ&`h2Fv85.4{R].=<;u P+gZ2\Eqeb@X^#8!*#ɺLQo4)^L@0%Bt}Dz6#Yǝ2'sO! .k<<DZ 2+z%`[FG2,@2"@2!2ɒ7ːدq`x Ҙ;^(BUʆ|CgKX/6+¼d  XT Rf/t)32W~:)F?~륟w:^#_@ 1_lz m.l7$'&gWn\+Wxh_i^O~:N:VXQ/g:U xXX:8+cmPBI8 }b2)1!2c%2b&^P} El60I I JQ`Ĝ@"o) >ihwŀag8#:?7P?!*I4- Rb%,$E$W]2-=!lEa+z4e !3Zz"wBސ'D# 21d*:>v} 8vy-i?nv0zٵR+؃he^6X:bTҮ*GHa&{Mb:2PV~Yy Ih;%pi OɵvCoȎ՘Ļ%6fƢQӡw::~&-Bm8-NFO#$pR)GiR)ee?f.P F^m+U)gIk񕜷TX8'gqVȳ̠0rJj1(:[ )4F!X8,ȕRc(=xȦ'lX6t~#0RPVK@#0V[(dծFk`I6:!,~|֯UK 남 dhSt_"Q]- ~#0xx Dcli1a~x/+eFDW`W-mN}/o] [JOdoL/,ׯ<7yc$tD [Nysm*)}^ȓv!+?v2(l5nxu^QLCzee@m6\&^)+%[*~ M[H0VT݅vw}}^d"Ko Mn(eLڴPW{BC(@He }K$eepG_cD\Q9UHe)4Cw5'W.~q}HlGc˝Bj(Oʁ~04 E;If14ch*p-="~RB'_LS֥^{A޵jev5 9kO_wqڅp˺FG=!{#,кpNt= &esUgtvN]f\ݨh)ݕ9qQU~T=YBu/g_lO$, t1I7ְmDOmz1u; Ү0 Cr. z=Dzq X}>ǾXXˉ/ 㛳e!k020b`|Ac>Gzea_}#9H0cILo8JO(y%`hjcY1I9U5+֖~rzϻ؍Ep k-O0p7ܔ2"rHӺNȲD+@l$YXu^Ű|:p!2P.Qjw ŗEsҠ(p9JӀR,g`(E$ݷp&~5)b^f ,o_zTKoZNCO.kw{8D9YG6M5ɓp1`~_~ 6FbfHFr25pq 4›&"j«I5X*] D(4<7Wĕ{Gbk4B$NbϬ| =h'ENgPW|Z+ʒ9CA'SUC\>&,b_jtrFyW~M? yz1Y56IYuvxb!WhOрlpM?lP0EJSyW}%V+Cg5\aX}7_qloVxeQѺM9P1:mGuʷğChdHRbQQFƼIIHy(YW) Fx/E*SA!DSh:vJIIFq3 )b P&c k 9Z+1z۝if3U[3ǐ1{XC 55 $Qz.ܯx=.|]l㾲حtF{0|x!] } /! V3 _ bO>cRbc(fɠaB0CO5i|'b="m!|bUH1H+}%^R+S>𙀿[/\D+>|Ō=!oUXb Zб4Ǧ{XΫzc|tMQ;[ogƛ~E95֐-jPR?oK,ɗD๩kh$e7XSo*DܙM:Q0G `jyNQ MәU**ERXmdFd'68h28 aX_Uu:- `UWn12vM+)(DSr¼z3l(8I .=CYAE| :D( P"]qgr fK_DQnwIaϿ^J_}* ^G Y5HUtFvv(L!S.mrXEpf29#>+PR@$R Jb }&V`_!T2RQU~%:GI"ȡ}\ZWsx7B BL$Q>LvI`R8U* dz ^!V?9 M&DdG p)!fFM`Z[iۋR?An !UeBR4?e/˨}'ར 9.je>?x'* -z(q2ӫv O+.XLѢ°mO? ~ķrÖvt~]񎙒8L&;o6wv[o ԈW#,W>!%N\9X VĆ"ůG#{9K )1,~1RznɄkX~X}xߋY^1vVxX6{<n~m7Q;t|?ߴ#N0J*#%@RFz=0Bp|b#70x&p 76ڻ越3?s[Wdzqe˲$Ǐ:\cˉHb9ZjBImy@k!$h9-,Ӟ4m)׎҆cY,73o̽wf[+WzXr1f*)`\.!(قAqYQ.BQ^4uk D"~Wlv 9~/A\Q\e3DTVܼD% x1<|g|vY$~Ϟ3,/(9jw󚕅.>i7>xÂƠQ%^XXegʾj{9/~Z>:siGWRU-XY]%:NUCI %[o5^S1keݕ;wDt'^8h)qp=R^UX *%.W/ʳd㟝WÚ|E2NtQ2#RAR -d}rwɾhB%s ]y*jWw+?5lNү'_|?"W &\=Ǔ?;=;/'_?5U{ \*}GScxZF U9}FGShkKvn 8Vm22\RZJߧ؊<*^klS'@5dBa` )Q) t1Kl NOaV|ƃ>|G=f{uQ8Էlw]߼!W[[vng]_T\޽0v@1)j5I|AN*apW55vYp4BB26.hEA}z?SnkފN8\h9`(,s`Do1Ey#ga (HE ۼ^?ނFY6%18d'l ¼Q u* ᐙwՕ3޼[mnF's)C$ lJ[MpS鹍tKL%#ܽG-d>rH.yԽ<5^z#Pf-&7t=L*8jQ^PN 3ҖNɜl=U>Oky6=1߳=7 ^Vy1ՁB=-s:eWq0hw9u< 8 Cɥ0tzbtAj\Ң-I0;acoT|ȱ^&^$Rz~bVkf0}abp;"[>E-+#K1nEpf2Gn+ߍDA 1cf5%?"a[q$a; +!9EvsT;ϢN }ˋn ڶs^^e7u/rrm" 1K+WAOQ|E?= Z tw(=َ|Á4s>Ԩn$L#L[* 0dS'?[ʽ!Il9#0Uk~My!R]g7~><4B SAL#{O\N* >8\VT:r}7=!Q ZSfQq&]KnRB꬜XeDw*4= ͡*) 9pT(Vh 7|BkQY:ifBfZK>ƨ@B3HzUY ͡bCU0DZ&֠ C?Phwjl s,e(4"4U4BQJSTڟ*4D JkH΢+_$|5uD= F)4__߫РB/(4_gWhп 7Ji=)c]>J VХJlCY'&L9,xf"lPhovR/Qh.FnBCy)]D'?*4[Tv9BK K޲U ~7(_RZ)4 KX r*ixBp]U9փ אPK?CcDI8mcF/,Th/tSK z)܈C"ѯb5 mAIp;Q ɢpeEMOQDbZ6h%m,$I@ ~; rpwQTz@5rR}7]W݄t<R-|b23BW$oɾ CpZl)&K5A[!kHeKԏRlRIyBkBK.BhbIR✼jj]4OFbgr:LjjH5UrhZD0šwӒTD0m~dSY:N6MwZepMȼY1A*T\hZ`_:]OPaZ>MG!F.\krZ)EB"K.}~⒧6w+$WH[ۦ.Z o3-ɭw\|͟R,Yt$A.Z4.]RY=sT ,)'Ι+!muFU[bgz =3LO6۶+Sdĕɡdfg/*=9$.OW \ٖfo(V$3C QD`g7JgCFSh]Jz.L =b6ӗޓ*fԀlOdAR@_M:#!&#Tr(̄"V[gWj`?՛ЁmI 5,_֓Kdx;=,n-%!?4 TmnZ!6C=tpobזTYz k6-AP4JP|DOl-S!1} k`},Qx)s&9%J<ձ"k>A0dۉ3)H/k`[gv9P 3gžN\lInDдs'\D梷R-❋:K㔱W7 ~=>e㛃0C`4h \5W2jEAҴd$c_ zI߆_|8<}AI/GܙQ{7>`Mt_hpAs.n'q\lfALz99kQЫgg.zBRMJ]w.p PfgSKBF)#10gٓGcRp`(vFZ ٓa0G N" Þd|0ފR?>ŒQFT32O2c`7l9c5m ;dhYH6.P(艺}[*R7=99J; hA)vCMZtL|dAn}>YߤbR=ajHXML⮻>f$bdK:c br2I_\,Nxrq+/YO(>{ȷ ]3W7BI뫎j/N^q*<5ĜM&᳃'O$P 7 AơT=*bF~HPPQsDlTQ3^xMf\Ux+IFr8u*RFr"HX9('UV0N 0oKS\-)f%"qVJ^4A\P$uq9XGc C:;$C~(XD550syyfϰ/\PYV`kvU1r700i;m`D@%T i4fE1l17?"1b 3#fQX-Z|jSDr% %w'U _ ̐GOFACs,uA~YDpv?*,}Ih 4 =#{hZe,ANBQ!P;* i~0a)Ф4iTk*4nMk՚&Qjj-eHk# 5MmGi3ClF^=`-BZ8VkV5;t^nݸc^ԱI{˓>6,cԱjc̝yV)±d̺h bX{w qݍw8Z͖mnTY:֍.bclI~qVmǙO{q}% Njۺg`Р>0hԟa#uP 2LnC`"(A3#Qm\(D3 ŜQY92K ^{+hu=rr4zBt\>,G_ruZ{z-66v`9ඒ)2cB⠻(6cjӀ!n'KNpTNF敨V͙D @r|ryT2Cvv}Fp漱;HeNo&}L0 ed⿬F(<4N_!"%AdLy)u8~|> endobj 5184 0 obj <> stream x]͎0<|m`F"eEL"5J]${?[; c{ 9Cm6SCft};/O^)SzjӷiӍ)˿.~cz>ާWa6E^.S\Sχ.}s+xL>[cnSӆ bmV: C߷btn61TZN։N^RY p75B~O ސ_o\Klɚ)}4gn{` ֵwc^ڇ5__wKKL;0=e_m kc/BRk_i%RX} Kl%+Ùrxkq?^qg+^*ci1ЁԹDC;8!%m) endstream endobj 5185 0 obj <> endobj 5186 0 obj <> stream xܼy?^U==w;;;;{nòr,,ȍ *C♰¢I$HL*&Ĩ 艹Y߿:kS}uKmD R]}^D.Z}mƏʧƗ]qբZؿ_qڥ뮽!B7.[`[. wQ ܔ_C0ԣˮyB+^ϏPgFV-jǭ>B%]}͵/h-%}1 g"GѰ FY-Vt=^?BeTE2SU]SohljFcF;E Bi~T8ǮDr~Ecڄcr'ABFDpEB,֣2$ɨ9$GlBQ5wq MCh,6ڋ'>A7r4\VPM݅t[8 P ډf$= Cנ9kT@s.v/ҋ.B G\s<_Vh B|\: `psK Ⱦ{r$_HJU )c .,nZB#w؍dFYgxz1i@t _0.yaeNGяK[\o/Lzբ_ڄnG߇{>/cD}!z~ K\H;,*Dt)=X5&9NSkPނzՅ{M!z ZO =/0u؈8kq/bpz'AOR|ގ>?M. aS+i9WjER< [Q*"FO9'\r 9\d~Ki>}ܞ(<#Pـh$Ũ>h5ZcF z|CS~>8FPOkS*x m߂]ك ? s 6τH%ze$ydIg={/Fd,$N f+3f~J׌tkVj^cwe_ddO^n|/???/h@O=p ܽ2Ml2#r-7$Vhb~Ha;{r B1 B?@ook5E<&n\ϴhnӼRg-w'şa6K]3ƴ&I@Gh7ڋY/m| #@wItdFƑvMVs0Ck$Y3p6/x*Π}0Y,i9H T'txMM8 tɢ9S0癑7k[Y2ӥJiT Q3RD?ohzqH bɏUh9e ́z萟ϱws\dt 5hH[!8Q9ӿ7kr8G 9 }U<fo'ezԋN>@SgBDQЮGmQ5Ur T54w!s AMfpR߂&(ʸKf(mcZ[겵5UtE }-;+B:yl05ޭ袵^rp y;C[g̒Ã>yvs@G5@V@V=; Q=QECǴ0Z4DDQF1)TbvH`?ht?ѸCV!V%rܗ/cNwm=cUsc+f>cG~IZd`+bMUpk7xx*yd4Av\lss&fk`J}nɅ8#f%):$PaB@D /P2i814!JTD"\]N's|V +0B)V%!K`^zgZe;ɉlP1 Y18?7x*xC9%T*?C}?Jxθ[EX]MbmjSP\2(tX<^Ls̪`sGl,-vLPA{9hA>:YOuaLjx)Je,ץpMEccu?խWY8sK Wi$B4 Sfqj2Z;? ϙwM:|iopbsdg2K#k [͟>vʵ't)!-ͱ!']!\v2tN:OSDG*)34Wܖ:D#"h"$YkDګyZUY+F9{RĢ'x*%rt {Fr)ϧRa`TόЙ=;7` vy\[ ڝASNg~vRopqI'l9HA7sAȔ'Wy&r6܂xʋ;.uy/|r~:g#3gri[[a?śV lR8av 9pAt:K6o1n*7IGLcUI53ҾwDF٦uul 8HfDG)F] +K*9WTjJuXQ< Ɉ1d9́`sV^GGGN$F$R{: Y5\ɤ.ͅK_{DR%`P A8?.08 60 9X^xtT68 t8`ιLQy#Ϸ+rYeķAk@1m)f " F?}pUEsάY&TVίaLV͆AһɭIDLJ_t.[\PL+CՇ, QK"BvI ِqAKA5̎-bAt!eB*L*6+F}I*!SHD C%J: Y5\q{JMx&W\u!i(-}byQ頵Z]AT]yҕCdpm3@^M{qO\2@Ӏ);y% Şʔ!b?KLy/ԖQi͢U ,?T=S ͿT&/Ǔ͢T9jP*ߍ O-~*ڲILg쨬O'ۓ c1rI^|{rR1s2T{tl #jKUNSP%f݂'BD\^/|_\uЎ >G687_/{23+;b$92g>b&Z> #PeEP.>+:R yRA"ҍUUJUoU_*J+Odߘ0[{bhсUd$\x3Ĵ(3bGº1$ 957ߌ@΀r&DUE<=^ԣqz"WZ< 7_'H_ob1y{pWzXڑeGVO]wI򲩂+ ]<2_(?Iv]*xz4%h2P5)iI gw_"cb}f}}' ߕ ekdMڤ80)H5C$0Ckd3H%RClb^={ZxVh(VG_f ٹKhA$O![E̴ L-+dq&;-;/{uvCvZ! M%VKol*ô*6@Ӡ @C= v-mK=ܮmuȐ8cPg+٬`l[ajӫ>—IAj9tDJ>xRA[ }]ņ B;?dshA\m;³ڲAhkm"*B,F_(BL{F fQXn 9Z2ήG^~~)ۭ;f+Em5,z֧q 'j''(]Nk{(uѓQ3ƉFM~!gZQ l&l+4`:*,D%,RDY{ zDv.rJ,65CD$8%$(A"Z'8,p8ĝH/2WQ%<=ENQJ5?X^< =9tIsPxK(D$jQ.Pp:V欚g:Su-~nqI3cSo.rk PCkE/, JuSc6hQP i݀o_aNeGMFS/W>9]]=OWrv遇<mD_TP)AC냤q:bcz ܎67v|WxHV&Ũc`(bzN H X#@<1,5b9 E@ܡt?fg}t h`>hjh` O>0Q `VFtg1(eTg*OU'+Iq84cTk)ÕQI% Cf(ziIgi2+͕4m "pzɺ:he2v6q)+k-yTi~$]2ؾ)Sd28-vkwؔVw1/N0x@~e7/8ٺ}W+S{뵸/ꮐVV;m؞GɯO,;l1OS')L49l;n 1K5Β0ދ _'ԎG#Nň'Zr j`[rM`7ߠCE5@LY5\-͋JQq\ӝ-=:咪"&W ϜS{<=m[KJD~EP_x!Y$NE g!Qk@1P^K^Z'7xZX\2pYLZiT[}TU+ս}՚/7Y#2*^qI#kTMWEoT%j,)US) iuiuiMϪ:jh i-'T BRM'p?vJP5 3ZJL k<}Ćmݑ=}'#OEw`bfTuq!Kt U` 1ډ3xre[Q0sam+K?ڝub$ϼGC[?x]4/rxdfy.żͰH`D!|D`8n%  1 薘 f%> X–ۜFg] DqIcxEqGb̀:)t+uSd NA';O)d`d}iܔ.&5N%.t 8KI86Dqj# ~Ǚ8/!x 9Mt➊PRN.GQQ8Zzzӆ*ԛbD3eRCCVC{H!]PU4Ae#@a,50]yARZ|MS..&:hMygNJ- `kNX2w(cEx5yF8WQc0"B F*ė5fv)Qa:d"8 l]aweB!ڀiq8G5 䢣S&tq%0)3 vY AYp" Ad!-4`.Ei'v>oA2TSo>bb<Wpd{|0o f_̝x{F@GN(7KqՔ66i!rJMSl@1AH0w 3q bebeTJ& ȇ1/Oґ>ߴ#oķljX̰h'+)S Zmqo0Ws `QZ$V&$6(wc(-\w K?z4j;w>JN~mkb,R}hOc>5xcn5ms~ۀkc?~|Mu]tk -W^v5juZ>UQ*O>_hjXڇjWڟZC_-mk%mNѮn>ݧ}]ΠiݪeܦK3-ݤf'e2ĭ$%]YoY{}) 6@,bjXϘFW}y@ԏs")*GΞ=nmJeI%H 9nTR?7VW7*I_>Z,u,\Um +pK)['_2֪z ֬;G%k\>mw_!RsJm]wSR'uL7M^P) | ~bĤT6P=5%˻).{%j`囬zdF/31 +￲iSjY31+1+Ƒ1NH4:m]K:M6 V!.g&V^D>sG GWF$N b"(,h&uR[j ׅ5WhԆ{NA1M_@4}QkܔO.*GE(&bc{cllSPX-k6 "WI>k3=񪄒؛`ҜPk=sf-3&T` _@TՔtKk68;( |k׹˚̺)-*`\(+K`\E`BH{"ZM8jodT%do/79hoަ#4 (z"fc4_ft_}{)Dx}oSZj'V'd?yZUDtGb#o[&6?sf{,.ftO/zV2ume3 M2u{g{fU-3써ۅLWpWWwe@OxWSd̘9#/qSrtgFbfd/w$ʢ)s&ؽ^drÐ gɈxG"h4=(D? :08,Eէ?fT^1.82ŒbP"`oS= SUux33#`e1֦T1\ BœE &1Dr, ]E oe5{jnM_,\v5c0j>N} -- cLΟk1yL(Ag~XؕS\%9%%ERLD"F+JJoꕒ_ʩv Ț-6ZM@3*.H n#edD<=i5B䨫$(_kɚTOБQ #LdCƓFʸѸݸ!hO?7FO(S!7Ř4nlO<ij3?1F [*L9ES$DRwR)KTYںDk!ٓs=4s7u;o^fҘNc]tcQ쫚B,l?>1=>[^ۿf!)q2"SiV ZZQdp}'*ه;#TZHq YIHTJ wJ nJ-PVqQKH>cMf&Tkm)KmnLn:#YԽ{x\ (z1u.y焇Q<@WTZ=~!}"(mi qci@$;쩱d2HNez&t#USU]@<תrq)$UFKIF <f}x5[0xhp5A3֣!df3*V)Յ@쳒.@Ǫ3t~nƬQNNM3f4n_U@qQԁ>$:(X̭-qպ`(օyt~>սJWIK~ [J{ ?捞[Yw5D[>SԬ56O{W`ɍ~FnjszgoّʬLo~ (h{6(Q49_}ý EQ5D..&w?]\𹊷ߥ;/ÍO]Bfɦ'k(qlȗUnmIxE)2_=EIc;υ^pFaU{$-^Nqfۏߙ?52o|lžG>{sMݳ''e޽xmLn\j.~,pUvΜkZ 6_&Vmԍo{hߦfTUC(zmsoS#lX턍6lN2J,UVLe0V m*Kʒ߾䷯,6JT\,/Kw'p&qQr'JfE7~8vA?[袯pуbkуozԃow~q%y$h3%*~Y7&55+R!ZqU6ś]%k[ ybODJ̑X?Uh RD^۬#}oY1ϣ_kuu\jcXRn.m{t0(qaS-"ےQ*{6Ԧ6J+mÝj!;6h@tÙ=аh dl2C_1P3w ֢ unwP|ej5pJbYDhό8iAQ=(bAD"1bg+BVʒ*IpB)Kf+SWb[[qTi,iӭρ<vݖ:jUvE gSSťc ;Gi) e㷤šJ_KjKhCVJ 5o(&ElԨv6S\/ArI@zLC~1%7?q9߲ۯ?5;7niiw|H]qf$D ¸/|EXizjF ij Z3EਊVjƑEDeUN?++ǏW懖tLa)̋2€NN;+V{:^s0Z6vK.!ya|x6 rKX4E~gBޤ{@ 1zP4Z Vhn_Apz–Zi 7x+.0M&\I"r/'.;hlbi0XAqЯE954)9}V}&lEgu#֎ jFte3i`(T`BwPoWq-O-ȹ+;CyoV 5칣dºT3 _,?ubxΕB/`-|StPM86ݗI2ѽ{'Iɍ z4f^MoJjڍ^'j 55k<זݦճ=D/!ۓDLm@XD@y7ٲ"RW_ʝmM|^lm=K7)WS(7ñ@CN9F_ EHVFR oh  9U\|{fRHPDhirWp[lE%G98dMȔy{;<oxh&#b~s%{o];&~d0aWare/X}kÓq=C …?0[H-'KXZq޷GU܋Ϝ9޳{vI6$d_ņG ِ@X!jVWUڒ.%Wk[ }xZim{p[O 9 A{w39ٴGS%YSiR,YUYP`"BjnAF!hs<}m|̙ сM) WKyAXg>@ :/Aݩ+@)م6m*Ն UWK⒜ҝ ˖ .xV~;(=TtPՙjKtd;6ً%b}I1#ɶY9vV%b\%ml}FNfvp+eWUd0CnӳAYJ$;u fTb(g+'g.φ+eKцi*Q osmFEbXyY^puXu;f<ǃZٳgϪ Fp1=xCtkS۳L$ f`ebi%.ubڱX]JOaGS H+޶q"앣KS'>l. OzfqOx+ u<+U,8?s#Lq|L-g%L gG-"nf@VI`Ō{}lחQ,y]>w^Q8+׳{{KDoboz8 uaF:_^^3pB݇hnw&rVVa)B@d. ^RNӛ\9h ZIefvCp~~ߙΙ6vЩ^opEAA 6nFXj6"6 9r)u6 \# @H.BX$gV/tUdgR B~VAl!B?j,,z s(-zpN:炳lm)fleT_zh_('1iJ`'z~>* mbjٳ4Fϗ™[E- ONt-Wۍ3ɳ> #4rrʼnHBc&_`63ߏ5dxfWpKd'G>}6zkp5Yk=LO bcIvε7Y?-op.+m +er7sp9'`5:dzȪ3TPꎃ=a?+w&Y aP5pN0 תc. gäbJ`LStrN'6%$#f=Z\Ẽ~'b<1;#QUbN*tq 2)P!vcqZ+϶n')g+)cd+Pާ3GX]HWY[(?A-CtSTۙ Z7__C dE;@ NL* yhG,7Øӷ٠uM"}?ḇ[WI.6\$+۱^vNml AF:4u>Dq1:uNIb6[=ag'3ܶoȽMa:>ztu^{rB͝MKsW.tΒK8_t?u@~w\IԵC(Bʧ8:!祯no>Gx?iR`K1toi]vMۧHo2uNuu!FqH|WڿxwҚk %%4/&}Wᮣ/jyimusZ/}_rβ]{5d?4Kc&^L'UN M#nV՘hL/8d6blQ: gPK B)eQ= <(f5P;1l/BTH‹ qo0x?jIBi+0 ka9Wvh~_-Vd5Zy}j+g37CyLH~8m(h#+% t`ڲ۰Ϛ׆i@E0P y']V28z.[=Wu` ){;m-,ȍTzIys0,tˊa=FzYѱv'upOum1Y7:qzD%rWѷ`Xxc&$L#gLI|Qӥ<|[񞱼 (@94D! v).*4ߝwX^z/?J#GLbk#(9Qvt8+RnM/MH;W3Wyfd<" xHon_t@롭/AduAp}+EĘ8@/Fk}&T71a6B]MPh5.t5Zm@?5ڈJmB4Zpsth!^}&hG#hGizF}FPF 8$c@\6QJFSmwh4wF(h` ڔX)ցV7j[$eU픷;rx`v0>QsW&]~r`ndVڦTz?%krguIU5ҹP/N:9Q2⛪Tpr`_إsj"vj_' Ab!ijM\Uo=+GKJ;x71SI%[EruO{ye@gΎ[:啉-=S+>'Sϊ MST2GŻK1e|VV2T*vtni,'nv^yvvvȫ[ARkoGq_NOܞ({BVSu{wS.B{{:w@Do}/kgFC@'ߕK M[Һ5˪YC47vopwo{PL}=d BuC;pAE<ygΗ;PdNq_2I湿sTN2#zcM|P72عjbHlIΌݪ& a4C}CrG6\Nmic}bA4pe]bMUze5>ry|sra.`ꟃ9`p05ݷtC=ʽ Fۀ ]6C\45pِS|Л@td.K]?%g@9 !2rT`끸>Sj{jZG/_B 3.ߋy5\ rN:jYtr5PYr9 %qy˄[ZO?/J?j|.j9[Ǭ(JJz4[Bdy'dv0 (;KcI@*U&.KQq9R15bUj9gXi*eq*acujEs\Q*U.C`<lo'{NP^&Xj","ja+#̴FЊ5}z]/0@ r<(zLnMAw\o3hnR)&WLD$-E&/ =4TwZZ/]6[F Vv  08pՐ:Mc6{~\/Qld1d}1b%|Fvœ6%P!F(xR,8L4Ji_\pXYE0Yt\|zŤ֫11F9GO\Q im)Y#Ã樂FtLtB Q(j 0Cü sݹ<@SCf*1K 08X v@ .g ()xL FI Ed4aDHB;ݱ ;d'SS0 M(Fy->ӮUM' ؘS_Qa;Zm^8ibl"؝hӕhxt};!G .$":o?/b\1IKTA][,}]BߠBDl-{-#q1nD????5[}]a^?2Խ`phÌ8ǘ}[cMYB)sQjAsps~c~N~?>?F~n{-H[,oAȷXo\|7ߛ&{(u)0Q>0K(Ž٫ӹGAu`>p{`V$Mܣ`Ƹ=cys{ *QQCcD!&TQqnRKyw+ UTQzz4)>58b>cyQ}`w$0n \oY8c&Lrn^PB"1)Upt/83b̴,>>?|>-E~p>?0sS~^ O]XWWWx+< x^a P಩efV,]>_d{,4B П Wfyq g 8hՊs Ĭ+$11*,%^ ȣWTRRQH )*[ۢ"N KI<}>RMtN ^A]t=Q I%^/P%>gpJ)=%@O(]cJ׃tG PyQyPުĩ>%^ (ڬT[o;@,/HwHai,#BFڤ}]L·L %9 v- G &iw8@m[! 񻥁pVKFٵAj ?(a)6jCCђJ汸kT)*)2 A:JҚy/q ]"ˆ[ mՆE\CetEh5F9#2"E/ӛQȥ)-r쎙z> 5Z42/Ґ4_9Ri16]n/4㆑v&[KbFtExـV/rwW< qgIeb\p︿mrW9+0Z4v[rH"[ ֍<<憑U5r=ܦڃfom Ur )6TIlxkG++UFo88F0?pF9dXJ2??{;dXB2OK)o(204 ܲ|G@\Oay 2΂F@Pd:x1z : TP+4a9Z9 endstream endobj 5187 0 obj 26521 endobj 5188 0 obj <> endobj 5189 0 obj <> stream x]ͮ0y /oW8)BEbBbhK3m.@Ǔ33_&|waɿ;E]>=B_1FCwv{z;i{|v_Sl?e0Wswc?͏*F|n/zayƔ+#gMn}n;곦(696SΗWUGkQFt]A[ѕ.7Ў5tx ]v_1nQB+qS@=S;hW?kר_CD^A,5K/W&07_Ie?`_! ~C~'2[h[[6C~#_b>Nx0C~ K~7. N< 6ͦ~K~^6KďojCc!ĵE} 4#K~ endstream endobj 5190 0 obj <> endobj 5191 0 obj <> stream xoE: %K*:)M*!4 T-vƨUzTC+q( *$p%zpJ Iz=v?z'{^'-C_ѥm7FgTGEo'Rrns0GB6dɮi5[O6Q||6UN۔l}c}ڝgws0J]*bwʮssx=xg{#3'㑙Tzr63ytb<̌*[˚|7TZll,U*}Mcۛ* _);Z)KkGO$wJ34RDe2ɥ:$SsTs0HJ*"cR# ;wًʼnۣ){g_K endstream endobj 5192 0 obj 960 endobj 5193 0 obj <> endobj 5194 0 obj <> stream x]Mj0 >ЮL;Eh8("왶Ѕzx<}YRf|pk"8 Z|UIB2;kƥS:!߸fp7BCai`=l)}!C#y2,(+u}ޏn/Qlt&cLQtM;ԅ'i-;UZrWGPVIv#T5N *T&o endstream endobj 5195 0 obj <> endobj 5196 0 obj <> endobj 5197 0 obj <> endobj 5198 0 obj <> endobj 5199 0 obj <> endobj 5200 0 obj <> endobj 5201 0 obj <> endobj 5202 0 obj <> endobj 5203 0 obj <> endobj 1 0 obj <>/Contents 2 0 R>> endobj 12 0 obj <>/Contents 13 0 R>> endobj 16 0 obj <>/Contents 17 0 R>> endobj 161 0 obj <>/Contents 162 0 R>> endobj 184 0 obj <>/Contents 185 0 R>> endobj 205 0 obj <>/Contents 206 0 R>> endobj 267 0 obj <>/Contents 268 0 R>> endobj 287 0 obj <>/Contents 288 0 R>> endobj 290 0 obj <>/Contents 291 0 R>> endobj 324 0 obj <>/Contents 325 0 R>> endobj 333 0 obj <>/Contents 334 0 R>> endobj 374 0 obj <>/Contents 375 0 R>> endobj 413 0 obj <>/Contents 414 0 R>> endobj 447 0 obj <>/Contents 448 0 R>> endobj 480 0 obj <>/Contents 481 0 R>> endobj 509 0 obj <>/Contents 510 0 R>> endobj 547 0 obj <>/Contents 548 0 R>> endobj 557 0 obj <>/Contents 558 0 R>> endobj 599 0 obj <>/Contents 600 0 R>> endobj 633 0 obj <>/Contents 634 0 R>> endobj 671 0 obj <>/Contents 672 0 R>> endobj 709 0 obj <>/Contents 710 0 R>> endobj 787 0 obj <>/Contents 788 0 R>> endobj 823 0 obj <>/Contents 824 0 R>> endobj 876 0 obj <>/Contents 877 0 R>> endobj 919 0 obj <>/Contents 920 0 R>> endobj 967 0 obj <>/Contents 968 0 R>> endobj 1029 0 obj <>/Contents 1030 0 R>> endobj 1070 0 obj <>/Contents 1071 0 R>> endobj 1104 0 obj <>/Contents 1105 0 R>> endobj 1143 0 obj <>/Contents 1144 0 R>> endobj 1172 0 obj <>/Contents 1173 0 R>> endobj 1218 0 obj <>/Contents 1219 0 R>> endobj 1260 0 obj <>/Contents 1261 0 R>> endobj 1302 0 obj <>/Contents 1303 0 R>> endobj 1324 0 obj <>/Contents 1325 0 R>> endobj 1350 0 obj <>/Contents 1351 0 R>> endobj 1371 0 obj <>/Contents 1372 0 R>> endobj 1400 0 obj <>/Contents 1401 0 R>> endobj 1421 0 obj <>/Contents 1422 0 R>> endobj 1442 0 obj <>/Contents 1443 0 R>> endobj 1480 0 obj <>/Contents 1481 0 R>> endobj 1526 0 obj <>/Contents 1527 0 R>> endobj 1587 0 obj <>/Contents 1588 0 R>> endobj 1645 0 obj <>/Contents 1646 0 R>> endobj 1692 0 obj <>/Contents 1693 0 R>> endobj 1755 0 obj <>/Contents 1756 0 R>> endobj 1773 0 obj <>/Contents 1774 0 R>> endobj 1808 0 obj <>/Contents 1809 0 R>> endobj 1849 0 obj <>/Contents 1850 0 R>> endobj 1900 0 obj <>/Contents 1901 0 R>> endobj 1926 0 obj <>/Contents 1927 0 R>> endobj 1970 0 obj <>/Contents 1971 0 R>> endobj 2015 0 obj <>/Contents 2016 0 R>> endobj 2049 0 obj <>/Contents 2050 0 R>> endobj 2073 0 obj <>/Contents 2074 0 R>> endobj 2098 0 obj <>/Contents 2099 0 R>> endobj 2122 0 obj <>/Contents 2123 0 R>> endobj 2144 0 obj <>/Contents 2145 0 R>> endobj 2168 0 obj <>/Contents 2169 0 R>> endobj 2190 0 obj <>/Contents 2191 0 R>> endobj 2215 0 obj <>/Contents 2216 0 R>> endobj 2236 0 obj <>/Contents 2237 0 R>> endobj 2262 0 obj <>/Contents 2263 0 R>> endobj 2286 0 obj <>/Contents 2287 0 R>> endobj 2309 0 obj <>/Contents 2310 0 R>> endobj 2315 0 obj <>/Contents 2316 0 R>> endobj 2372 0 obj <>/Contents 2373 0 R>> endobj 2427 0 obj <>/Contents 2428 0 R>> endobj 2434 0 obj <>/Contents 2435 0 R>> endobj 2472 0 obj <>/Contents 2473 0 R>> endobj 2511 0 obj <>/Contents 2512 0 R>> endobj 2541 0 obj <>/Contents 2542 0 R>> endobj 2557 0 obj <>/Contents 2558 0 R>> endobj 2676 0 obj <>/Contents 2677 0 R>> endobj 2772 0 obj <>/Contents 2773 0 R>> endobj 2891 0 obj <>/Contents 2892 0 R>> endobj 3005 0 obj <>/Contents 3006 0 R>> endobj 3011 0 obj <>/Contents 3012 0 R>> endobj 3058 0 obj <>/Contents 3059 0 R>> endobj 3111 0 obj <>/Contents 3112 0 R>> endobj 3165 0 obj <>/Contents 3166 0 R>> endobj 3219 0 obj <>/Contents 3220 0 R>> endobj 3265 0 obj <>/Contents 3266 0 R>> endobj 3315 0 obj <>/Contents 3316 0 R>> endobj 3368 0 obj <>/Contents 3369 0 R>> endobj 3403 0 obj <>/Contents 3404 0 R>> endobj 3548 0 obj <>/Contents 3549 0 R>> endobj 3762 0 obj <>/Contents 3763 0 R>> endobj 3981 0 obj <>/Contents 3982 0 R>> endobj 4199 0 obj <>/Contents 4200 0 R>> endobj 4418 0 obj <>/Contents 4419 0 R>> endobj 4606 0 obj <>/Contents 4607 0 R>> endobj 4798 0 obj <>/Contents 4799 0 R>> endobj 4986 0 obj <>/Contents 4987 0 R>> endobj 5204 0 obj <> endobj 5205 0 obj < /Dest[184 0 R/XYZ 85.1 640.2 0]/Parent 5204 0 R/Next 5208 0 R>> endobj 5206 0 obj < /Dest[184 0 R/XYZ 85.1 336.5 0]/Parent 5205 0 R/Next 5207 0 R>> endobj 5207 0 obj < /Dest[205 0 R/XYZ 56.7 207.6 0]/Parent 5205 0 R/Prev 5206 0 R>> endobj 5208 0 obj < /Dest[290 0 R/XYZ 85.1 640.2 0]/Parent 5204 0 R/Prev 5205 0 R/Next 5218 0 R>> endobj 5209 0 obj < /Dest[290 0 R/XYZ 85.1 297.9 0]/Parent 5208 0 R/Next 5210 0 R>> endobj 5210 0 obj < /Dest[333 0 R/XYZ 85.1 723.1 0]/Parent 5208 0 R/Prev 5209 0 R/Next 5211 0 R>> endobj 5211 0 obj < /Dest[374 0 R/XYZ 56.7 723.1 0]/Parent 5208 0 R/Prev 5210 0 R/Next 5212 0 R>> endobj 5212 0 obj < /Dest[413 0 R/XYZ 85.1 723.1 0]/Parent 5208 0 R/Prev 5211 0 R/Next 5213 0 R>> endobj 5213 0 obj < /Dest[447 0 R/XYZ 56.7 723.1 0]/Parent 5208 0 R/Prev 5212 0 R/Next 5214 0 R>> endobj 5214 0 obj < /Dest[509 0 R/XYZ 56.7 723.1 0]/Parent 5208 0 R/Prev 5213 0 R/Next 5215 0 R>> endobj 5215 0 obj < /Dest[557 0 R/XYZ 56.7 723.1 0]/Parent 5208 0 R/Prev 5214 0 R/Next 5216 0 R>> endobj 5216 0 obj < /Dest[599 0 R/XYZ 85.1 723.1 0]/Parent 5208 0 R/Prev 5215 0 R/Next 5217 0 R>> endobj 5217 0 obj < /Dest[633 0 R/XYZ 56.7 723.1 0]/Parent 5208 0 R/Prev 5216 0 R>> endobj 5218 0 obj < /Dest[671 0 R/XYZ 85.1 640.2 0]/Parent 5204 0 R/Prev 5208 0 R/Next 5416 0 R>> endobj 5219 0 obj < /Dest[709 0 R/XYZ 56.7 723.1 0]/Parent 5218 0 R/Next 5238 0 R>> endobj 5220 0 obj < /Dest[823 0 R/XYZ 56.7 574.7 0]/Parent 5219 0 R/Next 5221 0 R>> endobj 5221 0 obj < /Dest[876 0 R/XYZ 85.1 624 0]/Parent 5219 0 R/Prev 5220 0 R>> endobj 5222 0 obj < /Dest[876 0 R/XYZ 85.1 545.7 0]/Parent 5221 0 R/Next 5223 0 R>> endobj 5223 0 obj < /Dest[876 0 R/XYZ 85.1 410.2 0]/Parent 5221 0 R/Prev 5222 0 R/Next 5224 0 R>> endobj 5224 0 obj < /Dest[919 0 R/XYZ 56.7 593 0]/Parent 5221 0 R/Prev 5223 0 R/Next 5225 0 R>> endobj 5225 0 obj < /Dest[919 0 R/XYZ 56.7 488.5 0]/Parent 5221 0 R/Prev 5224 0 R/Next 5226 0 R>> endobj 5226 0 obj < /Dest[919 0 R/XYZ 56.7 383.9 0]/Parent 5221 0 R/Prev 5225 0 R/Next 5227 0 R>> endobj 5227 0 obj < /Dest[919 0 R/XYZ 56.7 161.2 0]/Parent 5221 0 R/Prev 5226 0 R/Next 5228 0 R>> endobj 5228 0 obj < /Dest[967 0 R/XYZ 85.1 625.3 0]/Parent 5221 0 R/Prev 5227 0 R/Next 5229 0 R>> endobj 5229 0 obj < /Dest[967 0 R/XYZ 85.1 502.5 0]/Parent 5221 0 R/Prev 5228 0 R/Next 5230 0 R>> endobj 5230 0 obj < /Dest[967 0 R/XYZ 85.1 267.1 0]/Parent 5221 0 R/Prev 5229 0 R/Next 5231 0 R>> endobj 5231 0 obj < /Dest[1029 0 R/XYZ 56.7 618.3 0]/Parent 5221 0 R/Prev 5230 0 R/Next 5232 0 R>> endobj 5232 0 obj < /Dest[1029 0 R/XYZ 56.7 556 0]/Parent 5221 0 R/Prev 5231 0 R/Next 5233 0 R>> endobj 5233 0 obj < /Dest[1029 0 R/XYZ 56.7 493.7 0]/Parent 5221 0 R/Prev 5232 0 R/Next 5234 0 R>> endobj 5234 0 obj < /Dest[1029 0 R/XYZ 56.7 320.3 0]/Parent 5221 0 R/Prev 5233 0 R/Next 5235 0 R>> endobj 5235 0 obj < /Dest[1029 0 R/XYZ 56.7 190.4 0]/Parent 5221 0 R/Prev 5234 0 R/Next 5236 0 R>> endobj 5236 0 obj < /Dest[1070 0 R/XYZ 85.1 661.9 0]/Parent 5221 0 R/Prev 5235 0 R/Next 5237 0 R>> endobj 5237 0 obj < /Dest[1070 0 R/XYZ 85.1 526.4 0]/Parent 5221 0 R/Prev 5236 0 R>> endobj 5238 0 obj < /Dest[1104 0 R/XYZ 56.7 723.1 0]/Parent 5218 0 R/Prev 5219 0 R/Next 5315 0 R>> endobj 5239 0 obj < /Dest[1172 0 R/XYZ 56.7 723.2 0]/Parent 5238 0 R/Next 5240 0 R>> endobj 5240 0 obj < /Dest[1172 0 R/XYZ 56.7 492.8 0]/Parent 5238 0 R/Prev 5239 0 R/Next 5241 0 R>> endobj 5241 0 obj < /Dest[1218 0 R/XYZ 85.1 692.9 0]/Parent 5238 0 R/Prev 5240 0 R/Next 5245 0 R>> endobj 5242 0 obj < /Dest[1218 0 R/XYZ 85.1 614.6 0]/Parent 5241 0 R/Next 5243 0 R>> endobj 5243 0 obj < /Dest[1218 0 R/XYZ 85.1 221.8 0]/Parent 5241 0 R/Prev 5242 0 R/Next 5244 0 R>> endobj 5244 0 obj < /Dest[1260 0 R/XYZ 56.7 631 0]/Parent 5241 0 R/Prev 5243 0 R>> endobj 5245 0 obj < /Dest[1260 0 R/XYZ 56.7 525.1 0]/Parent 5238 0 R/Prev 5241 0 R/Next 5286 0 R>> endobj 5246 0 obj < /Dest[1260 0 R/XYZ 56.7 242.7 0]/Parent 5245 0 R/Next 5247 0 R>> endobj 5247 0 obj < /Dest[1260 0 R/XYZ 56.7 180.4 0]/Parent 5245 0 R/Prev 5246 0 R/Next 5248 0 R>> endobj 5248 0 obj < /Dest[1302 0 R/XYZ 85.1 723.2 0]/Parent 5245 0 R/Prev 5247 0 R/Next 5249 0 R>> endobj 5249 0 obj < /Dest[1302 0 R/XYZ 85.1 673.5 0]/Parent 5245 0 R/Prev 5248 0 R/Next 5250 0 R>> endobj 5250 0 obj < /Dest[1302 0 R/XYZ 85.1 585.9 0]/Parent 5245 0 R/Prev 5249 0 R/Next 5251 0 R>> endobj 5251 0 obj < /Dest[1302 0 R/XYZ 85.1 523.6 0]/Parent 5245 0 R/Prev 5250 0 R/Next 5252 0 R>> endobj 5252 0 obj < /Dest[1302 0 R/XYZ 85.1 405.1 0]/Parent 5245 0 R/Prev 5251 0 R/Next 5253 0 R>> endobj 5253 0 obj < /Dest[1302 0 R/XYZ 85.1 330.1 0]/Parent 5245 0 R/Prev 5252 0 R/Next 5254 0 R>> endobj 5254 0 obj < /Dest[1302 0 R/XYZ 85.1 280.5 0]/Parent 5245 0 R/Prev 5253 0 R/Next 5255 0 R>> endobj 5255 0 obj < /Dest[1302 0 R/XYZ 85.1 199.9 0]/Parent 5245 0 R/Prev 5254 0 R/Next 5256 0 R>> endobj 5256 0 obj < /Dest[1324 0 R/XYZ 56.7 692.8 0]/Parent 5245 0 R/Prev 5255 0 R/Next 5257 0 R>> endobj 5257 0 obj < /Dest[1324 0 R/XYZ 56.7 586.9 0]/Parent 5245 0 R/Prev 5256 0 R/Next 5258 0 R>> endobj 5258 0 obj < /Dest[1324 0 R/XYZ 56.7 537.2 0]/Parent 5245 0 R/Prev 5257 0 R/Next 5259 0 R>> endobj 5259 0 obj < /Dest[1324 0 R/XYZ 56.7 400.3 0]/Parent 5245 0 R/Prev 5258 0 R/Next 5260 0 R>> endobj 5260 0 obj < /Dest[1324 0 R/XYZ 56.7 325.4 0]/Parent 5245 0 R/Prev 5259 0 R/Next 5261 0 R>> endobj 5261 0 obj < /Dest[1324 0 R/XYZ 56.7 182.8 0]/Parent 5245 0 R/Prev 5260 0 R/Next 5262 0 R>> endobj 5262 0 obj < /Dest[1350 0 R/XYZ 85.1 723.2 0]/Parent 5245 0 R/Prev 5261 0 R/Next 5263 0 R>> endobj 5263 0 obj < /Dest[1350 0 R/XYZ 85.1 648.2 0]/Parent 5245 0 R/Prev 5262 0 R/Next 5264 0 R>> endobj 5264 0 obj < /Dest[1350 0 R/XYZ 85.1 573.3 0]/Parent 5245 0 R/Prev 5263 0 R/Next 5265 0 R>> endobj 5265 0 obj < /Dest[1350 0 R/XYZ 85.1 498.3 0]/Parent 5245 0 R/Prev 5264 0 R/Next 5266 0 R>> endobj 5266 0 obj < /Dest[1350 0 R/XYZ 85.1 436 0]/Parent 5245 0 R/Prev 5265 0 R/Next 5267 0 R>> endobj 5267 0 obj < /Dest[1350 0 R/XYZ 85.1 386.4 0]/Parent 5245 0 R/Prev 5266 0 R/Next 5268 0 R>> endobj 5268 0 obj < /Dest[1350 0 R/XYZ 85.1 293.1 0]/Parent 5245 0 R/Prev 5267 0 R/Next 5269 0 R>> endobj 5269 0 obj < /Dest[1350 0 R/XYZ 85.1 199.9 0]/Parent 5245 0 R/Prev 5268 0 R/Next 5270 0 R>> endobj 5270 0 obj < /Dest[1371 0 R/XYZ 56.7 692.9 0]/Parent 5245 0 R/Prev 5269 0 R/Next 5271 0 R>> endobj 5271 0 obj < /Dest[1371 0 R/XYZ 56.7 643.2 0]/Parent 5245 0 R/Prev 5270 0 R/Next 5272 0 R>> endobj 5272 0 obj < /Dest[1371 0 R/XYZ 56.7 568.3 0]/Parent 5245 0 R/Prev 5271 0 R/Next 5273 0 R>> endobj 5273 0 obj < /Dest[1371 0 R/XYZ 56.7 387.8 0]/Parent 5245 0 R/Prev 5272 0 R/Next 5274 0 R>> endobj 5274 0 obj < /Dest[1400 0 R/XYZ 85.1 680.2 0]/Parent 5245 0 R/Prev 5273 0 R/Next 5275 0 R>> endobj 5275 0 obj < /Dest[1400 0 R/XYZ 85.1 519.4 0]/Parent 5245 0 R/Prev 5274 0 R/Next 5276 0 R>> endobj 5276 0 obj < /Dest[1400 0 R/XYZ 85.1 400.9 0]/Parent 5245 0 R/Prev 5275 0 R/Next 5277 0 R>> endobj 5277 0 obj < /Dest[1400 0 R/XYZ 85.1 138.9 0]/Parent 5245 0 R/Prev 5276 0 R/Next 5278 0 R>> endobj 5278 0 obj < /Dest[1421 0 R/XYZ 56.7 593 0]/Parent 5245 0 R/Prev 5277 0 R/Next 5279 0 R>> endobj 5279 0 obj < /Dest[1421 0 R/XYZ 56.7 499.8 0]/Parent 5245 0 R/Prev 5278 0 R/Next 5280 0 R>> endobj 5280 0 obj < /Dest[1421 0 R/XYZ 56.7 412.2 0]/Parent 5245 0 R/Prev 5279 0 R/Next 5281 0 R>> endobj 5281 0 obj < /Dest[1421 0 R/XYZ 56.7 293.6 0]/Parent 5245 0 R/Prev 5280 0 R/Next 5282 0 R>> endobj 5282 0 obj < /Dest[1421 0 R/XYZ 56.7 218.7 0]/Parent 5245 0 R/Prev 5281 0 R/Next 5283 0 R>> endobj 5283 0 obj < /Dest[1442 0 R/XYZ 85.1 723.2 0]/Parent 5245 0 R/Prev 5282 0 R/Next 5284 0 R>> endobj 5284 0 obj < /Dest[1442 0 R/XYZ 85.1 629.9 0]/Parent 5245 0 R/Prev 5283 0 R/Next 5285 0 R>> endobj 5285 0 obj < /Dest[1442 0 R/XYZ 85.1 536.7 0]/Parent 5245 0 R/Prev 5284 0 R>> endobj 5286 0 obj < /Dest[1442 0 R/XYZ 85.1 487 0]/Parent 5238 0 R/Prev 5245 0 R>> endobj 5287 0 obj < /Dest[1442 0 R/XYZ 85.1 421.4 0]/Parent 5286 0 R/Next 5288 0 R>> endobj 5288 0 obj < /Dest[1442 0 R/XYZ 85.1 291.6 0]/Parent 5286 0 R/Prev 5287 0 R/Next 5289 0 R>> endobj 5289 0 obj < /Dest[1442 0 R/XYZ 85.1 180 0]/Parent 5286 0 R/Prev 5288 0 R/Next 5290 0 R>> endobj 5290 0 obj < /Dest[1480 0 R/XYZ 56.7 600 0]/Parent 5286 0 R/Prev 5289 0 R/Next 5291 0 R>> endobj 5291 0 obj < /Dest[1480 0 R/XYZ 56.7 506.8 0]/Parent 5286 0 R/Prev 5290 0 R/Next 5292 0 R>> endobj 5292 0 obj < /Dest[1480 0 R/XYZ 56.7 413.5 0]/Parent 5286 0 R/Prev 5291 0 R/Next 5293 0 R>> endobj 5293 0 obj < /Dest[1480 0 R/XYZ 56.7 271 0]/Parent 5286 0 R/Prev 5292 0 R/Next 5294 0 R>> endobj 5294 0 obj < /Dest[1526 0 R/XYZ 85.1 723.2 0]/Parent 5286 0 R/Prev 5293 0 R/Next 5295 0 R>> endobj 5295 0 obj < /Dest[1526 0 R/XYZ 85.1 593.3 0]/Parent 5286 0 R/Prev 5294 0 R/Next 5296 0 R>> endobj 5296 0 obj < /Dest[1526 0 R/XYZ 85.1 450.8 0]/Parent 5286 0 R/Prev 5295 0 R/Next 5297 0 R>> endobj 5297 0 obj < /Dest[1526 0 R/XYZ 85.1 321 0]/Parent 5286 0 R/Prev 5296 0 R/Next 5298 0 R>> endobj 5298 0 obj < /Dest[1526 0 R/XYZ 85.1 203.8 0]/Parent 5286 0 R/Prev 5297 0 R/Next 5299 0 R>> endobj 5299 0 obj < /Dest[1587 0 R/XYZ 56.7 723.2 0]/Parent 5286 0 R/Prev 5298 0 R/Next 5300 0 R>> endobj 5300 0 obj < /Dest[1587 0 R/XYZ 56.7 606 0]/Parent 5286 0 R/Prev 5299 0 R/Next 5301 0 R>> endobj 5301 0 obj < /Dest[1587 0 R/XYZ 56.7 463.5 0]/Parent 5286 0 R/Prev 5300 0 R/Next 5302 0 R>> endobj 5302 0 obj < /Dest[1587 0 R/XYZ 56.7 315.3 0]/Parent 5286 0 R/Prev 5301 0 R/Next 5303 0 R>> endobj 5303 0 obj < /Dest[1587 0 R/XYZ 56.7 198.1 0]/Parent 5286 0 R/Prev 5302 0 R/Next 5304 0 R>> endobj 5304 0 obj < /Dest[1645 0 R/XYZ 85.1 692.9 0]/Parent 5286 0 R/Prev 5303 0 R/Next 5305 0 R>> endobj 5305 0 obj < /Dest[1645 0 R/XYZ 85.1 563 0]/Parent 5286 0 R/Prev 5304 0 R/Next 5306 0 R>> endobj 5306 0 obj < /Dest[1645 0 R/XYZ 85.1 402.2 0]/Parent 5286 0 R/Prev 5305 0 R/Next 5307 0 R>> endobj 5307 0 obj < /Dest[1645 0 R/XYZ 85.1 285 0]/Parent 5286 0 R/Prev 5306 0 R/Next 5308 0 R>> endobj 5308 0 obj < /Dest[1645 0 R/XYZ 85.1 222.7 0]/Parent 5286 0 R/Prev 5307 0 R/Next 5309 0 R>> endobj 5309 0 obj < /Dest[1692 0 R/XYZ 56.7 723.2 0]/Parent 5286 0 R/Prev 5308 0 R/Next 5310 0 R>> endobj 5310 0 obj < /Dest[1692 0 R/XYZ 56.7 544.1 0]/Parent 5286 0 R/Prev 5309 0 R/Next 5311 0 R>> endobj 5311 0 obj < /Dest[1692 0 R/XYZ 56.7 370.6 0]/Parent 5286 0 R/Prev 5310 0 R/Next 5312 0 R>> endobj 5312 0 obj < /Dest[1692 0 R/XYZ 56.7 222.5 0]/Parent 5286 0 R/Prev 5311 0 R/Next 5313 0 R>> endobj 5313 0 obj < /Dest[1755 0 R/XYZ 85.1 692.9 0]/Parent 5286 0 R/Prev 5312 0 R/Next 5314 0 R>> endobj 5314 0 obj < /Dest[1755 0 R/XYZ 85.1 571.3 0]/Parent 5286 0 R/Prev 5313 0 R>> endobj 5315 0 obj < /Dest[1773 0 R/XYZ 56.7 723.1 0]/Parent 5218 0 R/Prev 5238 0 R/Next 5325 0 R>> endobj 5316 0 obj < /Dest[1773 0 R/XYZ 56.7 281.4 0]/Parent 5315 0 R/Next 5317 0 R>> endobj 5317 0 obj < /Dest[1808 0 R/XYZ 85.1 604.6 0]/Parent 5315 0 R/Prev 5316 0 R>> endobj 5318 0 obj < /Dest[1808 0 R/XYZ 85.1 508 0]/Parent 5317 0 R/Next 5319 0 R>> endobj 5319 0 obj < /Dest[1808 0 R/XYZ 85.1 209.4 0]/Parent 5317 0 R/Prev 5318 0 R/Next 5320 0 R>> endobj 5320 0 obj < /Dest[1849 0 R/XYZ 56.7 661.9 0]/Parent 5317 0 R/Prev 5319 0 R/Next 5321 0 R>> endobj 5321 0 obj < /Dest[1849 0 R/XYZ 56.7 543.4 0]/Parent 5317 0 R/Prev 5320 0 R/Next 5322 0 R>> endobj 5322 0 obj < /Dest[1849 0 R/XYZ 56.7 333.3 0]/Parent 5317 0 R/Prev 5321 0 R/Next 5323 0 R>> endobj 5323 0 obj < /Dest[1849 0 R/XYZ 56.7 172.5 0]/Parent 5317 0 R/Prev 5322 0 R/Next 5324 0 R>> endobj 5324 0 obj < /Dest[1900 0 R/XYZ 85.1 625.3 0]/Parent 5317 0 R/Prev 5323 0 R>> endobj 5325 0 obj < /Dest[1926 0 R/XYZ 56.7 723.1 0]/Parent 5218 0 R/Prev 5315 0 R/Next 5411 0 R>> endobj 5326 0 obj < /Dest[1970 0 R/XYZ 85.1 542.4 0]/Parent 5325 0 R/Next 5327 0 R>> endobj 5327 0 obj < /Dest[1970 0 R/XYZ 85.1 311.8 0]/Parent 5325 0 R/Prev 5326 0 R>> endobj 5328 0 obj < /Dest[2015 0 R/XYZ 56.7 474.9 0]/Parent 5327 0 R/Next 5329 0 R>> endobj 5329 0 obj < /Dest[2015 0 R/XYZ 56.7 387.3 0]/Parent 5327 0 R/Prev 5328 0 R/Next 5330 0 R>> endobj 5330 0 obj < /Dest[2015 0 R/XYZ 56.7 337.6 0]/Parent 5327 0 R/Prev 5329 0 R/Next 5331 0 R>> endobj 5331 0 obj < /Dest[2015 0 R/XYZ 56.7 257 0]/Parent 5327 0 R/Prev 5330 0 R/Next 5332 0 R>> endobj 5332 0 obj < /Dest[2015 0 R/XYZ 56.7 207.4 0]/Parent 5327 0 R/Prev 5331 0 R/Next 5333 0 R>> endobj 5333 0 obj < /Dest[2015 0 R/XYZ 56.7 157.7 0]/Parent 5327 0 R/Prev 5332 0 R/Next 5334 0 R>> endobj 5334 0 obj < /Dest[2049 0 R/XYZ 85.1 723.2 0]/Parent 5327 0 R/Prev 5333 0 R/Next 5335 0 R>> endobj 5335 0 obj < /Dest[2049 0 R/XYZ 85.1 642.6 0]/Parent 5327 0 R/Prev 5334 0 R/Next 5336 0 R>> endobj 5336 0 obj < /Dest[2049 0 R/XYZ 85.1 580.3 0]/Parent 5327 0 R/Prev 5335 0 R/Next 5337 0 R>> endobj 5337 0 obj < /Dest[2049 0 R/XYZ 85.1 505.3 0]/Parent 5327 0 R/Prev 5336 0 R/Next 5338 0 R>> endobj 5338 0 obj < /Dest[2049 0 R/XYZ 85.1 443 0]/Parent 5327 0 R/Prev 5337 0 R/Next 5339 0 R>> endobj 5339 0 obj < /Dest[2049 0 R/XYZ 85.1 380.7 0]/Parent 5327 0 R/Prev 5338 0 R/Next 5340 0 R>> endobj 5340 0 obj < /Dest[2049 0 R/XYZ 85.1 318.4 0]/Parent 5327 0 R/Prev 5339 0 R/Next 5341 0 R>> endobj 5341 0 obj < /Dest[2049 0 R/XYZ 85.1 256.1 0]/Parent 5327 0 R/Prev 5340 0 R/Next 5342 0 R>> endobj 5342 0 obj < /Dest[2049 0 R/XYZ 85.1 193.8 0]/Parent 5327 0 R/Prev 5341 0 R/Next 5343 0 R>> endobj 5343 0 obj < /Dest[2049 0 R/XYZ 85.1 131.5 0]/Parent 5327 0 R/Prev 5342 0 R/Next 5344 0 R>> endobj 5344 0 obj < /Dest[2073 0 R/XYZ 56.7 723.2 0]/Parent 5327 0 R/Prev 5343 0 R/Next 5345 0 R>> endobj 5345 0 obj < /Dest[2073 0 R/XYZ 56.7 648.2 0]/Parent 5327 0 R/Prev 5344 0 R/Next 5346 0 R>> endobj 5346 0 obj < /Dest[2073 0 R/XYZ 56.7 585.9 0]/Parent 5327 0 R/Prev 5345 0 R/Next 5347 0 R>> endobj 5347 0 obj < /Dest[2073 0 R/XYZ 56.7 368.9 0]/Parent 5327 0 R/Prev 5346 0 R/Next 5348 0 R>> endobj 5348 0 obj < /Dest[2073 0 R/XYZ 56.7 319.2 0]/Parent 5327 0 R/Prev 5347 0 R/Next 5349 0 R>> endobj 5349 0 obj < /Dest[2073 0 R/XYZ 56.7 207.7 0]/Parent 5327 0 R/Prev 5348 0 R/Next 5350 0 R>> endobj 5350 0 obj < /Dest[2098 0 R/XYZ 85.1 600 0]/Parent 5327 0 R/Prev 5349 0 R/Next 5351 0 R>> endobj 5351 0 obj < /Dest[2098 0 R/XYZ 85.1 357.7 0]/Parent 5327 0 R/Prev 5350 0 R/Next 5352 0 R>> endobj 5352 0 obj < /Dest[2098 0 R/XYZ 85.1 189.9 0]/Parent 5327 0 R/Prev 5351 0 R/Next 5353 0 R>> endobj 5353 0 obj < /Dest[2098 0 R/XYZ 85.1 140.2 0]/Parent 5327 0 R/Prev 5352 0 R/Next 5354 0 R>> endobj 5354 0 obj < /Dest[2122 0 R/XYZ 56.7 674.6 0]/Parent 5327 0 R/Prev 5353 0 R/Next 5355 0 R>> endobj 5355 0 obj < /Dest[2122 0 R/XYZ 56.7 537.7 0]/Parent 5327 0 R/Prev 5354 0 R/Next 5356 0 R>> endobj 5356 0 obj < /Dest[2122 0 R/XYZ 56.7 431.8 0]/Parent 5327 0 R/Prev 5355 0 R/Next 5357 0 R>> endobj 5357 0 obj < /Dest[2122 0 R/XYZ 56.7 351.2 0]/Parent 5327 0 R/Prev 5356 0 R/Next 5358 0 R>> endobj 5358 0 obj < /Dest[2122 0 R/XYZ 56.7 288.9 0]/Parent 5327 0 R/Prev 5357 0 R/Next 5359 0 R>> endobj 5359 0 obj < /Dest[2122 0 R/XYZ 56.7 226.6 0]/Parent 5327 0 R/Prev 5358 0 R/Next 5360 0 R>> endobj 5360 0 obj < /Dest[2122 0 R/XYZ 56.7 164.3 0]/Parent 5327 0 R/Prev 5359 0 R/Next 5361 0 R>> endobj 5361 0 obj < /Dest[2144 0 R/XYZ 85.1 723.2 0]/Parent 5327 0 R/Prev 5360 0 R/Next 5362 0 R>> endobj 5362 0 obj < /Dest[2144 0 R/XYZ 85.1 648.2 0]/Parent 5327 0 R/Prev 5361 0 R/Next 5363 0 R>> endobj 5363 0 obj < /Dest[2144 0 R/XYZ 85.1 585.9 0]/Parent 5327 0 R/Prev 5362 0 R/Next 5364 0 R>> endobj 5364 0 obj < /Dest[2144 0 R/XYZ 85.1 523.6 0]/Parent 5327 0 R/Prev 5363 0 R/Next 5365 0 R>> endobj 5365 0 obj < /Dest[2144 0 R/XYZ 85.1 461.3 0]/Parent 5327 0 R/Prev 5364 0 R/Next 5366 0 R>> endobj 5366 0 obj < /Dest[2144 0 R/XYZ 85.1 399 0]/Parent 5327 0 R/Prev 5365 0 R/Next 5367 0 R>> endobj 5367 0 obj < /Dest[2144 0 R/XYZ 85.1 349.4 0]/Parent 5327 0 R/Prev 5366 0 R/Next 5368 0 R>> endobj 5368 0 obj < /Dest[2144 0 R/XYZ 85.1 287.1 0]/Parent 5327 0 R/Prev 5367 0 R/Next 5369 0 R>> endobj 5369 0 obj < /Dest[2144 0 R/XYZ 85.1 224.8 0]/Parent 5327 0 R/Prev 5368 0 R/Next 5370 0 R>> endobj 5370 0 obj < /Dest[2144 0 R/XYZ 85.1 162.4 0]/Parent 5327 0 R/Prev 5369 0 R/Next 5371 0 R>> endobj 5371 0 obj < /Dest[2168 0 R/XYZ 56.7 723.2 0]/Parent 5327 0 R/Prev 5370 0 R/Next 5372 0 R>> endobj 5372 0 obj < /Dest[2168 0 R/XYZ 56.7 604.6 0]/Parent 5327 0 R/Prev 5371 0 R/Next 5373 0 R>> endobj 5373 0 obj < /Dest[2168 0 R/XYZ 56.7 511.4 0]/Parent 5327 0 R/Prev 5372 0 R/Next 5374 0 R>> endobj 5374 0 obj < /Dest[2168 0 R/XYZ 56.7 449.1 0]/Parent 5327 0 R/Prev 5373 0 R/Next 5375 0 R>> endobj 5375 0 obj < /Dest[2168 0 R/XYZ 56.7 355.8 0]/Parent 5327 0 R/Prev 5374 0 R/Next 5376 0 R>> endobj 5376 0 obj < /Dest[2168 0 R/XYZ 56.7 293.5 0]/Parent 5327 0 R/Prev 5375 0 R/Next 5377 0 R>> endobj 5377 0 obj < /Dest[2168 0 R/XYZ 56.7 205.9 0]/Parent 5327 0 R/Prev 5376 0 R/Next 5378 0 R>> endobj 5378 0 obj < /Dest[2168 0 R/XYZ 56.7 156.3 0]/Parent 5327 0 R/Prev 5377 0 R/Next 5379 0 R>> endobj 5379 0 obj < /Dest[2190 0 R/XYZ 85.1 723.2 0]/Parent 5327 0 R/Prev 5378 0 R/Next 5380 0 R>> endobj 5380 0 obj < /Dest[2190 0 R/XYZ 85.1 660.9 0]/Parent 5327 0 R/Prev 5379 0 R/Next 5381 0 R>> endobj 5381 0 obj < /Dest[2190 0 R/XYZ 85.1 529.7 0]/Parent 5327 0 R/Prev 5380 0 R/Next 5382 0 R>> endobj 5382 0 obj < /Dest[2190 0 R/XYZ 85.1 449.1 0]/Parent 5327 0 R/Prev 5381 0 R/Next 5383 0 R>> endobj 5383 0 obj < /Dest[2190 0 R/XYZ 85.1 361.5 0]/Parent 5327 0 R/Prev 5382 0 R/Next 5384 0 R>> endobj 5384 0 obj < /Dest[2190 0 R/XYZ 85.1 273.9 0]/Parent 5327 0 R/Prev 5383 0 R/Next 5385 0 R>> endobj 5385 0 obj < /Dest[2190 0 R/XYZ 85.1 193.3 0]/Parent 5327 0 R/Prev 5384 0 R/Next 5386 0 R>> endobj 5386 0 obj < /Dest[2215 0 R/XYZ 56.7 723.2 0]/Parent 5327 0 R/Prev 5385 0 R/Next 5387 0 R>> endobj 5387 0 obj < /Dest[2215 0 R/XYZ 56.7 604.6 0]/Parent 5327 0 R/Prev 5386 0 R/Next 5388 0 R>> endobj 5388 0 obj < /Dest[2215 0 R/XYZ 56.7 529.7 0]/Parent 5327 0 R/Prev 5387 0 R/Next 5389 0 R>> endobj 5389 0 obj < /Dest[2215 0 R/XYZ 56.7 423.8 0]/Parent 5327 0 R/Prev 5388 0 R/Next 5390 0 R>> endobj 5390 0 obj < /Dest[2215 0 R/XYZ 56.7 348.8 0]/Parent 5327 0 R/Prev 5389 0 R/Next 5391 0 R>> endobj 5391 0 obj < /Dest[2215 0 R/XYZ 56.7 273.8 0]/Parent 5327 0 R/Prev 5390 0 R/Next 5392 0 R>> endobj 5392 0 obj < /Dest[2236 0 R/XYZ 85.1 723.2 0]/Parent 5327 0 R/Prev 5391 0 R/Next 5393 0 R>> endobj 5393 0 obj < /Dest[2236 0 R/XYZ 85.1 586.3 0]/Parent 5327 0 R/Prev 5392 0 R/Next 5394 0 R>> endobj 5394 0 obj < /Dest[2236 0 R/XYZ 85.1 467.8 0]/Parent 5327 0 R/Prev 5393 0 R/Next 5395 0 R>> endobj 5395 0 obj < /Dest[2236 0 R/XYZ 85.1 343.6 0]/Parent 5327 0 R/Prev 5394 0 R/Next 5396 0 R>> endobj 5396 0 obj < /Dest[2236 0 R/XYZ 85.1 293.9 0]/Parent 5327 0 R/Prev 5395 0 R/Next 5397 0 R>> endobj 5397 0 obj < /Dest[2236 0 R/XYZ 85.1 200.7 0]/Parent 5327 0 R/Prev 5396 0 R/Next 5398 0 R>> endobj 5398 0 obj < /Dest[2262 0 R/XYZ 56.7 723.2 0]/Parent 5327 0 R/Prev 5397 0 R/Next 5399 0 R>> endobj 5399 0 obj < /Dest[2262 0 R/XYZ 56.7 617.3 0]/Parent 5327 0 R/Prev 5398 0 R/Next 5400 0 R>> endobj 5400 0 obj < /Dest[2262 0 R/XYZ 56.7 555 0]/Parent 5327 0 R/Prev 5399 0 R/Next 5401 0 R>> endobj 5401 0 obj < /Dest[2262 0 R/XYZ 56.7 474.4 0]/Parent 5327 0 R/Prev 5400 0 R/Next 5402 0 R>> endobj 5402 0 obj < /Dest[2262 0 R/XYZ 56.7 381.1 0]/Parent 5327 0 R/Prev 5401 0 R/Next 5403 0 R>> endobj 5403 0 obj < /Dest[2262 0 R/XYZ 56.7 256.9 0]/Parent 5327 0 R/Prev 5402 0 R/Next 5404 0 R>> endobj 5404 0 obj < /Dest[2286 0 R/XYZ 85.1 723.2 0]/Parent 5327 0 R/Prev 5403 0 R/Next 5405 0 R>> endobj 5405 0 obj < /Dest[2286 0 R/XYZ 85.1 555.4 0]/Parent 5327 0 R/Prev 5404 0 R/Next 5406 0 R>> endobj 5406 0 obj < /Dest[2286 0 R/XYZ 85.1 418.5 0]/Parent 5327 0 R/Prev 5405 0 R/Next 5407 0 R>> endobj 5407 0 obj < /Dest[2286 0 R/XYZ 85.1 356.2 0]/Parent 5327 0 R/Prev 5406 0 R/Next 5408 0 R>> endobj 5408 0 obj < /Dest[2286 0 R/XYZ 85.1 263 0]/Parent 5327 0 R/Prev 5407 0 R/Next 5409 0 R>> endobj 5409 0 obj < /Dest[2286 0 R/XYZ 85.1 182.4 0]/Parent 5327 0 R/Prev 5408 0 R/Next 5410 0 R>> endobj 5410 0 obj < /Dest[2309 0 R/XYZ 56.7 723.2 0]/Parent 5327 0 R/Prev 5409 0 R>> endobj 5411 0 obj < /Dest[2315 0 R/XYZ 85.1 723.1 0]/Parent 5218 0 R/Prev 5325 0 R>> endobj 5412 0 obj < /Dest[2315 0 R/XYZ 85.1 405.2 0]/Parent 5411 0 R/Next 5413 0 R>> endobj 5413 0 obj < /Dest[2315 0 R/XYZ 85.1 238.9 0]/Parent 5411 0 R/Prev 5412 0 R>> endobj 5414 0 obj < /Dest[2315 0 R/XYZ 85.1 173.3 0]/Parent 5413 0 R/Next 5415 0 R>> endobj 5415 0 obj < /Dest[2372 0 R/XYZ 56.7 463.6 0]/Parent 5413 0 R/Prev 5414 0 R>> endobj 5416 0 obj < /Dest[2427 0 R/XYZ 85.1 640.2 0]/Parent 5204 0 R/Prev 5218 0 R/Next 5420 0 R>> endobj 5417 0 obj < /Dest[2434 0 R/XYZ 56.7 723.1 0]/Parent 5416 0 R/Next 5418 0 R>> endobj 5418 0 obj < /Dest[2472 0 R/XYZ 85.1 723.1 0]/Parent 5416 0 R/Prev 5417 0 R/Next 5419 0 R>> endobj 5419 0 obj < /Dest[2511 0 R/XYZ 56.7 723.1 0]/Parent 5416 0 R/Prev 5418 0 R>> endobj 5420 0 obj < /Dest[2541 0 R/XYZ 85.1 640.2 0]/Parent 5204 0 R/Prev 5416 0 R/Next 5425 0 R>> endobj 5421 0 obj < /Dest[2541 0 R/XYZ 85.1 436.3 0]/Parent 5420 0 R/Next 5422 0 R>> endobj 5422 0 obj < /Dest[2557 0 R/XYZ 56.7 723.2 0]/Parent 5420 0 R/Prev 5421 0 R/Next 5423 0 R>> endobj 5423 0 obj < /Dest[2772 0 R/XYZ 56.7 723.2 0]/Parent 5420 0 R/Prev 5422 0 R/Next 5424 0 R>> endobj 5424 0 obj < /Dest[2891 0 R/XYZ 85.1 335.3 0]/Parent 5420 0 R/Prev 5423 0 R>> endobj 5425 0 obj < /Dest[3011 0 R/XYZ 85.1 640.2 0]/Parent 5204 0 R/Prev 5420 0 R/Next 5450 0 R>> endobj 5426 0 obj < /Dest[3011 0 R/XYZ 85.1 543.2 0]/Parent 5425 0 R/Next 5427 0 R>> endobj 5427 0 obj < /Dest[3011 0 R/XYZ 85.1 364.2 0]/Parent 5425 0 R/Prev 5426 0 R/Next 5428 0 R>> endobj 5428 0 obj < /Dest[3011 0 R/XYZ 85.1 294.1 0]/Parent 5425 0 R/Prev 5427 0 R/Next 5429 0 R>> endobj 5429 0 obj < /Dest[3011 0 R/XYZ 85.1 148.3 0]/Parent 5425 0 R/Prev 5428 0 R/Next 5430 0 R>> endobj 5430 0 obj < /Dest[3058 0 R/XYZ 56.7 622 0]/Parent 5425 0 R/Prev 5429 0 R/Next 5431 0 R>> endobj 5431 0 obj < /Dest[3058 0 R/XYZ 56.7 519.8 0]/Parent 5425 0 R/Prev 5430 0 R/Next 5432 0 R>> endobj 5432 0 obj < /Dest[3058 0 R/XYZ 56.7 348.7 0]/Parent 5425 0 R/Prev 5431 0 R/Next 5433 0 R>> endobj 5433 0 obj < /Dest[3111 0 R/XYZ 85.1 723.2 0]/Parent 5425 0 R/Prev 5432 0 R/Next 5434 0 R>> endobj 5434 0 obj < /Dest[3111 0 R/XYZ 85.1 563.6 0]/Parent 5425 0 R/Prev 5433 0 R/Next 5435 0 R>> endobj 5435 0 obj < /Dest[3111 0 R/XYZ 85.1 271.3 0]/Parent 5425 0 R/Prev 5434 0 R/Next 5436 0 R>> endobj 5436 0 obj < /Dest[3165 0 R/XYZ 56.7 640.3 0]/Parent 5425 0 R/Prev 5435 0 R/Next 5437 0 R>> endobj 5437 0 obj < /Dest[3165 0 R/XYZ 56.7 481.9 0]/Parent 5425 0 R/Prev 5436 0 R/Next 5438 0 R>> endobj 5438 0 obj < /Dest[3165 0 R/XYZ 56.7 386.4 0]/Parent 5425 0 R/Prev 5437 0 R/Next 5439 0 R>> endobj 5439 0 obj < /Dest[3165 0 R/XYZ 56.7 310.4 0]/Parent 5425 0 R/Prev 5438 0 R/Next 5440 0 R>> endobj 5440 0 obj < /Dest[3165 0 R/XYZ 56.7 189.6 0]/Parent 5425 0 R/Prev 5439 0 R/Next 5441 0 R>> endobj 5441 0 obj < /Dest[3219 0 R/XYZ 85.1 679.1 0]/Parent 5425 0 R/Prev 5440 0 R/Next 5442 0 R>> endobj 5442 0 obj < /Dest[3219 0 R/XYZ 85.1 347.5 0]/Parent 5425 0 R/Prev 5441 0 R/Next 5443 0 R>> endobj 5443 0 obj < /Dest[3219 0 R/XYZ 85.1 284.1 0]/Parent 5425 0 R/Prev 5442 0 R/Next 5444 0 R>> endobj 5444 0 obj < /Dest[3265 0 R/XYZ 56.7 571.2 0]/Parent 5425 0 R/Prev 5443 0 R/Next 5445 0 R>> endobj 5445 0 obj < /Dest[3265 0 R/XYZ 56.7 507.8 0]/Parent 5425 0 R/Prev 5444 0 R/Next 5446 0 R>> endobj 5446 0 obj < /Dest[3265 0 R/XYZ 56.7 158.1 0]/Parent 5425 0 R/Prev 5445 0 R/Next 5447 0 R>> endobj 5447 0 obj < /Dest[3315 0 R/XYZ 85.1 501.7 0]/Parent 5425 0 R/Prev 5446 0 R/Next 5448 0 R>> endobj 5448 0 obj < /Dest[3315 0 R/XYZ 85.1 157.7 0]/Parent 5425 0 R/Prev 5447 0 R/Next 5449 0 R>> endobj 5449 0 obj < /Dest[3368 0 R/XYZ 56.7 431.7 0]/Parent 5425 0 R/Prev 5448 0 R>> endobj 5450 0 obj < /Dest[3403 0 R/XYZ 85.1 640.2 0]/Parent 5204 0 R/Prev 5425 0 R>> endobj 5452 0 obj <> endobj 5 0 obj <> endobj 5453 0 obj <> endobj 6 0 obj <> endobj 5454 0 obj <> endobj 7 0 obj <> endobj 5455 0 obj <> endobj 8 0 obj <> endobj 5456 0 obj <> endobj 10 0 obj <> endobj 5457 0 obj <> endobj 9 0 obj <> endobj 5458 0 obj <> endobj 11 0 obj <> endobj 5459 0 obj <> endobj 15 0 obj <> endobj 5460 0 obj <> endobj 19 0 obj <> endobj 5461 0 obj <> endobj 23 0 obj <> endobj 24 0 obj <> endobj 5462 0 obj <> endobj 22 0 obj <> endobj 21 0 obj <> endobj 5463 0 obj <> endobj 27 0 obj <> endobj 28 0 obj <> endobj 5464 0 obj <> endobj 26 0 obj <> endobj 25 0 obj <> endobj 5465 0 obj <> endobj 31 0 obj <> endobj 32 0 obj <> endobj 5466 0 obj <> endobj 30 0 obj <> endobj 29 0 obj <> endobj 5467 0 obj <> endobj 35 0 obj <> endobj 36 0 obj <> endobj 5468 0 obj <> endobj 34 0 obj <> endobj 33 0 obj <> endobj 5469 0 obj <> endobj 39 0 obj <> endobj 40 0 obj <> endobj 5470 0 obj <> endobj 38 0 obj <> endobj 37 0 obj <> endobj 5471 0 obj <> endobj 43 0 obj <> endobj 44 0 obj <> endobj 5472 0 obj <> endobj 42 0 obj <> endobj 41 0 obj <> endobj 5473 0 obj <> endobj 47 0 obj <> endobj 48 0 obj <> endobj 5474 0 obj <> endobj 46 0 obj <> endobj 45 0 obj <> endobj 5475 0 obj <> endobj 51 0 obj <> endobj 52 0 obj <> endobj 5476 0 obj <> endobj 50 0 obj <> endobj 49 0 obj <> endobj 5477 0 obj <> endobj 55 0 obj <> endobj 56 0 obj <> endobj 5478 0 obj <> endobj 54 0 obj <> endobj 53 0 obj <> endobj 5479 0 obj <> endobj 59 0 obj <> endobj 60 0 obj <> endobj 5480 0 obj <> endobj 58 0 obj <> endobj 57 0 obj <> endobj 5481 0 obj <> endobj 63 0 obj <> endobj 64 0 obj <> endobj 5482 0 obj <> endobj 62 0 obj <> endobj 61 0 obj <> endobj 5483 0 obj <> endobj 67 0 obj <> endobj 68 0 obj <> endobj 5484 0 obj <> endobj 66 0 obj <> endobj 65 0 obj <> endobj 5485 0 obj <> endobj 71 0 obj <> endobj 72 0 obj <> endobj 5486 0 obj <> endobj 70 0 obj <> endobj 69 0 obj <> endobj 5487 0 obj <> endobj 75 0 obj <> endobj 76 0 obj <> endobj 5488 0 obj <> endobj 74 0 obj <> endobj 73 0 obj <> endobj 5489 0 obj <> endobj 79 0 obj <> endobj 80 0 obj <> endobj 5490 0 obj <> endobj 78 0 obj <> endobj 77 0 obj <> endobj 5491 0 obj <> endobj 83 0 obj <> endobj 84 0 obj <> endobj 5492 0 obj <> endobj 82 0 obj <> endobj 81 0 obj <> endobj 5493 0 obj <> endobj 87 0 obj <> endobj 88 0 obj <> endobj 5494 0 obj <> endobj 86 0 obj <> endobj 85 0 obj <> endobj 5495 0 obj <> endobj 91 0 obj <> endobj 92 0 obj <> endobj 5496 0 obj <> endobj 90 0 obj <> endobj 89 0 obj <> endobj 5497 0 obj <> endobj 95 0 obj <> endobj 96 0 obj <> endobj 5498 0 obj <> endobj 94 0 obj <> endobj 93 0 obj <> endobj 5499 0 obj <> endobj 99 0 obj <> endobj 100 0 obj <> endobj 5500 0 obj <> endobj 98 0 obj <> endobj 97 0 obj <> endobj 5501 0 obj <> endobj 103 0 obj <> endobj 104 0 obj <> endobj 5502 0 obj <> endobj 102 0 obj <> endobj 101 0 obj <> endobj 5503 0 obj <> endobj 107 0 obj <> endobj 108 0 obj <> endobj 5504 0 obj <> endobj 106 0 obj <> endobj 105 0 obj <> endobj 5505 0 obj <> endobj 111 0 obj <> endobj 112 0 obj <> endobj 5506 0 obj <> endobj 110 0 obj <> endobj 109 0 obj <> endobj 5507 0 obj <> endobj 115 0 obj <> endobj 116 0 obj <> endobj 5508 0 obj <> endobj 114 0 obj <> endobj 113 0 obj <> endobj 5509 0 obj <> endobj 119 0 obj <> endobj 120 0 obj <> endobj 5510 0 obj <> endobj 118 0 obj <> endobj 117 0 obj <> endobj 5511 0 obj <> endobj 123 0 obj <> endobj 124 0 obj <> endobj 5512 0 obj <> endobj 122 0 obj <> endobj 121 0 obj <> endobj 5513 0 obj <> endobj 127 0 obj <> endobj 128 0 obj <> endobj 5514 0 obj <> endobj 126 0 obj <> endobj 125 0 obj <> endobj 5515 0 obj <> endobj 131 0 obj <> endobj 132 0 obj <> endobj 5516 0 obj <> endobj 130 0 obj <> endobj 129 0 obj <> endobj 5517 0 obj <> endobj 135 0 obj <> endobj 136 0 obj <> endobj 5518 0 obj <> endobj 134 0 obj <> endobj 133 0 obj <> endobj 5519 0 obj <> endobj 139 0 obj <> endobj 140 0 obj <> endobj 5520 0 obj <> endobj 138 0 obj <> endobj 137 0 obj <> endobj 5521 0 obj <> endobj 143 0 obj <> endobj 144 0 obj <> endobj 5522 0 obj <> endobj 142 0 obj <> endobj 141 0 obj <> endobj 5523 0 obj <> endobj 147 0 obj <> endobj 148 0 obj <> endobj 5524 0 obj <> endobj 146 0 obj <> endobj 145 0 obj <> endobj 5525 0 obj <> endobj 151 0 obj <> endobj 152 0 obj <> endobj 5526 0 obj <> endobj 150 0 obj <> endobj 149 0 obj <> endobj 5527 0 obj <> endobj 155 0 obj <> endobj 156 0 obj <> endobj 5528 0 obj <> endobj 154 0 obj <> endobj 153 0 obj <> endobj 5529 0 obj <> endobj 159 0 obj <> endobj 160 0 obj <> endobj 5530 0 obj <> endobj 158 0 obj <> endobj 157 0 obj <> endobj 5531 0 obj <> endobj 166 0 obj <> endobj 167 0 obj <> endobj 5532 0 obj <> endobj 165 0 obj <> endobj 164 0 obj <> endobj 5533 0 obj <> endobj 170 0 obj <> endobj 171 0 obj <> endobj 5534 0 obj <> endobj 169 0 obj <> endobj 168 0 obj <> endobj 5535 0 obj <> endobj 174 0 obj <> endobj 175 0 obj <> endobj 5536 0 obj <> endobj 173 0 obj <> endobj 172 0 obj <> endobj 5537 0 obj <> endobj 178 0 obj <> endobj 179 0 obj <> endobj 5538 0 obj <> endobj 177 0 obj <> endobj 176 0 obj <> endobj 5539 0 obj <> endobj 182 0 obj <> endobj 183 0 obj <> endobj 5540 0 obj <> endobj 181 0 obj <> endobj 180 0 obj <> endobj 20 0 obj <> endobj 5541 0 obj <> endobj 187 0 obj <> endobj 5542 0 obj <> endobj 189 0 obj <> endobj 5543 0 obj <> endobj 190 0 obj <> endobj 5544 0 obj <> endobj 188 0 obj <> endobj 5545 0 obj <> endobj 191 0 obj <> endobj 5546 0 obj <> endobj 192 0 obj <> endobj 5547 0 obj <> endobj 194 0 obj <> endobj 5548 0 obj <> endobj 193 0 obj <> endobj 5549 0 obj <> endobj 195 0 obj <> endobj 5550 0 obj <> endobj 196 0 obj <> endobj 5551 0 obj <> endobj 197 0 obj <> endobj 5552 0 obj <> endobj 198 0 obj <> endobj 5553 0 obj <> endobj 202 0 obj <> endobj 5554 0 obj <> endobj 201 0 obj <> endobj 200 0 obj <> endobj 5555 0 obj <> endobj 204 0 obj <> endobj 203 0 obj <> endobj 199 0 obj <> endobj 5556 0 obj <> endobj 208 0 obj <> endobj 5557 0 obj <> endobj 210 0 obj <> endobj 5558 0 obj <> endobj 209 0 obj <> endobj 5559 0 obj <> endobj 214 0 obj <> endobj 5560 0 obj <> endobj 213 0 obj <> endobj 5561 0 obj <> endobj 216 0 obj <> endobj 5562 0 obj <> endobj 215 0 obj <> endobj 5563 0 obj <> endobj 212 0 obj <> endobj 5564 0 obj <> endobj 219 0 obj <> endobj 5565 0 obj <> endobj 218 0 obj <> endobj 5566 0 obj <> endobj 221 0 obj <> endobj 5567 0 obj <> endobj 220 0 obj <> endobj 5568 0 obj <> endobj 217 0 obj <> endobj 5569 0 obj <> endobj 224 0 obj <> endobj 5570 0 obj <> endobj 223 0 obj <> endobj 5571 0 obj <> endobj 226 0 obj <> endobj 5572 0 obj <> endobj 225 0 obj <> endobj 5573 0 obj <> endobj 222 0 obj <> endobj 5574 0 obj <> endobj 211 0 obj <> endobj 5575 0 obj <> endobj 227 0 obj <> endobj 5576 0 obj <> endobj 231 0 obj <> endobj 5577 0 obj <> endobj 230 0 obj <> endobj 5578 0 obj <> endobj 233 0 obj <> endobj 5579 0 obj <> endobj 232 0 obj <> endobj 5580 0 obj <> endobj 229 0 obj <> endobj 5581 0 obj <> endobj 228 0 obj <> endobj 5582 0 obj <> endobj 234 0 obj <> endobj 5583 0 obj <> endobj 235 0 obj <> endobj 5584 0 obj <> endobj 239 0 obj <> endobj 5585 0 obj <> endobj 238 0 obj <> endobj 5586 0 obj <> endobj 241 0 obj <> endobj 5587 0 obj <> endobj 240 0 obj <> endobj 5588 0 obj <> endobj 237 0 obj <> endobj 5589 0 obj <> endobj 244 0 obj <> endobj 5590 0 obj <> endobj 243 0 obj <> endobj 5591 0 obj <> endobj 246 0 obj <> endobj 5592 0 obj <> endobj 245 0 obj <> endobj 5593 0 obj <> endobj 242 0 obj <> endobj 5594 0 obj <> endobj 249 0 obj <> endobj 5595 0 obj <> endobj 248 0 obj <> endobj 5596 0 obj <> endobj 252 0 obj <> endobj 5597 0 obj <> endobj 251 0 obj <> endobj 5598 0 obj <> endobj 250 0 obj <> endobj 5599 0 obj <> endobj 247 0 obj <> endobj 5600 0 obj <> endobj 236 0 obj <> endobj 5601 0 obj <> endobj 254 0 obj <> endobj 5602 0 obj <> endobj 253 0 obj <> endobj 5603 0 obj <> endobj 255 0 obj <> endobj 5604 0 obj <> endobj 256 0 obj <> endobj 5605 0 obj <> endobj 260 0 obj <> endobj 259 0 obj <> endobj 258 0 obj <> endobj 257 0 obj <> endobj 5606 0 obj <> endobj 264 0 obj <> endobj 5607 0 obj <> endobj 263 0 obj <> endobj 262 0 obj <> endobj 5608 0 obj <> endobj 266 0 obj <> endobj 265 0 obj <> endobj 261 0 obj <> endobj 5609 0 obj <> endobj 274 0 obj <> endobj 5610 0 obj <> endobj 273 0 obj <> endobj 272 0 obj <> endobj 271 0 obj <> endobj 5611 0 obj <> endobj 277 0 obj <> endobj 276 0 obj <> endobj 275 0 obj <> endobj 270 0 obj <> endobj 5612 0 obj <> endobj 282 0 obj <> endobj 5613 0 obj <> endobj 281 0 obj <> endobj 280 0 obj <> endobj 279 0 obj <> endobj 278 0 obj <> endobj 5614 0 obj <> endobj 283 0 obj <> endobj 5615 0 obj <> endobj 286 0 obj <> endobj 285 0 obj <> endobj 284 0 obj <> endobj 5616 0 obj <> endobj 293 0 obj <> endobj 5617 0 obj <> endobj 294 0 obj <> endobj 5618 0 obj <> endobj 295 0 obj <> endobj 5619 0 obj <> endobj 296 0 obj <> endobj 5620 0 obj <> endobj 300 0 obj <> endobj 299 0 obj <> endobj 298 0 obj <> endobj 5621 0 obj <> endobj 303 0 obj <> endobj 302 0 obj <> endobj 301 0 obj <> endobj 5622 0 obj <> endobj 306 0 obj <> endobj 305 0 obj <> endobj 304 0 obj <> endobj 297 0 obj <> endobj 5623 0 obj <> endobj 308 0 obj <> endobj 5624 0 obj <> endobj 309 0 obj <> endobj 5625 0 obj <> endobj 307 0 obj <> endobj 5626 0 obj <> endobj 310 0 obj <> endobj 5627 0 obj <> endobj 311 0 obj <> endobj 5628 0 obj <> endobj 315 0 obj <> endobj 314 0 obj <> endobj 313 0 obj <> endobj 5629 0 obj <> endobj 319 0 obj <> endobj 5630 0 obj <> endobj 318 0 obj <> endobj 5631 0 obj <> endobj 320 0 obj <> endobj 317 0 obj <> endobj 316 0 obj <> endobj 5632 0 obj <> endobj 323 0 obj <> ] >> endobj 5633 0 obj <> endobj 327 0 obj <> endobj 5634 0 obj <> endobj 329 0 obj <> endobj 5635 0 obj <> endobj 328 0 obj <> endobj 322 0 obj <> endobj 321 0 obj <> endobj 5636 0 obj <> endobj 332 0 obj <> endobj 331 0 obj <> endobj 330 0 obj <> endobj 312 0 obj <> endobj 5637 0 obj <> endobj 336 0 obj <> endobj 5638 0 obj <> endobj 337 0 obj <> endobj 339 0 obj <> endobj 340 0 obj <> endobj 341 0 obj <> endobj 342 0 obj <> endobj 343 0 obj <> endobj 344 0 obj <> endobj 345 0 obj <> endobj 346 0 obj <> endobj 347 0 obj <> endobj 348 0 obj <> endobj 349 0 obj <> endobj 350 0 obj <> endobj 351 0 obj <> endobj 352 0 obj <> endobj 353 0 obj <> endobj 354 0 obj <> endobj 355 0 obj <> endobj 356 0 obj <> endobj 357 0 obj <> endobj 358 0 obj <> endobj 359 0 obj <> endobj 360 0 obj <> endobj 361 0 obj <> endobj 362 0 obj <> endobj 363 0 obj <> endobj 364 0 obj <> endobj 365 0 obj <> endobj 5639 0 obj <> endobj 338 0 obj <> endobj 5640 0 obj <> endobj 366 0 obj <> endobj 5641 0 obj <> endobj 367 0 obj <> endobj 5642 0 obj <> endobj 368 0 obj <> endobj 5643 0 obj <> endobj 369 0 obj <> endobj 5644 0 obj <> endobj 370 0 obj <> endobj 5645 0 obj <> endobj 371 0 obj <> endobj 5646 0 obj <> endobj 373 0 obj <> endobj 5647 0 obj <> endobj 372 0 obj <> endobj 5648 0 obj <> endobj 377 0 obj <> endobj 5649 0 obj <> endobj 378 0 obj <> endobj 5650 0 obj <> endobj 379 0 obj <> endobj 5651 0 obj <> endobj 380 0 obj <> endobj 382 0 obj <> endobj 383 0 obj <> endobj 384 0 obj <> endobj 385 0 obj <> endobj 386 0 obj <> endobj 387 0 obj <> endobj 388 0 obj <> endobj 389 0 obj <> endobj 390 0 obj <> endobj 391 0 obj <> endobj 392 0 obj <> endobj 393 0 obj <> endobj 394 0 obj <> endobj 395 0 obj <> endobj 396 0 obj <> endobj 397 0 obj <> endobj 398 0 obj <> endobj 399 0 obj <> endobj 400 0 obj <> endobj 401 0 obj <> endobj 402 0 obj <> endobj 403 0 obj <> endobj 404 0 obj <> endobj 405 0 obj <> endobj 406 0 obj <> endobj 407 0 obj <> endobj 408 0 obj <> endobj 5652 0 obj <> endobj 381 0 obj <> endobj 5653 0 obj <> endobj 409 0 obj <> endobj 5654 0 obj <> endobj 410 0 obj <> endobj 5655 0 obj <> endobj 411 0 obj <> endobj 5656 0 obj <> endobj 412 0 obj <> endobj 5657 0 obj <> endobj 416 0 obj <> endobj 5658 0 obj <> endobj 417 0 obj <> endobj 5659 0 obj <> endobj 418 0 obj <> endobj 5660 0 obj <> endobj 419 0 obj <> endobj 421 0 obj <> endobj 422 0 obj <> endobj 423 0 obj <> endobj 424 0 obj <> endobj 425 0 obj <> endobj 426 0 obj <> endobj 427 0 obj <> endobj 428 0 obj <> endobj 429 0 obj <> endobj 430 0 obj <> endobj 431 0 obj <> endobj 432 0 obj <> endobj 433 0 obj <> endobj 434 0 obj <> endobj 435 0 obj <> endobj 436 0 obj <> endobj 437 0 obj <> endobj 438 0 obj <> endobj 439 0 obj <> endobj 5661 0 obj <> endobj 420 0 obj <> endobj 5662 0 obj <> endobj 440 0 obj <> endobj 5663 0 obj <> endobj 441 0 obj <> endobj 5664 0 obj <> endobj 443 0 obj <> endobj 5665 0 obj <> endobj 442 0 obj <> endobj 5666 0 obj <> endobj 446 0 obj <> endobj 445 0 obj <> endobj 444 0 obj <> endobj 5667 0 obj <> endobj 450 0 obj <> endobj 5668 0 obj <> endobj 451 0 obj <> endobj 5669 0 obj <> endobj 452 0 obj <> endobj 5670 0 obj <> endobj 453 0 obj <> endobj 5671 0 obj <> endobj 454 0 obj <> endobj 5672 0 obj <> endobj 455 0 obj <> endobj 457 0 obj <> endobj 458 0 obj <> endobj 459 0 obj <> endobj 460 0 obj <> endobj 461 0 obj <> endobj 462 0 obj <> endobj 463 0 obj <> endobj 464 0 obj <> endobj 465 0 obj <> endobj 5673 0 obj <> endobj 456 0 obj <> endobj 5674 0 obj <> endobj 466 0 obj <> endobj 5675 0 obj <> endobj 467 0 obj <> endobj 5676 0 obj <> endobj 468 0 obj <> endobj 5677 0 obj <> endobj 469 0 obj <> endobj 471 0 obj <> endobj 472 0 obj <> endobj 473 0 obj <> endobj 474 0 obj <> endobj 475 0 obj <> endobj 476 0 obj <> endobj 477 0 obj <> endobj 478 0 obj <> endobj 479 0 obj <> endobj 5678 0 obj <> endobj 470 0 obj <> endobj 5679 0 obj <> endobj 483 0 obj <> endobj 5680 0 obj <> endobj 484 0 obj <> endobj 5681 0 obj <> endobj 485 0 obj <> endobj 5682 0 obj <> endobj 489 0 obj <> endobj 488 0 obj <> endobj 487 0 obj <> endobj 5683 0 obj <> endobj 492 0 obj <> endobj 491 0 obj <> endobj 490 0 obj <> endobj 5684 0 obj <> endobj 495 0 obj <> endobj 494 0 obj <> endobj 493 0 obj <> endobj 5685 0 obj <> endobj 498 0 obj <> endobj 497 0 obj <> endobj 496 0 obj <> endobj 5686 0 obj <> endobj 501 0 obj <> endobj 500 0 obj <> endobj 499 0 obj <> endobj 5687 0 obj <> endobj 504 0 obj <> endobj 503 0 obj <> endobj 502 0 obj <> endobj 5688 0 obj <> endobj 507 0 obj <> endobj 506 0 obj <> endobj 505 0 obj <> endobj 486 0 obj <> endobj 5689 0 obj <> endobj 508 0 obj <> endobj 5690 0 obj <> endobj 512 0 obj <> endobj 5691 0 obj <> endobj 513 0 obj <> endobj 5692 0 obj <> endobj 514 0 obj <> endobj 5693 0 obj <> endobj 515 0 obj <> endobj 517 0 obj <> endobj 518 0 obj <> endobj 519 0 obj <> endobj 520 0 obj <> endobj 521 0 obj <> endobj 522 0 obj <> endobj 523 0 obj <> endobj 524 0 obj <> endobj 525 0 obj <> endobj 526 0 obj <> endobj 527 0 obj <> endobj 528 0 obj <> endobj 529 0 obj <> endobj 530 0 obj <> endobj 531 0 obj <> endobj 532 0 obj <> endobj 533 0 obj <> endobj 534 0 obj <> endobj 535 0 obj <> endobj 536 0 obj <> endobj 537 0 obj <> endobj 538 0 obj <> endobj 539 0 obj <> endobj 540 0 obj <> endobj 5694 0 obj <> endobj 516 0 obj <> endobj 5695 0 obj <> endobj 542 0 obj <> endobj 5696 0 obj <> endobj 541 0 obj <> endobj 5697 0 obj <> endobj 543 0 obj <> endobj 5698 0 obj <> endobj 544 0 obj <> endobj 5699 0 obj <> endobj 545 0 obj <> endobj 5700 0 obj <> endobj 546 0 obj <> endobj 5701 0 obj <> endobj 550 0 obj <> endobj 5702 0 obj <> endobj 551 0 obj <> endobj 5703 0 obj <> endobj 552 0 obj <> endobj 5704 0 obj <> endobj 554 0 obj <> endobj 5705 0 obj <> endobj 553 0 obj <> endobj 5706 0 obj <> endobj 556 0 obj <> endobj 5707 0 obj <> endobj 555 0 obj <> endobj 5708 0 obj <> endobj 560 0 obj <> endobj 5709 0 obj <> endobj 561 0 obj <> endobj 563 0 obj <> endobj 5710 0 obj <> endobj 562 0 obj <> endobj 5711 0 obj <> endobj 564 0 obj <> endobj 566 0 obj <> endobj 567 0 obj <> endobj 568 0 obj <> endobj 569 0 obj <> endobj 570 0 obj <> endobj 571 0 obj <> endobj 572 0 obj <> endobj 573 0 obj <> endobj 574 0 obj <> endobj 575 0 obj <> endobj 5712 0 obj <> endobj 565 0 obj <> endobj 5713 0 obj <> endobj 576 0 obj <> endobj 5714 0 obj <> endobj 577 0 obj <> endobj 579 0 obj <> endobj 580 0 obj <> endobj 581 0 obj <> endobj 582 0 obj <> endobj 583 0 obj <> endobj 584 0 obj <> endobj 585 0 obj <> endobj 586 0 obj <> endobj 587 0 obj <> endobj 588 0 obj <> endobj 589 0 obj <> endobj 590 0 obj <> endobj 591 0 obj <> endobj 592 0 obj <> endobj 593 0 obj <> endobj 594 0 obj <> endobj 595 0 obj <> endobj 5715 0 obj <> endobj 578 0 obj <> endobj 5716 0 obj <> endobj 596 0 obj <> endobj 5717 0 obj <> endobj 597 0 obj <> endobj 5718 0 obj <> endobj 598 0 obj <> endobj 5719 0 obj <> endobj 602 0 obj <> endobj 5720 0 obj <> endobj 603 0 obj <> endobj 605 0 obj <> endobj 606 0 obj <> endobj 607 0 obj <> endobj 608 0 obj <> endobj 609 0 obj <> endobj 610 0 obj <> endobj 611 0 obj <> endobj 612 0 obj <> endobj 613 0 obj <> endobj 614 0 obj <> endobj 615 0 obj <> endobj 616 0 obj <> endobj 617 0 obj <> endobj 618 0 obj <> endobj 619 0 obj <> endobj 620 0 obj <> endobj 621 0 obj <> endobj 622 0 obj <> endobj 623 0 obj <> endobj 624 0 obj <> endobj 625 0 obj <> endobj 626 0 obj <> endobj 627 0 obj <> endobj 628 0 obj <> endobj 5721 0 obj <> endobj 604 0 obj <> endobj 5722 0 obj <> endobj 629 0 obj <> endobj 5723 0 obj <> endobj 630 0 obj <> endobj 5724 0 obj <> endobj 631 0 obj <> endobj 5725 0 obj <> endobj 632 0 obj <> endobj 5726 0 obj <> endobj 636 0 obj <> endobj 5727 0 obj <> endobj 637 0 obj <> endobj 639 0 obj <> endobj 640 0 obj <> endobj 641 0 obj <> endobj 642 0 obj <> endobj 643 0 obj <> endobj 644 0 obj <> endobj 645 0 obj <> endobj 646 0 obj <> endobj 647 0 obj <> endobj 648 0 obj <> endobj 649 0 obj <> endobj 650 0 obj <> endobj 651 0 obj <> endobj 652 0 obj <> endobj 653 0 obj <> endobj 654 0 obj <> endobj 655 0 obj <> endobj 656 0 obj <> endobj 657 0 obj <> endobj 658 0 obj <> endobj 659 0 obj <> endobj 660 0 obj <> endobj 661 0 obj <> endobj 662 0 obj <> endobj 663 0 obj <> endobj 664 0 obj <> endobj 665 0 obj <> endobj 666 0 obj <> endobj 667 0 obj <> endobj 5728 0 obj <> endobj 638 0 obj <> endobj 5729 0 obj <> endobj 668 0 obj <> endobj 5730 0 obj <> endobj 669 0 obj <> endobj 5731 0 obj <> endobj 670 0 obj <> endobj 5732 0 obj <> endobj 674 0 obj <> endobj 5733 0 obj <> endobj 675 0 obj <> endobj 5734 0 obj <> endobj 679 0 obj <> endobj 678 0 obj <> endobj 677 0 obj <> endobj 5735 0 obj <> endobj 682 0 obj <> endobj 681 0 obj <> endobj 680 0 obj <> endobj 5736 0 obj <> endobj 685 0 obj <> endobj 684 0 obj <> endobj 683 0 obj <> endobj 676 0 obj <> endobj 5737 0 obj <> endobj 686 0 obj <> endobj 5738 0 obj <> endobj 690 0 obj <> endobj 689 0 obj <> endobj 688 0 obj <> endobj 5739 0 obj <> endobj 693 0 obj <> endobj 692 0 obj <> endobj 691 0 obj <> endobj 5740 0 obj <> endobj 696 0 obj <> endobj 695 0 obj <> endobj 694 0 obj <> endobj 5741 0 obj <> endobj 699 0 obj <> endobj 698 0 obj <> endobj 697 0 obj <> endobj 5742 0 obj <> endobj 702 0 obj <> endobj 701 0 obj <> endobj 700 0 obj <> endobj 5743 0 obj <> endobj 705 0 obj <> endobj 704 0 obj <> endobj 703 0 obj <> endobj 5744 0 obj <> endobj 708 0 obj <> endobj 707 0 obj <> endobj 706 0 obj <> endobj 687 0 obj <> endobj 5745 0 obj <> endobj 712 0 obj <> endobj 5746 0 obj <> endobj 713 0 obj <> endobj 5747 0 obj <> endobj 714 0 obj <> endobj 5748 0 obj <> endobj 718 0 obj <> endobj 5749 0 obj <> endobj 5750 0 obj <> endobj 717 0 obj <> endobj 5751 0 obj <> endobj 720 0 obj <> endobj 5752 0 obj <> endobj 721 0 obj <> endobj 5753 0 obj <> endobj 5754 0 obj <> endobj 719 0 obj <> endobj 5755 0 obj <> endobj 716 0 obj <> endobj 5756 0 obj <> endobj 724 0 obj <> endobj 5757 0 obj <> endobj 5758 0 obj <> endobj 723 0 obj <> endobj 5759 0 obj <> endobj 726 0 obj <> endobj 5760 0 obj <> endobj 727 0 obj <> endobj 5761 0 obj <> endobj 728 0 obj <> endobj 5762 0 obj <> endobj 5763 0 obj <> endobj 725 0 obj <> endobj 5764 0 obj <> endobj 722 0 obj <> endobj 5765 0 obj <> endobj 731 0 obj <> endobj 5766 0 obj <> endobj 5767 0 obj <> endobj 730 0 obj <> endobj 5768 0 obj <> endobj 733 0 obj <> endobj 5769 0 obj <> endobj 735 0 obj <> endobj 5770 0 obj <> endobj 734 0 obj <> endobj 5771 0 obj <> endobj 736 0 obj <> endobj 5772 0 obj <> endobj 5773 0 obj <> endobj 732 0 obj <> endobj 5774 0 obj <> endobj 729 0 obj <> endobj 5775 0 obj <> endobj 739 0 obj <> endobj 5776 0 obj <> endobj 5777 0 obj <> endobj 738 0 obj <> endobj 5778 0 obj <> endobj 741 0 obj <> endobj 5779 0 obj <> endobj 745 0 obj <> endobj 5780 0 obj <> endobj 5781 0 obj <> endobj 744 0 obj <> endobj 5782 0 obj <> endobj 747 0 obj <> endobj 5783 0 obj <> endobj 5784 0 obj <> endobj 746 0 obj <> endobj 5785 0 obj <> endobj 743 0 obj <> endobj 5786 0 obj <> endobj 750 0 obj <> endobj 5787 0 obj <> endobj 5788 0 obj <> endobj 749 0 obj <> endobj 5789 0 obj <> endobj 752 0 obj <> endobj 5790 0 obj <> endobj 5791 0 obj <> endobj 751 0 obj <> endobj 5792 0 obj <> endobj 748 0 obj <> endobj 5793 0 obj <> endobj 755 0 obj <> endobj 5794 0 obj <> endobj 5795 0 obj <> endobj 754 0 obj <> endobj 5796 0 obj <> endobj 757 0 obj <> endobj 5797 0 obj <> endobj 5798 0 obj <> endobj 756 0 obj <> endobj 5799 0 obj <> endobj 753 0 obj <> endobj 5800 0 obj <> endobj 760 0 obj <> endobj 5801 0 obj <> endobj 5802 0 obj <> endobj 759 0 obj <> endobj 5803 0 obj <> endobj 762 0 obj <> endobj 5804 0 obj <> endobj 5805 0 obj <> endobj 761 0 obj <> endobj 5806 0 obj <> endobj 758 0 obj <> endobj 5807 0 obj <> endobj 765 0 obj <> endobj 5808 0 obj <> endobj 5809 0 obj <> endobj 764 0 obj <> endobj 5810 0 obj <> endobj 767 0 obj <> endobj 5811 0 obj <> endobj 5812 0 obj <> endobj 766 0 obj <> endobj 5813 0 obj <> endobj 763 0 obj <> endobj 5814 0 obj <> endobj 770 0 obj <> endobj 5815 0 obj <> endobj 5816 0 obj <> endobj 769 0 obj <> endobj 5817 0 obj <> endobj 772 0 obj <> endobj 5818 0 obj <> endobj 5819 0 obj <> endobj 771 0 obj <> endobj 5820 0 obj <> endobj 768 0 obj <> endobj 5821 0 obj <> endobj 775 0 obj <> endobj 5822 0 obj <> endobj 5823 0 obj <> endobj 774 0 obj <> endobj 5824 0 obj <> endobj 777 0 obj <> endobj 5825 0 obj <> endobj 5826 0 obj <> endobj 776 0 obj <> endobj 5827 0 obj <> endobj 773 0 obj <> endobj 5828 0 obj <> endobj 780 0 obj <> endobj 5829 0 obj <> endobj 5830 0 obj <> endobj 779 0 obj <> endobj 5831 0 obj <> endobj 782 0 obj <> ] >> endobj 5832 0 obj <> endobj 5833 0 obj <> endobj 781 0 obj <> endobj 5834 0 obj <> endobj 778 0 obj <> endobj 5835 0 obj <> endobj 792 0 obj <> endobj 5836 0 obj <> endobj 5837 0 obj <> endobj 791 0 obj <> endobj 5838 0 obj <> endobj 794 0 obj <> endobj 5839 0 obj <> endobj 5840 0 obj <> endobj 793 0 obj <> endobj 5841 0 obj <> endobj 790 0 obj <> endobj 5842 0 obj <> endobj 742 0 obj <> endobj 5843 0 obj <> endobj 5844 0 obj <> endobj 740 0 obj <> endobj 5845 0 obj <> endobj 737 0 obj <> endobj 5846 0 obj <> endobj 797 0 obj <> endobj 5847 0 obj <> endobj 5848 0 obj <> endobj 796 0 obj <> endobj 5849 0 obj <> endobj 799 0 obj <> endobj 5850 0 obj <> endobj 800 0 obj <> endobj 5851 0 obj <> endobj 5852 0 obj <> endobj 798 0 obj <> endobj 5853 0 obj <> endobj 795 0 obj <> endobj 5854 0 obj <> endobj 803 0 obj <> endobj 5855 0 obj <> endobj 5856 0 obj <> endobj 802 0 obj <> endobj 5857 0 obj <> endobj 805 0 obj <> endobj 5858 0 obj <> endobj 806 0 obj <> endobj 5859 0 obj <> endobj 807 0 obj <> endobj 5860 0 obj <> endobj 808 0 obj <> endobj 5861 0 obj <> endobj 809 0 obj <> endobj 5862 0 obj <> endobj 5863 0 obj <> endobj 804 0 obj <> endobj 5864 0 obj <> endobj 801 0 obj <> endobj 5865 0 obj <> endobj 812 0 obj <> endobj 5866 0 obj <> endobj 5867 0 obj <> endobj 811 0 obj <> endobj 5868 0 obj <> endobj 814 0 obj <> endobj 5869 0 obj <> endobj 815 0 obj <> endobj 5870 0 obj <> endobj 816 0 obj <> endobj 5871 0 obj <> endobj 817 0 obj <> endobj 5872 0 obj <> endobj 5873 0 obj <> endobj 813 0 obj <> endobj 5874 0 obj <> endobj 810 0 obj <> endobj 5875 0 obj <> endobj 820 0 obj <> endobj 5876 0 obj <> endobj 5877 0 obj <> endobj 819 0 obj <> endobj 5878 0 obj <> endobj 822 0 obj <> ] >> endobj 5879 0 obj <> endobj 827 0 obj <> endobj 5880 0 obj <> endobj 826 0 obj <> endobj 5881 0 obj <> endobj 828 0 obj <> endobj 5882 0 obj <> endobj 5883 0 obj <> endobj 821 0 obj <> endobj 5884 0 obj <> endobj 818 0 obj <> endobj 5885 0 obj <> endobj 715 0 obj <> endobj 5886 0 obj <> endobj 786 0 obj <> endobj 5887 0 obj <> endobj 785 0 obj <> endobj 784 0 obj <> endobj 783 0 obj <> endobj 5888 0 obj <> endobj 829 0 obj <> endobj 5889 0 obj <> endobj 830 0 obj <> endobj 5890 0 obj <> endobj 831 0 obj <> endobj 5891 0 obj <> endobj 835 0 obj <> endobj 834 0 obj <> endobj 833 0 obj <> endobj 5892 0 obj <> endobj 839 0 obj <> endobj 5893 0 obj <> endobj 838 0 obj <> endobj 837 0 obj <> endobj 836 0 obj <> endobj 5894 0 obj <> endobj 843 0 obj <> endobj 5895 0 obj <> endobj 842 0 obj <> endobj 841 0 obj <> endobj 840 0 obj <> endobj 5896 0 obj <> endobj 846 0 obj <> endobj 845 0 obj <> endobj 844 0 obj <> endobj 5897 0 obj <> endobj 849 0 obj <> endobj 848 0 obj <> endobj 847 0 obj <> endobj 5898 0 obj <> endobj 852 0 obj <> endobj 851 0 obj <> endobj 850 0 obj <> endobj 5899 0 obj <> endobj 855 0 obj <> endobj 854 0 obj <> endobj 853 0 obj <> endobj 5900 0 obj <> endobj 858 0 obj <> endobj 857 0 obj <> endobj 856 0 obj <> endobj 832 0 obj <> endobj 5901 0 obj <> endobj 859 0 obj <> endobj 5902 0 obj <> endobj 863 0 obj <> endobj 862 0 obj <> endobj 861 0 obj <> endobj 5903 0 obj <> endobj 866 0 obj <> endobj 865 0 obj <> endobj 864 0 obj <> endobj 5904 0 obj <> endobj 869 0 obj <> endobj 868 0 obj <> endobj 867 0 obj <> endobj 5905 0 obj <> endobj 872 0 obj <> endobj 871 0 obj <> endobj 870 0 obj <> endobj 5906 0 obj <> endobj 875 0 obj <> endobj 874 0 obj <> endobj 873 0 obj <> endobj 860 0 obj <> endobj 5907 0 obj <> endobj 879 0 obj <> endobj 5908 0 obj <> endobj 880 0 obj <> endobj 5909 0 obj <> endobj 881 0 obj <> endobj 5910 0 obj <> endobj 883 0 obj <> endobj 5911 0 obj <> endobj 882 0 obj <> endobj 5912 0 obj <> endobj 884 0 obj <> endobj 5913 0 obj <> endobj 885 0 obj <> endobj 5914 0 obj <> endobj 886 0 obj <> endobj 5915 0 obj <> endobj 890 0 obj <> endobj 5916 0 obj <> endobj 889 0 obj <> endobj 5917 0 obj <> endobj 892 0 obj <> endobj 5918 0 obj <> endobj 891 0 obj <> endobj 5919 0 obj <> endobj 888 0 obj <> endobj 5920 0 obj <> endobj 895 0 obj <> endobj 5921 0 obj <> endobj 894 0 obj <> endobj 5922 0 obj <> endobj 897 0 obj <> endobj 5923 0 obj <> endobj 896 0 obj <> endobj 5924 0 obj <> endobj 893 0 obj <> endobj 5925 0 obj <> endobj 887 0 obj <> endobj 5926 0 obj <> endobj 898 0 obj <> endobj 5927 0 obj <> endobj 899 0 obj <> endobj 5928 0 obj <> endobj 900 0 obj <> endobj 5929 0 obj <> endobj 901 0 obj <> endobj 5930 0 obj <> endobj 905 0 obj <> endobj 5931 0 obj <> endobj 5932 0 obj <> endobj 904 0 obj <> endobj 5933 0 obj <> endobj 907 0 obj <> endobj 5934 0 obj <> endobj 5935 0 obj <> endobj 906 0 obj <> endobj 5936 0 obj <> endobj 903 0 obj <> endobj 5937 0 obj <> endobj 910 0 obj <> endobj 5938 0 obj <> endobj 5939 0 obj <> endobj 909 0 obj <> endobj 5940 0 obj <> endobj 912 0 obj <> endobj 5941 0 obj <> endobj 913 0 obj <> endobj 5942 0 obj <> endobj 914 0 obj <> endobj 5943 0 obj <> endobj 915 0 obj <> ] >> endobj 5944 0 obj <> endobj 922 0 obj <> endobj 5945 0 obj <> endobj 5946 0 obj <> endobj 911 0 obj <> endobj 5947 0 obj <> endobj 908 0 obj <> endobj 5948 0 obj <> endobj 902 0 obj <> endobj 5949 0 obj <> endobj 918 0 obj <> endobj 917 0 obj <> endobj 916 0 obj <> endobj 5950 0 obj <> endobj 923 0 obj <> endobj 5951 0 obj <> endobj 924 0 obj <> endobj 5952 0 obj <> endobj 925 0 obj <> endobj 5953 0 obj <> endobj 926 0 obj <> endobj 5954 0 obj <> endobj 930 0 obj <> endobj 5955 0 obj <> endobj 929 0 obj <> endobj 5956 0 obj <> endobj 932 0 obj <> endobj 5957 0 obj <> endobj 931 0 obj <> endobj 5958 0 obj <> endobj 928 0 obj <> endobj 5959 0 obj <> endobj 927 0 obj <> endobj 5960 0 obj <> endobj 933 0 obj <> endobj 5961 0 obj <> endobj 934 0 obj <> endobj 5962 0 obj <> endobj 935 0 obj <> endobj 5963 0 obj <> endobj 936 0 obj <> endobj 5964 0 obj <> endobj 940 0 obj <> endobj 5965 0 obj <> endobj 939 0 obj <> endobj 5966 0 obj <> endobj 942 0 obj <> endobj 5967 0 obj <> endobj 941 0 obj <> endobj 5968 0 obj <> endobj 938 0 obj <> endobj 5969 0 obj <> endobj 937 0 obj <> endobj 5970 0 obj <> endobj 943 0 obj <> endobj 5971 0 obj <> endobj 944 0 obj <> endobj 5972 0 obj <> endobj 945 0 obj <> endobj 5973 0 obj <> endobj 946 0 obj <> endobj 5974 0 obj <> endobj 950 0 obj <> endobj 5975 0 obj <> endobj 949 0 obj <> endobj 5976 0 obj <> endobj 952 0 obj <> endobj 5977 0 obj <> endobj 951 0 obj <> endobj 5978 0 obj <> endobj 948 0 obj <> endobj 5979 0 obj <> endobj 955 0 obj <> endobj 5980 0 obj <> endobj 954 0 obj <> endobj 5981 0 obj <> endobj 957 0 obj <> endobj 5982 0 obj <> endobj 956 0 obj <> endobj 5983 0 obj <> endobj 953 0 obj <> endobj 5984 0 obj <> endobj 960 0 obj <> endobj 5985 0 obj <> endobj 959 0 obj <> endobj 5986 0 obj <> endobj 962 0 obj <> endobj 5987 0 obj <> endobj 961 0 obj <> endobj 5988 0 obj <> endobj 958 0 obj <> endobj 5989 0 obj <> endobj 947 0 obj <> endobj 5990 0 obj <> endobj 963 0 obj <> endobj 5991 0 obj <> endobj 964 0 obj <> endobj 5992 0 obj <> endobj 965 0 obj <> endobj 5993 0 obj <> endobj 966 0 obj <> endobj 5994 0 obj <> endobj 970 0 obj <> endobj 5995 0 obj <> endobj 974 0 obj <> endobj 5996 0 obj <> endobj 973 0 obj <> endobj 5997 0 obj <> endobj 976 0 obj <> endobj 5998 0 obj <> endobj 975 0 obj <> endobj 5999 0 obj <> endobj 972 0 obj <> endobj 6000 0 obj <> endobj 979 0 obj <> endobj 6001 0 obj <> endobj 978 0 obj <> endobj 6002 0 obj <> endobj 981 0 obj <> endobj 6003 0 obj <> endobj 980 0 obj <> endobj 6004 0 obj <> endobj 977 0 obj <> endobj 6005 0 obj <> endobj 971 0 obj <> endobj 6006 0 obj <> endobj 982 0 obj <> endobj 6007 0 obj <> endobj 983 0 obj <> endobj 6008 0 obj <> endobj 984 0 obj <> endobj 6009 0 obj <> endobj 985 0 obj <> endobj 6010 0 obj <> endobj 989 0 obj <> endobj 6011 0 obj <> endobj 988 0 obj <> endobj 6012 0 obj <> endobj 991 0 obj <> endobj 6013 0 obj <> endobj 990 0 obj <> endobj 6014 0 obj <> endobj 987 0 obj <> endobj 6015 0 obj <> endobj 994 0 obj <> endobj 6016 0 obj <> endobj 993 0 obj <> endobj 6017 0 obj <> endobj 996 0 obj <> endobj 6018 0 obj <> endobj 995 0 obj <> endobj 6019 0 obj <> endobj 992 0 obj <> endobj 6020 0 obj <> endobj 986 0 obj <> endobj 6021 0 obj <> endobj 997 0 obj <> endobj 6022 0 obj <> endobj 998 0 obj <> endobj 6023 0 obj <> endobj 999 0 obj <> endobj 6024 0 obj <> endobj 1000 0 obj <> endobj 6025 0 obj <> endobj 1004 0 obj <> endobj 6026 0 obj <> endobj 1003 0 obj <> endobj 6027 0 obj <> endobj 1006 0 obj <> endobj 6028 0 obj <> endobj 1005 0 obj <> endobj 6029 0 obj <> endobj 1002 0 obj <> endobj 6030 0 obj <> endobj 1009 0 obj <> endobj 6031 0 obj <> endobj 1008 0 obj <> endobj 6032 0 obj <> endobj 1011 0 obj <> endobj 6033 0 obj <> endobj 1010 0 obj <> endobj 6034 0 obj <> endobj 1007 0 obj <> endobj 6035 0 obj <> endobj 1001 0 obj <> endobj 6036 0 obj <> endobj 1012 0 obj <> endobj 6037 0 obj <> endobj 1013 0 obj <> endobj 6038 0 obj <> endobj 1014 0 obj <> endobj 6039 0 obj <> endobj 1015 0 obj <> endobj 6040 0 obj <> endobj 1016 0 obj <> endobj 6041 0 obj <> endobj 1017 0 obj <> endobj 6042 0 obj <> endobj 1021 0 obj <> endobj 6043 0 obj <> endobj 1020 0 obj <> endobj 6044 0 obj <> endobj 1023 0 obj <> endobj 6045 0 obj <> endobj 1022 0 obj <> endobj 6046 0 obj <> endobj 1019 0 obj <> endobj 6047 0 obj <> endobj 1026 0 obj <> endobj 6048 0 obj <> endobj 1025 0 obj <> endobj 6049 0 obj <> endobj 1028 0 obj <> endobj 6050 0 obj <> endobj 1027 0 obj <> endobj 6051 0 obj <> endobj 1024 0 obj <> endobj 6052 0 obj <> endobj 1018 0 obj <> endobj 6053 0 obj <> endobj 1032 0 obj <> endobj 6054 0 obj <> endobj 1033 0 obj <> endobj 6055 0 obj <> endobj 1034 0 obj <> endobj 6056 0 obj <> endobj 1035 0 obj <> endobj 6057 0 obj <> endobj 1036 0 obj <> endobj 6058 0 obj <> endobj 1037 0 obj <> endobj 6059 0 obj <> endobj 1038 0 obj <> endobj 6060 0 obj <> endobj 1039 0 obj <> endobj 6061 0 obj <> endobj 1040 0 obj <> endobj 6062 0 obj <> endobj 1041 0 obj <> endobj 6063 0 obj <> endobj 1045 0 obj <> endobj 6064 0 obj <> endobj 1044 0 obj <> endobj 6065 0 obj <> endobj 1047 0 obj <> endobj 6066 0 obj <> endobj 1046 0 obj <> endobj 6067 0 obj <> endobj 1043 0 obj <> endobj 6068 0 obj <> endobj 1042 0 obj <> endobj 6069 0 obj <> endobj 1048 0 obj <> endobj 6070 0 obj <> endobj 1049 0 obj <> endobj 6071 0 obj <> endobj 1050 0 obj <> endobj 6072 0 obj <> endobj 1052 0 obj <> endobj 6073 0 obj <> endobj 1051 0 obj <> endobj 6074 0 obj <> endobj 1053 0 obj <> endobj 6075 0 obj <> endobj 1057 0 obj <> endobj 6076 0 obj <> endobj 1056 0 obj <> endobj 6077 0 obj <> endobj 1059 0 obj <> endobj 6078 0 obj <> endobj 1058 0 obj <> endobj 6079 0 obj <> endobj 1055 0 obj <> endobj 6080 0 obj <> endobj 1054 0 obj <> endobj 6081 0 obj <> endobj 1060 0 obj <> endobj 6082 0 obj <> endobj 1061 0 obj <> endobj 6083 0 obj <> endobj 1062 0 obj <> endobj 6084 0 obj <> endobj 1063 0 obj <> endobj 6085 0 obj <> endobj 1067 0 obj <> endobj 6086 0 obj <> endobj 6087 0 obj <> endobj 1066 0 obj <> endobj 6088 0 obj <> endobj 1069 0 obj <> endobj 6089 0 obj <> endobj 6090 0 obj <> endobj 1068 0 obj <> endobj 6091 0 obj <> endobj 1065 0 obj <> endobj 6092 0 obj <> endobj 1075 0 obj <> endobj 6093 0 obj <> endobj 6094 0 obj <> endobj 1074 0 obj <> endobj 6095 0 obj <> endobj 1077 0 obj <> endobj 6096 0 obj <> endobj 6097 0 obj <> endobj 1076 0 obj <> endobj 6098 0 obj <> endobj 1073 0 obj <> endobj 6099 0 obj <> endobj 1064 0 obj <> endobj 6100 0 obj <> endobj 1078 0 obj <> endobj 6101 0 obj <> endobj 1079 0 obj <> endobj 6102 0 obj <> endobj 1080 0 obj <> endobj 6103 0 obj <> endobj 1081 0 obj <> endobj 6104 0 obj <> endobj 1085 0 obj <> endobj 6105 0 obj <> endobj 1084 0 obj <> endobj 6106 0 obj <> endobj 1087 0 obj <> endobj 6107 0 obj <> endobj 1086 0 obj <> endobj 6108 0 obj <> endobj 1083 0 obj <> endobj 6109 0 obj <> endobj 1090 0 obj <> endobj 6110 0 obj <> endobj 1089 0 obj <> endobj 6111 0 obj <> endobj 1092 0 obj <> endobj 6112 0 obj <> endobj 1091 0 obj <> endobj 6113 0 obj <> endobj 1088 0 obj <> endobj 6114 0 obj <> endobj 1082 0 obj <> endobj 6115 0 obj <> endobj 1093 0 obj <> endobj 6116 0 obj <> endobj 1094 0 obj <> endobj 6117 0 obj <> endobj 1095 0 obj <> endobj 6118 0 obj <> endobj 1096 0 obj <> endobj 6119 0 obj <> endobj 1100 0 obj <> endobj 6120 0 obj <> endobj 1099 0 obj <> endobj 6121 0 obj <> endobj 1102 0 obj <> endobj 6122 0 obj <> endobj 1101 0 obj <> endobj 6123 0 obj <> endobj 1098 0 obj <> endobj 6124 0 obj <> endobj 1097 0 obj <> endobj 6125 0 obj <> endobj 1103 0 obj <> endobj 6126 0 obj <> endobj 1107 0 obj <> endobj 6127 0 obj <> endobj 1108 0 obj <> endobj 6128 0 obj <> endobj 1109 0 obj <> endobj 6129 0 obj <> endobj 1111 0 obj <> endobj 6130 0 obj <> endobj 1112 0 obj <> endobj 6131 0 obj <> endobj 1110 0 obj <> endobj 6132 0 obj <> endobj 1113 0 obj <> endobj 6133 0 obj <> endobj 1114 0 obj <> endobj 6134 0 obj <> endobj 1118 0 obj <> endobj 6135 0 obj <> endobj 6136 0 obj <> endobj 1117 0 obj <> endobj 6137 0 obj <> endobj 1120 0 obj <> endobj 6138 0 obj <> endobj 1121 0 obj <> endobj 6139 0 obj <> endobj 6140 0 obj <> endobj 1119 0 obj <> endobj 6141 0 obj <> endobj 1116 0 obj <> endobj 6142 0 obj <> endobj 1124 0 obj <> endobj 6143 0 obj <> endobj 6144 0 obj <> endobj 1123 0 obj <> endobj 6145 0 obj <> endobj 1126 0 obj <> endobj 6146 0 obj <> endobj 1127 0 obj <> endobj 6147 0 obj <> endobj 1128 0 obj <> endobj 6148 0 obj <> endobj 6149 0 obj <> endobj 1125 0 obj <> endobj 6150 0 obj <> endobj 1122 0 obj <> endobj 6151 0 obj <> endobj 1131 0 obj <> endobj 6152 0 obj <> endobj 6153 0 obj <> endobj 1130 0 obj <> endobj 6154 0 obj <> endobj 1133 0 obj <> endobj 6155 0 obj <> endobj 1134 0 obj <> endobj 6156 0 obj <> endobj 1135 0 obj <> endobj 6157 0 obj <> endobj 6158 0 obj <> endobj 1132 0 obj <> endobj 6159 0 obj <> endobj 1129 0 obj <> endobj 6160 0 obj <> endobj 1138 0 obj <> endobj 6161 0 obj <> endobj 6162 0 obj <> endobj 1137 0 obj <> endobj 6163 0 obj <> endobj 1141 0 obj <> endobj 6164 0 obj <> endobj 1142 0 obj <> endobj 6165 0 obj <> endobj 1140 0 obj <> ] >> endobj 6166 0 obj <> endobj 1146 0 obj <> endobj 6167 0 obj <> endobj 1147 0 obj <> endobj 6168 0 obj <> endobj 1149 0 obj <> endobj 6169 0 obj <> endobj 1148 0 obj <> endobj 6170 0 obj <> endobj 1150 0 obj <> endobj 6171 0 obj <> endobj 6172 0 obj <> endobj 1139 0 obj <> endobj 6173 0 obj <> endobj 1136 0 obj <> endobj 6174 0 obj <> endobj 1115 0 obj <> endobj 6175 0 obj <> endobj 1152 0 obj <> endobj 6176 0 obj <> endobj 1151 0 obj <> endobj 6177 0 obj <> endobj 1153 0 obj <> endobj 6178 0 obj <> endobj 1154 0 obj <> endobj 6179 0 obj <> endobj 1155 0 obj <> endobj 6180 0 obj <> endobj 1156 0 obj <> endobj 6181 0 obj <> endobj 1157 0 obj <> endobj 6182 0 obj <> endobj 1158 0 obj <> endobj 6183 0 obj <> endobj 1159 0 obj <> endobj 6184 0 obj <> endobj 1160 0 obj <> endobj 6185 0 obj <> endobj 1161 0 obj <> endobj 6186 0 obj <> endobj 1162 0 obj <> endobj 6187 0 obj <> endobj 1163 0 obj <> endobj 6188 0 obj <> endobj 1164 0 obj <> endobj 6189 0 obj <> endobj 1165 0 obj <> endobj 6190 0 obj <> endobj 1166 0 obj <> endobj 6191 0 obj <> endobj 1167 0 obj <> endobj 6192 0 obj <> endobj 1168 0 obj <> endobj 6193 0 obj <> endobj 1171 0 obj <> endobj 1170 0 obj <> endobj 1169 0 obj <> endobj 6194 0 obj <> endobj 1175 0 obj <> endobj 6195 0 obj <> endobj 1176 0 obj <> endobj 6196 0 obj <> endobj 1180 0 obj <> endobj 6197 0 obj <> endobj 1182 0 obj <> endobj 6198 0 obj <> endobj 1183 0 obj <> endobj 6199 0 obj <> endobj 1181 0 obj <> endobj 6200 0 obj <> endobj 1184 0 obj <> endobj 1179 0 obj <> endobj 1178 0 obj <> endobj 6201 0 obj <> endobj 1188 0 obj <> endobj 6202 0 obj <> endobj 1187 0 obj <> endobj 1186 0 obj <> endobj 1185 0 obj <> endobj 6203 0 obj <> endobj 1191 0 obj <> endobj 1190 0 obj <> endobj 1189 0 obj <> endobj 6204 0 obj <> endobj 1194 0 obj <> endobj 1193 0 obj <> endobj 1192 0 obj <> endobj 1177 0 obj <> endobj 6205 0 obj <> endobj 1195 0 obj <> endobj 6206 0 obj <> endobj 1196 0 obj <> endobj 6207 0 obj <> endobj 1197 0 obj <> endobj 6208 0 obj <> endobj 1201 0 obj <> endobj 6209 0 obj <> endobj 1202 0 obj <> endobj 1200 0 obj <> endobj 1199 0 obj <> endobj 6210 0 obj <> endobj 1205 0 obj <> endobj 1204 0 obj <> endobj 1203 0 obj <> endobj 6211 0 obj <> endobj 1209 0 obj <> endobj 6212 0 obj <> endobj 1208 0 obj <> endobj 1207 0 obj <> endobj 1206 0 obj <> endobj 6213 0 obj <> endobj 1213 0 obj <> endobj 6214 0 obj <> endobj 1212 0 obj <> endobj 1211 0 obj <> endobj 1210 0 obj <> endobj 6215 0 obj <> endobj 1217 0 obj <> endobj 6216 0 obj <> endobj 1216 0 obj <> ] >> endobj 1215 0 obj <> endobj 1214 0 obj <> endobj 1198 0 obj <> endobj 6217 0 obj <> endobj 1221 0 obj <> endobj 6218 0 obj <> endobj 1223 0 obj <> endobj 6219 0 obj <> endobj 1222 0 obj <> endobj 6220 0 obj <> endobj 1224 0 obj <> endobj 6221 0 obj <> endobj 1225 0 obj <> endobj 6222 0 obj <> endobj 1226 0 obj <> endobj 6223 0 obj <> endobj 1227 0 obj <> endobj 6224 0 obj <> endobj 1231 0 obj <> endobj 6225 0 obj <> endobj 1230 0 obj <> endobj 6226 0 obj <> endobj 1233 0 obj <> endobj 6227 0 obj <> endobj 1232 0 obj <> endobj 6228 0 obj <> endobj 1229 0 obj <> endobj 6229 0 obj <> endobj 1236 0 obj <> endobj 6230 0 obj <> endobj 1235 0 obj <> endobj 6231 0 obj <> endobj 1238 0 obj <> endobj 6232 0 obj <> endobj 1237 0 obj <> endobj 6233 0 obj <> endobj 1234 0 obj <> endobj 6234 0 obj <> endobj 1241 0 obj <> endobj 6235 0 obj <> endobj 1240 0 obj <> endobj 6236 0 obj <> endobj 1243 0 obj <> endobj 6237 0 obj <> endobj 1242 0 obj <> endobj 6238 0 obj <> endobj 1239 0 obj <> endobj 6239 0 obj <> endobj 1228 0 obj <> endobj 6240 0 obj <> endobj 1244 0 obj <> endobj 6241 0 obj <> endobj 1245 0 obj <> endobj 6242 0 obj <> endobj 1246 0 obj <> endobj 6243 0 obj <> endobj 1247 0 obj <> endobj 6244 0 obj <> endobj 1248 0 obj <> endobj 6245 0 obj <> endobj 1252 0 obj <> endobj 6246 0 obj <> endobj 6247 0 obj <> endobj 1251 0 obj <> endobj 6248 0 obj <> endobj 1254 0 obj <> endobj 6249 0 obj <> endobj 6250 0 obj <> endobj 1253 0 obj <> endobj 6251 0 obj <> endobj 1250 0 obj <> endobj 6252 0 obj <> endobj 1257 0 obj <> endobj 6253 0 obj <> endobj 6254 0 obj <> endobj 1256 0 obj <> endobj 6255 0 obj <> endobj 1259 0 obj <> ] >> endobj 6256 0 obj <> endobj 6257 0 obj <> endobj 1258 0 obj <> endobj 6258 0 obj <> endobj 1255 0 obj <> endobj 6259 0 obj <> endobj 1249 0 obj <> endobj 6260 0 obj <> endobj 1263 0 obj <> endobj 6261 0 obj <> endobj 1264 0 obj <> endobj 6262 0 obj <> endobj 1265 0 obj <> endobj 6263 0 obj <> endobj 1266 0 obj <> endobj 6264 0 obj <> endobj 1267 0 obj <> endobj 6265 0 obj <> endobj 1268 0 obj <> endobj 6266 0 obj <> endobj 1269 0 obj <> endobj 6267 0 obj <> endobj 1273 0 obj <> endobj 6268 0 obj <> endobj 1272 0 obj <> endobj 6269 0 obj <> endobj 1275 0 obj <> endobj 6270 0 obj <> endobj 1274 0 obj <> endobj 6271 0 obj <> endobj 1271 0 obj <> endobj 6272 0 obj <> endobj 1278 0 obj <> endobj 6273 0 obj <> endobj 1277 0 obj <> endobj 6274 0 obj <> endobj 1280 0 obj <> endobj 6275 0 obj <> endobj 1279 0 obj <> endobj 6276 0 obj <> endobj 1276 0 obj <> endobj 6277 0 obj <> endobj 1283 0 obj <> endobj 6278 0 obj <> endobj 1282 0 obj <> endobj 6279 0 obj <> endobj 1285 0 obj <> endobj 6280 0 obj <> endobj 1284 0 obj <> endobj 6281 0 obj <> endobj 1281 0 obj <> endobj 6282 0 obj <> endobj 1288 0 obj <> endobj 6283 0 obj <> endobj 1287 0 obj <> endobj 6284 0 obj <> endobj 1290 0 obj <> endobj 6285 0 obj <> endobj 1289 0 obj <> endobj 6286 0 obj <> endobj 1286 0 obj <> endobj 6287 0 obj <> endobj 1270 0 obj <> endobj 6288 0 obj <> endobj 1292 0 obj <> endobj 6289 0 obj <> endobj 1291 0 obj <> endobj 6290 0 obj <> endobj 1294 0 obj <> endobj 6291 0 obj <> endobj 1295 0 obj <> endobj 6292 0 obj <> endobj 1296 0 obj <> endobj 6293 0 obj <> endobj 1293 0 obj <> endobj 6294 0 obj <> endobj 1297 0 obj <> endobj 6295 0 obj <> endobj 1298 0 obj <> endobj 6296 0 obj <> endobj 1299 0 obj <> endobj 6297 0 obj <> endobj 1300 0 obj <> endobj 6298 0 obj <> endobj 1301 0 obj <> endobj 6299 0 obj <> endobj 1305 0 obj <> endobj 6300 0 obj <> endobj 1306 0 obj <> endobj 6301 0 obj <> endobj 1307 0 obj <> endobj 6302 0 obj <> endobj 1308 0 obj <> endobj 6303 0 obj <> endobj 1309 0 obj <> endobj 6304 0 obj <> endobj 1310 0 obj <> endobj 6305 0 obj <> endobj 1311 0 obj <> endobj 6306 0 obj <> endobj 1312 0 obj <> endobj 6307 0 obj <> endobj 1313 0 obj <> endobj 6308 0 obj <> endobj 1314 0 obj <> endobj 6309 0 obj <> endobj 1315 0 obj <> endobj 6310 0 obj <> endobj 1316 0 obj <> endobj 6311 0 obj <> endobj 1317 0 obj <> endobj 6312 0 obj <> endobj 1318 0 obj <> endobj 6313 0 obj <> endobj 1319 0 obj <> endobj 6314 0 obj <> endobj 1320 0 obj <> endobj 6315 0 obj <> endobj 1321 0 obj <> endobj 6316 0 obj <> endobj 1322 0 obj <> endobj 6317 0 obj <> endobj 1323 0 obj <> endobj 6318 0 obj <> endobj 1328 0 obj <> endobj 6319 0 obj <> endobj 1327 0 obj <> endobj 6320 0 obj <> endobj 1329 0 obj <> endobj 6321 0 obj <> endobj 1330 0 obj <> endobj 6322 0 obj <> endobj 1332 0 obj <> endobj 6323 0 obj <> endobj 1331 0 obj <> endobj 6324 0 obj <> endobj 1333 0 obj <> endobj 6325 0 obj <> endobj 1334 0 obj <> endobj 6326 0 obj <> endobj 1335 0 obj <> endobj 6327 0 obj <> endobj 1336 0 obj <> endobj 6328 0 obj <> endobj 1337 0 obj <> endobj 6329 0 obj <> endobj 1339 0 obj <> endobj 6330 0 obj <> endobj 1338 0 obj <> endobj 6331 0 obj <> endobj 1340 0 obj <> endobj 6332 0 obj <> endobj 1341 0 obj <> endobj 6333 0 obj <> endobj 1342 0 obj <> endobj 6334 0 obj <> endobj 1343 0 obj <> endobj 6335 0 obj <> endobj 1344 0 obj <> endobj 6336 0 obj <> endobj 1345 0 obj <> endobj 6337 0 obj <> endobj 1347 0 obj <> endobj 6338 0 obj <> endobj 1346 0 obj <> endobj 6339 0 obj <> endobj 1348 0 obj <> endobj 6340 0 obj <> endobj 1349 0 obj <> endobj 6341 0 obj <> endobj 1353 0 obj <> endobj 6342 0 obj <> endobj 1354 0 obj <> endobj 6343 0 obj <> endobj 1355 0 obj <> endobj 6344 0 obj <> endobj 1356 0 obj <> endobj 6345 0 obj <> endobj 1357 0 obj <> endobj 6346 0 obj <> endobj 1358 0 obj <> endobj 6347 0 obj <> endobj 1359 0 obj <> endobj 6348 0 obj <> endobj 1360 0 obj <> endobj 6349 0 obj <> endobj 1361 0 obj <> endobj 6350 0 obj <> endobj 1362 0 obj <> endobj 6351 0 obj <> endobj 1363 0 obj <> endobj 6352 0 obj <> endobj 1364 0 obj <> endobj 6353 0 obj <> endobj 1365 0 obj <> endobj 6354 0 obj <> endobj 1366 0 obj <> endobj 6355 0 obj <> endobj 1367 0 obj <> endobj 6356 0 obj <> endobj 1368 0 obj <> endobj 6357 0 obj <> endobj 1369 0 obj <> endobj 6358 0 obj <> endobj 1370 0 obj <> endobj 6359 0 obj <> endobj 1375 0 obj <> endobj 6360 0 obj <> endobj 1374 0 obj <> endobj 6361 0 obj <> endobj 1376 0 obj <> endobj 6362 0 obj <> endobj 1377 0 obj <> endobj 6363 0 obj <> endobj 1378 0 obj <> endobj 6364 0 obj <> endobj 1379 0 obj <> endobj 6365 0 obj <> endobj 1380 0 obj <> endobj 6366 0 obj <> endobj 1381 0 obj <> endobj 6367 0 obj <> endobj 1382 0 obj <> endobj 6368 0 obj <> endobj 1383 0 obj <> endobj 6369 0 obj <> endobj 1385 0 obj <> endobj 6370 0 obj <> endobj 1386 0 obj <> endobj 6371 0 obj <> endobj 1384 0 obj <> endobj 6372 0 obj <> endobj 1387 0 obj <> endobj 6373 0 obj <> endobj 1389 0 obj <> endobj 6374 0 obj <> endobj 1388 0 obj <> endobj 6375 0 obj <> endobj 1390 0 obj <> endobj 6376 0 obj <> endobj 1391 0 obj <> endobj 6377 0 obj <> endobj 1392 0 obj <> endobj 6378 0 obj <> endobj 1393 0 obj <> endobj 6379 0 obj <> endobj 1394 0 obj <> ] >> endobj 6380 0 obj <> endobj 1397 0 obj <> endobj 1396 0 obj <> endobj 6381 0 obj <> endobj 1399 0 obj <> endobj 1398 0 obj <> endobj 1395 0 obj <> endobj 6382 0 obj <> endobj 1403 0 obj <> endobj 6383 0 obj <> endobj 1404 0 obj <> endobj 6384 0 obj <> endobj 1405 0 obj <> endobj 6385 0 obj <> endobj 1406 0 obj <> endobj 6386 0 obj <> endobj 1407 0 obj <> endobj 6387 0 obj <> endobj 1408 0 obj <> endobj 6388 0 obj <> endobj 1409 0 obj <> endobj 6389 0 obj <> endobj 1410 0 obj <> endobj 6390 0 obj <> endobj 1411 0 obj <> endobj 6391 0 obj <> endobj 1412 0 obj <> endobj 6392 0 obj <> endobj 1414 0 obj <> endobj 6393 0 obj <> endobj 1413 0 obj <> endobj 6394 0 obj <> endobj 1415 0 obj <> endobj 6395 0 obj <> endobj 1416 0 obj <> endobj 6396 0 obj <> endobj 1417 0 obj <> endobj 6397 0 obj <> endobj 1418 0 obj <> endobj 6398 0 obj <> endobj 1419 0 obj <> endobj 6399 0 obj <> endobj 1420 0 obj <> ] >> endobj 6400 0 obj <> endobj 1424 0 obj <> endobj 6401 0 obj <> endobj 1425 0 obj <> endobj 6402 0 obj <> endobj 1426 0 obj <> endobj 6403 0 obj <> endobj 1427 0 obj <> endobj 6404 0 obj <> endobj 1428 0 obj <> endobj 6405 0 obj <> endobj 1429 0 obj <> endobj 6406 0 obj <> endobj 1431 0 obj <> endobj 6407 0 obj <> endobj 1430 0 obj <> endobj 6408 0 obj <> endobj 1432 0 obj <> endobj 6409 0 obj <> endobj 1433 0 obj <> endobj 6410 0 obj <> endobj 1434 0 obj <> endobj 6411 0 obj <> endobj 1435 0 obj <> endobj 6412 0 obj <> endobj 1436 0 obj <> endobj 6413 0 obj <> endobj 1437 0 obj <> endobj 6414 0 obj <> endobj 1438 0 obj <> endobj 6415 0 obj <> endobj 1441 0 obj <> endobj 1440 0 obj <> endobj 1439 0 obj <> endobj 6416 0 obj <> endobj 1445 0 obj <> endobj 6417 0 obj <> endobj 1446 0 obj <> endobj 6418 0 obj <> endobj 1447 0 obj <> endobj 6419 0 obj <> endobj 1448 0 obj <> endobj 6420 0 obj <> endobj 1449 0 obj <> endobj 6421 0 obj <> endobj 1450 0 obj <> endobj 6422 0 obj <> endobj 1451 0 obj <> endobj 6423 0 obj <> endobj 1452 0 obj <> endobj 6424 0 obj <> endobj 1453 0 obj <> endobj 6425 0 obj <> endobj 1454 0 obj <> endobj 6426 0 obj <> endobj 1455 0 obj <> endobj 6427 0 obj <> endobj 1456 0 obj <> endobj 6428 0 obj <> endobj 1460 0 obj <> endobj 6429 0 obj <> endobj 1459 0 obj <> endobj 6430 0 obj <> endobj 1462 0 obj <> endobj 6431 0 obj <> endobj 1461 0 obj <> endobj 6432 0 obj <> endobj 1458 0 obj <> endobj 6433 0 obj <> endobj 1465 0 obj <> endobj 6434 0 obj <> endobj 1464 0 obj <> endobj 6435 0 obj <> endobj 1467 0 obj <> endobj 6436 0 obj <> endobj 1466 0 obj <> endobj 6437 0 obj <> endobj 1463 0 obj <> endobj 6438 0 obj <> endobj 1457 0 obj <> endobj 6439 0 obj <> endobj 1468 0 obj <> endobj 6440 0 obj <> endobj 1469 0 obj <> endobj 6441 0 obj <> endobj 1470 0 obj <> endobj 6442 0 obj <> endobj 1474 0 obj <> endobj 6443 0 obj <> endobj 1473 0 obj <> endobj 6444 0 obj <> endobj 1476 0 obj <> endobj 6445 0 obj <> endobj 1475 0 obj <> endobj 6446 0 obj <> endobj 1472 0 obj <> endobj 6447 0 obj <> endobj 1471 0 obj <> endobj 6448 0 obj <> endobj 1477 0 obj <> endobj 6449 0 obj <> endobj 1478 0 obj <> endobj 6450 0 obj <> endobj 1479 0 obj <> endobj 6451 0 obj <> endobj 1483 0 obj <> endobj 6452 0 obj <> endobj 1487 0 obj <> endobj 6453 0 obj <> endobj 1486 0 obj <> endobj 6454 0 obj <> endobj 1489 0 obj <> endobj 6455 0 obj <> endobj 1488 0 obj <> endobj 6456 0 obj <> endobj 1485 0 obj <> endobj 6457 0 obj <> endobj 1492 0 obj <> endobj 6458 0 obj <> endobj 1491 0 obj <> endobj 6459 0 obj <> endobj 1494 0 obj <> endobj 6460 0 obj <> endobj 1493 0 obj <> endobj 6461 0 obj <> endobj 1490 0 obj <> endobj 6462 0 obj <> endobj 1484 0 obj <> endobj 6463 0 obj <> endobj 1495 0 obj <> endobj 6464 0 obj <> endobj 1496 0 obj <> endobj 6465 0 obj <> endobj 1497 0 obj <> endobj 6466 0 obj <> endobj 1498 0 obj <> endobj 6467 0 obj <> endobj 1499 0 obj <> endobj 6468 0 obj <> endobj 1500 0 obj <> endobj 6469 0 obj <> endobj 1501 0 obj <> endobj 6470 0 obj <> endobj 1502 0 obj <> endobj 6471 0 obj <> endobj 1503 0 obj <> endobj 6472 0 obj <> endobj 1504 0 obj <> endobj 6473 0 obj <> endobj 1508 0 obj <> endobj 6474 0 obj <> endobj 1507 0 obj <> endobj 6475 0 obj <> endobj 1510 0 obj <> endobj 6476 0 obj <> endobj 1509 0 obj <> endobj 6477 0 obj <> endobj 1506 0 obj <> endobj 6478 0 obj <> endobj 1505 0 obj <> endobj 6479 0 obj <> endobj 1511 0 obj <> endobj 6480 0 obj <> endobj 1512 0 obj <> endobj 6481 0 obj <> endobj 1513 0 obj <> endobj 6482 0 obj <> endobj 1517 0 obj <> endobj 6483 0 obj <> endobj 1516 0 obj <> endobj 6484 0 obj <> endobj 1519 0 obj <> endobj 6485 0 obj <> endobj 1518 0 obj <> endobj 6486 0 obj <> endobj 1515 0 obj <> endobj 6487 0 obj <> endobj 1522 0 obj <> endobj 6488 0 obj <> endobj 1521 0 obj <> endobj 6489 0 obj <> endobj 1524 0 obj <> endobj 6490 0 obj <> endobj 1523 0 obj <> endobj 6491 0 obj <> endobj 1520 0 obj <> endobj 6492 0 obj <> endobj 1514 0 obj <> endobj 6493 0 obj <> endobj 1525 0 obj <> endobj 6494 0 obj <> endobj 1529 0 obj <> endobj 6495 0 obj <> endobj 1530 0 obj <> endobj 6496 0 obj <> endobj 1534 0 obj <> endobj 6497 0 obj <> endobj 1533 0 obj <> endobj 6498 0 obj <> endobj 1536 0 obj <> endobj 6499 0 obj <> endobj 1535 0 obj <> endobj 6500 0 obj <> endobj 1532 0 obj <> endobj 6501 0 obj <> endobj 1539 0 obj <> endobj 6502 0 obj <> endobj 1538 0 obj <> endobj 6503 0 obj <> endobj 1541 0 obj <> endobj 6504 0 obj <> endobj 1540 0 obj <> endobj 6505 0 obj <> endobj 1537 0 obj <> endobj 6506 0 obj <> endobj 1531 0 obj <> endobj 6507 0 obj <> endobj 1542 0 obj <> endobj 6508 0 obj <> endobj 1543 0 obj <> endobj 6509 0 obj <> endobj 1544 0 obj <> endobj 6510 0 obj <> endobj 1548 0 obj <> endobj 6511 0 obj <> endobj 1547 0 obj <> endobj 6512 0 obj <> endobj 1550 0 obj <> endobj 6513 0 obj <> endobj 1549 0 obj <> endobj 6514 0 obj <> endobj 1546 0 obj <> endobj 6515 0 obj <> endobj 1553 0 obj <> endobj 6516 0 obj <> endobj 1552 0 obj <> endobj 6517 0 obj <> endobj 1555 0 obj <> endobj 6518 0 obj <> endobj 1554 0 obj <> endobj 6519 0 obj <> endobj 1551 0 obj <> endobj 6520 0 obj <> endobj 1545 0 obj <> endobj 6521 0 obj <> endobj 1556 0 obj <> endobj 6522 0 obj <> endobj 1557 0 obj <> endobj 6523 0 obj <> endobj 1558 0 obj <> endobj 6524 0 obj <> endobj 1559 0 obj <> endobj 6525 0 obj <> endobj 1563 0 obj <> endobj 6526 0 obj <> endobj 1562 0 obj <> endobj 6527 0 obj <> endobj 1565 0 obj <> endobj 6528 0 obj <> endobj 1564 0 obj <> endobj 6529 0 obj <> endobj 1561 0 obj <> endobj 6530 0 obj <> endobj 1560 0 obj <> endobj 6531 0 obj <> endobj 1566 0 obj <> endobj 6532 0 obj <> endobj 1567 0 obj <> endobj 6533 0 obj <> endobj 1568 0 obj <> endobj 6534 0 obj <> endobj 1569 0 obj <> endobj 6535 0 obj <> endobj 1573 0 obj <> endobj 6536 0 obj <> endobj 1572 0 obj <> endobj 6537 0 obj <> endobj 1575 0 obj <> endobj 6538 0 obj <> endobj 1574 0 obj <> endobj 6539 0 obj <> endobj 1571 0 obj <> endobj 6540 0 obj <> endobj 1570 0 obj <> endobj 6541 0 obj <> endobj 1576 0 obj <> endobj 6542 0 obj <> endobj 1577 0 obj <> endobj 6543 0 obj <> endobj 1578 0 obj <> endobj 6544 0 obj <> endobj 1579 0 obj <> endobj 6545 0 obj <> endobj 1583 0 obj <> endobj 6546 0 obj <> endobj 1582 0 obj <> endobj 6547 0 obj <> endobj 1585 0 obj <> endobj 6548 0 obj <> endobj 1584 0 obj <> endobj 6549 0 obj <> endobj 1581 0 obj <> endobj 6550 0 obj <> endobj 1580 0 obj <> endobj 6551 0 obj <> endobj 1586 0 obj <> endobj 6552 0 obj <> endobj 1590 0 obj <> endobj 6553 0 obj <> endobj 1591 0 obj <> endobj 6554 0 obj <> endobj 1592 0 obj <> endobj 6555 0 obj <> endobj 1596 0 obj <> endobj 6556 0 obj <> endobj 1595 0 obj <> endobj 6557 0 obj <> endobj 1598 0 obj <> endobj 6558 0 obj <> endobj 1597 0 obj <> endobj 6559 0 obj <> endobj 1594 0 obj <> endobj 6560 0 obj <> endobj 1593 0 obj <> endobj 6561 0 obj <> endobj 1599 0 obj <> endobj 6562 0 obj <> endobj 1600 0 obj <> endobj 6563 0 obj <> endobj 1601 0 obj <> endobj 6564 0 obj <> endobj 1602 0 obj <> endobj 6565 0 obj <> endobj 1606 0 obj <> endobj 6566 0 obj <> endobj 1605 0 obj <> endobj 6567 0 obj <> endobj 1608 0 obj <> endobj 6568 0 obj <> endobj 1607 0 obj <> endobj 6569 0 obj <> endobj 1604 0 obj <> endobj 6570 0 obj <> endobj 1603 0 obj <> endobj 6571 0 obj <> endobj 1609 0 obj <> endobj 6572 0 obj <> endobj 1610 0 obj <> endobj 6573 0 obj <> endobj 1611 0 obj <> endobj 6574 0 obj <> endobj 1612 0 obj <> endobj 6575 0 obj <> endobj 1616 0 obj <> endobj 6576 0 obj <> endobj 1615 0 obj <> endobj 6577 0 obj <> endobj 1618 0 obj <> endobj 6578 0 obj <> endobj 1617 0 obj <> endobj 6579 0 obj <> endobj 1614 0 obj <> endobj 6580 0 obj <> endobj 1621 0 obj <> endobj 6581 0 obj <> endobj 1620 0 obj <> endobj 6582 0 obj <> endobj 1623 0 obj <> endobj 6583 0 obj <> endobj 1622 0 obj <> endobj 6584 0 obj <> endobj 1619 0 obj <> endobj 6585 0 obj <> endobj 1613 0 obj <> endobj 6586 0 obj <> endobj 1624 0 obj <> endobj 6587 0 obj <> endobj 1625 0 obj <> endobj 6588 0 obj <> endobj 1626 0 obj <> endobj 6589 0 obj <> endobj 1627 0 obj <> endobj 6590 0 obj <> endobj 1631 0 obj <> endobj 6591 0 obj <> endobj 1630 0 obj <> endobj 6592 0 obj <> endobj 1633 0 obj <> endobj 6593 0 obj <> endobj 1632 0 obj <> endobj 6594 0 obj <> endobj 1629 0 obj <> endobj 6595 0 obj <> endobj 1628 0 obj <> endobj 6596 0 obj <> endobj 1634 0 obj <> endobj 6597 0 obj <> endobj 1635 0 obj <> endobj 6598 0 obj <> endobj 1636 0 obj <> endobj 6599 0 obj <> endobj 1637 0 obj <> endobj 6600 0 obj <> endobj 1641 0 obj <> endobj 6601 0 obj <> endobj 1640 0 obj <> endobj 6602 0 obj <> endobj 1643 0 obj <> endobj 6603 0 obj <> endobj 1642 0 obj <> endobj 6604 0 obj <> endobj 1639 0 obj <> endobj 6605 0 obj <> endobj 1638 0 obj <> endobj 6606 0 obj <> endobj 1644 0 obj <> ] >> endobj 6607 0 obj <> endobj 1648 0 obj <> endobj 6608 0 obj <> endobj 1650 0 obj <> endobj 6609 0 obj <> endobj 1649 0 obj <> endobj 6610 0 obj <> endobj 1651 0 obj <> endobj 6611 0 obj <> endobj 1655 0 obj <> endobj 6612 0 obj <> endobj 1654 0 obj <> endobj 6613 0 obj <> endobj 1657 0 obj <> endobj 6614 0 obj <> endobj 1656 0 obj <> endobj 6615 0 obj <> endobj 1653 0 obj <> endobj 6616 0 obj <> endobj 1652 0 obj <> endobj 6617 0 obj <> endobj 1658 0 obj <> endobj 6618 0 obj <> endobj 1659 0 obj <> endobj 6619 0 obj <> endobj 1661 0 obj <> endobj 6620 0 obj <> endobj 1660 0 obj <> endobj 6621 0 obj <> endobj 1662 0 obj <> endobj 6622 0 obj <> endobj 1666 0 obj <> endobj 6623 0 obj <> endobj 1665 0 obj <> endobj 6624 0 obj <> endobj 1668 0 obj <> endobj 6625 0 obj <> endobj 1667 0 obj <> endobj 6626 0 obj <> endobj 1664 0 obj <> endobj 6627 0 obj <> endobj 1671 0 obj <> endobj 6628 0 obj <> endobj 1670 0 obj <> endobj 6629 0 obj <> endobj 1673 0 obj <> endobj 6630 0 obj <> endobj 1672 0 obj <> endobj 6631 0 obj <> endobj 1669 0 obj <> endobj 6632 0 obj <> endobj 1663 0 obj <> endobj 6633 0 obj <> endobj 1674 0 obj <> endobj 6634 0 obj <> endobj 1675 0 obj <> endobj 6635 0 obj <> endobj 1676 0 obj <> endobj 6636 0 obj <> endobj 1677 0 obj <> endobj 6637 0 obj <> endobj 1681 0 obj <> endobj 6638 0 obj <> endobj 1680 0 obj <> endobj 6639 0 obj <> endobj 1683 0 obj <> endobj 6640 0 obj <> endobj 1682 0 obj <> endobj 6641 0 obj <> endobj 1679 0 obj <> endobj 6642 0 obj <> endobj 1678 0 obj <> endobj 6643 0 obj <> endobj 1684 0 obj <> endobj 6644 0 obj <> endobj 1685 0 obj <> endobj 6645 0 obj <> endobj 1686 0 obj <> endobj 6646 0 obj <> endobj 1687 0 obj <> endobj 6647 0 obj <> endobj 1688 0 obj <> endobj 6648 0 obj <> endobj 1690 0 obj <> endobj 6649 0 obj <> endobj 1689 0 obj <> endobj 6650 0 obj <> endobj 1691 0 obj <> endobj 6651 0 obj <> endobj 1695 0 obj <> endobj 6652 0 obj <> endobj 1696 0 obj <> endobj 6653 0 obj <> endobj 1700 0 obj <> endobj 6654 0 obj <> endobj 1699 0 obj <> endobj 6655 0 obj <> endobj 1702 0 obj <> endobj 6656 0 obj <> endobj 1701 0 obj <> endobj 6657 0 obj <> endobj 1698 0 obj <> endobj 6658 0 obj <> endobj 1705 0 obj <> endobj 6659 0 obj <> endobj 1704 0 obj <> endobj 6660 0 obj <> endobj 1707 0 obj <> endobj 6661 0 obj <> endobj 1706 0 obj <> endobj 6662 0 obj <> endobj 1703 0 obj <> endobj 6663 0 obj <> endobj 1710 0 obj <> endobj 6664 0 obj <> endobj 1709 0 obj <> endobj 6665 0 obj <> endobj 1712 0 obj <> endobj 6666 0 obj <> endobj 1711 0 obj <> endobj 6667 0 obj <> endobj 1708 0 obj <> endobj 6668 0 obj <> endobj 1697 0 obj <> endobj 6669 0 obj <> endobj 1713 0 obj <> endobj 6670 0 obj <> endobj 1714 0 obj <> endobj 6671 0 obj <> endobj 1715 0 obj <> endobj 6672 0 obj <> endobj 1716 0 obj <> endobj 6673 0 obj <> endobj 1720 0 obj <> endobj 6674 0 obj <> endobj 1719 0 obj <> endobj 6675 0 obj <> endobj 1722 0 obj <> endobj 6676 0 obj <> endobj 1721 0 obj <> endobj 6677 0 obj <> endobj 1718 0 obj <> endobj 6678 0 obj <> endobj 1725 0 obj <> endobj 6679 0 obj <> endobj 1724 0 obj <> endobj 6680 0 obj <> endobj 1727 0 obj <> endobj 6681 0 obj <> endobj 1726 0 obj <> endobj 6682 0 obj <> endobj 1723 0 obj <> endobj 6683 0 obj <> endobj 1717 0 obj <> endobj 6684 0 obj <> endobj 1728 0 obj <> endobj 6685 0 obj <> endobj 1729 0 obj <> endobj 6686 0 obj <> endobj 1730 0 obj <> endobj 6687 0 obj <> endobj 1731 0 obj <> endobj 6688 0 obj <> endobj 1735 0 obj <> endobj 6689 0 obj <> endobj 1734 0 obj <> endobj 6690 0 obj <> endobj 1737 0 obj <> endobj 6691 0 obj <> endobj 1736 0 obj <> endobj 6692 0 obj <> endobj 1733 0 obj <> endobj 6693 0 obj <> endobj 1740 0 obj <> endobj 6694 0 obj <> endobj 1739 0 obj <> endobj 6695 0 obj <> endobj 1742 0 obj <> endobj 6696 0 obj <> endobj 1741 0 obj <> endobj 6697 0 obj <> endobj 1738 0 obj <> endobj 6698 0 obj <> endobj 1732 0 obj <> endobj 6699 0 obj <> endobj 1743 0 obj <> endobj 6700 0 obj <> endobj 1744 0 obj <> endobj 6701 0 obj <> endobj 1745 0 obj <> endobj 6702 0 obj <> endobj 1747 0 obj <> endobj 6703 0 obj <> endobj 1746 0 obj <> endobj 6704 0 obj <> endobj 1748 0 obj <> endobj 6705 0 obj <> endobj 1752 0 obj <> endobj 6706 0 obj <> endobj 1751 0 obj <> endobj 6707 0 obj <> endobj 1754 0 obj <> endobj 6708 0 obj <> endobj 1753 0 obj <> endobj 6709 0 obj <> endobj 1750 0 obj <> endobj 6710 0 obj <> endobj 1749 0 obj <> endobj 6711 0 obj <> endobj 1758 0 obj <> endobj 6712 0 obj <> endobj 1759 0 obj <> endobj 6713 0 obj <> endobj 1760 0 obj <> endobj 6714 0 obj <> endobj 1761 0 obj <> endobj 6715 0 obj <> endobj 1762 0 obj <> endobj 6716 0 obj <> endobj 1763 0 obj <> endobj 6717 0 obj <> endobj 1764 0 obj <> endobj 6718 0 obj <> endobj 1765 0 obj <> endobj 6719 0 obj <> endobj 1769 0 obj <> endobj 6720 0 obj <> endobj 1768 0 obj <> endobj 6721 0 obj <> endobj 1771 0 obj <> endobj 6722 0 obj <> endobj 1770 0 obj <> endobj 6723 0 obj <> endobj 1767 0 obj <> endobj 6724 0 obj <> endobj 1766 0 obj <> endobj 6725 0 obj <> endobj 1772 0 obj <> endobj 6726 0 obj <> endobj 1776 0 obj <> endobj 6727 0 obj <> endobj 1777 0 obj <> endobj 6728 0 obj <> endobj 1779 0 obj <> endobj 6729 0 obj <> endobj 1778 0 obj <> endobj 6730 0 obj <> endobj 1781 0 obj <> endobj 6731 0 obj <> endobj 1782 0 obj <> endobj 6732 0 obj <> endobj 1780 0 obj <> endobj 6733 0 obj <> endobj 1783 0 obj <> endobj 6734 0 obj <> endobj 1784 0 obj <> endobj 6735 0 obj <> endobj 1788 0 obj <> endobj 6736 0 obj <> endobj 1787 0 obj <> endobj 6737 0 obj <> endobj 1791 0 obj <> endobj 6738 0 obj <> endobj 1790 0 obj <> endobj 6739 0 obj <> endobj 1789 0 obj <> endobj 6740 0 obj <> endobj 1786 0 obj <> endobj 6741 0 obj <> endobj 1785 0 obj <> endobj 6742 0 obj <> endobj 1793 0 obj <> endobj 6743 0 obj <> endobj 1792 0 obj <> endobj 6744 0 obj <> endobj 1794 0 obj <> endobj 6745 0 obj <> endobj 1795 0 obj <> endobj 6746 0 obj <> endobj 1796 0 obj <> endobj 6747 0 obj <> endobj 1797 0 obj <> endobj 6748 0 obj <> endobj 1798 0 obj <> endobj 6749 0 obj <> endobj 1799 0 obj <> endobj 6750 0 obj <> endobj 1803 0 obj <> ] >> endobj 1802 0 obj <> endobj 1801 0 obj <> endobj 6751 0 obj <> endobj 1813 0 obj <> endobj 1812 0 obj <> endobj 1811 0 obj <> endobj 1800 0 obj <> endobj 6752 0 obj <> endobj 1807 0 obj <> endobj 6753 0 obj <> endobj 1806 0 obj <> endobj 1805 0 obj <> endobj 1804 0 obj <> endobj 6754 0 obj <> endobj 1814 0 obj <> endobj 6755 0 obj <> endobj 1815 0 obj <> endobj 6756 0 obj <> endobj 1816 0 obj <> endobj 6757 0 obj <> endobj 1817 0 obj <> endobj 6758 0 obj <> endobj 1818 0 obj <> endobj 6759 0 obj <> endobj 1819 0 obj <> endobj 6760 0 obj <> endobj 1820 0 obj <> endobj 6761 0 obj <> endobj 1824 0 obj <> endobj 6762 0 obj <> endobj 1823 0 obj <> endobj 6763 0 obj <> endobj 1826 0 obj <> endobj 6764 0 obj <> endobj 1825 0 obj <> endobj 6765 0 obj <> endobj 1822 0 obj <> endobj 6766 0 obj <> endobj 1829 0 obj <> endobj 6767 0 obj <> endobj 1828 0 obj <> endobj 6768 0 obj <> endobj 1831 0 obj <> endobj 6769 0 obj <> endobj 1830 0 obj <> endobj 6770 0 obj <> endobj 1827 0 obj <> endobj 6771 0 obj <> endobj 1834 0 obj <> endobj 6772 0 obj <> endobj 1833 0 obj <> endobj 6773 0 obj <> endobj 1837 0 obj <> endobj 6774 0 obj <> endobj 1836 0 obj <> endobj 6775 0 obj <> endobj 1835 0 obj <> endobj 6776 0 obj <> endobj 1832 0 obj <> endobj 6777 0 obj <> endobj 1821 0 obj <> endobj 6778 0 obj <> endobj 1838 0 obj <> endobj 6779 0 obj <> endobj 1839 0 obj <> endobj 6780 0 obj <> endobj 1840 0 obj <> endobj 6781 0 obj <> endobj 1841 0 obj <> endobj 6782 0 obj <> endobj 1842 0 obj <> endobj 6783 0 obj <> endobj 1846 0 obj <> endobj 6784 0 obj <> endobj 6785 0 obj <> endobj 1845 0 obj <> endobj 6786 0 obj <> endobj 1848 0 obj <> endobj 6787 0 obj <> endobj 6788 0 obj <> endobj 1847 0 obj <> endobj 6789 0 obj <> endobj 1844 0 obj <> endobj 6790 0 obj <> endobj 1854 0 obj <> endobj 6791 0 obj <> endobj 6792 0 obj <> endobj 1853 0 obj <> endobj 6793 0 obj <> endobj 1856 0 obj <> endobj 6794 0 obj <> endobj 6795 0 obj <> endobj 1855 0 obj <> endobj 6796 0 obj <> endobj 1852 0 obj <> endobj 6797 0 obj <> endobj 1843 0 obj <> endobj 6798 0 obj <> endobj 1857 0 obj <> endobj 6799 0 obj <> endobj 1858 0 obj <> endobj 6800 0 obj <> endobj 1859 0 obj <> endobj 6801 0 obj <> endobj 1860 0 obj <> endobj 6802 0 obj <> endobj 1861 0 obj <> endobj 6803 0 obj <> endobj 1862 0 obj <> endobj 6804 0 obj <> endobj 1863 0 obj <> endobj 6805 0 obj <> endobj 1867 0 obj <> endobj 6806 0 obj <> endobj 1866 0 obj <> endobj 6807 0 obj <> endobj 1869 0 obj <> endobj 6808 0 obj <> endobj 1868 0 obj <> endobj 6809 0 obj <> endobj 1865 0 obj <> endobj 6810 0 obj <> endobj 1872 0 obj <> endobj 6811 0 obj <> endobj 1871 0 obj <> endobj 6812 0 obj <> endobj 1874 0 obj <> endobj 6813 0 obj <> endobj 1873 0 obj <> endobj 6814 0 obj <> endobj 1870 0 obj <> endobj 6815 0 obj <> endobj 1877 0 obj <> endobj 6816 0 obj <> endobj 1876 0 obj <> endobj 6817 0 obj <> endobj 1879 0 obj <> endobj 6818 0 obj <> endobj 1878 0 obj <> endobj 6819 0 obj <> endobj 1875 0 obj <> endobj 6820 0 obj <> endobj 1864 0 obj <> endobj 6821 0 obj <> endobj 1880 0 obj <> endobj 6822 0 obj <> endobj 1882 0 obj <> endobj 6823 0 obj <> endobj 1881 0 obj <> endobj 6824 0 obj <> endobj 1883 0 obj <> endobj 6825 0 obj <> endobj 1884 0 obj <> endobj 6826 0 obj <> endobj 1885 0 obj <> endobj 6827 0 obj <> endobj 1889 0 obj <> endobj 6828 0 obj <> endobj 1888 0 obj <> endobj 6829 0 obj <> endobj 1891 0 obj <> endobj 6830 0 obj <> endobj 1890 0 obj <> endobj 6831 0 obj <> endobj 1887 0 obj <> endobj 6832 0 obj <> endobj 1894 0 obj <> endobj 6833 0 obj <> endobj 1893 0 obj <> endobj 6834 0 obj <> endobj 1896 0 obj <> endobj 6835 0 obj <> endobj 1895 0 obj <> endobj 6836 0 obj <> endobj 1892 0 obj <> endobj 6837 0 obj <> endobj 1886 0 obj <> endobj 6838 0 obj <> endobj 1897 0 obj <> endobj 6839 0 obj <> endobj 1898 0 obj <> endobj 6840 0 obj <> endobj 1899 0 obj <> endobj 6841 0 obj <> endobj 1903 0 obj <> endobj 6842 0 obj <> endobj 1907 0 obj <> endobj 6843 0 obj <> endobj 1906 0 obj <> endobj 6844 0 obj <> endobj 1909 0 obj <> endobj 6845 0 obj <> endobj 1908 0 obj <> endobj 6846 0 obj <> endobj 1905 0 obj <> endobj 6847 0 obj <> endobj 1912 0 obj <> endobj 6848 0 obj <> endobj 1911 0 obj <> endobj 6849 0 obj <> endobj 1914 0 obj <> endobj 6850 0 obj <> endobj 1913 0 obj <> endobj 6851 0 obj <> endobj 1910 0 obj <> endobj 6852 0 obj <> endobj 1904 0 obj <> endobj 6853 0 obj <> endobj 1915 0 obj <> endobj 6854 0 obj <> endobj 1916 0 obj <> endobj 6855 0 obj <> endobj 1917 0 obj <> endobj 6856 0 obj <> endobj 1918 0 obj <> endobj 6857 0 obj <> endobj 1922 0 obj <> endobj 6858 0 obj <> endobj 1921 0 obj <> endobj 6859 0 obj <> endobj 1924 0 obj <> endobj 6860 0 obj <> endobj 1923 0 obj <> endobj 6861 0 obj <> endobj 1920 0 obj <> endobj 6862 0 obj <> endobj 1919 0 obj <> endobj 6863 0 obj <> endobj 1925 0 obj <> endobj 6864 0 obj <> endobj 1929 0 obj <> endobj 6865 0 obj <> endobj 1930 0 obj <> endobj 6866 0 obj <> endobj 1932 0 obj <> endobj 6867 0 obj <> endobj 1931 0 obj <> endobj 6868 0 obj <> endobj 1933 0 obj <> endobj 6869 0 obj <> endobj 1934 0 obj <> endobj 6870 0 obj <> endobj 1938 0 obj <> endobj 1937 0 obj <> endobj 1936 0 obj <> endobj 6871 0 obj <> endobj 1941 0 obj <> endobj 1940 0 obj <> endobj 1939 0 obj <> endobj 6872 0 obj <> endobj 1944 0 obj <> endobj 1943 0 obj <> endobj 1942 0 obj <> endobj 6873 0 obj <> endobj 1947 0 obj <> endobj 1946 0 obj <> endobj 1945 0 obj <> endobj 6874 0 obj <> endobj 1950 0 obj <> endobj 1949 0 obj <> endobj 1948 0 obj <> endobj 1935 0 obj <> endobj 6875 0 obj <> endobj 1951 0 obj <> endobj 6876 0 obj <> endobj 1953 0 obj <> endobj 6877 0 obj <> endobj 1952 0 obj <> endobj 6878 0 obj <> endobj 1954 0 obj <> endobj 6879 0 obj <> endobj 1955 0 obj <> endobj 6880 0 obj <> endobj 1956 0 obj <> endobj 6881 0 obj <> endobj 1960 0 obj <> endobj 6882 0 obj <> endobj 1959 0 obj <> endobj 6883 0 obj <> endobj 1963 0 obj <> endobj 6884 0 obj <> endobj 1962 0 obj <> endobj 6885 0 obj <> endobj 1961 0 obj <> endobj 6886 0 obj <> endobj 1958 0 obj <> endobj 6887 0 obj <> endobj 1957 0 obj <> endobj 6888 0 obj <> endobj 1966 0 obj <> endobj 1965 0 obj <> endobj 6889 0 obj <> endobj 1969 0 obj <> endobj 6890 0 obj <> endobj 1968 0 obj <> endobj 1967 0 obj <> endobj 1964 0 obj <> endobj 6891 0 obj <> endobj 1974 0 obj <> endobj 6892 0 obj <> endobj 1973 0 obj <> endobj 6893 0 obj <> endobj 1976 0 obj <> endobj 6894 0 obj <> endobj 1975 0 obj <> endobj 6895 0 obj <> endobj 1978 0 obj <> endobj 6896 0 obj <> endobj 1977 0 obj <> endobj 6897 0 obj <> endobj 1979 0 obj <> endobj 6898 0 obj <> endobj 1981 0 obj <> endobj 6899 0 obj <> endobj 1980 0 obj <> endobj 6900 0 obj <> endobj 1982 0 obj <> endobj 6901 0 obj <> endobj 1986 0 obj <> endobj 1985 0 obj <> endobj 1984 0 obj <> endobj 6902 0 obj <> endobj 1989 0 obj <> endobj 1988 0 obj <> endobj 1987 0 obj <> endobj 6903 0 obj <> endobj 1993 0 obj <> endobj 6904 0 obj <> endobj 1992 0 obj <> endobj 1991 0 obj <> endobj 1990 0 obj <> endobj 1983 0 obj <> endobj 6905 0 obj <> endobj 1994 0 obj <> endobj 6906 0 obj <> endobj 1995 0 obj <> endobj 6907 0 obj <> endobj 1997 0 obj <> endobj 6908 0 obj <> endobj 1996 0 obj <> endobj 6909 0 obj <> endobj 1998 0 obj <> endobj 6910 0 obj <> endobj 2002 0 obj <> endobj 6911 0 obj <> endobj 6912 0 obj <> endobj 2001 0 obj <> endobj 6913 0 obj <> endobj 2004 0 obj <> endobj 6914 0 obj <> endobj 6915 0 obj <> endobj 2003 0 obj <> endobj 6916 0 obj <> endobj 2000 0 obj <> endobj 6917 0 obj <> endobj 2020 0 obj <> endobj 6918 0 obj <> endobj 6919 0 obj <> endobj 2019 0 obj <> endobj 6920 0 obj <> endobj 2022 0 obj <> endobj 6921 0 obj <> endobj 6922 0 obj <> endobj 2021 0 obj <> endobj 6923 0 obj <> endobj 2018 0 obj <> endobj 6924 0 obj <> endobj 2025 0 obj <> endobj 6925 0 obj <> endobj 6926 0 obj <> endobj 2024 0 obj <> endobj 6927 0 obj <> endobj 2027 0 obj <> endobj 6928 0 obj <> endobj 6929 0 obj <> endobj 2026 0 obj <> endobj 6930 0 obj <> endobj 2023 0 obj <> endobj 6931 0 obj <> endobj 1999 0 obj <> endobj 6932 0 obj <> endobj 2007 0 obj <> endobj 2006 0 obj <> endobj 6933 0 obj <> endobj 2009 0 obj <> endobj 2008 0 obj <> endobj 6934 0 obj <> endobj 2011 0 obj <> endobj 2010 0 obj <> endobj 6935 0 obj <> endobj 2014 0 obj <> endobj 6936 0 obj <> endobj 2013 0 obj <> endobj 2012 0 obj <> endobj 2005 0 obj <> endobj 6937 0 obj <> endobj 2029 0 obj <> endobj 6938 0 obj <> endobj 2028 0 obj <> endobj 6939 0 obj <> endobj 2031 0 obj <> endobj 6940 0 obj <> endobj 2030 0 obj <> endobj 6941 0 obj <> endobj 2032 0 obj <> endobj 6942 0 obj <> endobj 2033 0 obj <> endobj 6943 0 obj <> endobj 2034 0 obj <> endobj 6944 0 obj <> endobj 2035 0 obj <> endobj 6945 0 obj <> endobj 2036 0 obj <> endobj 6946 0 obj <> endobj 2037 0 obj <> endobj 6947 0 obj <> endobj 2038 0 obj <> endobj 6948 0 obj <> endobj 2039 0 obj <> endobj 6949 0 obj <> endobj 2040 0 obj <> endobj 6950 0 obj <> endobj 2041 0 obj <> endobj 6951 0 obj <> endobj 2042 0 obj <> endobj 6952 0 obj <> endobj 2043 0 obj <> endobj 6953 0 obj <> endobj 2044 0 obj <> endobj 6954 0 obj <> endobj 2045 0 obj <> endobj 6955 0 obj <> endobj 2048 0 obj <> endobj 2047 0 obj <> endobj 2046 0 obj <> endobj 6956 0 obj <> endobj 2052 0 obj <> endobj 6957 0 obj <> endobj 2053 0 obj <> endobj 6958 0 obj <> endobj 2054 0 obj <> endobj 6959 0 obj <> endobj 2055 0 obj <> endobj 6960 0 obj <> endobj 2056 0 obj <> endobj 6961 0 obj <> endobj 2057 0 obj <> endobj 6962 0 obj <> endobj 2058 0 obj <> endobj 6963 0 obj <> endobj 2059 0 obj <> endobj 6964 0 obj <> endobj 2060 0 obj <> endobj 6965 0 obj <> endobj 2061 0 obj <> endobj 6966 0 obj <> endobj 2062 0 obj <> endobj 6967 0 obj <> endobj 2063 0 obj <> endobj 6968 0 obj <> endobj 2064 0 obj <> endobj 6969 0 obj <> endobj 2065 0 obj <> endobj 6970 0 obj <> endobj 2066 0 obj <> endobj 6971 0 obj <> endobj 2067 0 obj <> endobj 6972 0 obj <> endobj 2068 0 obj <> endobj 6973 0 obj <> endobj 2069 0 obj <> endobj 6974 0 obj <> endobj 2070 0 obj <> endobj 6975 0 obj <> endobj 2071 0 obj <> endobj 6976 0 obj <> endobj 2072 0 obj <> endobj 6977 0 obj <> endobj 2076 0 obj <> endobj 6978 0 obj <> endobj 2077 0 obj <> endobj 6979 0 obj <> endobj 2078 0 obj <> endobj 6980 0 obj <> endobj 2079 0 obj <> endobj 6981 0 obj <> endobj 2080 0 obj <> endobj 6982 0 obj <> endobj 2081 0 obj <> endobj 6983 0 obj <> endobj 2082 0 obj <> endobj 6984 0 obj <> endobj 2083 0 obj <> endobj 6985 0 obj <> endobj 2084 0 obj <> endobj 6986 0 obj <> endobj 2085 0 obj <> endobj 6987 0 obj <> endobj 2086 0 obj <> endobj 6988 0 obj <> endobj 2087 0 obj <> endobj 6989 0 obj <> endobj 2088 0 obj <> endobj 6990 0 obj <> endobj 2089 0 obj <> endobj 6991 0 obj <> endobj 2091 0 obj <> endobj 6992 0 obj <> endobj 2090 0 obj <> endobj 6993 0 obj <> endobj 2092 0 obj <> endobj 6994 0 obj <> endobj 2093 0 obj <> endobj 6995 0 obj <> endobj 2094 0 obj <> endobj 6996 0 obj <> endobj 2095 0 obj <> endobj 6997 0 obj <> endobj 2096 0 obj <> endobj 6998 0 obj <> endobj 2101 0 obj <> endobj 6999 0 obj <> endobj 2097 0 obj <> 2101 0 R <> ] >> endobj 7000 0 obj <> endobj 2102 0 obj <> endobj 7001 0 obj <> endobj 2103 0 obj <> endobj 7002 0 obj <> endobj 2104 0 obj <> endobj 7003 0 obj <> endobj 2105 0 obj <> endobj 7004 0 obj <> endobj 2106 0 obj <> endobj 7005 0 obj <> endobj 2107 0 obj <> endobj 7006 0 obj <> endobj 2109 0 obj <> endobj 7007 0 obj <> endobj 2108 0 obj <> endobj 7008 0 obj <> endobj 2110 0 obj <> endobj 7009 0 obj <> endobj 2111 0 obj <> endobj 7010 0 obj <> endobj 2112 0 obj <> endobj 7011 0 obj <> endobj 2113 0 obj <> endobj 7012 0 obj <> endobj 2114 0 obj <> endobj 7013 0 obj <> endobj 2115 0 obj <> endobj 7014 0 obj <> endobj 2116 0 obj <> endobj 7015 0 obj <> endobj 2117 0 obj <> endobj 7016 0 obj <> endobj 2118 0 obj <> endobj 7017 0 obj <> endobj 2119 0 obj <> endobj 7018 0 obj <> endobj 2120 0 obj <> endobj 7019 0 obj <> endobj 2121 0 obj <> ] >> endobj 7020 0 obj <> endobj 2125 0 obj <> endobj 7021 0 obj <> endobj 2126 0 obj <> endobj 7022 0 obj <> endobj 2127 0 obj <> endobj 7023 0 obj <> endobj 2128 0 obj <> endobj 7024 0 obj <> endobj 2129 0 obj <> endobj 7025 0 obj <> endobj 2130 0 obj <> endobj 7026 0 obj <> endobj 2131 0 obj <> endobj 7027 0 obj <> endobj 2132 0 obj <> endobj 7028 0 obj <> endobj 2133 0 obj <> endobj 7029 0 obj <> endobj 2134 0 obj <> endobj 7030 0 obj <> endobj 2135 0 obj <> endobj 7031 0 obj <> endobj 2136 0 obj <> endobj 7032 0 obj <> endobj 2137 0 obj <> endobj 7033 0 obj <> endobj 2138 0 obj <> endobj 7034 0 obj <> endobj 2139 0 obj <> endobj 7035 0 obj <> endobj 2140 0 obj <> endobj 7036 0 obj <> endobj 2141 0 obj <> endobj 7037 0 obj <> endobj 2142 0 obj <> endobj 7038 0 obj <> endobj 2143 0 obj <> endobj 7039 0 obj <> endobj 2147 0 obj <> endobj 7040 0 obj <> endobj 2148 0 obj <> endobj 7041 0 obj <> endobj 2149 0 obj <> endobj 7042 0 obj <> endobj 2150 0 obj <> endobj 7043 0 obj <> endobj 2151 0 obj <> endobj 7044 0 obj <> endobj 2152 0 obj <> endobj 7045 0 obj <> endobj 2153 0 obj <> endobj 7046 0 obj <> endobj 2154 0 obj <> endobj 7047 0 obj <> endobj 2155 0 obj <> endobj 7048 0 obj <> endobj 2156 0 obj <> endobj 7049 0 obj <> endobj 2157 0 obj <> endobj 7050 0 obj <> endobj 2158 0 obj <> endobj 7051 0 obj <> endobj 2159 0 obj <> endobj 7052 0 obj <> endobj 2160 0 obj <> endobj 7053 0 obj <> endobj 2161 0 obj <> endobj 7054 0 obj <> endobj 2162 0 obj <> endobj 7055 0 obj <> endobj 2163 0 obj <> endobj 7056 0 obj <> endobj 2165 0 obj <> endobj 7057 0 obj <> endobj 2164 0 obj <> endobj 7058 0 obj <> endobj 2166 0 obj <> endobj 7059 0 obj <> endobj 2167 0 obj <> endobj 7060 0 obj <> endobj 2171 0 obj <> endobj 7061 0 obj <> endobj 2172 0 obj <> endobj 7062 0 obj <> endobj 2173 0 obj <> endobj 7063 0 obj <> endobj 2174 0 obj <> endobj 7064 0 obj <> endobj 2175 0 obj <> endobj 7065 0 obj <> endobj 2176 0 obj <> endobj 7066 0 obj <> endobj 2177 0 obj <> endobj 7067 0 obj <> endobj 2178 0 obj <> endobj 7068 0 obj <> endobj 2179 0 obj <> endobj 7069 0 obj <> endobj 2180 0 obj <> endobj 7070 0 obj <> endobj 2181 0 obj <> endobj 7071 0 obj <> endobj 2182 0 obj <> endobj 7072 0 obj <> endobj 2183 0 obj <> endobj 7073 0 obj <> endobj 2184 0 obj <> endobj 7074 0 obj <> endobj 2185 0 obj <> endobj 7075 0 obj <> endobj 2186 0 obj <> endobj 7076 0 obj <> endobj 2187 0 obj <> endobj 7077 0 obj <> endobj 2188 0 obj <> endobj 7078 0 obj <> endobj 2189 0 obj <> endobj 7079 0 obj <> endobj 2193 0 obj <> endobj 7080 0 obj <> endobj 2194 0 obj <> endobj 7081 0 obj <> endobj 2195 0 obj <> endobj 7082 0 obj <> endobj 2197 0 obj <> endobj 7083 0 obj <> endobj 2196 0 obj <> endobj 7084 0 obj <> endobj 2198 0 obj <> endobj 7085 0 obj <> endobj 2199 0 obj <> endobj 7086 0 obj <> endobj 2200 0 obj <> endobj 7087 0 obj <> endobj 2201 0 obj <> endobj 7088 0 obj <> endobj 2202 0 obj <> endobj 7089 0 obj <> endobj 2203 0 obj <> endobj 7090 0 obj <> endobj 2204 0 obj <> endobj 7091 0 obj <> endobj 2206 0 obj <> endobj 7092 0 obj <> endobj 2205 0 obj <> endobj 7093 0 obj <> endobj 2207 0 obj <> endobj 7094 0 obj <> endobj 2208 0 obj <> endobj 7095 0 obj <> endobj 2209 0 obj <> endobj 7096 0 obj <> endobj 2210 0 obj <> endobj 7097 0 obj <> endobj 2211 0 obj <> endobj 7098 0 obj <> endobj 2214 0 obj <> endobj 2213 0 obj <> endobj 2212 0 obj <> endobj 7099 0 obj <> endobj 2218 0 obj <> endobj 7100 0 obj <> endobj 2219 0 obj <> endobj 7101 0 obj <> endobj 2220 0 obj <> endobj 7102 0 obj <> endobj 2221 0 obj <> endobj 7103 0 obj <> endobj 2222 0 obj <> endobj 7104 0 obj <> endobj 2223 0 obj <> endobj 7105 0 obj <> endobj 2224 0 obj <> endobj 7106 0 obj <> endobj 2225 0 obj <> endobj 7107 0 obj <> endobj 2226 0 obj <> endobj 7108 0 obj <> endobj 2227 0 obj <> endobj 7109 0 obj <> endobj 2228 0 obj <> endobj 7110 0 obj <> endobj 2230 0 obj <> endobj 7111 0 obj <> endobj 2229 0 obj <> endobj 7112 0 obj <> endobj 2231 0 obj <> endobj 7113 0 obj <> endobj 2232 0 obj <> endobj 7114 0 obj <> endobj 2233 0 obj <> endobj 7115 0 obj <> endobj 2234 0 obj <> endobj 7116 0 obj <> endobj 2235 0 obj <> endobj 7117 0 obj <> endobj 2239 0 obj <> endobj 7118 0 obj <> endobj 2241 0 obj <> endobj 7119 0 obj <> endobj 2240 0 obj <> endobj 7120 0 obj <> endobj 2242 0 obj <> endobj 7121 0 obj <> endobj 2243 0 obj <> endobj 7122 0 obj <> endobj 2244 0 obj <> endobj 7123 0 obj <> endobj 2245 0 obj <> endobj 7124 0 obj <> endobj 2246 0 obj <> endobj 7125 0 obj <> endobj 2247 0 obj <> endobj 7126 0 obj <> endobj 2248 0 obj <> endobj 7127 0 obj <> endobj 2249 0 obj <> endobj 7128 0 obj <> endobj 2250 0 obj <> endobj 7129 0 obj <> endobj 2251 0 obj <> endobj 7130 0 obj <> endobj 2252 0 obj <> endobj 7131 0 obj <> endobj 2253 0 obj <> endobj 7132 0 obj <> endobj 2254 0 obj <> endobj 7133 0 obj <> endobj 2255 0 obj <> endobj 7134 0 obj <> endobj 2256 0 obj <> endobj 7135 0 obj <> endobj 2257 0 obj <> endobj 7136 0 obj <> endobj 2258 0 obj <> endobj 7137 0 obj <> endobj 2261 0 obj <> endobj 2260 0 obj <> endobj 2259 0 obj <> endobj 7138 0 obj <> endobj 2265 0 obj <> endobj 7139 0 obj <> endobj 2266 0 obj <> endobj 7140 0 obj <> endobj 2267 0 obj <> endobj 7141 0 obj <> endobj 2268 0 obj <> endobj 7142 0 obj <> endobj 2269 0 obj <> endobj 7143 0 obj <> endobj 2270 0 obj <> endobj 7144 0 obj <> endobj 2271 0 obj <> endobj 7145 0 obj <> endobj 2272 0 obj <> endobj 7146 0 obj <> endobj 2273 0 obj <> endobj 7147 0 obj <> endobj 2274 0 obj <> endobj 7148 0 obj <> endobj 2275 0 obj <> endobj 7149 0 obj <> endobj 2276 0 obj <> endobj 7150 0 obj <> endobj 2278 0 obj <> endobj 7151 0 obj <> endobj 2277 0 obj <> endobj 7152 0 obj <> endobj 2279 0 obj <> endobj 7153 0 obj <> endobj 2280 0 obj <> endobj 7154 0 obj <> endobj 2281 0 obj <> endobj 7155 0 obj <> endobj 2282 0 obj <> endobj 7156 0 obj <> endobj 2283 0 obj <> endobj 7157 0 obj <> endobj 2284 0 obj <> endobj 7158 0 obj <> endobj 2285 0 obj <> endobj 7159 0 obj <> endobj 2289 0 obj <> endobj 7160 0 obj <> endobj 2290 0 obj <> endobj 7161 0 obj <> endobj 2291 0 obj <> endobj 7162 0 obj <> endobj 2292 0 obj <> endobj 7163 0 obj <> endobj 2293 0 obj <> endobj 7164 0 obj <> endobj 2294 0 obj <> endobj 7165 0 obj <> endobj 2295 0 obj <> endobj 7166 0 obj <> endobj 2296 0 obj <> endobj 7167 0 obj <> endobj 2297 0 obj <> endobj 7168 0 obj <> endobj 2298 0 obj <> endobj 7169 0 obj <> endobj 2299 0 obj <> endobj 7170 0 obj <> endobj 2300 0 obj <> endobj 7171 0 obj <> endobj 2301 0 obj <> endobj 7172 0 obj <> endobj 2302 0 obj <> endobj 7173 0 obj <> endobj 2303 0 obj <> endobj 7174 0 obj <> endobj 2304 0 obj <> endobj 7175 0 obj <> endobj 2305 0 obj <> endobj 7176 0 obj <> endobj 2306 0 obj <> endobj 7177 0 obj <> endobj 2307 0 obj <> endobj 7178 0 obj <> endobj 2308 0 obj <> endobj 7179 0 obj <> endobj 2312 0 obj <> endobj 7180 0 obj <> endobj 2313 0 obj <> endobj 7181 0 obj <> endobj 2314 0 obj <> endobj 7182 0 obj <> endobj 2318 0 obj <> endobj 7183 0 obj <> endobj 2319 0 obj <> endobj 7184 0 obj <> endobj 2320 0 obj <> endobj 7185 0 obj <> endobj 2324 0 obj <> endobj 7186 0 obj <> endobj 2323 0 obj <> endobj 7187 0 obj <> endobj 2326 0 obj <> endobj 7188 0 obj <> endobj 2325 0 obj <> endobj 7189 0 obj <> endobj 2322 0 obj <> endobj 7190 0 obj <> endobj 2329 0 obj <> endobj 7191 0 obj <> endobj 2328 0 obj <> endobj 7192 0 obj <> endobj 2331 0 obj <> endobj 7193 0 obj <> endobj 2330 0 obj <> endobj 7194 0 obj <> endobj 2327 0 obj <> endobj 7195 0 obj <> endobj 2334 0 obj <> endobj 7196 0 obj <> endobj 2333 0 obj <> endobj 7197 0 obj <> endobj 2336 0 obj <> endobj 7198 0 obj <> endobj 2335 0 obj <> endobj 7199 0 obj <> endobj 2332 0 obj <> endobj 7200 0 obj <> endobj 2339 0 obj <> endobj 7201 0 obj <> endobj 2338 0 obj <> endobj 7202 0 obj <> endobj 2341 0 obj <> endobj 7203 0 obj <> endobj 2340 0 obj <> endobj 7204 0 obj <> endobj 2337 0 obj <> endobj 7205 0 obj <> endobj 2344 0 obj <> endobj 7206 0 obj <> endobj 2343 0 obj <> endobj 7207 0 obj <> endobj 2346 0 obj <> endobj 7208 0 obj <> endobj 2345 0 obj <> endobj 7209 0 obj <> endobj 2342 0 obj <> endobj 7210 0 obj <> endobj 2349 0 obj <> endobj 7211 0 obj <> endobj 2348 0 obj <> endobj 7212 0 obj <> endobj 2352 0 obj <> endobj 7213 0 obj <> endobj 2351 0 obj <> endobj 7214 0 obj <> endobj 2350 0 obj <> endobj 7215 0 obj <> endobj 2347 0 obj <> endobj 7216 0 obj <> endobj 2321 0 obj <> endobj 7217 0 obj <> endobj 2353 0 obj <> endobj 7218 0 obj <> endobj 2354 0 obj <> endobj 7219 0 obj <> endobj 2355 0 obj <> endobj 7220 0 obj <> endobj 2356 0 obj <> endobj 7221 0 obj <> endobj 2357 0 obj <> endobj 7222 0 obj <> endobj 2361 0 obj <> endobj 2360 0 obj <> endobj 2359 0 obj <> endobj 7223 0 obj <> endobj 2364 0 obj <> endobj 2363 0 obj <> endobj 2362 0 obj <> endobj 2358 0 obj <> endobj 7224 0 obj <> endobj 2365 0 obj <> endobj 7225 0 obj <> endobj 2366 0 obj <> endobj 7226 0 obj <> endobj 2367 0 obj <> endobj 7227 0 obj <> endobj 2368 0 obj <> endobj 7228 0 obj <> endobj 2371 0 obj <> endobj 2370 0 obj <> endobj 2369 0 obj <> endobj 7229 0 obj <> endobj 2375 0 obj <> endobj 7230 0 obj <> endobj 2379 0 obj <> endobj 7231 0 obj <> endobj 2378 0 obj <> endobj 7232 0 obj <> endobj 2381 0 obj <> endobj 7233 0 obj <> endobj 2380 0 obj <> endobj 7234 0 obj <> endobj 2377 0 obj <> endobj 7235 0 obj <> endobj 2384 0 obj <> endobj 7236 0 obj <> endobj 2383 0 obj <> endobj 7237 0 obj <> endobj 2386 0 obj <> endobj 7238 0 obj <> endobj 2385 0 obj <> endobj 7239 0 obj <> endobj 2382 0 obj <> endobj 7240 0 obj <> endobj 2389 0 obj <> endobj 7241 0 obj <> endobj 2388 0 obj <> endobj 7242 0 obj <> endobj 2391 0 obj <> endobj 7243 0 obj <> endobj 2390 0 obj <> endobj 7244 0 obj <> endobj 2387 0 obj <> endobj 7245 0 obj <> endobj 2394 0 obj <> endobj 7246 0 obj <> endobj 2393 0 obj <> endobj 7247 0 obj <> endobj 2396 0 obj <> endobj 7248 0 obj <> endobj 2395 0 obj <> endobj 7249 0 obj <> endobj 2392 0 obj <> endobj 7250 0 obj <> endobj 2376 0 obj <> endobj 7251 0 obj <> endobj 2397 0 obj <> endobj 7252 0 obj <> endobj 2398 0 obj <> endobj 7253 0 obj <> endobj 2400 0 obj <> endobj 7254 0 obj <> endobj 2399 0 obj <> endobj 7255 0 obj <> endobj 2401 0 obj <> endobj 7256 0 obj <> endobj 2402 0 obj <> endobj 7257 0 obj <> endobj 2403 0 obj <> endobj 7258 0 obj <> endobj 2407 0 obj <> endobj 7259 0 obj <> endobj 2406 0 obj <> endobj 7260 0 obj <> endobj 2409 0 obj <> endobj 7261 0 obj <> endobj 2408 0 obj <> endobj 7262 0 obj <> endobj 2405 0 obj <> endobj 7263 0 obj <> endobj 2412 0 obj <> endobj 7264 0 obj <> endobj 2411 0 obj <> endobj 7265 0 obj <> endobj 2414 0 obj <> endobj 7266 0 obj <> endobj 2413 0 obj <> endobj 7267 0 obj <> endobj 2410 0 obj <> endobj 7268 0 obj <> endobj 2417 0 obj <> endobj 7269 0 obj <> endobj 2416 0 obj <> endobj 7270 0 obj <> endobj 2419 0 obj <> endobj 7271 0 obj <> endobj 2418 0 obj <> endobj 7272 0 obj <> endobj 2415 0 obj <> endobj 7273 0 obj <> endobj 2422 0 obj <> endobj 7274 0 obj <> endobj 2421 0 obj <> endobj 7275 0 obj <> endobj 2424 0 obj <> endobj 7276 0 obj <> endobj 2423 0 obj <> endobj 7277 0 obj <> endobj 2420 0 obj <> endobj 7278 0 obj <> endobj 2404 0 obj <> endobj 7279 0 obj <> endobj 2425 0 obj <> endobj 7280 0 obj <> endobj 2426 0 obj <> endobj 7281 0 obj <> endobj 2430 0 obj <> endobj 7282 0 obj <> endobj 2431 0 obj <> endobj 7283 0 obj <> endobj 2432 0 obj <> endobj 7284 0 obj <> endobj 2433 0 obj <> endobj 7285 0 obj <> endobj 2437 0 obj <> endobj 7286 0 obj <> endobj 2438 0 obj <> endobj 7287 0 obj <> endobj 2440 0 obj <> endobj 7288 0 obj <> endobj 2439 0 obj <> endobj 7289 0 obj <> endobj 2444 0 obj <> endobj 7290 0 obj <> endobj 2443 0 obj <> endobj 7291 0 obj <> endobj 2446 0 obj <> endobj 7292 0 obj <> endobj 2447 0 obj <> endobj 7293 0 obj <> endobj 2448 0 obj <> endobj 7294 0 obj <> endobj 2445 0 obj <> endobj 7295 0 obj <> endobj 2442 0 obj <> endobj 7296 0 obj <> endobj 2441 0 obj <> endobj 7297 0 obj <> endobj 2450 0 obj <> endobj 7298 0 obj <> endobj 2449 0 obj <> endobj 7299 0 obj <> endobj 2454 0 obj <> endobj 7300 0 obj <> endobj 2453 0 obj <> endobj 7301 0 obj <> endobj 2456 0 obj <> endobj 7302 0 obj <> endobj 2455 0 obj <> endobj 7303 0 obj <> endobj 2452 0 obj <> endobj 7304 0 obj <> endobj 2451 0 obj <> endobj 7305 0 obj <> endobj 2457 0 obj <> endobj 7306 0 obj <> endobj 2461 0 obj <> endobj 7307 0 obj <> endobj 2460 0 obj <> endobj 7308 0 obj <> endobj 2463 0 obj <> endobj 7309 0 obj <> endobj 2462 0 obj <> endobj 7310 0 obj <> endobj 2459 0 obj <> endobj 7311 0 obj <> endobj 2458 0 obj <> endobj 7312 0 obj <> endobj 2464 0 obj <> endobj 7313 0 obj <> endobj 2465 0 obj <> endobj 7314 0 obj <> endobj 2469 0 obj <> endobj 7315 0 obj <> endobj 2468 0 obj <> endobj 7316 0 obj <> endobj 2471 0 obj <> endobj 7317 0 obj <> endobj 2470 0 obj <> endobj 7318 0 obj <> endobj 2467 0 obj <> endobj 7319 0 obj <> endobj 2466 0 obj <> endobj 7320 0 obj <> endobj 2475 0 obj <> endobj 7321 0 obj <> endobj 2476 0 obj <> endobj 7322 0 obj <> endobj 2480 0 obj <> endobj 7323 0 obj <> endobj 2479 0 obj <> endobj 7324 0 obj <> endobj 2483 0 obj <> endobj 7325 0 obj <> endobj 2482 0 obj <> endobj 7326 0 obj <> endobj 2487 0 obj <> endobj 2486 0 obj <> endobj 2485 0 obj <> endobj 7327 0 obj <> endobj 2490 0 obj <> endobj 2489 0 obj <> endobj 2488 0 obj <> endobj 7328 0 obj <> endobj 2493 0 obj <> endobj 2492 0 obj <> endobj 2491 0 obj <> endobj 7329 0 obj <> endobj 2497 0 obj <> endobj 7330 0 obj <> endobj 2496 0 obj <> endobj 2495 0 obj <> endobj 2494 0 obj <> endobj 2484 0 obj <> endobj 7331 0 obj <> endobj 2498 0 obj <> endobj 7332 0 obj <> endobj 2481 0 obj <> endobj 7333 0 obj <> endobj 2478 0 obj <> endobj 7334 0 obj <> endobj 2501 0 obj <> endobj 7335 0 obj <> endobj 2500 0 obj <> endobj 7336 0 obj <> endobj 2504 0 obj <> endobj 7337 0 obj <> endobj 2503 0 obj <> endobj 7338 0 obj <> endobj 2505 0 obj <> endobj 7339 0 obj <> endobj 2502 0 obj <> endobj 7340 0 obj <> endobj 2499 0 obj <> endobj 7341 0 obj <> endobj 2477 0 obj <> endobj 7342 0 obj <> endobj 2508 0 obj <> endobj 2507 0 obj <> endobj 7343 0 obj <> endobj 2510 0 obj <> endobj 2509 0 obj <> endobj 2506 0 obj <> endobj 7344 0 obj <> endobj 2514 0 obj <> endobj 7345 0 obj <> endobj 2515 0 obj <> endobj 7346 0 obj <> endobj 2519 0 obj <> endobj 7347 0 obj <> endobj 2518 0 obj <> endobj 7348 0 obj <> endobj 2521 0 obj <> endobj 7349 0 obj <> endobj 2520 0 obj <> endobj 7350 0 obj <> endobj 2517 0 obj <> endobj 7351 0 obj <> endobj 2516 0 obj <> endobj 7352 0 obj <> endobj 2522 0 obj <> endobj 7353 0 obj <> endobj 2523 0 obj <> endobj 7354 0 obj <> endobj 2527 0 obj <> endobj 7355 0 obj <> endobj 2526 0 obj <> endobj 7356 0 obj <> endobj 2529 0 obj <> endobj 7357 0 obj <> endobj 2530 0 obj <> endobj 7358 0 obj <> endobj 2528 0 obj <> endobj 7359 0 obj <> endobj 2525 0 obj <> endobj 7360 0 obj <> endobj 2533 0 obj <> endobj 7361 0 obj <> endobj 2532 0 obj <> endobj 7362 0 obj <> endobj 2535 0 obj <> endobj 7363 0 obj <> endobj 2534 0 obj <> endobj 7364 0 obj <> endobj 2531 0 obj <> endobj 7365 0 obj <> endobj 2538 0 obj <> endobj 7366 0 obj <> endobj 2537 0 obj <> endobj 7367 0 obj <> endobj 2540 0 obj <> endobj 7368 0 obj <> endobj 2539 0 obj <> endobj 7369 0 obj <> endobj 2536 0 obj <> endobj 7370 0 obj <> endobj 2524 0 obj <> endobj 7371 0 obj <> endobj 2544 0 obj <> endobj 7372 0 obj <> endobj 2545 0 obj <> endobj 7373 0 obj <> endobj 2547 0 obj <> endobj 7374 0 obj <> endobj 2546 0 obj <> endobj 7375 0 obj <> endobj 2548 0 obj <> endobj 7376 0 obj <> endobj 2550 0 obj <> endobj 7377 0 obj <> endobj 2549 0 obj <> endobj 7378 0 obj <> endobj 2551 0 obj <> endobj 7379 0 obj <> endobj 2552 0 obj <> endobj 7380 0 obj <> endobj 2553 0 obj <> endobj 7381 0 obj <> endobj 2556 0 obj <> endobj 2555 0 obj <> endobj 2554 0 obj <> endobj 7382 0 obj <> endobj 2560 0 obj <> endobj 7383 0 obj <> endobj 2564 0 obj <> endobj 7384 0 obj <> endobj 7385 0 obj <> endobj 2563 0 obj <> endobj 7386 0 obj <> endobj 2562 0 obj <> endobj 7387 0 obj <> endobj 2567 0 obj <> endobj 7388 0 obj <> endobj 2566 0 obj <> endobj 7389 0 obj <> endobj 2569 0 obj <> endobj 7390 0 obj <> endobj 2568 0 obj <> endobj 7391 0 obj <> endobj 2571 0 obj <> endobj 7392 0 obj <> endobj 2570 0 obj <> endobj 7393 0 obj <> endobj 2565 0 obj <> endobj 7394 0 obj <> endobj 2574 0 obj <> endobj 7395 0 obj <> endobj 2573 0 obj <> endobj 7396 0 obj <> endobj 2576 0 obj <> endobj 7397 0 obj <> endobj 2575 0 obj <> endobj 7398 0 obj <> endobj 2578 0 obj <> endobj 7399 0 obj <> endobj 2577 0 obj <> endobj 7400 0 obj <> endobj 2572 0 obj <> endobj 7401 0 obj <> endobj 2581 0 obj <> endobj 7402 0 obj <> endobj 2580 0 obj <> endobj 7403 0 obj <> endobj 2583 0 obj <> endobj 7404 0 obj <> endobj 2582 0 obj <> endobj 7405 0 obj <> endobj 2585 0 obj <> endobj 7406 0 obj <> endobj 2584 0 obj <> endobj 7407 0 obj <> endobj 2579 0 obj <> endobj 7408 0 obj <> endobj 2588 0 obj <> endobj 7409 0 obj <> endobj 2587 0 obj <> endobj 7410 0 obj <> endobj 2590 0 obj <> endobj 7411 0 obj <> endobj 2589 0 obj <> endobj 7412 0 obj <> endobj 2592 0 obj <> endobj 7413 0 obj <> endobj 2591 0 obj <> endobj 7414 0 obj <> endobj 2586 0 obj <> endobj 7415 0 obj <> endobj 2595 0 obj <> endobj 7416 0 obj <> endobj 2594 0 obj <> endobj 7417 0 obj <> endobj 2597 0 obj <> endobj 7418 0 obj <> endobj 2596 0 obj <> endobj 7419 0 obj <> endobj 2599 0 obj <> endobj 7420 0 obj <> endobj 2598 0 obj <> endobj 7421 0 obj <> endobj 2593 0 obj <> endobj 7422 0 obj <> endobj 2603 0 obj <> endobj 7423 0 obj <> endobj 2602 0 obj <> endobj 7424 0 obj <> endobj 2601 0 obj <> endobj 7425 0 obj <> endobj 2605 0 obj <> endobj 7426 0 obj <> endobj 2604 0 obj <> endobj 7427 0 obj <> endobj 2607 0 obj <> endobj 7428 0 obj <> endobj 2606 0 obj <> endobj 7429 0 obj <> endobj 2600 0 obj <> endobj 7430 0 obj <> endobj 2610 0 obj <> endobj 7431 0 obj <> endobj 2609 0 obj <> endobj 7432 0 obj <> endobj 2612 0 obj <> endobj 7433 0 obj <> endobj 2611 0 obj <> endobj 7434 0 obj <> endobj 2614 0 obj <> endobj 7435 0 obj <> endobj 2613 0 obj <> endobj 7436 0 obj <> endobj 2608 0 obj <> endobj 7437 0 obj <> endobj 2617 0 obj <> endobj 7438 0 obj <> endobj 2616 0 obj <> endobj 7439 0 obj <> endobj 2619 0 obj <> endobj 7440 0 obj <> endobj 2618 0 obj <> endobj 7441 0 obj <> endobj 2621 0 obj <> endobj 7442 0 obj <> endobj 2620 0 obj <> endobj 7443 0 obj <> endobj 2615 0 obj <> endobj 7444 0 obj <> endobj 2624 0 obj <> endobj 7445 0 obj <> endobj 2623 0 obj <> endobj 7446 0 obj <> endobj 2626 0 obj <> endobj 7447 0 obj <> endobj 2625 0 obj <> endobj 7448 0 obj <> endobj 2628 0 obj <> endobj 7449 0 obj <> endobj 2627 0 obj <> endobj 7450 0 obj <> endobj 2622 0 obj <> endobj 7451 0 obj <> endobj 2561 0 obj <> endobj 7452 0 obj <> endobj 2629 0 obj <> endobj 7453 0 obj <> endobj 2633 0 obj <> endobj 7454 0 obj <> endobj 7455 0 obj <> endobj 2632 0 obj <> endobj 7456 0 obj <> endobj 2631 0 obj <> endobj 7457 0 obj <> endobj 2636 0 obj <> endobj 7458 0 obj <> endobj 2635 0 obj <> endobj 7459 0 obj <> endobj 2638 0 obj <> endobj 7460 0 obj <> endobj 2637 0 obj <> endobj 7461 0 obj <> endobj 2640 0 obj <> endobj 7462 0 obj <> endobj 2639 0 obj <> endobj 7463 0 obj <> endobj 2634 0 obj <> endobj 7464 0 obj <> endobj 2643 0 obj <> endobj 7465 0 obj <> endobj 2642 0 obj <> endobj 7466 0 obj <> endobj 2645 0 obj <> endobj 7467 0 obj <> endobj 2644 0 obj <> endobj 7468 0 obj <> endobj 2647 0 obj <> endobj 7469 0 obj <> endobj 2646 0 obj <> endobj 7470 0 obj <> endobj 2641 0 obj <> endobj 7471 0 obj <> endobj 2650 0 obj <> endobj 7472 0 obj <> endobj 2649 0 obj <> endobj 7473 0 obj <> endobj 2652 0 obj <> endobj 7474 0 obj <> endobj 2651 0 obj <> endobj 7475 0 obj <> endobj 2654 0 obj <> endobj 7476 0 obj <> endobj 2653 0 obj <> endobj 7477 0 obj <> endobj 2648 0 obj <> endobj 7478 0 obj <> endobj 2657 0 obj <> endobj 7479 0 obj <> endobj 2656 0 obj <> endobj 7480 0 obj <> endobj 2659 0 obj <> endobj 7481 0 obj <> endobj 2658 0 obj <> endobj 7482 0 obj <> endobj 2661 0 obj <> endobj 7483 0 obj <> endobj 2660 0 obj <> endobj 7484 0 obj <> endobj 2655 0 obj <> endobj 7485 0 obj <> endobj 2664 0 obj <> endobj 7486 0 obj <> endobj 2663 0 obj <> endobj 7487 0 obj <> endobj 2666 0 obj <> endobj 7488 0 obj <> endobj 2665 0 obj <> endobj 7489 0 obj <> endobj 2668 0 obj <> endobj 7490 0 obj <> endobj 2667 0 obj <> endobj 7491 0 obj <> endobj 2662 0 obj <> endobj 7492 0 obj <> endobj 2671 0 obj <> endobj 7493 0 obj <> endobj 2670 0 obj <> endobj 7494 0 obj <> endobj 2673 0 obj <> endobj 7495 0 obj <> endobj 2672 0 obj <> endobj 7496 0 obj <> endobj 2675 0 obj <> endobj 7497 0 obj <> endobj 2674 0 obj <> endobj 7498 0 obj <> endobj 2669 0 obj <> endobj 7499 0 obj <> endobj 2630 0 obj <> endobj 7500 0 obj <> endobj 2682 0 obj <> endobj 7501 0 obj <> endobj 7502 0 obj <> endobj 2681 0 obj <> endobj 7503 0 obj <> endobj 2680 0 obj <> endobj 7504 0 obj <> endobj 2685 0 obj <> endobj 7505 0 obj <> endobj 2684 0 obj <> endobj 7506 0 obj <> endobj 2687 0 obj <> endobj 7507 0 obj <> endobj 2686 0 obj <> endobj 7508 0 obj <> endobj 2689 0 obj <> endobj 7509 0 obj <> endobj 2688 0 obj <> endobj 7510 0 obj <> endobj 2683 0 obj <> endobj 7511 0 obj <> endobj 2692 0 obj <> endobj 7512 0 obj <> endobj 2691 0 obj <> endobj 7513 0 obj <> endobj 2694 0 obj <> endobj 7514 0 obj <> endobj 2693 0 obj <> endobj 7515 0 obj <> endobj 2696 0 obj <> endobj 7516 0 obj <> endobj 7517 0 obj <> endobj 2695 0 obj <> endobj 7518 0 obj <> endobj 2690 0 obj <> endobj 7519 0 obj <> endobj 2699 0 obj <> endobj 7520 0 obj <> endobj 2698 0 obj <> endobj 7521 0 obj <> endobj 2701 0 obj <> endobj 7522 0 obj <> endobj 2700 0 obj <> endobj 7523 0 obj <> endobj 2697 0 obj <> endobj 7524 0 obj <> endobj 2704 0 obj <> endobj 7525 0 obj <> endobj 2703 0 obj <> endobj 7526 0 obj <> endobj 2706 0 obj <> endobj 7527 0 obj <> endobj 2705 0 obj <> endobj 7528 0 obj <> endobj 2708 0 obj <> endobj 7529 0 obj <> endobj 2707 0 obj <> endobj 7530 0 obj <> endobj 2702 0 obj <> endobj 7531 0 obj <> endobj 2711 0 obj <> endobj 7532 0 obj <> endobj 2710 0 obj <> endobj 7533 0 obj <> endobj 2713 0 obj <> endobj 7534 0 obj <> endobj 2712 0 obj <> endobj 7535 0 obj <> endobj 2715 0 obj <> endobj 7536 0 obj <> endobj 2714 0 obj <> endobj 7537 0 obj <> endobj 2709 0 obj <> endobj 7538 0 obj <> endobj 2718 0 obj <> endobj 7539 0 obj <> endobj 2717 0 obj <> endobj 7540 0 obj <> endobj 2720 0 obj <> endobj 7541 0 obj <> endobj 2719 0 obj <> endobj 7542 0 obj <> endobj 2722 0 obj <> endobj 7543 0 obj <> endobj 2721 0 obj <> endobj 7544 0 obj <> endobj 2716 0 obj <> endobj 7545 0 obj <> endobj 2725 0 obj <> endobj 7546 0 obj <> endobj 2724 0 obj <> endobj 7547 0 obj <> endobj 2727 0 obj <> endobj 7548 0 obj <> endobj 2726 0 obj <> endobj 7549 0 obj <> endobj 2729 0 obj <> endobj 7550 0 obj <> endobj 2728 0 obj <> endobj 7551 0 obj <> endobj 2723 0 obj <> endobj 7552 0 obj <> endobj 2732 0 obj <> endobj 7553 0 obj <> endobj 2731 0 obj <> endobj 7554 0 obj <> endobj 2734 0 obj <> endobj 7555 0 obj <> endobj 2733 0 obj <> endobj 7556 0 obj <> endobj 2736 0 obj <> endobj 7557 0 obj <> endobj 2735 0 obj <> endobj 7558 0 obj <> endobj 2730 0 obj <> endobj 7559 0 obj <> endobj 2739 0 obj <> endobj 7560 0 obj <> endobj 2738 0 obj <> endobj 7561 0 obj <> endobj 2741 0 obj <> endobj 7562 0 obj <> endobj 2740 0 obj <> endobj 7563 0 obj <> endobj 2743 0 obj <> endobj 7564 0 obj <> endobj 2742 0 obj <> endobj 7565 0 obj <> endobj 2737 0 obj <> endobj 7566 0 obj <> endobj 2746 0 obj <> endobj 7567 0 obj <> endobj 2745 0 obj <> endobj 7568 0 obj <> endobj 2748 0 obj <> endobj 7569 0 obj <> endobj 2747 0 obj <> endobj 7570 0 obj <> endobj 2750 0 obj <> endobj 7571 0 obj <> endobj 2749 0 obj <> endobj 7572 0 obj <> endobj 2744 0 obj <> endobj 7573 0 obj <> endobj 2753 0 obj <> endobj 7574 0 obj <> endobj 2752 0 obj <> endobj 7575 0 obj <> endobj 2755 0 obj <> endobj 7576 0 obj <> endobj 2754 0 obj <> endobj 7577 0 obj <> endobj 2757 0 obj <> endobj 7578 0 obj <> endobj 2756 0 obj <> endobj 7579 0 obj <> endobj 2751 0 obj <> endobj 7580 0 obj <> endobj 2760 0 obj <> endobj 7581 0 obj <> endobj 2759 0 obj <> endobj 7582 0 obj <> endobj 2762 0 obj <> endobj 7583 0 obj <> endobj 2761 0 obj <> endobj 7584 0 obj <> endobj 2764 0 obj <> endobj 7585 0 obj <> endobj 2763 0 obj <> endobj 7586 0 obj <> endobj 2758 0 obj <> endobj 7587 0 obj <> endobj 2767 0 obj <> endobj 7588 0 obj <> endobj 2766 0 obj <> endobj 7589 0 obj <> endobj 2769 0 obj <> endobj 7590 0 obj <> endobj 2768 0 obj <> endobj 7591 0 obj <> endobj 2771 0 obj <> endobj 7592 0 obj <> endobj 2770 0 obj <> endobj 7593 0 obj <> endobj 2765 0 obj <> endobj 7594 0 obj <> endobj 2679 0 obj <> endobj 7595 0 obj <> endobj 2775 0 obj <> endobj 7596 0 obj <> endobj 2779 0 obj <> endobj 7597 0 obj <> endobj 7598 0 obj <> endobj 2778 0 obj <> endobj 7599 0 obj <> endobj 2777 0 obj <> endobj 7600 0 obj <> endobj 2782 0 obj <> endobj 7601 0 obj <> endobj 2781 0 obj <> endobj 7602 0 obj <> endobj 2784 0 obj <> endobj 7603 0 obj <> endobj 2783 0 obj <> endobj 7604 0 obj <> endobj 2786 0 obj <> endobj 7605 0 obj <> endobj 2785 0 obj <> endobj 7606 0 obj <> endobj 2780 0 obj <> endobj 7607 0 obj <> endobj 2789 0 obj <> endobj 7608 0 obj <> endobj 2788 0 obj <> endobj 7609 0 obj <> endobj 2791 0 obj <> endobj 7610 0 obj <> endobj 2790 0 obj <> endobj 7611 0 obj <> endobj 2793 0 obj <> endobj 7612 0 obj <> endobj 2792 0 obj <> endobj 7613 0 obj <> endobj 2787 0 obj <> endobj 7614 0 obj <> endobj 2796 0 obj <> endobj 7615 0 obj <> endobj 2795 0 obj <> endobj 7616 0 obj <> endobj 2798 0 obj <> endobj 7617 0 obj <> endobj 2797 0 obj <> endobj 7618 0 obj <> endobj 2800 0 obj <> endobj 7619 0 obj <> endobj 2799 0 obj <> endobj 7620 0 obj <> endobj 2794 0 obj <> endobj 7621 0 obj <> endobj 2803 0 obj <> endobj 7622 0 obj <> endobj 2802 0 obj <> endobj 7623 0 obj <> endobj 2805 0 obj <> endobj 7624 0 obj <> endobj 2804 0 obj <> endobj 7625 0 obj <> endobj 2807 0 obj <> endobj 7626 0 obj <> endobj 2806 0 obj <> endobj 7627 0 obj <> endobj 2801 0 obj <> endobj 7628 0 obj <> endobj 2810 0 obj <> endobj 7629 0 obj <> endobj 2809 0 obj <> endobj 7630 0 obj <> endobj 2812 0 obj <> endobj 7631 0 obj <> endobj 2811 0 obj <> endobj 7632 0 obj <> endobj 2814 0 obj <> endobj 7633 0 obj <> endobj 2813 0 obj <> endobj 7634 0 obj <> endobj 2808 0 obj <> endobj 7635 0 obj <> endobj 2818 0 obj <> endobj 7636 0 obj <> endobj 2817 0 obj <> endobj 7637 0 obj <> endobj 2816 0 obj <> endobj 7638 0 obj <> endobj 2820 0 obj <> endobj 7639 0 obj <> endobj 2819 0 obj <> endobj 7640 0 obj <> endobj 2822 0 obj <> endobj 7641 0 obj <> endobj 2821 0 obj <> endobj 7642 0 obj <> endobj 2815 0 obj <> endobj 7643 0 obj <> endobj 2825 0 obj <> endobj 7644 0 obj <> endobj 2824 0 obj <> endobj 7645 0 obj <> endobj 2827 0 obj <> endobj 7646 0 obj <> endobj 2826 0 obj <> endobj 7647 0 obj <> endobj 2829 0 obj <> endobj 7648 0 obj <> endobj 2828 0 obj <> endobj 7649 0 obj <> endobj 2823 0 obj <> endobj 7650 0 obj <> endobj 2832 0 obj <> endobj 7651 0 obj <> endobj 2831 0 obj <> endobj 7652 0 obj <> endobj 2834 0 obj <> endobj 7653 0 obj <> endobj 2833 0 obj <> endobj 7654 0 obj <> endobj 2836 0 obj <> endobj 7655 0 obj <> endobj 2835 0 obj <> endobj 7656 0 obj <> endobj 2830 0 obj <> endobj 7657 0 obj <> endobj 2839 0 obj <> endobj 7658 0 obj <> endobj 2838 0 obj <> endobj 7659 0 obj <> endobj 2841 0 obj <> endobj 7660 0 obj <> endobj 2840 0 obj <> endobj 7661 0 obj <> endobj 2843 0 obj <> endobj 7662 0 obj <> endobj 2842 0 obj <> endobj 7663 0 obj <> endobj 2837 0 obj <> endobj 7664 0 obj <> endobj 2776 0 obj <> endobj 7665 0 obj <> endobj 2844 0 obj <> endobj 7666 0 obj <> endobj 2848 0 obj <> endobj 7667 0 obj <> endobj 7668 0 obj <> endobj 2847 0 obj <> endobj 7669 0 obj <> endobj 2846 0 obj <> endobj 7670 0 obj <> endobj 2851 0 obj <> endobj 7671 0 obj <> endobj 2850 0 obj <> endobj 7672 0 obj <> endobj 2853 0 obj <> endobj 7673 0 obj <> endobj 2852 0 obj <> endobj 7674 0 obj <> endobj 2855 0 obj <> endobj 7675 0 obj <> endobj 2854 0 obj <> endobj 7676 0 obj <> endobj 2849 0 obj <> endobj 7677 0 obj <> endobj 2858 0 obj <> endobj 7678 0 obj <> endobj 2857 0 obj <> endobj 7679 0 obj <> endobj 2860 0 obj <> endobj 7680 0 obj <> endobj 2859 0 obj <> endobj 7681 0 obj <> endobj 2862 0 obj <> endobj 7682 0 obj <> endobj 2861 0 obj <> endobj 7683 0 obj <> endobj 2856 0 obj <> endobj 7684 0 obj <> endobj 2865 0 obj <> endobj 7685 0 obj <> endobj 2864 0 obj <> endobj 7686 0 obj <> endobj 2867 0 obj <> endobj 7687 0 obj <> endobj 2866 0 obj <> endobj 7688 0 obj <> endobj 2869 0 obj <> endobj 7689 0 obj <> endobj 2868 0 obj <> endobj 7690 0 obj <> endobj 2863 0 obj <> endobj 7691 0 obj <> endobj 2872 0 obj <> endobj 7692 0 obj <> endobj 2871 0 obj <> endobj 7693 0 obj <> endobj 2874 0 obj <> endobj 7694 0 obj <> endobj 2873 0 obj <> endobj 7695 0 obj <> endobj 2876 0 obj <> endobj 7696 0 obj <> endobj 2875 0 obj <> endobj 7697 0 obj <> endobj 2870 0 obj <> endobj 7698 0 obj <> endobj 2879 0 obj <> endobj 7699 0 obj <> endobj 2878 0 obj <> endobj 7700 0 obj <> endobj 2881 0 obj <> endobj 7701 0 obj <> endobj 2880 0 obj <> endobj 7702 0 obj <> endobj 2883 0 obj <> endobj 7703 0 obj <> endobj 2882 0 obj <> endobj 7704 0 obj <> endobj 2877 0 obj <> endobj 7705 0 obj <> endobj 2886 0 obj <> endobj 7706 0 obj <> endobj 2885 0 obj <> endobj 7707 0 obj <> endobj 2888 0 obj <> endobj 7708 0 obj <> endobj 2887 0 obj <> endobj 7709 0 obj <> endobj 2890 0 obj <> endobj 7710 0 obj <> endobj 2889 0 obj <> endobj 7711 0 obj <> endobj 2884 0 obj <> endobj 7712 0 obj <> endobj 2845 0 obj <> endobj 7713 0 obj <> endobj 2897 0 obj <> endobj 7714 0 obj <> endobj 7715 0 obj <> endobj 2896 0 obj <> endobj 7716 0 obj <> endobj 2895 0 obj <> endobj 7717 0 obj <> endobj 2900 0 obj <> endobj 7718 0 obj <> endobj 2899 0 obj <> endobj 7719 0 obj <> endobj 2902 0 obj <> endobj 7720 0 obj <> endobj 2901 0 obj <> endobj 7721 0 obj <> endobj 2904 0 obj <> endobj 7722 0 obj <> endobj 2903 0 obj <> endobj 7723 0 obj <> endobj 2898 0 obj <> endobj 7724 0 obj <> endobj 2907 0 obj <> endobj 7725 0 obj <> endobj 2906 0 obj <> endobj 7726 0 obj <> endobj 2909 0 obj <> endobj 7727 0 obj <> endobj 2908 0 obj <> endobj 7728 0 obj <> endobj 2911 0 obj <> endobj 7729 0 obj <> endobj 7730 0 obj <> endobj 2910 0 obj <> endobj 7731 0 obj <> endobj 2905 0 obj <> endobj 7732 0 obj <> endobj 2914 0 obj <> endobj 7733 0 obj <> endobj 2913 0 obj <> endobj 7734 0 obj <> endobj 2916 0 obj <> endobj 7735 0 obj <> endobj 2915 0 obj <> endobj 7736 0 obj <> endobj 2912 0 obj <> endobj 7737 0 obj <> endobj 2919 0 obj <> endobj 7738 0 obj <> endobj 2918 0 obj <> endobj 7739 0 obj <> endobj 2921 0 obj <> endobj 7740 0 obj <> endobj 2920 0 obj <> endobj 7741 0 obj <> endobj 2923 0 obj <> endobj 7742 0 obj <> endobj 2922 0 obj <> endobj 7743 0 obj <> endobj 2917 0 obj <> endobj 7744 0 obj <> endobj 2926 0 obj <> endobj 7745 0 obj <> endobj 2925 0 obj <> endobj 7746 0 obj <> endobj 2928 0 obj <> endobj 7747 0 obj <> endobj 2927 0 obj <> endobj 7748 0 obj <> endobj 2930 0 obj <> endobj 7749 0 obj <> endobj 2929 0 obj <> endobj 7750 0 obj <> endobj 2924 0 obj <> endobj 7751 0 obj <> endobj 2933 0 obj <> endobj 7752 0 obj <> endobj 2932 0 obj <> endobj 7753 0 obj <> endobj 2935 0 obj <> endobj 7754 0 obj <> endobj 2934 0 obj <> endobj 7755 0 obj <> endobj 2937 0 obj <> endobj 7756 0 obj <> endobj 2936 0 obj <> endobj 7757 0 obj <> endobj 2931 0 obj <> endobj 7758 0 obj <> endobj 2940 0 obj <> endobj 7759 0 obj <> endobj 2939 0 obj <> endobj 7760 0 obj <> endobj 2942 0 obj <> endobj 7761 0 obj <> endobj 2941 0 obj <> endobj 7762 0 obj <> endobj 2944 0 obj <> endobj 7763 0 obj <> endobj 2943 0 obj <> endobj 7764 0 obj <> endobj 2938 0 obj <> endobj 7765 0 obj <> endobj 2947 0 obj <> endobj 7766 0 obj <> endobj 2946 0 obj <> endobj 7767 0 obj <> endobj 2949 0 obj <> endobj 7768 0 obj <> endobj 2948 0 obj <> endobj 7769 0 obj <> endobj 2951 0 obj <> endobj 7770 0 obj <> endobj 2950 0 obj <> endobj 7771 0 obj <> endobj 2945 0 obj <> endobj 7772 0 obj <> endobj 2954 0 obj <> endobj 7773 0 obj <> endobj 2953 0 obj <> endobj 7774 0 obj <> endobj 2956 0 obj <> endobj 7775 0 obj <> endobj 2955 0 obj <> endobj 7776 0 obj <> endobj 2958 0 obj <> endobj 7777 0 obj <> endobj 2957 0 obj <> endobj 7778 0 obj <> endobj 2952 0 obj <> endobj 7779 0 obj <> endobj 2961 0 obj <> endobj 7780 0 obj <> endobj 2960 0 obj <> endobj 7781 0 obj <> endobj 2963 0 obj <> endobj 7782 0 obj <> endobj 2962 0 obj <> endobj 7783 0 obj <> endobj 2965 0 obj <> endobj 7784 0 obj <> endobj 2964 0 obj <> endobj 7785 0 obj <> endobj 2959 0 obj <> endobj 7786 0 obj <> endobj 2968 0 obj <> endobj 7787 0 obj <> endobj 2967 0 obj <> endobj 7788 0 obj <> endobj 2970 0 obj <> endobj 7789 0 obj <> endobj 2969 0 obj <> endobj 7790 0 obj <> endobj 2972 0 obj <> endobj 7791 0 obj <> endobj 2971 0 obj <> endobj 7792 0 obj <> endobj 2966 0 obj <> endobj 7793 0 obj <> endobj 2975 0 obj <> endobj 7794 0 obj <> endobj 2974 0 obj <> endobj 7795 0 obj <> endobj 2977 0 obj <> endobj 7796 0 obj <> endobj 2976 0 obj <> endobj 7797 0 obj <> endobj 2979 0 obj <> endobj 7798 0 obj <> endobj 2978 0 obj <> endobj 7799 0 obj <> endobj 2973 0 obj <> endobj 7800 0 obj <> endobj 2982 0 obj <> endobj 7801 0 obj <> endobj 2981 0 obj <> endobj 7802 0 obj <> endobj 2984 0 obj <> endobj 7803 0 obj <> endobj 2983 0 obj <> endobj 7804 0 obj <> endobj 2986 0 obj <> endobj 7805 0 obj <> endobj 2985 0 obj <> endobj 7806 0 obj <> endobj 2980 0 obj <> endobj 7807 0 obj <> endobj 2894 0 obj <> endobj 7808 0 obj <> endobj 2987 0 obj <> endobj 7809 0 obj <> endobj 2988 0 obj <> endobj 7810 0 obj <> endobj 2992 0 obj <> endobj 2991 0 obj <> endobj 2990 0 obj <> endobj 7811 0 obj <> endobj 2995 0 obj <> endobj 2994 0 obj <> endobj 2993 0 obj <> endobj 7812 0 obj <> endobj 2998 0 obj <> endobj 2997 0 obj <> endobj 2996 0 obj <> endobj 7813 0 obj <> endobj 3001 0 obj <> endobj 3000 0 obj <> endobj 2999 0 obj <> endobj 7814 0 obj <> endobj 3004 0 obj <> ] >> endobj 3003 0 obj <> endobj 3002 0 obj <> endobj 7815 0 obj <> endobj 3010 0 obj <> endobj 3009 0 obj <> endobj 3008 0 obj <> endobj 2989 0 obj <> endobj 7816 0 obj <> endobj 3014 0 obj <> endobj 7817 0 obj <> endobj 3015 0 obj <> endobj 7818 0 obj <> endobj 3016 0 obj <> endobj 7819 0 obj <> endobj 3020 0 obj <> endobj 3019 0 obj <> endobj 3018 0 obj <> endobj 7820 0 obj <> endobj 3023 0 obj <> endobj 3022 0 obj <> endobj 3021 0 obj <> endobj 7821 0 obj <> endobj 3026 0 obj <> endobj 3025 0 obj <> endobj 3024 0 obj <> endobj 7822 0 obj <> endobj 3029 0 obj <> endobj 3028 0 obj <> endobj 3027 0 obj <> endobj 7823 0 obj <> endobj 3032 0 obj <> endobj 3031 0 obj <> endobj 3030 0 obj <> endobj 3017 0 obj <> endobj 7824 0 obj <> endobj 3033 0 obj <> endobj 7825 0 obj <> endobj 3037 0 obj <> endobj 3036 0 obj <> endobj 3035 0 obj <> endobj 7826 0 obj <> endobj 3040 0 obj <> endobj 3039 0 obj <> endobj 3038 0 obj <> endobj 3034 0 obj <> endobj 7827 0 obj <> endobj 3041 0 obj <> endobj 7828 0 obj <> endobj 3042 0 obj <> endobj 7829 0 obj <> endobj 3046 0 obj <> endobj 3045 0 obj <> endobj 3044 0 obj <> endobj 7830 0 obj <> endobj 3049 0 obj <> endobj 3048 0 obj <> endobj 3047 0 obj <> endobj 7831 0 obj <> endobj 3052 0 obj <> endobj 3051 0 obj <> endobj 3050 0 obj <> endobj 3043 0 obj <> endobj 7832 0 obj <> endobj 3053 0 obj <> endobj 7833 0 obj <> endobj 3057 0 obj <> ] >> endobj 3056 0 obj <> endobj 3055 0 obj <> endobj 7834 0 obj <> endobj 3064 0 obj <> endobj 7835 0 obj <> endobj 3063 0 obj <> endobj 3062 0 obj <> endobj 3061 0 obj <> endobj 7836 0 obj <> endobj 3067 0 obj <> endobj 3066 0 obj <> endobj 3065 0 obj <> endobj 7837 0 obj <> endobj 3070 0 obj <> endobj 3069 0 obj <> endobj 3068 0 obj <> endobj 3054 0 obj <> endobj 7838 0 obj <> endobj 3071 0 obj <> endobj 7839 0 obj <> endobj 3075 0 obj <> endobj 3074 0 obj <> endobj 3073 0 obj <> endobj 7840 0 obj <> endobj 3078 0 obj <> endobj 3077 0 obj <> endobj 3076 0 obj <> endobj 7841 0 obj <> endobj 3081 0 obj <> endobj 3080 0 obj <> endobj 3079 0 obj <> endobj 3072 0 obj <> endobj 7842 0 obj <> endobj 3082 0 obj <> endobj 7843 0 obj <> endobj 3083 0 obj <> endobj 7844 0 obj <> endobj 3087 0 obj <> endobj 3086 0 obj <> endobj 3085 0 obj <> endobj 7845 0 obj <> endobj 3090 0 obj <> endobj 3089 0 obj <> endobj 3088 0 obj <> endobj 7846 0 obj <> endobj 3093 0 obj <> endobj 3092 0 obj <> endobj 3091 0 obj <> endobj 3084 0 obj <> endobj 7847 0 obj <> endobj 3094 0 obj <> endobj 7848 0 obj <> endobj 3098 0 obj <> endobj 3097 0 obj <> endobj 3096 0 obj <> endobj 7849 0 obj <> endobj 3101 0 obj <> endobj 3100 0 obj <> endobj 3099 0 obj <> endobj 7850 0 obj <> endobj 3104 0 obj <> endobj 3103 0 obj <> endobj 3102 0 obj <> endobj 7851 0 obj <> endobj 3107 0 obj <> endobj 3106 0 obj <> endobj 3105 0 obj <> endobj 7852 0 obj <> endobj 3110 0 obj <> endobj 3109 0 obj <> endobj 3108 0 obj <> endobj 3095 0 obj <> endobj 7853 0 obj <> endobj 3114 0 obj <> endobj 7854 0 obj <> endobj 3118 0 obj <> endobj 3117 0 obj <> endobj 3116 0 obj <> endobj 7855 0 obj <> endobj 3121 0 obj <> endobj 3120 0 obj <> endobj 3119 0 obj <> endobj 7856 0 obj <> endobj 3124 0 obj <> endobj 3123 0 obj <> endobj 3122 0 obj <> endobj 7857 0 obj <> endobj 3127 0 obj <> endobj 3126 0 obj <> endobj 3125 0 obj <> endobj 3115 0 obj <> endobj 7858 0 obj <> endobj 3128 0 obj <> endobj 7859 0 obj <> endobj 3129 0 obj <> endobj 7860 0 obj <> endobj 3130 0 obj <> endobj 7861 0 obj <> endobj 3134 0 obj <> endobj 3133 0 obj <> endobj 3132 0 obj <> endobj 7862 0 obj <> endobj 3137 0 obj <> endobj 3136 0 obj <> endobj 3135 0 obj <> endobj 7863 0 obj <> endobj 3140 0 obj <> endobj 3139 0 obj <> endobj 3138 0 obj <> endobj 7864 0 obj <> endobj 3143 0 obj <> endobj 3142 0 obj <> endobj 3141 0 obj <> endobj 7865 0 obj <> endobj 3146 0 obj <> endobj 3145 0 obj <> endobj 3144 0 obj <> endobj 7866 0 obj <> endobj 3149 0 obj <> endobj 3148 0 obj <> endobj 3147 0 obj <> endobj 7867 0 obj <> endobj 3152 0 obj <> endobj 3151 0 obj <> endobj 3150 0 obj <> endobj 3131 0 obj <> endobj 7868 0 obj <> endobj 3153 0 obj <> endobj 7869 0 obj <> endobj 3154 0 obj <> endobj 7870 0 obj <> endobj 3158 0 obj <> endobj 3157 0 obj <> endobj 3156 0 obj <> endobj 7871 0 obj <> endobj 3161 0 obj <> endobj 3160 0 obj <> endobj 3159 0 obj <> endobj 7872 0 obj <> endobj 3164 0 obj <> endobj 7873 0 obj <> endobj 3171 0 obj <> endobj 3170 0 obj <> endobj 3169 0 obj <> endobj 7874 0 obj <> endobj 3174 0 obj <> endobj 3173 0 obj <> endobj 3172 0 obj <> endobj 3168 0 obj <> endobj 3163 0 obj <> endobj 3162 0 obj <> endobj 7875 0 obj <> endobj 3177 0 obj <> endobj 3176 0 obj <> endobj 3175 0 obj <> endobj 3155 0 obj <> endobj 7876 0 obj <> endobj 3178 0 obj <> endobj 7877 0 obj <> endobj 3179 0 obj <> endobj 7878 0 obj <> endobj 3183 0 obj <> endobj 3182 0 obj <> endobj 3181 0 obj <> endobj 7879 0 obj <> endobj 3186 0 obj <> endobj 3185 0 obj <> endobj 3184 0 obj <> endobj 7880 0 obj <> endobj 3189 0 obj <> endobj 3188 0 obj <> endobj 3187 0 obj <> endobj 3180 0 obj <> endobj 7881 0 obj <> endobj 3190 0 obj <> endobj 7882 0 obj <> endobj 3194 0 obj <> endobj 3193 0 obj <> endobj 3192 0 obj <> endobj 7883 0 obj <> endobj 3197 0 obj <> endobj 3196 0 obj <> endobj 3195 0 obj <> endobj 3191 0 obj <> endobj 7884 0 obj <> endobj 3198 0 obj <> endobj 7885 0 obj <> endobj 3202 0 obj <> endobj 3201 0 obj <> endobj 3200 0 obj <> endobj 3199 0 obj <> endobj 7886 0 obj <> endobj 3203 0 obj <> endobj 7887 0 obj <> endobj 3207 0 obj <> endobj 3206 0 obj <> endobj 3205 0 obj <> endobj 7888 0 obj <> endobj 3210 0 obj <> endobj 3209 0 obj <> endobj 3208 0 obj <> endobj 3204 0 obj <> endobj 7889 0 obj <> endobj 3211 0 obj <> endobj 7890 0 obj <> endobj 3215 0 obj <> endobj 3214 0 obj <> endobj 3213 0 obj <> endobj 7891 0 obj <> endobj 3218 0 obj <> endobj 3217 0 obj <> endobj 3216 0 obj <> endobj 7892 0 obj <> endobj 3224 0 obj <> endobj 3223 0 obj <> endobj 3222 0 obj <> endobj 3212 0 obj <> endobj 7893 0 obj <> endobj 3225 0 obj <> endobj 7894 0 obj <> endobj 3229 0 obj <> endobj 3228 0 obj <> endobj 3227 0 obj <> endobj 7895 0 obj <> endobj 3232 0 obj <> endobj 3231 0 obj <> endobj 3230 0 obj <> endobj 7896 0 obj <> endobj 3235 0 obj <> endobj 3234 0 obj <> endobj 3233 0 obj <> endobj 7897 0 obj <> endobj 3239 0 obj <> endobj 7898 0 obj <> endobj 3238 0 obj <> endobj 3237 0 obj <> endobj 3236 0 obj <> endobj 7899 0 obj <> endobj 3243 0 obj <> endobj 7900 0 obj <> endobj 3242 0 obj <> endobj 3241 0 obj <> endobj 3240 0 obj <> endobj 7901 0 obj <> endobj 3246 0 obj <> endobj 3245 0 obj <> endobj 3244 0 obj <> endobj 7902 0 obj <> endobj 3249 0 obj <> endobj 3248 0 obj <> endobj 3247 0 obj <> endobj 3226 0 obj <> endobj 7903 0 obj <> endobj 3250 0 obj <> endobj 7904 0 obj <> endobj 3254 0 obj <> endobj 3253 0 obj <> endobj 3252 0 obj <> endobj 3251 0 obj <> endobj 7905 0 obj <> endobj 3255 0 obj <> endobj 7906 0 obj <> endobj 3256 0 obj <> endobj 7907 0 obj <> endobj 3257 0 obj <> endobj 7908 0 obj <> endobj 3261 0 obj <> endobj 3260 0 obj <> endobj 3259 0 obj <> endobj 7909 0 obj <> endobj 3264 0 obj <> endobj 3263 0 obj <> endobj 3262 0 obj <> endobj 7910 0 obj <> endobj 3271 0 obj <> endobj 7911 0 obj <> endobj 3270 0 obj <> endobj 3269 0 obj <> endobj 3268 0 obj <> endobj 7912 0 obj <> endobj 3275 0 obj <> endobj 7913 0 obj <> endobj 3274 0 obj <> endobj 3273 0 obj <> endobj 3272 0 obj <> endobj 3258 0 obj <> endobj 7914 0 obj <> endobj 3276 0 obj <> endobj 7915 0 obj <> endobj 3280 0 obj <> endobj 3279 0 obj <> endobj 3278 0 obj <> endobj 3277 0 obj <> endobj 7916 0 obj <> endobj 3281 0 obj <> endobj 7917 0 obj <> endobj 3282 0 obj <> endobj 7918 0 obj <> endobj 3283 0 obj <> endobj 7919 0 obj <> endobj 3287 0 obj <> endobj 3286 0 obj <> endobj 3285 0 obj <> endobj 7920 0 obj <> endobj 3290 0 obj <> endobj 3289 0 obj <> endobj 3288 0 obj <> endobj 7921 0 obj <> endobj 3293 0 obj <> endobj 3292 0 obj <> endobj 3291 0 obj <> endobj 7922 0 obj <> endobj 3296 0 obj <> endobj 3295 0 obj <> endobj 3294 0 obj <> endobj 7923 0 obj <> endobj 3299 0 obj <> endobj 3298 0 obj <> endobj 3297 0 obj <> endobj 7924 0 obj <> endobj 3302 0 obj <> endobj 3301 0 obj <> endobj 3300 0 obj <> endobj 7925 0 obj <> endobj 3305 0 obj <> endobj 3304 0 obj <> endobj 3303 0 obj <> endobj 7926 0 obj <> endobj 3308 0 obj <> endobj 3307 0 obj <> endobj 3306 0 obj <> endobj 3284 0 obj <> endobj 7927 0 obj <> endobj 3309 0 obj <> endobj 7928 0 obj <> endobj 3310 0 obj <> endobj 7929 0 obj <> endobj 3314 0 obj <> ] >> endobj 3313 0 obj <> endobj 3312 0 obj <> endobj 7930 0 obj <> endobj 3320 0 obj <> endobj 3319 0 obj <> endobj 3318 0 obj <> endobj 7931 0 obj <> endobj 3323 0 obj <> endobj 3322 0 obj <> endobj 3321 0 obj <> endobj 7932 0 obj <> endobj 3326 0 obj <> endobj 3325 0 obj <> endobj 3324 0 obj <> endobj 7933 0 obj <> endobj 3329 0 obj <> endobj 3328 0 obj <> endobj 3327 0 obj <> endobj 7934 0 obj <> endobj 3332 0 obj <> endobj 3331 0 obj <> endobj 3330 0 obj <> endobj 3311 0 obj <> endobj 7935 0 obj <> endobj 3333 0 obj <> endobj 7936 0 obj <> endobj 3334 0 obj <> endobj 7937 0 obj <> endobj 3335 0 obj <> endobj 7938 0 obj <> endobj 3339 0 obj <> endobj 3338 0 obj <> endobj 3337 0 obj <> endobj 7939 0 obj <> endobj 3342 0 obj <> endobj 3341 0 obj <> endobj 3340 0 obj <> endobj 7940 0 obj <> endobj 3345 0 obj <> endobj 3344 0 obj <> endobj 3343 0 obj <> endobj 7941 0 obj <> endobj 3349 0 obj <> endobj 7942 0 obj <> endobj 3348 0 obj <> endobj 3347 0 obj <> endobj 3346 0 obj <> endobj 7943 0 obj <> endobj 3352 0 obj <> endobj 3351 0 obj <> endobj 3350 0 obj <> endobj 7944 0 obj <> endobj 3355 0 obj <> endobj 3354 0 obj <> endobj 3353 0 obj <> endobj 7945 0 obj <> endobj 3358 0 obj <> endobj 3357 0 obj <> endobj 3356 0 obj <> endobj 7946 0 obj <> endobj 3361 0 obj <> endobj 3360 0 obj <> endobj 3359 0 obj <> endobj 3336 0 obj <> endobj 7947 0 obj <> endobj 3362 0 obj <> endobj 7948 0 obj <> endobj 3363 0 obj <> endobj 7949 0 obj <> endobj 3367 0 obj <> ] >> endobj 3366 0 obj <> endobj 3365 0 obj <> endobj 7950 0 obj <> endobj 3373 0 obj <> endobj 3372 0 obj <> endobj 3371 0 obj <> endobj 7951 0 obj <> endobj 3376 0 obj <> endobj 3375 0 obj <> endobj 3374 0 obj <> endobj 7952 0 obj <> endobj 3379 0 obj <> endobj 3378 0 obj <> endobj 3377 0 obj <> endobj 7953 0 obj <> endobj 3383 0 obj <> endobj 7954 0 obj <> endobj 3382 0 obj <> endobj 3381 0 obj <> endobj 3380 0 obj <> endobj 7955 0 obj <> endobj 3386 0 obj <> endobj 3385 0 obj <> endobj 3384 0 obj <> endobj 7956 0 obj <> endobj 3389 0 obj <> endobj 3388 0 obj <> endobj 3387 0 obj <> endobj 3364 0 obj <> endobj 7957 0 obj <> endobj 3390 0 obj <> endobj 7958 0 obj <> endobj 3391 0 obj <> endobj 7959 0 obj <> endobj 3392 0 obj <> endobj 7960 0 obj <> endobj 3396 0 obj <> endobj 3395 0 obj <> endobj 3394 0 obj <> endobj 7961 0 obj <> endobj 3399 0 obj <> endobj 3398 0 obj <> endobj 3397 0 obj <> endobj 7962 0 obj <> endobj 3402 0 obj <> endobj 3401 0 obj <> endobj 3400 0 obj <> endobj 3393 0 obj <> endobj 7963 0 obj <> endobj 3406 0 obj <> endobj 7964 0 obj <> endobj 3408 0 obj <> endobj 3410 0 obj <> endobj 7965 0 obj <> endobj 3409 0 obj <> endobj 7966 0 obj <> endobj 3411 0 obj <> endobj 3413 0 obj <> endobj 7967 0 obj <> endobj 3412 0 obj <> endobj 3415 0 obj <> endobj 7968 0 obj <> endobj 3414 0 obj <> endobj 3417 0 obj <> endobj 7969 0 obj <> endobj 3416 0 obj <> endobj 3419 0 obj <> endobj 7970 0 obj <> endobj 3418 0 obj <> endobj 3421 0 obj <> endobj 7971 0 obj <> endobj 3420 0 obj <> endobj 3423 0 obj <> endobj 7972 0 obj <> endobj 3422 0 obj <> endobj 7973 0 obj <> endobj 3424 0 obj <> endobj 3426 0 obj <> endobj 7974 0 obj <> endobj 3425 0 obj <> endobj 3428 0 obj <> endobj 7975 0 obj <> endobj 3427 0 obj <> endobj 3430 0 obj <> endobj 7976 0 obj <> endobj 3429 0 obj <> endobj 7977 0 obj <> endobj 3431 0 obj <> endobj 3433 0 obj <> endobj 7978 0 obj <> endobj 3432 0 obj <> endobj 3435 0 obj <> endobj 7979 0 obj <> endobj 3434 0 obj <> endobj 3437 0 obj <> endobj 7980 0 obj <> endobj 3436 0 obj <> endobj 7981 0 obj <> endobj 3438 0 obj <> endobj 3440 0 obj <> endobj 7982 0 obj <> endobj 3439 0 obj <> endobj 3442 0 obj <> endobj 7983 0 obj <> endobj 3441 0 obj <> endobj 3444 0 obj <> endobj 7984 0 obj <> endobj 3443 0 obj <> endobj 3446 0 obj <> endobj 7985 0 obj <> endobj 3445 0 obj <> endobj 3448 0 obj <> endobj 7986 0 obj <> endobj 3447 0 obj <> endobj 7987 0 obj <> endobj 3449 0 obj <> endobj 3451 0 obj <> endobj 7988 0 obj <> endobj 3450 0 obj <> endobj 3453 0 obj <> endobj 7989 0 obj <> endobj 3452 0 obj <> endobj 7990 0 obj <> endobj 3454 0 obj <> endobj 3456 0 obj <> endobj 7991 0 obj <> endobj 3455 0 obj <> endobj 3458 0 obj <> endobj 7992 0 obj <> endobj 3457 0 obj <> endobj 3460 0 obj <> endobj 7993 0 obj <> endobj 3459 0 obj <> endobj 3462 0 obj <> endobj 7994 0 obj <> endobj 3461 0 obj <> endobj 7995 0 obj <> endobj 3463 0 obj <> endobj 3465 0 obj <> endobj 7996 0 obj <> endobj 3464 0 obj <> endobj 3467 0 obj <> endobj 7997 0 obj <> endobj 3466 0 obj <> endobj 7998 0 obj <> endobj 3468 0 obj <> endobj 3470 0 obj <> endobj 7999 0 obj <> endobj 3469 0 obj <> endobj 3472 0 obj <> endobj 8000 0 obj <> endobj 3471 0 obj <> endobj 8001 0 obj <> endobj 3473 0 obj <> endobj 3475 0 obj <> endobj 8002 0 obj <> endobj 3474 0 obj <> endobj 3477 0 obj <> endobj 8003 0 obj <> endobj 3476 0 obj <> endobj 3479 0 obj <> endobj 8004 0 obj <> endobj 3478 0 obj <> endobj 3481 0 obj <> endobj 8005 0 obj <> endobj 3480 0 obj <> endobj 3483 0 obj <> endobj 8006 0 obj <> endobj 3482 0 obj <> endobj 3485 0 obj <> endobj 8007 0 obj <> endobj 3484 0 obj <> endobj 8008 0 obj <> endobj 3486 0 obj <> endobj 3488 0 obj <> endobj 8009 0 obj <> endobj 3487 0 obj <> endobj 3490 0 obj <> endobj 8010 0 obj <> endobj 3489 0 obj <> endobj 3492 0 obj <> endobj 8011 0 obj <> endobj 3491 0 obj <> endobj 8012 0 obj <> endobj 3493 0 obj <> endobj 3495 0 obj <> endobj 8013 0 obj <> endobj 3494 0 obj <> endobj 3497 0 obj <> endobj 8014 0 obj <> endobj 3496 0 obj <> endobj 3499 0 obj <> endobj 8015 0 obj <> endobj 3498 0 obj <> endobj 3501 0 obj <> endobj 8016 0 obj <> endobj 3500 0 obj <> endobj 8017 0 obj <> endobj 3502 0 obj <> endobj 3504 0 obj <> endobj 8018 0 obj <> endobj 3503 0 obj <> endobj 3506 0 obj <> endobj 8019 0 obj <> endobj 3505 0 obj <> endobj 3508 0 obj <> endobj 8020 0 obj <> endobj 3507 0 obj <> endobj 3510 0 obj <> endobj 8021 0 obj <> endobj 3509 0 obj <> endobj 3512 0 obj <> endobj 8022 0 obj <> endobj 3511 0 obj <> endobj 3514 0 obj <> endobj 8023 0 obj <> endobj 3513 0 obj <> endobj 3516 0 obj <> endobj 8024 0 obj <> endobj 3515 0 obj <> endobj 3518 0 obj <> endobj 8025 0 obj <> endobj 3517 0 obj <> endobj 8026 0 obj <> endobj 3519 0 obj <> endobj 3521 0 obj <> endobj 8027 0 obj <> endobj 3520 0 obj <> endobj 3523 0 obj <> endobj 8028 0 obj <> endobj 3522 0 obj <> endobj 3525 0 obj <> endobj 8029 0 obj <> endobj 3524 0 obj <> endobj 3527 0 obj <> endobj 8030 0 obj <> endobj 3526 0 obj <> endobj 3529 0 obj <> endobj 8031 0 obj <> endobj 3528 0 obj <> endobj 3531 0 obj <> endobj 8032 0 obj <> endobj 3530 0 obj <> endobj 3533 0 obj <> endobj 8033 0 obj <> endobj 3532 0 obj <> endobj 8034 0 obj <> endobj 3534 0 obj <> endobj 3536 0 obj <> endobj 8035 0 obj <> endobj 3535 0 obj <> endobj 8036 0 obj <> endobj 3537 0 obj <> endobj 3539 0 obj <> endobj 8037 0 obj <> endobj 3538 0 obj <> endobj 3541 0 obj <> endobj 8038 0 obj <> endobj 3540 0 obj <> endobj 3543 0 obj <> endobj 8039 0 obj <> endobj 3542 0 obj <> endobj 3545 0 obj <> endobj 8040 0 obj <> endobj 3544 0 obj <> endobj 3547 0 obj <> endobj 8041 0 obj <> endobj 3546 0 obj <> endobj 3552 0 obj <> endobj 8042 0 obj <> endobj 3551 0 obj <> endobj 3554 0 obj <> endobj 8043 0 obj <> endobj 3553 0 obj <> endobj 3556 0 obj <> endobj 8044 0 obj <> endobj 3555 0 obj <> endobj 3558 0 obj <> endobj 8045 0 obj <> endobj 3557 0 obj <> endobj 3560 0 obj <> endobj 8046 0 obj <> endobj 3559 0 obj <> endobj 3562 0 obj <> endobj 8047 0 obj <> endobj 3561 0 obj <> endobj 3564 0 obj <> endobj 8048 0 obj <> endobj 3563 0 obj <> endobj 3566 0 obj <> endobj 8049 0 obj <> endobj 3565 0 obj <> endobj 3568 0 obj <> endobj 8050 0 obj <> endobj 3567 0 obj <> endobj 3570 0 obj <> endobj 8051 0 obj <> endobj 3569 0 obj <> endobj 3572 0 obj <> endobj 8052 0 obj <> endobj 3571 0 obj <> endobj 3574 0 obj <> endobj 8053 0 obj <> endobj 3573 0 obj <> endobj 3576 0 obj <> endobj 8054 0 obj <> endobj 3575 0 obj <> endobj 3578 0 obj <> endobj 8055 0 obj <> endobj 3577 0 obj <> endobj 3580 0 obj <> endobj 8056 0 obj <> endobj 3579 0 obj <> endobj 3582 0 obj <> endobj 8057 0 obj <> endobj 3581 0 obj <> endobj 3584 0 obj <> endobj 8058 0 obj <> endobj 3583 0 obj <> endobj 3586 0 obj <> endobj 8059 0 obj <> endobj 3585 0 obj <> endobj 3588 0 obj <> endobj 8060 0 obj <> endobj 3587 0 obj <> endobj 3590 0 obj <> endobj 8061 0 obj <> endobj 3589 0 obj <> endobj 3592 0 obj <> endobj 8062 0 obj <> endobj 3591 0 obj <> endobj 3594 0 obj <> endobj 8063 0 obj <> endobj 3593 0 obj <> endobj 3596 0 obj <> endobj 8064 0 obj <> endobj 3595 0 obj <> endobj 3598 0 obj <> endobj 8065 0 obj <> endobj 3597 0 obj <> endobj 3600 0 obj <> endobj 8066 0 obj <> endobj 3599 0 obj <> endobj 3602 0 obj <> endobj 8067 0 obj <> endobj 3601 0 obj <> endobj 3604 0 obj <> endobj 8068 0 obj <> endobj 3603 0 obj <> endobj 8069 0 obj <> endobj 3605 0 obj <> endobj 3607 0 obj <> endobj 8070 0 obj <> endobj 3606 0 obj <> endobj 3609 0 obj <> endobj 8071 0 obj <> endobj 3608 0 obj <> endobj 3611 0 obj <> endobj 8072 0 obj <> endobj 3610 0 obj <> endobj 3613 0 obj <> endobj 8073 0 obj <> endobj 3612 0 obj <> endobj 3615 0 obj <> endobj 8074 0 obj <> endobj 3614 0 obj <> endobj 3617 0 obj <> endobj 8075 0 obj <> endobj 3616 0 obj <> endobj 3619 0 obj <> endobj 8076 0 obj <> endobj 3618 0 obj <> endobj 3621 0 obj <> endobj 8077 0 obj <> endobj 3620 0 obj <> endobj 3623 0 obj <> endobj 8078 0 obj <> endobj 3622 0 obj <> endobj 3625 0 obj <> endobj 8079 0 obj <> endobj 3624 0 obj <> endobj 3627 0 obj <> endobj 8080 0 obj <> endobj 3626 0 obj <> endobj 3629 0 obj <> endobj 8081 0 obj <> endobj 3628 0 obj <> endobj 3631 0 obj <> endobj 8082 0 obj <> endobj 3630 0 obj <> endobj 3633 0 obj <> endobj 8083 0 obj <> endobj 3632 0 obj <> endobj 3635 0 obj <> endobj 8084 0 obj <> endobj 3634 0 obj <> endobj 3637 0 obj <> endobj 8085 0 obj <> endobj 3636 0 obj <> endobj 3639 0 obj <> endobj 8086 0 obj <> endobj 3638 0 obj <> endobj 3641 0 obj <> endobj 8087 0 obj <> endobj 3640 0 obj <> endobj 3643 0 obj <> endobj 8088 0 obj <> endobj 3642 0 obj <> endobj 3645 0 obj <> endobj 8089 0 obj <> endobj 3644 0 obj <> endobj 3647 0 obj <> endobj 8090 0 obj <> endobj 3646 0 obj <> endobj 3649 0 obj <> endobj 8091 0 obj <> endobj 3648 0 obj <> endobj 3651 0 obj <> endobj 8092 0 obj <> endobj 3650 0 obj <> endobj 3653 0 obj <> endobj 8093 0 obj <> endobj 3652 0 obj <> endobj 3655 0 obj <> endobj 8094 0 obj <> endobj 3654 0 obj <> endobj 3657 0 obj <> endobj 8095 0 obj <> endobj 3656 0 obj <> endobj 3659 0 obj <> endobj 8096 0 obj <> endobj 3658 0 obj <> endobj 3661 0 obj <> endobj 8097 0 obj <> endobj 3660 0 obj <> endobj 3663 0 obj <> endobj 8098 0 obj <> endobj 3662 0 obj <> endobj 3665 0 obj <> endobj 8099 0 obj <> endobj 3664 0 obj <> endobj 3667 0 obj <> endobj 8100 0 obj <> endobj 3666 0 obj <> endobj 3669 0 obj <> endobj 8101 0 obj <> endobj 3668 0 obj <> endobj 3671 0 obj <> endobj 8102 0 obj <> endobj 3670 0 obj <> endobj 3673 0 obj <> endobj 8103 0 obj <> endobj 3672 0 obj <> endobj 3675 0 obj <> endobj 8104 0 obj <> endobj 3674 0 obj <> endobj 3677 0 obj <> endobj 8105 0 obj <> endobj 3676 0 obj <> endobj 3679 0 obj <> endobj 8106 0 obj <> endobj 3678 0 obj <> endobj 3681 0 obj <> endobj 8107 0 obj <> endobj 3680 0 obj <> endobj 3683 0 obj <> endobj 8108 0 obj <> endobj 3682 0 obj <> endobj 3685 0 obj <> endobj 8109 0 obj <> endobj 3684 0 obj <> endobj 3687 0 obj <> endobj 8110 0 obj <> endobj 3686 0 obj <> endobj 3689 0 obj <> endobj 8111 0 obj <> endobj 3688 0 obj <> endobj 3691 0 obj <> endobj 8112 0 obj <> endobj 3690 0 obj <> endobj 3693 0 obj <> endobj 8113 0 obj <> endobj 3692 0 obj <> endobj 3695 0 obj <> endobj 8114 0 obj <> endobj 3694 0 obj <> endobj 3697 0 obj <> endobj 8115 0 obj <> endobj 3696 0 obj <> endobj 3699 0 obj <> endobj 8116 0 obj <> endobj 3698 0 obj <> endobj 3701 0 obj <> endobj 8117 0 obj <> endobj 3700 0 obj <> endobj 3703 0 obj <> endobj 8118 0 obj <> endobj 3702 0 obj <> endobj 3705 0 obj <> endobj 8119 0 obj <> endobj 3704 0 obj <> endobj 3707 0 obj <> endobj 8120 0 obj <> endobj 3706 0 obj <> endobj 3709 0 obj <> endobj 8121 0 obj <> endobj 3708 0 obj <> endobj 3711 0 obj <> endobj 8122 0 obj <> endobj 3710 0 obj <> endobj 3713 0 obj <> endobj 8123 0 obj <> endobj 3712 0 obj <> endobj 3715 0 obj <> endobj 8124 0 obj <> endobj 3714 0 obj <> endobj 3717 0 obj <> endobj 8125 0 obj <> endobj 3716 0 obj <> endobj 3719 0 obj <> endobj 8126 0 obj <> endobj 3718 0 obj <> endobj 3721 0 obj <> endobj 8127 0 obj <> endobj 3720 0 obj <> endobj 3723 0 obj <> endobj 8128 0 obj <> endobj 3722 0 obj <> endobj 3725 0 obj <> endobj 8129 0 obj <> endobj 3724 0 obj <> endobj 3727 0 obj <> endobj 8130 0 obj <> endobj 3726 0 obj <> endobj 3729 0 obj <> endobj 8131 0 obj <> endobj 3728 0 obj <> endobj 3731 0 obj <> endobj 8132 0 obj <> endobj 3730 0 obj <> endobj 3733 0 obj <> endobj 8133 0 obj <> endobj 3732 0 obj <> endobj 3735 0 obj <> endobj 8134 0 obj <> endobj 3734 0 obj <> endobj 3737 0 obj <> endobj 8135 0 obj <> endobj 3736 0 obj <> endobj 3739 0 obj <> endobj 8136 0 obj <> endobj 3738 0 obj <> endobj 3741 0 obj <> endobj 8137 0 obj <> endobj 3740 0 obj <> endobj 3743 0 obj <> endobj 8138 0 obj <> endobj 3742 0 obj <> endobj 3745 0 obj <> endobj 8139 0 obj <> endobj 3744 0 obj <> endobj 3747 0 obj <> endobj 8140 0 obj <> endobj 3746 0 obj <> endobj 3749 0 obj <> endobj 8141 0 obj <> endobj 3748 0 obj <> endobj 3751 0 obj <> endobj 8142 0 obj <> endobj 3750 0 obj <> endobj 3753 0 obj <> endobj 8143 0 obj <> endobj 3752 0 obj <> endobj 3755 0 obj <> endobj 8144 0 obj <> endobj 3754 0 obj <> endobj 3757 0 obj <> endobj 8145 0 obj <> endobj 3756 0 obj <> endobj 3759 0 obj <> endobj 8146 0 obj <> endobj 3758 0 obj <> endobj 3761 0 obj <> endobj 8147 0 obj <> endobj 3760 0 obj <> endobj 3766 0 obj <> endobj 8148 0 obj <> endobj 3765 0 obj <> endobj 3768 0 obj <> endobj 8149 0 obj <> endobj 3767 0 obj <> endobj 3770 0 obj <> endobj 8150 0 obj <> endobj 3769 0 obj <> endobj 3772 0 obj <> endobj 8151 0 obj <> endobj 3771 0 obj <> endobj 3774 0 obj <> endobj 8152 0 obj <> endobj 3773 0 obj <> endobj 3776 0 obj <> endobj 8153 0 obj <> endobj 3775 0 obj <> endobj 3778 0 obj <> endobj 8154 0 obj <> endobj 3777 0 obj <> endobj 3780 0 obj <> endobj 8155 0 obj <> endobj 3779 0 obj <> endobj 3782 0 obj <> endobj 8156 0 obj <> endobj 3781 0 obj <> endobj 3784 0 obj <> endobj 8157 0 obj <> endobj 3783 0 obj <> endobj 3786 0 obj <> endobj 8158 0 obj <> endobj 3785 0 obj <> endobj 3788 0 obj <> endobj 8159 0 obj <> endobj 3787 0 obj <> endobj 3790 0 obj <> endobj 8160 0 obj <> endobj 3789 0 obj <> endobj 3792 0 obj <> endobj 8161 0 obj <> endobj 3791 0 obj <> endobj 3794 0 obj <> endobj 8162 0 obj <> endobj 3793 0 obj <> endobj 3796 0 obj <> endobj 8163 0 obj <> endobj 3795 0 obj <> endobj 3798 0 obj <> endobj 8164 0 obj <> endobj 3797 0 obj <> endobj 3800 0 obj <> endobj 8165 0 obj <> endobj 3799 0 obj <> endobj 3802 0 obj <> endobj 8166 0 obj <> endobj 3801 0 obj <> endobj 3804 0 obj <> endobj 8167 0 obj <> endobj 3803 0 obj <> endobj 3806 0 obj <> endobj 8168 0 obj <> endobj 3805 0 obj <> endobj 3808 0 obj <> endobj 8169 0 obj <> endobj 3807 0 obj <> endobj 3810 0 obj <> endobj 8170 0 obj <> endobj 3809 0 obj <> endobj 3812 0 obj <> endobj 8171 0 obj <> endobj 3811 0 obj <> endobj 3814 0 obj <> endobj 8172 0 obj <> endobj 3813 0 obj <> endobj 3816 0 obj <> endobj 8173 0 obj <> endobj 3815 0 obj <> endobj 3818 0 obj <> endobj 8174 0 obj <> endobj 3817 0 obj <> endobj 3820 0 obj <> endobj 8175 0 obj <> endobj 3819 0 obj <> endobj 3822 0 obj <> endobj 8176 0 obj <> endobj 3821 0 obj <> endobj 3824 0 obj <> endobj 8177 0 obj <> endobj 3823 0 obj <> endobj 3826 0 obj <> endobj 8178 0 obj <> endobj 3825 0 obj <> endobj 3828 0 obj <> endobj 8179 0 obj <> endobj 3827 0 obj <> endobj 3830 0 obj <> endobj 8180 0 obj <> endobj 3829 0 obj <> endobj 3832 0 obj <> endobj 8181 0 obj <> endobj 3831 0 obj <> endobj 3834 0 obj <> endobj 8182 0 obj <> endobj 3833 0 obj <> endobj 3836 0 obj <> endobj 8183 0 obj <> endobj 3835 0 obj <> endobj 3838 0 obj <> endobj 8184 0 obj <> endobj 3837 0 obj <> endobj 3840 0 obj <> endobj 8185 0 obj <> endobj 3839 0 obj <> endobj 3842 0 obj <> endobj 8186 0 obj <> endobj 3841 0 obj <> endobj 3844 0 obj <> endobj 8187 0 obj <> endobj 3843 0 obj <> endobj 3846 0 obj <> endobj 8188 0 obj <> endobj 3845 0 obj <> endobj 3848 0 obj <> endobj 8189 0 obj <> endobj 3847 0 obj <> endobj 3850 0 obj <> endobj 8190 0 obj <> endobj 3849 0 obj <> endobj 3852 0 obj <> endobj 8191 0 obj <> endobj 3851 0 obj <> endobj 3854 0 obj <> endobj 8192 0 obj <> endobj 3853 0 obj <> endobj 3856 0 obj <> endobj 8193 0 obj <> endobj 3855 0 obj <> endobj 3858 0 obj <> endobj 8194 0 obj <> endobj 3857 0 obj <> endobj 3860 0 obj <> endobj 8195 0 obj <> endobj 3859 0 obj <> endobj 3862 0 obj <> endobj 8196 0 obj <> endobj 3861 0 obj <> endobj 3864 0 obj <> endobj 8197 0 obj <> endobj 3863 0 obj <> endobj 3866 0 obj <> endobj 8198 0 obj <> endobj 3865 0 obj <> endobj 3868 0 obj <> endobj 8199 0 obj <> endobj 3867 0 obj <> endobj 3870 0 obj <> endobj 8200 0 obj <> endobj 3869 0 obj <> endobj 3872 0 obj <> endobj 8201 0 obj <> endobj 3871 0 obj <> endobj 3874 0 obj <> endobj 8202 0 obj <> endobj 3873 0 obj <> endobj 3876 0 obj <> endobj 8203 0 obj <> endobj 3875 0 obj <> endobj 3878 0 obj <> endobj 8204 0 obj <> endobj 3877 0 obj <> endobj 3880 0 obj <> endobj 8205 0 obj <> endobj 3879 0 obj <> endobj 3882 0 obj <> endobj 8206 0 obj <> endobj 3881 0 obj <> endobj 3884 0 obj <> endobj 8207 0 obj <> endobj 3883 0 obj <> endobj 3886 0 obj <> endobj 8208 0 obj <> endobj 3885 0 obj <> endobj 3888 0 obj <> endobj 8209 0 obj <> endobj 3887 0 obj <> endobj 3890 0 obj <> endobj 8210 0 obj <> endobj 3889 0 obj <> endobj 3892 0 obj <> endobj 8211 0 obj <> endobj 3891 0 obj <> endobj 3894 0 obj <> endobj 8212 0 obj <> endobj 3893 0 obj <> endobj 3896 0 obj <> endobj 8213 0 obj <> endobj 3895 0 obj <> endobj 3898 0 obj <> endobj 8214 0 obj <> endobj 3897 0 obj <> endobj 3900 0 obj <> endobj 8215 0 obj <> endobj 3899 0 obj <> endobj 3902 0 obj <> endobj 8216 0 obj <> endobj 3901 0 obj <> endobj 3904 0 obj <> endobj 8217 0 obj <> endobj 3903 0 obj <> endobj 3906 0 obj <> endobj 8218 0 obj <> endobj 3905 0 obj <> endobj 3908 0 obj <> endobj 8219 0 obj <> endobj 3907 0 obj <> endobj 3910 0 obj <> endobj 8220 0 obj <> endobj 3909 0 obj <> endobj 3912 0 obj <> endobj 8221 0 obj <> endobj 3911 0 obj <> endobj 3914 0 obj <> endobj 8222 0 obj <> endobj 3913 0 obj <> endobj 3916 0 obj <> endobj 8223 0 obj <> endobj 3915 0 obj <> endobj 3918 0 obj <> endobj 8224 0 obj <> endobj 3917 0 obj <> endobj 3920 0 obj <> endobj 8225 0 obj <> endobj 3919 0 obj <> endobj 3922 0 obj <> endobj 8226 0 obj <> endobj 3921 0 obj <> endobj 3924 0 obj <> endobj 8227 0 obj <> endobj 3923 0 obj <> endobj 3926 0 obj <> endobj 8228 0 obj <> endobj 3925 0 obj <> endobj 3928 0 obj <> endobj 8229 0 obj <> endobj 3927 0 obj <> endobj 3930 0 obj <> endobj 8230 0 obj <> endobj 3929 0 obj <> endobj 3932 0 obj <> endobj 8231 0 obj <> endobj 3931 0 obj <> endobj 3934 0 obj <> endobj 8232 0 obj <> endobj 3933 0 obj <> endobj 3936 0 obj <> endobj 8233 0 obj <> endobj 3935 0 obj <> endobj 3938 0 obj <> endobj 8234 0 obj <> endobj 3937 0 obj <> endobj 3940 0 obj <> endobj 8235 0 obj <> endobj 3939 0 obj <> endobj 3942 0 obj <> endobj 8236 0 obj <> endobj 3941 0 obj <> endobj 3944 0 obj <> endobj 8237 0 obj <> endobj 3943 0 obj <> endobj 3946 0 obj <> endobj 8238 0 obj <> endobj 3945 0 obj <> endobj 3948 0 obj <> endobj 8239 0 obj <> endobj 3947 0 obj <> endobj 3950 0 obj <> endobj 8240 0 obj <> endobj 3949 0 obj <> endobj 3952 0 obj <> endobj 8241 0 obj <> endobj 3951 0 obj <> endobj 3954 0 obj <> endobj 8242 0 obj <> endobj 3953 0 obj <> endobj 3956 0 obj <> endobj 8243 0 obj <> endobj 3955 0 obj <> endobj 3958 0 obj <> endobj 8244 0 obj <> endobj 3957 0 obj <> endobj 3960 0 obj <> endobj 8245 0 obj <> endobj 3959 0 obj <> endobj 3962 0 obj <> endobj 8246 0 obj <> endobj 3961 0 obj <> endobj 3964 0 obj <> endobj 8247 0 obj <> endobj 3963 0 obj <> endobj 3966 0 obj <> endobj 8248 0 obj <> endobj 3965 0 obj <> endobj 3968 0 obj <> endobj 8249 0 obj <> endobj 3967 0 obj <> endobj 3970 0 obj <> endobj 8250 0 obj <> endobj 3969 0 obj <> endobj 3972 0 obj <> endobj 8251 0 obj <> endobj 3971 0 obj <> endobj 3974 0 obj <> endobj 8252 0 obj <> endobj 3973 0 obj <> endobj 3976 0 obj <> endobj 8253 0 obj <> endobj 3975 0 obj <> endobj 3978 0 obj <> endobj 8254 0 obj <> endobj 3977 0 obj <> endobj 3980 0 obj <> endobj 8255 0 obj <> endobj 3979 0 obj <> endobj 3985 0 obj <> endobj 8256 0 obj <> endobj 3984 0 obj <> endobj 3987 0 obj <> endobj 8257 0 obj <> endobj 3986 0 obj <> endobj 3989 0 obj <> endobj 8258 0 obj <> endobj 3988 0 obj <> endobj 3991 0 obj <> endobj 8259 0 obj <> endobj 3990 0 obj <> endobj 3993 0 obj <> endobj 8260 0 obj <> endobj 3992 0 obj <> endobj 3995 0 obj <> endobj 8261 0 obj <> endobj 3994 0 obj <> endobj 3997 0 obj <> endobj 8262 0 obj <> endobj 3996 0 obj <> endobj 3999 0 obj <> endobj 8263 0 obj <> endobj 3998 0 obj <> endobj 4001 0 obj <> endobj 8264 0 obj <> endobj 4000 0 obj <> endobj 4003 0 obj <> endobj 8265 0 obj <> endobj 4002 0 obj <> endobj 4005 0 obj <> endobj 8266 0 obj <> endobj 4004 0 obj <> endobj 4007 0 obj <> endobj 8267 0 obj <> endobj 4006 0 obj <> endobj 4009 0 obj <> endobj 8268 0 obj <> endobj 4008 0 obj <> endobj 4011 0 obj <> endobj 8269 0 obj <> endobj 4010 0 obj <> endobj 4013 0 obj <> endobj 8270 0 obj <> endobj 4012 0 obj <> endobj 4015 0 obj <> endobj 8271 0 obj <> endobj 4014 0 obj <> endobj 4017 0 obj <> endobj 8272 0 obj <> endobj 4016 0 obj <> endobj 4019 0 obj <> endobj 8273 0 obj <> endobj 4018 0 obj <> endobj 4021 0 obj <> endobj 8274 0 obj <> endobj 4020 0 obj <> endobj 4023 0 obj <> endobj 8275 0 obj <> endobj 4022 0 obj <> endobj 4025 0 obj <> endobj 8276 0 obj <> endobj 4024 0 obj <> endobj 4027 0 obj <> endobj 8277 0 obj <> endobj 4026 0 obj <> endobj 4029 0 obj <> endobj 8278 0 obj <> endobj 4028 0 obj <> endobj 4031 0 obj <> endobj 8279 0 obj <> endobj 4030 0 obj <> endobj 4033 0 obj <> endobj 8280 0 obj <> endobj 4032 0 obj <> endobj 4035 0 obj <> endobj 8281 0 obj <> endobj 4034 0 obj <> endobj 4037 0 obj <> endobj 8282 0 obj <> endobj 4036 0 obj <> endobj 4039 0 obj <> endobj 8283 0 obj <> endobj 4038 0 obj <> endobj 4041 0 obj <> endobj 8284 0 obj <> endobj 4040 0 obj <> endobj 4043 0 obj <> endobj 8285 0 obj <> endobj 4042 0 obj <> endobj 4045 0 obj <> endobj 8286 0 obj <> endobj 4044 0 obj <> endobj 4047 0 obj <> endobj 8287 0 obj <> endobj 4046 0 obj <> endobj 4049 0 obj <> endobj 8288 0 obj <> endobj 4048 0 obj <> endobj 4051 0 obj <> endobj 8289 0 obj <> endobj 4050 0 obj <> endobj 4053 0 obj <> endobj 8290 0 obj <> endobj 4052 0 obj <> endobj 4055 0 obj <> endobj 8291 0 obj <> endobj 4054 0 obj <> endobj 4057 0 obj <> endobj 8292 0 obj <> endobj 4056 0 obj <> endobj 4059 0 obj <> endobj 8293 0 obj <> endobj 4058 0 obj <> endobj 4061 0 obj <> endobj 8294 0 obj <> endobj 4060 0 obj <> endobj 4063 0 obj <> endobj 8295 0 obj <> endobj 4062 0 obj <> endobj 4065 0 obj <> endobj 8296 0 obj <> endobj 4064 0 obj <> endobj 4067 0 obj <> endobj 8297 0 obj <> endobj 4066 0 obj <> endobj 4069 0 obj <> endobj 8298 0 obj <> endobj 4068 0 obj <> endobj 4071 0 obj <> endobj 8299 0 obj <> endobj 4070 0 obj <> endobj 4073 0 obj <> endobj 8300 0 obj <> endobj 4072 0 obj <> endobj 4075 0 obj <> endobj 8301 0 obj <> endobj 4074 0 obj <> endobj 4077 0 obj <> endobj 8302 0 obj <> endobj 4076 0 obj <> endobj 4079 0 obj <> endobj 8303 0 obj <> endobj 4078 0 obj <> endobj 4081 0 obj <> endobj 8304 0 obj <> endobj 4080 0 obj <> endobj 4083 0 obj <> endobj 8305 0 obj <> endobj 4082 0 obj <> endobj 4085 0 obj <> endobj 8306 0 obj <> endobj 4084 0 obj <> endobj 4087 0 obj <> endobj 8307 0 obj <> endobj 4086 0 obj <> endobj 4089 0 obj <> endobj 8308 0 obj <> endobj 4088 0 obj <> endobj 4091 0 obj <> endobj 8309 0 obj <> endobj 4090 0 obj <> endobj 4093 0 obj <> endobj 8310 0 obj <> endobj 4092 0 obj <> endobj 4095 0 obj <> endobj 8311 0 obj <> endobj 4094 0 obj <> endobj 4097 0 obj <> endobj 8312 0 obj <> endobj 4096 0 obj <> endobj 4099 0 obj <> endobj 8313 0 obj <> endobj 4098 0 obj <> endobj 4101 0 obj <> endobj 8314 0 obj <> endobj 4100 0 obj <> endobj 4103 0 obj <> endobj 8315 0 obj <> endobj 4102 0 obj <> endobj 4105 0 obj <> endobj 8316 0 obj <> endobj 4104 0 obj <> endobj 4107 0 obj <> endobj 8317 0 obj <> endobj 4106 0 obj <> endobj 4109 0 obj <> endobj 8318 0 obj <> endobj 4108 0 obj <> endobj 4111 0 obj <> endobj 8319 0 obj <> endobj 4110 0 obj <> endobj 4113 0 obj <> endobj 8320 0 obj <> endobj 4112 0 obj <> endobj 8321 0 obj <> endobj 4114 0 obj <> endobj 4116 0 obj <> endobj 8322 0 obj <> endobj 4115 0 obj <> endobj 4118 0 obj <> endobj 8323 0 obj <> endobj 4117 0 obj <> endobj 4120 0 obj <> endobj 8324 0 obj <> endobj 4119 0 obj <> endobj 4122 0 obj <> endobj 8325 0 obj <> endobj 4121 0 obj <> endobj 4124 0 obj <> endobj 8326 0 obj <> endobj 4123 0 obj <> endobj 4126 0 obj <> endobj 8327 0 obj <> endobj 4125 0 obj <> endobj 4128 0 obj <> endobj 8328 0 obj <> endobj 4127 0 obj <> endobj 4130 0 obj <> endobj 8329 0 obj <> endobj 4129 0 obj <> endobj 4132 0 obj <> endobj 8330 0 obj <> endobj 4131 0 obj <> endobj 4134 0 obj <> endobj 8331 0 obj <> endobj 4133 0 obj <> endobj 4136 0 obj <> endobj 8332 0 obj <> endobj 4135 0 obj <> endobj 4138 0 obj <> endobj 8333 0 obj <> endobj 4137 0 obj <> endobj 4140 0 obj <> endobj 8334 0 obj <> endobj 4139 0 obj <> endobj 4142 0 obj <> endobj 8335 0 obj <> endobj 4141 0 obj <> endobj 4144 0 obj <> endobj 8336 0 obj <> endobj 4143 0 obj <> endobj 4146 0 obj <> endobj 8337 0 obj <> endobj 4145 0 obj <> endobj 4148 0 obj <> endobj 8338 0 obj <> endobj 4147 0 obj <> endobj 4150 0 obj <> endobj 8339 0 obj <> endobj 4149 0 obj <> endobj 4152 0 obj <> endobj 8340 0 obj <> endobj 4151 0 obj <> endobj 4154 0 obj <> endobj 8341 0 obj <> endobj 4153 0 obj <> endobj 4156 0 obj <> endobj 8342 0 obj <> endobj 4155 0 obj <> endobj 4158 0 obj <> endobj 8343 0 obj <> endobj 4157 0 obj <> endobj 4160 0 obj <> endobj 8344 0 obj <> endobj 4159 0 obj <> endobj 4162 0 obj <> endobj 8345 0 obj <> endobj 4161 0 obj <> endobj 4164 0 obj <> endobj 8346 0 obj <> endobj 4163 0 obj <> endobj 4166 0 obj <> endobj 8347 0 obj <> endobj 4165 0 obj <> endobj 4168 0 obj <> endobj 8348 0 obj <> endobj 4167 0 obj <> endobj 4170 0 obj <> endobj 8349 0 obj <> endobj 4169 0 obj <> endobj 4172 0 obj <> endobj 8350 0 obj <> endobj 4171 0 obj <> endobj 4174 0 obj <> endobj 8351 0 obj <> endobj 4173 0 obj <> endobj 4176 0 obj <> endobj 8352 0 obj <> endobj 4175 0 obj <> endobj 4178 0 obj <> endobj 8353 0 obj <> endobj 4177 0 obj <> endobj 4180 0 obj <> endobj 8354 0 obj <> endobj 4179 0 obj <> endobj 4182 0 obj <> endobj 8355 0 obj <> endobj 4181 0 obj <> endobj 4184 0 obj <> endobj 8356 0 obj <> endobj 4183 0 obj <> endobj 4186 0 obj <> endobj 8357 0 obj <> endobj 4185 0 obj <> endobj 4188 0 obj <> endobj 8358 0 obj <> endobj 4187 0 obj <> endobj 4190 0 obj <> endobj 8359 0 obj <> endobj 4189 0 obj <> endobj 4192 0 obj <> endobj 8360 0 obj <> endobj 4191 0 obj <> endobj 4194 0 obj <> endobj 8361 0 obj <> endobj 4193 0 obj <> endobj 4196 0 obj <> endobj 8362 0 obj <> endobj 4195 0 obj <> endobj 4198 0 obj <> endobj 8363 0 obj <> endobj 4197 0 obj <> endobj 4203 0 obj <> endobj 8364 0 obj <> endobj 4202 0 obj <> endobj 4205 0 obj <> endobj 8365 0 obj <> endobj 4204 0 obj <> endobj 4207 0 obj <> endobj 8366 0 obj <> endobj 4206 0 obj <> endobj 4209 0 obj <> endobj 8367 0 obj <> endobj 4208 0 obj <> endobj 4211 0 obj <> endobj 8368 0 obj <> endobj 4210 0 obj <> endobj 4213 0 obj <> endobj 8369 0 obj <> endobj 4212 0 obj <> endobj 4215 0 obj <> endobj 8370 0 obj <> endobj 4214 0 obj <> endobj 4217 0 obj <> endobj 8371 0 obj <> endobj 4216 0 obj <> endobj 4219 0 obj <> endobj 8372 0 obj <> endobj 4218 0 obj <> endobj 4221 0 obj <> endobj 8373 0 obj <> endobj 4220 0 obj <> endobj 4223 0 obj <> endobj 8374 0 obj <> endobj 4222 0 obj <> endobj 4225 0 obj <> endobj 8375 0 obj <> endobj 4224 0 obj <> endobj 4227 0 obj <> endobj 8376 0 obj <> endobj 4226 0 obj <> endobj 4229 0 obj <> endobj 8377 0 obj <> endobj 4228 0 obj <> endobj 4231 0 obj <> endobj 8378 0 obj <> endobj 4230 0 obj <> endobj 4233 0 obj <> endobj 8379 0 obj <> endobj 4232 0 obj <> endobj 4235 0 obj <> endobj 8380 0 obj <> endobj 4234 0 obj <> endobj 4237 0 obj <> endobj 8381 0 obj <> endobj 4236 0 obj <> endobj 4239 0 obj <> endobj 8382 0 obj <> endobj 4238 0 obj <> endobj 4241 0 obj <> endobj 8383 0 obj <> endobj 4240 0 obj <> endobj 4243 0 obj <> endobj 8384 0 obj <> endobj 4242 0 obj <> endobj 4245 0 obj <> endobj 8385 0 obj <> endobj 4244 0 obj <> endobj 4247 0 obj <> endobj 8386 0 obj <> endobj 4246 0 obj <> endobj 4249 0 obj <> endobj 8387 0 obj <> endobj 4248 0 obj <> endobj 4251 0 obj <> endobj 8388 0 obj <> endobj 4250 0 obj <> endobj 4253 0 obj <> endobj 8389 0 obj <> endobj 4252 0 obj <> endobj 4255 0 obj <> endobj 8390 0 obj <> endobj 4254 0 obj <> endobj 4257 0 obj <> endobj 8391 0 obj <> endobj 4256 0 obj <> endobj 4259 0 obj <> endobj 8392 0 obj <> endobj 4258 0 obj <> endobj 4261 0 obj <> endobj 8393 0 obj <> endobj 4260 0 obj <> endobj 4263 0 obj <> endobj 8394 0 obj <> endobj 4262 0 obj <> endobj 4265 0 obj <> endobj 8395 0 obj <> endobj 4264 0 obj <> endobj 4267 0 obj <> endobj 8396 0 obj <> endobj 4266 0 obj <> endobj 4269 0 obj <> endobj 8397 0 obj <> endobj 4268 0 obj <> endobj 4271 0 obj <> endobj 8398 0 obj <> endobj 4270 0 obj <> endobj 4273 0 obj <> endobj 8399 0 obj <> endobj 4272 0 obj <> endobj 4275 0 obj <> endobj 8400 0 obj <> endobj 4274 0 obj <> endobj 4277 0 obj <> endobj 8401 0 obj <> endobj 4276 0 obj <> endobj 4279 0 obj <> endobj 8402 0 obj <> endobj 4278 0 obj <> endobj 4281 0 obj <> endobj 8403 0 obj <> endobj 4280 0 obj <> endobj 4283 0 obj <> endobj 8404 0 obj <> endobj 4282 0 obj <> endobj 4285 0 obj <> endobj 8405 0 obj <> endobj 4284 0 obj <> endobj 4287 0 obj <> endobj 8406 0 obj <> endobj 4286 0 obj <> endobj 4289 0 obj <> endobj 8407 0 obj <> endobj 4288 0 obj <> endobj 4291 0 obj <> endobj 8408 0 obj <> endobj 4290 0 obj <> endobj 4293 0 obj <> endobj 8409 0 obj <> endobj 4292 0 obj <> endobj 4295 0 obj <> endobj 8410 0 obj <> endobj 4294 0 obj <> endobj 4297 0 obj <> endobj 8411 0 obj <> endobj 4296 0 obj <> endobj 4299 0 obj <> endobj 8412 0 obj <> endobj 4298 0 obj <> endobj 4301 0 obj <> endobj 8413 0 obj <> endobj 4300 0 obj <> endobj 4303 0 obj <> endobj 8414 0 obj <> endobj 4302 0 obj <> endobj 4305 0 obj <> endobj 8415 0 obj <> endobj 4304 0 obj <> endobj 4307 0 obj <> endobj 8416 0 obj <> endobj 4306 0 obj <> endobj 4309 0 obj <> endobj 8417 0 obj <> endobj 4308 0 obj <> endobj 4311 0 obj <> endobj 8418 0 obj <> endobj 4310 0 obj <> endobj 4313 0 obj <> endobj 8419 0 obj <> endobj 4312 0 obj <> endobj 4315 0 obj <> endobj 8420 0 obj <> endobj 4314 0 obj <> endobj 4317 0 obj <> endobj 8421 0 obj <> endobj 4316 0 obj <> endobj 4319 0 obj <> endobj 8422 0 obj <> endobj 4318 0 obj <> endobj 4321 0 obj <> endobj 8423 0 obj <> endobj 4320 0 obj <> endobj 4323 0 obj <> endobj 8424 0 obj <> endobj 4322 0 obj <> endobj 4325 0 obj <> endobj 8425 0 obj <> endobj 4324 0 obj <> endobj 4327 0 obj <> endobj 8426 0 obj <> endobj 4326 0 obj <> endobj 4329 0 obj <> endobj 8427 0 obj <> endobj 4328 0 obj <> endobj 4331 0 obj <> endobj 8428 0 obj <> endobj 4330 0 obj <> endobj 4333 0 obj <> endobj 8429 0 obj <> endobj 4332 0 obj <> endobj 4335 0 obj <> endobj 8430 0 obj <> endobj 4334 0 obj <> endobj 4337 0 obj <> endobj 8431 0 obj <> endobj 4336 0 obj <> endobj 4339 0 obj <> endobj 8432 0 obj <> endobj 4338 0 obj <> endobj 4341 0 obj <> endobj 8433 0 obj <> endobj 4340 0 obj <> endobj 4343 0 obj <> endobj 8434 0 obj <> endobj 4342 0 obj <> endobj 4345 0 obj <> endobj 8435 0 obj <> endobj 4344 0 obj <> endobj 4347 0 obj <> endobj 8436 0 obj <> endobj 4346 0 obj <> endobj 4349 0 obj <> endobj 8437 0 obj <> endobj 4348 0 obj <> endobj 4351 0 obj <> endobj 8438 0 obj <> endobj 4350 0 obj <> endobj 4353 0 obj <> endobj 8439 0 obj <> endobj 4352 0 obj <> endobj 4355 0 obj <> endobj 8440 0 obj <> endobj 4354 0 obj <> endobj 4357 0 obj <> endobj 8441 0 obj <> endobj 4356 0 obj <> endobj 4359 0 obj <> endobj 8442 0 obj <> endobj 4358 0 obj <> endobj 4361 0 obj <> endobj 8443 0 obj <> endobj 4360 0 obj <> endobj 4363 0 obj <> endobj 8444 0 obj <> endobj 4362 0 obj <> endobj 4365 0 obj <> endobj 8445 0 obj <> endobj 4364 0 obj <> endobj 4367 0 obj <> endobj 8446 0 obj <> endobj 4366 0 obj <> endobj 4369 0 obj <> endobj 8447 0 obj <> endobj 4368 0 obj <> endobj 4371 0 obj <> endobj 8448 0 obj <> endobj 4370 0 obj <> endobj 4373 0 obj <> endobj 8449 0 obj <> endobj 4372 0 obj <> endobj 4375 0 obj <> endobj 8450 0 obj <> endobj 4374 0 obj <> endobj 4377 0 obj <> endobj 8451 0 obj <> endobj 4376 0 obj <> endobj 4379 0 obj <> endobj 8452 0 obj <> endobj 4378 0 obj <> endobj 4381 0 obj <> endobj 8453 0 obj <> endobj 4380 0 obj <> endobj 4383 0 obj <> endobj 8454 0 obj <> endobj 4382 0 obj <> endobj 4385 0 obj <> endobj 8455 0 obj <> endobj 4384 0 obj <> endobj 4387 0 obj <> endobj 8456 0 obj <> endobj 4386 0 obj <> endobj 4389 0 obj <> endobj 8457 0 obj <> endobj 4388 0 obj <> endobj 4391 0 obj <> endobj 8458 0 obj <> endobj 4390 0 obj <> endobj 4393 0 obj <> endobj 8459 0 obj <> endobj 4392 0 obj <> endobj 4395 0 obj <> endobj 8460 0 obj <> endobj 4394 0 obj <> endobj 4397 0 obj <> endobj 8461 0 obj <> endobj 4396 0 obj <> endobj 4399 0 obj <> endobj 8462 0 obj <> endobj 4398 0 obj <> endobj 4401 0 obj <> endobj 8463 0 obj <> endobj 4400 0 obj <> endobj 4403 0 obj <> endobj 8464 0 obj <> endobj 4402 0 obj <> endobj 4405 0 obj <> endobj 8465 0 obj <> endobj 4404 0 obj <> endobj 4407 0 obj <> endobj 8466 0 obj <> endobj 4406 0 obj <> endobj 4409 0 obj <> endobj 8467 0 obj <> endobj 4408 0 obj <> endobj 4411 0 obj <> endobj 8468 0 obj <> endobj 4410 0 obj <> endobj 4413 0 obj <> endobj 8469 0 obj <> endobj 4412 0 obj <> endobj 4415 0 obj <> endobj 8470 0 obj <> endobj 4414 0 obj <> endobj 4417 0 obj <> endobj 8471 0 obj <> endobj 4416 0 obj <> endobj 4422 0 obj <> endobj 8472 0 obj <> endobj 4421 0 obj <> endobj 4424 0 obj <> endobj 8473 0 obj <> endobj 4423 0 obj <> endobj 4426 0 obj <> endobj 8474 0 obj <> endobj 4425 0 obj <> endobj 4428 0 obj <> endobj 8475 0 obj <> endobj 4427 0 obj <> endobj 4430 0 obj <> endobj 8476 0 obj <> endobj 4429 0 obj <> endobj 4432 0 obj <> endobj 8477 0 obj <> endobj 4431 0 obj <> endobj 4434 0 obj <> endobj 8478 0 obj <> endobj 4433 0 obj <> endobj 4436 0 obj <> endobj 8479 0 obj <> endobj 4435 0 obj <> endobj 4438 0 obj <> endobj 8480 0 obj <> endobj 4437 0 obj <> endobj 8481 0 obj <> endobj 4439 0 obj <> endobj 4441 0 obj <> endobj 8482 0 obj <> endobj 4440 0 obj <> endobj 4443 0 obj <> endobj 8483 0 obj <> endobj 4442 0 obj <> endobj 8484 0 obj <> endobj 4444 0 obj <> endobj 4446 0 obj <> endobj 8485 0 obj <> endobj 4445 0 obj <> endobj 4448 0 obj <> endobj 8486 0 obj <> endobj 4447 0 obj <> endobj 4450 0 obj <> endobj 8487 0 obj <> endobj 4449 0 obj <> endobj 4452 0 obj <> endobj 8488 0 obj <> endobj 4451 0 obj <> endobj 8489 0 obj <> endobj 4453 0 obj <> endobj 4455 0 obj <> endobj 8490 0 obj <> endobj 4454 0 obj <> endobj 4457 0 obj <> endobj 8491 0 obj <> endobj 4456 0 obj <> endobj 4459 0 obj <> endobj 8492 0 obj <> endobj 4458 0 obj <> endobj 8493 0 obj <> endobj 4460 0 obj <> endobj 4462 0 obj <> endobj 8494 0 obj <> endobj 4461 0 obj <> endobj 8495 0 obj <> endobj 4463 0 obj <> endobj 4465 0 obj <> endobj 8496 0 obj <> endobj 4464 0 obj <> endobj 4467 0 obj <> endobj 8497 0 obj <> endobj 4466 0 obj <> endobj 8498 0 obj <> endobj 4468 0 obj <> endobj 4470 0 obj <> endobj 8499 0 obj <> endobj 4469 0 obj <> endobj 4472 0 obj <> endobj 8500 0 obj <> endobj 4471 0 obj <> endobj 4474 0 obj <> endobj 8501 0 obj <> endobj 4473 0 obj <> endobj 4476 0 obj <> endobj 8502 0 obj <> endobj 4475 0 obj <> endobj 8503 0 obj <> endobj 4477 0 obj <> endobj 4479 0 obj <> endobj 8504 0 obj <> endobj 4478 0 obj <> endobj 4481 0 obj <> endobj 8505 0 obj <> endobj 4480 0 obj <> endobj 4483 0 obj <> endobj 8506 0 obj <> endobj 4482 0 obj <> endobj 4485 0 obj <> endobj 8507 0 obj <> endobj 4484 0 obj <> endobj 4487 0 obj <> endobj 8508 0 obj <> endobj 4486 0 obj <> endobj 4489 0 obj <> endobj 8509 0 obj <> endobj 4488 0 obj <> endobj 4491 0 obj <> endobj 8510 0 obj <> endobj 4490 0 obj <> endobj 4493 0 obj <> endobj 8511 0 obj <> endobj 4492 0 obj <> endobj 4495 0 obj <> endobj 8512 0 obj <> endobj 4494 0 obj <> endobj 4497 0 obj <> endobj 8513 0 obj <> endobj 4496 0 obj <> endobj 4499 0 obj <> endobj 8514 0 obj <> endobj 4498 0 obj <> endobj 4501 0 obj <> endobj 8515 0 obj <> endobj 4500 0 obj <> endobj 4503 0 obj <> endobj 8516 0 obj <> endobj 4502 0 obj <> endobj 4505 0 obj <> endobj 8517 0 obj <> endobj 4504 0 obj <> endobj 4507 0 obj <> endobj 8518 0 obj <> endobj 4506 0 obj <> endobj 4509 0 obj <> endobj 8519 0 obj <> endobj 4508 0 obj <> endobj 4511 0 obj <> endobj 8520 0 obj <> endobj 4510 0 obj <> endobj 4513 0 obj <> endobj 8521 0 obj <> endobj 4512 0 obj <> endobj 4515 0 obj <> endobj 8522 0 obj <> endobj 4514 0 obj <> endobj 4517 0 obj <> endobj 8523 0 obj <> endobj 4516 0 obj <> endobj 4519 0 obj <> endobj 8524 0 obj <> endobj 4518 0 obj <> endobj 4521 0 obj <> endobj 8525 0 obj <> endobj 4520 0 obj <> endobj 4523 0 obj <> endobj 8526 0 obj <> endobj 4522 0 obj <> endobj 4525 0 obj <> endobj 8527 0 obj <> endobj 4524 0 obj <> endobj 4527 0 obj <> endobj 8528 0 obj <> endobj 4526 0 obj <> endobj 8529 0 obj <> endobj 4528 0 obj <> endobj 4530 0 obj <> endobj 8530 0 obj <> endobj 4529 0 obj <> endobj 4532 0 obj <> endobj 8531 0 obj <> endobj 4531 0 obj <> endobj 4534 0 obj <> endobj 8532 0 obj <> endobj 4533 0 obj <> endobj 4536 0 obj <> endobj 8533 0 obj <> endobj 4535 0 obj <> endobj 4538 0 obj <> endobj 8534 0 obj <> endobj 4537 0 obj <> endobj 4540 0 obj <> endobj 8535 0 obj <> endobj 4539 0 obj <> endobj 4542 0 obj <> endobj 8536 0 obj <> endobj 4541 0 obj <> endobj 4544 0 obj <> endobj 8537 0 obj <> endobj 4543 0 obj <> endobj 4546 0 obj <> endobj 8538 0 obj <> endobj 4545 0 obj <> endobj 8539 0 obj <> endobj 4547 0 obj <> endobj 4549 0 obj <> endobj 8540 0 obj <> endobj 4548 0 obj <> endobj 8541 0 obj <> endobj 4550 0 obj <> endobj 4552 0 obj <> endobj 8542 0 obj <> endobj 4551 0 obj <> endobj 8543 0 obj <> endobj 4553 0 obj <> endobj 4555 0 obj <> endobj 8544 0 obj <> endobj 4554 0 obj <> endobj 4557 0 obj <> endobj 8545 0 obj <> endobj 4556 0 obj <> endobj 4559 0 obj <> endobj 8546 0 obj <> endobj 4558 0 obj <> endobj 8547 0 obj <> endobj 4560 0 obj <> endobj 4562 0 obj <> endobj 8548 0 obj <> endobj 4561 0 obj <> endobj 8549 0 obj <> endobj 4563 0 obj <> endobj 4565 0 obj <> endobj 8550 0 obj <> endobj 4564 0 obj <> endobj 4567 0 obj <> endobj 8551 0 obj <> endobj 4566 0 obj <> endobj 4569 0 obj <> endobj 8552 0 obj <> endobj 4568 0 obj <> endobj 4571 0 obj <> endobj 8553 0 obj <> endobj 4570 0 obj <> endobj 4573 0 obj <> endobj 8554 0 obj <> endobj 4572 0 obj <> endobj 4575 0 obj <> endobj 8555 0 obj <> endobj 4574 0 obj <> endobj 4577 0 obj <> endobj 8556 0 obj <> endobj 4576 0 obj <> endobj 8557 0 obj <> endobj 4578 0 obj <> endobj 4580 0 obj <> endobj 8558 0 obj <> endobj 4579 0 obj <> endobj 8559 0 obj <> endobj 4581 0 obj <> endobj 4583 0 obj <> endobj 8560 0 obj <> endobj 4582 0 obj <> endobj 4585 0 obj <> endobj 8561 0 obj <> endobj 4584 0 obj <> endobj 4587 0 obj <> endobj 8562 0 obj <> endobj 4586 0 obj <> endobj 4589 0 obj <> endobj 8563 0 obj <> endobj 4588 0 obj <> endobj 4591 0 obj <> endobj 8564 0 obj <> endobj 4590 0 obj <> endobj 4593 0 obj <> endobj 8565 0 obj <> endobj 4592 0 obj <> endobj 4595 0 obj <> endobj 8566 0 obj <> endobj 4594 0 obj <> endobj 4597 0 obj <> endobj 8567 0 obj <> endobj 4596 0 obj <> endobj 4599 0 obj <> endobj 8568 0 obj <> endobj 4598 0 obj <> endobj 4601 0 obj <> endobj 8569 0 obj <> endobj 4600 0 obj <> endobj 4603 0 obj <> endobj 8570 0 obj <> endobj 4602 0 obj <> endobj 4605 0 obj <> endobj 8571 0 obj <> endobj 4604 0 obj <> endobj 8572 0 obj <> endobj 4609 0 obj <> endobj 4611 0 obj <> endobj 8573 0 obj <> endobj 4610 0 obj <> endobj 4613 0 obj <> endobj 8574 0 obj <> endobj 4612 0 obj <> endobj 4615 0 obj <> endobj 8575 0 obj <> endobj 4614 0 obj <> endobj 4617 0 obj <> endobj 8576 0 obj <> endobj 4616 0 obj <> endobj 4619 0 obj <> endobj 8577 0 obj <> endobj 4618 0 obj <> endobj 4621 0 obj <> endobj 8578 0 obj <> endobj 4620 0 obj <> endobj 4623 0 obj <> endobj 8579 0 obj <> endobj 4622 0 obj <> endobj 8580 0 obj <> endobj 4624 0 obj <> endobj 4626 0 obj <> endobj 8581 0 obj <> endobj 4625 0 obj <> endobj 4628 0 obj <> endobj 8582 0 obj <> endobj 4627 0 obj <> endobj 4630 0 obj <> endobj 8583 0 obj <> endobj 4629 0 obj <> endobj 8584 0 obj <> endobj 4631 0 obj <> endobj 4633 0 obj <> endobj 8585 0 obj <> endobj 4632 0 obj <> endobj 4635 0 obj <> endobj 8586 0 obj <> endobj 4634 0 obj <> endobj 4637 0 obj <> endobj 8587 0 obj <> endobj 4636 0 obj <> endobj 8588 0 obj <> endobj 4638 0 obj <> endobj 4640 0 obj <> endobj 8589 0 obj <> endobj 4639 0 obj <> endobj 4642 0 obj <> endobj 8590 0 obj <> endobj 4641 0 obj <> endobj 4644 0 obj <> endobj 8591 0 obj <> endobj 4643 0 obj <> endobj 4646 0 obj <> endobj 8592 0 obj <> endobj 4645 0 obj <> endobj 4648 0 obj <> endobj 8593 0 obj <> endobj 4647 0 obj <> endobj 4650 0 obj <> endobj 8594 0 obj <> endobj 4649 0 obj <> endobj 8595 0 obj <> endobj 4651 0 obj <> endobj 4653 0 obj <> endobj 8596 0 obj <> endobj 4652 0 obj <> endobj 4655 0 obj <> endobj 8597 0 obj <> endobj 4654 0 obj <> endobj 4657 0 obj <> endobj 8598 0 obj <> endobj 4656 0 obj <> endobj 4659 0 obj <> endobj 8599 0 obj <> endobj 4658 0 obj <> endobj 4661 0 obj <> endobj 8600 0 obj <> endobj 4660 0 obj <> endobj 4663 0 obj <> endobj 8601 0 obj <> endobj 4662 0 obj <> endobj 4665 0 obj <> endobj 8602 0 obj <> endobj 4664 0 obj <> endobj 4667 0 obj <> endobj 8603 0 obj <> endobj 4666 0 obj <> endobj 4669 0 obj <> endobj 8604 0 obj <> endobj 4668 0 obj <> endobj 4671 0 obj <> endobj 8605 0 obj <> endobj 4670 0 obj <> endobj 4673 0 obj <> endobj 8606 0 obj <> endobj 4672 0 obj <> endobj 8607 0 obj <> endobj 4674 0 obj <> endobj 4676 0 obj <> endobj 8608 0 obj <> endobj 4675 0 obj <> endobj 4678 0 obj <> endobj 8609 0 obj <> endobj 4677 0 obj <> endobj 4680 0 obj <> endobj 8610 0 obj <> endobj 4679 0 obj <> endobj 4682 0 obj <> endobj 8611 0 obj <> endobj 4681 0 obj <> endobj 4684 0 obj <> endobj 8612 0 obj <> endobj 4683 0 obj <> endobj 4686 0 obj <> endobj 8613 0 obj <> endobj 4685 0 obj <> endobj 4688 0 obj <> endobj 8614 0 obj <> endobj 4687 0 obj <> endobj 4690 0 obj <> endobj 8615 0 obj <> endobj 4689 0 obj <> endobj 8616 0 obj <> endobj 4691 0 obj <> endobj 4693 0 obj <> endobj 8617 0 obj <> endobj 4692 0 obj <> endobj 4695 0 obj <> endobj 8618 0 obj <> endobj 4694 0 obj <> endobj 4697 0 obj <> endobj 8619 0 obj <> endobj 4696 0 obj <> endobj 4699 0 obj <> endobj 8620 0 obj <> endobj 4698 0 obj <> endobj 4701 0 obj <> endobj 8621 0 obj <> endobj 4700 0 obj <> endobj 4703 0 obj <> endobj 8622 0 obj <> endobj 4702 0 obj <> endobj 4705 0 obj <> endobj 8623 0 obj <> endobj 4704 0 obj <> endobj 4707 0 obj <> endobj 8624 0 obj <> endobj 4706 0 obj <> endobj 4709 0 obj <> endobj 8625 0 obj <> endobj 4708 0 obj <> endobj 4711 0 obj <> endobj 8626 0 obj <> endobj 4710 0 obj <> endobj 4713 0 obj <> endobj 8627 0 obj <> endobj 4712 0 obj <> endobj 4715 0 obj <> endobj 8628 0 obj <> endobj 4714 0 obj <> endobj 4717 0 obj <> endobj 8629 0 obj <> endobj 4716 0 obj <> endobj 4719 0 obj <> endobj 8630 0 obj <> endobj 4718 0 obj <> endobj 4721 0 obj <> endobj 8631 0 obj <> endobj 4720 0 obj <> endobj 4723 0 obj <> endobj 8632 0 obj <> endobj 4722 0 obj <> endobj 4725 0 obj <> endobj 8633 0 obj <> endobj 4724 0 obj <> endobj 4727 0 obj <> endobj 8634 0 obj <> endobj 4726 0 obj <> endobj 8635 0 obj <> endobj 4728 0 obj <> endobj 8636 0 obj <> endobj 4729 0 obj <> endobj 4731 0 obj <> endobj 8637 0 obj <> endobj 4730 0 obj <> endobj 4733 0 obj <> endobj 8638 0 obj <> endobj 4732 0 obj <> endobj 4735 0 obj <> endobj 8639 0 obj <> endobj 4734 0 obj <> endobj 4737 0 obj <> endobj 8640 0 obj <> endobj 4736 0 obj <> endobj 4739 0 obj <> endobj 8641 0 obj <> endobj 4738 0 obj <> endobj 4741 0 obj <> endobj 8642 0 obj <> endobj 4740 0 obj <> endobj 4743 0 obj <> endobj 8643 0 obj <> endobj 4742 0 obj <> endobj 4745 0 obj <> endobj 8644 0 obj <> endobj 4744 0 obj <> endobj 4747 0 obj <> endobj 8645 0 obj <> endobj 4746 0 obj <> endobj 4749 0 obj <> endobj 8646 0 obj <> endobj 4748 0 obj <> endobj 4751 0 obj <> endobj 8647 0 obj <> endobj 4750 0 obj <> endobj 4753 0 obj <> endobj 8648 0 obj <> endobj 4752 0 obj <> endobj 4755 0 obj <> endobj 8649 0 obj <> endobj 4754 0 obj <> endobj 4757 0 obj <> endobj 8650 0 obj <> endobj 4756 0 obj <> endobj 8651 0 obj <> endobj 4758 0 obj <> endobj 4760 0 obj <> endobj 8652 0 obj <> endobj 4759 0 obj <> endobj 4762 0 obj <> endobj 8653 0 obj <> endobj 4761 0 obj <> endobj 8654 0 obj <> endobj 4763 0 obj <> endobj 4765 0 obj <> endobj 8655 0 obj <> endobj 4764 0 obj <> endobj 4767 0 obj <> endobj 8656 0 obj <> endobj 4766 0 obj <> endobj 4769 0 obj <> endobj 8657 0 obj <> endobj 4768 0 obj <> endobj 8658 0 obj <> endobj 4770 0 obj <> endobj 4772 0 obj <> endobj 8659 0 obj <> endobj 4771 0 obj <> endobj 4774 0 obj <> endobj 8660 0 obj <> endobj 4773 0 obj <> endobj 4776 0 obj <> endobj 8661 0 obj <> endobj 4775 0 obj <> endobj 4778 0 obj <> endobj 8662 0 obj <> endobj 4777 0 obj <> endobj 4780 0 obj <> endobj 8663 0 obj <> endobj 4779 0 obj <> endobj 4782 0 obj <> endobj 8664 0 obj <> endobj 4781 0 obj <> endobj 4784 0 obj <> endobj 8665 0 obj <> endobj 4783 0 obj <> endobj 4786 0 obj <> endobj 8666 0 obj <> endobj 4785 0 obj <> endobj 4788 0 obj <> endobj 8667 0 obj <> endobj 4787 0 obj <> endobj 4790 0 obj <> endobj 8668 0 obj <> endobj 4789 0 obj <> endobj 4792 0 obj <> endobj 8669 0 obj <> endobj 4791 0 obj <> endobj 4794 0 obj <> endobj 8670 0 obj <> endobj 4793 0 obj <> endobj 8671 0 obj <> endobj 4795 0 obj <> endobj 4797 0 obj <> endobj 8672 0 obj <> endobj 4796 0 obj <> endobj 4802 0 obj <> endobj 8673 0 obj <> endobj 4801 0 obj <> endobj 4804 0 obj <> endobj 8674 0 obj <> endobj 4803 0 obj <> endobj 4806 0 obj <> endobj 8675 0 obj <> endobj 4805 0 obj <> endobj 4808 0 obj <> endobj 8676 0 obj <> endobj 4807 0 obj <> endobj 4810 0 obj <> endobj 8677 0 obj <> endobj 4809 0 obj <> endobj 8678 0 obj <> endobj 4811 0 obj <> endobj 4813 0 obj <> endobj 8679 0 obj <> endobj 4812 0 obj <> endobj 4815 0 obj <> endobj 8680 0 obj <> endobj 4814 0 obj <> endobj 4817 0 obj <> endobj 8681 0 obj <> endobj 4816 0 obj <> endobj 8682 0 obj <> endobj 4818 0 obj <> endobj 4820 0 obj <> endobj 8683 0 obj <> endobj 4819 0 obj <> endobj 4822 0 obj <> endobj 8684 0 obj <> endobj 4821 0 obj <> endobj 4824 0 obj <> endobj 8685 0 obj <> endobj 4823 0 obj <> endobj 4826 0 obj <> endobj 8686 0 obj <> endobj 4825 0 obj <> endobj 4828 0 obj <> endobj 8687 0 obj <> endobj 4827 0 obj <> endobj 4830 0 obj <> endobj 8688 0 obj <> endobj 4829 0 obj <> endobj 8689 0 obj <> endobj 4831 0 obj <> endobj 4833 0 obj <> endobj 8690 0 obj <> endobj 4832 0 obj <> endobj 4835 0 obj <> endobj 8691 0 obj <> endobj 4834 0 obj <> endobj 4837 0 obj <> endobj 8692 0 obj <> endobj 4836 0 obj <> endobj 4839 0 obj <> endobj 8693 0 obj <> endobj 4838 0 obj <> endobj 8694 0 obj <> endobj 4840 0 obj <> endobj 4842 0 obj <> endobj 8695 0 obj <> endobj 4841 0 obj <> endobj 4844 0 obj <> endobj 8696 0 obj <> endobj 4843 0 obj <> endobj 4846 0 obj <> endobj 8697 0 obj <> endobj 4845 0 obj <> endobj 4848 0 obj <> endobj 8698 0 obj <> endobj 4847 0 obj <> endobj 4850 0 obj <> endobj 8699 0 obj <> endobj 4849 0 obj <> endobj 8700 0 obj <> endobj 4851 0 obj <> endobj 4853 0 obj <> endobj 8701 0 obj <> endobj 4852 0 obj <> endobj 4855 0 obj <> endobj 8702 0 obj <> endobj 4854 0 obj <> endobj 4857 0 obj <> endobj 8703 0 obj <> endobj 4856 0 obj <> endobj 4859 0 obj <> endobj 8704 0 obj <> endobj 4858 0 obj <> endobj 4861 0 obj <> endobj 8705 0 obj <> endobj 4860 0 obj <> endobj 8706 0 obj <> endobj 4862 0 obj <> endobj 4864 0 obj <> endobj 8707 0 obj <> endobj 4863 0 obj <> endobj 8708 0 obj <> endobj 4865 0 obj <> endobj 4867 0 obj <> endobj 8709 0 obj <> endobj 4866 0 obj <> endobj 4869 0 obj <> endobj 8710 0 obj <> endobj 4868 0 obj <> endobj 4871 0 obj <> endobj 8711 0 obj <> endobj 4870 0 obj <> endobj 4873 0 obj <> endobj 8712 0 obj <> endobj 4872 0 obj <> endobj 4875 0 obj <> endobj 8713 0 obj <> endobj 4874 0 obj <> endobj 4877 0 obj <> endobj 8714 0 obj <> endobj 4876 0 obj <> endobj 4879 0 obj <> endobj 8715 0 obj <> endobj 4878 0 obj <> endobj 8716 0 obj <> endobj 4880 0 obj <> endobj 4882 0 obj <> endobj 8717 0 obj <> endobj 4881 0 obj <> endobj 4884 0 obj <> endobj 8718 0 obj <> endobj 4883 0 obj <> endobj 8719 0 obj <> endobj 4885 0 obj <> endobj 4887 0 obj <> endobj 8720 0 obj <> endobj 4886 0 obj <> endobj 4889 0 obj <> endobj 8721 0 obj <> endobj 4888 0 obj <> endobj 4891 0 obj <> endobj 8722 0 obj <> endobj 4890 0 obj <> endobj 8723 0 obj <> endobj 4892 0 obj <> endobj 4894 0 obj <> endobj 8724 0 obj <> endobj 4893 0 obj <> endobj 4896 0 obj <> endobj 8725 0 obj <> endobj 4895 0 obj <> endobj 4898 0 obj <> endobj 8726 0 obj <> endobj 4897 0 obj <> endobj 8727 0 obj <> endobj 4899 0 obj <> endobj 4901 0 obj <> endobj 8728 0 obj <> endobj 4900 0 obj <> endobj 4903 0 obj <> endobj 8729 0 obj <> endobj 4902 0 obj <> endobj 4905 0 obj <> endobj 8730 0 obj <> endobj 4904 0 obj <> endobj 4907 0 obj <> endobj 8731 0 obj <> endobj 4906 0 obj <> endobj 4909 0 obj <> endobj 8732 0 obj <> endobj 4908 0 obj <> endobj 4911 0 obj <> endobj 8733 0 obj <> endobj 4910 0 obj <> endobj 4913 0 obj <> endobj 8734 0 obj <> endobj 4912 0 obj <> endobj 4915 0 obj <> endobj 8735 0 obj <> endobj 4914 0 obj <> endobj 4917 0 obj <> endobj 8736 0 obj <> endobj 4916 0 obj <> endobj 4919 0 obj <> endobj 8737 0 obj <> endobj 4918 0 obj <> endobj 4921 0 obj <> endobj 8738 0 obj <> endobj 4920 0 obj <> endobj 4923 0 obj <> endobj 8739 0 obj <> endobj 4922 0 obj <> endobj 4925 0 obj <> endobj 8740 0 obj <> endobj 4924 0 obj <> endobj 4927 0 obj <> endobj 8741 0 obj <> endobj 4926 0 obj <> endobj 8742 0 obj <> endobj 4928 0 obj <> endobj 4930 0 obj <> endobj 8743 0 obj <> endobj 4929 0 obj <> endobj 8744 0 obj <> endobj 4931 0 obj <> endobj 4933 0 obj <> endobj 8745 0 obj <> endobj 4932 0 obj <> endobj 4935 0 obj <> endobj 8746 0 obj <> endobj 4934 0 obj <> endobj 4937 0 obj <> endobj 8747 0 obj <> endobj 4936 0 obj <> endobj 8748 0 obj <> endobj 4938 0 obj <> endobj 4940 0 obj <> endobj 8749 0 obj <> endobj 4939 0 obj <> endobj 4942 0 obj <> endobj 8750 0 obj <> endobj 4941 0 obj <> endobj 4944 0 obj <> endobj 8751 0 obj <> endobj 4943 0 obj <> endobj 4946 0 obj <> endobj 8752 0 obj <> endobj 4945 0 obj <> endobj 4948 0 obj <> endobj 8753 0 obj <> endobj 4947 0 obj <> endobj 4950 0 obj <> endobj 8754 0 obj <> endobj 4949 0 obj <> endobj 4952 0 obj <> endobj 8755 0 obj <> endobj 4951 0 obj <> endobj 4954 0 obj <> endobj 8756 0 obj <> endobj 4953 0 obj <> endobj 4956 0 obj <> endobj 8757 0 obj <> endobj 4955 0 obj <> endobj 4958 0 obj <> endobj 8758 0 obj <> endobj 4957 0 obj <> endobj 8759 0 obj <> endobj 4959 0 obj <> endobj 4961 0 obj <> endobj 8760 0 obj <> endobj 4960 0 obj <> endobj 4963 0 obj <> endobj 8761 0 obj <> endobj 4962 0 obj <> endobj 4965 0 obj <> endobj 8762 0 obj <> endobj 4964 0 obj <> endobj 4967 0 obj <> endobj 8763 0 obj <> endobj 4966 0 obj <> endobj 4969 0 obj <> endobj 8764 0 obj <> endobj 4968 0 obj <> endobj 4971 0 obj <> endobj 8765 0 obj <> endobj 4970 0 obj <> endobj 4973 0 obj <> endobj 8766 0 obj <> endobj 4972 0 obj <> endobj 4975 0 obj <> endobj 8767 0 obj <> endobj 4974 0 obj <> endobj 4977 0 obj <> endobj 8768 0 obj <> endobj 4976 0 obj <> endobj 4979 0 obj <> endobj 8769 0 obj <> endobj 4978 0 obj <> endobj 4981 0 obj <> endobj 8770 0 obj <> endobj 4980 0 obj <> endobj 4983 0 obj <> endobj 8771 0 obj <> endobj 4982 0 obj <> endobj 4985 0 obj <> endobj 8772 0 obj <> endobj 4984 0 obj <> endobj 8773 0 obj <> endobj 4989 0 obj <> endobj 4991 0 obj <> endobj 8774 0 obj <> endobj 4990 0 obj <> endobj 4993 0 obj <> endobj 8775 0 obj <> endobj 4992 0 obj <> endobj 8776 0 obj <> endobj 4994 0 obj <> endobj 4996 0 obj <> endobj 8777 0 obj <> endobj 4995 0 obj <> endobj 4998 0 obj <> endobj 8778 0 obj <> endobj 4997 0 obj <> endobj 5000 0 obj <> endobj 8779 0 obj <> endobj 4999 0 obj <> endobj 8780 0 obj <> endobj 5001 0 obj <> endobj 5003 0 obj <> endobj 8781 0 obj <> endobj 5002 0 obj <> endobj 8782 0 obj <> endobj 5004 0 obj <> endobj 5006 0 obj <> endobj 8783 0 obj <> endobj 5005 0 obj <> endobj 5008 0 obj <> endobj 8784 0 obj <> endobj 5007 0 obj <> endobj 8785 0 obj <> endobj 5009 0 obj <> endobj 5011 0 obj <> endobj 8786 0 obj <> endobj 5010 0 obj <> endobj 8787 0 obj <> endobj 5012 0 obj <> endobj 5014 0 obj <> endobj 8788 0 obj <> endobj 5013 0 obj <> endobj 8789 0 obj <> endobj 5015 0 obj <> endobj 8790 0 obj <> endobj 5016 0 obj <> endobj 5018 0 obj <> endobj 8791 0 obj <> endobj 5017 0 obj <> endobj 5020 0 obj <> endobj 8792 0 obj <> endobj 5019 0 obj <> endobj 5022 0 obj <> endobj 8793 0 obj <> endobj 5021 0 obj <> endobj 5024 0 obj <> endobj 8794 0 obj <> endobj 5023 0 obj <> endobj 5026 0 obj <> endobj 8795 0 obj <> endobj 5025 0 obj <> endobj 5028 0 obj <> endobj 8796 0 obj <> endobj 5027 0 obj <> endobj 5030 0 obj <> endobj 8797 0 obj <> endobj 5029 0 obj <> endobj 8798 0 obj <> endobj 5031 0 obj <> endobj 5033 0 obj <> endobj 8799 0 obj <> endobj 5032 0 obj <> endobj 5035 0 obj <> endobj 8800 0 obj <> endobj 5034 0 obj <> endobj 8801 0 obj <> endobj 5036 0 obj <> endobj 5038 0 obj <> endobj 8802 0 obj <> endobj 5037 0 obj <> endobj 3407 0 obj <> endobj 4 0 obj <> endobj 5451 0 obj <> /K[4 0 R ] >> endobj 8803 0 obj <> endobj 5170 0 obj <> endobj 5039 0 obj <> /StructParent 94>> endobj 5040 0 obj <> endobj 5041 0 obj <> endobj 5042 0 obj <> endobj 5043 0 obj <> endobj 5044 0 obj <> endobj 5045 0 obj <> endobj 5046 0 obj <> endobj 5047 0 obj <> endobj 5048 0 obj <> endobj 5049 0 obj <> endobj 5050 0 obj <> endobj 5051 0 obj <> endobj 5052 0 obj <> endobj 5053 0 obj <> endobj 5054 0 obj <> endobj 5055 0 obj <> endobj 5056 0 obj <> endobj 5057 0 obj <> endobj 5058 0 obj <> endobj 5059 0 obj <> endobj 5060 0 obj <> endobj 5061 0 obj <> endobj 5062 0 obj <> endobj 5063 0 obj <> endobj 5064 0 obj <> endobj 5065 0 obj <> endobj 5066 0 obj <> endobj 5067 0 obj <> endobj 5068 0 obj <> endobj 5069 0 obj <> endobj 5070 0 obj <> endobj 5071 0 obj <> endobj 5072 0 obj <> endobj 5073 0 obj <> endobj 5074 0 obj <> endobj 5075 0 obj <> endobj 5076 0 obj <> endobj 5077 0 obj <> endobj 5078 0 obj <> endobj 5079 0 obj <> endobj 5080 0 obj <> /StructParent 224>> endobj 5081 0 obj <> /StructParent 197>> endobj 5082 0 obj <> /StructParent 190>> endobj 5083 0 obj <> /StructParent 184>> endobj 5084 0 obj <> /StructParent 179>> endobj 5085 0 obj <> /StructParent 155>> endobj 5086 0 obj <> /StructParent 142>> endobj 5087 0 obj <> /StructParent 138>> endobj 5088 0 obj <> endobj 5089 0 obj <> endobj 5090 0 obj <> endobj 5091 0 obj <> endobj 5092 0 obj <> endobj 5093 0 obj <> endobj 5094 0 obj <> endobj 5095 0 obj <> endobj 5096 0 obj <> endobj 5097 0 obj <> endobj 5098 0 obj <> endobj 5099 0 obj <> endobj 5100 0 obj <> endobj 5101 0 obj <> endobj 5102 0 obj <> endobj 5103 0 obj <> endobj 5104 0 obj <> endobj 5105 0 obj <> endobj 5106 0 obj <> endobj 5107 0 obj <> endobj 5108 0 obj <> endobj 5109 0 obj <> endobj 5110 0 obj <> endobj 5111 0 obj <> endobj 5112 0 obj <> endobj 5113 0 obj <> endobj 5114 0 obj <> endobj 5115 0 obj <> endobj 5116 0 obj <> endobj 5117 0 obj <> endobj 5118 0 obj <> endobj 5119 0 obj <> endobj 5120 0 obj <> endobj 5121 0 obj <> endobj 5122 0 obj <> endobj 5123 0 obj <> endobj 5124 0 obj <> endobj 5125 0 obj <> endobj 5126 0 obj <> endobj 5127 0 obj <> endobj 5128 0 obj <> endobj 5129 0 obj <> endobj 5130 0 obj <> endobj 5131 0 obj <> endobj 5132 0 obj <> endobj 5133 0 obj <> endobj 5134 0 obj <> endobj 5135 0 obj <> endobj 5136 0 obj <> endobj 5137 0 obj <> endobj 5138 0 obj <> endobj 5139 0 obj <> endobj 5140 0 obj <> endobj 5141 0 obj <> endobj 5142 0 obj <> endobj 5143 0 obj <> endobj 5144 0 obj <> endobj 5145 0 obj <> endobj 5146 0 obj <> endobj 5147 0 obj <> endobj 5148 0 obj <> endobj 5149 0 obj <> endobj 5150 0 obj <> endobj 5151 0 obj <> endobj 5152 0 obj <> endobj 5153 0 obj <> endobj 5154 0 obj <> endobj 5155 0 obj <> endobj 5156 0 obj <> endobj 5157 0 obj <> endobj 5158 0 obj <> endobj 5159 0 obj <> endobj 5160 0 obj <> endobj 5161 0 obj <> endobj 5162 0 obj <> endobj 5163 0 obj <> endobj 5164 0 obj <> endobj 5165 0 obj <> endobj 5166 0 obj <> endobj 5167 0 obj <> endobj 5168 0 obj <> endobj 5169 0 obj <> endobj 8804 0 obj <> /Outlines 5204 0 R /StructTreeRoot 5451 0 R /Lang(en-GB) /MarkInfo<> >> endobj 8805 0 obj < /Author /Subject /Creator /Producer /CreationDate(D:20100123100106Z')>> endobj xref 0 8806 0000000000 65535 f 0000401899 00000 n 0000000019 00000 n 0000000578 00000 n 0001174174 00000 n 0000480069 00000 n 0000480244 00000 n 0000480418 00000 n 0000480593 00000 n 0000480911 00000 n 0000480732 00000 n 0000481090 00000 n 0000402084 00000 n 0000000598 00000 n 0000000913 00000 n 0000481270 00000 n 0000402251 00000 n 0000000934 00000 n 0000003279 00000 n 0000481416 00000 n 0000501255 00000 n 0000481904 00000 n 0000481795 00000 n 0000481563 00000 n 0000481660 00000 n 0000482388 00000 n 0000482279 00000 n 0000482031 00000 n 0000482128 00000 n 0000482874 00000 n 0000482765 00000 n 0000482515 00000 n 0000482612 00000 n 0000483363 00000 n 0000483253 00000 n 0000483001 00000 n 0000483099 00000 n 0000483852 00000 n 0000483742 00000 n 0000483490 00000 n 0000483588 00000 n 0000484341 00000 n 0000484231 00000 n 0000483979 00000 n 0000484077 00000 n 0000484830 00000 n 0000484720 00000 n 0000484468 00000 n 0000484566 00000 n 0000485319 00000 n 0000485209 00000 n 0000484957 00000 n 0000485055 00000 n 0000485808 00000 n 0000485698 00000 n 0000485446 00000 n 0000485544 00000 n 0000486297 00000 n 0000486187 00000 n 0000485935 00000 n 0000486033 00000 n 0000486784 00000 n 0000486674 00000 n 0000486424 00000 n 0000486522 00000 n 0000487273 00000 n 0000487163 00000 n 0000486911 00000 n 0000487009 00000 n 0000487762 00000 n 0000487652 00000 n 0000487400 00000 n 0000487498 00000 n 0000488251 00000 n 0000488141 00000 n 0000487889 00000 n 0000487987 00000 n 0000488740 00000 n 0000488630 00000 n 0000488378 00000 n 0000488476 00000 n 0000489229 00000 n 0000489119 00000 n 0000488867 00000 n 0000488965 00000 n 0000489718 00000 n 0000489608 00000 n 0000489356 00000 n 0000489454 00000 n 0000490207 00000 n 0000490097 00000 n 0000489845 00000 n 0000489943 00000 n 0000490696 00000 n 0000490586 00000 n 0000490334 00000 n 0000490432 00000 n 0000491187 00000 n 0000491076 00000 n 0000490823 00000 n 0000490921 00000 n 0000491684 00000 n 0000491570 00000 n 0000491314 00000 n 0000491414 00000 n 0000492183 00000 n 0000492069 00000 n 0000491813 00000 n 0000491913 00000 n 0000492682 00000 n 0000492568 00000 n 0000492312 00000 n 0000492412 00000 n 0000493181 00000 n 0000493067 00000 n 0000492811 00000 n 0000492911 00000 n 0000493680 00000 n 0000493566 00000 n 0000493310 00000 n 0000493410 00000 n 0000494179 00000 n 0000494065 00000 n 0000493809 00000 n 0000493909 00000 n 0000494678 00000 n 0000494564 00000 n 0000494308 00000 n 0000494408 00000 n 0000495177 00000 n 0000495063 00000 n 0000494807 00000 n 0000494907 00000 n 0000495676 00000 n 0000495562 00000 n 0000495306 00000 n 0000495406 00000 n 0000496173 00000 n 0000496059 00000 n 0000495805 00000 n 0000495905 00000 n 0000496672 00000 n 0000496558 00000 n 0000496302 00000 n 0000496402 00000 n 0000497171 00000 n 0000497057 00000 n 0000496801 00000 n 0000496901 00000 n 0000497670 00000 n 0000497556 00000 n 0000497300 00000 n 0000497400 00000 n 0000498170 00000 n 0000498055 00000 n 0000497799 00000 n 0000497900 00000 n 0000498672 00000 n 0000498557 00000 n 0000498299 00000 n 0000498400 00000 n 0000402744 00000 n 0000003301 00000 n 0000003938 00000 n 0000499171 00000 n 0000499057 00000 n 0000498801 00000 n 0000498901 00000 n 0000499671 00000 n 0000499557 00000 n 0000499301 00000 n 0000499401 00000 n 0000500171 00000 n 0000500057 00000 n 0000499801 00000 n 0000499901 00000 n 0000500671 00000 n 0000500556 00000 n 0000500301 00000 n 0000500401 00000 n 0000501172 00000 n 0000501057 00000 n 0000500801 00000 n 0000500902 00000 n 0000402969 00000 n 0000003960 00000 n 0000007776 00000 n 0000501693 00000 n 0000502116 00000 n 0000501826 00000 n 0000501960 00000 n 0000502300 00000 n 0000502464 00000 n 0000502762 00000 n 0000502606 00000 n 0000502937 00000 n 0000503091 00000 n 0000503256 00000 n 0000503421 00000 n 0000504172 00000 n 0000503840 00000 n 0000503734 00000 n 0000503564 00000 n 0000504088 00000 n 0000503993 00000 n 0000403185 00000 n 0000007799 00000 n 0000011354 00000 n 0000504312 00000 n 0000504610 00000 n 0000504454 00000 n 0000507282 00000 n 0000505428 00000 n 0000504946 00000 n 0000504766 00000 n 0000505283 00000 n 0000505108 00000 n 0000506243 00000 n 0000505761 00000 n 0000505581 00000 n 0000506098 00000 n 0000505923 00000 n 0000507058 00000 n 0000506576 00000 n 0000506396 00000 n 0000506913 00000 n 0000506738 00000 n 0000507444 00000 n 0000508483 00000 n 0000508257 00000 n 0000507773 00000 n 0000507591 00000 n 0000508112 00000 n 0000507935 00000 n 0000508629 00000 n 0000508794 00000 n 0000511609 00000 n 0000509605 00000 n 0000509122 00000 n 0000508941 00000 n 0000509460 00000 n 0000509284 00000 n 0000510422 00000 n 0000509939 00000 n 0000509758 00000 n 0000510277 00000 n 0000510101 00000 n 0000511385 00000 n 0000510756 00000 n 0000510575 00000 n 0000511240 00000 n 0000511053 00000 n 0000510897 00000 n 0000511906 00000 n 0000511767 00000 n 0000512082 00000 n 0000512236 00000 n 0000512684 00000 n 0000512602 00000 n 0000512517 00000 n 0000512419 00000 n 0000513418 00000 n 0000513086 00000 n 0000512980 00000 n 0000512810 00000 n 0000513334 00000 n 0000513239 00000 n 0000403401 00000 n 0000011377 00000 n 0000013387 00000 n 0000514344 00000 n 0000513911 00000 n 0000513826 00000 n 0000513719 00000 n 0000513560 00000 n 0000514262 00000 n 0000514177 00000 n 0000514080 00000 n 0000514926 00000 n 0000514844 00000 n 0000514759 00000 n 0000514652 00000 n 0000514478 00000 n 0000515074 00000 n 0000515416 00000 n 0000515332 00000 n 0000515238 00000 n 0000403590 00000 n 0000013410 00000 n 0000013499 00000 n 0000403742 00000 n 0000013520 00000 n 0000016913 00000 n 0000515564 00000 n 0000515719 00000 n 0000515883 00000 n 0000516047 00000 n 0000517195 00000 n 0000516411 00000 n 0000516326 00000 n 0000516229 00000 n 0000516762 00000 n 0000516677 00000 n 0000516580 00000 n 0000517113 00000 n 0000517028 00000 n 0000516931 00000 n 0000517628 00000 n 0000517337 00000 n 0000517471 00000 n 0000517813 00000 n 0000517978 00000 n 0000520366 00000 n 0000518333 00000 n 0000518248 00000 n 0000518150 00000 n 0000519024 00000 n 0000518931 00000 n 0000518637 00000 n 0000518462 00000 n 0000518833 00000 n 0000519933 00000 n 0000519832 00000 n 0000519193 00000 n 0000403949 00000 n 0000016936 00000 n 0000018514 00000 n 0000519411 00000 n 0000519725 00000 n 0000519551 00000 n 0000520284 00000 n 0000520199 00000 n 0000520102 00000 n 0000404138 00000 n 0000018537 00000 n 0000022132 00000 n 0000520520 00000 n 0000520673 00000 n 0000523335 00000 n 0000520768 00000 n 0000520859 00000 n 0000520950 00000 n 0000521041 00000 n 0000521132 00000 n 0000521224 00000 n 0000521316 00000 n 0000521408 00000 n 0000521500 00000 n 0000521592 00000 n 0000521684 00000 n 0000521776 00000 n 0000521868 00000 n 0000521960 00000 n 0000522052 00000 n 0000522144 00000 n 0000522236 00000 n 0000522328 00000 n 0000522420 00000 n 0000522512 00000 n 0000522604 00000 n 0000522696 00000 n 0000522788 00000 n 0000522880 00000 n 0000522972 00000 n 0000523064 00000 n 0000523156 00000 n 0000523789 00000 n 0000523954 00000 n 0000524119 00000 n 0000524284 00000 n 0000524449 00000 n 0000524614 00000 n 0000524914 00000 n 0000524757 00000 n 0000404327 00000 n 0000022155 00000 n 0000025458 00000 n 0000525072 00000 n 0000525225 00000 n 0000525407 00000 n 0000525567 00000 n 0000528230 00000 n 0000525662 00000 n 0000525753 00000 n 0000525844 00000 n 0000525935 00000 n 0000526027 00000 n 0000526119 00000 n 0000526211 00000 n 0000526303 00000 n 0000526395 00000 n 0000526487 00000 n 0000526579 00000 n 0000526671 00000 n 0000526763 00000 n 0000526855 00000 n 0000526947 00000 n 0000527039 00000 n 0000527131 00000 n 0000527223 00000 n 0000527315 00000 n 0000527407 00000 n 0000527499 00000 n 0000527591 00000 n 0000527683 00000 n 0000527775 00000 n 0000527867 00000 n 0000527959 00000 n 0000528051 00000 n 0000528685 00000 n 0000528850 00000 n 0000529015 00000 n 0000529180 00000 n 0000404497 00000 n 0000025481 00000 n 0000029474 00000 n 0000529327 00000 n 0000529480 00000 n 0000529644 00000 n 0000529808 00000 n 0000531735 00000 n 0000529903 00000 n 0000529994 00000 n 0000530085 00000 n 0000530176 00000 n 0000530268 00000 n 0000530360 00000 n 0000530452 00000 n 0000530544 00000 n 0000530636 00000 n 0000530728 00000 n 0000530820 00000 n 0000530912 00000 n 0000531004 00000 n 0000531096 00000 n 0000531188 00000 n 0000531280 00000 n 0000531372 00000 n 0000531464 00000 n 0000531556 00000 n 0000532102 00000 n 0000532267 00000 n 0000532567 00000 n 0000532410 00000 n 0000532922 00000 n 0000532838 00000 n 0000532743 00000 n 0000404687 00000 n 0000029497 00000 n 0000033753 00000 n 0000533054 00000 n 0000533207 00000 n 0000533371 00000 n 0000533535 00000 n 0000533699 00000 n 0000533863 00000 n 0000534871 00000 n 0000533958 00000 n 0000534049 00000 n 0000534140 00000 n 0000534232 00000 n 0000534324 00000 n 0000534416 00000 n 0000534508 00000 n 0000534600 00000 n 0000534692 00000 n 0000535129 00000 n 0000535294 00000 n 0000535459 00000 n 0000535624 00000 n 0000536635 00000 n 0000535720 00000 n 0000535812 00000 n 0000535904 00000 n 0000535996 00000 n 0000536088 00000 n 0000536180 00000 n 0000536272 00000 n 0000536364 00000 n 0000536456 00000 n 0000404857 00000 n 0000033776 00000 n 0000036147 00000 n 0000536877 00000 n 0000537041 00000 n 0000537205 00000 n 0000539757 00000 n 0000537569 00000 n 0000537484 00000 n 0000537387 00000 n 0000537920 00000 n 0000537835 00000 n 0000537738 00000 n 0000538271 00000 n 0000538186 00000 n 0000538089 00000 n 0000538622 00000 n 0000538537 00000 n 0000538440 00000 n 0000538973 00000 n 0000538888 00000 n 0000538791 00000 n 0000539324 00000 n 0000539239 00000 n 0000539142 00000 n 0000539675 00000 n 0000539590 00000 n 0000539493 00000 n 0000539953 00000 n 0000405027 00000 n 0000036170 00000 n 0000040236 00000 n 0000540100 00000 n 0000540253 00000 n 0000540417 00000 n 0000540581 00000 n 0000542968 00000 n 0000540676 00000 n 0000540767 00000 n 0000540858 00000 n 0000540949 00000 n 0000541041 00000 n 0000541133 00000 n 0000541225 00000 n 0000541317 00000 n 0000541409 00000 n 0000541501 00000 n 0000541593 00000 n 0000541685 00000 n 0000541777 00000 n 0000541869 00000 n 0000541961 00000 n 0000542053 00000 n 0000542145 00000 n 0000542237 00000 n 0000542329 00000 n 0000542421 00000 n 0000542513 00000 n 0000542605 00000 n 0000542697 00000 n 0000542789 00000 n 0000543525 00000 n 0000543368 00000 n 0000543701 00000 n 0000543866 00000 n 0000544031 00000 n 0000544196 00000 n 0000405217 00000 n 0000040259 00000 n 0000041735 00000 n 0000544361 00000 n 0000544521 00000 n 0000544685 00000 n 0000544983 00000 n 0000544827 00000 n 0000545291 00000 n 0000545135 00000 n 0000405416 00000 n 0000041758 00000 n 0000045131 00000 n 0000545447 00000 n 0000545600 00000 n 0000545873 00000 n 0000545695 00000 n 0000546043 00000 n 0000547143 00000 n 0000546138 00000 n 0000546229 00000 n 0000546320 00000 n 0000546412 00000 n 0000546504 00000 n 0000546596 00000 n 0000546688 00000 n 0000546780 00000 n 0000546872 00000 n 0000546964 00000 n 0000547412 00000 n 0000547577 00000 n 0000549324 00000 n 0000547673 00000 n 0000547765 00000 n 0000547857 00000 n 0000547949 00000 n 0000548041 00000 n 0000548133 00000 n 0000548225 00000 n 0000548317 00000 n 0000548409 00000 n 0000548501 00000 n 0000548593 00000 n 0000548685 00000 n 0000548777 00000 n 0000548869 00000 n 0000548961 00000 n 0000549053 00000 n 0000549145 00000 n 0000549672 00000 n 0000549855 00000 n 0000550016 00000 n 0000405586 00000 n 0000045154 00000 n 0000048182 00000 n 0000550163 00000 n 0000550316 00000 n 0000552702 00000 n 0000550411 00000 n 0000550502 00000 n 0000550593 00000 n 0000550684 00000 n 0000550775 00000 n 0000550867 00000 n 0000550959 00000 n 0000551051 00000 n 0000551143 00000 n 0000551235 00000 n 0000551327 00000 n 0000551419 00000 n 0000551511 00000 n 0000551603 00000 n 0000551695 00000 n 0000551787 00000 n 0000551879 00000 n 0000551971 00000 n 0000552063 00000 n 0000552155 00000 n 0000552247 00000 n 0000552339 00000 n 0000552431 00000 n 0000552523 00000 n 0000553123 00000 n 0000553288 00000 n 0000553453 00000 n 0000553618 00000 n 0000405756 00000 n 0000048205 00000 n 0000051832 00000 n 0000553765 00000 n 0000553918 00000 n 0000556764 00000 n 0000554013 00000 n 0000554104 00000 n 0000554195 00000 n 0000554286 00000 n 0000554377 00000 n 0000554469 00000 n 0000554561 00000 n 0000554653 00000 n 0000554745 00000 n 0000554837 00000 n 0000554929 00000 n 0000555021 00000 n 0000555113 00000 n 0000555205 00000 n 0000555297 00000 n 0000555389 00000 n 0000555481 00000 n 0000555573 00000 n 0000555665 00000 n 0000555757 00000 n 0000555849 00000 n 0000555941 00000 n 0000556033 00000 n 0000556125 00000 n 0000556217 00000 n 0000556309 00000 n 0000556401 00000 n 0000556493 00000 n 0000556585 00000 n 0000557240 00000 n 0000557405 00000 n 0000557570 00000 n 0000405926 00000 n 0000051855 00000 n 0000055059 00000 n 0000557733 00000 n 0000557888 00000 n 0000559036 00000 n 0000558252 00000 n 0000558167 00000 n 0000558070 00000 n 0000558603 00000 n 0000558518 00000 n 0000558421 00000 n 0000558954 00000 n 0000558869 00000 n 0000558772 00000 n 0000559200 00000 n 0000561755 00000 n 0000559564 00000 n 0000559479 00000 n 0000559382 00000 n 0000559915 00000 n 0000559830 00000 n 0000559733 00000 n 0000560266 00000 n 0000560181 00000 n 0000560084 00000 n 0000560617 00000 n 0000560532 00000 n 0000560435 00000 n 0000560969 00000 n 0000560884 00000 n 0000560786 00000 n 0000561321 00000 n 0000561236 00000 n 0000561138 00000 n 0000561673 00000 n 0000561588 00000 n 0000561490 00000 n 0000406096 00000 n 0000055082 00000 n 0000058577 00000 n 0000561933 00000 n 0000562086 00000 n 0000562250 00000 n 0000581461 00000 n 0000563348 00000 n 0000562621 00000 n 0000562396 00000 n 0000563182 00000 n 0000562779 00000 n 0000562962 00000 n 0000564623 00000 n 0000563724 00000 n 0000563501 00000 n 0000564449 00000 n 0000563882 00000 n 0000564048 00000 n 0000564231 00000 n 0000566052 00000 n 0000565002 00000 n 0000564776 00000 n 0000565878 00000 n 0000565160 00000 n 0000565462 00000 n 0000565305 00000 n 0000565657 00000 n 0000575620 00000 n 0000566429 00000 n 0000566205 00000 n 0000575454 00000 n 0000566587 00000 n 0000575172 00000 n 0000567514 00000 n 0000566961 00000 n 0000566736 00000 n 0000567356 00000 n 0000567136 00000 n 0000568445 00000 n 0000567892 00000 n 0000567667 00000 n 0000568287 00000 n 0000568067 00000 n 0000569376 00000 n 0000568823 00000 n 0000568598 00000 n 0000569218 00000 n 0000568998 00000 n 0000570307 00000 n 0000569754 00000 n 0000569529 00000 n 0000570149 00000 n 0000569929 00000 n 0000571238 00000 n 0000570685 00000 n 0000570460 00000 n 0000571080 00000 n 0000570860 00000 n 0000572169 00000 n 0000571616 00000 n 0000571391 00000 n 0000572011 00000 n 0000571791 00000 n 0000573100 00000 n 0000572547 00000 n 0000572322 00000 n 0000572942 00000 n 0000572722 00000 n 0000574047 00000 n 0000573478 00000 n 0000573253 00000 n 0000573889 00000 n 0000573636 00000 n 0000582019 00000 n 0000581935 00000 n 0000581829 00000 n 0000581659 00000 n 0000406295 00000 n 0000058600 00000 n 0000062997 00000 n 0000574976 00000 n 0000574424 00000 n 0000574200 00000 n 0000574818 00000 n 0000574599 00000 n 0000576725 00000 n 0000575998 00000 n 0000575773 00000 n 0000576559 00000 n 0000576156 00000 n 0000576339 00000 n 0000578350 00000 n 0000577101 00000 n 0000576878 00000 n 0000578160 00000 n 0000577259 00000 n 0000577425 00000 n 0000577591 00000 n 0000577757 00000 n 0000577941 00000 n 0000579808 00000 n 0000578729 00000 n 0000578503 00000 n 0000579626 00000 n 0000578887 00000 n 0000579054 00000 n 0000579221 00000 n 0000579405 00000 n 0000581264 00000 n 0000580186 00000 n 0000579961 00000 n 0000581090 00000 n 0000580344 00000 n 0000406465 00000 n 0000063020 00000 n 0000066632 00000 n 0000580678 00000 n 0000580522 00000 n 0000580871 00000 n 0000582151 00000 n 0000582315 00000 n 0000582468 00000 n 0000585669 00000 n 0000582832 00000 n 0000582747 00000 n 0000582650 00000 n 0000583329 00000 n 0000583244 00000 n 0000583136 00000 n 0000582961 00000 n 0000583827 00000 n 0000583742 00000 n 0000583633 00000 n 0000583458 00000 n 0000584179 00000 n 0000584094 00000 n 0000583996 00000 n 0000584531 00000 n 0000584446 00000 n 0000584348 00000 n 0000584883 00000 n 0000584798 00000 n 0000584700 00000 n 0000585235 00000 n 0000585150 00000 n 0000585052 00000 n 0000585587 00000 n 0000585502 00000 n 0000585404 00000 n 0000585873 00000 n 0000587729 00000 n 0000586239 00000 n 0000586154 00000 n 0000586056 00000 n 0000586591 00000 n 0000586506 00000 n 0000586408 00000 n 0000586943 00000 n 0000586858 00000 n 0000586760 00000 n 0000587295 00000 n 0000587210 00000 n 0000587112 00000 n 0000587647 00000 n 0000587562 00000 n 0000587464 00000 n 0000406673 00000 n 0000066655 00000 n 0000070658 00000 n 0000587891 00000 n 0000588055 00000 n 0000588219 00000 n 0000588506 00000 n 0000588352 00000 n 0000588680 00000 n 0000588833 00000 n 0000588997 00000 n 0000590849 00000 n 0000589806 00000 n 0000589323 00000 n 0000589143 00000 n 0000589661 00000 n 0000589485 00000 n 0000590623 00000 n 0000590140 00000 n 0000589959 00000 n 0000590478 00000 n 0000590302 00000 n 0000591003 00000 n 0000591168 00000 n 0000591322 00000 n 0000591487 00000 n 0000594271 00000 n 0000592412 00000 n 0000591859 00000 n 0000591634 00000 n 0000592254 00000 n 0000592034 00000 n 0000594077 00000 n 0000592791 00000 n 0000592565 00000 n 0000593887 00000 n 0000592949 00000 n 0000593116 00000 n 0000593283 00000 n 0000593450 00000 n 0000594622 00000 n 0000594538 00000 n 0000594443 00000 n 0000406863 00000 n 0000070681 00000 n 0000073202 00000 n 0000593667 00000 n 0000594754 00000 n 0000594918 00000 n 0000595071 00000 n 0000595235 00000 n 0000596268 00000 n 0000596043 00000 n 0000595561 00000 n 0000595381 00000 n 0000595898 00000 n 0000595723 00000 n 0000596414 00000 n 0000596578 00000 n 0000596731 00000 n 0000596896 00000 n 0000597932 00000 n 0000597707 00000 n 0000597224 00000 n 0000597043 00000 n 0000597562 00000 n 0000597386 00000 n 0000598078 00000 n 0000598243 00000 n 0000598397 00000 n 0000598562 00000 n 0000601231 00000 n 0000599373 00000 n 0000598890 00000 n 0000598709 00000 n 0000599228 00000 n 0000599052 00000 n 0000600190 00000 n 0000599707 00000 n 0000599526 00000 n 0000600045 00000 n 0000599869 00000 n 0000601007 00000 n 0000600524 00000 n 0000600343 00000 n 0000600862 00000 n 0000600686 00000 n 0000601393 00000 n 0000601558 00000 n 0000601723 00000 n 0000601877 00000 n 0000407033 00000 n 0000073225 00000 n 0000076210 00000 n 0000602024 00000 n 0000603873 00000 n 0000602832 00000 n 0000602350 00000 n 0000602170 00000 n 0000602687 00000 n 0000602512 00000 n 0000603647 00000 n 0000603165 00000 n 0000602985 00000 n 0000603502 00000 n 0000603327 00000 n 0000604027 00000 n 0000604191 00000 n 0000604344 00000 n 0000604508 00000 n 0000606357 00000 n 0000605317 00000 n 0000604834 00000 n 0000604654 00000 n 0000605172 00000 n 0000604996 00000 n 0000606134 00000 n 0000605651 00000 n 0000605470 00000 n 0000605989 00000 n 0000605813 00000 n 0000606511 00000 n 0000606676 00000 n 0000606830 00000 n 0000606995 00000 n 0000608878 00000 n 0000607817 00000 n 0000607326 00000 n 0000607143 00000 n 0000607669 00000 n 0000607491 00000 n 0000608648 00000 n 0000608157 00000 n 0000607974 00000 n 0000608500 00000 n 0000608322 00000 n 0000609035 00000 n 0000609201 00000 n 0000609367 00000 n 0000609533 00000 n 0000609688 00000 n 0000609854 00000 n 0000611739 00000 n 0000610676 00000 n 0000610185 00000 n 0000610002 00000 n 0000610528 00000 n 0000610350 00000 n 0000611509 00000 n 0000611017 00000 n 0000610833 00000 n 0000611361 00000 n 0000611182 00000 n 0000407203 00000 n 0000076233 00000 n 0000079572 00000 n 0000611896 00000 n 0000612062 00000 n 0000612228 00000 n 0000612394 00000 n 0000612549 00000 n 0000612715 00000 n 0000612870 00000 n 0000613036 00000 n 0000613191 00000 n 0000613357 00000 n 0000614413 00000 n 0000614183 00000 n 0000613689 00000 n 0000613505 00000 n 0000614034 00000 n 0000613855 00000 n 0000614562 00000 n 0000614729 00000 n 0000614896 00000 n 0000615190 00000 n 0000615032 00000 n 0000615369 00000 n 0000616426 00000 n 0000616196 00000 n 0000615702 00000 n 0000615518 00000 n 0000616047 00000 n 0000615868 00000 n 0000616575 00000 n 0000616742 00000 n 0000616898 00000 n 0000617065 00000 n 0000619154 00000 n 0000618006 00000 n 0000617442 00000 n 0000617214 00000 n 0000617844 00000 n 0000617621 00000 n 0000407395 00000 n 0000079596 00000 n 0000081076 00000 n 0000618954 00000 n 0000618391 00000 n 0000618164 00000 n 0000618792 00000 n 0000618570 00000 n 0000619312 00000 n 0000619478 00000 n 0000619633 00000 n 0000619799 00000 n 0000621688 00000 n 0000620623 00000 n 0000620130 00000 n 0000619947 00000 n 0000620474 00000 n 0000620296 00000 n 0000621457 00000 n 0000620964 00000 n 0000620781 00000 n 0000621308 00000 n 0000621130 00000 n 0000621846 00000 n 0000622013 00000 n 0000622169 00000 n 0000622336 00000 n 0000623393 00000 n 0000623163 00000 n 0000622669 00000 n 0000622485 00000 n 0000623014 00000 n 0000622835 00000 n 0000623542 00000 n 0000407567 00000 n 0000081100 00000 n 0000085692 00000 n 0000623691 00000 n 0000623846 00000 n 0000624012 00000 n 0000624470 00000 n 0000624162 00000 n 0000624308 00000 n 0000624658 00000 n 0000624824 00000 n 0000630919 00000 n 0000625943 00000 n 0000625200 00000 n 0000624972 00000 n 0000625772 00000 n 0000625362 00000 n 0000625549 00000 n 0000627253 00000 n 0000626330 00000 n 0000626101 00000 n 0000627073 00000 n 0000626492 00000 n 0000626662 00000 n 0000626849 00000 n 0000628563 00000 n 0000627640 00000 n 0000627411 00000 n 0000628383 00000 n 0000627802 00000 n 0000627972 00000 n 0000628159 00000 n 0000630718 00000 n 0000628950 00000 n 0000628721 00000 n 0000630520 00000 n 0000629397 00000 n 0000629114 00000 n 0000629255 00000 n 0000407759 00000 n 0000085716 00000 n 0000089298 00000 n 0000629625 00000 n 0000629794 00000 n 0000630100 00000 n 0000629941 00000 n 0000630297 00000 n 0000631232 00000 n 0000631091 00000 n 0000631409 00000 n 0000631576 00000 n 0000631761 00000 n 0000631948 00000 n 0000632135 00000 n 0000632322 00000 n 0000632498 00000 n 0000632683 00000 n 0000632870 00000 n 0000633057 00000 n 0000633244 00000 n 0000633420 00000 n 0000633605 00000 n 0000633792 00000 n 0000633979 00000 n 0000634166 00000 n 0000634528 00000 n 0000634440 00000 n 0000634342 00000 n 0000407960 00000 n 0000089322 00000 n 0000093253 00000 n 0000634663 00000 n 0000634818 00000 n 0000637203 00000 n 0000635879 00000 n 0000635772 00000 n 0000635002 00000 n 0000635463 00000 n 0000635149 00000 n 0000635286 00000 n 0000635672 00000 n 0000636391 00000 n 0000636302 00000 n 0000636190 00000 n 0000636012 00000 n 0000636754 00000 n 0000636665 00000 n 0000636564 00000 n 0000637117 00000 n 0000637028 00000 n 0000636927 00000 n 0000637381 00000 n 0000637537 00000 n 0000637704 00000 n 0000640298 00000 n 0000638276 00000 n 0000638178 00000 n 0000637889 00000 n 0000638077 00000 n 0000638639 00000 n 0000638550 00000 n 0000638449 00000 n 0000639152 00000 n 0000639063 00000 n 0000638950 00000 n 0000638772 00000 n 0000639665 00000 n 0000639576 00000 n 0000639463 00000 n 0000639285 00000 n 0000640212 00000 n 0000640123 00000 n 0000639976 00000 n 0000639798 00000 n 0000408197 00000 n 0000093277 00000 n 0000097209 00000 n 0000640485 00000 n 0000640777 00000 n 0000640620 00000 n 0000640954 00000 n 0000641109 00000 n 0000641275 00000 n 0000641441 00000 n 0000644171 00000 n 0000642266 00000 n 0000641772 00000 n 0000641589 00000 n 0000642117 00000 n 0000641938 00000 n 0000643102 00000 n 0000642608 00000 n 0000642424 00000 n 0000642953 00000 n 0000642774 00000 n 0000643940 00000 n 0000643445 00000 n 0000643260 00000 n 0000643791 00000 n 0000643611 00000 n 0000644338 00000 n 0000644505 00000 n 0000644672 00000 n 0000644828 00000 n 0000644995 00000 n 0000647103 00000 n 0000645936 00000 n 0000645372 00000 n 0000645144 00000 n 0000645774 00000 n 0000645551 00000 n 0000646903 00000 n 0000646322 00000 n 0000646094 00000 n 0000646741 00000 n 0000646484 00000 n 0000408389 00000 n 0000097233 00000 n 0000100714 00000 n 0000647261 00000 n 0000647427 00000 n 0000647593 00000 n 0000647748 00000 n 0000647914 00000 n 0000648080 00000 n 0000648235 00000 n 0000651798 00000 n 0000649059 00000 n 0000648566 00000 n 0000648383 00000 n 0000648910 00000 n 0000648732 00000 n 0000649895 00000 n 0000649401 00000 n 0000649217 00000 n 0000649746 00000 n 0000649567 00000 n 0000650731 00000 n 0000650237 00000 n 0000650053 00000 n 0000650582 00000 n 0000650403 00000 n 0000651567 00000 n 0000651073 00000 n 0000650889 00000 n 0000651418 00000 n 0000651239 00000 n 0000652112 00000 n 0000651970 00000 n 0000652732 00000 n 0000652275 00000 n 0000652422 00000 n 0000652569 00000 n 0000652935 00000 n 0000653102 00000 n 0000653258 00000 n 0000653425 00000 n 0000653581 00000 n 0000408581 00000 n 0000100738 00000 n 0000104109 00000 n 0000653730 00000 n 0000653885 00000 n 0000654051 00000 n 0000654206 00000 n 0000654372 00000 n 0000654527 00000 n 0000654693 00000 n 0000654848 00000 n 0000655014 00000 n 0000655180 00000 n 0000655335 00000 n 0000655502 00000 n 0000655658 00000 n 0000655825 00000 n 0000655981 00000 n 0000656148 00000 n 0000656315 00000 n 0000656471 00000 n 0000656638 00000 n 0000408753 00000 n 0000104133 00000 n 0000107419 00000 n 0000656933 00000 n 0000656789 00000 n 0000657110 00000 n 0000657265 00000 n 0000657577 00000 n 0000657415 00000 n 0000657754 00000 n 0000657909 00000 n 0000658075 00000 n 0000658231 00000 n 0000658398 00000 n 0000658712 00000 n 0000658549 00000 n 0000658891 00000 n 0000659047 00000 n 0000659214 00000 n 0000659370 00000 n 0000659537 00000 n 0000659704 00000 n 0000660018 00000 n 0000659855 00000 n 0000660197 00000 n 0000660353 00000 n 0000408925 00000 n 0000107443 00000 n 0000110463 00000 n 0000660502 00000 n 0000660657 00000 n 0000660823 00000 n 0000660978 00000 n 0000661144 00000 n 0000661299 00000 n 0000661465 00000 n 0000661620 00000 n 0000661786 00000 n 0000661941 00000 n 0000662107 00000 n 0000662263 00000 n 0000662430 00000 n 0000662597 00000 n 0000662753 00000 n 0000662920 00000 n 0000663087 00000 n 0000663243 00000 n 0000409097 00000 n 0000110487 00000 n 0000114925 00000 n 0000663529 00000 n 0000663388 00000 n 0000663706 00000 n 0000663861 00000 n 0000664027 00000 n 0000664182 00000 n 0000664348 00000 n 0000664503 00000 n 0000664669 00000 n 0000664835 00000 n 0000665287 00000 n 0000664986 00000 n 0000665127 00000 n 0000665478 00000 n 0000665772 00000 n 0000665614 00000 n 0000665951 00000 n 0000666118 00000 n 0000666285 00000 n 0000666452 00000 n 0000666619 00000 n 0000667261 00000 n 0000666918 00000 n 0000666820 00000 n 0000667173 00000 n 0000667075 00000 n 0000409307 00000 n 0000114949 00000 n 0000118875 00000 n 0000667423 00000 n 0000667578 00000 n 0000667744 00000 n 0000667928 00000 n 0000668103 00000 n 0000668269 00000 n 0000668435 00000 n 0000668590 00000 n 0000668756 00000 n 0000668922 00000 n 0000669216 00000 n 0000669058 00000 n 0000669395 00000 n 0000669562 00000 n 0000669729 00000 n 0000669896 00000 n 0000670063 00000 n 0000670219 00000 n 0000409499 00000 n 0000118899 00000 n 0000122378 00000 n 0000670420 00000 n 0000670586 00000 n 0000670752 00000 n 0000670907 00000 n 0000671073 00000 n 0000671239 00000 n 0000671531 00000 n 0000671374 00000 n 0000671708 00000 n 0000671864 00000 n 0000672031 00000 n 0000672198 00000 n 0000672354 00000 n 0000672521 00000 n 0000672677 00000 n 0000673030 00000 n 0000672942 00000 n 0000672844 00000 n 0000409691 00000 n 0000122402 00000 n 0000125697 00000 n 0000673165 00000 n 0000673320 00000 n 0000673486 00000 n 0000673652 00000 n 0000673807 00000 n 0000673973 00000 n 0000674139 00000 n 0000674294 00000 n 0000674460 00000 n 0000674615 00000 n 0000674781 00000 n 0000674937 00000 n 0000676831 00000 n 0000675764 00000 n 0000675270 00000 n 0000675086 00000 n 0000675615 00000 n 0000675436 00000 n 0000676600 00000 n 0000676106 00000 n 0000675922 00000 n 0000676451 00000 n 0000676272 00000 n 0000676989 00000 n 0000677156 00000 n 0000677312 00000 n 0000678369 00000 n 0000678139 00000 n 0000677645 00000 n 0000677461 00000 n 0000677990 00000 n 0000677811 00000 n 0000678518 00000 n 0000678685 00000 n 0000678841 00000 n 0000409863 00000 n 0000125721 00000 n 0000128492 00000 n 0000678990 00000 n 0000680879 00000 n 0000679814 00000 n 0000679321 00000 n 0000679138 00000 n 0000679665 00000 n 0000679487 00000 n 0000680648 00000 n 0000680155 00000 n 0000679972 00000 n 0000680499 00000 n 0000680321 00000 n 0000681037 00000 n 0000681203 00000 n 0000681358 00000 n 0000681524 00000 n 0000681690 00000 n 0000681845 00000 n 0000682012 00000 n 0000682179 00000 n 0000682335 00000 n 0000682502 00000 n 0000683559 00000 n 0000683329 00000 n 0000682835 00000 n 0000682651 00000 n 0000683180 00000 n 0000683001 00000 n 0000683708 00000 n 0000683875 00000 n 0000684031 00000 n 0000685925 00000 n 0000684858 00000 n 0000684364 00000 n 0000684180 00000 n 0000684709 00000 n 0000684530 00000 n 0000685694 00000 n 0000685200 00000 n 0000685016 00000 n 0000685545 00000 n 0000685366 00000 n 0000686083 00000 n 0000410035 00000 n 0000128516 00000 n 0000131254 00000 n 0000686232 00000 n 0000686387 00000 n 0000688276 00000 n 0000687211 00000 n 0000686718 00000 n 0000686535 00000 n 0000687062 00000 n 0000686884 00000 n 0000688045 00000 n 0000687552 00000 n 0000687369 00000 n 0000687896 00000 n 0000687718 00000 n 0000688434 00000 n 0000688600 00000 n 0000688755 00000 n 0000690647 00000 n 0000689580 00000 n 0000689086 00000 n 0000688903 00000 n 0000689431 00000 n 0000689252 00000 n 0000690416 00000 n 0000689922 00000 n 0000689738 00000 n 0000690267 00000 n 0000690088 00000 n 0000690805 00000 n 0000690972 00000 n 0000691128 00000 n 0000691295 00000 n 0000692352 00000 n 0000692122 00000 n 0000691628 00000 n 0000691444 00000 n 0000691973 00000 n 0000691794 00000 n 0000692501 00000 n 0000692668 00000 n 0000692824 00000 n 0000692991 00000 n 0000694048 00000 n 0000693818 00000 n 0000693324 00000 n 0000693140 00000 n 0000693669 00000 n 0000693490 00000 n 0000694197 00000 n 0000694364 00000 n 0000694520 00000 n 0000694687 00000 n 0000695744 00000 n 0000695514 00000 n 0000695020 00000 n 0000694836 00000 n 0000695365 00000 n 0000695186 00000 n 0000695893 00000 n 0000410207 00000 n 0000131278 00000 n 0000133405 00000 n 0000696042 00000 n 0000696197 00000 n 0000696363 00000 n 0000697417 00000 n 0000697187 00000 n 0000696694 00000 n 0000696511 00000 n 0000697038 00000 n 0000696860 00000 n 0000697566 00000 n 0000697732 00000 n 0000697887 00000 n 0000698053 00000 n 0000699108 00000 n 0000698878 00000 n 0000698384 00000 n 0000698201 00000 n 0000698729 00000 n 0000698550 00000 n 0000699257 00000 n 0000699424 00000 n 0000699580 00000 n 0000699747 00000 n 0000701641 00000 n 0000700574 00000 n 0000700080 00000 n 0000699896 00000 n 0000700425 00000 n 0000700246 00000 n 0000701410 00000 n 0000700916 00000 n 0000700732 00000 n 0000701261 00000 n 0000701082 00000 n 0000701799 00000 n 0000701966 00000 n 0000702122 00000 n 0000702289 00000 n 0000703342 00000 n 0000703116 00000 n 0000702622 00000 n 0000702438 00000 n 0000702967 00000 n 0000702788 00000 n 0000703491 00000 n 0000703658 00000 n 0000703814 00000 n 0000703981 00000 n 0000705038 00000 n 0000704808 00000 n 0000704314 00000 n 0000704130 00000 n 0000704659 00000 n 0000704480 00000 n 0000705187 00000 n 0000410379 00000 n 0000133429 00000 n 0000136135 00000 n 0000705388 00000 n 0000705680 00000 n 0000705523 00000 n 0000705857 00000 n 0000706911 00000 n 0000706681 00000 n 0000706188 00000 n 0000706005 00000 n 0000706532 00000 n 0000706354 00000 n 0000707060 00000 n 0000707226 00000 n 0000707528 00000 n 0000707367 00000 n 0000707707 00000 n 0000709599 00000 n 0000708534 00000 n 0000708040 00000 n 0000707856 00000 n 0000708385 00000 n 0000708206 00000 n 0000709370 00000 n 0000708876 00000 n 0000708692 00000 n 0000709221 00000 n 0000709042 00000 n 0000709757 00000 n 0000709924 00000 n 0000710080 00000 n 0000710247 00000 n 0000711304 00000 n 0000711074 00000 n 0000710580 00000 n 0000710396 00000 n 0000710925 00000 n 0000710746 00000 n 0000711453 00000 n 0000711620 00000 n 0000711776 00000 n 0000711943 00000 n 0000712099 00000 n 0000712404 00000 n 0000712244 00000 n 0000712583 00000 n 0000410580 00000 n 0000136159 00000 n 0000139331 00000 n 0000712732 00000 n 0000712887 00000 n 0000715610 00000 n 0000713711 00000 n 0000713218 00000 n 0000713035 00000 n 0000713562 00000 n 0000713384 00000 n 0000714545 00000 n 0000714052 00000 n 0000713869 00000 n 0000714396 00000 n 0000714218 00000 n 0000715379 00000 n 0000714886 00000 n 0000714703 00000 n 0000715230 00000 n 0000715052 00000 n 0000715777 00000 n 0000715943 00000 n 0000716109 00000 n 0000716265 00000 n 0000718158 00000 n 0000717092 00000 n 0000716598 00000 n 0000716414 00000 n 0000716943 00000 n 0000716764 00000 n 0000717928 00000 n 0000717434 00000 n 0000717250 00000 n 0000717779 00000 n 0000717600 00000 n 0000718316 00000 n 0000718483 00000 n 0000718650 00000 n 0000718806 00000 n 0000720699 00000 n 0000719633 00000 n 0000719139 00000 n 0000718955 00000 n 0000719484 00000 n 0000719305 00000 n 0000720469 00000 n 0000719975 00000 n 0000719791 00000 n 0000720320 00000 n 0000720141 00000 n 0000720857 00000 n 0000721024 00000 n 0000721191 00000 n 0000721485 00000 n 0000721327 00000 n 0000721664 00000 n 0000722721 00000 n 0000722491 00000 n 0000721997 00000 n 0000721813 00000 n 0000722342 00000 n 0000722163 00000 n 0000410772 00000 n 0000139355 00000 n 0000140735 00000 n 0000722870 00000 n 0000723036 00000 n 0000723191 00000 n 0000723375 00000 n 0000723537 00000 n 0000723703 00000 n 0000723858 00000 n 0000724024 00000 n 0000725074 00000 n 0000724848 00000 n 0000724355 00000 n 0000724172 00000 n 0000724699 00000 n 0000724521 00000 n 0000725223 00000 n 0000410944 00000 n 0000140759 00000 n 0000144917 00000 n 0000725372 00000 n 0000725527 00000 n 0000725861 00000 n 0000725671 00000 n 0000726306 00000 n 0000726010 00000 n 0000726147 00000 n 0000726494 00000 n 0000726660 00000 n 0000727865 00000 n 0000727637 00000 n 0000726993 00000 n 0000726809 00000 n 0000727488 00000 n 0000727297 00000 n 0000727138 00000 n 0000728152 00000 n 0000728010 00000 n 0000728331 00000 n 0000728498 00000 n 0000728665 00000 n 0000728821 00000 n 0000728988 00000 n 0000729155 00000 n 0000730012 00000 n 0000729564 00000 n 0000729475 00000 n 0000729340 00000 n 0000730521 00000 n 0000730433 00000 n 0000730323 00000 n 0000730150 00000 n 0000411181 00000 n 0000144941 00000 n 0000148687 00000 n 0000729926 00000 n 0000729837 00000 n 0000729737 00000 n 0000730674 00000 n 0000730840 00000 n 0000730995 00000 n 0000731161 00000 n 0000731327 00000 n 0000731482 00000 n 0000731648 00000 n 0000734524 00000 n 0000732473 00000 n 0000731979 00000 n 0000731796 00000 n 0000732324 00000 n 0000732145 00000 n 0000733309 00000 n 0000732815 00000 n 0000732631 00000 n 0000733160 00000 n 0000732981 00000 n 0000734295 00000 n 0000733651 00000 n 0000733467 00000 n 0000734146 00000 n 0000733955 00000 n 0000733796 00000 n 0000734691 00000 n 0000734858 00000 n 0000735025 00000 n 0000735181 00000 n 0000735348 00000 n 0000737437 00000 n 0000736289 00000 n 0000735725 00000 n 0000735497 00000 n 0000736127 00000 n 0000735904 00000 n 0000411373 00000 n 0000148711 00000 n 0000151786 00000 n 0000737237 00000 n 0000736674 00000 n 0000736447 00000 n 0000737075 00000 n 0000736853 00000 n 0000737595 00000 n 0000737761 00000 n 0000737916 00000 n 0000738082 00000 n 0000738248 00000 n 0000738403 00000 n 0000738569 00000 n 0000741293 00000 n 0000739394 00000 n 0000738900 00000 n 0000738717 00000 n 0000739245 00000 n 0000739066 00000 n 0000740230 00000 n 0000739736 00000 n 0000739552 00000 n 0000740081 00000 n 0000739902 00000 n 0000741066 00000 n 0000740572 00000 n 0000740388 00000 n 0000740917 00000 n 0000740738 00000 n 0000741460 00000 n 0000741765 00000 n 0000741605 00000 n 0000741944 00000 n 0000742100 00000 n 0000742267 00000 n 0000744161 00000 n 0000743094 00000 n 0000742600 00000 n 0000742416 00000 n 0000742945 00000 n 0000742766 00000 n 0000743930 00000 n 0000743436 00000 n 0000743252 00000 n 0000743781 00000 n 0000743602 00000 n 0000744319 00000 n 0000744486 00000 n 0000744642 00000 n 0000411565 00000 n 0000151810 00000 n 0000153138 00000 n 0000744791 00000 n 0000746680 00000 n 0000745615 00000 n 0000745122 00000 n 0000744939 00000 n 0000745466 00000 n 0000745288 00000 n 0000746449 00000 n 0000745956 00000 n 0000745773 00000 n 0000746300 00000 n 0000746122 00000 n 0000746838 00000 n 0000747004 00000 n 0000747159 00000 n 0000747325 00000 n 0000748380 00000 n 0000748150 00000 n 0000747656 00000 n 0000747473 00000 n 0000748001 00000 n 0000747822 00000 n 0000748529 00000 n 0000411737 00000 n 0000153162 00000 n 0000157400 00000 n 0000748678 00000 n 0000748833 00000 n 0000749136 00000 n 0000748977 00000 n 0000749313 00000 n 0000749479 00000 n 0000751388 00000 n 0000749852 00000 n 0000749763 00000 n 0000749663 00000 n 0000750214 00000 n 0000750125 00000 n 0000750025 00000 n 0000750576 00000 n 0000750487 00000 n 0000750387 00000 n 0000750939 00000 n 0000750850 00000 n 0000750749 00000 n 0000751302 00000 n 0000751213 00000 n 0000751112 00000 n 0000751575 00000 n 0000751880 00000 n 0000751720 00000 n 0000752059 00000 n 0000752226 00000 n 0000752393 00000 n 0000753601 00000 n 0000753372 00000 n 0000752727 00000 n 0000752542 00000 n 0000753223 00000 n 0000753031 00000 n 0000752872 00000 n 0000754372 00000 n 0000753866 00000 n 0000753768 00000 n 0000754284 00000 n 0000754174 00000 n 0000754001 00000 n 0000411956 00000 n 0000157424 00000 n 0000161716 00000 n 0000754653 00000 n 0000754512 00000 n 0000754967 00000 n 0000754808 00000 n 0000755281 00000 n 0000755122 00000 n 0000755458 00000 n 0000755751 00000 n 0000755593 00000 n 0000755930 00000 n 0000757267 00000 n 0000756305 00000 n 0000756216 00000 n 0000756115 00000 n 0000756668 00000 n 0000756579 00000 n 0000756478 00000 n 0000757181 00000 n 0000757092 00000 n 0000756979 00000 n 0000756801 00000 n 0000757436 00000 n 0000757592 00000 n 0000757897 00000 n 0000757737 00000 n 0000758076 00000 n 0000761096 00000 n 0000759000 00000 n 0000758453 00000 n 0000758225 00000 n 0000758838 00000 n 0000758615 00000 n 0000762395 00000 n 0000761379 00000 n 0000761281 00000 n 0000761634 00000 n 0000761536 00000 n 0000761889 00000 n 0000761791 00000 n 0000762307 00000 n 0000762197 00000 n 0000762024 00000 n 0000412202 00000 n 0000161740 00000 n 0000165172 00000 n 0000759948 00000 n 0000759385 00000 n 0000759158 00000 n 0000759786 00000 n 0000759564 00000 n 0000760896 00000 n 0000760333 00000 n 0000760106 00000 n 0000760734 00000 n 0000760512 00000 n 0000762694 00000 n 0000762553 00000 n 0000763008 00000 n 0000762849 00000 n 0000763185 00000 n 0000763352 00000 n 0000763508 00000 n 0000763675 00000 n 0000763831 00000 n 0000763998 00000 n 0000764154 00000 n 0000764321 00000 n 0000764488 00000 n 0000764644 00000 n 0000764811 00000 n 0000764967 00000 n 0000765134 00000 n 0000765290 00000 n 0000765643 00000 n 0000765555 00000 n 0000765457 00000 n 0000412403 00000 n 0000165196 00000 n 0000167948 00000 n 0000765778 00000 n 0000765933 00000 n 0000766099 00000 n 0000766265 00000 n 0000766420 00000 n 0000766586 00000 n 0000766741 00000 n 0000766907 00000 n 0000767062 00000 n 0000767228 00000 n 0000767383 00000 n 0000767550 00000 n 0000767706 00000 n 0000767873 00000 n 0000768029 00000 n 0000768196 00000 n 0000768352 00000 n 0000768519 00000 n 0000768675 00000 n 0000768842 00000 n 0000768998 00000 n 0000412575 00000 n 0000167972 00000 n 0000171522 00000 n 0000769147 00000 n 0000769302 00000 n 0000769468 00000 n 0000769623 00000 n 0000769789 00000 n 0000769944 00000 n 0000770110 00000 n 0000770276 00000 n 0000770442 00000 n 0000770608 00000 n 0000770774 00000 n 0000770941 00000 n 0000771097 00000 n 0000771264 00000 n 0000771558 00000 n 0000771400 00000 n 0000771737 00000 n 0000771904 00000 n 0000772071 00000 n 0000772227 00000 n 0000772394 00000 n 0000772698 00000 n 0000412767 00000 n 0000171546 00000 n 0000175181 00000 n 0000772539 00000 n 0000772942 00000 n 0000773108 00000 n 0000773274 00000 n 0000773440 00000 n 0000773595 00000 n 0000773761 00000 n 0000774065 00000 n 0000773905 00000 n 0000774243 00000 n 0000774410 00000 n 0000774577 00000 n 0000774744 00000 n 0000774900 00000 n 0000775067 00000 n 0000775234 00000 n 0000775401 00000 n 0000775568 00000 n 0000775724 00000 n 0000775891 00000 n 0000776047 00000 n 0000412968 00000 n 0000175205 00000 n 0000178068 00000 n 0000776248 00000 n 0000776414 00000 n 0000776569 00000 n 0000776735 00000 n 0000776901 00000 n 0000777067 00000 n 0000777222 00000 n 0000777388 00000 n 0000777554 00000 n 0000777709 00000 n 0000777876 00000 n 0000778043 00000 n 0000778199 00000 n 0000778366 00000 n 0000778522 00000 n 0000778689 00000 n 0000778845 00000 n 0000779012 00000 n 0000779168 00000 n 0000413140 00000 n 0000178092 00000 n 0000179962 00000 n 0000779317 00000 n 0000779472 00000 n 0000779638 00000 n 0000779793 00000 n 0000779959 00000 n 0000780114 00000 n 0000780280 00000 n 0000780435 00000 n 0000780601 00000 n 0000780756 00000 n 0000780922 00000 n 0000781078 00000 n 0000781245 00000 n 0000781401 00000 n 0000781568 00000 n 0000781724 00000 n 0000781891 00000 n 0000782194 00000 n 0000782033 00000 n 0000782373 00000 n 0000782529 00000 n 0000413312 00000 n 0000179986 00000 n 0000182846 00000 n 0000782678 00000 n 0000782833 00000 n 0000782999 00000 n 0000783165 00000 n 0000783320 00000 n 0000783486 00000 n 0000783652 00000 n 0000783807 00000 n 0000783973 00000 n 0000784128 00000 n 0000784294 00000 n 0000784461 00000 n 0000784617 00000 n 0000784784 00000 n 0000784940 00000 n 0000785107 00000 n 0000785263 00000 n 0000785430 00000 n 0000785586 00000 n 0000413484 00000 n 0000182870 00000 n 0000186561 00000 n 0000785735 00000 n 0000785890 00000 n 0000786056 00000 n 0000786348 00000 n 0000786191 00000 n 0000786525 00000 n 0000786691 00000 n 0000786846 00000 n 0000787012 00000 n 0000787178 00000 n 0000787334 00000 n 0000787501 00000 n 0000787795 00000 n 0000787637 00000 n 0000787974 00000 n 0000788130 00000 n 0000788297 00000 n 0000788464 00000 n 0000788620 00000 n 0000788973 00000 n 0000788885 00000 n 0000788787 00000 n 0000413685 00000 n 0000186585 00000 n 0000190420 00000 n 0000789108 00000 n 0000789263 00000 n 0000789429 00000 n 0000789595 00000 n 0000789750 00000 n 0000789916 00000 n 0000790071 00000 n 0000790237 00000 n 0000790403 00000 n 0000790558 00000 n 0000790724 00000 n 0000791027 00000 n 0000790866 00000 n 0000791206 00000 n 0000791362 00000 n 0000791529 00000 n 0000791696 00000 n 0000791863 00000 n 0000413857 00000 n 0000190444 00000 n 0000193990 00000 n 0000792012 00000 n 0000792304 00000 n 0000792147 00000 n 0000792481 00000 n 0000792647 00000 n 0000792813 00000 n 0000792968 00000 n 0000793134 00000 n 0000793300 00000 n 0000793455 00000 n 0000793622 00000 n 0000793789 00000 n 0000793956 00000 n 0000794112 00000 n 0000794279 00000 n 0000794435 00000 n 0000794602 00000 n 0000794769 00000 n 0000794925 00000 n 0000795092 00000 n 0000795445 00000 n 0000795357 00000 n 0000795259 00000 n 0000414049 00000 n 0000194014 00000 n 0000197428 00000 n 0000795580 00000 n 0000795735 00000 n 0000795901 00000 n 0000796067 00000 n 0000796222 00000 n 0000796388 00000 n 0000796543 00000 n 0000796709 00000 n 0000796875 00000 n 0000797030 00000 n 0000797196 00000 n 0000797363 00000 n 0000797657 00000 n 0000797499 00000 n 0000797836 00000 n 0000798003 00000 n 0000798170 00000 n 0000798326 00000 n 0000798493 00000 n 0000798660 00000 n 0000798827 00000 n 0000414241 00000 n 0000197452 00000 n 0000200783 00000 n 0000798976 00000 n 0000799131 00000 n 0000799297 00000 n 0000799463 00000 n 0000799629 00000 n 0000799795 00000 n 0000799950 00000 n 0000800116 00000 n 0000800282 00000 n 0000800448 00000 n 0000800603 00000 n 0000800770 00000 n 0000800926 00000 n 0000801093 00000 n 0000801260 00000 n 0000801416 00000 n 0000801583 00000 n 0000801750 00000 n 0000801906 00000 n 0000802073 00000 n 0000414413 00000 n 0000200807 00000 n 0000201463 00000 n 0000802222 00000 n 0000802377 00000 n 0000802543 00000 n 0000414585 00000 n 0000201486 00000 n 0000204888 00000 n 0000802691 00000 n 0000802846 00000 n 0000803012 00000 n 0000808386 00000 n 0000803835 00000 n 0000803342 00000 n 0000803160 00000 n 0000803686 00000 n 0000803508 00000 n 0000804668 00000 n 0000804175 00000 n 0000803993 00000 n 0000804519 00000 n 0000804341 00000 n 0000805501 00000 n 0000805008 00000 n 0000804826 00000 n 0000805352 00000 n 0000805174 00000 n 0000806335 00000 n 0000805841 00000 n 0000805659 00000 n 0000806186 00000 n 0000806007 00000 n 0000807170 00000 n 0000806676 00000 n 0000806493 00000 n 0000807021 00000 n 0000806842 00000 n 0000808155 00000 n 0000807511 00000 n 0000807328 00000 n 0000808006 00000 n 0000807815 00000 n 0000807656 00000 n 0000808580 00000 n 0000808747 00000 n 0000808903 00000 n 0000809070 00000 n 0000809237 00000 n 0000810061 00000 n 0000809612 00000 n 0000809523 00000 n 0000809422 00000 n 0000809975 00000 n 0000809886 00000 n 0000809785 00000 n 0000810221 00000 n 0000810377 00000 n 0000810544 00000 n 0000810700 00000 n 0000811053 00000 n 0000810965 00000 n 0000810867 00000 n 0000414777 00000 n 0000204912 00000 n 0000208414 00000 n 0000811188 00000 n 0000814741 00000 n 0000812012 00000 n 0000811519 00000 n 0000811336 00000 n 0000811863 00000 n 0000811685 00000 n 0000812846 00000 n 0000812353 00000 n 0000812170 00000 n 0000812697 00000 n 0000812519 00000 n 0000813680 00000 n 0000813187 00000 n 0000813004 00000 n 0000813531 00000 n 0000813353 00000 n 0000814514 00000 n 0000814021 00000 n 0000813838 00000 n 0000814365 00000 n 0000814187 00000 n 0000814917 00000 n 0000815083 00000 n 0000815388 00000 n 0000815228 00000 n 0000815567 00000 n 0000815723 00000 n 0000815890 00000 n 0000819458 00000 n 0000816717 00000 n 0000816223 00000 n 0000816039 00000 n 0000816568 00000 n 0000816389 00000 n 0000817553 00000 n 0000817059 00000 n 0000816875 00000 n 0000817404 00000 n 0000817225 00000 n 0000818391 00000 n 0000817896 00000 n 0000817711 00000 n 0000818242 00000 n 0000818062 00000 n 0000819227 00000 n 0000818733 00000 n 0000818549 00000 n 0000819078 00000 n 0000818899 00000 n 0000819634 00000 n 0000819801 00000 n 0000414969 00000 n 0000208438 00000 n 0000209847 00000 n 0000819966 00000 n 0000820123 00000 n 0000820289 00000 n 0000820455 00000 n 0000415141 00000 n 0000209871 00000 n 0000213784 00000 n 0000820603 00000 n 0000820758 00000 n 0000821061 00000 n 0000820902 00000 n 0000822485 00000 n 0000822254 00000 n 0000821404 00000 n 0000821220 00000 n 0000822087 00000 n 0000821553 00000 n 0000821722 00000 n 0000821908 00000 n 0000822772 00000 n 0000822630 00000 n 0000823843 00000 n 0000823612 00000 n 0000823117 00000 n 0000822932 00000 n 0000823463 00000 n 0000823283 00000 n 0000823992 00000 n 0000825047 00000 n 0000824819 00000 n 0000824325 00000 n 0000824141 00000 n 0000824670 00000 n 0000824491 00000 n 0000825196 00000 n 0000825363 00000 n 0000826420 00000 n 0000826190 00000 n 0000825696 00000 n 0000825512 00000 n 0000826041 00000 n 0000825862 00000 n 0000415342 00000 n 0000213808 00000 n 0000217702 00000 n 0000826569 00000 n 0000826724 00000 n 0000830994 00000 n 0000829596 00000 n 0000827056 00000 n 0000826872 00000 n 0000829429 00000 n 0000827342 00000 n 0000827201 00000 n 0000829051 00000 n 0000827729 00000 n 0000827640 00000 n 0000827540 00000 n 0000828091 00000 n 0000828002 00000 n 0000827902 00000 n 0000828453 00000 n 0000828364 00000 n 0000828264 00000 n 0000828965 00000 n 0000828876 00000 n 0000828764 00000 n 0000828586 00000 n 0000829249 00000 n 0000830763 00000 n 0000829939 00000 n 0000829754 00000 n 0000830605 00000 n 0000830226 00000 n 0000830084 00000 n 0000830425 00000 n 0000831611 00000 n 0000831268 00000 n 0000831170 00000 n 0000831523 00000 n 0000831425 00000 n 0000415552 00000 n 0000217726 00000 n 0000221044 00000 n 0000831755 00000 n 0000831910 00000 n 0000832967 00000 n 0000832736 00000 n 0000832242 00000 n 0000832058 00000 n 0000832587 00000 n 0000832408 00000 n 0000833116 00000 n 0000833282 00000 n 0000836188 00000 n 0000834286 00000 n 0000833614 00000 n 0000833430 00000 n 0000834128 00000 n 0000833763 00000 n 0000833949 00000 n 0000835123 00000 n 0000834628 00000 n 0000834444 00000 n 0000834974 00000 n 0000834794 00000 n 0000835959 00000 n 0000835465 00000 n 0000835281 00000 n 0000835810 00000 n 0000835631 00000 n 0000415724 00000 n 0000221068 00000 n 0000224295 00000 n 0000836371 00000 n 0000836528 00000 n 0000836831 00000 n 0000836672 00000 n 0000837008 00000 n 0000837300 00000 n 0000837143 00000 n 0000837477 00000 n 0000837643 00000 n 0000837810 00000 n 0000838163 00000 n 0000838075 00000 n 0000837977 00000 n 0000415925 00000 n 0000224319 00000 n 0000228174 00000 n 0000838298 00000 n 0000849706 00000 n 0000838826 00000 n 0000838664 00000 n 0000838437 00000 n 0000839965 00000 n 0000839156 00000 n 0000838975 00000 n 0000839486 00000 n 0000839305 00000 n 0000839816 00000 n 0000839635 00000 n 0000841128 00000 n 0000840315 00000 n 0000840132 00000 n 0000840647 00000 n 0000840464 00000 n 0000840979 00000 n 0000840796 00000 n 0000842292 00000 n 0000841478 00000 n 0000841295 00000 n 0000841810 00000 n 0000841627 00000 n 0000842143 00000 n 0000841959 00000 n 0000843458 00000 n 0000842643 00000 n 0000842459 00000 n 0000842976 00000 n 0000842792 00000 n 0000843309 00000 n 0000843125 00000 n 0000844624 00000 n 0000843809 00000 n 0000843625 00000 n 0000844142 00000 n 0000843958 00000 n 0000844475 00000 n 0000844291 00000 n 0000845940 00000 n 0000845125 00000 n 0000844929 00000 n 0000844787 00000 n 0000845458 00000 n 0000845274 00000 n 0000845791 00000 n 0000845607 00000 n 0000847106 00000 n 0000846291 00000 n 0000846107 00000 n 0000846624 00000 n 0000846440 00000 n 0000846957 00000 n 0000846773 00000 n 0000848272 00000 n 0000847457 00000 n 0000847273 00000 n 0000847790 00000 n 0000847606 00000 n 0000848123 00000 n 0000847939 00000 n 0000849438 00000 n 0000848623 00000 n 0000848439 00000 n 0000848956 00000 n 0000848772 00000 n 0000849289 00000 n 0000849105 00000 n 0000849954 00000 n 0000857735 00000 n 0000850493 00000 n 0000850331 00000 n 0000850103 00000 n 0000851635 00000 n 0000850824 00000 n 0000850642 00000 n 0000851155 00000 n 0000850973 00000 n 0000851486 00000 n 0000851304 00000 n 0000852801 00000 n 0000851986 00000 n 0000851802 00000 n 0000852319 00000 n 0000852135 00000 n 0000852652 00000 n 0000852468 00000 n 0000853967 00000 n 0000853152 00000 n 0000852968 00000 n 0000853485 00000 n 0000853301 00000 n 0000853818 00000 n 0000853634 00000 n 0000855133 00000 n 0000854318 00000 n 0000854134 00000 n 0000854651 00000 n 0000854467 00000 n 0000854984 00000 n 0000854800 00000 n 0000856299 00000 n 0000855484 00000 n 0000855300 00000 n 0000855817 00000 n 0000855633 00000 n 0000856150 00000 n 0000855966 00000 n 0000857465 00000 n 0000856650 00000 n 0000856466 00000 n 0000856983 00000 n 0000856799 00000 n 0000857316 00000 n 0000857132 00000 n 0000416117 00000 n 0000228198 00000 n 0000231314 00000 n 0000873420 00000 n 0000858327 00000 n 0000858165 00000 n 0000857938 00000 n 0000859466 00000 n 0000858657 00000 n 0000858476 00000 n 0000858987 00000 n 0000858806 00000 n 0000859317 00000 n 0000859136 00000 n 0000860687 00000 n 0000859816 00000 n 0000859633 00000 n 0000860148 00000 n 0000859965 00000 n 0000860525 00000 n 0000860297 00000 n 0000861518 00000 n 0000861037 00000 n 0000860854 00000 n 0000861369 00000 n 0000861186 00000 n 0000862674 00000 n 0000861859 00000 n 0000861676 00000 n 0000862192 00000 n 0000862008 00000 n 0000862525 00000 n 0000862341 00000 n 0000863840 00000 n 0000863025 00000 n 0000862841 00000 n 0000863358 00000 n 0000863174 00000 n 0000863691 00000 n 0000863507 00000 n 0000865006 00000 n 0000864191 00000 n 0000864007 00000 n 0000864524 00000 n 0000864340 00000 n 0000864857 00000 n 0000864673 00000 n 0000866172 00000 n 0000865357 00000 n 0000865173 00000 n 0000865690 00000 n 0000865506 00000 n 0000866023 00000 n 0000865839 00000 n 0000867338 00000 n 0000866523 00000 n 0000866339 00000 n 0000866856 00000 n 0000866672 00000 n 0000867189 00000 n 0000867005 00000 n 0000868504 00000 n 0000867689 00000 n 0000867505 00000 n 0000868022 00000 n 0000867838 00000 n 0000868355 00000 n 0000868171 00000 n 0000869670 00000 n 0000868855 00000 n 0000868671 00000 n 0000869188 00000 n 0000869004 00000 n 0000869521 00000 n 0000869337 00000 n 0000870836 00000 n 0000870021 00000 n 0000869837 00000 n 0000870354 00000 n 0000870170 00000 n 0000870687 00000 n 0000870503 00000 n 0000872002 00000 n 0000871187 00000 n 0000871003 00000 n 0000871520 00000 n 0000871336 00000 n 0000871853 00000 n 0000871669 00000 n 0000873168 00000 n 0000872353 00000 n 0000872169 00000 n 0000872686 00000 n 0000872502 00000 n 0000873019 00000 n 0000872835 00000 n 0000416289 00000 n 0000231338 00000 n 0000235200 00000 n 0000873686 00000 n 0000885094 00000 n 0000874214 00000 n 0000874052 00000 n 0000873825 00000 n 0000875353 00000 n 0000874544 00000 n 0000874363 00000 n 0000874874 00000 n 0000874693 00000 n 0000875204 00000 n 0000875023 00000 n 0000876516 00000 n 0000875703 00000 n 0000875520 00000 n 0000876035 00000 n 0000875852 00000 n 0000876367 00000 n 0000876184 00000 n 0000877680 00000 n 0000876866 00000 n 0000876683 00000 n 0000877198 00000 n 0000877015 00000 n 0000877531 00000 n 0000877347 00000 n 0000878846 00000 n 0000878031 00000 n 0000877847 00000 n 0000878364 00000 n 0000878180 00000 n 0000878697 00000 n 0000878513 00000 n 0000880012 00000 n 0000879197 00000 n 0000879013 00000 n 0000879530 00000 n 0000879346 00000 n 0000879863 00000 n 0000879679 00000 n 0000881328 00000 n 0000880513 00000 n 0000880317 00000 n 0000880175 00000 n 0000880846 00000 n 0000880662 00000 n 0000881179 00000 n 0000880995 00000 n 0000882494 00000 n 0000881679 00000 n 0000881495 00000 n 0000882012 00000 n 0000881828 00000 n 0000882345 00000 n 0000882161 00000 n 0000883660 00000 n 0000882845 00000 n 0000882661 00000 n 0000883178 00000 n 0000882994 00000 n 0000883511 00000 n 0000883327 00000 n 0000884826 00000 n 0000884011 00000 n 0000883827 00000 n 0000884344 00000 n 0000884160 00000 n 0000884677 00000 n 0000884493 00000 n 0000885342 00000 n 0000893123 00000 n 0000885881 00000 n 0000885719 00000 n 0000885491 00000 n 0000887023 00000 n 0000886212 00000 n 0000886030 00000 n 0000886543 00000 n 0000886361 00000 n 0000886874 00000 n 0000886692 00000 n 0000888189 00000 n 0000887374 00000 n 0000887190 00000 n 0000887707 00000 n 0000887523 00000 n 0000888040 00000 n 0000887856 00000 n 0000889355 00000 n 0000888540 00000 n 0000888356 00000 n 0000888873 00000 n 0000888689 00000 n 0000889206 00000 n 0000889022 00000 n 0000890521 00000 n 0000889706 00000 n 0000889522 00000 n 0000890039 00000 n 0000889855 00000 n 0000890372 00000 n 0000890188 00000 n 0000891687 00000 n 0000890872 00000 n 0000890688 00000 n 0000891205 00000 n 0000891021 00000 n 0000891538 00000 n 0000891354 00000 n 0000892853 00000 n 0000892038 00000 n 0000891854 00000 n 0000892371 00000 n 0000892187 00000 n 0000892704 00000 n 0000892520 00000 n 0000416481 00000 n 0000235224 00000 n 0000239788 00000 n 0000908808 00000 n 0000893715 00000 n 0000893553 00000 n 0000893326 00000 n 0000894854 00000 n 0000894045 00000 n 0000893864 00000 n 0000894375 00000 n 0000894194 00000 n 0000894705 00000 n 0000894524 00000 n 0000896075 00000 n 0000895204 00000 n 0000895021 00000 n 0000895536 00000 n 0000895353 00000 n 0000895913 00000 n 0000895685 00000 n 0000896906 00000 n 0000896425 00000 n 0000896242 00000 n 0000896757 00000 n 0000896574 00000 n 0000898062 00000 n 0000897247 00000 n 0000897064 00000 n 0000897580 00000 n 0000897396 00000 n 0000897913 00000 n 0000897729 00000 n 0000899228 00000 n 0000898413 00000 n 0000898229 00000 n 0000898746 00000 n 0000898562 00000 n 0000899079 00000 n 0000898895 00000 n 0000900394 00000 n 0000899579 00000 n 0000899395 00000 n 0000899912 00000 n 0000899728 00000 n 0000900245 00000 n 0000900061 00000 n 0000901560 00000 n 0000900745 00000 n 0000900561 00000 n 0000901078 00000 n 0000900894 00000 n 0000901411 00000 n 0000901227 00000 n 0000902726 00000 n 0000901911 00000 n 0000901727 00000 n 0000902244 00000 n 0000902060 00000 n 0000902577 00000 n 0000902393 00000 n 0000903892 00000 n 0000903077 00000 n 0000902893 00000 n 0000903410 00000 n 0000903226 00000 n 0000903743 00000 n 0000903559 00000 n 0000905058 00000 n 0000904243 00000 n 0000904059 00000 n 0000904576 00000 n 0000904392 00000 n 0000904909 00000 n 0000904725 00000 n 0000906224 00000 n 0000905409 00000 n 0000905225 00000 n 0000905742 00000 n 0000905558 00000 n 0000906075 00000 n 0000905891 00000 n 0000907390 00000 n 0000906575 00000 n 0000906391 00000 n 0000906908 00000 n 0000906724 00000 n 0000907241 00000 n 0000907057 00000 n 0000908556 00000 n 0000907741 00000 n 0000907557 00000 n 0000908074 00000 n 0000907890 00000 n 0000908407 00000 n 0000908223 00000 n 0000909092 00000 n 0000909248 00000 n 0000911557 00000 n 0000909623 00000 n 0000909534 00000 n 0000909433 00000 n 0000909986 00000 n 0000909897 00000 n 0000909796 00000 n 0000910349 00000 n 0000910260 00000 n 0000910159 00000 n 0000910712 00000 n 0000910623 00000 n 0000910522 00000 n 0000911109 00000 n 0000911020 00000 n 0000910885 00000 n 0000416653 00000 n 0000239812 00000 n 0000240718 00000 n 0000911471 00000 n 0000911382 00000 n 0000911282 00000 n 0000416825 00000 n 0000240741 00000 n 0000243477 00000 n 0000911751 00000 n 0000911908 00000 n 0000912074 00000 n 0000913970 00000 n 0000912436 00000 n 0000912347 00000 n 0000912247 00000 n 0000912798 00000 n 0000912709 00000 n 0000912609 00000 n 0000913160 00000 n 0000913071 00000 n 0000912971 00000 n 0000913522 00000 n 0000913433 00000 n 0000913333 00000 n 0000913884 00000 n 0000913795 00000 n 0000913695 00000 n 0000914157 00000 n 0000914968 00000 n 0000914519 00000 n 0000914430 00000 n 0000914330 00000 n 0000914882 00000 n 0000914793 00000 n 0000914692 00000 n 0000915128 00000 n 0000915284 00000 n 0000916471 00000 n 0000915659 00000 n 0000915570 00000 n 0000915469 00000 n 0000916022 00000 n 0000915933 00000 n 0000915832 00000 n 0000916385 00000 n 0000916296 00000 n 0000916195 00000 n 0000916640 00000 n 0000918358 00000 n 0000917038 00000 n 0000916949 00000 n 0000916814 00000 n 0000416997 00000 n 0000243501 00000 n 0000246724 00000 n 0000917548 00000 n 0000917459 00000 n 0000917348 00000 n 0000917171 00000 n 0000917910 00000 n 0000917821 00000 n 0000917721 00000 n 0000918272 00000 n 0000918183 00000 n 0000918083 00000 n 0000918536 00000 n 0000919708 00000 n 0000918898 00000 n 0000918809 00000 n 0000918709 00000 n 0000919260 00000 n 0000919171 00000 n 0000919071 00000 n 0000919622 00000 n 0000919533 00000 n 0000919433 00000 n 0000919877 00000 n 0000920033 00000 n 0000921220 00000 n 0000920408 00000 n 0000920319 00000 n 0000920218 00000 n 0000920771 00000 n 0000920682 00000 n 0000920581 00000 n 0000921134 00000 n 0000921045 00000 n 0000920944 00000 n 0000921389 00000 n 0000923291 00000 n 0000921753 00000 n 0000921664 00000 n 0000921563 00000 n 0000922116 00000 n 0000922027 00000 n 0000921926 00000 n 0000922479 00000 n 0000922390 00000 n 0000922289 00000 n 0000922842 00000 n 0000922753 00000 n 0000922652 00000 n 0000923205 00000 n 0000923116 00000 n 0000923015 00000 n 0000417189 00000 n 0000246748 00000 n 0000250278 00000 n 0000923460 00000 n 0000924994 00000 n 0000923822 00000 n 0000923733 00000 n 0000923633 00000 n 0000924184 00000 n 0000924095 00000 n 0000923995 00000 n 0000924546 00000 n 0000924457 00000 n 0000924357 00000 n 0000924908 00000 n 0000924819 00000 n 0000924719 00000 n 0000925172 00000 n 0000925327 00000 n 0000925493 00000 n 0000928129 00000 n 0000925866 00000 n 0000925777 00000 n 0000925677 00000 n 0000926228 00000 n 0000926139 00000 n 0000926039 00000 n 0000926591 00000 n 0000926502 00000 n 0000926401 00000 n 0000926954 00000 n 0000926865 00000 n 0000926764 00000 n 0000927317 00000 n 0000927228 00000 n 0000927127 00000 n 0000927680 00000 n 0000927591 00000 n 0000927490 00000 n 0000928043 00000 n 0000927954 00000 n 0000927853 00000 n 0000928334 00000 n 0000928490 00000 n 0000930848 00000 n 0000928865 00000 n 0000928776 00000 n 0000928675 00000 n 0000929228 00000 n 0000929139 00000 n 0000929038 00000 n 0000930400 00000 n 0000930302 00000 n 0000929401 00000 n 0000417361 00000 n 0000250302 00000 n 0000253551 00000 n 0000930208 00000 n 0000929760 00000 n 0000929671 00000 n 0000929571 00000 n 0000930122 00000 n 0000930033 00000 n 0000929933 00000 n 0000930762 00000 n 0000930673 00000 n 0000930573 00000 n 0000931026 00000 n 0000931181 00000 n 0000932364 00000 n 0000931554 00000 n 0000931465 00000 n 0000931365 00000 n 0000931916 00000 n 0000931827 00000 n 0000931727 00000 n 0000932278 00000 n 0000932189 00000 n 0000932089 00000 n 0000932533 00000 n 0000933344 00000 n 0000932895 00000 n 0000932806 00000 n 0000932706 00000 n 0000933258 00000 n 0000933169 00000 n 0000933068 00000 n 0000933504 00000 n 0000933954 00000 n 0000933868 00000 n 0000933779 00000 n 0000933678 00000 n 0000934105 00000 n 0000934918 00000 n 0000934469 00000 n 0000934380 00000 n 0000934279 00000 n 0000934832 00000 n 0000934743 00000 n 0000934642 00000 n 0000935078 00000 n 0000936235 00000 n 0000935442 00000 n 0000935353 00000 n 0000935252 00000 n 0000935805 00000 n 0000935716 00000 n 0000935615 00000 n 0000417533 00000 n 0000253575 00000 n 0000257734 00000 n 0000936149 00000 n 0000936060 00000 n 0000935960 00000 n 0000936404 00000 n 0000939323 00000 n 0000936766 00000 n 0000936677 00000 n 0000936577 00000 n 0000937128 00000 n 0000937039 00000 n 0000936939 00000 n 0000937490 00000 n 0000937401 00000 n 0000937301 00000 n 0000938000 00000 n 0000937911 00000 n 0000937800 00000 n 0000937623 00000 n 0000938511 00000 n 0000938422 00000 n 0000938310 00000 n 0000938133 00000 n 0000938874 00000 n 0000938785 00000 n 0000938684 00000 n 0000939237 00000 n 0000939148 00000 n 0000939047 00000 n 0000939528 00000 n 0000939978 00000 n 0000939892 00000 n 0000939803 00000 n 0000939702 00000 n 0000940129 00000 n 0000940285 00000 n 0000940452 00000 n 0000942278 00000 n 0000940827 00000 n 0000940738 00000 n 0000940637 00000 n 0000941190 00000 n 0000941101 00000 n 0000941000 00000 n 0000417734 00000 n 0000257758 00000 n 0000261404 00000 n 0000941682 00000 n 0000941593 00000 n 0000941482 00000 n 0000941323 00000 n 0000942192 00000 n 0000942103 00000 n 0000941992 00000 n 0000941815 00000 n 0000942456 00000 n 0000942904 00000 n 0000942818 00000 n 0000942729 00000 n 0000942629 00000 n 0000943055 00000 n 0000943210 00000 n 0000943376 00000 n 0000946378 00000 n 0000943751 00000 n 0000943662 00000 n 0000943561 00000 n 0000944114 00000 n 0000944025 00000 n 0000943924 00000 n 0000944477 00000 n 0000944388 00000 n 0000944287 00000 n 0000944840 00000 n 0000944751 00000 n 0000944650 00000 n 0000945203 00000 n 0000945114 00000 n 0000945013 00000 n 0000945566 00000 n 0000945477 00000 n 0000945376 00000 n 0000945929 00000 n 0000945840 00000 n 0000945739 00000 n 0000946292 00000 n 0000946203 00000 n 0000946102 00000 n 0000946592 00000 n 0000946748 00000 n 0000949053 00000 n 0000947157 00000 n 0000947068 00000 n 0000946933 00000 n 0000417935 00000 n 0000261428 00000 n 0000265391 00000 n 0000947519 00000 n 0000947430 00000 n 0000947330 00000 n 0000947881 00000 n 0000947792 00000 n 0000947692 00000 n 0000948243 00000 n 0000948154 00000 n 0000948054 00000 n 0000948605 00000 n 0000948516 00000 n 0000948416 00000 n 0000948967 00000 n 0000948878 00000 n 0000948778 00000 n 0000949249 00000 n 0000949415 00000 n 0000949570 00000 n 0000952720 00000 n 0000949943 00000 n 0000949854 00000 n 0000949754 00000 n 0000950306 00000 n 0000950217 00000 n 0000950116 00000 n 0000950669 00000 n 0000950580 00000 n 0000950479 00000 n 0000951182 00000 n 0000951093 00000 n 0000950980 00000 n 0000950802 00000 n 0000951545 00000 n 0000951456 00000 n 0000951355 00000 n 0000951908 00000 n 0000951819 00000 n 0000951718 00000 n 0000952271 00000 n 0000952182 00000 n 0000952081 00000 n 0000952634 00000 n 0000952545 00000 n 0000952444 00000 n 0000952934 00000 n 0000953090 00000 n 0000955918 00000 n 0000953499 00000 n 0000953410 00000 n 0000953275 00000 n 0000418127 00000 n 0000265415 00000 n 0000268482 00000 n 0000953861 00000 n 0000953772 00000 n 0000953672 00000 n 0000954223 00000 n 0000954134 00000 n 0000954034 00000 n 0000954585 00000 n 0000954496 00000 n 0000954396 00000 n 0000955108 00000 n 0000955019 00000 n 0000954908 00000 n 0000954718 00000 n 0000955470 00000 n 0000955381 00000 n 0000955281 00000 n 0000955832 00000 n 0000955743 00000 n 0000955643 00000 n 0000956123 00000 n 0000956289 00000 n 0000956445 00000 n 0000957632 00000 n 0000956820 00000 n 0000956731 00000 n 0000956630 00000 n 0000957183 00000 n 0000957094 00000 n 0000956993 00000 n 0000957546 00000 n 0000957457 00000 n 0000957356 00000 n 0000418319 00000 n 0000268506 00000 n 0000271516 00000 n 0000957783 00000 n 0001166546 00000 n 0000957922 00000 n 0000958169 00000 n 0000958028 00000 n 0000958345 00000 n 0000958592 00000 n 0000958451 00000 n 0000958840 00000 n 0000958699 00000 n 0000959089 00000 n 0000958947 00000 n 0000959338 00000 n 0000959196 00000 n 0000959588 00000 n 0000959446 00000 n 0000959838 00000 n 0000959696 00000 n 0000959997 00000 n 0000960256 00000 n 0000960096 00000 n 0000960524 00000 n 0000960364 00000 n 0000960774 00000 n 0000960632 00000 n 0000960933 00000 n 0000961192 00000 n 0000961032 00000 n 0000961460 00000 n 0000961300 00000 n 0000961728 00000 n 0000961568 00000 n 0000961887 00000 n 0000962146 00000 n 0000961986 00000 n 0000962414 00000 n 0000962254 00000 n 0000962682 00000 n 0000962522 00000 n 0000962950 00000 n 0000962790 00000 n 0000963200 00000 n 0000963058 00000 n 0000963377 00000 n 0000963626 00000 n 0000963484 00000 n 0000963876 00000 n 0000963734 00000 n 0000964035 00000 n 0000964294 00000 n 0000964134 00000 n 0000964544 00000 n 0000964402 00000 n 0000964794 00000 n 0000964652 00000 n 0000965044 00000 n 0000964902 00000 n 0000965203 00000 n 0000965462 00000 n 0000965302 00000 n 0000965712 00000 n 0000965570 00000 n 0000965871 00000 n 0000966130 00000 n 0000965970 00000 n 0000966398 00000 n 0000966238 00000 n 0000966557 00000 n 0000966816 00000 n 0000966656 00000 n 0000967084 00000 n 0000966924 00000 n 0000967352 00000 n 0000967192 00000 n 0000967620 00000 n 0000967460 00000 n 0000967888 00000 n 0000967728 00000 n 0000968156 00000 n 0000967996 00000 n 0000968333 00000 n 0000968582 00000 n 0000968440 00000 n 0000968832 00000 n 0000968690 00000 n 0000969082 00000 n 0000968940 00000 n 0000969241 00000 n 0000969500 00000 n 0000969340 00000 n 0000969750 00000 n 0000969608 00000 n 0000970000 00000 n 0000969858 00000 n 0000970250 00000 n 0000970108 00000 n 0000970409 00000 n 0000970668 00000 n 0000970508 00000 n 0000970936 00000 n 0000970776 00000 n 0000971205 00000 n 0000971044 00000 n 0000971475 00000 n 0000971314 00000 n 0000971745 00000 n 0000971584 00000 n 0000972015 00000 n 0000971854 00000 n 0000972285 00000 n 0000972124 00000 n 0000972555 00000 n 0000972394 00000 n 0000972715 00000 n 0000972976 00000 n 0000972815 00000 n 0000973246 00000 n 0000973085 00000 n 0000973516 00000 n 0000973355 00000 n 0000973768 00000 n 0000973625 00000 n 0000974020 00000 n 0000973877 00000 n 0000974272 00000 n 0000974129 00000 n 0000974524 00000 n 0000974381 00000 n 0000974684 00000 n 0000974945 00000 n 0000974784 00000 n 0000975105 00000 n 0000975366 00000 n 0000975205 00000 n 0000975636 00000 n 0000975475 00000 n 0000975906 00000 n 0000975745 00000 n 0000976176 00000 n 0000976015 00000 n 0000976446 00000 n 0000976285 00000 n 0000418491 00000 n 0000271540 00000 n 0000275323 00000 n 0000976714 00000 n 0000976555 00000 n 0000976980 00000 n 0000976821 00000 n 0000977246 00000 n 0000977087 00000 n 0000977512 00000 n 0000977353 00000 n 0000977778 00000 n 0000977619 00000 n 0000978045 00000 n 0000977885 00000 n 0000978313 00000 n 0000978153 00000 n 0000978581 00000 n 0000978421 00000 n 0000978849 00000 n 0000978689 00000 n 0000979117 00000 n 0000978957 00000 n 0000979385 00000 n 0000979225 00000 n 0000979653 00000 n 0000979493 00000 n 0000979921 00000 n 0000979761 00000 n 0000980189 00000 n 0000980029 00000 n 0000980457 00000 n 0000980297 00000 n 0000980725 00000 n 0000980565 00000 n 0000980993 00000 n 0000980833 00000 n 0000981261 00000 n 0000981101 00000 n 0000981529 00000 n 0000981369 00000 n 0000981797 00000 n 0000981637 00000 n 0000982065 00000 n 0000981905 00000 n 0000982333 00000 n 0000982173 00000 n 0000982601 00000 n 0000982441 00000 n 0000982851 00000 n 0000982709 00000 n 0000983101 00000 n 0000982959 00000 n 0000983351 00000 n 0000983209 00000 n 0000983601 00000 n 0000983459 00000 n 0000983778 00000 n 0000984027 00000 n 0000983885 00000 n 0000984277 00000 n 0000984135 00000 n 0000984527 00000 n 0000984385 00000 n 0000984777 00000 n 0000984635 00000 n 0000985027 00000 n 0000984885 00000 n 0000985277 00000 n 0000985135 00000 n 0000985527 00000 n 0000985385 00000 n 0000985777 00000 n 0000985635 00000 n 0000986027 00000 n 0000985885 00000 n 0000986277 00000 n 0000986135 00000 n 0000986527 00000 n 0000986385 00000 n 0000986777 00000 n 0000986635 00000 n 0000987027 00000 n 0000986885 00000 n 0000987277 00000 n 0000987135 00000 n 0000987527 00000 n 0000987385 00000 n 0000987777 00000 n 0000987635 00000 n 0000988027 00000 n 0000987885 00000 n 0000988277 00000 n 0000988135 00000 n 0000988527 00000 n 0000988385 00000 n 0000988777 00000 n 0000988635 00000 n 0000989027 00000 n 0000988885 00000 n 0000989277 00000 n 0000989135 00000 n 0000989528 00000 n 0000989385 00000 n 0000989797 00000 n 0000989636 00000 n 0000990067 00000 n 0000989906 00000 n 0000990337 00000 n 0000990176 00000 n 0000990607 00000 n 0000990446 00000 n 0000990877 00000 n 0000990716 00000 n 0000991147 00000 n 0000990986 00000 n 0000991417 00000 n 0000991256 00000 n 0000991687 00000 n 0000991526 00000 n 0000991957 00000 n 0000991796 00000 n 0000992209 00000 n 0000992066 00000 n 0000992461 00000 n 0000992318 00000 n 0000992713 00000 n 0000992570 00000 n 0000992965 00000 n 0000992822 00000 n 0000993217 00000 n 0000993074 00000 n 0000993469 00000 n 0000993326 00000 n 0000993721 00000 n 0000993578 00000 n 0000993973 00000 n 0000993830 00000 n 0000994225 00000 n 0000994082 00000 n 0000994477 00000 n 0000994334 00000 n 0000994729 00000 n 0000994586 00000 n 0000994981 00000 n 0000994838 00000 n 0000995233 00000 n 0000995090 00000 n 0000995485 00000 n 0000995342 00000 n 0000995737 00000 n 0000995594 00000 n 0000995989 00000 n 0000995846 00000 n 0000996241 00000 n 0000996098 00000 n 0000996493 00000 n 0000996350 00000 n 0000996763 00000 n 0000996602 00000 n 0000997033 00000 n 0000996872 00000 n 0000997303 00000 n 0000997142 00000 n 0000997573 00000 n 0000997412 00000 n 0000997825 00000 n 0000997682 00000 n 0000998077 00000 n 0000997934 00000 n 0000998329 00000 n 0000998186 00000 n 0000998581 00000 n 0000998438 00000 n 0000998833 00000 n 0000998690 00000 n 0000999085 00000 n 0000998942 00000 n 0000999337 00000 n 0000999194 00000 n 0000999589 00000 n 0000999446 00000 n 0000999841 00000 n 0000999698 00000 n 0001000093 00000 n 0000999950 00000 n 0001000345 00000 n 0001000202 00000 n 0001000597 00000 n 0001000454 00000 n 0001000849 00000 n 0001000706 00000 n 0001001101 00000 n 0001000958 00000 n 0001001353 00000 n 0001001210 00000 n 0001001605 00000 n 0001001462 00000 n 0001001857 00000 n 0001001714 00000 n 0001002109 00000 n 0001001966 00000 n 0001002361 00000 n 0001002218 00000 n 0001002613 00000 n 0001002470 00000 n 0001002865 00000 n 0001002722 00000 n 0001003117 00000 n 0001002974 00000 n 0001003369 00000 n 0001003226 00000 n 0001003621 00000 n 0001003478 00000 n 0000418663 00000 n 0000275347 00000 n 0000278827 00000 n 0001003871 00000 n 0001003730 00000 n 0001004119 00000 n 0001003978 00000 n 0001004367 00000 n 0001004226 00000 n 0001004615 00000 n 0001004474 00000 n 0001004863 00000 n 0001004722 00000 n 0001005112 00000 n 0001004970 00000 n 0001005362 00000 n 0001005220 00000 n 0001005612 00000 n 0001005470 00000 n 0001005862 00000 n 0001005720 00000 n 0001006112 00000 n 0001005970 00000 n 0001006362 00000 n 0001006220 00000 n 0001006612 00000 n 0001006470 00000 n 0001006862 00000 n 0001006720 00000 n 0001007112 00000 n 0001006970 00000 n 0001007362 00000 n 0001007220 00000 n 0001007612 00000 n 0001007470 00000 n 0001007862 00000 n 0001007720 00000 n 0001008112 00000 n 0001007970 00000 n 0001008362 00000 n 0001008220 00000 n 0001008612 00000 n 0001008470 00000 n 0001008862 00000 n 0001008720 00000 n 0001009112 00000 n 0001008970 00000 n 0001009362 00000 n 0001009220 00000 n 0001009612 00000 n 0001009470 00000 n 0001009862 00000 n 0001009720 00000 n 0001010112 00000 n 0001009970 00000 n 0001010362 00000 n 0001010220 00000 n 0001010612 00000 n 0001010470 00000 n 0001010862 00000 n 0001010720 00000 n 0001011112 00000 n 0001010970 00000 n 0001011362 00000 n 0001011220 00000 n 0001011612 00000 n 0001011470 00000 n 0001011862 00000 n 0001011720 00000 n 0001012112 00000 n 0001011970 00000 n 0001012362 00000 n 0001012220 00000 n 0001012612 00000 n 0001012470 00000 n 0001012862 00000 n 0001012720 00000 n 0001013112 00000 n 0001012970 00000 n 0001013362 00000 n 0001013220 00000 n 0001013612 00000 n 0001013470 00000 n 0001013862 00000 n 0001013720 00000 n 0001014112 00000 n 0001013970 00000 n 0001014362 00000 n 0001014220 00000 n 0001014612 00000 n 0001014470 00000 n 0001014862 00000 n 0001014720 00000 n 0001015112 00000 n 0001014970 00000 n 0001015362 00000 n 0001015220 00000 n 0001015612 00000 n 0001015470 00000 n 0001015862 00000 n 0001015720 00000 n 0001016112 00000 n 0001015970 00000 n 0001016363 00000 n 0001016220 00000 n 0001016615 00000 n 0001016472 00000 n 0001016867 00000 n 0001016724 00000 n 0001017119 00000 n 0001016976 00000 n 0001017371 00000 n 0001017228 00000 n 0001017623 00000 n 0001017480 00000 n 0001017875 00000 n 0001017732 00000 n 0001018127 00000 n 0001017984 00000 n 0001018379 00000 n 0001018236 00000 n 0001018631 00000 n 0001018488 00000 n 0001018883 00000 n 0001018740 00000 n 0001019135 00000 n 0001018992 00000 n 0001019387 00000 n 0001019244 00000 n 0001019639 00000 n 0001019496 00000 n 0001019891 00000 n 0001019748 00000 n 0001020143 00000 n 0001020000 00000 n 0001020413 00000 n 0001020252 00000 n 0001020683 00000 n 0001020522 00000 n 0001020935 00000 n 0001020792 00000 n 0001021187 00000 n 0001021044 00000 n 0001021457 00000 n 0001021296 00000 n 0001021709 00000 n 0001021566 00000 n 0001021979 00000 n 0001021818 00000 n 0001022249 00000 n 0001022088 00000 n 0001022519 00000 n 0001022358 00000 n 0001022771 00000 n 0001022628 00000 n 0001023023 00000 n 0001022880 00000 n 0001023275 00000 n 0001023132 00000 n 0001023527 00000 n 0001023384 00000 n 0001023779 00000 n 0001023636 00000 n 0001024031 00000 n 0001023888 00000 n 0001024283 00000 n 0001024140 00000 n 0001024535 00000 n 0001024392 00000 n 0001024787 00000 n 0001024644 00000 n 0001025057 00000 n 0001024896 00000 n 0001025327 00000 n 0001025166 00000 n 0001025597 00000 n 0001025436 00000 n 0001025849 00000 n 0001025706 00000 n 0001026101 00000 n 0001025958 00000 n 0001026353 00000 n 0001026210 00000 n 0001026605 00000 n 0001026462 00000 n 0001026857 00000 n 0001026714 00000 n 0001027109 00000 n 0001026966 00000 n 0001027361 00000 n 0001027218 00000 n 0001027613 00000 n 0001027470 00000 n 0001027865 00000 n 0001027722 00000 n 0001028135 00000 n 0001027974 00000 n 0001028405 00000 n 0001028244 00000 n 0001028675 00000 n 0001028514 00000 n 0001028927 00000 n 0001028784 00000 n 0001029179 00000 n 0001029036 00000 n 0001029431 00000 n 0001029288 00000 n 0001029683 00000 n 0001029540 00000 n 0001029935 00000 n 0001029792 00000 n 0001030187 00000 n 0001030044 00000 n 0001030439 00000 n 0001030296 00000 n 0001030691 00000 n 0001030548 00000 n 0001030943 00000 n 0001030800 00000 n 0000418835 00000 n 0000278851 00000 n 0000282611 00000 n 0001031193 00000 n 0001031052 00000 n 0001031441 00000 n 0001031300 00000 n 0001031689 00000 n 0001031548 00000 n 0001031937 00000 n 0001031796 00000 n 0001032203 00000 n 0001032044 00000 n 0001032470 00000 n 0001032310 00000 n 0001032738 00000 n 0001032578 00000 n 0001033006 00000 n 0001032846 00000 n 0001033274 00000 n 0001033114 00000 n 0001033542 00000 n 0001033382 00000 n 0001033810 00000 n 0001033650 00000 n 0001034078 00000 n 0001033918 00000 n 0001034346 00000 n 0001034186 00000 n 0001034614 00000 n 0001034454 00000 n 0001034882 00000 n 0001034722 00000 n 0001035150 00000 n 0001034990 00000 n 0001035418 00000 n 0001035258 00000 n 0001035686 00000 n 0001035526 00000 n 0001035936 00000 n 0001035794 00000 n 0001036186 00000 n 0001036044 00000 n 0001036436 00000 n 0001036294 00000 n 0001036686 00000 n 0001036544 00000 n 0001036936 00000 n 0001036794 00000 n 0001037186 00000 n 0001037044 00000 n 0001037436 00000 n 0001037294 00000 n 0001037686 00000 n 0001037544 00000 n 0001037936 00000 n 0001037794 00000 n 0001038186 00000 n 0001038044 00000 n 0001038436 00000 n 0001038294 00000 n 0001038686 00000 n 0001038544 00000 n 0001038936 00000 n 0001038794 00000 n 0001039186 00000 n 0001039044 00000 n 0001039436 00000 n 0001039294 00000 n 0001039686 00000 n 0001039544 00000 n 0001039936 00000 n 0001039794 00000 n 0001040186 00000 n 0001040044 00000 n 0001040436 00000 n 0001040294 00000 n 0001040686 00000 n 0001040544 00000 n 0001040936 00000 n 0001040794 00000 n 0001041186 00000 n 0001041044 00000 n 0001041436 00000 n 0001041294 00000 n 0001041686 00000 n 0001041544 00000 n 0001041936 00000 n 0001041794 00000 n 0001042186 00000 n 0001042044 00000 n 0001042436 00000 n 0001042294 00000 n 0001042686 00000 n 0001042544 00000 n 0001042936 00000 n 0001042794 00000 n 0001043186 00000 n 0001043044 00000 n 0001043436 00000 n 0001043294 00000 n 0001043686 00000 n 0001043544 00000 n 0001043937 00000 n 0001043794 00000 n 0001044189 00000 n 0001044046 00000 n 0001044441 00000 n 0001044298 00000 n 0001044693 00000 n 0001044550 00000 n 0001044945 00000 n 0001044802 00000 n 0001045197 00000 n 0001045054 00000 n 0001045449 00000 n 0001045306 00000 n 0001045701 00000 n 0001045558 00000 n 0001045953 00000 n 0001045810 00000 n 0001046205 00000 n 0001046062 00000 n 0001046457 00000 n 0001046314 00000 n 0001046709 00000 n 0001046566 00000 n 0001046961 00000 n 0001046818 00000 n 0001047213 00000 n 0001047070 00000 n 0001047465 00000 n 0001047322 00000 n 0001047625 00000 n 0001047886 00000 n 0001047725 00000 n 0001048138 00000 n 0001047995 00000 n 0001048390 00000 n 0001048247 00000 n 0001048642 00000 n 0001048499 00000 n 0001048894 00000 n 0001048751 00000 n 0001049146 00000 n 0001049003 00000 n 0001049398 00000 n 0001049255 00000 n 0001049650 00000 n 0001049507 00000 n 0001049902 00000 n 0001049759 00000 n 0001050154 00000 n 0001050011 00000 n 0001050406 00000 n 0001050263 00000 n 0001050658 00000 n 0001050515 00000 n 0001050910 00000 n 0001050767 00000 n 0001051162 00000 n 0001051019 00000 n 0001051414 00000 n 0001051271 00000 n 0001051666 00000 n 0001051523 00000 n 0001051918 00000 n 0001051775 00000 n 0001052170 00000 n 0001052027 00000 n 0001052422 00000 n 0001052279 00000 n 0001052674 00000 n 0001052531 00000 n 0001052926 00000 n 0001052783 00000 n 0001053178 00000 n 0001053035 00000 n 0001053430 00000 n 0001053287 00000 n 0001053682 00000 n 0001053539 00000 n 0001053934 00000 n 0001053791 00000 n 0001054186 00000 n 0001054043 00000 n 0001054438 00000 n 0001054295 00000 n 0001054690 00000 n 0001054547 00000 n 0001054942 00000 n 0001054799 00000 n 0001055194 00000 n 0001055051 00000 n 0001055464 00000 n 0001055303 00000 n 0001055734 00000 n 0001055573 00000 n 0001056004 00000 n 0001055843 00000 n 0001056274 00000 n 0001056113 00000 n 0001056526 00000 n 0001056383 00000 n 0001056796 00000 n 0001056635 00000 n 0001057066 00000 n 0001056905 00000 n 0001057318 00000 n 0001057175 00000 n 0001057570 00000 n 0001057427 00000 n 0001057822 00000 n 0001057679 00000 n 0001058074 00000 n 0001057931 00000 n 0001058326 00000 n 0001058183 00000 n 0000419007 00000 n 0000282635 00000 n 0000286140 00000 n 0001058594 00000 n 0001058435 00000 n 0001058860 00000 n 0001058701 00000 n 0001059126 00000 n 0001058967 00000 n 0001059392 00000 n 0001059233 00000 n 0001059658 00000 n 0001059499 00000 n 0001059907 00000 n 0001059765 00000 n 0001060157 00000 n 0001060015 00000 n 0001060407 00000 n 0001060265 00000 n 0001060657 00000 n 0001060515 00000 n 0001060907 00000 n 0001060765 00000 n 0001061157 00000 n 0001061015 00000 n 0001061407 00000 n 0001061265 00000 n 0001061657 00000 n 0001061515 00000 n 0001061907 00000 n 0001061765 00000 n 0001062157 00000 n 0001062015 00000 n 0001062407 00000 n 0001062265 00000 n 0001062657 00000 n 0001062515 00000 n 0001062907 00000 n 0001062765 00000 n 0001063157 00000 n 0001063015 00000 n 0001063407 00000 n 0001063265 00000 n 0001063657 00000 n 0001063515 00000 n 0001063907 00000 n 0001063765 00000 n 0001064157 00000 n 0001064015 00000 n 0001064407 00000 n 0001064265 00000 n 0001064657 00000 n 0001064515 00000 n 0001064907 00000 n 0001064765 00000 n 0001065157 00000 n 0001065015 00000 n 0001065407 00000 n 0001065265 00000 n 0001065657 00000 n 0001065515 00000 n 0001065907 00000 n 0001065765 00000 n 0001066157 00000 n 0001066015 00000 n 0001066407 00000 n 0001066265 00000 n 0001066657 00000 n 0001066515 00000 n 0001066907 00000 n 0001066765 00000 n 0001067157 00000 n 0001067015 00000 n 0001067407 00000 n 0001067265 00000 n 0001067657 00000 n 0001067515 00000 n 0001067907 00000 n 0001067765 00000 n 0001068157 00000 n 0001068015 00000 n 0001068407 00000 n 0001068265 00000 n 0001068657 00000 n 0001068515 00000 n 0001068907 00000 n 0001068765 00000 n 0001069157 00000 n 0001069015 00000 n 0001069407 00000 n 0001069265 00000 n 0001069657 00000 n 0001069515 00000 n 0001069907 00000 n 0001069765 00000 n 0001070157 00000 n 0001070015 00000 n 0001070407 00000 n 0001070265 00000 n 0001070657 00000 n 0001070515 00000 n 0001070907 00000 n 0001070765 00000 n 0001071158 00000 n 0001071015 00000 n 0001071410 00000 n 0001071267 00000 n 0001071662 00000 n 0001071519 00000 n 0001071914 00000 n 0001071771 00000 n 0001072166 00000 n 0001072023 00000 n 0001072418 00000 n 0001072275 00000 n 0001072670 00000 n 0001072527 00000 n 0001072922 00000 n 0001072779 00000 n 0001073174 00000 n 0001073031 00000 n 0001073426 00000 n 0001073283 00000 n 0001073678 00000 n 0001073535 00000 n 0001073930 00000 n 0001073787 00000 n 0001074182 00000 n 0001074039 00000 n 0001074434 00000 n 0001074291 00000 n 0001074686 00000 n 0001074543 00000 n 0001074938 00000 n 0001074795 00000 n 0001075190 00000 n 0001075047 00000 n 0001075442 00000 n 0001075299 00000 n 0001075694 00000 n 0001075551 00000 n 0001075946 00000 n 0001075803 00000 n 0001076198 00000 n 0001076055 00000 n 0001076450 00000 n 0001076307 00000 n 0001076702 00000 n 0001076559 00000 n 0001076954 00000 n 0001076811 00000 n 0001077206 00000 n 0001077063 00000 n 0001077458 00000 n 0001077315 00000 n 0001077710 00000 n 0001077567 00000 n 0001077962 00000 n 0001077819 00000 n 0001078214 00000 n 0001078071 00000 n 0001078466 00000 n 0001078323 00000 n 0001078718 00000 n 0001078575 00000 n 0001078970 00000 n 0001078827 00000 n 0001079222 00000 n 0001079079 00000 n 0001079474 00000 n 0001079331 00000 n 0001079726 00000 n 0001079583 00000 n 0001079978 00000 n 0001079835 00000 n 0001080230 00000 n 0001080087 00000 n 0001080482 00000 n 0001080339 00000 n 0001080752 00000 n 0001080591 00000 n 0001081022 00000 n 0001080861 00000 n 0001081274 00000 n 0001081131 00000 n 0001081526 00000 n 0001081383 00000 n 0001081778 00000 n 0001081635 00000 n 0001082030 00000 n 0001081887 00000 n 0001082282 00000 n 0001082139 00000 n 0001082534 00000 n 0001082391 00000 n 0001082786 00000 n 0001082643 00000 n 0001083038 00000 n 0001082895 00000 n 0001083290 00000 n 0001083147 00000 n 0001083542 00000 n 0001083399 00000 n 0001083794 00000 n 0001083651 00000 n 0001084046 00000 n 0001083903 00000 n 0001084298 00000 n 0001084155 00000 n 0001084550 00000 n 0001084407 00000 n 0001084802 00000 n 0001084659 00000 n 0001085054 00000 n 0001084911 00000 n 0001085306 00000 n 0001085163 00000 n 0001085558 00000 n 0001085415 00000 n 0000419179 00000 n 0000286164 00000 n 0000289682 00000 n 0001085808 00000 n 0001085667 00000 n 0001086056 00000 n 0001085915 00000 n 0001086304 00000 n 0001086163 00000 n 0001086552 00000 n 0001086411 00000 n 0001086800 00000 n 0001086659 00000 n 0001087049 00000 n 0001086907 00000 n 0001087299 00000 n 0001087157 00000 n 0001087549 00000 n 0001087407 00000 n 0001087799 00000 n 0001087657 00000 n 0001087958 00000 n 0001088217 00000 n 0001088057 00000 n 0001088467 00000 n 0001088325 00000 n 0001088626 00000 n 0001088885 00000 n 0001088725 00000 n 0001089153 00000 n 0001088993 00000 n 0001089421 00000 n 0001089261 00000 n 0001089671 00000 n 0001089529 00000 n 0001089830 00000 n 0001090089 00000 n 0001089929 00000 n 0001090339 00000 n 0001090197 00000 n 0001090607 00000 n 0001090447 00000 n 0001090784 00000 n 0001091033 00000 n 0001090891 00000 n 0001091192 00000 n 0001091451 00000 n 0001091291 00000 n 0001091701 00000 n 0001091559 00000 n 0001091860 00000 n 0001092119 00000 n 0001091959 00000 n 0001092369 00000 n 0001092227 00000 n 0001092619 00000 n 0001092477 00000 n 0001092869 00000 n 0001092727 00000 n 0001093028 00000 n 0001093287 00000 n 0001093127 00000 n 0001093555 00000 n 0001093395 00000 n 0001093823 00000 n 0001093663 00000 n 0001094073 00000 n 0001093931 00000 n 0001094341 00000 n 0001094181 00000 n 0001094609 00000 n 0001094449 00000 n 0001094877 00000 n 0001094717 00000 n 0001095145 00000 n 0001094985 00000 n 0001095413 00000 n 0001095253 00000 n 0001095681 00000 n 0001095521 00000 n 0001095949 00000 n 0001095789 00000 n 0001096217 00000 n 0001096057 00000 n 0001096485 00000 n 0001096325 00000 n 0001096753 00000 n 0001096593 00000 n 0001097021 00000 n 0001096861 00000 n 0001097289 00000 n 0001097129 00000 n 0001097557 00000 n 0001097397 00000 n 0001097825 00000 n 0001097665 00000 n 0001098093 00000 n 0001097933 00000 n 0001098361 00000 n 0001098201 00000 n 0001098629 00000 n 0001098469 00000 n 0001098898 00000 n 0001098737 00000 n 0001099149 00000 n 0001099006 00000 n 0001099401 00000 n 0001099258 00000 n 0001099653 00000 n 0001099510 00000 n 0001099813 00000 n 0001100074 00000 n 0001099913 00000 n 0001100344 00000 n 0001100183 00000 n 0001100614 00000 n 0001100453 00000 n 0001100884 00000 n 0001100723 00000 n 0001101154 00000 n 0001100993 00000 n 0001101424 00000 n 0001101263 00000 n 0001101694 00000 n 0001101533 00000 n 0001101964 00000 n 0001101803 00000 n 0001102216 00000 n 0001102073 00000 n 0001102376 00000 n 0001102637 00000 n 0001102476 00000 n 0001102815 00000 n 0001103066 00000 n 0001102923 00000 n 0001103226 00000 n 0001103487 00000 n 0001103326 00000 n 0001103757 00000 n 0001103596 00000 n 0001104009 00000 n 0001103866 00000 n 0001104169 00000 n 0001104430 00000 n 0001104269 00000 n 0001104590 00000 n 0001104851 00000 n 0001104690 00000 n 0001105121 00000 n 0001104960 00000 n 0001105391 00000 n 0001105230 00000 n 0001105661 00000 n 0001105500 00000 n 0001105931 00000 n 0001105770 00000 n 0001106201 00000 n 0001106040 00000 n 0001106453 00000 n 0001106310 00000 n 0001106631 00000 n 0001106882 00000 n 0001106739 00000 n 0001107060 00000 n 0001107311 00000 n 0001107168 00000 n 0001107581 00000 n 0001107420 00000 n 0001107851 00000 n 0001107690 00000 n 0001108121 00000 n 0001107960 00000 n 0001108391 00000 n 0001108230 00000 n 0001108661 00000 n 0001108500 00000 n 0001108931 00000 n 0001108770 00000 n 0001109201 00000 n 0001109040 00000 n 0001109471 00000 n 0001109310 00000 n 0001109741 00000 n 0001109580 00000 n 0001110011 00000 n 0001109850 00000 n 0001110281 00000 n 0001110120 00000 n 0000419351 00000 n 0000289706 00000 n 0000293230 00000 n 0001110441 00000 n 0001110688 00000 n 0001110547 00000 n 0001110936 00000 n 0001110795 00000 n 0001111184 00000 n 0001111043 00000 n 0001111432 00000 n 0001111291 00000 n 0001111681 00000 n 0001111539 00000 n 0001111930 00000 n 0001111788 00000 n 0001112180 00000 n 0001112038 00000 n 0001112339 00000 n 0001112598 00000 n 0001112438 00000 n 0001112866 00000 n 0001112706 00000 n 0001113116 00000 n 0001112974 00000 n 0001113293 00000 n 0001113542 00000 n 0001113400 00000 n 0001113792 00000 n 0001113650 00000 n 0001114042 00000 n 0001113900 00000 n 0001114201 00000 n 0001114460 00000 n 0001114300 00000 n 0001114728 00000 n 0001114568 00000 n 0001114996 00000 n 0001114836 00000 n 0001115264 00000 n 0001115104 00000 n 0001115514 00000 n 0001115372 00000 n 0001115764 00000 n 0001115622 00000 n 0001115923 00000 n 0001116182 00000 n 0001116022 00000 n 0001116450 00000 n 0001116290 00000 n 0001116718 00000 n 0001116558 00000 n 0001116986 00000 n 0001116826 00000 n 0001117254 00000 n 0001117094 00000 n 0001117522 00000 n 0001117362 00000 n 0001117790 00000 n 0001117630 00000 n 0001118040 00000 n 0001117898 00000 n 0001118290 00000 n 0001118148 00000 n 0001118540 00000 n 0001118398 00000 n 0001118790 00000 n 0001118648 00000 n 0001118967 00000 n 0001119216 00000 n 0001119074 00000 n 0001119466 00000 n 0001119324 00000 n 0001119716 00000 n 0001119574 00000 n 0001119966 00000 n 0001119824 00000 n 0001120216 00000 n 0001120074 00000 n 0001120466 00000 n 0001120324 00000 n 0001120716 00000 n 0001120574 00000 n 0001120966 00000 n 0001120824 00000 n 0001121125 00000 n 0001121384 00000 n 0001121224 00000 n 0001121634 00000 n 0001121492 00000 n 0001121884 00000 n 0001121742 00000 n 0001122152 00000 n 0001121992 00000 n 0001122420 00000 n 0001122260 00000 n 0001122688 00000 n 0001122528 00000 n 0001122956 00000 n 0001122796 00000 n 0001123224 00000 n 0001123064 00000 n 0001123493 00000 n 0001123332 00000 n 0001123762 00000 n 0001123601 00000 n 0001124032 00000 n 0001123871 00000 n 0001124302 00000 n 0001124141 00000 n 0001124572 00000 n 0001124411 00000 n 0001124842 00000 n 0001124681 00000 n 0001125112 00000 n 0001124951 00000 n 0001125364 00000 n 0001125221 00000 n 0001125616 00000 n 0001125473 00000 n 0001125868 00000 n 0001125725 00000 n 0001126046 00000 n 0001126205 00000 n 0001126466 00000 n 0001126305 00000 n 0001126736 00000 n 0001126575 00000 n 0001127006 00000 n 0001126845 00000 n 0001127258 00000 n 0001127115 00000 n 0001127528 00000 n 0001127367 00000 n 0001127798 00000 n 0001127637 00000 n 0001128068 00000 n 0001127907 00000 n 0001128338 00000 n 0001128177 00000 n 0001128590 00000 n 0001128447 00000 n 0001128842 00000 n 0001128699 00000 n 0001129094 00000 n 0001128951 00000 n 0001129346 00000 n 0001129203 00000 n 0001129598 00000 n 0001129455 00000 n 0001129850 00000 n 0001129707 00000 n 0001130028 00000 n 0001130279 00000 n 0001130136 00000 n 0001130531 00000 n 0001130388 00000 n 0001130709 00000 n 0001130960 00000 n 0001130817 00000 n 0001131230 00000 n 0001131069 00000 n 0001131482 00000 n 0001131339 00000 n 0001131642 00000 n 0001131903 00000 n 0001131742 00000 n 0001132173 00000 n 0001132012 00000 n 0001132425 00000 n 0001132282 00000 n 0001132695 00000 n 0001132534 00000 n 0001132965 00000 n 0001132804 00000 n 0001133235 00000 n 0001133074 00000 n 0001133505 00000 n 0001133344 00000 n 0001133775 00000 n 0001133614 00000 n 0001134027 00000 n 0001133884 00000 n 0001134279 00000 n 0001134136 00000 n 0001134531 00000 n 0001134388 00000 n 0001134783 00000 n 0001134640 00000 n 0001134943 00000 n 0001135204 00000 n 0001135043 00000 n 0000419523 00000 n 0000293254 00000 n 0000296865 00000 n 0001135472 00000 n 0001135313 00000 n 0001135738 00000 n 0001135579 00000 n 0001135986 00000 n 0001135845 00000 n 0001136234 00000 n 0001136093 00000 n 0001136482 00000 n 0001136341 00000 n 0001136658 00000 n 0001136907 00000 n 0001136765 00000 n 0001137175 00000 n 0001137015 00000 n 0001137425 00000 n 0001137283 00000 n 0001137602 00000 n 0001137851 00000 n 0001137709 00000 n 0001138101 00000 n 0001137959 00000 n 0001138351 00000 n 0001138209 00000 n 0001138601 00000 n 0001138459 00000 n 0001138851 00000 n 0001138709 00000 n 0001139101 00000 n 0001138959 00000 n 0001139260 00000 n 0001139519 00000 n 0001139359 00000 n 0001139787 00000 n 0001139627 00000 n 0001140037 00000 n 0001139895 00000 n 0001140287 00000 n 0001140145 00000 n 0001140446 00000 n 0001140705 00000 n 0001140545 00000 n 0001140973 00000 n 0001140813 00000 n 0001141223 00000 n 0001141081 00000 n 0001141473 00000 n 0001141331 00000 n 0001141723 00000 n 0001141581 00000 n 0001141882 00000 n 0001142141 00000 n 0001141981 00000 n 0001142409 00000 n 0001142249 00000 n 0001142677 00000 n 0001142517 00000 n 0001142945 00000 n 0001142785 00000 n 0001143213 00000 n 0001143053 00000 n 0001143390 00000 n 0001143639 00000 n 0001143497 00000 n 0001143798 00000 n 0001144057 00000 n 0001143897 00000 n 0001144325 00000 n 0001144165 00000 n 0001144593 00000 n 0001144433 00000 n 0001144843 00000 n 0001144701 00000 n 0001145093 00000 n 0001144951 00000 n 0001145343 00000 n 0001145201 00000 n 0001145593 00000 n 0001145451 00000 n 0001145752 00000 n 0001146011 00000 n 0001145851 00000 n 0001146279 00000 n 0001146119 00000 n 0001146438 00000 n 0001146697 00000 n 0001146537 00000 n 0001146965 00000 n 0001146805 00000 n 0001147233 00000 n 0001147073 00000 n 0001147392 00000 n 0001147651 00000 n 0001147491 00000 n 0001147919 00000 n 0001147759 00000 n 0001148169 00000 n 0001148027 00000 n 0001148328 00000 n 0001148588 00000 n 0001148427 00000 n 0001148857 00000 n 0001148696 00000 n 0001149109 00000 n 0001148966 00000 n 0001149361 00000 n 0001149218 00000 n 0001149631 00000 n 0001149470 00000 n 0001149901 00000 n 0001149740 00000 n 0001150171 00000 n 0001150010 00000 n 0001150441 00000 n 0001150280 00000 n 0001150711 00000 n 0001150550 00000 n 0001150981 00000 n 0001150820 00000 n 0001151251 00000 n 0001151090 00000 n 0001151521 00000 n 0001151360 00000 n 0001151791 00000 n 0001151630 00000 n 0001152043 00000 n 0001151900 00000 n 0001152203 00000 n 0001152464 00000 n 0001152303 00000 n 0001152624 00000 n 0001152885 00000 n 0001152724 00000 n 0001153137 00000 n 0001152994 00000 n 0001153389 00000 n 0001153246 00000 n 0001153549 00000 n 0001153810 00000 n 0001153649 00000 n 0001154062 00000 n 0001153919 00000 n 0001154314 00000 n 0001154171 00000 n 0001154566 00000 n 0001154423 00000 n 0001154836 00000 n 0001154675 00000 n 0001155088 00000 n 0001154945 00000 n 0001155340 00000 n 0001155197 00000 n 0001155592 00000 n 0001155449 00000 n 0001155844 00000 n 0001155701 00000 n 0001156096 00000 n 0001155953 00000 n 0001156274 00000 n 0001156525 00000 n 0001156382 00000 n 0001156777 00000 n 0001156634 00000 n 0001157029 00000 n 0001156886 00000 n 0001157281 00000 n 0001157138 00000 n 0001157533 00000 n 0001157390 00000 n 0001157803 00000 n 0001157642 00000 n 0001158055 00000 n 0001157912 00000 n 0001158307 00000 n 0001158164 00000 n 0001158577 00000 n 0001158416 00000 n 0001158847 00000 n 0001158686 00000 n 0001159117 00000 n 0001158956 00000 n 0001159387 00000 n 0001159226 00000 n 0001159657 00000 n 0001159496 00000 n 0000419695 00000 n 0000296889 00000 n 0000298190 00000 n 0001159817 00000 n 0001160064 00000 n 0001159923 00000 n 0001160312 00000 n 0001160171 00000 n 0001160470 00000 n 0001160727 00000 n 0001160568 00000 n 0001160993 00000 n 0001160834 00000 n 0001161242 00000 n 0001161100 00000 n 0001161401 00000 n 0001161660 00000 n 0001161500 00000 n 0001161837 00000 n 0001162086 00000 n 0001161944 00000 n 0001162336 00000 n 0001162194 00000 n 0001162513 00000 n 0001162762 00000 n 0001162620 00000 n 0001162939 00000 n 0001163188 00000 n 0001163046 00000 n 0001163347 00000 n 0001163505 00000 n 0001163764 00000 n 0001163604 00000 n 0001164032 00000 n 0001163872 00000 n 0001164300 00000 n 0001164140 00000 n 0001164568 00000 n 0001164408 00000 n 0001164836 00000 n 0001164676 00000 n 0001165086 00000 n 0001164944 00000 n 0001165336 00000 n 0001165194 00000 n 0001165513 00000 n 0001165762 00000 n 0001165620 00000 n 0001166012 00000 n 0001165870 00000 n 0001166189 00000 n 0001166438 00000 n 0001166296 00000 n 0001220804 00000 n 0001220960 00000 n 0001221097 00000 n 0001221233 00000 n 0001221373 00000 n 0001221511 00000 n 0001221651 00000 n 0001221792 00000 n 0001221932 00000 n 0001222070 00000 n 0001222210 00000 n 0001222350 00000 n 0001222488 00000 n 0001222627 00000 n 0001222766 00000 n 0001222904 00000 n 0001223041 00000 n 0001223180 00000 n 0001223320 00000 n 0001223457 00000 n 0001223598 00000 n 0001223738 00000 n 0001223875 00000 n 0001224016 00000 n 0001224155 00000 n 0001224294 00000 n 0001224435 00000 n 0001224575 00000 n 0001224711 00000 n 0001224851 00000 n 0001224988 00000 n 0001225127 00000 n 0001225264 00000 n 0001225403 00000 n 0001225540 00000 n 0001225679 00000 n 0001225818 00000 n 0001225956 00000 n 0001226094 00000 n 0001226232 00000 n 0001226370 00000 n 0001226508 00000 n 0001226677 00000 n 0001226856 00000 n 0001227040 00000 n 0001227224 00000 n 0001227406 00000 n 0001227588 00000 n 0001227770 00000 n 0001227939 00000 n 0001228080 00000 n 0001228221 00000 n 0001228362 00000 n 0001228503 00000 n 0001228644 00000 n 0001228785 00000 n 0001228924 00000 n 0001229065 00000 n 0001229206 00000 n 0001229347 00000 n 0001229488 00000 n 0001229625 00000 n 0001229764 00000 n 0001229905 00000 n 0001230045 00000 n 0001230186 00000 n 0001230325 00000 n 0001230466 00000 n 0001230606 00000 n 0001230742 00000 n 0001230882 00000 n 0001231023 00000 n 0001231163 00000 n 0001231302 00000 n 0001231443 00000 n 0001231584 00000 n 0001231724 00000 n 0001231865 00000 n 0001232002 00000 n 0001232143 00000 n 0001232280 00000 n 0001232419 00000 n 0001232560 00000 n 0001232701 00000 n 0001232840 00000 n 0001232981 00000 n 0001233121 00000 n 0001233259 00000 n 0001233400 00000 n 0001233541 00000 n 0001233680 00000 n 0001233818 00000 n 0001233959 00000 n 0001234100 00000 n 0001234241 00000 n 0001234380 00000 n 0001234521 00000 n 0001234661 00000 n 0001234800 00000 n 0001234941 00000 n 0001235079 00000 n 0001235218 00000 n 0001235359 00000 n 0001235500 00000 n 0001235641 00000 n 0001235779 00000 n 0001235919 00000 n 0001236059 00000 n 0001236199 00000 n 0001236339 00000 n 0001236477 00000 n 0001236617 00000 n 0001236757 00000 n 0001236893 00000 n 0001237034 00000 n 0001237175 00000 n 0001237314 00000 n 0001237453 00000 n 0001237594 00000 n 0001237735 00000 n 0001237876 00000 n 0001238017 00000 n 0001238156 00000 n 0001238295 00000 n 0001238436 00000 n 0001238577 00000 n 0001238718 00000 n 0001238859 00000 n 0001239000 00000 n 0001239141 00000 n 0001239280 00000 n 0001219881 00000 n 0000298214 00000 n 0000304955 00000 n 0000304979 00000 n 0000305187 00000 n 0000305534 00000 n 0000305763 00000 n 0000344903 00000 n 0000344928 00000 n 0000345131 00000 n 0000345802 00000 n 0000346321 00000 n 0000370352 00000 n 0000370377 00000 n 0000370590 00000 n 0000371135 00000 n 0000371537 00000 n 0000398149 00000 n 0000398174 00000 n 0000398382 00000 n 0000398937 00000 n 0000399346 00000 n 0000400396 00000 n 0000400419 00000 n 0000400613 00000 n 0000400916 00000 n 0000401087 00000 n 0000401189 00000 n 0000401289 00000 n 0000401381 00000 n 0000401480 00000 n 0000401586 00000 n 0000401680 00000 n 0000401840 00000 n 0000419867 00000 n 0000419931 00000 n 0000420099 00000 n 0000420273 00000 n 0000420451 00000 n 0000420649 00000 n 0000420871 00000 n 0000421099 00000 n 0000421335 00000 n 0000421591 00000 n 0000421843 00000 n 0000422083 00000 n 0000422339 00000 n 0000422603 00000 n 0000422869 00000 n 0000423097 00000 n 0000423302 00000 n 0000423452 00000 n 0000423623 00000 n 0000423881 00000 n 0000424129 00000 n 0000424367 00000 n 0000424599 00000 n 0000424903 00000 n 0000425163 00000 n 0000425443 00000 n 0000425707 00000 n 0000426011 00000 n 0000426336 00000 n 0000426619 00000 n 0000426872 00000 n 0000427101 00000 n 0000427378 00000 n 0000427639 00000 n 0000427862 00000 n 0000428078 00000 n 0000428229 00000 n 0000428386 00000 n 0000428617 00000 n 0000428900 00000 n 0000429153 00000 n 0000429402 00000 n 0000429682 00000 n 0000429925 00000 n 0000430202 00000 n 0000430479 00000 n 0000430772 00000 n 0000431089 00000 n 0000431402 00000 n 0000431727 00000 n 0000432016 00000 n 0000432333 00000 n 0000432590 00000 n 0000432887 00000 n 0000433156 00000 n 0000433409 00000 n 0000433670 00000 n 0000433935 00000 n 0000434212 00000 n 0000434501 00000 n 0000434778 00000 n 0000435067 00000 n 0000435332 00000 n 0000435627 00000 n 0000435908 00000 n 0000436185 00000 n 0000436490 00000 n 0000436763 00000 n 0000437024 00000 n 0000437309 00000 n 0000437606 00000 n 0000437907 00000 n 0000438224 00000 n 0000438517 00000 n 0000438806 00000 n 0000439077 00000 n 0000439366 00000 n 0000439651 00000 n 0000439936 00000 n 0000440233 00000 n 0000440538 00000 n 0000440843 00000 n 0000441106 00000 n 0000441310 00000 n 0000441541 00000 n 0000441818 00000 n 0000442053 00000 n 0000442300 00000 n 0000442561 00000 n 0000442850 00000 n 0000443085 00000 n 0000443326 00000 n 0000443559 00000 n 0000443792 00000 n 0000444011 00000 n 0000444240 00000 n 0000444449 00000 n 0000444676 00000 n 0000444897 00000 n 0000445110 00000 n 0000445323 00000 n 0000445548 00000 n 0000445779 00000 n 0000445992 00000 n 0000446175 00000 n 0000446444 00000 n 0000446689 00000 n 0000446942 00000 n 0000447199 00000 n 0000447404 00000 n 0000447597 00000 n 0000447788 00000 n 0000448115 00000 n 0000448266 00000 n 0000448439 00000 n 0000448732 00000 n 0000448997 00000 n 0000449274 00000 n 0000449583 00000 n 0000449848 00000 n 0000450117 00000 n 0000450348 00000 n 0000450568 00000 n 0000450719 00000 n 0000450893 00000 n 0000451092 00000 n 0000451317 00000 n 0000451542 00000 n 0000451757 00000 n 0000451946 00000 n 0000452159 00000 n 0000452400 00000 n 0000452665 00000 n 0000452906 00000 n 0000453159 00000 n 0000453354 00000 n 0000453563 00000 n 0000453784 00000 n 0000454009 00000 n 0000454202 00000 n 0000454439 00000 n 0000454704 00000 n 0000454941 00000 n 0000455202 00000 n 0000455419 00000 n 0000455664 00000 n 0000455917 00000 n 0000456196 00000 n 0000456457 00000 n 0000456678 00000 n 0000456919 00000 n 0000457164 00000 n 0000457377 00000 n 0000457602 00000 n 0000457815 00000 n 0000458016 00000 n 0000458225 00000 n 0000458430 00000 n 0000458635 00000 n 0000458824 00000 n 0000459033 00000 n 0000459234 00000 n 0000459443 00000 n 0000459654 00000 n 0000459871 00000 n 0000460072 00000 n 0000460285 00000 n 0000460478 00000 n 0000460695 00000 n 0000460920 00000 n 0000461157 00000 n 0000461382 00000 n 0000461619 00000 n 0000461840 00000 n 0000462085 00000 n 0000462322 00000 n 0000462555 00000 n 0000462808 00000 n 0000463029 00000 n 0000463246 00000 n 0000463491 00000 n 0000463680 00000 n 0000463905 00000 n 0000464154 00000 n 0000464419 00000 n 0000464656 00000 n 0000464881 00000 n 0000465118 00000 n 0000465387 00000 n 0000465640 00000 n 0000465873 00000 n 0000466078 00000 n 0000466323 00000 n 0000466552 00000 n 0000466797 00000 n 0000467042 00000 n 0000467307 00000 n 0000467566 00000 n 0000467855 00000 n 0000468072 00000 n 0000468317 00000 n 0000468550 00000 n 0000468799 00000 n 0000469068 00000 n 0000469281 00000 n 0000469488 00000 n 0000469713 00000 n 0000469884 00000 n 0000470085 00000 n 0000470236 00000 n 0000470409 00000 n 0000470712 00000 n 0000471007 00000 n 0000471230 00000 n 0000471433 00000 n 0000471622 00000 n 0000471841 00000 n 0000472120 00000 n 0000472327 00000 n 0000472560 00000 n 0000472785 00000 n 0000472912 00000 n 0000473144 00000 n 0000473391 00000 n 0000473676 00000 n 0000473961 00000 n 0000474238 00000 n 0000474513 00000 n 0000474782 00000 n 0000475071 00000 n 0000475356 00000 n 0000475645 00000 n 0000475918 00000 n 0000476207 00000 n 0000476488 00000 n 0000476777 00000 n 0000477058 00000 n 0000477331 00000 n 0000477620 00000 n 0000477909 00000 n 0000478186 00000 n 0000478451 00000 n 0000478720 00000 n 0000479009 00000 n 0000479294 00000 n 0000479567 00000 n 0000479838 00000 n 0001182941 00000 n 0000479965 00000 n 0000480159 00000 n 0000480333 00000 n 0000480509 00000 n 0000480685 00000 n 0000480827 00000 n 0000481006 00000 n 0000481182 00000 n 0000481365 00000 n 0000481516 00000 n 0000481744 00000 n 0000481984 00000 n 0000482212 00000 n 0000482468 00000 n 0000482696 00000 n 0000482954 00000 n 0000483184 00000 n 0000483443 00000 n 0000483673 00000 n 0000483932 00000 n 0000484162 00000 n 0000484421 00000 n 0000484651 00000 n 0000484910 00000 n 0000485140 00000 n 0000485399 00000 n 0000485629 00000 n 0000485888 00000 n 0000486118 00000 n 0000486377 00000 n 0000486607 00000 n 0000486864 00000 n 0000487094 00000 n 0000487353 00000 n 0000487583 00000 n 0000487842 00000 n 0000488072 00000 n 0000488331 00000 n 0000488561 00000 n 0000488820 00000 n 0000489050 00000 n 0000489309 00000 n 0000489539 00000 n 0000489798 00000 n 0000490028 00000 n 0000490287 00000 n 0000490517 00000 n 0000490776 00000 n 0000491007 00000 n 0000491267 00000 n 0000491501 00000 n 0000491766 00000 n 0000492000 00000 n 0000492265 00000 n 0000492499 00000 n 0000492764 00000 n 0000492998 00000 n 0000493263 00000 n 0000493497 00000 n 0000493762 00000 n 0000493996 00000 n 0000494261 00000 n 0000494495 00000 n 0000494760 00000 n 0000494994 00000 n 0000495259 00000 n 0000495493 00000 n 0000495758 00000 n 0000495992 00000 n 0000496255 00000 n 0000496489 00000 n 0000496754 00000 n 0000496988 00000 n 0000497253 00000 n 0000497487 00000 n 0000497752 00000 n 0000497988 00000 n 0000498252 00000 n 0000498488 00000 n 0000498754 00000 n 0000498988 00000 n 0000499254 00000 n 0000499488 00000 n 0000499754 00000 n 0000499988 00000 n 0000500254 00000 n 0000500489 00000 n 0000500754 00000 n 0000500990 00000 n 0000501626 00000 n 0000501779 00000 n 0000501913 00000 n 0000502047 00000 n 0000502231 00000 n 0000502395 00000 n 0000502559 00000 n 0000502693 00000 n 0000502868 00000 n 0000503024 00000 n 0000503187 00000 n 0000503352 00000 n 0000503517 00000 n 0000503665 00000 n 0000503924 00000 n 0000504261 00000 n 0000504407 00000 n 0000504541 00000 n 0000504715 00000 n 0000504868 00000 n 0000505040 00000 n 0000505205 00000 n 0000505377 00000 n 0000505530 00000 n 0000505683 00000 n 0000505855 00000 n 0000506020 00000 n 0000506192 00000 n 0000506345 00000 n 0000506498 00000 n 0000506670 00000 n 0000506835 00000 n 0000507007 00000 n 0000507160 00000 n 0000507393 00000 n 0000507540 00000 n 0000507694 00000 n 0000507867 00000 n 0000508033 00000 n 0000508206 00000 n 0000508359 00000 n 0000508578 00000 n 0000508725 00000 n 0000508890 00000 n 0000509044 00000 n 0000509216 00000 n 0000509382 00000 n 0000509554 00000 n 0000509707 00000 n 0000509861 00000 n 0000510033 00000 n 0000510199 00000 n 0000510371 00000 n 0000510524 00000 n 0000510678 00000 n 0000510850 00000 n 0000510985 00000 n 0000511162 00000 n 0000511334 00000 n 0000511487 00000 n 0000511720 00000 n 0000511855 00000 n 0000512013 00000 n 0000512169 00000 n 0000512332 00000 n 0000512763 00000 n 0000512911 00000 n 0000513170 00000 n 0000513507 00000 n 0000513650 00000 n 0000513993 00000 n 0000514431 00000 n 0000514565 00000 n 0000515005 00000 n 0000515169 00000 n 0000515497 00000 n 0000515650 00000 n 0000515814 00000 n 0000515978 00000 n 0000516142 00000 n 0000516493 00000 n 0000516844 00000 n 0000517290 00000 n 0000517424 00000 n 0000517559 00000 n 0000517744 00000 n 0000517909 00000 n 0000518065 00000 n 0000518415 00000 n 0000518550 00000 n 0000518746 00000 n 0000519106 00000 n 0000519324 00000 n 0000519504 00000 n 0000519638 00000 n 0000520015 00000 n 0000520469 00000 n 0000520606 00000 n 0000523248 00000 n 0000523720 00000 n 0000523885 00000 n 0000524050 00000 n 0000524215 00000 n 0000524380 00000 n 0000524545 00000 n 0000524710 00000 n 0000524845 00000 n 0000525021 00000 n 0000525158 00000 n 0000525320 00000 n 0000525498 00000 n 0000528143 00000 n 0000528616 00000 n 0000528781 00000 n 0000528946 00000 n 0000529111 00000 n 0000529276 00000 n 0000529413 00000 n 0000529575 00000 n 0000529739 00000 n 0000531648 00000 n 0000532033 00000 n 0000532198 00000 n 0000532363 00000 n 0000532498 00000 n 0000532674 00000 n 0000533003 00000 n 0000533140 00000 n 0000533302 00000 n 0000533466 00000 n 0000533630 00000 n 0000533794 00000 n 0000534784 00000 n 0000535060 00000 n 0000535225 00000 n 0000535390 00000 n 0000535555 00000 n 0000536548 00000 n 0000536826 00000 n 0000536972 00000 n 0000537136 00000 n 0000537300 00000 n 0000537651 00000 n 0000538002 00000 n 0000538353 00000 n 0000538704 00000 n 0000539055 00000 n 0000539406 00000 n 0000539884 00000 n 0000540049 00000 n 0000540186 00000 n 0000540348 00000 n 0000540512 00000 n 0000542881 00000 n 0000543321 00000 n 0000543456 00000 n 0000543632 00000 n 0000543797 00000 n 0000543962 00000 n 0000544127 00000 n 0000544292 00000 n 0000544452 00000 n 0000544616 00000 n 0000544780 00000 n 0000544914 00000 n 0000545088 00000 n 0000545222 00000 n 0000545396 00000 n 0000545533 00000 n 0000545786 00000 n 0000545974 00000 n 0000547056 00000 n 0000547343 00000 n 0000547508 00000 n 0000549237 00000 n 0000549603 00000 n 0000549768 00000 n 0000549947 00000 n 0000550112 00000 n 0000550249 00000 n 0000552615 00000 n 0000553054 00000 n 0000553219 00000 n 0000553384 00000 n 0000553549 00000 n 0000553714 00000 n 0000553851 00000 n 0000556677 00000 n 0000557171 00000 n 0000557336 00000 n 0000557501 00000 n 0000557666 00000 n 0000557819 00000 n 0000557983 00000 n 0000558334 00000 n 0000558685 00000 n 0000559131 00000 n 0000559295 00000 n 0000559646 00000 n 0000559997 00000 n 0000560348 00000 n 0000560699 00000 n 0000561051 00000 n 0000561403 00000 n 0000561882 00000 n 0000562019 00000 n 0000562181 00000 n 0000562345 00000 n 0000562498 00000 n 0000562577 00000 n 0000562728 00000 n 0000562876 00000 n 0000563059 00000 n 0000563138 00000 n 0000563297 00000 n 0000563450 00000 n 0000563603 00000 n 0000563680 00000 n 0000563831 00000 n 0000563979 00000 n 0000564145 00000 n 0000564328 00000 n 0000564405 00000 n 0000564572 00000 n 0000564725 00000 n 0000564879 00000 n 0000564958 00000 n 0000565109 00000 n 0000565258 00000 n 0000565393 00000 n 0000565571 00000 n 0000565755 00000 n 0000565834 00000 n 0000566001 00000 n 0000566154 00000 n 0000566308 00000 n 0000566385 00000 n 0000566536 00000 n 0000566685 00000 n 0000566839 00000 n 0000566917 00000 n 0000567068 00000 n 0000567234 00000 n 0000567312 00000 n 0000567463 00000 n 0000567616 00000 n 0000567770 00000 n 0000567848 00000 n 0000567999 00000 n 0000568165 00000 n 0000568243 00000 n 0000568394 00000 n 0000568547 00000 n 0000568701 00000 n 0000568779 00000 n 0000568930 00000 n 0000569096 00000 n 0000569174 00000 n 0000569325 00000 n 0000569478 00000 n 0000569632 00000 n 0000569710 00000 n 0000569861 00000 n 0000570027 00000 n 0000570105 00000 n 0000570256 00000 n 0000570409 00000 n 0000570563 00000 n 0000570641 00000 n 0000570792 00000 n 0000570958 00000 n 0000571036 00000 n 0000571187 00000 n 0000571340 00000 n 0000571494 00000 n 0000571572 00000 n 0000571723 00000 n 0000571889 00000 n 0000571967 00000 n 0000572118 00000 n 0000572271 00000 n 0000572425 00000 n 0000572503 00000 n 0000572654 00000 n 0000572820 00000 n 0000572898 00000 n 0000573049 00000 n 0000573202 00000 n 0000573356 00000 n 0000573434 00000 n 0000573585 00000 n 0000573767 00000 n 0000573845 00000 n 0000573996 00000 n 0000574149 00000 n 0000574302 00000 n 0000574380 00000 n 0000574531 00000 n 0000574696 00000 n 0000574774 00000 n 0000574925 00000 n 0000575078 00000 n 0000575333 00000 n 0000575410 00000 n 0000575569 00000 n 0000575722 00000 n 0000575875 00000 n 0000575954 00000 n 0000576105 00000 n 0000576253 00000 n 0000576436 00000 n 0000576515 00000 n 0000576674 00000 n 0000576827 00000 n 0000576980 00000 n 0000577057 00000 n 0000577208 00000 n 0000577356 00000 n 0000577522 00000 n 0000577688 00000 n 0000577855 00000 n 0000578039 00000 n 0000578116 00000 n 0000578299 00000 n 0000578452 00000 n 0000578606 00000 n 0000578685 00000 n 0000578836 00000 n 0000578985 00000 n 0000579152 00000 n 0000579319 00000 n 0000579503 00000 n 0000579582 00000 n 0000579757 00000 n 0000579910 00000 n 0000580064 00000 n 0000580142 00000 n 0000580293 00000 n 0000580475 00000 n 0000580609 00000 n 0000580785 00000 n 0000580968 00000 n 0000581046 00000 n 0000581213 00000 n 0000581366 00000 n 0000581612 00000 n 0000581760 00000 n 0000582100 00000 n 0000582246 00000 n 0000582401 00000 n 0000582563 00000 n 0000582914 00000 n 0000583049 00000 n 0000583411 00000 n 0000583546 00000 n 0000583909 00000 n 0000584261 00000 n 0000584613 00000 n 0000584965 00000 n 0000585317 00000 n 0000585804 00000 n 0000585969 00000 n 0000586321 00000 n 0000586673 00000 n 0000587025 00000 n 0000587377 00000 n 0000587840 00000 n 0000587986 00000 n 0000588150 00000 n 0000588305 00000 n 0000588439 00000 n 0000588611 00000 n 0000588766 00000 n 0000588928 00000 n 0000589092 00000 n 0000589245 00000 n 0000589417 00000 n 0000589583 00000 n 0000589755 00000 n 0000589908 00000 n 0000590062 00000 n 0000590234 00000 n 0000590400 00000 n 0000590572 00000 n 0000590725 00000 n 0000590952 00000 n 0000591099 00000 n 0000591255 00000 n 0000591418 00000 n 0000591583 00000 n 0000591737 00000 n 0000591815 00000 n 0000591966 00000 n 0000592132 00000 n 0000592210 00000 n 0000592361 00000 n 0000592514 00000 n 0000592668 00000 n 0000592747 00000 n 0000592898 00000 n 0000593047 00000 n 0000593214 00000 n 0000593381 00000 n 0000593581 00000 n 0000593764 00000 n 0000593843 00000 n 0000594026 00000 n 0000594179 00000 n 0000594374 00000 n 0000594703 00000 n 0000594849 00000 n 0000595004 00000 n 0000595166 00000 n 0000595330 00000 n 0000595483 00000 n 0000595655 00000 n 0000595820 00000 n 0000595992 00000 n 0000596145 00000 n 0000596363 00000 n 0000596509 00000 n 0000596664 00000 n 0000596827 00000 n 0000596992 00000 n 0000597146 00000 n 0000597318 00000 n 0000597484 00000 n 0000597656 00000 n 0000597809 00000 n 0000598027 00000 n 0000598174 00000 n 0000598330 00000 n 0000598493 00000 n 0000598658 00000 n 0000598812 00000 n 0000598984 00000 n 0000599150 00000 n 0000599322 00000 n 0000599475 00000 n 0000599629 00000 n 0000599801 00000 n 0000599967 00000 n 0000600139 00000 n 0000600292 00000 n 0000600446 00000 n 0000600618 00000 n 0000600784 00000 n 0000600956 00000 n 0000601109 00000 n 0000601342 00000 n 0000601489 00000 n 0000601654 00000 n 0000601810 00000 n 0000601973 00000 n 0000602119 00000 n 0000602272 00000 n 0000602444 00000 n 0000602609 00000 n 0000602781 00000 n 0000602934 00000 n 0000603087 00000 n 0000603259 00000 n 0000603424 00000 n 0000603596 00000 n 0000603749 00000 n 0000603976 00000 n 0000604122 00000 n 0000604277 00000 n 0000604439 00000 n 0000604603 00000 n 0000604756 00000 n 0000604928 00000 n 0000605094 00000 n 0000605266 00000 n 0000605419 00000 n 0000605573 00000 n 0000605745 00000 n 0000605911 00000 n 0000606083 00000 n 0000606236 00000 n 0000606460 00000 n 0000606607 00000 n 0000606763 00000 n 0000606926 00000 n 0000607092 00000 n 0000607248 00000 n 0000607423 00000 n 0000607591 00000 n 0000607766 00000 n 0000607923 00000 n 0000608079 00000 n 0000608254 00000 n 0000608422 00000 n 0000608597 00000 n 0000608754 00000 n 0000608984 00000 n 0000609132 00000 n 0000609298 00000 n 0000609464 00000 n 0000609621 00000 n 0000609785 00000 n 0000609951 00000 n 0000610107 00000 n 0000610282 00000 n 0000610450 00000 n 0000610625 00000 n 0000610782 00000 n 0000610938 00000 n 0000611114 00000 n 0000611282 00000 n 0000611458 00000 n 0000611615 00000 n 0000611845 00000 n 0000611993 00000 n 0000612159 00000 n 0000612325 00000 n 0000612482 00000 n 0000612646 00000 n 0000612803 00000 n 0000612967 00000 n 0000613124 00000 n 0000613288 00000 n 0000613454 00000 n 0000613611 00000 n 0000613787 00000 n 0000613956 00000 n 0000614132 00000 n 0000614290 00000 n 0000614511 00000 n 0000614660 00000 n 0000614827 00000 n 0000614985 00000 n 0000615123 00000 n 0000615300 00000 n 0000615467 00000 n 0000615624 00000 n 0000615800 00000 n 0000615969 00000 n 0000616145 00000 n 0000616303 00000 n 0000616524 00000 n 0000616673 00000 n 0000616831 00000 n 0000616996 00000 n 0000617163 00000 n 0000617320 00000 n 0000617398 00000 n 0000617553 00000 n 0000617722 00000 n 0000617800 00000 n 0000617955 00000 n 0000618113 00000 n 0000618269 00000 n 0000618347 00000 n 0000618502 00000 n 0000618670 00000 n 0000618748 00000 n 0000618903 00000 n 0000619061 00000 n 0000619261 00000 n 0000619409 00000 n 0000619566 00000 n 0000619730 00000 n 0000619896 00000 n 0000620052 00000 n 0000620228 00000 n 0000620396 00000 n 0000620572 00000 n 0000620730 00000 n 0000620886 00000 n 0000621062 00000 n 0000621230 00000 n 0000621406 00000 n 0000621564 00000 n 0000621795 00000 n 0000621944 00000 n 0000622102 00000 n 0000622267 00000 n 0000622434 00000 n 0000622591 00000 n 0000622767 00000 n 0000622936 00000 n 0000623112 00000 n 0000623270 00000 n 0000623491 00000 n 0000623640 00000 n 0000623779 00000 n 0000623943 00000 n 0000624109 00000 n 0000624255 00000 n 0000624401 00000 n 0000624589 00000 n 0000624755 00000 n 0000624921 00000 n 0000625078 00000 n 0000625156 00000 n 0000625311 00000 n 0000625463 00000 n 0000625650 00000 n 0000625728 00000 n 0000625892 00000 n 0000626050 00000 n 0000626207 00000 n 0000626286 00000 n 0000626441 00000 n 0000626593 00000 n 0000626763 00000 n 0000626950 00000 n 0000627029 00000 n 0000627202 00000 n 0000627360 00000 n 0000627517 00000 n 0000627596 00000 n 0000627751 00000 n 0000627903 00000 n 0000628073 00000 n 0000628260 00000 n 0000628339 00000 n 0000628512 00000 n 0000628670 00000 n 0000628827 00000 n 0000628906 00000 n 0000629061 00000 n 0000629208 00000 n 0000629346 00000 n 0000629556 00000 n 0000629725 00000 n 0000629894 00000 n 0000630031 00000 n 0000630211 00000 n 0000630397 00000 n 0000630476 00000 n 0000630667 00000 n 0000630825 00000 n 0000631044 00000 n 0000631181 00000 n 0000631340 00000 n 0000631507 00000 n 0000631674 00000 n 0000631862 00000 n 0000632049 00000 n 0000632236 00000 n 0000632429 00000 n 0000632596 00000 n 0000632784 00000 n 0000632971 00000 n 0000633158 00000 n 0000633351 00000 n 0000633518 00000 n 0000633706 00000 n 0000633893 00000 n 0000634080 00000 n 0000634273 00000 n 0000634612 00000 n 0000634751 00000 n 0000634915 00000 n 0000635102 00000 n 0000635239 00000 n 0000635376 00000 n 0000635585 00000 n 0000635965 00000 n 0000636103 00000 n 0000636477 00000 n 0000636840 00000 n 0000637312 00000 n 0000637470 00000 n 0000637635 00000 n 0000637802 00000 n 0000637990 00000 n 0000638362 00000 n 0000638725 00000 n 0000638863 00000 n 0000639238 00000 n 0000639376 00000 n 0000639751 00000 n 0000639889 00000 n 0000640416 00000 n 0000640573 00000 n 0000640710 00000 n 0000640885 00000 n 0000641042 00000 n 0000641206 00000 n 0000641372 00000 n 0000641538 00000 n 0000641694 00000 n 0000641870 00000 n 0000642039 00000 n 0000642215 00000 n 0000642373 00000 n 0000642530 00000 n 0000642706 00000 n 0000642875 00000 n 0000643051 00000 n 0000643209 00000 n 0000643366 00000 n 0000643543 00000 n 0000643712 00000 n 0000643889 00000 n 0000644047 00000 n 0000644287 00000 n 0000644436 00000 n 0000644603 00000 n 0000644761 00000 n 0000644926 00000 n 0000645093 00000 n 0000645250 00000 n 0000645328 00000 n 0000645483 00000 n 0000645652 00000 n 0000645730 00000 n 0000645885 00000 n 0000646043 00000 n 0000646200 00000 n 0000646278 00000 n 0000646433 00000 n 0000646619 00000 n 0000646697 00000 n 0000646852 00000 n 0000647010 00000 n 0000647210 00000 n 0000647358 00000 n 0000647524 00000 n 0000647681 00000 n 0000647845 00000 n 0000648011 00000 n 0000648168 00000 n 0000648332 00000 n 0000648488 00000 n 0000648664 00000 n 0000648832 00000 n 0000649008 00000 n 0000649166 00000 n 0000649323 00000 n 0000649499 00000 n 0000649668 00000 n 0000649844 00000 n 0000650002 00000 n 0000650159 00000 n 0000650335 00000 n 0000650504 00000 n 0000650680 00000 n 0000650838 00000 n 0000650995 00000 n 0000651171 00000 n 0000651340 00000 n 0000651516 00000 n 0000651674 00000 n 0000651923 00000 n 0000652061 00000 n 0000652222 00000 n 0000652369 00000 n 0000652516 00000 n 0000652663 00000 n 0000652866 00000 n 0000653033 00000 n 0000653191 00000 n 0000653356 00000 n 0000653514 00000 n 0000653679 00000 n 0000653818 00000 n 0000653982 00000 n 0000654139 00000 n 0000654303 00000 n 0000654460 00000 n 0000654624 00000 n 0000654781 00000 n 0000654945 00000 n 0000655111 00000 n 0000655268 00000 n 0000655433 00000 n 0000655591 00000 n 0000655756 00000 n 0000655914 00000 n 0000656079 00000 n 0000656246 00000 n 0000656404 00000 n 0000656569 00000 n 0000656736 00000 n 0000656882 00000 n 0000657041 00000 n 0000657198 00000 n 0000657362 00000 n 0000657508 00000 n 0000657685 00000 n 0000657842 00000 n 0000658006 00000 n 0000658164 00000 n 0000658329 00000 n 0000658496 00000 n 0000658643 00000 n 0000658822 00000 n 0000658980 00000 n 0000659145 00000 n 0000659303 00000 n 0000659468 00000 n 0000659635 00000 n 0000659802 00000 n 0000659949 00000 n 0000660128 00000 n 0000660286 00000 n 0000660451 00000 n 0000660590 00000 n 0000660754 00000 n 0000660911 00000 n 0000661075 00000 n 0000661232 00000 n 0000661396 00000 n 0000661553 00000 n 0000661717 00000 n 0000661874 00000 n 0000662038 00000 n 0000662196 00000 n 0000662361 00000 n 0000662528 00000 n 0000662686 00000 n 0000662851 00000 n 0000663018 00000 n 0000663176 00000 n 0000663341 00000 n 0000663478 00000 n 0000663637 00000 n 0000663794 00000 n 0000663958 00000 n 0000664115 00000 n 0000664279 00000 n 0000664436 00000 n 0000664600 00000 n 0000664766 00000 n 0000664933 00000 n 0000665080 00000 n 0000665218 00000 n 0000665409 00000 n 0000665567 00000 n 0000665705 00000 n 0000665882 00000 n 0000666049 00000 n 0000666216 00000 n 0000666383 00000 n 0000666550 00000 n 0000666751 00000 n 0000667006 00000 n 0000667354 00000 n 0000667511 00000 n 0000667675 00000 n 0000667841 00000 n 0000668034 00000 n 0000668200 00000 n 0000668366 00000 n 0000668523 00000 n 0000668687 00000 n 0000668853 00000 n 0000669011 00000 n 0000669149 00000 n 0000669326 00000 n 0000669493 00000 n 0000669660 00000 n 0000669827 00000 n 0000669994 00000 n 0000670152 00000 n 0000670351 00000 n 0000670517 00000 n 0000670683 00000 n 0000670840 00000 n 0000671004 00000 n 0000671170 00000 n 0000671327 00000 n 0000671464 00000 n 0000671639 00000 n 0000671797 00000 n 0000671962 00000 n 0000672129 00000 n 0000672287 00000 n 0000672452 00000 n 0000672610 00000 n 0000672775 00000 n 0000673114 00000 n 0000673253 00000 n 0000673417 00000 n 0000673583 00000 n 0000673740 00000 n 0000673904 00000 n 0000674070 00000 n 0000674227 00000 n 0000674391 00000 n 0000674548 00000 n 0000674712 00000 n 0000674870 00000 n 0000675035 00000 n 0000675192 00000 n 0000675368 00000 n 0000675537 00000 n 0000675713 00000 n 0000675871 00000 n 0000676028 00000 n 0000676204 00000 n 0000676373 00000 n 0000676549 00000 n 0000676707 00000 n 0000676938 00000 n 0000677087 00000 n 0000677245 00000 n 0000677410 00000 n 0000677567 00000 n 0000677743 00000 n 0000677912 00000 n 0000678088 00000 n 0000678246 00000 n 0000678467 00000 n 0000678616 00000 n 0000678774 00000 n 0000678939 00000 n 0000679087 00000 n 0000679243 00000 n 0000679419 00000 n 0000679587 00000 n 0000679763 00000 n 0000679921 00000 n 0000680077 00000 n 0000680253 00000 n 0000680421 00000 n 0000680597 00000 n 0000680755 00000 n 0000680986 00000 n 0000681134 00000 n 0000681291 00000 n 0000681455 00000 n 0000681621 00000 n 0000681778 00000 n 0000681943 00000 n 0000682110 00000 n 0000682268 00000 n 0000682433 00000 n 0000682600 00000 n 0000682757 00000 n 0000682933 00000 n 0000683102 00000 n 0000683278 00000 n 0000683436 00000 n 0000683657 00000 n 0000683806 00000 n 0000683964 00000 n 0000684129 00000 n 0000684286 00000 n 0000684462 00000 n 0000684631 00000 n 0000684807 00000 n 0000684965 00000 n 0000685122 00000 n 0000685298 00000 n 0000685467 00000 n 0000685643 00000 n 0000685801 00000 n 0000686032 00000 n 0000686181 00000 n 0000686320 00000 n 0000686484 00000 n 0000686640 00000 n 0000686816 00000 n 0000686984 00000 n 0000687160 00000 n 0000687318 00000 n 0000687474 00000 n 0000687650 00000 n 0000687818 00000 n 0000687994 00000 n 0000688152 00000 n 0000688383 00000 n 0000688531 00000 n 0000688688 00000 n 0000688852 00000 n 0000689008 00000 n 0000689184 00000 n 0000689353 00000 n 0000689529 00000 n 0000689687 00000 n 0000689844 00000 n 0000690020 00000 n 0000690189 00000 n 0000690365 00000 n 0000690523 00000 n 0000690754 00000 n 0000690903 00000 n 0000691061 00000 n 0000691226 00000 n 0000691393 00000 n 0000691550 00000 n 0000691726 00000 n 0000691895 00000 n 0000692071 00000 n 0000692229 00000 n 0000692450 00000 n 0000692599 00000 n 0000692757 00000 n 0000692922 00000 n 0000693089 00000 n 0000693246 00000 n 0000693422 00000 n 0000693591 00000 n 0000693767 00000 n 0000693925 00000 n 0000694146 00000 n 0000694295 00000 n 0000694453 00000 n 0000694618 00000 n 0000694785 00000 n 0000694942 00000 n 0000695118 00000 n 0000695287 00000 n 0000695463 00000 n 0000695621 00000 n 0000695842 00000 n 0000695991 00000 n 0000696130 00000 n 0000696294 00000 n 0000696460 00000 n 0000696616 00000 n 0000696792 00000 n 0000696960 00000 n 0000697136 00000 n 0000697294 00000 n 0000697515 00000 n 0000697663 00000 n 0000697820 00000 n 0000697984 00000 n 0000698150 00000 n 0000698306 00000 n 0000698482 00000 n 0000698651 00000 n 0000698827 00000 n 0000698985 00000 n 0000699206 00000 n 0000699355 00000 n 0000699513 00000 n 0000699678 00000 n 0000699845 00000 n 0000700002 00000 n 0000700178 00000 n 0000700347 00000 n 0000700523 00000 n 0000700681 00000 n 0000700838 00000 n 0000701014 00000 n 0000701183 00000 n 0000701359 00000 n 0000701517 00000 n 0000701748 00000 n 0000701897 00000 n 0000702055 00000 n 0000702220 00000 n 0000702387 00000 n 0000702544 00000 n 0000702720 00000 n 0000702889 00000 n 0000703065 00000 n 0000703223 00000 n 0000703440 00000 n 0000703589 00000 n 0000703747 00000 n 0000703912 00000 n 0000704079 00000 n 0000704236 00000 n 0000704412 00000 n 0000704581 00000 n 0000704757 00000 n 0000704915 00000 n 0000705136 00000 n 0000705319 00000 n 0000705476 00000 n 0000705613 00000 n 0000705788 00000 n 0000705954 00000 n 0000706110 00000 n 0000706286 00000 n 0000706454 00000 n 0000706630 00000 n 0000706788 00000 n 0000707009 00000 n 0000707157 00000 n 0000707314 00000 n 0000707461 00000 n 0000707638 00000 n 0000707805 00000 n 0000707962 00000 n 0000708138 00000 n 0000708307 00000 n 0000708483 00000 n 0000708641 00000 n 0000708798 00000 n 0000708974 00000 n 0000709143 00000 n 0000709319 00000 n 0000709477 00000 n 0000709706 00000 n 0000709855 00000 n 0000710013 00000 n 0000710178 00000 n 0000710345 00000 n 0000710502 00000 n 0000710678 00000 n 0000710847 00000 n 0000711023 00000 n 0000711181 00000 n 0000711402 00000 n 0000711551 00000 n 0000711709 00000 n 0000711874 00000 n 0000712032 00000 n 0000712197 00000 n 0000712335 00000 n 0000712514 00000 n 0000712681 00000 n 0000712820 00000 n 0000712984 00000 n 0000713140 00000 n 0000713316 00000 n 0000713484 00000 n 0000713660 00000 n 0000713818 00000 n 0000713974 00000 n 0000714150 00000 n 0000714318 00000 n 0000714494 00000 n 0000714652 00000 n 0000714808 00000 n 0000714984 00000 n 0000715152 00000 n 0000715328 00000 n 0000715486 00000 n 0000715726 00000 n 0000715874 00000 n 0000716040 00000 n 0000716198 00000 n 0000716363 00000 n 0000716520 00000 n 0000716696 00000 n 0000716865 00000 n 0000717041 00000 n 0000717199 00000 n 0000717356 00000 n 0000717532 00000 n 0000717701 00000 n 0000717877 00000 n 0000718035 00000 n 0000718265 00000 n 0000718414 00000 n 0000718581 00000 n 0000718739 00000 n 0000718904 00000 n 0000719061 00000 n 0000719237 00000 n 0000719406 00000 n 0000719582 00000 n 0000719740 00000 n 0000719897 00000 n 0000720073 00000 n 0000720242 00000 n 0000720418 00000 n 0000720576 00000 n 0000720806 00000 n 0000720955 00000 n 0000721122 00000 n 0000721280 00000 n 0000721418 00000 n 0000721595 00000 n 0000721762 00000 n 0000721919 00000 n 0000722095 00000 n 0000722264 00000 n 0000722440 00000 n 0000722598 00000 n 0000722819 00000 n 0000722967 00000 n 0000723124 00000 n 0000723288 00000 n 0000723468 00000 n 0000723634 00000 n 0000723791 00000 n 0000723955 00000 n 0000724121 00000 n 0000724277 00000 n 0000724453 00000 n 0000724621 00000 n 0000724797 00000 n 0000724955 00000 n 0000725172 00000 n 0000725321 00000 n 0000725460 00000 n 0000725624 00000 n 0000725774 00000 n 0000725963 00000 n 0000726100 00000 n 0000726237 00000 n 0000726425 00000 n 0000726591 00000 n 0000726758 00000 n 0000726915 00000 n 0000727091 00000 n 0000727229 00000 n 0000727410 00000 n 0000727586 00000 n 0000727744 00000 n 0000727963 00000 n 0000728101 00000 n 0000728262 00000 n 0000728429 00000 n 0000728596 00000 n 0000728754 00000 n 0000728919 00000 n 0000729086 00000 n 0000729253 00000 n 0000729650 00000 n 0000730103 00000 n 0000730254 00000 n 0000730605 00000 n 0000730771 00000 n 0000730928 00000 n 0000731092 00000 n 0000731258 00000 n 0000731415 00000 n 0000731579 00000 n 0000731745 00000 n 0000731901 00000 n 0000732077 00000 n 0000732246 00000 n 0000732422 00000 n 0000732580 00000 n 0000732737 00000 n 0000732913 00000 n 0000733082 00000 n 0000733258 00000 n 0000733416 00000 n 0000733573 00000 n 0000733749 00000 n 0000733887 00000 n 0000734068 00000 n 0000734244 00000 n 0000734402 00000 n 0000734640 00000 n 0000734789 00000 n 0000734956 00000 n 0000735114 00000 n 0000735279 00000 n 0000735446 00000 n 0000735603 00000 n 0000735681 00000 n 0000735836 00000 n 0000736005 00000 n 0000736083 00000 n 0000736238 00000 n 0000736396 00000 n 0000736552 00000 n 0000736630 00000 n 0000736785 00000 n 0000736953 00000 n 0000737031 00000 n 0000737186 00000 n 0000737344 00000 n 0000737544 00000 n 0000737692 00000 n 0000737849 00000 n 0000738013 00000 n 0000738179 00000 n 0000738336 00000 n 0000738500 00000 n 0000738666 00000 n 0000738822 00000 n 0000738998 00000 n 0000739167 00000 n 0000739343 00000 n 0000739501 00000 n 0000739658 00000 n 0000739834 00000 n 0000740003 00000 n 0000740179 00000 n 0000740337 00000 n 0000740494 00000 n 0000740670 00000 n 0000740839 00000 n 0000741015 00000 n 0000741173 00000 n 0000741409 00000 n 0000741558 00000 n 0000741696 00000 n 0000741875 00000 n 0000742033 00000 n 0000742198 00000 n 0000742365 00000 n 0000742522 00000 n 0000742698 00000 n 0000742867 00000 n 0000743043 00000 n 0000743201 00000 n 0000743358 00000 n 0000743534 00000 n 0000743703 00000 n 0000743879 00000 n 0000744037 00000 n 0000744268 00000 n 0000744417 00000 n 0000744575 00000 n 0000744740 00000 n 0000744888 00000 n 0000745044 00000 n 0000745220 00000 n 0000745388 00000 n 0000745564 00000 n 0000745722 00000 n 0000745878 00000 n 0000746054 00000 n 0000746222 00000 n 0000746398 00000 n 0000746556 00000 n 0000746787 00000 n 0000746935 00000 n 0000747092 00000 n 0000747256 00000 n 0000747422 00000 n 0000747578 00000 n 0000747754 00000 n 0000747923 00000 n 0000748099 00000 n 0000748257 00000 n 0000748478 00000 n 0000748627 00000 n 0000748766 00000 n 0000748930 00000 n 0000749067 00000 n 0000749244 00000 n 0000749410 00000 n 0000749576 00000 n 0000749938 00000 n 0000750300 00000 n 0000750662 00000 n 0000751025 00000 n 0000751506 00000 n 0000751673 00000 n 0000751811 00000 n 0000751990 00000 n 0000752157 00000 n 0000752324 00000 n 0000752491 00000 n 0000752648 00000 n 0000752825 00000 n 0000752963 00000 n 0000753144 00000 n 0000753321 00000 n 0000753479 00000 n 0000753699 00000 n 0000753954 00000 n 0000754105 00000 n 0000754465 00000 n 0000754602 00000 n 0000754761 00000 n 0000754898 00000 n 0000755075 00000 n 0000755212 00000 n 0000755389 00000 n 0000755546 00000 n 0000755684 00000 n 0000755861 00000 n 0000756028 00000 n 0000756391 00000 n 0000756754 00000 n 0000756892 00000 n 0000757367 00000 n 0000757525 00000 n 0000757690 00000 n 0000757828 00000 n 0000758007 00000 n 0000758174 00000 n 0000758331 00000 n 0000758409 00000 n 0000758564 00000 n 0000758716 00000 n 0000758794 00000 n 0000758949 00000 n 0000759107 00000 n 0000759263 00000 n 0000759341 00000 n 0000759496 00000 n 0000759664 00000 n 0000759742 00000 n 0000759897 00000 n 0000760055 00000 n 0000760211 00000 n 0000760289 00000 n 0000760444 00000 n 0000760612 00000 n 0000760690 00000 n 0000760845 00000 n 0000761003 00000 n 0000761212 00000 n 0000761467 00000 n 0000761722 00000 n 0000761977 00000 n 0000762128 00000 n 0000762506 00000 n 0000762643 00000 n 0000762802 00000 n 0000762939 00000 n 0000763116 00000 n 0000763283 00000 n 0000763441 00000 n 0000763606 00000 n 0000763764 00000 n 0000763929 00000 n 0000764087 00000 n 0000764252 00000 n 0000764419 00000 n 0000764577 00000 n 0000764742 00000 n 0000764900 00000 n 0000765065 00000 n 0000765223 00000 n 0000765388 00000 n 0000765727 00000 n 0000765866 00000 n 0000766030 00000 n 0000766196 00000 n 0000766353 00000 n 0000766517 00000 n 0000766674 00000 n 0000766838 00000 n 0000766995 00000 n 0000767159 00000 n 0000767316 00000 n 0000767481 00000 n 0000767639 00000 n 0000767804 00000 n 0000767962 00000 n 0000768127 00000 n 0000768285 00000 n 0000768450 00000 n 0000768608 00000 n 0000768773 00000 n 0000768931 00000 n 0000769096 00000 n 0000769235 00000 n 0000769399 00000 n 0000769556 00000 n 0000769720 00000 n 0000769877 00000 n 0000770041 00000 n 0000770207 00000 n 0000770373 00000 n 0000770539 00000 n 0000770705 00000 n 0000770872 00000 n 0000771030 00000 n 0000771195 00000 n 0000771353 00000 n 0000771491 00000 n 0000771668 00000 n 0000771835 00000 n 0000772002 00000 n 0000772160 00000 n 0000772325 00000 n 0000772492 00000 n 0000772629 00000 n 0000772873 00000 n 0000773039 00000 n 0000773205 00000 n 0000773371 00000 n 0000773528 00000 n 0000773692 00000 n 0000773858 00000 n 0000773996 00000 n 0000774174 00000 n 0000774341 00000 n 0000774508 00000 n 0000774675 00000 n 0000774833 00000 n 0000774998 00000 n 0000775165 00000 n 0000775332 00000 n 0000775499 00000 n 0000775657 00000 n 0000775822 00000 n 0000775980 00000 n 0000776179 00000 n 0000776345 00000 n 0000776502 00000 n 0000776666 00000 n 0000776832 00000 n 0000776998 00000 n 0000777155 00000 n 0000777319 00000 n 0000777485 00000 n 0000777642 00000 n 0000777807 00000 n 0000777974 00000 n 0000778132 00000 n 0000778297 00000 n 0000778455 00000 n 0000778620 00000 n 0000778778 00000 n 0000778943 00000 n 0000779101 00000 n 0000779266 00000 n 0000779405 00000 n 0000779569 00000 n 0000779726 00000 n 0000779890 00000 n 0000780047 00000 n 0000780211 00000 n 0000780368 00000 n 0000780532 00000 n 0000780689 00000 n 0000780853 00000 n 0000781011 00000 n 0000781176 00000 n 0000781334 00000 n 0000781499 00000 n 0000781657 00000 n 0000781822 00000 n 0000781980 00000 n 0000782127 00000 n 0000782304 00000 n 0000782462 00000 n 0000782627 00000 n 0000782766 00000 n 0000782930 00000 n 0000783096 00000 n 0000783253 00000 n 0000783417 00000 n 0000783583 00000 n 0000783740 00000 n 0000783904 00000 n 0000784061 00000 n 0000784225 00000 n 0000784392 00000 n 0000784550 00000 n 0000784715 00000 n 0000784873 00000 n 0000785038 00000 n 0000785196 00000 n 0000785361 00000 n 0000785519 00000 n 0000785684 00000 n 0000785823 00000 n 0000785987 00000 n 0000786144 00000 n 0000786281 00000 n 0000786456 00000 n 0000786622 00000 n 0000786779 00000 n 0000786943 00000 n 0000787109 00000 n 0000787267 00000 n 0000787432 00000 n 0000787590 00000 n 0000787728 00000 n 0000787905 00000 n 0000788063 00000 n 0000788228 00000 n 0000788395 00000 n 0000788553 00000 n 0000788718 00000 n 0000789057 00000 n 0000789196 00000 n 0000789360 00000 n 0000789526 00000 n 0000789683 00000 n 0000789847 00000 n 0000790004 00000 n 0000790168 00000 n 0000790334 00000 n 0000790491 00000 n 0000790655 00000 n 0000790813 00000 n 0000790960 00000 n 0000791137 00000 n 0000791295 00000 n 0000791460 00000 n 0000791627 00000 n 0000791794 00000 n 0000791961 00000 n 0000792100 00000 n 0000792237 00000 n 0000792412 00000 n 0000792578 00000 n 0000792744 00000 n 0000792901 00000 n 0000793065 00000 n 0000793231 00000 n 0000793388 00000 n 0000793553 00000 n 0000793720 00000 n 0000793887 00000 n 0000794045 00000 n 0000794210 00000 n 0000794368 00000 n 0000794533 00000 n 0000794700 00000 n 0000794858 00000 n 0000795023 00000 n 0000795190 00000 n 0000795529 00000 n 0000795668 00000 n 0000795832 00000 n 0000795998 00000 n 0000796155 00000 n 0000796319 00000 n 0000796476 00000 n 0000796640 00000 n 0000796806 00000 n 0000796963 00000 n 0000797127 00000 n 0000797294 00000 n 0000797452 00000 n 0000797590 00000 n 0000797767 00000 n 0000797934 00000 n 0000798101 00000 n 0000798259 00000 n 0000798424 00000 n 0000798591 00000 n 0000798758 00000 n 0000798925 00000 n 0000799064 00000 n 0000799228 00000 n 0000799394 00000 n 0000799560 00000 n 0000799726 00000 n 0000799883 00000 n 0000800047 00000 n 0000800213 00000 n 0000800379 00000 n 0000800536 00000 n 0000800701 00000 n 0000800859 00000 n 0000801024 00000 n 0000801191 00000 n 0000801349 00000 n 0000801514 00000 n 0000801681 00000 n 0000801839 00000 n 0000802004 00000 n 0000802171 00000 n 0000802310 00000 n 0000802474 00000 n 0000802640 00000 n 0000802779 00000 n 0000802943 00000 n 0000803109 00000 n 0000803265 00000 n 0000803440 00000 n 0000803608 00000 n 0000803784 00000 n 0000803942 00000 n 0000804098 00000 n 0000804273 00000 n 0000804441 00000 n 0000804617 00000 n 0000804775 00000 n 0000804931 00000 n 0000805106 00000 n 0000805274 00000 n 0000805450 00000 n 0000805608 00000 n 0000805764 00000 n 0000805939 00000 n 0000806108 00000 n 0000806284 00000 n 0000806442 00000 n 0000806599 00000 n 0000806774 00000 n 0000806943 00000 n 0000807119 00000 n 0000807277 00000 n 0000807434 00000 n 0000807609 00000 n 0000807747 00000 n 0000807928 00000 n 0000808104 00000 n 0000808262 00000 n 0000808529 00000 n 0000808678 00000 n 0000808836 00000 n 0000809001 00000 n 0000809168 00000 n 0000809335 00000 n 0000809698 00000 n 0000810152 00000 n 0000810310 00000 n 0000810475 00000 n 0000810633 00000 n 0000810798 00000 n 0000811137 00000 n 0000811285 00000 n 0000811441 00000 n 0000811617 00000 n 0000811785 00000 n 0000811961 00000 n 0000812119 00000 n 0000812275 00000 n 0000812451 00000 n 0000812619 00000 n 0000812795 00000 n 0000812953 00000 n 0000813109 00000 n 0000813285 00000 n 0000813453 00000 n 0000813629 00000 n 0000813787 00000 n 0000813943 00000 n 0000814119 00000 n 0000814287 00000 n 0000814463 00000 n 0000814621 00000 n 0000814866 00000 n 0000815014 00000 n 0000815181 00000 n 0000815319 00000 n 0000815498 00000 n 0000815656 00000 n 0000815821 00000 n 0000815988 00000 n 0000816145 00000 n 0000816321 00000 n 0000816490 00000 n 0000816666 00000 n 0000816824 00000 n 0000816981 00000 n 0000817157 00000 n 0000817326 00000 n 0000817502 00000 n 0000817660 00000 n 0000817817 00000 n 0000817994 00000 n 0000818163 00000 n 0000818340 00000 n 0000818498 00000 n 0000818655 00000 n 0000818831 00000 n 0000819000 00000 n 0000819176 00000 n 0000819334 00000 n 0000819583 00000 n 0000819732 00000 n 0000819899 00000 n 0000820054 00000 n 0000820220 00000 n 0000820386 00000 n 0000820552 00000 n 0000820691 00000 n 0000820855 00000 n 0000820992 00000 n 0000821169 00000 n 0000821325 00000 n 0000821502 00000 n 0000821653 00000 n 0000821822 00000 n 0000822008 00000 n 0000822203 00000 n 0000822361 00000 n 0000822583 00000 n 0000822721 00000 n 0000822881 00000 n 0000823038 00000 n 0000823215 00000 n 0000823384 00000 n 0000823561 00000 n 0000823719 00000 n 0000823941 00000 n 0000824090 00000 n 0000824247 00000 n 0000824423 00000 n 0000824592 00000 n 0000824768 00000 n 0000824926 00000 n 0000825145 00000 n 0000825294 00000 n 0000825461 00000 n 0000825618 00000 n 0000825794 00000 n 0000825963 00000 n 0000826139 00000 n 0000826297 00000 n 0000826518 00000 n 0000826657 00000 n 0000826821 00000 n 0000826977 00000 n 0000827154 00000 n 0000827291 00000 n 0000827453 00000 n 0000827815 00000 n 0000828177 00000 n 0000828539 00000 n 0000828677 00000 n 0000829163 00000 n 0000829350 00000 n 0000829545 00000 n 0000829703 00000 n 0000829860 00000 n 0000830037 00000 n 0000830175 00000 n 0000830339 00000 n 0000830526 00000 n 0000830712 00000 n 0000830870 00000 n 0000831101 00000 n 0000831356 00000 n 0000831704 00000 n 0000831843 00000 n 0000832007 00000 n 0000832163 00000 n 0000832340 00000 n 0000832508 00000 n 0000832685 00000 n 0000832843 00000 n 0000833065 00000 n 0000833213 00000 n 0000833379 00000 n 0000833535 00000 n 0000833712 00000 n 0000833863 00000 n 0000834049 00000 n 0000834235 00000 n 0000834393 00000 n 0000834549 00000 n 0000834726 00000 n 0000834895 00000 n 0000835072 00000 n 0000835230 00000 n 0000835387 00000 n 0000835563 00000 n 0000835732 00000 n 0000835908 00000 n 0000836066 00000 n 0000836304 00000 n 0000836459 00000 n 0000836625 00000 n 0000836762 00000 n 0000836939 00000 n 0000837096 00000 n 0000837233 00000 n 0000837408 00000 n 0000837574 00000 n 0000837741 00000 n 0000837908 00000 n 0000838247 00000 n 0000838386 00000 n 0000838542 00000 n 0000838620 00000 n 0000838775 00000 n 0000838924 00000 n 0000839080 00000 n 0000839254 00000 n 0000839410 00000 n 0000839584 00000 n 0000839740 00000 n 0000839914 00000 n 0000840081 00000 n 0000840237 00000 n 0000840413 00000 n 0000840569 00000 n 0000840745 00000 n 0000840901 00000 n 0000841077 00000 n 0000841244 00000 n 0000841400 00000 n 0000841576 00000 n 0000841732 00000 n 0000841908 00000 n 0000842065 00000 n 0000842241 00000 n 0000842408 00000 n 0000842565 00000 n 0000842741 00000 n 0000842898 00000 n 0000843074 00000 n 0000843231 00000 n 0000843407 00000 n 0000843574 00000 n 0000843731 00000 n 0000843907 00000 n 0000844064 00000 n 0000844240 00000 n 0000844397 00000 n 0000844573 00000 n 0000844740 00000 n 0000844878 00000 n 0000845047 00000 n 0000845223 00000 n 0000845380 00000 n 0000845556 00000 n 0000845713 00000 n 0000845889 00000 n 0000846056 00000 n 0000846213 00000 n 0000846389 00000 n 0000846546 00000 n 0000846722 00000 n 0000846879 00000 n 0000847055 00000 n 0000847222 00000 n 0000847379 00000 n 0000847555 00000 n 0000847712 00000 n 0000847888 00000 n 0000848045 00000 n 0000848221 00000 n 0000848388 00000 n 0000848545 00000 n 0000848721 00000 n 0000848878 00000 n 0000849054 00000 n 0000849211 00000 n 0000849387 00000 n 0000849554 00000 n 0000849885 00000 n 0000850052 00000 n 0000850209 00000 n 0000850287 00000 n 0000850442 00000 n 0000850591 00000 n 0000850748 00000 n 0000850922 00000 n 0000851079 00000 n 0000851253 00000 n 0000851410 00000 n 0000851584 00000 n 0000851751 00000 n 0000851908 00000 n 0000852084 00000 n 0000852241 00000 n 0000852417 00000 n 0000852574 00000 n 0000852750 00000 n 0000852917 00000 n 0000853074 00000 n 0000853250 00000 n 0000853407 00000 n 0000853583 00000 n 0000853740 00000 n 0000853916 00000 n 0000854083 00000 n 0000854240 00000 n 0000854416 00000 n 0000854573 00000 n 0000854749 00000 n 0000854906 00000 n 0000855082 00000 n 0000855249 00000 n 0000855406 00000 n 0000855582 00000 n 0000855739 00000 n 0000855915 00000 n 0000856072 00000 n 0000856248 00000 n 0000856415 00000 n 0000856572 00000 n 0000856748 00000 n 0000856905 00000 n 0000857081 00000 n 0000857238 00000 n 0000857414 00000 n 0000857581 00000 n 0000857887 00000 n 0000858043 00000 n 0000858121 00000 n 0000858276 00000 n 0000858425 00000 n 0000858581 00000 n 0000858755 00000 n 0000858911 00000 n 0000859085 00000 n 0000859241 00000 n 0000859415 00000 n 0000859582 00000 n 0000859738 00000 n 0000859914 00000 n 0000860070 00000 n 0000860246 00000 n 0000860402 00000 n 0000860481 00000 n 0000860636 00000 n 0000860803 00000 n 0000860959 00000 n 0000861135 00000 n 0000861291 00000 n 0000861467 00000 n 0000861625 00000 n 0000861781 00000 n 0000861957 00000 n 0000862114 00000 n 0000862290 00000 n 0000862447 00000 n 0000862623 00000 n 0000862790 00000 n 0000862947 00000 n 0000863123 00000 n 0000863280 00000 n 0000863456 00000 n 0000863613 00000 n 0000863789 00000 n 0000863956 00000 n 0000864113 00000 n 0000864289 00000 n 0000864446 00000 n 0000864622 00000 n 0000864779 00000 n 0000864955 00000 n 0000865122 00000 n 0000865279 00000 n 0000865455 00000 n 0000865612 00000 n 0000865788 00000 n 0000865945 00000 n 0000866121 00000 n 0000866288 00000 n 0000866445 00000 n 0000866621 00000 n 0000866778 00000 n 0000866954 00000 n 0000867111 00000 n 0000867287 00000 n 0000867454 00000 n 0000867611 00000 n 0000867787 00000 n 0000867944 00000 n 0000868120 00000 n 0000868277 00000 n 0000868453 00000 n 0000868620 00000 n 0000868777 00000 n 0000868953 00000 n 0000869110 00000 n 0000869286 00000 n 0000869443 00000 n 0000869619 00000 n 0000869786 00000 n 0000869943 00000 n 0000870119 00000 n 0000870276 00000 n 0000870452 00000 n 0000870609 00000 n 0000870785 00000 n 0000870952 00000 n 0000871109 00000 n 0000871285 00000 n 0000871442 00000 n 0000871618 00000 n 0000871775 00000 n 0000871951 00000 n 0000872118 00000 n 0000872275 00000 n 0000872451 00000 n 0000872608 00000 n 0000872784 00000 n 0000872941 00000 n 0000873117 00000 n 0000873284 00000 n 0000873635 00000 n 0000873774 00000 n 0000873930 00000 n 0000874008 00000 n 0000874163 00000 n 0000874312 00000 n 0000874468 00000 n 0000874642 00000 n 0000874798 00000 n 0000874972 00000 n 0000875128 00000 n 0000875302 00000 n 0000875469 00000 n 0000875625 00000 n 0000875801 00000 n 0000875957 00000 n 0000876133 00000 n 0000876289 00000 n 0000876465 00000 n 0000876632 00000 n 0000876788 00000 n 0000876964 00000 n 0000877120 00000 n 0000877296 00000 n 0000877453 00000 n 0000877629 00000 n 0000877796 00000 n 0000877953 00000 n 0000878129 00000 n 0000878286 00000 n 0000878462 00000 n 0000878619 00000 n 0000878795 00000 n 0000878962 00000 n 0000879119 00000 n 0000879295 00000 n 0000879452 00000 n 0000879628 00000 n 0000879785 00000 n 0000879961 00000 n 0000880128 00000 n 0000880266 00000 n 0000880435 00000 n 0000880611 00000 n 0000880768 00000 n 0000880944 00000 n 0000881101 00000 n 0000881277 00000 n 0000881444 00000 n 0000881601 00000 n 0000881777 00000 n 0000881934 00000 n 0000882110 00000 n 0000882267 00000 n 0000882443 00000 n 0000882610 00000 n 0000882767 00000 n 0000882943 00000 n 0000883100 00000 n 0000883276 00000 n 0000883433 00000 n 0000883609 00000 n 0000883776 00000 n 0000883933 00000 n 0000884109 00000 n 0000884266 00000 n 0000884442 00000 n 0000884599 00000 n 0000884775 00000 n 0000884942 00000 n 0000885273 00000 n 0000885440 00000 n 0000885597 00000 n 0000885675 00000 n 0000885830 00000 n 0000885979 00000 n 0000886136 00000 n 0000886310 00000 n 0000886467 00000 n 0000886641 00000 n 0000886798 00000 n 0000886972 00000 n 0000887139 00000 n 0000887296 00000 n 0000887472 00000 n 0000887629 00000 n 0000887805 00000 n 0000887962 00000 n 0000888138 00000 n 0000888305 00000 n 0000888462 00000 n 0000888638 00000 n 0000888795 00000 n 0000888971 00000 n 0000889128 00000 n 0000889304 00000 n 0000889471 00000 n 0000889628 00000 n 0000889804 00000 n 0000889961 00000 n 0000890137 00000 n 0000890294 00000 n 0000890470 00000 n 0000890637 00000 n 0000890794 00000 n 0000890970 00000 n 0000891127 00000 n 0000891303 00000 n 0000891460 00000 n 0000891636 00000 n 0000891803 00000 n 0000891960 00000 n 0000892136 00000 n 0000892293 00000 n 0000892469 00000 n 0000892626 00000 n 0000892802 00000 n 0000892969 00000 n 0000893275 00000 n 0000893431 00000 n 0000893509 00000 n 0000893664 00000 n 0000893813 00000 n 0000893969 00000 n 0000894143 00000 n 0000894299 00000 n 0000894473 00000 n 0000894629 00000 n 0000894803 00000 n 0000894970 00000 n 0000895126 00000 n 0000895302 00000 n 0000895458 00000 n 0000895634 00000 n 0000895790 00000 n 0000895869 00000 n 0000896024 00000 n 0000896191 00000 n 0000896347 00000 n 0000896523 00000 n 0000896679 00000 n 0000896855 00000 n 0000897013 00000 n 0000897169 00000 n 0000897345 00000 n 0000897502 00000 n 0000897678 00000 n 0000897835 00000 n 0000898011 00000 n 0000898178 00000 n 0000898335 00000 n 0000898511 00000 n 0000898668 00000 n 0000898844 00000 n 0000899001 00000 n 0000899177 00000 n 0000899344 00000 n 0000899501 00000 n 0000899677 00000 n 0000899834 00000 n 0000900010 00000 n 0000900167 00000 n 0000900343 00000 n 0000900510 00000 n 0000900667 00000 n 0000900843 00000 n 0000901000 00000 n 0000901176 00000 n 0000901333 00000 n 0000901509 00000 n 0000901676 00000 n 0000901833 00000 n 0000902009 00000 n 0000902166 00000 n 0000902342 00000 n 0000902499 00000 n 0000902675 00000 n 0000902842 00000 n 0000902999 00000 n 0000903175 00000 n 0000903332 00000 n 0000903508 00000 n 0000903665 00000 n 0000903841 00000 n 0000904008 00000 n 0000904165 00000 n 0000904341 00000 n 0000904498 00000 n 0000904674 00000 n 0000904831 00000 n 0000905007 00000 n 0000905174 00000 n 0000905331 00000 n 0000905507 00000 n 0000905664 00000 n 0000905840 00000 n 0000905997 00000 n 0000906173 00000 n 0000906340 00000 n 0000906497 00000 n 0000906673 00000 n 0000906830 00000 n 0000907006 00000 n 0000907163 00000 n 0000907339 00000 n 0000907506 00000 n 0000907663 00000 n 0000907839 00000 n 0000907996 00000 n 0000908172 00000 n 0000908329 00000 n 0000908505 00000 n 0000908672 00000 n 0000909023 00000 n 0000909181 00000 n 0000909346 00000 n 0000909709 00000 n 0000910072 00000 n 0000910435 00000 n 0000910798 00000 n 0000911195 00000 n 0000911684 00000 n 0000911839 00000 n 0000912005 00000 n 0000912162 00000 n 0000912522 00000 n 0000912884 00000 n 0000913246 00000 n 0000913608 00000 n 0000914088 00000 n 0000914245 00000 n 0000914605 00000 n 0000915059 00000 n 0000915217 00000 n 0000915382 00000 n 0000915745 00000 n 0000916108 00000 n 0000916571 00000 n 0000916729 00000 n 0000917124 00000 n 0000917261 00000 n 0000917634 00000 n 0000917996 00000 n 0000918467 00000 n 0000918624 00000 n 0000918984 00000 n 0000919346 00000 n 0000919808 00000 n 0000919966 00000 n 0000920131 00000 n 0000920494 00000 n 0000920857 00000 n 0000921320 00000 n 0000921478 00000 n 0000921839 00000 n 0000922202 00000 n 0000922565 00000 n 0000922928 00000 n 0000923409 00000 n 0000923548 00000 n 0000923908 00000 n 0000924270 00000 n 0000924632 00000 n 0000925103 00000 n 0000925260 00000 n 0000925424 00000 n 0000925590 00000 n 0000925952 00000 n 0000926314 00000 n 0000926677 00000 n 0000927040 00000 n 0000927403 00000 n 0000927766 00000 n 0000928265 00000 n 0000928423 00000 n 0000928588 00000 n 0000928951 00000 n 0000929314 00000 n 0000929502 00000 n 0000929846 00000 n 0000930486 00000 n 0000930957 00000 n 0000931114 00000 n 0000931278 00000 n 0000931640 00000 n 0000932002 00000 n 0000932464 00000 n 0000932621 00000 n 0000932981 00000 n 0000933435 00000 n 0000933593 00000 n 0000934036 00000 n 0000934194 00000 n 0000934555 00000 n 0000935009 00000 n 0000935167 00000 n 0000935528 00000 n 0000935891 00000 n 0000936335 00000 n 0000936492 00000 n 0000936852 00000 n 0000937214 00000 n 0000937576 00000 n 0000937713 00000 n 0000938086 00000 n 0000938223 00000 n 0000938597 00000 n 0000938960 00000 n 0000939459 00000 n 0000939617 00000 n 0000940060 00000 n 0000940218 00000 n 0000940383 00000 n 0000940550 00000 n 0000940913 00000 n 0000941276 00000 n 0000941413 00000 n 0000941768 00000 n 0000941905 00000 n 0000942387 00000 n 0000942544 00000 n 0000942986 00000 n 0000943143 00000 n 0000943307 00000 n 0000943474 00000 n 0000943837 00000 n 0000944200 00000 n 0000944563 00000 n 0000944926 00000 n 0000945289 00000 n 0000945652 00000 n 0000946015 00000 n 0000946523 00000 n 0000946681 00000 n 0000946846 00000 n 0000947243 00000 n 0000947605 00000 n 0000947967 00000 n 0000948329 00000 n 0000948691 00000 n 0000949180 00000 n 0000949346 00000 n 0000949503 00000 n 0000949667 00000 n 0000950029 00000 n 0000950392 00000 n 0000950755 00000 n 0000950893 00000 n 0000951268 00000 n 0000951631 00000 n 0000951994 00000 n 0000952357 00000 n 0000952865 00000 n 0000953023 00000 n 0000953188 00000 n 0000953585 00000 n 0000953947 00000 n 0000954309 00000 n 0000954671 00000 n 0000954821 00000 n 0000955194 00000 n 0000955556 00000 n 0000956054 00000 n 0000956220 00000 n 0000956378 00000 n 0000956543 00000 n 0000956906 00000 n 0000957269 00000 n 0000957732 00000 n 0000957871 00000 n 0000958118 00000 n 0000958276 00000 n 0000958541 00000 n 0000958789 00000 n 0000959038 00000 n 0000959287 00000 n 0000959537 00000 n 0000959787 00000 n 0000959946 00000 n 0000960187 00000 n 0000960455 00000 n 0000960723 00000 n 0000960882 00000 n 0000961123 00000 n 0000961391 00000 n 0000961659 00000 n 0000961836 00000 n 0000962077 00000 n 0000962345 00000 n 0000962613 00000 n 0000962881 00000 n 0000963149 00000 n 0000963308 00000 n 0000963575 00000 n 0000963825 00000 n 0000963984 00000 n 0000964225 00000 n 0000964493 00000 n 0000964743 00000 n 0000964993 00000 n 0000965152 00000 n 0000965393 00000 n 0000965661 00000 n 0000965820 00000 n 0000966061 00000 n 0000966329 00000 n 0000966506 00000 n 0000966747 00000 n 0000967015 00000 n 0000967283 00000 n 0000967551 00000 n 0000967819 00000 n 0000968087 00000 n 0000968264 00000 n 0000968531 00000 n 0000968781 00000 n 0000969031 00000 n 0000969190 00000 n 0000969431 00000 n 0000969699 00000 n 0000969949 00000 n 0000970199 00000 n 0000970358 00000 n 0000970599 00000 n 0000970867 00000 n 0000971136 00000 n 0000971406 00000 n 0000971676 00000 n 0000971946 00000 n 0000972216 00000 n 0000972486 00000 n 0000972664 00000 n 0000972907 00000 n 0000973177 00000 n 0000973447 00000 n 0000973717 00000 n 0000973969 00000 n 0000974221 00000 n 0000974473 00000 n 0000974633 00000 n 0000974876 00000 n 0000975054 00000 n 0000975297 00000 n 0000975567 00000 n 0000975837 00000 n 0000976107 00000 n 0000976377 00000 n 0000976645 00000 n 0000976911 00000 n 0000977177 00000 n 0000977443 00000 n 0000977709 00000 n 0000977976 00000 n 0000978244 00000 n 0000978512 00000 n 0000978780 00000 n 0000979048 00000 n 0000979316 00000 n 0000979584 00000 n 0000979852 00000 n 0000980120 00000 n 0000980388 00000 n 0000980656 00000 n 0000980924 00000 n 0000981192 00000 n 0000981460 00000 n 0000981728 00000 n 0000981996 00000 n 0000982264 00000 n 0000982532 00000 n 0000982800 00000 n 0000983050 00000 n 0000983300 00000 n 0000983550 00000 n 0000983709 00000 n 0000983976 00000 n 0000984226 00000 n 0000984476 00000 n 0000984726 00000 n 0000984976 00000 n 0000985226 00000 n 0000985476 00000 n 0000985726 00000 n 0000985976 00000 n 0000986226 00000 n 0000986476 00000 n 0000986726 00000 n 0000986976 00000 n 0000987226 00000 n 0000987476 00000 n 0000987726 00000 n 0000987976 00000 n 0000988226 00000 n 0000988476 00000 n 0000988726 00000 n 0000988976 00000 n 0000989226 00000 n 0000989477 00000 n 0000989728 00000 n 0000989998 00000 n 0000990268 00000 n 0000990538 00000 n 0000990808 00000 n 0000991078 00000 n 0000991348 00000 n 0000991618 00000 n 0000991888 00000 n 0000992158 00000 n 0000992410 00000 n 0000992662 00000 n 0000992914 00000 n 0000993166 00000 n 0000993418 00000 n 0000993670 00000 n 0000993922 00000 n 0000994174 00000 n 0000994426 00000 n 0000994678 00000 n 0000994930 00000 n 0000995182 00000 n 0000995434 00000 n 0000995686 00000 n 0000995938 00000 n 0000996190 00000 n 0000996442 00000 n 0000996694 00000 n 0000996964 00000 n 0000997234 00000 n 0000997504 00000 n 0000997774 00000 n 0000998026 00000 n 0000998278 00000 n 0000998530 00000 n 0000998782 00000 n 0000999034 00000 n 0000999286 00000 n 0000999538 00000 n 0000999790 00000 n 0001000042 00000 n 0001000294 00000 n 0001000546 00000 n 0001000798 00000 n 0001001050 00000 n 0001001302 00000 n 0001001554 00000 n 0001001806 00000 n 0001002058 00000 n 0001002310 00000 n 0001002562 00000 n 0001002814 00000 n 0001003066 00000 n 0001003318 00000 n 0001003570 00000 n 0001003820 00000 n 0001004068 00000 n 0001004316 00000 n 0001004564 00000 n 0001004812 00000 n 0001005061 00000 n 0001005311 00000 n 0001005561 00000 n 0001005811 00000 n 0001006061 00000 n 0001006311 00000 n 0001006561 00000 n 0001006811 00000 n 0001007061 00000 n 0001007311 00000 n 0001007561 00000 n 0001007811 00000 n 0001008061 00000 n 0001008311 00000 n 0001008561 00000 n 0001008811 00000 n 0001009061 00000 n 0001009311 00000 n 0001009561 00000 n 0001009811 00000 n 0001010061 00000 n 0001010311 00000 n 0001010561 00000 n 0001010811 00000 n 0001011061 00000 n 0001011311 00000 n 0001011561 00000 n 0001011811 00000 n 0001012061 00000 n 0001012311 00000 n 0001012561 00000 n 0001012811 00000 n 0001013061 00000 n 0001013311 00000 n 0001013561 00000 n 0001013811 00000 n 0001014061 00000 n 0001014311 00000 n 0001014561 00000 n 0001014811 00000 n 0001015061 00000 n 0001015311 00000 n 0001015561 00000 n 0001015811 00000 n 0001016061 00000 n 0001016312 00000 n 0001016564 00000 n 0001016816 00000 n 0001017068 00000 n 0001017320 00000 n 0001017572 00000 n 0001017824 00000 n 0001018076 00000 n 0001018328 00000 n 0001018580 00000 n 0001018832 00000 n 0001019084 00000 n 0001019336 00000 n 0001019588 00000 n 0001019840 00000 n 0001020092 00000 n 0001020344 00000 n 0001020614 00000 n 0001020884 00000 n 0001021136 00000 n 0001021388 00000 n 0001021658 00000 n 0001021910 00000 n 0001022180 00000 n 0001022450 00000 n 0001022720 00000 n 0001022972 00000 n 0001023224 00000 n 0001023476 00000 n 0001023728 00000 n 0001023980 00000 n 0001024232 00000 n 0001024484 00000 n 0001024736 00000 n 0001024988 00000 n 0001025258 00000 n 0001025528 00000 n 0001025798 00000 n 0001026050 00000 n 0001026302 00000 n 0001026554 00000 n 0001026806 00000 n 0001027058 00000 n 0001027310 00000 n 0001027562 00000 n 0001027814 00000 n 0001028066 00000 n 0001028336 00000 n 0001028606 00000 n 0001028876 00000 n 0001029128 00000 n 0001029380 00000 n 0001029632 00000 n 0001029884 00000 n 0001030136 00000 n 0001030388 00000 n 0001030640 00000 n 0001030892 00000 n 0001031142 00000 n 0001031390 00000 n 0001031638 00000 n 0001031886 00000 n 0001032134 00000 n 0001032401 00000 n 0001032669 00000 n 0001032937 00000 n 0001033205 00000 n 0001033473 00000 n 0001033741 00000 n 0001034009 00000 n 0001034277 00000 n 0001034545 00000 n 0001034813 00000 n 0001035081 00000 n 0001035349 00000 n 0001035617 00000 n 0001035885 00000 n 0001036135 00000 n 0001036385 00000 n 0001036635 00000 n 0001036885 00000 n 0001037135 00000 n 0001037385 00000 n 0001037635 00000 n 0001037885 00000 n 0001038135 00000 n 0001038385 00000 n 0001038635 00000 n 0001038885 00000 n 0001039135 00000 n 0001039385 00000 n 0001039635 00000 n 0001039885 00000 n 0001040135 00000 n 0001040385 00000 n 0001040635 00000 n 0001040885 00000 n 0001041135 00000 n 0001041385 00000 n 0001041635 00000 n 0001041885 00000 n 0001042135 00000 n 0001042385 00000 n 0001042635 00000 n 0001042885 00000 n 0001043135 00000 n 0001043385 00000 n 0001043635 00000 n 0001043886 00000 n 0001044138 00000 n 0001044390 00000 n 0001044642 00000 n 0001044894 00000 n 0001045146 00000 n 0001045398 00000 n 0001045650 00000 n 0001045902 00000 n 0001046154 00000 n 0001046406 00000 n 0001046658 00000 n 0001046910 00000 n 0001047162 00000 n 0001047414 00000 n 0001047574 00000 n 0001047817 00000 n 0001048087 00000 n 0001048339 00000 n 0001048591 00000 n 0001048843 00000 n 0001049095 00000 n 0001049347 00000 n 0001049599 00000 n 0001049851 00000 n 0001050103 00000 n 0001050355 00000 n 0001050607 00000 n 0001050859 00000 n 0001051111 00000 n 0001051363 00000 n 0001051615 00000 n 0001051867 00000 n 0001052119 00000 n 0001052371 00000 n 0001052623 00000 n 0001052875 00000 n 0001053127 00000 n 0001053379 00000 n 0001053631 00000 n 0001053883 00000 n 0001054135 00000 n 0001054387 00000 n 0001054639 00000 n 0001054891 00000 n 0001055143 00000 n 0001055395 00000 n 0001055665 00000 n 0001055935 00000 n 0001056205 00000 n 0001056475 00000 n 0001056727 00000 n 0001056997 00000 n 0001057267 00000 n 0001057519 00000 n 0001057771 00000 n 0001058023 00000 n 0001058275 00000 n 0001058525 00000 n 0001058791 00000 n 0001059057 00000 n 0001059323 00000 n 0001059589 00000 n 0001059856 00000 n 0001060106 00000 n 0001060356 00000 n 0001060606 00000 n 0001060856 00000 n 0001061106 00000 n 0001061356 00000 n 0001061606 00000 n 0001061856 00000 n 0001062106 00000 n 0001062356 00000 n 0001062606 00000 n 0001062856 00000 n 0001063106 00000 n 0001063356 00000 n 0001063606 00000 n 0001063856 00000 n 0001064106 00000 n 0001064356 00000 n 0001064606 00000 n 0001064856 00000 n 0001065106 00000 n 0001065356 00000 n 0001065606 00000 n 0001065856 00000 n 0001066106 00000 n 0001066356 00000 n 0001066606 00000 n 0001066856 00000 n 0001067106 00000 n 0001067356 00000 n 0001067606 00000 n 0001067856 00000 n 0001068106 00000 n 0001068356 00000 n 0001068606 00000 n 0001068856 00000 n 0001069106 00000 n 0001069356 00000 n 0001069606 00000 n 0001069856 00000 n 0001070106 00000 n 0001070356 00000 n 0001070606 00000 n 0001070856 00000 n 0001071107 00000 n 0001071359 00000 n 0001071611 00000 n 0001071863 00000 n 0001072115 00000 n 0001072367 00000 n 0001072619 00000 n 0001072871 00000 n 0001073123 00000 n 0001073375 00000 n 0001073627 00000 n 0001073879 00000 n 0001074131 00000 n 0001074383 00000 n 0001074635 00000 n 0001074887 00000 n 0001075139 00000 n 0001075391 00000 n 0001075643 00000 n 0001075895 00000 n 0001076147 00000 n 0001076399 00000 n 0001076651 00000 n 0001076903 00000 n 0001077155 00000 n 0001077407 00000 n 0001077659 00000 n 0001077911 00000 n 0001078163 00000 n 0001078415 00000 n 0001078667 00000 n 0001078919 00000 n 0001079171 00000 n 0001079423 00000 n 0001079675 00000 n 0001079927 00000 n 0001080179 00000 n 0001080431 00000 n 0001080683 00000 n 0001080953 00000 n 0001081223 00000 n 0001081475 00000 n 0001081727 00000 n 0001081979 00000 n 0001082231 00000 n 0001082483 00000 n 0001082735 00000 n 0001082987 00000 n 0001083239 00000 n 0001083491 00000 n 0001083743 00000 n 0001083995 00000 n 0001084247 00000 n 0001084499 00000 n 0001084751 00000 n 0001085003 00000 n 0001085255 00000 n 0001085507 00000 n 0001085757 00000 n 0001086005 00000 n 0001086253 00000 n 0001086501 00000 n 0001086749 00000 n 0001086998 00000 n 0001087248 00000 n 0001087498 00000 n 0001087748 00000 n 0001087907 00000 n 0001088148 00000 n 0001088416 00000 n 0001088575 00000 n 0001088816 00000 n 0001089084 00000 n 0001089352 00000 n 0001089620 00000 n 0001089779 00000 n 0001090020 00000 n 0001090288 00000 n 0001090538 00000 n 0001090715 00000 n 0001090982 00000 n 0001091141 00000 n 0001091382 00000 n 0001091650 00000 n 0001091809 00000 n 0001092050 00000 n 0001092318 00000 n 0001092568 00000 n 0001092818 00000 n 0001092977 00000 n 0001093218 00000 n 0001093486 00000 n 0001093754 00000 n 0001094022 00000 n 0001094272 00000 n 0001094540 00000 n 0001094808 00000 n 0001095076 00000 n 0001095344 00000 n 0001095612 00000 n 0001095880 00000 n 0001096148 00000 n 0001096416 00000 n 0001096684 00000 n 0001096952 00000 n 0001097220 00000 n 0001097488 00000 n 0001097756 00000 n 0001098024 00000 n 0001098292 00000 n 0001098560 00000 n 0001098829 00000 n 0001099098 00000 n 0001099350 00000 n 0001099602 00000 n 0001099762 00000 n 0001100005 00000 n 0001100275 00000 n 0001100545 00000 n 0001100815 00000 n 0001101085 00000 n 0001101355 00000 n 0001101625 00000 n 0001101895 00000 n 0001102165 00000 n 0001102325 00000 n 0001102568 00000 n 0001102746 00000 n 0001103015 00000 n 0001103175 00000 n 0001103418 00000 n 0001103688 00000 n 0001103958 00000 n 0001104118 00000 n 0001104361 00000 n 0001104539 00000 n 0001104782 00000 n 0001105052 00000 n 0001105322 00000 n 0001105592 00000 n 0001105862 00000 n 0001106132 00000 n 0001106402 00000 n 0001106562 00000 n 0001106831 00000 n 0001106991 00000 n 0001107260 00000 n 0001107512 00000 n 0001107782 00000 n 0001108052 00000 n 0001108322 00000 n 0001108592 00000 n 0001108862 00000 n 0001109132 00000 n 0001109402 00000 n 0001109672 00000 n 0001109942 00000 n 0001110212 00000 n 0001110390 00000 n 0001110637 00000 n 0001110885 00000 n 0001111133 00000 n 0001111381 00000 n 0001111630 00000 n 0001111879 00000 n 0001112129 00000 n 0001112288 00000 n 0001112529 00000 n 0001112797 00000 n 0001113065 00000 n 0001113224 00000 n 0001113491 00000 n 0001113741 00000 n 0001113991 00000 n 0001114150 00000 n 0001114391 00000 n 0001114659 00000 n 0001114927 00000 n 0001115195 00000 n 0001115463 00000 n 0001115713 00000 n 0001115872 00000 n 0001116113 00000 n 0001116381 00000 n 0001116649 00000 n 0001116917 00000 n 0001117185 00000 n 0001117453 00000 n 0001117721 00000 n 0001117989 00000 n 0001118239 00000 n 0001118489 00000 n 0001118739 00000 n 0001118898 00000 n 0001119165 00000 n 0001119415 00000 n 0001119665 00000 n 0001119915 00000 n 0001120165 00000 n 0001120415 00000 n 0001120665 00000 n 0001120915 00000 n 0001121074 00000 n 0001121315 00000 n 0001121583 00000 n 0001121833 00000 n 0001122083 00000 n 0001122351 00000 n 0001122619 00000 n 0001122887 00000 n 0001123155 00000 n 0001123424 00000 n 0001123693 00000 n 0001123963 00000 n 0001124233 00000 n 0001124503 00000 n 0001124773 00000 n 0001125043 00000 n 0001125313 00000 n 0001125565 00000 n 0001125817 00000 n 0001125977 00000 n 0001126154 00000 n 0001126397 00000 n 0001126667 00000 n 0001126937 00000 n 0001127207 00000 n 0001127459 00000 n 0001127729 00000 n 0001127999 00000 n 0001128269 00000 n 0001128539 00000 n 0001128791 00000 n 0001129043 00000 n 0001129295 00000 n 0001129547 00000 n 0001129799 00000 n 0001129959 00000 n 0001130228 00000 n 0001130480 00000 n 0001130640 00000 n 0001130909 00000 n 0001131161 00000 n 0001131431 00000 n 0001131591 00000 n 0001131834 00000 n 0001132104 00000 n 0001132374 00000 n 0001132626 00000 n 0001132896 00000 n 0001133166 00000 n 0001133436 00000 n 0001133706 00000 n 0001133976 00000 n 0001134228 00000 n 0001134480 00000 n 0001134732 00000 n 0001134892 00000 n 0001135135 00000 n 0001135403 00000 n 0001135669 00000 n 0001135935 00000 n 0001136183 00000 n 0001136431 00000 n 0001136589 00000 n 0001136856 00000 n 0001137106 00000 n 0001137374 00000 n 0001137533 00000 n 0001137800 00000 n 0001138050 00000 n 0001138300 00000 n 0001138550 00000 n 0001138800 00000 n 0001139050 00000 n 0001139209 00000 n 0001139450 00000 n 0001139718 00000 n 0001139986 00000 n 0001140236 00000 n 0001140395 00000 n 0001140636 00000 n 0001140904 00000 n 0001141172 00000 n 0001141422 00000 n 0001141672 00000 n 0001141831 00000 n 0001142072 00000 n 0001142340 00000 n 0001142608 00000 n 0001142876 00000 n 0001143144 00000 n 0001143321 00000 n 0001143588 00000 n 0001143747 00000 n 0001143988 00000 n 0001144256 00000 n 0001144524 00000 n 0001144792 00000 n 0001145042 00000 n 0001145292 00000 n 0001145542 00000 n 0001145701 00000 n 0001145942 00000 n 0001146210 00000 n 0001146387 00000 n 0001146628 00000 n 0001146896 00000 n 0001147164 00000 n 0001147341 00000 n 0001147582 00000 n 0001147850 00000 n 0001148118 00000 n 0001148277 00000 n 0001148519 00000 n 0001148788 00000 n 0001149058 00000 n 0001149310 00000 n 0001149562 00000 n 0001149832 00000 n 0001150102 00000 n 0001150372 00000 n 0001150642 00000 n 0001150912 00000 n 0001151182 00000 n 0001151452 00000 n 0001151722 00000 n 0001151992 00000 n 0001152152 00000 n 0001152395 00000 n 0001152573 00000 n 0001152816 00000 n 0001153086 00000 n 0001153338 00000 n 0001153498 00000 n 0001153741 00000 n 0001154011 00000 n 0001154263 00000 n 0001154515 00000 n 0001154767 00000 n 0001155037 00000 n 0001155289 00000 n 0001155541 00000 n 0001155793 00000 n 0001156045 00000 n 0001156205 00000 n 0001156474 00000 n 0001156726 00000 n 0001156978 00000 n 0001157230 00000 n 0001157482 00000 n 0001157734 00000 n 0001158004 00000 n 0001158256 00000 n 0001158508 00000 n 0001158778 00000 n 0001159048 00000 n 0001159318 00000 n 0001159588 00000 n 0001159766 00000 n 0001160013 00000 n 0001160261 00000 n 0001160419 00000 n 0001160658 00000 n 0001160924 00000 n 0001161191 00000 n 0001161350 00000 n 0001161591 00000 n 0001161768 00000 n 0001162035 00000 n 0001162285 00000 n 0001162444 00000 n 0001162711 00000 n 0001162870 00000 n 0001163137 00000 n 0001163296 00000 n 0001163454 00000 n 0001163695 00000 n 0001163963 00000 n 0001164231 00000 n 0001164499 00000 n 0001164767 00000 n 0001165035 00000 n 0001165285 00000 n 0001165444 00000 n 0001165711 00000 n 0001165961 00000 n 0001166120 00000 n 0001166387 00000 n 0001183585 00000 n 0001239419 00000 n 0001239658 00000 n trailer < <639C87FCCE34CDFAD315AC1864A349CF> ] /DocChecksum /798C364111CDE98EC183B50F895C3FBD >> startxref 1240048 %%EOF jq-jq-1.8.0/vendor/decNumber/example1.c000066400000000000000000000030461501676513100176330ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001, 2007. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example1.c -- convert the first two argument words to decNumber, // add them together, and display the result #define DECNUMDIGITS 34 // work with up to 34 digits #include "decNumber.h" // base number library #include // for printf int main(int argc, char *argv[]) { decNumber a, b; // working numbers decContext set; // working context char string[DECNUMDIGITS+14]; // conversion buffer decContextTestEndian(0); // warn if DECLITEND is wrong if (argc<3) { // not enough words printf("Please supply two numbers to add.\n"); return 1; } decContextDefault(&set, DEC_INIT_BASE); // initialize set.traps=0; // no traps, thank you set.digits=DECNUMDIGITS; // set precision decNumberFromString(&a, argv[1], &set); decNumberFromString(&b, argv[2], &set); decNumberAdd(&a, &a, &b, &set); // a=a+b decNumberToString(&a, string); printf("%s + %s => %s\n", argv[1], argv[2], string); return 0; } // main jq-jq-1.8.0/vendor/decNumber/example2.c000066400000000000000000000045541501676513100176410ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example2.c -- calculate compound interest // Arguments are investment, rate (%), and years #define DECNUMDIGITS 38 // work with up to 38 digits #include "decNumber.h" // base number library #include // for printf int main(int argc, char *argv[]) { int need=3; if (argc %s\n", argv[1], argv[2], argv[3], string); } //---------------------------------------------------------------| return 0; } // main jq-jq-1.8.0/vendor/decNumber/example3.c000066400000000000000000000053601501676513100176360ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example3.c -- calculate compound interest, passive checking // Arguments are investment, rate (%), and years #define DECNUMDIGITS 38 // work with up to 38 digits #include "decNumber.h" // base number library #include // for printf int main(int argc, char *argv[]) { int need=3; if (argc %s\n", argv[1], argv[2], argv[3], string); } //---------------------------------------------------------------| return 0; } // main jq-jq-1.8.0/vendor/decNumber/example4.c000066400000000000000000000044011501676513100176320ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example4.c -- add two numbers, active error handling // Arguments are two numbers #define DECNUMDIGITS 38 // work with up to 38 digits #include "decNumber.h" // base number library #include // for printf // [snip... #include // signal handling #include // setjmp/longjmp jmp_buf preserve; // stack snapshot void signalHandler(int); // prototype for GCC void signalHandler(int sig) { signal(SIGFPE, signalHandler); // re-enable longjmp(preserve, sig); // branch to preserved point } // ...snip] int main(int argc, char *argv[]) { decNumber a, b; // working numbers decContext set; // working context char string[DECNUMDIGITS+14]; // conversion buffer int value; // work variable if (argc<3) { // not enough words printf("Please supply two numbers to add.\n"); return 1; } decContextDefault(&set, DEC_INIT_BASE); // initialize // [snip... signal(SIGFPE, signalHandler); // set up signal handler value=setjmp(preserve); // preserve and test environment if (value) { // (non-0 after longjmp) set.status &= DEC_Errors; // keep only errors printf("Signal trapped [%s].\n", decContextStatusToString(&set)); return 1; } // ...snip] // [change from Example 1, here] // leave traps enabled set.digits=DECNUMDIGITS; // set precision decNumberFromString(&a, argv[1], &set); decNumberFromString(&b, argv[2], &set); decNumberAdd(&a, &a, &b, &set); // A=A+B decNumberToString(&a, string); printf("%s + %s => %s\n", argv[1], argv[2], string); return 0; } // main jq-jq-1.8.0/vendor/decNumber/example5.c000066400000000000000000000027341501676513100176420ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001, 2007. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example5.c -- decimal64 conversions #include "decimal64.h" // decimal64 and decNumber library #include // for (s)printf int main(int argc, char *argv[]) { decimal64 a; // working decimal64 number decNumber d; // working number decContext set; // working context char string[DECIMAL64_String]; // number->string buffer char hexes[25]; // decimal64->hex buffer int i; // counter if (argc<2) { // not enough words printf("Please supply a number.\n"); return 1; } decContextDefault(&set, DEC_INIT_DECIMAL64); // initialize decimal64FromString(&a, argv[1], &set); // lay out the decimal64 as eight hexadecimal pairs for (i=0; i<8; i++) { sprintf(&hexes[i*3], "%02x ", a.bytes[i]); } decimal64ToNumber(&a, &d); decNumberToString(&d, string); printf("%s => %s=> %s\n", argv[1], hexes, string); return 0; } // main jq-jq-1.8.0/vendor/decNumber/example6.c000066400000000000000000000056051501676513100176430ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example6.c -- calculate compound interest, using Packed Decimal // Values are investment, rate (%), and years #include "decPacked.h" // base number library #include // for printf int main(int argc, char *argv[]) { { // excerpt for User's Guide starts here--------------------------| decNumber one, mtwo, hundred; // constants decNumber start, rate, years; // parameters decNumber total; // result decContext set; // working context uint8_t startpack[]={0x01, 0x00, 0x00, 0x0C}; // investment=100000 int32_t startscale=0; uint8_t ratepack[]={0x06, 0x5C}; // rate=6.5% int32_t ratescale=1; uint8_t yearspack[]={0x02, 0x0C}; // years=20 int32_t yearsscale=0; uint8_t respack[16]; // result, packed int32_t resscale; // .. char hexes[49]; // for packed->hex int i; // counter if (argc<0) printf("%s", argv[1]); // noop for warning decContextDefault(&set, DEC_INIT_BASE); // initialize set.traps=0; // no traps set.digits=25; // precision 25 decNumberFromString(&one, "1", &set); // set constants decNumberFromString(&mtwo, "-2", &set); decNumberFromString(&hundred, "100", &set); decPackedToNumber(startpack, sizeof(startpack), &startscale, &start); decPackedToNumber(ratepack, sizeof(ratepack), &ratescale, &rate); decPackedToNumber(yearspack, sizeof(yearspack), &yearsscale, &years); decNumberDivide(&rate, &rate, &hundred, &set); // rate=rate/100 decNumberAdd(&rate, &rate, &one, &set); // rate=rate+1 decNumberPower(&rate, &rate, &years, &set); // rate=rate^years decNumberMultiply(&total, &rate, &start, &set); // total=rate*start decNumberRescale(&total, &total, &mtwo, &set); // two digits please decPackedFromNumber(respack, sizeof(respack), &resscale, &total); // lay out the total as sixteen hexadecimal pairs for (i=0; i<16; i++) { sprintf(&hexes[i*3], "%02x ", respack[i]); } printf("Result: %s (scale=%ld)\n", hexes, (long int)resscale); } //---------------------------------------------------------------| return 0; } // main jq-jq-1.8.0/vendor/decNumber/example7.c000066400000000000000000000025411501676513100176400ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001, 2008. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example7.c -- using decQuad to add two numbers together // compile: example7.c decContext.c decQuad.c #include "decQuad.h" // decQuad library #include // for printf int main(int argc, char *argv[]) { decQuad a, b; // working decQuads decContext set; // working context char string[DECQUAD_String]; // number->string buffer decContextTestEndian(0); // warn if DECLITEND is wrong if (argc<3) { // not enough words printf("Please supply two numbers to add.\n"); return 1; } decContextDefault(&set, DEC_INIT_DECQUAD); // initialize decQuadFromString(&a, argv[1], &set); decQuadFromString(&b, argv[2], &set); decQuadAdd(&a, &a, &b, &set); // a=a+b decQuadToString(&a, string); printf("%s + %s => %s\n", argv[1], argv[2], string); return 0; } // main jq-jq-1.8.0/vendor/decNumber/example8.c000066400000000000000000000033231501676513100176400ustar00rootroot00000000000000/* ------------------------------------------------------------------ */ /* Decimal Number Library Demonstration program */ /* ------------------------------------------------------------------ */ /* Copyright (c) IBM Corporation, 2001, 2007. All rights reserved. */ /* ----------------------------------------------------------------+- */ /* right margin -->| */ // example8.c -- using decQuad with the decNumber module // compile: example8.c decContext.c decQuad.c // and: decNumber.c decimal128.c decimal64.c #include "decQuad.h" // decQuad library #include "decimal128.h" // interface to decNumber #include // for printf int main(int argc, char *argv[]) { decQuad a; // working decQuad decNumber numa, numb; // working decNumbers decContext set; // working context char string[DECQUAD_String]; // number->string buffer if (argc<3) { // not enough words printf("Please supply two numbers for power(2*a, b).\n"); return 1; } decContextDefault(&set, DEC_INIT_DECQUAD); // initialize decQuadFromString(&a, argv[1], &set); // get a decQuadAdd(&a, &a, &a, &set); // double a decQuadToNumber(&a, &numa); // convert to decNumber decNumberFromString(&numb, argv[2], &set); decNumberPower(&numa, &numa, &numb, &set); // numa=numa**numb decQuadFromNumber(&a, &numa, &set); // back via a Quad decQuadToString(&a, string); // .. printf("power(2*%s, %s) => %s\n", argv[1], argv[2], string); return 0; } // main jq-jq-1.8.0/vendor/decNumber/readme.txt000066400000000000000000000055021501676513100177500ustar00rootroot00000000000000This is the readme.txt for the decNumber package. It includes instructions for compiling and testing the package; please read them. --------------------------------------------------------------------- decNumber is distributed in two forms; as a complete package from the International Components for Unicode (ICU) site (under an as-is license), or as a collection of Open Source files from the GCC source repository (under the GPL license). If you are using the GCC files, you can obtain the documentation, the example files mentioned below, and this readme from the General Decimal Arithmetic web page -- http://speleotrove.com/decimal/ (the URL for the open source files is also linked from there). The ICU package --------------- The ICU package includes the files: * readme.txt (this file) * ICU-license.html * decNumber.pdf (documentation) * The .c and .h file for each module in the package (see the decNumber documentation), together with other included files. * The .c files for each of the examples (example1.c through example8.c). The ICU package is made available under the terms of the ICU License (ICU 1.8.1 and later) included in the package as ICU-license.html. Your use of that package indicates your acceptance of the terms and conditions of that Agreement. To use and check decNumber -------------------------- Please read the appropriate license and documentation before using this package. If you are upgrading an existing use of decNumber (with version <= 3.37) please read the Changes Appendix for later versions -- you may need to change the DECLITEND flag. 1. Compile and link example1.c, decNumber.c, and decContext.c For instance, use: gcc -o example1 example1.c decNumber.c decContext.c Note: If your compiler does not provide stdint.h or if your C compiler does not handle line comments (// ...), then see the User's Guide section in the documentation for further information (including a sample minimal stdint.h). The use of compiler optimization is strongly recommended (e.g., -O3 for GCC or /O2 for Visual Studio). 2. Run example1 with two numeric arguments, for example: example1 1.23 1.27 this should display: 1.23 + 1.27 => 2.50 3. Similarly, try the other examples, at will. Examples 2->4 require three files to be compiled, like Example 1. Example 5 requires decimal64.c in addition to the core modules. Example 6 requires decPacked.c in addition to the core modules. Example 7 requires only example7.c decContext.c and decQuad.c Example 8 requires example8.c, decContext.c, and decQuad.c, plus decNumber.c, decimal128.c, and decimal64.c (the latter for shared tables and code) jq-jq-1.8.0/vendor/oniguruma/000077500000000000000000000000001501676513100160525ustar00rootroot00000000000000