[
  {
    "path": ".clang-format",
    "content": "---\nLanguage:        Cpp\n# BasedOnStyle:  Google\nAccessModifierOffset: -1\nAlignAfterOpenBracket: Align\nAlignConsecutiveAssignments: false\nAlignConsecutiveDeclarations: false\nAlignEscapedNewlines: Left\nAlignOperands:   true\nAlignTrailingComments: true\nAllowAllParametersOfDeclarationOnNextLine: true\nAllowShortBlocksOnASingleLine: true\nAllowShortCaseLabelsOnASingleLine: false\nAllowShortFunctionsOnASingleLine: All\nAllowShortIfStatementsOnASingleLine: true\nAllowShortLoopsOnASingleLine: true\nAlwaysBreakAfterDefinitionReturnType: None\nAlwaysBreakAfterReturnType: None\nAlwaysBreakBeforeMultilineStrings: true\nAlwaysBreakTemplateDeclarations: Yes\nBinPackArguments: true\nBinPackParameters: true\nBraceWrapping:   \n  AfterClass:      false\n  AfterControlStatement: false\n  AfterEnum:       false\n  AfterFunction:   false\n  AfterNamespace:  false\n  AfterObjCDeclaration: false\n  AfterStruct:     false\n  AfterUnion:      false\n  AfterExternBlock: false\n  BeforeCatch:     false\n  BeforeElse:      false\n  IndentBraces:    false\n  SplitEmptyFunction: true\n  SplitEmptyRecord: true\n  SplitEmptyNamespace: true\nBreakBeforeBinaryOperators: None\nBreakBeforeBraces: Attach\nBreakBeforeInheritanceComma: false\nBreakInheritanceList: BeforeColon\nBreakBeforeTernaryOperators: true\nBreakConstructorInitializersBeforeComma: false\nBreakConstructorInitializers: BeforeColon\nBreakAfterJavaFieldAnnotations: false\nBreakStringLiterals: true\nColumnLimit:     80\nCommentPragmas:  '^ IWYU pragma:'\nCompactNamespaces: false\nConstructorInitializerAllOnOneLineOrOnePerLine: true\nConstructorInitializerIndentWidth: 4\nContinuationIndentWidth: 4\nCpp11BracedListStyle: true\nDerivePointerAlignment: true\nDisableFormat:   false\nExperimentalAutoDetectBinPacking: false\nFixNamespaceComments: true\nForEachMacros:   \n  - foreach\n  - Q_FOREACH\n  - BOOST_FOREACH\nIncludeBlocks:   Preserve\nIncludeCategories: \n  - Regex:           '^<ext/.*\\.h>'\n    Priority:        2\n  - Regex:           '^<.*\\.h>'\n    Priority:        1\n  - Regex:           '^<.*'\n    Priority:        2\n  - Regex:           '.*'\n    Priority:        3\nIncludeIsMainRegex: '([-_](test|unittest))?$'\nIndentCaseLabels: true\nIndentPPDirectives: None\nIndentWidth:     2\nIndentWrappedFunctionNames: false\nJavaScriptQuotes: Leave\nJavaScriptWrapImports: true\nKeepEmptyLinesAtTheStartOfBlocks: false\nMacroBlockBegin: ''\nMacroBlockEnd:   ''\nMaxEmptyLinesToKeep: 1\nNamespaceIndentation: None\nObjCBinPackProtocolList: Never\nObjCBlockIndentWidth: 2\nObjCSpaceAfterProperty: false\nObjCSpaceBeforeProtocolList: false\nPenaltyBreakAssignment: 2\nPenaltyBreakBeforeFirstCallParameter: 1\nPenaltyBreakComment: 300\nPenaltyBreakFirstLessLess: 120\nPenaltyBreakString: 1000\nPenaltyBreakTemplateDeclaration: 10\nPenaltyExcessCharacter: 1000000\nPenaltyReturnTypeOnItsOwnLine: 200\nPointerAlignment: Left\nRawStringFormats: \n  - Language:        Cpp\n    Delimiters:      \n      - cc\n      - CC\n      - cpp\n      - Cpp\n      - CPP\n      - 'c++'\n      - 'C++'\n    CanonicalDelimiter: ''\n    BasedOnStyle:    google\n  - Language:        TextProto\n    Delimiters:      \n      - pb\n      - PB\n      - proto\n      - PROTO\n    EnclosingFunctions: \n      - EqualsProto\n      - EquivToProto\n      - PARSE_PARTIAL_TEXT_PROTO\n      - PARSE_TEST_PROTO\n      - PARSE_TEXT_PROTO\n      - ParseTextOrDie\n      - ParseTextProtoOrDie\n    CanonicalDelimiter: ''\n    BasedOnStyle:    google\nReflowComments:  true\nSortIncludes:    true\nSortUsingDeclarations: true\nSpaceAfterCStyleCast: false\nSpaceAfterTemplateKeyword: true\nSpaceBeforeAssignmentOperators: true\nSpaceBeforeCpp11BracedList: false\nSpaceBeforeCtorInitializerColon: true\nSpaceBeforeInheritanceColon: true\nSpaceBeforeParens: ControlStatements\nSpaceBeforeRangeBasedForLoopColon: true\nSpaceInEmptyParentheses: false\nSpacesBeforeTrailingComments: 2\nSpacesInAngles:  false\nSpacesInContainerLiterals: true\nSpacesInCStyleCastParentheses: false\nSpacesInParentheses: false\nSpacesInSquareBrackets: false\nStandard:        Auto\nTabWidth:        8\nUseTab:          Never\n...\n\n"
  },
  {
    "path": ".clang-tidy",
    "content": "---\nChecks:          'clang-diagnostic-*,clang-analyzer-*,google-*'\nWarningsAsErrors: ''\nHeaderFilterRegex: ''\nAnalyzeTemporaryDtors: false\nFormatStyle:     none\nUser:            brenden\nCheckOptions:    \n  - key:             google-build-namespaces.HeaderFileExtensions\n    value:           ',h,hh,hpp,hxx'\n  - key:             google-global-names-in-headers.HeaderFileExtensions\n    value:           ',h,hh,hpp,hxx'\n  - key:             google-readability-braces-around-statements.ShortStatementLines\n    value:           '1'\n  - key:             google-readability-function-size.BranchThreshold\n    value:           '4294967295'\n  - key:             google-readability-function-size.LineThreshold\n    value:           '4294967295'\n  - key:             google-readability-function-size.NestingThreshold\n    value:           '4294967295'\n  - key:             google-readability-function-size.ParameterThreshold\n    value:           '4294967295'\n  - key:             google-readability-function-size.StatementThreshold\n    value:           '800'\n  - key:             google-readability-function-size.VariableThreshold\n    value:           '4294967295'\n  - key:             google-readability-namespace-comments.ShortNamespaceLines\n    value:           '10'\n  - key:             google-readability-namespace-comments.SpacesBeforeComments\n    value:           '2'\n  - key:             google-runtime-int.SignedTypePrefix\n    value:           int\n  - key:             google-runtime-int.TypeSuffix\n    value:           ''\n  - key:             google-runtime-int.UnsignedTypePrefix\n    value:           uint\n  - key:             google-runtime-references.WhiteListTypes\n    value:           ''\n  - key:             modernize-loop-convert.MaxCopySize\n    value:           '16'\n  - key:             modernize-loop-convert.MinConfidence\n    value:           reasonable\n  - key:             modernize-loop-convert.NamingStyle\n    value:           CamelCase\n  - key:             modernize-pass-by-value.IncludeStyle\n    value:           llvm\n  - key:             modernize-replace-auto-ptr.IncludeStyle\n    value:           llvm\n  - key:             modernize-use-nullptr.NullMacros\n    value:           'NULL'\n...\n\n"
  },
  {
    "path": ".dockerignore",
    "content": "Dockerfile\n.dockerignore\n\n# Ignore SCM/CI related stuff\n.github/\n.git/\n.gitlab-ci.yml\n\n**/.DS_Store\n**/*~\n**/.*.swp\nDoxyfile\npatches/\ndoc/conky.1\nREADME\nbuild*/\ndoc/*.html\n\nMakefile\nCMakeCache.txt\nCMakeFiles\ndata/convertconf.h\ndata/defconfig.h\nlua/libcairo-orig.c\nlua/libcairo.c\nlua/libimlib2.c\n*.so\n*.a\n/config.h\n\n# Ignore vscode stuff\n.vscode\n*.code-workspace\n\n# Ignore tests\ntests/\n"
  },
  {
    "path": ".editorconfig",
    "content": "root = true\n\n[*]\nend_of_line = lf\ninsert_final_newline = true\nindent_style = space\nindent_size = 2\n"
  },
  {
    "path": ".envrc",
    "content": "use flake\n"
  },
  {
    "path": ".git-blame-ignore-revs",
    "content": "# Run this command to always ignore formatting commits in `git blame`\n# git config blame.ignoreRevsFile .git-blame-ignore-revs\n\n# Following commits only reformat/cleanup code and can be ignored when tracking\n# down regressions and introduced bugs:\n\n### Clarifying licensing (SVN@904)\n# Updates license headers\n27b4c8550cfae4fd0f2169962e33f4907a8e7d71\n\n### Reformatted all code (SVN@1007)\n3d26a4880e92df2c6004d85c1be458e35c6bfc3a\n\n# Spelling fixes\nb62e1158300f0644b304f2f8b7e8105ba09073b3\n\n### outsource the whole template object machinery\n# Moves template variables code from core.c into template.c\nff199355f66216600c4bdc6bec4743afe5b61470\n\n### Add formatting/static analysis (#486)\n# Large cleanup of codebase that fixed indentation in most files\neebc8c653b34eb946d23ceb913ed5d69cc22f10e\n\n### Build improvements: clang-tidy, sonar, Dockerfile. (#488)\n# Touches most files with minor changes (NULL -> nullptr)\n4b92556fca9cbede3cbac4112f0a24b554390099\n\n### Use clang-format\n# Applies clang-format formatting\n033508a93e6b0440ddbd2376c1e97b69e3308687\n\n### Move X11 stuff from conky.cc to display-x11\n281097a2a562ef58e5604a3519f739c715ba5410\n\n### Get rid of silly `if (not ...` expressions (#713)\n3a3092902ee8a5fda71996d264f981b98375c6a3\n\n### Fix docbook2x handling.\n# Large diff, affects only docbook2x which is no longer used\nc6ad28074af3ec1bb4b3cc052df58062ce2a7c9b\n\n### Fix MAINTAINER_MODE (-Wall -Werror -Wpedantic) (#714)\n# Large diff, minor refactoring changes\n9af6fa7903c5cb6f05614deac23373d4d0cf5959\n\n### Refactor docs, make a new website\n# Large diff, no changes affecting code\n47ad3f9982baea4069a5c37ffdb2e1523e504f18\n\n### Fix issues building without BUILD_ARGB flag\n# Changes a lot of indentations in x11.cc\nf6d42c5a69fed134a8b4ed0602c892f6f7b6e242\n### Fix DependentOptions splitting arguments on spaces\n# Again, indentation changes in x11.cc\ncbebe447078e28c50957d568303f42d6b8aae126\n\n### Cleanup build flags, global namespace and includes (#1841)\n# Large refactor of global namespace\n# Includes changes to functionality so it can't be ignored:\n# color parsing, text alignment, output registration\n# 6adf6b9dd4d368640bf7ef57f3e6199d83154d78\n\n### Move sources into appropriate subdirectories (#2119)\n# Performed no changes to the source files, only moved them. Child commit\n# addressed the bugs caused by the move, to separate renames from changes.\n342f07b8ca101e0c4ef5c75346033c4df241d16d\nae8f1fa8472d6c3a31b4a09be4d19568a3f3f23e\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "# These are supported funding model platforms\n\ngithub: brndnmtthws\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.yml",
    "content": "name: 🐞 Bug Report\ndescription: 'File a bug report: crashes, unexpected behaviour, and other errors go here.'\ntitle: '[Bug]: '\nlabels: ['bug', 'triage']\nbody:\n  - type: markdown\n    attributes:\n      value: |\n        If you haven't done so already, please take a moment to search the [existing issues](https://github.com/brndnmtthws/conky/issues) to see if this has been previously reported. If not, carry on.\n\n        Thanks for taking the time to fill out this bug report!\n  - type: textarea\n    id: what-happened\n    attributes:\n      label: What happened?\n      description: >\n        Describe the problem, what you expected to happen, and any other\n        relevant info. You can attach logs, stack traces, and config below. If\n        required, include screenshots here which demonstrate the problem.\n      placeholder: Here's what happened\n    validations:\n      required: true\n  - type: input\n    id: version\n    attributes:\n      label: Version\n      description: What version of Conky are you running?\n    validations:\n      required: true\n  - type: dropdown\n    id: os\n    validations:\n      required: true\n    attributes:\n      label: Which OS/distro are you seeing the problem on?\n      options:\n        - Ubuntu\n        - Fedora\n        - Debian\n        - Arch Linux\n        - Gentoo\n        - Linux (other)\n        - macOS\n  - type: textarea\n    id: config\n    attributes:\n      label: Conky config\n      description: Paste your Conky config here if it's relevant.\n      render: Lua\n  - type: markdown\n    attributes:\n      value: |\n        ## Getting a stack trace\n\n        If you are reporting a crash, please attach a stack trace below.\n\n        To create one with `gdb`, try the following steps:\n\n        ```shell\n        # Start 'conky'\n        $ gdb conky\n\n        # Run 'conky' with a config.\n        (gdb) run -c ~/.your_conky.conf\n\n        # Wait for a crash to occur, then run this.\n        (gdb) bt full\n\n        # ... stack trace output here ...\n        ```\n\n        Here are some additional resources on obtaining stack traces:\n        - [Arch Linux Wiki](https://wiki.archlinux.org/index.php/Debug_-_Getting_Traces)\n        - [Ubuntu Wiki](https://wiki.ubuntu.com/DebuggingProgramCrash)\n        - [AskUbuntu - Where do I find core dump files, and how do I view and analyze the backtrace (stack trace) in one?](https://askubuntu.com/a/1349048)\n        - [Julia Evans - How to get a core dump for a segfault on Linux](https://jvns.ca/blog/2018/04/28/debugging-a-segfault-on-linux/)\n        - [GDB Documentation](https://sourceware.org/gdb/current/onlinedocs/gdb/)\n        - [lldb Documentation](https://lldb.llvm.org/use/tutorial.html)\n  - type: textarea\n    id: stacktrace\n    attributes:\n      label: Stack trace\n      description: Paste your stacktrace here if you have one.\n      render: GDB\n  - type: textarea\n    id: logs\n    attributes:\n      label: Relevant log output\n      description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.\n      render: Shell\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "content": "blank_issues_enabled: true\ncontact_links:\n  - name: 🙏 General questions & help\n    url: https://github.com/brndnmtthws/conky/discussions/categories/q-a\n    about: Please ask and answer general questions using GitHub Discussions\n  - name: 💡 New ideas and feature requests\n    url: https://github.com/brndnmtthws/conky/discussions/categories/ideas\n    about: Request and discuss enhancements using GitHub Discussions\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "# Set update schedule for GitHub Actions\n\nversion: 2\nupdates:\n  # Maintain dependencies for actions\n  - package-ecosystem: 'github-actions'\n    directory: '/'\n    schedule:\n      interval: 'weekly'\n    groups:\n      actions:\n        patterns:\n          - '*'\n\n  # Maintain dependencies for web docs/npm\n  - package-ecosystem: 'npm'\n    directory: '/web'\n    schedule:\n      interval: 'weekly'\n    groups:\n      web-deps:\n        patterns:\n          # Group all the web deps together to keep the PR spam down\n          - '*'\n"
  },
  {
    "path": ".github/instructions/cmake-review.instructions.md",
    "content": "---\napplyTo: 'CMakeLists.txt,cmake/**/*.cmake,tests/CMakeLists.txt,src/CMakeLists.txt,lua/CMakeLists.txt,data/CMakeLists.txt,doc/CMakeLists.txt,extras/CMakeLists.txt,3rdparty/CMakeLists.txt'\nexcludeAgent: 'coding-agent'\n---\n\n# Conky Build-System Review Instructions\n\nPrioritize build reproducibility and CI parity.\n\nFocus review comments on:\n\n- Option defaults and interactions (`MAINTAINER_MODE`, `BUILD_TESTING`, `CHECK_CODE_QUALITY`, `CODE_COVERAGE`) that may change expected developer or CI behavior.\n- Platform/compiler conditionals that could break Linux/macOS matrix builds.\n- Dependency/linking changes that risk optional feature regressions.\n- New targets/commands that are not wired into existing workflows or documented usage.\n\nValidation expectations:\n\n- Build paths should remain compatible with `cmake . -B build -G Ninja -DMAINTAINER_MODE=ON`.\n- Test execution should remain compatible with `ctest --output-on-failure` from `build/`.\n- Format-related guidance should align with available targets (`clang-format`, `check-clang-format`) and their configuration preconditions.\n\nRaise comments when CMake changes alter cache variable semantics without migration notes or clear rationale.\n"
  },
  {
    "path": ".github/instructions/cpp-review.instructions.md",
    "content": "---\napplyTo: 'src/**/*.cc,src/**/*.hh,src/**/*.hpp,src/**/*.h,src/**/*.cpp,tests/**/*.cc,tests/**/*.hh,tests/**/*.hpp,tests/**/*.h,lua/**/*.cc,lua/**/*.hh,lua/**/*.hpp,lua/**/*.h'\nexcludeAgent: 'coding-agent'\n---\n\n# Conky C/C++ Review Instructions\n\nPrioritize behavioral correctness, regressions, and runtime safety over style-only feedback.\n\nFocus review comments on:\n\n- Changes to text object registration (for example `OBJ`, `OBJ_ARG`, `OBJ_IF`, and `OBJ_IF_ARG` in `construct_text_object()` in `src/core.cc`) and update logic (`update_cb` + `conky::callback_handle`) that could break refresh cadence, caching, or responsiveness.\n- Backend behavior across output modes (`display_output_base` descendants), especially graceful degradation for ncurses and HTTP outputs.\n- Platform-guarded logic under `src/data/os/` and tests that should mirror implementation `#ifdef` boundaries.\n- Lifetime/ownership bugs, null dereferences, unchecked conversions, out-of-bounds access, and unintended copies in hot paths.\n\nTesting expectations:\n\n- New behavior should have or update tests in `tests/test-*.cc`.\n- Encourage focused test runs with `./build/tests/test-conky \"<test-or-tag>\"` and full verification with `ctest --test-dir build --output-on-failure`.\n- If behavior changed but no test changed, ask for justification.\n\nDo not request purely stylistic changes already enforced by clang-format unless readability or correctness is impacted.\n"
  },
  {
    "path": ".github/instructions/workflow-review.instructions.md",
    "content": "---\napplyTo: '.github/workflows/**/*.yml,.github/workflows/**/*.yaml,.github/scripts/**/*.sh,.github/scripts/**/*.bash,Dockerfile,tests/dockerfiles/**'\nexcludeAgent: 'coding-agent'\n---\n\n# Conky CI/Release Review Instructions\n\nPrioritize signal quality and release safety.\n\nFocus review comments on:\n\n- Steps that could mask failures (missing `set -e`, ignored exit codes, or removed test stages).\n- Drift from project CI expectations: configure, build, and run tests (`ctest --output-on-failure`) on supported matrices.\n- Cache key changes that risk stale artifacts or ineffective caching.\n- Changes affecting release artifacts (AppImage, Docker, checksums, signing) and versioning correctness.\n- Security concerns in actions usage (unpinned third-party actions, unsafe token exposure, or over-broad permissions).\n\nRequire explicit rationale when reducing matrix coverage or disabling optional feature combinations that currently run in CI.\n"
  },
  {
    "path": ".github/labeler.yml",
    "content": "documentation:\n  - changed-files:\n      - any-glob-to-any-file:\n          - doc/**/*\n          - data/conky*.conf\n\nextras:\n  - changed-files:\n      - any-glob-to-any-file:\n          - extras/**/*\n\nsources:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/**/*\n\ntests:\n  - changed-files:\n      - any-glob-to-any-file:\n          - tests/**/*\n\nweb:\n  - changed-files:\n      - any-glob-to-any-file:\n          - web/**/*\n\njavascript:\n  - changed-files:\n      - any-glob-to-any-file:\n          - web/**/*.tsx\n          - web/**/*.jsx\n          - web/**/*.ts\n          - web/**/*.js\n\nappimage:\n  - changed-files:\n      - any-glob-to-any-file:\n          - appimage/*\n          - appimage/**/*\n\n3rdparty:\n  - changed-files:\n      - any-glob-to-any-file:\n          - 3rdparty/**/*\n\ngh-actions:\n  - changed-files:\n      - any-glob-to-any-file:\n          - .github/workflows/*\n          - .github/workflows/**/*\n          - .github/labeler.yml\n          - .github/pull_request_template.md\n\ndependencies:\n  - changed-files:\n      - any-glob-to-any-file:\n          - web/package-lock.json\n          - cmake/ConkyPlatformChecks.cmake\n\naudio:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/audio/**/*\n\npower:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/hardware/apcupsd.cc\n          - src/data/hardware/apcupsd.h\n          - src/data/hardware/bsdapm.cc\n          - src/data/hardware/bsdapm.h\n          - src/data/hardware/smapi.cc\n          - src/data/hardware/smapi.h\n\n'display: console':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/output/display-console.cc\n          - src/output/display-console.hh\n'display: file':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/output/display-file.cc\n          - src/output/display-file.hh\n'display: http':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/output/display-http.cc\n          - src/output/display-http.hh\n'display: ncurses':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/output/nc.cc\n          - src/output/nc.h\n          - src/output/display-ncurses.cc\n          - src/output/display-ncurses.hh\n'display: wayland':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/wl_protocols/**/*\n          - src/output/wl.cc\n          - src/output/wl.h\n          - src/output/display-wayland.cc\n          - src/output/display-wayland.hh\n'display: x11':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/output/*x11*.cc\n          - src/output/*x11*.h\n          - src/output/*x11*.hh\n\n'build system':\n  - changed-files:\n      - any-glob-to-any-file:\n          - 'CMakeLists.txt'\n          - 'cmake/**/*'\n\ncairo:\n  - changed-files:\n      - any-glob-to-any-file:\n          - 'lua/*cairo*'\n\n'disk io':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/hardware/diskio.cc\n          - src/data/hardware/diskio.h\n\n'sensors':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/hardware/hddtemp.cc\n          - src/data/hardware/hddtemp.h\n          - src/data/hardware/i8k.cc\n          - src/data/hardware/i8k.h\n          - src/data/hardware/sony.cc\n          - src/data/hardware/sony.h\n\ncpu:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/hardware/cpu.cc\n          - src/data/hardware/cpu.h\n          - src/data/proc.cc\n          - src/data/proc.h\n          - src/data/top.cc\n          - src/data/top.h\n\nlua:\n  - changed-files:\n      - any-glob-to-any-file:\n          - lua/**/*\n          - src/lua/**/*\n\n'os: linux':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/linux.cc\n          - src/data/os/linux.h\n\n'os: dragonfly':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/dragonfly.cc\n          - src/data/os/dragonfly.h\n\n'os: freebsd':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/freebsd.cc\n          - src/data/os/freebsd.h\n\n'os: haiku':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/haiku.cc\n          - src/data/os/haiku.h\n\n'os: netbsd':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/netbsd.cc\n          - src/data/os/netbsd.h\n\n'os: openbsd':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/openbsd.cc\n          - src/data/os/openbsd.h\n\n'os: solaris':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/solaris.cc\n          - src/data/os/solaris.h\n\n'os: macos':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/os/darwin_sip.h\n          - src/data/os/darwin.h\n          - src/data/os/darwin.mm\n\n'mouse events':\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/mouse-events.cc\n          - src/mouse-events.h\n\nnetworking:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/network/**/*\n\nmail:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/network/mail.cc\n          - src/data/network/mail.h\n\ncalendar:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/network/ical.cc\n          - src/data/network/ical.h\n\nnvidia:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/data/hardware/nvidia.cc\n          - src/data/hardware/nvidia.h\n\nrendering:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/output/gui.cc\n          - src/output/gui.h\n          - src/specials.cc\n          - src/specials.h\n\ntext:\n  - changed-files:\n      - any-glob-to-any-file:\n          - src/content/**/*\n"
  },
  {
    "path": ".github/pull_request_template.md",
    "content": "# Checklist\n- [ ] I have described the changes\n- [ ] I have linked to any relevant GitHub issues, if applicable\n- [ ] Documentation in `doc/` has been updated\n- [ ] All new code is licensed under GPLv3\n\n## Description\n\n* Describe the changes, why they were necessary, etc\n* Describe how the changes will affect existing behaviour.\n* Describe how you tested and validated your changes.\n* Include any relevant screenshots/evidence demonstrating that the changes work and have been tested.\n"
  },
  {
    "path": ".github/release.yml",
    "content": "changelog:\n  categories:\n    - title: 🏕 Features\n      labels:\n        - feature\n    - title: 🧪 Improvements\n      labels:\n        - enhancement\n    - title: 🐞 Bug fixes\n      labels:\n        - bug\n        - regression\n    - title: 🎛️ Miscellaneous\n      labels:\n        - '*'\n      exclude:\n        labels:\n          - dependencies\n          - bug\n          - regression\n          - feature\n          - enhancement\n    - title: 👒 Dependencies\n      labels:\n        - dependencies\n"
  },
  {
    "path": ".github/scripts/docker-build.bash",
    "content": "#!/usr/bin/env bash\nset -e\n\nDH_USERNAME=\"${DOCKERHUB_USERNAME:-conky}\"\nDOCKERHUB_IMAGE_ID=$DH_USERNAME/$IMAGE_NAME\n\n# Change all uppercase to lowercase\nDOCKERHUB_IMAGE_ID=$(echo $DOCKERHUB_IMAGE_ID | tr '[A-Z]' '[a-z]')\n\n# Only build amd64 on PRs, build all platforms on main. The arm builds\n# take far too long.\nimage_platforms=\"--platform linux/amd64\"\npush_image=\"\"\ncache_tag=\"pr-cache\"\nimage_tags=()\n\n# Strip git ref prefix from version\nVERSION_TAG=$(echo $GITHUB_REF | sed -e 's,.*/\\(.*\\),\\1,')\n\n# Strip \"v\" prefix from tag name\nif [[ \"$GITHUB_REF\" == refs/tags/* ]]; then\n    VERSION_TAG=$(echo $VERSION_TAG | sed -e 's/^v//')\nfi\n\nimage_tags+=(\"--tag\" \"$DOCKERHUB_IMAGE_ID:$VERSION_TAG\")\n\n# tag as latest on releases\nif [[ \"$RELEASE\" == ON ]]; then\n    image_tags+=(\"--tag\" \"$DOCKERHUB_IMAGE_ID:latest\")\nfi\n\n# Only push on main\nif [[ \"$GITHUB_REF\" == refs/heads/main ]]; then\n    push_image=\"--push\"\n    image_platforms=\"--platform linux/arm/v7,linux/arm64/v8,linux/amd64\"\n    cache_tag=\"main-cache\"\nfi\n\n# Only write to cache if credentials are available\nif [[ -z \"$DOCKERHUB_TOKEN\" ]]; then\n    write_cache=\"\"\nelse\n    write_cache=\"--cache-to=type=registry,ref=$DOCKERHUB_IMAGE_ID:$cache_tag,mode=max\"\nfi\n\ndocker buildx build \\\n    ${push_image} \\\n    ${image_platforms} \\\n    --cache-from=type=registry,ref=$DOCKERHUB_IMAGE_ID:$cache_tag \\\n    ${write_cache} \\\n    \"${image_tags[@]}\" \\\n    .\n"
  },
  {
    "path": ".github/scripts/setup-sccache.sh",
    "content": "#!/bin/sh\n\nexport SCCACHE_VERSION=\"${SCCACHE_VERSION:=0.9.1}\"\n\nexport sccache_arch=\"x86_64\"\nif [ \"$RUNNER_ARCH\" = \"X86\" ]; then\n    export sccache_arch=\"i686\"\nelif [ \"$RUNNER_ARCH\" = \"X64\" ]; then\n    export sccache_arch=\"x86_64\"\nelif [ \"$RUNNER_ARCH\" = \"ARM\" ]; then\n    export sccache_arch=\"armv7\"\nelif [ \"$RUNNER_ARCH\" = \"ARM64\" ]; then\n    export sccache_arch=\"aarch64\"\nfi\n\ninstall_sccache() {\n    export sccache_archive=\"sccache-v$SCCACHE_VERSION-$sccache_arch-$sccache_os\"\n    export sccache_url=\"https://github.com/mozilla/sccache/releases/download/v$SCCACHE_VERSION/$sccache_archive.tar.gz\"\n\n    echo \"Downloading $sccache_url...\"\n    if ! wget -q \"$sccache_url\"; then\n        echo \"Can't download $sccache_url.\" >2\n        exit 1\n    fi\n    echo \"Extracting $sccache_archive.tar.gz...\"\n    if ! tar -xzf \"$sccache_archive.tar.gz\" >/dev/null; then\n        echo \"Can't extract $sccache_archive.tar.gz\" >2\n        exit 1\n    fi\n    chmod +x \"$sccache_archive/sccache\"\n    sudo cp \"$sccache_archive/sccache\" \"/usr/local/bin/sccache\"\n    rm -rf \"$sccache_archive.tar.gz\"\n    rm -rf \"$sccache_archive\"\n}\n\nexport sccache_os=\"unknown-linux-musl\"\nif [ \"$RUNNER_OS\" = \"Linux\" ]; then\n    export sccache_os=\"unknown-linux-musl\"\n    if [ \"$RUNNER_ARCH\" = \"ARM\" ]; then\n        export sccache_os=\"unknown-linux-musleabi\"\n    fi\n    if ! install_sccache; then\n        echo \"Unable to install sccache!\" >2\n        exit 1\n    fi\nelif [ \"$RUNNER_OS\" = \"macOS\" ]; then\n    export sccache_os=\"apple-darwin\"\n    if ! install_sccache; then\n        echo \"Unable to install sccache!\" >2\n        exit 1\n    fi\nelif [ \"$RUNNER_OS\" = \"Windows\" ]; then\n    export sccache_os=\"pc-windows-msvc\"\n    if ! install_sccache; then\n        echo \"Unable to install sccache!\" >2\n        exit 1\n    fi\nfi\n\necho \"sccache installed.\"\n\n# Configure\nmkdir $HOME/.sccache\necho \"SCCACHE_DIR=$HOME/.sccache\" >>$GITHUB_ENV\nif [ \"$RUNNER_DEBUG\" = \"1\" ]; then\n    echo \"Running with debug output; cached binary artifacts will be ignored to produce a cleaner build\"\n    echo \"SCCACHE_RECACHE=true\" >>$GITHUB_ENV\nfi\n\necho \"sccache configured.\"\n"
  },
  {
    "path": ".github/workflows/build-and-test-linux.yaml",
    "content": "name: Build and test on Linux\non:\n  push:\n    branches:\n      - main\n    paths-ignore:\n      - web/**\n      - doc/**\n  pull_request:\n    branches:\n      - main\n    paths-ignore:\n      - web/**\n      - doc/**\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\nenv:\n  SCCACHE_VERSION: '0.9.1'\n\njobs:\n  build:\n    strategy:\n      matrix:\n        os:\n          - ubuntu-22.04\n          - ubuntu-24.04\n        x11: [ON, OFF]\n        wayland: [ON, OFF]\n        compiler:\n          - clang\n          - gcc\n    runs-on: ${{ matrix.os }}\n    steps:\n      - run: sudo apt-get -qq update\n      - name: Install dependencies\n        run: |\n          sudo apt-get install -yqq --no-install-recommends \\\n            audacious-dev \\\n            cmake \\\n            gawk \\\n            gperf \\\n            lcov \\\n            libaudclient-dev \\\n            libcairo2-dev \\\n            libpango1.0-dev \\\n            libcurl4-gnutls-dev \\\n            libdbus-glib-1-dev \\\n            libfreetype-dev \\\n            libfreetype6-dev \\\n            libstdc++6 \\\n            libglib2.0-dev \\\n            libical-dev \\\n            libimlib2-dev \\\n            libircclient-dev \\\n            libiw-dev \\\n            liblua5.3-dev \\\n            libmicrohttpd-dev \\\n            libmysqlclient-dev \\\n            libpulse-dev \\\n            librsvg2-dev \\\n            libsystemd-dev \\\n            libwayland-bin \\\n            libwayland-dev \\\n            libx11-dev \\\n            libxdamage-dev \\\n            libxext-dev \\\n            libxft-dev \\\n            libxinerama-dev \\\n            libxml2-dev \\\n            libxmmsclient-dev \\\n            libxnvctrl-dev \\\n            ncurses-dev \\\n            ninja-build \\\n            wayland-protocols\n      - name: Install clang and libc++\n        if: matrix.compiler == 'clang'\n        run: |\n          sudo apt-get install -yqq --no-install-recommends \\\n            clang \\\n            libc++-dev \\\n            libc++abi-dev\n      - name: Install gcc\n        if: matrix.compiler == 'gcc'\n        run: |\n          sudo apt-get install -yqq --no-install-recommends \\\n            gcc \\\n            g++\n      - name: Checkout\n        uses: actions/checkout@v5\n      - name: Install sccache\n        run: .github/scripts/setup-sccache.sh\n      - name: Load cached compilation artifacts\n        id: compiler-cache\n        uses: actions/cache@v4\n        with:\n          path: '${{ env.SCCACHE_DIR }}'\n          key: sccache-${{ matrix.os }}-${{ matrix.x11 }}-${{ matrix.wayland }}-${{ matrix.compiler }}\n          restore-keys: |\n            sccache-${{ matrix.os }}-${{ matrix.x11 }}-${{ matrix.wayland }}-${{ matrix.compiler }}\n            sccache-${{ matrix.os }}-${{ matrix.x11 }}-${{ matrix.wayland }}\n            sccache-${{ matrix.os }}-${{ matrix.x11 }}\n            sccache-${{ matrix.os }}\n      - name: Configure with CMake\n        run: |\n          set -x # show the commands we're running\n          [[ \"${{ matrix.compiler }}\" == \"clang\"* ]] && CC=clang\n          [[ \"${{ matrix.compiler }}\" == \"clang\"* ]] && CXX=clang++\n\n          [[ \"${{ matrix.compiler }}\" == \"gcc\"* ]] && CC=gcc\n          [[ \"${{ matrix.compiler }}\" == \"gcc\"* ]] && CXX=g++\n\n\n          # Enable librsvg by default, disable for older versions of Ubuntu\n          # because we need librsvg>=2.52\n          RSVG_ENABLED=ON\n          [[ \"${{ matrix.os }}\" == \"ubuntu-20.04\"* ]] && RSVG_ENABLED=OFF\n\n          # Reset sccache statistics\n          sccache --zero-stats\n\n          cmake . -B build -G Ninja              \\\n            -DBUILD_AUDACIOUS=ON                 \\\n            -DBUILD_HTTP=ON                      \\\n            -DBUILD_ICAL=ON                      \\\n            -DBUILD_ICONV=ON                     \\\n            -DBUILD_IRC=ON                       \\\n            -DBUILD_IRC=ON                       \\\n            -DBUILD_JOURNAL=ON                   \\\n            -DBUILD_LUA_CAIRO=ON                 \\\n            -DBUILD_LUA_CAIRO_XLIB=ON            \\\n            -DBUILD_LUA_IMLIB2=ON                \\\n            -DBUILD_LUA_RSVG=${RSVG_ENABLED}     \\\n            -DBUILD_LUA_TEXT=ON                  \\\n            -DBUILD_MYSQL=ON                     \\\n            -DBUILD_NVIDIA=ON                    \\\n            -DBUILD_PULSEAUDIO=ON                \\\n            -DBUILD_CURL=ON                      \\\n            -DBUILD_RSS=ON                       \\\n            -DBUILD_WLAN=ON                      \\\n            -DBUILD_WAYLAND=${{ matrix.wayland }}\\\n            -DBUILD_X11=${{ matrix.x11 }}        \\\n            -DBUILD_XMMS2=ON                     \\\n            -DCMAKE_C_COMPILER=$CC               \\\n            -DCMAKE_CXX_COMPILER=$CXX            \\\n            -DMAINTAINER_MODE=ON\n      - name: Compile\n        run: cmake --build build\n      - name: Show sccache stats\n        run: sccache --show-stats\n      - name: Test\n        working-directory: build\n        run: ctest --output-on-failure\n"
  },
  {
    "path": ".github/workflows/build-and-test-macos.yaml",
    "content": "name: Build and test on macOS\non:\n  push:\n    branches:\n      - main\n    paths-ignore:\n      - web/**\n      - doc/**\n  pull_request:\n    branches:\n      - main\n    paths-ignore:\n      - web/**\n      - doc/**\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\nenv:\n  SCCACHE_VERSION: '0.9.1'\n\njobs:\n  build:\n    env:\n      HOMEBREW_NO_INSTALL_UPGRADE: 1\n      HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1\n    strategy:\n      matrix:\n        os:\n          - macos-latest\n    runs-on: ${{ matrix.os }}\n    steps:\n      - name: Install dependencies\n        run: |\n          brew install --force \\\n            curl               \\\n            freetype           \\\n            gettext            \\\n            gperf              \\\n            imlib2             \\\n            lcov               \\\n            librsvg            \\\n            libxfixes          \\\n            libxft             \\\n            libxi              \\\n            libxinerama        \\\n            libxml2            \\\n            lua                \\\n            ninja              \\\n            pkg-config         \\\n            || true # Ignore errors\n      - name: Checkout\n        uses: actions/checkout@v5\n      - name: Configure sccache\n        run: .github/scripts/setup-sccache.sh\n      - name: Load cached compilation artifacts\n        id: compiler-cache\n        uses: actions/cache@v4\n        with:\n          path: '${{ env.SCCACHE_DIR }}'\n          key: sccache-${{ matrix.os }}\n          restore-keys: |\n            sccache-${{ matrix.os }}\n            sccache-\n      - name: Configure with CMake\n        run: |\n          # Reset sccache statistics\n          sccache --zero-stats\n\n          cmake . -B build -G Ninja            \\\n          -DMAINTAINER_MODE=ON                 \\\n          -DBUILD_WAYLAND=OFF                  \\\n          -DBUILD_RSS=ON                       \\\n          -DBUILD_CURL=ON\n      - name: Compile\n        run: cmake --build build\n      - name: Show sccache stats\n        run: sccache --show-stats\n      - name: Test\n        working-directory: build\n        run: ctest --output-on-failure\n"
  },
  {
    "path": ".github/workflows/codeql.yml",
    "content": "name: 'CodeQL'\n\non:\n  schedule:\n    - cron: '20 2 * * 0'\n\njobs:\n  analyze:\n    name: Analyze\n    runs-on: ubuntu-latest\n    permissions:\n      actions: read\n      contents: read\n      security-events: write\n\n    strategy:\n      fail-fast: false\n      matrix:\n        language: ['cpp', 'javascript', 'python']\n        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]\n        # Use only 'java' to analyze code written in Java, Kotlin or both\n        # Use only 'javascript' to analyze code written in JavaScript, TypeScript or both\n        # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support\n\n    steps:\n      - run: sudo apt-get -qq update\n      - name: Install dependencies\n        if: matrix.language == 'cpp'\n        run: |\n          sudo apt-get install -yqq --no-install-recommends \\\n            audacious-dev \\\n            cmake \\\n            gawk \\\n            gperf \\\n            lcov \\\n            libaudclient-dev \\\n            libc++-14-dev \\\n            libc++abi-14-dev \\\n            libcairo2-dev \\\n            libcurl4-gnutls-dev \\\n            libdbus-glib-1-dev \\\n            libfreetype-dev \\\n            libfreetype6-dev \\\n            libstdc++6 \\\n            libglib2.0-dev \\\n            libical-dev \\\n            libimlib2-dev \\\n            libircclient-dev \\\n            libiw-dev \\\n            liblua5.3-dev \\\n            libmicrohttpd-dev \\\n            libmysqlclient-dev \\\n            libpulse-dev \\\n            librsvg2-dev \\\n            libsystemd-dev \\\n            libwayland-bin \\\n            libwayland-dev \\\n            libx11-dev \\\n            libxdamage-dev \\\n            libxext-dev \\\n            libxft-dev \\\n            libxinerama-dev \\\n            libxml2-dev \\\n            libxmmsclient-dev \\\n            libxnvctrl-dev \\\n            ncurses-dev \\\n            ninja-build \\\n            wayland-protocols\n      - name: Checkout repository\n        uses: actions/checkout@v5\n\n      # Initializes the CodeQL tools for scanning.\n      - name: Initialize CodeQL\n        uses: github/codeql-action/init@v3\n        with:\n          languages: ${{ matrix.language }}\n          # If you wish to specify custom queries, you can do so here or in a config file.\n          # By default, queries listed here will override any specified in a config file.\n          # Prefix the list here with \"+\" to use these queries and those in the config file.\n          # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs\n          # queries: security-extended,security-and-quality\n\n      # Autobuild attempts to build any compiled languages  (C/C++, C#, Go, or Java).\n      # If this step fails, then you should remove it and run the build manually (see below)\n      - name: Autobuild\n        uses: github/codeql-action/autobuild@v3\n\n      - name: Perform CodeQL Analysis\n        uses: github/codeql-action/analyze@v3\n        with:\n          category: '/language:${{matrix.language}}'\n"
  },
  {
    "path": ".github/workflows/docker.yaml",
    "content": "name: Docker\n\non:\n  push:\n    branches:\n      - main\n    paths-ignore:\n      - web/**\n      - doc/**\n    # Publish `v1.2.3` tags as releases.\n    tags:\n      - v*\n\n  pull_request:\n    branches:\n      - main\n    paths-ignore:\n      - web/**\n      - doc/**\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\njobs:\n  docker-buildx:\n    env:\n      IMAGE_NAME: conky\n      DOCKER_BUILDKIT: 1\n      DOCKERHUB_USERNAME: brndnmtthws\n      DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n      - name: Set up QEMU\n        uses: docker/setup-qemu-action@v3\n      - name: Set up Docker Buildx\n        id: buildx\n        uses: docker/setup-buildx-action@v3\n      - name: Login to Docker Hub\n        uses: docker/login-action@v3\n        if: ${{ env.DOCKERHUB_TOKEN != '' }}\n        with:\n          username: ${{ env.DOCKERHUB_USERNAME }}\n          password: ${{ secrets.DOCKERHUB_TOKEN }}\n      - name: Build and push Docker image\n        env:\n          RELEASE: \"${{ startsWith(github.ref, 'refs/tags/') && 'ON' || 'OFF' }}\"\n          GITHUB_REF: ${{ github.ref }}\n        run: .github/scripts/docker-build.bash\n"
  },
  {
    "path": ".github/workflows/labeler.yml",
    "content": "name: 'Pull Request Labeler'\non:\n  - pull_request_target\n\njobs:\n  triage:\n    permissions:\n      contents: read\n      pull-requests: write\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v5\n      - name: Run labeler\n        uses: actions/labeler@v6\n        with:\n          sync-labels: true\n          repo-token: '${{ secrets.GITHUB_TOKEN }}'\n"
  },
  {
    "path": ".github/workflows/nix.yaml",
    "content": "name: 'Nix build'\non:\n  push:\n    branches:\n      - main\n    paths-ignore:\n      - web/**\n      - doc/**\n  pull_request:\n    branches:\n      - main\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\njobs:\n  build-and-check:\n    strategy:\n      matrix:\n        os: [ubuntu-latest, macos-latest]\n    runs-on: ${{ matrix.os }}\n    steps:\n      - uses: actions/checkout@v5\n      - uses: nixbuild/nix-quick-install-action@v34\n      - name: Restore and cache Nix store\n        uses: nix-community/cache-nix-action@v6\n        with:\n          primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix') }}\n          restore-prefixes-first-match: nix-${{ runner.os }}-\n          gc-max-store-size: 1073741824\n          purge: true\n          purge-prefixes: cache-${{ runner.os }}-\n          purge-created: 0\n          purge-primary-key: never\n      - run: nix build\n      - run: nix flake check\n"
  },
  {
    "path": ".github/workflows/publish-appimage.yml",
    "content": "name: Build AppImage\non:\n  push:\n    branches:\n      - main\n    tags:\n      - v*\n    paths-ignore:\n      - web/**\n      - doc/**\n  pull_request:\n    branches:\n      - main\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\nenv:\n  SCCACHE_VERSION: '0.9.1'\n\njobs:\n  build:\n    runs-on: ${{ matrix.os }}\n    strategy:\n      fail-fast: false\n      matrix:\n        os:\n          - ubuntu-22.04\n          - ubuntu-24.04\n        arch:\n          - x86_64\n        mode:\n          - debug\n          - release\n    permissions:\n      contents: write\n      discussions: write\n    steps:\n      - run: sudo apt-get -qq update\n      - name: Install dependencies\n        run: |\n          sudo apt-get install -yqq --no-install-recommends \\\n            audacious-dev \\\n            cmake \\\n            gawk \\\n            gperf \\\n            lcov \\\n            libaudclient-dev \\\n            libcairo2-dev \\\n            libcurl4-gnutls-dev \\\n            libdbus-glib-1-dev \\\n            libfreetype-dev \\\n            libfreetype6-dev \\\n            libstdc++6 \\\n            libfuse2 \\\n            libglib2.0-dev \\\n            libical-dev \\\n            libimlib2-dev \\\n            libircclient-dev \\\n            libiw-dev \\\n            liblua5.3-dev \\\n            libmicrohttpd-dev \\\n            libmysqlclient-dev \\\n            libpulse-dev \\\n            librsvg2-dev \\\n            libsystemd-dev \\\n            libwayland-bin \\\n            libwayland-dev \\\n            libx11-dev \\\n            libxdamage-dev \\\n            libxext-dev \\\n            libxft-dev \\\n            libxinerama-dev \\\n            libxml2-dev \\\n            libxmmsclient-dev \\\n            libxnvctrl-dev \\\n            ncurses-dev \\\n            ninja-build \\\n            pandoc \\\n            wayland-protocols\n      - name: Checkout\n        uses: actions/checkout@v5\n        with:\n          fetch-depth: 0\n      - uses: actions/setup-python@v6\n        with:\n          python-version: '3.12'\n          cache: 'pip' # caching pip dependencies\n          cache-dependency-path: 'requirements-dev.txt'\n      - run: pip install -r requirements-dev.txt\n      - name: Import GPG Deploy Key\n        # only run on main branch\n        if: github.ref == 'refs/heads/main'\n        run: |\n          echo \"${{ secrets.GPG_DEPLOY_KEY }}\" > appimage/secret.gpg\n          gpg --import appimage/secret.gpg\n      - name: Set clang version to 12 for ubuntu-20.04\n        if: matrix.os == 'ubuntu-20.04'\n        run: |\n          echo \"CLANG_VERSION=12\" | tee -a $GITHUB_ENV\n      - name: Set clang version to 15 for ubuntu-22.04\n        if: matrix.os == 'ubuntu-22.04'\n        run: |\n          echo \"CLANG_VERSION=15\" | tee -a $GITHUB_ENV\n      - name: Set clang version to 18 for ubuntu-24.04\n        if: matrix.os == 'ubuntu-24.04'\n        run: |\n          echo \"CLANG_VERSION=18\" | tee -a $GITHUB_ENV\n      - name: Install libc++, set CC and CXX env vars\n        run: |\n          sudo apt-get install -yqq --no-install-recommends \\\n            libc++-${CLANG_VERSION}-dev \\\n            libc++abi-${CLANG_VERSION}-dev\n          echo \"CC=clang-${CLANG_VERSION}\" | tee -a $GITHUB_ENV\n          echo \"CXX=clang++-${CLANG_VERSION}\" | tee -a $GITHUB_ENV\n\n      - name: Install sccache\n        if: startsWith(github.ref, 'refs/tags/') != true\n        run: .github/scripts/setup-sccache.sh\n      - name: Load cached compilation artifacts\n        if: startsWith(github.ref, 'refs/tags/') != true\n        id: compiler-cache\n        uses: actions/cache@v4\n        with:\n          path: '${{ env.SCCACHE_DIR }}'\n          key: sccache-${{ matrix.os }}-${{ matrix.arch }}\n          restore-keys: |\n            sccache-${{ matrix.os }}-${{ matrix.arch }}\n            sccache-${{ matrix.os }}\n            sccache-\n      - name: Build AppImage\n        run: ./appimage/build.sh --${{ matrix.mode }}\n        env:\n          RELEASE: \"${{ startsWith(github.ref, 'refs/tags/') && 'ON' || 'OFF' }}\"\n      - name: Show sccache stats\n        if: startsWith(github.ref, 'refs/tags/') != true\n        run: sccache --show-stats\n      - run: ./conky-x86_64.AppImage --version # print version\n      - name: Set CONKY_VERSION\n        run: echo \"CONKY_VERSION=$(./conky-x86_64.AppImage --short-version)\" | tee -a $GITHUB_ENV\n      - run: mv conky-x86_64.AppImage conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}-${{ matrix.mode }}.AppImage\n      - run: mv conky-x86_64.AppImage.sha256 conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}-${{ matrix.mode }}.AppImage.sha256\n      - name: Upload AppImage artifact\n        uses: actions/upload-artifact@v4\n        with:\n          path: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}-${{ matrix.mode }}.AppImage'\n          name: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}-${{ matrix.mode }}.AppImage'\n          if-no-files-found: error\n      - name: Upload AppImage checksum artifact\n        uses: actions/upload-artifact@v4\n        with:\n          path: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}-${{ matrix.mode }}.AppImage.sha256'\n          name: 'conky-${{ matrix.os }}-${{ matrix.arch }}-v${{ env.CONKY_VERSION }}-${{ matrix.mode }}.AppImage.sha256'\n          if-no-files-found: error\n      - name: Upload man page artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: conky.1.gz\n          path: conky.1.gz\n          # conky.1.gz is created by all jobs!\n          overwrite: true\n\n  release:\n    runs-on: ubuntu-latest\n    needs: build\n    steps:\n      - name: Download all artifacts\n        uses: actions/download-artifact@v5\n        with:\n          path: ${{ github.workspace }}/artifacts\n\n      - name: Create Conky Release\n        id: create_release\n        uses: softprops/action-gh-release@v2\n        if: startsWith(github.ref, 'refs/tags/')\n        with:\n          draft: false\n          prerelease: false\n          discussion_category_name: General\n          generate_release_notes: true\n          fail_on_unmatched_files: true\n          files: |\n            ${{ github.workspace }}/artifacts/**/*\n"
  },
  {
    "path": ".github/workflows/stale.yml",
    "content": "name: \"Close stale issues and PRs\"\non:\n  schedule:\n    - cron: \"30 1 * * *\"\n\njobs:\n  stale:\n    permissions:\n      contents: write # for delete-branch option\n      issues: write\n      pull-requests: write\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/stale@v10\n        with:\n          stale-issue-message: \"This issue is stale because it has been open 365 days with no activity. Remove stale label or comment, or this issue will be closed in 30 days.\"\n          stale-pr-message: \"This PR is stale because it has been open 365 days with no activity. Remove stale label or comment, or this PR will be closed in 30 days.\"\n          close-issue-message: \"This issue was closed because it has been stalled for 30 days with no activity.\"\n          close-pr-message: \"This PR was closed because it has been stalled for 30 days with no activity.\"\n          days-before-issue-stale: 365\n          days-before-pr-stale: 365\n          days-before-issue-close: 30\n          days-before-pr-close: 30\n          delete-branch: true\n"
  },
  {
    "path": ".github/workflows/web.yml",
    "content": "name: Web CI\n\non:\n  push:\n    branches: [main]\n    paths:\n      - web/**\n      - doc/**\n  pull_request:\n    branches: [main]\n    paths:\n      - web/**\n      - doc/**\n\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v5\n      - name: Use Node.js runtime for Next.js\n        uses: actions/setup-node@v5\n        with:\n          node-version: 20\n      - name: Use Bun package manager\n        uses: oven-sh/setup-bun@v2\n        with:\n          bun-version: 1.3.10\n      - run: bun install --frozen-lockfile\n        working-directory: web\n      - run: bun run lint\n        working-directory: web\n      - run: bun run build\n        working-directory: web\n      - run: bun run e2e:headless\n        working-directory: web\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n*~\n.*.swp\nDoxyfile\npatches/\ndoc/conky.1\nREADME\nbuild*/\ndoc/*.html\n\nMakefile\nCMakeCache.txt\nCMakeFiles\ncmake_install.cmake\ncmake_uninstall.cmake\nCPackConfig.cmake\nCPackSourceConfig.cmake\n\n# Generated files\ndata/convertconf.h\ndata/defconfig.h\n*.so\n*.a\n/config.h\n/build.h\nsrc/colour-names.hh\n\n# Compiler cache\n.cache\n\n# Ignore (most) vscode stuff\n.vscode/*\n*.code-workspace\n# Allow vscode recommended extensions\n!.vscode/extensions.json\n.idea/\n\n# Ignore nix stuff\n/result\n\n# Ignore direnv\n.direnv\n\n# Built AppImages\n/conky*.AppImage\n/conky*.AppImage.sha256\n\n# Built manual\n/conky.1.gz\n"
  },
  {
    "path": ".prettierrc.cjs",
    "content": "module.exports = {\n  printWidth: 80,\n  semi: false,\n  singleQuote: true,\n  tabWidth: 2,\n  useTabs: false,\n}\n"
  },
  {
    "path": ".vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"kamadorueda.alejandra\",\n    \"ms-vscode.cmake-tools\",\n    \"mkhl.direnv\",\n    \"xaver.clang-format\"\n  ]\n}\n"
  },
  {
    "path": "3rdparty/CMakeLists.txt",
    "content": "# Vc version 1.4.4\nadd_subdirectory(Vc)\n\nadd_subdirectory(toluapp)\n"
  },
  {
    "path": "3rdparty/Vc/.clang-format",
    "content": "BasedOnStyle: Google\n\n#    The extra indent or outdent of access modifiers, e.g. public:.\nAccessModifierOffset: -4\n\n#    If true, aligns escaped newlines as far left as possible. Otherwise puts them into the right-most column.\nAlignEscapedNewlinesLeft: false\n\n#    If true, aligns trailing comments.\nAlignTrailingComments: true\n\n#    Allow putting all parameters of a function declaration onto the next line even if BinPackParameters is false.\nAllowAllParametersOfDeclarationOnNextLine: false\n\n#    If true, if (a) return; can be put on a single line.\nAllowShortIfStatementsOnASingleLine: false\n\n#    If true, while (true) continue; can be put on a single line.\nAllowShortLoopsOnASingleLine: false\n\nAllowShortFunctionsOnASingleLine: true\n\n#    If true, always break before multiline string literals.\nAlwaysBreakBeforeMultilineStrings: false\n\n#    If true, always break after the template<...> of a template declaration.\nAlwaysBreakTemplateDeclarations: false\n\n#    If false, a function call’s or function definition’s parameters will either all be on the same line or will have one line each.\nBinPackParameters: true\n\n#    If true, binary operators will be placed after line breaks.\nBreakBeforeBinaryOperators: false\n\n#    The brace breaking style to use.\n#    Possible values:\n#        BS_Attach (in configuration: Attach) Always attach braces to surrounding context.\n#        BS_Linux (in configuration: Linux) Like Attach, but break before braces on function, namespace and class definitions.\n#        BS_Stroustrup (in configuration: Stroustrup) Like Attach, but break before function definitions.\n#        BS_Allman (in configuration: Allman) Always break before braces.\nBreakBeforeBraces: Linux\n\n#    Always break constructor initializers before commas and align the commas with the colon.\nBreakConstructorInitializersBeforeComma: true\n\n#    The column limit.\n#    A column limit of 0 means that there is no column limit. In this case, clang-format will respect the input’s line breaking decisions within statements.\nColumnLimit: 90\n\n#    If the constructor initializers don’t fit on a line, put each initializer on its own line.\n#ConstructorInitializerAllOnOneLineOrOnePerLine (bool)\n\n#    The number of characters to use for indentation of constructor initializer lists.\n#ConstructorInitializerIndentWidth (unsigned)\n\n#    If true, format braced lists as best suited for C++11 braced lists.\n#    Important differences: - No spaces inside the braced list. - No line break before the closing brace. - Indentation with the continuation indent, not with the block indent.\n#    Fundamentally, C++11 braced lists are formatted exactly like function calls would be formatted in their place. If the braced list follows a name (e.g. a type or variable name), clang-format formats as if the {} were the parentheses of a function call with that name. If there is no name, a zero-length name is assumed.\nCpp11BracedListStyle: true\n\n#    If true, analyze the formatted file for the most common binding.\n#DerivePointerBinding (bool)\n\n#    If true, clang-format detects whether function calls and definitions are formatted with one parameter per line.\n#    Each call can be bin-packed, one-per-line or inconclusive. If it is inconclusive, e.g. completely on one line, but a decision needs to be made, clang-format analyzes whether there are other bin-packed cases in the input file and act accordingly.\n#    NOTE: This is an experimental flag, that might go away or be renamed. Do not use this in config files, etc. Use at your own risk.\n#ExperimentalAutoDetectBinPacking (bool)\n\n#    Indent case labels one level from the switch statement.\n#    When false, use the same indentation level as for the switch statement. Switch statement body is always indented one level more than case labels.\nIndentCaseLabels: false\n\n#    If true, indent when breaking function declarations which are not also definitions after the type.\n#IndentFunctionDeclarationAfterType (bool)\n\n#    The number of characters to use for indentation.\nIndentWidth: 4\n\n#    The maximum number of consecutive empty lines to keep.\nMaxEmptyLinesToKeep: 1\n\n#    The indentation used for namespaces.\n#    Possible values:\n#        NI_None (in configuration: None) Don’t indent in namespaces.\n#        NI_Inner (in configuration: Inner) Indent only in inner namespaces (nested in other namespaces).\n#        NI_All (in configuration: All) Indent in all namespaces.\nNamespaceIndentation: None\n\n#    Add a space in front of an Objective-C protocol list, i.e. use Foo <Protocol> instead of Foo<Protocol>.\n#ObjCSpaceBeforeProtocolList (bool)\n\n#    The penalty for each line break introduced inside a comment.\n#PenaltyBreakComment (unsigned)\n\n#    The penalty for breaking before the first <<.\n#PenaltyBreakFirstLessLess (unsigned)\n\n#    The penalty for each line break introduced inside a string literal.\n#PenaltyBreakString (unsigned)\n#    The penalty for each character outside of the column limit.\n#PenaltyExcessCharacter (unsigned)\n#    Penalty for putting the return type of a function onto its own line.\n#PenaltyReturnTypeOnItsOwnLine (unsigned)\n#    Set whether & and * bind to the type as opposed to the variable.\n#PointerBindsToType: false\n#    If true, spaces will be inserted between ‘for’/’if’/’while’/... and ‘(‘.\n#SpaceAfterControlStatementKeyword: true\n#    If false, spaces will be removed before ‘=’, ‘+=’, etc.\n#SpaceBeforeAssignmentOperators: true\n#    If false, spaces may be inserted into ‘()’.\n#SpaceInEmptyParentheses: false\n#    The number of spaces to before trailing line comments.\n#SpacesBeforeTrailingComments (unsigned)\n#    If false, spaces may be inserted into C style casts.\n#SpacesInCStyleCastParentheses (bool)\n\n#    If true, spaces will be inserted after every ‘(‘ and before every ‘)’.\nSpacesInParentheses: false\n\n#    Format compatible with this standard, e.g. use A<A<int> > instead of A<A<int>> for LS_Cpp03.\n#    Possible values:\n#        LS_Cpp03 (in configuration: Cpp03) Use C++03-compatible syntax.\n#        LS_Cpp11 (in configuration: Cpp11) Use features of C++11 (e.g. A<A<int>> instead of A<A<int> >).\n#        LS_Auto (in configuration: Auto) Automatic detection based on the input.\nStandard: Cpp11\n\n#    If true, IndentWidth consecutive spaces will be replaced with tab characters.\nUseTab: false\n\n# vim: ft=yaml\n"
  },
  {
    "path": "3rdparty/Vc/.gitignore",
    "content": "doc/html\ndoc/latex\ndoc/man\nvc-benchmarks\n*.swp\n*~\n.makeApidox.stamp\n.makeApidox.stamp.new\nbuild-*\n.vs\nout\n"
  },
  {
    "path": "3rdparty/Vc/CMakeLists.txt",
    "content": "# cmake_minimum_required(VERSION 3.0)\n\ncmake_policy(SET CMP0028 NEW) # Double colon in target name means ALIAS or IMPORTED target.\ncmake_policy(SET CMP0048 NEW) # The ``project()`` command manages VERSION variables.\n\nif(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR)\n   message(FATAL_ERROR \"You don't want to configure in the source directory!\")\nendif()\n\nif(NOT DEFINED CMAKE_BUILD_TYPE)\n   set(CMAKE_BUILD_TYPE Release CACHE STRING\n      \"Choose the type of build, options are: None Debug Release RelWithDebug RelWithDebInfo MinSizeRel.\"\n      FORCE)\nendif()\n\n# read version parts from version.h\nfile(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/Vc/version.h _version_lines REGEX \"^#define Vc_VERSION_STRING \")\nstring(REGEX MATCH \"([0-9]+)\\\\.([0-9]+)\\\\.([0-9]+)\" _version_matches \"${_version_lines}\")\n\nproject(Vc VERSION \"${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}\" LANGUAGES C CXX)\nlist(APPEND CMAKE_MODULE_PATH \"${CMAKE_CURRENT_LIST_DIR}/cmake\")\n\nset(CMAKE_CXX_STANDARD 14)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\n\nset(disabled_targets)\n\ninclude (VcMacros)\ninclude (AddTargetProperty)\ninclude (OptimizeForArchitecture)\n\nvc_determine_compiler()\n\nif(\"${CMAKE_SYSTEM_PROCESSOR}\" MATCHES \"(i686|x86|AMD64|amd64)\")\n   set(Vc_X86 TRUE)\nelseif(\"${CMAKE_SYSTEM_PROCESSOR}\" MATCHES \"(arm|aarch32|aarch64)\")\n   message(WARNING \"No optimized implementation of the Vc types available for ${CMAKE_SYSTEM_PROCESSOR}\")\n   set(Vc_ARM TRUE)\nelse()\n   message(WARNING \"No optimized implementation of the Vc types available for ${CMAKE_SYSTEM_PROCESSOR}\")\nendif()\n\n# if(NOT Vc_COMPILER_IS_MSVC)\n#    AddCompilerFlag(\"-std=c++14\" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS)\n#    if(NOT _ok)\n#       AddCompilerFlag(\"-std=c++1y\" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS)\n#       if(NOT _ok)\n#          AddCompilerFlag(\"-std=c++11\" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS)\n#          if(NOT _ok)\n#             AddCompilerFlag(\"-std=c++0x\" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS)\n#             if(NOT _ok)\n#                message(FATAL_ERROR \"Vc 1.x requires C++11, better even C++14. It seems this is not available. If this was incorrectly determined please notify vc-devel@compeng.uni-frankfurt.de\")\n#             endif()\n#          endif()\n#       endif()\n#    endif()\n# elseif(MSVC_VERSION LESS 1920)\n#    message(FATAL_ERROR \"Vc 1.x requires at least Visual Studio 2019.\")\n#    AddCompilerFlag(\"/std:c++14\" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS)\n# endif()\n\n# if(MSVC AND (NOT DEFINED Vc_USE_MSVC_SSA_OPTIMIZER_DESPITE_BUGGY_EXP OR NOT Vc_USE_MSVC_SSA_OPTIMIZER_DESPITE_BUGGY_EXP))\n#    # bug report: https://developercommunity.visualstudio.com/t/AVX-codegen-bug-on-Vc-with-MSVC-2019/1470844#T-N1521672\n#    message(STATUS \"WARNING! MSVC starting with 19.20 uses a new optimizer that has a bug causing Vc::exp() to return slighly wrong results.\\\n#  You can set Vc_USE_MSVC_SSA_OPTIMIZER_DESPITE_BUGGY_EXP=ON to still use the new optimizer on the affected MSVC versions.\")\n#    AddCompilerFlag(\"/d2SSAOptimizer-\" CXX_RESULT _ok CXX_FLAGS CMAKE_CXX_FLAGS)\n# endif()\n\nif(Vc_COMPILER_IS_GCC)\n   if(Vc_GCC_VERSION VERSION_GREATER \"5.0.0\" AND Vc_GCC_VERSION VERSION_LESS \"6.0.0\")\n      UserWarning(\"GCC 5 goes into an endless loop comiling example_scaling_scalar. Therefore, this target is disabled.\")\n      list(APPEND disabled_targets\n         example_scaling_scalar\n         )\n   endif()\n# elseif(Vc_COMPILER_IS_MSVC)\n#    # Disable warning \"C++ exception specification ignored except to indicate a function is not __declspec(nothrow)\"\n#    # MSVC emits the warning for the _UnitTest_Compare desctructor which needs the throw declaration so that it doesn't std::terminate\n#    AddCompilerFlag(\"/wd4290\")\nendif()\n\nvc_set_preferred_compiler_flags(WARNING_FLAGS BUILDTYPE_FLAGS)\n\nadd_definitions(${Vc_DEFINITIONS})\nadd_compile_options(${Vc_COMPILE_FLAGS})\n\nif(Vc_COMPILER_IS_INTEL)\n   # per default icc is not IEEE compliant, but we need that for verification\n   AddCompilerFlag(\"-fp-model source\")\nendif()\n\nif(CMAKE_BUILD_TYPE STREQUAL \"\" AND NOT CMAKE_CXX_FLAGS MATCHES \"-O[123]\")\n   message(STATUS \"WARNING! It seems you are compiling without optimization. Please set CMAKE_BUILD_TYPE.\")\nendif(CMAKE_BUILD_TYPE STREQUAL \"\" AND NOT CMAKE_CXX_FLAGS MATCHES \"-O[123]\")\n\ninclude_directories(${CMAKE_CURRENT_SOURCE_DIR}) # ${CMAKE_CURRENT_SOURCE_DIR}/include)\n\nadd_custom_target(other VERBATIM)\nadd_custom_target(Scalar COMMENT \"build Scalar code\" VERBATIM)\nadd_custom_target(SSE COMMENT \"build SSE code\" VERBATIM)\nadd_custom_target(AVX COMMENT \"build AVX code\" VERBATIM)\nadd_custom_target(AVX2 COMMENT \"build AVX2 code\" VERBATIM)\n\nAddCompilerFlag(-ftemplate-depth=128 CXX_FLAGS CMAKE_CXX_FLAGS)\n\nset(libvc_compile_flags \"-DVc_COMPILE_LIB\")\nAddCompilerFlag(\"-fPIC\" CXX_FLAGS libvc_compile_flags)\n\n# -fstack-protector is the default of GCC, but at least Ubuntu changes the default to -fstack-protector-strong, which is crazy\nAddCompilerFlag(\"-fstack-protector\" CXX_FLAGS libvc_compile_flags)\n\nset(_srcs src/const.cpp)\nif(Vc_X86)\n   list(APPEND _srcs src/cpuid.cpp src/support_x86.cpp)\n   vc_compile_for_all_implementations(_srcs src/trigonometric.cpp ONLY SSE2 SSE3 SSSE3 SSE4_1 AVX AVX+FMA AVX2+FMA+BMI2)\n   if(NOT Vc_XOP_INTRINSICS_BROKEN)\n     vc_compile_for_all_implementations(_srcs src/trigonometric.cpp ONLY AVX+XOP+FMA)\n     if(NOT Vc_FMA4_INTRINSICS_BROKEN)\n       vc_compile_for_all_implementations(_srcs src/trigonometric.cpp ONLY SSE+XOP+FMA4 AVX+XOP+FMA4)\n     endif()\n   endif()\n   vc_compile_for_all_implementations(_srcs src/sse_sorthelper.cpp ONLY SSE2 SSE4_1 AVX AVX2+FMA+BMI2)\n   vc_compile_for_all_implementations(_srcs src/avx_sorthelper.cpp ONLY AVX AVX2+FMA+BMI2)\nelseif(Vc_ARM)\n   list(APPEND _srcs src/support_dummy.cpp)\nelse()\n   list(APPEND _srcs src/support_dummy.cpp)\nendif()\nadd_library(Vc STATIC ${_srcs})\nset_property(TARGET Vc APPEND PROPERTY COMPILE_OPTIONS ${libvc_compile_flags})\nadd_target_property(Vc LABELS \"other\")\nif(XCODE)\n   # TODO: document what this does and why it has no counterpart in the non-XCODE logic\n   set_target_properties(Vc PROPERTIES XCODE_ATTRIBUTE_GCC_INLINES_ARE_PRIVATE_EXTERN \"NO\")\n   set_target_properties(Vc PROPERTIES XCODE_ATTRIBUTE_GCC_SYMBOLS_PRIVATE_EXTERN \"YES\")\n   set_target_properties(Vc PROPERTIES XCODE_ATTRIBUTE_CLANG_CXX_LANGUAGE_STANDARD \"c++0x\")\n   set_target_properties(Vc PROPERTIES XCODE_ATTRIBUTE_CLANG_CXX_LIBRARY \"libc++\")\nelseif(UNIX AND Vc_COMPILER_IS_CLANG)\n   # On UNIX (Linux) the standard library used by default typically is libstdc++ (GCC).\n   # To get the full clang deal we rather want to build against libc++. This requires\n   # additionally the libc++abi and libsupc++ libraries in all linker invokations.\n   option(USE_LIBC++ \"Use libc++ instead of the system default C++ standard library.\" OFF)\n   if(USE_LIBC++)\n      AddCompilerFlag(-stdlib=libc++ CXX_FLAGS CMAKE_CXX_FLAGS CXX_RESULT _use_libcxx)\n      if(_use_libcxx)\n         find_library(LIBC++ABI c++abi)\n         mark_as_advanced(LIBC++ABI)\n         if(LIBC++ABI)\n            set(CMAKE_REQUIRED_LIBRARIES \"${LIBC++ABI};supc++\")\n            CHECK_CXX_SOURCE_COMPILES(\"#include <stdexcept>\n            #include <iostream>\n            void foo() {\n              std::cout << 'h' << std::flush << std::endl;\n              throw std::exception();\n            }\n            int main() {\n              try { foo(); }\n              catch (int) { return 0; }\n              return 1;\n            }\" libcxx_compiles)\n            unset(CMAKE_REQUIRED_LIBRARIES)\n            if(libcxx_compiles)\n               link_libraries(${LIBC++ABI} supc++)\n            endif()\n         endif()\n      endif()\n   else()\n      CHECK_CXX_SOURCE_COMPILES(\"#include <tuple>\n      std::tuple<int> f() { std::tuple<int> r; return r; }\n      int main() { return 0; }\n      \" tuple_sanity)\n      if (NOT tuple_sanity)\n         message(FATAL_ERROR \"Clang and std::tuple brokenness detected. Please update your compiler.\")\n      endif()\n   endif()\nendif()\nadd_dependencies(other Vc)\ntarget_include_directories(Vc\n   PUBLIC\n   $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>\n   $<INSTALL_INTERFACE:include>\n   )\n\n# option(Vc_ENABLE_INSTALL \"Whether to install the library.\" OFF)\n# if (Vc_ENABLE_INSTALL)\n#    install(TARGETS Vc EXPORT VcTargets DESTINATION lib${LIB_SUFFIX})\n#    install(DIRECTORY Vc/ DESTINATION include/Vc FILES_MATCHING REGEX \"/*.(h|tcc|def)$\")\n#    install(FILES\n#       Vc/Allocator\n#       Vc/IO\n#       Vc/Memory\n#       Vc/SimdArray\n#       Vc/Utils\n#       Vc/Vc\n#       Vc/algorithm\n#       Vc/array\n#       Vc/iterators\n#       Vc/limits\n#       Vc/simdize\n#       Vc/span\n#       Vc/type_traits\n#       Vc/vector\n#       DESTINATION include/Vc)\n\n#    # Generate and install CMake package and modules\n#    include(CMakePackageConfigHelpers)\n#    set(PACKAGE_INSTALL_DESTINATION\n#       lib${LIB_SUFFIX}/cmake/${PROJECT_NAME}\n#       )\n#    install(EXPORT ${PROJECT_NAME}Targets\n#       NAMESPACE ${PROJECT_NAME}::\n#       DESTINATION ${PACKAGE_INSTALL_DESTINATION}\n#       EXPORT_LINK_INTERFACE_LIBRARIES\n#       )\n#    write_basic_package_version_file(\n#       ${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake\n#       VERSION ${PROJECT_VERSION}\n#       COMPATIBILITY AnyNewerVersion\n#       )\n#    configure_package_config_file(\n#       ${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in\n#       ${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake\n#       INSTALL_DESTINATION ${PACKAGE_INSTALL_DESTINATION}\n#       PATH_VARS CMAKE_INSTALL_PREFIX\n#       )\n#    install(FILES\n#       cmake/UserWarning.cmake\n#       cmake/VcMacros.cmake\n#       cmake/AddCompilerFlag.cmake\n#       cmake/CheckCCompilerFlag.cmake\n#       cmake/CheckCXXCompilerFlag.cmake\n#       cmake/OptimizeForArchitecture.cmake\n#       cmake/FindVc.cmake\n#       ${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}Config.cmake\n#       ${CMAKE_CURRENT_BINARY_DIR}/cmake/${PROJECT_NAME}ConfigVersion.cmake\n#       DESTINATION ${PACKAGE_INSTALL_DESTINATION}\n#       )\n# endif()\n\n# option(BUILD_TESTING \"Build the testing tree.\" OFF)\n# include (CTest)\n# configure_file(${PROJECT_SOURCE_DIR}/CTestCustom.cmake ${PROJECT_BINARY_DIR}/CTestCustom.cmake COPYONLY)\n# if(BUILD_TESTING)\n   # add_custom_target(build_tests ALL VERBATIM)\n   # add_subdirectory(tests)\n# endif()\n\n# set(BUILD_EXAMPLES FALSE CACHE BOOL \"Build examples.\")\n# if(BUILD_EXAMPLES)\n   # add_subdirectory(examples)\n# endif(BUILD_EXAMPLES)\n\n# Hide Vc_IMPL as it is only meant for users of Vc\nmark_as_advanced(Vc_IMPL)\n\n# find_program(BIN_CAT cat)\n# mark_as_advanced(BIN_CAT)\n# if(BIN_CAT)\n#    file(REMOVE ${PROJECT_BINARY_DIR}/help.txt)\n#    add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/help.txt\n#       COMMAND ${CMAKE_MAKE_PROGRAM} help > ${PROJECT_BINARY_DIR}/help.txt\n#       VERBATIM\n#       )\n#    add_custom_target(cached_help\n#       ${BIN_CAT} ${PROJECT_BINARY_DIR}/help.txt\n#       DEPENDS ${PROJECT_BINARY_DIR}/help.txt\n#       VERBATIM\n#       )\n# endif()\n"
  },
  {
    "path": "3rdparty/Vc/LICENSE",
    "content": "Copyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "3rdparty/Vc/README.md",
    "content": "**Vc is now in maintenance mode and no longer actively developed.\nHowever, we continue to review pull requests with bugfixes from the community.**\n\n**You may be interested in switching to [std-simd](https://github.com/VcDevel/std-simd).**\nGCC 11 includes an experimental version of `std::simd` as part of libstdc++, which also works with clang.\nFeatures present in Vc 1.4 and not present in *std-simd* will eventually turn into Vc 2.0,which then depends on *std-simd*.\n\n# Vc: portable, zero-overhead C++ types for explicitly data-parallel programming\n\nRecent generations of CPUs, and GPUs in particular, require data-parallel codes\nfor full efficiency. Data parallelism requires that the same sequence of\noperations is applied to different input data. CPUs and GPUs can thus reduce\nthe necessary hardware for instruction decoding and scheduling in favor of more\narithmetic and logic units, which execute the same instructions synchronously.\nOn CPU architectures this is implemented via SIMD registers and instructions.\nA single SIMD register can store N values and a single SIMD instruction can\nexecute N operations on those values. On GPU architectures N threads run in\nperfect sync, fed by a single instruction decoder/scheduler. Each thread has\nlocal memory and a given index to calculate the offsets in memory for loads and\nstores.\n\nCurrent C++ compilers can do automatic transformation of scalar codes to SIMD\ninstructions (auto-vectorization). However, the compiler must reconstruct an\nintrinsic property of the algorithm that was lost when the developer wrote a\npurely scalar implementation in C++. Consequently, C++ compilers cannot\nvectorize any given code to its most efficient data-parallel variant.\nEspecially larger data-parallel loops, spanning over multiple functions or even\ntranslation units, will often not be transformed into efficient SIMD code.\n\nThe Vc library provides the missing link. Its types enable explicitly stating\ndata-parallel operations on multiple values. The parallelism is therefore added\nvia the type system. Competing approaches state the parallelism via new control\nstructures and consequently new semantics inside the body of these control\nstructures.\n\nVc is a free software library to ease explicit vectorization of C++ code. It\nhas an intuitive API and provides portability between different compilers and\ncompiler versions as well as portability between different vector instruction\nsets. Thus an application written with Vc can be compiled for:\n\n* AVX and AVX2\n* SSE2 up to SSE4.2 or SSE4a\n* Scalar\n* ~~AVX-512 (Vc 2 development)~~\n* ~~NEON (in development)~~\n* ~~NVIDIA GPUs / CUDA (research)~~\n\nAfter Intel dropped MIC support with ICC 18, Vc 1.4 also removed support for it.\n\n## Examples\n\n### Usage on Compiler Explorer\n\n* [Simdize Example](https://godbolt.org/z/JVEM2j)\n* [Total momentum and time stepping of `std::vector<Particle>`](https://godbolt.org/z/JNdkL9)\n* [Matrix Example](https://godbolt.org/z/fFEkuX): This uses vertical\n  vectorization which does not scale to different vector sizes. However, the\n  example is instructive to compare it with similar solutions of other languages\n  or libraries.\n* [N-vortex solver](https://godbolt.org/z/4o1cg_) showing `simdize`d iteration\n  over many `std::vector<float>`. Note how [important the `-march` flag is, compared\n  to plain `-mavx2 -mfma`](https://godbolt.org/z/hKiOjr).\n\n### Scalar Product\n\nLet's start from the code for calculating a 3D scalar product using builtin floats:\n```cpp\nusing Vec3D = std::array<float, 3>;\nfloat scalar_product(Vec3D a, Vec3D b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n```\nUsing Vc, we can easily vectorize the code using the `float_v` type:\n```cpp\nusing Vc::float_v\nusing Vec3D = std::array<float_v, 3>;\nfloat_v scalar_product(Vec3D a, Vec3D b) {\n  return a[0] * b[0] + a[1] * b[1] + a[2] * b[2];\n}\n```\nThe above will scale to 1, 4, 8, 16, etc. scalar products calculated in parallel, depending\non the target hardware's capabilities.\n\nFor comparison, the same vectorization using Intel SSE intrinsics is more verbose and uses\nprefix notation (i.e. function calls):\n```cpp\nusing Vec3D = std::array<__m128, 3>;\n__m128 scalar_product(Vec3D a, Vec3D b) {\n  return _mm_add_ps(_mm_add_ps(_mm_mul_ps(a[0], b[0]), _mm_mul_ps(a[1], b[1])),\n                    _mm_mul_ps(a[2], b[2]));\n}\n```\nThe above will neither scale to AVX, AVX-512, etc. nor is it portable to other SIMD ISAs.\n\n## Build Requirements\n\ncmake >= 3.0\n\nC++11 Compiler:\n\n* GCC >= 4.8.1\n* clang >= 3.4\n* ICC >= 18.0.5\n* Visual Studio 2019 (64-bit target)\n\n\n## Building and Installing Vc\n\n* Clone Vc and initialize Vc's git submodules:\n\n```sh\ngit clone https://github.com/VcDevel/Vc.git\ncd Vc\ngit submodule update --init\n```\n\n* Create a build directory:\n\n```sh\n$ mkdir build\n$ cd build\n```\n\n* Configure with cmake and add relevant options:\n\n```sh\n$ cmake ..\n```\n\nOptionally, specify an installation directory:\n\n```sh\n$ cmake -DCMAKE_INSTALL_PREFIX=/opt/Vc ..\n```\n\nOptionally, include building the unit tests:\n\n```sh\n$ cmake -DBUILD_TESTING=ON ..\n```\n\nOn Windows, if you have multiple versions of Visual Studio installed, you can select one:\n\n```sh\n$ cmake -G \"Visual Studio 16 2019\" ..\n```\n\nSee `cmake --help` for a list of possible generators.\n\n\n* Build and install:\n\n```sh\n$ cmake --build . -j 16\n$ cmake --install . # may require permissions\n```\n\nOn Windows, you can also open `Vc.sln` in Visual Studio and build/install from the IDE.\n\n## Documentation\n\nThe documentation is generated via [doxygen](http://doxygen.org). You can build\nthe documentation by running `doxygen` in the `doc` subdirectory.\nAlternatively, you can find nightly builds of the documentation at:\n\n* [1.4 branch](https://vcdevel.github.io/Vc-1.4/)\n* [1.4.4 release](https://vcdevel.github.io/Vc-1.4.4/)\n* [1.4.3 release](https://vcdevel.github.io/Vc-1.4.3/)\n* [1.4.2 release](https://vcdevel.github.io/Vc-1.4.2/)\n* [1.4.1 release](https://vcdevel.github.io/Vc-1.4.1/)\n* [1.4.0 release](https://vcdevel.github.io/Vc-1.4.0/)\n* [1.3 branch](https://vcdevel.github.io/Vc-1.3/)\n* [1.3.0 release](https://vcdevel.github.io/Vc-1.3.0/)\n* [1.2.0 release](https://vcdevel.github.io/Vc-1.2.0/)\n* [1.1.0 release](https://vcdevel.github.io/Vc-1.1.0/)\n* [0.7 branch](https://vcdevel.github.io/Vc-0.7/)\n\n## Publications\n\n* [M. Kretz, \"Extending C++ for Explicit Data-Parallel Programming via SIMD\n  Vector Types\", Goethe University Frankfurt, Dissertation,\n  2015.](http://publikationen.ub.uni-frankfurt.de/frontdoor/index/index/docId/38415)\n* [M. Kretz and V. Lindenstruth, \"Vc: A C++ library for explicit\n  vectorization\", Software: Practice and Experience,\n  2011.](http://dx.doi.org/10.1002/spe.1149)\n* [M. Kretz, \"Efficient Use of Multi- and Many-Core Systems with Vectorization\n  and Multithreading\", University of Heidelberg,\n  2009.](http://code.compeng.uni-frankfurt.de/attachments/13/Diplomarbeit.pdf)\n\n[Work on integrating the functionality of Vc in the C++ standard library.](\nhttps://github.com/VcDevel/Vc/wiki/ISO-Standardization-of-the-Vector-classes)\n\n## License\n\nVc is released under the terms of the [3-clause BSD license](http://opensource.org/licenses/BSD-3-Clause).\n"
  },
  {
    "path": "3rdparty/Vc/Vc/Allocator",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_ALLOCATOR_H_\n#define VC_ALLOCATOR_H_\n\n#include <new>\n#include <cstddef>\n#include <cstdlib>\n#include <utility>\n\n#include \"global.h\"\n#include \"common/macros.h\"\n\n/**\n * \\ingroup Utilities\n *\n * Convenience macro to set the default allocator for a given \\p Type to\n * Vc::Allocator.\n *\n * \\param Type Your type that you want to use with STL containers.\n *\n * \\note You have to use this macro in the global namespace.\n */\n#ifdef Vc_MSVC\n#define Vc_DECLARE_ALLOCATOR(Type)                                                   \\\nnamespace std                                                                        \\\n{                                                                                    \\\ntemplate <> class allocator<Type> : public ::Vc::Allocator<Type>                     \\\n{                                                                                    \\\npublic:                                                                              \\\n    template <typename U> struct rebind {                                            \\\n        typedef ::std::allocator<U> other;                                           \\\n    };                                                                               \\\n    /* MSVC brokenness: the following function is optional - just doesn't compile    \\\n     * without it */                                                                 \\\n    const allocator &select_on_container_copy_construction() const { return *this; } \\\n};                                                                                   \\\n}\n#else\n#define Vc_DECLARE_ALLOCATOR(Type)                                                   \\\nnamespace std                                                                        \\\n{                                                                                    \\\ntemplate <> class allocator<Type> : public ::Vc::Allocator<Type>                     \\\n{                                                                                    \\\npublic:                                                                              \\\n    template <typename U> struct rebind {                                            \\\n        typedef ::std::allocator<U> other;                                           \\\n    };                                                                               \\\n};                                                                                   \\\n}\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n    using std::size_t;\n    using std::ptrdiff_t;\n\n    /**\n     * \\headerfile Allocator <Vc/Allocator>\n     * An allocator that uses global new and supports over-aligned types, as per [C++11 20.6.9].\n     *\n     * Meant as a simple replacement for the allocator defined in the C++ Standard.\n     * Allocation is done using the global new/delete operators. But if the alignment property of \\p\n     * T is larger than the size of a pointer, the allocate function allocates slightly more memory\n     * to adjust the pointer for correct alignment.\n     *\n     * If the \\p T does not require over-alignment no additional memory will be allocated.\n     *\n     * \\tparam T The type of objects to allocate.\n     *\n     * Example:\n     * \\code\n     * struct Data {\n     *   Vc::float_v x, y, z;\n     * };\n     *\n     * void fun()\n     * {\n     *   std::vector<Data> dat0; // this will use std::allocator<Data>, which probably ignores the\n     *                           // alignment requirements for Data. Thus any access to dat0 may\n     *                           // crash your program.\n     *\n     *   std::vector<Data, Vc::Allocator<Data> > dat1; // now std::vector will get correctly aligned\n     *                           // memory. Accesses to dat1 are safe.\n     *   ...\n     * \\endcode\n     *\n     * %Vc ships a macro to conveniently tell STL to use Vc::Allocator per default for a given type:\n     * \\code\n     * struct Data {\n     *   Vc::float_v x, y, z;\n     * };\n     * Vc_DECLARE_ALLOCATOR(Data)\n     *\n     * void fun()\n     * {\n     *   std::vector<Data> dat0; // good now\n     *   ...\n     * \\endcode\n     *\n     * \\ingroup Utilities\n     */\n    template<typename T> class Allocator\n    {\n    private:\n        enum Constants {\n#ifdef Vc_HAVE_STD_MAX_ALIGN_T\n            NaturalAlignment = alignof(std::max_align_t),\n#elif defined(Vc_HAVE_MAX_ALIGN_T)\n            NaturalAlignment = alignof(::max_align_t),\n#else\n            NaturalAlignment = sizeof(void *) > alignof(long double) ? sizeof(void *) :\n                (alignof(long double) > alignof(long long) ? alignof(long double) : alignof(long long)),\n#endif\n#if defined Vc_IMPL_AVX\n            SimdAlignment = 32,\n#elif defined Vc_IMPL_SSE\n            SimdAlignment = 16,\n#else\n            SimdAlignment = 1,\n#endif\n            Alignment = alignof(T) > SimdAlignment ? alignof(T) : SimdAlignment,\n            /* The number of extra bytes allocated must be large enough to put a pointer right\n             * before the adjusted address. This pointer stores the original address, which is\n             * required to call ::operator delete in deallocate.\n             *\n             * The address we get from ::operator new is a multiple of NaturalAlignment:\n             *   p = N * NaturalAlignment\n             *\n             * Since all alignments are powers of two, Alignment is a multiple of NaturalAlignment:\n             *   Alignment = k * NaturalAlignment\n             *\n             * two cases:\n             * 1. If p is already aligned to Alignment then allocate will return p + Alignment. In\n             *    this case there are Alignment Bytes available to store a pointer.\n             * 2. If p is not aligned then p + (k - (N modulo k)) * NaturalAlignment will be\n             *    returned. Since NaturalAlignment >= sizeof(void*) the pointer fits.\n             */\n            ExtraBytes = Alignment > NaturalAlignment ? Alignment : 0,\n            AlignmentMask = Alignment - 1\n        };\n    public:\n        typedef size_t    size_type;\n        typedef ptrdiff_t difference_type;\n        typedef T*        pointer;\n        typedef const T*  const_pointer;\n        typedef T&        reference;\n        typedef const T&  const_reference;\n        typedef T         value_type;\n\n        template<typename U> struct rebind { typedef Allocator<U> other; };\n\n        Allocator() throw() { }\n        Allocator(const Allocator&) throw() { }\n        template<typename U> Allocator(const Allocator<U>&) throw() { }\n\n        pointer address(reference x) const { return &x; }\n        const_pointer address(const_reference x) const { return &x; }\n\n        pointer allocate(size_type n, const void* = 0)\n        {\n            if (n > this->max_size()) {\n                throw std::bad_alloc();\n            }\n\n            char *p = static_cast<char *>(::operator new(n * sizeof(T) + ExtraBytes));\n            if (ExtraBytes > 0) {\n                char *const pp = p;\n                p += ExtraBytes;\n                const char *null = 0;\n                p -= ((p - null) & AlignmentMask); // equivalent to p &= ~AlignmentMask;\n                reinterpret_cast<char **>(p)[-1] = pp;\n            }\n            return reinterpret_cast<pointer>(p);\n        }\n\n        void deallocate(pointer p, size_type)\n        {\n            if (ExtraBytes > 0) {\n                p = reinterpret_cast<pointer *>(p)[-1];\n            }\n            ::operator delete(p);\n        }\n\n        size_type max_size() const throw() { return size_t(-1) / sizeof(T); }\n\n#ifdef Vc_MSVC\n        // MSVC brokenness: the following function is optional - just doesn't compile without it\n        const Allocator &select_on_container_copy_construction() const { return *this; }\n\n        // MSVC also requires a function that neither C++98 nor C++11 mention\n        // but it doesn't support variadic templates... otherwise the Vc_CXX11 clause would be nice\n        void construct(pointer p) { ::new(p) T(); }\n\n        // we still need the C++98 version:\n        void construct(pointer p, const T& val) { ::new(p) T(val); }\n        void destroy(pointer p) { p->~T(); }\n#else\n        template<typename U, typename... Args> void construct(U* p, Args&&... args)\n        {\n            ::new(p) U(std::forward<Args>(args)...);\n        }\n        template<typename U> void destroy(U* p) { p->~U(); }\n#endif\n    };\n\n    template<typename T> inline bool operator==(const Allocator<T>&, const Allocator<T>&) { return true;  }\n    template<typename T> inline bool operator!=(const Allocator<T>&, const Allocator<T>&) { return false; }\n\n}\n\n#include \"vector.h\"\nnamespace std\n{\n    template<typename T, typename Abi>\n    class allocator<Vc::Vector<T, Abi> > : public ::Vc::Allocator<Vc::Vector<T, Abi> >\n    {\n    public:\n        template<typename U> struct rebind { typedef ::std::allocator<U> other; };\n#ifdef Vc_MSVC\n        // MSVC brokenness: the following function is optional - just doesn't compile without it\n        const allocator &select_on_container_copy_construction() const { return *this; }\n#endif\n    };\n    template <typename T, typename Abi>\n    class allocator<Vc::Mask<T, Abi>> : public ::Vc::Allocator<Vc::Mask<T, Abi>>\n    {\n    public:\n        template<typename U> struct rebind { typedef ::std::allocator<U> other; };\n#ifdef Vc_MSVC\n        // MSVC brokenness: the following function is optional - just doesn't compile without it\n        const allocator &select_on_container_copy_construction() const { return *this; }\n#endif\n    };\n    template <typename T, std::size_t N, typename V, std::size_t M>\n    class allocator<Vc::SimdArray<T, N, V, M>> : public ::Vc::Allocator<Vc::SimdArray<T, N, V, M>>\n    {\n    public:\n        template<typename U> struct rebind { typedef ::std::allocator<U> other; };\n#ifdef Vc_MSVC\n        // MSVC brokenness: the following function is optional - just doesn't compile without it\n        const allocator &select_on_container_copy_construction() const { return *this; }\n#endif\n    };\n    template <typename T, std::size_t N, typename V, std::size_t M>\n    class allocator<Vc::SimdMaskArray<T, N, V, M>> : public ::Vc::Allocator<Vc::SimdMaskArray<T, N, V, M>>\n    {\n    public:\n        template<typename U> struct rebind { typedef ::std::allocator<U> other; };\n#ifdef Vc_MSVC\n        // MSVC brokenness: the following function is optional - just doesn't compile without it\n        const allocator &select_on_container_copy_construction() const { return *this; }\n#endif\n    };\n}\n\n#endif // VC_ALLOCATOR_H_\n\n// vim: ft=cpp et sw=4 sts=4\n"
  },
  {
    "path": "3rdparty/Vc/Vc/IO",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_IO_\n#define VC_IO_\n\n#include \"common/types.h\"\n#include \"common/simdarrayfwd.h\"\n#include \"common/memoryfwd.h\"\n#include <iostream>\n\n#if defined(__GNUC__) && !defined(_WIN32) && defined(_GLIBCXX_OSTREAM)\n#define Vc_HACK_OSTREAM_FOR_TTY 1\n#endif\n\n#ifdef Vc_HACK_OSTREAM_FOR_TTY\n#include <unistd.h>\n#include <ext/stdio_sync_filebuf.h>\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace\n{\n#ifdef Vc_HACK_OSTREAM_FOR_TTY\nclass hacked_ostream : public std::ostream\n{\npublic:\n    using std::ostream::_M_streambuf;\n};\nbool mayUseColor(const std::ostream &os) __attribute__((__const__));\nbool mayUseColor(const std::ostream &os)\n{\n    std::basic_streambuf<char> *hack1 =\n        const_cast<std::basic_streambuf<char> *>(os.*(&hacked_ostream::_M_streambuf));\n    __gnu_cxx::stdio_sync_filebuf<char> *hack =\n        dynamic_cast<__gnu_cxx::stdio_sync_filebuf<char> *>(hack1);\n    if (!hack) {\n        return false;\n    }\n    FILE *file = hack->file();\n    return 1 == isatty(fileno(file));\n}\n#else\nbool mayUseColor(const std::ostream &) { return false; }\n#endif\n}  // anonymous namespace\n\nnamespace AnsiColor\n{\nstruct Type\n{\n    const char *data;\n};\nstatic const Type green = {\"\\033[1;40;32m\"};\nstatic const Type yellow = {\"\\033[1;40;33m\"};\nstatic const Type blue = {\"\\033[1;40;34m\"};\nstatic const Type normal = {\"\\033[0m\"};\n\ninline std::ostream &operator<<(std::ostream &out, const Type &c)\n{\n    if (mayUseColor(out)) {\n        out << c.data;\n    }\n    return out;\n}\n}  // namespace AnsiColor\n\n/**\n * \\ingroup Vectors\n * \\headerfile IO <Vc/IO>\n *\n * Prints the contents of a vector into a stream object.\n *\n * \\code\n * const Vc::int_v v(Vc::IndexesFromZero);\n * std::cout << v << std::endl;\n * \\endcode\n * will output (with SSE):\n\\verbatim\n[0, 1, 2, 3]\n\\endverbatim\n *\n * \\param out Any standard C++ ostream object. For example std::cout or a\n *            std::stringstream object.\n * \\param v Any Vc::Vector object.\n * \\return  The ostream object: to chain multiple stream operations.\n *\n * \\note With the GNU standard library this function will check whether the\n *       output stream is a tty in which case it colorizes the output.\n */\ntemplate <typename T, typename Abi>\ninline std::ostream &operator<<(std::ostream &out, const Vc::Vector<T, Abi> &v)\n{\n    using TT = typename std::conditional<std::is_same<T, char>::value ||\n                                             std::is_same<T, unsigned char>::value ||\n                                             std::is_same<T, signed char>::value,\n                                         int,\n                                         T>::type;\n    out << AnsiColor::green << '[';\n    out << TT(v[0]);\n    for (size_t i = 1; i < v.Size; ++i) {\n        out << \", \" << TT(v[i]);\n    }\n    out << ']' << AnsiColor::normal;\n    return out;\n}\n\n/**\n * \\ingroup Masks\n * \\headerfile IO <Vc/IO>\n *\n * Prints the contents of a mask into a stream object.\n *\n * \\code\n * const Vc::short_m m = Vc::short_v::IndexesFromZero() < 3;\n * std::cout << m << std::endl;\n * \\endcode\n * will output (with SSE):\n\\verbatim\nm[1110 0000]\n\\endverbatim\n *\n * \\param out Any standard C++ ostream object. For example std::cout or a\n *            std::stringstream object.\n * \\param m Any Vc::Mask object.\n * \\return  The ostream object: to chain multiple stream operations.\n *\n * \\note With the GNU standard library this function will check whether the\n *       output stream is a tty in which case it colorizes the output.\n */\ntemplate <typename T, typename Abi>\ninline std::ostream &operator<<(std::ostream &out, const Vc::Mask<T, Abi> &m)\n{\n    out << AnsiColor::blue << \"m[\";\n    for (unsigned int i = 0; i < m.Size; ++i) {\n        if (i > 0 && (i % 4) == 0) {\n            out << ' ';\n        }\n        if (m[i]) {\n            out << AnsiColor::yellow << '1';\n        } else {\n            out << AnsiColor::blue << '0';\n        }\n    }\n    out << AnsiColor::blue << ']' << AnsiColor::normal;\n    return out;\n}\n\nnamespace Common\n{\n#ifdef DOXYGEN\n/**\n * \\ingroup Utilities\n * \\headerfile dox.h <Vc/IO>\n *\n * Prints the contents of a Memory object into a stream object.\n *\n * \\code\n * Vc::Memory<int_v, 10> m;\n * for (int i = 0; i < m.entriesCount(); ++i) {\n *   m[i] = i;\n * }\n * std::cout << m << std::endl;\n * \\endcode\n * will output (with SSE):\n\\verbatim\n{[0, 1, 2, 3] [4, 5, 6, 7] [8, 9, 0, 0]}\n\\endverbatim\n *\n * \\param s Any standard C++ ostream object. For example std::cout or a std::stringstream object.\n * \\param m Any Vc::Memory object.\n * \\return  The ostream object: to chain multiple stream operations.\n *\n * \\note With the GNU standard library this function will check whether the\n *       output stream is a tty in which case it colorizes the output.\n *\n * \\warning Please do not forget that printing a large memory object can take a long time.\n */\ntemplate<typename V, typename Parent, typename Dimension, typename RM>\ninline std::ostream &operator<<(std::ostream &s, const Vc::MemoryBase<V, Parent, Dimension, RM> &m);\n#endif\n\ntemplate<typename V, typename Parent, typename RM>\ninline std::ostream &operator<<(std::ostream &out, const MemoryBase<V, Parent, 1, RM> &m )\n{\n    out << AnsiColor::blue << '{' << AnsiColor::normal;\n    for (unsigned int i = 0; i < m.vectorsCount(); ++i) {\n        out << V(m.vector(i));\n    }\n    out << AnsiColor::blue << '}' << AnsiColor::normal;\n    return out;\n}\n\ntemplate<typename V, typename Parent, typename RM>\ninline std::ostream &operator<<(std::ostream &out, const MemoryBase<V, Parent, 2, RM> &m )\n{\n    out << AnsiColor::blue << '{' << AnsiColor::normal;\n    for (size_t i = 0; i < m.rowsCount(); ++i) {\n        if (i > 0) {\n            out << \"\\n \";\n        }\n        const size_t vcount = m[i].vectorsCount();\n        for (size_t j = 0; j < vcount; ++j) {\n            out << V(m[i].vector(j));\n        }\n    }\n    out << AnsiColor::blue << '}' << AnsiColor::normal;\n    return out;\n}\n}  // namespace Common\n\ntemplate<typename T, std::size_t N>\ninline std::ostream &operator<<(std::ostream &out, const SimdArray<T, N> &v)\n{\n    out << AnsiColor::green << '<' << v[0];\n    for (size_t i = 1; i < N; ++i) {\n        if (i % 4 == 0) out << \" |\";\n        out << ' ' << v[i];\n    }\n    return out << '>' << AnsiColor::normal;\n}\n\ntemplate<typename T, std::size_t N>\ninline std::ostream &operator<<(std::ostream &out, const SimdMaskArray<T, N> &m)\n{\n    out << AnsiColor::blue << \"«\";\n    for (size_t i = 0; i < N; ++i) {\n        if (i > 0 && (i % 4) == 0) {\n            out << ' ';\n        }\n        if ( m[i] ) {\n          out << AnsiColor::yellow << '1';\n        } else {\n          out << AnsiColor::blue << '0';\n        }\n    }\n    return out << AnsiColor::blue << \"»\" << AnsiColor::normal;\n}\n}\n\n#endif // VC_IO_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/Memory",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_MEMORY_\n#define VC_MEMORY_\n\n#include \"vector.h\"\n#include \"common/memory.h\"\n#include \"common/interleavedmemory.h\"\n\n#include \"common/make_unique.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\nusing Common::make_unique;\n}\n\n#endif // VC_MEMORY_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/SimdArray",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SIMDARRAY_\n#define VC_SIMDARRAY_\n\n#include \"common/simdarray.h\"\n\n#endif // VC_SIMDARRAY_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/Utils",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_UTILS_\n#define VC_UTILS_\n\n#include \"global.h\"\n\n#ifdef Vc_IMPL_Scalar\n# define VECTOR_NAMESPACE Scalar\n#else\n# define VECTOR_NAMESPACE SSE\n#endif\n\n#include \"common/deinterleave.h\"\n#include \"common/makeContainer.h\"\n\n#endif // VC_UTILS_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/Vc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_VC_\n#define VC_VC_\n#include \"vector.h\"\n#include \"IO\"\n#include \"Memory\"\n#include \"Utils\"\n#include \"Allocator\"\n#include \"algorithm\"\n#include \"iterators\"\n#include \"simdize\"\n#include \"array\"\n#include \"span\"\n#include \"vector\"\n#endif // VC_VC_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/algorithm",
    "content": "#include \"common/algorithms.h\"\n"
  },
  {
    "path": "3rdparty/Vc/Vc/array",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n//===---------------------------- array -----------------------------------===//\n//\n//                     The LLVM Compiler Infrastructure\n//\n// This file is dual licensed under the MIT and the University of Illinois Open\n// Source Licenses. See LICENSE.TXT for details.\n//\n//===----------------------------------------------------------------------===//\n\n#ifndef VC_INCLUDE_VC_ARRAY_\n#define VC_INCLUDE_VC_ARRAY_\n\n#include <type_traits>\n#include <utility>\n#include <iterator>\n#include <algorithm>\n#include <stdexcept>\n\n#include \"common/subscript.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * \\ingroup Containers\n * This is `std::array` with additional subscript operators supporting gather and scatter operations.\n *\n * The [std::array](https://en.cppreference.com/w/cpp/container/array) documentation applies.\n *\n * Gathers from structured data (AoS: arrays of struct) are possible via a special\n * subscript operator.\n * Example:\n * \\code\n * Vc::array<float, 100> data;\n * std::iota(data.begin(), data.end(), 0.f);  // fill with values 0, 1, 2, ...\n * auto indexes = float_v::IndexType::IndexesFromZero();\n * float_v gathered = data[indexes];  // gathered == [0, 1, 2, ...]\n * \\endcode\n *\n * This also works for gathers into arrays of structures:\n * \\code\n * struct Point { float x, y, z; };\n * Vc::array<Point, 100> points;\n * // fill points ...\n * auto indexes = float_v::IndexType::IndexesFromZero();\n * float_v xs = data[indexes][&Point::x];  // [points[0].x, points[1].x, points[2].x, ...]\n * float_v ys = data[indexes][&Point::y];  // [points[0].y, points[1].y, points[2].y, ...]\n * float_v zs = data[indexes][&Point::z];  // [points[0].z, points[1].z, points[2].z, ...]\n * \\endcode\n *\n * Arrays may also be nested:\n * \\code:\n * Vc::array<Vc::array<float, 3>, 100> points;\n * // fill points ...\n * auto indexes = float_v::IndexType::IndexesFromZero();\n * float_v xs = data[indexes][0];  // [points[0][0], points[1][0], points[2][0], ...]\n * float_v ys = data[indexes][1];  // [points[0][1], points[1][1], points[2][1], ...]\n * float_v zs = data[indexes][2];  // [points[0][2], points[1][2], points[2][2], ...]\n * \\endcode\n */\ntemplate <class T, size_t Size> struct array {\n    // types:\n    typedef array self_;\n    typedef T value_type;\n    typedef value_type& reference;\n    typedef const value_type& const_reference;\n    typedef value_type* iterator;\n    typedef const value_type* const_iterator;\n    typedef value_type* pointer;\n    typedef const value_type* const_pointer;\n    typedef size_t size_type;\n    typedef ptrdiff_t difference_type;\n    typedef std::reverse_iterator<iterator> reverse_iterator;\n    typedef std::reverse_iterator<const_iterator> const_reverse_iterator;\n\n    value_type elems_[Size > 0 ? Size : 1];\n\n    // No explicit construct/copy/destroy for aggregate type\n    void fill(const value_type& u_) { std::fill_n(elems_, Size, u_); }\n    void swap(array& a_) noexcept(std::swap(std::declval<T &>(), std::declval<T &>()))\n    {\n        std::swap_ranges(elems_, elems_ + Size, a_.elems_);\n    }\n\n    // iterators:\n    iterator begin() noexcept { return iterator(elems_); }\n    const_iterator begin() const noexcept { return const_iterator(elems_); }\n    iterator end() noexcept { return iterator(elems_ + Size); }\n    const_iterator end() const noexcept { return const_iterator(elems_ + Size); }\n    reverse_iterator rbegin() noexcept { return reverse_iterator(end()); }\n    const_reverse_iterator rbegin() const noexcept\n    {\n        return const_reverse_iterator(end());\n    }\n    reverse_iterator rend() noexcept { return reverse_iterator(begin()); }\n    const_reverse_iterator rend() const noexcept\n    {\n        return const_reverse_iterator(begin());\n    }\n\n    const_iterator cbegin() const noexcept { return begin(); }\n    const_iterator cend() const noexcept { return end(); }\n    const_reverse_iterator crbegin() const noexcept { return rbegin(); }\n    const_reverse_iterator crend() const noexcept { return rend(); }\n    // capacity:\n    constexpr size_type size() const noexcept { return Size; }\n    constexpr size_type max_size() const noexcept { return Size; }\n    constexpr bool empty() const noexcept { return Size == 0; }\n    // element access:\n    reference operator[](size_type n_) { return elems_[n_]; }\n    constexpr const_reference operator[](size_type n_) const { return elems_[n_]; }\n\n    /**\n     * \\name Data-Parallel Subscripting for Gather & Scatter\n     */\n    ///@{\n    template <typename I>\n    Vc_ALWAYS_INLINE auto operator[](I&& arg_)\n        -> decltype(subscript_operator(*this, std::forward<I>(arg_)))\n    {\n        return subscript_operator(*this, std::forward<I>(arg_));\n    }\n\n    template <typename I>\n    Vc_ALWAYS_INLINE auto operator[](I&& arg_) const\n        -> decltype(subscript_operator(*this, std::forward<I>(arg_)))\n    {\n        return subscript_operator(*this, std::forward<I>(arg_));\n    }\n    ///@}\n\n    reference at(size_type n_);\n    constexpr const_reference at(size_type n_) const;\n\n    reference front() { return elems_[0]; }\n    constexpr const_reference front() const { return elems_[0]; }\n    reference back() { return elems_[Size > 0 ? Size - 1 : 0]; }\n    constexpr const_reference back() const { return elems_[Size > 0 ? Size - 1 : 0]; }\n    value_type* data() noexcept { return elems_; }\n    const value_type* data() const noexcept { return elems_; }\n};\n\ntemplate <class T, size_t Size>\ntypename array<T, Size>::reference array<T, Size>::at(size_type n_)\n{\n    if (n_ >= Size) {\n        throw std::out_of_range(\"array::at\");\n    }\n    return elems_[n_];\n}\n\ntemplate <class T, size_t Size>\nconstexpr typename array<T, Size>::const_reference array<T, Size>::at(size_type n_) const\n{\n    return n_ >= Size ? (throw std::out_of_range(\"array::at\"), elems_[0]) : elems_[n_];\n}\n\ntemplate <class T, size_t Size>\ninline bool operator==(const array<T, Size>& x_, const array<T, Size>& y_)\n{\n    return std::equal(x_.elems_, x_.elems_ + Size, y_.elems_);\n}\n\ntemplate <class T, size_t Size>\ninline bool operator!=(const array<T, Size>& x_, const array<T, Size>& y_)\n{\n    return !(x_ == y_);\n}\n\ntemplate <class T, size_t Size>\ninline bool operator<(const array<T, Size>& x_, const array<T, Size>& y_)\n{\n    return std::lexicographical_compare(x_.elems_, x_.elems_ + Size, y_.elems_,\n                                        y_.elems_ + Size);\n}\n\ntemplate <class T, size_t Size>\ninline bool operator>(const array<T, Size>& x_, const array<T, Size>& y_)\n{\n    return y_ < x_;\n}\n\ntemplate <class T, size_t Size>\ninline bool operator<=(const array<T, Size>& x_, const array<T, Size>& y_)\n{\n    return !(y_ < x_);\n}\n\ntemplate <class T, size_t Size>\ninline bool operator>=(const array<T, Size>& x_, const array<T, Size>& y_)\n{\n    return !(x_ < y_);\n}\n\n/**\\name non-member begin & end\n * Implement the non-member begin & end functions in the %Vc namespace so that ADL works\n * and `begin(some_vc_array)` always works.\n */\n///@{\ntemplate <typename T, std::size_t N>\ninline auto begin(array<T, N>& arr) -> decltype(arr.begin())\n{\n    return arr.begin();\n}\ntemplate <typename T, std::size_t N>\ninline auto begin(const array<T, N>& arr) -> decltype(arr.begin())\n{\n    return arr.begin();\n}\ntemplate <typename T, std::size_t N>\ninline auto end(array<T, N>& arr) -> decltype(arr.end())\n{\n    return arr.end();\n}\ntemplate <typename T, std::size_t N>\ninline auto end(const array<T, N>& arr) -> decltype(arr.end())\n{\n    return arr.end();\n}\n///@}\n\nnamespace Traits\n{\ntemplate <typename T, std::size_t N>\nstruct has_no_allocated_data_impl<Vc::array<T, N>> : public std::true_type\n{\n};\ntemplate <typename T, std::size_t N>\nstruct has_contiguous_storage_impl<Vc::array<T, N>> : public std::true_type\n{\n};\n}  // namespace Traits\n}  // namespace Vc\n\nnamespace std\n{\ntemplate <class T, size_t Size>\ninline\n#ifdef Vc_MSVC\n    // MSVC fails to do SFINAE correctly and gets totally confused:\n    // error C2433: 'type': 'inline' not permitted on data declarations\n    // error C4430: missing type specifier - int assumed. Note: C++ does not support default-int\n    // error C2061: syntax error: identifier 'swap'\n    void\n#else\n    typename enable_if<is_same<void, decltype(swap(declval<T&>(), declval<T&>()))>::value,\n                       void>::type\n#endif\n    swap(const Vc::array<T, Size>& x_,\n         const Vc::array<T, Size>& y_) noexcept(swap(declval<T&>(), declval<T&>()))\n{\n    x_.swap(y_);\n}\n\ntemplate <class T, size_t Size>\nclass tuple_size<Vc::array<T, Size>> : public integral_constant<size_t, Size>\n{\n};\n\ntemplate <size_t I, class T, size_t Size> class tuple_element<I, Vc::array<T, Size>>\n{\npublic:\n    typedef T type;\n};\n\ntemplate <size_t I, class T, size_t Size>\ninline constexpr typename std::enable_if<(I < Size), T&>::type get(\n    Vc::array<T, Size>& a_) noexcept\n{\n    return a_.elems_[I];\n}\n\ntemplate <size_t I, class T, size_t Size>\ninline constexpr typename std::enable_if<(I < Size), const T&>::type get(\n    const Vc::array<T, Size>& a_) noexcept\n{\n    return a_.elems_[I];\n}\n\ntemplate <size_t I, class T, size_t Size>\ninline constexpr typename std::enable_if<(I < Size), T&&>::type get(\n    Vc::array<T, Size>&& a_) noexcept\n{\n    return std::move(a_.elems_[I]);\n}\n}  // namespace std\n\n#endif  // VC_INCLUDE_VC_ARRAY_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/casts.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_CASTS_H_\n#define VC_AVX_CASTS_H_\n\n#include \"intrinsics.h\"\n#include \"types.h\"\n#include \"../sse/casts.h\"\n#include \"shuffle.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\nnamespace Casts\n{\n    template<typename T> Vc_INTRINSIC_L T avx_cast(__m128  v) Vc_INTRINSIC_R;\n    template<typename T> Vc_INTRINSIC_L T avx_cast(__m128i v) Vc_INTRINSIC_R;\n    template<typename T> Vc_INTRINSIC_L T avx_cast(__m128d v) Vc_INTRINSIC_R;\n    template<typename T> Vc_INTRINSIC_L T avx_cast(__m256  v) Vc_INTRINSIC_R;\n    template<typename T> Vc_INTRINSIC_L T avx_cast(__m256i v) Vc_INTRINSIC_R;\n    template<typename T> Vc_INTRINSIC_L T avx_cast(__m256d v) Vc_INTRINSIC_R;\n\n    // 128 -> 128\n    template<> Vc_INTRINSIC __m128  avx_cast(__m128  v) { return v; }\n    template<> Vc_INTRINSIC __m128  avx_cast(__m128i v) { return _mm_castsi128_ps(v); }\n    template<> Vc_INTRINSIC __m128  avx_cast(__m128d v) { return _mm_castpd_ps(v); }\n    template<> Vc_INTRINSIC __m128i avx_cast(__m128  v) { return _mm_castps_si128(v); }\n    template<> Vc_INTRINSIC __m128i avx_cast(__m128i v) { return v; }\n    template<> Vc_INTRINSIC __m128i avx_cast(__m128d v) { return _mm_castpd_si128(v); }\n    template<> Vc_INTRINSIC __m128d avx_cast(__m128  v) { return _mm_castps_pd(v); }\n    template<> Vc_INTRINSIC __m128d avx_cast(__m128i v) { return _mm_castsi128_pd(v); }\n    template<> Vc_INTRINSIC __m128d avx_cast(__m128d v) { return v; }\n\n    // 128 -> 256\n    // FIXME: the following casts leave the upper 128bits undefined. With GCC and ICC I've never\n    // seen the cast not do what I want though: after a VEX-coded SSE instruction the register's\n    // upper 128bits are zero. Thus using the same register as AVX register will have the upper\n    // 128bits zeroed. MSVC, though, implements _mm256_castxx128_xx256 with a 128bit move to memory\n    // + 256bit load. Thus the upper 128bits are really undefined. But there is no intrinsic to do\n    // what I want (i.e. alias the register, disallowing the move to memory in-between). I'm stuck,\n    // do we really want to rely on specific compiler behavior here?\n    template<> Vc_INTRINSIC __m256  avx_cast(__m128  v) { return _mm256_castps128_ps256(v); }\n    template<> Vc_INTRINSIC __m256  avx_cast(__m128i v) { return _mm256_castps128_ps256(_mm_castsi128_ps(v)); }\n    template<> Vc_INTRINSIC __m256  avx_cast(__m128d v) { return _mm256_castps128_ps256(_mm_castpd_ps(v)); }\n    template<> Vc_INTRINSIC __m256i avx_cast(__m128  v) { return _mm256_castsi128_si256(_mm_castps_si128(v)); }\n    template<> Vc_INTRINSIC __m256i avx_cast(__m128i v) { return _mm256_castsi128_si256(v); }\n    template<> Vc_INTRINSIC __m256i avx_cast(__m128d v) { return _mm256_castsi128_si256(_mm_castpd_si128(v)); }\n    template<> Vc_INTRINSIC __m256d avx_cast(__m128  v) { return _mm256_castpd128_pd256(_mm_castps_pd(v)); }\n    template<> Vc_INTRINSIC __m256d avx_cast(__m128i v) { return _mm256_castpd128_pd256(_mm_castsi128_pd(v)); }\n    template<> Vc_INTRINSIC __m256d avx_cast(__m128d v) { return _mm256_castpd128_pd256(v); }\n\n#if defined Vc_MSVC || defined Vc_CLANG || defined Vc_APPLECLANG\n    static Vc_INTRINSIC Vc_CONST __m256  zeroExtend(__m128  v) { return _mm256_permute2f128_ps   (_mm256_castps128_ps256(v), _mm256_castps128_ps256(v), 0x80); }\n    static Vc_INTRINSIC Vc_CONST __m256i zeroExtend(__m128i v) { return _mm256_permute2f128_si256(_mm256_castsi128_si256(v), _mm256_castsi128_si256(v), 0x80); }\n    static Vc_INTRINSIC Vc_CONST __m256d zeroExtend(__m128d v) { return _mm256_permute2f128_pd   (_mm256_castpd128_pd256(v), _mm256_castpd128_pd256(v), 0x80); }\n#else\n    static Vc_INTRINSIC Vc_CONST __m256  zeroExtend(__m128  v) { return _mm256_castps128_ps256(v); }\n    static Vc_INTRINSIC Vc_CONST __m256i zeroExtend(__m128i v) { return _mm256_castsi128_si256(v); }\n    static Vc_INTRINSIC Vc_CONST __m256d zeroExtend(__m128d v) { return _mm256_castpd128_pd256(v); }\n#endif\n\n    // 256 -> 128\n    template<> Vc_INTRINSIC __m128  avx_cast(__m256  v) { return _mm256_castps256_ps128(v); }\n    template<> Vc_INTRINSIC __m128  avx_cast(__m256i v) { return _mm256_castps256_ps128(_mm256_castsi256_ps(v)); }\n    template<> Vc_INTRINSIC __m128  avx_cast(__m256d v) { return _mm256_castps256_ps128(_mm256_castpd_ps(v)); }\n    template<> Vc_INTRINSIC __m128i avx_cast(__m256  v) { return _mm256_castsi256_si128(_mm256_castps_si256(v)); }\n    template<> Vc_INTRINSIC __m128i avx_cast(__m256i v) { return _mm256_castsi256_si128(v); }\n    template<> Vc_INTRINSIC __m128i avx_cast(__m256d v) { return _mm256_castsi256_si128(_mm256_castpd_si256(v)); }\n    template<> Vc_INTRINSIC __m128d avx_cast(__m256  v) { return _mm256_castpd256_pd128(_mm256_castps_pd(v)); }\n    template<> Vc_INTRINSIC __m128d avx_cast(__m256i v) { return _mm256_castpd256_pd128(_mm256_castsi256_pd(v)); }\n    template<> Vc_INTRINSIC __m128d avx_cast(__m256d v) { return _mm256_castpd256_pd128(v); }\n\n    // 256 -> 256\n    template<> Vc_INTRINSIC __m256  avx_cast(__m256  v) { return v; }\n    template<> Vc_INTRINSIC __m256  avx_cast(__m256i v) { return _mm256_castsi256_ps(v); }\n    template<> Vc_INTRINSIC __m256  avx_cast(__m256d v) { return _mm256_castpd_ps(v); }\n    template<> Vc_INTRINSIC __m256i avx_cast(__m256  v) { return _mm256_castps_si256(v); }\n    template<> Vc_INTRINSIC __m256i avx_cast(__m256i v) { return v; }\n    template<> Vc_INTRINSIC __m256i avx_cast(__m256d v) { return _mm256_castpd_si256(v); }\n    template<> Vc_INTRINSIC __m256d avx_cast(__m256  v) { return _mm256_castps_pd(v); }\n    template<> Vc_INTRINSIC __m256d avx_cast(__m256i v) { return _mm256_castsi256_pd(v); }\n    template<> Vc_INTRINSIC __m256d avx_cast(__m256d v) { return v; }\n\n    // simplify splitting 256-bit registers in 128-bit registers\n    Vc_INTRINSIC Vc_CONST __m128  lo128(__m256  v) { return avx_cast<__m128>(v); }\n    Vc_INTRINSIC Vc_CONST __m128d lo128(__m256d v) { return avx_cast<__m128d>(v); }\n    Vc_INTRINSIC Vc_CONST __m128i lo128(__m256i v) { return avx_cast<__m128i>(v); }\n    Vc_INTRINSIC Vc_CONST __m128  hi128(__m256  v) { return extract128<1>(v); }\n    Vc_INTRINSIC Vc_CONST __m128d hi128(__m256d v) { return extract128<1>(v); }\n    Vc_INTRINSIC Vc_CONST __m128i hi128(__m256i v) { return extract128<1>(v); }\n\n    // simplify combining 128-bit registers in 256-bit registers\n    Vc_INTRINSIC Vc_CONST __m256  concat(__m128  a, __m128  b) { return insert128<1>(avx_cast<__m256 >(a), b); }\n    Vc_INTRINSIC Vc_CONST __m256d concat(__m128d a, __m128d b) { return insert128<1>(avx_cast<__m256d>(a), b); }\n    Vc_INTRINSIC Vc_CONST __m256i concat(__m128i a, __m128i b) { return insert128<1>(avx_cast<__m256i>(a), b); }\n\n}  // namespace Casts\nusing namespace Casts;\n}  // namespace AVX\n\nnamespace AVX2\n{\nusing namespace AVX::Casts;\n}  // namespace AVX2\n\nnamespace AVX\n{\ntemplate <typename From, typename To> struct ConvertTag {};\n\nVc_INTRINSIC __m256i convert(__m256  v, ConvertTag<float , int>) { return _mm256_cvttps_epi32(v); }\nVc_INTRINSIC __m128i convert(__m256d v, ConvertTag<double, int>) { return _mm256_cvttpd_epi32(v); }\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<int   , int>) { return v; }\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<uint  , int>) { return v; }\nVc_INTRINSIC __m256i convert(__m128i v, ConvertTag<short , int>) {\n#ifdef Vc_IMPL_AVX2\n    return _mm256_cvtepi16_epi32(v);\n#else\n    return AVX::srai_epi32<16>(\n        concat(_mm_unpacklo_epi16(v, v), _mm_unpackhi_epi16(v, v)));\n#endif\n}\nVc_INTRINSIC __m256i convert(__m128i v, ConvertTag<ushort, int>) {\n#ifdef Vc_IMPL_AVX2\n    return _mm256_cvtepu16_epi32(v);\n#else\n    return AVX::srli_epi32<16>(\n        concat(_mm_unpacklo_epi16(v, v), _mm_unpackhi_epi16(v, v)));\n#endif\n}\n\nVc_INTRINSIC __m256i convert(__m256  v, ConvertTag<float , uint>) {\n    using namespace AVX;\n    return _mm256_castps_si256(_mm256_blendv_ps(\n        _mm256_castsi256_ps(_mm256_cvttps_epi32(v)),\n        _mm256_castsi256_ps(add_epi32(_mm256_cvttps_epi32(_mm256_sub_ps(v, set2power31_ps())),\n                                      set2power31_epu32())),\n        cmpge_ps(v, set2power31_ps())));\n}\nVc_INTRINSIC __m128i convert(__m256d v, ConvertTag<double, uint>) {\n    using namespace AVX;\n    return _mm_xor_si128(\n        _mm256_cvttpd_epi32(_mm256_sub_pd(_mm256_floor_pd(v), set1_pd(0x80000000u))),\n        _mm_set2power31_epu32());\n}\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<int   , uint>) { return v; }\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<uint  , uint>) { return v; }\nVc_INTRINSIC __m256i convert(__m128i v, ConvertTag<short , uint>) {\n#ifdef Vc_IMPL_AVX2\n    return _mm256_cvtepi16_epi32(v);\n#else\n    return AVX::srai_epi32<16>(\n        concat(_mm_unpacklo_epi16(v, v), _mm_unpackhi_epi16(v, v)));\n#endif\n}\nVc_INTRINSIC __m256i convert(__m128i v, ConvertTag<ushort, uint>) {\n#ifdef Vc_IMPL_AVX2\n    return _mm256_cvtepu16_epi32(v);\n#else\n    return AVX::srli_epi32<16>(\n        concat(_mm_unpacklo_epi16(v, v), _mm_unpackhi_epi16(v, v)));\n#endif\n}\n\nVc_INTRINSIC __m256  convert(__m256  v, ConvertTag<float , float>) { return v; }\nVc_INTRINSIC __m128  convert(__m256d v, ConvertTag<double, float>) { return _mm256_cvtpd_ps(v); }\nVc_INTRINSIC __m256  convert(__m256i v, ConvertTag<int   , float>) { return _mm256_cvtepi32_ps(v); }\nVc_INTRINSIC __m256  convert(__m256i v, ConvertTag<uint  , float>) {\n    // this is complicated because cvtepi32_ps only supports signed input. Thus, all\n    // input values with the MSB set would produce a negative result. We can reuse the\n    // cvtepi32_ps instruction if we unset the MSB. But then the rounding results can be\n    // different. Since float uses 24 bits for the mantissa (effectively), the 9-bit LSB\n    // determines the rounding direction. (Consider the bits ...8'7654'3210. The bits [0:7]\n    // need to be dropped and if > 0x80 round up, if < 0x80 round down. If [0:7] == 0x80\n    // then the rounding direction is determined by bit [8] for round to even. That's why\n    // the 9th bit is relevant for the rounding decision.)\n    // If the MSB of the input is set to 0, the cvtepi32_ps instruction makes its rounding\n    // decision on the lowest 8 bits instead. A second rounding decision is made when\n    // float(0x8000'0000) is added. This will rarely fix the rounding issue.\n    //\n    // Here's what the standard rounding mode expects:\n    // 0xc0000080 should cvt to 0xc0000000\n    // 0xc0000081 should cvt to 0xc0000100\n    //     --     should cvt to 0xc0000100\n    // 0xc000017f should cvt to 0xc0000100\n    // 0xc0000180 should cvt to 0xc0000200\n    //\n    // However: using float(input ^ 0x8000'0000) + float(0x8000'0000) we get:\n    // 0xc0000081 would cvt to 0xc0000000\n    // 0xc00000c0 would cvt to 0xc0000000\n    // 0xc00000c1 would cvt to 0xc0000100\n    // 0xc000013f would cvt to 0xc0000100\n    // 0xc0000140 would cvt to 0xc0000200\n    //\n    // Solution: float(input & 0x7fff'fe00) + (float(0x8000'0000) + float(input & 0x1ff))\n    // This ensures the rounding decision is made on the 9-bit LSB when 0x8000'0000 is\n    // added to the float value of the low 8 bits of the input.\n    using namespace AVX;\n    return _mm256_blendv_ps(\n        _mm256_cvtepi32_ps(v),\n        _mm256_add_ps(_mm256_cvtepi32_ps(and_si256(v, set1_epi32(0x7ffffe00))),\n                      _mm256_add_ps(set2power31_ps(), _mm256_cvtepi32_ps(and_si256(\n                                                          v, set1_epi32(0x000001ff))))),\n        _mm256_castsi256_ps(cmplt_epi32(v, _mm256_setzero_si256())));\n}\nVc_INTRINSIC __m256  convert(__m128i v, ConvertTag<short , float>) { return _mm256_cvtepi32_ps(convert(v, ConvertTag< short, int>())); }\nVc_INTRINSIC __m256  convert(__m128i v, ConvertTag<ushort, float>) { return _mm256_cvtepi32_ps(convert(v, ConvertTag<ushort, int>())); }\n\nVc_INTRINSIC __m256d convert(__m128  v, ConvertTag<float , double>) { return _mm256_cvtps_pd(v); }\nVc_INTRINSIC __m256d convert(__m256d v, ConvertTag<double, double>) { return v; }\nVc_INTRINSIC __m256d convert(__m128i v, ConvertTag<int   , double>) { return _mm256_cvtepi32_pd(v); }\nVc_INTRINSIC __m256d convert(__m128i v, ConvertTag<uint  , double>) {\n    using namespace AVX;\n    return _mm256_add_pd(\n        _mm256_cvtepi32_pd(_mm_xor_si128(v, _mm_setmin_epi32())),\n        set1_pd(1u << 31)); }\nVc_INTRINSIC __m256d convert(__m128i v, ConvertTag<short , double>) { return convert(convert(v, SSE::ConvertTag< short, int>()), ConvertTag<int, double>()); }\nVc_INTRINSIC __m256d convert(__m128i v, ConvertTag<ushort, double>) { return convert(convert(v, SSE::ConvertTag<ushort, int>()), ConvertTag<int, double>()); }\n\nVc_INTRINSIC __m128i convert(__m256i v, ConvertTag<int   , short>) {\n#ifdef Vc_IMPL_AVX2\n    auto a = _mm256_shuffle_epi8(\n        v, _mm256_setr_epi8(0, 1, 4, 5, 8, 9, 12, 13, -0x80, -0x80, -0x80, -0x80, -0x80,\n                            -0x80, -0x80, -0x80, 0, 1, 4, 5, 8, 9, 12, 13, -0x80, -0x80,\n                            -0x80, -0x80, -0x80, -0x80, -0x80, -0x80));\n    return lo128(_mm256_permute4x64_epi64(a, 0xf8));  // a[0] a[2] | a[3] a[3]\n#else\n    const auto tmp0 = _mm_unpacklo_epi16(lo128(v), hi128(v));\n    const auto tmp1 = _mm_unpackhi_epi16(lo128(v), hi128(v));\n    const auto tmp2 = _mm_unpacklo_epi16(tmp0, tmp1);\n    const auto tmp3 = _mm_unpackhi_epi16(tmp0, tmp1);\n    return _mm_unpacklo_epi16(tmp2, tmp3);\n#endif\n}\nVc_INTRINSIC __m128i convert(__m256i v, ConvertTag<uint  , short>) { return convert(v, ConvertTag<int, short>()); }\nVc_INTRINSIC __m128i convert(__m256  v, ConvertTag<float , short>) { return convert(convert(v, ConvertTag<float, int>()), ConvertTag<int, short>()); }\nVc_INTRINSIC __m128i convert(__m256d v, ConvertTag<double, short>) { return convert(convert(v, ConvertTag<double, int>()), SSE::ConvertTag<int, short>()); }\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<short , short>) { return v; }\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<ushort, short>) { return v; }\n\nVc_INTRINSIC __m128i convert(__m256i v, ConvertTag<int   , ushort>) {\n    auto tmp0 = _mm_unpacklo_epi16(lo128(v), hi128(v));\n    auto tmp1 = _mm_unpackhi_epi16(lo128(v), hi128(v));\n    auto tmp2 = _mm_unpacklo_epi16(tmp0, tmp1);\n    auto tmp3 = _mm_unpackhi_epi16(tmp0, tmp1);\n    return _mm_unpacklo_epi16(tmp2, tmp3);\n}\nVc_INTRINSIC __m128i convert(__m256i v, ConvertTag<uint  , ushort>) {\n    auto tmp0 = _mm_unpacklo_epi16(lo128(v), hi128(v));\n    auto tmp1 = _mm_unpackhi_epi16(lo128(v), hi128(v));\n    auto tmp2 = _mm_unpacklo_epi16(tmp0, tmp1);\n    auto tmp3 = _mm_unpackhi_epi16(tmp0, tmp1);\n    return _mm_unpacklo_epi16(tmp2, tmp3);\n}\nVc_INTRINSIC __m128i convert(__m256  v, ConvertTag<float , ushort>) { return convert(convert(v, ConvertTag<float, uint>()), ConvertTag<uint, ushort>()); }\nVc_INTRINSIC __m128i convert(__m256d v, ConvertTag<double, ushort>) { return convert(convert(v, ConvertTag<double, uint>()), SSE::ConvertTag<uint, ushort>()); }\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<short , ushort>) { return v; }\nVc_INTRINSIC __m256i convert(__m256i v, ConvertTag<ushort, ushort>) { return v; }\n\ntemplate <typename From, typename To>\nVc_INTRINSIC auto convert(\n    typename std::conditional<(sizeof(From) < sizeof(To)),\n                              typename SSE::VectorTraits<From>::VectorType,\n                              typename AVX::VectorTypeHelper<From>::Type>::type v)\n    -> decltype(convert(v, ConvertTag<From, To>()))\n{\n    return convert(v, ConvertTag<From, To>());\n}\n\ntemplate <typename From, typename To, typename = enable_if<(sizeof(From) < sizeof(To))>>\nVc_INTRINSIC auto convert(typename AVX::VectorTypeHelper<From>::Type v)\n    -> decltype(convert(lo128(v), ConvertTag<From, To>()))\n{\n    return convert(lo128(v), ConvertTag<From, To>());\n}\n}  // namespace AVX\n}  // namespace Vc\n\n#endif // VC_AVX_CASTS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/const.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_CONST_H_\n#define VC_AVX_CONST_H_\n\n#include <cstddef>\n#include \"types.h\"\n#include \"const_data.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\n    template<typename T> struct IndexesFromZeroData;\n    template<> struct IndexesFromZeroData<int> {\n        static Vc_ALWAYS_INLINE Vc_CONST const int *address() { return reinterpret_cast<const int *>(&_IndexesFromZero32[0]); }\n    };\n    template<> struct IndexesFromZeroData<unsigned int> {\n        static Vc_ALWAYS_INLINE Vc_CONST const unsigned int *address() { return &_IndexesFromZero32[0]; }\n    };\n    template<> struct IndexesFromZeroData<short> {\n        static Vc_ALWAYS_INLINE Vc_CONST const short *address() { return reinterpret_cast<const short *>(&_IndexesFromZero16[0]); }\n    };\n    template<> struct IndexesFromZeroData<unsigned short> {\n        static Vc_ALWAYS_INLINE Vc_CONST const unsigned short *address() { return &_IndexesFromZero16[0]; }\n    };\n    template<> struct IndexesFromZeroData<signed char> {\n        static Vc_ALWAYS_INLINE Vc_CONST const signed char *address() { return reinterpret_cast<const signed char *>(&_IndexesFromZero8[0]); }\n    };\n    template<> struct IndexesFromZeroData<char> {\n        static Vc_ALWAYS_INLINE Vc_CONST const char *address() { return reinterpret_cast<const char *>(&_IndexesFromZero8[0]); }\n    };\n    template<> struct IndexesFromZeroData<unsigned char> {\n        static Vc_ALWAYS_INLINE Vc_CONST const unsigned char *address() { return &_IndexesFromZero8[0]; }\n    };\n\n    template<typename _T> struct Const\n    {\n        typedef Vector<_T> V;\n        typedef typename V::EntryType T;\n        typedef typename V::Mask M;\n\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4()        { return V(c_trig<T>::data[0]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_hi()     { return V(c_trig<T>::data[1]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_rem1()   { return V(c_trig<T>::data[2]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_rem2()   { return V(c_trig<T>::data[3]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _1_16()        { return V(c_trig<T>::data[4]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _16()          { return V(c_trig<T>::data[5]); }\n\n        static Vc_ALWAYS_INLINE Vc_CONST V atanP(int i)      { return V(c_trig<T>::data[(12 + i)]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V atanQ(int i)      { return V(c_trig<T>::data[(17 + i)]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V atanThrsHi()      { return V(c_trig<T>::data[22]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V atanThrsLo()      { return V(c_trig<T>::data[23]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_2_rem()       { return V(c_trig<T>::data[24]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V lossThreshold()   { return V(c_trig<T>::data[8]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _4_pi()           { return V(c_trig<T>::data[9]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_2()           { return V(c_trig<T>::data[10]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi()             { return V(c_trig<T>::data[11]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff0(int i) { return V(c_trig<T>::data[(28 + i)]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff1(int i) { return V(c_trig<T>::data[(33 + i)]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff2(int i) { return V(c_trig<T>::data[(37 + i)]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff3(int i) { return V(c_trig<T>::data[(43 + i)]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V smallAsinInput()  { return V(c_trig<T>::data[25]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V largeAsinInput()  { return V(c_trig<T>::data[26]); }\n\n        static Vc_ALWAYS_INLINE Vc_CONST M exponentMask() { return M(V(c_log<T>::d(1)).data()); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _1_2()         { return V(c_log<T>::d(18)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _1_sqrt2()     { return V(c_log<T>::d(15)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V P(int i)       { return V(c_log<T>::d(2 + i)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V Q(int i)       { return V(c_log<T>::d(8 + i)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V min()          { return V(c_log<T>::d(14)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V ln2_small()    { return V(c_log<T>::d(17)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V ln2_large()    { return V(c_log<T>::d(16)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V neginf()       { return V(c_log<T>::d(13)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V log10_e()      { return V(c_log<T>::d(19)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V log2_e()       { return V(c_log<T>::d(20)); }\n\n        static Vc_ALWAYS_INLINE_L Vc_CONST_L V highMask() Vc_ALWAYS_INLINE_R Vc_CONST_R;\n        static Vc_ALWAYS_INLINE_L Vc_CONST_L V highMask(int bits) Vc_ALWAYS_INLINE_R Vc_CONST_R;\n    };\n\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<float> Const<float>::highMask()\n    {\n        return _mm256_broadcast_ss(\n            reinterpret_cast<const float *>(&c_general::highMaskFloat));\n    }\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<double> Const<double>::highMask()\n    {\n        return _mm256_broadcast_sd(\n            reinterpret_cast<const double *>(&c_general::highMaskDouble));\n    }\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<float> Const<float>::highMask(int bits)\n    {\n#ifdef Vc_IMPL_AVX2\n#if defined Vc_ICC || defined Vc_MSVC\n        __m256i allone = _mm256_set1_epi64x(~0);\n#else\n        auto allone = ~__m256i();\n#endif\n        return _mm256_castsi256_ps(_mm256_slli_epi32(allone, bits));\n#else\n        __m128 tmp = _mm_castsi128_ps(_mm_slli_epi32(_mm_setallone_si128(), bits));\n        return concat(tmp, tmp);\n#endif\n    }\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<double> Const<double>::highMask(int bits)\n    {\n#ifdef Vc_IMPL_AVX2\n#if defined Vc_ICC || defined Vc_MSVC\n        __m256i allone = _mm256_set1_epi64x(~0);\n#else\n        auto allone = ~__m256i();\n#endif\n        return _mm256_castsi256_pd(_mm256_slli_epi64(allone, bits));\n#else\n        __m128d tmp = _mm_castsi128_pd(_mm_slli_epi64(_mm_setallone_si128(), bits));\n        return concat(tmp, tmp);\n#endif\n    }\n}  // namespace AVX\n\nnamespace AVX2\n{\nusing AVX::IndexesFromZeroData;\nusing AVX::Const;\n}  // namespace AVX2\n}  // namespace Vc\n\n#endif // VC_AVX_CONST_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/const_data.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_CONST_DATA_H_\n#define VC_AVX_CONST_DATA_H_\n\n#include \"../common/data.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\n\nalignas(64) extern const unsigned int   _IndexesFromZero32[ 8];\nalignas(16) extern const unsigned short _IndexesFromZero16[16];\nalignas(16) extern const unsigned char  _IndexesFromZero8 [32];\n\nstruct alignas(64) c_general\n{\n    static const float oneFloat;\n    static const unsigned int absMaskFloat[2];\n    static const unsigned int signMaskFloat[2];\n    static const unsigned int highMaskFloat;\n    static const unsigned short minShort[2];\n    static const unsigned short one16[2];\n    static const float _2power31;\n    static const double oneDouble;\n    static const unsigned long long frexpMask;\n    static const unsigned long long highMaskDouble;\n};\n\ntemplate<typename T> struct c_trig\n{\n    alignas(64) static const T data[];\n};\n#ifndef Vc_MSVC\ntemplate <> alignas(64) const float c_trig<float>::data[];\ntemplate <> alignas(64) const double c_trig<double>::data[];\n#endif\n\ntemplate<typename T> struct c_log\n{\n    typedef float floatAlias Vc_MAY_ALIAS;\n    static Vc_ALWAYS_INLINE float d(int i) { return *reinterpret_cast<const floatAlias *>(&data[i]); }\n    alignas(64) static const unsigned int data[21];\n};\n#ifndef Vc_MSVC\ntemplate<> alignas(64) const unsigned int c_log<float>::data[21];\n#endif\n\ntemplate<> struct c_log<double>\n{\n    enum VectorSize { Size = 16 / sizeof(double) };\n    typedef double doubleAlias Vc_MAY_ALIAS;\n    static Vc_ALWAYS_INLINE double d(int i) { return *reinterpret_cast<const doubleAlias *>(&data[i]); }\n    alignas(64) static const unsigned long long data[21];\n};\n\n}  // namespace AVX\n}  // namespace Vc\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX2\n{\n    using AVX::_IndexesFromZero8;\n    using AVX::_IndexesFromZero16;\n    using AVX::_IndexesFromZero32;\n    using AVX::c_general;\n    using AVX::c_trig;\n    using AVX::c_log;\n}  // namespace AVX2\n}  // namespace Vc\n\n#endif // VC_AVX_CONST_DATA_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/debug.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_DEBUG_H_\n#define VC_AVX_DEBUG_H_\n\n#ifndef NDEBUG\n#include \"vector.h\"\n#include <iostream>\n#include <iomanip>\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\ntemplate <typename T, typename U> struct AddType {\n    const U &d;\n};\ntemplate <typename T, typename U> AddType<T, U> addType(const U &x) { return {x}; }\n\n#ifdef NDEBUG\nclass DebugStream\n{\n    public:\n        DebugStream(const char *, const char *, int) {}\n        template<typename T> inline DebugStream &operator<<(const T &) { return *this; }\n};\n#else\nclass DebugStream\n{\n    private:\n        template<typename T, typename V> static void printVector(V _x)\n        {\n            enum { Size = sizeof(V) / sizeof(T) };\n            union { V v; T m[Size]; } x = { _x };\n            std::cerr << '[' << std::setprecision(24) << x.m[0];\n            for (int i = 1; i < Size; ++i) {\n                std::cerr << \", \" << std::setprecision(24) << x.m[i];\n            }\n            std::cerr << ']';\n        }\n    public:\n        DebugStream(const char *func, const char *file, int line)\n        {\n            std::cerr << \"\\033[1;40;33mDEBUG: \" << file << ':' << line << ' ' << func << ' ';\n        }\n\n        template<typename T> DebugStream &operator<<(const T &x) { std::cerr << x; return *this; }\n\n        template <typename T, typename U> DebugStream &operator<<(AddType<T, U> &&x)\n        {\n            printVector<T, U>(x.d);\n            return *this;\n        }\n        DebugStream &operator<<(__m128 x) {\n            printVector<float, __m128>(x);\n            return *this;\n        }\n        DebugStream &operator<<(__m256 x) {\n            printVector<float, __m256>(x);\n            return *this;\n        }\n        DebugStream &operator<<(__m128d x) {\n            printVector<double, __m128d>(x);\n            return *this;\n        }\n        DebugStream &operator<<(__m256d x) {\n            printVector<double, __m256d>(x);\n            return *this;\n        }\n        DebugStream &operator<<(__m128i x) {\n            printVector<unsigned int, __m128i>(x);\n            return *this;\n        }\n        DebugStream &operator<<(__m256i x) {\n            printVector<unsigned int, __m256i>(x);\n            return *this;\n        }\n\n        ~DebugStream()\n        {\n            std::cerr << \"\\033[0m\" << std::endl;\n        }\n};\n#endif\n\n#ifdef Vc_DEBUG\n#undef Vc_DEBUG\n#endif\n#ifdef Vc_MSVC\n#define Vc_DEBUG Vc::AVX::DebugStream(__FUNCSIG__, __FILE__, __LINE__)\n#else\n#define Vc_DEBUG Vc::AVX::DebugStream(__PRETTY_FUNCTION__, __FILE__, __LINE__)\n#endif\n\n}  // namespace AVX\n}  // namespace Vc\n\n#endif // VC_AVX_DEBUG_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/deinterleave.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX2\n{\n\ninline void deinterleave(double_v &Vc_RESTRICT a, double_v &Vc_RESTRICT b, double_v &Vc_RESTRICT c)\n{   // estimated latency (AVX): 4.5 cycles\n    const m256d tmp0 = Mem::shuffle128<X0, Y1>(a.data(), b.data());\n    const m256d tmp1 = Mem::shuffle128<X1, Y0>(a.data(), c.data());\n    const m256d tmp2 = Mem::shuffle128<X0, Y1>(b.data(), c.data());\n    a.data() = Mem::shuffle<X0, Y1, X2, Y3>(tmp0, tmp1);\n    b.data() = Mem::shuffle<X1, Y0, X3, Y2>(tmp0, tmp2);\n    c.data() = Mem::shuffle<X0, Y1, X2, Y3>(tmp1, tmp2);\n}\n\ninline void deinterleave(float_v &Vc_RESTRICT a, float_v &Vc_RESTRICT b, float_v &Vc_RESTRICT c)\n{\n    //                               abc   abc abc\n    // a = [a0 b0 c0 a1 b1 c1 a2 b2] 332 = 211+121\n    // b = [c2 a3 b3 c3 a4 b4 c4 a5] 323 = 112+211\n    // c = [b5 c5 a6 b6 c6 a7 b7 c7] 233 = 121+112\n    const m256 ac0 = Mem::shuffle128<X0, Y0>(a.data(), c.data()); // a0 b0 c0 a1 b5 c5 a6 b6\n    const m256 ac1 = Mem::shuffle128<X1, Y1>(a.data(), c.data()); // b1 c1 a2 b2 c6 a7 b7 c7\n\n    m256 tmp0 = Mem::blend<X0, Y1, X2, X3, Y4, X5, X6, Y7>( ac0, b.data());\n           tmp0 = Mem::blend<X0, X1, Y2, X3, X4, Y5, X6, X7>(tmp0,      ac1); // a0 a3 a2 a1 a4 a7 a6 a5\n    m256 tmp1 = Mem::blend<X0, X1, Y2, X3, X4, Y5, X6, X7>( ac0, b.data());\n           tmp1 = Mem::blend<Y0, X1, X2, Y3, X4, X5, Y6, X7>(tmp1,      ac1); // b1 b0 b3 b2 b5 b4 b7 b6\n    m256 tmp2 = Mem::blend<Y0, X1, X2, Y3, X4, X5, Y6, X7>( ac0, b.data());\n           tmp2 = Mem::blend<X0, Y1, X2, X3, Y4, X5, X6, Y7>(tmp2,      ac1); // c2 c1 c0 c3 c6 c5 c4 c7\n\n    a.data() = Mem::permute<X0, X3, X2, X1>(tmp0);\n    b.data() = Mem::permute<X1, X0, X3, X2>(tmp1);\n    c.data() = Mem::permute<X2, X1, X0, X3>(tmp2);\n}\n\ninline void deinterleave(int_v &Vc_RESTRICT a, int_v &Vc_RESTRICT b, int_v &Vc_RESTRICT c)\n{\n    deinterleave(reinterpret_cast<float_v &>(a), reinterpret_cast<float_v &>(b),\n            reinterpret_cast<float_v &>(c));\n}\n\ninline void deinterleave(uint_v &Vc_RESTRICT a, uint_v &Vc_RESTRICT b, uint_v &Vc_RESTRICT c)\n{\n    deinterleave(reinterpret_cast<float_v &>(a), reinterpret_cast<float_v &>(b),\n            reinterpret_cast<float_v &>(c));\n}\n\ninline void deinterleave(Vector<short> &Vc_RESTRICT , Vector<short> &Vc_RESTRICT ,\n        Vector<short> &Vc_RESTRICT )\n{\n    return;\n    /* TODO:\n    //                               abc   abc abc\n    // a = [a0 b0 c0 a1 b1 c1 a2 b2] 332 = 211+121\n    // b = [c2 a3 b3 c3 a4 b4 c4 a5] 323 = 112+211\n    // c = [b5 c5 a6 b6 c6 a7 b7 c7] 233 = 121+112\n    m128i ac0 = _mm_unpacklo_epi64(a.data(), c.data()); // a0 b0 c0 a1 b5 c5 a6 b6\n    m128i ac1 = _mm_unpackhi_epi64(a.data(), c.data()); // b1 c1 a2 b2 c6 a7 b7 c7\n\n    m128i tmp0 = Mem::blend<X0, Y1, X2, X3, Y4, X5, X6, Y7>( ac0, b.data());\n            tmp0 = Mem::blend<X0, X1, Y2, X3, X4, Y5, X6, X7>(tmp0,      ac1); // a0 a3 a2 a1 a4 a7 a6 a5\n    m128i tmp1 = Mem::blend<X0, X1, Y2, X3, X4, Y5, X6, X7>( ac0, b.data());\n            tmp1 = Mem::blend<Y0, X1, X2, Y3, X4, X5, Y6, X7>(tmp1,      ac1); // b1 b0 b3 b2 b5 b4 b7 b6\n    m128i tmp2 = Mem::blend<Y0, X1, X2, Y3, X4, X5, Y6, X7>( ac0, b.data());\n            tmp2 = Mem::blend<X0, Y1, X2, X3, Y4, X5, X6, Y7>(tmp2,      ac1); // c2 c1 c0 c3 c6 c5 c4 c7\n\n    a.data() = Mem::permuteHi<X4, X7, X6, X5>(Mem::permuteLo<X0, X3, X2, X1>(tmp0));\n    b.data() = Mem::permuteHi<X5, X4, X7, X6>(Mem::permuteLo<X1, X0, X3, X2>(tmp1));\n    c.data() = Mem::permuteHi<X6, X5, X4, X7>(Mem::permuteLo<X2, X1, X0, X3>(tmp2));\n    */\n}\n\ninline void deinterleave(Vector<unsigned short> &Vc_RESTRICT a, Vector<unsigned short> &Vc_RESTRICT b,\n        Vector<unsigned short> &Vc_RESTRICT c)\n{\n    deinterleave(reinterpret_cast<Vector<short> &>(a), reinterpret_cast<Vector<short> &>(b),\n            reinterpret_cast<Vector<short> &>(c));\n}\n\ninline void deinterleave(Vector<float> &a, Vector<float> &b)\n{\n    // a7 a6 a5 a4 a3 a2 a1 a0\n    // b7 b6 b5 b4 b3 b2 b1 b0\n    const m256 tmp0 = Reg::permute128<Y0, X0>(a.data(), b.data()); // b3 b2 b1 b0 a3 a2 a1 a0\n    const m256 tmp1 = Reg::permute128<Y1, X1>(a.data(), b.data()); // b7 b6 b5 b4 a7 a6 a5 a4\n\n    const m256 tmp2 = _mm256_unpacklo_ps(tmp0, tmp1); // b5 b1 b4 b0 a5 a1 a4 a0\n    const m256 tmp3 = _mm256_unpackhi_ps(tmp0, tmp1); // b7 b3 b6 b2 a7 a3 a6 a2\n\n    a.data() = _mm256_unpacklo_ps(tmp2, tmp3); // b6 b4 b2 b0 a6 a4 a2 a0\n    b.data() = _mm256_unpackhi_ps(tmp2, tmp3); // b7 b5 b3 b1 a7 a5 a3 a1\n}\n\ninline void deinterleave(Vector<short> &a, // a0 b0 a1 b1 a2 b2 a3 b3 | a4 b4 a5 ...\n                         Vector<short> &b) // a8 b8 a9 ...\n{\n    auto v0 = Mem::shuffle128<X0, Y0>(a.data(), b.data());\n    auto v1 = Mem::shuffle128<X1, Y1>(a.data(), b.data());\n    auto v2 = AVX::unpacklo_epi16(v0, v1); // a0 a4 ...\n    auto v3 = AVX::unpackhi_epi16(v0, v1); // a2 a6 ...\n    v0 = AVX::unpacklo_epi16(v2, v3); // a0 a2 ...\n    v1 = AVX::unpackhi_epi16(v2, v3); // a1 a3 ...\n    a.data() = AVX::unpacklo_epi16(v0, v1); // a0 a1 ...\n    b.data() = AVX::unpackhi_epi16(v0, v1); // b0 b1 ...\n}\n\ninline void deinterleave(Vector<ushort> &a, Vector<ushort> &b)\n{\n    auto v0 = Mem::shuffle128<X0, Y0>(a.data(), b.data());\n    auto v1 = Mem::shuffle128<X1, Y1>(a.data(), b.data());\n    auto v2 = AVX::unpacklo_epi16(v0, v1); // a0 a4 ...\n    auto v3 = AVX::unpackhi_epi16(v0, v1); // a2 a6 ...\n    v0 = AVX::unpacklo_epi16(v2, v3); // a0 a2 ...\n    v1 = AVX::unpackhi_epi16(v2, v3); // a1 a3 ...\n    a.data() = AVX::unpacklo_epi16(v0, v1); // a0 a1 ...\n    b.data() = AVX::unpackhi_epi16(v0, v1); // b0 b1 ...\n}\n\n}  // namespace AVX2\nnamespace Detail\n{\ntemplate <typename Flags>\ninline void deinterleave(AVX2::float_v &a, AVX2::float_v &b, const float *m, Flags align)\n{\n    a.load(m, align);\n    b.load(m + AVX2::float_v::Size, align);\n    Vc::AVX2::deinterleave(a, b);\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::float_v &a, AVX2::float_v &b, const short *m, Flags f)\n{\n    using namespace Vc::AVX2;\n    const auto tmp = Detail::load32(m, f);\n    a.data() =\n        _mm256_cvtepi32_ps(concat(_mm_srai_epi32(_mm_slli_epi32(lo128(tmp), 16), 16),\n                                  _mm_srai_epi32(_mm_slli_epi32(hi128(tmp), 16), 16)));\n    b.data() = _mm256_cvtepi32_ps(\n        concat(_mm_srai_epi32(lo128(tmp), 16), _mm_srai_epi32(hi128(tmp), 16)));\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::float_v &a, AVX2::float_v &b, const unsigned short *m, Flags f)\n{\n    using namespace Vc::AVX2;\n    const auto tmp = Detail::load32(m, f);\n    a.data() = _mm256_cvtepi32_ps(\n        concat(_mm_blend_epi16(lo128(tmp), _mm_setzero_si128(), 0xaa),\n               _mm_blend_epi16(hi128(tmp), _mm_setzero_si128(), 0xaa)));\n    b.data() = _mm256_cvtepi32_ps(\n        concat(_mm_srli_epi32(lo128(tmp), 16), _mm_srli_epi32(hi128(tmp), 16)));\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::double_v &a, AVX2::double_v &b, const double *m, Flags align)\n{\n    using namespace Vc::AVX2;\n\n    a.load(m, align);\n    b.load(m + AVX2::double_v::Size, align);\n\n    m256d tmp0 = Mem::shuffle128<Vc::X0, Vc::Y0>(a.data(), b.data());  // b1 b0 a1 a0\n    m256d tmp1 = Mem::shuffle128<Vc::X1, Vc::Y1>(a.data(), b.data());  // b3 b2 a3 a2\n\n    a.data() = _mm256_unpacklo_pd(tmp0, tmp1);  // b2 b0 a2 a0\n    b.data() = _mm256_unpackhi_pd(tmp0, tmp1);  // b3 b1 a3 a1\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::int_v &a, AVX2::int_v &b, const int *m, Flags align)\n{\n    using namespace AVX;\n    a.load(m, align);\n    b.load(m + AVX2::int_v::Size, align);\n\n    const m256 tmp0 = avx_cast<m256>(Mem::shuffle128<Vc::X0, Vc::Y0>(a.data(), b.data()));\n    const m256 tmp1 = avx_cast<m256>(Mem::shuffle128<Vc::X1, Vc::Y1>(a.data(), b.data()));\n\n    const m256 tmp2 = _mm256_unpacklo_ps(tmp0, tmp1); // b5 b1 b4 b0 a5 a1 a4 a0\n    const m256 tmp3 = _mm256_unpackhi_ps(tmp0, tmp1); // b7 b3 b6 b2 a7 a3 a6 a2\n\n    a.data() = avx_cast<m256i>(_mm256_unpacklo_ps(tmp2, tmp3)); // b6 b4 b2 b0 a6 a4 a2 a0\n    b.data() = avx_cast<m256i>(_mm256_unpackhi_ps(tmp2, tmp3)); // b7 b5 b3 b1 a7 a5 a3 a1\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::int_v &a, AVX2::int_v &b, const short *m, Flags f)\n{\n    using namespace Vc::AVX;\n    const AVX2::short_v tmp0(m, f);\n    const m256i tmp = tmp0.data();\n    a.data() = concat(\n                _mm_srai_epi32(_mm_slli_epi32(lo128(tmp), 16), 16),\n                _mm_srai_epi32(_mm_slli_epi32(hi128(tmp), 16), 16));\n    b.data() = concat(\n                _mm_srai_epi32(lo128(tmp), 16),\n                _mm_srai_epi32(hi128(tmp), 16));\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::uint_v &a, AVX2::uint_v &b, const unsigned int *m, Flags align)\n{\n    using namespace AVX;\n    a.load(m, align);\n    b.load(m + AVX2::uint_v::Size, align);\n\n    const m256 tmp0 = avx_cast<m256>(Mem::shuffle128<Vc::X0, Vc::Y0>(a.data(), b.data()));\n    const m256 tmp1 = avx_cast<m256>(Mem::shuffle128<Vc::X1, Vc::Y1>(a.data(), b.data()));\n\n    const m256 tmp2 = _mm256_unpacklo_ps(tmp0, tmp1); // b5 b1 b4 b0 a5 a1 a4 a0\n    const m256 tmp3 = _mm256_unpackhi_ps(tmp0, tmp1); // b7 b3 b6 b2 a7 a3 a6 a2\n\n    a.data() = avx_cast<m256i>(_mm256_unpacklo_ps(tmp2, tmp3)); // b6 b4 b2 b0 a6 a4 a2 a0\n    b.data() = avx_cast<m256i>(_mm256_unpackhi_ps(tmp2, tmp3)); // b7 b5 b3 b1 a7 a5 a3 a1\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::uint_v &a, AVX2::uint_v &b, const unsigned short *m, Flags f)\n{\n    using namespace Vc::AVX;\n    const AVX2::ushort_v tmp0(m, f);\n    const m256i tmp = tmp0.data();\n    a.data() = concat(\n                _mm_srai_epi32(_mm_slli_epi32(lo128(tmp), 16), 16),\n                _mm_srai_epi32(_mm_slli_epi32(hi128(tmp), 16), 16));\n    b.data() = concat(\n                _mm_srai_epi32(lo128(tmp), 16),\n                _mm_srai_epi32(hi128(tmp), 16));\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::short_v &a, AVX2::short_v &b, const short *m, Flags align)\n{\n    a.load(m, align);\n    b.load(m + AVX2::short_v::Size, align);\n    Vc::AVX2::deinterleave(a, b);\n}\n\ntemplate <typename Flags>\ninline void deinterleave(AVX2::ushort_v &a, AVX2::ushort_v &b, const unsigned short *m, Flags align)\n{\n    a.load(m, align);\n    b.load(m + AVX2::ushort_v::Size, align);\n    Vc::AVX2::deinterleave(a, b);\n}\n\n// only support M == V::EntryType -> no specialization\ntemplate <typename T, typename M, typename Flags>\nVc_ALWAYS_INLINE void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,\n                                   AVX2::Vector<T> &Vc_RESTRICT b,\n                                   AVX2::Vector<T> &Vc_RESTRICT c,\n                                   const M *Vc_RESTRICT memory, Flags align)\n{\n    using V = AVX2::Vector<T>;\n    a.load(&memory[0 * V::Size], align);\n    b.load(&memory[1 * V::Size], align);\n    c.load(&memory[2 * V::Size], align);\n    Vc::AVX2::deinterleave(a, b, c);\n}\n\n}  // namespace Detail\n}  // namespace Vc\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/detail.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_DETAIL_H_\n#define VC_AVX_DETAIL_H_\n\n#include \"../sse/detail.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n// (converting) load functions {{{1\ntemplate <typename Flags>\nVc_INTRINSIC Vc_PURE __m256 load(const float *x, Flags, LoadTag<__m256, float>,\n                                 typename Flags::EnableIfAligned = nullptr)\n{\n    return _mm256_load_ps(x);\n}\ntemplate <typename Flags>\nVc_INTRINSIC Vc_PURE __m256 load(const float *x, Flags, LoadTag<__m256, float>,\n                                 typename Flags::EnableIfUnaligned = nullptr)\n{\n    return _mm256_loadu_ps(x);\n}\ntemplate <typename Flags>\nVc_INTRINSIC Vc_PURE __m256 load(const float *x, Flags, LoadTag<__m256, float>,\n                                 typename Flags::EnableIfStreaming = nullptr)\n{\n    return AvxIntrinsics::stream_load<__m256>(x);\n}\n\ntemplate <typename Flags>\nVc_INTRINSIC Vc_PURE __m256d load(const double *x, Flags, LoadTag<__m256d, double>,\n                                  typename Flags::EnableIfAligned = nullptr)\n{\n    return _mm256_load_pd(x);\n}\ntemplate <typename Flags>\nVc_INTRINSIC Vc_PURE __m256d load(const double *x, Flags, LoadTag<__m256d, double>,\n                                  typename Flags::EnableIfUnaligned = nullptr)\n{\n    return _mm256_loadu_pd(x);\n}\ntemplate <typename Flags>\nVc_INTRINSIC Vc_PURE __m256d load(const double *x, Flags, LoadTag<__m256d, double>,\n                                  typename Flags::EnableIfStreaming = nullptr)\n{\n    return AvxIntrinsics::stream_load<__m256d>(x);\n}\n\ntemplate <typename Flags, typename T, typename = enable_if<std::is_integral<T>::value>>\nVc_INTRINSIC Vc_PURE __m256i\nload(const T *x, Flags, LoadTag<__m256i, T>, typename Flags::EnableIfAligned = nullptr)\n{\n    return _mm256_load_si256(reinterpret_cast<const __m256i *>(x));\n}\ntemplate <typename Flags, typename T, typename = enable_if<std::is_integral<T>::value>>\nVc_INTRINSIC Vc_PURE __m256i\nload(const T *x, Flags, LoadTag<__m256i, T>, typename Flags::EnableIfUnaligned = nullptr)\n{\n    return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(x));\n}\ntemplate <typename Flags, typename T, typename = enable_if<std::is_integral<T>::value>>\nVc_INTRINSIC Vc_PURE __m256i\nload(const T *x, Flags, LoadTag<__m256i, T>, typename Flags::EnableIfStreaming = nullptr)\n{\n    return AvxIntrinsics::stream_load<__m256i>(x);\n}\n\n// load32{{{2\nVc_INTRINSIC __m256 load32(const float *mem, when_aligned)\n{\n    return _mm256_load_ps(mem);\n}\nVc_INTRINSIC __m256 load32(const float *mem, when_unaligned)\n{\n    return _mm256_loadu_ps(mem);\n}\nVc_INTRINSIC __m256 load32(const float *mem, when_streaming)\n{\n    return AvxIntrinsics::stream_load<__m256>(mem);\n}\nVc_INTRINSIC __m256d load32(const double *mem, when_aligned)\n{\n    return _mm256_load_pd(mem);\n}\nVc_INTRINSIC __m256d load32(const double *mem, when_unaligned)\n{\n    return _mm256_loadu_pd(mem);\n}\nVc_INTRINSIC __m256d load32(const double *mem, when_streaming)\n{\n    return AvxIntrinsics::stream_load<__m256d>(mem);\n}\ntemplate <class T> Vc_INTRINSIC __m256i load32(const T *mem, when_aligned)\n{\n    static_assert(std::is_integral<T>::value, \"load32<T> is only intended for integral T\");\n    return _mm256_load_si256(reinterpret_cast<const __m256i *>(mem));\n}\ntemplate <class T> Vc_INTRINSIC __m256i load32(const T *mem, when_unaligned)\n{\n    static_assert(std::is_integral<T>::value, \"load32<T> is only intended for integral T\");\n    return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(mem));\n}\ntemplate <class T> Vc_INTRINSIC __m256i load32(const T *mem, when_streaming)\n{\n    static_assert(std::is_integral<T>::value, \"load32<T> is only intended for integral T\");\n    return AvxIntrinsics::stream_load<__m256i>(mem);\n}\n\n// MSVC workarounds{{{2\n#ifdef Vc_MSVC\n// work around: \"fatal error C1001: An internal error has occurred in the compiler.\"\nVc_INTRINSIC __m256i load(const uint *mem, when_aligned, LoadTag<__m256i, int>)\n{\n    return _mm256_load_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\nVc_INTRINSIC __m256d load(const double *mem, when_unaligned, LoadTag<__m256d, double>)\n{\n    return _mm256_loadu_pd(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256 load(const float *mem, when_aligned,\n                         enable_if<(std::is_same<DstT, float>::value &&\n                                    std::is_same<V, __m256>::value)> = nullarg)\n{\n    return _mm256_load_ps(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256 load(const float *mem, when_unaligned,\n                         enable_if<(std::is_same<DstT, float>::value &&\n                                    std::is_same<V, __m256>::value)> = nullarg)\n{\n    return _mm256_loadu_ps(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256 load(const float *mem, when_streaming,\n                         enable_if<(std::is_same<DstT, float>::value &&\n                                    std::is_same<V, __m256>::value)> = nullarg)\n{\n    return AvxIntrinsics::stream_load<__m256>(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256d load(const double *mem, when_aligned,\n                          enable_if<(std::is_same<DstT, double>::value &&\n                                     std::is_same<V, __m256d>::value)> = nullarg)\n{\n    return _mm256_load_pd(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256d load(const double *mem, when_unaligned,\n                          enable_if<(std::is_same<DstT, double>::value &&\n                                     std::is_same<V, __m256d>::value)> = nullarg)\n{\n    return _mm256_loadu_pd(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256d load(const double *mem, when_streaming,\n                          enable_if<(std::is_same<DstT, double>::value &&\n                                     std::is_same<V, __m256d>::value)> = nullarg)\n{\n    return AvxIntrinsics::stream_load<__m256d>(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const uint *mem, when_aligned,\n                          enable_if<(std::is_same<DstT, uint>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_load_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const uint *mem, when_unaligned,\n                          enable_if<(std::is_same<DstT, uint>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const uint *mem, when_streaming,\n                          enable_if<(std::is_same<DstT, uint>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return AvxIntrinsics::stream_load<__m256i>(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const int *mem, when_unaligned,\n                          enable_if<(std::is_same<DstT, int>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const int *mem, when_aligned,\n                          enable_if<(std::is_same<DstT, int>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_load_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const int *mem, when_streaming,\n                          enable_if<(std::is_same<DstT, int>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return AvxIntrinsics::stream_load<__m256i>(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const short *mem, when_unaligned,\n                          enable_if<(std::is_same<DstT, short>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const short *mem, when_aligned,\n                          enable_if<(std::is_same<DstT, short>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_load_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const short *mem, when_streaming,\n                          enable_if<(std::is_same<DstT, short>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return AvxIntrinsics::stream_load<__m256i>(mem);\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const ushort *mem, when_unaligned,\n                          enable_if<(std::is_same<DstT, ushort>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_loadu_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const ushort *mem, when_aligned,\n                          enable_if<(std::is_same<DstT, ushort>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return _mm256_load_si256(reinterpret_cast<const __m256i *>(mem));\n}\n\ntemplate <typename V, typename DstT>\nVc_INTRINSIC __m256i load(const ushort *mem, when_streaming,\n                          enable_if<(std::is_same<DstT, ushort>::value &&\n                                     std::is_same<V, __m256i>::value)> = nullarg)\n{\n    return AvxIntrinsics::stream_load<__m256i>(mem);\n}\n\n#endif  // Vc_MSVC\n\n// short {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const ushort *mem, Flags f, LoadTag<__m256i, short>)\n{\n    return load32(mem, f);\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const uchar *mem, Flags f, LoadTag<__m256i, short>)\n{\n    return AVX::cvtepu8_epi16(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const schar *mem, Flags f, LoadTag<__m256i, short>)\n{\n    return AVX::cvtepi8_epi16(load16(mem, f));\n}\n\n// ushort {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const uchar *mem, Flags f, LoadTag<__m256i, ushort>)\n{\n    return AVX::cvtepu8_epi16(load16(mem, f));\n}\n\n// int {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const uint *mem, Flags f, LoadTag<__m256i, int>)\n{\n    return load32(mem, f);\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const ushort *mem, Flags f, LoadTag<__m256i, int>)\n{\n    return AVX::cvtepu16_epi32(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const short *mem, Flags f, LoadTag<__m256i, int>)\n{\n    return AVX::cvtepi16_epi32(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const uchar *mem, Flags, LoadTag<__m256i, int>)\n{\n    return AVX::cvtepu8_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const schar *mem, Flags, LoadTag<__m256i, int>)\n{\n    return AVX::cvtepi8_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\n\n// uint {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const ushort *mem, Flags f, LoadTag<__m256i, uint>)\n{\n    return AVX::cvtepu16_epi32(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256i load(const uchar *mem, Flags, LoadTag<__m256i, uint>)\n{\n    return AVX::cvtepu8_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\n\n// double {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m256d load(const float *mem, Flags f, LoadTag<__m256d, double>)\n{\n    return AVX::convert<float, double>(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256d load(const uint *mem, Flags f, LoadTag<__m256d, double>)\n{\n    return AVX::convert<uint, double>(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256d load(const int *mem, Flags f, LoadTag<__m256d, double>)\n{\n    return AVX::convert<int, double>(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256d load(const ushort *mem, Flags f, LoadTag<__m256d, double>)\n{\n    return AVX::convert<int, double>(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256d load(const short *mem, Flags f, LoadTag<__m256d, double>)\n{\n    return AVX::convert<int, double>(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256d load(const uchar *mem, Flags f, LoadTag<__m256d, double>)\n{\n    return AVX::convert<int, double>(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256d load(const schar *mem, Flags f, LoadTag<__m256d, double>)\n{\n    return AVX::convert<int, double>(load16(mem, f));\n}\n\n// float {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m256 load(const double *mem, Flags f, LoadTag<__m256, float>)\n{\n    return AVX::concat(_mm256_cvtpd_ps(load32(&mem[0], f)),\n                       _mm256_cvtpd_ps(load32(&mem[4], f)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256 load(const uint *mem, Flags f, LoadTag<__m256, float>)\n{\n    const auto v = load32(mem, f);\n    return _mm256_blendv_ps(\n        _mm256_cvtepi32_ps(v),\n        _mm256_add_ps(_mm256_cvtepi32_ps(AVX::sub_epi32(v, AVX::set2power31_epu32())),\n                      AVX::set2power31_ps()),\n        _mm256_castsi256_ps(AVX::cmplt_epi32(v, _mm256_setzero_si256())));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256 load(const int *mem, Flags f, LoadTag<__m256, float>)\n{\n    return AVX::convert<int, float>(load32(mem, f));\n}\ntemplate <typename T, typename Flags,\n          typename = enable_if<!std::is_same<T, float>::value>>\nVc_INTRINSIC __m256 load(const T *mem, Flags f, LoadTag<__m256, float>)\n{\n    return _mm256_cvtepi32_ps(load<__m256i, int>(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256 load(const ushort *mem, Flags f, LoadTag<__m256, float>)\n{\n    return AVX::convert<ushort, float>(load16(mem, f));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m256 load(const short *mem, Flags f, LoadTag<__m256, float>)\n{\n    return AVX::convert<short, float>(load16(mem, f));\n}\n/*\ntemplate<typename Flags> struct LoadHelper<float, unsigned char, Flags> {\n    static __m256 load(const unsigned char *mem, Flags)\n    {\n        return _mm256_cvtepi32_ps(\n            cvtepu8_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem))));\n    }\n};\ntemplate<typename Flags> struct LoadHelper<float, signed char, Flags> {\n    static __m256 load(const signed char *mem, Flags)\n    {\n        return _mm256_cvtepi32_ps(\n            cvtepi8_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem))));\n    }\n};\n*/\n\n// shifted{{{1\ntemplate <int amount, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(sizeof(T) == 32 && amount >= 16), T> shifted(T k)\n{\n    return AVX::avx_cast<T>(AVX::zeroExtend(\n        _mm_srli_si128(AVX::hi128(AVX::avx_cast<__m256i>(k)), amount - 16)));\n}\ntemplate <int amount, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(sizeof(T) == 32 && amount > 0 && amount < 16), T>\nshifted(T k)\n{\n    return AVX::avx_cast<T>(\n        AVX::alignr<amount>(Mem::permute128<X1, Const0>(AVX::avx_cast<__m256i>(k)),\n                            AVX::avx_cast<__m256i>(k)));\n}\ntemplate <int amount, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(sizeof(T) == 32 && amount <= -16), T> shifted(T k)\n{\n    return AVX::avx_cast<T>(Mem::permute128<Const0, X0>(AVX::avx_cast<__m256i>(\n        _mm_slli_si128(AVX::lo128(AVX::avx_cast<__m256i>(k)), -16 - amount))));\n}\ntemplate <int amount, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(sizeof(T) == 32 && amount > -16 && amount < 0), T>\nshifted(T k)\n{\n    return AVX::avx_cast<T>(\n        AVX::alignr<16 + amount>(AVX::avx_cast<__m256i>(k),\n                                 Mem::permute128<Const0, X0>(AVX::avx_cast<__m256i>(k))));\n}\n// mask_cast{{{1\ntemplate<size_t From, size_t To, typename R> Vc_INTRINSIC Vc_CONST R mask_cast(__m256i k)\n{\n    static_assert(From == To, \"Incorrect mask cast.\");\n    static_assert(std::is_same<R, __m256>::value, \"Incorrect mask cast.\");\n    return AVX::avx_cast<__m256>(k);\n}\n\n// 4 -> 4\ntemplate <> Vc_INTRINSIC Vc_CONST __m128 mask_cast<4, 4, __m128>(__m256i k)\n{\n    return AVX::avx_cast<__m128>(_mm_packs_epi32(AVX::lo128(k), AVX::hi128(k)));\n}\n\ntemplate <> Vc_INTRINSIC Vc_CONST __m256 mask_cast<4, 4, __m256>(__m128i k)\n{\n    const auto kk = _mm_castsi128_ps(k);\n    return AVX::concat(_mm_unpacklo_ps(kk, kk), _mm_unpackhi_ps(kk, kk));\n}\n\n// 4 -> 8\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<4, 8, __m256>(__m256i k)\n{\n    // aabb ccdd -> abcd 0000\n    return AVX::avx_cast<__m256>(AVX::concat(_mm_packs_epi32(AVX::lo128(k), AVX::hi128(k)),\n                                 _mm_setzero_si128()));\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<4, 8, __m128>(__m256i k)\n{\n    // aaaa bbbb cccc dddd -> abcd 0000\n    return AVX::avx_cast<__m128>(_mm_packs_epi16(_mm_packs_epi32(AVX::lo128(k), AVX::hi128(k)), _mm_setzero_si128()));\n}\n\ntemplate <> Vc_INTRINSIC Vc_CONST __m256 mask_cast<4, 8, __m256>(__m128i k)\n{\n    return AVX::zeroExtend(AVX::avx_cast<__m128>(k));\n}\n\n// 4 -> 16\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<4, 16, __m256>(__m256i k)\n{\n    // aaaa bbbb cccc dddd -> abcd 0000 0000 0000\n    return AVX::zeroExtend(mask_cast<4, 8, __m128>(k));\n}\n\n// 8 -> 4\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<8, 4, __m256>(__m256i k)\n{\n    // aabb ccdd eeff gghh -> aaaa bbbb cccc dddd\n    const auto lo = AVX::lo128(AVX::avx_cast<__m256>(k));\n    return AVX::concat(_mm_unpacklo_ps(lo, lo),\n                  _mm_unpackhi_ps(lo, lo));\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<8, 4, __m128>(__m256i k)\n{\n    return AVX::avx_cast<__m128>(AVX::lo128(k));\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<8, 4, __m256>(__m128i k)\n{\n    // abcd efgh -> aaaa bbbb cccc dddd\n    const auto tmp = _mm_unpacklo_epi16(k, k); // aa bb cc dd\n    return AVX::avx_cast<__m256>(AVX::concat(_mm_unpacklo_epi32(tmp, tmp), // aaaa bbbb\n                                 _mm_unpackhi_epi32(tmp, tmp))); // cccc dddd\n}\n\n// 8 -> 8\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<8, 8, __m128>(__m256i k)\n{\n    // aabb ccdd eeff gghh -> abcd efgh\n    return AVX::avx_cast<__m128>(_mm_packs_epi16(AVX::lo128(k), AVX::hi128(k)));\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<8, 8, __m256>(__m128i k)\n{\n    return AVX::avx_cast<__m256>(AVX::concat(_mm_unpacklo_epi16(k, k),\n                                 _mm_unpackhi_epi16(k, k)));\n}\n\n// 8 -> 16\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<8, 16, __m256>(__m256i k)\n{\n    // aabb ccdd eeff gghh -> abcd efgh 0000 0000\n    return AVX::zeroExtend(mask_cast<8, 8, __m128>(k));\n}\n\n// 16 -> 8\n#ifdef Vc_IMPL_AVX2\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<16, 8, __m256>(__m256i k)\n{\n    // abcd efgh ijkl mnop -> aabb ccdd eeff gghh\n    const auto flipped = Mem::permute4x64<X0, X2, X1, X3>(k);\n    return _mm256_castsi256_ps(AVX::unpacklo_epi16(flipped, flipped));\n}\n#endif\n\n// 16 -> 4\ntemplate<> Vc_INTRINSIC Vc_CONST __m256 mask_cast<16, 4, __m256>(__m256i k)\n{\n    // abcd efgh ijkl mnop -> aaaa bbbb cccc dddd\n    const auto tmp = _mm_unpacklo_epi16(AVX::lo128(k), AVX::lo128(k)); // aabb ccdd\n    return _mm256_castsi256_ps(AVX::concat(_mm_unpacklo_epi32(tmp, tmp), _mm_unpackhi_epi32(tmp, tmp)));\n}\n\n// allone{{{1\ntemplate<> Vc_INTRINSIC Vc_CONST __m256  allone<__m256 >() { return AVX::setallone_ps(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m256i allone<__m256i>() { return AVX::setallone_si256(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m256d allone<__m256d>() { return AVX::setallone_pd(); }\n\n// zero{{{1\ntemplate<> Vc_INTRINSIC Vc_CONST __m256  zero<__m256 >() { return _mm256_setzero_ps(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m256i zero<__m256i>() { return _mm256_setzero_si256(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m256d zero<__m256d>() { return _mm256_setzero_pd(); }\n\n// one{{{1\nVc_INTRINSIC Vc_CONST __m256  one( float) { return AVX::setone_ps   (); }\nVc_INTRINSIC Vc_CONST __m256d one(double) { return AVX::setone_pd   (); }\nVc_INTRINSIC Vc_CONST __m256i one(   int) { return AVX::setone_epi32(); }\nVc_INTRINSIC Vc_CONST __m256i one(  uint) { return AVX::setone_epu32(); }\nVc_INTRINSIC Vc_CONST __m256i one( short) { return AVX::setone_epi16(); }\nVc_INTRINSIC Vc_CONST __m256i one(ushort) { return AVX::setone_epu16(); }\nVc_INTRINSIC Vc_CONST __m256i one( schar) { return AVX::setone_epi8 (); }\nVc_INTRINSIC Vc_CONST __m256i one( uchar) { return AVX::setone_epu8 (); }\n\n// negate{{{1\nVc_ALWAYS_INLINE Vc_CONST __m256 negate(__m256 v, std::integral_constant<std::size_t, 4>)\n{\n    return _mm256_xor_ps(v, AVX::setsignmask_ps());\n}\nVc_ALWAYS_INLINE Vc_CONST __m256d negate(__m256d v, std::integral_constant<std::size_t, 8>)\n{\n    return _mm256_xor_pd(v, AVX::setsignmask_pd());\n}\nVc_ALWAYS_INLINE Vc_CONST __m256i negate(__m256i v, std::integral_constant<std::size_t, 4>)\n{\n    return AVX::sign_epi32(v, Detail::allone<__m256i>());\n}\nVc_ALWAYS_INLINE Vc_CONST __m256i negate(__m256i v, std::integral_constant<std::size_t, 2>)\n{\n    return AVX::sign_epi16(v, Detail::allone<__m256i>());\n}\n\n// xor_{{{1\nVc_INTRINSIC __m256 xor_(__m256 a, __m256 b) { return _mm256_xor_ps(a, b); }\nVc_INTRINSIC __m256d xor_(__m256d a, __m256d b) { return _mm256_xor_pd(a, b); }\nVc_INTRINSIC __m256i xor_(__m256i a, __m256i b)\n{\n#ifdef Vc_IMPL_AVX2\n    return _mm256_xor_si256(a, b);\n#else\n    return _mm256_castps_si256(\n        _mm256_xor_ps(_mm256_castsi256_ps(a), _mm256_castsi256_ps(b)));\n#endif\n}\n\n// or_{{{1\nVc_INTRINSIC __m256 or_(__m256 a, __m256 b) { return _mm256_or_ps(a, b); }\nVc_INTRINSIC __m256d or_(__m256d a, __m256d b) { return _mm256_or_pd(a, b); }\nVc_INTRINSIC __m256i or_(__m256i a, __m256i b)\n{\n#ifdef Vc_IMPL_AVX2\n    return _mm256_or_si256(a, b);\n#else\n    return _mm256_castps_si256(\n        _mm256_or_ps(_mm256_castsi256_ps(a), _mm256_castsi256_ps(b)));\n#endif\n}\n\n// and_{{{1\nVc_INTRINSIC __m256 and_(__m256 a, __m256 b) { return _mm256_and_ps(a, b); }\nVc_INTRINSIC __m256d and_(__m256d a, __m256d b) { return _mm256_and_pd(a, b); }\nVc_INTRINSIC __m256i and_(__m256i a, __m256i b) {\n#ifdef Vc_IMPL_AVX2\n    return _mm256_and_si256(a, b);\n#else\n    return _mm256_castps_si256(\n        _mm256_and_ps(_mm256_castsi256_ps(a), _mm256_castsi256_ps(b)));\n#endif\n}\n\n// andnot_{{{1\nVc_INTRINSIC __m256 andnot_(__m256 a, __m256 b) { return _mm256_andnot_ps(a, b); }\nVc_INTRINSIC __m256d andnot_(__m256d a, __m256d b) { return _mm256_andnot_pd(a, b); }\nVc_INTRINSIC __m256i andnot_(__m256i a, __m256i b)\n{\n#ifdef Vc_IMPL_AVX2\n    return _mm256_andnot_si256(a, b);\n#else\n    return _mm256_castps_si256(\n        _mm256_andnot_ps(_mm256_castsi256_ps(a), _mm256_castsi256_ps(b)));\n#endif\n}\n\n// not_{{{1\nVc_INTRINSIC __m256  not_(__m256  a) { return andnot_(a, allone<__m256 >()); }\nVc_INTRINSIC __m256d not_(__m256d a) { return andnot_(a, allone<__m256d>()); }\nVc_INTRINSIC __m256i not_(__m256i a) { return andnot_(a, allone<__m256i>()); }\n\n// blend{{{1\nVc_INTRINSIC __m256  blend(__m256  a, __m256  b, __m256  c) { return _mm256_blendv_ps(a, b, c); }\nVc_INTRINSIC __m256d blend(__m256d a, __m256d b, __m256d c) { return _mm256_blendv_pd(a, b, c); }\nVc_INTRINSIC __m256i blend(__m256i a, __m256i b, __m256i c) { return AVX::blendv_epi8(a, b, c); }\n\n// abs{{{1\nVc_INTRINSIC __m256  abs(__m256  a,  float) { return and_(a, AVX::setabsmask_ps()); }\nVc_INTRINSIC __m256d abs(__m256d a, double) { return and_(a, AVX::setabsmask_pd()); }\nVc_INTRINSIC __m256i abs(__m256i a,    int) { return AVX::abs_epi32(a); }\nVc_INTRINSIC __m256i abs(__m256i a,   uint) { return a; }\nVc_INTRINSIC __m256i abs(__m256i a,  short) { return AVX::abs_epi16(a); }\nVc_INTRINSIC __m256i abs(__m256i a, ushort) { return a; }\nVc_INTRINSIC __m256i abs(__m256i a,  schar) { return AVX::abs_epi8 (a); }\nVc_INTRINSIC __m256i abs(__m256i a,  uchar) { return a; }\n\n// add{{{1\nVc_INTRINSIC __m256  add(__m256  a, __m256  b,  float) { return _mm256_add_ps(a, b); }\nVc_INTRINSIC __m256d add(__m256d a, __m256d b, double) { return _mm256_add_pd(a, b); }\nVc_INTRINSIC __m256i add(__m256i a, __m256i b,    int) { return AVX::add_epi32(a, b); }\nVc_INTRINSIC __m256i add(__m256i a, __m256i b,   uint) { return AVX::add_epi32(a, b); }\nVc_INTRINSIC __m256i add(__m256i a, __m256i b,  short) { return AVX::add_epi16(a, b); }\nVc_INTRINSIC __m256i add(__m256i a, __m256i b, ushort) { return AVX::add_epi16(a, b); }\n\n// sub{{{1\nVc_INTRINSIC __m256  sub(__m256  a, __m256  b,  float) { return _mm256_sub_ps(a, b); }\nVc_INTRINSIC __m256d sub(__m256d a, __m256d b, double) { return _mm256_sub_pd(a, b); }\nVc_INTRINSIC __m256i sub(__m256i a, __m256i b,    int) { return AVX::sub_epi32(a, b); }\nVc_INTRINSIC __m256i sub(__m256i a, __m256i b,   uint) { return AVX::sub_epi32(a, b); }\nVc_INTRINSIC __m256i sub(__m256i a, __m256i b,  short) { return AVX::sub_epi16(a, b); }\nVc_INTRINSIC __m256i sub(__m256i a, __m256i b, ushort) { return AVX::sub_epi16(a, b); }\n\n// mul{{{1\nVc_INTRINSIC __m256  mul(__m256  a, __m256  b,  float) { return _mm256_mul_ps(a, b); }\nVc_INTRINSIC __m256d mul(__m256d a, __m256d b, double) { return _mm256_mul_pd(a, b); }\nVc_INTRINSIC __m256i mul(__m256i a, __m256i b,    int) { return AVX::mullo_epi32(a, b); }\nVc_INTRINSIC __m256i mul(__m256i a, __m256i b,   uint) { return AVX::mullo_epi32(a, b); }\nVc_INTRINSIC __m256i mul(__m256i a, __m256i b,  short) { return AVX::mullo_epi16(a, b); }\nVc_INTRINSIC __m256i mul(__m256i a, __m256i b, ushort) { return AVX::mullo_epi16(a, b); }\n\n// mul{{{1\nVc_INTRINSIC __m256  div(__m256  a, __m256  b,  float) { return _mm256_div_ps(a, b); }\nVc_INTRINSIC __m256d div(__m256d a, __m256d b, double) { return _mm256_div_pd(a, b); }\nVc_INTRINSIC __m256i div(__m256i a, __m256i b,    int) {\n    using namespace AVX;\n    const __m256d lo1 = _mm256_cvtepi32_pd(lo128(a));\n    const __m256d lo2 = _mm256_cvtepi32_pd(lo128(b));\n    const __m256d hi1 = _mm256_cvtepi32_pd(hi128(a));\n    const __m256d hi2 = _mm256_cvtepi32_pd(hi128(b));\n    return concat(_mm256_cvttpd_epi32(_mm256_div_pd(lo1, lo2)),\n                  _mm256_cvttpd_epi32(_mm256_div_pd(hi1, hi2)));\n}\nVc_INTRINSIC __m256i div(__m256i a, __m256i b,   uint) {\n    // SSE/AVX only has signed int conversion to doubles. Therefore we first adjust the input before\n    // conversion and take the adjustment back after the conversion.\n    // It could be argued that for b this is not really important because division by a b >= 2^31 is\n    // useless. But for full correctness it cannot be ignored.\n    using namespace AVX;\n    const __m256i aa = add_epi32(a, set1_epi32(-2147483648));\n    const __m256i bb = add_epi32(b, set1_epi32(-2147483648));\n    const __m256d loa = _mm256_add_pd(_mm256_cvtepi32_pd(lo128(aa)), set1_pd(2147483648.));\n    const __m256d hia = _mm256_add_pd(_mm256_cvtepi32_pd(hi128(aa)), set1_pd(2147483648.));\n    const __m256d lob = _mm256_add_pd(_mm256_cvtepi32_pd(lo128(bb)), set1_pd(2147483648.));\n    const __m256d hib = _mm256_add_pd(_mm256_cvtepi32_pd(hi128(bb)), set1_pd(2147483648.));\n    // there is one remaining problem: a >= 2^31 and b == 1\n    // in that case the return value would be 2^31\n    return avx_cast<__m256i>(_mm256_blendv_ps(\n        avx_cast<__m256>(concat(_mm256_cvttpd_epi32(_mm256_div_pd(loa, lob)),\n                                          _mm256_cvttpd_epi32(_mm256_div_pd(hia, hib)))),\n        avx_cast<__m256>(a),\n        avx_cast<__m256>(cmpeq_epi32(b, setone_epi32()))));\n}\nVc_INTRINSIC __m256i div(__m256i a, __m256i b,  short) {\n    using namespace AVX;\n    const __m256 lo =\n        _mm256_div_ps(convert<short, float>(lo128(a)), convert<short, float>(lo128(b)));\n    const __m256 hi =\n        _mm256_div_ps(convert<short, float>(hi128(a)), convert<short, float>(hi128(b)));\n    return concat(convert<float, short>(lo), convert<float, short>(hi));\n}\n\n// horizontal add{{{1\ntemplate <typename T> Vc_INTRINSIC T add(Common::IntrinsicType<T, 32 / sizeof(T)> a, T)\n{\n    return {add(add(AVX::lo128(a), AVX::hi128(a), T()), T())};\n}\n\n// horizontal mul{{{1\ntemplate <typename T> Vc_INTRINSIC T mul(Common::IntrinsicType<T, 32 / sizeof(T)> a, T)\n{\n    return {mul(mul(AVX::lo128(a), AVX::hi128(a), T()), T())};\n}\n\n// horizontal min{{{1\ntemplate <typename T> Vc_INTRINSIC T min(Common::IntrinsicType<T, 32 / sizeof(T)> a, T)\n{\n    return {min(min(AVX::lo128(a), AVX::hi128(a), T()), T())};\n}\n\n// horizontal max{{{1\ntemplate <typename T> Vc_INTRINSIC T max(Common::IntrinsicType<T, 32 / sizeof(T)> a, T)\n{\n    return {max(max(AVX::lo128(a), AVX::hi128(a), T()), T())};\n}\n// cmpeq{{{1\nVc_INTRINSIC __m256  cmpeq(__m256  a, __m256  b,  float) { return AvxIntrinsics::cmpeq_ps(a, b); }\nVc_INTRINSIC __m256d cmpeq(__m256d a, __m256d b, double) { return AvxIntrinsics::cmpeq_pd(a, b); }\nVc_INTRINSIC __m256i cmpeq(__m256i a, __m256i b,    int) { return AvxIntrinsics::cmpeq_epi32(a, b); }\nVc_INTRINSIC __m256i cmpeq(__m256i a, __m256i b,   uint) { return AvxIntrinsics::cmpeq_epi32(a, b); }\nVc_INTRINSIC __m256i cmpeq(__m256i a, __m256i b,  short) { return AvxIntrinsics::cmpeq_epi16(a, b); }\nVc_INTRINSIC __m256i cmpeq(__m256i a, __m256i b, ushort) { return AvxIntrinsics::cmpeq_epi16(a, b); }\n\n// cmpneq{{{1\nVc_INTRINSIC __m256  cmpneq(__m256  a, __m256  b,  float) { return AvxIntrinsics::cmpneq_ps(a, b); }\nVc_INTRINSIC __m256d cmpneq(__m256d a, __m256d b, double) { return AvxIntrinsics::cmpneq_pd(a, b); }\nVc_INTRINSIC __m256i cmpneq(__m256i a, __m256i b,    int) { return not_(AvxIntrinsics::cmpeq_epi32(a, b)); }\nVc_INTRINSIC __m256i cmpneq(__m256i a, __m256i b,   uint) { return not_(AvxIntrinsics::cmpeq_epi32(a, b)); }\nVc_INTRINSIC __m256i cmpneq(__m256i a, __m256i b,  short) { return not_(AvxIntrinsics::cmpeq_epi16(a, b)); }\nVc_INTRINSIC __m256i cmpneq(__m256i a, __m256i b, ushort) { return not_(AvxIntrinsics::cmpeq_epi16(a, b)); }\nVc_INTRINSIC __m256i cmpneq(__m256i a, __m256i b,  schar) { return not_(AvxIntrinsics::cmpeq_epi8 (a, b)); }\nVc_INTRINSIC __m256i cmpneq(__m256i a, __m256i b,  uchar) { return not_(AvxIntrinsics::cmpeq_epi8 (a, b)); }\n\n// cmpgt{{{1\nVc_INTRINSIC __m256  cmpgt(__m256  a, __m256  b,  float) { return AVX::cmpgt_ps(a, b); }\nVc_INTRINSIC __m256d cmpgt(__m256d a, __m256d b, double) { return AVX::cmpgt_pd(a, b); }\nVc_INTRINSIC __m256i cmpgt(__m256i a, __m256i b,    int) { return AVX::cmpgt_epi32(a, b); }\nVc_INTRINSIC __m256i cmpgt(__m256i a, __m256i b,   uint) { return AVX::cmpgt_epu32(a, b); }\nVc_INTRINSIC __m256i cmpgt(__m256i a, __m256i b,  short) { return AVX::cmpgt_epi16(a, b); }\nVc_INTRINSIC __m256i cmpgt(__m256i a, __m256i b, ushort) { return AVX::cmpgt_epu16(a, b); }\nVc_INTRINSIC __m256i cmpgt(__m256i a, __m256i b,  schar) { return AVX::cmpgt_epi8 (a, b); }\nVc_INTRINSIC __m256i cmpgt(__m256i a, __m256i b,  uchar) { return AVX::cmpgt_epu8 (a, b); }\n\n// cmpge{{{1\nVc_INTRINSIC __m256  cmpge(__m256  a, __m256  b,  float) { return AVX::cmpge_ps(a, b); }\nVc_INTRINSIC __m256d cmpge(__m256d a, __m256d b, double) { return AVX::cmpge_pd(a, b); }\nVc_INTRINSIC __m256i cmpge(__m256i a, __m256i b,    int) { return not_(AVX::cmpgt_epi32(b, a)); }\nVc_INTRINSIC __m256i cmpge(__m256i a, __m256i b,   uint) { return not_(AVX::cmpgt_epu32(b, a)); }\nVc_INTRINSIC __m256i cmpge(__m256i a, __m256i b,  short) { return not_(AVX::cmpgt_epi16(b, a)); }\nVc_INTRINSIC __m256i cmpge(__m256i a, __m256i b, ushort) { return not_(AVX::cmpgt_epu16(b, a)); }\nVc_INTRINSIC __m256i cmpge(__m256i a, __m256i b,  schar) { return not_(AVX::cmpgt_epi8 (b, a)); }\nVc_INTRINSIC __m256i cmpge(__m256i a, __m256i b,  uchar) { return not_(AVX::cmpgt_epu8 (b, a)); }\n\n// cmple{{{1\nVc_INTRINSIC __m256  cmple(__m256  a, __m256  b,  float) { return AVX::cmple_ps(a, b); }\nVc_INTRINSIC __m256d cmple(__m256d a, __m256d b, double) { return AVX::cmple_pd(a, b); }\nVc_INTRINSIC __m256i cmple(__m256i a, __m256i b,    int) { return not_(AVX::cmpgt_epi32(a, b)); }\nVc_INTRINSIC __m256i cmple(__m256i a, __m256i b,   uint) { return not_(AVX::cmpgt_epu32(a, b)); }\nVc_INTRINSIC __m256i cmple(__m256i a, __m256i b,  short) { return not_(AVX::cmpgt_epi16(a, b)); }\nVc_INTRINSIC __m256i cmple(__m256i a, __m256i b, ushort) { return not_(AVX::cmpgt_epu16(a, b)); }\nVc_INTRINSIC __m256i cmple(__m256i a, __m256i b,  schar) { return not_(AVX::cmpgt_epi8 (a, b)); }\nVc_INTRINSIC __m256i cmple(__m256i a, __m256i b,  uchar) { return not_(AVX::cmpgt_epu8 (a, b)); }\n\n// cmplt{{{1\nVc_INTRINSIC __m256  cmplt(__m256  a, __m256  b,  float) { return AVX::cmplt_ps(a, b); }\nVc_INTRINSIC __m256d cmplt(__m256d a, __m256d b, double) { return AVX::cmplt_pd(a, b); }\nVc_INTRINSIC __m256i cmplt(__m256i a, __m256i b,    int) { return AVX::cmpgt_epi32(b, a); }\nVc_INTRINSIC __m256i cmplt(__m256i a, __m256i b,   uint) { return AVX::cmpgt_epu32(b, a); }\nVc_INTRINSIC __m256i cmplt(__m256i a, __m256i b,  short) { return AVX::cmpgt_epi16(b, a); }\nVc_INTRINSIC __m256i cmplt(__m256i a, __m256i b, ushort) { return AVX::cmpgt_epu16(b, a); }\nVc_INTRINSIC __m256i cmplt(__m256i a, __m256i b,  schar) { return AVX::cmpgt_epi8 (b, a); }\nVc_INTRINSIC __m256i cmplt(__m256i a, __m256i b,  uchar) { return AVX::cmpgt_epu8 (b, a); }\n\n// fma{{{1\nVc_INTRINSIC __m256 fma(__m256  a, __m256  b, __m256  c,  float) {\n#ifdef Vc_IMPL_FMA4\n    return _mm256_macc_ps(a, b, c);\n#elif defined Vc_IMPL_FMA\n    return _mm256_fmadd_ps(a, b, c);\n#else\n    using namespace AVX;\n    __m256d v1_0 = _mm256_cvtps_pd(lo128(a));\n    __m256d v1_1 = _mm256_cvtps_pd(hi128(a));\n    __m256d v2_0 = _mm256_cvtps_pd(lo128(b));\n    __m256d v2_1 = _mm256_cvtps_pd(hi128(b));\n    __m256d v3_0 = _mm256_cvtps_pd(lo128(c));\n    __m256d v3_1 = _mm256_cvtps_pd(hi128(c));\n    return concat(_mm256_cvtpd_ps(_mm256_add_pd(_mm256_mul_pd(v1_0, v2_0), v3_0)),\n                  _mm256_cvtpd_ps(_mm256_add_pd(_mm256_mul_pd(v1_1, v2_1), v3_1)));\n#endif\n}\nVc_INTRINSIC __m256d fma(__m256d a, __m256d b, __m256d c, double)\n{\n#ifdef Vc_IMPL_FMA4\n    return _mm256_macc_pd(a, b, c);\n#elif defined Vc_IMPL_FMA\n    return _mm256_fmadd_pd(a, b, c);\n#else\n    using namespace AVX;\n    __m256d h1 = and_(a, _mm256_broadcast_sd(reinterpret_cast<const double *>(\n                             &c_general::highMaskDouble)));\n    __m256d h2 = and_(b, _mm256_broadcast_sd(reinterpret_cast<const double *>(\n                             &c_general::highMaskDouble)));\n    const __m256d l1 = _mm256_sub_pd(a, h1);\n    const __m256d l2 = _mm256_sub_pd(b, h2);\n    const __m256d ll = mul(l1, l2, double());\n    const __m256d lh = add(mul(l1, h2, double()), mul(h1, l2, double()), double());\n    const __m256d hh = mul(h1, h2, double());\n    // ll < lh < hh for all entries is certain\n    const __m256d lh_lt_v3 = cmplt(abs(lh, double()), abs(c, double()), double());  // |lh| < |c|\n    const __m256d x = _mm256_blendv_pd(c, lh, lh_lt_v3);\n    const __m256d y = _mm256_blendv_pd(lh, c, lh_lt_v3);\n    return add(add(ll, x, double()), add(y, hh, double()), double());\n#endif\n}\ntemplate <typename T> Vc_INTRINSIC __m256i fma(__m256i a, __m256i b, __m256i c, T)\n{\n    return add(mul(a, b, T()), c, T());\n}\n\n// shiftRight{{{1\ntemplate <int shift> Vc_INTRINSIC __m256i shiftRight(__m256i a,    int) { return AVX::srai_epi32<shift>(a); }\ntemplate <int shift> Vc_INTRINSIC __m256i shiftRight(__m256i a,   uint) { return AVX::srli_epi32<shift>(a); }\ntemplate <int shift> Vc_INTRINSIC __m256i shiftRight(__m256i a,  short) { return AVX::srai_epi16<shift>(a); }\ntemplate <int shift> Vc_INTRINSIC __m256i shiftRight(__m256i a, ushort) { return AVX::srli_epi16<shift>(a); }\n//template <int shift> Vc_INTRINSIC __m256i shiftRight(__m256i a,  schar) { return AVX::srai_epi8 <shift>(a); }\n//template <int shift> Vc_INTRINSIC __m256i shiftRight(__m256i a,  uchar) { return AVX::srli_epi8 <shift>(a); }\n\nVc_INTRINSIC __m256i shiftRight(__m256i a, int shift,    int) { return AVX::sra_epi32(a, _mm_cvtsi32_si128(shift)); }\nVc_INTRINSIC __m256i shiftRight(__m256i a, int shift,   uint) { return AVX::srl_epi32(a, _mm_cvtsi32_si128(shift)); }\nVc_INTRINSIC __m256i shiftRight(__m256i a, int shift,  short) { return AVX::sra_epi16(a, _mm_cvtsi32_si128(shift)); }\nVc_INTRINSIC __m256i shiftRight(__m256i a, int shift, ushort) { return AVX::srl_epi16(a, _mm_cvtsi32_si128(shift)); }\n//Vc_INTRINSIC __m256i shiftRight(__m256i a, int shift,  schar) { return AVX::sra_epi8 (a, _mm_cvtsi32_si128(shift)); }\n//Vc_INTRINSIC __m256i shiftRight(__m256i a, int shift,  uchar) { return AVX::srl_epi8 (a, _mm_cvtsi32_si128(shift)); }\n\n// shiftLeft{{{1\ntemplate <int shift> Vc_INTRINSIC __m256i shiftLeft(__m256i a,    int) { return AVX::slli_epi32<shift>(a); }\ntemplate <int shift> Vc_INTRINSIC __m256i shiftLeft(__m256i a,   uint) { return AVX::slli_epi32<shift>(a); }\ntemplate <int shift> Vc_INTRINSIC __m256i shiftLeft(__m256i a,  short) { return AVX::slli_epi16<shift>(a); }\ntemplate <int shift> Vc_INTRINSIC __m256i shiftLeft(__m256i a, ushort) { return AVX::slli_epi16<shift>(a); }\n//template <int shift> Vc_INTRINSIC __m256i shiftLeft(__m256i a,  schar) { return AVX::slli_epi8 <shift>(a); }\n//template <int shift> Vc_INTRINSIC __m256i shiftLeft(__m256i a,  uchar) { return AVX::slli_epi8 <shift>(a); }\n\nVc_INTRINSIC __m256i shiftLeft(__m256i a, int shift,    int) { return AVX::sll_epi32(a, _mm_cvtsi32_si128(shift)); }\nVc_INTRINSIC __m256i shiftLeft(__m256i a, int shift,   uint) { return AVX::sll_epi32(a, _mm_cvtsi32_si128(shift)); }\nVc_INTRINSIC __m256i shiftLeft(__m256i a, int shift,  short) { return AVX::sll_epi16(a, _mm_cvtsi32_si128(shift)); }\nVc_INTRINSIC __m256i shiftLeft(__m256i a, int shift, ushort) { return AVX::sll_epi16(a, _mm_cvtsi32_si128(shift)); }\n//Vc_INTRINSIC __m256i shiftLeft(__m256i a, int shift,  schar) { return AVX::sll_epi8 (a, _mm_cvtsi32_si128(shift)); }\n//Vc_INTRINSIC __m256i shiftLeft(__m256i a, int shift,  uchar) { return AVX::sll_epi8 (a, _mm_cvtsi32_si128(shift)); }\n\n// zeroExtendIfNeeded{{{1\nVc_INTRINSIC __m256  zeroExtendIfNeeded(__m256  x) { return x; }\nVc_INTRINSIC __m256d zeroExtendIfNeeded(__m256d x) { return x; }\nVc_INTRINSIC __m256i zeroExtendIfNeeded(__m256i x) { return x; }\nVc_INTRINSIC __m256  zeroExtendIfNeeded(__m128  x) { return AVX::zeroExtend(x); }\nVc_INTRINSIC __m256d zeroExtendIfNeeded(__m128d x) { return AVX::zeroExtend(x); }\nVc_INTRINSIC __m256i zeroExtendIfNeeded(__m128i x) { return AVX::zeroExtend(x); }\n\n// broadcast{{{1\nVc_INTRINSIC __m256  avx_broadcast( float x) { return _mm256_set1_ps(x); }\nVc_INTRINSIC __m256d avx_broadcast(double x) { return _mm256_set1_pd(x); }\nVc_INTRINSIC __m256i avx_broadcast(   int x) { return _mm256_set1_epi32(x); }\nVc_INTRINSIC __m256i avx_broadcast(  uint x) { return _mm256_set1_epi32(x); }\nVc_INTRINSIC __m256i avx_broadcast( short x) { return _mm256_set1_epi16(x); }\nVc_INTRINSIC __m256i avx_broadcast(ushort x) { return _mm256_set1_epi16(x); }\nVc_INTRINSIC __m256i avx_broadcast(  char x) { return _mm256_set1_epi8(x); }\nVc_INTRINSIC __m256i avx_broadcast( schar x) { return _mm256_set1_epi8(x); }\nVc_INTRINSIC __m256i avx_broadcast( uchar x) { return _mm256_set1_epi8(x); }\n\n// sorted{{{1\ntemplate <Vc::Implementation Impl, typename T,\n          typename = enable_if<(Impl >= AVXImpl && Impl <= AVX2Impl)>>\nVc_CONST_L AVX2::Vector<T> Vc_VDECL sorted(AVX2::Vector<T> x) Vc_CONST_R;\ntemplate <typename T> Vc_INTRINSIC Vc_CONST AVX2::Vector<T> sorted(AVX2::Vector<T> x)\n{\n    return sorted<CurrentImplementation::current()>(x);\n}\n\n// shifted{{{1\ntemplate <typename T, typename V>\nstatic Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32), V> shifted(V v, int amount)\n{\n    using namespace AVX;\n    constexpr int S = sizeof(T);\n    switch (amount) {\n    case  0: return v;\n    case  1: return shifted<sanitize<V>( 1 * S)>(v);\n    case  2: return shifted<sanitize<V>( 2 * S)>(v);\n    case  3: return shifted<sanitize<V>( 3 * S)>(v);\n    case -1: return shifted<sanitize<V>(-1 * S)>(v);\n    case -2: return shifted<sanitize<V>(-2 * S)>(v);\n    case -3: return shifted<sanitize<V>(-3 * S)>(v);\n    }\n    if (sizeof(T) <= 4) {\n        switch (amount) {\n        case  4: return shifted<sanitize<V>( 4 * S)>(v);\n        case  5: return shifted<sanitize<V>( 5 * S)>(v);\n        case  6: return shifted<sanitize<V>( 6 * S)>(v);\n        case  7: return shifted<sanitize<V>( 7 * S)>(v);\n        case -4: return shifted<sanitize<V>(-4 * S)>(v);\n        case -5: return shifted<sanitize<V>(-5 * S)>(v);\n        case -6: return shifted<sanitize<V>(-6 * S)>(v);\n        case -7: return shifted<sanitize<V>(-7 * S)>(v);\n        }\n        if (sizeof(T) <= 2) {\n            switch (amount) {\n            case   8: return shifted<sanitize<V>(  8 * S)>(v);\n            case   9: return shifted<sanitize<V>(  9 * S)>(v);\n            case  10: return shifted<sanitize<V>( 10 * S)>(v);\n            case  11: return shifted<sanitize<V>( 11 * S)>(v);\n            case  12: return shifted<sanitize<V>( 12 * S)>(v);\n            case  13: return shifted<sanitize<V>( 13 * S)>(v);\n            case  14: return shifted<sanitize<V>( 14 * S)>(v);\n            case  15: return shifted<sanitize<V>( 15 * S)>(v);\n            case  -8: return shifted<sanitize<V>(- 8 * S)>(v);\n            case  -9: return shifted<sanitize<V>(- 9 * S)>(v);\n            case -10: return shifted<sanitize<V>(-10 * S)>(v);\n            case -11: return shifted<sanitize<V>(-11 * S)>(v);\n            case -12: return shifted<sanitize<V>(-12 * S)>(v);\n            case -13: return shifted<sanitize<V>(-13 * S)>(v);\n            case -14: return shifted<sanitize<V>(-14 * S)>(v);\n            case -15: return shifted<sanitize<V>(-15 * S)>(v);\n            }\n            if (sizeof(T) == 1) {\n                switch (amount) {\n                case  16: return shifted<sanitize<V>( 16)>(v);\n                case  17: return shifted<sanitize<V>( 17)>(v);\n                case  18: return shifted<sanitize<V>( 18)>(v);\n                case  19: return shifted<sanitize<V>( 19)>(v);\n                case  20: return shifted<sanitize<V>( 20)>(v);\n                case  21: return shifted<sanitize<V>( 21)>(v);\n                case  22: return shifted<sanitize<V>( 22)>(v);\n                case  23: return shifted<sanitize<V>( 23)>(v);\n                case  24: return shifted<sanitize<V>( 24)>(v);\n                case  25: return shifted<sanitize<V>( 25)>(v);\n                case  26: return shifted<sanitize<V>( 26)>(v);\n                case  27: return shifted<sanitize<V>( 27)>(v);\n                case  28: return shifted<sanitize<V>( 28)>(v);\n                case  29: return shifted<sanitize<V>( 29)>(v);\n                case  30: return shifted<sanitize<V>( 30)>(v);\n                case  31: return shifted<sanitize<V>( 31)>(v);\n                case -16: return shifted<sanitize<V>(-16)>(v);\n                case -17: return shifted<sanitize<V>(-17)>(v);\n                case -18: return shifted<sanitize<V>(-18)>(v);\n                case -19: return shifted<sanitize<V>(-19)>(v);\n                case -20: return shifted<sanitize<V>(-20)>(v);\n                case -21: return shifted<sanitize<V>(-21)>(v);\n                case -22: return shifted<sanitize<V>(-22)>(v);\n                case -23: return shifted<sanitize<V>(-23)>(v);\n                case -24: return shifted<sanitize<V>(-24)>(v);\n                case -25: return shifted<sanitize<V>(-25)>(v);\n                case -26: return shifted<sanitize<V>(-26)>(v);\n                case -27: return shifted<sanitize<V>(-27)>(v);\n                case -28: return shifted<sanitize<V>(-28)>(v);\n                case -29: return shifted<sanitize<V>(-29)>(v);\n                case -30: return shifted<sanitize<V>(-30)>(v);\n                case -31: return shifted<sanitize<V>(-31)>(v);\n                }\n            }\n        }\n    }\n    return avx_cast<V>(_mm256_setzero_ps());\n}\n\ntemplate <typename T, typename V>\nstatic Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 16), V> shifted(V v, int amount)\n{\n    using namespace AVX;\n    switch (amount) {\n    case  0: return v;\n    case  1: return avx_cast<V>(_mm_srli_si128(avx_cast<__m128i>(v), sanitize<V>(1 * sizeof(T))));\n    case  2: return avx_cast<V>(_mm_srli_si128(avx_cast<__m128i>(v), sanitize<V>(2 * sizeof(T))));\n    case  3: return avx_cast<V>(_mm_srli_si128(avx_cast<__m128i>(v), sanitize<V>(3 * sizeof(T))));\n    case -1: return avx_cast<V>(_mm_slli_si128(avx_cast<__m128i>(v), sanitize<V>(1 * sizeof(T))));\n    case -2: return avx_cast<V>(_mm_slli_si128(avx_cast<__m128i>(v), sanitize<V>(2 * sizeof(T))));\n    case -3: return avx_cast<V>(_mm_slli_si128(avx_cast<__m128i>(v), sanitize<V>(3 * sizeof(T))));\n    }\n    if (sizeof(T) <= 2) {\n        switch (amount) {\n        case  4: return avx_cast<V>(_mm_srli_si128(avx_cast<__m128i>(v), sanitize<V>(4 * sizeof(T))));\n        case  5: return avx_cast<V>(_mm_srli_si128(avx_cast<__m128i>(v), sanitize<V>(5 * sizeof(T))));\n        case  6: return avx_cast<V>(_mm_srli_si128(avx_cast<__m128i>(v), sanitize<V>(6 * sizeof(T))));\n        case  7: return avx_cast<V>(_mm_srli_si128(avx_cast<__m128i>(v), sanitize<V>(7 * sizeof(T))));\n        case -4: return avx_cast<V>(_mm_slli_si128(avx_cast<__m128i>(v), sanitize<V>(4 * sizeof(T))));\n        case -5: return avx_cast<V>(_mm_slli_si128(avx_cast<__m128i>(v), sanitize<V>(5 * sizeof(T))));\n        case -6: return avx_cast<V>(_mm_slli_si128(avx_cast<__m128i>(v), sanitize<V>(6 * sizeof(T))));\n        case -7: return avx_cast<V>(_mm_slli_si128(avx_cast<__m128i>(v), sanitize<V>(7 * sizeof(T))));\n        }\n    }\n    return avx_cast<V>(_mm_setzero_ps());\n}\n// rotated{{{1\ntemplate <typename T, size_t N, typename V>\nstatic Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 4), V> rotated(V v,\n                                                                               int amount)\n{\n    using namespace AVX;\n    const __m128i vLo = avx_cast<__m128i>(lo128(v));\n    const __m128i vHi = avx_cast<__m128i>(hi128(v));\n    switch (static_cast<unsigned int>(amount) % N) {\n    case 0:\n        return v;\n    case 1:\n        return avx_cast<V>(concat(SSE::alignr_epi8<sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<sizeof(T)>(vLo, vHi)));\n    case 2:\n        return Mem::permute128<X1, X0>(v);\n    case 3:\n        return avx_cast<V>(concat(SSE::alignr_epi8<sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<sizeof(T)>(vHi, vLo)));\n    }\n    return avx_cast<V>(_mm256_setzero_ps());\n}\n\ntemplate <typename T, size_t N, typename V>\nstatic Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 8), V> rotated(V v,\n                                                                               int amount)\n{\n    using namespace AVX;\n    const __m128i vLo = avx_cast<__m128i>(lo128(v));\n    const __m128i vHi = avx_cast<__m128i>(hi128(v));\n    switch (static_cast<unsigned int>(amount) % N) {\n    case 0:\n        return v;\n    case 1:\n        return avx_cast<V>(concat(SSE::alignr_epi8<1 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<1 * sizeof(T)>(vLo, vHi)));\n    case 2:\n        return avx_cast<V>(concat(SSE::alignr_epi8<2 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<2 * sizeof(T)>(vLo, vHi)));\n    case 3:\n        return avx_cast<V>(concat(SSE::alignr_epi8<3 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<3 * sizeof(T)>(vLo, vHi)));\n    case 4:\n        return Mem::permute128<X1, X0>(v);\n    case 5:\n        return avx_cast<V>(concat(SSE::alignr_epi8<1 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<1 * sizeof(T)>(vHi, vLo)));\n    case 6:\n        return avx_cast<V>(concat(SSE::alignr_epi8<2 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<2 * sizeof(T)>(vHi, vLo)));\n    case 7:\n        return avx_cast<V>(concat(SSE::alignr_epi8<3 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<3 * sizeof(T)>(vHi, vLo)));\n    }\n    return avx_cast<V>(_mm256_setzero_ps());\n}\n\n#ifdef Vc_IMPL_AVX2\ntemplate <typename T, size_t N, typename V>\nstatic Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 32 && N == 16), V> rotated(\n    V v, int amount)\n{\n    using namespace AVX;\n    const __m128i vLo = avx_cast<__m128i>(lo128(v));\n    const __m128i vHi = avx_cast<__m128i>(hi128(v));\n    switch (static_cast<unsigned int>(amount) % N) {\n    case 0:\n        return v;\n    case 1:\n        return avx_cast<V>(concat(SSE::alignr_epi8<1 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<1 * sizeof(T)>(vLo, vHi)));\n    case 2:\n        return avx_cast<V>(concat(SSE::alignr_epi8<2 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<2 * sizeof(T)>(vLo, vHi)));\n    case 3:\n        return avx_cast<V>(concat(SSE::alignr_epi8<3 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<3 * sizeof(T)>(vLo, vHi)));\n    case 4:\n        return Mem::permute4x64<X1, X2, X3, X0>(v);\n    case 5:\n        return avx_cast<V>(concat(SSE::alignr_epi8<5 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<5 * sizeof(T)>(vLo, vHi)));\n    case 6:\n        return avx_cast<V>(concat(SSE::alignr_epi8<6 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<6 * sizeof(T)>(vLo, vHi)));\n    case 7:\n        return avx_cast<V>(concat(SSE::alignr_epi8<7 * sizeof(T)>(vHi, vLo),\n                                  SSE::alignr_epi8<7 * sizeof(T)>(vLo, vHi)));\n    case 8:\n        return Mem::permute128<X1, X0>(v);\n    case 9:\n        return avx_cast<V>(concat(SSE::alignr_epi8<1 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<1 * sizeof(T)>(vHi, vLo)));\n    case 10:\n        return avx_cast<V>(concat(SSE::alignr_epi8<2 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<2 * sizeof(T)>(vHi, vLo)));\n    case 11:\n        return avx_cast<V>(concat(SSE::alignr_epi8<3 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<3 * sizeof(T)>(vHi, vLo)));\n    case 12:\n        return Mem::permute4x64<X3, X0, X1, X2>(v);\n    case 13:\n        return avx_cast<V>(concat(SSE::alignr_epi8<5 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<5 * sizeof(T)>(vHi, vLo)));\n    case 14:\n        return avx_cast<V>(concat(SSE::alignr_epi8<6 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<6 * sizeof(T)>(vHi, vLo)));\n    case 15:\n        return avx_cast<V>(concat(SSE::alignr_epi8<7 * sizeof(T)>(vLo, vHi),\n                                  SSE::alignr_epi8<7 * sizeof(T)>(vHi, vLo)));\n    }\n    return avx_cast<V>(_mm256_setzero_ps());\n}\n#endif  // Vc_IMPL_AVX2\n\n// testc{{{1\nVc_INTRINSIC Vc_CONST int testc(__m128  a, __m128  b) { return _mm_testc_si128(_mm_castps_si128(a), _mm_castps_si128(b)); }\nVc_INTRINSIC Vc_CONST int testc(__m256  a, __m256  b) { return _mm256_testc_ps(a, b); }\nVc_INTRINSIC Vc_CONST int testc(__m256d a, __m256d b) { return _mm256_testc_pd(a, b); }\nVc_INTRINSIC Vc_CONST int testc(__m256i a, __m256i b) { return _mm256_testc_si256(a, b); }\n\n// testz{{{1\nVc_INTRINSIC Vc_CONST int testz(__m128  a, __m128  b) { return _mm_testz_si128(_mm_castps_si128(a), _mm_castps_si128(b)); }\nVc_INTRINSIC Vc_CONST int testz(__m256  a, __m256  b) { return _mm256_testz_ps(a, b); }\nVc_INTRINSIC Vc_CONST int testz(__m256d a, __m256d b) { return _mm256_testz_pd(a, b); }\nVc_INTRINSIC Vc_CONST int testz(__m256i a, __m256i b) { return _mm256_testz_si256(a, b); }\n\n// testnzc{{{1\nVc_INTRINSIC Vc_CONST int testnzc(__m128 a, __m128 b) { return _mm_testnzc_si128(_mm_castps_si128(a), _mm_castps_si128(b)); }\nVc_INTRINSIC Vc_CONST int testnzc(__m256  a, __m256  b) { return _mm256_testnzc_ps(a, b); }\nVc_INTRINSIC Vc_CONST int testnzc(__m256d a, __m256d b) { return _mm256_testnzc_pd(a, b); }\nVc_INTRINSIC Vc_CONST int testnzc(__m256i a, __m256i b) { return _mm256_testnzc_si256(a, b); }\n\n// movemask{{{1\nVc_INTRINSIC Vc_CONST int movemask(__m256i a) { return AVX::movemask_epi8(a); }\nVc_INTRINSIC Vc_CONST int movemask(__m128i a) { return _mm_movemask_epi8(a); }\nVc_INTRINSIC Vc_CONST int movemask(__m256d a) { return _mm256_movemask_pd(a); }\nVc_INTRINSIC Vc_CONST int movemask(__m128d a) { return _mm_movemask_pd(a); }\nVc_INTRINSIC Vc_CONST int movemask(__m256  a) { return _mm256_movemask_ps(a); }\nVc_INTRINSIC Vc_CONST int movemask(__m128  a) { return _mm_movemask_ps(a); }\n\n// mask_store{{{1\ntemplate <size_t N, typename Flags>\nVc_INTRINSIC void mask_store(__m256i k, bool *mem, Flags)\n{\n    static_assert(\n        N == 4 || N == 8 || N == 16,\n        \"mask_store(__m256i, bool *) is only implemented for 4, 8, and 16 entries\");\n    switch (N) {\n    case 4:\n        *aliasing_cast<int32_t>(mem) = (_mm_movemask_epi8(AVX::lo128(k)) |\n                                        (_mm_movemask_epi8(AVX::hi128(k)) << 16)) &\n                                       0x01010101;\n        break;\n    case 8: {\n        const auto k2 = _mm_srli_epi16(_mm_packs_epi16(AVX::lo128(k), AVX::hi128(k)), 15);\n        const auto k3 = _mm_packs_epi16(k2, _mm_setzero_si128());\n#ifdef __x86_64__\n        *aliasing_cast<int64_t>(mem) = _mm_cvtsi128_si64(k3);\n#else\n        *aliasing_cast<int32_t>(mem) = _mm_cvtsi128_si32(k3);\n        *aliasing_cast<int32_t>(mem + 4) = _mm_extract_epi32(k3, 1);\n#endif\n    } break;\n    case 16: {\n        const auto bools = Detail::and_(_mm_set1_epi8(1),\n                                        _mm_packs_epi16(AVX::lo128(k), AVX::hi128(k)));\n        if (Flags::IsAligned) {\n            _mm_store_si128(reinterpret_cast<__m128i *>(mem), bools);\n        } else {\n            _mm_storeu_si128(reinterpret_cast<__m128i *>(mem), bools);\n        }\n    } break;\n    default:\n        Vc_UNREACHABLE();\n    }\n}\n\n// mask_load{{{1\ntemplate <typename R, size_t N, typename Flags>\nVc_INTRINSIC R mask_load(const bool *mem, Flags,\n                         enable_if<std::is_same<R, __m128>::value> = nullarg)\n{\n    static_assert(N == 4 || N == 8,\n                  \"mask_load<__m128>(const bool *) is only implemented for 4, 8 entries\");\n    switch (N) {\n    case 4: {\n        __m128i k = _mm_cvtsi32_si128(*aliasing_cast<int32_t>(mem));\n        k = _mm_unpacklo_epi8(k, k);\n        k = _mm_unpacklo_epi16(k, k);\n        k = _mm_cmpgt_epi32(k, _mm_setzero_si128());\n        return AVX::avx_cast<__m128>(k);\n    }\n    case 8: {\n#ifdef __x86_64__\n        __m128i k = _mm_cvtsi64_si128(*aliasing_cast<int64_t>(mem));\n#else\n        __m128i k = _mm_castpd_si128(_mm_load_sd(aliasing_cast<double>(mem)));\n#endif\n        return AVX::avx_cast<__m128>(\n            _mm_cmpgt_epi16(_mm_unpacklo_epi8(k, k), _mm_setzero_si128()));\n    }\n    default:\n        Vc_UNREACHABLE();\n    }\n}\n\ntemplate <typename R, size_t N, typename Flags>\nVc_INTRINSIC R mask_load(const bool *mem, Flags,\n                         enable_if<std::is_same<R, __m256>::value> = nullarg)\n{\n    static_assert(\n        N == 4 || N == 8 || N == 16,\n        \"mask_load<__m256>(const bool *) is only implemented for 4, 8, and 16 entries\");\n    switch (N) {\n    case 4: {\n        __m128i k = AVX::avx_cast<__m128i>(_mm_and_ps(\n            _mm_set1_ps(*aliasing_cast<float>(mem)),\n            AVX::avx_cast<__m128>(_mm_setr_epi32(0x1, 0x100, 0x10000, 0x1000000))));\n        k = _mm_cmpgt_epi32(k, _mm_setzero_si128());\n        return AVX::avx_cast<__m256>(\n            AVX::concat(_mm_unpacklo_epi32(k, k), _mm_unpackhi_epi32(k, k)));\n    }\n    case 8: {\n#ifdef __x86_64__\n        __m128i k = _mm_cvtsi64_si128(*aliasing_cast<int64_t>(mem));\n#else\n        __m128i k = _mm_castpd_si128(_mm_load_sd(aliasing_cast<double>(mem)));\n#endif\n        k = _mm_cmpgt_epi16(_mm_unpacklo_epi8(k, k), _mm_setzero_si128());\n        return AVX::avx_cast<__m256>(\n            AVX::concat(_mm_unpacklo_epi16(k, k), _mm_unpackhi_epi16(k, k)));\n    }\n    case 16: {\n        const auto k128 = _mm_cmpgt_epi8(\n            Flags::IsAligned ? _mm_load_si128(reinterpret_cast<const __m128i *>(mem))\n                             : _mm_loadu_si128(reinterpret_cast<const __m128i *>(mem)),\n            _mm_setzero_si128());\n        return AVX::avx_cast<__m256>(\n            AVX::concat(_mm_unpacklo_epi8(k128, k128), _mm_unpackhi_epi8(k128, k128)));\n    }\n    default:\n        Vc_UNREACHABLE();\n        return R();\n    }\n}\n\n// mask_to_int{{{1\ntemplate <size_t Size>\nVc_INTRINSIC_L Vc_CONST_L int mask_to_int(__m256i x) Vc_INTRINSIC_R Vc_CONST_R;\ntemplate <> Vc_INTRINSIC Vc_CONST int mask_to_int<4>(__m256i k)\n{\n    return movemask(AVX::avx_cast<__m256d>(k));\n}\ntemplate <> Vc_INTRINSIC Vc_CONST int mask_to_int<8>(__m256i k)\n{\n    return movemask(AVX::avx_cast<__m256>(k));\n}\n#ifdef Vc_IMPL_BMI2\ntemplate <> Vc_INTRINSIC Vc_CONST int mask_to_int<16>(__m256i k)\n{\n    return _pext_u32(movemask(k), 0x55555555u);\n}\n#endif\ntemplate <> Vc_INTRINSIC Vc_CONST int mask_to_int<32>(__m256i k)\n{\n    return movemask(k);\n}\n\n//InterleaveImpl{{{1\ntemplate<typename V> struct InterleaveImpl<V, 16, 32> {\n    template<typename I> static inline void interleave(typename V::EntryType *const data, const I &i,/*{{{*/\n            const typename V::AsArg v0, // a0 a1 a2 a3 a4 a5 a6 a7 | a8 a9 ...\n            const typename V::AsArg v1) // b0 b1 b2 b3 b4 b5 b6 b7 | b8 b9 ...\n    {\n        const __m256i tmp0 = AVX::unpacklo_epi16(v0.data(), v1.data()); // a0 b0 a1 b1 a2 b2 a3 b3 | a8 b8 a9 ...\n        const __m256i tmp1 = AVX::unpackhi_epi16(v0.data(), v1.data()); // a4 b4 a5 ...\n        using namespace AVX;\n        *aliasing_cast<uint32_t>(&data[i[ 0]]) = _mm_cvtsi128_si32(lo128(tmp0));\n        *aliasing_cast<uint32_t>(&data[i[ 1]]) = _mm_extract_epi32(lo128(tmp0), 1);\n        *aliasing_cast<uint32_t>(&data[i[ 2]]) = _mm_extract_epi32(lo128(tmp0), 2);\n        *aliasing_cast<uint32_t>(&data[i[ 3]]) = _mm_extract_epi32(lo128(tmp0), 3);\n        *aliasing_cast<uint32_t>(&data[i[ 4]]) = _mm_cvtsi128_si32(lo128(tmp1));\n        *aliasing_cast<uint32_t>(&data[i[ 5]]) = _mm_extract_epi32(lo128(tmp1), 1);\n        *aliasing_cast<uint32_t>(&data[i[ 6]]) = _mm_extract_epi32(lo128(tmp1), 2);\n        *aliasing_cast<uint32_t>(&data[i[ 7]]) = _mm_extract_epi32(lo128(tmp1), 3);\n        *aliasing_cast<uint32_t>(&data[i[ 8]]) = _mm_cvtsi128_si32(hi128(tmp0));\n        *aliasing_cast<uint32_t>(&data[i[ 9]]) = _mm_extract_epi32(hi128(tmp0), 1);\n        *aliasing_cast<uint32_t>(&data[i[10]]) = _mm_extract_epi32(hi128(tmp0), 2);\n        *aliasing_cast<uint32_t>(&data[i[11]]) = _mm_extract_epi32(hi128(tmp0), 3);\n        *aliasing_cast<uint32_t>(&data[i[12]]) = _mm_cvtsi128_si32(hi128(tmp1));\n        *aliasing_cast<uint32_t>(&data[i[13]]) = _mm_extract_epi32(hi128(tmp1), 1);\n        *aliasing_cast<uint32_t>(&data[i[14]]) = _mm_extract_epi32(hi128(tmp1), 2);\n        *aliasing_cast<uint32_t>(&data[i[15]]) = _mm_extract_epi32(hi128(tmp1), 3);\n    }/*}}}*/\n    static inline void interleave(typename V::EntryType *const data, const Common::SuccessiveEntries<2> &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        const __m256i tmp0 = AVX::unpacklo_epi16(v0.data(), v1.data()); // a0 b0 a1 b1 a2 b2 a3 b3 | a8 b8 a9 ...\n        const __m256i tmp1 = AVX::unpackhi_epi16(v0.data(), v1.data()); // a4 b4 a5 ...\n        V(Mem::shuffle128<X0, Y0>(tmp0, tmp1)).store(&data[i[0]], Vc::Unaligned);\n        V(Mem::shuffle128<X1, Y1>(tmp0, tmp1)).store(&data[i[8]], Vc::Unaligned);\n    }/*}}}*/\n    template<typename I> static inline void interleave(typename V::EntryType *const data, const I &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1, const typename V::AsArg v2)\n    {\n        interleave(data, i, v0, v1);\n        v2.scatter(data + 2, i);\n    }/*}}}*/\n    template<typename I> static inline void interleave(typename V::EntryType *const data, const I &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1,\n            const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        const __m256i tmp0 = AVX::unpacklo_epi16(v0.data(), v2.data()); // a0 c0 a1 c1 a2 c2 a3 c3 | a8 c8 a9 c9 ...\n        const __m256i tmp1 = AVX::unpackhi_epi16(v0.data(), v2.data()); // a4 c4 a5 c5 a6 c6 a7 c7 | a12 c12 ...\n        const __m256i tmp2 = AVX::unpacklo_epi16(v1.data(), v3.data()); // b0 d0 b1 d1 b2 d2 b3 d3 | b8 d8 b9 d9 ...\n        const __m256i tmp3 = AVX::unpackhi_epi16(v1.data(), v3.data()); // b4 d4 b5 ...\n\n        const __m256i tmp4 = AVX::unpacklo_epi16(tmp0, tmp2); // a0 b0 c0 d0 a1 b1 c1 d1 | a8 b8 c8 d8 a9 b9 ...\n        const __m256i tmp5 = AVX::unpackhi_epi16(tmp0, tmp2); // [abcd]2 [abcd]3 | [abcd]10 [abcd]11\n        const __m256i tmp6 = AVX::unpacklo_epi16(tmp1, tmp3); // [abcd]4 [abcd]5 | [abcd]12 [abcd]13\n        const __m256i tmp7 = AVX::unpackhi_epi16(tmp1, tmp3); // [abcd]6 [abcd]7 | [abcd]14 [abcd]15\n\n        using namespace AVX;\n        auto &&store = [&](__m256i x, int offset) {\n            _mm_storel_epi64(reinterpret_cast<__m128i *>(&data[i[offset + 0]]), lo128(x));\n            _mm_storel_epi64(reinterpret_cast<__m128i *>(&data[i[offset + 8]]), hi128(x));\n            _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[offset + 1]]), avx_cast<__m128>(x));\n            _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[offset + 9]]), avx_cast<__m128>(hi128(x)));\n        };\n        store(tmp4, 0);\n        store(tmp5, 2);\n        store(tmp6, 4);\n        store(tmp7, 6);\n    }/*}}}*/\n    static inline void interleave(typename V::EntryType *const data, const Common::SuccessiveEntries<4> &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1,\n            const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        const __m256i tmp0 = AVX::unpacklo_epi16(v0.data(), v2.data()); // a0 c0 a1 c1 a2 c2 a3 c3 | a8 c8 a9 c9 ...\n        const __m256i tmp1 = AVX::unpackhi_epi16(v0.data(), v2.data()); // a4 c4 a5 c5 a6 c6 a7 c7 | a12 c12 ...\n        const __m256i tmp2 = AVX::unpacklo_epi16(v1.data(), v3.data()); // b0 d0 b1 d1 b2 d2 b3 d3 | b8 d8 b9 d9 ...\n        const __m256i tmp3 = AVX::unpackhi_epi16(v1.data(), v3.data()); // b4 d4 b5 ...\n\n        const __m256i tmp4 = AVX::unpacklo_epi16(tmp0, tmp2); // a0 b0 c0 d0 a1 b1 c1 d1 | a8 b8 c8 d8 a9 b9 ...\n        const __m256i tmp5 = AVX::unpackhi_epi16(tmp0, tmp2); // [abcd]2 [abcd]3 | [abcd]10 [abcd]11\n        const __m256i tmp6 = AVX::unpacklo_epi16(tmp1, tmp3); // [abcd]4 [abcd]5 | [abcd]12 [abcd]13\n        const __m256i tmp7 = AVX::unpackhi_epi16(tmp1, tmp3); // [abcd]6 [abcd]7 | [abcd]14 [abcd]15\n\n        V(Mem::shuffle128<X0, Y0>(tmp4, tmp5)).store(&data[i[0]], ::Vc::Unaligned);\n        V(Mem::shuffle128<X0, Y0>(tmp6, tmp7)).store(&data[i[4]], ::Vc::Unaligned);\n        V(Mem::shuffle128<X1, Y1>(tmp4, tmp5)).store(&data[i[8]], ::Vc::Unaligned);\n        V(Mem::shuffle128<X1, Y1>(tmp6, tmp7)).store(&data[i[12]], ::Vc::Unaligned);\n    }/*}}}*/\n    template <typename I>  // interleave 5 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        v4.scatter(data + 4, i);\n    }\n    template <typename I>  // interleave 6 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // interleave 7 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // interleave 8 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6, const typename V::AsArg v7)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6, v7);\n    }\n    //}}}2\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1)\n    {\n        const __m256i tmp4 =  // a0 b0 a1 b1 a2 b2 a3 b3 | a8 b8 a9 b9 a10 b10 a11 b11\n            _mm256_setr_epi32(\n                *aliasing_cast<int>(&data[i[0]]), *aliasing_cast<int>(&data[i[1]]),\n                *aliasing_cast<int>(&data[i[2]]), *aliasing_cast<int>(&data[i[3]]),\n                *aliasing_cast<int>(&data[i[8]]), *aliasing_cast<int>(&data[i[9]]),\n                *aliasing_cast<int>(&data[i[10]]), *aliasing_cast<int>(&data[i[11]]));\n        const __m256i tmp5 =  // a4 b4 a5 b5 a6 b6 a7 b7 | a12 b12 a13 b13 a14 b14 a15 b15\n            _mm256_setr_epi32(\n                *aliasing_cast<int>(&data[i[4]]), *aliasing_cast<int>(&data[i[5]]),\n                *aliasing_cast<int>(&data[i[6]]), *aliasing_cast<int>(&data[i[7]]),\n                *aliasing_cast<int>(&data[i[12]]), *aliasing_cast<int>(&data[i[13]]),\n                *aliasing_cast<int>(&data[i[14]]), *aliasing_cast<int>(&data[i[15]]));\n\n        const __m256i tmp2 = AVX::unpacklo_epi16(tmp4, tmp5);  // a0 a4 b0 b4 a1 a5 b1 b5 | a8 a12 b8 b12 a9 a13 b9 b13\n        const __m256i tmp3 = AVX::unpackhi_epi16(tmp4, tmp5);  // a2 a6 b2 b6 a3 a7 b3 b7 | a10 a14 b10 b14 a11 a15 b11 b15\n\n        const __m256i tmp0 = AVX::unpacklo_epi16(tmp2, tmp3);  // a0 a2 a4 a6 b0 b2 b4 b6 | a8 a10 a12 a14 b8 ...\n        const __m256i tmp1 = AVX::unpackhi_epi16(tmp2, tmp3);  // a1 a3 a5 a7 b1 b3 b5 b7 | a9 a11 a13 a15 b9 ...\n\n        v0.data() = AVX::unpacklo_epi16(tmp0, tmp1); // a0 a1 a2 a3 a4 a5 a6 a7 | a8 a9 ...\n        v1.data() = AVX::unpackhi_epi16(tmp0, tmp1); // b0 b1 b2 b3 b4 b5 b6 b7 | b8 b9 ...\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2)\n    {\n        using namespace AVX;\n        const __m256i tmp0 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[0]]), *aliasing_cast<double>(&data[i[1]]),\n            *aliasing_cast<double>(&data[i[8]]), *aliasing_cast<double>(&data[i[9]])));\n        const __m256i tmp1 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[2]]), *aliasing_cast<double>(&data[i[3]]),\n            *aliasing_cast<double>(&data[i[10]]), *aliasing_cast<double>(&data[i[11]])));\n        const __m256i tmp2 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[4]]), *aliasing_cast<double>(&data[i[5]]),\n            *aliasing_cast<double>(&data[i[12]]), *aliasing_cast<double>(&data[i[13]])));\n        const __m256i tmp3 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[6]]), *aliasing_cast<double>(&data[i[7]]),\n            *aliasing_cast<double>(&data[i[14]]), *aliasing_cast<double>(&data[i[15]])));\n        const __m256i tmp4 = AVX::unpacklo_epi16(tmp0, tmp2); // a0 a4 b0 b4 c0 c4 XX XX | a8 a12 b8 ...\n        const __m256i tmp5 = AVX::unpackhi_epi16(tmp0, tmp2); // a1 a5 ...\n        const __m256i tmp6 = AVX::unpacklo_epi16(tmp1, tmp3); // a2 a6 ...\n        const __m256i tmp7 = AVX::unpackhi_epi16(tmp1, tmp3); // a3 a7 ...\n\n        const __m256i tmp8  = AVX::unpacklo_epi16(tmp4, tmp6); // a0 a2 a4 a6 b0 ...\n        const __m256i tmp9  = AVX::unpackhi_epi16(tmp4, tmp6); // c0 c2 c4 c6 XX ...\n        const __m256i tmp10 = AVX::unpacklo_epi16(tmp5, tmp7); // a1 a3 a5 a7 b1 ...\n        const __m256i tmp11 = AVX::unpackhi_epi16(tmp5, tmp7); // c1 c3 c5 c7 XX ...\n\n        v0.data() = AVX::unpacklo_epi16(tmp8, tmp10); // a0 a1 a2 a3 a4 a5 a6 a7 | a8 ...\n        v1.data() = AVX::unpackhi_epi16(tmp8, tmp10);\n        v2.data() = AVX::unpacklo_epi16(tmp9, tmp11);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3)\n    {\n        using namespace AVX;\n        const __m256i tmp0 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[0]]), *aliasing_cast<double>(&data[i[1]]),\n            *aliasing_cast<double>(&data[i[8]]), *aliasing_cast<double>(&data[i[9]])));\n        const __m256i tmp1 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[2]]), *aliasing_cast<double>(&data[i[3]]),\n            *aliasing_cast<double>(&data[i[10]]), *aliasing_cast<double>(&data[i[11]])));\n        const __m256i tmp2 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[4]]), *aliasing_cast<double>(&data[i[5]]),\n            *aliasing_cast<double>(&data[i[12]]), *aliasing_cast<double>(&data[i[13]])));\n        const __m256i tmp3 = avx_cast<__m256i>(_mm256_setr_pd(\n            *aliasing_cast<double>(&data[i[6]]), *aliasing_cast<double>(&data[i[7]]),\n            *aliasing_cast<double>(&data[i[14]]), *aliasing_cast<double>(&data[i[15]])));\n        const __m256i tmp4 = AVX::unpacklo_epi16(tmp0, tmp2); // a0 a4 b0 b4 c0 c4 d0 d4 | a8 a12 b8 ...\n        const __m256i tmp5 = AVX::unpackhi_epi16(tmp0, tmp2); // a1 a5 ...\n        const __m256i tmp6 = AVX::unpacklo_epi16(tmp1, tmp3); // a2 a6 ...\n        const __m256i tmp7 = AVX::unpackhi_epi16(tmp1, tmp3); // a3 a7 ...\n\n        const __m256i tmp8  = AVX::unpacklo_epi16(tmp4, tmp6); // a0 a2 a4 a6 b0 ...\n        const __m256i tmp9  = AVX::unpackhi_epi16(tmp4, tmp6); // c0 c2 c4 c6 d0 ...\n        const __m256i tmp10 = AVX::unpacklo_epi16(tmp5, tmp7); // a1 a3 a5 a7 b1 ...\n        const __m256i tmp11 = AVX::unpackhi_epi16(tmp5, tmp7); // c1 c3 c5 c7 d1 ...\n\n        v0.data() = AVX::unpacklo_epi16(tmp8, tmp10); // a0 a1 a2 a3 a4 a5 a6 a7 | a8 ...\n        v1.data() = AVX::unpackhi_epi16(tmp8, tmp10);\n        v2.data() = AVX::unpacklo_epi16(tmp9, tmp11);\n        v3.data() = AVX::unpackhi_epi16(tmp9, tmp11);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4)\n    {\n        using namespace AVX;\n        const __m256i a = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[8]])));\n        const __m256i b = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[9]])));\n        const __m256i c = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[10]])));\n        const __m256i d = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[11]])));\n        const __m256i e = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[12]])));\n        const __m256i f = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[13]])));\n        const __m256i g = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[14]])));\n        const __m256i h = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[15]])));\n\n        const __m256i tmp2  = AVX::unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4 | a8 ...\n        const __m256i tmp4  = AVX::unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m256i tmp3  = AVX::unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m256i tmp5  = AVX::unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m256i tmp10 = AVX::unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m256i tmp11 = AVX::unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m256i tmp12 = AVX::unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m256i tmp13 = AVX::unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m256i tmp0  = AVX::unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6 | a8 ...\n        const __m256i tmp1  = AVX::unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m256i tmp6  = AVX::unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m256i tmp7  = AVX::unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m256i tmp8  = AVX::unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m256i tmp9  = AVX::unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n\n        v0.data() = AVX::unpacklo_epi16(tmp0, tmp1);\n        v1.data() = AVX::unpackhi_epi16(tmp0, tmp1);\n        v2.data() = AVX::unpacklo_epi16(tmp6, tmp7);\n        v3.data() = AVX::unpackhi_epi16(tmp6, tmp7);\n        v4.data() = AVX::unpacklo_epi16(tmp8, tmp9);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        using namespace AVX;\n        const __m256i a = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[8]])));\n        const __m256i b = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[9]])));\n        const __m256i c = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[10]])));\n        const __m256i d = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[11]])));\n        const __m256i e = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[12]])));\n        const __m256i f = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[13]])));\n        const __m256i g = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[14]])));\n        const __m256i h = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[15]])));\n\n        const __m256i tmp2  = AVX::unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4 | a8 ...\n        const __m256i tmp4  = AVX::unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m256i tmp3  = AVX::unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m256i tmp5  = AVX::unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m256i tmp10 = AVX::unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m256i tmp11 = AVX::unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m256i tmp12 = AVX::unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m256i tmp13 = AVX::unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m256i tmp0  = AVX::unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6 | a8 ...\n        const __m256i tmp1  = AVX::unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m256i tmp6  = AVX::unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m256i tmp7  = AVX::unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m256i tmp8  = AVX::unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m256i tmp9  = AVX::unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n\n        v0.data() = AVX::unpacklo_epi16(tmp0, tmp1);\n        v1.data() = AVX::unpackhi_epi16(tmp0, tmp1);\n        v2.data() = AVX::unpacklo_epi16(tmp6, tmp7);\n        v3.data() = AVX::unpackhi_epi16(tmp6, tmp7);\n        v4.data() = AVX::unpacklo_epi16(tmp8, tmp9);\n        v5.data() = AVX::unpackhi_epi16(tmp8, tmp9);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6)\n    {\n        using namespace AVX;\n        const __m256i a = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[8]])));\n        const __m256i b = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[9]])));\n        const __m256i c = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[10]])));\n        const __m256i d = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[11]])));\n        const __m256i e = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[12]])));\n        const __m256i f = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[13]])));\n        const __m256i g = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[14]])));\n        const __m256i h = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[15]])));\n\n        const __m256i tmp2  = AVX::unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4 | a8 ...\n        const __m256i tmp4  = AVX::unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m256i tmp3  = AVX::unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m256i tmp5  = AVX::unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m256i tmp10 = AVX::unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m256i tmp11 = AVX::unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m256i tmp12 = AVX::unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m256i tmp13 = AVX::unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m256i tmp0  = AVX::unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6 | a8 ...\n        const __m256i tmp1  = AVX::unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m256i tmp6  = AVX::unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m256i tmp7  = AVX::unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m256i tmp8  = AVX::unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m256i tmp9  = AVX::unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n        const __m256i tmp14 = AVX::unpackhi_epi16(tmp10, tmp11); // g0 g2 g4 g6 h0 h2 h4 h6\n        const __m256i tmp15 = AVX::unpackhi_epi16(tmp12, tmp13); // g1 g3 g5 g7 h1 h3 h5 h7\n\n        v0.data() = AVX::unpacklo_epi16(tmp0, tmp1);\n        v1.data() = AVX::unpackhi_epi16(tmp0, tmp1);\n        v2.data() = AVX::unpacklo_epi16(tmp6, tmp7);\n        v3.data() = AVX::unpackhi_epi16(tmp6, tmp7);\n        v4.data() = AVX::unpacklo_epi16(tmp8, tmp9);\n        v5.data() = AVX::unpackhi_epi16(tmp8, tmp9);\n        v6.data() = AVX::unpacklo_epi16(tmp14, tmp15);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6, V &v7)\n    {\n        using namespace AVX;\n        const __m256i a = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[8]])));\n        const __m256i b = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[9]])));\n        const __m256i c = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[10]])));\n        const __m256i d = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[11]])));\n        const __m256i e = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[12]])));\n        const __m256i f = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[13]])));\n        const __m256i g = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[14]])));\n        const __m256i h = concat(_mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]])),\n                                 _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[15]])));\n\n        const __m256i tmp2  = AVX::unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4 | a8 ...\n        const __m256i tmp4  = AVX::unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m256i tmp3  = AVX::unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m256i tmp5  = AVX::unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m256i tmp10 = AVX::unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m256i tmp11 = AVX::unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m256i tmp12 = AVX::unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m256i tmp13 = AVX::unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m256i tmp0  = AVX::unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6 | a8 ...\n        const __m256i tmp1  = AVX::unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m256i tmp6  = AVX::unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m256i tmp7  = AVX::unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m256i tmp8  = AVX::unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m256i tmp9  = AVX::unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n        const __m256i tmp14 = AVX::unpackhi_epi16(tmp10, tmp11); // g0 g2 g4 g6 h0 h2 h4 h6\n        const __m256i tmp15 = AVX::unpackhi_epi16(tmp12, tmp13); // g1 g3 g5 g7 h1 h3 h5 h7\n\n        v0.data() = AVX::unpacklo_epi16(tmp0, tmp1);\n        v1.data() = AVX::unpackhi_epi16(tmp0, tmp1);\n        v2.data() = AVX::unpacklo_epi16(tmp6, tmp7);\n        v3.data() = AVX::unpackhi_epi16(tmp6, tmp7);\n        v4.data() = AVX::unpacklo_epi16(tmp8, tmp9);\n        v5.data() = AVX::unpackhi_epi16(tmp8, tmp9);\n        v6.data() = AVX::unpacklo_epi16(tmp14, tmp15);\n        v7.data() = AVX::unpackhi_epi16(tmp14, tmp15);\n    }/*}}}*/\n};\ntemplate<typename V> struct InterleaveImpl<V, 8, 32> {\n    static_assert(sizeof(typename V::value_type) == 4, \"\");\n    template<typename I> static inline void interleave(typename V::EntryType *const data, const I &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        using namespace AVX;\n        // [0a 1a 0b 1b 0e 1e 0f 1f]:\n        const m256 tmp0 = _mm256_unpacklo_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v1.data()));\n        // [0c 1c 0d 1d 0g 1g 0h 1h]:\n        const m256 tmp1 = _mm256_unpackhi_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v1.data()));\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[0]]), lo128(tmp0));\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[1]]), lo128(tmp0));\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[2]]), lo128(tmp1));\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[3]]), lo128(tmp1));\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[4]]), hi128(tmp0));\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[5]]), hi128(tmp0));\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[6]]), hi128(tmp1));\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[7]]), hi128(tmp1));\n    }/*}}}*/\n    static inline void interleave(typename V::EntryType *const data, const Common::SuccessiveEntries<2> &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        using namespace AVX;\n        // [0a 1a 0b 1b 0e 1e 0f 1f]:\n        const m256 tmp0 = _mm256_unpacklo_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v1.data()));\n        // [0c 1c 0d 1d 0g 1g 0h 1h]:\n        const m256 tmp1 = _mm256_unpackhi_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v1.data()));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[0]]), lo128(tmp0));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[2]]), lo128(tmp1));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[4]]), hi128(tmp0));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[6]]), hi128(tmp1));\n    }/*}}}*/\n    // interleave scatter 3 {{{\n    template <typename I>\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2)\n    {\n        using namespace AVX;\n#ifdef Vc_USE_MASKMOV_SCATTER\n        // [0a 2a 0b 2b 0e 2e 0f 2f]:\n        const m256 tmp0 = _mm256_unpacklo_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v2.data()));\n        // [0c 2c 0d 2d 0g 2g 0h 2h]:\n        const m256 tmp1 = _mm256_unpackhi_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v2.data()));\n        // [1a __ 1b __ 1e __ 1f __]:\n        const m256 tmp2 = _mm256_unpacklo_ps(avx_cast<m256>(v1.data()), avx_cast<m256>(v1.data()));\n        // [1c __ 1d __ 1g __ 1h __]:\n        const m256 tmp3 = _mm256_unpackhi_ps(avx_cast<m256>(v1.data()), avx_cast<m256>(v1.data()));\n        const m256 tmp4 = _mm256_unpacklo_ps(tmp0, tmp2);\n        const m256 tmp5 = _mm256_unpackhi_ps(tmp0, tmp2);\n        const m256 tmp6 = _mm256_unpacklo_ps(tmp1, tmp3);\n        const m256 tmp7 = _mm256_unpackhi_ps(tmp1, tmp3);\n        const m128i mask = _mm_set_epi32(0, -1, -1, -1);\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[0]]), mask, lo128(tmp4));\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[1]]), mask, lo128(tmp5));\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[2]]), mask, lo128(tmp6));\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[3]]), mask, lo128(tmp7));\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[4]]), mask, hi128(tmp4));\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[5]]), mask, hi128(tmp5));\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[6]]), mask, hi128(tmp6));\n        _mm_maskstore_ps(aliasing_cast<float>(&data[i[7]]), mask, hi128(tmp7));\n#else\n        interleave(data, i, v0, v1);\n        v2.scatter(data + 2, i);\n#endif\n    }  // }}}\n    // interleave successive 3 {{{\n    static inline void interleave(typename V::EntryType *const data,\n                                  const Common::SuccessiveEntries<3> &i,\n                                  const typename V::AsArg v0_,\n                                  const typename V::AsArg v1_,\n                                  const typename V::AsArg v2_)\n    {\n        __m256 v0 = AVX::avx_cast<__m256>(v0_.data());  // a0 a1 a2 a3|a4 a5 a6 a7\n        __m256 v1 = AVX::avx_cast<__m256>(v1_.data());  // b0 b1 b2 b3|b4 b5 b6 b7\n        __m256 v2 = AVX::avx_cast<__m256>(v2_.data());  // c0 c1 c2 c3|c4 c5 c6 c7\n\n        v0 = _mm256_shuffle_ps(v0, v0, 0x6c);  // a0 a3 a2 a1|a4 a7 a6 a5\n        v1 = _mm256_shuffle_ps(v1, v1, 0xb1);  // b1 b0 b3 b2|b5 b4 b7 b6\n        v2 = _mm256_shuffle_ps(v2, v2, 0xc6);  // c2 c1 c0 c3|c6 c5 c4 c7\n\n        // a0 b0 c0 a1|c6 a7 b7 c7:\n        __m256 w0 = Mem::blend<X0, X1, Y2, X3, Y4, X5, X6, Y7>(\n                    Mem::blend<X0, Y1, X2, X3, X4, X5, Y6, X7>(v0, v1), v2);\n        // b1 c1 a2 b2|b5 c5 a6 b6:\n        __m256 w1 = Mem::blend<X0, Y1, X2, X3, X4, Y5, X6, X7>(\n                    Mem::blend<Y0, X1, X2, Y3, Y4, X5, X6, Y7>(v0, v1), v2);\n        // c2 a3 b3 c3|a4 b4 c4 a5:\n        __m256 w2 = Mem::blend<Y0, X1, X2, Y3, X4, X5, Y6, X7>(\n                    Mem::blend<X0, X1, Y2, X3, X4, Y5, X6, X7>(v0, v1), v2);\n\n        // a0 b0 c0 a1|b1 c1 a2 b2:\n        _mm256_storeu_ps(aliasing_cast<float>(&data[i[0]]),\n                         _mm256_permute2f128_ps(w0, w1, 0x20));\n        // c2 a3 b3 c3|a4 b4 c4 a5: w2\n        _mm256_storeu_ps(aliasing_cast<float>(&data[i[0]] + 8), w2);\n        // b5 c5 a6 b6|c6 a7 b7 c7:\n        _mm256_storeu_ps(aliasing_cast<float>(&data[i[0]] + 16),\n                         _mm256_permute2f128_ps(w1, w0, 0x31));\n\n    }  //}}}\n    // interleave scatter 4 {{{\n    template <typename I>\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        using namespace AVX;\n        const __m256 tmp0 =\n            _mm256_unpacklo_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v2.data()));\n        const __m256 tmp1 =\n            _mm256_unpackhi_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v2.data()));\n        const __m256 tmp2 =\n            _mm256_unpacklo_ps(avx_cast<m256>(v1.data()), avx_cast<m256>(v3.data()));\n        const __m256 tmp3 =\n            _mm256_unpackhi_ps(avx_cast<m256>(v1.data()), avx_cast<m256>(v3.data()));\n        const __m256 _04 = _mm256_unpacklo_ps(tmp0, tmp2);\n        const __m256 _15 = _mm256_unpackhi_ps(tmp0, tmp2);\n        const __m256 _26 = _mm256_unpacklo_ps(tmp1, tmp3);\n        const __m256 _37 = _mm256_unpackhi_ps(tmp1, tmp3);\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[0]]), lo128(_04));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[1]]), lo128(_15));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[2]]), lo128(_26));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[3]]), lo128(_37));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[4]]), hi128(_04));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[5]]), hi128(_15));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[6]]), hi128(_26));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[7]]), hi128(_37));\n    }  // }}}\n    // interleave successive 4 {{{\n    // same as above except fot the stores, that can be combined to 256-bit stores\n    static inline void interleave(typename V::EntryType *const data,\n                                  const Common::SuccessiveEntries<4> &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        using namespace AVX;\n        const __m256 tmp0 =\n            _mm256_unpacklo_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v2.data()));\n        const __m256 tmp1 =\n            _mm256_unpackhi_ps(avx_cast<m256>(v0.data()), avx_cast<m256>(v2.data()));\n        const __m256 tmp2 =\n            _mm256_unpacklo_ps(avx_cast<m256>(v1.data()), avx_cast<m256>(v3.data()));\n        const __m256 tmp3 =\n            _mm256_unpackhi_ps(avx_cast<m256>(v1.data()), avx_cast<m256>(v3.data()));\n        const __m256 _04 = _mm256_unpacklo_ps(tmp0, tmp2);\n        const __m256 _15 = _mm256_unpackhi_ps(tmp0, tmp2);\n        const __m256 _26 = _mm256_unpacklo_ps(tmp1, tmp3);\n        const __m256 _37 = _mm256_unpackhi_ps(tmp1, tmp3);\n        _mm256_storeu_ps(aliasing_cast<float>(&data[i[0]]),\n                         _mm256_permute2f128_ps(_04, _15, 0x20));\n        _mm256_storeu_ps(aliasing_cast<float>(&data[i[0]] + 8),\n                         _mm256_permute2f128_ps(_26, _37, 0x20));\n        _mm256_storeu_ps(aliasing_cast<float>(&data[i[0]] + 16),\n                         _mm256_permute2f128_ps(_04, _15, 0x31));\n        _mm256_storeu_ps(aliasing_cast<float>(&data[i[0]] + 24),\n                         _mm256_permute2f128_ps(_26, _37, 0x31));\n    }                      // }}}\n    template <typename I>  // interleave 5 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        v4.scatter(data + 4, i);\n    }\n    template <typename I>  // interleave 6 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // interleave 7 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // interleave 8 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6, const typename V::AsArg v7)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6, v7);\n    }\n    //}}}2\n    // deinterleave scatter 2 {{{\n    template <typename I>\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1)\n    {\n        using namespace AVX;\n        const m128  il0 = _mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64 const *>(&data[i[0]])); // a0 b0\n        const m128  il2 = _mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64 const *>(&data[i[2]])); // a2 b2\n        const m128  il4 = _mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64 const *>(&data[i[4]])); // a4 b4\n        const m128  il6 = _mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<__m64 const *>(&data[i[6]])); // a6 b6\n        const m128 il01 = _mm_loadh_pi(             il0, reinterpret_cast<__m64 const *>(&data[i[1]])); // a0 b0 a1 b1\n        const m128 il23 = _mm_loadh_pi(             il2, reinterpret_cast<__m64 const *>(&data[i[3]])); // a2 b2 a3 b3\n        const m128 il45 = _mm_loadh_pi(             il4, reinterpret_cast<__m64 const *>(&data[i[5]])); // a4 b4 a5 b5\n        const m128 il67 = _mm_loadh_pi(             il6, reinterpret_cast<__m64 const *>(&data[i[7]])); // a6 b6 a7 b7\n\n        const m256 tmp2 = concat(il01, il45);\n        const m256 tmp3 = concat(il23, il67);\n\n        const m256 tmp0 = _mm256_unpacklo_ps(tmp2, tmp3);\n        const m256 tmp1 = _mm256_unpackhi_ps(tmp2, tmp3);\n\n        v0.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(tmp0, tmp1));\n        v1.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(tmp0, tmp1));\n    }  // }}}\n    // deinterleave successive 2 {{{\n    static inline void deinterleave(typename V::EntryType const *const data,\n                                    const Common::SuccessiveEntries<2> &i, V &v0, V &v1)\n    {\n        using namespace AVX;\n        const m256 il0123 = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0]])); // a0 b0 a1 b1 a2 b2 a3 b3\n        const m256 il4567 = _mm256_loadu_ps(aliasing_cast<float>(&data[i[4]])); // a4 b4 a5 b5 a6 b6 a7 b7\n\n        const m256 tmp2 = Mem::shuffle128<X0, Y0>(il0123, il4567);\n        const m256 tmp3 = Mem::shuffle128<X1, Y1>(il0123, il4567);\n\n        const m256 tmp0 = _mm256_unpacklo_ps(tmp2, tmp3);\n        const m256 tmp1 = _mm256_unpackhi_ps(tmp2, tmp3);\n\n        v0.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(tmp0, tmp1));\n        v1.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(tmp0, tmp1));\n    }  // }}}\n    // deinterleave scatter 3 {{{\n    template <typename I>\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2)\n    {\n        using namespace AVX;\n        const m128  il0 = _mm_loadu_ps(aliasing_cast<float>(&data[i[0]])); // a0 b0 c0 d0\n        const m128  il1 = _mm_loadu_ps(aliasing_cast<float>(&data[i[1]])); // a1 b1 c1 d1\n        const m128  il2 = _mm_loadu_ps(aliasing_cast<float>(&data[i[2]])); // a2 b2 c2 d2\n        const m128  il3 = _mm_loadu_ps(aliasing_cast<float>(&data[i[3]])); // a3 b3 c3 d3\n        const m128  il4 = _mm_loadu_ps(aliasing_cast<float>(&data[i[4]])); // a4 b4 c4 d4\n        const m128  il5 = _mm_loadu_ps(aliasing_cast<float>(&data[i[5]])); // a5 b5 c5 d5\n        const m128  il6 = _mm_loadu_ps(aliasing_cast<float>(&data[i[6]])); // a6 b6 c6 d6\n        const m128  il7 = _mm_loadu_ps(aliasing_cast<float>(&data[i[7]])); // a7 b7 c7 d7\n\n        const m256 il04 = concat(il0, il4);\n        const m256 il15 = concat(il1, il5);\n        const m256 il26 = concat(il2, il6);\n        const m256 il37 = concat(il3, il7);\n        const m256 ab0246 = _mm256_unpacklo_ps(il04, il26);\n        const m256 ab1357 = _mm256_unpacklo_ps(il15, il37);\n        const m256 cd0246 = _mm256_unpackhi_ps(il04, il26);\n        const m256 cd1357 = _mm256_unpackhi_ps(il15, il37);\n        v0.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(ab0246, ab1357));\n        v1.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(ab0246, ab1357));\n        v2.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(cd0246, cd1357));\n    }  // }}}\n    // deinterleave successive 3 {{{\n    static inline void deinterleave(typename V::EntryType const *const data,\n                                    const Common::SuccessiveEntries<3> &i, V &v0, V &v1,\n                                    V &v2)\n    {\n        // 0a 1a 2a 0b 1b 2b 0c 1c\n        __m256 in0 = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0]] + 0));\n        // 2c 0d 1d 2d 0e 1e 2e 0f\n        __m256 in1 = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0]] + 8));\n        // 1f 2f 0g 1g 2g 0h 1h 2h\n        __m256 in2 = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0]] + 16));\n\n        // swap(v0.hi, v2.lo):\n        //      [0a 1a 2a 0b 1f 2f 0g 1g]\n        //      [2c 0d 1d 2d 0e 1e 2e 0f]\n        //      [1b 2b 0c 1c 2g 0h 1h 2h]\n        const __m256 aaabffgg = _mm256_permute2f128_ps(in0, in2, 0x20);\n        const __m256 cdddeeef = in1;\n        const __m256 bbccghhh = _mm256_permute2f128_ps(in0, in2, 0x31);\n        // blend:\n        // 0: [a d c b e h g f]\n        // 1: [b a d c f e h g]\n        // 2: [c b a d g f e h]\n        const __m256 x0 = _mm256_blend_ps(\n            _mm256_blend_ps(aaabffgg, cdddeeef, 0 + 2 + 0 + 0 + 0x10 + 0 + 0 + 0x80),\n            bbccghhh, 0 + 0 + 4 + 0 + 0 + 0x20 + 0 + 0);\n        const __m256 x1 = _mm256_blend_ps(\n            _mm256_blend_ps(aaabffgg, cdddeeef, 0 + 0 + 4 + 0 + 0 + 0x20 + 0 + 0),\n            bbccghhh, 1 + 0 + 0 + 8 + 0 + 0 + 0x40 + 0);\n        const __m256 x2 = _mm256_blend_ps(\n            _mm256_blend_ps(aaabffgg, cdddeeef, 1 + 0 + 0 + 8 + 0 + 0 + 0x40 + 0),\n            bbccghhh, 0 + 2 + 0 + 0 + 0x10 + 0 + 0 + 0x80);\n        // 0: [a d c b e h g f] >-perm(0, 3, 2, 1)-> [a b c d e f g h]\n        // 1: [b a d c f e h g] >-perm(1, 0, 3, 2)-> [a b c d e f g h]\n        // 2: [c b a d g f e h] >-perm(2, 1, 0, 3)-> [a b c d e f g h]\n        v0 = AVX::avx_cast<typename V::VectorType>(_mm256_shuffle_ps(x0, x0, 0x6c));\n        v1 = AVX::avx_cast<typename V::VectorType>(_mm256_shuffle_ps(x1, x1, 0xb1));\n        v2 = AVX::avx_cast<typename V::VectorType>(_mm256_shuffle_ps(x2, x2, 0xc6));\n    }  // }}}\n    // deinterleave scatter 4 {{{\n    template <typename I>\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2, V &v3)\n    {\n        using namespace AVX;\n        const m128  il0 = _mm_loadu_ps(aliasing_cast<float>(&data[i[0]])); // a0 b0 c0 d0\n        const m128  il1 = _mm_loadu_ps(aliasing_cast<float>(&data[i[1]])); // a1 b1 c1 d1\n        const m128  il2 = _mm_loadu_ps(aliasing_cast<float>(&data[i[2]])); // a2 b2 c2 d2\n        const m128  il3 = _mm_loadu_ps(aliasing_cast<float>(&data[i[3]])); // a3 b3 c3 d3\n        const m128  il4 = _mm_loadu_ps(aliasing_cast<float>(&data[i[4]])); // a4 b4 c4 d4\n        const m128  il5 = _mm_loadu_ps(aliasing_cast<float>(&data[i[5]])); // a5 b5 c5 d5\n        const m128  il6 = _mm_loadu_ps(aliasing_cast<float>(&data[i[6]])); // a6 b6 c6 d6\n        const m128  il7 = _mm_loadu_ps(aliasing_cast<float>(&data[i[7]])); // a7 b7 c7 d7\n\n        const m256 il04 = concat(il0, il4);\n        const m256 il15 = concat(il1, il5);\n        const m256 il26 = concat(il2, il6);\n        const m256 il37 = concat(il3, il7);\n        const m256 ab0246 = _mm256_unpacklo_ps(il04, il26);\n        const m256 ab1357 = _mm256_unpacklo_ps(il15, il37);\n        const m256 cd0246 = _mm256_unpackhi_ps(il04, il26);\n        const m256 cd1357 = _mm256_unpackhi_ps(il15, il37);\n        v0.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(ab0246, ab1357));\n        v1.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(ab0246, ab1357));\n        v2.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(cd0246, cd1357));\n        v3.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(cd0246, cd1357));\n    }  // }}}\n    // deinterleave successive 4 {{{\n    static inline void deinterleave(typename V::EntryType const *const data,\n                                    const Common::SuccessiveEntries<4> &i, V &v0, V &v1,\n                                    V &v2, V &v3)\n    {\n        using namespace AVX;\n        const __m256 il01 = _mm256_loadu_ps(\n            aliasing_cast<float>(&data[i[0]]));  // a0 b0 c0 d0 | a1 b1 c1 d1\n        const __m256 il23 = _mm256_loadu_ps(\n            aliasing_cast<float>(&data[i[2]]));  // a2 b2 c2 d2 | a3 b3 c3 d3\n        const __m256 il45 = _mm256_loadu_ps(\n            aliasing_cast<float>(&data[i[4]]));  // a4 b4 c4 d4 | a5 b5 c5 d5\n        const __m256 il67 = _mm256_loadu_ps(\n            aliasing_cast<float>(&data[i[6]]));  // a6 b6 c6 d6 | a7 b7 c7 d7\n\n        const __m256 il04 = _mm256_permute2f128_ps(il01, il45, 0x20);\n        const __m256 il15 = _mm256_permute2f128_ps(il01, il45, 0x31);\n        const __m256 il26 = _mm256_permute2f128_ps(il23, il67, 0x20);\n        const __m256 il37 = _mm256_permute2f128_ps(il23, il67, 0x31);\n        const __m256 ab0246 = _mm256_unpacklo_ps(il04, il26);\n        const __m256 ab1357 = _mm256_unpacklo_ps(il15, il37);\n        const __m256 cd0246 = _mm256_unpackhi_ps(il04, il26);\n        const __m256 cd1357 = _mm256_unpackhi_ps(il15, il37);\n        v0.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(ab0246, ab1357));\n        v1.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(ab0246, ab1357));\n        v2.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(cd0246, cd1357));\n        v3.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(cd0246, cd1357));\n    }  // }}}\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4)\n    {\n        v4.gather(data + 4, i);\n        deinterleave(data, i, v0, v1, v2, v3);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n    }/*}}}*/\n    static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const Common::SuccessiveEntries<6> &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        using namespace AVX;\n        const m256 a = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0]]));\n        const m256 b = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0] + 1 * V::Size]));\n        const m256 c = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0] + 2 * V::Size]));\n        const m256 d = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0] + 3 * V::Size]));\n        const m256 e = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0] + 4 * V::Size]));\n        const m256 f = _mm256_loadu_ps(aliasing_cast<float>(&data[i[0] + 5 * V::Size]));\n        const __m256 tmp2 = Mem::shuffle128<X0, Y0>(a, d);\n        const __m256 tmp3 = Mem::shuffle128<X1, Y1>(b, e);\n        const __m256 tmp4 = Mem::shuffle128<X1, Y1>(a, d);\n        const __m256 tmp5 = Mem::shuffle128<X0, Y0>(c, f);\n        const __m256 tmp8 = Mem::shuffle128<X0, Y0>(b, e);\n        const __m256 tmp9 = Mem::shuffle128<X1, Y1>(c, f);\n        const __m256 tmp0 = _mm256_unpacklo_ps(tmp2, tmp3);\n        const __m256 tmp1 = _mm256_unpackhi_ps(tmp4, tmp5);\n        const __m256 tmp6 = _mm256_unpackhi_ps(tmp2, tmp3);\n        const __m256 tmp7 = _mm256_unpacklo_ps(tmp8, tmp9);\n        const __m256 tmp10 = _mm256_unpacklo_ps(tmp4, tmp5);\n        const __m256 tmp11 = _mm256_unpackhi_ps(tmp8, tmp9);\n        v0.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(tmp0, tmp1));\n        v1.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(tmp0, tmp1));\n        v2.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(tmp6, tmp7));\n        v3.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(tmp6, tmp7));\n        v4.data() = avx_cast<typename V::VectorType>(_mm256_unpacklo_ps(tmp10, tmp11));\n        v5.data() = avx_cast<typename V::VectorType>(_mm256_unpackhi_ps(tmp10, tmp11));\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5, v6);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6, V &v7)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5, v6, v7);\n    }/*}}}*/\n};\ntemplate<typename V> struct InterleaveImpl<V, 4, 32> {\n    template <typename I>  // interleave 2 args{{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        using namespace AVX;\n        const m256d tmp0 = _mm256_unpacklo_pd(v0.data(), v1.data());\n        const m256d tmp1 = _mm256_unpackhi_pd(v0.data(), v1.data());\n        _mm_storeu_pd(&data[i[0]], lo128(tmp0));\n        _mm_storeu_pd(&data[i[1]], lo128(tmp1));\n        _mm_storeu_pd(&data[i[2]], hi128(tmp0));\n        _mm_storeu_pd(&data[i[3]], hi128(tmp1));\n    }\n    template <typename I>  // interleave 3 args{{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2)\n    {\n        using namespace AVX;\n#ifdef Vc_USE_MASKMOV_SCATTER\n        const m256d tmp0 = _mm256_unpacklo_pd(v0.data(), v1.data());\n        const m256d tmp1 = _mm256_unpackhi_pd(v0.data(), v1.data());\n        const m256d tmp2 = _mm256_unpacklo_pd(v2.data(), v2.data());\n        const m256d tmp3 = _mm256_unpackhi_pd(v2.data(), v2.data());\n\n#if defined(Vc_MSVC) && (Vc_MSVC < 170000000 || !defined(_WIN64))\n        // MSVC needs to be at Version 2012 before _mm256_set_epi64x works\n        const m256i mask = concat(_mm_setallone_si128(), _mm_set_epi32(0, 0, -1, -1));\n#else\n        const m256i mask = _mm256_set_epi64x(0, -1, -1, -1);\n#endif\n        _mm256_maskstore_pd(&data[i[0]], mask, Mem::shuffle128<X0, Y0>(tmp0, tmp2));\n        _mm256_maskstore_pd(&data[i[1]], mask, Mem::shuffle128<X0, Y0>(tmp1, tmp3));\n        _mm256_maskstore_pd(&data[i[2]], mask, Mem::shuffle128<X1, Y1>(tmp0, tmp2));\n        _mm256_maskstore_pd(&data[i[3]], mask, Mem::shuffle128<X1, Y1>(tmp1, tmp3));\n#else\n        interleave(data, i, v0, v1);\n        v2.scatter(data + 2, i);\n#endif\n    }\n    template <typename I>  // interleave 4 args{{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        using namespace AVX;\n        // 0a 1a 0c 1c:\n        const m256d tmp0 = _mm256_unpacklo_pd(v0.data(), v1.data());\n        // 0b 1b 0b 1b:\n        const m256d tmp1 = _mm256_unpackhi_pd(v0.data(), v1.data());\n        // 2a 3a 2c 3c:\n        const m256d tmp2 = _mm256_unpacklo_pd(v2.data(), v3.data());\n        // 2b 3b 2b 3b:\n        const m256d tmp3 = _mm256_unpackhi_pd(v2.data(), v3.data());\n        /* The following might be more efficient once 256-bit stores are not split internally into 2\n         * 128-bit stores.\n        _mm256_storeu_pd(&data[i[0]], Mem::shuffle128<X0, Y0>(tmp0, tmp2));\n        _mm256_storeu_pd(&data[i[1]], Mem::shuffle128<X0, Y0>(tmp1, tmp3));\n        _mm256_storeu_pd(&data[i[2]], Mem::shuffle128<X1, Y1>(tmp0, tmp2));\n        _mm256_storeu_pd(&data[i[3]], Mem::shuffle128<X1, Y1>(tmp1, tmp3));\n        */\n        _mm_storeu_pd(&data[i[0]  ], lo128(tmp0));\n        _mm_storeu_pd(&data[i[0]+2], lo128(tmp2));\n        _mm_storeu_pd(&data[i[1]  ], lo128(tmp1));\n        _mm_storeu_pd(&data[i[1]+2], lo128(tmp3));\n        _mm_storeu_pd(&data[i[2]  ], hi128(tmp0));\n        _mm_storeu_pd(&data[i[2]+2], hi128(tmp2));\n        _mm_storeu_pd(&data[i[3]  ], hi128(tmp1));\n        _mm_storeu_pd(&data[i[3]+2], hi128(tmp3));\n    }\n    template <typename I>  // interleave 5 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        v4.scatter(data + 4, i);\n    }\n    template <typename I>  // interleave 6 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // interleave 7 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // interleave 8 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6, const typename V::AsArg v7)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6, v7);\n    }\n    //}}}2\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1)\n    {\n        using namespace Vc::AVX;\n        const m256d ab02 = concat(_mm_loadu_pd(&data[i[0]]), _mm_loadu_pd(&data[i[2]]));\n        const m256d ab13 = concat(_mm_loadu_pd(&data[i[1]]), _mm_loadu_pd(&data[i[3]]));\n\n        v0.data() = _mm256_unpacklo_pd(ab02, ab13);\n        v1.data() = _mm256_unpackhi_pd(ab02, ab13);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2)\n    {\n        v2.gather(data + 2, i);\n        deinterleave(data, i, v0, v1);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4)\n    {\n        v4.gather(data + 4, i);\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6)\n    {\n        v6.gather(data + 6, i);\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6, V &v7)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n        deinterleave(data + 6, i, v6, v7);\n    }/*}}}*/\n};\n//}}}1\n}  // namespace Detail\n}  // namespace Vc\n\n#endif  // VC_AVX_DETAIL_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/helperimpl.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_HELPERIMPL_H_\n#define VC_AVX_HELPERIMPL_H_\n\n#include \"../sse/helperimpl.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <typename A>\ninline void deinterleave(AVX2::float_v &, AVX2::float_v &, const float *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::float_v &, AVX2::float_v &, const short *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::float_v &, AVX2::float_v &, const ushort *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::double_v &, AVX2::double_v &, const double *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::int_v &, AVX2::int_v &, const int *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::int_v &, AVX2::int_v &, const short *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::uint_v &, AVX2::uint_v &, const uint *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::uint_v &, AVX2::uint_v &, const ushort *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::short_v &, AVX2::short_v &, const short *, A);\ntemplate <typename A>\ninline void deinterleave(AVX2::ushort_v &, AVX2::ushort_v &, const ushort *, A);\n\ntemplate <typename T, typename M, typename A>\nVc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,\n                                     AVX2::Vector<T> &Vc_RESTRICT b,\n                                     AVX2::Vector<T> &Vc_RESTRICT c,\n                                     const M *Vc_RESTRICT memory,\n                                     A align) Vc_ALWAYS_INLINE_R;\ntemplate <typename T, typename M, typename A>\nVc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,\n                                     AVX2::Vector<T> &Vc_RESTRICT b,\n                                     AVX2::Vector<T> &Vc_RESTRICT c,\n                                     AVX2::Vector<T> &Vc_RESTRICT d,\n                                     const M *Vc_RESTRICT memory,\n                                     A align) Vc_ALWAYS_INLINE_R;\ntemplate <typename T, typename M, typename A>\nVc_ALWAYS_INLINE_L void deinterleave(AVX2::Vector<T> &Vc_RESTRICT a,\n                                     AVX2::Vector<T> &Vc_RESTRICT b,\n                                     AVX2::Vector<T> &Vc_RESTRICT c,\n                                     AVX2::Vector<T> &Vc_RESTRICT d,\n                                     AVX2::Vector<T> &Vc_RESTRICT e,\n                                     const M *Vc_RESTRICT memory,\n                                     A align) Vc_ALWAYS_INLINE_R;\ntemplate <typename T, typename M, typename A>\nVc_ALWAYS_INLINE_L void deinterleave(\n    AVX2::Vector<T> &Vc_RESTRICT a, AVX2::Vector<T> &Vc_RESTRICT b,\n    AVX2::Vector<T> &Vc_RESTRICT c, AVX2::Vector<T> &Vc_RESTRICT d,\n    AVX2::Vector<T> &Vc_RESTRICT e, AVX2::Vector<T> &Vc_RESTRICT f,\n    const M *Vc_RESTRICT memory, A align) Vc_ALWAYS_INLINE_R;\ntemplate <typename T, typename M, typename A>\nVc_ALWAYS_INLINE_L void deinterleave(\n    AVX2::Vector<T> &Vc_RESTRICT a, AVX2::Vector<T> &Vc_RESTRICT b,\n    AVX2::Vector<T> &Vc_RESTRICT c, AVX2::Vector<T> &Vc_RESTRICT d,\n    AVX2::Vector<T> &Vc_RESTRICT e, AVX2::Vector<T> &Vc_RESTRICT f,\n    AVX2::Vector<T> &Vc_RESTRICT g, AVX2::Vector<T> &Vc_RESTRICT h,\n    const M *Vc_RESTRICT memory, A align) Vc_ALWAYS_INLINE_R;\n\nVc_ALWAYS_INLINE void prefetchForOneRead(const void *addr, VectorAbi::Avx)\n{\n    prefetchForOneRead(addr, VectorAbi::Sse());\n}\nVc_ALWAYS_INLINE void prefetchForModify(const void *addr, VectorAbi::Avx)\n{\n    prefetchForModify(addr, VectorAbi::Sse());\n}\nVc_ALWAYS_INLINE void prefetchClose(const void *addr, VectorAbi::Avx)\n{\n    prefetchClose(addr, VectorAbi::Sse());\n}\nVc_ALWAYS_INLINE void prefetchMid(const void *addr, VectorAbi::Avx)\n{\n    prefetchMid(addr, VectorAbi::Sse());\n}\nVc_ALWAYS_INLINE void prefetchFar(const void *addr, VectorAbi::Avx)\n{\n    prefetchFar(addr, VectorAbi::Sse());\n}\n}  // namespace Detail\n}  // namespace Vc\n\n#include \"deinterleave.tcc\"\n\n#endif // VC_AVX_HELPERIMPL_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/intrinsics.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_INTRINSICS_H_\n#define VC_AVX_INTRINSICS_H_\n\n#include \"../global.h\"\n#include \"../traits/type_traits.h\"\n\n// see comment in sse/intrinsics.h\nextern \"C\" {\n// AVX\n#include <immintrin.h>\n\n#if (defined(Vc_IMPL_XOP) || defined(Vc_IMPL_FMA4)) && !defined(Vc_MSVC)\n#include <x86intrin.h>\n#endif\n}\n\n#include \"../common/fix_clang_emmintrin.h\"\n\n#include \"const_data.h\"\n#include \"../common/types.h\"\n#include \"macros.h\"\n#include <cstdlib>\n\n#if (defined Vc_CLANG && Vc_CLANG >= 0x30900 && Vc_CLANG < 0x70000)\n#ifdef _mm256_permute2f128_si256\n#undef _mm256_permute2f128_si256\n#define _mm256_permute2f128_si256(V1, V2, M) __extension__ ({ \\\n  (__m256i)__builtin_ia32_vperm2f128_si256((__v8si)(__m256i)(V1), \\\n                                           (__v8si)(__m256i)(V2), (char)(M)); })\n#endif\n\n#ifdef _mm256_permute2f128_ps\n#undef _mm256_permute2f128_ps\n#define _mm256_permute2f128_ps(V1, V2, M) __extension__ ({ \\\n  (__m256)__builtin_ia32_vperm2f128_ps256((__v8sf)(__m256)(V1), \\\n                                          (__v8sf)(__m256)(V2), (char)(M)); })\n#endif\n\n#ifdef _mm256_permute2x128_si256\n#undef _mm256_permute2x128_si256\n#define _mm256_permute2x128_si256(V1, V2, M) __extension__ ({ \\\n  (__m256i)__builtin_ia32_permti256((__m256i)(V1), (__m256i)(V2), (char)(M)); })\n#endif\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AvxIntrinsics\n{\n    using AVX::c_general;\n    using AVX::_IndexesFromZero32;\n    using AVX::_IndexesFromZero16;\n    using AVX::_IndexesFromZero8;\n\n    typedef __m128  m128 ;\n    typedef __m128d m128d;\n    typedef __m128i m128i;\n    typedef __m256  m256 ;\n    typedef __m256d m256d;\n    typedef __m256i m256i;\n\n#ifdef Vc_GCC\n    // Redefine the mul/add/sub intrinsics to use GCC-specific operators instead of builtin\n    // functions. This way the fp-contraction optimization step kicks in and creates FMAs! :)\n    static Vc_INTRINSIC Vc_CONST m256d _mm256_mul_pd(m256d a, m256d b) { return static_cast<m256d>(static_cast<__v4df>(a) * static_cast<__v4df>(b)); }\n    static Vc_INTRINSIC Vc_CONST m256d _mm256_add_pd(m256d a, m256d b) { return static_cast<m256d>(static_cast<__v4df>(a) + static_cast<__v4df>(b)); }\n    static Vc_INTRINSIC Vc_CONST m256d _mm256_sub_pd(m256d a, m256d b) { return static_cast<m256d>(static_cast<__v4df>(a) - static_cast<__v4df>(b)); }\n    static Vc_INTRINSIC Vc_CONST m256 _mm256_mul_ps(m256 a, m256 b) { return static_cast<m256>(static_cast<__v8sf>(a) * static_cast<__v8sf>(b)); }\n    static Vc_INTRINSIC Vc_CONST m256 _mm256_add_ps(m256 a, m256 b) { return static_cast<m256>(static_cast<__v8sf>(a) + static_cast<__v8sf>(b)); }\n    static Vc_INTRINSIC Vc_CONST m256 _mm256_sub_ps(m256 a, m256 b) { return static_cast<m256>(static_cast<__v8sf>(a) - static_cast<__v8sf>(b)); }\n#endif\n\n    static Vc_INTRINSIC m256d Vc_CONST set1_pd   (double a) { return _mm256_set1_pd   (a); }\n    static Vc_INTRINSIC m256i Vc_CONST set1_epi32(int    a) { return _mm256_set1_epi32(a); }\n\n    static Vc_INTRINSIC Vc_CONST m128i _mm_setallone_si128() { return _mm_load_si128(reinterpret_cast<const __m128i *>(Common::AllBitsSet)); }\n    static Vc_INTRINSIC Vc_CONST m128  _mm_setallone_ps() { return _mm_load_ps(reinterpret_cast<const float *>(Common::AllBitsSet)); }\n    static Vc_INTRINSIC Vc_CONST m128d _mm_setallone_pd() { return _mm_load_pd(reinterpret_cast<const double *>(Common::AllBitsSet)); }\n\n    static Vc_INTRINSIC Vc_CONST m256i setallone_si256() { return _mm256_castps_si256(_mm256_load_ps(reinterpret_cast<const float *>(Common::AllBitsSet))); }\n    static Vc_INTRINSIC Vc_CONST m256d setallone_pd() { return _mm256_load_pd(reinterpret_cast<const double *>(Common::AllBitsSet)); }\n    static Vc_INTRINSIC Vc_CONST m256  setallone_ps() { return _mm256_load_ps(reinterpret_cast<const float *>(Common::AllBitsSet)); }\n\n    static Vc_INTRINSIC m256i Vc_CONST setone_epi8 ()  { return _mm256_set1_epi8(1); }\n    static Vc_INTRINSIC m256i Vc_CONST setone_epu8 ()  { return setone_epi8(); }\n    static Vc_INTRINSIC m256i Vc_CONST setone_epi16()  { return _mm256_castps_si256(_mm256_broadcast_ss(reinterpret_cast<const float *>(c_general::one16))); }\n    static Vc_INTRINSIC m256i Vc_CONST setone_epu16()  { return setone_epi16(); }\n    static Vc_INTRINSIC m256i Vc_CONST setone_epi32()  { return _mm256_castps_si256(_mm256_broadcast_ss(reinterpret_cast<const float *>(&_IndexesFromZero32[1]))); }\n    static Vc_INTRINSIC m256i Vc_CONST setone_epu32()  { return setone_epi32(); }\n\n    static Vc_INTRINSIC m256  Vc_CONST setone_ps()     { return _mm256_broadcast_ss(&c_general::oneFloat); }\n    static Vc_INTRINSIC m256d Vc_CONST setone_pd()     { return _mm256_broadcast_sd(&c_general::oneDouble); }\n\n    static Vc_INTRINSIC m256d Vc_CONST setabsmask_pd() { return _mm256_broadcast_sd(reinterpret_cast<const double *>(&c_general::absMaskFloat[0])); }\n    static Vc_INTRINSIC m256  Vc_CONST setabsmask_ps() { return _mm256_broadcast_ss(reinterpret_cast<const float *>(&c_general::absMaskFloat[1])); }\n    static Vc_INTRINSIC m256d Vc_CONST setsignmask_pd(){ return _mm256_broadcast_sd(reinterpret_cast<const double *>(&c_general::signMaskFloat[0])); }\n    static Vc_INTRINSIC m256  Vc_CONST setsignmask_ps(){ return _mm256_broadcast_ss(reinterpret_cast<const float *>(&c_general::signMaskFloat[1])); }\n\n    static Vc_INTRINSIC m256  Vc_CONST set2power31_ps()    { return _mm256_broadcast_ss(&c_general::_2power31); }\n    static Vc_INTRINSIC m128  Vc_CONST _mm_set2power31_ps()    { return _mm_broadcast_ss(&c_general::_2power31); }\n    static Vc_INTRINSIC m256i Vc_CONST set2power31_epu32() { return _mm256_castps_si256(_mm256_broadcast_ss(reinterpret_cast<const float *>(&c_general::signMaskFloat[1]))); }\n    static Vc_INTRINSIC m128i Vc_CONST _mm_set2power31_epu32() { return _mm_castps_si128(_mm_broadcast_ss(reinterpret_cast<const float *>(&c_general::signMaskFloat[1]))); }\n\n    static Vc_INTRINSIC m256i Vc_CONST setmin_epi8 () { return _mm256_set1_epi8(-0x80); }\n    static Vc_INTRINSIC m128i Vc_CONST _mm_setmin_epi16() { return _mm_castps_si128(_mm_broadcast_ss(reinterpret_cast<const float *>(c_general::minShort))); }\n    static Vc_INTRINSIC m128i Vc_CONST _mm_setmin_epi32() { return _mm_castps_si128(_mm_broadcast_ss(reinterpret_cast<const float *>(&c_general::signMaskFloat[1]))); }\n    static Vc_INTRINSIC m256i Vc_CONST setmin_epi16() { return _mm256_castps_si256(_mm256_broadcast_ss(reinterpret_cast<const float *>(c_general::minShort))); }\n    static Vc_INTRINSIC m256i Vc_CONST setmin_epi32() { return _mm256_castps_si256(_mm256_broadcast_ss(reinterpret_cast<const float *>(&c_general::signMaskFloat[1]))); }\n\n    template <int i>\n    static Vc_INTRINSIC Vc_CONST unsigned int extract_epu32(__m128i x)\n    {\n        return _mm_extract_epi32(x, i);\n    }\n\n    template <int offset> Vc_INTRINSIC __m256  insert128(__m256  a, __m128  b) { return _mm256_insertf128_ps(a, b, offset); }\n    template <int offset> Vc_INTRINSIC __m256d insert128(__m256d a, __m128d b) { return _mm256_insertf128_pd(a, b, offset); }\n    template <int offset> Vc_INTRINSIC __m256i insert128(__m256i a, __m128i b) {\n#ifdef Vc_IMPL_AVX2\n        return _mm256_inserti128_si256(a, b, offset);\n#else\n        return _mm256_insertf128_si256(a, b, offset);\n#endif\n    }\n\n    template <int offset> Vc_INTRINSIC __m128  extract128(__m256  a) { return _mm256_extractf128_ps(a, offset); }\n    template <int offset> Vc_INTRINSIC __m128d extract128(__m256d a) { return _mm256_extractf128_pd(a, offset); }\n    template <int offset> Vc_INTRINSIC __m128i extract128(__m256i a) {\n#ifdef Vc_IMPL_AVX2\n        return _mm256_extracti128_si256(a, offset);\n#else\n        return _mm256_extractf128_si256(a, offset);\n#endif\n    }\n\n    /////////////////////// COMPARE OPS ///////////////////////\n#ifdef Vc_GCC\n    // GCC needs builtin compare operators to enable constant folding\n    Vc_INTRINSIC __m256d cmpeq_pd   (__m256d a, __m256d b) { return reinterpret_cast<__m256d>(a == b); }\n    Vc_INTRINSIC __m256d cmpneq_pd  (__m256d a, __m256d b) { return reinterpret_cast<__m256d>(a != b); }\n    Vc_INTRINSIC __m256d cmplt_pd   (__m256d a, __m256d b) { return reinterpret_cast<__m256d>(a < b); }\n    Vc_INTRINSIC __m256d cmpge_pd   (__m256d a, __m256d b) { return reinterpret_cast<__m256d>(a >= b); }\n    Vc_INTRINSIC __m256d cmple_pd   (__m256d a, __m256d b) { return reinterpret_cast<__m256d>(a <= b); }\n    Vc_INTRINSIC __m256d cmpgt_pd   (__m256d a, __m256d b) { return reinterpret_cast<__m256d>(a > b); }\n\n    Vc_INTRINSIC __m256  cmpeq_ps   (__m256  a, __m256  b) { return reinterpret_cast<__m256 >(a == b); }\n    Vc_INTRINSIC __m256  cmpneq_ps  (__m256  a, __m256  b) { return reinterpret_cast<__m256 >(a != b); }\n    Vc_INTRINSIC __m256  cmplt_ps   (__m256  a, __m256  b) { return reinterpret_cast<__m256 >(a < b); }\n    Vc_INTRINSIC __m256  cmpge_ps   (__m256  a, __m256  b) { return reinterpret_cast<__m256 >(a >= b); }\n    Vc_INTRINSIC __m256  cmple_ps   (__m256  a, __m256  b) { return reinterpret_cast<__m256 >(a <= b); }\n    Vc_INTRINSIC __m256  cmpgt_ps   (__m256  a, __m256  b) { return reinterpret_cast<__m256 >(a > b); }\n#else\n    Vc_INTRINSIC __m256d cmpeq_pd   (__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_EQ_OQ); }\n    Vc_INTRINSIC __m256d cmpneq_pd  (__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_NEQ_UQ); }\n    Vc_INTRINSIC __m256d cmplt_pd   (__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_LT_OS); }\n    Vc_INTRINSIC __m256d cmpge_pd   (__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_NLT_US); }\n    Vc_INTRINSIC __m256d cmple_pd   (__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_LE_OS); }\n    Vc_INTRINSIC __m256d cmpgt_pd   (__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_NLE_US); }\n\n    Vc_INTRINSIC __m256  cmpeq_ps   (__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_EQ_OQ); }\n    Vc_INTRINSIC __m256  cmpneq_ps  (__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_NEQ_UQ); }\n    Vc_INTRINSIC __m256  cmplt_ps   (__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_LT_OS); }\n    Vc_INTRINSIC __m256  cmpge_ps   (__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_NLT_US); }\n    Vc_INTRINSIC __m256  cmple_ps   (__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_LE_OS); }\n    Vc_INTRINSIC __m256  cmpgt_ps   (__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_NLE_US); }\n#endif\n    Vc_INTRINSIC __m256d cmpnlt_pd  (__m256d a, __m256d b) { return cmpge_pd(a, b); }\n    Vc_INTRINSIC __m256d cmpnle_pd  (__m256d a, __m256d b) { return cmpgt_pd(a, b); }\n    Vc_INTRINSIC __m256  cmpnlt_ps  (__m256  a, __m256  b) { return cmpge_ps(a, b); }\n    Vc_INTRINSIC __m256  cmpnle_ps  (__m256  a, __m256  b) { return cmpgt_ps(a, b); }\n\n    Vc_INTRINSIC __m256d cmpord_pd  (__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_ORD_Q); }\n    Vc_INTRINSIC __m256d cmpunord_pd(__m256d a, __m256d b) { return _mm256_cmp_pd(a, b, _CMP_UNORD_Q); }\n    Vc_INTRINSIC __m256  cmpord_ps  (__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_ORD_Q); }\n    Vc_INTRINSIC __m256  cmpunord_ps(__m256  a, __m256  b) { return _mm256_cmp_ps(a, b, _CMP_UNORD_Q); }\n\n#if defined(Vc_IMPL_XOP)\n    static Vc_INTRINSIC m128i cmplt_epu16(__m128i a, __m128i b) {\n        return _mm_comlt_epu16(a, b);\n    }\n    static Vc_INTRINSIC m128i cmpgt_epu16(__m128i a, __m128i b) {\n        return _mm_comgt_epu16(a, b);\n    }\n#else\n    static Vc_INTRINSIC m128i cmplt_epu16(__m128i a, __m128i b) {\n        return _mm_cmplt_epi16(_mm_xor_si128(a, _mm_setmin_epi16()), _mm_xor_si128(b, _mm_setmin_epi16()));\n    }\n    static Vc_INTRINSIC m128i cmpgt_epu16(__m128i a, __m128i b) {\n        return _mm_cmpgt_epi16(_mm_xor_si128(a, _mm_setmin_epi16()), _mm_xor_si128(b, _mm_setmin_epi16()));\n    }\n#endif\n\n#ifdef Vc_IMPL_AVX2\n    template <int shift> Vc_INTRINSIC Vc_CONST m256i alignr(__m256i s1, __m256i s2)\n    {\n        return _mm256_alignr_epi8(s1, s2, shift);\n    }\n#else\n    template <int shift> Vc_INTRINSIC Vc_CONST m256i alignr(__m256i s1, __m256i s2)\n    {\n        return insert128<1>(\n            _mm256_castsi128_si256(_mm_alignr_epi8(_mm256_castsi256_si128(s1),\n                                                   _mm256_castsi256_si128(s2), shift)),\n            _mm_alignr_epi8(extract128<1>(s1), extract128<1>(s2), shift));\n    }\n#endif\n\n#ifdef Vc_IMPL_AVX2\n#define Vc_AVX_TO_SSE_2_NEW(name)                                                        \\\n    Vc_INTRINSIC Vc_CONST m256i name(__m256i a0, __m256i b0)                             \\\n    {                                                                                    \\\n        return _mm256_##name(a0, b0);                                                    \\\n    }\n#define Vc_AVX_TO_SSE_256_128(name)                                                      \\\n    Vc_INTRINSIC Vc_CONST m256i name(__m256i a0, __m128i b0)                             \\\n    {                                                                                    \\\n        return _mm256_##name(a0, b0);                                                    \\\n    }\n#define Vc_AVX_TO_SSE_1i(name)                                                           \\\n    template <int i> Vc_INTRINSIC Vc_CONST m256i name(__m256i a0)                        \\\n    {                                                                                    \\\n        return _mm256_##name(a0, i);                                                     \\\n    }\n#define Vc_AVX_TO_SSE_1(name)                                                            \\\n    Vc_INTRINSIC Vc_CONST __m256i name(__m256i a0) { return _mm256_##name(a0); }\n#define Vc_AVX_TO_SSE_1_128(name, shift__)                                               \\\n    Vc_INTRINSIC Vc_CONST __m256i name(__m128i a0) { return _mm256_##name(a0); }\n#else\n/**\\internal\n * Defines the function \\p name, which takes to __m256i arguments and calls `_mm_##name` on the low\n * and high 128 bit halfs of the arguments.\n *\n * In case the AVX2 intrinsics are enabled, the arguments are directly passed to a single\n * `_mm256_##name` call.\n */\n#define Vc_AVX_TO_SSE_1(name)                                                            \\\n    Vc_INTRINSIC Vc_CONST __m256i name(__m256i a0)                                       \\\n    {                                                                                    \\\n        __m128i a1 = extract128<1>(a0);                                                  \\\n        __m128i r0 = _mm_##name(_mm256_castsi256_si128(a0));                             \\\n        __m128i r1 = _mm_##name(a1);                                                     \\\n        return insert128<1>(_mm256_castsi128_si256(r0), r1);                             \\\n    }\n#define Vc_AVX_TO_SSE_1_128(name, shift__)                                               \\\n    Vc_INTRINSIC Vc_CONST __m256i name(__m128i a0)                                       \\\n    {                                                                                    \\\n        __m128i r0 = _mm_##name(a0);                                                     \\\n        __m128i r1 = _mm_##name(_mm_srli_si128(a0, shift__));                            \\\n        return insert128<1>(_mm256_castsi128_si256(r0), r1);                             \\\n    }\n#define Vc_AVX_TO_SSE_2_NEW(name)                                                        \\\n    Vc_INTRINSIC Vc_CONST m256i name(__m256i a0, __m256i b0)                             \\\n    {                                                                                    \\\n        m128i a1 = extract128<1>(a0);                                                    \\\n        m128i b1 = extract128<1>(b0);                                                    \\\n        m128i r0 = _mm_##name(_mm256_castsi256_si128(a0), _mm256_castsi256_si128(b0));   \\\n        m128i r1 = _mm_##name(a1, b1);                                                   \\\n        return insert128<1>(_mm256_castsi128_si256(r0), r1);                             \\\n    }\n#define Vc_AVX_TO_SSE_256_128(name)                                                      \\\n    Vc_INTRINSIC Vc_CONST m256i name(__m256i a0, __m128i b0)                             \\\n    {                                                                                    \\\n        m128i a1 = extract128<1>(a0);                                                    \\\n        m128i r0 = _mm_##name(_mm256_castsi256_si128(a0), b0);                           \\\n        m128i r1 = _mm_##name(a1, b0);                                                   \\\n        return insert128<1>(_mm256_castsi128_si256(r0), r1);                             \\\n    }\n#define Vc_AVX_TO_SSE_1i(name)                                                           \\\n    template <int i> Vc_INTRINSIC Vc_CONST m256i name(__m256i a0)                        \\\n    {                                                                                    \\\n        m128i a1 = extract128<1>(a0);                                                    \\\n        m128i r0 = _mm_##name(_mm256_castsi256_si128(a0), i);                            \\\n        m128i r1 = _mm_##name(a1, i);                                                    \\\n        return insert128<1>(_mm256_castsi128_si256(r0), r1);                             \\\n    }\n#endif\n    Vc_INTRINSIC Vc_CONST __m128i sll_epi16(__m128i a, __m128i b) { return _mm_sll_epi16(a, b); }\n    Vc_INTRINSIC Vc_CONST __m128i sll_epi32(__m128i a, __m128i b) { return _mm_sll_epi32(a, b); }\n    Vc_INTRINSIC Vc_CONST __m128i sll_epi64(__m128i a, __m128i b) { return _mm_sll_epi64(a, b); }\n    Vc_INTRINSIC Vc_CONST __m128i srl_epi16(__m128i a, __m128i b) { return _mm_srl_epi16(a, b); }\n    Vc_INTRINSIC Vc_CONST __m128i srl_epi32(__m128i a, __m128i b) { return _mm_srl_epi32(a, b); }\n    Vc_INTRINSIC Vc_CONST __m128i srl_epi64(__m128i a, __m128i b) { return _mm_srl_epi64(a, b); }\n    Vc_INTRINSIC Vc_CONST __m128i sra_epi16(__m128i a, __m128i b) { return _mm_sra_epi16(a, b); }\n    Vc_INTRINSIC Vc_CONST __m128i sra_epi32(__m128i a, __m128i b) { return _mm_sra_epi32(a, b); }\n\n    Vc_AVX_TO_SSE_1i(slli_epi16)\n    Vc_AVX_TO_SSE_1i(slli_epi32)\n    Vc_AVX_TO_SSE_1i(slli_epi64)\n    Vc_AVX_TO_SSE_1i(srai_epi16)\n    Vc_AVX_TO_SSE_1i(srai_epi32)\n    Vc_AVX_TO_SSE_1i(srli_epi16)\n    Vc_AVX_TO_SSE_1i(srli_epi32)\n    Vc_AVX_TO_SSE_1i(srli_epi64)\n\n    Vc_AVX_TO_SSE_256_128(sll_epi16)\n    Vc_AVX_TO_SSE_256_128(sll_epi32)\n    Vc_AVX_TO_SSE_256_128(sll_epi64)\n    Vc_AVX_TO_SSE_256_128(srl_epi16)\n    Vc_AVX_TO_SSE_256_128(srl_epi32)\n    Vc_AVX_TO_SSE_256_128(srl_epi64)\n    Vc_AVX_TO_SSE_256_128(sra_epi16)\n    Vc_AVX_TO_SSE_256_128(sra_epi32)\n\n    Vc_AVX_TO_SSE_2_NEW(cmpeq_epi8)\n    Vc_AVX_TO_SSE_2_NEW(cmpeq_epi16)\n    Vc_AVX_TO_SSE_2_NEW(cmpeq_epi32)\n    Vc_AVX_TO_SSE_2_NEW(cmpeq_epi64)\n    Vc_AVX_TO_SSE_2_NEW(cmpgt_epi8)\n    Vc_AVX_TO_SSE_2_NEW(cmpgt_epi16)\n    Vc_AVX_TO_SSE_2_NEW(cmpgt_epi32)\n    Vc_AVX_TO_SSE_2_NEW(cmpgt_epi64)\n    Vc_AVX_TO_SSE_2_NEW(unpackhi_epi16)\n    Vc_AVX_TO_SSE_2_NEW(unpacklo_epi16)\n    Vc_AVX_TO_SSE_2_NEW(add_epi16)\n    Vc_AVX_TO_SSE_2_NEW(add_epi32)\n    Vc_AVX_TO_SSE_2_NEW(add_epi64)\n    Vc_AVX_TO_SSE_2_NEW(sub_epi16)\n    Vc_AVX_TO_SSE_2_NEW(sub_epi32)\n    Vc_AVX_TO_SSE_2_NEW(mullo_epi16)\n    Vc_AVX_TO_SSE_2_NEW(sign_epi16)\n    Vc_AVX_TO_SSE_2_NEW(sign_epi32)\n    Vc_AVX_TO_SSE_2_NEW(min_epi8)\n    Vc_AVX_TO_SSE_2_NEW(max_epi8)\n    Vc_AVX_TO_SSE_2_NEW(min_epu16)\n    Vc_AVX_TO_SSE_2_NEW(max_epu16)\n    Vc_AVX_TO_SSE_2_NEW(min_epi32)\n    Vc_AVX_TO_SSE_2_NEW(max_epi32)\n    Vc_AVX_TO_SSE_2_NEW(min_epu32)\n    Vc_AVX_TO_SSE_2_NEW(max_epu32)\n    Vc_AVX_TO_SSE_2_NEW(mullo_epi32)\n\n    Vc_AVX_TO_SSE_1(abs_epi8)\n    Vc_AVX_TO_SSE_1(abs_epi16)\n    Vc_AVX_TO_SSE_1(abs_epi32)\n    Vc_AVX_TO_SSE_1_128(cvtepi8_epi16, 8)\n    Vc_AVX_TO_SSE_1_128(cvtepi8_epi32, 4)\n    Vc_AVX_TO_SSE_1_128(cvtepi8_epi64, 2)\n    Vc_AVX_TO_SSE_1_128(cvtepi16_epi32, 8)\n    Vc_AVX_TO_SSE_1_128(cvtepi16_epi64, 4)\n    Vc_AVX_TO_SSE_1_128(cvtepi32_epi64, 8)\n    Vc_AVX_TO_SSE_1_128(cvtepu8_epi16, 8)\n    Vc_AVX_TO_SSE_1_128(cvtepu8_epi32, 4)\n    Vc_AVX_TO_SSE_1_128(cvtepu8_epi64, 2)\n    Vc_AVX_TO_SSE_1_128(cvtepu16_epi32, 8)\n    Vc_AVX_TO_SSE_1_128(cvtepu16_epi64, 4)\n    Vc_AVX_TO_SSE_1_128(cvtepu32_epi64, 8)\n#ifndef Vc_IMPL_AVX2\n\n/////////////////////////////////////////////////////////////////////////\n// implementation of the intrinsics missing in AVX\n/////////////////////////////////////////////////////////////////////////\n\n    static Vc_INTRINSIC m256i Vc_CONST and_si256(__m256i x, __m256i y) {\n        return _mm256_castps_si256(_mm256_and_ps(_mm256_castsi256_ps(x), _mm256_castsi256_ps(y)));\n    }\n    static Vc_INTRINSIC m256i Vc_CONST andnot_si256(__m256i x, __m256i y) {\n        return _mm256_castps_si256(_mm256_andnot_ps(_mm256_castsi256_ps(x), _mm256_castsi256_ps(y)));\n    }\n    static Vc_INTRINSIC m256i Vc_CONST or_si256(__m256i x, __m256i y) {\n        return _mm256_castps_si256(_mm256_or_ps(_mm256_castsi256_ps(x), _mm256_castsi256_ps(y)));\n    }\n    static Vc_INTRINSIC m256i Vc_CONST xor_si256(__m256i x, __m256i y) {\n        return _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(x), _mm256_castsi256_ps(y)));\n    }\n\n    Vc_INTRINSIC Vc_CONST int movemask_epi8(__m256i a0)\n    {\n        m128i a1 = extract128<1>(a0);\n        return (_mm_movemask_epi8(a1) << 16) | _mm_movemask_epi8(_mm256_castsi256_si128(a0));\n    }\n    template <int m> Vc_INTRINSIC Vc_CONST m256i blend_epi16(__m256i a0, __m256i b0)\n    {\n        m128i a1 = extract128<1>(a0);\n        m128i b1 = extract128<1>(b0);\n        m128i r0 = _mm_blend_epi16(_mm256_castsi256_si128(a0), _mm256_castsi256_si128(b0), m & 0xff);\n        m128i r1 = _mm_blend_epi16(a1, b1, m >> 8);\n        return insert128<1>(_mm256_castsi128_si256(r0), r1);\n    }\n    Vc_INTRINSIC Vc_CONST m256i blendv_epi8(__m256i a0, __m256i b0, __m256i m0) {\n        m128i a1 = extract128<1>(a0);\n        m128i b1 = extract128<1>(b0);\n        m128i m1 = extract128<1>(m0);\n        m128i r0 = _mm_blendv_epi8(_mm256_castsi256_si128(a0), _mm256_castsi256_si128(b0), _mm256_castsi256_si128(m0));\n        m128i r1 = _mm_blendv_epi8(a1, b1, m1);\n        return insert128<1>(_mm256_castsi128_si256(r0), r1);\n    }\n    // mpsadbw_epu8 (__m128i __X, __m128i __Y, const int __M)\n\n#else // Vc_IMPL_AVX2\n\nstatic Vc_INTRINSIC Vc_CONST m256i xor_si256(__m256i x, __m256i y) { return _mm256_xor_si256(x, y); }\nstatic Vc_INTRINSIC Vc_CONST m256i or_si256(__m256i x, __m256i y) { return _mm256_or_si256(x, y); }\nstatic Vc_INTRINSIC Vc_CONST m256i and_si256(__m256i x, __m256i y) { return _mm256_and_si256(x, y); }\nstatic Vc_INTRINSIC Vc_CONST m256i andnot_si256(__m256i x, __m256i y) { return _mm256_andnot_si256(x, y); }\n\n/////////////////////////////////////////////////////////////////////////\n// implementation of the intrinsics missing in AVX2\n/////////////////////////////////////////////////////////////////////////\nVc_INTRINSIC Vc_CONST m256i blendv_epi8(__m256i a0, __m256i b0, __m256i m0)\n{\n    return _mm256_blendv_epi8(a0, b0, m0);\n}\nVc_INTRINSIC Vc_CONST int movemask_epi8(__m256i a0)\n{\n    return _mm256_movemask_epi8(a0);\n}\n\n#endif // Vc_IMPL_AVX2\n\n/////////////////////////////////////////////////////////////////////////\n// implementation of intrinsics missing in AVX and AVX2\n/////////////////////////////////////////////////////////////////////////\n\nstatic Vc_INTRINSIC m256i cmplt_epi64(__m256i a, __m256i b) {\n    return cmpgt_epi64(b, a);\n}\nstatic Vc_INTRINSIC m256i cmplt_epi32(__m256i a, __m256i b) {\n    return cmpgt_epi32(b, a);\n}\nstatic Vc_INTRINSIC m256i cmplt_epi16(__m256i a, __m256i b) {\n    return cmpgt_epi16(b, a);\n}\nstatic Vc_INTRINSIC m256i cmplt_epi8(__m256i a, __m256i b) {\n    return cmpgt_epi8(b, a);\n}\n\nstatic Vc_INTRINSIC m256i cmpgt_epu8(__m256i a, __m256i b) {\n    return cmpgt_epi8(xor_si256(a, setmin_epi8()), xor_si256(b, setmin_epi8()));\n}\n#if defined(Vc_IMPL_XOP)\n    Vc_AVX_TO_SSE_2_NEW(comlt_epu32)\n    Vc_AVX_TO_SSE_2_NEW(comgt_epu32)\n    Vc_AVX_TO_SSE_2_NEW(comlt_epu16)\n    Vc_AVX_TO_SSE_2_NEW(comgt_epu16)\n    static Vc_INTRINSIC m256i Vc_CONST cmplt_epu32(__m256i a, __m256i b) { return comlt_epu32(a, b); }\n    static Vc_INTRINSIC m256i Vc_CONST cmpgt_epu32(__m256i a, __m256i b) { return comgt_epu32(a, b); }\n    static Vc_INTRINSIC m256i Vc_CONST cmplt_epu16(__m256i a, __m256i b) { return comlt_epu16(a, b); }\n    static Vc_INTRINSIC m256i Vc_CONST cmpgt_epu16(__m256i a, __m256i b) { return comgt_epu16(a, b); }\n#else\n    static Vc_INTRINSIC m256i Vc_CONST cmplt_epu32(__m256i _a, __m256i _b) {\n        m256i a = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_a), _mm256_castsi256_ps(setmin_epi32())));\n        m256i b = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_b), _mm256_castsi256_ps(setmin_epi32())));\n        return cmplt_epi32(a, b);\n    }\n    static Vc_INTRINSIC m256i Vc_CONST cmpgt_epu32(__m256i _a, __m256i _b) {\n        m256i a = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_a), _mm256_castsi256_ps(setmin_epi32())));\n        m256i b = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_b), _mm256_castsi256_ps(setmin_epi32())));\n        return cmpgt_epi32(a, b);\n    }\n    static Vc_INTRINSIC m256i Vc_CONST cmplt_epu16(__m256i _a, __m256i _b) {\n        m256i a = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_a), _mm256_castsi256_ps(setmin_epi16())));\n        m256i b = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_b), _mm256_castsi256_ps(setmin_epi16())));\n        return cmplt_epi16(a, b);\n    }\n    static Vc_INTRINSIC m256i Vc_CONST cmpgt_epu16(__m256i _a, __m256i _b) {\n        m256i a = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_a), _mm256_castsi256_ps(setmin_epi16())));\n        m256i b = _mm256_castps_si256(_mm256_xor_ps(_mm256_castsi256_ps(_b), _mm256_castsi256_ps(setmin_epi16())));\n        return cmpgt_epi16(a, b);\n    }\n#endif\n\nstatic Vc_INTRINSIC void _mm256_maskstore(float *mem, const __m256 mask, const __m256 v) {\n    _mm256_maskstore_ps(mem, _mm256_castps_si256(mask), v);\n}\nstatic Vc_INTRINSIC void _mm256_maskstore(double *mem, const __m256d mask, const __m256d v) {\n    _mm256_maskstore_pd(mem, _mm256_castpd_si256(mask), v);\n}\nstatic Vc_INTRINSIC void _mm256_maskstore(int *mem, const __m256i mask, const __m256i v) {\n#ifdef Vc_IMPL_AVX2\n    _mm256_maskstore_epi32(mem, mask, v);\n#else\n    _mm256_maskstore_ps(reinterpret_cast<float *>(mem), mask, _mm256_castsi256_ps(v));\n#endif\n}\nstatic Vc_INTRINSIC void _mm256_maskstore(unsigned int *mem, const __m256i mask, const __m256i v) {\n    _mm256_maskstore(reinterpret_cast<int *>(mem), mask, v);\n}\nstatic Vc_INTRINSIC void _mm256_maskstore(short *mem, const __m256i mask, const __m256i v) {\n    using namespace AVX;\n    _mm_maskmoveu_si128(_mm256_castsi256_si128(v), _mm256_castsi256_si128(mask), reinterpret_cast<char *>(&mem[0]));\n    _mm_maskmoveu_si128(extract128<1>(v), extract128<1>(mask), reinterpret_cast<char *>(&mem[8]));\n}\nstatic Vc_INTRINSIC void _mm256_maskstore(unsigned short *mem, const __m256i mask, const __m256i v) {\n    _mm256_maskstore(reinterpret_cast<short *>(mem), mask, v);\n}\n\n#undef Vc_AVX_TO_SSE_1\n#undef Vc_AVX_TO_SSE_1_128\n#undef Vc_AVX_TO_SSE_2_NEW\n#undef Vc_AVX_TO_SSE_256_128\n#undef Vc_AVX_TO_SSE_1i\n\ntemplate<typename R> Vc_INTRINSIC_L R stream_load(const float *mem) Vc_INTRINSIC_R;\ntemplate<> Vc_INTRINSIC m128 stream_load<m128>(const float *mem)\n{\n    return _mm_castsi128_ps(_mm_stream_load_si128(reinterpret_cast<__m128i *>(const_cast<float *>(mem))));\n}\ntemplate<> Vc_INTRINSIC m256 stream_load<m256>(const float *mem)\n{\n    return insert128<1>(_mm256_castps128_ps256(stream_load<m128>(mem)),\n                                stream_load<m128>(mem + 4));\n}\n\ntemplate<typename R> Vc_INTRINSIC_L R stream_load(const double *mem) Vc_INTRINSIC_R;\ntemplate<> Vc_INTRINSIC m128d stream_load<m128d>(const double *mem)\n{\n    return _mm_castsi128_pd(_mm_stream_load_si128(reinterpret_cast<__m128i *>(const_cast<double *>(mem))));\n}\ntemplate<> Vc_INTRINSIC m256d stream_load<m256d>(const double *mem)\n{\n    return insert128<1>(_mm256_castpd128_pd256(stream_load<m128d>(mem)),\n                                stream_load<m128d>(mem + 2));\n}\n\ntemplate<typename R> Vc_INTRINSIC_L R stream_load(const void *mem) Vc_INTRINSIC_R;\ntemplate<> Vc_INTRINSIC m128i stream_load<m128i>(const void *mem)\n{\n    return _mm_stream_load_si128(reinterpret_cast<__m128i *>(const_cast<void *>(mem)));\n}\ntemplate<> Vc_INTRINSIC m256i stream_load<m256i>(const void *mem)\n{\n    return insert128<1>(_mm256_castsi128_si256(stream_load<m128i>(mem)),\n                                stream_load<m128i>(static_cast<const __m128i *>(mem) + 1));\n}\n\nVc_INTRINSIC void stream_store(float *mem, __m128 value, __m128 mask)\n{\n    _mm_maskmoveu_si128(_mm_castps_si128(value), _mm_castps_si128(mask), reinterpret_cast<char *>(mem));\n}\nVc_INTRINSIC void stream_store(float *mem, __m256 value, __m256 mask)\n{\n    stream_store(mem, _mm256_castps256_ps128(value), _mm256_castps256_ps128(mask));\n    stream_store(mem + 4, extract128<1>(value), extract128<1>(mask));\n}\nVc_INTRINSIC void stream_store(double *mem, __m128d value, __m128d mask)\n{\n    _mm_maskmoveu_si128(_mm_castpd_si128(value), _mm_castpd_si128(mask), reinterpret_cast<char *>(mem));\n}\nVc_INTRINSIC void stream_store(double *mem, __m256d value, __m256d mask)\n{\n    stream_store(mem, _mm256_castpd256_pd128(value), _mm256_castpd256_pd128(mask));\n    stream_store(mem + 2, extract128<1>(value), extract128<1>(mask));\n}\nVc_INTRINSIC void stream_store(void *mem, __m128i value, __m128i mask)\n{\n    _mm_maskmoveu_si128(value, mask, reinterpret_cast<char *>(mem));\n}\nVc_INTRINSIC void stream_store(void *mem, __m256i value, __m256i mask)\n{\n    stream_store(mem, _mm256_castsi256_si128(value), _mm256_castsi256_si128(mask));\n    stream_store(static_cast<__m128i *>(mem) + 1, extract128<1>(value), extract128<1>(mask));\n}\n\n#ifndef __x86_64__\nVc_INTRINSIC Vc_PURE __m128i _mm_cvtsi64_si128(int64_t x) {\n    return _mm_castpd_si128(_mm_load_sd(reinterpret_cast<const double *>(&x)));\n}\n#endif\n\n#ifdef Vc_IMPL_AVX2\ntemplate <int Scale> __m256 gather(const float *addr, __m256i idx)\n{\n    return _mm256_i32gather_ps(addr, idx, Scale);\n}\ntemplate <int Scale> __m256d gather(const double *addr, __m128i idx)\n{\n    return _mm256_i32gather_pd(addr, idx, Scale);\n}\ntemplate <int Scale> __m256i gather(const int *addr, __m256i idx)\n{\n    return _mm256_i32gather_epi32(addr, idx, Scale);\n}\ntemplate <int Scale> __m256i gather(const unsigned *addr, __m256i idx)\n{\n    return _mm256_i32gather_epi32(aliasing_cast<int>(addr), idx, Scale);\n}\n\ntemplate <int Scale> __m256 gather(__m256 src, __m256 k, const float *addr, __m256i idx)\n{\n    return _mm256_mask_i32gather_ps(src, addr, idx, k, Scale);\n}\ntemplate <int Scale>\n__m256d gather(__m256d src, __m256d k, const double *addr, __m128i idx)\n{\n    return _mm256_mask_i32gather_pd(src, addr, idx, k, Scale);\n}\ntemplate <int Scale> __m256i gather(__m256i src, __m256i k, const int *addr, __m256i idx)\n{\n    return _mm256_mask_i32gather_epi32(src, addr, idx, k, Scale);\n}\ntemplate <int Scale>\n__m256i gather(__m256i src, __m256i k, const unsigned *addr, __m256i idx)\n{\n    return _mm256_mask_i32gather_epi32(src, aliasing_cast<int>(addr), idx, k, Scale);\n}\n#endif\n\n}  // namespace AvxIntrinsics\n}  // namespace Vc\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\n    using namespace AvxIntrinsics;\n}  // namespace AVX\nnamespace AVX2\n{\n    using namespace AvxIntrinsics;\n}  // namespace AVX2\nnamespace AVX\n{\n    template<typename T> struct VectorTypeHelper;\n    template<> struct VectorTypeHelper<         char > { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<  signed char > { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<unsigned char > { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<         short> { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<unsigned short> { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<         int  > { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<unsigned int  > { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<         long > { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<unsigned long > { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<         long long> { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<unsigned long long> { typedef __m256i Type; };\n    template<> struct VectorTypeHelper<         float> { typedef __m256  Type; };\n    template<> struct VectorTypeHelper<        double> { typedef __m256d Type; };\n\n    template <typename T>\n    using IntegerVectorType =\n        typename std::conditional<sizeof(T) == 16, __m128i, __m256i>::type;\n    template <typename T>\n    using DoubleVectorType =\n        typename std::conditional<sizeof(T) == 16, __m128d, __m256d>::type;\n    template <typename T>\n    using FloatVectorType =\n        typename std::conditional<sizeof(T) == 16, __m128, __m256>::type;\n\n    template<typename T> struct VectorHelper {};\n    template<typename T> struct VectorHelperSize;\n}  // namespace AVX\n}  // namespace Vc\n\n#endif // VC_AVX_INTRINSICS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/limits.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_LIMITS_H_\n#define VC_AVX_LIMITS_H_\n\n#include \"intrinsics.h\"\n#include \"types.h\"\n#include \"macros.h\"\n\nnamespace std\n{\n#define Vc_NUM_LIM(T, _max, _min)                                                        \\\n    template <> struct numeric_limits<Vc::AVX2::Vector<T>> : public numeric_limits<T> {  \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> max() Vc_NOEXCEPT               \\\n        {                                                                                \\\n            return _max;                                                                 \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> min() Vc_NOEXCEPT               \\\n        {                                                                                \\\n            return _min;                                                                 \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> lowest() Vc_NOEXCEPT            \\\n        {                                                                                \\\n            return min();                                                                \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> epsilon() Vc_NOEXCEPT           \\\n        {                                                                                \\\n            return Vc::AVX2::Vector<T>::Zero();                                          \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> round_error() Vc_NOEXCEPT       \\\n        {                                                                                \\\n            return Vc::AVX2::Vector<T>::Zero();                                          \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> infinity() Vc_NOEXCEPT          \\\n        {                                                                                \\\n            return Vc::AVX2::Vector<T>::Zero();                                          \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> quiet_NaN() Vc_NOEXCEPT         \\\n        {                                                                                \\\n            return Vc::AVX2::Vector<T>::Zero();                                          \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> signaling_NaN() Vc_NOEXCEPT     \\\n        {                                                                                \\\n            return Vc::AVX2::Vector<T>::Zero();                                          \\\n        }                                                                                \\\n        static Vc_INTRINSIC Vc_CONST Vc::AVX2::Vector<T> denorm_min() Vc_NOEXCEPT        \\\n        {                                                                                \\\n            return Vc::AVX2::Vector<T>::Zero();                                          \\\n        }                                                                                \\\n    }\n\n#ifdef Vc_IMPL_AVX2\nVc_NUM_LIM(unsigned short, Vc::Detail::allone<__m256i>(), Vc::Detail::zero<__m256i>());\nVc_NUM_LIM(         short, _mm256_srli_epi16(Vc::Detail::allone<__m256i>(), 1), Vc::AVX::setmin_epi16());\nVc_NUM_LIM(  unsigned int, Vc::Detail::allone<__m256i>(), Vc::Detail::zero<__m256i>());\nVc_NUM_LIM(           int, _mm256_srli_epi32(Vc::Detail::allone<__m256i>(), 1), Vc::AVX::setmin_epi32());\n#endif\n#undef Vc_NUM_LIM\n\n} // namespace std\n\n#endif // VC_AVX_LIMITS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/macros.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"../common/macros.h\"\n\n#ifndef VC_AVX_MACROS_H_\n#define VC_AVX_MACROS_H_\n\n#endif // VC_AVX_MACROS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/mask.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_MASK_H_\n#define VC_AVX_MASK_H_\n\n#include <array>\n\n#include \"intrinsics.h\"\n#include \"../common/storage.h\"\n#include \"../common/bitscanintrinsics.h\"\n#include \"../common/maskbool.h\"\n#include \"detail.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\ntemplate <typename T> class Mask<T, VectorAbi::Avx>\n{\npublic:\n    using abi = VectorAbi::Avx;\n\n    /**\n     * The \\c EntryType of masks is always bool, independent of \\c T.\n     */\n    typedef bool EntryType;\n    using value_type = EntryType;\n\n    using MaskBool = Common::MaskBool<sizeof(T)>;\n    /**\n     * The \\c VectorEntryType, in contrast to \\c EntryType, reveals information about the SIMD\n     * implementation. This type is useful for the \\c sizeof operator in generic functions.\n     */\n    using VectorEntryType = MaskBool;\n\n    /**\n     * The associated Vector<T> type.\n     */\n    using Vector = AVX2::Vector<T>;\n\n    ///\\internal\n    using VectorTypeF = AVX::FloatVectorType<typename AVX::VectorTypeHelper<T>::Type>;\n    ///\\internal\n    using VectorTypeD = AVX::DoubleVectorType<VectorTypeF>;\n    ///\\internal\n    using VectorTypeI = AVX::IntegerVectorType<VectorTypeF>;\n\nprivate:\n    typedef const VectorTypeF VArg;\n    typedef const VectorTypeD VdArg;\n    typedef const VectorTypeI ViArg;\n\npublic:\n    static constexpr size_t Size = sizeof(VectorTypeF) / sizeof(T);\n    static constexpr size_t MemoryAlignment = Size;\n    static constexpr std::size_t size() { return Size; }\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(VectorType));\n\nprivate:\n    typedef Common::Storage<T, Size> Storage;\n\npublic:\n    /**\n     * The \\c VectorType reveals the implementation-specific internal type used for the\n     * SIMD type.\n     */\n    using VectorType = typename Storage::VectorType;\n\n    using EntryReference = Vc::Detail::ElementReference<Mask>;\n    using reference = EntryReference;\n\n        // abstracts the way Masks are passed to functions, it can easily be changed to const ref here\n#if defined Vc_MSVC && defined _WIN32\n        typedef const Mask &AsArg;\n#else\n        typedef const Mask AsArg;\n#endif\n\n        Vc_INTRINSIC Mask() {}\n        Vc_INTRINSIC Mask(VArg  x) : d(AVX::avx_cast<VectorType>(x)) {}\n        Vc_INTRINSIC Mask(VdArg x) : d(AVX::avx_cast<VectorType>(x)) {}\n        Vc_INTRINSIC Mask(ViArg x) : d(AVX::avx_cast<VectorType>(x)) {}\n        Vc_INTRINSIC explicit Mask(VectorSpecialInitializerZero) : d(Detail::zero<VectorType>()) {}\n        Vc_INTRINSIC explicit Mask(VectorSpecialInitializerOne) : d(Detail::allone<VectorType>()) {}\n        Vc_INTRINSIC explicit Mask(bool b)\n            : d(b ? Detail::allone<VectorType>() : Detail::zero<VectorType>())\n        {\n        }\n        Vc_INTRINSIC static Mask Zero() { return Mask{Vc::Zero}; }\n        Vc_INTRINSIC static Mask One() { return Mask{Vc::One}; }\n\n        // implicit cast\n        template <typename U>\n        Vc_INTRINSIC Mask(\n            U &&rhs, Common::enable_if_mask_converts_implicitly<Mask, T, U> = nullarg)\n            : d(AVX::avx_cast<VectorType>(\n                  Detail::mask_cast<Traits::decay<U>::Size, Size, VectorTypeF>(\n                      rhs.dataI())))\n        {\n        }\n\n#if Vc_IS_VERSION_1\n        // explicit cast, implemented via simd_cast (in avx/simd_cast_caller.h)\n        template <typename U>\n        Vc_DEPRECATED(\"use simd_cast instead of explicit type casting to convert between \"\n                      \"mask types\") Vc_INTRINSIC\n            explicit Mask(U &&rhs,\n                          Common::enable_if_mask_converts_explicitly<T, U> = nullarg);\n#endif\n\n        template<typename Flags = DefaultLoadTag> Vc_INTRINSIC explicit Mask(const bool *mem, Flags f = Flags()) { load(mem, f); }\n\n        template<typename Flags = DefaultLoadTag> Vc_INTRINSIC void load(const bool *mem, Flags = Flags());\n\n        template<typename Flags = DefaultLoadTag> Vc_INTRINSIC void store(bool *mem, Flags = Flags()) const;\n\n        Vc_INTRINSIC Mask &operator=(const Mask &) = default;\n        Vc_INTRINSIC_L Mask &operator=(const std::array<bool, Size> &values) Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L operator std::array<bool, Size>() const Vc_INTRINSIC_R;\n\n        // specializations in mask.tcc\n        Vc_INTRINSIC Vc_PURE bool operator==(const Mask &rhs) const\n        { return Detail::movemask(d.v()) == Detail::movemask(rhs.d.v()); }\n\n        Vc_INTRINSIC Vc_PURE bool operator!=(const Mask &rhs) const\n        { return !operator==(rhs); }\n\n        Vc_INTRINSIC Mask operator!() const\n        {\n#ifdef Vc_GCC\n            return ~dataI();\n#else\n            return Detail::andnot_(dataF(), Detail::allone<VectorTypeF>());\n#endif\n        }\n\n        Vc_INTRINSIC Mask &operator&=(const Mask &rhs) { d.v() = AVX::avx_cast<VectorType>(Detail::and_(data(), rhs.data())); return *this; }\n        Vc_INTRINSIC Mask &operator|=(const Mask &rhs) { d.v() = AVX::avx_cast<VectorType>(Detail::or_ (data(), rhs.data())); return *this; }\n        Vc_INTRINSIC Mask &operator^=(const Mask &rhs) { d.v() = AVX::avx_cast<VectorType>(Detail::xor_(data(), rhs.data())); return *this; }\n\n        Vc_INTRINSIC Vc_PURE Mask operator&(const Mask &rhs) const { return Detail::and_(data(), rhs.data()); }\n        Vc_INTRINSIC Vc_PURE Mask operator|(const Mask &rhs) const { return Detail::or_(data(), rhs.data()); }\n        Vc_INTRINSIC Vc_PURE Mask operator^(const Mask &rhs) const { return Detail::xor_(data(), rhs.data()); }\n\n        Vc_INTRINSIC Vc_PURE Mask operator&&(const Mask &rhs) const { return Detail::and_(data(), rhs.data()); }\n        Vc_INTRINSIC Vc_PURE Mask operator||(const Mask &rhs) const { return Detail::or_(data(), rhs.data()); }\n\n        // no need for expression template optimizations because cmp(n)eq for floats are not bitwise\n        // compares\n        Vc_INTRINSIC_L bool isNotEmpty() const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L bool isEmpty() const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L bool isFull() const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L bool isMix() const Vc_INTRINSIC_R;\n\n        Vc_INTRINSIC Vc_PURE int shiftMask() const { return Detail::movemask(dataI()); }\n        Vc_INTRINSIC Vc_PURE int toInt() const { return Detail::mask_to_int<Size>(dataI()); }\n\n        Vc_INTRINSIC VectorType  data () const { return d.v(); }\n        Vc_INTRINSIC VectorTypeF dataF() const { return AVX::avx_cast<VectorTypeF>(d.v()); }\n        Vc_INTRINSIC VectorTypeI dataI() const { return AVX::avx_cast<VectorTypeI>(d.v()); }\n        Vc_INTRINSIC VectorTypeD dataD() const { return AVX::avx_cast<VectorTypeD>(d.v()); }\n\nprivate:\n    friend reference;\n    static Vc_INTRINSIC Vc_PURE value_type get(const Mask &m, int i) noexcept\n    {\n        return m.toInt() & (1 << i);\n    }\n    template <typename U>\n    static Vc_INTRINSIC void set(Mask &m, int i,\n                                 U &&v) noexcept(noexcept(MaskBool(std::declval<U>())))\n    {\n        m.d.set(i, MaskBool(std::forward<U>(v)));\n    }\n\npublic:\n    /**\n     * \\note the returned object models the concept of a reference and\n     * as such it can exist longer than the data it is referencing.\n     * \\note to avoid lifetime issues, we strongly advice not to store\n     * any reference objects.\n     */\n    Vc_ALWAYS_INLINE reference operator[](size_t index) noexcept\n    {\n        return {*this, int(index)};\n    }\n    Vc_ALWAYS_INLINE Vc_PURE value_type operator[](size_t index) const noexcept\n    {\n        return get(*this, index);\n    }\n\n        Vc_INTRINSIC Vc_PURE int count() const { return Detail::popcnt16(toInt()); }\n        Vc_INTRINSIC Vc_PURE int firstOne() const { return _bit_scan_forward(toInt()); }\n\n        template <typename G> static Vc_INTRINSIC_L Mask generate(G &&gen) Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vc_PURE_L Mask shifted(int amount) const Vc_INTRINSIC_R Vc_PURE_R;\n\n    private:\n#ifdef Vc_COMPILE_BENCHMARKS\n    public:\n#endif\n        Storage d;\n};\ntemplate <typename T> constexpr size_t Mask<T, VectorAbi::Avx>::Size;\ntemplate <typename T> constexpr size_t Mask<T, VectorAbi::Avx>::MemoryAlignment;\n\n}  // namespace Vc\n\n#include \"mask.tcc\"\n\n#endif // VC_AVX_MASK_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/mask.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// store {{{1\ntemplate <typename T>\ntemplate <typename Flags>\nVc_INTRINSIC void Mask<T, VectorAbi::Avx>::store(bool *mem, Flags f) const\n{\n    Detail::mask_store<Size>(dataI(), mem, f);\n}\n\n// load {{{1\ntemplate <typename T>\ntemplate <typename Flags>\nVc_INTRINSIC void Mask<T, VectorAbi::Avx>::load(const bool *mem, Flags f)\n{\n    d.v() = AVX::avx_cast<VectorType>(Detail::mask_load<VectorTypeF, Size>(mem, f));\n}\n\n// operator[] {{{1\n#ifdef Vc_IMPL_AVX2\ntemplate <>\nVc_INTRINSIC Vc_PURE bool AVX2::Mask<int16_t>::get(const AVX2::Mask<int16_t> &m,\n                                                   int index) noexcept\n{\n    return m.shiftMask() & (1 << 2 * index);\n}\ntemplate <>\nVc_INTRINSIC Vc_PURE bool AVX2::Mask<uint16_t>::get(const AVX2::Mask<uint16_t> &m,\n                                                    int index) noexcept\n{\n    return m.shiftMask() & (1 << 2 * index);\n}\n#endif\n// operator== {{{1\ntemplate <> Vc_INTRINSIC Vc_PURE bool AVX2::double_m::operator==(const AVX2::double_m &rhs) const\n{ return Detail::movemask(dataD()) == Detail::movemask(rhs.dataD()); }\n#ifdef Vc_IMPL_AVX2\ntemplate <> Vc_INTRINSIC Vc_PURE bool AVX2::short_m::operator==(const AVX2::short_m &rhs) const\n{ return Detail::movemask(dataI()) == Detail::movemask(rhs.dataI()); }\ntemplate <> Vc_INTRINSIC Vc_PURE bool AVX2::ushort_m::operator==(const AVX2::ushort_m &rhs) const\n{ return Detail::movemask(dataI()) == Detail::movemask(rhs.dataI()); }\n#endif\n\n// isFull, isNotEmpty, isEmpty, isMix specializations{{{1\ntemplate <typename T> Vc_INTRINSIC bool Mask<T, VectorAbi::Avx>::isFull() const {\n    if (sizeof(T) == 8) {\n        return 0 != Detail::testc(dataD(), Detail::allone<VectorTypeD>());\n    } else if (sizeof(T) == 4) {\n        return 0 != Detail::testc(dataF(), Detail::allone<VectorTypeF>());\n    } else {\n        return 0 != Detail::testc(dataI(), Detail::allone<VectorTypeI>());\n    }\n}\n\ntemplate <typename T> Vc_INTRINSIC bool Mask<T, VectorAbi::Avx>::isNotEmpty() const {\n    if (sizeof(T) == 8) {\n        return 0 == Detail::testz(dataD(), dataD());\n    } else if (sizeof(T) == 4) {\n        return 0 == Detail::testz(dataF(), dataF());\n    } else {\n        return 0 == Detail::testz(dataI(), dataI());\n    }\n}\n\ntemplate <typename T> Vc_INTRINSIC bool Mask<T, VectorAbi::Avx>::isEmpty() const {\n    if (sizeof(T) == 8) {\n        return 0 != Detail::testz(dataD(), dataD());\n    } else if (sizeof(T) == 4) {\n        return 0 != Detail::testz(dataF(), dataF());\n    } else {\n        return 0 != Detail::testz(dataI(), dataI());\n    }\n}\n\ntemplate <typename T> Vc_INTRINSIC bool Mask<T, VectorAbi::Avx>::isMix() const {\n    if (sizeof(T) == 8) {\n        return 0 != Detail::testnzc(dataD(), Detail::allone<VectorTypeD>());\n    } else if (sizeof(T) == 4) {\n        return 0 != Detail::testnzc(dataF(), Detail::allone<VectorTypeF>());\n    } else {\n        return 0 != Detail::testnzc(dataI(), Detail::allone<VectorTypeI>());\n    }\n}\n\n// generate {{{1\ntemplate <typename M, typename G>\nVc_INTRINSIC M generate_impl(G &&gen, std::integral_constant<int, 4 + 32>)\n{\n    return _mm256_setr_epi64x(\n        gen(0) ? 0xffffffffffffffffull : 0, gen(1) ? 0xffffffffffffffffull : 0,\n        gen(2) ? 0xffffffffffffffffull : 0, gen(3) ? 0xffffffffffffffffull : 0);\n}\ntemplate <typename M, typename G>\nVc_INTRINSIC M generate_impl(G &&gen, std::integral_constant<int, 8 + 32>)\n{\n    return _mm256_setr_epi32(gen(0) ? 0xfffffffful : 0, gen(1) ? 0xfffffffful : 0,\n                             gen(2) ? 0xfffffffful : 0, gen(3) ? 0xfffffffful : 0,\n                             gen(4) ? 0xfffffffful : 0, gen(5) ? 0xfffffffful : 0,\n                             gen(6) ? 0xfffffffful : 0, gen(7) ? 0xfffffffful : 0);\n}\ntemplate <typename M, typename G>\nVc_INTRINSIC M generate_impl(G &&gen, std::integral_constant<int, 16 + 32>)\n{\n    return _mm256_setr_epi16(gen(0) ? 0xfffful : 0, gen(1) ? 0xfffful : 0,\n                             gen(2) ? 0xfffful : 0, gen(3) ? 0xfffful : 0,\n                             gen(4) ? 0xfffful : 0, gen(5) ? 0xfffful : 0,\n                             gen(6) ? 0xfffful : 0, gen(7) ? 0xfffful : 0,\n                             gen(8) ? 0xfffful : 0, gen(9) ? 0xfffful : 0,\n                             gen(10) ? 0xfffful : 0, gen(11) ? 0xfffful : 0,\n                             gen(12) ? 0xfffful : 0, gen(13) ? 0xfffful : 0,\n                             gen(14) ? 0xfffful : 0, gen(15) ? 0xfffful : 0);\n}\ntemplate <typename T>\ntemplate <typename G>\nVc_INTRINSIC AVX2::Mask<T> Mask<T, VectorAbi::Avx>::generate(G &&gen)\n{\n    return generate_impl<AVX2::Mask<T>>(std::forward<G>(gen),\n                                  std::integral_constant<int, Size + sizeof(Storage)>());\n}\n// shifted {{{1\ntemplate <typename T> Vc_INTRINSIC Vc_PURE AVX2::Mask<T> Mask<T, VectorAbi::Avx>::shifted(int amount) const\n{\n    switch (amount * int(sizeof(VectorEntryType))) {\n    case   0: return *this;\n    case   1: return Detail::shifted<  1>(dataI());\n    case   2: return Detail::shifted<  2>(dataI());\n    case   3: return Detail::shifted<  3>(dataI());\n    case   4: return Detail::shifted<  4>(dataI());\n    case   5: return Detail::shifted<  5>(dataI());\n    case   6: return Detail::shifted<  6>(dataI());\n    case   7: return Detail::shifted<  7>(dataI());\n    case   8: return Detail::shifted<  8>(dataI());\n    case   9: return Detail::shifted<  9>(dataI());\n    case  10: return Detail::shifted< 10>(dataI());\n    case  11: return Detail::shifted< 11>(dataI());\n    case  12: return Detail::shifted< 12>(dataI());\n    case  13: return Detail::shifted< 13>(dataI());\n    case  14: return Detail::shifted< 14>(dataI());\n    case  15: return Detail::shifted< 15>(dataI());\n    case  16: return Detail::shifted< 16>(dataI());\n    case  17: return Detail::shifted< 17>(dataI());\n    case  18: return Detail::shifted< 18>(dataI());\n    case  19: return Detail::shifted< 19>(dataI());\n    case  20: return Detail::shifted< 20>(dataI());\n    case  21: return Detail::shifted< 21>(dataI());\n    case  22: return Detail::shifted< 22>(dataI());\n    case  23: return Detail::shifted< 23>(dataI());\n    case  24: return Detail::shifted< 24>(dataI());\n    case  25: return Detail::shifted< 25>(dataI());\n    case  26: return Detail::shifted< 26>(dataI());\n    case  27: return Detail::shifted< 27>(dataI());\n    case  28: return Detail::shifted< 28>(dataI());\n    case  29: return Detail::shifted< 29>(dataI());\n    case  30: return Detail::shifted< 30>(dataI());\n    case  31: return Detail::shifted< 31>(dataI());\n    case  -1: return Detail::shifted< -1>(dataI());\n    case  -2: return Detail::shifted< -2>(dataI());\n    case  -3: return Detail::shifted< -3>(dataI());\n    case  -4: return Detail::shifted< -4>(dataI());\n    case  -5: return Detail::shifted< -5>(dataI());\n    case  -6: return Detail::shifted< -6>(dataI());\n    case  -7: return Detail::shifted< -7>(dataI());\n    case  -8: return Detail::shifted< -8>(dataI());\n    case  -9: return Detail::shifted< -9>(dataI());\n    case -10: return Detail::shifted<-10>(dataI());\n    case -11: return Detail::shifted<-11>(dataI());\n    case -12: return Detail::shifted<-12>(dataI());\n    case -13: return Detail::shifted<-13>(dataI());\n    case -14: return Detail::shifted<-14>(dataI());\n    case -15: return Detail::shifted<-15>(dataI());\n    case -16: return Detail::shifted<-16>(dataI());\n    case -17: return Detail::shifted<-17>(dataI());\n    case -18: return Detail::shifted<-18>(dataI());\n    case -19: return Detail::shifted<-19>(dataI());\n    case -20: return Detail::shifted<-20>(dataI());\n    case -21: return Detail::shifted<-21>(dataI());\n    case -22: return Detail::shifted<-22>(dataI());\n    case -23: return Detail::shifted<-23>(dataI());\n    case -24: return Detail::shifted<-24>(dataI());\n    case -25: return Detail::shifted<-25>(dataI());\n    case -26: return Detail::shifted<-26>(dataI());\n    case -27: return Detail::shifted<-27>(dataI());\n    case -28: return Detail::shifted<-28>(dataI());\n    case -29: return Detail::shifted<-29>(dataI());\n    case -30: return Detail::shifted<-30>(dataI());\n    case -31: return Detail::shifted<-31>(dataI());\n    }\n    return Zero();\n}\n// }}}1\n\n/*\ntemplate<> Vc_INTRINSIC AVX2::Mask< 4, 32> &AVX2::Mask< 4, 32>::operator=(const std::array<bool, 4> &values) {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    unsigned int x = *reinterpret_cast<const unsigned int *>(values.data());\n    x *= 0xffu;\n    __m128i y = _mm_cvtsi32_si128(x); //  4 Bytes\n    y = _mm_unpacklo_epi8(y, y);    //  8 Bytes\n    y = _mm_unpacklo_epi16(y, y);   // 16 Bytes\n    d.v() = AVX::avx_cast<__m256>(AVX::concat(_mm_unpacklo_epi32(y, y), _mm_unpackhi_epi32(y, y)));\n    return *this;\n}\ntemplate<> Vc_INTRINSIC AVX2::Mask< 8, 32> &AVX2::Mask< 8, 32>::operator=(const std::array<bool, 8> &values) {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    unsigned long long x = *reinterpret_cast<const unsigned long long *>(values.data());\n    x *= 0xffull;\n    __m128i y = _mm_cvtsi64_si128(x); //  8 Bytes\n    y = _mm_unpacklo_epi8(y, y);   // 16 Bytes\n    d.v() = AVX::avx_cast<__m256>(AVX::concat(_mm_unpacklo_epi16(y, y), _mm_unpackhi_epi16(y, y)));\n    return *this;\n}\ntemplate<> Vc_INTRINSIC AVX2::Mask< 8, 16> &AVX2::Mask< 8, 16>::operator=(const std::array<bool, 8> &values) {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    unsigned long long x = *reinterpret_cast<const unsigned long long *>(values.data());\n    x *= 0xffull;\n    __m128i y = _mm_cvtsi64_si128(x); //  8 Bytes\n    d.v() = AVX::avx_cast<__m128>(_mm_unpacklo_epi8(y, y));\n    return *this;\n}\ntemplate<> Vc_INTRINSIC AVX2::Mask<16, 16> &AVX2::Mask<16, 16>::operator=(const std::array<bool, 16> &values) {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    __m128i x = _mm_loadu_si128(reinterpret_cast<const __m128i *>(values.data()));\n    d.v() = _mm_andnot_ps(AVX::_mm_setallone_ps(), AVX::avx_cast<__m128>(_mm_sub_epi8(x, _mm_set1_epi8(1))));\n    return *this;\n}\n\ntemplate<> Vc_INTRINSIC AVX2::Mask< 4, 32>::operator std::array<bool, 4>() const {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    __m128i x = _mm_packs_epi32(AVX::lo128(dataI()), AVX::hi128(dataI())); // 64bit -> 32bit\n    x = _mm_packs_epi32(x, x); // 32bit -> 16bit\n    x = _mm_srli_epi16(x, 15);\n    x = _mm_packs_epi16(x, x); // 16bit ->  8bit\n    std::array<bool, 4> r;\n    asm volatile(\"vmovd %1,%0\" : \"=m\"(*r.data()) : \"x\"(x));\n    return r;\n}\ntemplate<> Vc_INTRINSIC AVX2::Mask< 8, 32>::operator std::array<bool, 8>() const {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    __m128i x = _mm_packs_epi32(AVX::lo128(dataI()), AVX::hi128(dataI())); // 32bit -> 16bit\n    x = _mm_srli_epi16(x, 15);\n    x = _mm_packs_epi16(x, x); // 16bit ->  8bit\n    std::array<bool, 8> r;\n    asm volatile(\"vmovq %1,%0\" : \"=m\"(*r.data()) : \"x\"(x));\n    return r;\n}\ntemplate<> Vc_INTRINSIC AVX2::Mask< 8, 16>::operator std::array<bool, 8>() const {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    __m128i x = _mm_srli_epi16(dataI(), 15);\n    x = _mm_packs_epi16(x, x); // 16bit ->  8bit\n    std::array<bool, 8> r;\n    asm volatile(\"vmovq %1,%0\" : \"=m\"(*r.data()) : \"x\"(x));\n    return r;\n}\ntemplate<> Vc_INTRINSIC AVX2::Mask<16, 16>::operator std::array<bool, 16>() const {\n    static_assert(sizeof(bool) == 1, \"Vc expects bool to have a sizeof 1 Byte\");\n    __m128 x = _mm_and_ps(d.v(), AVX::avx_cast<__m128>(_mm_set1_epi32(0x01010101)));\n    std::array<bool, 16> r;\n    asm volatile(\"vmovups %1,%0\" : \"=m\"(*r.data()) : \"x\"(x));\n    return r;\n}\n*/\n\n}\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/math.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_MATH_H_\n#define VC_AVX_MATH_H_\n\n#include \"const.h\"\n#include \"limits.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// min & max {{{1\n#ifdef Vc_IMPL_AVX2\nVc_ALWAYS_INLINE AVX2::int_v    min(const AVX2::int_v    &x, const AVX2::int_v    &y) { return _mm256_min_epi32(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::uint_v   min(const AVX2::uint_v   &x, const AVX2::uint_v   &y) { return _mm256_min_epu32(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::short_v  min(const AVX2::short_v  &x, const AVX2::short_v  &y) { return _mm256_min_epi16(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::ushort_v min(const AVX2::ushort_v &x, const AVX2::ushort_v &y) { return _mm256_min_epu16(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::int_v    max(const AVX2::int_v    &x, const AVX2::int_v    &y) { return _mm256_max_epi32(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::uint_v   max(const AVX2::uint_v   &x, const AVX2::uint_v   &y) { return _mm256_max_epu32(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::short_v  max(const AVX2::short_v  &x, const AVX2::short_v  &y) { return _mm256_max_epi16(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::ushort_v max(const AVX2::ushort_v &x, const AVX2::ushort_v &y) { return _mm256_max_epu16(x.data(), y.data()); }\n#endif\nVc_ALWAYS_INLINE AVX2::float_v  min(const AVX2::float_v  &x, const AVX2::float_v  &y) { return _mm256_min_ps(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::double_v min(const AVX2::double_v &x, const AVX2::double_v &y) { return _mm256_min_pd(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::float_v  max(const AVX2::float_v  &x, const AVX2::float_v  &y) { return _mm256_max_ps(x.data(), y.data()); }\nVc_ALWAYS_INLINE AVX2::double_v max(const AVX2::double_v &x, const AVX2::double_v &y) { return _mm256_max_pd(x.data(), y.data()); }\n\n// sqrt {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> sqrt(const AVX2::Vector<T> &x)\n{\n    return AVX::VectorHelper<T>::sqrt(x.data());\n}\n\n// rsqrt {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> rsqrt(const AVX2::Vector<T> &x)\n{\n    return AVX::VectorHelper<T>::rsqrt(x.data());\n}\n\n// reciprocal {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> reciprocal(const AVX2::Vector<T> &x)\n{\n    return AVX::VectorHelper<T>::reciprocal(x.data());\n}\n\n// round {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> round(const AVX2::Vector<T> &x)\n{\n    return AVX::VectorHelper<T>::round(x.data());\n}\n\n// abs {{{1\nVc_INTRINSIC Vc_CONST AVX2::double_v abs(AVX2::double_v x)\n{\n    return Detail::and_(x.data(), AVX::setabsmask_pd());\n}\nVc_INTRINSIC Vc_CONST AVX2::float_v abs(AVX2::float_v x)\n{\n    return Detail::and_(x.data(), AVX::setabsmask_ps());\n}\n#ifdef Vc_IMPL_AVX2\nVc_INTRINSIC Vc_CONST AVX2::int_v abs(AVX2::int_v x)\n{\n    return _mm256_abs_epi32(x.data());\n}\nVc_INTRINSIC Vc_CONST AVX2::short_v abs(AVX2::short_v x)\n{\n    return _mm256_abs_epi16(x.data());\n}\n#endif\n\n// isfinite {{{1\nVc_ALWAYS_INLINE Vc_PURE AVX2::double_m isfinite(const AVX2::double_v &x)\n{\n    return AVX::cmpord_pd(x.data(), _mm256_mul_pd(Detail::zero<__m256d>(), x.data()));\n}\n\nVc_ALWAYS_INLINE Vc_PURE AVX2::float_m isfinite(const AVX2::float_v &x)\n{\n    return AVX::cmpord_ps(x.data(), _mm256_mul_ps(Detail::zero<__m256>(), x.data()));\n}\n\n// isinf {{{1\nVc_ALWAYS_INLINE Vc_PURE AVX2::double_m isinf(const AVX2::double_v &x)\n{\n    return _mm256_castsi256_pd(AVX::cmpeq_epi64(\n        _mm256_castpd_si256(abs(x).data()),\n        _mm256_castpd_si256(Detail::avx_broadcast(AVX::c_log<double>::d(1)))));\n}\n\nVc_ALWAYS_INLINE Vc_PURE AVX2::float_m isinf(const AVX2::float_v &x)\n{\n    return _mm256_castsi256_ps(\n        AVX::cmpeq_epi32(_mm256_castps_si256(abs(x).data()),\n                         _mm256_castps_si256(Detail::avx_broadcast(AVX::c_log<float>::d(1)))));\n}\n\n// isnan {{{1\nVc_ALWAYS_INLINE Vc_PURE AVX2::double_m isnan(const AVX2::double_v &x)\n{\n    return AVX::cmpunord_pd(x.data(), x.data());\n}\n\nVc_ALWAYS_INLINE Vc_PURE AVX2::float_m isnan(const AVX2::float_v &x)\n{\n    return AVX::cmpunord_ps(x.data(), x.data());\n}\n\n// copysign {{{1\nVc_INTRINSIC Vc_CONST AVX2::float_v copysign(AVX2::float_v mag, AVX2::float_v sign)\n{\n    return _mm256_or_ps(_mm256_and_ps(sign.data(), AVX::setsignmask_ps()),\n                        _mm256_and_ps(mag.data(), AVX::setabsmask_ps()));\n}\nVc_INTRINSIC Vc_CONST AVX2::double_v copysign(AVX2::double_v::AsArg mag,\n                                              AVX2::double_v::AsArg sign)\n{\n    return _mm256_or_pd(_mm256_and_pd(sign.data(), AVX::setsignmask_pd()),\n                        _mm256_and_pd(mag.data(), AVX::setabsmask_pd()));\n}\n\n//}}}1\n// frexp {{{1\n/**\n * splits \\p v into exponent and mantissa, the sign is kept with the mantissa\n *\n * The return value will be in the range [0.5, 1.0[\n * The \\p e value will be an integer defining the power-of-two exponent\n */\ninline AVX2::double_v frexp(AVX2::double_v::AsArg v, SimdArray<int, 4> *e)\n{\n    const __m256d exponentBits = AVX::Const<double>::exponentMask().dataD();\n    const __m256d exponentPart = _mm256_and_pd(v.data(), exponentBits);\n    auto lo = AVX::avx_cast<__m128i>(AVX::lo128(exponentPart));\n    auto hi = AVX::avx_cast<__m128i>(AVX::hi128(exponentPart));\n    lo = _mm_sub_epi32(_mm_srli_epi64(lo, 52), _mm_set1_epi64x(0x3fe));\n    hi = _mm_sub_epi32(_mm_srli_epi64(hi, 52), _mm_set1_epi64x(0x3fe));\n    SSE::int_v exponent = Mem::shuffle<X0, X2, Y0, Y2>(lo, hi);\n    const __m256d exponentMaximized = _mm256_or_pd(v.data(), exponentBits);\n    AVX2::double_v ret =\n        _mm256_and_pd(exponentMaximized,\n                      _mm256_broadcast_sd(reinterpret_cast<const double *>(&AVX::c_general::frexpMask)));\n    const double_m zeroMask = v == AVX2::double_v::Zero();\n    ret(isnan(v) || !isfinite(v) || zeroMask) = v;\n    exponent.setZero(simd_cast<SSE::int_m>(zeroMask));\n    internal_data(*e) = exponent;\n    return ret;\n}\n\n#ifdef Vc_IMPL_AVX2\ninline SimdArray<double, 8> frexp(const SimdArray<double, 8> &v, SimdArray<int, 8> *e)\n{\n    const __m256d exponentBits = AVX::Const<double>::exponentMask().dataD();\n    const __m256d w[2] = {internal_data(internal_data0(v)).data(),\n                          internal_data(internal_data1(v)).data()};\n    const __m256i exponentPart[2] = {\n        _mm256_castpd_si256(_mm256_and_pd(w[0], exponentBits)),\n        _mm256_castpd_si256(_mm256_and_pd(w[1], exponentBits))};\n    const __m256i lo = _mm256_sub_epi32(_mm256_srli_epi64(exponentPart[0], 52),\n                                        _mm256_set1_epi32(0x3fe));   // 0.1. 2.3.\n    const __m256i hi = _mm256_sub_epi32(_mm256_srli_epi64(exponentPart[1], 52),\n                                        _mm256_set1_epi32(0x3fe));   // 4.5. 6.7.\n    const __m256i a = _mm256_unpacklo_epi32(lo, hi);                 // 04.. 26..\n    const __m256i b = _mm256_unpackhi_epi32(lo, hi);                 // 15.. 37..\n    const __m256i tmp = _mm256_unpacklo_epi32(a, b);                 // 0145 2367\n    const __m256i exponent =\n        AVX::concat(_mm_unpacklo_epi64(AVX::lo128(tmp), AVX::hi128(tmp)),\n                    _mm_unpackhi_epi64(AVX::lo128(tmp), AVX::hi128(tmp)));  // 0123 4567\n    const __m256d exponentMaximized[2] = {_mm256_or_pd(w[0], exponentBits),\n                                          _mm256_or_pd(w[1], exponentBits)};\n    const auto frexpMask =\n        _mm256_broadcast_sd(reinterpret_cast<const double *>(&AVX::c_general::frexpMask));\n    fixed_size_simd<double, 8> ret = {\n        fixed_size_simd<double, 4>(\n            AVX::double_v(_mm256_and_pd(exponentMaximized[0], frexpMask))),\n        fixed_size_simd<double, 4>(\n            AVX::double_v(_mm256_and_pd(exponentMaximized[1], frexpMask)))};\n    const auto zeroMask = v == v.Zero();\n    ret(isnan(v) || !isfinite(v) || zeroMask) = v;\n    internal_data(*e) =\n        Detail::andnot_(simd_cast<AVX2::int_m>(zeroMask).dataI(), exponent);\n    return ret;\n}\n#endif  // Vc_IMPL_AVX2\n\nnamespace Detail\n{\nVc_INTRINSIC AVX2::float_v::IndexType extractExponent(__m256 e)\n{\n    SimdArray<uint, float_v::Size> exponentPart;\n    const auto ee = AVX::avx_cast<__m256i>(e);\n#ifdef Vc_IMPL_AVX2\n    exponentPart = AVX2::uint_v(ee);\n#else\n    internal_data(internal_data0(exponentPart)) = AVX::lo128(ee);\n    internal_data(internal_data1(exponentPart)) = AVX::hi128(ee);\n#endif\n    return (exponentPart >> 23) - 0x7e;\n}\n}  // namespace Detail\ninline AVX2::float_v frexp(AVX2::float_v::AsArg v, SimdArray<int, 8> *e)\n{\n    using namespace Detail;\n    using namespace AVX2;\n    const __m256 exponentBits = Const<float>::exponentMask().data();\n    *e = extractExponent(and_(v.data(), exponentBits));\n    const __m256 exponentMaximized = or_(v.data(), exponentBits);\n    AVX2::float_v ret = _mm256_and_ps(exponentMaximized, avx_cast<__m256>(set1_epi32(0xbf7fffffu)));\n    ret(isnan(v) || !isfinite(v) || v == AVX2::float_v::Zero()) = v;\n    e->setZero(simd_cast<decltype(*e == *e)>(v == AVX2::float_v::Zero()));\n    return ret;\n}\n\n// ldexp {{{1\n/*             -> x * 2^e\n * x == NaN    -> NaN\n * x == (-)inf -> (-)inf\n */\ninline AVX2::double_v ldexp(AVX2::double_v::AsArg v, const SimdArray<int, 4> &_e)\n{\n    SSE::int_v e = internal_data(_e);\n    e.setZero(simd_cast<SSE::int_m>(v == AVX2::double_v::Zero()));\n    const __m256i exponentBits =\n        AVX::concat(_mm_slli_epi64(_mm_unpacklo_epi32(e.data(), e.data()), 52),\n                    _mm_slli_epi64(_mm_unpackhi_epi32(e.data(), e.data()), 52));\n    return AVX::avx_cast<__m256d>(\n        AVX::add_epi64(AVX::avx_cast<__m256i>(v.data()), exponentBits));\n}\ninline AVX2::float_v ldexp(AVX2::float_v::AsArg v, SimdArray<int, 8> e)\n{\n    e.setZero(simd_cast<decltype(e == e)>(v == AVX2::float_v::Zero()));\n    e <<= 23;\n#ifdef Vc_IMPL_AVX2\n    return {AVX::avx_cast<__m256>(\n        AVX::concat(_mm_add_epi32(AVX::avx_cast<__m128i>(AVX::lo128(v.data())),\n                                  AVX::lo128(internal_data(e).data())),\n                    _mm_add_epi32(AVX::avx_cast<__m128i>(AVX::hi128(v.data())),\n                                  AVX::hi128(internal_data(e).data()))))};\n#else\n    return {AVX::avx_cast<__m256>(\n        AVX::concat(_mm_add_epi32(AVX::avx_cast<__m128i>(AVX::lo128(v.data())),\n                                  internal_data(internal_data0(e)).data()),\n                    _mm_add_epi32(AVX::avx_cast<__m128i>(AVX::hi128(v.data())),\n                                  internal_data(internal_data1(e)).data())))};\n#endif\n}\n\n// trunc {{{1\nVc_ALWAYS_INLINE AVX2::float_v trunc(AVX2::float_v::AsArg v)\n{\n    return _mm256_round_ps(v.data(), 0x3);\n}\nVc_ALWAYS_INLINE AVX2::double_v trunc(AVX2::double_v::AsArg v)\n{\n    return _mm256_round_pd(v.data(), 0x3);\n}\n\n// floor {{{1\nVc_ALWAYS_INLINE AVX2::float_v floor(AVX2::float_v::AsArg v)\n{\n    return _mm256_floor_ps(v.data());\n}\nVc_ALWAYS_INLINE AVX2::double_v floor(AVX2::double_v::AsArg v)\n{\n    return _mm256_floor_pd(v.data());\n}\n\n// ceil {{{1\nVc_ALWAYS_INLINE AVX2::float_v ceil(AVX2::float_v::AsArg v)\n{\n    return _mm256_ceil_ps(v.data());\n}\nVc_ALWAYS_INLINE AVX2::double_v ceil(AVX2::double_v::AsArg v)\n{\n    return _mm256_ceil_pd(v.data());\n}\n\n// fma {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vector<T, VectorAbi::Avx> fma(Vector<T, VectorAbi::Avx> a,\n                                               Vector<T, VectorAbi::Avx> b,\n                                               Vector<T, VectorAbi::Avx> c)\n{\n    return Detail::fma(a.data(), b.data(), c.data(), T());\n}\n\n// }}}1\n}  // namespace Vc\n\n#endif // VC_AVX_MATH_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/shuffle.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_SHUFFLE_H_\n#define VC_AVX_SHUFFLE_H_\n\n#include \"../sse/shuffle.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <int... Dst> struct Permutation {};\ntemplate <uint8_t... Sel> struct Mask {};\n\n#ifdef Vc_IMPL_AVX2\ntemplate <uint8_t Sel0, uint8_t Sel1, uint8_t Sel2, uint8_t Sel3, uint8_t Sel4,\n          uint8_t Sel5, uint8_t Sel6, uint8_t Sel7, uint8_t Sel8, uint8_t Sel9,\n          uint8_t Sel10, uint8_t Sel11, uint8_t Sel12, uint8_t Sel13, uint8_t Sel14,\n          uint8_t Sel15>\nVc_INTRINSIC Vc_CONST __m256i\nblend(__m256i a, __m256i b, Mask<Sel0, Sel1, Sel2, Sel3, Sel4, Sel5, Sel6, Sel7, Sel8,\n                                 Sel9, Sel10, Sel11, Sel12, Sel13, Sel14, Sel15>)\n{\n    static_assert((Sel0 == 0 || Sel0 == 1) && (Sel1 == 0 || Sel1 == 1) &&\n                      (Sel2 == 0 || Sel2 == 1) && (Sel3 == 0 || Sel3 == 1) &&\n                      (Sel4 == 0 || Sel4 == 1) && (Sel5 == 0 || Sel5 == 1) &&\n                      (Sel6 == 0 || Sel6 == 1) && (Sel7 == 0 || Sel7 == 1) &&\n                      (Sel8 == 0 || Sel8 == 1) && (Sel9 == 0 || Sel9 == 1) &&\n                      (Sel10 == 0 || Sel10 == 1) && (Sel11 == 0 || Sel11 == 1) &&\n                      (Sel12 == 0 || Sel12 == 1) && (Sel13 == 0 || Sel13 == 1) &&\n                      (Sel14 == 0 || Sel14 == 1) && (Sel15 == 0 || Sel15 == 1),\n                  \"Selectors must be 0 or 1 to select the value from a or b\");\n    constexpr uint8_t mask = static_cast<uint8_t>(\n        (Sel0  << 0 ) | (Sel1  << 1 ) | (Sel2  << 2 ) | (Sel3  << 3 ) |\n        (Sel4  << 4 ) | (Sel5  << 5 ) | (Sel6  << 6 ) | (Sel7  << 7 ) |\n        (Sel8  << 8 ) | (Sel9  << 9 ) | (Sel10 << 10) | (Sel11 << 11) |\n        (Sel12 << 12) | (Sel13 << 13) | (Sel14 << 14) | (Sel15 << 15));\n    return _mm256_blend_epi16(a, b, mask);\n}\n#endif  // Vc_IMPL_AVX2\n}  // namespace Detail\nnamespace Mem\n{\n#ifdef Vc_IMPL_AVX2\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256i Vc_CONST permuteLo(__m256i x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm256_shufflelo_epi16(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256i Vc_CONST permuteHi(__m256i x) {\n            static_assert(Dst0 >= X4 && Dst1 >= X4 && Dst2 >= X4 && Dst3 >= X4, \"Incorrect_Range\");\n            static_assert(Dst0 <= X7 && Dst1 <= X7 && Dst2 <= X7 && Dst3 <= X7, \"Incorrect_Range\");\n            return _mm256_shufflehi_epi16(x, (Dst0 - X4) + (Dst1 - X4) * 4 + (Dst2 - X4) * 16 + (Dst3 - X4) * 64);\n        }\n#endif  // Vc_IMPL_AVX2\n\n        template<VecPos L, VecPos H> static Vc_ALWAYS_INLINE __m256 Vc_CONST permute128(__m256 x) {\n            static_assert((L >= X0 && L <= X1) || L == Const0, \"Incorrect_Range\");\n            static_assert((H >= X0 && H <= X1) || H == Const0, \"Incorrect_Range\");\n            return _mm256_permute2f128_ps(\n                x, x, (L == Const0 ? 0x8 : L) + (H == Const0 ? 0x80 : H * (1 << 4)));\n        }\n        template<VecPos L, VecPos H> static Vc_ALWAYS_INLINE __m256d Vc_CONST permute128(__m256d x) {\n            static_assert((L >= X0 && L <= X1) || L == Const0, \"Incorrect_Range\");\n            static_assert((H >= X0 && H <= X1) || H == Const0, \"Incorrect_Range\");\n            return _mm256_permute2f128_pd(\n                x, x, (L == Const0 ? 0x8 : L) + (H == Const0 ? 0x80 : H * (1 << 4)));\n        }\n        template<VecPos L, VecPos H> static Vc_ALWAYS_INLINE __m256i Vc_CONST permute128(__m256i x) {\n            static_assert((L >= X0 && L <= X1) || L == Const0, \"Incorrect_Range\");\n            static_assert((H >= X0 && H <= X1) || H == Const0, \"Incorrect_Range\");\n#ifdef Vc_IMPL_AVX2\n            return _mm256_permute2x128_si256(\n                x, x, (L == Const0 ? 0x8 : L) + (H == Const0 ? 0x80 : H * (1 << 4)));\n#else\n            return _mm256_permute2f128_si256(\n                x, x, (L == Const0 ? 0x8 : L) + (H == Const0 ? 0x80 : H * (1 << 4)));\n#endif\n        }\n        template<VecPos L, VecPos H> static Vc_ALWAYS_INLINE __m256 Vc_CONST shuffle128(__m256 x, __m256 y) {\n            static_assert(L >= X0 && H >= X0, \"Incorrect_Range\");\n            static_assert(L <= Y1 && H <= Y1, \"Incorrect_Range\");\n            return _mm256_permute2f128_ps(x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n        }\n        template<VecPos L, VecPos H> static Vc_ALWAYS_INLINE __m256i Vc_CONST shuffle128(__m256i x, __m256i y) {\n            static_assert(L >= X0 && H >= X0, \"Incorrect_Range\");\n            static_assert(L <= Y1 && H <= Y1, \"Incorrect_Range\");\n#ifdef Vc_IMPL_AVX2\n            return _mm256_permute2x128_si256(\n                x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n#else\n            return _mm256_permute2f128_si256(\n                x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n#endif\n        }\n        template<VecPos L, VecPos H> static Vc_ALWAYS_INLINE __m256d Vc_CONST shuffle128(__m256d x, __m256d y) {\n            static_assert(L >= X0 && H >= X0, \"Incorrect_Range\");\n            static_assert(L <= Y1 && H <= Y1, \"Incorrect_Range\");\n            return _mm256_permute2f128_pd(x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n        }\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256d Vc_CONST permute(__m256d x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X2 && Dst3 >= X2, \"Incorrect_Range\");\n            static_assert(Dst0 <= X1 && Dst1 <= X1 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm256_permute_pd(x, Dst0 + Dst1 * 2 + (Dst2 - X2) * 4 + (Dst3 - X2) * 8);\n        }\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256 Vc_CONST permute(__m256 x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm256_permute_ps(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256i Vc_CONST permute(__m256i x) {\n            return _mm256_castps_si256(permute<Dst0, Dst1, Dst2, Dst3>(_mm256_castsi256_ps(x)));\n        }\n#ifdef Vc_IMPL_AVX2\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256i Vc_CONST permute4x64(__m256i x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm256_permute4x64_epi64(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n#endif  // Vc_IMPL_AVX2\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256d Vc_CONST shuffle(__m256d x, __m256d y) {\n            static_assert(Dst0 >= X0 && Dst1 >= Y0 && Dst2 >= X2 && Dst3 >= Y2, \"Incorrect_Range\");\n            static_assert(Dst0 <= X1 && Dst1 <= Y1 && Dst2 <= X3 && Dst3 <= Y3, \"Incorrect_Range\");\n            return _mm256_shuffle_pd(x, y, Dst0 + (Dst1 - Y0) * 2 + (Dst2 - X2) * 4 + (Dst3 - Y2) * 8);\n        }\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m256 Vc_CONST shuffle(__m256 x, __m256 y) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= Y0 && Dst3 >= Y0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= Y3 && Dst3 <= Y3, \"Incorrect_Range\");\n            return _mm256_shuffle_ps(x, y, Dst0 + Dst1 * 4 + (Dst2 - Y0) * 16 + (Dst3 - Y0) * 64);\n        }\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3, VecPos Dst4, VecPos Dst5, VecPos Dst6, VecPos Dst7>\n        static Vc_ALWAYS_INLINE __m256 Vc_CONST blend(__m256 x, __m256 y) {\n            static_assert(Dst0 == X0 || Dst0 == Y0, \"Incorrect_Range\");\n            static_assert(Dst1 == X1 || Dst1 == Y1, \"Incorrect_Range\");\n            static_assert(Dst2 == X2 || Dst2 == Y2, \"Incorrect_Range\");\n            static_assert(Dst3 == X3 || Dst3 == Y3, \"Incorrect_Range\");\n            static_assert(Dst4 == X4 || Dst4 == Y4, \"Incorrect_Range\");\n            static_assert(Dst5 == X5 || Dst5 == Y5, \"Incorrect_Range\");\n            static_assert(Dst6 == X6 || Dst6 == Y6, \"Incorrect_Range\");\n            static_assert(Dst7 == X7 || Dst7 == Y7, \"Incorrect_Range\");\n            return _mm256_blend_ps(x, y,\n                    (Dst0 / Y0) *  1 + (Dst1 / Y1) *  2 +\n                    (Dst2 / Y2) *  4 + (Dst3 / Y3) *  8 +\n                    (Dst4 / Y4) * 16 + (Dst5 / Y5) * 32 +\n                    (Dst6 / Y6) * 64 + (Dst7 / Y7) *128\n                    );\n        }\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3, VecPos Dst4, VecPos Dst5, VecPos Dst6, VecPos Dst7>\n        static Vc_ALWAYS_INLINE __m256i Vc_CONST blend(__m256i x, __m256i y) {\n            return _mm256_castps_si256(blend<Dst0, Dst1, Dst2, Dst3, Dst4, Dst5, Dst6, Dst7>(_mm256_castsi256_ps(x), _mm256_castsi256_ps(y)));\n        }\n        template<VecPos Dst> struct ScaleForBlend { enum { Value = Dst >= X4 ? Dst - X4 + Y0 : Dst }; };\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3, VecPos Dst4, VecPos Dst5, VecPos Dst6, VecPos Dst7>\n        static Vc_ALWAYS_INLINE __m256 Vc_CONST permute(__m256 x) {\n            static_assert(Dst0 >= X0 && Dst0 <= X7, \"Incorrect_Range\");\n            static_assert(Dst1 >= X0 && Dst1 <= X7, \"Incorrect_Range\");\n            static_assert(Dst2 >= X0 && Dst2 <= X7, \"Incorrect_Range\");\n            static_assert(Dst3 >= X0 && Dst3 <= X7, \"Incorrect_Range\");\n            static_assert(Dst4 >= X0 && Dst4 <= X7, \"Incorrect_Range\");\n            static_assert(Dst5 >= X0 && Dst5 <= X7, \"Incorrect_Range\");\n            static_assert(Dst6 >= X0 && Dst6 <= X7, \"Incorrect_Range\");\n            static_assert(Dst7 >= X0 && Dst7 <= X7, \"Incorrect_Range\");\n            if (Dst0 + X4 == Dst4 && Dst1 + X4 == Dst5 && Dst2 + X4 == Dst6 && Dst3 + X4 == Dst7) {\n                return permute<Dst0, Dst1, Dst2, Dst3>(x);\n            }\n            const __m128 loIn = _mm256_castps256_ps128(x);\n            const __m128 hiIn = _mm256_extractf128_ps(x, 1);\n            __m128 lo, hi;\n\n            if (Dst0 < X4 && Dst1 < X4 && Dst2 < X4 && Dst3 < X4) {\n                lo = _mm_permute_ps(loIn, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n            } else if (Dst0 >= X4 && Dst1 >= X4 && Dst2 >= X4 && Dst3 >= X4) {\n                lo = _mm_permute_ps(hiIn, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n            } else if (Dst0 < X4 && Dst1 < X4 && Dst2 >= X4 && Dst3 >= X4) {\n                lo = shuffle<Dst0, Dst1, Dst2 - X4 + Y0, Dst3 - X4 + Y0>(loIn, hiIn);\n            } else if (Dst0 >= X4 && Dst1 >= X4 && Dst2 < X4 && Dst3 < X4) {\n                lo = shuffle<Dst0 - X4, Dst1 - X4, Dst2 + Y0, Dst3 + Y0>(hiIn, loIn);\n            } else if (Dst0 == X0 && Dst1 == X4 && Dst2 == X1 && Dst3 == X5) {\n                lo = _mm_unpacklo_ps(loIn, hiIn);\n            } else if (Dst0 == X4 && Dst1 == X0 && Dst2 == X5 && Dst3 == X1) {\n                lo = _mm_unpacklo_ps(hiIn, loIn);\n            } else if (Dst0 == X2 && Dst1 == X6 && Dst2 == X3 && Dst3 == X7) {\n                lo = _mm_unpackhi_ps(loIn, hiIn);\n            } else if (Dst0 == X6 && Dst1 == X2 && Dst2 == X7 && Dst3 == X3) {\n                lo = _mm_unpackhi_ps(hiIn, loIn);\n            } else if (Dst0 % X4 == 0 && Dst1 % X4 == 1 && Dst2 % X4 == 2 && Dst3 % X4 == 3) {\n                lo = blend<ScaleForBlend<Dst0>::Value, ScaleForBlend<Dst1>::Value,\n                   ScaleForBlend<Dst2>::Value, ScaleForBlend<Dst3>::Value>(loIn, hiIn);\n            }\n\n            if (Dst4 >= X4 && Dst5 >= X4 && Dst6 >= X4 && Dst7 >= X4) {\n                hi = _mm_permute_ps(hiIn, (Dst4 - X4) + (Dst5 - X4) * 4 + (Dst6 - X4) * 16 + (Dst7 - X4) * 64);\n            } else if (Dst4 < X4 && Dst5 < X4 && Dst6 < X4 && Dst7 < X4) {\n                hi = _mm_permute_ps(loIn, (Dst4 - X4) + (Dst5 - X4) * 4 + (Dst6 - X4) * 16 + (Dst7 - X4) * 64);\n            } else if (Dst4 < X4 && Dst5 < X4 && Dst6 >= X4 && Dst7 >= X4) {\n                hi = shuffle<Dst4, Dst5, Dst6 - X4 + Y0, Dst7 - X4 + Y0>(loIn, hiIn);\n            } else if (Dst4 >= X4 && Dst5 >= X4 && Dst6 < X4 && Dst7 < X4) {\n                hi = shuffle<Dst4 - X4, Dst5 - X4, Dst6 + Y0, Dst7 + Y0>(hiIn, loIn);\n            } else if (Dst4 == X0 && Dst5 == X4 && Dst6 == X1 && Dst7 == X5) {\n                hi = _mm_unpacklo_ps(loIn, hiIn);\n            } else if (Dst4 == X4 && Dst5 == X0 && Dst6 == X5 && Dst7 == X1) {\n                hi = _mm_unpacklo_ps(hiIn, loIn);\n            } else if (Dst4 == X2 && Dst5 == X6 && Dst6 == X3 && Dst7 == X7) {\n                hi = _mm_unpackhi_ps(loIn, hiIn);\n            } else if (Dst4 == X6 && Dst5 == X2 && Dst6 == X7 && Dst7 == X3) {\n                hi = _mm_unpackhi_ps(hiIn, loIn);\n            } else if (Dst4 % X4 == 0 && Dst5 % X4 == 1 && Dst6 % X4 == 2 && Dst7 % X4 == 3) {\n                hi = blend<ScaleForBlend<Dst4>::Value, ScaleForBlend<Dst5>::Value,\n                   ScaleForBlend<Dst6>::Value, ScaleForBlend<Dst7>::Value>(loIn, hiIn);\n            }\n\n            return _mm256_insertf128_ps(_mm256_castps128_ps256(lo), hi, 1);\n        }\n}  // namespace Mem\n}  // namespace Vc\n\n    // little endian has the lo bits on the right and high bits on the left\n    // with vectors this becomes greatly confusing:\n    // Mem: abcd\n    // Reg: dcba\n    //\n    // The shuffles and permutes above use memory ordering. The ones below use register ordering:\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Reg\n{\n        template<VecPos H, VecPos L> static Vc_ALWAYS_INLINE __m256 Vc_CONST permute128(__m256 x, __m256 y) {\n            static_assert(L >= X0 && H >= X0, \"Incorrect_Range\");\n            static_assert(L <= Y1 && H <= Y1, \"Incorrect_Range\");\n            return _mm256_permute2f128_ps(x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n        }\n        template<VecPos H, VecPos L> static Vc_ALWAYS_INLINE __m256i Vc_CONST permute128(__m256i x, __m256i y) {\n            static_assert(L >= X0 && H >= X0, \"Incorrect_Range\");\n            static_assert(L <= Y1 && H <= Y1, \"Incorrect_Range\");\n#ifdef Vc_IMPL_AVX2\n            return _mm256_permute2x128_si256(\n                x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n#else\n            return _mm256_permute2f128_si256(\n                x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n#endif\n        }\n        template<VecPos H, VecPos L> static Vc_ALWAYS_INLINE __m256d Vc_CONST permute128(__m256d x, __m256d y) {\n            static_assert(L >= X0 && H >= X0, \"Incorrect_Range\");\n            static_assert(L <= Y1 && H <= Y1, \"Incorrect_Range\");\n            return _mm256_permute2f128_pd(x, y, (L < Y0 ? L : L - Y0 + 2) + (H < Y0 ? H : H - Y0 + 2) * (1 << 4));\n        }\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m256d Vc_CONST permute(__m256d x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X2 && Dst3 >= X2, \"Incorrect_Range\");\n            static_assert(Dst0 <= X1 && Dst1 <= X1 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm256_permute_pd(x, Dst0 + Dst1 * 2 + (Dst2 - X2) * 4 + (Dst3 - X2) * 8);\n        }\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m256 Vc_CONST permute(__m256 x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm256_permute_ps(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n        template<VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128d Vc_CONST permute(__m128d x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X1 && Dst1 <= X1, \"Incorrect_Range\");\n            return _mm_permute_pd(x, Dst0 + Dst1 * 2);\n        }\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128 Vc_CONST permute(__m128 x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm_permute_ps(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m256d Vc_CONST shuffle(__m256d x, __m256d y) {\n            static_assert(Dst0 >= X0 && Dst1 >= Y0 && Dst2 >= X2 && Dst3 >= Y2, \"Incorrect_Range\");\n            static_assert(Dst0 <= X1 && Dst1 <= Y1 && Dst2 <= X3 && Dst3 <= Y3, \"Incorrect_Range\");\n            return _mm256_shuffle_pd(x, y, Dst0 + (Dst1 - Y0) * 2 + (Dst2 - X2) * 4 + (Dst3 - Y2) * 8);\n        }\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m256 Vc_CONST shuffle(__m256 x, __m256 y) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= Y0 && Dst3 >= Y0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= Y3 && Dst3 <= Y3, \"Incorrect_Range\");\n            return _mm256_shuffle_ps(x, y, Dst0 + Dst1 * 4 + (Dst2 - Y0) * 16 + (Dst3 - Y0) * 64);\n        }\n}  // namespace Reg\n}  // namespace Vc\n\n#endif // VC_AVX_SHUFFLE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/simd_cast.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_SIMD_CAST_H_\n#define VC_AVX_SIMD_CAST_H_\n\n#ifndef VC_AVX_VECTOR_H_\n#error \"Vc/avx/vector.h needs to be included before Vc/avx/simd_cast.h\"\n#endif\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// Declarations: helper macros Vc_SIMD_CAST_AVX_[124] & Vc_SIMD_CAST_[124] {{{1\n#define Vc_SIMD_CAST_AVX_1(from_, to_)                                                   \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        AVX2::from_ x, enable_if<std::is_same<To, AVX2::to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_AVX_2(from_, to_)                                                   \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        AVX2::from_ x0, AVX2::from_ x1,                                                  \\\n        enable_if<std::is_same<To, AVX2::to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_AVX_3(from_, to_)                                                   \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        AVX2::from_ x0, AVX2::from_ x1, AVX2::from_ x2,                                  \\\n        enable_if<std::is_same<To, AVX2::to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_AVX_4(from_, to_)                                                   \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        AVX2::from_ x0, AVX2::from_ x1, AVX2::from_ x2, AVX2::from_ x3,                  \\\n        enable_if<std::is_same<To, AVX2::to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_1(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x, enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_2(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_3(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_4(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, from_ x3,                                          \\\n        enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_5(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, from_ x3, from_ x4,                                \\\n        enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_6(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, from_ x5,                      \\\n        enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_7(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, from_ x5, from_ x6,            \\\n        enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_8(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, from_ x5, from_ x6, from_ x7,  \\\n        enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_OFFSET(from_, to_, offset_)                                         \\\n    static_assert(from_::size() >= to_::size() * (offset_ + 1),                          \\\n                  \"this offset cannot exist for this type combination\");                 \\\n    template <typename To, int offset>                                                   \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x,                                                                         \\\n        enable_if<(offset == offset_ && std::is_same<To, to_>::value)> = nullarg)\n\n// Declaration: SSE -> AVX where the AVX Vector is integral and thus of equal size() {{{1\n// as the equivalent SSE Vector\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(From x, enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n                             SSE::Vector<typename To::EntryType>::Size == To::Size)> =\n                      nullarg);\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To simd_cast(\n    From x0, From x1,\n    enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n               SSE::Vector<typename To::EntryType>::Size == To::Size)> = nullarg);\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To simd_cast(\n    From x0, From x1, From x2,\n    enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n               SSE::Vector<typename To::EntryType>::Size == To::Size)> = nullarg);\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To simd_cast(\n    From x0, From x1, From x2, From x3,\n    enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n               SSE::Vector<typename To::EntryType>::Size == To::Size)> = nullarg);\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To simd_cast(\n    From x0, From x1, From x2, From x3, From x4, From x5, From x6, From x7,\n    enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n               SSE::Vector<typename To::EntryType>::Size == To::Size)> = nullarg);\n\n// Declarations: Vector casts without offset {{{1\n// AVX2::Vector {{{2\nVc_SIMD_CAST_AVX_1( float_v, double_v);\n\nVc_SIMD_CAST_AVX_1(double_v,  float_v);\nVc_SIMD_CAST_AVX_2(double_v,  float_v);\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_1(   int_v, double_v);\nVc_SIMD_CAST_AVX_1(  uint_v, double_v);\nVc_SIMD_CAST_AVX_1( short_v, double_v);\nVc_SIMD_CAST_AVX_1(ushort_v, double_v);\n\nVc_SIMD_CAST_AVX_1(   int_v,  float_v);\nVc_SIMD_CAST_AVX_1(  uint_v,  float_v);\nVc_SIMD_CAST_AVX_1( short_v,  float_v);\nVc_SIMD_CAST_AVX_1(ushort_v,  float_v);\n\nVc_SIMD_CAST_AVX_1(double_v,    int_v);\nVc_SIMD_CAST_AVX_1( float_v,    int_v);\nVc_SIMD_CAST_AVX_1(  uint_v,    int_v);\nVc_SIMD_CAST_AVX_1( short_v,    int_v);\nVc_SIMD_CAST_AVX_1(ushort_v,    int_v);\nVc_SIMD_CAST_AVX_2(double_v,    int_v);\n\nVc_SIMD_CAST_AVX_1(double_v,   uint_v);\nVc_SIMD_CAST_AVX_1( float_v,   uint_v);\nVc_SIMD_CAST_AVX_1(   int_v,   uint_v);\nVc_SIMD_CAST_AVX_1( short_v,   uint_v);\nVc_SIMD_CAST_AVX_1(ushort_v,   uint_v);\nVc_SIMD_CAST_AVX_2(double_v,   uint_v);\n\nVc_SIMD_CAST_AVX_1(double_v,  short_v);\nVc_SIMD_CAST_AVX_1( float_v,  short_v);\nVc_SIMD_CAST_AVX_1(   int_v,  short_v);\nVc_SIMD_CAST_AVX_1(  uint_v,  short_v);\nVc_SIMD_CAST_AVX_1(ushort_v,  short_v);\nVc_SIMD_CAST_AVX_2(double_v,  short_v);\nVc_SIMD_CAST_AVX_2( float_v,  short_v);\nVc_SIMD_CAST_AVX_2(   int_v,  short_v);\nVc_SIMD_CAST_AVX_2(  uint_v,  short_v);\nVc_SIMD_CAST_AVX_3(double_v,  short_v);\nVc_SIMD_CAST_AVX_4(double_v,  short_v);\n\nVc_SIMD_CAST_AVX_1(double_v, ushort_v);\nVc_SIMD_CAST_AVX_1( float_v, ushort_v);\nVc_SIMD_CAST_AVX_1(   int_v, ushort_v);\nVc_SIMD_CAST_AVX_1(  uint_v, ushort_v);\nVc_SIMD_CAST_AVX_1( short_v, ushort_v);\nVc_SIMD_CAST_AVX_2(double_v, ushort_v);\nVc_SIMD_CAST_AVX_2( float_v, ushort_v);\nVc_SIMD_CAST_AVX_2(   int_v, ushort_v);\nVc_SIMD_CAST_AVX_2(  uint_v, ushort_v);\nVc_SIMD_CAST_AVX_3(double_v, ushort_v);\nVc_SIMD_CAST_AVX_4(double_v, ushort_v);\n#endif\n\n// 1 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_1(SSE::double_v, AVX2::double_v);\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::double_v);\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::double_v);\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::double_v);\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::double_v);\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::double_v);\n\nVc_SIMD_CAST_1(SSE::double_v, AVX2:: float_v);\nVc_SIMD_CAST_1(SSE:: float_v, AVX2:: float_v);\nVc_SIMD_CAST_1(SSE::   int_v, AVX2:: float_v);\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2:: float_v);\nVc_SIMD_CAST_1(SSE:: short_v, AVX2:: float_v);\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2:: float_v);\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(SSE::double_v, AVX2::   int_v);\nVc_SIMD_CAST_1(SSE::double_v, AVX2::  uint_v);\nVc_SIMD_CAST_1(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_1(SSE::double_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::   int_v);\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::  uint_v);\nVc_SIMD_CAST_1(SSE:: float_v, AVX2:: short_v);\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::   int_v);\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::   int_v);\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::   int_v);\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::   int_v);\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::  uint_v);\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::  uint_v);\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::  uint_v);\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::  uint_v);\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2:: short_v);\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2:: short_v);\nVc_SIMD_CAST_1(SSE:: short_v, AVX2:: short_v);\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2:: short_v);\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::ushort_v);\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::ushort_v);\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::ushort_v);\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::ushort_v);\n#endif\n\n// 2 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_2(SSE::double_v, AVX2::double_v);\n\nVc_SIMD_CAST_2(SSE::double_v, AVX2:: float_v);\nVc_SIMD_CAST_2(SSE:: float_v, AVX2:: float_v);\nVc_SIMD_CAST_2(SSE::   int_v, AVX2:: float_v);\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2:: float_v);\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_2(SSE::double_v, AVX2::   int_v);\nVc_SIMD_CAST_2(SSE::double_v, AVX2::  uint_v);\nVc_SIMD_CAST_2(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_2(SSE::double_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_2(SSE:: float_v, AVX2::   int_v);\nVc_SIMD_CAST_2(SSE:: float_v, AVX2::  uint_v);\nVc_SIMD_CAST_2(SSE:: float_v, AVX2:: short_v);\nVc_SIMD_CAST_2(SSE:: float_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2::   int_v);\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2::   int_v);\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2::  uint_v);\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2::  uint_v);\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2:: short_v);\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2:: short_v);\nVc_SIMD_CAST_2(SSE:: short_v, AVX2:: short_v);\nVc_SIMD_CAST_2(SSE::ushort_v, AVX2:: short_v);\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2::ushort_v);\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2::ushort_v);\nVc_SIMD_CAST_2(SSE:: short_v, AVX2::ushort_v);\nVc_SIMD_CAST_2(SSE::ushort_v, AVX2::ushort_v);\n#endif\n\n// 3 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_3(SSE::double_v, AVX2:: float_v);\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_3(SSE::double_v, AVX2::   int_v);\nVc_SIMD_CAST_3(SSE::double_v, AVX2::  uint_v);\nVc_SIMD_CAST_3(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_3(SSE::double_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_3(SSE:: float_v, AVX2:: short_v);\nVc_SIMD_CAST_3(SSE:: float_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_3(SSE::   int_v, AVX2:: short_v);\nVc_SIMD_CAST_3(SSE::  uint_v, AVX2:: short_v);\n\nVc_SIMD_CAST_3(SSE::   int_v, AVX2::ushort_v);\nVc_SIMD_CAST_3(SSE::  uint_v, AVX2::ushort_v);\n#endif\n\n// 4 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_4(SSE::double_v, AVX2:: float_v);\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_4(SSE::double_v, AVX2::   int_v);\nVc_SIMD_CAST_4(SSE::double_v, AVX2::  uint_v);\nVc_SIMD_CAST_4(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_4(SSE::double_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_4(SSE:: float_v, AVX2:: short_v);\nVc_SIMD_CAST_4(SSE:: float_v, AVX2::ushort_v);\n\nVc_SIMD_CAST_4(SSE::   int_v, AVX2:: short_v);\nVc_SIMD_CAST_4(SSE::  uint_v, AVX2:: short_v);\n\nVc_SIMD_CAST_4(SSE::   int_v, AVX2::ushort_v);\nVc_SIMD_CAST_4(SSE::  uint_v, AVX2::ushort_v);\n#endif\n\n// 5 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_5(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_5(SSE::double_v, AVX2::ushort_v);\n#endif\n\n// 6 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_6(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_6(SSE::double_v, AVX2::ushort_v);\n#endif\n\n// 7 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_7(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_7(SSE::double_v, AVX2::ushort_v);\n#endif\n\n// 8 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_8(SSE::double_v, AVX2:: short_v);\nVc_SIMD_CAST_8(SSE::double_v, AVX2::ushort_v);\n#endif\n\n// 1 AVX2::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_1(AVX2::double_v, SSE::double_v);\nVc_SIMD_CAST_1(AVX2::double_v, SSE:: float_v);\nVc_SIMD_CAST_1(AVX2::double_v, SSE::   int_v);\nVc_SIMD_CAST_1(AVX2::double_v, SSE::  uint_v);\nVc_SIMD_CAST_1(AVX2::double_v, SSE:: short_v);\nVc_SIMD_CAST_1(AVX2::double_v, SSE::ushort_v);\n\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::double_v);\nVc_SIMD_CAST_1(AVX2:: float_v, SSE:: float_v);\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::   int_v);\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::  uint_v);\nVc_SIMD_CAST_1(AVX2:: float_v, SSE:: short_v);\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::ushort_v);\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::double_v);\nVc_SIMD_CAST_1(AVX2::   int_v, SSE:: float_v);\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::  uint_v);\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::   int_v);\nVc_SIMD_CAST_1(AVX2::   int_v, SSE:: short_v);\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::ushort_v);\n\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::double_v);\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE:: float_v);\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::   int_v);\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::  uint_v);\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE:: short_v);\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::ushort_v);\n\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::double_v);\nVc_SIMD_CAST_1(AVX2:: short_v, SSE:: float_v);\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::   int_v);\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::  uint_v);\nVc_SIMD_CAST_1(AVX2:: short_v, SSE:: short_v);\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::ushort_v);\n\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::double_v);\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE:: float_v);\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::   int_v);\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::  uint_v);\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE:: short_v);\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::ushort_v);\n#endif\n\n// 2 AVX2::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_2(AVX2::double_v, SSE:: short_v);\nVc_SIMD_CAST_2(AVX2::double_v, SSE::ushort_v);\n\n// 1 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::double_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 2 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::double_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 3 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::double_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 4 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::double_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 5 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 6 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 7 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 8 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::float_v>::value> = nullarg);\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 9 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 10 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 11 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 12 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 13 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 14 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 15 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 16 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          Scalar::Vector<T> x15,\n          enable_if<std::is_same<Return, AVX2::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          Scalar::Vector<T> x15,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value> = nullarg);\n#endif\n\n// 1 AVX2::Vector to 1 Scalar::Vector {{{2\ntemplate <typename To, typename FromT>\nVc_INTRINSIC Vc_CONST To simd_cast(AVX2::Vector<FromT> x,\n                                   enable_if<Scalar::is_vector<To>::value> = nullarg);\n\n// Declarations: Mask casts without offset {{{1\n// 1 AVX2::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(const AVX2::Mask<T> &k, enable_if<AVX2::is_mask<Return>::value> = nullarg);\n\n// 2 AVX2::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_AVX_2(double_m,  float_m);\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_2(double_m,    int_m);\nVc_SIMD_CAST_AVX_2(double_m,   uint_m);\nVc_SIMD_CAST_AVX_2(double_m,  short_m);\nVc_SIMD_CAST_AVX_2(double_m, ushort_m);\n\nVc_SIMD_CAST_AVX_2( float_m,  short_m);\nVc_SIMD_CAST_AVX_2( float_m, ushort_m);\n\nVc_SIMD_CAST_AVX_2(   int_m,  short_m);\nVc_SIMD_CAST_AVX_2(   int_m, ushort_m);\n\nVc_SIMD_CAST_AVX_2(  uint_m,  short_m);\nVc_SIMD_CAST_AVX_2(  uint_m, ushort_m);\n#endif\n\n// 4 AVX2::Mask to 1 AVX2::Mask {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_4(double_m,  short_m);\nVc_SIMD_CAST_AVX_4(double_m, ushort_m);\n#endif\n\n// 1 SSE::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_1(SSE::double_m, AVX2::double_m);\nVc_SIMD_CAST_1(SSE::double_m, AVX2:: float_m);\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(SSE::double_m, AVX2::   int_m);\nVc_SIMD_CAST_1(SSE::double_m, AVX2::  uint_m);\nVc_SIMD_CAST_1(SSE::double_m, AVX2:: short_m);\nVc_SIMD_CAST_1(SSE::double_m, AVX2::ushort_m);\n#endif\n\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::double_m);\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::double_m);\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::double_m);\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::double_m);\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::double_m);\n\nVc_SIMD_CAST_1(SSE:: float_m, AVX2:: float_m);\nVc_SIMD_CAST_1(SSE::   int_m, AVX2:: float_m);\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2:: float_m);\nVc_SIMD_CAST_1(SSE:: short_m, AVX2:: float_m);\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2:: float_m);\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::   int_m);\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::  uint_m);\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::   int_m);\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::  uint_m);\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::   int_m);\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::  uint_m);\n\nVc_SIMD_CAST_1(SSE:: float_m, AVX2:: short_m);\nVc_SIMD_CAST_1(SSE::   int_m, AVX2:: short_m);\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2:: short_m);\nVc_SIMD_CAST_1(SSE:: short_m, AVX2:: short_m);\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2:: short_m);\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::ushort_m);\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::ushort_m);\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::ushort_m);\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::ushort_m);\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::ushort_m);\n\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::   int_m);\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::  uint_m);\n\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::   int_m);\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::  uint_m);\n#endif\n\n// 2 SSE::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_2(SSE::double_m, AVX2::double_m);\nVc_SIMD_CAST_2(SSE::double_m, AVX2:: float_m);\nVc_SIMD_CAST_2(SSE:: float_m, AVX2:: float_m);\nVc_SIMD_CAST_2(SSE::   int_m, AVX2:: float_m);\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2:: float_m);\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_2(SSE::double_m, AVX2::   int_m);\nVc_SIMD_CAST_2(SSE::double_m, AVX2::  uint_m);\nVc_SIMD_CAST_2(SSE::double_m, AVX2:: short_m);\nVc_SIMD_CAST_2(SSE::double_m, AVX2::ushort_m);\n\nVc_SIMD_CAST_2(SSE:: float_m, AVX2::   int_m);\nVc_SIMD_CAST_2(SSE:: float_m, AVX2::  uint_m);\nVc_SIMD_CAST_2(SSE:: float_m, AVX2:: short_m);\nVc_SIMD_CAST_2(SSE:: float_m, AVX2::ushort_m);\n\nVc_SIMD_CAST_2(SSE::   int_m, AVX2::   int_m);\nVc_SIMD_CAST_2(SSE::   int_m, AVX2::  uint_m);\nVc_SIMD_CAST_2(SSE::   int_m, AVX2:: short_m);\nVc_SIMD_CAST_2(SSE::   int_m, AVX2::ushort_m);\n\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2::   int_m);\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2::  uint_m);\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2:: short_m);\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2::ushort_m);\n\nVc_SIMD_CAST_2(SSE:: short_m, AVX2:: short_m);\nVc_SIMD_CAST_2(SSE:: short_m, AVX2::ushort_m);\nVc_SIMD_CAST_2(SSE::ushort_m, AVX2:: short_m);\nVc_SIMD_CAST_2(SSE::ushort_m, AVX2::ushort_m);\n#endif\n\n// 4 SSE::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_4(SSE::double_m, AVX2:: float_m);\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_4(SSE::double_m, AVX2::   int_m);\nVc_SIMD_CAST_4(SSE::double_m, AVX2::  uint_m);\nVc_SIMD_CAST_4(SSE::double_m, AVX2:: short_m);\nVc_SIMD_CAST_4(SSE::double_m, AVX2::ushort_m);\nVc_SIMD_CAST_4(SSE:: float_m, AVX2:: short_m);\nVc_SIMD_CAST_4(SSE:: float_m, AVX2::ushort_m);\nVc_SIMD_CAST_4(SSE::   int_m, AVX2:: short_m);\nVc_SIMD_CAST_4(SSE::   int_m, AVX2::ushort_m);\nVc_SIMD_CAST_4(SSE::  uint_m, AVX2:: short_m);\nVc_SIMD_CAST_4(SSE::  uint_m, AVX2::ushort_m);\n#endif\n\n// 1 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k,\n          enable_if<AVX2::is_mask<Return>::value> = nullarg);\n\n// 2 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k0, Scalar::Mask<T> k1,\n          enable_if<AVX2::is_mask<Return>::value> = nullarg);\n\n// 4 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    Scalar::Mask<T> k0, Scalar::Mask<T> k1, Scalar::Mask<T> k2, Scalar::Mask<T> k3,\n    enable_if<(AVX2::is_mask<Return>::value && Return::Size >= 4)> = nullarg);\n\n// 8 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    Scalar::Mask<T> k0, Scalar::Mask<T> k1, Scalar::Mask<T> k2, Scalar::Mask<T> k3,\n    Scalar::Mask<T> k4, Scalar::Mask<T> k5, Scalar::Mask<T> k6, Scalar::Mask<T> k7,\n    enable_if<(AVX2::is_mask<Return>::value && Return::Size >= 8)> = nullarg);\n\n// 16 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k0, Scalar::Mask<T> k1, Scalar::Mask<T> k2, Scalar::Mask<T> k3,\n          Scalar::Mask<T> k4, Scalar::Mask<T> k5, Scalar::Mask<T> k6, Scalar::Mask<T> k7,\n          Scalar::Mask<T> k8, Scalar::Mask<T> k9, Scalar::Mask<T> k10,\n          Scalar::Mask<T> k11, Scalar::Mask<T> k12, Scalar::Mask<T> k13,\n          Scalar::Mask<T> k14, Scalar::Mask<T> k15,\n          enable_if<(AVX2::is_mask<Return>::value && Return::Size >= 16)> = nullarg);\n\n// 1 AVX2::Mask to 1 SSE::Mask {{{2\nVc_SIMD_CAST_1(AVX2::double_m, SSE::double_m);\nVc_SIMD_CAST_1(AVX2::double_m, SSE:: float_m);\nVc_SIMD_CAST_1(AVX2::double_m, SSE::   int_m);\nVc_SIMD_CAST_1(AVX2::double_m, SSE::  uint_m);\nVc_SIMD_CAST_1(AVX2::double_m, SSE:: short_m);\nVc_SIMD_CAST_1(AVX2::double_m, SSE::ushort_m);\n\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::double_m);\nVc_SIMD_CAST_1(AVX2:: float_m, SSE:: float_m);\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::   int_m);\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::  uint_m);\nVc_SIMD_CAST_1(AVX2:: float_m, SSE:: short_m);\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::ushort_m);\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::double_m);\nVc_SIMD_CAST_1(AVX2::   int_m, SSE:: float_m);\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::   int_m);\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::  uint_m);\nVc_SIMD_CAST_1(AVX2::   int_m, SSE:: short_m);\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::ushort_m);\n\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::double_m);\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE:: float_m);\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::   int_m);\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::  uint_m);\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE:: short_m);\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::ushort_m);\n\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::double_m);\nVc_SIMD_CAST_1(AVX2:: short_m, SSE:: float_m);\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::   int_m);\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::  uint_m);\nVc_SIMD_CAST_1(AVX2:: short_m, SSE:: short_m);\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::ushort_m);\n\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::double_m);\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE:: float_m);\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::   int_m);\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::  uint_m);\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE:: short_m);\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::ushort_m);\n#endif\n\n// 2 AVX2::Mask to 1 SSE::Mask {{{2\nVc_SIMD_CAST_2(AVX2::double_m, SSE:: short_m);\nVc_SIMD_CAST_2(AVX2::double_m, SSE::ushort_m);\n\n// 1 AVX2::Mask to 1 Scalar::Mask {{{2\ntemplate <typename To, typename FromT>\nVc_INTRINSIC Vc_CONST To simd_cast(AVX2::Mask<FromT> x,\n                                   enable_if<Scalar::is_mask<To>::value> = nullarg);\n\n// Declaration: offset == 0 | convert from AVX2::Mask/Vector {{{1\ntemplate <typename Return, int offset, typename From>\nVc_INTRINSIC Vc_CONST enable_if<\n    (offset == 0 &&\n     ((AVX2::is_vector<From>::value && !Scalar::is_vector<Return>::value &&\n       Traits::is_simd_vector<Return>::value && !Traits::isSimdArray<Return>::value) ||\n      (AVX2::is_mask<From>::value && !Scalar::is_mask<Return>::value &&\n       Traits::is_simd_mask<Return>::value &&\n       !Traits::isSimdMaskArray<Return>::value))),\n    Return>\nsimd_cast(const From &x);\n// Declaration: offset == 0 | convert from SSE::Mask/Vector to AVX2::Mask/Vector {{{1\ntemplate <typename Return, int offset, typename From>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    const From &x,\n    enable_if<offset == 0 && ((SSE::is_vector<From>::value &&\n                               AVX2::is_vector<Return>::value) ||\n                              (SSE::is_mask<From>::value &&\n                               AVX2::is_mask<Return>::value))> = nullarg);\n\n// Declarations: Vector casts with offset {{{1\n// AVX2 to AVX2 {{{2\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(AVX2::is_vector<Return>::value && offset != 0),\n                                Return>\nsimd_cast(AVX2::Vector<T> x);\n// AVX2 to SSE (Vector<T>) {{{2\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_vector<Return>::value &&\n                                 sizeof(AVX2::Vector<T>) == 32),\n                                Return>\nsimd_cast(AVX2::Vector<T> x);\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_vector<Return>::value &&\n                                 sizeof(AVX2::Vector<T>) == 16),\n                                Return>\nsimd_cast(AVX2::Vector<T> x);\n// SSE to AVX2 {{{2\nVc_SIMD_CAST_OFFSET(SSE:: short_v, AVX2::double_v, 1);\nVc_SIMD_CAST_OFFSET(SSE::ushort_v, AVX2::double_v, 1);\n\n// Declarations: Mask casts with offset {{{1\n// 1 AVX2::Mask to N AVX2::Mask {{{2\n/* This declaration confuses GCC (4.9.2). If the declarations are there the definitions\n * are ignored by the compiler. ;-(\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC_L Vc_CONST_L Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<sizeof(k) == 32 && sizeof(Return) == 32 && offset == 1 &&\n                    AVX2::is_mask<Return>::value> = nullarg) Vc_INTRINSIC_R Vc_CONST_R;\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC_L Vc_CONST_L Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<sizeof(k) == 32 && sizeof(Return) == 16 && offset == 1 &&\n                    AVX2::is_mask<Return>::value> = nullarg) Vc_INTRINSIC_R Vc_CONST_R;\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC_L Vc_CONST_L Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<sizeof(k) == 16 && sizeof(Return) == 32 && offset == 1 &&\n                    AVX2::is_mask<Return>::value> = nullarg) Vc_INTRINSIC_R Vc_CONST_R;\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC_L Vc_CONST_L Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<sizeof(k) == 16 && sizeof(Return) == 16 && offset == 1 &&\n                    AVX2::is_mask<Return>::value> = nullarg) Vc_INTRINSIC_R Vc_CONST_R;\n                    */\n\n// 1 SSE::Mask to N AVX2(2)::Mask {{{2\nVc_SIMD_CAST_OFFSET(SSE:: short_m, AVX2::double_m, 1);\nVc_SIMD_CAST_OFFSET(SSE::ushort_m, AVX2::double_m, 1);\n\n// AVX2 to SSE (Mask<T>) {{{2\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_mask<Return>::value &&\n                                 sizeof(AVX2::Mask<T>) == 32),\n                                Return>\nsimd_cast(AVX2::Mask<T> x);\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_mask<Return>::value &&\n                                 sizeof(AVX2::Mask<T>) == 16),\n                                Return>\nsimd_cast(AVX2::Mask<T> x);\n\n// helper macros Vc_SIMD_CAST_AVX_[124] & Vc_SIMD_CAST_[124] {{{1\n#undef Vc_SIMD_CAST_AVX_1\n#define Vc_SIMD_CAST_AVX_1(from_, to_)                                                   \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(AVX2::from_ x,                                    \\\n                                       enable_if<std::is_same<To, AVX2::to_>::value>)\n\n#undef Vc_SIMD_CAST_AVX_2\n#define Vc_SIMD_CAST_AVX_2(from_, to_)                                                   \\\n    static_assert(AVX2::from_::size() * 2 <= AVX2::to_::size(),                          \\\n                  \"this type combination is wrong\");                                     \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(AVX2::from_ x0, AVX2::from_ x1,                   \\\n                                       enable_if<std::is_same<To, AVX2::to_>::value>)\n\n#undef Vc_SIMD_CAST_AVX_3\n#define Vc_SIMD_CAST_AVX_3(from_, to_)                                                   \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(AVX2::from_ x0, AVX2::from_ x1, AVX2::from_ x2,   \\\n                                       enable_if<std::is_same<To, AVX2::to_>::value>)\n\n#undef Vc_SIMD_CAST_AVX_4\n#define Vc_SIMD_CAST_AVX_4(from_, to_)                                                   \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(AVX2::from_ x0, AVX2::from_ x1, AVX2::from_ x2,   \\\n                                       AVX2::from_ x3,                                   \\\n                                       enable_if<std::is_same<To, AVX2::to_>::value>)\n\n#undef Vc_SIMD_CAST_1\n#define Vc_SIMD_CAST_1(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x, enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_2\n#define Vc_SIMD_CAST_2(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1,                               \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_3\n#define Vc_SIMD_CAST_3(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2,                     \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_4\n#define Vc_SIMD_CAST_4(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2, from_ x3,           \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_5\n#define Vc_SIMD_CAST_5(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_6\n#define Vc_SIMD_CAST_6(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, \\\n                                       from_ x5,                                         \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_7\n#define Vc_SIMD_CAST_7(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, \\\n                                       from_ x5, from_ x6,                               \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_8\n#define Vc_SIMD_CAST_8(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, \\\n                                       from_ x5, from_ x6, from_ x7,                     \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#undef Vc_SIMD_CAST_OFFSET\n#define Vc_SIMD_CAST_OFFSET(from_, to_, offset_)                                         \\\n    static_assert(from_::size() >= to_::size() * (offset_ + 1),                          \\\n                  \"this offset cannot exist for this type combination\");                 \\\n    template <typename To, int offset>                                                   \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x, enable_if<(offset == offset_ && std::is_same<To, to_>::value)>)\n\n// SSE -> AVX2 where the AVX2 Vector is integral and thus of equal size() as the {{{1\n// equivalent SSE Vector\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(From x, enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n                             SSE::Vector<typename To::EntryType>::Size == To::Size)>)\n{\n    return simd_cast<SSE::Vector<typename To::EntryType>>(x).data();\n}\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(From x0, From x1,\n          enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n                     SSE::Vector<typename To::EntryType>::Size == To::Size)>)\n{\n    return simd_cast<SSE::Vector<typename To::EntryType>>(x0, x1).data();\n}\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(From x0, From x1, From x2,\n          enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n                     SSE::Vector<typename To::EntryType>::Size == To::Size)>)\n{\n    return simd_cast<SSE::Vector<typename To::EntryType>>(x0, x1, x2).data();\n}\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(From x0, From x1, From x2, From x3,\n          enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n                     SSE::Vector<typename To::EntryType>::Size == To::Size)>)\n{\n    return simd_cast<SSE::Vector<typename To::EntryType>>(x0, x1, x2, x3).data();\n}\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(From x0, From x1, From x2, From x3, From x4, From x5, From x6, From x7,\n          enable_if<(AVX2::is_vector<To>::value && SSE::is_vector<From>::value &&\n                     SSE::Vector<typename To::EntryType>::Size == To::Size)>)\n{\n    return simd_cast<SSE::Vector<typename To::EntryType>>(x0, x1, x2, x3, x4, x5, x6, x7)\n        .data();\n}\n\n// Vector casts without offset {{{1\n// AVX2::Vector {{{2\n// 1: to double_v {{{3\nVc_SIMD_CAST_AVX_1( float_v, double_v) { return _mm256_cvtps_pd(AVX::lo128(x.data())); }\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_1(   int_v, double_v) { return AVX::convert<   int, double>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_AVX_1(  uint_v, double_v) { return AVX::convert<  uint, double>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_AVX_1( short_v, double_v) { return AVX::convert< short, double>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_AVX_1(ushort_v, double_v) { return AVX::convert<ushort, double>(AVX::lo128(x.data())); }\n#endif\n\n// 1: to float_v {{{3\nVc_SIMD_CAST_AVX_1(double_v,  float_v) { return AVX::zeroExtend(_mm256_cvtpd_ps(x.data())); }\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_1(   int_v,  float_v) { return AVX::convert<   int, float>(x.data()); }\nVc_SIMD_CAST_AVX_1(  uint_v,  float_v) { return AVX::convert<  uint, float>(x.data()); }\nVc_SIMD_CAST_AVX_1( short_v,  float_v) { return AVX::convert< short, float>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_AVX_1(ushort_v,  float_v) { return AVX::convert<ushort, float>(AVX::lo128(x.data())); }\n#endif\n\n// 2: to float_v {{{3\nVc_SIMD_CAST_AVX_2(double_v,  float_v) { return AVX::concat(_mm256_cvtpd_ps(x0.data()), _mm256_cvtpd_ps(x1.data())); }\n\n// 1: to int_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_1(double_v,    int_v) { return AVX::zeroExtend(_mm256_cvttpd_epi32(x.data())); }\nVc_SIMD_CAST_AVX_1( float_v,    int_v) { return _mm256_cvttps_epi32(x.data()); }\nVc_SIMD_CAST_AVX_1(  uint_v,    int_v) { return x.data(); }\nVc_SIMD_CAST_AVX_1( short_v,    int_v) { return _mm256_cvtepi16_epi32(AVX::lo128(x.data())); }\nVc_SIMD_CAST_AVX_1(ushort_v,    int_v) { return _mm256_cvtepu16_epi32(AVX::lo128(x.data())); }\n#endif\n\n// 2: to int_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_2(double_v,    int_v) { return AVX::concat(_mm256_cvttpd_epi32(x0.data()), _mm256_cvttpd_epi32(x1.data())); }\n#endif\n\n// 1: to uint_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_1(double_v,   uint_v) { return AVX::zeroExtend(AVX::convert<double, uint>(x.data())); }\nVc_SIMD_CAST_AVX_1( float_v,   uint_v) {\n    return _mm256_blendv_epi8(\n        _mm256_cvttps_epi32(x.data()),\n        _mm256_add_epi32(\n            _mm256_cvttps_epi32(_mm256_sub_ps(x.data(), AVX::set2power31_ps())),\n            AVX::set2power31_epu32()),\n        _mm256_castps_si256(AVX::cmpge_ps(x.data(), AVX::set2power31_ps())));\n}\nVc_SIMD_CAST_AVX_1(   int_v,   uint_v) { return x.data(); }\nVc_SIMD_CAST_AVX_1( short_v,   uint_v) { return _mm256_cvtepi16_epi32(AVX::lo128(x.data())); }\nVc_SIMD_CAST_AVX_1(ushort_v,   uint_v) { return _mm256_cvtepu16_epi32(AVX::lo128(x.data())); }\n#endif\n\n// 2: to uint_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_2(double_v,   uint_v) { return AVX::concat(AVX::convert<double, uint>(x0.data()), AVX::convert<double, uint>(x1.data())); }\n#endif\n\n// 1: to short_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_1(double_v, short_v) { return AVX::zeroExtend(_mm_packs_epi32(_mm256_cvttpd_epi32(x.data()), _mm_setzero_si128())); }\nVc_SIMD_CAST_AVX_1( float_v, short_v) {\n    const auto tmp = _mm256_cvttps_epi32(x.data());\n    return AVX::zeroExtend(_mm_packs_epi32(AVX::lo128(tmp), AVX::hi128(tmp)));\n}\nVc_SIMD_CAST_AVX_1(   int_v,  short_v) { return AVX::zeroExtend(AVX::convert< int, short>(x.data())); }\nVc_SIMD_CAST_AVX_1(  uint_v,  short_v) { return AVX::zeroExtend(AVX::convert<uint, short>(x.data())); }\nVc_SIMD_CAST_AVX_1(ushort_v,  short_v) { return x.data(); }\n#endif\n\n// 2: to short_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_2(double_v,  short_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    return AVX::zeroExtend(_mm_packs_epi32(tmp0, tmp1));\n}\nVc_SIMD_CAST_AVX_2( float_v,  short_v) {\n    using AVX2::short_v;\n    using AVX2::int_v;\n    return simd_cast<short_v>(simd_cast<int_v>(x0), simd_cast<int_v>(x1));\n}\nVc_SIMD_CAST_AVX_2(   int_v,  short_v) {\n    const auto shuf = _mm256_setr_epi8(\n        0, 1, 4, 5, 8, 9, 12, 13, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80,\n        0, 1, 4, 5, 8, 9, 12, 13, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80);\n    auto a = _mm256_shuffle_epi8(x0.data(), shuf);\n    auto b = _mm256_shuffle_epi8(x1.data(), shuf);\n    return Mem::permute4x64<X0, X2, X1, X3>(_mm256_unpacklo_epi64(a, b));\n}\nVc_SIMD_CAST_AVX_2(  uint_v,  short_v) {\n    const auto shuf = _mm256_setr_epi8(\n        0, 1, 4, 5, 8, 9, 12, 13, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80,\n        0, 1, 4, 5, 8, 9, 12, 13, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80, -0x80);\n    auto a = _mm256_shuffle_epi8(x0.data(), shuf);\n    auto b = _mm256_shuffle_epi8(x1.data(), shuf);\n    return Mem::permute4x64<X0, X2, X1, X3>(_mm256_unpacklo_epi64(a, b));\n}\n#endif\n\n// 3: to short_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_3(double_v,  short_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    const auto tmp2 = _mm256_cvttpd_epi32(x2.data());\n    return AVX::concat(_mm_packs_epi32(tmp0, tmp1), _mm_packs_epi32(tmp2, _mm_setzero_si128()));\n}\n#endif\n\n// 4: to short_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_4(double_v,  short_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    const auto tmp2 = _mm256_cvttpd_epi32(x2.data());\n    const auto tmp3 = _mm256_cvttpd_epi32(x3.data());\n    return AVX::concat(_mm_packs_epi32(tmp0, tmp1), _mm_packs_epi32(tmp2, tmp3));\n}\n#endif\n\n// 1: to ushort_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_1(double_v, ushort_v) {\n    const auto tmp = _mm256_cvttpd_epi32(x.data());\n    return AVX::zeroExtend(_mm_packus_epi32(tmp, _mm_setzero_si128()));\n}\nVc_SIMD_CAST_AVX_1( float_v, ushort_v) {\n    const auto tmp = _mm256_cvttps_epi32(x.data());\n    return AVX::zeroExtend(_mm_packus_epi32(AVX::lo128(tmp), AVX::hi128(tmp)));\n}\nVc_SIMD_CAST_AVX_1(   int_v, ushort_v) { return AVX::zeroExtend(AVX::convert< int, ushort>(x.data())); }\nVc_SIMD_CAST_AVX_1(  uint_v, ushort_v) { return AVX::zeroExtend(AVX::convert<uint, ushort>(x.data())); }\nVc_SIMD_CAST_AVX_1( short_v, ushort_v) { return x.data(); }\n#endif\n\n// 2: to ushort_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_2(double_v, ushort_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    return AVX::zeroExtend(_mm_packus_epi32(tmp0, tmp1));\n}\nVc_SIMD_CAST_AVX_2( float_v, ushort_v) {\n    using AVX2::ushort_v;\n    using AVX2::int_v;\n    return simd_cast<ushort_v>(simd_cast<int_v>(x0), simd_cast<int_v>(x1));\n}\nVc_SIMD_CAST_AVX_2(   int_v, ushort_v) {\n    auto tmp0 = _mm256_unpacklo_epi16(x0.data(), x1.data());\n    auto tmp1 = _mm256_unpackhi_epi16(x0.data(), x1.data());\n    auto tmp2 = _mm256_unpacklo_epi16(tmp0, tmp1);\n    auto tmp3 = _mm256_unpackhi_epi16(tmp0, tmp1);\n    return Mem::permute4x64<X0, X2, X1, X3>(_mm256_unpacklo_epi16(tmp2, tmp3));\n}\nVc_SIMD_CAST_AVX_2(  uint_v, ushort_v) {\n    auto tmp0 = _mm256_unpacklo_epi16(x0.data(), x1.data());\n    auto tmp1 = _mm256_unpackhi_epi16(x0.data(), x1.data());\n    auto tmp2 = _mm256_unpacklo_epi16(tmp0, tmp1);\n    auto tmp3 = _mm256_unpackhi_epi16(tmp0, tmp1);\n    return Mem::permute4x64<X0, X2, X1, X3>(_mm256_unpacklo_epi16(tmp2, tmp3));\n}\n#endif\n\n// 3: to ushort_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_3(double_v, ushort_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    const auto tmp2 = _mm256_cvttpd_epi32(x2.data());\n    return AVX::concat(_mm_packus_epi32(tmp0, tmp1),\n                       _mm_packus_epi32(tmp2, _mm_setzero_si128()));\n}\n#endif\n\n// 4: to ushort_v {{{3\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_4(double_v, ushort_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    const auto tmp2 = _mm256_cvttpd_epi32(x2.data());\n    const auto tmp3 = _mm256_cvttpd_epi32(x3.data());\n    return AVX::concat(_mm_packus_epi32(tmp0, tmp1), _mm_packus_epi32(tmp2, tmp3));\n}\n#endif\n\n// 1 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_1(SSE::double_v, AVX2::double_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::double_v) { return _mm256_cvtps_pd(x.data()); }\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::double_v) { return _mm256_cvtepi32_pd(x.data()); }\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::double_v) { using namespace AvxIntrinsics; return _mm256_add_pd(_mm256_cvtepi32_pd(_mm_sub_epi32(x.data(), _mm_setmin_epi32())), set1_pd(1u << 31)); }\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::double_v) { return simd_cast<AVX2::double_v>(simd_cast<SSE::int_v>(x)); }\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::double_v) { return simd_cast<AVX2::double_v>(simd_cast<SSE::int_v>(x)); }\n\nVc_SIMD_CAST_1(SSE::double_v, AVX2:: float_v) { return AVX::zeroExtend(simd_cast<SSE:: float_v>(x).data()); }\nVc_SIMD_CAST_1(SSE:: float_v, AVX2:: float_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::   int_v, AVX2:: float_v) { return AVX::zeroExtend(_mm_cvtepi32_ps(x.data())); }\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2:: float_v) { return AVX::zeroExtend(simd_cast<SSE::float_v>(x).data()); }\nVc_SIMD_CAST_1(SSE:: short_v, AVX2:: float_v) { return AVX::convert< short, float>(x.data()); }\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2:: float_v) { return AVX::convert<ushort, float>(x.data()); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(SSE::double_v, AVX2::   int_v) { return AVX::zeroExtend(simd_cast<SSE::   int_v>(x).data()); }\nVc_SIMD_CAST_1(SSE::double_v, AVX2::  uint_v) { return AVX::zeroExtend(simd_cast<SSE::  uint_v>(x).data()); }\nVc_SIMD_CAST_1(SSE::double_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE:: short_v>(x).data()); }\nVc_SIMD_CAST_1(SSE::double_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x).data()); }\n\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::   int_v) { return AVX::zeroExtend(simd_cast<SSE::int_v>(x).data()); }\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::  uint_v) { return AVX::zeroExtend(simd_cast<SSE::uint_v>(x).data()); }\nVc_SIMD_CAST_1(SSE:: float_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE::short_v>(x).data()); }\nVc_SIMD_CAST_1(SSE:: float_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x).data()); }\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::   int_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::   int_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::   int_v) { return AVX::convert< short,  int>(x.data()); }\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::   int_v) { return AVX::convert<ushort,  int>(x.data()); }\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::  uint_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::  uint_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::  uint_v) { return AVX::convert< short, uint>(x.data()); }\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::  uint_v) { return AVX::convert<ushort, uint>(x.data()); }\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE::short_v>(x).data()); }\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE::short_v>(x).data()); }\nVc_SIMD_CAST_1(SSE:: short_v, AVX2:: short_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2:: short_v) { return AVX::zeroExtend(x.data()); }\n\nVc_SIMD_CAST_1(SSE::   int_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x).data()); }\nVc_SIMD_CAST_1(SSE::  uint_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x).data()); }\nVc_SIMD_CAST_1(SSE:: short_v, AVX2::ushort_v) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::ushort_v, AVX2::ushort_v) { return AVX::zeroExtend(x.data()); }\n#endif\n\n// 2 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_2(SSE::double_v, AVX2::double_v) { return AVX::concat(x0.data(), x1.data()); }\n\nVc_SIMD_CAST_2(SSE::double_v, AVX2:: float_v) { return AVX::zeroExtend(simd_cast<SSE:: float_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE:: float_v, AVX2:: float_v) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::   int_v, AVX2:: float_v) { return AVX::convert< int, float>(AVX::concat(x0.data(), x1.data())); }\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2:: float_v) { return AVX::convert<uint, float>(AVX::concat(x0.data(), x1.data())); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_2(SSE::double_v, AVX2::   int_v) { return AVX::zeroExtend(simd_cast<SSE::   int_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE::double_v, AVX2::  uint_v) { return AVX::zeroExtend(simd_cast<SSE::  uint_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE::double_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE:: short_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE::double_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x0, x1).data()); }\n\nVc_SIMD_CAST_2(SSE:: float_v, AVX2::   int_v) { return simd_cast<AVX2:: int_v>(simd_cast<AVX2::float_v>(x0, x1)); }\nVc_SIMD_CAST_2(SSE:: float_v, AVX2::  uint_v) { return simd_cast<AVX2::uint_v>(simd_cast<AVX2::float_v>(x0, x1)); }\nVc_SIMD_CAST_2(SSE:: float_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE:: short_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE:: float_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x0, x1).data()); }\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2::   int_v) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2::   int_v) { return AVX::concat(x0.data(), x1.data()); }\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2::  uint_v) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2::  uint_v) { return AVX::concat(x0.data(), x1.data()); }\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE:: short_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE:: short_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE:: short_v, AVX2:: short_v) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::ushort_v, AVX2:: short_v) { return AVX::concat(x0.data(), x1.data()); }\n\nVc_SIMD_CAST_2(SSE::   int_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE::  uint_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x0, x1).data()); }\nVc_SIMD_CAST_2(SSE:: short_v, AVX2::ushort_v) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::ushort_v, AVX2::ushort_v) { return AVX::concat(x0.data(), x1.data()); }\n#endif\n// 3 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_3(SSE::double_v, AVX2:: float_v) { return simd_cast<AVX2:: float_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2)); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_3(SSE::double_v, AVX2::   int_v) { return simd_cast<AVX2:: int_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2)); }\nVc_SIMD_CAST_3(SSE::double_v, AVX2::  uint_v) { return simd_cast<AVX2::uint_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2)); }\nVc_SIMD_CAST_3(SSE::double_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE:: short_v>(x0, x1, x2).data()); }\nVc_SIMD_CAST_3(SSE::double_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x0, x1, x2).data()); }\n\nVc_SIMD_CAST_3(SSE:: float_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::float_v>(x0, x1), simd_cast<AVX2::float_v>(x2)); }\nVc_SIMD_CAST_3(SSE:: float_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::float_v>(x0, x1), simd_cast<AVX2::float_v>(x2)); }\n\nVc_SIMD_CAST_3(SSE::   int_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2:: int_v>(x0, x1), simd_cast<AVX2:: int_v>(x2)); }\nVc_SIMD_CAST_3(SSE::  uint_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::uint_v>(x0, x1), simd_cast<AVX2::uint_v>(x2)); }\n\nVc_SIMD_CAST_3(SSE::   int_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2:: int_v>(x0, x1), simd_cast<AVX2:: int_v>(x2)); }\nVc_SIMD_CAST_3(SSE::  uint_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::uint_v>(x0, x1), simd_cast<AVX2::uint_v>(x2)); }\n#endif\n\n// 4 SSE::Vector to 1 AVX2::Vector {{{2\nVc_SIMD_CAST_4(SSE::double_v, AVX2:: float_v) { return simd_cast<AVX2:: float_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3)); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_4(SSE::double_v, AVX2::   int_v) { return simd_cast<AVX2:: int_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3)); }\nVc_SIMD_CAST_4(SSE::double_v, AVX2::  uint_v) { return simd_cast<AVX2::uint_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3)); }\nVc_SIMD_CAST_4(SSE::double_v, AVX2:: short_v) { return AVX::zeroExtend(simd_cast<SSE:: short_v>(x0, x1, x2, x3).data()); }\nVc_SIMD_CAST_4(SSE::double_v, AVX2::ushort_v) { return AVX::zeroExtend(simd_cast<SSE::ushort_v>(x0, x1, x2, x3).data()); }\n\nVc_SIMD_CAST_4(SSE:: float_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::float_v>(x0, x1), simd_cast<AVX2::float_v>(x2, x3)); }\nVc_SIMD_CAST_4(SSE:: float_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::float_v>(x0, x1), simd_cast<AVX2::float_v>(x2, x3)); }\n\nVc_SIMD_CAST_4(SSE::   int_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2:: int_v>(x0, x1), simd_cast<AVX2:: int_v>(x2, x3)); }\nVc_SIMD_CAST_4(SSE::  uint_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::uint_v>(x0, x1), simd_cast<AVX2::uint_v>(x2, x3)); }\n\nVc_SIMD_CAST_4(SSE::   int_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2:: int_v>(x0, x1), simd_cast<AVX2:: int_v>(x2, x3)); }\nVc_SIMD_CAST_4(SSE::  uint_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::uint_v>(x0, x1), simd_cast<AVX2::uint_v>(x2, x3)); }\n#endif\n\n// 5 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_5(SSE::double_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4)); }\nVc_SIMD_CAST_5(SSE::double_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4)); }\n#endif\n\n// 6 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_6(SSE::double_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4, x5)); }\nVc_SIMD_CAST_6(SSE::double_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4, x5)); }\n#endif\n\n// 7 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_7(SSE::double_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4, x5), simd_cast<AVX2::double_v>(x6)); }\nVc_SIMD_CAST_7(SSE::double_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4, x5), simd_cast<AVX2::double_v>(x6)); }\n#endif\n\n// 8 SSE::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_8(SSE::double_v, AVX2:: short_v) { return simd_cast<AVX2:: short_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4, x5), simd_cast<AVX2::double_v>(x6, x7)); }\nVc_SIMD_CAST_8(SSE::double_v, AVX2::ushort_v) { return simd_cast<AVX2::ushort_v>(simd_cast<AVX2::double_v>(x0, x1), simd_cast<AVX2::double_v>(x2, x3), simd_cast<AVX2::double_v>(x4, x5), simd_cast<AVX2::double_v>(x6, x7)); }\n#endif\n\n// 1 AVX2::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_1(AVX2::double_v, SSE::double_v) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2:: float_v, SSE:: float_v) { return AVX::lo128(x.data()); }\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::   int_v) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::  uint_v) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2:: short_v, SSE:: short_v) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::ushort_v) { return AVX::lo128(x.data()); }\n#endif\n\nVc_SIMD_CAST_1(AVX2::double_v, SSE:: float_v) { return simd_cast<SSE:: float_v>(simd_cast<AVX2:: float_v>(x)); }\nVc_SIMD_CAST_1(AVX2::double_v, SSE::   int_v) { return AVX::convert<double, int>(x.data()); }\nVc_SIMD_CAST_1(AVX2::double_v, SSE::  uint_v) { return AVX::convert<double, unsigned int>(x.data()); }\nVc_SIMD_CAST_1(AVX2::double_v, SSE:: short_v) { return AVX::convert<double, short>(x.data()); }\nVc_SIMD_CAST_1(AVX2::double_v, SSE::ushort_v) { return AVX::convert<double, unsigned short>(x.data()); }\n\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::double_v) { return simd_cast<SSE::double_v>(simd_cast<SSE:: float_v>(x)); }\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::   int_v) { return simd_cast<SSE::   int_v>(simd_cast<SSE:: float_v>(x)); }\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::  uint_v) { return simd_cast<SSE::  uint_v>(simd_cast<SSE:: float_v>(x)); }\nVc_SIMD_CAST_1(AVX2:: float_v, SSE:: short_v) { return AVX::convert<float, short>(x.data()); }\nVc_SIMD_CAST_1(AVX2:: float_v, SSE::ushort_v) { return AVX::convert<float, unsigned short>(x.data()); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::double_v) { return SSE::convert<int, double>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_1(AVX2::   int_v, SSE:: float_v) { return SSE::convert<int, float>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::  uint_v) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2::   int_v, SSE:: short_v) { return AVX::convert<int,  short>(x.data()); }\nVc_SIMD_CAST_1(AVX2::   int_v, SSE::ushort_v) { return AVX::convert<int, ushort>(x.data()); }\n\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::double_v) { return SSE::convert<uint, double>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE:: float_v) { return SSE::convert<uint, float>(AVX::lo128(x.data())); }\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::   int_v) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE:: short_v) { return AVX::convert<uint,  short>(x.data()); }\nVc_SIMD_CAST_1(AVX2::  uint_v, SSE::ushort_v) { return AVX::convert<uint, ushort>(x.data()); }\n\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::double_v) { return simd_cast<SSE::double_v>(simd_cast<SSE:: short_v>(x)); }\nVc_SIMD_CAST_1(AVX2:: short_v, SSE:: float_v) { return simd_cast<SSE:: float_v>(simd_cast<SSE:: short_v>(x)); }\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::   int_v) { return simd_cast<SSE::   int_v>(simd_cast<SSE:: short_v>(x)); }\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::  uint_v) { return simd_cast<SSE::  uint_v>(simd_cast<SSE:: short_v>(x)); }\nVc_SIMD_CAST_1(AVX2:: short_v, SSE::ushort_v) { return simd_cast<SSE::ushort_v>(simd_cast<SSE:: short_v>(x)); }\n\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::double_v) { return simd_cast<SSE::double_v>(simd_cast<SSE::ushort_v>(x)); }\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE:: float_v) { return simd_cast<SSE:: float_v>(simd_cast<SSE::ushort_v>(x)); }\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::   int_v) { return simd_cast<SSE::   int_v>(simd_cast<SSE::ushort_v>(x)); }\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE::  uint_v) { return simd_cast<SSE::  uint_v>(simd_cast<SSE::ushort_v>(x)); }\nVc_SIMD_CAST_1(AVX2::ushort_v, SSE:: short_v) { return simd_cast<SSE:: short_v>(simd_cast<SSE::ushort_v>(x)); }\n#endif\n\n// 2 AVX2::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_2(AVX2::double_v, SSE:: short_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    return _mm_packs_epi32(tmp0, tmp1);\n}\nVc_SIMD_CAST_2(AVX2::double_v, SSE::ushort_v) {\n    const auto tmp0 = _mm256_cvttpd_epi32(x0.data());\n    const auto tmp1 = _mm256_cvttpd_epi32(x1.data());\n    return _mm_packus_epi32(tmp0, tmp1);\n}\n\n// 1 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::double_v>::value>)\n{\n    return AVX::zeroExtend(_mm_setr_pd(x.data(), 0.));\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return AVX::zeroExtend(_mm_setr_ps(x.data(), 0.f, 0.f, 0.f));\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x.data(), 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x.data()), 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 2 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::double_v>::value>)\n{\n    return AVX::zeroExtend(_mm_setr_pd(x0.data(), x1.data()));\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return AVX::zeroExtend(_mm_setr_ps(x0.data(), x1.data(), 0.f, 0.f));\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x0.data(), x1.data(), 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x0.data()), uint(x1.data()), 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 3 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::double_v>::value>)\n{\n    return _mm256_setr_pd(x0.data(), x1.data(), x2.data(), 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return AVX::zeroExtend(_mm_setr_ps(x0.data(), x1.data(), x2.data(), 0));\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x0.data(), x1.data(), x2.data(), 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()), 0, 0, 0,\n                             0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 4 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::double_v>::value>)\n{\n    return _mm256_setr_pd(x0.data(), x1.data(), x2.data(), x3.data());\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return AVX::zeroExtend(_mm_setr_ps(x0.data(), x1.data(), x2.data(), x3.data()));\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x0.data(), x1.data(), x2.data(), x3.data(), 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()),\n                             uint(x3.data()), 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 5 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return _mm256_setr_ps(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(), 0, 0, 0);\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(), 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()),\n                             uint(x3.data()), uint(x4.data()), 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 6 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return _mm256_setr_ps(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), 0, 0);\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()),\n                             uint(x3.data()), uint(x4.data()), uint(x5.data()), 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 7 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return _mm256_setr_ps(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), 0);\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()),\n                             uint(x3.data()), uint(x4.data()), uint(x5.data()),\n                             uint(x6.data()), 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), 0, 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 8 Scalar::Vector to 1 AVX2::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::float_v>::value>)\n{\n    return _mm256_setr_ps(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), x7.data());\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::int_v>::value>)\n{\n    return _mm256_setr_epi32(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data());\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::uint_v>::value>)\n{\n    return _mm256_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()),\n                             uint(x3.data()), uint(x4.data()), uint(x5.data()),\n                             uint(x6.data()), uint(x7.data()));\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), x7.data(), 0, 0, 0, 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), x7.data(), 0, 0, 0, 0, 0, 0, 0, 0);\n}\n#endif\n\n// 9 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), 0, 0, 0, 0, 0, 0,\n                             0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), 0, 0, 0, 0, 0, 0,\n                             0);\n}\n#endif\n\n// 10 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(), 0, 0,\n                             0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(), 0, 0,\n                             0, 0, 0, 0);\n}\n#endif\n\n// 11 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), 0, 0, 0, 0, 0);\n}\n#endif\n\n// 12 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), 0, 0, 0, 0);\n}\n#endif\n\n// 13 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), 0, 0, 0);\n}\n#endif\n\n// 14 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), x13.data(), 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), x13.data(), 0, 0);\n}\n#endif\n\n// 15 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), x13.data(), x14.data(),\n                             0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), x13.data(), x14.data(),\n                             0);\n}\n#endif\n\n// 16 Scalar::Vector to 1 AVX2::Vector {{{2\n#ifdef Vc_IMPL_AVX2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          Scalar::Vector<T> x15, enable_if<std::is_same<Return, AVX2::short_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), x13.data(), x14.data(),\n                             x15.data());\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7, Scalar::Vector<T> x8,\n          Scalar::Vector<T> x9, Scalar::Vector<T> x10, Scalar::Vector<T> x11,\n          Scalar::Vector<T> x12, Scalar::Vector<T> x13, Scalar::Vector<T> x14,\n          Scalar::Vector<T> x15, enable_if<std::is_same<Return, AVX2::ushort_v>::value>)\n{\n    return _mm256_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                             x5.data(), x6.data(), x7.data(), x8.data(), x9.data(),\n                             x10.data(), x11.data(), x12.data(), x13.data(), x14.data(),\n                             x15.data());\n}\n#endif\n\n// 1 AVX2::Vector to 1 Scalar::Vector {{{2\ntemplate <typename To, typename FromT>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(AVX2::Vector<FromT> x, enable_if<Scalar::is_vector<To>::value>)\n{\n    return static_cast<To>(x[0]);\n}\n\n// Mask casts without offset {{{1\n// 1 AVX2::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(const AVX2::Mask<T> &k, enable_if<AVX2::is_mask<Return>::value>)\n{\n    return {Detail::mask_cast<Mask<T, VectorAbi::Avx>::Size, Return::Size,\n                              typename Return::VectorTypeF>(k.dataI())};\n}\n\n// 2 AVX2::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_AVX_2(double_m,  float_m) { return AVX::concat(_mm_packs_epi32(AVX::lo128(x0.dataI()), AVX::hi128(x0.dataI())), _mm_packs_epi32(AVX::lo128(x1.dataI()), AVX::hi128(x1.dataI()))); }\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_2(double_m,    int_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi32(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_AVX_2(double_m,   uint_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi32(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_AVX_2(double_m,  short_m) { return AVX::zeroExtend(_mm_packs_epi16(_mm_packs_epi32(AVX::lo128(x0.dataI()), AVX::hi128(x0.dataI())), _mm_packs_epi32(AVX::lo128(x1.dataI()), AVX::hi128(x1.dataI())))); }\nVc_SIMD_CAST_AVX_2(double_m, ushort_m) { return AVX::zeroExtend(_mm_packs_epi16(_mm_packs_epi32(AVX::lo128(x0.dataI()), AVX::hi128(x0.dataI())), _mm_packs_epi32(AVX::lo128(x1.dataI()), AVX::hi128(x1.dataI())))); }\n\nVc_SIMD_CAST_AVX_2( float_m,  short_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi16(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_AVX_2( float_m, ushort_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi16(x0.dataI(), x1.dataI())); }\n\nVc_SIMD_CAST_AVX_2(   int_m,  short_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi16(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_AVX_2(   int_m, ushort_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi16(x0.dataI(), x1.dataI())); }\n\nVc_SIMD_CAST_AVX_2(  uint_m,  short_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi16(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_AVX_2(  uint_m, ushort_m) { return Mem::permute4x64<X0, X2, X1, X3>(_mm256_packs_epi16(x0.dataI(), x1.dataI())); }\n#endif\n\n// 4 AVX2::Mask to 1 AVX2::Mask {{{2\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_AVX_4(double_m, short_m)\n{\n    using namespace AVX;\n    const auto tmp = _mm256_packs_epi32(\n        _mm256_packs_epi32(x0.dataI(), x1.dataI())  // a0 a1 b0 b1 a2 a3 b2 b3\n        ,\n        _mm256_packs_epi32(x2.dataI(), x3.dataI())  // c0 c1 d0 d1 c2 c3 d2 d3\n        );  // a0 a1 b0 b1 c0 c1 d0 d1 a2 a3 b2 b3 c2 c3 d2 d3\n    return concat(_mm_unpacklo_epi32(lo128(tmp), hi128(tmp)),   // a0 a1 a2 a3 b0 b1 b2 b3\n                  _mm_unpackhi_epi32(lo128(tmp), hi128(tmp)));  // c0 c1 c2 c3 d0 d1 d2 d3\n}\nVc_SIMD_CAST_AVX_4(double_m, ushort_m) { return simd_cast<AVX2::short_m>(x0, x1, x2, x3).data(); }\n#endif\n\n// 1 SSE::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_1(SSE::double_m, AVX2::double_m) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::double_m, AVX2:: float_m) { return AVX::zeroExtend(simd_cast<SSE:: float_m>(x).data()); }\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(SSE::double_m, AVX2::   int_m) { return AVX::zeroExtend(simd_cast<SSE::   int_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::double_m, AVX2::  uint_m) { return AVX::zeroExtend(simd_cast<SSE::  uint_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::double_m, AVX2:: short_m) { return AVX::zeroExtend(simd_cast<SSE:: short_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::double_m, AVX2::ushort_m) { return AVX::zeroExtend(simd_cast<SSE::ushort_m>(x).data()); }\n#endif\n\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::double_m) { return AVX::concat(_mm_unpacklo_ps(x.dataF(), x.dataF()), _mm_unpackhi_ps(x.dataF(), x.dataF())); }\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::double_m) { return AVX::concat(_mm_unpacklo_ps(x.dataF(), x.dataF()), _mm_unpackhi_ps(x.dataF(), x.dataF())); }\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::double_m) { return AVX::concat(_mm_unpacklo_ps(x.dataF(), x.dataF()), _mm_unpackhi_ps(x.dataF(), x.dataF())); }\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::double_m) { auto tmp = _mm_unpacklo_epi16(x.dataI(), x.dataI()); return AVX::concat(_mm_unpacklo_epi32(tmp, tmp), _mm_unpackhi_epi32(tmp, tmp)); }\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::double_m) { auto tmp = _mm_unpacklo_epi16(x.dataI(), x.dataI()); return AVX::concat(_mm_unpacklo_epi32(tmp, tmp), _mm_unpackhi_epi32(tmp, tmp)); }\n\nVc_SIMD_CAST_1(SSE:: float_m, AVX2:: float_m) { return AVX::zeroExtend(x.dataF()); }\nVc_SIMD_CAST_1(SSE::   int_m, AVX2:: float_m) { return AVX::zeroExtend(x.dataF()); }\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2:: float_m) { return AVX::zeroExtend(x.dataF()); }\nVc_SIMD_CAST_1(SSE:: short_m, AVX2:: float_m) { return AVX::concat(_mm_unpacklo_epi16(x.dataI(), x.dataI()), _mm_unpackhi_epi16(x.dataI(), x.dataI())); }\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2:: float_m) { return AVX::concat(_mm_unpacklo_epi16(x.dataI(), x.dataI()), _mm_unpackhi_epi16(x.dataI(), x.dataI())); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::   int_m) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::  uint_m) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::   int_m) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::  uint_m) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::   int_m) { return AVX::zeroExtend(x.data()); }\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::  uint_m) { return AVX::zeroExtend(x.data()); }\n\nVc_SIMD_CAST_1(SSE:: float_m, AVX2:: short_m) { return AVX::zeroExtend(simd_cast<SSE:: short_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::   int_m, AVX2:: short_m) { return AVX::zeroExtend(simd_cast<SSE:: short_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2:: short_m) { return AVX::zeroExtend(simd_cast<SSE:: short_m>(x).data()); }\nVc_SIMD_CAST_1(SSE:: short_m, AVX2:: short_m) { return AVX::zeroExtend(simd_cast<SSE:: short_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2:: short_m) { return AVX::zeroExtend(simd_cast<SSE:: short_m>(x).data()); }\nVc_SIMD_CAST_1(SSE:: float_m, AVX2::ushort_m) { return AVX::zeroExtend(simd_cast<SSE::ushort_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::   int_m, AVX2::ushort_m) { return AVX::zeroExtend(simd_cast<SSE::ushort_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::  uint_m, AVX2::ushort_m) { return AVX::zeroExtend(simd_cast<SSE::ushort_m>(x).data()); }\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::ushort_m) { return AVX::zeroExtend(simd_cast<SSE::ushort_m>(x).data()); }\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::ushort_m) { return AVX::zeroExtend(simd_cast<SSE::ushort_m>(x).data()); }\n\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::   int_m) { const auto v = Mem::permute4x64<X0, X2, X1, X3>(AVX::avx_cast<__m256i>(x.data())); return _mm256_unpacklo_epi16(v, v); }\nVc_SIMD_CAST_1(SSE:: short_m, AVX2::  uint_m) { const auto v = Mem::permute4x64<X0, X2, X1, X3>(AVX::avx_cast<__m256i>(x.data())); return _mm256_unpacklo_epi16(v, v); }\n\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::   int_m) { const auto v = Mem::permute4x64<X0, X2, X1, X3>(AVX::avx_cast<__m256i>(x.data())); return _mm256_unpacklo_epi16(v, v); }\nVc_SIMD_CAST_1(SSE::ushort_m, AVX2::  uint_m) { const auto v = Mem::permute4x64<X0, X2, X1, X3>(AVX::avx_cast<__m256i>(x.data())); return _mm256_unpacklo_epi16(v, v); }\n#endif\n\n// 2 SSE::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_2(SSE::double_m, AVX2::double_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::double_m, AVX2:: float_m) { return AVX::zeroExtend(_mm_packs_epi32(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_2(SSE:: float_m, AVX2:: float_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::   int_m, AVX2:: float_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2:: float_m) { return AVX::concat(x0.data(), x1.data()); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_2(SSE::double_m, AVX2::   int_m) { return AVX::zeroExtend(_mm_packs_epi32(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_2(SSE::double_m, AVX2::  uint_m) { return AVX::zeroExtend(_mm_packs_epi32(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_2(SSE::double_m, AVX2:: short_m) { return AVX::zeroExtend(_mm_packs_epi16(_mm_packs_epi32(x0.dataI(), x1.dataI()), _mm_setzero_si128())); }\nVc_SIMD_CAST_2(SSE::double_m, AVX2::ushort_m) { return AVX::zeroExtend(_mm_packs_epi16(_mm_packs_epi32(x0.dataI(), x1.dataI()), _mm_setzero_si128())); }\n\nVc_SIMD_CAST_2(SSE:: float_m, AVX2::   int_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE:: float_m, AVX2::  uint_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE:: float_m, AVX2:: short_m) { return AVX::zeroExtend(_mm_packs_epi16(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_2(SSE:: float_m, AVX2::ushort_m) { return AVX::zeroExtend(_mm_packs_epi16(x0.dataI(), x1.dataI())); }\n\nVc_SIMD_CAST_2(SSE::   int_m, AVX2::   int_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::   int_m, AVX2::  uint_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::   int_m, AVX2:: short_m) { return AVX::zeroExtend(_mm_packs_epi16(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_2(SSE::   int_m, AVX2::ushort_m) { return AVX::zeroExtend(_mm_packs_epi16(x0.dataI(), x1.dataI())); }\n\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2::   int_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2::  uint_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2:: short_m) { return AVX::zeroExtend(_mm_packs_epi16(x0.dataI(), x1.dataI())); }\nVc_SIMD_CAST_2(SSE::  uint_m, AVX2::ushort_m) { return AVX::zeroExtend(_mm_packs_epi16(x0.dataI(), x1.dataI())); }\n\nVc_SIMD_CAST_2(SSE:: short_m, AVX2:: short_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE:: short_m, AVX2::ushort_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::ushort_m, AVX2:: short_m) { return AVX::concat(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(SSE::ushort_m, AVX2::ushort_m) { return AVX::concat(x0.data(), x1.data()); }\n#endif\n\n// 4 SSE::Mask to 1 AVX2::Mask {{{2\nVc_SIMD_CAST_4(SSE::double_m, AVX2:: float_m) { return AVX::concat(_mm_packs_epi32(x0.dataI(), x1.dataI()), _mm_packs_epi32(x2.dataI(), x3.dataI())); }\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_4(SSE::double_m, AVX2::   int_m) { return AVX::concat(_mm_packs_epi32(x0.dataI(), x1.dataI()), _mm_packs_epi32(x2.dataI(), x3.dataI())); }\nVc_SIMD_CAST_4(SSE::double_m, AVX2::  uint_m) { return AVX::concat(_mm_packs_epi32(x0.dataI(), x1.dataI()), _mm_packs_epi32(x2.dataI(), x3.dataI())); }\nVc_SIMD_CAST_4(SSE::double_m, AVX2:: short_m) { return AVX::zeroExtend(_mm_packs_epi16(_mm_packs_epi32(x0.dataI(), x1.dataI()), _mm_packs_epi32(x2.dataI(), x3.dataI()))); }\nVc_SIMD_CAST_4(SSE::double_m, AVX2::ushort_m) { return AVX::zeroExtend(_mm_packs_epi16(_mm_packs_epi32(x0.dataI(), x1.dataI()), _mm_packs_epi32(x2.dataI(), x3.dataI()))); }\nVc_SIMD_CAST_4(SSE:: float_m, AVX2:: short_m) { return AVX::concat(_mm_packs_epi16(x0.dataI(), x1.dataI()), _mm_packs_epi16(x2.dataI(), x3.dataI())); }\nVc_SIMD_CAST_4(SSE:: float_m, AVX2::ushort_m) { return AVX::concat(_mm_packs_epi16(x0.dataI(), x1.dataI()), _mm_packs_epi16(x2.dataI(), x3.dataI())); }\nVc_SIMD_CAST_4(SSE::   int_m, AVX2:: short_m) { return AVX::concat(_mm_packs_epi16(x0.dataI(), x1.dataI()), _mm_packs_epi16(x2.dataI(), x3.dataI())); }\nVc_SIMD_CAST_4(SSE::   int_m, AVX2::ushort_m) { return AVX::concat(_mm_packs_epi16(x0.dataI(), x1.dataI()), _mm_packs_epi16(x2.dataI(), x3.dataI())); }\nVc_SIMD_CAST_4(SSE::  uint_m, AVX2:: short_m) { return AVX::concat(_mm_packs_epi16(x0.dataI(), x1.dataI()), _mm_packs_epi16(x2.dataI(), x3.dataI())); }\nVc_SIMD_CAST_4(SSE::  uint_m, AVX2::ushort_m) { return AVX::concat(_mm_packs_epi16(x0.dataI(), x1.dataI()), _mm_packs_epi16(x2.dataI(), x3.dataI())); }\n#endif\n\n// 1 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k, enable_if<AVX2::is_mask<Return>::value>)\n{\n    Return r{false};\n    r[0] = k.data();\n    return r;\n}\n\n// 2 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k0, Scalar::Mask<T> k1,\n          enable_if<AVX2::is_mask<Return>::value>)\n{\n    Return r{false};\n    r[0] = k0.data();\n    r[1] = k1.data();\n    return r;\n}\n\n// 4 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k0, Scalar::Mask<T> k1, Scalar::Mask<T> k2, Scalar::Mask<T> k3,\n          enable_if<(AVX2::is_mask<Return>::value && Return::Size >= 4)>)\n{\n    Return r{false};\n    r[0] = k0.data();\n    r[1] = k1.data();\n    r[2] = k2.data();\n    r[3] = k3.data();\n    return r;\n}\n\n// 8 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k0, Scalar::Mask<T> k1, Scalar::Mask<T> k2, Scalar::Mask<T> k3,\n          Scalar::Mask<T> k4, Scalar::Mask<T> k5, Scalar::Mask<T> k6, Scalar::Mask<T> k7,\n          enable_if<(AVX2::is_mask<Return>::value && Return::Size >= 8)>)\n{\n    Return r{false};\n    r[0] = k0.data();\n    r[1] = k1.data();\n    r[2] = k2.data();\n    r[3] = k3.data();\n    r[4] = k4.data();\n    r[5] = k5.data();\n    r[6] = k6.data();\n    r[7] = k7.data();\n    return r;\n}\n\n// 16 Scalar::Mask to 1 AVX2::Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Mask<T> k0, Scalar::Mask<T> k1, Scalar::Mask<T> k2, Scalar::Mask<T> k3,\n          Scalar::Mask<T> k4, Scalar::Mask<T> k5, Scalar::Mask<T> k6, Scalar::Mask<T> k7,\n          Scalar::Mask<T> k8, Scalar::Mask<T> k9, Scalar::Mask<T> k10,\n          Scalar::Mask<T> k11, Scalar::Mask<T> k12, Scalar::Mask<T> k13,\n          Scalar::Mask<T> k14, Scalar::Mask<T> k15,\n          enable_if<(AVX2::is_mask<Return>::value && Return::Size >= 16)>)\n{\n    Return r{false};\n    r[0] = k0.data();\n    r[1] = k1.data();\n    r[2] = k2.data();\n    r[3] = k3.data();\n    r[4] = k4.data();\n    r[5] = k5.data();\n    r[6] = k6.data();\n    r[7] = k7.data();\n    r[8] = k8.data();\n    r[9] = k9.data();\n    r[10] = k10.data();\n    r[11] = k11.data();\n    r[12] = k12.data();\n    r[13] = k13.data();\n    r[14] = k14.data();\n    r[15] = k15.data();\n    return r;\n}\n\n// 1 AVX2::Mask to 1 SSE::Mask {{{2\nVc_SIMD_CAST_1(AVX2::double_m, SSE::double_m) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2::double_m, SSE:: float_m) { return _mm_packs_epi32(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2::double_m, SSE::   int_m) { return _mm_packs_epi32(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2::double_m, SSE::  uint_m) { return _mm_packs_epi32(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2::double_m, SSE:: short_m) { return _mm_packs_epi16(_mm_packs_epi32(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())), _mm_setzero_si128()); }\nVc_SIMD_CAST_1(AVX2::double_m, SSE::ushort_m) { return _mm_packs_epi16(_mm_packs_epi32(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())), _mm_setzero_si128()); }\n\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::double_m) { return _mm_unpacklo_ps(AVX::lo128(x.data()), AVX::lo128(x.data())); }\nVc_SIMD_CAST_1(AVX2:: float_m, SSE:: float_m) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::   int_m) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::  uint_m) { return AVX::lo128(x.data()); }\nVc_SIMD_CAST_1(AVX2:: float_m, SSE:: short_m) { return _mm_packs_epi16(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2:: float_m, SSE::ushort_m) { return _mm_packs_epi16(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\n\n#ifdef Vc_IMPL_AVX2\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::double_m) { return _mm_unpacklo_epi32(AVX::lo128(x.dataI()), AVX::lo128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2::   int_m, SSE:: float_m) { return AVX::lo128(x.dataI()); }\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::   int_m) { return AVX::lo128(x.dataI()); }\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::  uint_m) { return AVX::lo128(x.dataI()); }\nVc_SIMD_CAST_1(AVX2::   int_m, SSE:: short_m) { return _mm_packs_epi16(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2::   int_m, SSE::ushort_m) { return _mm_packs_epi16(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\n\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::double_m) { return _mm_unpacklo_epi32(AVX::lo128(x.dataI()), AVX::lo128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE:: float_m) { return AVX::lo128(x.dataI()); }\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::   int_m) { return AVX::lo128(x.dataI()); }\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::  uint_m) { return AVX::lo128(x.dataI()); }\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE:: short_m) { return _mm_packs_epi16(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\nVc_SIMD_CAST_1(AVX2::  uint_m, SSE::ushort_m) { return _mm_packs_epi16(AVX::lo128(x.dataI()), AVX::hi128(x.dataI())); }\n\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::double_m) { return simd_cast<SSE::double_m>(SSE::short_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2:: short_m, SSE:: float_m) { return simd_cast<SSE:: float_m>(SSE::short_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::   int_m) { return simd_cast<SSE::   int_m>(SSE::short_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::  uint_m) { return simd_cast<SSE::  uint_m>(SSE::short_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2:: short_m, SSE:: short_m) { return simd_cast<SSE:: short_m>(SSE::short_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2:: short_m, SSE::ushort_m) { return simd_cast<SSE::ushort_m>(SSE::short_m(AVX::lo128(x.data()))); }\n\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::double_m) { return simd_cast<SSE::double_m>(SSE::ushort_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE:: float_m) { return simd_cast<SSE:: float_m>(SSE::ushort_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::   int_m) { return simd_cast<SSE::   int_m>(SSE::ushort_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::  uint_m) { return simd_cast<SSE::  uint_m>(SSE::ushort_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE:: short_m) { return simd_cast<SSE:: short_m>(SSE::ushort_m(AVX::lo128(x.data()))); }\nVc_SIMD_CAST_1(AVX2::ushort_m, SSE::ushort_m) { return simd_cast<SSE::ushort_m>(SSE::ushort_m(AVX::lo128(x.data()))); }\n#endif\n\n// 2 AVX2::Mask to 1 SSE::Mask {{{2\nVc_SIMD_CAST_2(AVX2::double_m, SSE:: short_m) { return _mm_packs_epi16(_mm_packs_epi32(AVX::lo128(x0.dataI()), AVX::hi128(x0.dataI())), _mm_packs_epi32(AVX::lo128(x1.dataI()), AVX::hi128(x1.dataI()))); }\nVc_SIMD_CAST_2(AVX2::double_m, SSE::ushort_m) { return _mm_packs_epi16(_mm_packs_epi32(AVX::lo128(x0.dataI()), AVX::hi128(x0.dataI())), _mm_packs_epi32(AVX::lo128(x1.dataI()), AVX::hi128(x1.dataI()))); }\n\n// 1 AVX2::Mask to 1 Scalar::Mask {{{2\ntemplate <typename To, typename FromT>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(AVX2::Mask<FromT> x, enable_if<Scalar::is_mask<To>::value>)\n{\n    return static_cast<To>(x[0]);\n}\n\n// offset == 0 | convert from AVX2::Mask/Vector {{{1\ntemplate <typename Return, int offset, typename From>\nVc_INTRINSIC Vc_CONST enable_if<\n    (offset == 0 &&\n     ((AVX2::is_vector<From>::value && !Scalar::is_vector<Return>::value &&\n       Traits::is_simd_vector<Return>::value && !Traits::isSimdArray<Return>::value) ||\n      (AVX2::is_mask<From>::value && !Scalar::is_mask<Return>::value &&\n       Traits::is_simd_mask<Return>::value &&\n       !Traits::isSimdMaskArray<Return>::value))),\n    Return>\nsimd_cast(const From &x)\n{\n    return simd_cast<Return>(x);\n}\n\n// offset == 0 | convert from SSE::Mask/Vector to AVX2::Mask/Vector {{{1\ntemplate <typename Return, int offset, typename From>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(const From &x,\n          enable_if<offset == 0 && ((SSE::is_vector<From>::value &&\n                                     AVX2::is_vector<Return>::value) ||\n                                    (SSE::is_mask<From>::value &&\n                                     AVX2::is_mask<Return>::value))>)\n{\n    return simd_cast<Return>(x);\n}\n\n// Vector casts with offset {{{1\n// AVX2 to AVX2 {{{2\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(AVX2::is_vector<Return>::value && offset != 0),\n                                Return>\n    simd_cast(AVX2::Vector<T> x)\n{\n    // TODO: there certainly is potential for leaving out the shift/permute\n    // instruction at the cost of a lot more specializations\n    using V = AVX2::Vector<T>;\n    constexpr int shift = sizeof(T) * offset * Return::Size;\n    static_assert(shift > 0 && shift < sizeof(x), \"\");\n    if (shift < 16) {\n        return simd_cast<Return>(V{AVX::avx_cast<typename V::VectorType>(\n            _mm_srli_si128(AVX::avx_cast<__m128i>(AVX::lo128(x.data())), shift))});\n    } else if (shift == 16) {\n        return simd_cast<Return>(V{Mem::permute128<X1, Const0>(x.data())});\n    } else {\n#ifdef Vc_MSVC\n#pragma warning(push)\n#pragma warning(disable : 4556)  // value of intrinsic immediate argument '-8' is out of\n                                 // range '0 - 255'\n#endif\n        return simd_cast<Return>(V{AVX::avx_cast<typename V::VectorType>(\n            _mm_srli_si128(AVX::avx_cast<__m128i>(AVX::hi128(x.data())), shift - 16))});\n#ifdef Vc_MSVC\n#pragma warning(pop)\n#endif\n    }\n}\n// AVX2 to SSE (Vector<T>) {{{2\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_vector<Return>::value &&\n                                 sizeof(AVX2::Vector<T>) == 32),\n                                Return>\n    simd_cast(AVX2::Vector<T> x)\n{\n    using V = AVX2::Vector<T>;\n    constexpr int shift = sizeof(V) / V::Size * offset * Return::Size;\n    static_assert(shift > 0, \"\");\n    static_assert(shift < sizeof(V), \"\");\n    using SseVector = SSE::Vector<typename V::EntryType>;\n    if (shift == 16) {\n        return simd_cast<Return>(SseVector{AVX::hi128(x.data())});\n    }\n    using Intrin = typename SseVector::VectorType;\n    return simd_cast<Return>(SseVector{AVX::avx_cast<Intrin>(\n        _mm_alignr_epi8(AVX::avx_cast<__m128i>(AVX::hi128(x.data())),\n                        AVX::avx_cast<__m128i>(AVX::lo128(x.data())), shift))});\n}\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_vector<Return>::value &&\n                                 sizeof(AVX2::Vector<T>) == 16),\n                                Return>\n    simd_cast(AVX2::Vector<T> x)\n{\n    using V = AVX2::Vector<T>;\n    constexpr int shift = sizeof(V) / V::Size * offset * Return::Size;\n    static_assert(shift > 0, \"\");\n    static_assert(shift < sizeof(V), \"\");\n    using SseVector = SSE::Vector<typename V::EntryType>;\n    return simd_cast<Return>(SseVector{_mm_srli_si128(x.data(), shift)});\n}\n// SSE to AVX2 {{{2\nVc_SIMD_CAST_OFFSET(SSE:: short_v, AVX2::double_v, 1) { return simd_cast<AVX2::double_v>(simd_cast<SSE::int_v, 1>(x)); }\nVc_SIMD_CAST_OFFSET(SSE::ushort_v, AVX2::double_v, 1) { return simd_cast<AVX2::double_v>(simd_cast<SSE::int_v, 1>(x)); }\n\n// Mask casts with offset {{{1\n// 1 AVX2::Mask to N AVX2::Mask {{{2\n// float_v and (u)int_v have size 8, double_v has size 4, and (u)short_v have size 16. Consequently,\n// offset can 0, 1, 2, or 3.\n// - offset == 0 is already done.\n// - offset == 1 can be 16 -> 8, 16 -> 4, 8 -> 4, and 16 -> 4\n// - offset == 2 && offset == 3 can only be 16 -> 4\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<(AVX2::is_mask<Return>::value && offset == 1 &&\n                     AVX2::Mask<T>::Size == Return::Size * 2)> = nullarg)\n{\n    const auto tmp = AVX::hi128(k.dataI());\n    return AVX::concat(_mm_unpacklo_epi8(tmp, tmp), _mm_unpackhi_epi8(tmp, tmp));\n}\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<(AVX2::is_mask<Return>::value && offset == 1 &&\n                     AVX2::Mask<T>::Size == Return::Size * 4)> = nullarg)\n{\n    auto tmp = AVX::lo128(k.dataI());\n    tmp = _mm_unpackhi_epi8(tmp, tmp);\n    return AVX::concat(_mm_unpacklo_epi16(tmp, tmp), _mm_unpackhi_epi16(tmp, tmp));\n}\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<(AVX2::is_mask<Return>::value && offset == 2 &&\n                     AVX2::Mask<T>::Size == Return::Size * 4)> = nullarg)\n{\n    auto tmp = AVX::hi128(k.dataI());\n    tmp = _mm_unpacklo_epi8(tmp, tmp);\n    return AVX::concat(_mm_unpacklo_epi16(tmp, tmp), _mm_unpackhi_epi16(tmp, tmp));\n}\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(const AVX2::Mask<T> &k,\n          enable_if<(AVX2::is_mask<Return>::value && offset == 3 &&\n                     AVX2::Mask<T>::Size == Return::Size * 4)> = nullarg)\n{\n    auto tmp = AVX::hi128(k.dataI());\n    tmp = _mm_unpackhi_epi8(tmp, tmp);\n    return AVX::concat(_mm_unpacklo_epi16(tmp, tmp), _mm_unpackhi_epi16(tmp, tmp));\n}\n\n// 1 SSE::Mask to N AVX2::Mask {{{2\nVc_SIMD_CAST_OFFSET(SSE:: short_m, AVX2::double_m, 1) { auto tmp = _mm_unpackhi_epi16(x.dataI(), x.dataI()); return AVX::concat(_mm_unpacklo_epi32(tmp, tmp), _mm_unpackhi_epi32(tmp, tmp)); }\nVc_SIMD_CAST_OFFSET(SSE::ushort_m, AVX2::double_m, 1) { auto tmp = _mm_unpackhi_epi16(x.dataI(), x.dataI()); return AVX::concat(_mm_unpacklo_epi32(tmp, tmp), _mm_unpackhi_epi32(tmp, tmp)); }\n\n// AVX2 to SSE (Mask<T>) {{{2\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_mask<Return>::value &&\n                                 sizeof(AVX2::Mask<T>) == 32),\n                                Return>\n    simd_cast(AVX2::Mask<T> x)\n{\n    using M = AVX2::Mask<T>;\n    constexpr int shift = sizeof(M) / M::Size * offset * Return::Size;\n    static_assert(shift > 0, \"\");\n    static_assert(shift < sizeof(M), \"\");\n    using SseVector = SSE::Mask<Traits::entry_type_of<typename M::Vector>>;\n    if (shift == 16) {\n        return simd_cast<Return>(SseVector{AVX::hi128(x.data())});\n    }\n    using Intrin = typename SseVector::VectorType;\n    return simd_cast<Return>(SseVector{AVX::avx_cast<Intrin>(\n        _mm_alignr_epi8(AVX::hi128(x.dataI()), AVX::lo128(x.dataI()), shift))});\n}\n\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(offset != 0 && SSE::is_mask<Return>::value &&\n                                 sizeof(AVX2::Mask<T>) == 16),\n                                Return>\n    simd_cast(AVX2::Mask<T> x)\n{\n    return simd_cast<Return, offset>(simd_cast<SSE::Mask<T>>(x));\n}\n\n// undef Vc_SIMD_CAST_AVX_[1234] & Vc_SIMD_CAST_[12345678] {{{1\n#undef Vc_SIMD_CAST_AVX_1\n#undef Vc_SIMD_CAST_AVX_2\n#undef Vc_SIMD_CAST_AVX_3\n#undef Vc_SIMD_CAST_AVX_4\n\n#undef Vc_SIMD_CAST_1\n#undef Vc_SIMD_CAST_2\n#undef Vc_SIMD_CAST_3\n#undef Vc_SIMD_CAST_4\n#undef Vc_SIMD_CAST_5\n#undef Vc_SIMD_CAST_6\n#undef Vc_SIMD_CAST_7\n#undef Vc_SIMD_CAST_8\n\n#undef Vc_SIMD_CAST_OFFSET\n// }}}1\n\n}  // namespace Vc\n\n#endif // VC_AVX_SIMD_CAST_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/simd_cast_caller.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef Vc_AVX_SIMD_CAST_CALLER_TCC_\n#define Vc_AVX_SIMD_CAST_CALLER_TCC_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n#if Vc_IS_VERSION_1\ntemplate <typename T>\ntemplate <typename U, typename>\nVc_INTRINSIC Vector<T, VectorAbi::Avx>::Vector(U &&x)\n    : d(simd_cast<Vector>(std::forward<U>(x)).data())\n{\n}\n\ntemplate <typename T>\ntemplate <typename U>\nVc_INTRINSIC Mask<T, VectorAbi::Avx>::Mask(U &&rhs,\n                                 Common::enable_if_mask_converts_explicitly<T, U>)\n    : Mask(simd_cast<Mask>(std::forward<U>(rhs)))\n{\n}\n#endif  // Vc_IS_VERSION_1\n}\n\n#endif  // Vc_AVX_SIMD_CAST_CALLER_TCC_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/types.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_TYPES_H_\n#define VC_AVX_TYPES_H_\n\n#include \"../sse/types.h\"\n#include \"../traits/type_traits.h\"\n#include \"macros.h\"\n\n#ifdef Vc_DEFAULT_IMPL_AVX2\n#define Vc_DOUBLE_V_SIZE 4\n#define Vc_FLOAT_V_SIZE 8\n#define Vc_INT_V_SIZE 8\n#define Vc_UINT_V_SIZE 8\n#define Vc_SHORT_V_SIZE 16\n#define Vc_USHORT_V_SIZE 16\n#elif defined Vc_DEFAULT_IMPL_AVX\n#define Vc_DOUBLE_V_SIZE 4\n#define Vc_FLOAT_V_SIZE 8\n#define Vc_INT_V_SIZE 4\n#define Vc_UINT_V_SIZE 4\n#define Vc_SHORT_V_SIZE 8\n#define Vc_USHORT_V_SIZE 8\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\ntemplate <typename T> using Vector = Vc::Vector<T, VectorAbi::Avx1Abi<T>>;\ntypedef Vector<double>         double_v;\ntypedef Vector<float>           float_v;\ntypedef Vector<int>               int_v;\ntypedef Vector<unsigned int>     uint_v;\ntypedef Vector<short>           short_v;\ntypedef Vector<unsigned short> ushort_v;\n\ntemplate <typename T> using Mask = Vc::Mask<T, VectorAbi::Avx1Abi<T>>;\ntypedef Mask<double>         double_m;\ntypedef Mask<float>           float_m;\ntypedef Mask<int>               int_m;\ntypedef Mask<unsigned int>     uint_m;\ntypedef Mask<short>           short_m;\ntypedef Mask<unsigned short> ushort_m;\n\ntemplate <typename T> struct Const;\n\ntemplate <typename T> struct is_vector : public std::false_type {};\ntemplate <typename T> struct is_vector<Vector<T>> : public std::true_type {};\ntemplate <typename T> struct is_mask : public std::false_type {};\ntemplate <typename T> struct is_mask<Mask<T>> : public std::true_type {};\n}  // namespace AVX\n\nnamespace AVX2\n{\ntemplate <typename T> using Vector = Vc::Vector<T, VectorAbi::Avx>;\nusing double_v = Vector<double>;\nusing  float_v = Vector< float>;\nusing    int_v = Vector<   int>;\nusing   uint_v = Vector<  uint>;\nusing  short_v = Vector< short>;\nusing ushort_v = Vector<ushort>;\n\ntemplate <typename T> using Mask = Vc::Mask<T, VectorAbi::Avx>;\nusing double_m = Mask<double>;\nusing  float_m = Mask< float>;\nusing  llong_m = Mask< llong>;\nusing ullong_m = Mask<ullong>;\nusing   long_m = Mask<  long>;\nusing  ulong_m = Mask< ulong>;\nusing    int_m = Mask<   int>;\nusing   uint_m = Mask<  uint>;\nusing  short_m = Mask< short>;\nusing ushort_m = Mask<ushort>;\nusing  schar_m = Mask< schar>;\nusing  uchar_m = Mask< uchar>;\n\ntemplate <typename T> struct is_vector : public std::false_type {};\ntemplate <typename T> struct is_vector<Vector<T>> : public std::true_type {};\ntemplate <typename T> struct is_mask : public std::false_type {};\ntemplate <typename T> struct is_mask<Mask<T>> : public std::true_type {};\n}  // namespace AVX2\n\nnamespace Traits\n{\ntemplate <class T> struct\nis_simd_vector_internal<Vector<T, VectorAbi::Avx>>\n  : public is_valid_vector_argument<T> {};\n\ntemplate<typename T> struct is_simd_mask_internal<Mask<T, VectorAbi::Avx>>\n  : public std::true_type {};\n}  // namespace Traits\n}  // namespace Vc\n\n#endif // VC_AVX_TYPES_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/vector.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_VECTOR_H_\n#define VC_AVX_VECTOR_H_\n\n#include \"intrinsics.h\"\n#include \"casts.h\"\n#include \"../sse/vector.h\"\n#include \"shuffle.h\"\n#include \"vectorhelper.h\"\n#include \"mask.h\"\n#include <algorithm>\n#include <cmath>\n#include \"../common/aliasingentryhelper.h\"\n#include \"../common/memoryfwd.h\"\n#include \"../common/where.h\"\n#include \"macros.h\"\n\n#ifdef isfinite\n#undef isfinite\n#endif\n#ifdef isnan\n#undef isnan\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <typename T, typename Abi> struct VectorTraits\n{\n    using mask_type = Vc::Mask<T, Abi>;\n    using vector_type = Vc::Vector<T, Abi>;\n    using writemasked_vector_type = Common::WriteMaskedVector<vector_type, mask_type>;\n    using intrinsic_type = typename AVX::VectorTypeHelper<T>::Type;\n};\n}  // namespace Detail\n\n#define Vc_CURRENT_CLASS_NAME Vector\ntemplate <typename T> class Vector<T, VectorAbi::Avx>\n{\npublic:\n    using abi = VectorAbi::Avx;\n\nprivate:\n    using traits_type = Detail::VectorTraits<T, abi>;\n    static_assert(\n        std::is_arithmetic<T>::value,\n        \"Vector<T> only accepts arithmetic builtin types as template parameter T.\");\n\n    using WriteMaskedVector = typename traits_type::writemasked_vector_type;\n\npublic:\n    using VectorType = typename traits_type::intrinsic_type;\n    using vector_type = VectorType;\n\n    using mask_type = typename traits_type::mask_type;\n    using Mask = mask_type;\n    using MaskType = mask_type;\n    using MaskArg Vc_DEPRECATED_ALIAS(\"Use MaskArgument instead.\") = typename Mask::AsArg;\n    using MaskArgument = typename Mask::AsArg;\n    using reference = Detail::ElementReference<Vector>;\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(VectorType));\n\n    using EntryType = T;\n        using value_type = EntryType;\n        typedef EntryType VectorEntryType;\n        static constexpr size_t Size = sizeof(VectorType) / sizeof(EntryType);\n        static constexpr size_t MemoryAlignment = alignof(VectorType);\n    using IndexType = fixed_size_simd<int, Size>;\n    using index_type = IndexType;\n        typedef Vector<T, abi> AsArg;\n        typedef VectorType VectorTypeArg;\n\n    protected:\n        template <typename U> using V = Vector<U, abi>;\n\n        // helper that specializes on VectorType\n        typedef AVX::VectorHelper<VectorType> HV;\n\n        // helper that specializes on T\n        typedef AVX::VectorHelper<T> HT;\n\n        // cast any m256/m128 to VectorType\n        template <typename V> static Vc_INTRINSIC VectorType _cast(V v)\n        {\n            return AVX::avx_cast<VectorType>(v);\n        }\n\n        typedef Common::VectorMemoryUnion<VectorType, EntryType> StorageType;\n        StorageType d;\n\n        using WidthT = Common::WidthT<VectorType>;\n        // ICC can't compile this:\n        // static constexpr WidthT Width = WidthT();\n\n    public:\n#include \"../common/generalinterface.h\"\n\n        static Vc_ALWAYS_INLINE_L Vector Random() Vc_ALWAYS_INLINE_R;\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // internal: required to enable returning objects of VectorType\n        Vc_ALWAYS_INLINE Vector(VectorTypeArg x) : d(x) {}\n\n        // implict conversion from compatible Vector<U, abi>\n        template <typename U>\n        Vc_INTRINSIC Vector(\n            V<U> x, typename std::enable_if<Traits::is_implicit_cast_allowed<U, T>::value,\n                                            void *>::type = nullptr)\n            : d(AVX::convert<U, T>(x.data()))\n        {\n        }\n\n#if Vc_IS_VERSION_1\n        // static_cast from the remaining Vector<U, abi>\n        template <typename U>\n        Vc_DEPRECATED(\"use simd_cast instead of explicit type casting to convert between \"\n                      \"vector types\") Vc_INTRINSIC explicit Vector(\n            V<U> x,\n            typename std::enable_if<!Traits::is_implicit_cast_allowed<U, T>::value,\n                                    void *>::type = nullptr)\n            : d(Detail::zeroExtendIfNeeded(AVX::convert<U, T>(x.data())))\n        {\n        }\n\n        // static_cast from other types, implemented via the non-member simd_cast function in\n        // simd_cast_caller.tcc\n        template <typename U,\n                  typename = enable_if<Traits::is_simd_vector<U>::value &&\n                                       !std::is_same<Vector, Traits::decay<U>>::value>>\n        Vc_DEPRECATED(\"use simd_cast instead of explicit type casting to convert between \"\n                      \"vector types\") Vc_INTRINSIC_L\n            explicit Vector(U &&x) Vc_INTRINSIC_R;\n#endif\n\n        Vc_INTRINSIC explicit Vector(reference a) : Vector(static_cast<EntryType>(a)) {}\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // broadcast\n        Vc_INTRINSIC Vector(EntryType a) : d(Detail::avx_broadcast(a)) {}\n        template <typename U>\n        Vc_INTRINSIC Vector(U a,\n                            typename std::enable_if<std::is_same<U, int>::value &&\n                                                        !std::is_same<U, EntryType>::value,\n                                                    void *>::type = nullptr)\n            : Vector(static_cast<EntryType>(a))\n        {\n        }\n\n        //template<typename U>\n        explicit Vector(std::initializer_list<EntryType>)\n        {\n            static_assert(std::is_same<EntryType, void>::value,\n                          \"A SIMD vector object cannot be initialized from an initializer list \"\n                          \"because the number of entries in the vector is target-dependent.\");\n        }\n\n#include \"../common/loadinterface.h\"\n#include \"../common/storeinterface.h\"\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // zeroing\n        Vc_INTRINSIC_L void setZero() Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L void setZero(const Mask &k) Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L void setZeroInverted(const Mask &k) Vc_INTRINSIC_R;\n\n        Vc_INTRINSIC_L void setQnan() Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L void setQnan(MaskArgument k) Vc_INTRINSIC_R;\n\n#include \"../common/gatherinterface.h\"\n#include \"../common/scatterinterface.h\"\n#if defined Vc_IMPL_AVX2 && !defined Vc_MSVC\n        // skip this code for MSVC because it fails to do overload resolution correctly\n\n        ////////////////////////////////////////////////////////////////////////////////\n        // non-converting pd, ps, and epi32 gathers\n        template <class U, class A, int Scale, int N = Vector<U, A>::size(),\n                  class = enable_if<(Vector<U, A>::size() >= size() && sizeof(T) >= 4)>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<T, Vector<U, A>, Scale> &args)\n        {\n            d.v() = AVX::gather<sizeof(T) * Scale>(\n                args.address,\n                simd_cast<conditional_t<Size == 4, SSE::int_v, AVX2::int_v>>(args.indexes)\n                    .data());\n        }\n\n        // masked overload\n        template <class U, class A, int Scale, int N = Vector<U, A>::size(),\n                  class = enable_if<(Vector<U, A>::size() >= size() && sizeof(T) >= 4)>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<T, Vector<U, A>, Scale> &args, MaskArgument k)\n        {\n            d.v() = AVX::gather<sizeof(T) * Scale>(\n                d.v(), k.data(), args.address,\n                simd_cast<conditional_t<Size == 4, SSE::int_v, AVX2::int_v>>(args.indexes)\n                    .data());\n        }\n\n        ////////////////////////////////////////////////////////////////////////////////\n        // converting (from 8-bit and 16-bit integers only) epi16 gather emulation via\n        // epi32 gathers\n        template <\n            class MT, class U, class A, int Scale,\n            class = enable_if<(sizeof(T) == 2 && std::is_integral<MT>::value &&\n                               (sizeof(MT) <= 2) && Vector<U, A>::size() >= size())>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<MT, Vector<U, A>, Scale> &args)\n        {\n            using AVX2::int_v;\n            const auto idx0 = simd_cast<int_v, 0>(args.indexes).data();\n            const auto idx1 = simd_cast<int_v, 1>(args.indexes).data();\n            *this = simd_cast<Vector>(int_v(AVX::gather<sizeof(MT) * Scale>(\n                                          aliasing_cast<int>(args.address), idx0)),\n                                      int_v(AVX::gather<sizeof(MT) * Scale>(\n                                          aliasing_cast<int>(args.address), idx1)));\n            if (sizeof(MT) == 1) {\n                if (std::is_signed<MT>::value) {\n                    using Signed = AVX2::Vector<typename std::make_signed<T>::type>;\n                    *this = (simd_cast<Signed>(*this) << 8) >> 8;  // sign extend\n                } else {\n                    *this &= 0xff;\n                }\n            }\n        }\n\n        // masked overload\n        template <\n            class MT, class U, class A, int Scale,\n            class = enable_if<(sizeof(T) == 2 && std::is_integral<MT>::value &&\n                               (sizeof(MT) <= 2) && Vector<U, A>::size() >= size())>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<MT, Vector<U, A>, Scale> &args, MaskArgument k)\n        {\n            using AVX2::int_v;\n            const auto idx0 = simd_cast<int_v, 0>(args.indexes).data();\n            const auto idx1 = simd_cast<int_v, 1>(args.indexes).data();\n            const auto k0 = simd_cast<AVX2::int_m, 0>(k).data();\n            const auto k1 = simd_cast<AVX2::int_m, 1>(k).data();\n            auto v = simd_cast<Vector>(\n                int_v(AVX::gather<sizeof(MT) * Scale>(\n                    _mm256_setzero_si256(), k0, aliasing_cast<int>(args.address), idx0)),\n                int_v(AVX::gather<sizeof(MT) * Scale>(\n                    _mm256_setzero_si256(), k1, aliasing_cast<int>(args.address), idx1)));\n            if (sizeof(MT) == 1) {\n                if (std::is_signed<MT>::value) {\n                    using Signed = AVX2::Vector<typename std::make_signed<T>::type>;\n                    v = (simd_cast<Signed>(v) << 8) >> 8;  // sign extend\n                } else {\n                    v &= 0xff;\n                }\n            }\n            assign(v, k);\n        }\n\n        ////////////////////////////////////////////////////////////////////////////////\n        // all remaining converting gathers\n        template <class MT, class U, class A, int Scale>\n        Vc_INTRINSIC enable_if<((sizeof(T) != 2 || sizeof(MT) > 2) &&\n                                Traits::is_valid_vector_argument<MT>::value &&\n                                !std::is_same<MT, T>::value &&\n                                Vector<U, A>::size() >= size()),\n                               void>\n        gatherImplementation(const Common::GatherArguments<MT, Vector<U, A>, Scale> &args)\n        {\n            *this = simd_cast<Vector>(fixed_size_simd<MT, Size>(args));\n        }\n\n        // masked overload\n        template <class MT, class U, class A, int Scale>\n        Vc_INTRINSIC enable_if<((sizeof(T) != 2 || sizeof(MT) > 2) &&\n                                Traits::is_valid_vector_argument<MT>::value &&\n                                !std::is_same<MT, T>::value &&\n                                Vector<U, A>::size() >= size()),\n                               void>\n        gatherImplementation(const Common::GatherArguments<MT, Vector<U, A>, Scale> &args,\n                             MaskArgument k)\n        {\n            assign(simd_cast<Vector>(fixed_size_simd<MT, Size>(args, k)), k);\n        }\n#endif  // Vc_IMPL_AVX2 && !MSVC\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        //prefix\n        Vc_ALWAYS_INLINE Vector &operator++() { data() = Detail::add(data(), Detail::one(T()), T()); return *this; }\n        Vc_ALWAYS_INLINE Vector &operator--() { data() = Detail::sub(data(), Detail::one(T()), T()); return *this; }\n        //postfix\n        Vc_ALWAYS_INLINE Vector operator++(int) { const Vector r = *this; data() = Detail::add(data(), Detail::one(T()), T()); return r; }\n        Vc_ALWAYS_INLINE Vector operator--(int) { const Vector r = *this; data() = Detail::sub(data(), Detail::one(T()), T()); return r; }\n\n    private:\n        friend reference;\n        Vc_INTRINSIC static value_type get(const Vector &o, int i) noexcept\n        {\n            return o.d.m(i);\n        }\n        template <typename U>\n        Vc_INTRINSIC static void set(Vector &o, int i, U &&v) noexcept(\n            noexcept(std::declval<value_type &>() = v))\n        {\n            return o.d.set(i, v);\n        }\n\n    public:\n        /**\n         * \\note the returned object models the concept of a reference and\n         * as such it can exist longer than the data it is referencing.\n         * \\note to avoid lifetime issues, we strongly advice not to store\n         * any reference objects.\n         */\n        Vc_ALWAYS_INLINE reference operator[](size_t index) noexcept\n        {\n            static_assert(noexcept(reference{std::declval<Vector &>(), int()}), \"\");\n            return {*this, int(index)};\n        }\n        Vc_ALWAYS_INLINE value_type operator[](size_t index) const noexcept\n        {\n            return d.m(index);\n        }\n\n        Vc_INTRINSIC_L Vc_PURE_L Vector operator[](Permutation::ReversedTag) const Vc_INTRINSIC_R Vc_PURE_R;\n        Vc_INTRINSIC_L Vc_PURE_L Vector operator[](const IndexType &perm) const Vc_INTRINSIC_R Vc_PURE_R;\n\n        Vc_INTRINSIC Vc_PURE Mask operator!() const\n        {\n            return *this == Zero();\n        }\n        Vc_ALWAYS_INLINE Vector operator~() const\n        {\n#ifndef Vc_ENABLE_FLOAT_BIT_OPERATORS\n            static_assert(std::is_integral<T>::value,\n                          \"bit-complement can only be used with Vectors of integral type\");\n#endif\n            return Detail::andnot_(data(), Detail::allone<VectorType>());\n        }\n        Vc_ALWAYS_INLINE_L Vc_PURE_L Vector operator-() const Vc_ALWAYS_INLINE_R Vc_PURE_R;\n        Vc_INTRINSIC Vc_PURE Vector operator+() const { return *this; }\n\n        // shifts\n#define Vc_OP_VEC(op)                                                                    \\\n    Vc_INTRINSIC Vector &operator op##=(AsArg x);                                        \\\n    Vc_INTRINSIC Vc_PURE Vector operator op(AsArg x) const                               \\\n    {                                                                                    \\\n        static_assert(                                                                   \\\n            std::is_integral<T>::value,                                                  \\\n            \"bitwise-operators can only be used with Vectors of integral type\");         \\\n    }\n    Vc_ALL_SHIFTS(Vc_OP_VEC);\n#undef Vc_OP_VEC\n\n        Vc_ALWAYS_INLINE_L Vector &operator>>=(int x) Vc_ALWAYS_INLINE_R;\n        Vc_ALWAYS_INLINE_L Vector &operator<<=(int x) Vc_ALWAYS_INLINE_R;\n        Vc_ALWAYS_INLINE_L Vector operator>>(int x) const Vc_ALWAYS_INLINE_R;\n        Vc_ALWAYS_INLINE_L Vector operator<<(int x) const Vc_ALWAYS_INLINE_R;\n\n        Vc_DEPRECATED(\"use isnegative(x) instead\") Vc_INTRINSIC Vc_PURE Mask\n            isNegative() const\n        {\n            return Vc::isnegative(*this);\n        }\n\n        Vc_ALWAYS_INLINE void assign( const Vector &v, const Mask &mask ) {\n            data() = Detail::blend(data(), v.data(), mask.data());\n        }\n\n        template <typename V2>\n        Vc_DEPRECATED(\"Use simd_cast instead of Vector::staticCast\") Vc_ALWAYS_INLINE V2\n            staticCast() const\n        {\n            return V2(*this);\n        }\n        template <typename V2>\n        Vc_DEPRECATED(\"use reinterpret_components_cast instead\") Vc_ALWAYS_INLINE V2\n            reinterpretCast() const\n        {\n            return AVX::avx_cast<typename V2::VectorType>(data());\n        }\n\n        Vc_ALWAYS_INLINE WriteMaskedVector operator()(const Mask &k)\n        {\n            return {*this, k};\n        }\n\n        Vc_ALWAYS_INLINE VectorType &data() { return d.v(); }\n        Vc_ALWAYS_INLINE const VectorType &data() const { return d.v(); }\n\n        template<int Index>\n        Vc_INTRINSIC_L Vector broadcast() const Vc_INTRINSIC_R;\n\n        Vc_INTRINSIC_L std::pair<Vector, int> minIndex() const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L std::pair<Vector, int> maxIndex() const Vc_INTRINSIC_R;\n\n        Vc_ALWAYS_INLINE EntryType min() const { return Detail::min(data(), T()); }\n        Vc_ALWAYS_INLINE EntryType max() const { return Detail::max(data(), T()); }\n        Vc_ALWAYS_INLINE EntryType product() const { return Detail::mul(data(), T()); }\n        Vc_ALWAYS_INLINE EntryType sum() const { return Detail::add(data(), T()); }\n        Vc_ALWAYS_INLINE_L Vector partialSum() const Vc_ALWAYS_INLINE_R;\n        //template<typename BinaryOperation> Vc_ALWAYS_INLINE_L Vector partialSum(BinaryOperation op) const Vc_ALWAYS_INLINE_R;\n        Vc_ALWAYS_INLINE_L EntryType min(MaskArgument m) const Vc_ALWAYS_INLINE_R;\n        Vc_ALWAYS_INLINE_L EntryType max(MaskArgument m) const Vc_ALWAYS_INLINE_R;\n        Vc_ALWAYS_INLINE_L EntryType product(MaskArgument m) const Vc_ALWAYS_INLINE_R;\n        Vc_ALWAYS_INLINE_L EntryType sum(MaskArgument m) const Vc_ALWAYS_INLINE_R;\n\n        Vc_INTRINSIC_L Vector shifted(int amount, Vector shiftIn) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector shifted(int amount) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector rotated(int amount) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vc_PURE_L Vector reversed() const Vc_INTRINSIC_R Vc_PURE_R;\n        Vc_ALWAYS_INLINE_L Vc_PURE_L Vector sorted() const Vc_ALWAYS_INLINE_R Vc_PURE_R;\n\n        template <typename F> void callWithValuesSorted(F &&f)\n        {\n            EntryType value = d.m(0);\n            f(value);\n            for (size_t i = 1; i < Size; ++i) {\n                if (d.m(i) != value) {\n                    value = d.m(i);\n                    f(value);\n                }\n            }\n        }\n\n        template <typename F> Vc_INTRINSIC void call(F &&f) const\n        {\n            Common::for_all_vector_entries<Size>([&](size_t i) { f(EntryType(d.m(i))); });\n        }\n\n        template <typename F> Vc_INTRINSIC void call(F &&f, const Mask &mask) const\n        {\n            for (size_t i : where(mask)) {\n                f(EntryType(d.m(i)));\n            }\n        }\n\n        template <typename F> Vc_INTRINSIC Vector apply(F &&f) const\n        {\n            Vector r;\n            Common::for_all_vector_entries<Size>(\n                [&](size_t i) { r.d.set(i, f(EntryType(d.m(i)))); });\n            return r;\n        }\n\n        template <typename F> Vc_INTRINSIC Vector apply(F &&f, const Mask &mask) const\n        {\n            Vector r(*this);\n            for (size_t i : where(mask)) {\n                r.d.set(i, f(EntryType(r.d.m(i))));\n            }\n            return r;\n        }\n\n        template<typename IndexT> Vc_INTRINSIC void fill(EntryType (&f)(IndexT)) {\n            Common::for_all_vector_entries<Size>([&](size_t i) { d.set(i, f(i)); });\n        }\n        Vc_INTRINSIC void fill(EntryType (&f)()) {\n            Common::for_all_vector_entries<Size>([&](size_t i) { d.set(i, f()); });\n        }\n\n        template <typename G> static Vc_INTRINSIC_L Vector generate(G gen) Vc_INTRINSIC_R;\n\n        Vc_DEPRECATED(\"use copysign(x, y) instead\") Vc_INTRINSIC Vector\n            copySign(AsArg x) const\n        {\n            return Vc::copysign(*this, x);\n        }\n\n        Vc_DEPRECATED(\"use exponent(x) instead\") Vc_INTRINSIC Vector exponent() const\n        {\n            Vc::exponent(*this);\n        }\n\n        Vc_INTRINSIC_L Vector interleaveLow(Vector x) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector interleaveHigh(Vector x) const Vc_INTRINSIC_R;\n};\n#undef Vc_CURRENT_CLASS_NAME\ntemplate <typename T> constexpr size_t Vector<T, VectorAbi::Avx>::Size;\ntemplate <typename T> constexpr size_t Vector<T, VectorAbi::Avx>::MemoryAlignment;\n\n#define Vc_CONDITIONAL_ASSIGN(name_, op_)                                                \\\n    template <Operator O, typename T, typename M, typename U>                            \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, void> conditional_assign(               \\\n        AVX2::Vector<T> &lhs, M &&mask, U &&rhs)                                         \\\n    {                                                                                    \\\n        lhs(mask) op_ rhs;                                                               \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(          Assign,  =);\nVc_CONDITIONAL_ASSIGN(      PlusAssign, +=);\nVc_CONDITIONAL_ASSIGN(     MinusAssign, -=);\nVc_CONDITIONAL_ASSIGN(  MultiplyAssign, *=);\nVc_CONDITIONAL_ASSIGN(    DivideAssign, /=);\nVc_CONDITIONAL_ASSIGN( RemainderAssign, %=);\nVc_CONDITIONAL_ASSIGN(       XorAssign, ^=);\nVc_CONDITIONAL_ASSIGN(       AndAssign, &=);\nVc_CONDITIONAL_ASSIGN(        OrAssign, |=);\nVc_CONDITIONAL_ASSIGN( LeftShiftAssign,<<=);\nVc_CONDITIONAL_ASSIGN(RightShiftAssign,>>=);\n#undef Vc_CONDITIONAL_ASSIGN\n\n#define Vc_CONDITIONAL_ASSIGN(name_, expr_)                                              \\\n    template <Operator O, typename T, typename M>                                        \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, AVX2::Vector<T>> conditional_assign(    \\\n        AVX2::Vector<T> &lhs, M &&mask)                                                  \\\n    {                                                                                    \\\n        return expr_;                                                                    \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(PostIncrement, lhs(mask)++);\nVc_CONDITIONAL_ASSIGN( PreIncrement, ++lhs(mask));\nVc_CONDITIONAL_ASSIGN(PostDecrement, lhs(mask)--);\nVc_CONDITIONAL_ASSIGN( PreDecrement, --lhs(mask));\n#undef Vc_CONDITIONAL_ASSIGN\n\n}  // namespace Vc\n\n#include \"vector.tcc\"\n#include \"simd_cast.h\"\n\n#endif // VC_AVX_VECTOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/vector.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"../common/x86_prefetches.h\"\n#include \"../common/gatherimplementation.h\"\n#include \"../common/scatterimplementation.h\"\n#include \"limits.h\"\n#include \"const.h\"\n#include \"../common/set.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n// compare operators {{{1\nVc_INTRINSIC AVX2::double_m operator==(AVX2::double_v a, AVX2::double_v b) { return AVX::cmpeq_pd(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: float_m operator==(AVX2:: float_v a, AVX2:: float_v b) { return AVX::cmpeq_ps(a.data(), b.data()); }\nVc_INTRINSIC AVX2::double_m operator!=(AVX2::double_v a, AVX2::double_v b) { return AVX::cmpneq_pd(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: float_m operator!=(AVX2:: float_v a, AVX2:: float_v b) { return AVX::cmpneq_ps(a.data(), b.data()); }\nVc_INTRINSIC AVX2::double_m operator>=(AVX2::double_v a, AVX2::double_v b) { return AVX::cmpnlt_pd(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: float_m operator>=(AVX2:: float_v a, AVX2:: float_v b) { return AVX::cmpnlt_ps(a.data(), b.data()); }\nVc_INTRINSIC AVX2::double_m operator<=(AVX2::double_v a, AVX2::double_v b) { return AVX::cmple_pd(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: float_m operator<=(AVX2:: float_v a, AVX2:: float_v b) { return AVX::cmple_ps(a.data(), b.data()); }\nVc_INTRINSIC AVX2::double_m operator> (AVX2::double_v a, AVX2::double_v b) { return AVX::cmpgt_pd(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: float_m operator> (AVX2:: float_v a, AVX2:: float_v b) { return AVX::cmpgt_ps(a.data(), b.data()); }\nVc_INTRINSIC AVX2::double_m operator< (AVX2::double_v a, AVX2::double_v b) { return AVX::cmplt_pd(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: float_m operator< (AVX2:: float_v a, AVX2:: float_v b) { return AVX::cmplt_ps(a.data(), b.data()); }\n\n#ifdef Vc_IMPL_AVX2\nVc_INTRINSIC AVX2::   int_m operator==(AVX2::   int_v a, AVX2::   int_v b) { return AVX::cmpeq_epi32(a.data(), b.data()); }\nVc_INTRINSIC AVX2::  uint_m operator==(AVX2::  uint_v a, AVX2::  uint_v b) { return AVX::cmpeq_epi32(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: short_m operator==(AVX2:: short_v a, AVX2:: short_v b) { return AVX::cmpeq_epi16(a.data(), b.data()); }\nVc_INTRINSIC AVX2::ushort_m operator==(AVX2::ushort_v a, AVX2::ushort_v b) { return AVX::cmpeq_epi16(a.data(), b.data()); }\nVc_INTRINSIC AVX2::   int_m operator!=(AVX2::   int_v a, AVX2::   int_v b) { return not_(AVX::cmpeq_epi32(a.data(), b.data())); }\nVc_INTRINSIC AVX2::  uint_m operator!=(AVX2::  uint_v a, AVX2::  uint_v b) { return not_(AVX::cmpeq_epi32(a.data(), b.data())); }\nVc_INTRINSIC AVX2:: short_m operator!=(AVX2:: short_v a, AVX2:: short_v b) { return not_(AVX::cmpeq_epi16(a.data(), b.data())); }\nVc_INTRINSIC AVX2::ushort_m operator!=(AVX2::ushort_v a, AVX2::ushort_v b) { return not_(AVX::cmpeq_epi16(a.data(), b.data())); }\nVc_INTRINSIC AVX2::   int_m operator>=(AVX2::   int_v a, AVX2::   int_v b) { return not_(AVX::cmplt_epi32(a.data(), b.data())); }\nVc_INTRINSIC AVX2::  uint_m operator>=(AVX2::  uint_v a, AVX2::  uint_v b) { return not_(AVX::cmplt_epu32(a.data(), b.data())); }\nVc_INTRINSIC AVX2:: short_m operator>=(AVX2:: short_v a, AVX2:: short_v b) { return not_(AVX::cmplt_epi16(a.data(), b.data())); }\nVc_INTRINSIC AVX2::ushort_m operator>=(AVX2::ushort_v a, AVX2::ushort_v b) { return not_(AVX::cmplt_epu16(a.data(), b.data())); }\nVc_INTRINSIC AVX2::   int_m operator<=(AVX2::   int_v a, AVX2::   int_v b) { return not_(AVX::cmpgt_epi32(a.data(), b.data())); }\nVc_INTRINSIC AVX2::  uint_m operator<=(AVX2::  uint_v a, AVX2::  uint_v b) { return not_(AVX::cmpgt_epu32(a.data(), b.data())); }\nVc_INTRINSIC AVX2:: short_m operator<=(AVX2:: short_v a, AVX2:: short_v b) { return not_(AVX::cmpgt_epi16(a.data(), b.data())); }\nVc_INTRINSIC AVX2::ushort_m operator<=(AVX2::ushort_v a, AVX2::ushort_v b) { return not_(AVX::cmpgt_epu16(a.data(), b.data())); }\nVc_INTRINSIC AVX2::   int_m operator> (AVX2::   int_v a, AVX2::   int_v b) { return AVX::cmpgt_epi32(a.data(), b.data()); }\nVc_INTRINSIC AVX2::  uint_m operator> (AVX2::  uint_v a, AVX2::  uint_v b) { return AVX::cmpgt_epu32(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: short_m operator> (AVX2:: short_v a, AVX2:: short_v b) { return AVX::cmpgt_epi16(a.data(), b.data()); }\nVc_INTRINSIC AVX2::ushort_m operator> (AVX2::ushort_v a, AVX2::ushort_v b) { return AVX::cmpgt_epu16(a.data(), b.data()); }\nVc_INTRINSIC AVX2::   int_m operator< (AVX2::   int_v a, AVX2::   int_v b) { return AVX::cmplt_epi32(a.data(), b.data()); }\nVc_INTRINSIC AVX2::  uint_m operator< (AVX2::  uint_v a, AVX2::  uint_v b) { return AVX::cmplt_epu32(a.data(), b.data()); }\nVc_INTRINSIC AVX2:: short_m operator< (AVX2:: short_v a, AVX2:: short_v b) { return AVX::cmplt_epi16(a.data(), b.data()); }\nVc_INTRINSIC AVX2::ushort_m operator< (AVX2::ushort_v a, AVX2::ushort_v b) { return AVX::cmplt_epu16(a.data(), b.data()); }\n#endif  // Vc_IMPL_AVX2\n\n// bitwise operators {{{1\ntemplate <typename T>\nVc_INTRINSIC AVX2::Vector<T> operator^(AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return xor_(a.data(), b.data());\n}\ntemplate <typename T>\nVc_INTRINSIC AVX2::Vector<T> operator&(AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return and_(a.data(), b.data());\n}\ntemplate <typename T>\nVc_INTRINSIC AVX2::Vector<T> operator|(AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return or_(a.data(), b.data());\n}\n// }}}1\n// arithmetic operators {{{1\ntemplate <typename T>\nVc_INTRINSIC AVX2::Vector<T> operator+(AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return add(a.data(), b.data(), T());\n}\ntemplate <typename T>\nVc_INTRINSIC AVX2::Vector<T> operator-(AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return sub(a.data(), b.data(), T());\n}\ntemplate <typename T>\nVc_INTRINSIC AVX2::Vector<T> operator*(AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return mul(a.data(), b.data(), T());\n}\ntemplate <typename T>\nVc_INTRINSIC AVX2::Vector<T> operator/(AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return div(a.data(), b.data(), T());\n}\nVc_INTRINSIC AVX2::Vector<ushort> operator/(AVX2::Vector<ushort> a,\n                                            AVX2::Vector<ushort> b)\n{\n    using namespace AVX;\n    const __m256 lo = _mm256_div_ps(convert<ushort, float>(lo128(a.data())),\n                                    convert<ushort, float>(lo128(b.data())));\n    const __m256 hi = _mm256_div_ps(convert<ushort, float>(hi128(a.data())),\n                                    convert<ushort, float>(hi128(b.data())));\n    const float_v threshold = 32767.f;\n    using Detail::operator>;\n    const __m128i loShort = (Vc_IS_UNLIKELY((float_v(lo) > threshold).isNotEmpty()))\n                                ? convert<float, ushort>(lo)\n                                : convert<float, short>(lo);\n    const __m128i hiShort = (Vc_IS_UNLIKELY((float_v(hi) > threshold).isNotEmpty()))\n                                ? convert<float, ushort>(hi)\n                                : convert<float, short>(hi);\n    return concat(loShort, hiShort);\n}\ntemplate <typename T>\nVc_INTRINSIC enable_if<std::is_integral<T>::value, AVX2::Vector<T>> operator%(\n    AVX2::Vector<T> a, AVX2::Vector<T> b)\n{\n    return a - a / b * b;\n}\n// }}}1\n}  // namespace Detail\n///////////////////////////////////////////////////////////////////////////////////////////\n// generate {{{1\ntemplate <> template <typename G> Vc_INTRINSIC AVX2::double_v AVX2::double_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    return _mm256_setr_pd(tmp0, tmp1, tmp2, tmp3);\n}\ntemplate <> template <typename G> Vc_INTRINSIC AVX2::float_v AVX2::float_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    const auto tmp4 = gen(4);\n    const auto tmp5 = gen(5);\n    const auto tmp6 = gen(6);\n    const auto tmp7 = gen(7);\n    return _mm256_setr_ps(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7);\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <> template <typename G> Vc_INTRINSIC AVX2::int_v AVX2::int_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    const auto tmp4 = gen(4);\n    const auto tmp5 = gen(5);\n    const auto tmp6 = gen(6);\n    const auto tmp7 = gen(7);\n    return _mm256_setr_epi32(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7);\n}\ntemplate <> template <typename G> Vc_INTRINSIC AVX2::uint_v AVX2::uint_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    const auto tmp4 = gen(4);\n    const auto tmp5 = gen(5);\n    const auto tmp6 = gen(6);\n    const auto tmp7 = gen(7);\n    return _mm256_setr_epi32(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7);\n}\ntemplate <> template <typename G> Vc_INTRINSIC AVX2::short_v AVX2::short_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    const auto tmp4 = gen(4);\n    const auto tmp5 = gen(5);\n    const auto tmp6 = gen(6);\n    const auto tmp7 = gen(7);\n    const auto tmp8 = gen(8);\n    const auto tmp9 = gen(9);\n    const auto tmp10 = gen(10);\n    const auto tmp11 = gen(11);\n    const auto tmp12 = gen(12);\n    const auto tmp13 = gen(13);\n    const auto tmp14 = gen(14);\n    const auto tmp15 = gen(15);\n    return _mm256_setr_epi16(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15);\n}\ntemplate <> template <typename G> Vc_INTRINSIC AVX2::ushort_v AVX2::ushort_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    const auto tmp4 = gen(4);\n    const auto tmp5 = gen(5);\n    const auto tmp6 = gen(6);\n    const auto tmp7 = gen(7);\n    const auto tmp8 = gen(8);\n    const auto tmp9 = gen(9);\n    const auto tmp10 = gen(10);\n    const auto tmp11 = gen(11);\n    const auto tmp12 = gen(12);\n    const auto tmp13 = gen(13);\n    const auto tmp14 = gen(14);\n    const auto tmp15 = gen(15);\n    return _mm256_setr_epi16(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7, tmp8, tmp9, tmp10, tmp11, tmp12, tmp13, tmp14, tmp15);\n}\n#endif\n\n// constants {{{1\ntemplate <typename T> Vc_INTRINSIC Vector<T, VectorAbi::Avx>::Vector(VectorSpecialInitializerZero) : d{} {}\n\ntemplate <> Vc_INTRINSIC Vector<double, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_pd()) {}\ntemplate <> Vc_INTRINSIC Vector< float, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_ps()) {}\n#ifdef Vc_IMPL_AVX2\ntemplate <> Vc_INTRINSIC Vector<   int, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_epi32()) {}\ntemplate <> Vc_INTRINSIC Vector<  uint, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_epu32()) {}\ntemplate <> Vc_INTRINSIC Vector< short, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_epi16()) {}\ntemplate <> Vc_INTRINSIC Vector<ushort, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_epu16()) {}\ntemplate <> Vc_INTRINSIC Vector< schar, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_epi8()) {}\ntemplate <> Vc_INTRINSIC Vector< uchar, VectorAbi::Avx>::Vector(VectorSpecialInitializerOne) : d(AVX::setone_epu8()) {}\n#endif\n\ntemplate <typename T>\nVc_ALWAYS_INLINE Vector<T, VectorAbi::Avx>::Vector(\n    VectorSpecialInitializerIndexesFromZero)\n    : Vector(AVX::IndexesFromZeroData<T>::address(), Vc::Aligned)\n{\n}\n\ntemplate <>\nVc_ALWAYS_INLINE Vector<float, VectorAbi::Avx>::Vector(VectorSpecialInitializerIndexesFromZero)\n    : Vector(AVX::IndexesFromZeroData<int>::address(), Vc::Aligned)\n{\n}\ntemplate <>\nVc_ALWAYS_INLINE Vector<double, VectorAbi::Avx>::Vector(VectorSpecialInitializerIndexesFromZero)\n    : Vector(AVX::IndexesFromZeroData<int>::address(), Vc::Aligned)\n{\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// load member functions {{{1\n// general load, implemented via LoadHelper {{{2\ntemplate <typename DstT>\ntemplate <typename SrcT, typename Flags>\nVc_INTRINSIC typename Vector<DstT, VectorAbi::Avx>::\n#ifndef Vc_MSVC\ntemplate\n#endif\nload_concept<SrcT, Flags>::type Vector<DstT, VectorAbi::Avx>::load(const SrcT *mem, Flags flags)\n{\n    Common::handleLoadPrefetches(mem, flags);\n    d.v() = Detail::load<VectorType, DstT>(mem, flags);\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// zeroing {{{1\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Avx>::setZero()\n{\n    data() = Detail::zero<VectorType>();\n}\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Avx>::setZero(const Mask &k)\n{\n    data() = Detail::andnot_(k.data(), data());\n}\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Avx>::setZeroInverted(const Mask &k)\n{\n    data() = Detail::and_(k.data(), data());\n}\n\ntemplate<> Vc_INTRINSIC void Vector<double, VectorAbi::Avx>::setQnan()\n{\n    data() = Detail::allone<VectorType>();\n}\ntemplate<> Vc_INTRINSIC void Vector<double, VectorAbi::Avx>::setQnan(MaskArgument k)\n{\n    data() = _mm256_or_pd(data(), k.dataD());\n}\ntemplate<> Vc_INTRINSIC void Vector<float, VectorAbi::Avx>::setQnan()\n{\n    data() = Detail::allone<VectorType>();\n}\ntemplate<> Vc_INTRINSIC void Vector<float, VectorAbi::Avx>::setQnan(MaskArgument k)\n{\n    data() = _mm256_or_ps(data(), k.dataF());\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// stores {{{1\ntemplate <typename T>\ntemplate <typename U,\n          typename Flags,\n          typename>\nVc_INTRINSIC void Vector<T, VectorAbi::Avx>::store(U *mem, Flags flags) const\n{\n    Common::handleStorePrefetches(mem, flags);\n    HV::template store<Flags>(mem, data());\n}\n\ntemplate <typename T>\ntemplate <typename U,\n          typename Flags,\n          typename>\nVc_INTRINSIC void Vector<T, VectorAbi::Avx>::store(U *mem, Mask mask, Flags flags) const\n{\n    Common::handleStorePrefetches(mem, flags);\n    HV::template store<Flags>(mem, data(), mask.data());\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// integer ops {{{1\n#ifdef Vc_IMPL_AVX2\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector<   int> Vector<   int, VectorAbi::Avx>::operator<<(AsArg x) const { return _mm256_sllv_epi32(d.v(), x.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector<  uint> Vector<  uint, VectorAbi::Avx>::operator<<(AsArg x) const { return _mm256_sllv_epi32(d.v(), x.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector<   int> Vector<   int, VectorAbi::Avx>::operator>>(AsArg x) const { return _mm256_srav_epi32(d.v(), x.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector<  uint> Vector<  uint, VectorAbi::Avx>::operator>>(AsArg x) const { return _mm256_srlv_epi32(d.v(), x.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector< short> Vector< short, VectorAbi::Avx>::operator<<(AsArg x) const { return generate([&](int i) { return get(*this, i) << get(x, i); }); }\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector<ushort> Vector<ushort, VectorAbi::Avx>::operator<<(AsArg x) const { return generate([&](int i) { return get(*this, i) << get(x, i); }); }\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector< short> Vector< short, VectorAbi::Avx>::operator>>(AsArg x) const { return generate([&](int i) { return get(*this, i) >> get(x, i); }); }\ntemplate <> Vc_ALWAYS_INLINE AVX2::Vector<ushort> Vector<ushort, VectorAbi::Avx>::operator>>(AsArg x) const { return generate([&](int i) { return get(*this, i) >> get(x, i); }); }\ntemplate <typename T>\nVc_ALWAYS_INLINE AVX2::Vector<T> &Vector<T, VectorAbi::Avx>::operator<<=(AsArg x)\n{\n    static_assert(std::is_integral<T>::value,\n                  \"bitwise-operators can only be used with Vectors of integral type\");\n    return *this = *this << x;\n}\ntemplate <typename T>\nVc_ALWAYS_INLINE AVX2::Vector<T> &Vector<T, VectorAbi::Avx>::operator>>=(AsArg x)\n{\n    static_assert(std::is_integral<T>::value,\n                  \"bitwise-operators can only be used with Vectors of integral type\");\n    return *this = *this >> x;\n}\n#endif\n\ntemplate<typename T> Vc_ALWAYS_INLINE AVX2::Vector<T> &Vector<T, VectorAbi::Avx>::operator>>=(int shift) {\n    d.v() = Detail::shiftRight(d.v(), shift, T());\n    return *static_cast<AVX2::Vector<T> *>(this);\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> Vector<T, VectorAbi::Avx>::operator>>(int shift) const {\n    return Detail::shiftRight(d.v(), shift, T());\n}\ntemplate<typename T> Vc_ALWAYS_INLINE AVX2::Vector<T> &Vector<T, VectorAbi::Avx>::operator<<=(int shift) {\n    d.v() = Detail::shiftLeft(d.v(), shift, T());\n    return *static_cast<AVX2::Vector<T> *>(this);\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> Vector<T, VectorAbi::Avx>::operator<<(int shift) const {\n    return Detail::shiftLeft(d.v(), shift, T());\n}\n\n// isnegative {{{1\nVc_INTRINSIC Vc_CONST AVX2::float_m isnegative(AVX2::float_v x)\n{\n    return AVX::avx_cast<__m256>(AVX::srai_epi32<31>(\n        AVX::avx_cast<__m256i>(_mm256_and_ps(AVX::setsignmask_ps(), x.data()))));\n}\nVc_INTRINSIC Vc_CONST AVX2::double_m isnegative(AVX2::double_v x)\n{\n    return Mem::permute<X1, X1, X3, X3>(AVX::avx_cast<__m256>(AVX::srai_epi32<31>(\n        AVX::avx_cast<__m256i>(_mm256_and_pd(AVX::setsignmask_pd(), x.data())))));\n}\n// gathers {{{1\n#define Vc_GATHER_IMPL(V_)                                                               \\\n    template <>                                                                          \\\n    template <class MT, class IT, int Scale>                                             \\\n    inline void AVX2::V_::gatherImplementation(                                          \\\n        const Common::GatherArguments<MT, IT, Scale> &args)\n#define Vc_M(i_) static_cast<value_type>(args.address[Scale * args.indexes[i_]])\nVc_GATHER_IMPL(double_v) { d.v() = _mm256_setr_pd(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3)); }\n\nVc_GATHER_IMPL(float_v)\n{\n    d.v() = _mm256_setr_ps(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3), Vc_M(4), Vc_M(5), Vc_M(6),\n                           Vc_M(7));\n}\n\n#ifdef Vc_IMPL_AVX2\nVc_GATHER_IMPL(int_v)\n{\n    d.v() = _mm256_setr_epi32(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3), Vc_M(4), Vc_M(5),\n                              Vc_M(6), Vc_M(7));\n}\n\nVc_GATHER_IMPL(uint_v)\n{\n    d.v() = _mm256_setr_epi32(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3), Vc_M(4), Vc_M(5),\n                              Vc_M(6), Vc_M(7));\n}\n\nVc_GATHER_IMPL(short_v)\n{\n    d.v() = _mm256_setr_epi16(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3), Vc_M(4), Vc_M(5),\n                              Vc_M(6), Vc_M(7), Vc_M(8), Vc_M(9), Vc_M(10), Vc_M(11),\n                              Vc_M(12), Vc_M(13), Vc_M(14), Vc_M(15));\n}\n\nVc_GATHER_IMPL(ushort_v)\n{\n    d.v() = _mm256_setr_epi16(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3), Vc_M(4), Vc_M(5),\n                              Vc_M(6), Vc_M(7), Vc_M(8), Vc_M(9), Vc_M(10), Vc_M(11),\n                              Vc_M(12), Vc_M(13), Vc_M(14), Vc_M(15));\n}\n#endif\n#undef Vc_M\n#undef Vc_GATHER_IMPL\n\ntemplate <class T>\ntemplate <class MT, class IT, int Scale>\ninline void Vector<T, VectorAbi::Avx>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args, MaskArgument mask)\n{\n    const auto *mem = args.address;\n    const auto indexes = Scale * args.indexes;\n    using Selector = std::integral_constant < Common::GatherScatterImplementation,\n#ifdef Vc_USE_SET_GATHERS\n          Traits::is_simd_vector<IT>::value ? Common::GatherScatterImplementation::SetIndexZero :\n#endif\n#ifdef Vc_USE_BSF_GATHERS\n                                            Common::GatherScatterImplementation::BitScanLoop\n#elif defined Vc_USE_POPCNT_BSF_GATHERS\n              Common::GatherScatterImplementation::PopcntSwitch\n#else\n              Common::GatherScatterImplementation::SimpleLoop\n#endif\n                                                > ;\n    Common::executeGather(Selector(), *this, mem, indexes, mask);\n}\n\ntemplate <typename T>\ntemplate <typename MT, typename IT>\ninline void Vector<T, VectorAbi::Avx>::scatterImplementation(MT *mem, IT &&indexes) const\n{\n    Common::unrolled_loop<std::size_t, 0, Size>([&](std::size_t i) { mem[indexes[i]] = d.m(i); });\n}\n\ntemplate <typename T>\ntemplate <typename MT, typename IT>\ninline void Vector<T, VectorAbi::Avx>::scatterImplementation(MT *mem, IT &&indexes, MaskArgument mask) const\n{\n    using Selector = std::integral_constant < Common::GatherScatterImplementation,\n#ifdef Vc_USE_SET_GATHERS\n          Traits::is_simd_vector<IT>::value ? Common::GatherScatterImplementation::SetIndexZero :\n#endif\n#ifdef Vc_USE_BSF_GATHERS\n                                            Common::GatherScatterImplementation::BitScanLoop\n#elif defined Vc_USE_POPCNT_BSF_GATHERS\n              Common::GatherScatterImplementation::PopcntSwitch\n#else\n              Common::GatherScatterImplementation::SimpleLoop\n#endif\n                                                > ;\n    Common::executeScatter(Selector(), *this, mem, std::forward<IT>(indexes), mask);\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// operator- {{{1\n#ifdef Vc_USE_BUILTIN_VECTOR_TYPES\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> Vector<T, VectorAbi::Avx>::operator-() const\n{\n    return VectorType(-d.builtin());\n}\n#else\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE AVX2::Vector<T> Vector<T, VectorAbi::Avx>::operator-() const\n{\n    return Detail::negate(d.v(), std::integral_constant<std::size_t, sizeof(T)>());\n}\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// horizontal ops {{{1\ntemplate <typename T>\nVc_INTRINSIC std::pair<Vector<T, VectorAbi::Avx>, int>\nVector<T, VectorAbi::Avx>::minIndex() const\n{\n    AVX2::Vector<T> x = min();\n    return std::make_pair(x, (*this == x).firstOne());\n}\ntemplate <typename T>\nVc_INTRINSIC std::pair<Vector<T, VectorAbi::Avx>, int>\nVector<T, VectorAbi::Avx>::maxIndex() const\n{\n    AVX2::Vector<T> x = max();\n    return std::make_pair(x, (*this == x).firstOne());\n}\ntemplate <> Vc_INTRINSIC std::pair<AVX2::float_v, int> AVX2::float_v::minIndex() const\n{\n    /*\n    // 28 cycles latency:\n    __m256 x = _mm256_min_ps(Mem::permute128<X1, X0>(d.v()), d.v());\n    x = _mm256_min_ps(x, Reg::permute<X2, X3, X0, X1>(x));\n    AVX2::float_v xx = _mm256_min_ps(x, Reg::permute<X1, X0, X3, X2>(x));\n    AVX2::uint_v idx = AVX2::uint_v::IndexesFromZero();\n    idx = _mm256_castps_si256(\n        _mm256_or_ps((*this != xx).data(), _mm256_castsi256_ps(idx.data())));\n    return std::make_pair(xx, (*this == xx).firstOne());\n\n    __m128 loData = AVX::lo128(d.v());\n    __m128 hiData = AVX::hi128(d.v());\n    const __m128 less2 = _mm_cmplt_ps(hiData, loData);\n    loData = _mm_min_ps(loData, hiData);\n    hiData = Mem::permute<X2, X3, X0, X1>(loData);\n    const __m128 less1 = _mm_cmplt_ps(hiData, loData);\n    loData = _mm_min_ps(loData, hiData);\n    hiData = Mem::permute<X1, X0, X3, X2>(loData);\n    const __m128 less0 = _mm_cmplt_ps(hiData, loData);\n    unsigned bits = _mm_movemask_ps(less0) & 0x1;\n    bits |= ((_mm_movemask_ps(less1) << 1) - bits) & 0x2;\n    bits |= ((_mm_movemask_ps(less2) << 3) - bits) & 0x4;\n    loData = _mm_min_ps(loData, hiData);\n    return std::make_pair(AVX::concat(loData, loData), bits);\n    */\n\n    // 28 cycles Latency:\n    __m256 x = d.v();\n    __m256 idx = Vector<float>::IndexesFromZero().data();\n    __m256 y = Mem::permute128<X1, X0>(x);\n    __m256 idy = Mem::permute128<X1, X0>(idx);\n    __m256 less = AVX::cmplt_ps(x, y);\n\n    x = _mm256_blendv_ps(y, x, less);\n    idx = _mm256_blendv_ps(idy, idx, less);\n    y = Reg::permute<X2, X3, X0, X1>(x);\n    idy = Reg::permute<X2, X3, X0, X1>(idx);\n    less = AVX::cmplt_ps(x, y);\n\n    x = _mm256_blendv_ps(y, x, less);\n    idx = _mm256_blendv_ps(idy, idx, less);\n    y = Reg::permute<X1, X0, X3, X2>(x);\n    idy = Reg::permute<X1, X0, X3, X2>(idx);\n    less = AVX::cmplt_ps(x, y);\n\n    idx = _mm256_blendv_ps(idy, idx, less);\n\n    const auto index = _mm_cvtsi128_si32(AVX::avx_cast<__m128i>(idx));\n#ifdef Vc_GNU_ASM\n    __asm__ __volatile__(\"\"); // help GCC to order the instructions better\n#endif\n    x = _mm256_blendv_ps(y, x, less);\n    return std::make_pair(x, index);\n}\ntemplate<typename T> Vc_ALWAYS_INLINE AVX2::Vector<T> Vector<T, VectorAbi::Avx>::partialSum() const\n{\n    //   a    b    c    d    e    f    g    h\n    // +      a    b    c    d    e    f    g    -> a ab bc  cd   de    ef     fg      gh\n    // +           a    ab   bc   cd   de   ef   -> a ab abc abcd bcde  cdef   defg    efgh\n    // +                     a    ab   abc  abcd -> a ab abc abcd abcde abcdef abcdefg abcdefgh\n    AVX2::Vector<T> tmp = *this;\n    if (Size >  1) tmp += tmp.shifted(-1);\n    if (Size >  2) tmp += tmp.shifted(-2);\n    if (Size >  4) tmp += tmp.shifted(-4);\n    if (Size >  8) tmp += tmp.shifted(-8);\n    if (Size > 16) tmp += tmp.shifted(-16);\n    return tmp;\n}\n\n/* This function requires correct masking because the neutral element of \\p op is not necessarily 0\n *\ntemplate<typename T> template<typename BinaryOperation> Vc_ALWAYS_INLINE AVX2::Vector<T> Vector<T, VectorAbi::Avx>::partialSum(BinaryOperation op) const\n{\n    //   a    b    c    d    e    f    g    h\n    // +      a    b    c    d    e    f    g    -> a ab bc  cd   de    ef     fg      gh\n    // +           a    ab   bc   cd   de   ef   -> a ab abc abcd bcde  cdef   defg    efgh\n    // +                     a    ab   abc  abcd -> a ab abc abcd abcde abcdef abcdefg abcdefgh\n    AVX2::Vector<T> tmp = *this;\n    Mask mask(true);\n    if (Size >  1) tmp(mask) = op(tmp, tmp.shifted(-1));\n    if (Size >  2) tmp(mask) = op(tmp, tmp.shifted(-2));\n    if (Size >  4) tmp(mask) = op(tmp, tmp.shifted(-4));\n    if (Size >  8) tmp(mask) = op(tmp, tmp.shifted(-8));\n    if (Size > 16) tmp(mask) = op(tmp, tmp.shifted(-16));\n    return tmp;\n}\n*/\n\ntemplate<typename T> Vc_ALWAYS_INLINE typename Vector<T, VectorAbi::Avx>::EntryType Vector<T, VectorAbi::Avx>::min(MaskArgument m) const\n{\n    AVX2::Vector<T> tmp = std::numeric_limits<AVX2::Vector<T> >::max();\n    tmp(m) = *this;\n    return tmp.min();\n}\ntemplate<typename T> Vc_ALWAYS_INLINE typename Vector<T, VectorAbi::Avx>::EntryType Vector<T, VectorAbi::Avx>::max(MaskArgument m) const\n{\n    AVX2::Vector<T> tmp = std::numeric_limits<AVX2::Vector<T> >::min();\n    tmp(m) = *this;\n    return tmp.max();\n}\ntemplate<typename T> Vc_ALWAYS_INLINE typename Vector<T, VectorAbi::Avx>::EntryType Vector<T, VectorAbi::Avx>::product(MaskArgument m) const\n{\n    AVX2::Vector<T> tmp(Vc::One);\n    tmp(m) = *this;\n    return tmp.product();\n}\ntemplate<typename T> Vc_ALWAYS_INLINE typename Vector<T, VectorAbi::Avx>::EntryType Vector<T, VectorAbi::Avx>::sum(MaskArgument m) const\n{\n    AVX2::Vector<T> tmp(Vc::Zero);\n    tmp(m) = *this;\n    return tmp.sum();\n}//}}}\n// exponent {{{1\nnamespace Detail\n{\nVc_INTRINSIC Vc_CONST __m256 exponent(__m256 v)\n{\n    using namespace AVX;\n    __m128i tmp0 = _mm_srli_epi32(avx_cast<__m128i>(v), 23);\n    __m128i tmp1 = _mm_srli_epi32(avx_cast<__m128i>(hi128(v)), 23);\n    tmp0 = _mm_sub_epi32(tmp0, _mm_set1_epi32(0x7f));\n    tmp1 = _mm_sub_epi32(tmp1, _mm_set1_epi32(0x7f));\n    return _mm256_cvtepi32_ps(concat(tmp0, tmp1));\n}\nVc_INTRINSIC Vc_CONST __m256d exponent(__m256d v)\n{\n    using namespace AVX;\n    __m128i tmp0 = _mm_srli_epi64(avx_cast<__m128i>(v), 52);\n    __m128i tmp1 = _mm_srli_epi64(avx_cast<__m128i>(hi128(v)), 52);\n    tmp0 = _mm_sub_epi32(tmp0, _mm_set1_epi32(0x3ff));\n    tmp1 = _mm_sub_epi32(tmp1, _mm_set1_epi32(0x3ff));\n    return _mm256_cvtepi32_pd(avx_cast<__m128i>(Mem::shuffle<X0, X2, Y0, Y2>(avx_cast<__m128>(tmp0), avx_cast<__m128>(tmp1))));\n}\n} // namespace Detail\n\nVc_INTRINSIC Vc_CONST AVX2::float_v exponent(AVX2::float_v x)\n{\n    using Detail::operator>=;\n    Vc_ASSERT((x >= x.Zero()).isFull());\n    return Detail::exponent(x.data());\n}\nVc_INTRINSIC Vc_CONST AVX2::double_v exponent(AVX2::double_v x)\n{\n    using Detail::operator>=;\n    Vc_ASSERT((x >= x.Zero()).isFull());\n    return Detail::exponent(x.data());\n}\n// }}}1\n// Random {{{1\nstatic Vc_ALWAYS_INLINE __m256i _doRandomStep()\n{\n    using Detail::operator*;\n    using Detail::operator+;\n#ifdef Vc_IMPL_AVX2\n    using AVX2::uint_v;\n    uint_v state0(&Common::RandomState[0]);\n    uint_v state1(&Common::RandomState[uint_v::Size]);\n    (state1 * uint_v(0xdeece66du) + uint_v(11)).store(&Common::RandomState[uint_v::Size]);\n    uint_v(Detail::xor_((state0 * uint_v(0xdeece66du) + uint_v(11)).data(),\n                        _mm256_srli_epi32(state1.data(), 16)))\n        .store(&Common::RandomState[0]);\n    return state0.data();\n#else\n    using SSE::uint_v;\n    uint_v state0(&Common::RandomState[0]);\n    uint_v state1(&Common::RandomState[uint_v::Size]);\n    uint_v state2(&Common::RandomState[2 * uint_v::Size]);\n    uint_v state3(&Common::RandomState[3 * uint_v::Size]);\n    (state2 * uint_v(0xdeece66du) + uint_v(11))\n        .store(&Common::RandomState[2 * uint_v::Size]);\n    (state3 * uint_v(0xdeece66du) + uint_v(11))\n        .store(&Common::RandomState[3 * uint_v::Size]);\n    uint_v(Detail::xor_((state0 * uint_v(0xdeece66du) + uint_v(11)).data(),\n                        _mm_srli_epi32(state2.data(), 16)))\n        .store(&Common::RandomState[0]);\n    uint_v(Detail::xor_((state1 * uint_v(0xdeece66du) + uint_v(11)).data(),\n                        _mm_srli_epi32(state3.data(), 16)))\n        .store(&Common::RandomState[uint_v::Size]);\n    return AVX::concat(state0.data(), state1.data());\n#endif\n}\n\n#ifdef Vc_IMPL_AVX2\ntemplate<typename T> Vc_ALWAYS_INLINE AVX2::Vector<T> Vector<T, VectorAbi::Avx>::Random()\n{\n    return {_doRandomStep()};\n}\n#endif\n\ntemplate <> Vc_ALWAYS_INLINE AVX2::float_v AVX2::float_v::Random()\n{\n    return HT::sub(Detail::or_(_cast(AVX::srli_epi32<2>(_doRandomStep())), HT::one()),\n                   HT::one());\n}\n\ntemplate<> Vc_ALWAYS_INLINE AVX2::double_v AVX2::double_v::Random()\n{\n    const __m256i state = Detail::load(&Common::RandomState[0], Vc::Aligned,\n                                       Detail::LoadTag<__m256i, int>());\n    for (size_t k = 0; k < 8; k += 2) {\n        typedef unsigned long long uint64 Vc_MAY_ALIAS;\n        const uint64 stateX = *aliasing_cast<uint64>(&Common::RandomState[k]);\n        *aliasing_cast<uint64>(&Common::RandomState[k]) = (stateX * 0x5deece66dull + 11);\n    }\n    return HT::sub(Detail::or_(_cast(AVX::srli_epi64<12>(state)), HT::one()), HT::one());\n}\n// }}}1\n// shifted / rotated {{{1\ntemplate<typename T> Vc_INTRINSIC AVX2::Vector<T> Vector<T, VectorAbi::Avx>::shifted(int amount) const\n{\n    return Detail::shifted<EntryType>(d.v(), amount);\n}\n\ntemplate <typename VectorType>\nVc_INTRINSIC Vc_CONST VectorType shifted_shortcut(VectorType left, VectorType right, Common::WidthT<__m128>)\n{\n    return Mem::shuffle<X2, X3, Y0, Y1>(left, right);\n}\ntemplate <typename VectorType>\nVc_INTRINSIC Vc_CONST VectorType shifted_shortcut(VectorType left, VectorType right, Common::WidthT<__m256>)\n{\n    return Mem::shuffle128<X1, Y0>(left, right);\n}\n\ntemplate<typename T> Vc_INTRINSIC AVX2::Vector<T> Vector<T, VectorAbi::Avx>::shifted(int amount, Vector shiftIn) const\n{\n#ifdef __GNUC__\n    if (__builtin_constant_p(amount)) {\n        const __m256i a = AVX::avx_cast<__m256i>(d.v());\n        const __m256i b = AVX::avx_cast<__m256i>(shiftIn.d.v());\n        if (amount * 2 == int(Size)) {\n            return shifted_shortcut(d.v(), shiftIn.d.v(), WidthT());\n        }\n        if (amount * 2 == -int(Size)) {\n            return shifted_shortcut(shiftIn.d.v(), d.v(), WidthT());\n        }\n        switch (amount) {\n        case 1:\n            return AVX::avx_cast<VectorType>(\n#ifdef Vc_IMPL_AVX2\n                _mm256_alignr_epi8(_mm256_permute2x128_si256(a, b, 0x21), a,\n                                   sizeof(EntryType))\n#else  // Vc_IMPL_AVX2\n                AVX::concat(\n                    _mm_alignr_epi8(AVX::hi128(a), AVX::lo128(a), sizeof(EntryType)),\n                    _mm_alignr_epi8(AVX::lo128(b), AVX::hi128(a), sizeof(EntryType)))\n#endif  // Vc_IMPL_AVX2\n                    );\n        case 2:\n            return AVX::avx_cast<VectorType>(\n#ifdef Vc_IMPL_AVX2\n                _mm256_alignr_epi8(_mm256_permute2x128_si256(a, b, 0x21), a,\n                                   2 * sizeof(EntryType))\n#else  // Vc_IMPL_AVX2\n                AVX::concat(\n                    _mm_alignr_epi8(AVX::hi128(a), AVX::lo128(a), 2 * sizeof(EntryType)),\n                    _mm_alignr_epi8(AVX::lo128(b), AVX::hi128(a), 2 * sizeof(EntryType)))\n#endif  // Vc_IMPL_AVX2\n                    );\n        case 3:\n            if (6u < Size) {\n                return AVX::avx_cast<VectorType>(\n#ifdef Vc_IMPL_AVX2\n                    _mm256_alignr_epi8(_mm256_permute2x128_si256(a, b, 0x21), a,\n                                       3 * sizeof(EntryType))\n#else   // Vc_IMPL_AVX2\n                    AVX::concat(_mm_alignr_epi8(AVX::hi128(a), AVX::lo128(a),\n                                                3 * sizeof(EntryType)),\n                                _mm_alignr_epi8(AVX::lo128(b), AVX::hi128(a),\n                                                3 * sizeof(EntryType)))\n#endif  // Vc_IMPL_AVX2\n                        );\n            // TODO: } else {\n            }\n        }\n    }\n#endif\n    using Detail::operator|;\n    return shifted(amount) | (amount > 0 ?\n                              shiftIn.shifted(amount - Size) :\n                              shiftIn.shifted(Size + amount));\n}\ntemplate<typename T> Vc_INTRINSIC AVX2::Vector<T> Vector<T, VectorAbi::Avx>::rotated(int amount) const\n{\n    return Detail::rotated<EntryType, size()>(d.v(), amount);\n}\n// sorted {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Avx> Vector<T, VectorAbi::Avx>::sorted()\n    const\n{\n    return Detail::sorted(*this);\n}\n// interleaveLow/-High {{{1\ntemplate <> Vc_INTRINSIC AVX2::double_v AVX2::double_v::interleaveLow(AVX2::double_v x) const\n{\n    return Mem::shuffle128<X0, Y0>(_mm256_unpacklo_pd(data(), x.data()),\n                                   _mm256_unpackhi_pd(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC AVX2::double_v AVX2::double_v::interleaveHigh(AVX2::double_v x) const\n{\n    return Mem::shuffle128<X1, Y1>(_mm256_unpacklo_pd(data(), x.data()),\n                                   _mm256_unpackhi_pd(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC AVX2::float_v AVX2::float_v::interleaveLow(AVX2::float_v x) const\n{\n    return Mem::shuffle128<X0, Y0>(_mm256_unpacklo_ps(data(), x.data()),\n                                   _mm256_unpackhi_ps(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC AVX2::float_v AVX2::float_v::interleaveHigh(AVX2::float_v x) const\n{\n    return Mem::shuffle128<X1, Y1>(_mm256_unpacklo_ps(data(), x.data()),\n                                   _mm256_unpackhi_ps(data(), x.data()));\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <> Vc_INTRINSIC    AVX2::int_v    AVX2::int_v::interleaveLow (   AVX2::int_v x) const {\n    return Mem::shuffle128<X0, Y0>(_mm256_unpacklo_epi32(data(), x.data()),\n                                   _mm256_unpackhi_epi32(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC    AVX2::int_v    AVX2::int_v::interleaveHigh(   AVX2::int_v x) const {\n    return Mem::shuffle128<X1, Y1>(_mm256_unpacklo_epi32(data(), x.data()),\n                                   _mm256_unpackhi_epi32(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC   AVX2::uint_v   AVX2::uint_v::interleaveLow (  AVX2::uint_v x) const {\n    return Mem::shuffle128<X0, Y0>(_mm256_unpacklo_epi32(data(), x.data()),\n                                   _mm256_unpackhi_epi32(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC   AVX2::uint_v   AVX2::uint_v::interleaveHigh(  AVX2::uint_v x) const {\n    return Mem::shuffle128<X1, Y1>(_mm256_unpacklo_epi32(data(), x.data()),\n                                   _mm256_unpackhi_epi32(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC  AVX2::short_v  AVX2::short_v::interleaveLow ( AVX2::short_v x) const {\n    return Mem::shuffle128<X0, Y0>(_mm256_unpacklo_epi16(data(), x.data()),\n                                   _mm256_unpackhi_epi16(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC  AVX2::short_v  AVX2::short_v::interleaveHigh( AVX2::short_v x) const {\n    return Mem::shuffle128<X1, Y1>(_mm256_unpacklo_epi16(data(), x.data()),\n                                   _mm256_unpackhi_epi16(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC AVX2::ushort_v AVX2::ushort_v::interleaveLow (AVX2::ushort_v x) const {\n    return Mem::shuffle128<X0, Y0>(_mm256_unpacklo_epi16(data(), x.data()),\n                                   _mm256_unpackhi_epi16(data(), x.data()));\n}\ntemplate <> Vc_INTRINSIC AVX2::ushort_v AVX2::ushort_v::interleaveHigh(AVX2::ushort_v x) const {\n    return Mem::shuffle128<X1, Y1>(_mm256_unpacklo_epi16(data(), x.data()),\n                                   _mm256_unpackhi_epi16(data(), x.data()));\n}\n#endif\n// permutation via operator[] {{{1\ntemplate <> Vc_INTRINSIC Vc_PURE AVX2::double_v AVX2::double_v::operator[](Permutation::ReversedTag) const\n{\n    return Mem::permute128<X1, X0>(Mem::permute<X1, X0, X3, X2>(d.v()));\n}\ntemplate <> Vc_INTRINSIC Vc_PURE AVX2::float_v AVX2::float_v::operator[](Permutation::ReversedTag) const\n{\n    return Mem::permute128<X1, X0>(Mem::permute<X3, X2, X1, X0>(d.v()));\n}\n#ifdef Vc_IMPL_AVX2\ntemplate <>\nVc_INTRINSIC Vc_PURE AVX2::int_v AVX2::int_v::operator[](Permutation::ReversedTag) const\n{\n    return Mem::permute128<X1, X0>(Mem::permute<X3, X2, X1, X0>(d.v()));\n}\ntemplate <>\nVc_INTRINSIC Vc_PURE AVX2::uint_v AVX2::uint_v::operator[](Permutation::ReversedTag) const\n{\n    return Mem::permute128<X1, X0>(Mem::permute<X3, X2, X1, X0>(d.v()));\n}\ntemplate <>\nVc_INTRINSIC Vc_PURE AVX2::short_v AVX2::short_v::operator[](\n    Permutation::ReversedTag) const\n{\n    return Mem::permute128<X1, X0>(AVX::avx_cast<__m256i>(Mem::shuffle<X1, Y0, X3, Y2>(\n        AVX::avx_cast<__m256d>(Mem::permuteHi<X7, X6, X5, X4>(d.v())),\n        AVX::avx_cast<__m256d>(Mem::permuteLo<X3, X2, X1, X0>(d.v())))));\n}\ntemplate <>\nVc_INTRINSIC Vc_PURE AVX2::ushort_v AVX2::ushort_v::operator[](\n    Permutation::ReversedTag) const\n{\n    return Mem::permute128<X1, X0>(AVX::avx_cast<__m256i>(Mem::shuffle<X1, Y0, X3, Y2>(\n        AVX::avx_cast<__m256d>(Mem::permuteHi<X7, X6, X5, X4>(d.v())),\n        AVX::avx_cast<__m256d>(Mem::permuteLo<X3, X2, X1, X0>(d.v())))));\n}\n#endif\ntemplate <> Vc_INTRINSIC AVX2::float_v Vector<float, VectorAbi::Avx>::operator[](const IndexType &/*perm*/) const\n{\n    // TODO\n    return *this;\n#ifdef Vc_IMPL_AVX2\n#else\n    /*\n    const int_m cross128 = AVX::concat(_mm_cmpgt_epi32(AVX::lo128(perm.data()), _mm_set1_epi32(3)),\n                                  _mm_cmplt_epi32(AVX::hi128(perm.data()), _mm_set1_epi32(4)));\n    if (cross128.isNotEmpty()) {\n    AVX2::float_v x = _mm256_permutevar_ps(d.v(), perm.data());\n        x(cross128) = _mm256_permutevar_ps(Mem::permute128<X1, X0>(d.v()), perm.data());\n        return x;\n    } else {\n    */\n#endif\n}\n\n// reversed {{{1\ntemplate <typename T>\nVc_INTRINSIC Vc_PURE Vector<T, VectorAbi::Avx> Vector<T, VectorAbi::Avx>::reversed() const\n{\n    return (*this)[Permutation::Reversed];\n}\n\n// broadcast from constexpr index {{{1\ntemplate <> template <int Index> Vc_INTRINSIC AVX2::float_v AVX2::float_v::broadcast() const\n{\n    constexpr VecPos Inner = static_cast<VecPos>(Index & 0x3);\n    constexpr VecPos Outer = static_cast<VecPos>((Index & 0x4) / 4);\n    return Mem::permute<Inner, Inner, Inner, Inner>(Mem::permute128<Outer, Outer>(d.v()));\n}\ntemplate <> template <int Index> Vc_INTRINSIC AVX2::double_v AVX2::double_v::broadcast() const\n{\n    constexpr VecPos Inner = static_cast<VecPos>(Index & 0x1);\n    constexpr VecPos Outer = static_cast<VecPos>((Index & 0x2) / 2);\n    return Mem::permute<Inner, Inner>(Mem::permute128<Outer, Outer>(d.v()));\n}\n// }}}1\n}  // namespace Vc\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/avx/vectorhelper.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_AVX_VECTORHELPER_H_\n#define VC_AVX_VECTORHELPER_H_\n\n#include <limits>\n#include \"types.h\"\n#include \"intrinsics.h\"\n#include \"casts.h\"\n#include \"../common/loadstoreflags.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\n        template<> struct VectorHelper<__m256>\n        {\n            typedef __m256 VectorType;\n            typedef const VectorType VTArg;\n\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VTArg x, typename Flags::EnableIfAligned               = nullptr) { _mm256_store_ps(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VTArg x, typename Flags::EnableIfUnalignedNotStreaming = nullptr) { _mm256_storeu_ps(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VTArg x, typename Flags::EnableIfStreaming             = nullptr) { _mm256_stream_ps(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VTArg x, typename Flags::EnableIfUnalignedAndStreaming = nullptr) { AvxIntrinsics::stream_store(mem, x, setallone_ps()); }\n\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VTArg x, VTArg m, typename std::enable_if<!Flags::IsStreaming, void *>::type = nullptr) { _mm256_maskstore(mem, m, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VTArg x, VTArg m, typename std::enable_if< Flags::IsStreaming, void *>::type = nullptr) { AvxIntrinsics::stream_store(mem, x, m); }\n        };\n\n        template<> struct VectorHelper<__m256d>\n        {\n            typedef __m256d VectorType;\n            typedef const VectorType VTArg;\n\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VTArg x, typename Flags::EnableIfAligned               = nullptr) { _mm256_store_pd(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VTArg x, typename Flags::EnableIfUnalignedNotStreaming = nullptr) { _mm256_storeu_pd(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VTArg x, typename Flags::EnableIfStreaming             = nullptr) { _mm256_stream_pd(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VTArg x, typename Flags::EnableIfUnalignedAndStreaming = nullptr) { AvxIntrinsics::stream_store(mem, x, setallone_pd()); }\n\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VTArg x, VTArg m, typename std::enable_if<!Flags::IsStreaming, void *>::type = nullptr) { _mm256_maskstore(mem, m, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VTArg x, VTArg m, typename std::enable_if< Flags::IsStreaming, void *>::type = nullptr) { AvxIntrinsics::stream_store(mem, x, m); }\n        };\n\n        template<> struct VectorHelper<__m256i>\n        {\n            typedef __m256i VectorType;\n            typedef const VectorType VTArg;\n\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VTArg x, typename Flags::EnableIfAligned               = nullptr) { _mm256_store_si256(reinterpret_cast<__m256i *>(mem), x); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VTArg x, typename Flags::EnableIfUnalignedNotStreaming = nullptr) { _mm256_storeu_si256(reinterpret_cast<__m256i *>(mem), x); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VTArg x, typename Flags::EnableIfStreaming             = nullptr) { _mm256_stream_si256(reinterpret_cast<__m256i *>(mem), x); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VTArg x, typename Flags::EnableIfUnalignedAndStreaming = nullptr) { AvxIntrinsics::stream_store(mem, x, setallone_si256()); }\n\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VTArg x, VTArg m, typename std::enable_if<!Flags::IsStreaming, void *>::type = nullptr) { _mm256_maskstore(mem, m, x); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VTArg x, VTArg m, typename std::enable_if< Flags::IsStreaming, void *>::type = nullptr) { AvxIntrinsics::stream_store(mem, x, m); }\n        };\n\n#define Vc_OP1(op) \\\n        static Vc_INTRINSIC VectorType Vc_CONST op(VTArg a) { return Vc_CAT2(_mm256_##op##_, Vc_SUFFIX)(a); }\n#define Vc_OP(op) \\\n        static Vc_INTRINSIC VectorType Vc_CONST op(VTArg a, VTArg b) { return Vc_CAT2(op##_ , Vc_SUFFIX)(a, b); }\n#define Vc_OP_(op) \\\n        static Vc_INTRINSIC VectorType Vc_CONST op(VTArg a, VTArg b) { return Vc_CAT2(_mm256_##op    , Vc_SUFFIX)(a, b); }\n#define Vc_OPx(op, op2) \\\n        static Vc_INTRINSIC VectorType Vc_CONST op(VTArg a, VTArg b) { return Vc_CAT2(_mm256_##op2##_, Vc_SUFFIX)(a, b); }\n\n        template<> struct VectorHelper<double> {\n            typedef __m256d VectorType;\n            typedef const VectorType VTArg;\n            typedef double EntryType;\n#define Vc_SUFFIX pd\n\n            static Vc_ALWAYS_INLINE VectorType notMaskedToZero(VTArg a, __m256 mask) { return Vc_CAT2(_mm256_and_, Vc_SUFFIX)(_mm256_castps_pd(mask), a); }\n            static Vc_ALWAYS_INLINE VectorType set(const double a) { return Vc_CAT2(_mm256_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE VectorType set(const double a, const double b, const double c, const double d) {\n                return Vc_CAT2(_mm256_set_, Vc_SUFFIX)(a, b, c, d);\n            }\n            static Vc_ALWAYS_INLINE VectorType zero() { return Vc_CAT2(_mm256_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE VectorType one()  { return Vc_CAT2(setone_, Vc_SUFFIX)(); }// set(1.); }\n\n            static inline void fma(VectorType &v1, VTArg v2, VTArg v3) {\n#ifdef Vc_IMPL_FMA4\n                v1 = _mm256_macc_pd(v1, v2, v3);\n#else\n                VectorType h1 = _mm256_and_pd(v1, _mm256_broadcast_sd(reinterpret_cast<const double *>(&c_general::highMaskDouble)));\n                VectorType h2 = _mm256_and_pd(v2, _mm256_broadcast_sd(reinterpret_cast<const double *>(&c_general::highMaskDouble)));\n#if defined(Vc_GCC) && Vc_GCC < 0x40703\n                // GCC before 4.7.3 uses an incorrect optimization where it replaces the subtraction with an andnot\n                // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54703\n                asm(\"\":\"+x\"(h1), \"+x\"(h2));\n#endif\n                const VectorType l1 = _mm256_sub_pd(v1, h1);\n                const VectorType l2 = _mm256_sub_pd(v2, h2);\n                const VectorType ll = mul(l1, l2);\n                const VectorType lh = add(mul(l1, h2), mul(h1, l2));\n                const VectorType hh = mul(h1, h2);\n                // ll < lh < hh for all entries is certain\n                const VectorType lh_lt_v3 = cmplt_pd(abs(lh), abs(v3)); // |lh| < |v3|\n                const VectorType b = _mm256_blendv_pd(v3, lh, lh_lt_v3);\n                const VectorType c = _mm256_blendv_pd(lh, v3, lh_lt_v3);\n                v1 = add(add(ll, b), add(c, hh));\n#endif\n            }\n\n            static Vc_INTRINSIC VectorType Vc_CONST add(VTArg a, VTArg b) { return _mm256_add_pd(a,b); }\n            static Vc_INTRINSIC VectorType Vc_CONST sub(VTArg a, VTArg b) { return _mm256_sub_pd(a,b); }\n            static Vc_INTRINSIC VectorType Vc_CONST mul(VTArg a, VTArg b) { return _mm256_mul_pd(a,b); }\n\n            Vc_OP1(sqrt)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType rsqrt(VTArg x) {\n                return _mm256_div_pd(one(), sqrt(x));\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType reciprocal(VTArg x) {\n                return _mm256_div_pd(one(), x);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType abs(VTArg a) {\n                return Vc_CAT2(_mm256_and_, Vc_SUFFIX)(a, setabsmask_pd());\n            }\n\n            static Vc_INTRINSIC VectorType Vc_CONST min(VTArg a, VTArg b) { return _mm256_min_pd(a, b); }\n            static Vc_INTRINSIC VectorType Vc_CONST max(VTArg a, VTArg b) { return _mm256_max_pd(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VTArg a) {\n                __m128d b = _mm_min_pd(avx_cast<__m128d>(a), _mm256_extractf128_pd(a, 1));\n                b = _mm_min_sd(b, _mm_unpackhi_pd(b, b));\n                return _mm_cvtsd_f64(b);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VTArg a) {\n                __m128d b = _mm_max_pd(avx_cast<__m128d>(a), _mm256_extractf128_pd(a, 1));\n                b = _mm_max_sd(b, _mm_unpackhi_pd(b, b));\n                return _mm_cvtsd_f64(b);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VTArg a) {\n                __m128d b = _mm_mul_pd(avx_cast<__m128d>(a), _mm256_extractf128_pd(a, 1));\n                b = _mm_mul_sd(b, _mm_shuffle_pd(b, b, _MM_SHUFFLE2(0, 1)));\n                return _mm_cvtsd_f64(b);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VTArg a) {\n                __m128d b = _mm_add_pd(avx_cast<__m128d>(a), _mm256_extractf128_pd(a, 1));\n                b = _mm_hadd_pd(b, b); // or: b = _mm_add_sd(b, _mm256_shuffle_pd(b, b, _MM_SHUFFLE2(0, 1)));\n                return _mm_cvtsd_f64(b);\n            }\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VTArg a) {\n                return _mm256_round_pd(a, _MM_FROUND_NINT);\n            }\n        };\n\n        template<> struct VectorHelper<float> {\n            typedef float EntryType;\n            typedef __m256 VectorType;\n            typedef const VectorType VTArg;\n#define Vc_SUFFIX ps\n\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType notMaskedToZero(VTArg a, __m256 mask) { return Vc_CAT2(_mm256_and_, Vc_SUFFIX)(mask, a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const float a) { return Vc_CAT2(_mm256_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const float a, const float b, const float c, const float d,\n                    const float e, const float f, const float g, const float h) {\n                return Vc_CAT2(_mm256_set_, Vc_SUFFIX)(a, b, c, d, e, f, g, h); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType zero() { return Vc_CAT2(_mm256_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType one()  { return Vc_CAT2(setone_, Vc_SUFFIX)(); }// set(1.f); }\n            static Vc_ALWAYS_INLINE Vc_CONST __m256 concat(__m256d a, __m256d b) { return _mm256_insertf128_ps(avx_cast<__m256>(_mm256_cvtpd_ps(a)), _mm256_cvtpd_ps(b), 1); }\n\n            static inline void fma(VectorType &v1, VTArg v2, VTArg v3) {\n#ifdef Vc_IMPL_FMA4\n                v1 = _mm256_macc_ps(v1, v2, v3);\n#else\n                __m256d v1_0 = _mm256_cvtps_pd(lo128(v1));\n                __m256d v1_1 = _mm256_cvtps_pd(hi128(v1));\n                __m256d v2_0 = _mm256_cvtps_pd(lo128(v2));\n                __m256d v2_1 = _mm256_cvtps_pd(hi128(v2));\n                __m256d v3_0 = _mm256_cvtps_pd(lo128(v3));\n                __m256d v3_1 = _mm256_cvtps_pd(hi128(v3));\n                v1 = AVX::concat(\n                        _mm256_cvtpd_ps(_mm256_add_pd(_mm256_mul_pd(v1_0, v2_0), v3_0)),\n                        _mm256_cvtpd_ps(_mm256_add_pd(_mm256_mul_pd(v1_1, v2_1), v3_1)));\n#endif\n            }\n\n            static Vc_INTRINSIC VectorType Vc_CONST add(VTArg a, VTArg b) { return _mm256_add_ps(a, b); }\n            static Vc_INTRINSIC VectorType Vc_CONST sub(VTArg a, VTArg b) { return _mm256_sub_ps(a, b); }\n            static Vc_INTRINSIC VectorType Vc_CONST mul(VTArg a, VTArg b) { return _mm256_mul_ps(a, b); }\n\n            Vc_OP1(sqrt) Vc_OP1(rsqrt)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType reciprocal(VTArg x) {\n                return _mm256_rcp_ps(x);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType abs(VTArg a) {\n                return Vc_CAT2(_mm256_and_, Vc_SUFFIX)(a, setabsmask_ps());\n            }\n\n            static Vc_INTRINSIC VectorType Vc_CONST min(VTArg a, VTArg b) { return _mm256_min_ps(a, b); }\n            static Vc_INTRINSIC VectorType Vc_CONST max(VTArg a, VTArg b) { return _mm256_max_ps(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VTArg a) {\n                __m128 b = _mm_min_ps(lo128(a), hi128(a));\n                b = _mm_min_ps(b, _mm_movehl_ps(b, b));   // b = min(a0, a2), min(a1, a3), min(a2, a2), min(a3, a3)\n                b = _mm_min_ss(b, _mm_shuffle_ps(b, b, _MM_SHUFFLE(1, 1, 1, 1))); // b = min(a0, a1), a1, a2, a3\n                return _mm_cvtss_f32(b);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VTArg a) {\n                __m128 b = _mm_max_ps(avx_cast<__m128>(a), _mm256_extractf128_ps(a, 1));\n                b = _mm_max_ps(b, _mm_movehl_ps(b, b));   // b = max(a0, a2), max(a1, a3), max(a2, a2), max(a3, a3)\n                b = _mm_max_ss(b, _mm_shuffle_ps(b, b, _MM_SHUFFLE(1, 1, 1, 1))); // b = max(a0, a1), a1, a2, a3\n                return _mm_cvtss_f32(b);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VTArg a) {\n                __m128 b = _mm_mul_ps(avx_cast<__m128>(a), _mm256_extractf128_ps(a, 1));\n                b = _mm_mul_ps(b, _mm_shuffle_ps(b, b, _MM_SHUFFLE(0, 1, 2, 3)));\n                b = _mm_mul_ss(b, _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 2, 0, 1)));\n                return _mm_cvtss_f32(b);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VTArg a) {\n                __m128 b = _mm_add_ps(avx_cast<__m128>(a), _mm256_extractf128_ps(a, 1));\n                b = _mm_add_ps(b, _mm_shuffle_ps(b, b, _MM_SHUFFLE(0, 1, 2, 3)));\n                b = _mm_add_ss(b, _mm_shuffle_ps(b, b, _MM_SHUFFLE(3, 2, 0, 1)));\n                return _mm_cvtss_f32(b);\n            }\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VTArg a) {\n                return _mm256_round_ps(a, _MM_FROUND_NINT);\n            }\n        };\n\n#undef Vc_OP1\n#undef Vc_OP\n#undef Vc_OP_\n#undef Vc_OPx\n\n}  // namespace AVX(2)\n}  // namespace Vc\n\n#endif // VC_AVX_VECTORHELPER_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/algorithms.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_ALGORITHMS_H_\n#define VC_COMMON_ALGORITHMS_H_\n\n#include \"simdize.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n#ifdef DOXYGEN\n/**\n * \\ingroup Utilities\n * \\headerfile algorithms.h <Vc/Vc>\n *\n * Vc variant of the `std::for_each` algorithm.\n *\n * This algorithm calls \\p f with one argument of type\n * `Vc::Vector<` *iterator value type* `, ` *unspecified* `>` as often as is needed to\n * iterate over the complete range from \\p first to \\p last.\n * It will try to use the best vector size (VectorAbi) to work on the largest chunks\n * possible.\n * To support aligned loads (and stores) and to support arbitrary range distances, the\n * algorithm may require the use of `Vc::VectorAbi` types that work on fewer elements in\n * parallel.\n *\n * The following example requires C++14 for generic lambdas. If you don't have generic\n * lambdas available you can use a \"classic\" functor type with a templated call operator\n * instead.\n *\n * \\code\n * void scale(std::vector<double> &data, double factor) {\n *   Vc::simd_for_each(data.begin(), data.end(), [&](auto v) {\n *      v *= factor;\n *   });\n * }\n * \\endcode\n */\ntemplate <class InputIt, class UnaryFunction>\nUnaryFunction simd_for_each(InputIt first, InputIt last, UnaryFunction f);\n#else\ntemplate <class InputIt, class UnaryFunction,\n          class ValueType = typename std::iterator_traits<InputIt>::value_type>\ninline enable_if<\n    Traits::is_functor_argument_immutable<UnaryFunction, simdize<ValueType>>::value,\n    UnaryFunction>\nsimd_for_each(InputIt first, InputIt last, UnaryFunction f)\n{\n    typedef simdize<ValueType> V;\n    typedef simdize<ValueType, 1> V1;\n    const auto lastV = last - V::Size + 1;\n    for (; first < lastV; first += V::Size) {\n        V tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n    }\n    for (; first != last; ++first) {\n        V1 tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n    }\n    return f;\n}\n\ntemplate <typename InputIt, typename UnaryFunction,\n          class ValueType = typename std::iterator_traits<InputIt>::value_type>\ninline enable_if<\n        !Traits::is_functor_argument_immutable<UnaryFunction, simdize<ValueType>>::value,\n    UnaryFunction>\nsimd_for_each(InputIt first, InputIt last, UnaryFunction f)\n{\n    typedef simdize<ValueType> V;\n    typedef simdize<ValueType, 1> V1;\n    const auto lastV = last - V::size() + 1;\n    for (; first < lastV; first += V::size()) {\n        V tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n        store_interleaved(tmp, std::addressof(*first));\n    }\n    for (; first != last; ++first) {\n        V1 tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n        store_interleaved(tmp, std::addressof(*first));\n    }\n    return f;\n}\n#endif\n\n///////////////////////////////////////////////////////////////////////////////\ntemplate <typename InputIt, typename UnaryFunction,\n          class ValueType = typename std::iterator_traits<InputIt>::value_type>\ninline enable_if<\n    Traits::is_functor_argument_immutable<UnaryFunction, simdize<ValueType>>::value,\n    UnaryFunction>\nsimd_for_each_n(InputIt first, std::size_t count, UnaryFunction f)\n{\n    typename std::make_signed<size_t>::type len = count;\n    typedef simdize<ValueType> V;\n    typedef simdize<ValueType, 1> V1;\n    for (; len >= int(V::size()); len -= V::Size, first += V::Size) {\n        V tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n    }\n    for (; len != 0; --len, ++first) {\n        V1 tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n    }\n    return f;\n}\n\ntemplate <typename InputIt, typename UnaryFunction,\n          class ValueType = typename std::iterator_traits<InputIt>::value_type>\ninline enable_if<\n    !Traits::is_functor_argument_immutable<UnaryFunction, simdize<ValueType>>::value,\n    UnaryFunction>\nsimd_for_each_n(InputIt first, std::size_t count, UnaryFunction f)\n{\n    typename std::make_signed<size_t>::type len = count;\n    typedef simdize<ValueType> V;\n    typedef simdize<ValueType, 1> V1;\n    for (; len >= int(V::size()); len -= V::Size, first += V::Size) {\n        V tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n        store_interleaved(tmp, std::addressof(*first));\n    }\n    for (; len != 0; --len, ++first) {\n        V1 tmp;\n        load_interleaved(tmp, std::addressof(*first));\n        f(tmp);\n        store_interleaved(tmp, std::addressof(*first));\n    }\n    return f;\n}\n\n}  // namespace Vc\n\n#endif // VC_COMMON_ALGORITHMS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/aliasingentryhelper.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_ALIASINGENTRYHELPER_H_\n#define VC_COMMON_ALIASINGENTRYHELPER_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\ntemplate<class StorageType> class AliasingEntryHelper\n{\n    private:\n        typedef typename StorageType::EntryType T;\n#ifdef Vc_ICC\n        StorageType *const m_storage;\n        const int m_index;\n    public:\n        Vc_ALWAYS_INLINE AliasingEntryHelper(StorageType *d, int index) : m_storage(d), m_index(index) {}\n        Vc_ALWAYS_INLINE AliasingEntryHelper(const AliasingEntryHelper &) = default;\n        Vc_ALWAYS_INLINE AliasingEntryHelper(AliasingEntryHelper &&) = default;\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator=(const AliasingEntryHelper &rhs) {\n            m_storage->assign(m_index, rhs);\n            return *this;\n        }\n\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator  =(T x) { m_storage->assign(m_index, x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator +=(T x) { m_storage->assign(m_index, m_storage->m(m_index) + x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator -=(T x) { m_storage->assign(m_index, m_storage->m(m_index) - x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator /=(T x) { m_storage->assign(m_index, m_storage->m(m_index) / x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator *=(T x) { m_storage->assign(m_index, m_storage->m(m_index) * x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator |=(T x) { m_storage->assign(m_index, m_storage->m(m_index) | x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator &=(T x) { m_storage->assign(m_index, m_storage->m(m_index) & x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator ^=(T x) { m_storage->assign(m_index, m_storage->m(m_index) ^ x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator %=(T x) { m_storage->assign(m_index, m_storage->m(m_index) % x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator<<=(T x) { m_storage->assign(m_index, m_storage->m(m_index)<< x); return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator>>=(T x) { m_storage->assign(m_index, m_storage->m(m_index)>> x); return *this; }\n#define m_data m_storage->read(m_index)\n#else\n        typedef T A Vc_MAY_ALIAS;\n        A &m_data;\n    public:\n        template<typename T2>\n        Vc_ALWAYS_INLINE AliasingEntryHelper(T2 &d) : m_data(reinterpret_cast<A &>(d)) {}\n\n        Vc_ALWAYS_INLINE AliasingEntryHelper(A &d) : m_data(d) {}\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator=(const AliasingEntryHelper &rhs) {\n            m_data = rhs.m_data;\n            return *this;\n        }\n\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator =(T x) { m_data  = x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator+=(T x) { m_data += x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator-=(T x) { m_data -= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator/=(T x) { m_data /= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator*=(T x) { m_data *= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator|=(T x) { m_data |= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator&=(T x) { m_data &= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator^=(T x) { m_data ^= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator%=(T x) { m_data %= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator<<=(T x) { m_data <<= x; return *this; }\n        Vc_ALWAYS_INLINE AliasingEntryHelper &operator>>=(T x) { m_data >>= x; return *this; }\n#endif\n\n        Vc_ALWAYS_INLINE Vc_PURE operator const T() const { return m_data; }\n\n        Vc_ALWAYS_INLINE Vc_PURE bool operator==(T x) const { return static_cast<T>(m_data) == x; }\n        Vc_ALWAYS_INLINE Vc_PURE bool operator!=(T x) const { return static_cast<T>(m_data) != x; }\n        Vc_ALWAYS_INLINE Vc_PURE bool operator<=(T x) const { return static_cast<T>(m_data) <= x; }\n        Vc_ALWAYS_INLINE Vc_PURE bool operator>=(T x) const { return static_cast<T>(m_data) >= x; }\n        Vc_ALWAYS_INLINE Vc_PURE bool operator< (T x) const { return static_cast<T>(m_data) <  x; }\n        Vc_ALWAYS_INLINE Vc_PURE bool operator> (T x) const { return static_cast<T>(m_data) >  x; }\n\n        Vc_ALWAYS_INLINE Vc_PURE T operator-() const { return -static_cast<T>(m_data); }\n        Vc_ALWAYS_INLINE Vc_PURE T operator~() const { return ~static_cast<T>(m_data); }\n        Vc_ALWAYS_INLINE Vc_PURE T operator+(T x) const { return static_cast<T>(m_data) + x; }\n        Vc_ALWAYS_INLINE Vc_PURE T operator-(T x) const { return static_cast<T>(m_data) - x; }\n        Vc_ALWAYS_INLINE Vc_PURE T operator/(T x) const { return static_cast<T>(m_data) / x; }\n        Vc_ALWAYS_INLINE Vc_PURE T operator*(T x) const { return static_cast<T>(m_data) * x; }\n        Vc_ALWAYS_INLINE Vc_PURE T operator|(T x) const { return static_cast<T>(m_data) | x; }\n        Vc_ALWAYS_INLINE Vc_PURE T operator&(T x) const { return static_cast<T>(m_data) & x; }\n        Vc_ALWAYS_INLINE Vc_PURE T operator^(T x) const { return static_cast<T>(m_data) ^ x; }\n        Vc_ALWAYS_INLINE Vc_PURE T operator%(T x) const { return static_cast<T>(m_data) % x; }\n        //T operator<<(T x) const { return static_cast<T>(m_data) << x; }\n        //T operator>>(T x) const { return static_cast<T>(m_data) >> x; }\n#ifdef m_data\n#undef m_data\n#endif\n};\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_ALIASINGENTRYHELPER_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/alignedbase.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_ALIGNEDBASE_H_\n#define VC_COMMON_ALIGNEDBASE_H_\n\n#include \"types.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n/**\\internal\n * Break the recursion of the function below.\n */\ntemplate <typename T> constexpr T max(T a) { return a; }\n/**\\internal\n * \\returns the maximum of all specified arguments.\n */\ntemplate <typename T, typename... Ts> constexpr T max(T a, T b, Ts... rest)\n{\n    return a > b ? max(a, rest...) : max(b, rest...);\n}\n}  // namespace Detail\nnamespace Common\n{\ntemplate <std::size_t> Vc_INTRINSIC void *aligned_malloc(std::size_t);\nVc_ALWAYS_INLINE void free(void *);\n}  // namespace Common\n\n/**\n * \\ingroup Utilities\n *\n * Helper class to ensure a given alignment.\n *\n * This class reimplements the \\c new and \\c delete operators to align objects allocated\n * on the heap suitably with the specified alignment \\c Alignment.\n *\n * \\see Vc::VectorAlignedBase\n * \\see Vc::MemoryAlignedBase\n */\ntemplate <std::size_t Alignment> struct alignas(Alignment) AlignedBase\n{\n    Vc_FREE_STORE_OPERATORS_ALIGNED(Alignment);\n};\n\n/**\n * \\ingroup Utilities\n *\n * Helper type to ensure suitable alignment for any Vc::Vector<T> type (using the default\n * VectorAbi).\n *\n * This class reimplements the \\c new and \\c delete operators to align objects allocated\n * on the heap suitably for objects of Vc::Vector<T> type. This is necessary since the\n * standard \\c new operator does not adhere to the alignment requirements of the type.\n *\n * \\see Vc::VectorAlignedBaseT\n * \\see Vc::MemoryAlignedBase\n * \\see Vc::AlignedBase\n */\nusing VectorAlignedBase = AlignedBase<\n    Detail::max(alignof(Vector<float>), alignof(Vector<double>), alignof(Vector<ullong>),\n                alignof(Vector<llong>), alignof(Vector<ulong>), alignof(Vector<long>),\n                alignof(Vector<uint>), alignof(Vector<int>), alignof(Vector<ushort>),\n                alignof(Vector<short>), alignof(Vector<uchar>), alignof(Vector<schar>))>;\n\n/**\n * \\ingroup Utilities\n * Variant of the above type ensuring suitable alignment only for the specified vector\n * type \\p V.\n *\n * \\see Vc::VectorAlignedBase\n * \\see Vc::MemoryAlignedBaseT\n */\ntemplate <typename V> using VectorAlignedBaseT = AlignedBase<alignof(V)>;\n\n/**\n * \\ingroup Utilities\n *\n * Helper class to ensure suitable alignment for arrays of scalar objects for any\n * Vc::Vector<T> type (using the default VectorAbi).\n *\n * This class reimplements the \\c new and \\c delete operators to align objects allocated\n * on the heap suitably for arrays of type \\p Vc::Vector<T>::EntryType. Subsequent load\n * and store operations are safe to use the aligned variant.\n *\n * \\see Vc::MemoryAlignedBaseT\n * \\see Vc::VectorAlignedBase\n * \\see Vc::AlignedBase\n */\nusing MemoryAlignedBase = AlignedBase<\n    Detail::max(Vector<float>::MemoryAlignment, Vector<double>::MemoryAlignment,\n                Vector<ullong>::MemoryAlignment, Vector<llong>::MemoryAlignment,\n                Vector<ulong>::MemoryAlignment, Vector<long>::MemoryAlignment,\n                Vector<uint>::MemoryAlignment, Vector<int>::MemoryAlignment,\n                Vector<ushort>::MemoryAlignment, Vector<short>::MemoryAlignment,\n                Vector<uchar>::MemoryAlignment, Vector<schar>::MemoryAlignment)>;\n\n/**\n * \\ingroup Utilities\n * Variant of the above type ensuring suitable alignment only for the specified vector\n * type \\p V.\n *\n * \\see Vc::MemoryAlignedBase\n * \\see Vc::VectorAlignedBaseT\n */\ntemplate <typename V> using MemoryAlignedBaseT = AlignedBase<V::MemoryAlignment>;\n}\n\n#endif  // VC_COMMON_ALIGNEDBASE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/bitscanintrinsics.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_BITSCANINTRINSICS_H_\n#define VC_COMMON_BITSCANINTRINSICS_H_\n\n#if defined(Vc_GCC) || defined(Vc_CLANG) || defined(Vc_APPLECLANG)\n#include <x86intrin.h>\n#  ifndef _bit_scan_forward\n#    define _bit_scan_forward(x) __builtin_ctz(x)\n#include \"macros.h\"\nstatic Vc_ALWAYS_INLINE Vc_CONST int _Vc_bit_scan_reverse_asm(unsigned int x) {\n    int r;\n    __asm__(\"bsr %1,%0\" : \"=r\"(r) : \"X\"(x));\n    return r;\n}\n#    define _bit_scan_reverse(x) _Vc_bit_scan_reverse_asm(x)\n#  endif\n#elif defined(_WIN32)\n#include <intrin.h>\nstatic inline __forceinline unsigned long _bit_scan_forward(unsigned long x) {\n\tunsigned long index;\n\t_BitScanForward(&index, x);\n\treturn index;\n}\nstatic inline __forceinline unsigned long _bit_scan_reverse(unsigned long x) {\n\tunsigned long index;\n\t_BitScanReverse(&index, x);\n\treturn index;\n}\n#elif defined(Vc_ICC)\n// for all I know ICC supports the _bit_scan_* intrinsics\n#else\n// just assume the compiler can do it\n#endif\n\n\n#endif // VC_COMMON_BITSCANINTRINSICS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/const.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_CONST_H_\n#define VC_COMMON_CONST_H_\n\n#include <type_traits>\n#include \"../global.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n\ntemplate <int exponent> constexpr double exponentToFloat(std::integral_constant<bool, true>);\ntemplate <int exponent> constexpr double exponentToFloat(std::integral_constant<bool, false>);\ntemplate <> constexpr double exponentToFloat<0>(std::integral_constant<bool, true>)\n{\n    return 1.;\n}\ntemplate <> constexpr double exponentToFloat<0>(std::integral_constant<bool, false>)\n{\n    return 1.;\n}\ntemplate <> constexpr double exponentToFloat<-32>(std::integral_constant<bool, true>)\n{\n    return 1. / (65536. * 65536.);\n}\ntemplate <> constexpr double exponentToFloat<32>(std::integral_constant<bool, false>)\n{\n    return 65536. * 65536.;\n}\ntemplate <> constexpr double exponentToFloat<-64>(std::integral_constant<bool, true>)\n{\n    return 1. / (65536. * 65536. * 65536. * 65536.);\n}\ntemplate <> constexpr double exponentToFloat<64>(std::integral_constant<bool, false>)\n{\n    return 65536. * 65536. * 65536. * 65536.;\n}\ntemplate <int exponent>\nconstexpr double exponentToFloat(std::integral_constant<bool, false> negative)\n{\n    return exponentToFloat<exponent - 1>(negative) * 2.0;\n}\ntemplate <int exponent>\nconstexpr double exponentToFloat(std::integral_constant<bool, true> negative)\n{\n    return exponentToFloat<exponent + 1>(negative) * 0.5;\n}\ntemplate <int sign, unsigned long long mantissa, int exponent> constexpr double doubleConstant()\n{\n    return (static_cast<double>((mantissa & 0x000fffffffffffffull) | 0x0010000000000000ull) /\n            0x0010000000000000ull) *\n           exponentToFloat<exponent>(std::integral_constant<bool, (exponent < 0)>()) * sign;\n}\ntemplate <int sign, unsigned int mantissa, int exponent> constexpr float floatConstant()\n{\n    return (static_cast<float>((mantissa & 0x007fffffu) | 0x00800000u) / 0x00800000u) *\n           static_cast<float>(\n               exponentToFloat<exponent>(std::integral_constant<bool, (exponent < 0)>())) *\n           sign;\n}\n\n}  // namespace Detail\n}  // namespace Vc\n\n#endif // VC_COMMON_CONST_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/data.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_CONST_DATA_H_\n#define VC_COMMON_CONST_DATA_H_\n\n#include \"macros.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\nalignas(64) extern unsigned int RandomState[];\nalignas(32) extern const unsigned int AllBitsSet[8];\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_CONST_DATA_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/deinterleave.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_DEINTERLEAVE_H_\n#define VC_COMMON_DEINTERLEAVE_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n/**\n * \\ingroup Vectors\n *\n * \\deprecated Turn to InterleavedMemoryWrapper for a more flexible and complete solution.\n *\n * Loads two vectors of values from an interleaved array.\n *\n * \\param a, b The vectors to load the values from memory into.\n * \\param memory The memory location where to read the next 2 * V::Size values from\n * \\param align Either pass Vc::Aligned or Vc::Unaligned. It defaults to Vc::Aligned if nothing is\n * specified.\n *\n * If you store your data as\n * \\code\n * struct { float x, y; } m[1000];\n * \\endcode\n * then the deinterleave function allows you to read \\p Size concurrent x and y values like this:\n * \\code\n * Vc::float_v x, y;\n * Vc::deinterleave(&x, &y, &m[10], Vc::Unaligned);\n * \\endcode\n * This code will load m[10], m[12], m[14], ... into \\p x and m[11], m[13], m[15], ... into \\p y.\n *\n * The deinterleave function supports the following type combinations:\n\\verbatim\n  V \\  M | float | double | ushort | short | uint | int\n=========|=======|========|========|=======|======|=====\n float_v |   X   |        |    X   |   X   |      |\n---------|-------|--------|--------|-------|------|-----\ndouble_v |       |    X   |        |       |      |\n---------|-------|--------|--------|-------|------|-----\n   int_v |       |        |        |   X   |      |  X\n---------|-------|--------|--------|-------|------|-----\n  uint_v |       |        |    X   |       |   X  |\n---------|-------|--------|--------|-------|------|-----\n short_v |       |        |        |   X   |      |\n---------|-------|--------|--------|-------|------|-----\nushort_v |       |        |    X   |       |      |\n\\endverbatim\n */\ntemplate<typename V, typename M, typename A> Vc_ALWAYS_INLINE void deinterleave(V *a, V *b,\n        const M *memory, A align)\n{\n    Detail::deinterleave(*a, *b, memory, align);\n}\n\n// documented as default for align above\ntemplate<typename V, typename M> Vc_ALWAYS_INLINE void deinterleave(V *a, V *b,\n        const M *memory)\n{\n    Detail::deinterleave(*a, *b, memory, Aligned);\n}\n\n}  // namespace Vc\n\n#endif // VC_COMMON_DEINTERLEAVE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/detail.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2018 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_DETAIL_H_\n#define VC_COMMON_DETAIL_H_\n\n#include <vector>\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n// convertIndexVector {{{\n// if the argument is a Vector<T> already we definitely want to keep it that way\ntemplate <typename IV>\nVc_INTRINSIC enable_if<(Traits::is_simd_vector<IV>::value &&\n                        sizeof(typename IV::EntryType) >= sizeof(int)),\n                       const IV &>\nconvertIndexVector(const IV &indexVector)\n{\n    return indexVector;\n}\n\n// but if the scalar (integral) type is smaller than int we convert it up to int. Otherwise it's\n// very likely that the calculations we have to perform will overflow.\ntemplate <typename IV>\nVc_INTRINSIC enable_if<(Traits::is_simd_vector<IV>::value &&\n                        sizeof(typename IV::EntryType) < sizeof(int)),\n                       fixed_size_simd<int, IV::Size>>\nconvertIndexVector(const IV &indexVector)\n{\n    return static_cast<fixed_size_simd<int, IV::Size>>(indexVector);\n}\n\n// helper for promoting int types to int or higher\ntemplate <class T> using promoted_type = decltype(std::declval<T>() + 1);\n\n// std::array, Vc::array, and C-array are fixed size and can therefore be converted to a\n// fixed_size_simd of the same size\ntemplate <typename T, std::size_t N>\nVc_INTRINSIC enable_if<std::is_integral<T>::value, fixed_size_simd<promoted_type<T>, N>>\nconvertIndexVector(const std::array<T, N> &indexVector)\n{\n    return fixed_size_simd<promoted_type<T>, N>{std::addressof(indexVector[0]),\n                                                Vc::Unaligned};\n}\ntemplate <typename T, std::size_t N>\nVc_INTRINSIC enable_if<std::is_integral<T>::value, fixed_size_simd<promoted_type<T>, N>>\nconvertIndexVector(const Vc::array<T, N> &indexVector)\n{\n    return fixed_size_simd<promoted_type<T>, N>{std::addressof(indexVector[0]),\n                                                Vc::Unaligned};\n}\ntemplate <typename T, std::size_t N>\nVc_INTRINSIC enable_if<std::is_integral<T>::value, fixed_size_simd<promoted_type<T>, N>>\nconvertIndexVector(const T (&indexVector)[N])\n{\n    return fixed_size_simd<promoted_type<T>, N>{std::addressof(indexVector[0]),\n                                                Vc::Unaligned};\n}\n\n// a plain pointer won't work. Because we need some information on the number of values in\n// the index argument\n#ifndef Vc_MSVC\n// MSVC treats the function as usable in SFINAE context if it is deleted. If it's not declared we\n// seem to get what we wanted (except for bad diagnostics)\ntemplate <class T>\nenable_if<std::is_pointer<T>::value, void> convertIndexVector(T indexVector) = delete;\n#endif\n\n// an initializer_list works, but is runtime-sized (before C++14, at least) so we have to\n// fall back to std::vector\ntemplate <typename T>\nVc_INTRINSIC std::vector<promoted_type<T>> convertIndexVector(\n    const std::initializer_list<T> &indexVector)\n{\n    return {begin(indexVector), end(indexVector)};\n}\n\n// a std::vector cannot be converted to anything better\ntemplate <typename T>\nVc_INTRINSIC\n    enable_if<(std::is_integral<T>::value && sizeof(T) >= sizeof(int)), std::vector<T>>\n    convertIndexVector(const std::vector<T> &indexVector)\n{\n    return indexVector;\n}\ntemplate <typename T>\nVc_INTRINSIC enable_if<(std::is_integral<T>::value && sizeof(T) < sizeof(int)),\n                       std::vector<promoted_type<T>>>\nconvertIndexVector(const std::vector<T> &indexVector)\n{\n    return {std::begin(indexVector), std::end(indexVector)};\n}\n\ntemplate <class T,\n          class = enable_if<\n              (!std::is_pointer<T>::value && !Traits::is_simd_vector<T>::value &&\n               !std::is_lvalue_reference<decltype(std::declval<const T &>()[0])>::value)>>\nVc_INTRINSIC const T &convertIndexVector(const T &i)\n{\n    return i;\n}\n\n// }}}\n}  // namespace Common\n}  // namespace Vc_VERSIONED_NAMESPACE\n\n#endif  // VC_COMMON_DETAIL_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/elementreference.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2016 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_ELEMENTREFERENCE_H_\n#define VC_COMMON_ELEMENTREFERENCE_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <typename U, typename Accessor = U> class ElementReference\n{\n    friend U;\n    friend Accessor;\n    Vc_INTRINSIC ElementReference(U &o, int i) noexcept : index(i), obj(o) {}\n\n    static constexpr bool get_noexcept =\n        noexcept(Accessor::get(std::declval<U &>(), int()));\n    template <typename T> static constexpr bool set_noexcept()\n    {\n        return noexcept(Accessor::set(std::declval<U &>(), int(), std::declval<T>()));\n    }\n\npublic:\n    using value_type = typename U::value_type;\n    Vc_INTRINSIC ElementReference(const ElementReference &) = delete;\n\n    /**\n     * Move Constructor\n     *\n     * this is the only way to constructor an ElementReference in user code\n     *\n     * \\note\n     * Please be aware that this class models the concept of a reference\n     * and as such it can have the same lifetime issue as a standard C++\n     * reference.\n     *\n     * \\note\n     * C++ 17 support copy-elision, which in turn allows to\n     * the ElementReference obtained via operator[] from a function\n     * and avoid copying. C++11 and C++14 don't offer this, thus we add\n     * the move constructor, to allow them to move the data and thus avoid\n     * copying (which was prohibited by the deleted constructor above\n     */\n    Vc_INTRINSIC ElementReference(ElementReference &&) = default;\n\n    Vc_INTRINSIC operator value_type() const noexcept(get_noexcept)\n    {\n        return Accessor::get(obj, index);\n    }\n\n    template <typename T>\n        Vc_INTRINSIC ElementReference &operator=(T &&x) &&\n        noexcept(noexcept(Accessor::set(std::declval<U &>(), int(), std::declval<T>())))\n    {\n        Accessor::set(obj, index, std::forward<T>(x));\n        return *this;\n    }\n\n// TODO: improve with operator.()\n\n#define Vc_OP_(op_)                                                                      \\\n    template <typename T, typename R = decltype(std::declval<const value_type &>()       \\\n                                                    op_ std::declval<T>())>              \\\n        Vc_INTRINSIC ElementReference &operator op_##=(T &&x) &&                         \\\n        noexcept(get_noexcept && noexcept(Accessor::set(std::declval<U &>(), int(),      \\\n                                                        std::declval<R &&>())))          \\\n    {                                                                                    \\\n        const value_type &lhs = Accessor::get(obj, index);                               \\\n        Accessor::set(obj, index, lhs op_ std::forward<T>(x));                           \\\n        return *this;                                                                    \\\n    }\n    Vc_ALL_ARITHMETICS(Vc_OP_);\n    Vc_ALL_SHIFTS(Vc_OP_);\n    Vc_ALL_BINARY(Vc_OP_);\n#undef Vc_OP_\n\n    template <typename = void>\n        Vc_INTRINSIC ElementReference &operator++() &&\n        noexcept(noexcept(std::declval<value_type &>() =\n                              Accessor::get(std::declval<U &>(), int())) &&\n                 set_noexcept<decltype(++std::declval<value_type &>())>())\n    {\n        value_type x = Accessor::get(obj, index);\n        Accessor::set(obj, index, ++x);\n        return *this;\n    }\n\n    template <typename = void>\n        Vc_INTRINSIC value_type operator++(int) &&\n        noexcept(noexcept(std::declval<value_type &>() =\n                              Accessor::get(std::declval<U &>(), int())) &&\n                 set_noexcept<decltype(std::declval<value_type &>()++)>())\n    {\n        const value_type r = Accessor::get(obj, index);\n        value_type x = r;\n        Accessor::set(obj, index, ++x);\n        return r;\n    }\n\n    template <typename = void>\n        Vc_INTRINSIC ElementReference &operator--() &&\n        noexcept(noexcept(std::declval<value_type &>() =\n                              Accessor::get(std::declval<U &>(), int())) &&\n                 set_noexcept<decltype(--std::declval<value_type &>())>())\n    {\n        value_type x = Accessor::get(obj, index);\n        Accessor::set(obj, index, --x);\n        return *this;\n    }\n\n    template <typename = void>\n        Vc_INTRINSIC value_type operator--(int) &&\n        noexcept(noexcept(std::declval<value_type &>() =\n                              Accessor::get(std::declval<U &>(), int())) &&\n                 set_noexcept<decltype(std::declval<value_type &>()--)>())\n    {\n        const value_type r = Accessor::get(obj, index);\n        value_type x = r;\n        Accessor::set(obj, index, --x);\n        return r;\n    }\n\n    friend void swap(ElementReference &&a, ElementReference &&b) {\n        value_type tmp(a);\n        static_cast<ElementReference &&>(a) = static_cast<value_type>(b);\n        static_cast<ElementReference &&>(b) = tmp;\n    }\n\n    friend void swap(value_type &a, ElementReference &&b) {\n        value_type tmp(a);\n        a = static_cast<value_type>(b);\n        static_cast<ElementReference &&>(b) = tmp;\n    }\n\n    friend void swap(ElementReference &&a, value_type &b) {\n        value_type tmp(a);\n        static_cast<ElementReference &&>(a) = b;\n        b = tmp;\n    }\n\nprivate:\n    int index;\n    U &obj;\n};\n\n}  // namespace Detail\n}  // namespace Vc\n\n#endif  // VC_COMMON_ELEMENTREFERENCE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/exponential.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n-------------------------------------------------------------------\n\nThe exp implementation is derived from Cephes, which carries the\nfollowing Copyright notice:\n\nCephes Math Library Release 2.2:  June, 1992\nCopyright 1984, 1987, 1989 by Stephen L. Moshier\nDirect inquiries to 30 Frost Street, Cambridge, MA 02140\n\n}}}*/\n\n#ifdef Vc_COMMON_MATH_H_INTERNAL\n\nconstexpr float log2_e = 1.44269504088896341f;\n\n// These constants are adjusted to account for single-precision floating point.\n// The original are for double precision:\n// \n// constexpr float MAXLOGF = 88.72283905206835f;\n// constexpr float MINLOGF = -103.278929903431851103f; /* log(2^-149) */\n\nconstexpr float MAXLOGF = 88.722831726074219f; /* log(2^127.99998474121094f) */\nconstexpr float MINLOGF = -88.029685974121094f; /* log(2^-126.99999237060547f) */\nconstexpr float MAXNUMF = 3.4028234663852885981170418348451692544e38f;\n\ntemplate <typename Abi, typename = enable_if<std::is_same<Abi, VectorAbi::Sse>::value ||\n                                             std::is_same<Abi, VectorAbi::Avx>::value>>\ninline Vector<float, detail::not_fixed_size_abi<Abi>> exp(Vector<float, Abi> x)\n{\n    using V = Vector<float, Abi>;\n    typedef typename V::Mask M;\n    typedef Detail::Const<float, Abi> C;\n\n        const M overflow  = x > MAXLOGF;\n        const M underflow = x < MINLOGF;\n\n        // log₂(eˣ) = x * log₂(e) * log₂(2)\n        //          = log₂(2^(x * log₂(e)))\n        // => eˣ = 2^(x * log₂(e))\n        // => n  = ⌊x * log₂(e) + ½⌋\n        // => y  = x - n * ln(2)       | recall that: ln(2) * log₂(e) == 1\n        // <=> eˣ = 2ⁿ * eʸ\n        V z = floor(C::log2_e() * x + 0.5f);\n        const auto n = static_cast<Vc::SimdArray<int, V::Size>>(z);\n        x -= z * C::ln2_large();\n        x -= z * C::ln2_small();\n\n        /* Theoretical peak relative error in [-0.5, +0.5] is 4.2e-9. */\n        z = ((((( 1.9875691500E-4f  * x\n                + 1.3981999507E-3f) * x\n                + 8.3334519073E-3f) * x\n                + 4.1665795894E-2f) * x\n                + 1.6666665459E-1f) * x\n                + 5.0000001201E-1f) * (x * x)\n                + x\n                + 1.0f;\n\n        x = ldexp(z, n); // == z * 2ⁿ\n\n        x(overflow) = std::numeric_limits<typename V::EntryType>::infinity();\n        x.setZero(underflow);\n\n        return x;\n    }\n\n#endif // Vc_COMMON_MATH_H_INTERNAL\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/fix_clang_emmintrin.h",
    "content": "/*{{{\n    Copyright (C) 2013-2015 Matthias Kretz <kretz@kde.org>\n\n    Permission to use, copy, modify, and distribute this software\n    and its documentation for any purpose and without fee is hereby\n    granted, provided that the above copyright notice appear in all\n    copies and that both that the copyright notice and this\n    permission notice and warranty disclaimer appear in supporting\n    documentation, and that the name of the author not be used in\n    advertising or publicity pertaining to distribution of the\n    software without specific, written prior permission.\n\n    The author disclaim all warranties with regard to this\n    software, including all implied warranties of merchantability\n    and fitness.  In no event shall the author be liable for any\n    special, indirect or consequential damages or any damages\n    whatsoever resulting from loss of use, data or profits, whether\n    in an action of contract, negligence or other tortious action,\n    arising out of or in connection with the use or performance of\n    this software.\n\n}}}*/\n\n#ifndef VC_COMMON_FIX_CLANG_EMMINTRIN_H_\n#define VC_COMMON_FIX_CLANG_EMMINTRIN_H_\n\n#include \"../global.h\"\n\n#if (defined Vc_CLANG && Vc_CLANG < 0x30700) || (defined Vc_APPLECLANG && Vc_APPLECLANG < 0x70000)\n\n#ifdef _mm_slli_si128\n#undef _mm_slli_si128\n#define _mm_slli_si128(a, count) __extension__ ({ \\\n  (__m128i)__builtin_ia32_pslldqi128((__m128i)(a), (count)*8); })\n#endif\n\n#ifdef _mm_srli_si128\n#undef _mm_srli_si128\n#define _mm_srli_si128(a, count) __extension__ ({ \\\n  (__m128i)__builtin_ia32_psrldqi128((__m128i)(a), (count)*8); })\n#endif\n\n#ifdef _mm_shuffle_epi32\n#undef _mm_shuffle_epi32\n#define _mm_shuffle_epi32(a, imm) __extension__ ({ \\\n  (__m128i)__builtin_shufflevector((__v4si)(__m128i)(a), (__v4si) _mm_set1_epi32(0), \\\n                                   (imm) & 0x3, ((imm) & 0xc) >> 2, \\\n                                   ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6); })\n#endif\n\n#ifdef _mm_shufflelo_epi16\n#undef _mm_shufflelo_epi16\n#define _mm_shufflelo_epi16(a, imm) __extension__ ({ \\\n  (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), (__v8hi) _mm_set1_epi16(0), \\\n                                   (imm) & 0x3, ((imm) & 0xc) >> 2, \\\n                                   ((imm) & 0x30) >> 4, ((imm) & 0xc0) >> 6, \\\n                                   4, 5, 6, 7); })\n#endif\n\n#ifdef _mm_shufflehi_epi16\n#undef _mm_shufflehi_epi16\n#define _mm_shufflehi_epi16(a, imm) __extension__ ({ \\\n  (__m128i)__builtin_shufflevector((__v8hi)(__m128i)(a), (__v8hi) _mm_set1_epi16(0), \\\n                                   0, 1, 2, 3, \\\n                                   4 + (((imm) & 0x03) >> 0), \\\n                                   4 + (((imm) & 0x0c) >> 2), \\\n                                   4 + (((imm) & 0x30) >> 4), \\\n                                   4 + (((imm) & 0xc0) >> 6)); })\n#endif\n\n#ifdef _mm_shuffle_pd\n#undef _mm_shuffle_pd\n#define _mm_shuffle_pd(a, b, i) __extension__ ({ \\\n  __builtin_shufflevector((__m128d)(a), (__m128d)(b), (i) & 1, (((i) & 2) >> 1) + 2); })\n#endif\n\n#endif // Vc_CLANG || Vc_APPLECLANG\n\n#endif // VC_COMMON_FIX_CLANG_EMMINTRIN_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/gatherimplementation.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_GATHERIMPLEMENTATION_H_\n#define VC_COMMON_GATHERIMPLEMENTATION_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\nenum class GatherScatterImplementation : int {\n    SimpleLoop,\n    SetIndexZero,\n    BitScanLoop,\n    PopcntSwitch\n};\n\nusing SimpleLoopT   = std::integral_constant<GatherScatterImplementation, GatherScatterImplementation::SimpleLoop>;\nusing SetIndexZeroT = std::integral_constant<GatherScatterImplementation, GatherScatterImplementation::SetIndexZero>;\nusing BitScanLoopT  = std::integral_constant<GatherScatterImplementation, GatherScatterImplementation::BitScanLoop>;\nusing PopcntSwitchT = std::integral_constant<GatherScatterImplementation, GatherScatterImplementation::PopcntSwitch>;\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeGather(SetIndexZeroT,\n                                    V &v,\n                                    const MT *mem,\n                                    IT &&indexes_,\n                                    typename V::MaskArgument mask)\n{\n    auto indexes = std::forward<IT>(indexes_);\n    indexes.setZeroInverted(static_cast<decltype(!indexes)>(mask));\n    const V tmp(mem, indexes);\n    where(mask) | v = tmp;\n}\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeGather(SimpleLoopT, V &v, const MT *mem, const IT &indexes,\n                                    const typename V::MaskArgument mask)\n{\n    if (Vc_IS_UNLIKELY(mask.isEmpty())) {\n        return;\n    }\n#if defined Vc_GCC && Vc_GCC >= 0x40900\n    // GCC 4.8 doesn't support dependent type and constexpr vector_size argument\n    constexpr std::size_t Sizeof = sizeof(V);\n    using Builtin [[gnu::vector_size(Sizeof)]] = typename V::value_type;\n    Builtin tmp = reinterpret_cast<Builtin>(v.data());\n    Common::unrolled_loop<std::size_t, 0, V::Size>([&](std::size_t i) {\n        if (mask[i]) {\n            tmp[i] = mem[indexes[i]];\n        }\n    });\n    v.data() = reinterpret_cast<typename V::VectorType>(tmp);\n#else\n    Common::unrolled_loop<std::size_t, 0, V::Size>([&](std::size_t i) {\n        if (mask[i])\n            v[i] = mem[indexes[i]];\n    });\n#endif\n}\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeGather(BitScanLoopT,\n                                    V &v,\n                                    const MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask)\n{\n#ifdef Vc_GNU_ASM\n    size_t bits = mask.toInt();\n    while (Vc_IS_LIKELY(bits > 0)) {\n        size_t i, j;\n        asm(\"bsf %[bits],%[i]\\n\\t\"\n            \"bsr %[bits],%[j]\\n\\t\"\n            \"btr %[i],%[bits]\\n\\t\"\n            \"btr %[j],%[bits]\\n\\t\"\n            : [i] \"=r\"(i), [j] \"=r\"(j), [bits] \"+r\"(bits));\n        v[i] = mem[indexes[i]];\n        v[j] = mem[indexes[j]];\n    }\n#else\n    // Alternative from Vc::SSE (0.7)\n    int bits = mask.toInt();\n    while (bits) {\n        const int i = _bit_scan_forward(bits);\n\tbits &= bits - 1;\n\tv[i] = mem[indexes[i]];\n    }\n#endif  // Vc_GNU_ASM\n}\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeGather(PopcntSwitchT,\n                                    V &v,\n                                    const MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 16> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low, high = 0;\n    switch (Vc::Detail::popcnt16(bits)) {\n    case 16:\n        v.gather(mem, indexes);\n        break;\n    case 15:\n        low = _bit_scan_forward(bits);\n        bits ^= 1 << low;\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 14:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 13:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 12:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 11:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 10:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 9:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 8:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 7:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 6:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 5:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 4:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 3:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 2:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        // fallthrough\n    case 1:\n        low = _bit_scan_forward(bits);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 0:\n        break;\n    }\n}\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeGather(PopcntSwitchT,\n                                    V &v,\n                                    const MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 8> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low, high = 0;\n    switch (Vc::Detail::popcnt8(bits)) {\n    case 8:\n        v.gather(mem, indexes);\n        break;\n    case 7:\n        low = _bit_scan_forward(bits);\n        bits ^= 1 << low;\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 6:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 5:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 4:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        high = (1 << high);\n        // fallthrough\n    case 3:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 2:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        // fallthrough\n    case 1:\n        low = _bit_scan_forward(bits);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 0:\n        break;\n    }\n}\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeGather(PopcntSwitchT,\n                                    V &v,\n                                    const MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 4> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low, high = 0;\n    switch (Vc::Detail::popcnt4(bits)) {\n    case 4:\n        v.gather(mem, indexes);\n        break;\n    case 3:\n        low = _bit_scan_forward(bits);\n        bits ^= 1 << low;\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 2:\n        high = _bit_scan_reverse(bits);\n        v[high] = mem[indexes[high]];\n        // fallthrough\n    case 1:\n        low = _bit_scan_forward(bits);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 0:\n        break;\n    }\n}\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeGather(PopcntSwitchT,\n                                    V &v,\n                                    const MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 2> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low;\n    switch (Vc::Detail::popcnt4(bits)) {\n    case 2:\n        v.gather(mem, indexes);\n        break;\n    case 1:\n        low = _bit_scan_forward(bits);\n        v[low] = mem[indexes[low]];\n        // fallthrough\n    case 0:\n        break;\n    }\n}\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_GATHERIMPLEMENTATION_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/gatherinterface.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef Vc_CURRENT_CLASS_NAME\n#error \"incorrect use of common/gatherinterface.h: Vc_CURRENT_CLASS_NAME must be defined to the current class name for declaring constructors.\"\n#endif\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// gathers\n// A gather takes the following arguments:\n// 1. A const pointer to memory of any type that can convert to EntryType\n// 2. An indexes “vector”. The requirement is that the type implements the subscript operator,\n//    stores «Size» valid index values, and each offset to the pointer above yields a valid\n//    memory location for reading.\n// 3. Optionally the third argument may be a mask. The mask disables several memory reads and\n//    thus removes the requirements in (2.) for the disabled entries.\n\nprivate:\n    /**\\internal\n     * This function implements a gather given a pointer to memory \\p mem and some\n     * container object storing the gather \\p indexes.\n     *\n     * \\param mem This pointer must be aligned correctly for the type \\p MT. This is the\n     * natural behavior of C++, so this is typically the case.\n     * \\param indexes This object contains at least \\VSize{T} indexes that denote the\n     * offset in \\p mem where the components for the current vector should be copied from.\n     * The offset is not in Bytes, but in multiples of `sizeof(MT)`.\n     */\n    // enable_if<std::can_convert<MT, EntryType>::value &&\n    // has_subscript_operator<IT>::value>\n    template <class MT, class IT, int Scale = 1>\n    inline void gatherImplementation(const Common::GatherArguments<MT, IT, Scale> &);\n\n    /**\\internal\n     * This overload of the above function adds a \\p mask argument to disable memory\n     * accesses at the \\p indexes offsets where \\p mask is \\c false.\n     */\n    template <class MT, class IT, int Scale = 1>\n    inline void gatherImplementation(const Common::GatherArguments<MT, IT, Scale> &,\n                                     MaskArgument mask);\n\npublic:\n#define Vc_ASSERT_GATHER_PARAMETER_TYPES_                                                \\\n    static_assert(                                                                       \\\n        std::is_convertible<MT, EntryType>::value,                                       \\\n        \"The memory pointer needs to point to a type that can be converted to the \"      \\\n        \"EntryType of this SIMD vector type.\");                                          \\\n    static_assert(                                                                       \\\n        Vc::Traits::has_subscript_operator<IT>::value,                                   \\\n        \"The indexes argument must be a type that implements the subscript operator.\");  \\\n    static_assert(                                                                       \\\n        !Traits::is_simd_vector<IT>::value ||                                            \\\n            Traits::simd_vector_size<IT>::value >= Size,                                 \\\n        \"If you use a SIMD vector for the indexes parameter, the index vector must \"     \\\n        \"have at least as many entries as this SIMD vector.\");                           \\\n    static_assert(                                                                       \\\n        !std::is_array<T>::value ||                                                      \\\n            (std::rank<T>::value == 1 &&                                                 \\\n             (std::extent<T>::value == 0 || std::extent<T>::value >= Size)),             \\\n        \"If you use a simple array for the indexes parameter, the array must have \"      \\\n        \"at least as many entries as this SIMD vector.\")\n\n    /**\n     * \\name Gather constructors and member functions\n     *\n     * Constructs or loads a vector from the objects at `mem[indexes[0]]`,\n     * `mem[indexes[1]]`, `mem[indexes[2]]`, ...\n     *\n     * All gather functions optionally take a mask as last argument. In that case only the\n     * entries that are selected in the mask are accessed in memory and copied to the\n     * vector. This enables invalid indexes in the \\p indexes vector if those are masked\n     * off in \\p mask.\n     *\n     * Gathers from structured data (AoS: arrays of struct) are possible via a special\n     * subscript operator of the container (array). You can use \\ref Vc::array and \\ref\n     * Vc::vector as drop-in replacements for \\c std::array and \\c std::vector. These\n     * container classes contain the necessary subscript operator overload. Example:\n     * \\code\n     * Vc::vector<float> data(100);\n     * std::iota(data.begin(), data.end(), 0.f);  // fill with values 0, 1, 2, ...\n     * auto indexes = float_v::IndexType::IndexesFromZero();\n     * float_v gathered = data[indexes];  // gathered == [0, 1, 2, ...]\n     * \\endcode\n     *\n     * This also works for gathers into arrays of structures:\n     * \\code\n     * struct Point { float x, y, z; };\n     * Vc::array<Point, 100> points;\n     * // fill points ...\n     * auto indexes = float_v::IndexType::IndexesFromZero();\n     * float_v xs = data[indexes][&Point::x];  // [points[0].x, points[1].x, points[2].x, ...]\n     * float_v ys = data[indexes][&Point::y];  // [points[0].y, points[1].y, points[2].y, ...]\n     * float_v zs = data[indexes][&Point::z];  // [points[0].z, points[1].z, points[2].z, ...]\n     * \\endcode\n     *\n     * Alternatively, you can use Vc::Common::AdaptSubscriptOperator to extend a given\n     * container class with the necessary subscript operator. Example:\n     * \\code\n     * template <typename T, typename Allocator = std::allocator<T>>\n     * using my_vector = Vc::Common::AdaptSubscriptOperator<std::vector<T, Allocator>>;\n     * \\endcode\n     *\n     * \\param mem A pointer to memory which contains objects of type \\p MT at the offsets\n     *            given by \\p indexes.\n     * \\param indexes A container/vector of offsets into \\p mem.\n     *                The type of \\p indexes (\\p IT) may either be a pointer to integers\n     *                (C-array) or a vector of integers (preferrably IndexType).\n     * \\param mask If a mask is given, only the active entries will be copied from memory.\n     *\n     * \\note If you use a masked gather constructor the masked-off entries of the vector\n     * are zero-initilized.\n     */\n    ///@{\n\n    /// Gather constructor\n    template <typename MT, typename IT,\n              typename = enable_if<Traits::has_subscript_operator<IT>::value>>\n    Vc_INTRINSIC Vc_CURRENT_CLASS_NAME(const MT *mem, const IT &indexes)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(\n            Common::make_gather<1>(mem, Common::convertIndexVector(indexes)));\n    }\n\n    template <class MT, class IT, int Scale>\n    Vc_INTRINSIC Vc_CURRENT_CLASS_NAME(const Common::GatherArguments<MT, IT, Scale> &args)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(args);\n    }\n\n    /// Masked gather constructor\n    template <typename MT, typename IT,\n              typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>\n    Vc_INTRINSIC Vc_CURRENT_CLASS_NAME(const MT *mem, const IT &indexes,\n                                       MaskArgument mask)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(\n            Common::make_gather<1>(mem, Common::convertIndexVector(indexes)), mask);\n    }\n\n    template <class MT, class IT, int Scale>\n    Vc_INTRINSIC Vc_CURRENT_CLASS_NAME(const Common::GatherArguments<MT, IT, Scale> &args,\n                                       MaskArgument mask)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(args, mask);\n    }\n\n    /// Gather function\n    template <typename MT, typename IT,\n              typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>\n    Vc_INTRINSIC void gather(const MT *mem, const IT &indexes)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(\n            Common::make_gather<1>(mem, Common::convertIndexVector(indexes)));\n    }\n\n    /// Masked gather function\n    template <typename MT, typename IT,\n              typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>\n    Vc_INTRINSIC void gather(const MT *mem, const IT &indexes, MaskArgument mask)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(\n            Common::make_gather<1>(mem, Common::convertIndexVector(indexes)), mask);\n    }\n    ///@}\n\n#include \"gatherinterface_deprecated.h\"\n\n    /**\\internal\n     * \\name Gather function to use from Vc::Common::subscript_operator\n     *\n     * \\param args\n     * \\param mask\n     */\n    ///@{\n    template <class MT, class IT, int Scale>\n    Vc_INTRINSIC void gather(const Common::GatherArguments<MT, IT, Scale> &args)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(args);\n    }\n\n    template <class MT, class IT, int Scale>\n    Vc_INTRINSIC void gather(const Common::GatherArguments<MT, IT, Scale> &args,\n                             MaskArgument mask)\n    {\n        Vc_ASSERT_GATHER_PARAMETER_TYPES_;\n        gatherImplementation(args, mask);\n    }\n    ///@}\n\n#undef Vc_ASSERT_GATHER_PARAMETER_TYPES_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/gatherinterface_deprecated.h",
    "content": "    /// \\name Deprecated Members\n    ///@{\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     */\n    template <typename S1, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline Vc_CURRENT_CLASS_NAME(const S1 *array,\n                                                           const EntryType S1::*member1,\n                                                           IT indexes)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1]\n                   .gatherArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline Vc_CURRENT_CLASS_NAME(const S1 *array,\n                                                           const EntryType S1::*member1,\n                                                           IT indexes, MaskArgument mask)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1]\n                   .gatherArguments(),\n               mask);\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param member2 If \\p member1 is a struct then \\p member2 selects the member to be read from that\n     *                struct (i.e. array[i].*member1.*member2 is read).\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     */\n    template <typename S1, typename S2, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline Vc_CURRENT_CLASS_NAME(const S1 *array,\n                                                           const S2 S1::*member1,\n                                                           const EntryType S2::*member2,\n                                                           IT indexes)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1][member2]\n                   .gatherArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param member2 If \\p member1 is a struct then \\p member2 selects the member to be read from that\n     *                struct (i.e. array[i].*member1.*member2 is read).\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename S2, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline Vc_CURRENT_CLASS_NAME(const S1 *array,\n                                                           const S2 S1::*member1,\n                                                           const EntryType S2::*member2,\n                                                           IT indexes, MaskArgument mask)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1][member2]\n                   .gatherArguments(),\n               mask);\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param ptrMember1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param outerIndexes\n     * \\param innerIndexes\n     */\n    template <typename S1, typename IT1, typename IT2>\n    Vc_DEPRECATED(\n        \"use the subscript operator to Vc::array or Vc::vector \"\n        \"instead.\") inline Vc_CURRENT_CLASS_NAME(const S1 *array,\n                                                 const EntryType *const S1::*ptrMember1,\n                                                 IT1 outerIndexes, IT2 innerIndexes)\n    {\n        gather(Common::SubscriptOperation<const S1, IT1, std::ratio<1, 1>, true>(\n                   array, outerIndexes)[ptrMember1][innerIndexes]\n                   .gatherArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param ptrMember1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param outerIndexes\n     * \\param innerIndexes\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename IT1, typename IT2>\n    Vc_DEPRECATED(\n        \"use the subscript operator to Vc::array or Vc::vector \"\n        \"instead.\") inline Vc_CURRENT_CLASS_NAME(const S1 *array,\n                                                 const EntryType *const S1::*ptrMember1,\n                                                 IT1 outerIndexes, IT2 innerIndexes,\n                                                 MaskArgument mask)\n    {\n        gather(Common::SubscriptOperation<const S1, IT1, std::ratio<1, 1>, true>(\n                   array, outerIndexes)[ptrMember1][innerIndexes]\n                   .gatherArguments(),\n               mask);\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     */\n    template <typename S1, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void gather(const S1 *array,\n                                                 const EntryType S1::*member1, IT indexes)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1]\n                   .gatherArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void gather(const S1 *array,\n                                                 const EntryType S1::*member1,\n                                                 IT indexes,\n                                                 MaskArgument mask)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1]\n                   .gatherArguments(),\n               mask);\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param member2 If \\p member1 is a struct then \\p member2 selects the member to be read from that\n     *                struct (i.e. array[i].*member1.*member2 is read).\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     */\n    template <typename S1, typename S2, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void gather(const S1 *array, const S2 S1::*member1,\n                                                 const EntryType S2::*member2, IT indexes)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1][member2]\n                   .gatherArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param member2 If \\p member1 is a struct then \\p member2 selects the member to be read from that\n     *                struct (i.e. array[i].*member1.*member2 is read).\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename S2, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void gather(const S1 *array, const S2 S1::*member1,\n                                                 const EntryType S2::*member2, IT indexes,\n                                                 MaskArgument mask)\n    {\n        gather(Common::SubscriptOperation<const S1, IT, std::ratio<1, 1>, true>(\n                   array, indexes)[member1][member2]\n                   .gatherArguments(),\n               mask);\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param ptrMember1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param outerIndexes\n     * \\param innerIndexes\n     */\n    template <typename S1, typename IT1, typename IT2>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void gather(const S1 *array,\n                                                 const EntryType *const S1::*ptrMember1,\n                                                 IT1 outerIndexes, IT2 innerIndexes)\n    {\n        gather(Common::SubscriptOperation<const S1, IT1, std::ratio<1, 1>, true>(\n                   array, outerIndexes)[ptrMember1][innerIndexes]\n                   .gatherArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param ptrMember1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param outerIndexes\n     * \\param innerIndexes\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename IT1, typename IT2>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void gather(const S1 *array,\n                                                 const EntryType *const S1::*ptrMember1,\n                                                 IT1 outerIndexes, IT2 innerIndexes,\n                                                 MaskArgument mask)\n    {\n        gather(Common::SubscriptOperation<const S1, IT1, std::ratio<1, 1>, true>(\n                   array, outerIndexes)[ptrMember1][innerIndexes]\n                   .gatherArguments(),\n               mask);\n    }\n    ///@}\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/generalinterface.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\npublic:\n    ///////////////////////////////////////////////////////////////////////////\n    // init to zero\n    Vc_INTRINSIC Vector() = default;\n\n    ///////////////////////////////////////////////////////////////////////////\n    // types\n\n    ///////////////////////////////////////////////////////////////////////////\n    // constants\n    static constexpr std::size_t size() { return Size; }\n\n    ///////////////////////////////////////////////////////////////////////////\n    // constant Vectors\n    explicit Vc_INTRINSIC_L Vector(VectorSpecialInitializerZero) Vc_INTRINSIC_R;\n    explicit Vc_INTRINSIC_L Vector(VectorSpecialInitializerOne) Vc_INTRINSIC_R;\n    explicit Vc_INTRINSIC_L Vector(VectorSpecialInitializerIndexesFromZero) Vc_INTRINSIC_R;\n    static Vc_INTRINSIC Vc_CONST Vector Zero() { return Vector(Vc::Zero); }\n    static Vc_INTRINSIC Vc_CONST Vector One() { return Vector(Vc::One); }\n    static Vc_INTRINSIC Vc_CONST Vector IndexesFromZero()\n    {\n        return Vector(Vc::IndexesFromZero);\n    }\n\n    ///////////////////////////////////////////////////////////////////////////\n    // generator ctor\n    template <class G, int = 0,\n              class = typename std::enable_if<std::is_convertible<\n                  decltype(std::declval<G>()(size_t())), value_type>::value>::type>\n    explicit Vector(G &&g) : Vector(generate(std::forward<G>(g)))\n    {\n    }\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/iif.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_IIF_H_\n#define VC_COMMON_IIF_H_\n\n#include \"../type_traits\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * \\ingroup Utilities\n *\n * Function to mimic the ternary operator '?:' (inline-if).\n *\n * \\param condition  Determines which values are returned. This is analog to the first argument to\n *                   the ternary operator.\n * \\param trueValue  The values to return where \\p condition is \\c true.\n * \\param falseValue The values to return where \\p condition is \\c false.\n * \\return A combination of entries from \\p trueValue and \\p falseValue, according to \\p condition.\n *\n * So instead of the scalar variant\n * \\code\n * float x = a > 1.f ? b : b + c;\n * \\endcode\n * you'd write\n * \\code\n * float_v x = Vc::iif (a > 1.f, b, b + c);\n * \\endcode\n *\n * Assuming \\c a has the values [0, 3, 5, 1], \\c b is [1, 1, 1, 1], and \\c c is [1, 2, 3, 4], then x\n * will be [2, 2, 3, 5].\n */\ntemplate <typename Mask, typename T>\nVc_ALWAYS_INLINE enable_if<is_simd_mask<Mask>::value && is_simd_vector<T>::value, T> iif(\n    const Mask &condition, const T &trueValue, const T &falseValue)\n{\n    T result(falseValue);\n    Vc::where(condition) | result = trueValue;\n    return result;\n}\n\n/**\\internal\n * The following declaration makes it explicit that `iif (Mask, non-vector, non-vector)`\n * is not supposed to work. Doing the same thing with \\c static_assert would break SFINAE.\n */\ntemplate <typename Mask, typename T>\nenable_if<is_simd_mask<Mask>::value && !is_simd_vector<T>::value, T> iif(\n    const Mask &, const T &, const T &) = delete;\n\n/**\n * \\ingroup Utilities\n *\n * Overload of the above for boolean conditions.\n *\n * This typically results in direct use of the ternary operator. This function makes it easier to\n * switch from a Vc type to a builtin type.\n *\n * \\param condition  Determines which value is returned. This is analog to the first argument to\n *                   the ternary operator.\n * \\param trueValue  The value to return if \\p condition is \\c true.\n * \\param falseValue The value to return if \\p condition is \\c false.\n * \\return Either \\p trueValue or \\p falseValue, depending on \\p condition.\n */\ntemplate<typename T> constexpr T iif (bool condition, const T &trueValue, const T &falseValue)\n{\n    return condition ? trueValue : falseValue;\n}\n\n}  // namespace Vc\n\n#endif // VC_COMMON_IIF_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/indexsequence.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_INDEXSEQUENCE_H_\n#define VC_COMMON_INDEXSEQUENCE_H_\n\n#include \"../global.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/** \\internal\n * Helper class for a sequence of size_t values from 0 to N. This type will be included in\n * C++14.\n */\ntemplate <std::size_t... I> struct index_sequence\n{\n    static constexpr std::size_t size() noexcept { return sizeof...(I); }\n};\n\n/** \\internal\n * This struct builds an index_sequence type from a given upper bound \\p N.\n * It does so recursively via concatenation of to index sequences of length N/2.\n */\ntemplate <std::size_t N> struct make_index_sequence_impl {\n    template <std::size_t Offset, std::size_t... Ns>\n    static index_sequence<Ns..., (Ns + Offset)...> join(std::false_type,\n                                                        index_sequence<Ns...>);\n    template <std::size_t Offset, std::size_t... Ns>\n    static index_sequence<Ns..., Offset - 1, (Ns + Offset)...> join(\n        std::true_type, index_sequence<Ns...>);\n\n    using is_odd = std::integral_constant<bool, N & 1>;\n    using half = typename make_index_sequence_impl<N / 2>::type;\n    using type = decltype(join<(N + 1) / 2>(is_odd(), half()));\n};\ntemplate <> struct make_index_sequence_impl<0> {\n    using type = index_sequence<>;\n};\ntemplate <> struct make_index_sequence_impl<1> {\n    using type = index_sequence<0>;\n};\ntemplate <> struct make_index_sequence_impl<2> {\n    using type = index_sequence<0, 1>;\n};\n\n/** \\internal\n * Creates an index_sequence type for the upper bound \\p N.\n */\ntemplate <std::size_t N>\nusing make_index_sequence = typename make_index_sequence_impl<N>::type;\n}\n\n#endif  // VC_COMMON_INDEXSEQUENCE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/interleave.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_INTERLEAVE_H_\n#define VC_COMMON_INTERLEAVE_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/** \\ingroup Utilities\n Interleaves the entries from \\p a and \\p b into two vectors of the same type. The order\n in the returned vector contains the elements `a[0], b[0], a[1], b[1], a[2], b[2], a[3],\n b[3], ...`.\n\nExample:\n\\code\nVc::SimdArray<int, 4> a = { 1, 2, 3, 4 };\nVc::SimdArray<int, 4> b = { 9, 8, 7, 6 };\nstd::tie(a, b) = Vc::interleave(a, b);\nstd::cout << a << b;\n// prints:\n// <1 9 2 8><3 7 4 6>\n\\endcode\n\n \\param a input vector whose data will appear at even indexes in the output\n \\param b input vector whose data will appear at odd indexes in the output\n \\return two vectors with data from \\p a and \\p b interleaved\n */\ntemplate <typename V, typename = enable_if<Traits::is_simd_vector<V>::value>>\nstd::pair<V, V> interleave(const V &a, const V &b)\n{\n    return {a.interleaveLow(b), a.interleaveHigh(b)};\n}\n}  // namespace Vc\n\n#endif  // VC_COMMON_INTERLEAVE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/interleavedmemory.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_INTERLEAVEDMEMORY_H_\n#define VC_COMMON_INTERLEAVEDMEMORY_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n/**\n * \\internal\n */\ntemplate<typename V, typename I, bool Readonly> struct InterleavedMemoryAccessBase\n{\n    // Partial specialization doesn't work for functions without partial specialization of the whole\n    // class. Therefore we capture the contents of InterleavedMemoryAccessBase in a macro to easily\n    // copy it into its specializations.\n    typedef typename std::conditional<\n        Readonly, typename std::add_const<typename V::EntryType>::type,\n        typename V::EntryType>::type T;\n    typedef typename V::AsArg VArg;\n    typedef T Ta Vc_MAY_ALIAS;\n    const I m_indexes;\n    Ta *const m_data;\n\n    Vc_ALWAYS_INLINE InterleavedMemoryAccessBase(typename I::AsArg indexes, Ta *data)\n        : m_indexes(indexes), m_data(data)\n    {\n    }\n\n    // implementations of the following are in {scalar,sse,avx}/detail.h\n    template <typename... Vs> Vc_INTRINSIC void deinterleave(Vs &&... vs) const\n    {\n        Impl::deinterleave(m_data, m_indexes, std::forward<Vs>(vs)...);\n    }\n\nprotected:\n    using Impl = Vc::Detail::InterleaveImpl<V, V::Size, sizeof(V)>;\n\n    template <typename T, std::size_t... Indexes>\n    Vc_INTRINSIC void callInterleave(T &&a, index_sequence<Indexes...>)\n    {\n        Impl::interleave(m_data, m_indexes, a[Indexes]...);\n    }\n};\n\n/**\n * \\internal\n */\n// delay execution of the deinterleaving gather until operator=\ntemplate <size_t StructSize, typename V, typename I = typename V::IndexType,\n          bool Readonly>\nstruct InterleavedMemoryReadAccess : public InterleavedMemoryAccessBase<V, I, Readonly>\n{\n    typedef InterleavedMemoryAccessBase<V, I, Readonly> Base;\n    typedef typename Base::Ta Ta;\n\n    Vc_ALWAYS_INLINE InterleavedMemoryReadAccess(Ta *data, typename I::AsArg indexes)\n        : Base(StructSize == 1u\n                   ? indexes\n                   : StructSize == 2u\n                         ? indexes << 1\n                         : StructSize == 4u\n                               ? indexes << 2\n                               : StructSize == 8u\n                                     ? indexes << 3\n                                     : StructSize == 16u ? indexes << 4\n                                                         : indexes * I(int(StructSize)),\n               data)\n    {\n    }\n\n    template <typename T, std::size_t... Indexes>\n    Vc_ALWAYS_INLINE T deinterleave_unpack(index_sequence<Indexes...>) const\n    {\n        T r;\n        Base::Impl::deinterleave(this->m_data, this->m_indexes, std::get<Indexes>(r)...);\n        return r;\n    }\n\n    template <typename T,\n              typename = enable_if<(std::is_default_constructible<T>::value &&\n                                    std::is_same<V, Traits::decay<decltype(std::get<0>(\n                                                        std::declval<T &>()))>>::value)>>\n    Vc_ALWAYS_INLINE operator T() const\n    {\n        return deinterleave_unpack<T>(make_index_sequence<std::tuple_size<T>::value>());\n    }\n};\n\n///\\internal Runtime check (NDEBUG) for asserting unique indexes.\ntemplate<typename I> struct CheckIndexesUnique\n{\n#ifdef NDEBUG\n    static Vc_INTRINSIC void test(const I &) {}\n#else\n    static void test(const I &indexes)\n    {\n        const I test = indexes.sorted();\n        Vc_ASSERT(I::Size == 1 || (test == test.rotated(1)).isEmpty())\n    }\n#endif\n};\n///\\internal For SuccessiveEntries there can never be a problem.\ntemplate<size_t S> struct CheckIndexesUnique<SuccessiveEntries<S> >\n{\n    static Vc_INTRINSIC void test(const SuccessiveEntries<S> &) {}\n};\n\n/**\n * \\internal\n */\ntemplate <size_t StructSize, typename V, typename I = typename V::IndexType>\nstruct InterleavedMemoryAccess : public InterleavedMemoryReadAccess<StructSize, V, I, false>\n{\n    typedef InterleavedMemoryAccessBase<V, I, false> Base;\n    typedef typename Base::Ta Ta;\n\n    Vc_ALWAYS_INLINE InterleavedMemoryAccess(Ta *data, typename I::AsArg indexes)\n        : InterleavedMemoryReadAccess<StructSize, V, I, false>(data, indexes)\n    {\n        CheckIndexesUnique<I>::test(indexes);\n    }\n\n    template <int N> Vc_ALWAYS_INLINE void operator=(VectorReferenceArray<N, V> &&rhs)\n    {\n        static_assert(N <= StructSize,\n                      \"You_are_trying_to_scatter_more_data_into_the_struct_than_it_has\");\n        this->callInterleave(std::move(rhs), make_index_sequence<N>());\n    }\n    template <int N> Vc_ALWAYS_INLINE void operator=(VectorReferenceArray<N, const V> &&rhs)\n    {\n        static_assert(N <= StructSize,\n                      \"You_are_trying_to_scatter_more_data_into_the_struct_than_it_has\");\n        this->callInterleave(std::move(rhs), make_index_sequence<N>());\n    }\n};\n\n/**\n * Wraps a pointer to memory with convenience functions to access it via vectors.\n *\n * \\param S The type of the struct.\n * \\param V The type of the vector to be returned when read. This should reflect the type of the\n * members inside the struct.\n *\n * \\see operator[]\n * \\ingroup Containers\n * \\headerfile interleavedmemory.h <Vc/Memory>\n */\ntemplate<typename S, typename V> class InterleavedMemoryWrapper\n{\n    typedef typename std::conditional<std::is_const<S>::value,\n                                      const typename V::EntryType,\n                                      typename V::EntryType>::type T;\n    typedef typename V::IndexType I;\n    typedef typename V::AsArg VArg;\n    typedef const I &IndexType;\n    static constexpr std::size_t StructSize = sizeof(S) / sizeof(T);\n    using ReadAccess = InterleavedMemoryReadAccess<StructSize, V>;\n    using Access =\n        typename std::conditional<std::is_const<T>::value, ReadAccess,\n                                  InterleavedMemoryAccess<StructSize, V>>::type;\n    using ReadSuccessiveEntries =\n        InterleavedMemoryReadAccess<StructSize, V, SuccessiveEntries<StructSize>>;\n    using AccessSuccessiveEntries = typename std::conditional<\n        std::is_const<T>::value, ReadSuccessiveEntries,\n        InterleavedMemoryAccess<StructSize, V, SuccessiveEntries<StructSize>>>::type;\n    typedef T Ta Vc_MAY_ALIAS;\n    Ta *const m_data;\n\n    static_assert(StructSize * sizeof(T) == sizeof(S),\n                  \"InterleavedMemoryAccess_does_not_support_packed_structs\");\n\npublic:\n    /**\n     * Constructs the wrapper object.\n     *\n     * \\param s A pointer to a C-array.\n     */\n    Vc_ALWAYS_INLINE InterleavedMemoryWrapper(S *s)\n        : m_data(reinterpret_cast<Ta *>(s))\n    {\n    }\n\n    /**\n     * Interleaved scatter/gather access.\n     *\n     * Assuming you have a struct of floats and a vector of \\p indexes into the array, this function\n     * can be used to access the struct entries as vectors using the minimal number of store or load\n     * instructions.\n     *\n     * \\param indexes Vector of indexes that determine the gather locations.\n     *\n     * \\return A special (magic) object that executes the loads and deinterleave on assignment to a\n     * vector tuple.\n     *\n     * Example:\n     * \\code\n     * struct Foo {\n     *   float x, y, z;\n     * };\n     *\n     * void fillWithBar(Foo *_data, uint_v indexes)\n     * {\n     *   Vc::InterleavedMemoryWrapper<Foo, float_v> data(_data);\n     *   const float_v x = bar(1);\n     *   const float_v y = bar(2);\n     *   const float_v z = bar(3);\n     *   data[indexes] = (x, y, z);\n     *   // it's also possible to just store a subset at the front of the struct:\n     *   data[indexes] = (x, y);\n     *   // if you want to store a single entry, use scatter:\n     *   z.scatter(_data, &Foo::x, indexes);\n     * }\n     *\n     * float_v normalizeStuff(Foo *_data, uint_v indexes)\n     * {\n     *   Vc::InterleavedMemoryWrapper<Foo, float_v> data(_data);\n     *   float_v x, y, z;\n     *   (x, y, z) = data[indexes];\n     *   // it is also possible to just load a subset from the front of the struct:\n     *   // (x, y) = data[indexes];\n     *   return Vc::sqrt(x * x + y * y + z * z);\n     * }\n     * \\endcode\n     *\n     * You may think of the gather operation (or scatter as the inverse) like this:\n\\verbatim\n             Memory: {x0 y0 z0 x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4 x5 y5 z5 x6 y6 z6 x7 y7 z7 x8 y8 z8}\n            indexes: [5, 0, 1, 7]\nResult in (x, y, z): ({x5 x0 x1 x7}, {y5 y0 y1 y7}, {z5 z0 z1 z7})\n\\endverbatim\n     *\n     * \\warning If \\p indexes contains non-unique entries on scatter, the result is undefined. If\n     * \\c NDEBUG is not defined the implementation will assert that the \\p indexes entries are unique.\n     */\n    template <typename IT>\n    Vc_ALWAYS_INLINE enable_if<!std::is_convertible<IT, size_t>::value &&\n                                   std::is_convertible<IT, IndexType>::value &&\n                                   !std::is_const<S>::value,\n                               Access>\n    operator[](IT indexes)\n    {\n        return Access(m_data, indexes);\n    }\n\n    /// const overload (gathers only) of the above function\n    Vc_ALWAYS_INLINE ReadAccess operator[](IndexType indexes) const\n    {\n        return ReadAccess(m_data, indexes);\n    }\n\n    /// alias of the above function\n    Vc_ALWAYS_INLINE ReadAccess gather(IndexType indexes) const { return operator[](indexes); }\n\n    /**\n     * Interleaved access.\n     *\n     * This function is an optimization of the function above, for cases where the index vector\n     * contains consecutive values. It will load \\p V::Size consecutive entries from memory and\n     * deinterleave them into Vc vectors.\n     *\n     * \\param first The first of \\p V::Size indizes to be accessed.\n     *\n     * \\return A special (magic) object that executes the loads and deinterleave on assignment to a\n     * vector tuple.\n     *\n     * Example:\n     * \\code\n     * struct Foo {\n     *   float x, y, z;\n     * };\n     *\n     * void foo(Foo *_data)\n     * {\n     *   Vc::InterleavedMemoryWrapper<Foo, float_v> data(_data);\n     *   for (size_t i = 0; i < 32U; i += float_v::Size) {\n     *     float_v x, y, z;\n     *     (x, y, z) = data[i];\n     *     // now:\n     *     // x = { _data[i].x, _data[i + 1].x, _data[i + 2].x, ... }\n     *     // y = { _data[i].y, _data[i + 1].y, _data[i + 2].y, ... }\n     *     // z = { _data[i].z, _data[i + 1].z, _data[i + 2].z, ... }\n     *     ...\n     *   }\n     * }\n     * \\endcode\n     */\n    Vc_ALWAYS_INLINE ReadSuccessiveEntries operator[](size_t first) const\n    {\n        return ReadSuccessiveEntries(m_data, first);\n    }\n\n    Vc_ALWAYS_INLINE AccessSuccessiveEntries operator[](size_t first)\n    {\n        return AccessSuccessiveEntries(m_data, first);\n    }\n\n    //Vc_ALWAYS_INLINE Access scatter(I indexes, VArg v0, VArg v1);\n};\n}  // namespace Common\n\nusing Common::InterleavedMemoryWrapper;\n\n/**\n * Creates an adapter around a given array of structure (AoS) that enables optimized loads\n * + deinterleaving operations / interleaving operations + stores for vector access (using\n * \\p V).\n *\n * \\tparam V The `Vc::Vector<T>` type to use per element of the structure.\n * \\param s A pointer to an array of structures containing data members of type `T`.\n *\n * \\see Vc::Common::InterleavedMemoryWrapper\n *\n * \\todo Support destructuring via structured bindings.\n */\ntemplate <typename V, typename S>\ninline Common::InterleavedMemoryWrapper<S, V> make_interleave_wrapper(S *s)\n{\n    return Common::InterleavedMemoryWrapper<S, V>(s);\n}\n}  // namespace Vc\n\n#endif // VC_COMMON_INTERLEAVEDMEMORY_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/iterators.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_ITERATORS_H_\n#define VC_COMMON_ITERATORS_H_\n\n#include <array>\n#include <iterator>\n#ifdef Vc_MSVC\n#include <intrin.h> // for _BitScanForward\n#endif  // Vc_MSVC\n#include \"where.h\"\n#include \"elementreference.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\ntemplate<typename _V, typename Flags> class MemoryVector;\ntemplate<typename _V, typename Flags> class MemoryVectorIterator;\n\ntemplate <typename V> class Iterator;\ntemplate <typename V, bool> class IteratorBase;\ntemplate <typename V> class IteratorBase<V, true>\n{\npublic:\n    using iterator_category = std::input_iterator_tag;\n    using value_type = typename V::value_type;\n    using difference_type = int;\n    using reference = value_type;\n    Vc_ALWAYS_INLINE reference operator*() const { return v()[i()]; }\n    Vc_ALWAYS_INLINE reference operator[](difference_type i2) const { return v()[i2]; }\n\nprivate:\n    Vc_INTRINSIC V &v() const { return *static_cast<const Iterator<V> *>(this)->v; }\n    Vc_INTRINSIC difference_type i() const\n    {\n        return static_cast<const Iterator<V> *>(this)->i;\n    }\n};\n\ntemplate <typename V> class IteratorBase<V, false>\n{\npublic:\n    using iterator_category = std::input_iterator_tag;\n    using value_type = typename V::value_type;\n    using difference_type = int;\n    using reference = Vc::Detail::ElementReference<V, IteratorBase>;\n    Vc_ALWAYS_INLINE reference operator*() const { return {*v(), i()}; }\n    Vc_ALWAYS_INLINE reference operator[](difference_type i2) const { return {*v(), i2}; }\n\nprivate:\n    Vc_INTRINSIC V *v() const { return static_cast<const Iterator<V> *>(this)->v; }\n    Vc_INTRINSIC difference_type i() const\n    {\n        return static_cast<const Iterator<V> *>(this)->i;\n    }\n\n    friend reference;\n    static Vc_INTRINSIC value_type get(const V &o, int i)\n    {\n        return o[i];\n    }\n    template <typename T> static Vc_INTRINSIC void set(V &o, int i, T &&v)\n    {\n        o[i] = std::forward<T>(v);\n    }\n};\n\n// class Iterator {{{\ntemplate <typename V> class Iterator : public IteratorBase<V, std::is_const<V>::value>\n{\n    using Base = IteratorBase<V, std::is_const<V>::value>;\n    friend Base;\n\npublic:\n    using typename Base::iterator_category;\n    using typename Base::value_type;\n    using typename Base::difference_type;\n    using pointer = const Iterator *;\n    using typename Base::reference;\n\n    constexpr Iterator() = default;\n    constexpr Iterator(V &_v, difference_type _i) : v(&_v), i(_i) {}\n    // rely on implicit copy constructor/assignment\n\n    Vc_ALWAYS_INLINE pointer operator->() const { return this; }\n    using Base::operator*;\n\n    Vc_ALWAYS_INLINE Iterator &operator++()    { ++i; return *this; }\n    Vc_ALWAYS_INLINE Iterator  operator++(int) { Iterator tmp = *this; ++i; return tmp; }\n\n    // bidirectional iteration is supported\n    Vc_ALWAYS_INLINE Iterator &operator--()    { --i; return *this; }\n    Vc_ALWAYS_INLINE Iterator  operator--(int) { Iterator tmp = *this; --i; return tmp; }\n\n    // RandomAccessIterator:\n    using Base::operator[];\n    Vc_ALWAYS_INLINE Iterator &operator+=(difference_type d) { i += d; return *this; }\n    Vc_ALWAYS_INLINE Iterator &operator-=(difference_type d) { i -= d; return *this; }\n    Vc_ALWAYS_INLINE Iterator operator+(difference_type d) const { return {*v, i + d}; }\n    Vc_ALWAYS_INLINE Iterator operator-(difference_type d) const { return {*v, i - d}; }\n    Vc_ALWAYS_INLINE difference_type operator-(const Iterator &rhs) const { return i - rhs.i; }\n    friend Vc_ALWAYS_INLINE Iterator operator+(difference_type d, const Iterator &rhs)\n    {\n        return {*rhs.v, rhs.i + d};\n    }\n\n    // InputIterator would not need to test v == rhs.v, but except for `reference` this\n    // class implements a complete RandomAccessIterator\n    Vc_ALWAYS_INLINE bool operator==(const Iterator<V> &rhs) const { return v == rhs.v && i == rhs.i; }\n    Vc_ALWAYS_INLINE bool operator!=(const Iterator<V> &rhs) const { return v == rhs.v && i != rhs.i; }\n    Vc_ALWAYS_INLINE bool operator< (const Iterator<V> &rhs) const { return v == rhs.v && i <  rhs.i; }\n    Vc_ALWAYS_INLINE bool operator<=(const Iterator<V> &rhs) const { return v == rhs.v && i <= rhs.i; }\n    Vc_ALWAYS_INLINE bool operator> (const Iterator<V> &rhs) const { return v == rhs.v && i >  rhs.i; }\n    Vc_ALWAYS_INLINE bool operator>=(const Iterator<V> &rhs) const { return v == rhs.v && i >= rhs.i; }\n\nprivate:\n    V *v = nullptr;\n    difference_type i = 0;\n};/*}}}*/\n\ntemplate <typename V> using ConstIterator = Iterator<const V>;\n\n    class BitmaskIterator/*{{{*/\n    {\n#ifdef Vc_MSVC\n        unsigned long mask;\n        unsigned long bit;\n#else\n        size_t mask;\n        size_t bit;\n#endif\n\n        void nextBit()\n        {\n#ifdef Vc_GNU_ASM\n            bit = __builtin_ctzl(mask);\n#elif defined(Vc_MSVC)\n            _BitScanForward(&bit, mask);\n#else\n#error \"Not implemented yet. Please contact vc-devel@compeng.uni-frankfurt.de\"\n#endif\n        }\n        void resetLsb()\n        {\n            // 01100100 - 1 = 01100011\n            mask &= (mask - 1);\n            /*\n#ifdef Vc_GNU_ASM\n            __asm__(\"btr %1,%0\" : \"+r\"(mask) : \"r\"(bit));\n#elif defined(_WIN64)\n            _bittestandreset64(&mask, bit);\n#elif defined(_WIN32)\n            _bittestandreset(&mask, bit);\n#else\n#error \"Not implemented yet. Please contact vc-devel@compeng.uni-frankfurt.de\"\n#endif\n            */\n        }\n    public:\n        BitmaskIterator(decltype(mask) m) : mask(m) { nextBit(); }\n        BitmaskIterator(const BitmaskIterator &) = default;\n        BitmaskIterator(BitmaskIterator &&) = default;\n\n        Vc_ALWAYS_INLINE size_t operator->() const { return bit; }\n        Vc_ALWAYS_INLINE size_t operator*() const { return bit; }\n\n        Vc_ALWAYS_INLINE BitmaskIterator &operator++()    { resetLsb(); nextBit(); return *this; }\n        Vc_ALWAYS_INLINE BitmaskIterator  operator++(int) { BitmaskIterator tmp = *this; resetLsb(); nextBit(); return tmp; }\n\n        Vc_ALWAYS_INLINE bool operator==(const BitmaskIterator &rhs) const { return mask == rhs.mask; }\n        Vc_ALWAYS_INLINE bool operator!=(const BitmaskIterator &rhs) const { return mask != rhs.mask; }\n    };/*}}}*/\n\ntemplate <typename T>\nVc_ALWAYS_INLINE\n    enable_if<Traits::is_simd_vector<T>::value || Traits::is_simd_mask<T>::value,\n              Iterator<typename std::remove_reference<T>::type>>\n    begin(T &&x)\n{\n    return {std::forward<T>(x), 0};\n}\n\ntemplate <typename T>\nVc_ALWAYS_INLINE\n    enable_if<Traits::is_simd_vector<T>::value || Traits::is_simd_mask<T>::value,\n              Iterator<typename std::remove_reference<T>::type>>\n    end(T &&x)\n{\n    using TT = typename std::decay<T>::type;\n    return {std::forward<T>(x), int(TT::size())};\n}\n\ntemplate <typename T>\nVc_ALWAYS_INLINE enable_if<\n    Traits::is_simd_mask<T>::value || Traits::is_simd_vector<T>::value, ConstIterator<T>>\ncbegin(const T &v)\n{\n    return {v, 0};\n}\n\ntemplate <typename T>\nVc_ALWAYS_INLINE enable_if<\n    Traits::is_simd_mask<T>::value || Traits::is_simd_vector<T>::value, ConstIterator<T>>\ncend(const T &v)\n{\n    return {v, int(T::size())};\n}\n\ntemplate<typename M> Vc_ALWAYS_INLINE BitmaskIterator begin(const WhereImpl::WhereMask<M> &w)\n{\n    return w.mask.toInt();\n}\n\ntemplate<typename M> Vc_ALWAYS_INLINE BitmaskIterator end(const WhereImpl::WhereMask<M> &)\n{\n    return 0;\n}\n\ntemplate<typename V, typename Flags, typename T> Vc_ALWAYS_INLINE MemoryVectorIterator<V, Flags>\n    makeIterator(T *mem, Flags)\n{\n    return new(mem) MemoryVector<V, Flags>;\n}\n\ntemplate<typename V, typename Flags, typename T> Vc_ALWAYS_INLINE MemoryVectorIterator<const V, Flags>\n    makeIterator(const T *mem, Flags)\n{\n    return new(const_cast<T *>(mem)) MemoryVector<const V, Flags>;\n}\n\ntemplate<typename V, typename Flags, typename FlagsX> Vc_ALWAYS_INLINE MemoryVectorIterator<V, Flags>\n    makeIterator(MemoryVector<V, FlagsX> &mv, Flags)\n{\n    return new(&mv) MemoryVector<V, Flags>;\n}\n\ntemplate<typename V, typename Flags, typename FlagsX> Vc_ALWAYS_INLINE MemoryVectorIterator<const V, Flags>\n    makeIterator(MemoryVector<const V, FlagsX> &mv, Flags)\n{\n    return new(&mv) MemoryVector<const V, Flags>;\n}\n\n}  // namespace Common\n\nusing Common::begin;\nusing Common::end;\nusing Common::cbegin;\nusing Common::cend;\nusing Common::makeIterator;\n}  // namespace Vc\n\n#endif // VC_COMMON_ITERATORS_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/loadinterface.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n// load ctors{{{1\n/**\n * Construct a vector from loading its entries from the array at \\p mem.\n *\n * \\param mem A pointer to data. The pointer must not be aligned on a\n *            MemoryAlignment boundary unless you add the Vc::Aligned flag as a second\n *            argument.\n */\nexplicit Vc_INTRINSIC Vector(const EntryType *mem)\n{\n    load(mem);\n}\n/**\n * Construct a vector from loading its entries from the array at \\p mem.\n *\n * \\param mem A pointer to data. If \\p flags contains the Vc::Aligned flag, the pointer\n *            must be aligned on a MemoryAlignment boundary.\n * \\param flags A (combination of) flag object(s), such as Vc::Aligned, Vc::Streaming,\n *              Vc::Unaligned, and/or Vc::PrefetchDefault.\n */\ntemplate <typename Flags, typename = enable_if<Traits::is_load_store_flag<Flags>::value>>\nexplicit Vc_INTRINSIC Vector(const EntryType *mem, Flags flags)\n{\n    load(mem, flags);\n}\n\ntemplate <typename U, typename Flags = DefaultLoadTag,\n          typename = enable_if<\n              (!std::is_integral<U>::value || !std::is_integral<EntryType>::value ||\n               sizeof(EntryType) >= sizeof(U)) &&\n              std::is_arithmetic<U>::value &&Traits::is_load_store_flag<Flags>::value>>\nexplicit Vc_INTRINSIC Vector(const U *x, Flags flags = Flags())\n{\n    load<U, Flags>(x, flags);\n}\n\n// load member functions{{{1\n/**\n * Load the vector entries from \\p mem, overwriting the previous values.\n *\n * \\param mem\n * A pointer to data. The pointer must not be aligned on a MemoryAlignment boundary unless\n * you add the Vc::Aligned flag as a second argument.\n */\nVc_INTRINSIC void load(const EntryType *mem)\n{\n    load(mem, DefaultLoadTag());\n}\n/**\n * Load the vector entries from \\p mem, overwriting the previous values.\n *\n * \\param mem\n * A pointer to data. If \\p flags contains the Vc::Aligned flag, the pointer must be\n * aligned on a MemoryAlignment boundary.\n * \\param flags\n * A (combination of) flag object(s), such as Vc::Aligned, Vc::Streaming, Vc::Unaligned,\n * and/or Vc::PrefetchDefault.\n */\ntemplate <typename Flags>\nVc_INTRINSIC enable_if<Traits::is_load_store_flag<Flags>::value, void>\nload(const EntryType *mem, Flags flags)\n{\n    load<EntryType, Flags>(mem, flags);\n}\nprivate:\ntemplate <typename U, typename Flags>\nstruct load_concept : public std::enable_if<\n              (!std::is_integral<U>::value || !std::is_integral<EntryType>::value ||\n               sizeof(EntryType) >= sizeof(U)) &&\n              std::is_arithmetic<U>::value && Traits::is_load_store_flag<Flags>::value, void>\n{};\n\npublic:\ntemplate <typename U, typename Flags = DefaultLoadTag>\nVc_INTRINSIC_L typename load_concept<U, Flags>::type load(const U *mem, Flags = Flags()) Vc_INTRINSIC_R;\n//}}}1\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/loadstoreflags.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_LOADSTOREFLAGS_H_\n#define VC_COMMON_LOADSTOREFLAGS_H_\n\n#include \"../traits/type_traits.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n/**\n * Hint for \\ref Prefetch to select prefetches that mark the memory as exclusive.\n *\n * This hint may optimize the prefetch if the memory will subsequently be written to.\n */\nstruct Exclusive {};\n/**\n * Hint for \\ref Prefetch to select prefetches that mark the memory as shared.\n */\nstruct Shared {};\n\nnamespace LoadStoreFlags\n{\n\nstruct StreamingFlag {};\nstruct UnalignedFlag {};\nstruct PrefetchFlagBase {};\n// TODO: determine a good default for typical CPU use\ntemplate <size_t L1 = 16 * 64, size_t L2 = 128 * 64, typename ExclusiveOrShared_ = void>\nstruct PrefetchFlag : public PrefetchFlagBase {\n    typedef ExclusiveOrShared_ ExclusiveOrShared;\n    static constexpr size_t L1Stride = L1;\n    static constexpr size_t L2Stride = L2;\n    static constexpr bool IsExclusive = std::is_same<ExclusiveOrShared, Exclusive>::value;\n    static constexpr bool IsShared = std::is_same<ExclusiveOrShared, Shared>::value;\n};\n\ntemplate<typename Base, typename Default, typename... LoadStoreFlags> struct ExtractType\n{\n    typedef Default type;\n};\ntemplate<typename Base, typename Default, typename T, typename... LoadStoreFlags> struct ExtractType<Base, Default, T, LoadStoreFlags...>\n{\n    typedef typename std::conditional<std::is_base_of<Base, T>::value, T, typename ExtractType<Base, Default, LoadStoreFlags...>::type>::type type;\n};\n\n// ICC warns about the constexpr members in LoadStoreFlags: member \"LoadStoreFlags<Flags...>::IsAligned\" was declared but never referenced\n// who needs that warning, especially if it was referenced...\n// The warning cannot be reenabled because it gets emitted whenever the LoadStoreFlags is instantiated\n// somewhere, so it could be anywhere.\n#ifdef Vc_ICC\n#pragma warning(disable: 177)\n#endif\n/**\\internal\n * Implementation of the load/store flags mechanism. This is internal API. Only some\n * concrete aliases are API-relevant types.\n */\ntemplate<typename... Flags> struct LoadStoreFlags\n{\nprivate:\n    // ICC doesn't grok this line:\n    //template<typename Test> using TestFlag = std::is_same<typename ExtractType<StreamingFlag, void, Flags...>::type, void>;\n    typedef typename ExtractType<PrefetchFlagBase, PrefetchFlag<0, 0>, Flags...>::type Prefetch;\n\npublic:\n    constexpr LoadStoreFlags() {}\n\n    static constexpr bool IsStreaming = !std::is_same<typename ExtractType<StreamingFlag, void, Flags...>::type, void>::value;\n    static constexpr bool IsUnaligned = !std::is_same<typename ExtractType<UnalignedFlag, void, Flags...>::type, void>::value;\n    static constexpr bool IsAligned = !IsUnaligned;\n    static constexpr bool IsPrefetch = !std::is_same<typename ExtractType<PrefetchFlagBase, void, Flags...>::type, void>::value;\n    static constexpr bool IsExclusivePrefetch = Prefetch::IsExclusive;\n    static constexpr bool IsSharedPrefetch = Prefetch::IsShared;\n    static constexpr size_t L1Stride = Prefetch::L1Stride;\n    static constexpr size_t L2Stride = Prefetch::L2Stride;\n\n    typedef LoadStoreFlags<typename std::conditional<std::is_same<Flags, UnalignedFlag>::value, void, Flags>::type...> UnalignedRemoved;\n\n    // The following EnableIf* convenience types cannot use enable_if because then no LoadStoreFlags type\n    // could ever be instantiated. Instead these types are defined either as void* or void. The\n    // function that does SFINAE then assigns \"= nullptr\" to this type. Thus, the ones with just\n    // void result in substitution failure.\n    typedef typename std::conditional<IsAligned   && !IsStreaming, void *, void>::type EnableIfAligned;\n    typedef typename std::conditional<IsAligned   &&  IsStreaming, void *, void>::type EnableIfStreaming;\n    typedef typename std::conditional<IsUnaligned && !IsStreaming, void *, void>::type EnableIfUnalignedNotStreaming;\n    typedef typename std::conditional<IsUnaligned &&  IsStreaming, void *, void>::type EnableIfUnalignedAndStreaming;\n    typedef typename std::conditional<IsUnaligned                , void *, void>::type EnableIfUnaligned;\n    typedef typename std::conditional<!IsUnaligned               , void *, void>::type EnableIfNotUnaligned;\n    typedef typename std::conditional<IsPrefetch                 , void *, void>::type EnableIfPrefetch;\n    typedef typename std::conditional<!IsPrefetch                , void *, void>::type EnableIfNotPrefetch;\n};\n\n/**\\internal\n * Specialization for no flags (i.e aligned, non-streaming, no prefetching)\n */\ntemplate<> struct LoadStoreFlags<>\n{\n    constexpr LoadStoreFlags() {}\n\n    static constexpr bool IsStreaming = false;\n    static constexpr bool IsUnaligned = false;\n    static constexpr bool IsAligned = !IsUnaligned;\n    static constexpr bool IsPrefetch = false;\n    static constexpr bool IsExclusivePrefetch = false;\n    static constexpr bool IsSharedPrefetch = false;\n    static constexpr size_t L1Stride = 0;\n    static constexpr size_t L2Stride = 0;\n    typedef void* EnableIfAligned;\n    typedef void* EnableIfNotUnaligned;\n    typedef void* EnableIfNotPrefetch;\n};\n\n/**\n * Operator for concatenation of LoadStoreFlags.\n *\n * Example:\n * \\code\n * float_v x(mem, Vc::Aligned | Vc::Streaming);\n * \\endcode\n */\ntemplate<typename... LFlags, typename... RFlags>\nconstexpr LoadStoreFlags<LFlags..., RFlags...> operator|(LoadStoreFlags<LFlags...>, LoadStoreFlags<RFlags...>)\n{\n    return LoadStoreFlags<LFlags..., RFlags...>();\n}\n\n} // LoadStoreFlags namespace\n\nusing LoadStoreFlags::PrefetchFlag;\n\ntypedef LoadStoreFlags::LoadStoreFlags<> AlignedTag;\ntypedef LoadStoreFlags::LoadStoreFlags<LoadStoreFlags::StreamingFlag> StreamingTag;\ntypedef LoadStoreFlags::LoadStoreFlags<LoadStoreFlags::UnalignedFlag> UnalignedTag;\n\n/// The default load tag type uses unaligned (non-streaming) loads.\ntypedef UnalignedTag DefaultLoadTag;\n/// The default store tag type uses unaligned (non-streaming) stores.\ntypedef UnalignedTag DefaultStoreTag;\n\n/**\\addtogroup Utilities\n * @{\n */\n/**\n * Use this object for a \\p flags parameter to request aligned loads and stores.\n *\n * It specifies that a load/store can expect a memory address that is aligned on\n * the correct boundary. (i.e. \\p MemoryAlignment)\n *\n * \\warning\n * If you specify Aligned, but the memory address is not aligned the program\n * will most likely crash.\n */\nconstexpr AlignedTag Aligned;\n\n/**\n * Use this object for a \\p flags parameter to request unaligned loads and stores.\n *\n * It specifies that a load/store can \\em not expect a memory address that is\n * aligned on the correct boundary. (i.e. alignment is less than\n * \\p MemoryAlignment)\n *\n * \\note\n * If you specify Unaligned, but the memory address is aligned the load/store\n * will execute slightly slower than necessary.\n */\nconstexpr UnalignedTag Unaligned;\n\n/**\n * Use this object for a \\p flags parameter to request streaming loads and stores.\n *\n * It specifies that the cache should be bypassed for the given load/store.\n * Whether this will actually be done depends on the target system's capabilities.\n *\n * Streaming stores can be interesting when the code calculates values that, after being\n * written to memory, will not be used for a long time or used by a different thread.\n *\n * \\note\n * Expect that most target systems do not support unaligned streaming loads or stores.\n * Therefore, make sure that you also specify Aligned.\n */\nconstexpr StreamingTag Streaming;\n\n/**\n * Use this object for a \\p flags parameter to request default software prefetches to be\n * emitted.\n */\nconstexpr LoadStoreFlags::LoadStoreFlags<PrefetchFlag<>> PrefetchDefault;\n///@}\n\n/**\n * \\tparam L1\n * \\tparam L2\n * \\tparam ExclusiveOrShared\n */\ntemplate <size_t L1 = PrefetchFlag<>::L1Stride,\n          size_t L2 = PrefetchFlag<>::L2Stride,\n          typename ExclusiveOrShared = PrefetchFlag<>::ExclusiveOrShared>\nstruct Prefetch : public LoadStoreFlags::LoadStoreFlags<PrefetchFlag<L1, L2, ExclusiveOrShared>>\n{\n};\n\nnamespace Traits\n{\n///\\internal partial specialization for detecting LoadStoreFlags types\ntemplate <typename... Ts>\nstruct is_loadstoreflag_internal<LoadStoreFlags::LoadStoreFlags<Ts...>> : public std::true_type\n{\n};\n///\\internal partial specialization for detecting the derived Prefetch type as a\n/// load/store flag.\ntemplate <size_t L1, size_t L2, typename ExclusiveOrShared>\nstruct is_loadstoreflag_internal<Prefetch<L1, L2, ExclusiveOrShared>> : public std::true_type\n{\n};\n}  // namespace Traits\n}  // namespace Vc\n\n#endif // VC_COMMON_LOADSTOREFLAGS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/logarithm.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n/* The log implementations are based on code from Julien Pommier which carries the following\n   copyright information:\n */\n/*\n   Inspired by Intel Approximate Math library, and based on the\n   corresponding algorithms of the cephes math library\n*/\n/* Copyright (C) 2007  Julien Pommier\n\n  This software is provided 'as-is', without any express or implied\n  warranty.  In no event will the authors be held liable for any damages\n  arising from the use of this software.\n\n  Permission is granted to anyone to use this software for any purpose,\n  including commercial applications, and to alter it and redistribute it\n  freely, subject to the following restrictions:\n\n  1. The origin of this software must not be misrepresented; you must not\n     claim that you wrote the original software. If you use this software\n     in a product, an acknowledgment in the product documentation would be\n     appreciated but is not required.\n  2. Altered source versions must be plainly marked as such, and must not be\n     misrepresented as being the original software.\n  3. This notice may not be removed or altered from any source distribution.\n\n  (this is the zlib license)\n*/\n\n#ifdef Vc_COMMON_MATH_H_INTERNAL\n\nenum LogarithmBase {\n    BaseE, Base10, Base2\n};\n\nnamespace Detail\n{\ntemplate <typename T, typename Abi>\nusing Const = typename std::conditional<std::is_same<Abi, VectorAbi::Avx>::value,\n                                        AVX::Const<T>, SSE::Const<T>>::type;\n\ntemplate<LogarithmBase Base>\nstruct LogImpl\n{\n    template<typename T, typename Abi> static Vc_ALWAYS_INLINE void log_series(Vector<T, Abi> &Vc_RESTRICT x, typename Vector<T, Abi>::AsArg exponent) {\n        typedef Vector<T, Abi> V;\n        typedef Detail::Const<T, Abi> C;\n        // Taylor series around x = 2^exponent\n        //   f(x) = ln(x)   → exponent * ln(2) → C::ln2_small + C::ln2_large\n        //  f'(x) =    x⁻¹  →  x               → 1\n        // f''(x) = -  x⁻²  → -x² / 2          → C::_1_2()\n        //        =  2!x⁻³  →  x³ / 3          → C::P(8)\n        //        = -3!x⁻⁴  → -x⁴ / 4          → C::P(7)\n        //        =  4!x⁻⁵  →  x⁵ / 5          → C::P(6)\n        // ...\n        // The high order coefficients are adjusted to reduce the error that occurs from ommission\n        // of higher order terms.\n        // P(0) is the smallest term and |x| < 1 ⇒ |xⁿ| > |xⁿ⁺¹|\n        // The order of additions must go from smallest to largest terms\n        const V x2 = x * x; // 0 → 4\n#ifdef Vc_LOG_ILP\n        V y2 = (C::P(6) * /*4 →  8*/ x2 + /* 8 → 11*/ C::P(7) * /*1 → 5*/ x) + /*11 → 14*/ C::P(8);\n        V y0 = (C::P(0) * /*5 →  9*/ x2 + /* 9 → 12*/ C::P(1) * /*2 → 6*/ x) + /*12 → 15*/ C::P(2);\n        V y1 = (C::P(3) * /*6 → 10*/ x2 + /*10 → 13*/ C::P(4) * /*3 → 7*/ x) + /*13 → 16*/ C::P(5);\n        const V x3 = x2 * x;  // 7 → 11\n        const V x6 = x3 * x3; // 11 → 15\n        const V x9 = x6 * x3; // 15 → 19\n        V y = (y0 * /*19 → 23*/ x9 + /*23 → 26*/ y1 * /*16 → 20*/ x6) + /*26 → 29*/ y2 * /*14 → 18*/ x3;\n#elif defined Vc_LOG_ILP2\n        /*\n         *                            name start done\n         *  movaps %xmm0, %xmm1     ; x     0     1\n         *  movaps %xmm0, %xmm2     ; x     0     1\n         *  mulps %xmm1, %xmm1      ; x2    1     5 *xmm1\n         *  movaps <P8>, %xmm15     ; y8    1     2\n         *  mulps %xmm1, %xmm2      ; x3    5     9 *xmm2\n         *  movaps %xmm1, %xmm3     ; x2    5     6\n         *  movaps %xmm1, %xmm4     ; x2    5     6\n         *  mulps %xmm3, %xmm3      ; x4    6    10 *xmm3\n         *  movaps %xmm2, %xmm5     ; x3    9    10\n         *  movaps %xmm2, %xmm6     ; x3    9    10\n         *  mulps %xmm2, %xmm4      ; x5    9    13 *xmm4\n         *  movaps %xmm3, %xmm7     ; x4   10    11\n         *  movaps %xmm3, %xmm8     ; x4   10    11\n         *  movaps %xmm3, %xmm9     ; x4   10    11\n         *  mulps %xmm5, %xmm5      ; x6   10    14 *xmm5\n         *  mulps %xmm3, %xmm6      ; x7   11    15 *xmm6\n         *  mulps %xmm7, %xmm7      ; x8   12    16 *xmm7\n         *  movaps %xmm4, %xmm10    ; x5   13    14\n         *  mulps %xmm4, %xmm8      ; x9   13    17 *xmm8\n         *  mulps %xmm5, %xmm10     ; x11  14    18 *xmm10\n         *  mulps %xmm5, %xmm9      ; x10  15    19 *xmm9\n         *  mulps <P0>, %xmm10      ; y0   18    22\n         *  mulps <P1>, %xmm9       ; y1   19    23\n         *  mulps <P2>, %xmm8       ; y2   20    24\n         *  mulps <P3>, %xmm7       ; y3   21    25\n         *  addps %xmm10, %xmm9     ; y    23    26\n         *  addps %xmm9, %xmm8      ; y    26    29\n         *  addps %xmm8, %xmm7      ; y    29    32\n         */\n        const V x3 = x2 * x;  // 4  → 8\n        const V x4 = x2 * x2; // 5  → 9\n        const V x5 = x2 * x3; // 8  → 12\n        const V x6 = x3 * x3; // 9  → 13\n        const V x7 = x4 * x3; // \n        const V x8 = x4 * x4;\n        const V x9 = x5 * x4;\n        const V x10 = x5 * x5;\n        const V x11 = x5 * x6; // 13 → 17\n        V y = C::P(0) * x11 + C::P(1) * x10 + C::P(2) * x9 + C::P(3) * x8 + C::P(4) * x7\n            + C::P(5) * x6  + C::P(6) * x5  + C::P(7) * x4 + C::P(8) * x3;\n#else\n        V y = C::P(0);\n        Vc::Common::unrolled_loop<int, 1, 9>([&](int i) { y = y * x + C::P(i); });\n        y *= x * x2;\n#endif\n        switch (Base) {\n        case BaseE:\n            // ln(2) is split in two parts to increase precision (i.e. ln2_small + ln2_large = ln(2))\n            y += exponent * C::ln2_small();\n            y -= x2 * C::_1_2(); // [0, 0.25[\n            x += y;\n            x += exponent * C::ln2_large();\n            break;\n        case Base10:\n            y += exponent * C::ln2_small();\n            y -= x2 * C::_1_2(); // [0, 0.25[\n            x += y;\n            x += exponent * C::ln2_large();\n            x *= C::log10_e();\n            break;\n        case Base2:\n            {\n                const V x_ = x;\n                x *= C::log2_e();\n                y *= C::log2_e();\n                y -= x_ * x * C::_1_2(); // [0, 0.25[\n                x += y;\n                x += exponent;\n                break;\n            }\n        }\n    }\n\ntemplate <typename Abi>\nstatic Vc_ALWAYS_INLINE void log_series(Vector<double, Abi> &Vc_RESTRICT x,\n                                        typename Vector<double, Abi>::AsArg exponent)\n{\n    typedef Vector<double, Abi> V;\n    typedef Detail::Const<double, Abi> C;\n        const V x2 = x * x;\n        V y = C::P(0);\n        V y2 = C::Q(0) + x;\n        Vc::Common::unrolled_loop<int, 1, 5>([&](int i) {\n            y = y * x + C::P(i);\n            y2 = y2 * x + C::Q(i);\n        });\n        y2 = x / y2;\n        y = y * x + C::P(5);\n        y = x2 * y * y2;\n        // TODO: refactor the following with the float implementation:\n        switch (Base) {\n        case BaseE:\n            // ln(2) is split in two parts to increase precision (i.e. ln2_small + ln2_large = ln(2))\n            y += exponent * C::ln2_small();\n            y -= x2 * C::_1_2(); // [0, 0.25[\n            x += y;\n            x += exponent * C::ln2_large();\n            break;\n        case Base10:\n            y += exponent * C::ln2_small();\n            y -= x2 * C::_1_2(); // [0, 0.25[\n            x += y;\n            x += exponent * C::ln2_large();\n            x *= C::log10_e();\n            break;\n        case Base2:\n            {\n                const V x_ = x;\n                x *= C::log2_e();\n                y *= C::log2_e();\n                y -= x_ * x * C::_1_2(); // [0, 0.25[\n                x += y;\n                x += exponent;\n                break;\n            }\n        }\n    }\n\ntemplate <typename T, typename Abi, typename V = Vector<T, Abi>>\nstatic inline Vector<T, Abi> calc(V _x)\n{\n        typedef typename V::Mask M;\n    typedef Detail::Const<T, Abi> C;\n\n        V x(_x);\n\n        const M invalidMask = x < V::Zero();\n        const M infinityMask = x == V::Zero();\n        const M denormal = x <= C::min();\n\n        x(denormal) *= V(Vc::Detail::doubleConstant<1, 0, 54>()); // 2²⁵\n        V exponent = Detail::exponent(x.data());                    // = ⎣log₂(x)⎦\n        exponent(denormal) -= 54;\n\n        x.setZero(C::exponentMask()); // keep only the fractional part ⇒ x ∈ [1, 2[\n        x = Detail::operator|(x,\n                              C::_1_2());  // and set the exponent to 2⁻¹   ⇒ x ∈ [½, 1[\n\n        // split calculation in two cases:\n        // A: x ∈ [½, √½[\n        // B: x ∈ [√½, 1[\n        // √½ defines the point where Δe(x) := log₂(x) - ⎣log₂(x)⎦ = ½, i.e.\n        // log₂(√½) - ⎣log₂(√½)⎦ = ½ * -1 - ⎣½ * -1⎦ = -½ + 1 = ½\n\n        const M smallX = x < C::_1_sqrt2();\n        x(smallX) += x; // => x ∈ [√½,     1[ ∪ [1.5, 1 + √½[\n        x -= V::One();  // => x ∈ [√½ - 1, 0[ ∪ [0.5, √½[\n        exponent(!smallX) += V::One();\n\n        log_series(x, exponent); // A: (ˣ⁄₂ᵉ - 1, e)  B: (ˣ⁄₂ᵉ⁺¹ - 1, e + 1)\n\n        x.setQnan(invalidMask);        // x < 0 → NaN\n        x(infinityMask) = C::neginf(); // x = 0 → -∞\n\n        return x;\n    }\n};\n}  // namespace Detail\n\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vc_CONST Vector<T, detail::not_fixed_size_abi<Abi>> log(\n    const Vector<T, Abi> &x)\n{\n    return Detail::LogImpl<BaseE>::calc<T, Abi>(x);\n}\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vc_CONST Vector<T, detail::not_fixed_size_abi<Abi>> log10(\n    const Vector<T, Abi> &x)\n{\n    return Detail::LogImpl<Base10>::calc<T, Abi>(x);\n}\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vc_CONST Vector<T, detail::not_fixed_size_abi<Abi>> log2(\n    const Vector<T, Abi> &x)\n{\n    return Detail::LogImpl<Base2>::calc<T, Abi>(x);\n}\n\n#endif // Vc_COMMON_MATH_H_INTERNAL\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/macros.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MACROS_H_\n#define VC_COMMON_MACROS_H_\n\n#include \"../global.h\"\n\n\n#ifdef Vc_MSVC\n#define Vc_ALIGNED_TYPEDEF(n_, type_, new_type_)                                      \\\n    typedef __declspec(align(n_)) type_ new_type_\n#elif __GNUC__\n#define Vc_ALIGNED_TYPEDEF(n_, type_, new_type_)                                      \\\n    typedef type_ new_type_[[gnu::aligned(n_)]]\n#else  // the following is actually ill-formed according to C++1[14]\n#define Vc_ALIGNED_TYPEDEF(n_, type_, new_type_)                                      \\\n    using new_type_ alignas(sizeof(n_)) = type_\n#endif\n\n// On Windows (WIN32) we might see macros called min and max. Just undefine them and hope\n// noone (re)defines them (NOMINMAX should help).\n#ifdef WIN32\n#define NOMINMAX 1\n#if defined min\n#undef min\n#endif\n#if defined max\n#undef max\n#endif\n#endif  // WIN32\n\n#if defined Vc_GCC && Vc_GCC >= 0x60000\n// GCC 6 drops all attributes on types passed as template arguments. This is important\n// if a may_alias gets lost and therefore needs to be readded in the implementation of\n// the class template.\n#define Vc_TEMPLATES_DROP_ATTRIBUTES 1\n#endif\n\n#if defined Vc_CLANG || defined Vc_APPLECLANG\n#  define Vc_UNREACHABLE __builtin_unreachable\n#  define Vc_NEVER_INLINE [[gnu::noinline]]\n#  define Vc_INTRINSIC_L inline\n#  define Vc_INTRINSIC_R __attribute__((always_inline))\n#  define Vc_INTRINSIC Vc_INTRINSIC_L Vc_INTRINSIC_R\n#  define Vc_FLATTEN\n#  define Vc_CONST __attribute__((const))\n#  define Vc_CONST_L\n#  define Vc_CONST_R Vc_CONST\n#  define Vc_PURE __attribute__((pure))\n#  define Vc_PURE_L\n#  define Vc_PURE_R Vc_PURE\n#  define Vc_MAY_ALIAS __attribute__((may_alias))\n#  define Vc_ALWAYS_INLINE_L inline\n#  define Vc_ALWAYS_INLINE_R __attribute__((always_inline))\n#  define Vc_ALWAYS_INLINE Vc_ALWAYS_INLINE_L Vc_ALWAYS_INLINE_R\n#  define Vc_IS_UNLIKELY(x) __builtin_expect(x, 0)\n#  define Vc_IS_LIKELY(x) __builtin_expect(x, 1)\n#  define Vc_RESTRICT __restrict__\n#  define Vc_DEPRECATED(msg)\n#  define Vc_DEPRECATED_ALIAS(msg)\n#  define Vc_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))\n#elif defined(__GNUC__)\n#  define Vc_UNREACHABLE __builtin_unreachable\n#  if defined Vc_GCC && !defined __OPTIMIZE__\n#    define Vc_MAY_ALIAS\n#  else\n#    define Vc_MAY_ALIAS __attribute__((__may_alias__))\n#  endif\n#  define Vc_INTRINSIC_R __attribute__((__always_inline__, __artificial__))\n#  define Vc_INTRINSIC_L inline\n#  define Vc_INTRINSIC Vc_INTRINSIC_L Vc_INTRINSIC_R\n#  define Vc_FLATTEN __attribute__((__flatten__))\n#  define Vc_ALWAYS_INLINE_L inline\n#  define Vc_ALWAYS_INLINE_R __attribute__((__always_inline__))\n#  define Vc_ALWAYS_INLINE Vc_ALWAYS_INLINE_L Vc_ALWAYS_INLINE_R\n#  ifdef Vc_ICC\n// ICC miscompiles if there are functions marked as pure or const\n#    define Vc_PURE\n#    define Vc_CONST\n#    define Vc_NEVER_INLINE\n#  else\n#    define Vc_NEVER_INLINE [[gnu::noinline]]\n#    define Vc_PURE __attribute__((__pure__))\n#    define Vc_CONST __attribute__((__const__))\n#  endif\n#  define Vc_CONST_L\n#  define Vc_CONST_R Vc_CONST\n#  define Vc_PURE_L\n#  define Vc_PURE_R Vc_PURE\n#  define Vc_IS_UNLIKELY(x) __builtin_expect(x, 0)\n#  define Vc_IS_LIKELY(x) __builtin_expect(x, 1)\n#  define Vc_RESTRICT __restrict__\n#  ifdef Vc_ICC\n#    define Vc_DEPRECATED(msg)\n#    define Vc_DEPRECATED_ALIAS(msg)\n#  else\n#    define Vc_DEPRECATED(msg) __attribute__((__deprecated__(msg)))\n#    define Vc_DEPRECATED_ALIAS(msg) __attribute__((__deprecated__(msg)))\n#  endif\n#  define Vc_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__))\n#else\n#  define Vc_NEVER_INLINE\n#  define Vc_FLATTEN\n#  ifdef Vc_PURE\n#    undef Vc_PURE\n#  endif\n#  define Vc_MAY_ALIAS\n#  ifdef Vc_MSVC\n#    define Vc_ALWAYS_INLINE inline __forceinline\n#    define Vc_ALWAYS_INLINE_L Vc_ALWAYS_INLINE\n#    define Vc_ALWAYS_INLINE_R\n#    define Vc_CONST __declspec(noalias)\n#    define Vc_CONST_L Vc_CONST\n#    define Vc_CONST_R\n#    define Vc_PURE /*Vc_CONST*/\n#    define Vc_PURE_L Vc_PURE\n#    define Vc_PURE_R\n#    define Vc_INTRINSIC inline __forceinline\n#    define Vc_INTRINSIC_L Vc_INTRINSIC\n#    define Vc_INTRINSIC_R\nnamespace Vc_VERSIONED_NAMESPACE {\nnamespace detail\n{\nstatic Vc_INTRINSIC void unreachable() { __assume(0); }\n}  // namespace detail\n}\n#    define Vc_UNREACHABLE Vc::detail::unreachable\n#  else\n#    define Vc_ALWAYS_INLINE\n#    define Vc_ALWAYS_INLINE_L\n#    define Vc_ALWAYS_INLINE_R\n#    define Vc_CONST\n#    define Vc_CONST_L\n#    define Vc_CONST_R\n#    define Vc_PURE\n#    define Vc_PURE_L\n#    define Vc_PURE_R\n#    define Vc_INTRINSIC\n#    define Vc_INTRINSIC_L\n#    define Vc_INTRINSIC_R\n#    define Vc_UNREACHABLE std::abort\n#  endif\n#  define Vc_IS_UNLIKELY(x) x\n#  define Vc_IS_LIKELY(x) x\n#  define Vc_RESTRICT __restrict\n#  define Vc_DEPRECATED(msg) __declspec(deprecated(msg))\n#  define Vc_DEPRECATED_ALIAS(msg)\n#  define Vc_WARN_UNUSED_RESULT\n#endif\n\n#ifdef Vc_CXX14\n#undef Vc_DEPRECATED\n#define Vc_DEPRECATED(msg_) [[deprecated(msg_)]]\n#endif\n\n#define Vc_NOTHING_EXPECTING_SEMICOLON static_assert(true, \"\")\n\n#define Vc_FREE_STORE_OPERATORS_ALIGNED(align_)                                          \\\n    /**\\name new/delete overloads for correct alignment */                               \\\n    /**@{*/                                                                              \\\n    /*!\\brief Allocates correctly aligned memory */                                      \\\n    Vc_ALWAYS_INLINE void *operator new(size_t size)                                     \\\n    {                                                                                    \\\n        return Vc::Common::aligned_malloc<align_>(size);                                 \\\n    }                                                                                    \\\n    /*!\\brief Returns \\p p. */                                                           \\\n    Vc_ALWAYS_INLINE void *operator new(size_t, void *p) { return p; }                   \\\n    /*!\\brief Allocates correctly aligned memory */                                      \\\n    Vc_ALWAYS_INLINE void *operator new[](size_t size)                                   \\\n    {                                                                                    \\\n        return Vc::Common::aligned_malloc<align_>(size);                                 \\\n    }                                                                                    \\\n    /*!\\brief Returns \\p p. */                                                           \\\n    Vc_ALWAYS_INLINE void *operator new[](size_t, void *p) { return p; }                 \\\n    /*!\\brief Frees aligned memory. */                                                   \\\n    Vc_ALWAYS_INLINE void operator delete(void *ptr, size_t) { Vc::Common::free(ptr); }  \\\n    /*!\\brief Does nothing. */                                                           \\\n    Vc_ALWAYS_INLINE void operator delete(void *, void *) {}                             \\\n    /*!\\brief Frees aligned memory. */                                                   \\\n    Vc_ALWAYS_INLINE void operator delete[](void *ptr, size_t)                           \\\n    {                                                                                    \\\n        Vc::Common::free(ptr);                                                           \\\n    }                                                                                    \\\n    /*!\\brief Does nothing. */                                                           \\\n    Vc_ALWAYS_INLINE void operator delete[](void *, void *) {}                           \\\n    /**@}*/                                                                              \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n\n#ifdef Vc_ASSERT\n#define Vc_EXTERNAL_ASSERT 1\n#else\n#ifdef NDEBUG\n#define Vc_ASSERT(x)\n#else\n#include <assert.h>\n#define Vc_ASSERT(x) assert(x);\n#endif\n#endif\n\n#if defined Vc_CLANG || defined Vc_APPLECLANG\n#define Vc_HAS_BUILTIN(x) __has_builtin(x)\n#else\n#define Vc_HAS_BUILTIN(x) 0\n#endif\n\n#define Vc_CAT_HELPER_(a, b, c, d) a##b##c##d\n#define Vc_CAT(a, b, c, d) Vc_CAT_HELPER_(a, b, c, d)\n\n#define Vc_CAT_IMPL(a, b) a##b\n#define Vc_CAT2(a, b) Vc_CAT_IMPL(a, b)\n\n#define Vc_APPLY_IMPL_1_(macro, a, b, c, d, e) macro(a)\n#define Vc_APPLY_IMPL_2_(macro, a, b, c, d, e) macro(a, b)\n#define Vc_APPLY_IMPL_3_(macro, a, b, c, d, e) macro(a, b, c)\n#define Vc_APPLY_IMPL_4_(macro, a, b, c, d, e) macro(a, b, c, d)\n#define Vc_APPLY_IMPL_5_(macro, a, b, c, d, e) macro(a, b, c, d, e)\n\n#define Vc_LIST_FLOAT_VECTOR_TYPES(size, macro, a, b, c, d) \\\n    size(macro, double_v, a, b, c, d) \\\n    size(macro,  float_v, a, b, c, d)\n#define Vc_LIST_INT_VECTOR_TYPES(size, macro, a, b, c, d) \\\n    size(macro,    int_v, a, b, c, d) \\\n    size(macro,   uint_v, a, b, c, d) \\\n    size(macro,  short_v, a, b, c, d) \\\n    size(macro, ushort_v, a, b, c, d)\n#define Vc_LIST_VECTOR_TYPES(size, macro, a, b, c, d) \\\n    Vc_LIST_FLOAT_VECTOR_TYPES(size, macro, a, b, c, d) \\\n    Vc_LIST_INT_VECTOR_TYPES(size, macro, a, b, c, d)\n#define Vc_LIST_COMPARES(size, macro, a, b, c, d) \\\n    size(macro, ==, a, b, c, d) \\\n    size(macro, !=, a, b, c, d) \\\n    size(macro, <=, a, b, c, d) \\\n    size(macro, >=, a, b, c, d) \\\n    size(macro, < , a, b, c, d) \\\n    size(macro, > , a, b, c, d)\n#define Vc_LIST_LOGICAL(size, macro, a, b, c, d) \\\n    size(macro, &&, a, b, c, d) \\\n    size(macro, ||, a, b, c, d)\n#define Vc_LIST_BINARY(size, macro, a, b, c, d) \\\n    size(macro, |, a, b, c, d) \\\n    size(macro, &, a, b, c, d) \\\n    size(macro, ^, a, b, c, d)\n#define Vc_LIST_SHIFTS(size, macro, a, b, c, d) \\\n    size(macro, <<, a, b, c, d) \\\n    size(macro, >>, a, b, c, d)\n#define Vc_LIST_ARITHMETICS(size, macro, a, b, c, d) \\\n    size(macro, +, a, b, c, d) \\\n    size(macro, -, a, b, c, d) \\\n    size(macro, *, a, b, c, d) \\\n    size(macro, /, a, b, c, d) \\\n    size(macro, %, a, b, c, d)\n\n#define Vc_APPLY_0(_list, macro)             _list(Vc_APPLY_IMPL_1_, macro, 0, 0, 0, 0) Vc_NOTHING_EXPECTING_SEMICOLON\n#define Vc_APPLY_1(_list, macro, a)          _list(Vc_APPLY_IMPL_2_, macro, a, 0, 0, 0) Vc_NOTHING_EXPECTING_SEMICOLON\n#define Vc_APPLY_2(_list, macro, a, b)       _list(Vc_APPLY_IMPL_3_, macro, a, b, 0, 0) Vc_NOTHING_EXPECTING_SEMICOLON\n#define Vc_APPLY_3(_list, macro, a, b, c)    _list(Vc_APPLY_IMPL_4_, macro, a, b, c, 0) Vc_NOTHING_EXPECTING_SEMICOLON\n#define Vc_APPLY_4(_list, macro, a, b, c, d) _list(Vc_APPLY_IMPL_5_, macro, a, b, c, d) Vc_NOTHING_EXPECTING_SEMICOLON\n\n#define Vc_ALL_COMPARES(macro)     Vc_APPLY_0(Vc_LIST_COMPARES, macro)\n#define Vc_ALL_LOGICAL(macro)      Vc_APPLY_0(Vc_LIST_LOGICAL, macro)\n#define Vc_ALL_BINARY(macro)       Vc_APPLY_0(Vc_LIST_BINARY, macro)\n#define Vc_ALL_SHIFTS(macro)       Vc_APPLY_0(Vc_LIST_SHIFTS, macro)\n#define Vc_ALL_ARITHMETICS(macro)  Vc_APPLY_0(Vc_LIST_ARITHMETICS, macro)\n#define Vc_ALL_FLOAT_VECTOR_TYPES(macro) Vc_APPLY_0(Vc_LIST_FLOAT_VECTOR_TYPES, macro)\n#define Vc_ALL_VECTOR_TYPES(macro) Vc_APPLY_0(Vc_LIST_VECTOR_TYPES, macro)\n\n#define Vc_EXACT_TYPE(_test, _reference, _type) \\\n    typename std::enable_if<std::is_same<_test, _reference>::value, _type>::type\n\n#define Vc_make_unique(name) Vc_CAT(Vc_,name,_,__LINE__)\n\n#if defined(Vc_NO_NOEXCEPT)\n#define Vc_NOEXCEPT throw()\n#else\n#define Vc_NOEXCEPT noexcept\n#endif\n\n#ifdef Vc_NO_ALWAYS_INLINE\n#undef Vc_ALWAYS_INLINE\n#undef Vc_ALWAYS_INLINE_L\n#undef Vc_ALWAYS_INLINE_R\n#define Vc_ALWAYS_INLINE inline\n#define Vc_ALWAYS_INLINE_L inline\n#define Vc_ALWAYS_INLINE_R\n#undef Vc_INTRINSIC\n#undef Vc_INTRINSIC_L\n#undef Vc_INTRINSIC_R\n#define Vc_INTRINSIC inline\n#define Vc_INTRINSIC_L inline\n#define Vc_INTRINSIC_R\n#endif\n\n#endif // VC_COMMON_MACROS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/makeContainer.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MAKECONTAINER_H_\n#define VC_COMMON_MAKECONTAINER_H_\n\n#include \"../vector.h\"\n#include <initializer_list>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n    namespace\n    {\n        template<typename Container, typename T> struct make_container_helper\n        {\n            static constexpr Container help(std::initializer_list<T> list) { return { list }; }\n        };\n\n        template <typename T_, typename Abi, typename Alloc,\n                  template <class, class> class Container>\n        struct make_container_helper<Container<Vector<T_, Abi>, Alloc>,\n                                     typename Vector<T_, Abi>::EntryType> {\n            typedef Vector<T_, Abi> V;\n            typedef typename V::EntryType T;\n            typedef Container<V, Alloc> C;\n            static inline C help(std::initializer_list<T> list) {\n                const std::size_t size = (list.size() + (V::Size - 1)) / V::Size;\n                C v(size);\n                auto containerIt = v.begin();\n                auto init = std::begin(list);\n                const auto initEnd = std::end(list);\n                for (std::size_t i = 0; i < size - 1; ++i) {\n                    *containerIt++ = V(init, Vc::Unaligned);\n                    init += V::Size;\n                }\n                Vc_ASSERT(all_of(*containerIt == V::Zero()));\n                int j = 0;\n                while (init != initEnd) {\n                    (*containerIt)[j++] = *init++;\n                }\n                return v;\n            }\n        };\n\n        template <typename T_, typename Abi, std::size_t N,\n                  template <class, std::size_t> class Container>\n        struct make_container_helper<Container<Vector<T_, Abi>, N>,\n                                     typename Vector<T_, Abi>::EntryType> {\n            typedef Vector<T_, Abi> V;\n            typedef typename V::EntryType T;\n            static constexpr std::size_t size = (N + (V::Size - 1)) / V::Size;\n            typedef Container<\n                V,\n#if defined Vc_CLANG && Vc_CLANG < 0x30700 // TODO: when did Vc_APPLECLANG fix it?\n                // clang before 3.7.0 has a bug when returning std::array<__m256x, 1>. So\n                // increase it to std::array<__m256x, 2> and fill it with zeros. Better\n                // than returning garbage.\n                (size == 1 && std::is_same<Abi, VectorAbi::Avx>::value) ? 2 :\n#endif\n                                                                        size> C;\n            static inline C help(std::initializer_list<T> list) {\n                Vc_ASSERT(N == list.size())\n                Vc_ASSERT(size == (list.size() + (V::Size - 1)) / V::Size)\n                C v;\n                auto containerIt = v.begin();\n                auto init = std::begin(list);\n                const auto initEnd = std::end(list);\n                for (std::size_t i = 0; i < size - 1; ++i) {\n                    *containerIt++ = V(init, Vc::Unaligned);\n                    init += V::Size;\n                }\n                Vc_ASSERT(all_of(*containerIt == V::Zero()));\n                int j = 0;\n                while (init != initEnd) {\n                    (*containerIt)[j++] = *init++;\n                }\n                return v;\n            }\n        };\n    } // anonymous namespace\n\n    /**\n     * \\ingroup Containers\n     * \\headerfile makeContainer.h <Vc/Utils>\n     *\n     * Construct a container of Vc vectors from a std::initializer_list of scalar entries.\n     *\n     * \\tparam Container The container type to construct.\n     * \\tparam T The scalar type to use for the initializer_list.\n     *\n     * \\param list An initializer list of arbitrary size. The type of the entries is important!\n     * If you pass a list of integers you will get a container filled with Vc::int_v objects.\n     * If, instead, you want to have a container of Vc::float_v objects, be sure the include a\n     * period (.) and the 'f' postfix in the literals. Alternatively, you can pass the\n     * type as second template argument to makeContainer.\n     *\n     * \\return Returns a container of the requested class filled with the minimum number of SIMD\n     * vectors to hold the values in the initializer list.\n     * If the number of values in \\p list does not match the number of values in the\n     * returned container object, the remaining values in the returned object will be\n     * zero-initialized.\n     *\n     * Example:\n     * \\code\n     * auto data = Vc::makeContainer<std::vector<float_v>>({ 1.f, 2.f, 3.f, 4.f, 5.f });\n     * // data.size() == 5 if float_v::Size == 1 (i.e. Vc_IMPL=Scalar)\n     * // data.size() == 2 if float_v::Size == 4 (i.e. Vc_IMPL=SSE)\n     * // data.size() == 1 if float_v::Size == 8 (i.e. Vc_IMPL=AVX)\n     * \\endcode\n     */\n    template<typename Container, typename T>\n    constexpr auto makeContainer(std::initializer_list<T> list) -> decltype(make_container_helper<Container, T>::help(list))\n    {\n        return make_container_helper<Container, T>::help(list);\n    }\n\n    template<typename Container, typename T>\n    constexpr auto make_container(std::initializer_list<T> list) -> decltype(makeContainer<Container, T>(list))\n    {\n        return makeContainer<Container, T>(list);\n    }\n\n}  // namespace Vc\n\n#endif // VC_COMMON_MAKECONTAINER_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/make_unique.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MAKE_UNIQUE_H_\n#define VC_COMMON_MAKE_UNIQUE_H_\n\n#include <memory>\n#include \"malloc.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\ntemplate<typename T> struct Deleter\n{\n    Vc_ALWAYS_INLINE void operator()(T *ptr) {\n        ptr->~T();\n        Vc::free(ptr);\n    }\n};\n\ntemplate<class T, MallocAlignment A = Vc::AlignOnVector, class... Args>\ninline std::unique_ptr<T, Deleter<T>> make_unique(Args&&... args)\n{\n    return std::unique_ptr<T, Deleter<T>>(new(Vc::malloc<T, A>(1)) T(std::forward<Args>(args)...));\n}\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_MAKE_UNIQUE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/malloc.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MALLOC_H_\n#define VC_COMMON_MALLOC_H_\n\n#ifndef Vc_VECTOR_DECLARED_\n#error \"Incorrect inclusion order. This header must be included from Vc/vector.h only.\"\n#endif\n\n#if defined _WIN32 || defined _WIN64\n#include <malloc.h>\n#else\n#include <cstdlib>\n#endif\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\ntemplate <size_t X> static constexpr size_t nextMultipleOf(size_t value)\n{\n    return (value % X) > 0 ? value + X - (value % X) : value;\n}\n\ntemplate <std::size_t alignment> Vc_INTRINSIC void *aligned_malloc(std::size_t n)\n{\n#ifdef __MIC__\n    return _mm_malloc(nextMultipleOf<alignment>(n), alignment);\n#elif defined(_WIN32)\n# ifdef __GNUC__\n    return __mingw_aligned_malloc(nextMultipleOf<alignment>(n), alignment);\n# else\n    return _aligned_malloc(nextMultipleOf<alignment>(n), alignment);\n# endif\n#else\n    void *ptr = nullptr;\n    if (0 == posix_memalign(&ptr, alignment < sizeof(void *) ? sizeof(void *) : alignment,\n                            nextMultipleOf<alignment>(n))) {\n        return ptr;\n    }\n    return ptr;\n#endif\n}\n\ntemplate <Vc::MallocAlignment A> Vc_ALWAYS_INLINE void *malloc(size_t n)\n{\n    switch (A) {\n    case Vc::AlignOnVector:\n        return aligned_malloc<Vc::VectorAlignment>(n);\n    case Vc::AlignOnCacheline:\n        // TODO: hardcoding 64 is not such a great idea\n        return aligned_malloc<64>(n);\n    case Vc::AlignOnPage:\n        // TODO: hardcoding 4096 is not such a great idea\n        return aligned_malloc<4096>(n);\n    }\n    return nullptr;\n}\n\nVc_ALWAYS_INLINE void free(void *p)\n{\n#ifdef __MIC__\n    _mm_free(p);\n#elif defined(_WIN32)\n# ifdef __GNUC__\n    return __mingw_aligned_free(p);\n# else\n    return _aligned_free(p);\n# endif\n#else\n    std::free(p);\n#endif\n}\n}  // namespace Common\n\n/**\n * Allocates memory on the Heap with alignment and padding suitable for vectorized access.\n *\n * Memory that was allocated with this function must be released with Vc::free! Other methods might\n * work but are not portable.\n *\n * \\param n Specifies the number of objects the allocated memory must be able to store.\n * \\tparam T The type of the allocated memory. Note, that the constructor is not called.\n * \\tparam A Determines the alignment of the memory. See \\ref Vc::MallocAlignment.\n *\n * \\return Pointer to memory of the requested type, or 0 on error. The allocated memory is padded at\n * the end to be a multiple of the requested alignment \\p A. Thus if you request memory for 21\n * int objects, aligned via Vc::AlignOnCacheline, you can safely read a full cacheline until the\n * end of the array, without generating an out-of-bounds access. For a cacheline size of 64 Bytes\n * and an int size of 4 Bytes you would thus get an array of 128 Bytes to work with.\n *\n * \\warning\n * \\li The standard malloc function specifies the number of Bytes to allocate whereas this\n *     function specifies the number of values, thus differing in a factor of sizeof(T).\n * \\li This function is mainly meant for use with builtin types. If you use a custom\n *     type with a sizeof that is not a multiple of 2 the results might not be what you expect.\n * \\li The constructor of T is not called. You can make up for this:\n * \\code\n * SomeType *array = new(Vc::malloc<SomeType, Vc::AlignOnCacheline>(N)) SomeType[N];\n * \\endcode\n *\n * \\see Vc::free\n *\n * \\ingroup Utilities\n * \\headerfile memory.h <Vc/Memory>\n */\ntemplate<typename T, Vc::MallocAlignment A>\nVc_ALWAYS_INLINE T *malloc(size_t n)\n{\n    return static_cast<T *>(Common::malloc<A>(n * sizeof(T)));\n}\n\n/**\n * Frees memory that was allocated with Vc::malloc.\n *\n * \\param p The pointer to the memory to be freed.\n *\n * \\tparam T The type of the allocated memory.\n *\n * \\warning The destructor of T is not called. If needed, you can call the destructor before calling\n * free:\n * \\code\n * for (int i = 0; i < N; ++i) {\n *   p[i].~T();\n * }\n * Vc::free(p);\n * \\endcode\n *\n * \\ingroup Utilities\n * \\headerfile memory.h <Vc/Memory>\n *\n * \\see Vc::malloc\n */\ntemplate<typename T>\nVc_ALWAYS_INLINE void free(T *p)\n{\n    Common::free(p);\n}\n}  // namespace Vc\n\n#endif // VC_COMMON_MALLOC_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/mask.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MASK_H_\n#define VC_COMMON_MASK_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * \\class Mask mask.h <Vc/vector.h>\n * \\ingroup Masks\n *\n * The main SIMD mask class.\n */\ntemplate <typename T, typename Abi = VectorAbi::Best<T>> class Mask\n{\npublic:\n    /**\n     * Returns the number of boolean components (\\VSize{T}) in a mask of this type.\n     *\n     * The size of the mask. I.e. the number of boolean entries in the mask. Do not\n     * make any assumptions about the size of masks.\n     *\n     * In addition, you can easily use if clauses that compare sizes. The compiler can\n     * statically evaluate and fully optimize dead code away (very much like \\#ifdef, but\n     * with syntax checking).\n     *\n     * \\returns The number of components (i.e. \\VSize{T}) objects of this mask type store\n     * and manipulate.\n     */\n    static constexpr size_t size() { return VectorTraits<T, Abi>::size(); }\n    ///\\copydoc size\n    ///\\deprecated Use Vc::Mask::size instead.\n    static constexpr size_t Size = VectorTraits<T, Abi>::size();\n\n    /**\n     * Specifies the alignment requirement for aligned load and store calls for objects of\n     * this mask type.\n     */\n    static constexpr size_t MemoryAlignment = VectorTraits<T, Abi>::maskMemoryAlignment();\n\n    /// The ABI tag type of the current template instantiation.\n    using abi = Abi;\n\n    /**\n     * The \\c EntryType of masks is always \\c bool, independent of \\c T.\n     */\n    using EntryType = bool;\n    /// \\copydoc EntryType\n    using value_type = EntryType;\n\n    /// The reference wrapper type used for accessing individual mask components.\n    using EntryReference = typename VectorTraits<T, Abi>::EntryReference;\n    /// \\copydoc EntryReference\n    using value_reference = EntryReference;\n\n    /**\n     * The \\c VectorEntryType, in contrast to \\c EntryType, reveals information about the SIMD\n     * implementation.\n     * This type is useful for the \\c sizeof operator in generic functions.\n     */\n    using VectorEntryType = typename VectorTraits<T, Abi>::VectorEntryType;\n\n    /**\\internal\n     * The \\c VectorType reveals the implementation-specific internal type used for the SIMD type.\n     */\n    using VectorType = typename VectorTraits<T, Abi>::VectorType;\n    /**\\internal\n     * \\copydoc VectorType\n     */\n    using vector_type = VectorType;\n\n    /*\n     * The associated Vector<T> type.\n     */\n    //using Vector = Vector<T, Abi>;\n\n    /// \\name Generators\n    ///@{\n    /**\n     * Creates a new mask object initialized to zero/\\c false.\n     *\n     * \\returns A mask object with zero-initialized components.\n     */\n    Vc_INTRINSIC static Mask Zero();\n\n    /**\n     * Creates a mask object initialized to one/\\c true.\n     *\n     * \\returns A mask object with components initialized to \\c true.\n     */\n    Vc_INTRINSIC static Mask One();\n\n    /// Generate a mask object from booleans returned from the function \\p gen.\n    template <typename G> static Vc_INTRINSIC Mask generate(G &&gen);\n    ///@}\n\n    /// \\name Compile-Time Constant Initialization\n    ///@{\n    /**\n     * Construct a zero-initialized vector object.\n     *\n     * This constructor follows the behavior of the underlying \\c bool type in that the\n     * expression `bool()` zero-initializes the object (to \\c false). On the other hand\n     * the variable \\c x in `bool x;` is uninitialized.\n     * Since, for class types, both expressions call the default constructor `Mask<T> x`\n     * must zero-initialize \\c x as well.\n     */\n    Vc_INTRINSIC Mask() = default;\n\n    /// Zero-initialize the new mask object (\\c false).\n    /// \\see Vc::Zero, Zero()\n    Vc_INTRINSIC explicit Mask(VectorSpecialInitializerZero);\n\n    /// Initialize the new mask object to one (\\c true).\n    /// \\see Vc::One, One()\n    Vc_INTRINSIC explicit Mask(VectorSpecialInitializerOne);\n    ///@}\n\n    /// \\name Conversion/Broadcast Constructors\n    ///@{\n    /**\n     * Broadcast constructor.\n     *\n     * Set all components of the new mask object to \\p b.\n     *\n     * \\param b Determines the initial state of the mask.\n     */\n    Vc_INTRINSIC explicit Mask(bool b);\n\n    /**\n     * Implicit conversion from a compatible (equal \\VSize{T} on every platform) mask\n     * object.\n     *\n     * \\param otherMask The mask to be converted.\n     */\n    template <typename U>\n    Vc_INTRINSIC Mask(U &&otherMask,\n                      Common::enable_if_mask_converts_implicitly<Mask, T, U> = nullarg);\n\n#if Vc_IS_VERSION_1\n    /**\n     * Explicit conversion (static_cast) from a mask object that potentially has a\n     * different \\VSize{T}.\n     *\n     * \\param otherMask The mask to be converted.\n     *\n     * \\internal This is implemented via simd_cast in scalar/simd_cast_caller.h\n     */\n    template <typename U>\n    Vc_DEPRECATED(\n        \"use simd_cast instead of explicit type casting to convert between mask types\")\n        Vc_INTRINSIC_L\n        explicit Mask(U &&otherMask, Common::enable_if_mask_converts_explicitly<T, U> =\n                                         nullarg) Vc_INTRINSIC_R;\n    ///@}\n#endif\n\n    /**\n     * \\name Loads & Stores\n     */\n    ///@{\n    /**\n     * Load constructor from an array of \\c bool.\n     *\n     * This constructor implements an explicit conversion from an array of booleans to a\n     * mask object. It corresponds to a Vector load constructor.\n     *\n     * \\param mem A pointer to the start of the array of booleans.\n     * \\see Mask(const bool *, Flags), load(const bool *)\n     */\n    Vc_ALWAYS_INLINE explicit Mask(const bool *mem);\n    /**\n     * Overload of the above with a load/store flag argument.\n     *\n     * \\param mem A pointer to the start of the array of booleans.\n     * \\param flags Choose a combination of flags such as Vc::Aligned, Vc::Streaming,\n     * Vc::Unaligned, Vc::PrefetchDefault, ...\n     * \\see load(const bool *, Flags)\n     */\n    template <typename Flags> Vc_ALWAYS_INLINE explicit Mask(const bool *mem, Flags flags);\n\n    /**\n     * Load the components of the mask from an array of \\c bool.\n     *\n     * \\param mem A pointer to the start of the array of booleans.\n     * \\see load(const bool *, Flags), Mask(const bool *)\n     */\n    Vc_ALWAYS_INLINE void load(const bool *mem);\n    /**\n     * Overload of the above with a load/store flag argument.\n     *\n     * \\param mem A pointer to the start of the array of booleans.\n     * \\param flags Choose a combination of flags such as Vc::Aligned, Vc::Streaming,\n     * Vc::Unaligned, Vc::PrefetchDefault, ...\n     * \\see Mask(const bool *, Flags)\n     */\n    template <typename Flags> Vc_ALWAYS_INLINE void load(const bool *mem, Flags flags);\n\n    /**\n     * Store the values of the mask to an array of \\c bool.\n     *\n     * \\param mem A pointer to the start of the array of booleans.\n     * \\see store(bool *, Flags)\n     */\n    Vc_ALWAYS_INLINE void store(bool *mem) const;\n    /**\n     * Overload of the above with a load/store flag argument.\n     *\n     * \\param mem A pointer to the start of the array of booleans.\n     * \\param flags Choose a combination of flags such as Vc::Aligned, Vc::Streaming,\n     * Vc::Unaligned, Vc::PrefetchDefault, ...\n     */\n    template <typename Flags> Vc_ALWAYS_INLINE void store(bool *mem, Flags flags) const;\n    ///@}\n\n    /// \\name Comparison Operators\n    ///@{\n    /**\n     * Returns whether the two masks are equal in all components.\n     *\n     * \\param mask The other mask to compare against.\n     * \\returns A scalar boolean value that says whether all components of the two masks\n     * are equal.\n     *\n     * \\note If you expected a behavior similar to the compare operator of Vc::Vector,\n     * consider that the bitwise operators already implement such functionality. There is\n     * little use, typically, in having `a == b` return the same as `a ^ b`. In general,\n     * it is more useful to query `all_of(a ^ b)` which is the same as this equality\n     * operator.\n     */\n    Vc_ALWAYS_INLINE bool operator==(const Mask &mask) const;\n\n    /**\n     * Returns whether the two masks are different in at least one component.\n     *\n     * \\param mask The other mask to compare against.\n     * \\returns A scalar boolean value that says whether at least one component of the two masks is different.\n     *\n     * \\note `(a == b) == !(a != b)` holds\n     * \\see Mask::operator==(const Mask &)\n     */\n    Vc_ALWAYS_INLINE bool operator!=(const Mask &mask) const;\n    ///@}\n\n    /**\n     * \\name Logical and Binary Operators\n     *\n     * \\brief Component-wise logical/binary operations on mask objects.\n     *\n     * The effect of logical and binary \\c AND and \\c OR is equivalent for mask types (as\n     * it is for \\c bool).\n     */\n    ///@{\n\n    /// Returns the component-wise application of a logical \\c AND to \\p mask.\n    Vc_ALWAYS_INLINE Mask operator&&(const Mask &mask) const;\n    /// Returns the component-wise application of a binary \\c AND to \\p mask.\n    Vc_ALWAYS_INLINE Mask operator&(const Mask &mask) const;\n    /// Returns the component-wise application of a logical \\c OR to \\p mask.\n    Vc_ALWAYS_INLINE Mask operator||(const Mask &mask) const;\n    /// Returns the component-wise application of a binary \\c OR to \\p mask.\n    Vc_ALWAYS_INLINE Mask operator|(const Mask &mask) const;\n    /// Returns the component-wise application of a binary \\c XOR to \\p mask.\n    Vc_ALWAYS_INLINE Mask operator^(const Mask &mask) const;\n    /// Returns a mask with inverted components.\n    Vc_ALWAYS_INLINE Mask operator!() const;\n\n    /// Modifies the mask using an \\c AND operation with \\p mask.\n    Vc_ALWAYS_INLINE Mask &operator&=(const Mask &mask);\n    /// Modifies the mask using an \\c OR operation with \\p mask.\n    Vc_ALWAYS_INLINE Mask &operator|=(const Mask &mask);\n    /// Modifies the mask using an \\c XOR operation with \\p mask.\n    Vc_ALWAYS_INLINE Mask &operator^=(const Mask &mask);\n    ///@}\n\n    /**\n     * \\name Reductions\n     *\n     * \\see any_of, all_of, none_of, some_of\n     */\n    ///@{\n\n    /// Returns a logical \\c AND of all components.\n    Vc_ALWAYS_INLINE bool isFull() const;\n    /// Returns a logical \\c OR of all components.\n    Vc_ALWAYS_INLINE bool isNotEmpty() const;\n    /// Returns \\c true if components are \\c false, \\c false otherwise.\n    Vc_ALWAYS_INLINE bool isEmpty() const;\n    /// Returns `!isFull() && !isEmpty()`.\n    Vc_ALWAYS_INLINE bool isMix() const;\n    ///@}\n\n    /**\\internal\n     * \\name Internal Data Access\n     */\n    ///@{\n    Vc_ALWAYS_INLINE bool data() const;\n    Vc_ALWAYS_INLINE bool dataI() const;\n    Vc_ALWAYS_INLINE bool dataD() const;\n    ///@}\n\n    /// \\name Scalar Subscript Operators\n    ///@{\n    /**\n     * Lvalue-reference-like access to mask entries.\n     *\n     * \\param index Determines the boolean to be accessed.\n     * \\return a temporary proxy object referencing the \\p index th entry of the mask.\n     *\n     * \\warning This operator does not return an lvalue reference (to \\c bool), but rather\n     * a temporary (rvalue) object that mimics an lvalue reference (as much as is possible\n     * with C++11/14).\n     */\n    Vc_ALWAYS_INLINE EntryReference operator[](size_t index);\n\n    /**\n     * Read-only access to mask entries.\n     *\n     * \\param index Determines the boolean to be accessed.\n     * \\return The \\p index th entry of the mask as a \\c bool (rvalue).\n     *\n     * \\warning This operator does not return an lvalue reference (to `const bool`), but\n     * rather a temporary (rvalue) \\c bool.\n     */\n    Vc_ALWAYS_INLINE EntryType operator[](size_t index) const;\n    ///@}\n\n    /// Returns how many components of the mask are \\c true.\n    Vc_ALWAYS_INLINE int count() const;\n\n    /**\n     * Returns the index of the first one in the mask.\n     *\n     * \\returns the index of the first component that is \\c true.\n     *\n     * \\warning The return value is undefined if the mask is empty.\n     *\n     * Thus, unless `none_of(mask)`, `mask[mask.firstOne()] == true` holds and `mask[i] ==\n     * false` for all `i < mask.firstOne()`.\n     */\n    Vc_ALWAYS_INLINE int firstOne() const;\n\n    /**\n     * Convert the boolean components of the mask into bits of an integer.\n     *\n     * \\return An \\c int where each bit corresponds to the boolean value in the mask.\n     *\n     * For example, the mask `[true, false, false, true]` results in a `9` (in binary: `1001`).\n     */\n    Vc_ALWAYS_INLINE int toInt() const;\n\n    /// Returns a mask with components shifted by \\p amount places.\n    Vc_INTRINSIC Vc_PURE Mask shifted(int amount) const;\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(Mask));\n\nprivate:\n    VectorType d;\n};\n\n/**\n * \\ingroup Utilities\n *\n * \\name Boolean Reductions\n */\n//@{\n/** \\ingroup Utilities\n *  Returns whether all entries in the mask \\p m are \\c true.\n */\ntemplate<typename Mask> constexpr bool all_of(const Mask &m) { return m.isFull(); }\n/** \\ingroup Utilities\n *  Returns \\p b\n */\nconstexpr bool all_of(bool b) { return b; }\n\n/** \\ingroup Utilities\n *  Returns whether at least one entry in the mask \\p m is \\c true.\n */\ntemplate<typename Mask> constexpr bool any_of(const Mask &m) { return m.isNotEmpty(); }\n/** \\ingroup Utilities\n *  Returns \\p b\n */\nconstexpr bool any_of(bool b) { return b; }\n\n/** \\ingroup Utilities\n *  Returns whether all entries in the mask \\p m are \\c false.\n */\ntemplate<typename Mask> constexpr bool none_of(const Mask &m) { return m.isEmpty(); }\n/** \\ingroup Utilities\n *  Returns \\p !b\n */\nconstexpr bool none_of(bool b) { return !b; }\n\n/** \\ingroup Utilities\n *  Returns whether at least one entry in \\p m is \\c true and at least one entry in \\p m is \\c\n *  false.\n */\ntemplate<typename Mask> constexpr bool some_of(const Mask &m) { return m.isMix(); }\n/** \\ingroup Utilities\n *  Returns \\c false\n */\nconstexpr bool some_of(bool) { return false; }\n//@}\n}  // namespace Vc\n\n#endif  // VC_COMMON_MASK_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/maskbool.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MASKENTRY_H_\n#define VC_COMMON_MASKENTRY_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\nnamespace\n{\n    template<size_t Bytes> struct MaskBoolStorage;\n    // the following for typedefs must use std::intN_t and NOT! Vc::intN_t. The latter\n    // segfaults ICC 15.0.3.\n    template<> struct MaskBoolStorage<1> { typedef std::int8_t  type; };\n    template<> struct MaskBoolStorage<2> { typedef std::int16_t type; };\n    template<> struct MaskBoolStorage<4> { typedef std::int32_t type; };\n    template<> struct MaskBoolStorage<8> { typedef std::int64_t type; };\n} // anonymous namespace\n\ntemplate<size_t Bytes> class MaskBool\n{\n    typedef typename MaskBoolStorage<Bytes>::type storage_type Vc_MAY_ALIAS;\n    storage_type data;\npublic:\n    constexpr MaskBool(bool x) noexcept : data(x ? -1 : 0) {}\n    Vc_ALWAYS_INLINE MaskBool &operator=(bool x) noexcept { data = x ? -1 : 0; return *this; }\n    template <typename T, typename = enable_if<(!std::is_same<T, bool>::value &&\n                                                std::is_fundamental<T>::value)>>\n    Vc_ALWAYS_INLINE MaskBool &operator=(T x) noexcept\n    {\n        data = reinterpret_cast<const storage_type &>(x);\n        return *this;\n    }\n\n    Vc_ALWAYS_INLINE MaskBool(const MaskBool &) noexcept = default;\n    Vc_ALWAYS_INLINE MaskBool &operator=(const MaskBool &) noexcept = default;\n\n    template <typename T, typename = enable_if<(std::is_same<T, bool>::value ||\n                                                (std::is_fundamental<T>::value &&\n                                                 sizeof(storage_type) == sizeof(T)))>>\n    constexpr operator T() const noexcept\n    {\n        return std::is_same<T, bool>::value ? T((data & 1) != 0) : aliasing_cast<T>(data);\n    }\n} Vc_MAY_ALIAS;\n\ntemplate <typename A,\n          typename B,\n          typename std::enable_if<\n              std::is_convertible<A, bool>::value &&std::is_convertible<B, bool>::value,\n              int>::type = 0>\nconstexpr bool operator==(A &&a, B &&b)\n{\n    return static_cast<bool>(a) == static_cast<bool>(b);\n}\ntemplate <typename A,\n          typename B,\n          typename std::enable_if<\n              std::is_convertible<A, bool>::value &&std::is_convertible<B, bool>::value,\n              int>::type = 0>\nconstexpr bool operator!=(A &&a, B &&b)\n{\n    return static_cast<bool>(a) != static_cast<bool>(b);\n}\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_MASKENTRY_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/math.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MATH_H_\n#define VC_COMMON_MATH_H_\n\n#define Vc_COMMON_MATH_H_INTERNAL 1\n\n#include \"trigonometric.h\"\n\n#include \"const.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// TODO, not vectorized:\ntemplate <class T, class Abi>\nSimdArray<int, Vector<T, Abi>::size()> fpclassify(const Vector<T, Abi> &x)\n{\n    return SimdArray<int, Vector<T, Abi>::size()>(\n        [&](std::size_t i) { return std::fpclassify(x[i]); });\n}\ntemplate <class T, size_t N> SimdArray<int, N> fpclassify(const SimdArray<T, N> &x)\n{\n    return SimdArray<int, N>([&](std::size_t i) { return std::fpclassify(x[i]); });\n}\n\n#ifdef Vc_IMPL_SSE\n// for SSE, AVX, and AVX2\n#include \"logarithm.h\"\n#include \"exponential.h\"\n#ifdef Vc_IMPL_AVX\ninline AVX::double_v exp(AVX::double_v _x)\n{\n    AVX::Vector<double> x = _x;\n    typedef AVX::Vector<double> V;\n        typedef V::Mask M;\n    typedef AVX::Const<double> C;\n\n        const M overflow  = x > Vc::Detail::doubleConstant< 1, 0x0006232bdd7abcd2ull, 9>(); // max log\n        const M underflow = x < Vc::Detail::doubleConstant<-1, 0x0006232bdd7abcd2ull, 9>(); // min log\n\n        V px = floor(C::log2_e() * x + 0.5);\n        __m128i tmp = _mm256_cvttpd_epi32(px.data());\n    const SimdArray<int, V::Size> n = SSE::int_v{tmp};\n        x -= px * C::ln2_large(); //Vc::Detail::doubleConstant<1, 0x00062e4000000000ull, -1>();  // ln2\n        x -= px * C::ln2_small(); //Vc::Detail::doubleConstant<1, 0x0007f7d1cf79abcaull, -20>(); // ln2\n\n        const double P[] = {\n            Vc::Detail::doubleConstant<1, 0x000089cdd5e44be8ull, -13>(),\n            Vc::Detail::doubleConstant<1, 0x000f06d10cca2c7eull,  -6>(),\n            Vc::Detail::doubleConstant<1, 0x0000000000000000ull,   0>()\n        };\n        const double Q[] = {\n            Vc::Detail::doubleConstant<1, 0x00092eb6bc365fa0ull, -19>(),\n            Vc::Detail::doubleConstant<1, 0x0004ae39b508b6c0ull,  -9>(),\n            Vc::Detail::doubleConstant<1, 0x000d17099887e074ull,  -3>(),\n            Vc::Detail::doubleConstant<1, 0x0000000000000000ull,   1>()\n        };\n        const V x2 = x * x;\n        px = x * ((P[0] * x2 + P[1]) * x2 + P[2]);\n        x =  px / ((((Q[0] * x2 + Q[1]) * x2 + Q[2]) * x2 + Q[3]) - px);\n        x = V::One() + 2.0 * x;\n\n        x = ldexp(x, n); // == x * 2ⁿ\n\n        x(overflow) = std::numeric_limits<double>::infinity();\n        x.setZero(underflow);\n\n        return x;\n    }\n#endif  // Vc_IMPL_AVX\n\ninline SSE::double_v exp(SSE::double_v::AsArg _x) {\n    SSE::Vector<double> x = _x;\n    typedef SSE::Vector<double> V;\n        typedef V::Mask M;\n    typedef SSE::Const<double> C;\n\n        const M overflow  = x > Vc::Detail::doubleConstant< 1, 0x0006232bdd7abcd2ull, 9>(); // max log\n        const M underflow = x < Vc::Detail::doubleConstant<-1, 0x0006232bdd7abcd2ull, 9>(); // min log\n\n        V px = floor(C::log2_e() * x + 0.5);\n    SimdArray<int, V::Size> n;\n        _mm_storel_epi64(reinterpret_cast<__m128i *>(&n), _mm_cvttpd_epi32(px.data()));\n        x -= px * C::ln2_large(); //Vc::Detail::doubleConstant<1, 0x00062e4000000000ull, -1>();  // ln2\n        x -= px * C::ln2_small(); //Vc::Detail::doubleConstant<1, 0x0007f7d1cf79abcaull, -20>(); // ln2\n\n        const double P[] = {\n            Vc::Detail::doubleConstant<1, 0x000089cdd5e44be8ull, -13>(),\n            Vc::Detail::doubleConstant<1, 0x000f06d10cca2c7eull,  -6>(),\n            Vc::Detail::doubleConstant<1, 0x0000000000000000ull,   0>()\n        };\n        const double Q[] = {\n            Vc::Detail::doubleConstant<1, 0x00092eb6bc365fa0ull, -19>(),\n            Vc::Detail::doubleConstant<1, 0x0004ae39b508b6c0ull,  -9>(),\n            Vc::Detail::doubleConstant<1, 0x000d17099887e074ull,  -3>(),\n            Vc::Detail::doubleConstant<1, 0x0000000000000000ull,   1>()\n        };\n        const V x2 = x * x;\n        px = x * ((P[0] * x2 + P[1]) * x2 + P[2]);\n        x =  px / ((((Q[0] * x2 + Q[1]) * x2 + Q[2]) * x2 + Q[3]) - px);\n        x = V::One() + 2.0 * x;\n\n        x = ldexp(x, n); // == x * 2ⁿ\n\n        x(overflow) = std::numeric_limits<double>::infinity();\n        x.setZero(underflow);\n\n        return x;\n    }\n\n#endif\n}  // namespace Vc\n\n#undef Vc_COMMON_MATH_H_INTERNAL\n\n#endif // VC_COMMON_MATH_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/memory.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MEMORY_H_\n#define VC_COMMON_MEMORY_H_\n\n#include \"memorybase.h\"\n#include <assert.h>\n#include <algorithm>\n#include <cstring>\n#include <cstddef>\n#include <initializer_list>\n#include \"memoryfwd.h\"\n#include \"malloc.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\ntemplate<typename V, size_t Size> struct _MemorySizeCalculation\n{\n    enum AlignmentCalculations {\n        Alignment = V::Size,\n        AlignmentMask = Alignment - 1,\n        MaskedSize = Size & AlignmentMask,\n        Padding = Alignment - MaskedSize,\n        PaddedSize = MaskedSize == 0 ? Size : Size + Padding\n    };\n};\n\n/**\n * \\ingroup Containers\n * \\headerfile memory.h <Vc/Memory>\n *\n * A helper class for fixed-size two-dimensional arrays.\n *\n * \\param V The vector type you want to operate on. (e.g. float_v or uint_v)\n * \\param Size1 Number of rows\n * \\param Size2 Number of columns\n */\ntemplate <typename V, size_t Size1, size_t Size2, bool InitPadding>\nclass Memory : public MemoryBase<V, Memory<V, Size1, Size2, InitPadding>, 2,\n                                 Memory<V, Size2, 0, InitPadding>>\n{\npublic:\n    typedef typename V::EntryType EntryType;\n\nprivate:\n    using RowMemory = Memory<V, Size2, 0, InitPadding>;\n    typedef MemoryBase<V, Memory<V, Size1, Size2, InitPadding>, 2, RowMemory> Base;\n    friend class MemoryBase<V, Memory<V, Size1, Size2, InitPadding>, 2, RowMemory>;\n    friend class MemoryDimensionBase<V, Memory<V, Size1, Size2, InitPadding>, 2,\n                                     RowMemory>;\n    enum : size_t {\n        Alignment = V::MemoryAlignment,\n        PaddedSize2 = _MemorySizeCalculation<V, Size2>::PaddedSize\n    };\n    alignas(static_cast<size_t>(Alignment))  // GCC complains about 'is not an\n                                             // integer constant' unless the\n                                             // static_cast is present\n        RowMemory m_mem[Size1];\n\n        public:\n            using Base::vector;\n            enum Constants {\n                RowCount = Size1,\n                VectorsCount = PaddedSize2 / V::Size\n            };\n\n            Memory() = default;\n\n            /**\n             * \\return the number of rows in the array.\n             *\n             * \\note This function can be eliminated by an optimizing compiler.\n             */\n            static constexpr size_t rowsCount() { return RowCount; }\n            /**\n             * \\return the number of scalar entries in the whole array.\n             *\n             * \\warning Do not use this function for scalar iteration over the array since there will be\n             * padding between rows if \\c Size2 is not divisible by \\c V::Size.\n             *\n             * \\note This function can be optimized into a compile-time constant.\n             */\n            static constexpr size_t entriesCount() { return Size1 * Size2; }\n            /**\n             * \\return the number of vectors in the whole array.\n             *\n             * \\note This function can be optimized into a compile-time constant.\n             */\n            static constexpr size_t vectorsCount() { return VectorsCount * Size1; }\n\n            /**\n             * Copies the data from a different object.\n             *\n             * \\param rhs The object to copy the data from.\n             *\n             * \\return reference to the modified Memory object.\n             *\n             * \\note Both objects must have the exact same vectorsCount().\n             */\n            template<typename Parent, typename RM>\n            Vc_ALWAYS_INLINE Memory &operator=(const MemoryBase<V, Parent, 2, RM> &rhs) {\n                assert(vectorsCount() == rhs.vectorsCount());\n                Detail::copyVectors(*this, rhs);\n                return *this;\n            }\n\n            Vc_ALWAYS_INLINE Memory &operator=(const Memory &rhs) {\n                Detail::copyVectors(*this, rhs);\n                return *this;\n            }\n\n            /**\n             * Initialize all data with the given vector.\n             *\n             * \\param v This vector will be used to initialize the memory.\n             *\n             * \\return reference to the modified Memory object.\n             */\n            inline Memory &operator=(const V &v) {\n                for (size_t i = 0; i < vectorsCount(); ++i) {\n                    vector(i) = v;\n                }\n                return *this;\n            }\n};\n\n    /**\n     * A helper class to simplify usage of correctly aligned and padded memory, allowing both vector and\n     * scalar access.\n     *\n     * Example:\n     * \\code\n        Vc::Memory<int_v, 11> array;\n\n        // scalar access:\n        for (size_t i = 0; i < array.entriesCount(); ++i) {\n            int x = array[i]; // read\n            array[i] = x;     // write\n        }\n        // more explicit alternative:\n        for (size_t i = 0; i < array.entriesCount(); ++i) {\n            int x = array.scalar(i); // read\n            array.scalar(i) = x;     // write\n        }\n\n        // vector access:\n        for (size_t i = 0; i < array.vectorsCount(); ++i) {\n            int_v x = array.vector(i); // read\n            array.vector(i) = x;       // write\n        }\n     * \\endcode\n     * This code allocates a small array and implements three equivalent loops (that do nothing useful).\n     * The loops show how scalar and vector read/write access is best implemented.\n     *\n     * Since the size of 11 is not a multiple of int_v::Size (unless you use the\n     * scalar Vc implementation) the last write access of the vector loop would normally be out of\n     * bounds. But the Memory class automatically pads the memory such that the whole array can be\n     * accessed with correctly aligned memory addresses.\n     *\n     * \\param V The vector type you want to operate on. (e.g. float_v or uint_v)\n     * \\param Size The number of entries of the scalar base type the memory should hold. This\n     * is thus the same number as you would use for a normal C array (e.g. float mem[11] becomes\n     * Memory<float_v, 11> mem).\n     *\n     * \\see Memory<V, 0u>\n     *\n     * \\ingroup Containers\n     * \\headerfile memory.h <Vc/Memory>\n     */\ntemplate <typename V, size_t Size, bool InitPadding>\nclass Memory<V, Size, 0u, InitPadding> :\n    public MemoryBase<V, Memory<V, Size, 0u, InitPadding>, 1, void>\n    {\n        public:\n            typedef typename V::EntryType EntryType;\n        private:\n            typedef MemoryBase<V, Memory<V, Size, 0u, InitPadding>, 1, void> Base;\n            friend class MemoryBase<V, Memory<V, Size, 0u, InitPadding>, 1, void>;\n            friend class MemoryDimensionBase<V, Memory<V, Size, 0u, InitPadding>, 1, void>;\n            enum : size_t {\n                Alignment = V::MemoryAlignment,     // in Bytes\n                MaskedSize = Size & (V::Size - 1),  // the fraction of Size that exceeds\n                                                    // an integral multiple of V::Size\n                Padding = V::Size - MaskedSize,\n                PaddedSize = MaskedSize == 0 ? Size : Size + Padding\n            };\n            alignas(static_cast<size_t>(Alignment))  // GCC complains about 'is not an\n                                                     // integer constant' unless the\n                                                     // static_cast is present\n                EntryType m_mem[PaddedSize];\n\n        public:\n            using Base::vector;\n            enum Constants {\n                EntriesCount = Size,\n                VectorsCount = PaddedSize / V::Size\n            };\n\n            Memory()\n            {\n                if (InitPadding) {\n                    Base::lastVector() = V::Zero();\n                }\n            }\n\n            Memory(std::initializer_list<EntryType> init)\n            {\n                Vc_ASSERT(init.size() <= Size);\n                Base::lastVector() = V::Zero();\n                std::copy(init.begin(), init.end(), &m_mem[0]);\n            }\n\n            /**\n             * Wrap existing data with the Memory convenience class.\n             *\n             * This function returns a \\em reference to a Memory<V, Size, 0> object that you must\n             * capture to avoid a copy of the whole data:\n             * \\code\n             * Memory<float_v, 16> &m = Memory<float_v, 16>::fromRawData(someAlignedPointerToFloat)\n             * \\endcode\n             *\n             * \\param ptr An aligned pointer to memory of type \\p V::EntryType (e.g. \\c float for\n             *            Vc::float_v).\n             * \\return A Memory object placed at the given location in memory.\n             *\n             * \\warning The pointer \\p ptr passed to this function must be aligned according to the\n             * alignment restrictions of \\p V.\n             * \\warning The size of the accessible memory must match \\p Size. This includes the\n             * required padding at the end to allow the last entries to be accessed via vectors. If\n             * you know what you are doing you might violate this constraint.\n             * \\warning It is your responsibility to ensure that the memory is released correctly\n             * (not too early/not leaked). This function simply adds convenience functions to \\em\n             * access the memory.\n             */\n            static Vc_ALWAYS_INLINE Vc_CONST Memory<V, Size, 0u, false> &fromRawData(EntryType *ptr)\n            {\n                // DANGER! This placement new has to use the right address. If the compiler decides\n                // RowMemory requires padding before the actual data then the address has to be adjusted\n                // accordingly\n                char *addr = reinterpret_cast<char *>(ptr);\n                typedef Memory<V, Size, 0u, false> MM;\n                addr -= offsetof(MM, m_mem);\n                return *new(addr) MM;\n            }\n\n            /**\n             * \\return the number of scalar entries in the whole array.\n             *\n             * \\note This function can be optimized into a compile-time constant.\n             */\n            static constexpr size_t entriesCount() { return EntriesCount; }\n\n            /**\n             * \\return the number of vectors in the whole array.\n             *\n             * \\note This function can be optimized into a compile-time constant.\n             */\n            static constexpr size_t vectorsCount() { return VectorsCount; }\n\n            inline Memory(const Memory &rhs)\n            {\n                Detail::copyVectors(*this, rhs);\n            }\n\n            template <size_t S> inline Memory(const Memory<V, S> &rhs)\n            {\n                assert(vectorsCount() == rhs.vectorsCount());\n                Detail::copyVectors(*this, rhs);\n            }\n\n            inline Memory &operator=(const Memory &rhs)\n            {\n                Detail::copyVectors(*this, rhs);\n                return *this;\n            }\n\n            template <size_t S> inline Memory &operator=(const Memory<V, S> &rhs)\n            {\n                assert(vectorsCount() == rhs.vectorsCount());\n                Detail::copyVectors(*this, rhs);\n                return *this;\n            }\n\n            Vc_ALWAYS_INLINE Memory &operator=(const EntryType *rhs) {\n                std::memcpy(m_mem, rhs, entriesCount() * sizeof(EntryType));\n                return *this;\n            }\n            inline Memory &operator=(const V &v) {\n                for (size_t i = 0; i < vectorsCount(); ++i) {\n                    vector(i) = v;\n                }\n                return *this;\n            }\n    };\n\n    /**\n     * A helper class that is very similar to Memory<V, Size> but with dynamically allocated memory and\n     * thus dynamic size.\n     *\n     * Example:\n     * \\code\n        size_t size = 11;\n        Vc::Memory<int_v> array(size);\n\n        // scalar access:\n        for (size_t i = 0; i < array.entriesCount(); ++i) {\n            array[i] = i;\n        }\n\n        // vector access:\n        for (size_t i = 0; i < array.vectorsCount(); ++i) {\n            array.vector(i) = int_v::IndexesFromZero() + i * int_v::Size;\n        }\n     * \\endcode\n     * This code allocates a small array with 11 scalar entries\n     * and implements two equivalent loops that initialize the memory.\n     * The scalar loop writes each individual int. The vectorized loop writes int_v::Size values to\n     * memory per iteration. Since the size of 11 is not a multiple of int_v::Size (unless you use the\n     * scalar Vc implementation) the last write access of the vector loop would normally be out of\n     * bounds. But the Memory class automatically pads the memory such that the whole array can be\n     * accessed with correctly aligned memory addresses.\n     * (Note: the scalar loop can be auto-vectorized, except for the last three assignments.)\n     *\n     * \\note The internal data pointer is not declared with the \\c __restrict__ keyword. Therefore\n     * modifying memory of V::EntryType will require the compiler to assume aliasing. If you want to use\n     * the \\c __restrict__ keyword you need to use a standard pointer to memory and do the vector\n     * address calculation and loads and stores manually.\n     *\n     * \\param V The vector type you want to operate on. (e.g. float_v or uint_v)\n     *\n     * \\see Memory<V, Size>\n     *\n     * \\ingroup Containers\n     * \\headerfile memory.h <Vc/Memory>\n     */\n    template<typename V> class Memory<V, 0u, 0u, true> : public MemoryBase<V, Memory<V, 0u, 0u, true>, 1, void>\n    {\n        public:\n            typedef typename V::EntryType EntryType;\n        private:\n            typedef MemoryBase<V, Memory<V>, 1, void> Base;\n            friend class MemoryBase<V, Memory<V>, 1, void>;\n            friend class MemoryDimensionBase<V, Memory<V>, 1, void>;\n        enum InternalConstants {\n            Alignment = V::Size,\n            AlignmentMask = Alignment - 1\n        };\n        size_t m_entriesCount;\n        size_t m_vectorsCount;\n        EntryType *m_mem;\n        size_t calcPaddedEntriesCount(size_t x)\n        {\n            size_t masked = x & AlignmentMask;\n            return (masked == 0 ? x : x + (Alignment - masked));\n        }\n    public:\n        using Base::vector;\n\n        /**\n         * Allocate enough memory to access \\p size values of type \\p V::EntryType.\n         *\n         * The allocated memory is aligned and padded correctly for fully vectorized access.\n         *\n         * \\param size Determines how many scalar values will fit into the allocated memory.\n         */\n        Vc_ALWAYS_INLINE Memory(size_t size)\n            : m_entriesCount(size),\n            m_vectorsCount(calcPaddedEntriesCount(m_entriesCount)),\n            m_mem(Vc::malloc<EntryType, Vc::AlignOnVector>(m_vectorsCount))\n        {\n            m_vectorsCount /= V::Size;\n            Base::lastVector() = V::Zero();\n        }\n\n        /**\n         * Copy the memory into a new memory area.\n         *\n         * The allocated memory is aligned and padded correctly for fully vectorized access.\n         *\n         * \\param rhs The Memory object to copy from.\n         */\n        template<typename Parent, typename RM>\n        Vc_ALWAYS_INLINE Memory(const MemoryBase<V, Parent, 1, RM> &rhs)\n            : m_entriesCount(rhs.entriesCount()),\n            m_vectorsCount(rhs.vectorsCount()),\n            m_mem(Vc::malloc<EntryType, Vc::AlignOnVector>(m_vectorsCount * V::Size))\n        {\n            Detail::copyVectors(*this, rhs);\n        }\n\n        /**\n         * Overload of the above function.\n         *\n         * (Because C++ would otherwise not use the templated cctor and use a default-constructed cctor instead.)\n         *\n         * \\param rhs The Memory object to copy from.\n         */\n        Vc_ALWAYS_INLINE Memory(const Memory &rhs)\n            : m_entriesCount(rhs.entriesCount()),\n            m_vectorsCount(rhs.vectorsCount()),\n            m_mem(Vc::malloc<EntryType, Vc::AlignOnVector>(m_vectorsCount * V::Size))\n        {\n            Detail::copyVectors(*this, rhs);\n        }\n\n        /**\n         * Frees the memory which was allocated in the constructor.\n         */\n        Vc_ALWAYS_INLINE ~Memory()\n        {\n            Vc::free(m_mem);\n        }\n\n        /**\n         * Swap the contents and size information of two Memory objects.\n         *\n         * \\param rhs The other Memory object to swap.\n         */\n        inline void swap(Memory &rhs) {\n            std::swap(m_mem, rhs.m_mem);\n            std::swap(m_entriesCount, rhs.m_entriesCount);\n            std::swap(m_vectorsCount, rhs.m_vectorsCount);\n        }\n\n        /**\n         * \\return the number of scalar entries in the whole array.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE size_t entriesCount() const { return m_entriesCount; }\n\n        /**\n         * \\return the number of vectors in the whole array.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE size_t vectorsCount() const { return m_vectorsCount; }\n\n        /**\n         * Overwrite all entries with the values stored in \\p rhs.\n         *\n         * \\param rhs The object to copy the data from.\n         *\n         * \\return reference to the modified Memory object.\n         *\n         * \\note this function requires the vectorsCount() of both Memory objects to be equal.\n         */\n        template<typename Parent, typename RM>\n        Vc_ALWAYS_INLINE Memory &operator=(const MemoryBase<V, Parent, 1, RM> &rhs) {\n            assert(vectorsCount() == rhs.vectorsCount());\n            Detail::copyVectors(*this, rhs);\n            return *this;\n        }\n\n        Vc_ALWAYS_INLINE Memory &operator=(const Memory &rhs) {\n            assert(vectorsCount() == rhs.vectorsCount());\n            Detail::copyVectors(*this, rhs);\n            return *this;\n        }\n\n        /**\n         * Overwrite all entries with the values stored in the memory at \\p rhs.\n         *\n         * \\param rhs The array to copy the data from.\n         *\n         * \\return reference to the modified Memory object.\n         *\n         * \\note this function requires that there are entriesCount() many values accessible from \\p rhs.\n         */\n        Vc_ALWAYS_INLINE Memory &operator=(const EntryType *rhs) {\n            std::memcpy(m_mem, rhs, entriesCount() * sizeof(EntryType));\n            return *this;\n        }\n};\n\n/**\n * Prefetch the cacheline containing \\p addr for a single read access.\n *\n * This prefetch completely bypasses the cache, not evicting any other data.\n *\n * \\param addr The cacheline containing \\p addr will be prefetched.\n *\n * \\ingroup Utilities\n * \\headerfile memory.h <Vc/Memory>\n */\nVc_ALWAYS_INLINE void prefetchForOneRead(const void *addr)\n{\n    Vc::Detail::prefetchForOneRead(addr, VectorAbi::Best<float>());\n}\n\n/**\n * Prefetch the cacheline containing \\p addr for modification.\n *\n * This prefetch evicts data from the cache. So use it only for data you really will use. When the\n * target system supports it the cacheline will be marked as modified while prefetching, saving work\n * later on.\n *\n * \\param addr The cacheline containing \\p addr will be prefetched.\n *\n * \\ingroup Utilities\n * \\headerfile memory.h <Vc/Memory>\n */\nVc_ALWAYS_INLINE void prefetchForModify(const void *addr)\n{\n    Vc::Detail::prefetchForModify(addr, VectorAbi::Best<float>());\n}\n\n/**\n * Prefetch the cacheline containing \\p addr to L1 cache.\n *\n * This prefetch evicts data from the cache. So use it only for data you really will use.\n *\n * \\param addr The cacheline containing \\p addr will be prefetched.\n *\n * \\ingroup Utilities\n * \\headerfile memory.h <Vc/Memory>\n */\nVc_ALWAYS_INLINE void prefetchClose(const void *addr)\n{\n    Vc::Detail::prefetchClose(addr, VectorAbi::Best<float>());\n}\n\n/**\n * Prefetch the cacheline containing \\p addr to L2 cache.\n *\n * This prefetch evicts data from the cache. So use it only for data you really will use.\n *\n * \\param addr The cacheline containing \\p addr will be prefetched.\n *\n * \\ingroup Utilities\n * \\headerfile memory.h <Vc/Memory>\n */\nVc_ALWAYS_INLINE void prefetchMid(const void *addr)\n{\n    Vc::Detail::prefetchMid(addr, VectorAbi::Best<float>());\n}\n\n/**\n * Prefetch the cacheline containing \\p addr to L3 cache.\n *\n * This prefetch evicts data from the cache. So use it only for data you really will use.\n *\n * \\param addr The cacheline containing \\p addr will be prefetched.\n *\n * \\ingroup Utilities\n * \\headerfile memory.h <Vc/Memory>\n */\nVc_ALWAYS_INLINE void prefetchFar(const void *addr)\n{\n    Vc::Detail::prefetchFar(addr, VectorAbi::Best<float>());\n}\n}  // namespace Common\n\nusing Common::Memory;\nusing Common::prefetchForOneRead;\nusing Common::prefetchForModify;\nusing Common::prefetchClose;\nusing Common::prefetchMid;\nusing Common::prefetchFar;\n}  // namespace Vc\n\nnamespace std\n{\n    template<typename V> Vc_ALWAYS_INLINE void swap(Vc::Memory<V> &a, Vc::Memory<V> &b) { a.swap(b); }\n} // namespace std\n\n#endif // VC_COMMON_MEMORY_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/memorybase.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MEMORYBASE_H_\n#define VC_COMMON_MEMORYBASE_H_\n\n#include <assert.h>\n#include <type_traits>\n#include <iterator>\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\n#define Vc_MEM_OPERATOR_EQ(op) \\\n        template<typename T> \\\n        Vc_ALWAYS_INLINE enable_if_mutable<T, MemoryVector &> operator op##=(const T &x) { \\\n            const V v = value() op x; \\\n            v.store(&m_data[0], Flags()); \\\n            return *this; \\\n        }\n/*dox{{{*/\n/**\n * Helper class for the Memory::vector(size_t) class of functions.\n *\n * You will never need to directly make use of this class. It is an implementation detail of the\n * Memory API.\n *\n * \\headerfile memorybase.h <Vc/Memory>\n *//*}}}*/\ntemplate<typename _V, typename Flags> class MemoryVector/*{{{*/\n{\n    typedef typename std::remove_cv<_V>::type V;\n\n    template<typename T, typename R> using enable_if_mutable =\n        typename std::enable_if<std::is_same<T, T>::value && !std::is_const<_V>::value, R>::type;\n\n    using EntryType =\n        typename std::conditional<std::is_const<_V>::value, const typename V::EntryType,\n                                  typename V::EntryType>::type;\n    typedef typename V::Mask Mask;\n\n    EntryType m_data[V::Size];\n\npublic:\n        // It is important that neither initialization nor cleanup is done as MemoryVector aliases\n        // other memory\n        Vc_INTRINSIC MemoryVector() = default;\n\n        // disable copies because this type is supposed to alias the data in a Memory object,\n        // nothing else\n        MemoryVector(const MemoryVector &) = delete;\n        MemoryVector(MemoryVector &&) = delete;\n        // Do not disable MemoryVector &operator=(const MemoryVector &) = delete; because it is\n        // covered nicely by the operator= below.\n\n        //! \\internal\n        Vc_ALWAYS_INLINE Vc_PURE V value() const { return V(&m_data[0], Flags()); }\n\n        /**\n         * Cast to \\p V operator.\n         *\n         * This function allows to assign this object to any object of type \\p V.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE operator V() const { return value(); }\n\n        template<typename T>\n        Vc_ALWAYS_INLINE enable_if_mutable<T, MemoryVector &> operator=(const T &x) {\n            V v;\n            v = x;\n            v.store(&m_data[0], Flags());\n            return *this;\n        }\n\n        Vc_ALL_BINARY(Vc_MEM_OPERATOR_EQ);\n        Vc_ALL_ARITHMETICS(Vc_MEM_OPERATOR_EQ);\n\n    Vc_ALWAYS_INLINE EntryType &operator[](size_t i) { return m_data[i]; }\n    Vc_ALWAYS_INLINE const EntryType &operator[](size_t i) const { return m_data[i]; }\n};\n\ntemplate<typename _V, typename Flags> class MemoryVectorIterator\n{\n    typedef typename std::remove_cv<_V>::type V;\n\n    template<typename T, typename R> using enable_if_mutable =\n        typename std::enable_if<std::is_same<T, T>::value && !std::is_const<_V>::value, R>::type;\n\n    using iterator_traits = std::iterator_traits<MemoryVector<_V, Flags> *>;\n\n    MemoryVector<_V, Flags> *d;\npublic:\n    typedef typename iterator_traits::difference_type difference_type;\n    typedef typename iterator_traits::value_type value_type;\n    typedef typename iterator_traits::pointer pointer;\n    typedef typename iterator_traits::reference reference;\n    typedef typename iterator_traits::iterator_category iterator_category;\n\n    constexpr MemoryVectorIterator(MemoryVector<_V, Flags> *dd) : d(dd) {}\n    constexpr MemoryVectorIterator(const MemoryVectorIterator &) = default;\n    constexpr MemoryVectorIterator(MemoryVectorIterator &&) = default;\n    Vc_ALWAYS_INLINE MemoryVectorIterator &operator=(const MemoryVectorIterator &) = default;\n\n    Vc_ALWAYS_INLINE void *orderBy() const { return d; }\n\n    Vc_ALWAYS_INLINE difference_type operator-(const MemoryVectorIterator &rhs) const { return d - rhs.d; }\n    Vc_ALWAYS_INLINE reference operator[](size_t i) const { return d[i]; }\n    Vc_ALWAYS_INLINE reference operator*() const { return *d; }\n    Vc_ALWAYS_INLINE pointer operator->() const { return d; }\n    Vc_ALWAYS_INLINE MemoryVectorIterator &operator++() { ++d; return *this; }\n    Vc_ALWAYS_INLINE MemoryVectorIterator operator++(int) { MemoryVectorIterator r(*this); ++d; return r; }\n    Vc_ALWAYS_INLINE MemoryVectorIterator &operator--() { --d; return *this; }\n    Vc_ALWAYS_INLINE MemoryVectorIterator operator--(int) { MemoryVectorIterator r(*this); --d; return r; }\n    Vc_ALWAYS_INLINE MemoryVectorIterator &operator+=(size_t n) { d += n; return *this; }\n    Vc_ALWAYS_INLINE MemoryVectorIterator &operator-=(size_t n) { d -= n; return *this; }\n    Vc_ALWAYS_INLINE MemoryVectorIterator operator+(size_t n) const { return MemoryVectorIterator(d + n); }\n    Vc_ALWAYS_INLINE MemoryVectorIterator operator-(size_t n) const { return MemoryVectorIterator(d - n); }\n};\n\ntemplate<typename V, typename FlagsL, typename FlagsR>\nVc_ALWAYS_INLINE bool operator==(const MemoryVectorIterator<V, FlagsL> &l, const MemoryVectorIterator<V, FlagsR> &r)\n{\n    return l.orderBy() == r.orderBy();\n}\ntemplate<typename V, typename FlagsL, typename FlagsR>\nVc_ALWAYS_INLINE bool operator!=(const MemoryVectorIterator<V, FlagsL> &l, const MemoryVectorIterator<V, FlagsR> &r)\n{\n    return l.orderBy() != r.orderBy();\n}\ntemplate<typename V, typename FlagsL, typename FlagsR>\nVc_ALWAYS_INLINE bool operator>=(const MemoryVectorIterator<V, FlagsL> &l, const MemoryVectorIterator<V, FlagsR> &r)\n{\n    return l.orderBy() >= r.orderBy();\n}\ntemplate<typename V, typename FlagsL, typename FlagsR>\nVc_ALWAYS_INLINE bool operator<=(const MemoryVectorIterator<V, FlagsL> &l, const MemoryVectorIterator<V, FlagsR> &r)\n{\n    return l.orderBy() <= r.orderBy();\n}\ntemplate<typename V, typename FlagsL, typename FlagsR>\nVc_ALWAYS_INLINE bool operator> (const MemoryVectorIterator<V, FlagsL> &l, const MemoryVectorIterator<V, FlagsR> &r)\n{\n    return l.orderBy() >  r.orderBy();\n}\ntemplate<typename V, typename FlagsL, typename FlagsR>\nVc_ALWAYS_INLINE bool operator< (const MemoryVectorIterator<V, FlagsL> &l, const MemoryVectorIterator<V, FlagsR> &r)\n{\n    return l.orderBy() <  r.orderBy();\n}\n/*}}}*/\n#undef Vc_MEM_OPERATOR_EQ\n\n#define Vc_VPH_OPERATOR(op)                                                              \\\n    template <typename V1, typename Flags1, typename V2, typename Flags2>                \\\n    decltype(std::declval<V1>() op std::declval<V2>()) operator op(                      \\\n        const MemoryVector<V1, Flags1> &x, const MemoryVector<V2, Flags2> &y)            \\\n    {                                                                                    \\\n        return x.value() op y.value();                                                   \\\n    }\nVc_ALL_ARITHMETICS(Vc_VPH_OPERATOR);\nVc_ALL_BINARY     (Vc_VPH_OPERATOR);\nVc_ALL_COMPARES   (Vc_VPH_OPERATOR);\n#undef Vc_VPH_OPERATOR\n\ntemplate<typename V, typename Parent, typename Flags = Prefetch<>> class MemoryRange/*{{{*/\n{\n    Parent *m_parent;\n    size_t m_first;\n    size_t m_last;\n\npublic:\n    MemoryRange(Parent *p, size_t firstIndex, size_t lastIndex)\n        : m_parent(p), m_first(firstIndex), m_last(lastIndex)\n    {}\n\n    MemoryVectorIterator<V, Flags> begin() const { return &m_parent->vector(m_first   , Flags()); }\n    MemoryVectorIterator<V, Flags> end() const   { return &m_parent->vector(m_last + 1, Flags()); }\n};/*}}}*/\ntemplate<typename V, typename Parent, int Dimension, typename RowMemory> class MemoryDimensionBase;\ntemplate<typename V, typename Parent, typename RowMemory> class MemoryDimensionBase<V, Parent, 1, RowMemory> // {{{1\n{\n    private:\n        Parent *p() { return static_cast<Parent *>(this); }\n        const Parent *p() const { return static_cast<const Parent *>(this); }\n    public:\n        /**\n         * The type of the scalar entries in the array.\n         */\n        typedef typename V::EntryType EntryType;\n\n        /**\n         * Returns a pointer to the start of the allocated memory.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE       EntryType *entries()       { return &p()->m_mem[0]; }\n        /// Const overload of the above function.\n        Vc_ALWAYS_INLINE Vc_PURE const EntryType *entries() const { return &p()->m_mem[0]; }\n\n        /**\n         * Returns the \\p i-th scalar value in the memory.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE EntryType &scalar(size_t i) { return entries()[i]; }\n        /// Const overload of the above function.\n        Vc_ALWAYS_INLINE Vc_PURE const EntryType scalar(size_t i) const { return entries()[i]; }\n\n#ifdef DOXYGEN\n        /**\n         * Cast operator to the scalar type. This allows to use the object very much like a standard\n         * C array.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE operator       EntryType*()       { return entries(); }\n        /// Const overload of the above function.\n        Vc_ALWAYS_INLINE Vc_PURE operator const EntryType*() const { return entries(); }\n#else\n        // The above conversion operator allows implicit conversion to bool. To prohibit this\n        // conversion we use SFINAE to allow only conversion to EntryType* and void*.\n        template <typename T,\n                  typename std::enable_if<\n                      std::is_same<typename std::remove_const<T>::type, EntryType *>::value ||\n                          std::is_same<typename std::remove_const<T>::type, void *>::value,\n                      int>::type = 0>\n        Vc_ALWAYS_INLINE Vc_PURE operator T()\n        {\n            return entries();\n        }\n        template <typename T,\n                  typename std::enable_if<std::is_same<T, const EntryType *>::value ||\n                                              std::is_same<T, const void *>::value,\n                                          int>::type = 0>\n        Vc_ALWAYS_INLINE Vc_PURE operator T() const\n        {\n            return entries();\n        }\n#endif\n\n        /**\n         *\n         */\n        template<typename Flags>\n        Vc_ALWAYS_INLINE MemoryRange<V, Parent, Flags> range(size_t firstIndex, size_t lastIndex, Flags) {\n            return MemoryRange<V, Parent, Flags>(p(), firstIndex, lastIndex);\n        }\n        Vc_ALWAYS_INLINE MemoryRange<V, Parent> range(size_t firstIndex, size_t lastIndex) {\n            return MemoryRange<V, Parent>(p(), firstIndex, lastIndex);\n        }\n        template<typename Flags>\n        Vc_ALWAYS_INLINE MemoryRange<const V, Parent, Flags> range(size_t firstIndex, size_t lastIndex, Flags) const {\n            return MemoryRange<const V, Parent, Flags>(p(), firstIndex, lastIndex);\n        }\n        Vc_ALWAYS_INLINE MemoryRange<const V, Parent> range(size_t firstIndex, size_t lastIndex) const {\n            return MemoryRange<const V, Parent>(p(), firstIndex, lastIndex);\n        }\n\n        /**\n         * Returns the \\p i-th scalar value in the memory.\n         */\n        Vc_ALWAYS_INLINE EntryType &operator[](size_t i) { return entries()[i]; }\n        /// Const overload of the above function.\n        Vc_ALWAYS_INLINE const EntryType &operator[](size_t i) const { return entries()[i]; }\n\n        /**\n         * Uses a vector gather to combine the entries at the indexes in \\p i into the returned\n         * vector object.\n         *\n         * \\param i  An integer vector. It determines the entries to be gathered.\n         * \\returns  A vector object. Modification of this object will not modify the values in\n         *           memory.\n         *\n         * \\warning  The API of this function might change in future versions of Vc to additionally\n         *           support scatters.\n         */\n        template<typename IndexT> Vc_ALWAYS_INLINE Vc_PURE V operator[](Vector<IndexT> i) const\n        {\n            return V(entries(), i);\n        }\n};\ntemplate<typename V, typename Parent, typename RowMemory> class MemoryDimensionBase<V, Parent, 2, RowMemory> // {{{1\n{\n    private:\n        Parent *p() { return static_cast<Parent *>(this); }\n        const Parent *p() const { return static_cast<const Parent *>(this); }\n    public:\n        /**\n         * The type of the scalar entries in the array.\n         */\n        typedef typename V::EntryType EntryType;\n\n        static constexpr size_t rowCount() { return Parent::RowCount; }\n\n        /**\n         * Returns a pointer to the start of the allocated memory.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE       EntryType *entries(size_t x = 0)       { return &p()->m_mem[x][0]; }\n        /// Const overload of the above function.\n        Vc_ALWAYS_INLINE Vc_PURE const EntryType *entries(size_t x = 0) const { return &p()->m_mem[x][0]; }\n\n        /**\n         * Returns the \\p i,j-th scalar value in the memory.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE EntryType &scalar(size_t i, size_t j) { return entries(i)[j]; }\n        /// Const overload of the above function.\n        Vc_ALWAYS_INLINE Vc_PURE const EntryType scalar(size_t i, size_t j) const { return entries(i)[j]; }\n\n        /**\n         * Returns the \\p i-th row in the memory.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE RowMemory &operator[](size_t i) {\n            return p()->m_mem[i];\n        }\n        /// Const overload of the above function.\n        Vc_ALWAYS_INLINE Vc_PURE const RowMemory &operator[](size_t i) const {\n            return p()->m_mem[i];\n        }\n\n        /**\n         * \\return the number of rows in the array.\n         *\n         * \\note This function can be eliminated by an optimizing compiler.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE size_t rowsCount() const { return p()->rowsCount(); }\n};\n\n//dox{{{1\n/**\n * \\headerfile memorybase.h <Vc/Memory>\n *\n * Common interface to all Memory classes, independent of allocation on the stack or heap.\n *\n * \\param V The vector type you want to operate on. (e.g. float_v or uint_v)\n * \\param Parent This type is the complete type of the class that derives from MemoryBase.\n * \\param Dimension The number of dimensions the implementation provides.\n * \\param RowMemory Class to be used to work on a single row.\n */\ntemplate<typename V, typename Parent, int Dimension, typename RowMemory> class MemoryBase : public MemoryDimensionBase<V, Parent, Dimension, RowMemory> //{{{1\n{\n    static_assert((V::size() * sizeof(typename V::EntryType)) % V::MemoryAlignment == 0,\n                  \"Vc::Memory can only be used for data-parallel types storing a number \"\n                  \"of values that's a multiple of the memory alignment.\");\n\n    private:\n        Parent *p() { return static_cast<Parent *>(this); }\n        const Parent *p() const { return static_cast<const Parent *>(this); }\n\n        template <class Flags>\n        using vector_reference = MayAlias<MemoryVector<V, Flags>> &;\n        template <class Flags>\n        using const_vector_reference = const MayAlias<MemoryVector<const V, Flags>> &;\n\n    public:\n        /**\n         * The type of the scalar entries in the array.\n         */\n        typedef typename V::EntryType EntryType;\n\n        /**\n         * \\return the number of scalar entries in the array. This function is optimized away\n         * if a constant size array is used.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE size_t entriesCount() const { return p()->entriesCount(); }\n        /**\n         * \\return the number of vector entries that span the array. This function is optimized away\n         * if a constant size array is used.\n         */\n        Vc_ALWAYS_INLINE Vc_PURE size_t vectorsCount() const { return p()->vectorsCount(); }\n\n        using MemoryDimensionBase<V, Parent, Dimension, RowMemory>::entries;\n        using MemoryDimensionBase<V, Parent, Dimension, RowMemory>::scalar;\n\n        /**\n         * Return a (vectorized) iterator to the start of this memory object.\n         */\n        template<typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE MemoryVectorIterator<      V, Flags> begin(Flags flags = Flags())       { return &firstVector(flags); }\n        //! const overload of the above\n        template<typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE MemoryVectorIterator<const V, Flags> begin(Flags flags = Flags()) const { return &firstVector(flags); }\n\n        /**\n         * Return a (vectorized) iterator to the end of this memory object.\n         */\n        template<typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE MemoryVectorIterator<      V, Flags>   end(Flags flags = Flags())       { return &lastVector(flags) + 1; }\n        //! const overload of the above\n        template<typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE MemoryVectorIterator<const V, Flags>   end(Flags flags = Flags()) const { return &lastVector(flags) + 1; }\n\n        /**\n         * \\param i Selects the offset, where the vector should be read.\n         *\n         * \\return a smart object to wrap the \\p i-th vector in the memory.\n         *\n         * The return value can be used as any other vector object. I.e. you can substitute\n         * something like\n         * \\code\n         * float_v a = ..., b = ...;\n         * a += b;\n         * \\endcode\n         * with\n         * \\code\n         * mem.vector(i) += b;\n         * \\endcode\n         *\n         * This function ensures that only \\em aligned loads and stores are used. Thus it only allows to\n         * access memory at fixed strides. If access to known offsets from the aligned vectors is\n         * needed the vector(size_t, int) function can be used.\n         */\n        template <typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE\n            typename std::enable_if<!std::is_convertible<Flags, int>::value,\n                                    vector_reference<Flags>>::type\n            vector(size_t i, Flags = Flags())\n        {\n            return *aliasing_cast<MemoryVector<V, Flags>>(&entries()[i * V::Size]);\n        }\n        /** \\brief Const overload of the above function\n         *\n         * \\param i Selects the offset, where the vector should be read.\n         *\n         * \\return a smart object to wrap the \\p i-th vector in the memory.\n         */\n        template <typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE\n            typename std::enable_if<!std::is_convertible<Flags, int>::value,\n                                    const_vector_reference<Flags>>::type\n            vector(size_t i, Flags = Flags()) const\n        {\n            return *aliasing_cast<MemoryVector<const V, Flags>>(&entries()[i * V::Size]);\n        }\n\n        /**\n         * \\return a smart object to wrap the vector starting from the \\p i-th scalar entry in the memory.\n         *\n         * Example:\n         * \\code\n         * Memory<float_v, N> mem;\n         * mem.setZero();\n         * for (int i = 0; i < mem.entriesCount(); i += float_v::Size) {\n         *     mem.vectorAt(i) += b;\n         * }\n         * \\endcode\n         *\n         * \\param i      Specifies the scalar entry from where the vector will be loaded/stored. I.e. the\n         * values scalar(i), scalar(i + 1), ..., scalar(i + V::Size - 1) will be read/overwritten.\n         *\n         * \\param flags  You must take care to determine whether an unaligned load/store is\n         * required. Per default an unaligned load/store is used. If \\p i is a multiple of \\c V::Size\n         * you may want to pass Vc::Aligned here.\n         */\n        template <typename Flags = UnalignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE vector_reference<Flags> vectorAt(size_t i,\n                                                                  Flags flags = Flags())\n        {\n            return *aliasing_cast<MemoryVector<V, Flags>>(&entries()[i]);\n        }\n        /** \\brief Const overload of the above function\n         *\n         * \\return a smart object to wrap the vector starting from the \\p i-th scalar entry in the memory.\n         *\n         * \\param i      Specifies the scalar entry from where the vector will be loaded/stored. I.e. the\n         * values scalar(i), scalar(i + 1), ..., scalar(i + V::Size - 1) will be read/overwritten.\n         *\n         * \\param flags  You must take care to determine whether an unaligned load/store is\n         * required. Per default an unaligned load/store is used. If \\p i is a multiple of \\c V::Size\n         * you may want to pass Vc::Aligned here.\n         */\n        template <typename Flags = UnalignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE const_vector_reference<Flags> vectorAt(\n            size_t i, Flags flags = Flags()) const\n        {\n            return *aliasing_cast<MemoryVector<const V, Flags>>(&entries()[i]);\n        }\n\n        /**\n         * \\return a smart object to wrap the \\p i-th vector + \\p shift in the memory.\n         *\n         * This function ensures that only \\em unaligned loads and stores are used.\n         * It allows to access memory at any location aligned to the entry type.\n         *\n         * \\param i Selects the memory location of the i-th vector. Thus if \\p V::Size == 4 and\n         *          \\p i is set to 3 the base address for the load/store will be the 12th entry\n         *          (same as \\p &mem[12]).\n         * \\param shift Shifts the base address determined by parameter \\p i by \\p shift many\n         *              entries. Thus \\p vector(3, 1) for \\p V::Size == 4 will load/store the\n         *              13th - 16th entries (same as \\p &mem[13]).\n         *\n         * \\note Any shift value is allowed as long as you make sure it stays within bounds of the\n         * allocated memory. Shift values that are a multiple of \\p V::Size will \\em not result in\n         * aligned loads. You have to use the above vector(size_t) function for aligned loads\n         * instead.\n         *\n         * \\note Thus a simple way to access vectors randomly is to set \\p i to 0 and use \\p shift as the\n         * parameter to select the memory address:\n         * \\code\n         * // don't use:\n         * mem.vector(i / V::Size, i % V::Size) += 1;\n         * // instead use:\n         * mem.vector(0, i) += 1;\n         * \\endcode\n         */\n        template <typename ShiftT, typename Flags = decltype(Unaligned)>\n        Vc_ALWAYS_INLINE Vc_PURE typename std::enable_if<\n            std::is_convertible<ShiftT, int>::value,\n            vector_reference<decltype(std::declval<Flags>() | Unaligned)>>::type\n        vector(size_t i, ShiftT shift, Flags = Flags())\n        {\n            return *aliasing_cast<\n                MemoryVector<V, decltype(std::declval<Flags>() | Unaligned)>>(\n                &entries()[i * V::Size + shift]);\n        }\n        /// Const overload of the above function.\n        template <typename ShiftT, typename Flags = decltype(Unaligned)>\n        Vc_ALWAYS_INLINE Vc_PURE typename std::enable_if<\n            std::is_convertible<ShiftT, int>::value,\n            const_vector_reference<decltype(std::declval<Flags>() | Unaligned)>>::type\n        vector(size_t i, ShiftT shift, Flags = Flags()) const\n        {\n            return *aliasing_cast<\n                MemoryVector<const V, decltype(std::declval<Flags>() | Unaligned)>>(\n                &entries()[i * V::Size + shift]);\n        }\n\n        /**\n         * \\return the first vector in the allocated memory.\n         *\n         * This function is simply a shorthand for vector(0).\n         */\n        template <typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE vector_reference<Flags> firstVector(Flags f = Flags())\n        {\n            return vector(0, f);\n        }\n        /// Const overload of the above function.\n        template <typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE const_vector_reference<Flags> firstVector(\n            Flags f = Flags()) const\n        {\n            return vector(0, f);\n        }\n\n        /**\n         * \\return the last vector in the allocated memory.\n         *\n         * This function is simply a shorthand for vector(vectorsCount() - 1).\n         */\n        template <typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE vector_reference<Flags> lastVector(Flags f = Flags())\n        {\n            return vector(vectorsCount() - 1, f);\n        }\n        /// Const overload of the above function.\n        template <typename Flags = AlignedTag>\n        Vc_ALWAYS_INLINE Vc_PURE const_vector_reference<Flags> lastVector(\n            Flags f = Flags()) const\n        {\n            return vector(vectorsCount() - 1, f);\n        }\n\n        Vc_ALWAYS_INLINE Vc_PURE V gather(const unsigned char  *indexes) const { return V(entries(), typename V::IndexType(indexes, Vc::Unaligned)); }\n        Vc_ALWAYS_INLINE Vc_PURE V gather(const unsigned short *indexes) const { return V(entries(), typename V::IndexType(indexes, Vc::Unaligned)); }\n        Vc_ALWAYS_INLINE Vc_PURE V gather(const unsigned int   *indexes) const { return V(entries(), typename V::IndexType(indexes, Vc::Unaligned)); }\n        Vc_ALWAYS_INLINE Vc_PURE V gather(const unsigned long  *indexes) const { return V(entries(), typename V::IndexType(indexes, Vc::Unaligned)); }\n\n        /**\n         * Zero the whole memory area.\n         */\n        Vc_ALWAYS_INLINE void setZero() {\n            V zero(Vc::Zero);\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) = zero;\n            }\n        }\n\n        /**\n         * Assign a value to all vectors in the array.\n         */\n        template<typename U>\n        Vc_ALWAYS_INLINE Parent &operator=(U &&x) {\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) = std::forward<U>(x);\n            }\n        }\n\n        /**\n         * (Inefficient) shorthand to add up two arrays.\n         */\n        template<typename P2, typename RM>\n        inline Parent &operator+=(const MemoryBase<V, P2, Dimension, RM> &rhs) {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) += rhs.vector(i);\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand to subtract two arrays.\n         */\n        template<typename P2, typename RM>\n        inline Parent &operator-=(const MemoryBase<V, P2, Dimension, RM> &rhs) {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) -= rhs.vector(i);\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand to multiply two arrays.\n         */\n        template<typename P2, typename RM>\n        inline Parent &operator*=(const MemoryBase<V, P2, Dimension, RM> &rhs) {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) *= rhs.vector(i);\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand to divide two arrays.\n         */\n        template<typename P2, typename RM>\n        inline Parent &operator/=(const MemoryBase<V, P2, Dimension, RM> &rhs) {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) /= rhs.vector(i);\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand to add a value to an array.\n         */\n        inline Parent &operator+=(EntryType rhs) {\n            V v(rhs);\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) += v;\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand to subtract a value from an array.\n         */\n        inline Parent &operator-=(EntryType rhs) {\n            V v(rhs);\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) -= v;\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand to multiply a value to an array.\n         */\n        inline Parent &operator*=(EntryType rhs) {\n            V v(rhs);\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) *= v;\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand to divide an array with a value.\n         */\n        inline Parent &operator/=(EntryType rhs) {\n            V v(rhs);\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                vector(i) /= v;\n            }\n            return static_cast<Parent &>(*this);\n        }\n\n        /**\n         * (Inefficient) shorthand compare equality of two arrays.\n         */\n        template<typename P2, typename RM>\n        inline bool operator==(const MemoryBase<V, P2, Dimension, RM> &rhs) const {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                if (!(V(vector(i)) == V(rhs.vector(i))).isFull()) {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        /**\n         * (Inefficient) shorthand compare two arrays.\n         */\n        template<typename P2, typename RM>\n        inline bool operator!=(const MemoryBase<V, P2, Dimension, RM> &rhs) const {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                if (!(V(vector(i)) == V(rhs.vector(i))).isEmpty()) {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        /**\n         * (Inefficient) shorthand compare two arrays.\n         */\n        template<typename P2, typename RM>\n        inline bool operator<(const MemoryBase<V, P2, Dimension, RM> &rhs) const {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                if (!(V(vector(i)) < V(rhs.vector(i))).isFull()) {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        /**\n         * (Inefficient) shorthand compare two arrays.\n         */\n        template<typename P2, typename RM>\n        inline bool operator<=(const MemoryBase<V, P2, Dimension, RM> &rhs) const {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                if (!(V(vector(i)) <= V(rhs.vector(i))).isFull()) {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        /**\n         * (Inefficient) shorthand compare two arrays.\n         */\n        template<typename P2, typename RM>\n        inline bool operator>(const MemoryBase<V, P2, Dimension, RM> &rhs) const {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                if (!(V(vector(i)) > V(rhs.vector(i))).isFull()) {\n                    return false;\n                }\n            }\n            return true;\n        }\n\n        /**\n         * (Inefficient) shorthand compare two arrays.\n         */\n        template<typename P2, typename RM>\n        inline bool operator>=(const MemoryBase<V, P2, Dimension, RM> &rhs) const {\n            assert(vectorsCount() == rhs.vectorsCount());\n            for (size_t i = 0; i < vectorsCount(); ++i) {\n                if (!(V(vector(i)) >= V(rhs.vector(i))).isFull()) {\n                    return false;\n                }\n            }\n            return true;\n        }\n};\n\nnamespace Detail\n{\ntemplate <typename V,\n          typename ParentL,\n          typename ParentR,\n          int Dimension,\n          typename RowMemoryL,\n          typename RowMemoryR>\ninline void copyVectors(MemoryBase<V, ParentL, Dimension, RowMemoryL> &dst,\n                        const MemoryBase<V, ParentR, Dimension, RowMemoryR> &src)\n{\n    const size_t vectorsCount = dst.vectorsCount();\n    size_t i = 3;\n    for (; i < vectorsCount; i += 4) {\n        const V tmp3 = src.vector(i - 3);\n        const V tmp2 = src.vector(i - 2);\n        const V tmp1 = src.vector(i - 1);\n        const V tmp0 = src.vector(i - 0);\n        dst.vector(i - 3) = tmp3;\n        dst.vector(i - 2) = tmp2;\n        dst.vector(i - 1) = tmp1;\n        dst.vector(i - 0) = tmp0;\n    }\n    for (i -= 3; i < vectorsCount; ++i) {\n        dst.vector(i) = src.vector(i);\n    }\n}\n} // namespace Detail\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_MEMORYBASE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/memoryfwd.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_MEMORYFWD_H_\n#define VC_COMMON_MEMORYFWD_H_\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\ntemplate <typename V, std::size_t Size1 = 0, std::size_t Size2 = 0,\n          bool InitPadding = true>\nclass Memory;\n\ntemplate <typename V, typename Parent, int Dimension, typename RowMemory>\nclass MemoryBase;\n}  // namespace Common\n\nusing Common::Memory;\n}  // namespace Vc\n\n#endif // VC_COMMON_MEMORYFWD_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/operators.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2016 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef COMMON_OPERATORS_H_\n#define COMMON_OPERATORS_H_\n#include \"simdarray.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <typename T, typename Abi, typename U>\nenable_if<!std::is_same<T, U>::value, U> is_convertible_to_any_vector(Vector<U, Abi>);\ntemplate <typename T, typename Abi> T is_convertible_to_any_vector(Vector<T, Abi>);\n\ntemplate <typename T, typename U, bool = std::is_integral<T>::value,\n          bool = std::is_integral<U>::value>\nstruct FundamentalReturnType;\ntemplate <class T, class U>\nusing fundamental_return_t = typename FundamentalReturnType<T, U>::type;\n\ntemplate <typename T, typename U> struct FundamentalReturnType<T, U, false, false> {\n    using type = typename std::conditional<\n        std::is_arithmetic<U>::value,\n        typename std::conditional<(sizeof(T) < sizeof(U)), U, T>::type,\n        // U is not arithmetic, e.g. an enum or a type with e.g. operator int()\n        T>::type;\n};\ntemplate <typename T, typename U> struct FundamentalReturnType<T, U, true, false> {\n    using type = typename std::conditional<\n        std::is_arithmetic<U>::value, U,\n        // U is not arithmetic, e.g. an enum or a type with e.g. operator int()\n        T>::type;\n};\ntemplate <typename T, typename U> struct FundamentalReturnType<T, U, false, true> {\n    using type = T;\n};\n\ntemplate <typename T> struct my_make_signed : public std::make_signed<T> {\n};\ntemplate <> struct my_make_signed<bool> {\n    using type = bool;\n};\n\ntemplate <typename TT, typename UU>\nstruct higher_conversion_rank {\n    template <typename A>\n    using fix_sign =\n        typename std::conditional<(std::is_unsigned<TT>::value ||\n                                   std::is_unsigned<UU>::value),\n                                  typename std::make_unsigned<A>::type, A>::type;\n    using T = typename my_make_signed<TT>::type;\n    using U = typename my_make_signed<UU>::type;\n    template <typename Test, typename Otherwise>\n    using c = typename std::conditional<std::is_same<T, Test>::value ||\n                                            std::is_same<U, Test>::value,\n                                        Test, Otherwise>::type;\n\n    using type = fix_sign<c<long long, c<long, c<int, c<short, c<signed char, void>>>>>>;\n};\n\ntemplate <typename T, typename U> struct FundamentalReturnType<T, U, true, true> {\n    template <bool B, class Then, class E>\n    using c = typename std::conditional<B, Then, E>::type;\n    using type =\n        c<(sizeof(T) > sizeof(U)), T,\n          c<(sizeof(T) < sizeof(U)), U, typename higher_conversion_rank<T, U>::type>>;\n};\n\ntemplate <class V, class T, class Tq, class = void> struct ReturnTypeImpl {\n    // no type => SFINAE\n};\n// 1. Vector × Vector\ntemplate <class T, class U, class Abi, class Uq>\nstruct ReturnTypeImpl<Vector<T, Abi>, Vector<U, Abi>, Uq, void> {\n    using type = Vc::Vector<fundamental_return_t<T, U>, Abi>;\n};\n// 2. Vector × int\ntemplate <class T, class Abi, class Uq>\nstruct ReturnTypeImpl<Vector<T, Abi>, int, Uq, void> {\n    // conversion from int is always allowed (because its the default when you hardcode a\n    // number)\n    using type = Vc::Vector<T, Abi>;\n};\n// 3. Vector × unsigned\ntemplate <class T, class Abi, class Uq>\nstruct ReturnTypeImpl<Vector<T, Abi>, uint, Uq, void> {\n    // conversion from unsigned int is allowed for all integral Vector<T>, but ensures\n    // unsigned result\n    using type = Vc::Vector<\n        typename std::conditional<std::is_integral<T>::value, std::make_unsigned<T>,\n                                  std::enable_if<true, T>>::type::type,\n        Abi>;\n};\n// 4. Vector × {enum, arithmetic}\ntemplate <class T, class U, class Abi, class Uq>\nstruct ReturnTypeImpl<\n    Vector<T, Abi>, U, Uq,\n    enable_if<!std::is_class<U>::value && !std::is_same<U, int>::value &&\n                  !std::is_same<U, uint>::value &&\n                  Traits::is_valid_vector_argument<fundamental_return_t<T, U>>::value,\n              void>> {\n    using type = Vc::Vector<fundamental_return_t<T, U>, Abi>;\n};\n// 5. Vector × UDT\ntemplate <class T, class U, class Abi, class Uq>\nstruct ReturnTypeImpl<\n    Vector<T, Abi>, U, Uq,\n    enable_if<std::is_class<U>::value && !Traits::is_simd_vector<U>::value &&\n                  Traits::is_valid_vector_argument<decltype(\n                      is_convertible_to_any_vector<T, Abi>(std::declval<Uq>()))>::value,\n              void>> {\n    using type =\n        Vc::Vector<fundamental_return_t<T, decltype(is_convertible_to_any_vector<T, Abi>(\n                                               std::declval<Uq>()))>,\n                   Abi>;\n};\ntemplate <class V, class Tq, class T = remove_cvref_t<Tq>>\nusing ReturnType = typename ReturnTypeImpl<V, T, Tq>::type;\n\ntemplate <class T> struct is_a_type : public std::true_type {\n};\n\n#ifdef Vc_ENABLE_FLOAT_BIT_OPERATORS\n#define Vc_TEST_FOR_BUILTIN_OPERATOR(op_) true\n#else\n#define Vc_TEST_FOR_BUILTIN_OPERATOR(op_)                                                \\\n    Detail::is_a_type<decltype(std::declval<typename R::value_type>()                    \\\n                                   op_ std::declval<typename R::value_type>())>::value\n#endif\n}  // namespace Detail\n\n#define Vc_GENERIC_OPERATOR(op_)                                                         \\\n    template <class T, class Abi, class U,                                               \\\n              class R = Detail::ReturnType<Vector<T, Abi>, U>>                           \\\n    Vc_ALWAYS_INLINE enable_if<Vc_TEST_FOR_BUILTIN_OPERATOR(op_) &&                      \\\n                                   std::is_convertible<Vector<T, Abi>, R>::value &&      \\\n                                   std::is_convertible<U, R>::value,                     \\\n                               R>                                                        \\\n    operator op_(Vector<T, Abi> x, U &&y)                                                \\\n    {                                                                                    \\\n        return Detail::operator op_(R(x), R(std::forward<U>(y)));                        \\\n    }                                                                                    \\\n    template <class T, class Abi, class U,                                               \\\n              class R = Detail::ReturnType<Vector<T, Abi>, U>>                           \\\n    Vc_ALWAYS_INLINE enable_if<Vc_TEST_FOR_BUILTIN_OPERATOR(op_) &&                      \\\n                                   !Traits::is_simd_vector<U>::value &&                  \\\n                                   std::is_convertible<Vector<T, Abi>, R>::value &&      \\\n                                   std::is_convertible<U, R>::value,                     \\\n                               R>                                                        \\\n    operator op_(U &&x, Vector<T, Abi> y)                                                \\\n    {                                                                                    \\\n        return Detail::operator op_(R(std::forward<U>(x)), R(y));                        \\\n    }                                                                                    \\\n    template <class T, class Abi, class U,                                               \\\n              class R = Detail::ReturnType<Vector<T, Abi>, U>>                           \\\n    Vc_ALWAYS_INLINE enable_if<Vc_TEST_FOR_BUILTIN_OPERATOR(op_) &&                      \\\n                                   std::is_convertible<Vector<T, Abi>, R>::value &&      \\\n                                   std::is_convertible<U, R>::value,                     \\\n                               Vector<T, Abi> &>                                         \\\n    operator op_##=(Vector<T, Abi> &x, U &&y)                                            \\\n    {                                                                                    \\\n        x = Detail::operator op_(R(x), R(std::forward<U>(y)));                           \\\n        return x;                                                                        \\\n    }\n\n#define Vc_LOGICAL_OPERATOR(op_)                                                         \\\n    template <class T, class Abi>                                                        \\\n    Vc_ALWAYS_INLINE typename Vector<T, Abi>::Mask operator op_(Vector<T, Abi> x,        \\\n                                                                Vector<T, Abi> y)        \\\n    {                                                                                    \\\n        return !!x op_ !!y;                                                              \\\n    }                                                                                    \\\n    template <class T, class Abi, class U>                                               \\\n    Vc_ALWAYS_INLINE                                                                     \\\n        enable_if<std::is_convertible<Vector<T, Abi>, Vector<U, Abi>>::value &&          \\\n                      std::is_convertible<Vector<U, Abi>, Vector<T, Abi>>::value,        \\\n                  typename Detail::ReturnType<Vector<T, Abi>, Vector<U, Abi>>::Mask>     \\\n        operator op_(Vector<T, Abi> x, Vector<U, Abi> y)                                 \\\n    {                                                                                    \\\n        return !!x op_ !!y;                                                              \\\n    }                                                                                    \\\n    template <class T, class Abi, class U>                                               \\\n    Vc_ALWAYS_INLINE enable_if<std::is_same<bool, decltype(!std::declval<U>())>::value,  \\\n                               typename Vector<T, Abi>::Mask>                            \\\n    operator op_(Vector<T, Abi> x, U &&y)                                                \\\n    {                                                                                    \\\n        using M = typename Vector<T, Abi>::Mask;                                         \\\n        return !!x op_ M(!!std::forward<U>(y));                                          \\\n    }                                                                                    \\\n    template <class T, class Abi, class U>                                               \\\n    Vc_ALWAYS_INLINE enable_if<std::is_same<bool, decltype(!std::declval<U>())>::value,  \\\n                               typename Vector<T, Abi>::Mask>                            \\\n    operator op_(U &&x, Vector<T, Abi> y)                                                \\\n    {                                                                                    \\\n        using M = typename Vector<T, Abi>::Mask;                                         \\\n        return M(!!std::forward<U>(x)) op_ !!y;                                          \\\n    }\n\n#define Vc_COMPARE_OPERATOR(op_)                                                         \\\n    template <class T, class Abi, class U,                                               \\\n              class R = Detail::ReturnType<Vector<T, Abi>, U>>                           \\\n    Vc_ALWAYS_INLINE enable_if<std::is_convertible<Vector<T, Abi>, R>::value &&          \\\n                                   std::is_convertible<U, R>::value,                     \\\n                               typename R::Mask>                                         \\\n    operator op_(Vector<T, Abi> x, U &&y)                                                \\\n    {                                                                                    \\\n        return Detail::operator op_(R(x), R(std::forward<U>(y)));                        \\\n    }                                                                                    \\\n    template <class T, class Abi, class U,                                               \\\n              class R = Detail::ReturnType<Vector<T, Abi>, U>>                           \\\n    Vc_ALWAYS_INLINE                                                                     \\\n        enable_if<!Traits::is_simd_vector_internal<remove_cvref_t<U>>::value &&          \\\n                      std::is_convertible<Vector<T, Abi>, R>::value &&                   \\\n                      std::is_convertible<U, R>::value,                                  \\\n                  typename R::Mask>                                                      \\\n        operator op_(U &&x, Vector<T, Abi> y)                                            \\\n    {                                                                                    \\\n        return Detail::operator op_(R(std::forward<U>(x)), R(y));                        \\\n    }\n\nVc_ALL_LOGICAL    (Vc_LOGICAL_OPERATOR);\nVc_ALL_BINARY     (Vc_GENERIC_OPERATOR);\nVc_ALL_ARITHMETICS(Vc_GENERIC_OPERATOR);\nVc_ALL_COMPARES   (Vc_COMPARE_OPERATOR);\n\n#undef Vc_LOGICAL_OPERATOR\n#undef Vc_GENERIC_OPERATOR\n#undef Vc_COMPARE_OPERATOR\n#undef Vc_INVALID_OPERATOR\n\n}  // namespace Vc\n#endif  // COMMON_OPERATORS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/permutation.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_PERMUTATION_H_\n#define VC_COMMON_PERMUTATION_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Permutation\n{\nstruct ReversedTag {};\nconstexpr ReversedTag Reversed{};\n}  // namespace Permutation\n}\n\n#endif  // VC_COMMON_PERMUTATION_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/scatterimplementation.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SCATTERIMPLEMENTATION_H_\n#define VC_COMMON_SCATTERIMPLEMENTATION_H_\n\n#include \"gatherimplementation.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeScatter(SetIndexZeroT,\n                                    V &v,\n                                    MT *mem,\n                                    IT indexes,\n                                    typename V::MaskArgument mask)\n{\n    indexes.setZeroInverted(static_cast<typename IT::Mask>(mask));\n    // Huh?\n    const V tmp(mem, indexes);\n    where(mask) | v = tmp;\n}\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeScatter(SimpleLoopT,\n                                    V &v,\n                                    MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask)\n{\n    if (Vc_IS_UNLIKELY(mask.isEmpty())) {\n        return;\n    }\n    Common::unrolled_loop<std::size_t, 0, V::Size>([&](std::size_t i) {\n        if (mask[i])\n            mem[indexes[i]] = v[i];\n    });\n}\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeScatter(BitScanLoopT,\n                                    V &v,\n                                    MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask)\n{\n    size_t bits = mask.toInt();\n    while (Vc_IS_LIKELY(bits > 0)) {\n        size_t i, j;\n        asm(\"bsf %[bits],%[i]\\n\\t\"\n            \"bsr %[bits],%[j]\\n\\t\"\n            \"btr %[i],%[bits]\\n\\t\"\n            \"btr %[j],%[bits]\\n\\t\"\n            : [i] \"=r\"(i), [j] \"=r\"(j), [bits] \"+r\"(bits));\n        mem[indexes[i]] = v[i];\n        mem[indexes[j]] = v[j];\n    }\n\n    /* Alternative from Vc::SSE (0.7)\n    int bits = mask.toInt();\n    while (bits) {\n        const int i = _bit_scan_forward(bits);\n        bits ^= (1 << i); // btr?\n        mem[indexes[i]] = v[i];\n    }\n    */\n}\n\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeScatter(PopcntSwitchT,\n                                    V &v,\n                                    MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 16> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low, high = 0;\n    switch (Vc::Detail::popcnt16(bits)) {\n    case 16:\n        v.scatter(mem, indexes);\n        break;\n    case 15:\n        low = _bit_scan_forward(bits);\n        bits ^= 1 << low;\n        mem[indexes[low]] = v[low];\n    case 14:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 13:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 12:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 11:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 10:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 9:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 8:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 7:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 6:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 5:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 4:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 3:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 2:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n    case 1:\n        low = _bit_scan_forward(bits);\n        mem[indexes[low]] = v[low];\n    case 0:\n        break;\n    }\n}\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeScatter(PopcntSwitchT,\n                                    V &v,\n                                    MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 8> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low, high = 0;\n    switch (Vc::Detail::popcnt8(bits)) {\n    case 8:\n        v.scatter(mem, indexes);\n        break;\n    case 7:\n        low = _bit_scan_forward(bits);\n        bits ^= 1 << low;\n        mem[indexes[low]] = v[low];\n    case 6:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 5:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 4:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n        high = (1 << high);\n    case 3:\n        low = _bit_scan_forward(bits);\n        bits ^= high | (1 << low);\n        mem[indexes[low]] = v[low];\n    case 2:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n    case 1:\n        low = _bit_scan_forward(bits);\n        mem[indexes[low]] = v[low];\n    case 0:\n        break;\n    }\n}\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeScatter(PopcntSwitchT,\n                                    V &v,\n                                    MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 4> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low, high = 0;\n    switch (Vc::Detail::popcnt4(bits)) {\n    case 4:\n        v.scatter(mem, indexes);\n        break;\n    case 3:\n        low = _bit_scan_forward(bits);\n        bits ^= 1 << low;\n        mem[indexes[low]] = v[low];\n    case 2:\n        high = _bit_scan_reverse(bits);\n        mem[indexes[high]] = v[high];\n    case 1:\n        low = _bit_scan_forward(bits);\n        mem[indexes[low]] = v[low];\n    case 0:\n        break;\n    }\n}\ntemplate <typename V, typename MT, typename IT>\nVc_ALWAYS_INLINE void executeScatter(PopcntSwitchT,\n                                    V &v,\n                                    MT *mem,\n                                    const IT &indexes,\n                                    typename V::MaskArgument mask,\n                                    enable_if<V::Size == 2> = nullarg)\n{\n    unsigned int bits = mask.toInt();\n    unsigned int low;\n    switch (Vc::Detail::popcnt4(bits)) {\n    case 2:\n        v.scatter(mem, indexes);\n        break;\n    case 1:\n        low = _bit_scan_forward(bits);\n        mem[indexes[low]] = v[low];\n    case 0:\n        break;\n    }\n}\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_SCATTERIMPLEMENTATION_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/scatterinterface.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// scatters\n// A scatter takes the following arguments:\n// 1. A pointer to memory of any type that EntryType can convert to.\n// 2. An indexes “vector”. The requirement is that the type implements the subscript operator,\n//    stores «Size» valid index values, and each offset to the pointer above yields a valid\n//    memory location for reading.\n// 3. Optionally the third argument may be a mask. The mask disables several memory stores and\n//    thus removes the requirements in (2.) for the disabled entries.\n\nprivate:\n    /**\\internal\n     * This function implements a scatter given a pointer to memory \\p mem and some\n     * container object storing the scatter \\p indexes.\n     *\n     * \\param mem This pointer must be aligned correctly for the type \\p MT. This is the\n     * natural behavior of C++, so this is typically the case.\n     * \\param indexes This object contains at least \\VSize{T} indexes that denote the\n     * offset in \\p mem where the components for the current vector should be copied to.\n     * The offset is not in Bytes, but in multiples of `sizeof(MT)`.\n     */\n    // enable_if<std::can_convert<MT, EntryType>::value && has_subscript_operator<IT>::value>\n    template <typename MT, typename IT>\n    inline void scatterImplementation(MT *mem, IT &&indexes) const;\n\n    /**\\internal\n     * This overload of the above function adds a \\p mask argument to disable memory\n     * accesses at the \\p indexes offsets where \\p mask is \\c false.\n     */\n    template <typename MT, typename IT>\n    inline void scatterImplementation(MT *mem, IT &&indexes, MaskArgument mask) const;\n\npublic:\n#define Vc_ASSERT_SCATTER_PARAMETER_TYPES_                                               \\\n    static_assert(                                                                       \\\n        std::is_convertible<EntryType, MT>::value,                                       \\\n        \"The memory pointer needs to point to a type that the EntryType of this \"        \\\n        \"SIMD vector type can be converted to.\");                                        \\\n    static_assert(                                                                       \\\n        Vc::Traits::has_subscript_operator<IT>::value,                                   \\\n        \"The indexes argument must be a type that implements the subscript operator.\");  \\\n    static_assert(                                                                       \\\n        !Traits::is_simd_vector<IT>::value ||                                            \\\n            Traits::simd_vector_size<IT>::value >= Size,                                 \\\n        \"If you use a SIMD vector for the indexes parameter, the index vector must \"     \\\n        \"have at least as many entries as this SIMD vector.\");                           \\\n    static_assert(                                                                       \\\n        !std::is_array<T>::value ||                                                      \\\n            (std::rank<T>::value == 1 &&                                                 \\\n             (std::extent<T>::value == 0 || std::extent<T>::value >= Size)),             \\\n        \"If you use a simple array for the indexes parameter, the array must have \"      \\\n        \"at least as many entries as this SIMD vector.\")\n\n    /**\n     * \\name Scatter functions\n     *\n     * Stores a vector to the objects at `mem[indexes[0]]`, `mem[indexes[1]]`,\n     * `mem[indexes[2]]`, ...\n     *\n     * \\param mem A pointer to memory which contains objects of type \\p MT at the offsets\n     *            given by \\p indexes.\n     * \\param indexes\n     * \\param mask\n     */\n    ///@{\n\n    /// Scatter function\n    template <typename MT,\n              typename IT,\n              typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>\n    Vc_INTRINSIC void scatter(MT *mem, IT &&indexes) const\n    {\n        Vc_ASSERT_SCATTER_PARAMETER_TYPES_;\n        scatterImplementation(mem, std::forward<IT>(indexes));\n    }\n\n    /// Masked scatter function\n    template <typename MT,\n              typename IT,\n              typename = enable_if<Vc::Traits::has_subscript_operator<IT>::value>>\n    Vc_INTRINSIC void scatter(MT *mem, IT &&indexes, MaskArgument mask) const\n    {\n        Vc_ASSERT_SCATTER_PARAMETER_TYPES_;\n        scatterImplementation(mem, std::forward<IT>(indexes), mask);\n    }\n    ///@}\n\n#include \"scatterinterface_deprecated.h\"\n\n    /**\\internal\n     * \\name Scatter function to use from Vc::Common::subscript_operator\n     *\n     * \\param args\n     * \\param mask\n     */\n    ///@{\n    template <typename MT, typename IT>\n    Vc_INTRINSIC void scatter(const Common::ScatterArguments<MT, IT> &args) const\n    {\n        scatter(args.address, args.indexes);\n    }\n\n    template <typename MT, typename IT>\n    Vc_INTRINSIC void scatter(const Common::ScatterArguments<MT, IT> &args, MaskArgument mask) const\n    {\n        scatter(args.address, args.indexes, mask);\n    }\n    ///@}\n#undef Vc_ASSERT_SCATTER_PARAMETER_TYPES_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/scatterinterface_deprecated.h",
    "content": "    /// \\name Deprecated Members\n    ///@{\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     */\n    template <typename S1, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void scatter(S1 *array, EntryType S1::*member1,\n                                                  IT indexes) const\n    {\n        scatter(Common::SubscriptOperation<S1, IT, std::ratio<1, 1>, true>(\n                    array, indexes)[member1]\n                    .scatterArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void scatter(S1 *array, EntryType S1::*member1,\n                                                  IT indexes, MaskArgument mask) const\n    {\n        scatter(Common::SubscriptOperation<S1, IT, std::ratio<1, 1>, true>(\n                    array, indexes)[member1]\n                    .scatterArguments(),\n                mask);\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param member2 If \\p member1 is a struct then \\p member2 selects the member to be read from that\n     *                struct (i.e. array[i].*member1.*member2 is read).\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     */\n    template <typename S1, typename S2, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void scatter(S1 *array, S2 S1::*member1,\n                                                  EntryType S2::*member2,\n                                                  IT indexes) const\n    {\n        scatter(Common::SubscriptOperation<S1, IT, std::ratio<1, 1>, true>(\n                    array, indexes)[member1][member2]\n                    .scatterArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param member1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param member2 If \\p member1 is a struct then \\p member2 selects the member to be read from that\n     *                struct (i.e. array[i].*member1.*member2 is read).\n     * \\param indexes Determines the offsets into \\p array where the values are gathered from/scattered\n     *                to. The type of indexes can either be an integer vector or a type that supports\n     *                operator[] access.\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename S2, typename IT>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void scatter(S1 *array, S2 S1::*member1,\n                                                  EntryType S2::*member2, IT indexes,\n                                                  MaskArgument mask) const\n    {\n        scatter(Common::SubscriptOperation<S1, IT, std::ratio<1, 1>, true>(\n                    array, indexes)[member1][member2]\n                    .scatterArguments(),\n                mask);\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param ptrMember1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param outerIndexes\n     * \\param innerIndexes\n     */\n    template <typename S1, typename IT1, typename IT2>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void scatter(S1 *array, EntryType *S1::*ptrMember1,\n                                                  IT1 outerIndexes,\n                                                  IT2 innerIndexes) const\n    {\n        scatter(Common::SubscriptOperation<S1, IT1, std::ratio<1, 1>, true>(\n                    array, outerIndexes)[ptrMember1][innerIndexes]\n                    .scatterArguments());\n    }\n\n    /**\n     * \\deprecated Use Vc::array or Vc::vector subscripting instead.\n     *\n     * \\param array   A pointer into memory (without alignment restrictions).\n     * \\param ptrMember1 If \\p array points to a struct, \\p member1 determines the member in the struct to\n     *                be read. Thus the offsets in \\p indexes are relative to the \\p array and not to\n     *                the size of the gathered type (i.e. array[i].*member1 is accessed instead of\n     *                (&(array->*member1))[i])\n     * \\param outerIndexes\n     * \\param innerIndexes\n     * \\param mask    If a mask is given only the active entries will be gathered/scattered.\n     */\n    template <typename S1, typename IT1, typename IT2>\n    Vc_DEPRECATED(\"use the subscript operator to Vc::array or Vc::vector \"\n                  \"instead.\") inline void scatter(S1 *array, EntryType *S1::*ptrMember1,\n                                                  IT1 outerIndexes, IT2 innerIndexes,\n                                                  MaskArgument mask) const\n    {\n        scatter(Common::SubscriptOperation<S1, IT1, std::ratio<1, 1>, true>(\n                    array, outerIndexes)[ptrMember1][innerIndexes]\n                    .scatterArguments(),\n                mask);\n    }\n    ///@}\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/set.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SET_H_\n#define VC_COMMON_SET_H_\n\n#include \"macros.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace\n{\n    static Vc_INTRINSIC Vc_CONST __m128i set(unsigned short x0, unsigned short x1, unsigned short x2, unsigned short x3,\n            unsigned short x4, unsigned short x5, unsigned short x6, unsigned short x7)\n    {\n#if defined(Vc_GNU_ASM)\n#if 0 // defined(__x86_64__)\n        // it appears that the 32bit variant is always faster\n        __m128i r;\n        unsigned long long tmp0 = x3; tmp0 = (tmp0 << 16) | x2;\n        unsigned long long tmp1 = x1; tmp1 = (tmp1 << 16) | x0;\n        asm(\"vmovq %1,%0\" : \"=x\"(r) : \"r\"((tmp0 << 32) | tmp1));\n        unsigned long long tmp2 = x7; tmp2 = (tmp2 << 16) | x6;\n        unsigned long long tmp3 = x5; tmp3 = (tmp3 << 16) | x4;\n        asm(\"vpinsrq $1,%1,%0,%0\" : \"+x\"(r) : \"r\"((tmp2 << 32) | tmp3));\n        return r;\n#elif defined(Vc_USE_VEX_CODING)\n        __m128i r0, r1;\n        unsigned int tmp0 = x1; tmp0 = (tmp0 << 16) | x0;\n        unsigned int tmp1 = x3; tmp1 = (tmp1 << 16) | x2;\n        unsigned int tmp2 = x5; tmp2 = (tmp2 << 16) | x4;\n        unsigned int tmp3 = x7; tmp3 = (tmp3 << 16) | x6;\n        asm(\"vmovd %1,%0\" : \"=x\"(r0) : \"r\"(tmp0));\n        asm(\"vpinsrd $1,%1,%0,%0\" : \"+x\"(r0) : \"r\"(tmp1));\n        asm(\"vmovd %1,%0\" : \"=x\"(r1) : \"r\"(tmp2));\n        asm(\"vpinsrd $1,%1,%0,%0\" : \"+x\"(r1) : \"r\"(tmp3));\n        asm(\"vpunpcklqdq %1,%0,%0\" : \"+x\"(r0) : \"x\"(r1));\n        return r0;\n#else\n        __m128i r0, r1;\n        unsigned int tmp0 = x1; tmp0 = (tmp0 << 16) | x0;\n        unsigned int tmp1 = x3; tmp1 = (tmp1 << 16) | x2;\n        unsigned int tmp2 = x5; tmp2 = (tmp2 << 16) | x4;\n        unsigned int tmp3 = x7; tmp3 = (tmp3 << 16) | x6;\n        asm(\"movd %1,%0\" : \"=x\"(r0) : \"r\"(tmp0));\n        asm(\"pinsrd $1,%1,%0\" : \"+x\"(r0) : \"r\"(tmp1));\n        asm(\"movd %1,%0\" : \"=x\"(r1) : \"r\"(tmp2));\n        asm(\"pinsrd $1,%1,%0\" : \"+x\"(r1) : \"r\"(tmp3));\n        asm(\"punpcklqdq %1,%0\" : \"+x\"(r0) : \"x\"(r1));\n        return r0;\n#endif\n#else\n        unsigned int tmp0 = x1; tmp0 = (tmp0 << 16) | x0;\n        unsigned int tmp1 = x3; tmp1 = (tmp1 << 16) | x2;\n        unsigned int tmp2 = x5; tmp2 = (tmp2 << 16) | x4;\n        unsigned int tmp3 = x7; tmp3 = (tmp3 << 16) | x6;\n        return _mm_setr_epi32(tmp0, tmp1, tmp2, tmp3);\n#endif\n    }\n    static Vc_INTRINSIC Vc_CONST __m128i set(short x0, short x1, short x2, short x3, short x4, short x5, short x6, short x7)\n    {\n        return set(static_cast<unsigned short>(x0), static_cast<unsigned short>(x1), static_cast<unsigned short>(x2),\n                static_cast<unsigned short>(x3), static_cast<unsigned short>(x4), static_cast<unsigned short>(x5),\n                static_cast<unsigned short>(x6), static_cast<unsigned short>(x7));\n    }\n}  // anonymous namespace\n}  // namespace Vc\n\n#endif // VC_COMMON_SET_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/simd_cast.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SIMD_CAST_H_\n#define VC_COMMON_SIMD_CAST_H_\n\n#include <type_traits>\n#include \"macros.h\"\n\n// declare a bogus simd_cast function template in the global namespace to enable ADL for\n// simd_cast<T>\ntemplate <class> void simd_cast();\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * Casts the argument \\p x from type \\p From to type \\p To.\n *\n * This function implements the trivial case where \\p To and \\p From are the same type.\n *\n * \\param x The object of type \\p From to be converted to type \\p To.\n * \\returns An object of type \\p To with all vector components converted according to\n *          standard conversion behavior as mandated by the C++ standard for the\n *          underlying arithmetic types.\n */\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(From &&x, enable_if<std::is_same<To, Traits::decay<From>>::value> = nullarg)\n{\n    return std::forward<From>(x);\n}\n\n/**\n * A cast from nothing results in default-initialization of \\p To.\n *\n * This function can be useful in generic code where a parameter pack expands to nothing.\n *\n * \\returns A zero-initialized object of type \\p To.\n */\ntemplate <typename To> Vc_INTRINSIC Vc_CONST To simd_cast() { return To(); }\n\n}  // namespace Vc\n\n#endif // VC_COMMON_SIMD_CAST_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/simd_cast_caller.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SIMD_CAST_CALLER_TCC_\n#define VC_COMMON_SIMD_CAST_CALLER_TCC_\n\n#include \"macros.h\"\nnamespace Vc_VERSIONED_NAMESPACE {\ntemplate <class T, std::size_t N, class VectorType>\ntemplate <class U, class V, class>\nVc_INTRINSIC SimdMaskArray<T, N, VectorType, N>::SimdMaskArray(\n    const SimdMaskArray<U, N, V> &x)\n    : data(simd_cast<mask_type>(internal_data(x)))\n{\n}\ntemplate <class T, std::size_t N, class VectorType>\ntemplate <class U, class V, class, class>\nVc_INTRINSIC SimdMaskArray<T, N, VectorType, N>::SimdMaskArray(\n    const SimdMaskArray<U, N, V> &x)\n    : data(simd_cast<mask_type>(internal_data(internal_data0(x)),\n                                internal_data(internal_data1(x))))\n{\n}\ntemplate <class T, std::size_t N, class VectorType>\ntemplate <class U, class V, class, class, class>\nVc_INTRINSIC SimdMaskArray<T, N, VectorType, N>::SimdMaskArray(\n    const SimdMaskArray<U, N, V> &x)\n    : data(simd_cast<mask_type>(internal_data(internal_data0(internal_data0(x))),\n                                internal_data(internal_data1(internal_data0(x))),\n                                internal_data(internal_data0(internal_data1(x))),\n                                internal_data(internal_data1(internal_data1(x)))))\n{\n}\n// conversion from any Segment object (could be SimdMaskArray or Mask<T>)\ntemplate <class T, std::size_t N, class VectorType>\ntemplate <class M, std::size_t Pieces, std::size_t Index>\nVc_INTRINSIC SimdMaskArray<T, N, VectorType, N>::SimdMaskArray(\n    Common::Segment<M, Pieces, Index> &&x,\n    enable_if<Traits::simd_vector_size<M>::value == Size * Pieces>)\n    : data(simd_cast<mask_type, Index>(x.data))\n{\n}\n// conversion from Mask<T>\ntemplate <class T, std::size_t N, class VectorType>\ntemplate <class M, class>\nVc_INTRINSIC SimdMaskArray<T, N, VectorType, N>::SimdMaskArray(M k)\n    : data(simd_cast<mask_type>(k))\n{\n}\n\n}  // namespace Vc_VERSIONED_NAMESPACE\n\n#endif  // VC_COMMON_SIMD_CAST_CALLER_TCC_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/simdarray.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SIMDARRAY_H_\n#define VC_COMMON_SIMDARRAY_H_\n\n//#define Vc_DEBUG_SIMD_CAST 1\n//#define Vc_DEBUG_SORTED 1\n//#include \"../IO\"\n\n#include <array>\n#include <limits>\n\n#include \"writemaskedvector.h\"\n#include \"simdarrayhelper.h\"\n#include \"simdmaskarray.h\"\n#include \"utility.h\"\n#include \"interleave.h\"\n#include \"indexsequence.h\"\n#include \"transpose.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// select_best_vector_type {{{\nnamespace Common\n{\n/// \\addtogroup SimdArray\n/// @{\n/**\n * \\internal\n * Selects the best SIMD type out of a typelist to store N scalar values.\n */\ntemplate <std::size_t N, class... Candidates> struct select_best_vector_type_impl;\n// last candidate; this one must work; assume it does:\ntemplate <std::size_t N, class T> struct select_best_vector_type_impl<N, T> {\n    using type = T;\n};\n// check the next candidate; use it if N >= T::size(); recurse otherwise:\ntemplate <std::size_t N, class T, class... Candidates>\nstruct select_best_vector_type_impl<N, T, Candidates...> {\n    using type = typename std::conditional<\n        (N < T::Size), typename select_best_vector_type_impl<N, Candidates...>::type,\n        T>::type;\n};\ntemplate <class T, std::size_t N>\nstruct select_best_vector_type : select_best_vector_type_impl<N,\n#ifdef Vc_IMPL_AVX2\n                                                              Vc::AVX2::Vector<T>,\n#elif defined Vc_IMPL_AVX\n                                                              Vc::AVX::Vector<T>,\n#endif\n#ifdef Vc_IMPL_SSE\n                                                              Vc::SSE::Vector<T>,\n#endif\n                                                              Vc::Scalar::Vector<T>> {\n};\n/// @}\n}  // namespace Common\n// }}}\n// internal namespace (product & sum helper) {{{1\nnamespace internal\n{\ntemplate <typename T> T Vc_INTRINSIC Vc_PURE product_helper_(const T &l, const T &r) { return l * r; }\ntemplate <typename T> T Vc_INTRINSIC Vc_PURE sum_helper_(const T &l, const T &r) { return l + r; }\n}  // namespace internal\n\n// min & max declarations {{{1\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\ninline fixed_size_simd<T, N> min(const SimdArray<T, N, V, M> &x,\n                                 const SimdArray<T, N, V, M> &y);\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\ninline fixed_size_simd<T, N> max(const SimdArray<T, N, V, M> &x,\n                                 const SimdArray<T, N, V, M> &y);\n\n// SimdArray class {{{1\n/// \\addtogroup SimdArray\n/// @{\n\n// atomic SimdArray {{{1\n#define Vc_CURRENT_CLASS_NAME SimdArray\n/**\\internal\n * Specialization of `SimdArray<T, N, VectorType, VectorSize>` for the case where `N ==\n * VectorSize`.\n *\n * This is specialized for implementation purposes: Since the general implementation uses\n * two SimdArray data members it recurses over different SimdArray instantiations. The\n * recursion is ended by this specialization, which has a single \\p VectorType_ data\n * member to which all functions are forwarded more or less directly.\n */\ntemplate <typename T, std::size_t N, typename VectorType_>\nclass SimdArray<T, N, VectorType_, N>\n{\n    static_assert(std::is_same<T, double>::value || std::is_same<T, float>::value ||\n                      std::is_same<T, int32_t>::value ||\n                      std::is_same<T, uint32_t>::value ||\n                      std::is_same<T, int16_t>::value ||\n                      std::is_same<T, uint16_t>::value,\n                  \"SimdArray<T, N> may only be used with T = { double, float, int32_t, uint32_t, \"\n                  \"int16_t, uint16_t }\");\n    static_assert(\n        std::is_same<VectorType_,\n                     typename Common::select_best_vector_type<T, N>::type>::value &&\n            VectorType_::size() == N,\n        \"ERROR: leave the third and fourth template parameters with their defaults. They \"\n        \"are implementation details.\");\n\npublic:\n    static constexpr bool is_atomic = true;\n    using VectorType = VectorType_;\n    using vector_type = VectorType;\n    using storage_type = vector_type;\n    using vectorentry_type = typename vector_type::VectorEntryType;\n    using value_type = T;\n    using mask_type = fixed_size_simd_mask<T, N>;\n    using index_type = fixed_size_simd<int, N>;\n    static constexpr std::size_t size() { return N; }\n    using Mask = mask_type;\n    using MaskType = Mask;\n    using MaskArgument = const MaskType &;\n    using VectorEntryType = vectorentry_type;\n    using EntryType = value_type;\n    using IndexType = index_type;\n    using AsArg = const SimdArray &;\n    using reference = Detail::ElementReference<SimdArray>;\n    static constexpr std::size_t Size = size();\n    static constexpr std::size_t MemoryAlignment = storage_type::MemoryAlignment;\n\n    // zero init\n    Vc_INTRINSIC SimdArray() = default;\n\n    // default copy ctor/operator\n    Vc_INTRINSIC SimdArray(const SimdArray &) = default;\n    Vc_INTRINSIC SimdArray(SimdArray &&) = default;\n    Vc_INTRINSIC SimdArray &operator=(const SimdArray &) = default;\n\n    // broadcast\n    Vc_INTRINSIC SimdArray(const value_type &a) : data(a) {}\n    Vc_INTRINSIC SimdArray(value_type &a) : data(a) {}\n    Vc_INTRINSIC SimdArray(value_type &&a) : data(a) {}\n    template <\n        typename U,\n        typename = enable_if<std::is_same<U, int>::value && !std::is_same<int, value_type>::value>>\n    Vc_INTRINSIC SimdArray(U a)\n        : SimdArray(static_cast<value_type>(a))\n    {\n    }\n\n    // implicit casts\n    template <class U, class V, class = enable_if<N == V::Size>>\n    Vc_INTRINSIC SimdArray(const SimdArray<U, N, V> &x)\n        : data(simd_cast<vector_type>(internal_data(x)))\n    {\n    }\n    template <class U, class V, class = enable_if<(N > V::Size && N <= 2 * V::Size)>,\n              class = U>\n    Vc_INTRINSIC SimdArray(const SimdArray<U, N, V> &x)\n        : data(simd_cast<vector_type>(internal_data(internal_data0(x)),\n                                      internal_data(internal_data1(x))))\n    {\n    }\n    template <class U, class V, class = enable_if<(N > 2 * V::Size && N <= 4 * V::Size)>,\n              class = U, class = U>\n    Vc_INTRINSIC SimdArray(const SimdArray<U, N, V> &x)\n        : data(simd_cast<vector_type>(internal_data(internal_data0(internal_data0(x))),\n                                      internal_data(internal_data1(internal_data0(x))),\n                                      internal_data(internal_data0(internal_data1(x))),\n                                      internal_data(internal_data1(internal_data1(x)))))\n    {\n    }\n\n    template <typename V, std::size_t Pieces, std::size_t Index>\n    Vc_INTRINSIC SimdArray(Common::Segment<V, Pieces, Index> &&x)\n        : data(simd_cast<vector_type, Index>(x.data))\n    {\n    }\n\n    Vc_INTRINSIC SimdArray(const std::initializer_list<value_type> &init)\n        : data(init.begin(), Vc::Unaligned)\n    {\n        Vc_ASSERT(init.size() == size());\n    }\n\n    // implicit conversion from underlying vector_type\n    template <\n        typename V,\n        typename = enable_if<Traits::is_simd_vector<V>::value && !Traits::isSimdArray<V>::value>>\n    Vc_INTRINSIC SimdArray(const V &x)\n        : data(simd_cast<vector_type>(x))\n    {\n    }\n\n    // implicit conversion to Vector<U, AnyAbi> for if Vector<U, AnyAbi>::size() == N and\n    // T implicitly convertible to U\n    template <typename U, typename A,\n              typename =\n                  enable_if<std::is_convertible<T, U>::value && Vector<U, A>::Size == N &&\n                            !std::is_same<A, simd_abi::fixed_size<N>>::value>>\n    Vc_INTRINSIC operator Vector<U, A>() const\n    {\n        return simd_cast<Vector<U, A>>(data);\n    }\n    operator fixed_size_simd<T, N> &()\n    {\n        return static_cast<fixed_size_simd<T, N> &>(*this);\n    }\n    operator const fixed_size_simd<T, N> &() const\n    {\n        return static_cast<const fixed_size_simd<T, N> &>(*this);\n    }\n\n#include \"gatherinterface.h\"\n#include \"scatterinterface.h\"\n\n    explicit Vc_INTRINSIC SimdArray(VectorSpecialInitializerZero) : data() {}\n    explicit Vc_INTRINSIC SimdArray(VectorSpecialInitializerOne o) : data(o) {}\n    explicit Vc_INTRINSIC SimdArray(VectorSpecialInitializerIndexesFromZero i) : data(i)\n    {\n    }\n    template <std::size_t Offset>\n    explicit Vc_INTRINSIC SimdArray(\n        Common::AddOffset<VectorSpecialInitializerIndexesFromZero, Offset>)\n        : data(Vc::IndexesFromZero)\n    {\n        data += value_type(Offset);\n    }\n\n    Vc_INTRINSIC void setZero() { data.setZero(); }\n    Vc_INTRINSIC void setZero(mask_type k) { data.setZero(internal_data(k)); }\n    Vc_INTRINSIC void setZeroInverted() { data.setZeroInverted(); }\n    Vc_INTRINSIC void setZeroInverted(mask_type k) { data.setZeroInverted(internal_data(k)); }\n\n    Vc_INTRINSIC void setQnan() { data.setQnan(); }\n    Vc_INTRINSIC void setQnan(mask_type m) { data.setQnan(internal_data(m)); }\n\n    // internal: execute specified Operation\n    template <typename Op, typename... Args>\n    static Vc_INTRINSIC fixed_size_simd<T, N> fromOperation(Op op, Args &&... args)\n    {\n        fixed_size_simd<T, N> r;\n        Common::unpackArgumentsAuto(op, r.data, std::forward<Args>(args)...);\n        return r;\n    }\n\n    template <typename Op, typename... Args>\n    static Vc_INTRINSIC void callOperation(Op op, Args &&... args)\n    {\n        Common::unpackArgumentsAuto(op, nullptr, std::forward<Args>(args)...);\n    }\n\n    static Vc_INTRINSIC fixed_size_simd<T, N> Zero()\n    {\n        return SimdArray(Vc::Zero);\n    }\n    static Vc_INTRINSIC fixed_size_simd<T, N> One()\n    {\n        return SimdArray(Vc::One);\n    }\n    static Vc_INTRINSIC fixed_size_simd<T, N> IndexesFromZero()\n    {\n        return SimdArray(Vc::IndexesFromZero);\n    }\n    static Vc_INTRINSIC fixed_size_simd<T, N> Random()\n    {\n        return fromOperation(Common::Operations::random());\n    }\n\n    // load ctor\n    template <class U, class Flags = DefaultLoadTag,\n              class = enable_if<std::is_arithmetic<U>::value &&\n                                Traits::is_load_store_flag<Flags>::value>>\n    explicit Vc_INTRINSIC SimdArray(const U *mem, Flags f = {}) : data(mem, f)\n    {\n    }\n\n    template <typename... Args> Vc_INTRINSIC void load(Args &&... args)\n    {\n        data.load(std::forward<Args>(args)...);\n    }\n\n    template <typename... Args> Vc_INTRINSIC void store(Args &&... args) const\n    {\n        data.store(std::forward<Args>(args)...);\n    }\n\n    Vc_INTRINSIC mask_type operator!() const\n    {\n        return {private_init, !data};\n    }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> operator-() const\n    {\n        return {private_init, -data};\n    }\n\n    /// Returns a copy of itself\n    Vc_INTRINSIC fixed_size_simd<T, N> operator+() const { return *this; }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> operator~() const\n    {\n        return {private_init, ~data};\n    }\n\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC Vc_CONST fixed_size_simd<T, N> operator<<(U x) const\n    {\n        return {private_init, data << x};\n    }\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC fixed_size_simd<T, N> &operator<<=(U x)\n    {\n        data <<= x;\n        return *this;\n    }\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC Vc_CONST fixed_size_simd<T, N> operator>>(U x) const\n    {\n        return {private_init, data >> x};\n    }\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC fixed_size_simd<T, N> &operator>>=(U x)\n    {\n        data >>= x;\n        return *this;\n    }\n\n#define Vc_BINARY_OPERATOR_(op)                                                          \\\n    Vc_INTRINSIC fixed_size_simd<T, N> &operator op##=(const SimdArray &rhs)             \\\n    {                                                                                    \\\n        data op## = rhs.data;                                                            \\\n        return *this;                                                                    \\\n    }\n    Vc_ALL_ARITHMETICS(Vc_BINARY_OPERATOR_);\n    Vc_ALL_BINARY(Vc_BINARY_OPERATOR_);\n    Vc_ALL_SHIFTS(Vc_BINARY_OPERATOR_);\n#undef Vc_BINARY_OPERATOR_\n\n    /// \\copydoc Vector::isNegative\n    Vc_DEPRECATED(\"use isnegative(x) instead\") Vc_INTRINSIC MaskType isNegative() const\n    {\n        return {private_init, isnegative(data)};\n    }\n\nprivate:\n    friend reference;\n    Vc_INTRINSIC static value_type get(const SimdArray &o, int i) noexcept\n    {\n        return o.data[i];\n    }\n    template <typename U>\n    Vc_INTRINSIC static void set(SimdArray &o, int i, U &&v) noexcept(\n        noexcept(std::declval<value_type &>() = v))\n    {\n        o.data[i] = v;\n    }\n\npublic:\n    /**\n     * \\note the returned object models the concept of a reference and\n     * as such it can exist longer than the data it is referencing.\n     * \\note to avoid lifetime issues, we strongly advice not to store\n     * any reference objects.\n     */\n    Vc_INTRINSIC reference operator[](size_t i) noexcept\n    {\n        static_assert(noexcept(reference{std::declval<SimdArray &>(), int()}), \"\");\n        return {*this, int(i)};\n    }\n    Vc_INTRINSIC value_type operator[](size_t i) const noexcept\n    {\n        return get(*this, int(i));\n    }\n\n    Vc_INTRINSIC Common::WriteMaskedVector<SimdArray, mask_type> operator()(const mask_type &k)\n    {\n        return {*this, k};\n    }\n\n    Vc_INTRINSIC void assign(const SimdArray &v, const mask_type &k)\n    {\n        data.assign(v.data, internal_data(k));\n    }\n\n    // reductions ////////////////////////////////////////////////////////\n#define Vc_REDUCTION_FUNCTION_(name_)                                                    \\\n    Vc_INTRINSIC Vc_PURE value_type name_() const { return data.name_(); }               \\\n    Vc_INTRINSIC Vc_PURE value_type name_(mask_type mask) const                          \\\n    {                                                                                    \\\n        return data.name_(internal_data(mask));                                          \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n    Vc_REDUCTION_FUNCTION_(min);\n    Vc_REDUCTION_FUNCTION_(max);\n    Vc_REDUCTION_FUNCTION_(product);\n    Vc_REDUCTION_FUNCTION_(sum);\n#undef Vc_REDUCTION_FUNCTION_\n    Vc_INTRINSIC Vc_PURE fixed_size_simd<T, N> partialSum() const\n    {\n        return {private_init, data.partialSum()};\n    }\n\n    template <typename F> Vc_INTRINSIC fixed_size_simd<T, N> apply(F &&f) const\n    {\n        return {private_init, data.apply(std::forward<F>(f))};\n    }\n    template <typename F> Vc_INTRINSIC fixed_size_simd<T, N> apply(F &&f, const mask_type &k) const\n    {\n        return {private_init, data.apply(std::forward<F>(f), k)};\n    }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> shifted(int amount) const\n    {\n        return {private_init, data.shifted(amount)};\n    }\n\n    template <std::size_t NN>\n    Vc_INTRINSIC fixed_size_simd<T, N> shifted(int amount, const SimdArray<value_type, NN> &shiftIn)\n        const\n    {\n        return {private_init, data.shifted(amount, simd_cast<VectorType>(shiftIn))};\n    }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> rotated(int amount) const\n    {\n        return {private_init, data.rotated(amount)};\n    }\n\n    /// \\copydoc Vector::exponent\n    Vc_DEPRECATED(\"use exponent(x) instead\") Vc_INTRINSIC fixed_size_simd<T, N> exponent() const\n    {\n        return {private_init, exponent(data)};\n    }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> interleaveLow(SimdArray x) const\n    {\n        return {private_init, data.interleaveLow(x.data)};\n    }\n    Vc_INTRINSIC fixed_size_simd<T, N> interleaveHigh(SimdArray x) const\n    {\n        return {private_init, data.interleaveHigh(x.data)};\n    }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> reversed() const\n    {\n        return {private_init, data.reversed()};\n    }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> sorted() const\n    {\n        return {private_init, data.sorted()};\n    }\n\n    template <class G, class = decltype(std::declval<G>()(std::size_t())),\n              class = enable_if<!Traits::is_simd_vector<G>::value>>\n    Vc_INTRINSIC SimdArray(const G &gen) : data(gen)\n    {\n    }\n    template <typename G> static Vc_INTRINSIC fixed_size_simd<T, N> generate(const G &gen)\n    {\n        return {private_init, VectorType::generate(gen)};\n    }\n\n    Vc_DEPRECATED(\"use copysign(x, y) instead\")\n        Vc_INTRINSIC fixed_size_simd<T, N> copySign(const SimdArray &x) const\n    {\n        return {private_init, Vc::copysign(data, x.data)};\n    }\n\n    friend VectorType &internal_data<>(SimdArray &x);\n    friend const VectorType &internal_data<>(const SimdArray &x);\n\n    /// \\internal\n    Vc_INTRINSIC SimdArray(private_init_t, VectorType &&x) : data(std::move(x)) {}\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(storage_type));\n\nprivate:\n    // The alignas attribute attached to the class declaration above is ignored by ICC\n    // 17.0.0 (at least). So just move the alignas attribute down here where it works for\n    // all compilers.\n    alignas(static_cast<std::size_t>(\n        Common::BoundedAlignment<Common::NextPowerOfTwo<N>::value * sizeof(VectorType_) /\n                                 VectorType_::size()>::value)) storage_type data;\n};\ntemplate <typename T, std::size_t N, typename VectorType> constexpr std::size_t SimdArray<T, N, VectorType, N>::Size;\ntemplate <typename T, std::size_t N, typename VectorType>\nconstexpr std::size_t SimdArray<T, N, VectorType, N>::MemoryAlignment;\ntemplate <typename T, std::size_t N, typename VectorType>\n#ifndef Vc_MSVC\nVc_INTRINSIC\n#endif\nVectorType &internal_data(SimdArray<T, N, VectorType, N> &x)\n{\n    return x.data;\n}\ntemplate <typename T, std::size_t N, typename VectorType>\n#ifndef Vc_MSVC\nVc_INTRINSIC\n#endif\nconst VectorType &internal_data(const SimdArray<T, N, VectorType, N> &x)\n{\n    return x.data;\n}\n\n// unwrap {{{2\ntemplate <class T> Vc_INTRINSIC T unwrap(const T &x) { return x; }\n\ntemplate <class T, size_t N, class V>\nVc_INTRINSIC V unwrap(const SimdArray<T, N, V, N> &x)\n{\n    return internal_data(x);\n}\n\ntemplate <class T, size_t Pieces, size_t Index>\nVc_INTRINSIC auto unwrap(const Common::Segment<T, Pieces, Index> &x)\n    -> decltype(x.to_fixed_size())\n{\n    return unwrap(x.to_fixed_size());\n}\n\n// gatherImplementation {{{2\ntemplate <typename T, std::size_t N, typename VectorType>\ntemplate <class MT, class IT, int Scale>\nVc_INTRINSIC void SimdArray<T, N, VectorType, N>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args)\n{\n    data.gather(Common::make_gather<Scale>(args.address, unwrap(args.indexes)));\n}\ntemplate <typename T, std::size_t N, typename VectorType>\ntemplate <class MT, class IT, int Scale>\nVc_INTRINSIC void SimdArray<T, N, VectorType, N>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args, MaskArgument mask)\n{\n    data.gather(Common::make_gather<Scale>(args.address, unwrap(args.indexes)),\n                mask);\n}\n\n// scatterImplementation {{{2\ntemplate <typename T, std::size_t N, typename VectorType>\ntemplate <typename MT, typename IT>\ninline void SimdArray<T, N, VectorType, N>::scatterImplementation(MT *mem,\n                                                                 IT &&indexes) const\n{\n    data.scatter(mem, unwrap(std::forward<IT>(indexes)));\n}\ntemplate <typename T, std::size_t N, typename VectorType>\ntemplate <typename MT, typename IT>\ninline void SimdArray<T, N, VectorType, N>::scatterImplementation(MT *mem,\n                                                                 IT &&indexes,\n                                                                 MaskArgument mask) const\n{\n    data.scatter(mem, unwrap(std::forward<IT>(indexes)), mask);\n}\n\n// generic SimdArray {{{1\n/**\n * Data-parallel arithmetic type with user-defined number of elements.\n *\n * \\tparam T The type of the vector's elements. The supported types currently are limited\n *           to the types supported by Vc::Vector<T>.\n *\n * \\tparam N The number of elements to store and process concurrently. You can choose an\n *           arbitrary number, though not every number is a good idea.\n *           Generally, a power of two value or the sum of two power of two values might\n *           work efficiently, though this depends a lot on the target system.\n *\n * \\tparam V Don't change the default value unless you really know what you are doing.\n *           This type is set to the underlying native Vc::Vector type used in the\n *           implementation of the type.\n *           Having it as part of the type name guards against some cases of ODR\n *           violations (i.e. linking incompatible translation units / libraries).\n *\n * \\tparam Wt Don't ever change the default value.\n *           This parameter is an unfortunate implementation detail shining through.\n *\n * \\warning Choosing \\p N too large (what “too large” means depends on the target) will\n *          result in excessive compilation times and high (or too high) register\n *          pressure, thus potentially negating the improvement from concurrent execution.\n *          As a rule of thumb, keep \\p N less or equal to `2 * float_v::size()`.\n *\n * \\warning A special portability concern arises from a current limitation in the MIC\n *          implementation (Intel Knights Corner), where SimdArray types with \\p T = \\p\n *          (u)short require an \\p N either less than short_v::size() or a multiple of\n *          short_v::size().\n *\n * \\headerfile simdarray.h <Vc/SimdArray>\n */\ntemplate <typename T, size_t N, typename V, size_t Wt> class SimdArray\n{\n    static_assert(std::is_same<T,   double>::value ||\n                  std::is_same<T,    float>::value ||\n                  std::is_same<T,  int32_t>::value ||\n                  std::is_same<T, uint32_t>::value ||\n                  std::is_same<T,  int16_t>::value ||\n                  std::is_same<T, uint16_t>::value, \"SimdArray<T, N> may only be used with T = { double, float, int32_t, uint32_t, int16_t, uint16_t }\");\n    static_assert(\n        std::is_same<V, typename Common::select_best_vector_type<T, N>::type>::value &&\n            V::size() == Wt,\n        \"ERROR: leave the third and fourth template parameters with their defaults. They \"\n        \"are implementation details.\");\n    static_assert(\n        // either the EntryType and VectorEntryType of the main V are equal\n        std::is_same<typename V::EntryType, typename V::VectorEntryType>::value ||\n            // or N is a multiple of V::size()\n            (N % V::size() == 0),\n        \"SimdArray<(un)signed short, N> on MIC only works correctly for N = k * \"\n        \"MIC::(u)short_v::size(), i.e. k * 16.\");\n\n    using my_traits = SimdArrayTraits<T, N>;\n    static constexpr std::size_t N0 = my_traits::N0;\n    static constexpr std::size_t N1 = my_traits::N1;\n    using Split = Common::Split<N0>;\n    template <typename U, std::size_t K> using CArray = U[K];\n\npublic:\n    static constexpr bool is_atomic = false;\n    using storage_type0 = typename my_traits::storage_type0;\n    using storage_type1 = typename my_traits::storage_type1;\n    static_assert(storage_type0::size() == N0, \"\");\n\n    /**\\internal\n     * This type reveals the implementation-specific type used for the data member.\n     */\n    using vector_type = V;\n    using vectorentry_type = typename storage_type0::vectorentry_type;\n    typedef vectorentry_type alias_type Vc_MAY_ALIAS;\n\n    /// The type of the elements (i.e.\\ \\p T)\n    using value_type = T;\n\n    /// The type of the mask used for masked operations and returned from comparisons.\n    using mask_type = fixed_size_simd_mask<T, N>;\n\n    /// The type of the vector used for indexes in gather and scatter operations.\n    using index_type = fixed_size_simd<int, N>;\n\n    /**\n     * Returns \\p N, the number of scalar components in an object of this type.\n     *\n     * The size of the SimdArray, i.e. the number of scalar elements in the vector. In\n     * contrast to Vector::size() you have control over this value via the \\p N template\n     * parameter of the SimdArray class template.\n     *\n     * \\returns The number of scalar values stored and manipulated concurrently by objects\n     * of this type.\n     */\n    static constexpr std::size_t size() { return N; }\n\n    /// \\copydoc mask_type\n    using Mask = mask_type;\n    /// \\copydoc mask_type\n    using MaskType = Mask;\n    using MaskArgument = const MaskType &;\n    using VectorEntryType = vectorentry_type;\n    /// \\copydoc value_type\n    using EntryType = value_type;\n    /// \\copydoc index_type\n    using IndexType = index_type;\n    using AsArg = const SimdArray &;\n\n    using reference = Detail::ElementReference<SimdArray>;\n\n    ///\\copydoc Vector::MemoryAlignment\n    static constexpr std::size_t MemoryAlignment =\n        storage_type0::MemoryAlignment > storage_type1::MemoryAlignment\n            ? storage_type0::MemoryAlignment\n            : storage_type1::MemoryAlignment;\n\n    /// \\name Generators\n    ///@{\n\n    ///\\copybrief Vector::Zero\n    static Vc_INTRINSIC fixed_size_simd<T, N> Zero()\n    {\n        return SimdArray(Vc::Zero);\n    }\n\n    ///\\copybrief Vector::One\n    static Vc_INTRINSIC fixed_size_simd<T, N> One()\n    {\n        return SimdArray(Vc::One);\n    }\n\n    ///\\copybrief Vector::IndexesFromZero\n    static Vc_INTRINSIC fixed_size_simd<T, N> IndexesFromZero()\n    {\n        return SimdArray(Vc::IndexesFromZero);\n    }\n\n    ///\\copydoc Vector::Random\n    static Vc_INTRINSIC fixed_size_simd<T, N> Random()\n    {\n        return fromOperation(Common::Operations::random());\n    }\n\n    template <class G, class = decltype(std::declval<G>()(std::size_t())),\n              class = enable_if<!Traits::is_simd_vector<G>::value>>\n    Vc_INTRINSIC SimdArray(const G &gen)\n        : data0(gen), data1([&](std::size_t i) { return gen(i + storage_type0::size()); })\n    {\n    }\n\n    ///\\copybrief Vector::generate\n    template <typename G> static Vc_INTRINSIC fixed_size_simd<T, N> generate(const G &gen) // {{{2\n    {\n        auto tmp = storage_type0::generate(gen);  // GCC bug: the order of evaluation in\n                                                  // an initializer list is well-defined\n                                                  // (front to back), but GCC 4.8 doesn't\n                                                  // implement this correctly. Therefore\n                                                  // we enforce correct order.\n        return {std::move(tmp),\n                storage_type1::generate([&](std::size_t i) { return gen(i + N0); })};\n    }\n    ///@}\n\n    /// \\name Compile-Time Constant Initialization\n    ///@{\n\n    ///\\copydoc Vector::Vector()\n    SimdArray() = default;\n    ///@}\n\n    /// \\name Conversion/Broadcast Constructors\n    ///@{\n\n    ///\\copydoc Vector::Vector(EntryType)\n    Vc_INTRINSIC SimdArray(value_type a) : data0(a), data1(a) {}\n    template <\n        typename U,\n        typename = enable_if<std::is_same<U, int>::value && !std::is_same<int, value_type>::value>>\n    SimdArray(U a)\n        : SimdArray(static_cast<value_type>(a))\n    {\n    }\n    ///@}\n\n    // default copy ctor/operator\n    SimdArray(const SimdArray &) = default;\n    SimdArray(SimdArray &&) = default;\n    SimdArray &operator=(const SimdArray &) = default;\n\n    // load ctor\n    template <typename U, typename Flags = DefaultLoadTag,\n              typename = enable_if<std::is_arithmetic<U>::value &&\n                                   Traits::is_load_store_flag<Flags>::value>>\n    explicit Vc_INTRINSIC SimdArray(const U *mem, Flags f = {})\n        : data0(mem, f), data1(mem + storage_type0::size(), f)\n    {\n    }\n\n// MSVC does overload resolution differently and takes the const U *mem overload (I hope)\n#ifndef Vc_MSVC\n    /**\\internal\n     * Load from a C-array. This is basically the same function as the load constructor\n     * above, except that the forwarding reference overload would steal the deal and the\n     * constructor above doesn't get called. This overload is required to enable loads\n     * from C-arrays.\n     */\n    template <typename U, std::size_t Extent, typename Flags = DefaultLoadTag,\n              typename = enable_if<std::is_arithmetic<U>::value &&\n                                   Traits::is_load_store_flag<Flags>::value>>\n    explicit Vc_INTRINSIC SimdArray(CArray<U, Extent> &mem, Flags f = {})\n        : data0(&mem[0], f), data1(&mem[storage_type0::size()], f)\n    {\n    }\n    /**\\internal\n     * Const overload of the above.\n     */\n    template <typename U, std::size_t Extent, typename Flags = DefaultLoadTag,\n              typename = enable_if<std::is_arithmetic<U>::value &&\n                                   Traits::is_load_store_flag<Flags>::value>>\n    explicit Vc_INTRINSIC SimdArray(const CArray<U, Extent> &mem, Flags f = {})\n        : data0(&mem[0], f), data1(&mem[storage_type0::size()], f)\n    {\n    }\n#endif\n\n    // initializer list\n    Vc_INTRINSIC SimdArray(const std::initializer_list<value_type> &init)\n        : data0(init.begin(), Vc::Unaligned)\n        , data1(init.begin() + storage_type0::size(), Vc::Unaligned)\n    {\n        Vc_ASSERT(init.size() == size());\n    }\n\n#include \"gatherinterface.h\"\n#include \"scatterinterface.h\"\n\n    explicit Vc_INTRINSIC SimdArray(VectorSpecialInitializerZero) : data0(), data1() {}\n    explicit Vc_INTRINSIC SimdArray(VectorSpecialInitializerOne o) : data0(o), data1(o) {}\n    explicit Vc_INTRINSIC SimdArray(VectorSpecialInitializerIndexesFromZero i)\n        : data0(i)\n        , data1(Common::AddOffset<VectorSpecialInitializerIndexesFromZero,\n                                  storage_type0::size()>())\n    {\n    }\n    template <size_t Offset>\n    explicit Vc_INTRINSIC SimdArray(\n        Common::AddOffset<VectorSpecialInitializerIndexesFromZero, Offset> i)\n        : data0(i)\n        , data1(Common::AddOffset<VectorSpecialInitializerIndexesFromZero,\n                                  storage_type0::size() + Offset>())\n    {\n    }\n\n    // explicit casts\n    template <class W, class = enable_if<\n                           (Traits::is_simd_vector<W>::value &&\n                            Traits::simd_vector_size<W>::value == N &&\n                            !(std::is_convertible<Traits::entry_type_of<W>, T>::value &&\n                              Traits::isSimdArray<W>::value))>>\n    Vc_INTRINSIC explicit SimdArray(W &&x) : data0(Split::lo(x)), data1(Split::hi(x))\n    {\n    }\n\n    // implicit casts\n    template <class W, class = enable_if<\n                           (Traits::isSimdArray<W>::value &&\n                            Traits::simd_vector_size<W>::value == N &&\n                            std::is_convertible<Traits::entry_type_of<W>, T>::value)>,\n              class = W>\n    Vc_INTRINSIC SimdArray(W &&x) : data0(Split::lo(x)), data1(Split::hi(x))\n    {\n    }\n\n    template <class W, std::size_t Pieces, std::size_t Index>\n    Vc_INTRINSIC SimdArray(Common::Segment<W, Pieces, Index> &&x)\n        : data0(Common::Segment<W, 2 * Pieces, 2 * Index>{x.data})\n        , data1(Common::Segment<W, 2 * Pieces, 2 * Index + 1>{x.data})\n    {\n    }\n\n    // implicit conversion to Vector<U, AnyAbi> for if Vector<U, AnyAbi>::size() == N and\n    // T implicitly convertible to U\n    template <typename U, typename A,\n              typename =\n                  enable_if<std::is_convertible<T, U>::value && Vector<U, A>::Size == N &&\n                            !std::is_same<A, simd_abi::fixed_size<N>>::value>>\n    operator Vector<U, A>() const\n    {\n        auto r = simd_cast<Vector<U, A>>(data0, data1);\n        return r;\n    }\n    Vc_INTRINSIC operator fixed_size_simd<T, N> &()\n    {\n        return static_cast<fixed_size_simd<T, N> &>(*this);\n    }\n    Vc_INTRINSIC operator const fixed_size_simd<T, N> &() const\n    {\n        return static_cast<const fixed_size_simd<T, N> &>(*this);\n    }\n\n    //////////////////// other functions ///////////////\n\n    Vc_INTRINSIC void setZero()\n    {\n        data0.setZero();\n        data1.setZero();\n    }\n    Vc_INTRINSIC void setZero(const mask_type &k)\n    {\n        data0.setZero(Split::lo(k));\n        data1.setZero(Split::hi(k));\n    }\n    Vc_INTRINSIC void setZeroInverted()\n    {\n        data0.setZeroInverted();\n        data1.setZeroInverted();\n    }\n    Vc_INTRINSIC void setZeroInverted(const mask_type &k)\n    {\n        data0.setZeroInverted(Split::lo(k));\n        data1.setZeroInverted(Split::hi(k));\n    }\n\n\n    Vc_INTRINSIC void setQnan() {\n        data0.setQnan();\n        data1.setQnan();\n    }\n    Vc_INTRINSIC void setQnan(const mask_type &m) {\n        data0.setQnan(Split::lo(m));\n        data1.setQnan(Split::hi(m));\n    }\n\n    ///\\internal execute specified Operation\n    template <typename Op, typename... Args>\n    static Vc_INTRINSIC fixed_size_simd<T, N> fromOperation(Op op, Args &&... args)\n    {\n        fixed_size_simd<T, N> r = {\n            storage_type0::fromOperation(op, Split::lo(args)...),  // no forward here - it\n                                                                   // could move and thus\n                                                                   // break the next line\n            storage_type1::fromOperation(op, Split::hi(std::forward<Args>(args))...)};\n        return r;\n    }\n\n    ///\\internal\n    template <typename Op, typename... Args>\n    static Vc_INTRINSIC void callOperation(Op op, Args &&... args)\n    {\n        storage_type0::callOperation(op, Split::lo(args)...);\n        storage_type1::callOperation(op, Split::hi(std::forward<Args>(args))...);\n    }\n\n\n    template <typename U, typename... Args> Vc_INTRINSIC void load(const U *mem, Args &&... args)\n    {\n        data0.load(mem, Split::lo(args)...);  // no forward here - it could move and thus\n                                              // break the next line\n        data1.load(mem + storage_type0::size(), Split::hi(std::forward<Args>(args))...);\n    }\n\n    template <typename U, typename... Args> Vc_INTRINSIC void store(U *mem, Args &&... args) const\n    {\n        data0.store(mem, Split::lo(args)...);  // no forward here - it could move and thus\n                                               // break the next line\n        data1.store(mem + storage_type0::size(), Split::hi(std::forward<Args>(args))...);\n    }\n\n    Vc_INTRINSIC mask_type operator!() const\n    {\n        return {!data0, !data1};\n    }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> operator-() const\n    {\n        return {-data0, -data1};\n    }\n\n    /// Returns a copy of itself\n    Vc_INTRINSIC fixed_size_simd<T, N> operator+() const { return *this; }\n\n    Vc_INTRINSIC fixed_size_simd<T, N> operator~() const\n    {\n        return {~data0, ~data1};\n    }\n\n    // left/right shift operators {{{2\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC Vc_CONST fixed_size_simd<T, N> operator<<(U x) const\n    {\n        return {data0 << x, data1 << x};\n    }\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC fixed_size_simd<T, N> &operator<<=(U x)\n    {\n        data0 <<= x;\n        data1 <<= x;\n        return *this;\n    }\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC Vc_CONST fixed_size_simd<T, N> operator>>(U x) const\n    {\n        return {data0 >> x, data1 >> x};\n    }\n    template <typename U,\n              typename = enable_if<std::is_integral<T>::value && std::is_integral<U>::value>>\n    Vc_INTRINSIC fixed_size_simd<T, N> &operator>>=(U x)\n    {\n        data0 >>= x;\n        data1 >>= x;\n        return *this;\n    }\n\n    // binary operators {{{2\n#define Vc_BINARY_OPERATOR_(op)                                                          \\\n    Vc_INTRINSIC fixed_size_simd<T, N> &operator op##=(const SimdArray &rhs)             \\\n    {                                                                                    \\\n        data0 op## = rhs.data0;                                                          \\\n        data1 op## = rhs.data1;                                                          \\\n        return *this;                                                                    \\\n    }\n    Vc_ALL_ARITHMETICS(Vc_BINARY_OPERATOR_);\n    Vc_ALL_BINARY(Vc_BINARY_OPERATOR_);\n    Vc_ALL_SHIFTS(Vc_BINARY_OPERATOR_);\n#undef Vc_BINARY_OPERATOR_\n\n    // operator[] {{{2\n    /// \\name Scalar Subscript Operators\n    ///@{\n\nprivate:\n    friend reference;\n    Vc_INTRINSIC static value_type get(const SimdArray &o, int i) noexcept\n    {\n        return reinterpret_cast<const alias_type *>(&o)[i];\n    }\n    template <typename U>\n    Vc_INTRINSIC static void set(SimdArray &o, int i, U &&v) noexcept(\n        noexcept(std::declval<value_type &>() = v))\n    {\n        reinterpret_cast<alias_type *>(&o)[i] = v;\n    }\n\npublic:\n    ///\\copydoc Vector::operator[](size_t)\n    /**\n     * \\note the returned object models the concept of a reference and\n     * as such it can exist longer than the data it is referencing.\n     * \\note to avoid lifetime issues, we strongly advice not to store\n     * any reference objects.\n     */\n    Vc_INTRINSIC reference operator[](size_t i) noexcept\n    {\n        static_assert(noexcept(reference{std::declval<SimdArray &>(), int()}), \"\");\n        return {*this, int(i)};\n    }\n\n    ///\\copydoc Vector::operator[](size_t) const\n    Vc_INTRINSIC value_type operator[](size_t index) const noexcept\n    {\n        return get(*this, int(index));\n    }\n    ///@}\n\n    // operator(){{{2\n    ///\\copydoc Vector::operator()(MaskType)\n    Vc_INTRINSIC Common::WriteMaskedVector<SimdArray, mask_type> operator()(\n        const mask_type &mask)\n    {\n        return {*this, mask};\n    }\n\n    ///\\internal\n    Vc_INTRINSIC void assign(const SimdArray &v, const mask_type &k) //{{{2\n    {\n        data0.assign(v.data0, internal_data0(k));\n        data1.assign(v.data1, internal_data1(k));\n    }\n\n    // reductions {{{2\n#define Vc_REDUCTION_FUNCTION_(name_, binary_fun_, scalar_fun_)                          \\\nprivate:                                                                                 \\\n    template <typename ForSfinae = void>                                                 \\\n    Vc_INTRINSIC enable_if<std::is_same<ForSfinae, void>::value &&                       \\\n                               storage_type0::Size == storage_type1::Size,           \\\n                           value_type> name_##_impl() const                              \\\n    {                                                                                    \\\n        return binary_fun_(data0, data1).name_();                                        \\\n    }                                                                                    \\\n                                                                                         \\\n    template <typename ForSfinae = void>                                                 \\\n    Vc_INTRINSIC enable_if<std::is_same<ForSfinae, void>::value &&                       \\\n                               storage_type0::Size != storage_type1::Size,           \\\n                           value_type> name_##_impl() const                              \\\n    {                                                                                    \\\n        return scalar_fun_(data0.name_(), data1.name_());                                \\\n    }                                                                                    \\\n                                                                                         \\\npublic:                                                                                  \\\n    /**\\copybrief Vector::##name_ */                                                     \\\n    Vc_INTRINSIC value_type name_() const { return name_##_impl(); }                     \\\n    /**\\copybrief Vector::##name_ */                                                     \\\n    Vc_INTRINSIC value_type name_(const mask_type &mask) const                           \\\n    {                                                                                    \\\n        if (Vc_IS_UNLIKELY(Split::lo(mask).isEmpty())) {                                 \\\n            return data1.name_(Split::hi(mask));                                         \\\n        } else if (Vc_IS_UNLIKELY(Split::hi(mask).isEmpty())) {                          \\\n            return data0.name_(Split::lo(mask));                                         \\\n        } else {                                                                         \\\n            return scalar_fun_(data0.name_(Split::lo(mask)),                             \\\n                               data1.name_(Split::hi(mask)));                            \\\n        }                                                                                \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n    Vc_REDUCTION_FUNCTION_(min, Vc::min, std::min);\n    Vc_REDUCTION_FUNCTION_(max, Vc::max, std::max);\n    Vc_REDUCTION_FUNCTION_(product, internal::product_helper_, internal::product_helper_);\n    Vc_REDUCTION_FUNCTION_(sum, internal::sum_helper_, internal::sum_helper_);\n#undef Vc_REDUCTION_FUNCTION_\n    ///\\copybrief Vector::partialSum\n    Vc_INTRINSIC Vc_PURE fixed_size_simd<T, N> partialSum() const //{{{2\n    {\n        auto ps0 = data0.partialSum();\n        auto tmp = data1;\n        tmp[0] += ps0[data0.size() - 1];\n        return {std::move(ps0), tmp.partialSum()};\n    }\n\n    // apply {{{2\n    ///\\copybrief Vector::apply(F &&) const\n    template <typename F> inline fixed_size_simd<T, N> apply(F &&f) const\n    {\n        return {data0.apply(f), data1.apply(f)};\n    }\n    ///\\copybrief Vector::apply(F &&, MaskType) const\n    template <typename F>\n    inline fixed_size_simd<T, N> apply(F &&f, const mask_type &k) const\n    {\n        return {data0.apply(f, Split::lo(k)), data1.apply(f, Split::hi(k))};\n    }\n\n    // shifted {{{2\n    ///\\copybrief Vector::shifted(int) const\n    inline fixed_size_simd<T, N> shifted(int amount) const\n    {\n        constexpr int SSize = Size;\n        constexpr int SSize0 = storage_type0::Size;\n        constexpr int SSize1 = storage_type1::Size;\n        if (amount == 0) {\n            return *this;\n        }\n        if (amount < 0) {\n            if (amount > -SSize0) {\n                return {data0.shifted(amount), data1.shifted(amount, data0)};\n            }\n            if (amount == -SSize0) {\n                return {storage_type0(0), simd_cast<storage_type1>(data0)};\n            }\n            if (amount < -SSize0) {\n                return {storage_type0(0), simd_cast<storage_type1>(data0.shifted(\n                                                   amount + SSize0))};\n            }\n            return Zero();\n        } else {\n            if (amount >= SSize) {\n                return Zero();\n            } else if (amount >= SSize0) {\n                return {\n                    simd_cast<storage_type0>(data1).shifted(amount - SSize0),\n                    storage_type1(0)};\n            } else if (amount >= SSize1) {\n                return {data0.shifted(amount, data1), storage_type1(0)};\n            } else {\n                return {data0.shifted(amount, data1), data1.shifted(amount)};\n            }\n        }\n    }\n\n    template <std::size_t NN>\n    inline enable_if<\n        !(std::is_same<storage_type0, storage_type1>::value &&  // not bisectable\n          N == NN),\n        fixed_size_simd<T, N>>\n        shifted(int amount, const SimdArray<value_type, NN> &shiftIn) const\n    {\n        constexpr int SSize = Size;\n        if (amount < 0) {\n            return fixed_size_simd<T, N>([&](int i) -> value_type {\n                i += amount;\n                if (i >= 0) {\n                    return operator[](i);\n                } else if (i >= -SSize) {\n                    return shiftIn[i + SSize];\n                }\n                return 0;\n            });\n        }\n        return fixed_size_simd<T, N>([&](int i) -> value_type {\n            i += amount;\n            if (i < SSize) {\n                return operator[](i);\n            } else if (i < 2 * SSize) {\n                return shiftIn[i - SSize];\n            }\n            return 0;\n        });\n    }\n\nprivate:\n    // workaround for MSVC not understanding the simpler and shorter expression of the boolean\n    // expression directly in the enable_if below\n    template <std::size_t NN> struct bisectable_shift\n        : public std::integral_constant<bool,\n                                        std::is_same<storage_type0, storage_type1>::value &&  // bisectable\n                                        N == NN>\n    {\n    };\n\npublic:\n    template <std::size_t NN>\n    inline fixed_size_simd<T, N> shifted(\n        enable_if<bisectable_shift<NN>::value, int> amount,\n        const SimdArray<value_type, NN> &shiftIn) const\n    {\n        constexpr int SSize = Size;\n        if (amount < 0) {\n            if (amount > -static_cast<int>(storage_type0::Size)) {\n                return {data0.shifted(amount, internal_data1(shiftIn)),\n                        data1.shifted(amount, data0)};\n            }\n            if (amount == -static_cast<int>(storage_type0::Size)) {\n                return {storage_type0(internal_data1(shiftIn)), storage_type1(data0)};\n            }\n            if (amount > -SSize) {\n                return {\n                    internal_data1(shiftIn)\n                        .shifted(amount + static_cast<int>(storage_type0::Size), internal_data0(shiftIn)),\n                    data0.shifted(amount + static_cast<int>(storage_type0::Size), internal_data1(shiftIn))};\n            }\n            if (amount == -SSize) {\n                return shiftIn;\n            }\n            if (amount > -2 * SSize) {\n                return shiftIn.shifted(amount + SSize);\n            }\n        }\n        if (amount == 0) {\n            return *this;\n        }\n        if (amount < static_cast<int>(storage_type0::Size)) {\n            return {data0.shifted(amount, data1),\n                    data1.shifted(amount, internal_data0(shiftIn))};\n        }\n        if (amount == static_cast<int>(storage_type0::Size)) {\n            return {storage_type0(data1), storage_type1(internal_data0(shiftIn))};\n        }\n        if (amount < SSize) {\n            return {data1.shifted(amount - static_cast<int>(storage_type0::Size), internal_data0(shiftIn)),\n                    internal_data0(shiftIn)\n                        .shifted(amount - static_cast<int>(storage_type0::Size), internal_data1(shiftIn))};\n        }\n        if (amount == SSize) {\n            return shiftIn;\n        }\n        if (amount < 2 * SSize) {\n            return shiftIn.shifted(amount - SSize);\n        }\n        return Zero();\n    }\n\n    // rotated {{{2\n    ///\\copybrief Vector::rotated\n    Vc_INTRINSIC fixed_size_simd<T, N> rotated(int amount) const\n    {\n        amount %= int(size());\n        if (amount == 0) {\n            return *this;\n        } else if (amount < 0) {\n            amount += size();\n        }\n\n#ifdef Vc_MSVC\n        // MSVC fails to find a SimdArray::shifted function with 2 arguments. So use store\n        // ->\n        // load to implement the function instead.\n        alignas(MemoryAlignment) T tmp[N + data0.size()];\n        data0.store(&tmp[0], Vc::Aligned);\n        data1.store(&tmp[data0.size()], Vc::Aligned);\n        data0.store(&tmp[N], Vc::Unaligned);\n        fixed_size_simd<T, N> r;\n        r.data0.load(&tmp[amount], Vc::Unaligned);\n        r.data1.load(&tmp[(amount + data0.size()) % size()], Vc::Unaligned);\n        return r;\n#else\n        auto &&d0cvtd = simd_cast<storage_type1>(data0);\n        auto &&d1cvtd = simd_cast<storage_type0>(data1);\n        constexpr int size0 = storage_type0::size();\n        constexpr int size1 = storage_type1::size();\n\n        if (amount == size0 && std::is_same<storage_type0, storage_type1>::value) {\n            return {std::move(d1cvtd), std::move(d0cvtd)};\n        } else if (amount < size1) {\n            return {data0.shifted(amount, d1cvtd), data1.shifted(amount, d0cvtd)};\n        } else if (amount == size1) {\n            return {data0.shifted(amount, d1cvtd), std::move(d0cvtd)};\n        } else if (int(size()) - amount < size1) {\n            return {data0.shifted(amount - int(size()), d1cvtd.shifted(size1 - size0)),\n                    data1.shifted(amount - int(size()), data0.shifted(size0 - size1))};\n        } else if (int(size()) - amount == size1) {\n            return {data0.shifted(-size1, d1cvtd.shifted(size1 - size0)),\n                    simd_cast<storage_type1>(data0.shifted(size0 - size1))};\n        } else if (amount <= size0) {\n            return {data0.shifted(size1, d1cvtd).shifted(amount - size1, data0),\n                    simd_cast<storage_type1>(data0.shifted(amount - size1))};\n        } else {\n            return {data0.shifted(size1, d1cvtd).shifted(amount - size1, data0),\n                    simd_cast<storage_type1>(data0.shifted(amount - size1, d1cvtd))};\n        }\n        return *this;\n#endif\n    }\n\n    // interleaveLow/-High {{{2\n    ///\\internal \\copydoc Vector::interleaveLow\n    Vc_INTRINSIC fixed_size_simd<T, N> interleaveLow(const SimdArray &x) const\n    {\n        // return data0[0], x.data0[0], data0[1], x.data0[1], ...\n        return {data0.interleaveLow(x.data0),\n                simd_cast<storage_type1>(data0.interleaveHigh(x.data0))};\n    }\n    ///\\internal \\copydoc Vector::interleaveHigh\n    Vc_INTRINSIC fixed_size_simd<T, N> interleaveHigh(const SimdArray &x) const\n    {\n        return interleaveHighImpl(\n            x,\n            std::integral_constant<bool, storage_type0::Size == storage_type1::Size>());\n    }\n\nprivate:\n    ///\\internal\n    Vc_INTRINSIC fixed_size_simd<T, N> interleaveHighImpl(const SimdArray &x, std::true_type) const\n    {\n        return {data1.interleaveLow(x.data1), data1.interleaveHigh(x.data1)};\n    }\n    ///\\internal\n    inline fixed_size_simd<T, N> interleaveHighImpl(const SimdArray &x, std::false_type) const\n    {\n        return {data0.interleaveHigh(x.data0)\n                    .shifted(storage_type1::Size,\n                             simd_cast<storage_type0>(data1.interleaveLow(x.data1))),\n                data1.interleaveHigh(x.data1)};\n    }\n\npublic:\n    ///\\copybrief Vector::reversed\n    inline fixed_size_simd<T, N> reversed() const //{{{2\n    {\n        if (std::is_same<storage_type0, storage_type1>::value) {\n            return {simd_cast<storage_type0>(data1).reversed(),\n                    simd_cast<storage_type1>(data0).reversed()};\n        } else {\n#ifdef Vc_MSVC\n            // MSVC fails to find a SimdArray::shifted function with 2 arguments. So use\n            // store\n            // -> load to implement the function instead.\n            alignas(MemoryAlignment) T tmp[N];\n            data1.reversed().store(&tmp[0], Vc::Aligned);\n            data0.reversed().store(&tmp[data1.size()], Vc::Unaligned);\n            return fixed_size_simd<T, N>{&tmp[0], Vc::Aligned};\n#else\n            return {data0.shifted(storage_type1::Size, data1).reversed(),\n                    simd_cast<storage_type1>(data0.reversed().shifted(\n                        storage_type0::Size - storage_type1::Size))};\n#endif\n        }\n    }\n    ///\\copydoc Vector::sorted\n    inline fixed_size_simd<T, N> sorted() const  //{{{2\n    {\n        return sortedImpl(\n            std::integral_constant<bool, storage_type0::Size == storage_type1::Size>());\n    }\n\n    ///\\internal\n    Vc_INTRINSIC fixed_size_simd<T, N> sortedImpl(std::true_type) const\n    {\n#ifdef Vc_DEBUG_SORTED\n        std::cerr << \"-- \" << data0 << data1 << '\\n';\n#endif\n        const auto a = data0.sorted();\n        const auto b = data1.sorted().reversed();\n        const auto lo = Vc::min(a, b);\n        const auto hi = Vc::max(a, b);\n        return {lo.sorted(), hi.sorted()};\n    }\n\n    ///\\internal\n    Vc_INTRINSIC fixed_size_simd<T, N> sortedImpl(std::false_type) const\n    {\n        using SortableArray =\n            fixed_size_simd<value_type, Common::NextPowerOfTwo<size()>::value>;\n        auto sortable = simd_cast<SortableArray>(*this);\n        for (std::size_t i = Size; i < SortableArray::Size; ++i) {\n            using limits = std::numeric_limits<value_type>;\n            if (limits::has_infinity) {\n                sortable[i] = limits::infinity();\n            } else {\n                sortable[i] = std::numeric_limits<value_type>::max();\n            }\n        }\n        return simd_cast<fixed_size_simd<T, N>>(sortable.sorted());\n\n        /* The following implementation appears to be less efficient. But this may need further\n         * work.\n        const auto a = data0.sorted();\n        const auto b = data1.sorted();\n#ifdef Vc_DEBUG_SORTED\n        std::cerr << \"== \" << a << b << '\\n';\n#endif\n        auto aIt = Vc::begin(a);\n        auto bIt = Vc::begin(b);\n        const auto aEnd = Vc::end(a);\n        const auto bEnd = Vc::end(b);\n        return SimdArray::generate([&](std::size_t) {\n            if (aIt == aEnd) {\n                return *(bIt++);\n            }\n            if (bIt == bEnd) {\n                return *(aIt++);\n            }\n            if (*aIt < *bIt) {\n                return *(aIt++);\n            } else {\n                return *(bIt++);\n            }\n        });\n        */\n    }\n\n    /// \\name Deprecated Members\n    ///@{\n\n    ///\\copydoc size\n    ///\\deprecated Use size() instead.\n    static constexpr std::size_t Size = size();\n\n    /// \\copydoc Vector::exponent\n    Vc_DEPRECATED(\"use exponent(x) instead\")\n        Vc_INTRINSIC fixed_size_simd<T, N> exponent() const\n    {\n        return {exponent(data0), exponent(data1)};\n    }\n\n    /// \\copydoc Vector::isNegative\n    Vc_DEPRECATED(\"use isnegative(x) instead\") Vc_INTRINSIC MaskType isNegative() const\n    {\n        return {isnegative(data0), isnegative(data1)};\n    }\n\n    ///\\copydoc Vector::copySign\n    Vc_DEPRECATED(\"use copysign(x, y) instead\")\n        Vc_INTRINSIC fixed_size_simd<T, N> copySign(const SimdArray &x) const\n    {\n        return {Vc::copysign(data0, x.data0),\n                Vc::copysign(data1, x.data1)};\n    }\n    ///@}\n\n    // internal_data0/1 {{{2\n    friend storage_type0 &internal_data0<>(SimdArray &x);\n    friend storage_type1 &internal_data1<>(SimdArray &x);\n    friend const storage_type0 &internal_data0<>(const SimdArray &x);\n    friend const storage_type1 &internal_data1<>(const SimdArray &x);\n\n    /// \\internal\n    Vc_INTRINSIC SimdArray(storage_type0 &&x, storage_type1 &&y) //{{{2\n        : data0(std::move(x)), data1(std::move(y))\n    {\n    }\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(storage_type0));\n\nprivate: //{{{2\n    // The alignas attribute attached to the class declaration above is ignored by ICC\n    // 17.0.0 (at least). So just move the alignas attribute down here where it works for\n    // all compilers.\n    alignas(static_cast<std::size_t>(\n        Common::BoundedAlignment<Common::NextPowerOfTwo<N>::value * sizeof(V) /\n                                 V::size()>::value)) storage_type0 data0;\n    storage_type1 data1;\n};\n#undef Vc_CURRENT_CLASS_NAME\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nconstexpr std::size_t SimdArray<T, N, V, M>::Size;\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nconstexpr std::size_t SimdArray<T, N, V, M>::MemoryAlignment;\n\n// gatherImplementation {{{2\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t M>\ntemplate <class MT, class IT, int Scale>\ninline void SimdArray<T, N, VectorType, M>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args)\n{\n    data0.gather(Common::make_gather<Scale>(\n        args.address, Split::lo(Common::Operations::gather(), args.indexes)));\n    data1.gather(Common::make_gather<Scale>(\n        args.address, Split::hi(Common::Operations::gather(), args.indexes)));\n}\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t M>\ntemplate <class MT, class IT, int Scale>\ninline void SimdArray<T, N, VectorType, M>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args, MaskArgument mask)\n{\n    data0.gather(Common::make_gather<Scale>(\n                     args.address, Split::lo(Common::Operations::gather(), args.indexes)),\n                 Split::lo(mask));\n    data1.gather(Common::make_gather<Scale>(\n                     args.address, Split::hi(Common::Operations::gather(), args.indexes)),\n                 Split::hi(mask));\n}\n\n// scatterImplementation {{{2\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t M>\ntemplate <typename MT, typename IT>\ninline void SimdArray<T, N, VectorType, M>::scatterImplementation(MT *mem,\n                                                                 IT &&indexes) const\n{\n    data0.scatter(mem, Split::lo(Common::Operations::gather(),\n                                indexes));  // don't forward indexes - it could move and\n                                            // thus break the next line\n    data1.scatter(mem, Split::hi(Common::Operations::gather(), std::forward<IT>(indexes)));\n}\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t M>\ntemplate <typename MT, typename IT>\ninline void SimdArray<T, N, VectorType, M>::scatterImplementation(MT *mem,\n                                                                 IT &&indexes, MaskArgument mask) const\n{\n    data0.scatter(mem, Split::lo(Common::Operations::gather(), indexes),\n                 Split::lo(mask));  // don't forward indexes - it could move and\n                                    // thus break the next line\n    data1.scatter(mem, Split::hi(Common::Operations::gather(), std::forward<IT>(indexes)),\n                 Split::hi(mask));\n}\n\n// internal_data0/1 (SimdArray) {{{1\n///\\internal Returns the first data member of a generic SimdArray\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\n#ifndef Vc_MSVC\nVc_INTRINSIC\n#endif\ntypename SimdArrayTraits<T, N>::storage_type0 &internal_data0(\n    SimdArray<T, N, V, M> &x)\n{\n    return x.data0;\n}\n///\\internal Returns the second data member of a generic SimdArray\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\n#ifndef Vc_MSVC\nVc_INTRINSIC\n#endif\ntypename SimdArrayTraits<T, N>::storage_type1 &internal_data1(\n    SimdArray<T, N, V, M> &x)\n{\n    return x.data1;\n}\n///\\internal Returns the first data member of a generic SimdArray (const overload)\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\n#ifndef Vc_MSVC\nVc_INTRINSIC\n#endif\nconst typename SimdArrayTraits<T, N>::storage_type0 &internal_data0(\n    const SimdArray<T, N, V, M> &x)\n{\n    return x.data0;\n}\n///\\internal Returns the second data member of a generic SimdArray (const overload)\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\n#ifndef Vc_MSVC\nVc_INTRINSIC\n#endif\nconst typename SimdArrayTraits<T, N>::storage_type1 &internal_data1(\n    const SimdArray<T, N, V, M> &x)\n{\n    return x.data1;\n}\n\n// MSVC workaround for SimdArray(storage_type0, storage_type1) ctor{{{1\n// MSVC sometimes stores x to data1. By first broadcasting 0 and then assigning y\n// in the body the bug is supressed.\n#if defined Vc_MSVC && defined Vc_IMPL_SSE && !defined Vc_IMPL_AVX\ntemplate <>\nVc_INTRINSIC SimdArray<double, 8>::SimdArray(fixed_size_simd<double, 4> &&x,\n                                             fixed_size_simd<double, 4> &&y)\n    : data0(x), data1(0)\n{\n    data1 = y;\n}\n#endif\n\n// binary operators {{{\nnamespace Detail\n{\n#define Vc_FIXED_OP(op)                                                                  \\\n    template <class T, int N,                                                            \\\n              class = typename std::enable_if<fixed_size_simd<T, N>::is_atomic>::type>   \\\n    Vc_INTRINSIC fixed_size_simd<T, N> operator op(const fixed_size_simd<T, N> &a,       \\\n                                                   const fixed_size_simd<T, N> &b)       \\\n    {                                                                                    \\\n        return {private_init, internal_data(a) op internal_data(b)};                     \\\n    }                                                                                    \\\n    template <class T, int N,                                                            \\\n              class = typename std::enable_if<!fixed_size_simd<T, N>::is_atomic>::type,  \\\n              class = T>                                                                 \\\n    Vc_INTRINSIC fixed_size_simd<T, N> operator op(const fixed_size_simd<T, N> &a,       \\\n                                                   const fixed_size_simd<T, N> &b)       \\\n    {                                                                                    \\\n        return {internal_data0(a) op internal_data0(b),                                  \\\n                internal_data1(a) op internal_data1(b)};                                 \\\n    }\nVc_ALL_ARITHMETICS(Vc_FIXED_OP);\nVc_ALL_BINARY(Vc_FIXED_OP);\nVc_ALL_SHIFTS(Vc_FIXED_OP);\n#undef Vc_FIXED_OP\n#define Vc_FIXED_OP(op)                                                                  \\\n    template <class T, int N,                                                            \\\n              class = typename std::enable_if<fixed_size_simd<T, N>::is_atomic>::type>   \\\n    Vc_INTRINSIC fixed_size_simd_mask<T, N> operator op(const fixed_size_simd<T, N> &a,  \\\n                                                        const fixed_size_simd<T, N> &b)  \\\n    {                                                                                    \\\n        return {private_init, internal_data(a) op internal_data(b)};                     \\\n    }                                                                                    \\\n    template <class T, int N,                                                            \\\n              class = typename std::enable_if<!fixed_size_simd<T, N>::is_atomic>::type,  \\\n              class = T>                                                                 \\\n    Vc_INTRINSIC fixed_size_simd_mask<T, N> operator op(const fixed_size_simd<T, N> &a,  \\\n                                                        const fixed_size_simd<T, N> &b)  \\\n    {                                                                                    \\\n        return {internal_data0(a) op internal_data0(b),                                  \\\n                internal_data1(a) op internal_data1(b)};                                 \\\n    }\nVc_ALL_COMPARES(Vc_FIXED_OP);\n#undef Vc_FIXED_OP\n}  // namespace Detail\n\n// }}}\n// binary operators {{{1\nnamespace result_vector_type_internal\n{\ntemplate <typename T>\nusing remove_cvref = typename std::remove_cv<typename std::remove_reference<T>::type>::type;\n\ntemplate <typename T>\nusing is_integer_larger_than_int = std::integral_constant<\n    bool, std::is_integral<T>::value &&(sizeof(T) > sizeof(int) ||\n                                        std::is_same<T, long>::value ||\n                                        std::is_same<T, unsigned long>::value)>;\n\ntemplate <\n    typename L, typename R,\n    std::size_t N = Traits::isSimdArray<L>::value ? Traits::simd_vector_size<L>::value\n                                                  : Traits::simd_vector_size<R>::value,\n    bool = (Traits::isSimdArray<L>::value ||\n            Traits::isSimdArray<R>::value) &&  // one of the operands must be a SimdArray\n           !(Traits::is_fixed_size_simd<L>::value &&        // if both are fixed_size, use\n             Traits::is_fixed_size_simd<R>::value) &&       // common/operators.h\n           ((std::is_arithmetic<remove_cvref<L>>::value &&  // one of the operands is a\n             !is_integer_larger_than_int<remove_cvref<L>>::value) ||  // scalar type\n            (std::is_arithmetic<remove_cvref<R>>::value &&\n             !is_integer_larger_than_int<remove_cvref<R>>::value) ||\n            // or one of the operands is Vector<T> with Vector<T>::size() ==\n            // SimdArray::size()\n            Traits::simd_vector_size<L>::value == Traits::simd_vector_size<R>::value)>\nstruct evaluate;\n\ntemplate <typename L, typename R, std::size_t N> struct evaluate<L, R, N, true>\n{\nprivate:\n    using LScalar = Traits::entry_type_of<L>;\n    using RScalar = Traits::entry_type_of<R>;\n\n    template <bool B, typename T, typename F>\n    using conditional = typename std::conditional<B, T, F>::type;\n\npublic:\n    // In principle we want the exact same rules for SimdArray<T> ⨉ SimdArray<U> as the standard\n    // defines for T ⨉ U. BUT: short ⨉ short returns int (because all integral types smaller than\n    // int are promoted to int before any operation). This would imply that SIMD types with integral\n    // types smaller than int are more or less useless - and you could use SimdArray<int> from the\n    // start. Therefore we special-case those operations where the scalar type of both operands is\n    // integral and smaller than int.\n    // In addition, there is no generic support for 64-bit int SIMD types. Therefore\n    // promotion to a 64-bit integral type (including `long` because it can potentially have 64\n    // bits) also is not done. But if one of the operands is a scalar type that is larger than int\n    // then the operator is disabled altogether. We do not want an implicit demotion.\n    using type = fixed_size_simd<\n        conditional<(std::is_integral<LScalar>::value &&std::is_integral<RScalar>::value &&\n                     sizeof(LScalar) < sizeof(int) &&\n                     sizeof(RScalar) < sizeof(int)),\n                    conditional<(sizeof(LScalar) == sizeof(RScalar)),\n                                conditional<std::is_unsigned<LScalar>::value, LScalar, RScalar>,\n                                conditional<(sizeof(LScalar) > sizeof(RScalar)), LScalar, RScalar>>,\n                    decltype(std::declval<LScalar>() + std::declval<RScalar>())>,\n        N>;\n};\n\n}  // namespace result_vector_type_internal\n\ntemplate <typename L, typename R>\nusing result_vector_type = typename result_vector_type_internal::evaluate<L, R>::type;\n\n#define Vc_BINARY_OPERATORS_(op_)                                                        \\\n    /*!\\brief Applies op_ component-wise and concurrently.  */                           \\\n    template <typename L, typename R>                                                    \\\n    Vc_INTRINSIC result_vector_type<L, R> operator op_(L &&lhs, R &&rhs)                 \\\n    {                                                                                    \\\n        using Return = result_vector_type<L, R>;                                         \\\n        return Vc::Detail::operator op_(                                                 \\\n            static_cast<const Return &>(std::forward<L>(lhs)),                           \\\n            static_cast<const Return &>(std::forward<R>(rhs)));                          \\\n    }\n/**\n * \\name Arithmetic and Bitwise Operators\n *\n * Applies the operator component-wise and concurrently on \\p lhs and \\p rhs and returns\n * a new SimdArray object containing the result values.\n *\n * This operator only participates in overload resolution if:\n * \\li At least one of the template parameters \\p L or \\p R is a SimdArray type.\n * \\li Either \\p L or \\p R is a fundamental arithmetic type but not an integral type\n *     larger than \\c int \\n\n *     or \\n\n *     \\p L or \\p R is a Vc::Vector type with equal number of elements (Vector::size() ==\n *     SimdArray::size()).\n *\n * The return type of the operator is a SimdArray type using the more precise EntryType of\n * \\p L or \\p R and the same number of elements as the SimdArray argument(s).\n */\n///@{\nVc_ALL_ARITHMETICS(Vc_BINARY_OPERATORS_);\nVc_ALL_BINARY(Vc_BINARY_OPERATORS_);\n///@}\n#undef Vc_BINARY_OPERATORS_\n#define Vc_BINARY_OPERATORS_(op_)                                                        \\\n    /*!\\brief Applies op_ component-wise and concurrently.  */                           \\\n    template <typename L, typename R>                                                    \\\n    Vc_INTRINSIC typename result_vector_type<L, R>::mask_type operator op_(L &&lhs,      \\\n                                                                           R &&rhs)      \\\n    {                                                                                    \\\n        using Promote = result_vector_type<L, R>;                                        \\\n        return Promote(std::forward<L>(lhs)) op_ Promote(std::forward<R>(rhs));          \\\n    }\n/**\n * \\name Compare Operators\n *\n * Applies the operator component-wise and concurrently on \\p lhs and \\p rhs and returns\n * a new SimdMaskArray object containing the result values.\n *\n * This operator only participates in overload resolution if (same rules as above):\n * \\li At least one of the template parameters \\p L or \\p R is a SimdArray type.\n * \\li Either \\p L or \\p R is a fundamental arithmetic type but not an integral type\n *     larger than \\c int \\n\n *     or \\n\n *     \\p L or \\p R is a Vc::Vector type with equal number of elements (Vector::size() ==\n *     SimdArray::size()).\n *\n * The return type of the operator is a SimdMaskArray type using the more precise EntryType of\n * \\p L or \\p R and the same number of elements as the SimdArray argument(s).\n */\n///@{\nVc_ALL_COMPARES(Vc_BINARY_OPERATORS_);\n///@}\n#undef Vc_BINARY_OPERATORS_\n\n// math functions {{{1\n#define Vc_FORWARD_UNARY_OPERATOR(name_)                                                 \\\n    /*!\\brief Applies the std::name_ function component-wise and concurrently. */        \\\n    template <typename T, std::size_t N, typename V, std::size_t M>                      \\\n    inline fixed_size_simd<T, N> name_(const SimdArray<T, N, V, M> &x)                   \\\n    {                                                                                    \\\n        return fixed_size_simd<T, N>::fromOperation(                                     \\\n            Common::Operations::Forward_##name_(), x);                                   \\\n    }                                                                                    \\\n    template <class T, int N>                                                            \\\n    fixed_size_simd<T, N> name_(const fixed_size_simd<T, N> &x)                          \\\n    {                                                                                    \\\n        return fixed_size_simd<T, N>::fromOperation(                                     \\\n            Common::Operations::Forward_##name_(), x);                                   \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n\n#define Vc_FORWARD_UNARY_BOOL_OPERATOR(name_)                                            \\\n    /*!\\brief Applies the std::name_ function component-wise and concurrently. */        \\\n    template <typename T, std::size_t N, typename V, std::size_t M>                      \\\n    inline fixed_size_simd_mask<T, N> name_(const SimdArray<T, N, V, M> &x)              \\\n    {                                                                                    \\\n        return fixed_size_simd_mask<T, N>::fromOperation(                                \\\n            Common::Operations::Forward_##name_(), x);                                   \\\n    }                                                                                    \\\n    template <class T, int N>                                                            \\\n    fixed_size_simd_mask<T, N> name_(const fixed_size_simd<T, N> &x)                     \\\n    {                                                                                    \\\n        return fixed_size_simd_mask<T, N>::fromOperation(                                \\\n            Common::Operations::Forward_##name_(), x);                                   \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n\n#define Vc_FORWARD_BINARY_OPERATOR(name_)                                                \\\n    /*!\\brief Applies the std::name_ function component-wise and concurrently. */        \\\n    template <typename T, std::size_t N, typename V, std::size_t M>                      \\\n    inline fixed_size_simd<T, N> name_(const SimdArray<T, N, V, M> &x,                   \\\n                                       const SimdArray<T, N, V, M> &y)                   \\\n    {                                                                                    \\\n        return fixed_size_simd<T, N>::fromOperation(                                     \\\n            Common::Operations::Forward_##name_(), x, y);                                \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n\n/**\n * \\name Math functions\n * These functions evaluate the\n */\n///@{\nVc_FORWARD_UNARY_OPERATOR(abs);\nVc_FORWARD_UNARY_OPERATOR(asin);\nVc_FORWARD_UNARY_OPERATOR(atan);\nVc_FORWARD_BINARY_OPERATOR(atan2);\nVc_FORWARD_UNARY_OPERATOR(ceil);\nVc_FORWARD_BINARY_OPERATOR(copysign);\nVc_FORWARD_UNARY_OPERATOR(cos);\nVc_FORWARD_UNARY_OPERATOR(exp);\nVc_FORWARD_UNARY_OPERATOR(exponent);\nVc_FORWARD_UNARY_OPERATOR(floor);\n/// Applies the std::fma function component-wise and concurrently.\ntemplate <typename T, std::size_t N>\ninline SimdArray<T, N> fma(const SimdArray<T, N> &a, const SimdArray<T, N> &b,\n                           const SimdArray<T, N> &c)\n{\n    return SimdArray<T, N>::fromOperation(Common::Operations::Forward_fma(), a, b, c);\n}\nVc_FORWARD_UNARY_BOOL_OPERATOR(isfinite);\nVc_FORWARD_UNARY_BOOL_OPERATOR(isinf);\nVc_FORWARD_UNARY_BOOL_OPERATOR(isnan);\nVc_FORWARD_UNARY_BOOL_OPERATOR(isnegative);\n/// Applies the std::frexp function component-wise and concurrently.\ntemplate <typename T, std::size_t N>\ninline SimdArray<T, N> frexp(const SimdArray<T, N> &x, SimdArray<int, N> *e)\n{\n    return SimdArray<T, N>::fromOperation(Common::Operations::Forward_frexp(), x, e);\n}\n/// Applies the std::ldexp function component-wise and concurrently.\ntemplate <typename T, std::size_t N>\ninline SimdArray<T, N> ldexp(const SimdArray<T, N> &x, const SimdArray<int, N> &e)\n{\n    return SimdArray<T, N>::fromOperation(Common::Operations::Forward_ldexp(), x, e);\n}\nVc_FORWARD_UNARY_OPERATOR(log);\nVc_FORWARD_UNARY_OPERATOR(log10);\nVc_FORWARD_UNARY_OPERATOR(log2);\nVc_FORWARD_UNARY_OPERATOR(reciprocal);\nVc_FORWARD_UNARY_OPERATOR(round);\nVc_FORWARD_UNARY_OPERATOR(rsqrt);\nVc_FORWARD_UNARY_OPERATOR(sin);\n/// Determines sine and cosine concurrently and component-wise on \\p x.\ntemplate <typename T, std::size_t N>\nvoid sincos(const SimdArray<T, N> &x, SimdArray<T, N> *sin, SimdArray<T, N> *cos)\n{\n    SimdArray<T, N>::callOperation(Common::Operations::Forward_sincos(), x, sin, cos);\n}\nVc_FORWARD_UNARY_OPERATOR(sqrt);\nVc_FORWARD_UNARY_OPERATOR(trunc);\nVc_FORWARD_BINARY_OPERATOR(min);\nVc_FORWARD_BINARY_OPERATOR(max);\n///@}\n#undef Vc_FORWARD_UNARY_OPERATOR\n#undef Vc_FORWARD_UNARY_BOOL_OPERATOR\n#undef Vc_FORWARD_BINARY_OPERATOR\n\n// simd_cast {{{1\n#ifdef Vc_MSVC\n#define Vc_DUMMY_ARG0 , int = 0\n#define Vc_DUMMY_ARG1 , long = 0\n#define Vc_DUMMY_ARG2 , short = 0\n#define Vc_DUMMY_ARG3 , char = '0'\n#define Vc_DUMMY_ARG4 , unsigned = 0u\n#define Vc_DUMMY_ARG5 , unsigned short = 0u\n#else\n#define Vc_DUMMY_ARG0\n#define Vc_DUMMY_ARG1\n#define Vc_DUMMY_ARG2\n#define Vc_DUMMY_ARG3\n#define Vc_DUMMY_ARG4\n#define Vc_DUMMY_ARG5\n#endif  // Vc_MSVC\n\n// simd_cast_impl_smaller_input {{{2\n// The following function can be implemented without the sizeof...(From) overload.\n// However, ICC has a bug (Premier Issue #6000116338) which leads to an ICE. Splitting the\n// function in two works around the issue.\ntemplate <typename Return, std::size_t N, typename T, typename... From>\nVc_INTRINSIC Vc_CONST enable_if<sizeof...(From) != 0, Return>\nsimd_cast_impl_smaller_input(const From &... xs, const T &last)\n{\n    Return r = simd_cast<Return>(xs...);\n    for (size_t i = 0; i < N; ++i) {\n        r[i + N * sizeof...(From)] = static_cast<typename Return::EntryType>(last[i]);\n    }\n    return r;\n}\ntemplate <typename Return, std::size_t N, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast_impl_smaller_input(const T &last)\n{\n    Return r = Return();\n    for (size_t i = 0; i < N; ++i) {\n        r[i] = static_cast<typename Return::EntryType>(last[i]);\n    }\n    return r;\n}\ntemplate <typename Return, std::size_t N, typename T, typename... From>\nVc_INTRINSIC Vc_CONST enable_if<sizeof...(From) != 0, Return> simd_cast_impl_larger_input(\n    const From &... xs, const T &last)\n{\n    Return r = simd_cast<Return>(xs...);\n    for (size_t i = N * sizeof...(From); i < Return::Size; ++i) {\n        r[i] = static_cast<typename Return::EntryType>(last[i - N * sizeof...(From)]);\n    }\n    return r;\n}\ntemplate <typename Return, std::size_t N, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast_impl_larger_input(const T &last)\n{\n    Return r = Return();\n    for (size_t i = 0; i < Return::size(); ++i) {\n        r[i] = static_cast<typename Return::EntryType>(last[i]);\n    }\n    return r;\n}\n\n// simd_cast_without_last (declaration) {{{2\ntemplate <typename Return, typename T, typename... From>\nVc_INTRINSIC_L Vc_CONST_L Return\n    simd_cast_without_last(const From &... xs, const T &) Vc_INTRINSIC_R Vc_CONST_R;\n\n// are_all_types_equal {{{2\ntemplate <typename... Ts> struct are_all_types_equal;\ntemplate <typename T>\nstruct are_all_types_equal<T> : public std::integral_constant<bool, true>\n{\n};\ntemplate <typename T0, typename T1, typename... Ts>\nstruct are_all_types_equal<T0, T1, Ts...>\n    : public std::integral_constant<\n          bool, std::is_same<T0, T1>::value && are_all_types_equal<T1, Ts...>::value>\n{\n};\n\n// simd_cast_interleaved_argument_order (declarations) {{{2\n/*! \\internal\n  The need for simd_cast_interleaved_argument_order stems from a shortcoming in pack\n  expansion of variadic templates in C++. For a simd_cast with SimdArray arguments that\n  are bisectable (i.e.  \\c storage_type0 and \\c storage_type1 are equal) the generic\n  implementation needs to forward to a simd_cast of the \\c internal_data0 and \\c\n  internal_data1 of the arguments. But the required order of arguments is\n  `internal_data0(arg0), internal_data1(arg0), internal_data0(arg1), ...`. This is\n  impossible to achieve with pack expansion. It is only possible to write\n  `internal_data0(args)..., internal_data1(args)...` and thus have the argument order\n  mixed up. The simd_cast_interleaved_argument_order “simply” calls simd_cast with the\n  arguments correctly reordered (i.e. interleaved).\n\n  The implementation of simd_cast_interleaved_argument_order is done generically, so that\n  it supports any number of arguments. The central idea of the implementation is an\n  `extract` function which returns one value of an argument pack determined via an index\n  passed as template argument. This index is generated via an index_sequence. The\n  `extract` function uses two argument packs (of equal size) to easily return values from\n  the front and middle of the argument pack (for doing the deinterleave).\n */\ntemplate <typename Return, typename... Ts>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast_interleaved_argument_order(const Ts &... a, const Ts &... b);\n\n// simd_cast_with_offset (declarations and one impl) {{{2\n// offset == 0 {{{3\ntemplate <typename Return, std::size_t offset, typename From, typename... Froms>\nVc_INTRINSIC Vc_CONST\n    enable_if<(are_all_types_equal<From, Froms...>::value && offset == 0), Return>\n        simd_cast_with_offset(const From &x, const Froms &... xs);\n// offset > 0 && offset divisible by Return::Size {{{3\ntemplate <typename Return, std::size_t offset, typename From>\nVc_INTRINSIC Vc_CONST\n    enable_if<(From::Size > offset && offset > 0 && offset % Return::Size == 0), Return>\n        simd_cast_with_offset(const From &x);\n// offset > 0 && offset NOT divisible && Return is non-atomic simd(mask)array {{{3\ntemplate <typename Return, std::size_t offset, typename From>\nVc_INTRINSIC Vc_CONST\n    enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&\n               ((Traits::isSimdArray<Return>::value &&\n                 !Traits::isAtomicSimdArray<Return>::value) ||\n                (Traits::isSimdMaskArray<Return>::value &&\n                 !Traits::isAtomicSimdMaskArray<Return>::value))),\n              Return>\n        simd_cast_with_offset(const From &x);\n// offset > 0 && offset NOT divisible && Return is atomic simd(mask)array {{{3\ntemplate <typename Return, std::size_t offset, typename From>\nVc_INTRINSIC Vc_CONST\n    enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&\n               ((Traits::isSimdArray<Return>::value &&\n                 Traits::isAtomicSimdArray<Return>::value) ||\n                (Traits::isSimdMaskArray<Return>::value &&\n                 Traits::isAtomicSimdMaskArray<Return>::value))),\n              Return>\n        simd_cast_with_offset(const From &x);\n// offset > first argument (drops first arg) {{{3\ntemplate <typename Return, std::size_t offset, typename From, typename... Froms>\nVc_INTRINSIC Vc_CONST enable_if<\n    (are_all_types_equal<From, Froms...>::value && From::Size <= offset), Return>\n    simd_cast_with_offset(const From &, const Froms &... xs)\n{\n    return simd_cast_with_offset<Return, offset - From::Size>(xs...);\n}\n\n// offset > first and only argument (returns Zero) {{{3\ntemplate <typename Return, std::size_t offset, typename From>\nVc_INTRINSIC Vc_CONST enable_if<(From::Size <= offset), Return> simd_cast_with_offset(\n    const From &)\n{\n    return Return(0);\n}\n\n// first_type_of {{{2\ntemplate <typename T, typename... Ts> struct first_type_of_impl\n{\n    using type = T;\n};\ntemplate <typename... Ts> using first_type_of = typename first_type_of_impl<Ts...>::type;\n\n// simd_cast_drop_arguments (declarations) {{{2\ntemplate <typename Return, typename From>\nVc_INTRINSIC Vc_CONST Return simd_cast_drop_arguments(From x);\ntemplate <typename Return, typename... Froms>\nVc_INTRINSIC Vc_CONST\n    enable_if<(are_all_types_equal<Froms...>::value &&\n               sizeof...(Froms) * first_type_of<Froms...>::Size < Return::Size),\n              Return>\n        simd_cast_drop_arguments(Froms... xs, first_type_of<Froms...> x);\n// The following function can be implemented without the sizeof...(From) overload.\n// However, ICC has a bug (Premier Issue #6000116338) which leads to an ICE. Splitting the\n// function in two works around the issue.\ntemplate <typename Return, typename From, typename... Froms>\nVc_INTRINSIC Vc_CONST enable_if<\n    (are_all_types_equal<From, Froms...>::value &&\n     (1 + sizeof...(Froms)) * From::Size >= Return::Size && sizeof...(Froms) != 0),\n    Return>\nsimd_cast_drop_arguments(Froms... xs, From x, From);\ntemplate <typename Return, typename From>\nVc_INTRINSIC Vc_CONST\n    enable_if<(are_all_types_equal<From>::value && From::Size >= Return::Size), Return>\n    simd_cast_drop_arguments(From x, From);\n\nnamespace\n{\n#ifdef Vc_DEBUG_SIMD_CAST\nvoid debugDoNothing(const std::initializer_list<void *> &) {}\ntemplate <typename T0, typename... Ts>\ninline void vc_debug_(const char *prefix, const char *suffix, const T0 &arg0,\n                      const Ts &... args)\n{\n    std::cerr << prefix << arg0;\n    debugDoNothing({&(std::cerr << \", \" << args)...});\n    std::cerr << suffix;\n}\n#else\ntemplate <typename T0, typename... Ts>\nVc_INTRINSIC void vc_debug_(const char *, const char *, const T0 &, const Ts &...)\n{\n}\n#endif\n}  // unnamed namespace\n\n// is_less trait{{{2\ntemplate <size_t A, size_t B>\nstruct is_less : public std::integral_constant<bool, (A < B)> {\n};\n\n// is_power_of_2 trait{{{2\ntemplate <size_t N>\nstruct is_power_of_2 : public std::integral_constant<bool, ((N - 1) & N) == 0> {\n};\n\n// simd_cast<T>(xs...) to SimdArray/-mask {{{2\n#define Vc_SIMDARRAY_CASTS(SimdArrayType_, NativeType_)                                  \\\n    template <typename Return, typename T, typename A, typename... Froms>                \\\n    Vc_INTRINSIC Vc_CONST enable_if<                                                     \\\n        (Traits::isAtomic##SimdArrayType_<Return>::value &&                              \\\n         is_less<NativeType_<T, A>::Size * sizeof...(Froms), Return::Size>::value &&     \\\n         are_all_types_equal<NativeType_<T, A>, Froms...>::value &&                      \\\n         !detail::is_fixed_size_abi<A>::value),                                          \\\n        Return>                                                                          \\\n    simd_cast(NativeType_<T, A> x, Froms... xs)                                          \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{1}(\", \")\\n\", x, xs...);                                     \\\n        return {private_init, simd_cast<typename Return::storage_type>(x, xs...)};       \\\n    }                                                                                    \\\n    template <typename Return, typename T, typename A, typename... Froms>                \\\n    Vc_INTRINSIC Vc_CONST enable_if<                                                     \\\n        (Traits::isAtomic##SimdArrayType_<Return>::value &&                              \\\n         !is_less<NativeType_<T, A>::Size * sizeof...(Froms), Return::Size>::value &&    \\\n         are_all_types_equal<NativeType_<T, A>, Froms...>::value &&                      \\\n         !detail::is_fixed_size_abi<A>::value),                                          \\\n        Return>                                                                          \\\n    simd_cast(NativeType_<T, A> x, Froms... xs)                                          \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{2}(\", \")\\n\", x, xs...);                                     \\\n        return {simd_cast_without_last<Return, NativeType_<T, A>, Froms...>(x, xs...)};  \\\n    }                                                                                    \\\n    template <typename Return, typename T, typename A, typename... Froms>                \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(Traits::is##SimdArrayType_<Return>::value &&                          \\\n                   !Traits::isAtomic##SimdArrayType_<Return>::value &&                   \\\n                   is_less<Common::left_size<Return::Size>(),                            \\\n                           NativeType_<T, A>::Size *(1 + sizeof...(Froms))>::value &&    \\\n                   are_all_types_equal<NativeType_<T, A>, Froms...>::value &&            \\\n                   !detail::is_fixed_size_abi<A>::value),                                \\\n                  Return>                                                                \\\n        simd_cast(NativeType_<T, A> x, Froms... xs)                                      \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{3}(\", \")\\n\", x, xs...);                                     \\\n        using R0 = typename Return::storage_type0;                                       \\\n        using R1 = typename Return::storage_type1;                                       \\\n        return {simd_cast_drop_arguments<R0, Froms...>(x, xs...),                        \\\n                simd_cast_with_offset<R1, R0::Size>(x, xs...)};                          \\\n    }                                                                                    \\\n    template <typename Return, typename T, typename A, typename... Froms>                \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(Traits::is##SimdArrayType_<Return>::value &&                          \\\n                   !Traits::isAtomic##SimdArrayType_<Return>::value &&                   \\\n                   !is_less<Common::left_size<Return::Size>(),                           \\\n                            NativeType_<T, A>::Size *(1 + sizeof...(Froms))>::value &&   \\\n                   are_all_types_equal<NativeType_<T, A>, Froms...>::value &&            \\\n                   !detail::is_fixed_size_abi<A>::value),                                \\\n                  Return>                                                                \\\n        simd_cast(NativeType_<T, A> x, Froms... xs)                                      \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{4}(\", \")\\n\", x, xs...);                                     \\\n        using R0 = typename Return::storage_type0;                                       \\\n        using R1 = typename Return::storage_type1;                                       \\\n        return {simd_cast<R0>(x, xs...), R1(0)};                                         \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n\nVc_SIMDARRAY_CASTS(SimdArray, Vc::Vector);\nVc_SIMDARRAY_CASTS(SimdMaskArray, Vc::Mask);\n#undef Vc_SIMDARRAY_CASTS\n\n// simd_cast<SimdArray/-mask, offset>(V) {{{2\n#define Vc_SIMDARRAY_CASTS(SimdArrayType_, NativeType_)                                  \\\n    /* SIMD Vector/Mask to atomic SimdArray/simdmaskarray */                             \\\n    template <typename Return, int offset, typename T, typename A>                       \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<Traits::isAtomic##SimdArrayType_<Return>::value, Return>               \\\n        simd_cast(NativeType_<T, A> x Vc_DUMMY_ARG0)                                     \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, atomic}(\", \")\\n\", offset, x);                       \\\n        return {private_init, simd_cast<typename Return::storage_type, offset>(x)};      \\\n    }                                                                                    \\\n    /* both halves of Return array are extracted from argument */                        \\\n    template <typename Return, int offset, typename T, typename A>                       \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(Traits::is##SimdArrayType_<Return>::value &&                          \\\n                   !Traits::isAtomic##SimdArrayType_<Return>::value &&                   \\\n                   Return::Size * offset + Common::left_size<Return::Size>() <           \\\n                       NativeType_<T, A>::Size),                                         \\\n                  Return>                                                                \\\n        simd_cast(NativeType_<T, A> x Vc_DUMMY_ARG1)                                     \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, split Return}(\", \")\\n\", offset, x);                 \\\n        using R0 = typename Return::storage_type0;                                       \\\n        constexpr int entries_offset = offset * Return::Size;                            \\\n        constexpr int entries_offset_right = entries_offset + R0::Size;                  \\\n        return {                                                                         \\\n            simd_cast_with_offset<typename Return::storage_type0, entries_offset>(x),    \\\n            simd_cast_with_offset<typename Return::storage_type1, entries_offset_right>( \\\n                x)};                                                                     \\\n    }                                                                                    \\\n    /* SIMD Vector/Mask to non-atomic SimdArray/simdmaskarray */                         \\\n    /* right half of Return array is zero */                                             \\\n    template <typename Return, int offset, typename T, typename A>                       \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(Traits::is##SimdArrayType_<Return>::value &&                          \\\n                   !Traits::isAtomic##SimdArrayType_<Return>::value &&                   \\\n                   Return::Size * offset + Common::left_size<Return::Size>() >=          \\\n                       NativeType_<T, A>::Size),                                         \\\n                  Return>                                                                \\\n        simd_cast(NativeType_<T, A> x Vc_DUMMY_ARG2)                                     \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, R1::Zero}(\", \")\\n\", offset, x);                     \\\n        using R0 = typename Return::storage_type0;                                       \\\n        using R1 = typename Return::storage_type1;                                       \\\n        constexpr int entries_offset = offset * Return::Size;                            \\\n        return {simd_cast_with_offset<R0, entries_offset>(x), R1(0)};                    \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n\nVc_SIMDARRAY_CASTS(SimdArray, Vc::Vector);\nVc_SIMDARRAY_CASTS(SimdMaskArray, Vc::Mask);\n#undef Vc_SIMDARRAY_CASTS\n\n// simd_cast<T>(xs...) from SimdArray/-mask {{{2\n#define Vc_SIMDARRAY_CASTS(SimdArrayType_)                                               \\\n    /* indivisible SimdArrayType_ */                                                     \\\n    template <typename Return, typename T, std::size_t N, typename V, typename... From>  \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(are_all_types_equal<SimdArrayType_<T, N, V, N>, From...>::value &&    \\\n                   (sizeof...(From) == 0 || N * sizeof...(From) < Return::Size) &&       \\\n                   !std::is_same<Return, SimdArrayType_<T, N, V, N>>::value),            \\\n                  Return>                                                                \\\n        simd_cast(const SimdArrayType_<T, N, V, N> &x0, const From &... xs)              \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{indivisible}(\", \")\\n\", x0, xs...);                          \\\n        return simd_cast<Return>(internal_data(x0), internal_data(xs)...);               \\\n    }                                                                                    \\\n    /* indivisible SimdArrayType_ && can drop arguments from the end */                  \\\n    template <typename Return, typename T, std::size_t N, typename V, typename... From>  \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(are_all_types_equal<SimdArrayType_<T, N, V, N>, From...>::value &&    \\\n                   (sizeof...(From) > 0 && (N * sizeof...(From) >= Return::Size)) &&     \\\n                   !std::is_same<Return, SimdArrayType_<T, N, V, N>>::value),            \\\n                  Return>                                                                \\\n        simd_cast(const SimdArrayType_<T, N, V, N> &x0, const From &... xs)              \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{indivisible2}(\", \")\\n\", x0, xs...);                         \\\n        return simd_cast_without_last<Return,                                            \\\n                                      typename SimdArrayType_<T, N, V, N>::storage_type, \\\n                                      typename From::storage_type...>(                   \\\n            internal_data(x0), internal_data(xs)...);                                    \\\n    }                                                                                    \\\n    /* bisectable SimdArrayType_ (N = 2^n) && never too large */                         \\\n    template <typename Return, typename T, std::size_t N, typename V, std::size_t M,     \\\n              typename... From>                                                          \\\n    Vc_INTRINSIC Vc_CONST enable_if<                                                     \\\n        (N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value &&    \\\n         !std::is_same<Return, SimdArrayType_<T, N, V, M>>::value &&                     \\\n         is_less<N * sizeof...(From), Return::Size>::value && is_power_of_2<N>::value),  \\\n        Return>                                                                          \\\n    simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs)                  \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{bisectable}(\", \")\\n\", x0, xs...);                           \\\n        return simd_cast_interleaved_argument_order<                                     \\\n            Return, typename SimdArrayType_<T, N, V, M>::storage_type0,                  \\\n            typename From::storage_type0...>(internal_data0(x0), internal_data0(xs)...,  \\\n                                             internal_data1(x0), internal_data1(xs)...); \\\n    }                                                                                    \\\n    /* bisectable SimdArrayType_ (N = 2^n) && input so large that at least the last      \\\n     * input can be dropped */                                                           \\\n    template <typename Return, typename T, std::size_t N, typename V, std::size_t M,     \\\n              typename... From>                                                          \\\n    Vc_INTRINSIC Vc_CONST enable_if<                                                     \\\n        (N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value &&    \\\n         !is_less<N * sizeof...(From), Return::Size>::value && is_power_of_2<N>::value), \\\n        Return>                                                                          \\\n    simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs)                  \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{bisectable2}(\", \")\\n\", x0, xs...);                          \\\n        return simd_cast_without_last<Return, SimdArrayType_<T, N, V, M>, From...>(      \\\n            x0, xs...);                                                                  \\\n    }                                                                                    \\\n    /* remaining SimdArrayType_ input never larger (N != 2^n) */                         \\\n    template <typename Return, typename T, std::size_t N, typename V, std::size_t M,     \\\n              typename... From>                                                          \\\n    Vc_INTRINSIC Vc_CONST enable_if<                                                     \\\n        (N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value &&    \\\n         N * (1 + sizeof...(From)) <= Return::Size && !is_power_of_2<N>::value),         \\\n        Return>                                                                          \\\n    simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs)                  \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{remaining}(\", \")\\n\", x0, xs...);                            \\\n        return simd_cast_impl_smaller_input<Return, N, SimdArrayType_<T, N, V, M>,       \\\n                                            From...>(x0, xs...);                         \\\n    }                                                                                    \\\n    /* remaining SimdArrayType_ input larger (N != 2^n) */                               \\\n    template <typename Return, typename T, std::size_t N, typename V, std::size_t M,     \\\n              typename... From>                                                          \\\n    Vc_INTRINSIC Vc_CONST enable_if<                                                     \\\n        (N != M && are_all_types_equal<SimdArrayType_<T, N, V, M>, From...>::value &&    \\\n         N * (1 + sizeof...(From)) > Return::Size && !is_power_of_2<N>::value),          \\\n        Return>                                                                          \\\n    simd_cast(const SimdArrayType_<T, N, V, M> &x0, const From &... xs)                  \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{remaining2}(\", \")\\n\", x0, xs...);                           \\\n        return simd_cast_impl_larger_input<Return, N, SimdArrayType_<T, N, V, M>,        \\\n                                           From...>(x0, xs...);                          \\\n    }                                                                                    \\\n    /* a single bisectable SimdArrayType_ (N = 2^n) too large */                         \\\n    template <typename Return, typename T, std::size_t N, typename V, std::size_t M>     \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(N != M && N >= 2 * Return::Size && is_power_of_2<N>::value), Return>  \\\n        simd_cast(const SimdArrayType_<T, N, V, M> &x)                                   \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{single bisectable}(\", \")\\n\", x);                            \\\n        return simd_cast<Return>(internal_data0(x));                                     \\\n    }                                                                                    \\\n    template <typename Return, typename T, std::size_t N, typename V, std::size_t M>     \\\n    Vc_INTRINSIC Vc_CONST enable_if<(N != M && N > Return::Size &&                       \\\n                                     N < 2 * Return::Size && is_power_of_2<N>::value),   \\\n                                    Return>                                              \\\n    simd_cast(const SimdArrayType_<T, N, V, M> &x)                                       \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{single bisectable2}(\", \")\\n\", x);                           \\\n        return simd_cast<Return>(internal_data0(x), internal_data1(x));                  \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\n\nVc_SIMDARRAY_CASTS(SimdArray);\nVc_SIMDARRAY_CASTS(SimdMaskArray);\n#undef Vc_SIMDARRAY_CASTS\ntemplate <class Return, class T, int N, class... Ts,\n          class = enable_if<!std::is_same<Return, fixed_size_simd<T, N>>::value>>\nVc_INTRINSIC Return simd_cast(const fixed_size_simd<T, N> &x, const Ts &... xs)\n{\n    return simd_cast<Return>(static_cast<const SimdArray<T, N> &>(x),\n                             static_cast<const SimdArray<T, N> &>(xs)...);\n}\ntemplate <class Return, class T, int N, class... Ts,\n          class = enable_if<!std::is_same<Return, fixed_size_simd_mask<T, N>>::value>>\nVc_INTRINSIC Return simd_cast(const fixed_size_simd_mask<T, N> &x, const Ts &... xs)\n{\n    return simd_cast<Return>(static_cast<const SimdMaskArray<T, N> &>(x),\n                             static_cast<const SimdMaskArray<T, N> &>(xs)...);\n}\n\n// simd_cast<T, offset>(SimdArray/-mask) {{{2\n#define Vc_SIMDARRAY_CASTS(SimdArrayType_)                                               \\\n    /* offset == 0 is like without offset */                                             \\\n    template <typename Return, int offset, typename T, std::size_t N, typename V,        \\\n              std::size_t M>                                                             \\\n    Vc_INTRINSIC Vc_CONST enable_if<(offset == 0), Return> simd_cast(                    \\\n        const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG0)                               \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset == 0}(\", \")\\n\", offset, x);                          \\\n        return simd_cast<Return>(x);                                                     \\\n    }                                                                                    \\\n    /* forward to V */                                                                   \\\n    template <typename Return, int offset, typename T, std::size_t N, typename V>        \\\n    Vc_INTRINSIC Vc_CONST enable_if<(offset != 0), Return> simd_cast(                    \\\n        const SimdArrayType_<T, N, V, N> &x Vc_DUMMY_ARG1)                               \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, forward}(\", \")\\n\", offset, x);                      \\\n        return simd_cast<Return, offset>(internal_data(x));                              \\\n    }                                                                                    \\\n    /* convert from right member of SimdArray */                                         \\\n    template <typename Return, int offset, typename T, std::size_t N, typename V,        \\\n              std::size_t M>                                                             \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(N != M && offset * Return::Size >= Common::left_size<N>() &&          \\\n                   offset != 0 && Common::left_size<N>() % Return::Size == 0),           \\\n                  Return>                                                                \\\n        simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG2)                     \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, right}(\", \")\\n\", offset, x);                        \\\n        return simd_cast<Return, offset - Common::left_size<N>() / Return::Size>(        \\\n            internal_data1(x));                                                          \\\n    }                                                                                    \\\n    /* same as above except for odd cases where offset * Return::Size doesn't fit the    \\\n     * left side of the SimdArray */                                                     \\\n    template <typename Return, int offset, typename T, std::size_t N, typename V,        \\\n              std::size_t M>                                                             \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(N != M && offset * Return::Size >= Common::left_size<N>() &&          \\\n                   offset != 0 && Common::left_size<N>() % Return::Size != 0),           \\\n                  Return>                                                                \\\n        simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG3)                     \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, right, nofit}(\", \")\\n\", offset, x);                 \\\n        return simd_cast_with_offset<Return,                                             \\\n                                     offset * Return::Size - Common::left_size<N>()>(    \\\n            internal_data1(x));                                                          \\\n    }                                                                                    \\\n    /* convert from left member of SimdArray */                                          \\\n    template <typename Return, int offset, typename T, std::size_t N, typename V,        \\\n              std::size_t M>                                                             \\\n    Vc_INTRINSIC Vc_CONST enable_if<                                                     \\\n        (N != M && /*offset * Return::Size < Common::left_size<N>() &&*/                 \\\n         offset != 0 && (offset + 1) * Return::Size <= Common::left_size<N>()),          \\\n        Return>                                                                          \\\n    simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG4)                         \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, left}(\", \")\\n\", offset, x);                         \\\n        return simd_cast<Return, offset>(internal_data0(x));                             \\\n    }                                                                                    \\\n    /* fallback to copying scalars */                                                    \\\n    template <typename Return, int offset, typename T, std::size_t N, typename V,        \\\n              std::size_t M>                                                             \\\n    Vc_INTRINSIC Vc_CONST                                                                \\\n        enable_if<(N != M && (offset * Return::Size < Common::left_size<N>()) &&         \\\n                   offset != 0 && (offset + 1) * Return::Size > Common::left_size<N>()), \\\n                  Return>                                                                \\\n        simd_cast(const SimdArrayType_<T, N, V, M> &x Vc_DUMMY_ARG5)                     \\\n    {                                                                                    \\\n        vc_debug_(\"simd_cast{offset, copy scalars}(\", \")\\n\", offset, x);                 \\\n        using R = typename Return::EntryType;                                            \\\n        Return r = Return(0);                                                            \\\n        for (std::size_t i = offset * Return::Size;                                      \\\n             i < std::min(N, (offset + 1) * Return::Size); ++i) {                        \\\n            r[i - offset * Return::Size] = static_cast<R>(x[i]);                         \\\n        }                                                                                \\\n        return r;                                                                        \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_SIMDARRAY_CASTS(SimdArray);\nVc_SIMDARRAY_CASTS(SimdMaskArray);\n#undef Vc_SIMDARRAY_CASTS\n// simd_cast_drop_arguments (definitions) {{{2\ntemplate <typename Return, typename From>\nVc_INTRINSIC Vc_CONST Return simd_cast_drop_arguments(From x)\n{\n    return simd_cast<Return>(x);\n}\ntemplate <typename Return, typename... Froms>\nVc_INTRINSIC Vc_CONST\n    enable_if<(are_all_types_equal<Froms...>::value &&\n               sizeof...(Froms) * first_type_of<Froms...>::Size < Return::Size),\n              Return>\n        simd_cast_drop_arguments(Froms... xs, first_type_of<Froms...> x)\n{\n    return simd_cast<Return>(xs..., x);\n}\n// The following function can be implemented without the sizeof...(From) overload.\n// However, ICC has a bug (Premier Issue #6000116338) which leads to an ICE. Splitting the\n// function in two works around the issue.\ntemplate <typename Return, typename From, typename... Froms>\nVc_INTRINSIC Vc_CONST enable_if<\n    (are_all_types_equal<From, Froms...>::value &&\n     (1 + sizeof...(Froms)) * From::Size >= Return::Size && sizeof...(Froms) != 0),\n    Return>\nsimd_cast_drop_arguments(Froms... xs, From x, From)\n{\n    return simd_cast_drop_arguments<Return, Froms...>(xs..., x);\n}\ntemplate <typename Return, typename From>\nVc_INTRINSIC Vc_CONST\n    enable_if<(are_all_types_equal<From>::value && From::Size >= Return::Size), Return>\n    simd_cast_drop_arguments(From x, From)\n{\n    return simd_cast_drop_arguments<Return>(x);\n}\n\n// simd_cast_with_offset (definitions) {{{2\n    template <typename Return, std::size_t offset, typename From>\n    Vc_INTRINSIC Vc_CONST\n    enable_if<(From::Size > offset && offset > 0 && offset % Return::Size == 0),\n              Return> simd_cast_with_offset(const From &x)\n{\n    return simd_cast<Return, offset / Return::Size>(x);\n}\ntemplate <typename Return, std::size_t offset, typename From>\nVc_INTRINSIC Vc_CONST\n    enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&\n               ((Traits::isSimdArray<Return>::value &&\n                 !Traits::isAtomicSimdArray<Return>::value) ||\n                (Traits::isSimdMaskArray<Return>::value &&\n                 !Traits::isAtomicSimdMaskArray<Return>::value))),\n              Return>\n        simd_cast_with_offset(const From &x)\n{\n    using R0 = typename Return::storage_type0;\n    using R1 = typename Return::storage_type1;\n    return {simd_cast_with_offset<R0, offset>(x),\n            simd_cast_with_offset<R1, offset + R0::Size>(x)};\n}\ntemplate <typename Return, std::size_t offset, typename From>\nVc_INTRINSIC Vc_CONST\n    enable_if<(From::Size > offset && offset > 0 && offset % Return::Size != 0 &&\n               ((Traits::isSimdArray<Return>::value &&\n                 Traits::isAtomicSimdArray<Return>::value) ||\n                (Traits::isSimdMaskArray<Return>::value &&\n                 Traits::isAtomicSimdMaskArray<Return>::value))),\n              Return>\n        simd_cast_with_offset(const From &x)\n{\n    return simd_cast<Return, offset / Return::Size>(x.shifted(offset % Return::Size));\n}\ntemplate <typename Return, std::size_t offset, typename From, typename... Froms>\nVc_INTRINSIC Vc_CONST\n    enable_if<(are_all_types_equal<From, Froms...>::value && offset == 0), Return>\n        simd_cast_with_offset(const From &x, const Froms &... xs)\n{\n    return simd_cast<Return>(x, xs...);\n}\n\n// simd_cast_without_last (definition) {{{2\ntemplate <typename Return, typename T, typename... From>\nVc_INTRINSIC Vc_CONST Return simd_cast_without_last(const From &... xs, const T &)\n{\n    return simd_cast<Return>(xs...);\n}\n\n// simd_cast_interleaved_argument_order (definitions) {{{2\n\n#ifdef Vc_MSVC\n// MSVC doesn't see that the Ts pack below can be empty and thus complains when extract_interleaved\n// is called with only 2 arguments. These overloads here are *INCORRECT standard C++*, but they make\n// MSVC do the right thing.\ntemplate <std::size_t I, typename T0>\nVc_INTRINSIC Vc_CONST enable_if<(I == 0), T0> extract_interleaved(const T0 &a0, const T0 &)\n{\n    return a0;\n}\ntemplate <std::size_t I, typename T0>\nVc_INTRINSIC Vc_CONST enable_if<(I == 1), T0> extract_interleaved(const T0 &, const T0 &b0)\n{\n    return b0;\n}\n#endif  // Vc_MSVC\n\n/// \\internal returns the first argument\ntemplate <std::size_t I, typename T0, typename... Ts>\nVc_INTRINSIC Vc_CONST enable_if<(I == 0), T0> extract_interleaved(const T0 &a0,\n                                                                  const Ts &...,\n                                                                  const T0 &,\n                                                                  const Ts &...)\n{\n    return a0;\n}\n/// \\internal returns the center argument\ntemplate <std::size_t I, typename T0, typename... Ts>\nVc_INTRINSIC Vc_CONST enable_if<(I == 1), T0> extract_interleaved(const T0 &,\n                                                                  const Ts &...,\n                                                                  const T0 &b0,\n                                                                  const Ts &...)\n{\n    return b0;\n}\n/// \\internal drops the first and center arguments and recurses\ntemplate <std::size_t I, typename T0, typename... Ts>\nVc_INTRINSIC Vc_CONST enable_if<(I > 1), T0> extract_interleaved(const T0 &,\n                                                                 const Ts &... a,\n                                                                 const T0 &,\n                                                                 const Ts &... b)\n{\n    return extract_interleaved<I - 2, Ts...>(a..., b...);\n}\n/// \\internal calls simd_cast with correct argument order thanks to extract_interleaved\ntemplate <typename Return, typename... Ts, std::size_t... Indexes>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast_interleaved_argument_order_1(index_sequence<Indexes...>, const Ts &... a,\n                                           const Ts &... b)\n{\n    return simd_cast<Return>(extract_interleaved<Indexes, Ts...>(a..., b...)...);\n}\n/// \\internal constructs the necessary index_sequence to pass it to\n/// simd_cast_interleaved_argument_order_1\ntemplate <typename Return, typename... Ts>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast_interleaved_argument_order(const Ts &... a, const Ts &... b)\n{\n    using seq = make_index_sequence<sizeof...(Ts)*2>;\n    return simd_cast_interleaved_argument_order_1<Return, Ts...>(seq(), a..., b...);\n}\n\n// conditional_assign {{{1\n#define Vc_CONDITIONAL_ASSIGN(name_, op_)                                                \\\n    template <Operator O, typename T, std::size_t N, typename V, size_t VN, typename M,  \\\n              typename U>                                                                \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, void> conditional_assign(               \\\n        SimdArray<T, N, V, VN> &lhs, M &&mask, U &&rhs)                                  \\\n    {                                                                                    \\\n        lhs(mask) op_ rhs;                                                               \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(          Assign,  =);\nVc_CONDITIONAL_ASSIGN(      PlusAssign, +=);\nVc_CONDITIONAL_ASSIGN(     MinusAssign, -=);\nVc_CONDITIONAL_ASSIGN(  MultiplyAssign, *=);\nVc_CONDITIONAL_ASSIGN(    DivideAssign, /=);\nVc_CONDITIONAL_ASSIGN( RemainderAssign, %=);\nVc_CONDITIONAL_ASSIGN(       XorAssign, ^=);\nVc_CONDITIONAL_ASSIGN(       AndAssign, &=);\nVc_CONDITIONAL_ASSIGN(        OrAssign, |=);\nVc_CONDITIONAL_ASSIGN( LeftShiftAssign,<<=);\nVc_CONDITIONAL_ASSIGN(RightShiftAssign,>>=);\n#undef Vc_CONDITIONAL_ASSIGN\n\n#define Vc_CONDITIONAL_ASSIGN(name_, expr_)                                              \\\n    template <Operator O, typename T, std::size_t N, typename V, size_t VN, typename M>  \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, SimdArray<T, N, V, VN>>                 \\\n    conditional_assign(SimdArray<T, N, V, VN> &lhs, M &&mask)                            \\\n    {                                                                                    \\\n        return expr_;                                                                    \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(PostIncrement, lhs(mask)++);\nVc_CONDITIONAL_ASSIGN( PreIncrement, ++lhs(mask));\nVc_CONDITIONAL_ASSIGN(PostDecrement, lhs(mask)--);\nVc_CONDITIONAL_ASSIGN( PreDecrement, --lhs(mask));\n#undef Vc_CONDITIONAL_ASSIGN\n// transpose_impl {{{1\nnamespace Common\n{\ntemplate <typename T, size_t N, typename V>\ninline void transpose_impl(\n    TransposeTag<4, 4>, SimdArray<T, N, V, N> *Vc_RESTRICT r[],\n    const TransposeProxy<SimdArray<T, N, V, N>, SimdArray<T, N, V, N>,\n                         SimdArray<T, N, V, N>, SimdArray<T, N, V, N>> &proxy)\n{\n    V *Vc_RESTRICT r2[4] = {&internal_data(*r[0]), &internal_data(*r[1]),\n                            &internal_data(*r[2]), &internal_data(*r[3])};\n    transpose_impl(TransposeTag<4, 4>(), &r2[0],\n                   TransposeProxy<V, V, V, V>{internal_data(std::get<0>(proxy.in)),\n                                              internal_data(std::get<1>(proxy.in)),\n                                              internal_data(std::get<2>(proxy.in)),\n                                              internal_data(std::get<3>(proxy.in))});\n}\n\ntemplate <typename T, typename V>\ninline void transpose_impl(\n    TransposeTag<2, 4>, SimdArray<T, 4, V, 1> *Vc_RESTRICT r[],\n    const TransposeProxy<SimdArray<T, 2, V, 1>, SimdArray<T, 2, V, 1>,\n                         SimdArray<T, 2, V, 1>, SimdArray<T, 2, V, 1>> &proxy)\n{\n    auto &lo = *r[0];\n    auto &hi = *r[1];\n    internal_data0(internal_data0(lo)) = internal_data0(std::get<0>(proxy.in));\n    internal_data1(internal_data0(lo)) = internal_data0(std::get<1>(proxy.in));\n    internal_data0(internal_data1(lo)) = internal_data0(std::get<2>(proxy.in));\n    internal_data1(internal_data1(lo)) = internal_data0(std::get<3>(proxy.in));\n    internal_data0(internal_data0(hi)) = internal_data1(std::get<0>(proxy.in));\n    internal_data1(internal_data0(hi)) = internal_data1(std::get<1>(proxy.in));\n    internal_data0(internal_data1(hi)) = internal_data1(std::get<2>(proxy.in));\n    internal_data1(internal_data1(hi)) = internal_data1(std::get<3>(proxy.in));\n}\n\ntemplate <typename T, typename V>\ninline void transpose_impl(\n    TransposeTag<4, 4>, SimdArray<T, 1, V, 1> *Vc_RESTRICT r[],\n    const TransposeProxy<SimdArray<T, 1, V, 1>, SimdArray<T, 1, V, 1>,\n                         SimdArray<T, 1, V, 1>, SimdArray<T, 1, V, 1>> &proxy)\n{\n    V *Vc_RESTRICT r2[4] = {&internal_data(*r[0]), &internal_data(*r[1]),\n                            &internal_data(*r[2]), &internal_data(*r[3])};\n    transpose_impl(TransposeTag<4, 4>(), &r2[0],\n                   TransposeProxy<V, V, V, V>{internal_data(std::get<0>(proxy.in)),\n                                              internal_data(std::get<1>(proxy.in)),\n                                              internal_data(std::get<2>(proxy.in)),\n                                              internal_data(std::get<3>(proxy.in))});\n}\n\ntemplate <typename T, size_t N, typename V>\ninline void transpose_impl(\n    TransposeTag<4, 4>, SimdArray<T, N, V, 1> *Vc_RESTRICT r[],\n    const TransposeProxy<SimdArray<T, N, V, 1>, SimdArray<T, N, V, 1>,\n                         SimdArray<T, N, V, 1>, SimdArray<T, N, V, 1>> &proxy)\n{\n    SimdArray<T, N, V, 1> *Vc_RESTRICT r0[4 / 2] = {r[0], r[1]};\n    SimdArray<T, N, V, 1> *Vc_RESTRICT r1[4 / 2] = {r[2], r[3]};\n    using H = SimdArray<T, 2>;\n    transpose_impl(TransposeTag<2, 4>(), &r0[0],\n                   TransposeProxy<H, H, H, H>{internal_data0(std::get<0>(proxy.in)),\n                                              internal_data0(std::get<1>(proxy.in)),\n                                              internal_data0(std::get<2>(proxy.in)),\n                                              internal_data0(std::get<3>(proxy.in))});\n    transpose_impl(TransposeTag<2, 4>(), &r1[0],\n                   TransposeProxy<H, H, H, H>{internal_data1(std::get<0>(proxy.in)),\n                                              internal_data1(std::get<1>(proxy.in)),\n                                              internal_data1(std::get<2>(proxy.in)),\n                                              internal_data1(std::get<3>(proxy.in))});\n}\n\n/* TODO:\ntemplate <typename T, std::size_t N, typename V, std::size_t VSize>\ninline enable_if<(N > VSize), void> transpose_impl(\n    std::array<SimdArray<T, N, V, VSize> * Vc_RESTRICT, 4> & r,\n    const TransposeProxy<SimdArray<T, N, V, VSize>, SimdArray<T, N, V, VSize>,\n                         SimdArray<T, N, V, VSize>, SimdArray<T, N, V, VSize>> &proxy)\n{\n    typedef SimdArray<T, N, V, VSize> SA;\n    std::array<typename SA::storage_type0 * Vc_RESTRICT, 4> r0 = {\n        {&internal_data0(*r[0]), &internal_data0(*r[1]), &internal_data0(*r[2]),\n         &internal_data0(*r[3])}};\n    transpose_impl(\n        r0, TransposeProxy<typename SA::storage_type0, typename SA::storage_type0,\n                           typename SA::storage_type0, typename SA::storage_type0>{\n                internal_data0(std::get<0>(proxy.in)),\n                internal_data0(std::get<1>(proxy.in)),\n                internal_data0(std::get<2>(proxy.in)),\n                internal_data0(std::get<3>(proxy.in))});\n\n    std::array<typename SA::storage_type1 * Vc_RESTRICT, 4> r1 = {\n        {&internal_data1(*r[0]), &internal_data1(*r[1]), &internal_data1(*r[2]),\n         &internal_data1(*r[3])}};\n    transpose_impl(\n        r1, TransposeProxy<typename SA::storage_type1, typename SA::storage_type1,\n                           typename SA::storage_type1, typename SA::storage_type1>{\n                internal_data1(std::get<0>(proxy.in)),\n                internal_data1(std::get<1>(proxy.in)),\n                internal_data1(std::get<2>(proxy.in)),\n                internal_data1(std::get<3>(proxy.in))});\n}\n*/\n}  // namespace Common\n\n// }}}1\nnamespace Detail\n{\n// InterleaveImpl for SimdArrays {{{\n// atomic {{{1\ntemplate <class T, size_t N,  class V, size_t VSizeof>\nstruct InterleaveImpl<SimdArray<T, N, V, N>, N, VSizeof> {\n    template <class I, class... VV>\n    static Vc_INTRINSIC void interleave(T *const data, const I &i, const VV &... vv)\n    {\n        InterleaveImpl<V, N, VSizeof>::interleave(data, i, internal_data(vv)...);\n    }\n    template <class I, class... VV>\n    static Vc_INTRINSIC void deinterleave(T const *const data, const I &i, VV &... vv)\n    {\n        InterleaveImpl<V, N, VSizeof>::deinterleave(data, i, internal_data(vv)...);\n    }\n};\n\n// generic (TODO) {{{1\n/*\ntemplate <class T, size_t N, class V, size_t Wt, size_t VSizeof>\nstruct InterleaveImpl<SimdArray<T, N, V, Wt>, N, VSizeof> {\n    using SA = SimdArray<T, N, V, Wt>;\n    using SA0 = typename SA::storage_type0;\n    using SA1 = typename SA::storage_type1;\n\n    template <class I, class... VV>\n    static Vc_INTRINSIC void interleave(T *const data, const I &i, const VV &... vv)\n    {\n        InterleaveImpl<SA0, SA0::size(), sizeof(SA0)>::interleave(\n            data, i,  // i needs to be split\n            internal_data0(vv)...);\n        InterleaveImpl<SA1, SA1::size(), sizeof(SA1)>::interleave(\n            data,  // how far to advance data?\n            i,     // i needs to be split\n            internal_data1(vv)...);\n    }\n    template <class I, class... VV>\n    static Vc_INTRINSIC void deinterleave(T const *const data, const I &i, VV &... vv)\n    {\n        InterleaveImpl<V, N, VSizeof>::deinterleave(data, i, internal_data(vv)...);\n    }\n};\n*/\n}  // namespace Detail\n// }}}\n/// @}\n\n} // namespace Vc_VERSIONED_NAMESPACE\n\n// numeric_limits {{{1\nnamespace std\n{\ntemplate <typename T, size_t N, typename V, size_t VN>\nstruct numeric_limits<Vc::SimdArray<T, N, V, VN>> : public numeric_limits<T> {\nprivate:\n    using R = Vc::SimdArray<T, N, V, VN>;\n\npublic:\n    static Vc_ALWAYS_INLINE Vc_CONST R max() noexcept { return numeric_limits<T>::max(); }\n    static Vc_ALWAYS_INLINE Vc_CONST R min() noexcept { return numeric_limits<T>::min(); }\n    static Vc_ALWAYS_INLINE Vc_CONST R lowest() noexcept\n    {\n        return numeric_limits<T>::lowest();\n    }\n    static Vc_ALWAYS_INLINE Vc_CONST R epsilon() noexcept\n    {\n        return numeric_limits<T>::epsilon();\n    }\n    static Vc_ALWAYS_INLINE Vc_CONST R round_error() noexcept\n    {\n        return numeric_limits<T>::round_error();\n    }\n    static Vc_ALWAYS_INLINE Vc_CONST R infinity() noexcept\n    {\n        return numeric_limits<T>::infinity();\n    }\n    static Vc_ALWAYS_INLINE Vc_CONST R quiet_NaN() noexcept\n    {\n        return numeric_limits<T>::quiet_NaN();\n    }\n    static Vc_ALWAYS_INLINE Vc_CONST R signaling_NaN() noexcept\n    {\n        return numeric_limits<T>::signaling_NaN();\n    }\n    static Vc_ALWAYS_INLINE Vc_CONST R denorm_min() noexcept\n    {\n        return numeric_limits<T>::denorm_min();\n    }\n};\n}  // namespace std\n//}}}1\n\n#endif // VC_COMMON_SIMDARRAY_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/simdarrayfwd.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SIMDARRAYFWD_H_\n#define VC_COMMON_SIMDARRAYFWD_H_\n\n#include \"../scalar/types.h\"\n#include \"../sse/types.h\"\n#include \"../avx/types.h\"\n\n#include \"utility.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// specialization of Vector for fixed_size<N> {{{\ntemplate <class T, int N>\nclass Vector<T, simd_abi::fixed_size<N>> : public SimdArray<T, N>\n{\n    using SimdArray<T, N>::SimdArray;\n\npublic:\n    // overload copy to force argument passing via the stack. This makes the type more\n    // usable on ABI boundaries\n    Vc_INTRINSIC Vector(const Vector &x) : SimdArray<T, N>(x) {}\n    Vc_INTRINSIC Vector &operator=(const Vector &x)\n    {\n        SimdArray<T, N>::operator=(x);\n        return *this;\n    }\n    Vector() = default;\n\n    using abi_type = simd_abi::fixed_size<N>;\n    using abi = abi_type;\n\n    Vc_DEPRECATED(\"use Vector([](int n) { return n; }) instead of \"\n                  \"Vector::IndexesFromZero()\") static Vector IndexesFromZero()\n    {\n        return Vector([](size_t i) -> T { return i; });\n    }\n    Vc_DEPRECATED(\"use 0 instead of Vector::Zero()\") static Vector Zero() { return 0; }\n    Vc_DEPRECATED(\"use 1 instead of Vector::One()\") static Vector One() { return 1; }\n};\n\ntemplate <class T, int N>\nclass Mask<T, simd_abi::fixed_size<N>> : public SimdMaskArray<T, N>\n{\n    using SimdMaskArray<T, N>::SimdMaskArray;\n\npublic:\n    // overload copy to force argument passing via the stack. This makes the type more\n    // usable on ABI boundaries\n    Vc_INTRINSIC Mask(const Mask &x) : SimdMaskArray<T, N>(x) {}\n    Vc_INTRINSIC Mask &operator=(const Mask &x)\n    {\n        SimdMaskArray<T, N>::operator=(x);\n        return *this;\n    }\n    Mask() = default;\n\n    using abi_type = simd_abi::fixed_size<N>;\n    using abi = abi_type;\n};\n// }}}\n\n/** \\internal\n * Simple traits for SimdArray to easily access internal types of non-atomic SimdArray\n * types.\n */\ntemplate <typename T, std::size_t N> struct SimdArrayTraits {\n    static constexpr std::size_t N0 = Common::left_size<N>();\n    static constexpr std::size_t N1 = Common::right_size<N>();\n\n    using storage_type0 = fixed_size_simd<T, N0>;\n    using storage_type1 = fixed_size_simd<T, N1>;\n};\n\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>\nVc_INTRINSIC_L typename SimdArrayTraits<T, N>::storage_type0 &internal_data0(\n    SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>\nVc_INTRINSIC_L typename SimdArrayTraits<T, N>::storage_type1 &internal_data1(\n    SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>\nVc_INTRINSIC_L const typename SimdArrayTraits<T, N>::storage_type0 &internal_data0(\n    const SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t VectorSize>\nVc_INTRINSIC_L const typename SimdArrayTraits<T, N>::storage_type1 &internal_data1(\n    const SimdArray<T, N, VectorType, VectorSize> &x) Vc_INTRINSIC_R;\n\ntemplate <typename T, std::size_t N, typename V>\nVc_INTRINSIC_L V &internal_data(SimdArray<T, N, V, N> &x) Vc_INTRINSIC_R;\ntemplate <typename T, std::size_t N, typename V>\nVc_INTRINSIC_L const V &internal_data(const SimdArray<T, N, V, N> &x) Vc_INTRINSIC_R;\n\nnamespace Traits\n{\n// is_fixed_size_simd {{{1\ntemplate <class T> struct is_fixed_size_simd : std::false_type {\n};\ntemplate <class T, int N>\nstruct is_fixed_size_simd<fixed_size_simd<T, N>> : std::true_type {\n};\ntemplate <class T, int N>\nstruct is_fixed_size_simd<fixed_size_simd_mask<T, N>> : std::true_type {\n};\n\n// is_simd_vector_internal {{{1\ntemplate <class T, int N>\nstruct is_simd_vector_internal<fixed_size_simd<T, N>> : is_valid_vector_argument<T> {};\n\n// is_simd_mask_internal {{{1\ntemplate <class T, int N>\nstruct is_simd_mask_internal<fixed_size_simd_mask<T, N>> : is_valid_vector_argument<T> {};\n\n// is_atomic_simdarray_internal {{{1\ntemplate <typename T, std::size_t N, typename V>\nstruct is_atomic_simdarray_internal<SimdArray<T, N, V, N>> : is_valid_vector_argument<T> {};\ntemplate <typename T, int N>\nstruct is_atomic_simdarray_internal<fixed_size_simd<T, N>>\n    : is_atomic_simdarray_internal<SimdArray<T, N>> {\n};\n\n// is_atomic_simd_mask_array_internal {{{1\ntemplate <typename T, std::size_t N, typename V>\nstruct is_atomic_simd_mask_array_internal<SimdMaskArray<T, N, V, N>>\n    : is_valid_vector_argument<T> {\n};\ntemplate <typename T, int N>\nstruct is_atomic_simd_mask_array_internal<fixed_size_simd_mask<T, N>>\n    : is_atomic_simd_mask_array_internal<SimdMaskArray<T, N>> {\n};\n\n// is_simdarray_internal {{{1\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t M>\nstruct is_simdarray_internal<SimdArray<T, N, VectorType, M>>\n    : is_valid_vector_argument<T> {\n};\ntemplate <typename T, int N>\nstruct is_simdarray_internal<fixed_size_simd<T, N>> : is_valid_vector_argument<T> {\n};\n\n// is_simd_mask_array_internal {{{1\ntemplate <typename T, std::size_t N, typename VectorType, std::size_t M>\nstruct is_simd_mask_array_internal<SimdMaskArray<T, N, VectorType, M>>\n    : is_valid_vector_argument<T> {\n};\ntemplate <typename T, int N>\nstruct is_simd_mask_array_internal<fixed_size_simd_mask<T, N>>\n    : is_valid_vector_argument<T> {\n};\n\n// is_integral_internal {{{1\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nstruct is_integral_internal<SimdArray<T, N, V, M>, false> : std::is_integral<T> {\n};\n\n// is_floating_point_internal {{{1\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nstruct is_floating_point_internal<SimdArray<T, N, V, M>, false>\n    : std::is_floating_point<T> {\n};\n\n// is_signed_internal {{{1\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nstruct is_signed_internal<SimdArray<T, N, V, M>, false> : std::is_signed<T> {\n};\n\n// is_unsigned_internal {{{1\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nstruct is_unsigned_internal<SimdArray<T, N, V, M>, false> : std::is_unsigned<T> {\n};\n\n// has_no_allocated_data_impl {{{1\ntemplate <typename T, std::size_t N>\nstruct has_no_allocated_data_impl<Vc::SimdArray<T, N>> : std::true_type {\n};\n\n// }}}1\n}  // namespace Traits\n\n}  // namespace Vc\n\n#endif  // VC_COMMON_SIMDARRAYFWD_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/simdarrayhelper.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SIMDARRAYHELPER_H_\n#define VC_COMMON_SIMDARRAYHELPER_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// private_init {{{\nnamespace\n{\nstatic constexpr struct private_init_t {} private_init = {};\n}  // unnamed namespace\n// }}}\n\nnamespace Common\n{\n\n/// \\addtogroup SimdArray\n/// @{\n\nnamespace Operations/*{{{*/\n{\nstruct tag {};\n#define Vc_DEFINE_OPERATION(name_)                                                       \\\n    struct name_ : public tag {                                                          \\\n        template <typename V, typename... Args>                                          \\\n        Vc_INTRINSIC void operator()(V &v, Args &&... args)                              \\\n        {                                                                                \\\n            v.name_(std::forward<Args>(args)...);                                        \\\n        }                                                                                \\\n    }\nVc_DEFINE_OPERATION(gather);\nVc_DEFINE_OPERATION(scatter);\nVc_DEFINE_OPERATION(load);\nVc_DEFINE_OPERATION(store);\nVc_DEFINE_OPERATION(setZero);\nVc_DEFINE_OPERATION(setZeroInverted);\nVc_DEFINE_OPERATION(assign);\n#undef Vc_DEFINE_OPERATION\n#define Vc_DEFINE_OPERATION(name_, code_)                                                \\\n    struct name_ : public tag {                                                          \\\n        template <typename V> Vc_INTRINSIC void operator()(V &v) { code_; }              \\\n    }\nVc_DEFINE_OPERATION(increment, ++(v));\nVc_DEFINE_OPERATION(decrement, --(v));\nVc_DEFINE_OPERATION(random, v = V::Random());\n#undef Vc_DEFINE_OPERATION\n#define Vc_DEFINE_OPERATION_FORWARD(name_)                                               \\\n    struct Forward_##name_ : public tag                                                  \\\n    {                                                                                    \\\n        template <typename... Args, typename = decltype(name_(std::declval<Args>()...))> \\\n        Vc_INTRINSIC void operator()(decltype(name_(std::declval<Args>()...)) &v,        \\\n                                     Args &&... args)                                    \\\n        {                                                                                \\\n            v = name_(std::forward<Args>(args)...);                                      \\\n        }                                                                                \\\n        template <typename... Args, typename = decltype(name_(std::declval<Args>()...))> \\\n        Vc_INTRINSIC void operator()(std::nullptr_t, Args && ... args)                   \\\n        {                                                                                \\\n            name_(std::forward<Args>(args)...);                                          \\\n        }                                                                                \\\n    }\nVc_DEFINE_OPERATION_FORWARD(abs);\nVc_DEFINE_OPERATION_FORWARD(asin);\nVc_DEFINE_OPERATION_FORWARD(atan);\nVc_DEFINE_OPERATION_FORWARD(atan2);\nVc_DEFINE_OPERATION_FORWARD(cos);\nVc_DEFINE_OPERATION_FORWARD(ceil);\nVc_DEFINE_OPERATION_FORWARD(copysign);\nVc_DEFINE_OPERATION_FORWARD(exp);\nVc_DEFINE_OPERATION_FORWARD(exponent);\nVc_DEFINE_OPERATION_FORWARD(fma);\nVc_DEFINE_OPERATION_FORWARD(floor);\nVc_DEFINE_OPERATION_FORWARD(frexp);\nVc_DEFINE_OPERATION_FORWARD(isfinite);\nVc_DEFINE_OPERATION_FORWARD(isinf);\nVc_DEFINE_OPERATION_FORWARD(isnan);\nVc_DEFINE_OPERATION_FORWARD(isnegative);\nVc_DEFINE_OPERATION_FORWARD(ldexp);\nVc_DEFINE_OPERATION_FORWARD(log);\nVc_DEFINE_OPERATION_FORWARD(log10);\nVc_DEFINE_OPERATION_FORWARD(log2);\nVc_DEFINE_OPERATION_FORWARD(reciprocal);\nVc_DEFINE_OPERATION_FORWARD(round);\nVc_DEFINE_OPERATION_FORWARD(rsqrt);\nVc_DEFINE_OPERATION_FORWARD(sin);\nVc_DEFINE_OPERATION_FORWARD(sincos);\nVc_DEFINE_OPERATION_FORWARD(sqrt);\nVc_DEFINE_OPERATION_FORWARD(trunc);\nVc_DEFINE_OPERATION_FORWARD(min);\nVc_DEFINE_OPERATION_FORWARD(max);\n#undef Vc_DEFINE_OPERATION_FORWARD\ntemplate<typename T> using is_operation = std::is_base_of<tag, T>;\n}  // namespace Operations }}}\n\n/**\n * \\internal\n * Helper type to statically communicate segmentation of one vector register into 2^n parts\n * (Pieces).\n *\n * Forward declaration in common/types.h.\n */\ntemplate <typename T_, std::size_t Pieces_, std::size_t Index_> struct Segment/*{{{*/\n{\n    static_assert(Index_ < Pieces_, \"You found a bug in Vc. Please report.\");\n\n    using type = T_;\n    using type_decayed = typename std::decay<type>::type;\n    static constexpr std::size_t Pieces = Pieces_;\n    static constexpr std::size_t Index = Index_;\n    using fixed_size_type =\n        fixed_size_simd<conditional_t<Traits::is_simd_vector<type_decayed>::value,\n                                      typename type_decayed::EntryType, float>,\n                        type_decayed::Size / Pieces>;\n\n    type data;\n\n    static constexpr std::size_t EntryOffset = Index * type_decayed::Size / Pieces;\n\n    // no non-const operator[] needed\n    decltype(std::declval<const type &>()[0]) operator[](size_t i) const { return data[i + EntryOffset]; }\n\n    fixed_size_type to_fixed_size() const\n    {\n        return simd_cast<fixed_size_type, Index>(data);\n    }\n};/*}}}*/\n\n//Segment<T *, ...> specialization {{{\ntemplate <typename T_, std::size_t Pieces_, std::size_t Index_>\nstruct Segment<T_ *, Pieces_, Index_> {\n    static_assert(Index_ < Pieces_, \"You found a bug in Vc. Please report.\");\n\n    using type = T_ *;\n    using type_decayed = typename std::decay<T_>::type;\n    static constexpr size_t Pieces = Pieces_;\n    static constexpr size_t Index = Index_;\n    using fixed_size_type = fixed_size_simd<\n        typename std::conditional<Traits::is_simd_vector<type_decayed>::value,\n                                  typename type_decayed::VectorEntryType, float>::type,\n        type_decayed::Size / Pieces> *;\n\n    type data;\n\n    static constexpr std::size_t EntryOffset = Index * type_decayed::size() / Pieces;\n\n    fixed_size_type to_fixed_size() const\n    {\n        return reinterpret_cast<\n#ifdef Vc_GCC\n                   // GCC might ICE if this type is declared with may_alias. If it doesn't\n                   // ICE it warns about ignoring the attribute.\n                   typename std::remove_pointer<fixed_size_type>::type\n#else\n                   MayAlias<typename std::remove_pointer<fixed_size_type>::type>\n#endif\n                       *>(data) +\n               Index;\n    }\n\n    //decltype(std::declval<type>()[0]) operator[](size_t i) { return data[i + EntryOffset]; }\n    //decltype(std::declval<type>()[0]) operator[](size_t i) const { return data[i + EntryOffset]; }\n};/*}}}*/\n\n/** \\internal\n  Template class that is used to attach an offset value to an existing type. It is used\n  for IndexesFromZero construction in SimdArray. The \\c data1 constructor needs to know\n  that the IndexesFromZero constructor requires an offset so that the whole data is\n  constructed as a correct sequence from `0` to `Size - 1`.\n\n  \\tparam T The original type that needs the offset attached.\n  \\tparam Offset An integral value that determines the offset in the complete SimdArray.\n */\ntemplate <typename T, std::size_t Offset> struct AddOffset\n{\n    constexpr AddOffset() = default;\n};\n\n// class Split {{{1\n/** \\internal\n  Helper type with static functions to generically adjust arguments for the \\c data0 and\n  \\c data1 members of SimdArray and SimdMaskArray.\n\n  \\tparam secondOffset The offset in number of elements that \\c data1 has in the SimdArray\n                       / SimdMaskArray. This is essentially equal to the number of\n                       elements in \\c data0.\n */\ntemplate <std::size_t secondOffset> class Split\n{\n    // split composite SimdArray\n    template <typename U, std::size_t N, typename V, std::size_t M,\n              typename = enable_if<N != M>>\n    static Vc_INTRINSIC auto loImpl(const SimdArray<U, N, V, M> &x)\n        -> decltype(internal_data0(x))\n    {\n        return internal_data0(x);\n    }\n    template <typename U, std::size_t N, typename V, std::size_t M,\n              typename = enable_if<N != M>>\n    static Vc_INTRINSIC auto hiImpl(const SimdArray<U, N, V, M> &x)\n        -> decltype(internal_data1(x))\n    {\n        return internal_data1(x);\n    }\n    template <typename U, std::size_t N, typename V, std::size_t M,\n              typename = enable_if<N != M>>\n    static Vc_INTRINSIC auto loImpl(SimdArray<U, N, V, M> *x)\n        -> decltype(&internal_data0(*x))\n    {\n        return &internal_data0(*x);\n    }\n    template <typename U, std::size_t N, typename V, std::size_t M,\n              typename = enable_if<N != M>>\n    static Vc_INTRINSIC auto hiImpl(SimdArray<U, N, V, M> *x)\n        -> decltype(&internal_data1(*x))\n    {\n        return &internal_data1(*x);\n    }\n\n    // split atomic SimdArray\n    template <typename U, std::size_t N, typename V>\n    static Vc_INTRINSIC Segment<V, 2, 0> loImpl(const SimdArray<U, N, V, N> &x)\n    {\n        return {internal_data(x)};\n    }\n    template <typename U, std::size_t N, typename V>\n    static Vc_INTRINSIC Segment<V, 2, 1> hiImpl(const SimdArray<U, N, V, N> &x)\n    {\n        return {internal_data(x)};\n    }\n    template <typename U, std::size_t N, typename V>\n    static Vc_INTRINSIC Segment<V *, 2, 0> loImpl(SimdArray<U, N, V, N> *x)\n    {\n        return {&internal_data(*x)};\n    }\n    template <typename U, std::size_t N, typename V>\n    static Vc_INTRINSIC Segment<V *, 2, 1> hiImpl(SimdArray<U, N, V, N> *x)\n    {\n        return {&internal_data(*x)};\n    }\n\n    // split composite SimdMaskArray\n    template <typename U, std::size_t N, typename V, std::size_t M>\n    static Vc_INTRINSIC auto loImpl(const SimdMaskArray<U, N, V, M> &x) -> decltype(internal_data0(x))\n    {\n        return internal_data0(x);\n    }\n    template <typename U, std::size_t N, typename V, std::size_t M>\n    static Vc_INTRINSIC auto hiImpl(const SimdMaskArray<U, N, V, M> &x) -> decltype(internal_data1(x))\n    {\n        return internal_data1(x);\n    }\n\n    template <typename U, std::size_t N, typename V>\n    static Vc_INTRINSIC Segment<typename SimdMaskArray<U, N, V, N>::mask_type, 2, 0> loImpl(\n        const SimdMaskArray<U, N, V, N> &x)\n    {\n        return {internal_data(x)};\n    }\n    template <typename U, std::size_t N, typename V>\n    static Vc_INTRINSIC Segment<typename SimdMaskArray<U, N, V, N>::mask_type, 2, 1> hiImpl(\n        const SimdMaskArray<U, N, V, N> &x)\n    {\n        return {internal_data(x)};\n    }\n\n    // split Vector<T> and Mask<T>\n#ifdef Vc_IMPL_AVX\n    template <class T>\n    static Vc_INTRINSIC SSE::Vector<T> loImpl(Vector<T, VectorAbi::Avx> &&x)\n    {\n        return simd_cast<SSE::Vector<T>, 0>(x);\n    }\n    template <class T>\n    static Vc_INTRINSIC SSE::Vector<T> hiImpl(Vector<T, VectorAbi::Avx> &&x)\n    {\n        return simd_cast<SSE::Vector<T>, 1>(x);\n    }\n    template <class T>\n    static Vc_INTRINSIC SSE::Mask<T> loImpl(Mask<T, VectorAbi::Avx> &&x)\n    {\n        return simd_cast<SSE::Mask<T>, 0>(x);\n    }\n    template <class T>\n    static Vc_INTRINSIC SSE::Mask<T> hiImpl(Mask<T, VectorAbi::Avx> &&x)\n    {\n        return simd_cast<SSE::Mask<T>, 1>(x);\n    }\n#endif  // Vc_IMPL_AVX\n    template <typename T>\n    static constexpr bool is_vector_or_mask(){\n        return (Traits::is_simd_vector<T>::value && !Traits::isSimdArray<T>::value) ||\n               (Traits::is_simd_mask<T>::value && !Traits::isSimdMaskArray<T>::value);\n    }\n    template <typename V>\n    static Vc_INTRINSIC Segment<V, 2, 0> loImpl(V &&x, enable_if<is_vector_or_mask<V>()> = nullarg)\n    {\n        return {std::forward<V>(x)};\n    }\n    template <typename V>\n    static Vc_INTRINSIC Segment<V, 2, 1> hiImpl(V &&x, enable_if<is_vector_or_mask<V>()> = nullarg)\n    {\n        return {std::forward<V>(x)};\n    }\n\n    // split std::vector<T>\n    template <class T, class A>\n    static Vc_INTRINSIC const T *loImpl(const std::vector<T, A> &x)\n    {\n        return x.data();\n    }\n    template <class T, class A>\n    static Vc_INTRINSIC const T *hiImpl(const std::vector<T, A> &x)\n    {\n        return x.data() + secondOffset;\n    }\n\n    // generically split Segments\n    template <typename V, std::size_t Pieces, std::size_t Index>\n    static Vc_INTRINSIC Segment<V, 2 * Pieces, 2 * Index> loImpl(\n        const Segment<V, Pieces, Index> &x)\n    {\n        return {x.data};\n    }\n    template <typename V, std::size_t Pieces, std::size_t Index>\n    static Vc_INTRINSIC Segment<V, 2 * Pieces, 2 * Index + 1> hiImpl(\n        const Segment<V, Pieces, Index> &x)\n    {\n        return {x.data};\n    }\n\n    /** \\internal\n     * \\name Checks for existence of \\c loImpl / \\c hiImpl\n     */\n    //@{\n    template <typename T, typename = decltype(loImpl(std::declval<T>()))>\n    static std::true_type have_lo_impl(int);\n    template <typename T> static std::false_type have_lo_impl(float);\n    template <typename T> static constexpr bool have_lo_impl()\n    {\n        return decltype(have_lo_impl<T>(1))::value;\n    }\n\n    template <typename T, typename = decltype(hiImpl(std::declval<T>()))>\n    static std::true_type have_hi_impl(int);\n    template <typename T> static std::false_type have_hi_impl(float);\n    template <typename T> static constexpr bool have_hi_impl()\n    {\n        return decltype(have_hi_impl<T>(1))::value;\n    }\n    //@}\n\npublic:\n    /** \\internal\n     * \\name with Operations tag\n     *\n     * These functions don't overload on the data parameter. The first parameter (the tag) clearly\n     * identifies the intended function.\n     */\n    //@{\n    template <typename U>\n    static Vc_INTRINSIC const U *lo(Operations::gather, const U *ptr)\n    {\n        return ptr;\n    }\n    template <typename U>\n    static Vc_INTRINSIC const U *hi(Operations::gather, const U *ptr)\n    {\n        return ptr + secondOffset;\n    }\n    template <typename U, typename = enable_if<!std::is_pointer<U>::value>>\n    static Vc_ALWAYS_INLINE decltype(loImpl(std::declval<U>()))\n        lo(Operations::gather, U &&x)\n    {\n        return loImpl(std::forward<U>(x));\n    }\n    template <typename U, typename = enable_if<!std::is_pointer<U>::value>>\n    static Vc_ALWAYS_INLINE decltype(hiImpl(std::declval<U>()))\n        hi(Operations::gather, U &&x)\n    {\n        return hiImpl(std::forward<U>(x));\n    }\n    template <typename U>\n    static Vc_INTRINSIC const U *lo(Operations::scatter, const U *ptr)\n    {\n        return ptr;\n    }\n    template <typename U>\n    static Vc_INTRINSIC const U *hi(Operations::scatter, const U *ptr)\n    {\n        return ptr + secondOffset;\n    }\n    //@}\n\n    /** \\internal\n      \\name without Operations tag\n\n      These functions are not clearly tagged as to where they are used and therefore\n      behave differently depending on the type of the parameter. Different behavior is\n      implemented via overloads of \\c loImpl and \\c hiImpl. They are not overloads of \\c\n      lo and \\c hi directly because it's hard to compete against a universal reference\n      (i.e. an overload for `int` requires overloads for `int &`, `const int &`, and `int\n      &&`. If one of them were missing `U &&` would win in overload resolution).\n     */\n    //@{\n    template <typename U>\n    static Vc_ALWAYS_INLINE decltype(loImpl(std::declval<U>())) lo(U &&x)\n    {\n        return loImpl(std::forward<U>(x));\n    }\n    template <typename U>\n    static Vc_ALWAYS_INLINE decltype(hiImpl(std::declval<U>())) hi(U &&x)\n    {\n        return hiImpl(std::forward<U>(x));\n    }\n\n    template <typename U>\n    static Vc_ALWAYS_INLINE enable_if<!have_lo_impl<U>(), U> lo(U &&x)\n    {\n        return std::forward<U>(x);\n    }\n    template <typename U>\n    static Vc_ALWAYS_INLINE enable_if<!have_hi_impl<U>(), U> hi(U &&x)\n    {\n        return std::forward<U>(x);\n    }\n    //@}\n};\n\n// actual_value {{{1\ntemplate <typename Op, typename U, std::size_t M, typename V>\nstatic Vc_INTRINSIC const V &actual_value(Op, const SimdArray<U, M, V, M> &x)\n{\n  return internal_data(x);\n}\ntemplate <typename Op, typename U, std::size_t M, typename V>\nstatic Vc_INTRINSIC V *actual_value(Op, SimdArray<U, M, V, M> *x)\n{\n  return &internal_data(*x);\n}\ntemplate <typename Op, typename T, size_t Pieces, size_t Index>\nstatic Vc_INTRINSIC typename Segment<T, Pieces, Index>::fixed_size_type actual_value(\n    Op, Segment<T, Pieces, Index> &&seg)\n{\n    return seg.to_fixed_size();\n}\n\ntemplate <typename Op, typename U, std::size_t M, typename V>\nstatic Vc_INTRINSIC const typename V::Mask &actual_value(Op, const SimdMaskArray<U, M, V, M> &x)\n{\n  return internal_data(x);\n}\ntemplate <typename Op, typename U, std::size_t M, typename V>\nstatic Vc_INTRINSIC typename V::Mask *actual_value(Op, SimdMaskArray<U, M, V, M> *x)\n{\n  return &internal_data(*x);\n}\n\n// unpackArgumentsAuto {{{1\n/**\\internal\n * \\name unpackArgumentsAuto\n *\n * Search for the right amount of SimdArray \"unpacking\" (via actual_value) to match the\n * interface of the function to be called.\n *\n * The compiler can figure this out for us thanks to SFINAE. The approach is to have a\n * number \\c I that determines the indexes of the arguments to be transformed via\n * actual_value.  Each bit of \\c I identifies an argument. unpackArgumentsAuto starts the\n * recursion with `I = 0`, i.e. no actual_value transformations. If the overload calling\n * \\c op is unavailable due to a substitution failure \\c I is incremented and the function\n * recurses. Otherwise there are two unpackArgumentsAutoImpl functions in the overload\n * set. The first argument (\\c int / \\c float) leads to a preference of the function\n * calling \\c op, thus ending the recursion.\n */\n///@{\n\n///\\internal transforms \\p arg via actual_value\ntemplate <typename Op, typename Arg>\nVc_INTRINSIC decltype(actual_value(std::declval<Op &>(), std::declval<Arg>()))\nconditionalUnpack(std::true_type, Op op, Arg &&arg)\n{\n    return actual_value(op, std::forward<Arg>(arg));\n}\n///\\internal forwards \\p arg to its return value\ntemplate <typename Op, typename Arg>\nVc_INTRINSIC Arg conditionalUnpack(std::false_type, Op, Arg &&arg)\n{\n    return std::forward<Arg>(arg);\n}\n\n///\\internal true-/false_type that selects whether the argument with index B should be unpacked\ntemplate <size_t A, size_t B>\nstruct selectorType : public std::integral_constant<bool, !((A & (size_t(1) << B)) != 0)> {\n};\n\n///\\internal ends the recursion, transforms arguments, and calls \\p op\ntemplate <size_t I, typename Op, typename R, typename... Args, size_t... Indexes>\nVc_INTRINSIC decltype(std::declval<Op &>()(std::declval<R &>(),\n                                           conditionalUnpack(selectorType<I, Indexes>(),\n                                                             std::declval<Op &>(),\n                                                             std::declval<Args>())...))\nunpackArgumentsAutoImpl(int, index_sequence<Indexes...>, Op op, R &&r, Args &&... args)\n{\n    op(std::forward<R>(r),\n       conditionalUnpack(selectorType<I, Indexes>(), op, std::forward<Args>(args))...);\n}\n\n///\\internal the current actual_value calls don't work: recurse to I + 1\ntemplate <size_t I, typename Op, typename R, typename... Args, size_t... Indexes>\nVc_INTRINSIC enable_if<(I <= (size_t(1) << sizeof...(Args))), void> unpackArgumentsAutoImpl(\n    float, index_sequence<Indexes...> is, Op op, R &&r, Args &&... args)\n{\n    // if R is nullptr_t then the return type cannot enforce that actually any unwrapping\n    // of the SimdArray types happens. Thus, you could get an endless loop of the\n    // SimdArray function overload calling itself, if the index goes up to (1 <<\n    // sizeof...(Args)) - 1 (which means no argument transformations via actual_value).\n    static_assert(\n        I < (1 << sizeof...(Args)) - (std::is_same<R, std::nullptr_t>::value ? 1 : 0),\n        \"Vc or compiler bug. Please report. Failed to find a combination of \"\n        \"actual_value(arg) transformations that allows calling Op.\");\n    unpackArgumentsAutoImpl<I + 1, Op, R, Args...>(int(), is, op, std::forward<R>(r),\n                                                   std::forward<Args>(args)...);\n}\n\n#ifdef Vc_ICC\ntemplate <size_t, typename... Ts> struct IccWorkaround {\n    using type = void;\n};\ntemplate <typename... Ts> struct IccWorkaround<2, Ts...> {\n    using type = typename std::remove_pointer<typename std::decay<\n        typename std::tuple_element<1, std::tuple<Ts...>>::type>::type>::type;\n};\n#endif\n\n///\\internal The interface to start the machinery.\ntemplate <typename Op, typename R, typename... Args>\nVc_INTRINSIC void unpackArgumentsAuto(Op op, R &&r, Args &&... args)\n{\n#ifdef Vc_ICC\n    // ugly hacky workaround for ICC:\n    // The compiler fails to do SFINAE right on recursion. We have to hit the right\n    // recursionStart number from the start.\n    const int recursionStart =\n        Traits::isSimdArray<\n            typename IccWorkaround<sizeof...(Args), Args...>::type>::value &&\n                (std::is_same<Op, Common::Operations::Forward_frexp>::value ||\n                 std::is_same<Op, Common::Operations::Forward_ldexp>::value)\n            ? 2\n            : 0;\n#else\n    const int recursionStart = 0;\n#endif\n    unpackArgumentsAutoImpl<recursionStart>(\n        int(), make_index_sequence<sizeof...(Args)>(), op, std::forward<R>(r),\n        std::forward<Args>(args)...);\n}\n///@}\n\n//}}}1\n///@}\n}  // namespace Common\n}  // namespace Vc\n\n#endif  // VC_COMMON_SIMDARRAYHELPER_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/simdize.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SIMDIZE_H_\n#define VC_COMMON_SIMDIZE_H_\n\n#include <tuple>\n#include <array>\n\n#include \"../Allocator\"\n#include \"interleavedmemory.h\"\n\n/*!\n\\addtogroup Simdize\n\nAutomatic type vectorization.\n\nStruct Vectorization\n======================\n\nThe `Vc::simdize<T>` expression transforms the type \\c T to a vectorized type. This requires the type\n\\c T to be a class template instance or an arithmetic type.\n\nExample:\nFirst, we declare a class template for a three-dimensional point. The template parameter \\c T\ndetermines the type of the members and is \\c float in the scalar (classical) case.\n\\code\ntemplate <typename T> struct PointTemplate\n{\n  T x, y, z;\n\n  // Declares tuple_size and makes the members accessible via get<N>(point), allowing\n  // the simdize implementation to convert between Point and PointV (see below).\n  Vc_SIMDIZE_INTERFACE((x, y, z));\n\n  PointTemplate(T xx, T yy, T zz) : x{xx}, y{yy}, z{zz} {};\n\n  // The following function will automatically be vectorized in the PointV type.\n  T distance_to_origin() const {\n    using std::sqrt;\n    return sqrt(x * x + y * y + z * z);\n  }\n};\n\\endcode\n\nIn the following we create a type alias for the scalar type, which simply means instantiating\n\\c PointTemplate with \\c float. The resulting type can then be transformed with \\ref simdize.\n\\code\nusing Point  = PointTemplate<float>;  // A simple struct with three floats and two functions.\nusing PointV = Vc::simdize<Point>;    // The vectorization of Point stores three float_v and thus\n                                      // float_v::size() Points.\n\\endcode\n\nThe following shows a code example using the above \\c Point and \\c PointV types.\n\\code\nPointV pv = Point{0.f, 1.f, 2.f};  // Constructs a PointV containing PointV::size()\n                                   // copies of Point{0, 1, 2}.\nfor (int i = 1; i < int(pv.size()); ++i) {\n  assign(pv, i, {i + 0.f, i + 1.f, i + 2.f});\n}\n\nconst Vc::float_v l = pv.distance_to_origin();\nstd::cout << l << '\\n';\n// prints [2.23607, 3.74166, 5.38516, 7.07107, 8.77496, 10.4881, 12.2066, 13.9284] with\n// float_v::size() == 8\n\nconst Point most_distant = extract(pv, (l.max() == l).firstOne());\nstd::cout << '(' << most_distant.x << \", \" << most_distant.y << \", \" << most_distant.z << \")\\n\";\n// prints (7, 8, 9) with float_v::size() == 8\n\\endcode\n\nIterator Vectorization\n======================\n\n`Vc::simdize<Iterator>` can also be used to turn an iterator type into a new iterator type with `Vc::simdize<Iterator::value_type>` as its `value_type`.\nNote that `Vc::simdize<double>` turns into `Vc::Vector<double>`, which makes it easy to iterate over a given container of builtin arithmetics using `Vc::Vector`.\n\\code\nvoid classic(const std::vector<Point> &data) {\n  using It = std::vector<Point>::const_iterator;\n  const It end = data.end();\n  for (It it = data.begin(); it != end; ++it) {\n    Point x = *it;\n    do_something(x);\n  }\n}\n\nvoid vectorized(const std::vector<float> &data) {\n  using It = Vc::simdize<std::vector<Point>::const_iterator>;\n  const It end = data.end();\n  for (It it = data.begin(); it != end; ++it) {\n    Vc::simdize<Point> x = *it;  // i.e. PointV\n    do_something(x);\n  }\n}\n\\endcode\n\n */\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\\internal\n * \\ingroup Simdize\n * This namespace contains all the required code for implementing simdize<T>. None of this\n * code should be directly accessed by users, though the unit test for simdize<T>\n * certainly may look into some of the details if necessary.\n */\nnamespace SimdizeDetail  // {{{\n{\n/**\n * \\addtogroup Simdize\n * @{\n */\nusing std::is_same;\nusing std::is_base_of;\nusing std::false_type;\nusing std::true_type;\nusing std::iterator_traits;\nusing std::conditional;\nusing std::size_t;\n\n/**\\internal\n * Typelist is a simple helper class for supporting multiple parameter packs in one class\n * template.\n */\ntemplate <typename... Ts> struct Typelist;\n\n/**\\internal\n * The Category identifies how the type argument to simdize<T> has to be transformed.\n */\nenum class Category {\n    ///\\internal No transformation\n    NoTransformation,\n    ///\\internal simple Vector<T> transformation\n    ArithmeticVectorizable,\n    ///\\internal transform an input iterator to return vectorized entries\n    InputIterator,\n    ///\\internal transform a forward iterator to return vectorized entries\n    OutputIterator,\n    ///\\internal transform an output iterator to return vectorized entries\n    ForwardIterator,\n    ///\\internal transform a bidirectional iterator to return vectorized entries\n    BidirectionalIterator,\n    ///\\internal transform a random access iterator to return vectorized entries\n    RandomAccessIterator,\n    ///\\internal transform a class template recursively\n    ClassTemplate\n};\n\n/**\\internal\n * iteratorCategories<T>(int()) returns whether iterator_traits<T>::iterator_category is a\n * valid type and whether it is derived from RandomAccessIterator or ForwardIterator.\n */\ntemplate <typename T, typename ItCat = typename T::iterator_category>\nconstexpr Category iteratorCategories(int, ItCat * = nullptr)\n{\n    return is_base_of<std::random_access_iterator_tag, ItCat>::value\n               ? Category::RandomAccessIterator\n               : is_base_of<std::bidirectional_iterator_tag, ItCat>::value\n                     ? Category::BidirectionalIterator\n                     : is_base_of<std::forward_iterator_tag, ItCat>::value\n                           ? Category::ForwardIterator\n                           : is_base_of<std::output_iterator_tag, ItCat>::value\n                                 ? Category::OutputIterator\n                                 : is_base_of<std::input_iterator_tag, ItCat>::value\n                                       ? Category::InputIterator\n                                       : Category::NoTransformation;\n}\n/**\\internal\n * This overload is selected for pointer types => RandomAccessIterator.\n */\ntemplate <typename T>\nconstexpr enable_if<std::is_pointer<T>::value, Category> iteratorCategories(float)\n{\n    return Category::RandomAccessIterator;\n}\n/**\\internal\n * This overload is selected if T does not work with iterator_traits.\n */\ntemplate <typename T> constexpr Category iteratorCategories(...)\n{\n    return Category::NoTransformation;\n}\n\n/**\\internal\n * Simple trait to identify whether a type T is a class template or not.\n */\ntemplate <typename T> struct is_class_template : public false_type\n{\n};\ntemplate <template <typename...> class C, typename... Ts>\nstruct is_class_template<C<Ts...>> : public true_type\n{\n};\n\n/**\\internal\n * Returns the Category for the given type \\p T.\n */\ntemplate <typename T> constexpr Category typeCategory()\n{\n    return (is_same<T, bool>::value || is_same<T, short>::value ||\n            is_same<T, unsigned short>::value || is_same<T, int>::value ||\n            is_same<T, unsigned int>::value || is_same<T, float>::value ||\n            is_same<T, double>::value)\n               ? Category::ArithmeticVectorizable\n               : iteratorCategories<T>(int()) != Category::NoTransformation\n                     ? iteratorCategories<T>(int())\n                     : is_class_template<T>::value ? Category::ClassTemplate\n                                                   : Category::NoTransformation;\n}\n\n/**\\internal\n * Trait determining the number of data members that get<N>(x) can access.\n * The type \\p T either has to provide a std::tuple_size specialization or contain a\n * constexpr tuple_size member.\n */\ntemplate <typename T, size_t TupleSize = std::tuple_size<T>::value>\nconstexpr size_t determine_tuple_size()\n{\n    return TupleSize;\n}\ntemplate <typename T, size_t TupleSize = T::tuple_size>\nconstexpr size_t determine_tuple_size(size_t = T::tuple_size)\n{\n    return TupleSize;\n}\n\n// workaround for MSVC limitation: constexpr functions in template arguments\n// confuse the compiler\ntemplate <typename T> struct determine_tuple_size_\n: public std::integral_constant<size_t, determine_tuple_size<T>()>\n{};\n\nnamespace\n{\ntemplate <typename T> struct The_simdization_for_the_requested_type_is_not_implemented;\n}  // unnamed namespace\n\n/**\\internal\n * The type behind the simdize expression whose member type \\c type determines the\n * transformed type.\n *\n * \\tparam T The type to be transformed.\n * \\tparam N The width the resulting vectorized type should have. A value of 0 lets the\n *           implementation choose the width.\n * \\tparam MT The base type to use for mask types. If set to \\c void the implementation\n *            chooses the type itself.\n * \\tparam Category The type category of \\p T. This determines the implementation strategy\n *                  (via template specialization).\n */\ntemplate <typename T, size_t N, typename MT, Category = typeCategory<T>()>\nstruct ReplaceTypes : public The_simdization_for_the_requested_type_is_not_implemented<T>\n{\n};\n\n/**\\internal\n * Specialization of ReplaceTypes that is used for types that should not be transformed by\n * simdize.\n */\ntemplate <typename T, size_t N, typename MT> struct ReplaceTypes<T, N, MT, Category::NoTransformation>\n{\n    typedef T type;\n};\n\n/**\\internal\n * The ReplaceTypes class template is nicer to use as an alias template. This is exported\n * to the outer Vc namespace.\n */\ntemplate <typename T, size_t N = 0, typename MT = void>\nusing simdize = typename SimdizeDetail::ReplaceTypes<T, N, MT>::type;\n\n// Alias for Vector<T, Abi> with size() == N, or SimdArray<T, N> otherwise.\ntemplate <class T, size_t N,\n          class Best = typename Common::select_best_vector_type<T, N>::type>\nusing deduce_vector_t =\n    typename std::conditional<Best::size() == N, Best, SimdArray<T, N>>::type;\n\n/**\\internal\n * ReplaceTypes specialization for simdizable arithmetic types. This results in either\n * Vector<T> or SimdArray<T, N>.\n */\ntemplate <typename T, size_t N, typename MT>\nstruct ReplaceTypes<T, N, MT, Category::ArithmeticVectorizable>\n    : public conditional<N == 0, Vector<T>, deduce_vector_t<T, N>> {\n};\n\n/**\\internal\n * ReplaceTypes specialization for bool. This results either in Mask<MT> or\n * SimdMaskArray<MT, N>.\n */\ntemplate <size_t N, typename MT>\nstruct ReplaceTypes<bool, N, MT, Category::ArithmeticVectorizable>\n    : public std::enable_if<true, typename ReplaceTypes<MT, N, MT>::type::mask_type> {\n};\n/**\\internal\n * ReplaceTypes specialization for bool and MT = void. In that case MT is set to float.\n */\ntemplate <size_t N>\nstruct ReplaceTypes<bool, N, void, Category::ArithmeticVectorizable>\n    : public ReplaceTypes<bool, N, float, Category::ArithmeticVectorizable>\n{\n};\n\n/**\\internal\n * This type substitutes the first type (\\p T) in \\p Remaining via simdize<T, N, MT> and\n * appends it to the Typelist in \\p Replaced. If \\p N = 0, the first simdize expression\n * that yields a vectorized type determines \\p N for the subsequent SubstituteOneByOne\n * instances.\n */\ntemplate <size_t N, typename MT, typename Replaced, typename... Remaining>\nstruct SubstituteOneByOne;\n\n/**\\internal\n * Template specialization for the case that there is at least one type in \\p Remaining.\n * The member type \\p type recurses via SubstituteOneByOne.\n */\ntemplate <size_t N, typename MT, typename... Replaced, typename T,\n          typename... Remaining>\nstruct SubstituteOneByOne<N, MT, Typelist<Replaced...>, T, Remaining...>\n{\nprivate:\n    /**\\internal\n     * If \\p U::size() yields a constant expression convertible to size_t then value will\n     * be equal to U::size(), 0 otherwise.\n     */\n    template <typename U, size_t M = U::Size>\n    static std::integral_constant<size_t, M> size_or_0(int);\n    template <typename U> static std::integral_constant<size_t, 0> size_or_0(...);\n\n    ///\\internal The vectorized type for \\p T.\n    using V = simdize<T, N, MT>;\n\n    /**\\internal\n     * Determine the new \\p N to use for the SubstituteOneByOne expression below. If N is\n     * non-zero that value is used. Otherwise size_or_0<V> determines the new value.\n     */\n    static constexpr auto NewN = N != 0 ? N : decltype(size_or_0<V>(int()))::value;\n\n    /**\\internal\n     * Determine the new \\p MT type to use for the SubstituteOneByOne expression below.\n     * This is normally the old \\p MT type. However, if N != NewN and MT = void, NewMT is\n     * set to either \\c float or \\p T, depending on whether \\p T is \\c bool or not.\n     */\n    typedef conditional_t<(N != NewN && is_same<MT, void>::value),\n                          conditional_t<is_same<T, bool>::value, float, T>, MT> NewMT;\n\npublic:\n    /**\\internal\n     * An alias to the type member of the completed recursion over SubstituteOneByOne.\n     */\n    using type = typename SubstituteOneByOne<NewN, NewMT, Typelist<Replaced..., V>,\n                                             Remaining...>::type;\n};\n\n///\\internal Generates the SubstitutedWithValues member. This needs specialization for the\n/// number of types in the template argument list.\ntemplate <size_t Size, typename... Replaced> struct SubstitutedBase;\n///\\internal Specialization for one type parameter.\ntemplate <typename Replaced> struct SubstitutedBase<1, Replaced> {\n    template <typename ValueT, template <typename, ValueT...> class C, ValueT... Values>\n    using SubstitutedWithValues = C<Replaced, Values...>;\n};\n///\\internal Specialization for two type parameters.\ntemplate <typename R0, typename R1> struct SubstitutedBase<2, R0, R1>\n{\n    template <typename ValueT, template <typename, typename, ValueT...> class C,\n              ValueT... Values>\n    using SubstitutedWithValues = C<R0, R1, Values...>;\n};\n///\\internal Specialization for three type parameters.\ntemplate <typename R0, typename R1, typename R2> struct SubstitutedBase<3, R0, R1, R2>\n{\n    template <typename ValueT, template <typename, typename, typename, ValueT...> class C,\n              ValueT... Values>\n    using SubstitutedWithValues = C<R0, R1, R2, Values...>;\n};\n#if defined Vc_ICC || defined Vc_MSVC\n#define Vc_VALUE_PACK_EXPANSION_IS_BROKEN 1\n#endif\n///\\internal Specialization for four type parameters.\ntemplate <typename... Replaced> struct SubstitutedBase<4, Replaced...> {\n#ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n    template <typename ValueT,\n              template <typename, typename, typename, typename, ValueT...> class C,\n              ValueT... Values>\n    using SubstitutedWithValues = C<Replaced..., Values...>;\n#endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n};\n///\\internal Specialization for five type parameters.\ntemplate <typename... Replaced> struct SubstitutedBase<5, Replaced...> {\n#ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n    template <typename ValueT, template <typename, typename, typename, typename, typename,\n                                         ValueT...> class C,\n              ValueT... Values>\n    using SubstitutedWithValues = C<Replaced..., Values...>;\n#endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n};\n///\\internal Specialization for six type parameters.\ntemplate <typename... Replaced> struct SubstitutedBase<6, Replaced...> {\n#ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n    template <typename ValueT, template <typename, typename, typename, typename, typename,\n                                         typename, ValueT...> class C,\n              ValueT... Values>\n    using SubstitutedWithValues = C<Replaced..., Values...>;\n#endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n};\n///\\internal Specialization for seven type parameters.\ntemplate <typename... Replaced> struct SubstitutedBase<7, Replaced...> {\n#ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n    template <typename ValueT, template <typename, typename, typename, typename, typename,\n                                         typename, typename, ValueT...> class C,\n              ValueT... Values>\n    using SubstitutedWithValues = C<Replaced..., Values...>;\n#endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n};\n///\\internal Specialization for eight type parameters.\ntemplate <typename... Replaced> struct SubstitutedBase<8, Replaced...> {\n#ifndef Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n    template <typename ValueT, template <typename, typename, typename, typename, typename,\n                                         typename, typename, typename, ValueT...> class C,\n              ValueT... Values>\n    using SubstitutedWithValues = C<Replaced..., Values...>;\n#endif // Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n};\n\n/**\\internal\n * Template specialization that ends the recursion and determines the return type \\p type.\n * The end of the recursion is identified by an empty typelist (i.e. no template\n * parameters) after the Typelist parameter.\n */\ntemplate <size_t N_, typename MT, typename Replaced0, typename... Replaced>\nstruct SubstituteOneByOne<N_, MT, Typelist<Replaced0, Replaced...>>\n{\n    /**\\internal\n     * Return type for returning the vector width and list of substituted types\n     */\n    struct type\n        : public SubstitutedBase<sizeof...(Replaced) + 1, Replaced0, Replaced...> {\n        static constexpr auto N = N_;\n        /**\\internal\n         * Alias template to construct a class template instantiation with the replaced\n         * types.\n         */\n        template <template <typename...> class C>\n        using Substituted = C<Replaced0, Replaced...>;\n    };\n};\n\n/**\\internal\n * Vectorized class templates are not substituted directly by ReplaceTypes/simdize.\n * Instead the replaced type is used as a base class for an adapter type which enables\n * the addition of extra operations. Specifically the following features are added:\n * \\li a constexpr \\p size() function, which returns the width of the vectorization. Note\n *     that this may hide a \\p size() member in the original class template (e.g. for STL\n *     container classes).\n * \\li The member type \\p base_type is an alias for the vectorized (i.e. substituted)\n *     class template\n * \\li The member type \\p scalar_type is an alias for the class template argument\n *     originally passed to the \\ref simdize expression.\n *\n * \\tparam Scalar\n * \\tparam Base\n * \\tparam N\n */\ntemplate <typename Scalar, typename Base, size_t N> class Adapter;\n\n/**\\internal\n * Specialization of ReplaceTypes for class templates (\\p C) where each template argument\n * needs to be substituted via SubstituteOneByOne.\n */\ntemplate <template <typename...> class C, typename... Ts, size_t N, typename MT>\nstruct ReplaceTypes<C<Ts...>, N, MT, Category::ClassTemplate>\n{\n    ///\\internal The \\p type member of the SubstituteOneByOne instantiation\n    using SubstitutionResult =\n        typename SubstituteOneByOne<N, MT, Typelist<>, Ts...>::type;\n    /**\\internal\n     * This expression instantiates the class template \\p C with the substituted template\n     * arguments in the \\p Ts parameter pack. The alias \\p Vectorized thus is the\n     * vectorized equivalent to \\p C<Ts...>.\n     */\n    using Vectorized = typename SubstitutionResult::template Substituted<C>;\n    /**\\internal\n     * The result type of this ReplaceTypes instantiation is set to \\p C<Ts...> if no\n     * template parameter substitution was done in SubstituteOneByOne. Otherwise, the type\n     * aliases an Adapter instantiation.\n     */\n    using type = conditional_t<is_same<C<Ts...>, Vectorized>::value, C<Ts...>,\n                               Adapter<C<Ts...>, Vectorized, SubstitutionResult::N>>;\n};\n\n/**\\internal\n * Specialization of the ReplaceTypes class template allowing transformation of class\n * templates with non-type parameters. This is impossible to express with variadic\n * templates and therefore requires a lot of code duplication.\n */\n#ifdef Vc_VALUE_PACK_EXPANSION_IS_BROKEN\n// ICC barfs on packs of values\n#define Vc_DEFINE_NONTYPE_REPLACETYPES_(ValueType_)                                      \\\n    template <template <typename, ValueType_...> class C, typename T, ValueType_ Value0, \\\n              ValueType_... Values>                                                      \\\n    struct is_class_template<C<T, Value0, Values...>> : public true_type {               \\\n    };                                                                                   \\\n    template <template <typename, typename, ValueType_...> class C, typename T0,         \\\n              typename T1, ValueType_ Value0, ValueType_... Values>                      \\\n    struct is_class_template<C<T0, T1, Value0, Values...>> : public true_type {          \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, ValueType_...> class C,            \\\n              typename T0, typename T1, typename T2, ValueType_ Value0,                  \\\n              ValueType_... Values>                                                      \\\n    struct is_class_template<C<T0, T1, T2, Value0, Values...>> : public true_type {      \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, ValueType_...> class C,  \\\n              typename T0, typename T1, typename T2, typename T3, ValueType_ Value0,     \\\n              ValueType_... Values>                                                      \\\n    struct is_class_template<C<T0, T1, T2, T3, Value0, Values...>> : public true_type {  \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, typename, ValueType_...> \\\n              class C,                                                                   \\\n              typename T0, typename T1, typename T2, typename T3, typename T4,           \\\n              ValueType_ Value0, ValueType_... Values>                                   \\\n    struct is_class_template<C<T0, T1, T2, T3, T4, Value0, Values...>>                   \\\n        : public true_type {                                                             \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, typename, typename,      \\\n                        ValueType_...> class C,                                          \\\n              typename T0, typename T1, typename T2, typename T3, typename T4,           \\\n              typename T5, ValueType_ Value0, ValueType_... Values>                      \\\n    struct is_class_template<C<T0, T1, T2, T3, T4, T5, Value0, Values...>>               \\\n        : public true_type {                                                             \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, typename, typename,      \\\n                        typename, ValueType_...> class C,                                \\\n              typename T0, typename T1, typename T2, typename T3, typename T4,           \\\n              typename T5, typename T6, ValueType_ Value0, ValueType_... Values>         \\\n    struct is_class_template<C<T0, T1, T2, T3, T4, T5, T6, Value0, Values...>>           \\\n        : public true_type {                                                             \\\n    };                                                                                   \\\n    template <template <typename, ValueType_> class C, typename T0, ValueType_ Value0,   \\\n              size_t N, typename MT>                                                     \\\n    struct ReplaceTypes<C<T0, Value0>, N, MT, Category::ClassTemplate> {                 \\\n        typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0>::type tmp;            \\\n        typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0>      \\\n            Substituted;                                                                 \\\n        static constexpr auto NN = tmp::N;                                               \\\n        typedef conditional_t<is_same<C<T0, Value0>, Substituted>::value, C<T0, Value0>, \\\n                              Adapter<C<T0, Value0>, Substituted, NN>> type;             \\\n    };                                                                                   \\\n    template <template <typename, typename, ValueType_> class C, typename T0,            \\\n              typename T1, ValueType_ Value0, size_t N, typename MT>                     \\\n    struct ReplaceTypes<C<T0, T1, Value0>, N, MT, Category::ClassTemplate> {             \\\n        typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1>::type tmp;        \\\n        typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0>      \\\n            Substituted;                                                                 \\\n        static constexpr auto NN = tmp::N;                                               \\\n        typedef conditional_t<is_same<C<T0, T1, Value0>, Substituted>::value,            \\\n                              C<T0, T1, Value0>,                                         \\\n                              Adapter<C<T0, T1, Value0>, Substituted, NN>> type;         \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, ValueType_> class C, typename T0,  \\\n              typename T1, typename T2, ValueType_ Value0, size_t N, typename MT>        \\\n    struct ReplaceTypes<C<T0, T1, T2, Value0>, N, MT, Category::ClassTemplate> {         \\\n        typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1, T2>::type tmp;    \\\n        typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0>      \\\n            Substituted;                                                                 \\\n        static constexpr auto NN = tmp::N;                                               \\\n        typedef conditional_t<is_same<C<T0, T1, T2, Value0>, Substituted>::value,        \\\n                              C<T0, T1, T2, Value0>,                                     \\\n                              Adapter<C<T0, T1, T2, Value0>, Substituted, NN>> type;     \\\n    }\n#else\n#define Vc_DEFINE_NONTYPE_REPLACETYPES_(ValueType_)                                      \\\n    template <template <typename, ValueType_...> class C, typename T, ValueType_ Value0, \\\n              ValueType_... Values>                                                      \\\n    struct is_class_template<C<T, Value0, Values...>> : public true_type {               \\\n    };                                                                                   \\\n    template <template <typename, typename, ValueType_...> class C, typename T0,         \\\n              typename T1, ValueType_ Value0, ValueType_... Values>                      \\\n    struct is_class_template<C<T0, T1, Value0, Values...>> : public true_type {          \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, ValueType_...> class C,            \\\n              typename T0, typename T1, typename T2, ValueType_ Value0,                  \\\n              ValueType_... Values>                                                      \\\n    struct is_class_template<C<T0, T1, T2, Value0, Values...>> : public true_type {      \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, ValueType_...> class C,  \\\n              typename T0, typename T1, typename T2, typename T3, ValueType_ Value0,     \\\n              ValueType_... Values>                                                      \\\n    struct is_class_template<C<T0, T1, T2, T3, Value0, Values...>> : public true_type {  \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, typename, ValueType_...> \\\n              class C,                                                                   \\\n              typename T0, typename T1, typename T2, typename T3, typename T4,           \\\n              ValueType_ Value0, ValueType_... Values>                                   \\\n    struct is_class_template<C<T0, T1, T2, T3, T4, Value0, Values...>>                   \\\n        : public true_type {                                                             \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, typename, typename,      \\\n                        ValueType_...> class C,                                          \\\n              typename T0, typename T1, typename T2, typename T3, typename T4,           \\\n              typename T5, ValueType_ Value0, ValueType_... Values>                      \\\n    struct is_class_template<C<T0, T1, T2, T3, T4, T5, Value0, Values...>>               \\\n        : public true_type {                                                             \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, typename, typename, typename,      \\\n                        typename, ValueType_...> class C,                                \\\n              typename T0, typename T1, typename T2, typename T3, typename T4,           \\\n              typename T5, typename T6, ValueType_ Value0, ValueType_... Values>         \\\n    struct is_class_template<C<T0, T1, T2, T3, T4, T5, T6, Value0, Values...>>           \\\n        : public true_type {                                                             \\\n    };                                                                                   \\\n    template <template <typename, ValueType_...> class C, typename T0,                   \\\n              ValueType_ Value0, ValueType_... Values, size_t N, typename MT>            \\\n    struct ReplaceTypes<C<T0, Value0, Values...>, N, MT, Category::ClassTemplate> {      \\\n        typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0>::type tmp;            \\\n        typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0,      \\\n                                                             Values...> Substituted;     \\\n        static constexpr auto NN = tmp::N;                                               \\\n        typedef conditional_t<is_same<C<T0, Value0, Values...>, Substituted>::value,     \\\n                              C<T0, Value0, Values...>,                                  \\\n                              Adapter<C<T0, Value0, Values...>, Substituted, NN>> type;  \\\n    };                                                                                   \\\n    template <template <typename, typename, ValueType_...> class C, typename T0,         \\\n              typename T1, ValueType_ Value0, ValueType_... Values, size_t N,            \\\n              typename MT>                                                               \\\n    struct ReplaceTypes<C<T0, T1, Value0, Values...>, N, MT, Category::ClassTemplate> {  \\\n        typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1>::type tmp;        \\\n        typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0,      \\\n                                                             Values...> Substituted;     \\\n        static constexpr auto NN = tmp::N;                                               \\\n        typedef conditional_t<is_same<C<T0, T1, Value0, Values...>, Substituted>::value, \\\n                              C<T0, T1, Value0, Values...>,                              \\\n                              Adapter<C<T0, T1, Value0, Values...>, Substituted, NN>>    \\\n            type;                                                                        \\\n    };                                                                                   \\\n    template <template <typename, typename, typename, ValueType_...> class C,            \\\n              typename T0, typename T1, typename T2, ValueType_ Value0,                  \\\n              ValueType_... Values, size_t N, typename MT>                               \\\n    struct ReplaceTypes<C<T0, T1, T2, Value0, Values...>, N, MT,                         \\\n                        Category::ClassTemplate> {                                       \\\n        typedef typename SubstituteOneByOne<N, MT, Typelist<>, T0, T1, T2>::type tmp;    \\\n        typedef typename tmp::template SubstitutedWithValues<ValueType_, C, Value0,      \\\n                                                             Values...> Substituted;     \\\n        static constexpr auto NN = tmp::N;                                               \\\n        typedef conditional_t<                                                           \\\n            is_same<C<T0, T1, T2, Value0, Values...>, Substituted>::value,               \\\n            C<T0, T1, T2, Value0, Values...>,                                            \\\n            Adapter<C<T0, T1, T2, Value0, Values...>, Substituted, NN>> type;            \\\n    }\n#endif  // Vc_VALUE_PACK_EXPANSION_IS_BROKEN\nVc_DEFINE_NONTYPE_REPLACETYPES_(bool);\nVc_DEFINE_NONTYPE_REPLACETYPES_(wchar_t);\nVc_DEFINE_NONTYPE_REPLACETYPES_(char);\nVc_DEFINE_NONTYPE_REPLACETYPES_(  signed char);\nVc_DEFINE_NONTYPE_REPLACETYPES_(unsigned char);\nVc_DEFINE_NONTYPE_REPLACETYPES_(  signed short);\nVc_DEFINE_NONTYPE_REPLACETYPES_(unsigned short);\nVc_DEFINE_NONTYPE_REPLACETYPES_(  signed int);\nVc_DEFINE_NONTYPE_REPLACETYPES_(unsigned int);\nVc_DEFINE_NONTYPE_REPLACETYPES_(  signed long);\nVc_DEFINE_NONTYPE_REPLACETYPES_(unsigned long);\nVc_DEFINE_NONTYPE_REPLACETYPES_(  signed long long);\nVc_DEFINE_NONTYPE_REPLACETYPES_(unsigned long long);\n#undef Vc_DEFINE_NONTYPE_REPLACETYPES_\n\n// preferred_construction {{{\nnamespace preferred_construction_impl\n{\ntemplate <typename T> T create();\n// 0: paren init\ntemplate <class Type, class... Init, class = decltype(Type(create<Init>()...))>\nconstexpr std::integral_constant<int, 0> test(int);\n// 1: 1-brace init\ntemplate <class Type, class... Init, class = decltype(Type{create<Init>()...})>\nconstexpr std::integral_constant<int, 1> test(float);\n// 2: 2-brace init\ntemplate <class Type, class... Init, class T, class = decltype(Type{{create<Init>()...}})>\nconstexpr std::integral_constant<int, 2> test(T);\n// 3: no init at all\ntemplate <class Type, class... Init> constexpr std::integral_constant<int, 3> test(...);\n}  // namespace preferred_construction_impl\n\ntemplate <class Type, class... Init>\nconstexpr inline decltype(preferred_construction_impl::test<Type, Init...>(0))\npreferred_construction()\n{\n    return {};\n}\n\n// }}}\n// get_dispatcher {{{\n/**\\internal\n * Uses either the `vc_get_<I>` member function of \\p x or `std::get<I>(x)` to retrieve\n * the `I`-th member of \\p x.\n */\ntemplate <size_t I, typename T,\n          typename R = decltype(std::declval<T &>().template vc_get_<I>())>\nR get_dispatcher(T &x, void * = nullptr)\n{\n    return x.template vc_get_<I>();\n}\ntemplate <size_t I, typename T,\n          typename R = decltype(std::declval<const T &>().template vc_get_<I>())>\nR get_dispatcher(const T &x, void * = nullptr)\n{\n    return x.template vc_get_<I>();\n}\ntemplate <size_t I, typename T, typename R = decltype(std::get<I>(std::declval<T &>()))>\nR get_dispatcher(T &x, int = 0)\n{\n    return std::get<I>(x);\n}\ntemplate <size_t I, typename T,\n          typename R = decltype(std::get<I>(std::declval<const T &>()))>\nR get_dispatcher(const T &x, int = 0)\n{\n    return std::get<I>(x);\n}\n\n// }}}\n// my_tuple_element {{{\ntemplate <size_t I, class T, class = void>\nstruct my_tuple_element : std::tuple_element<I, T> {\n};\n\ntemplate <size_t I, class T>\nstruct my_tuple_element<\n    I, T, typename std::conditional<\n              true, void, decltype(std::declval<T>().template vc_get_<I>())>::type> {\n    using type =\n        typename std::decay<decltype(std::declval<T>().template vc_get_<I>())>::type;\n};\n\n// }}}\n// homogeneous_sizeof {{{\n/**\\internal\n * This trait determines the `sizeof` of all fundamental types (i.e. recursively, when\n * needed) in the template parameter pack \\p Ts. If all fundamental types have equal\n * `sizeof`, the value is \"returned\" in the `value` member. Otherwise `value` is 0.\n */\ntemplate <class... Ts> struct homogeneous_sizeof;\ntemplate <class T, class = void> struct homogeneous_sizeof_one;\ntemplate <class T>\nstruct homogeneous_sizeof_one<T,\n                              typename std::enable_if<std::is_arithmetic<T>::value>::type>\n    : std::integral_constant<size_t, sizeof(T)> {\n};\ntemplate <class T0> struct homogeneous_sizeof<T0> : homogeneous_sizeof_one<T0> {\n};\n\ntemplate <class T0, class... Ts>\nstruct homogeneous_sizeof<T0, Ts...>\n    : std::integral_constant<size_t, homogeneous_sizeof<T0>::value ==\n                                             homogeneous_sizeof<Ts...>::value\n                                         ? homogeneous_sizeof<T0>::value\n                                         : 0> {\n};\n\ntemplate <class T, size_t... Is>\nstd::integral_constant<\n    size_t, homogeneous_sizeof<typename my_tuple_element<Is, T>::type...>::value>\n    homogeneous_sizeof_helper(index_sequence<Is...>);\n\ntemplate <class T>\nstruct homogeneous_sizeof_one<T, typename std::enable_if<std::is_class<T>::value>::type>\n    : decltype(homogeneous_sizeof_helper<T>(\n          make_index_sequence<determine_tuple_size_<T>::value>())) {\n};\n\n// }}}\n// class Adapter {{{\ntemplate <typename Scalar, typename Base, size_t N> class Adapter : public Base\n{\nprivate:\n    /// helper for the broadcast ctor below, error case\n    template <std::size_t... Indexes, int X>\n    Adapter(Vc::index_sequence<Indexes...>, const Scalar,\n            std::integral_constant<int, X>)\n    {\n        static_assert(\n            X < 3, \"Failed to construct an object of type Base. Neither via \"\n                   \"parenthesis-init, brace-init, nor double-brace init appear to work.\");\n    }\n\n    /// helper for the broadcast ctor below using double braces for Base initialization\n    template <std::size_t... Indexes>\n    Adapter(Vc::index_sequence<Indexes...>, const Scalar &x_,\n            std::integral_constant<int, 2>)\n        : Base{{get_dispatcher<Indexes>(x_)...}}\n    {\n    }\n\n    /// helper for the broadcast ctor below using single braces for Base initialization\n    template <std::size_t... Indexes>\n    Adapter(Vc::index_sequence<Indexes...>, const Scalar &x_,\n            std::integral_constant<int, 1>)\n        : Base{get_dispatcher<Indexes>(x_)...}\n    {\n    }\n\n    /// helper for the broadcast ctor below using parenthesis for Base initialization\n    template <std::size_t... Indexes>\n    Adapter(Vc::index_sequence<Indexes...>, const Scalar &x_,\n            std::integral_constant<int, 0>)\n        : Base(get_dispatcher<Indexes>(x_)...)\n    {\n    }\n\n    template <std::size_t... Indexes>\n    Adapter(Vc::index_sequence<Indexes...> seq_, const Scalar &x_)\n        : Adapter(seq_, x_,\n                  preferred_construction<Base, decltype(get_dispatcher<Indexes>(\n                                                   std::declval<const Scalar &>()))...>())\n    {\n    }\n\npublic:\n    /// The SIMD vector width of the members.\n    static constexpr size_t size() { return N; }\n    static constexpr size_t Size = N;\n\n    /// The vectorized base class template instantiation this Adapter class derives from.\n    using base_type = Base;\n    /// The original non-vectorized class template instantiation that was passed to the\n    /// simdize expression.\n    using scalar_type = Scalar;\n\n    /// Allow default construction. This is automatically ill-formed if Base() is\n    /// ill-formed.\n    Adapter() = default;\n\n    /// Defaulted copy and move construction and assignment\n#if defined Vc_CLANG && Vc_CLANG < 0x30700\n    Vc_INTRINSIC Adapter(const Adapter &x) : Base(x) {}\n#else\n    Adapter(const Adapter &) = default;\n#endif\n    /// Defaulted copy and move construction and assignment\n    Adapter(Adapter &&) = default;\n    /// Defaulted copy and move construction and assignment\n    Adapter &operator=(const Adapter &) = default;\n    /// Defaulted copy and move construction and assignment\n    Adapter &operator=(Adapter &&) = default;\n\n    /// Broadcast constructor\n    template <typename U, size_t TupleSize = determine_tuple_size_<Scalar>::value,\n              typename Seq = Vc::make_index_sequence<TupleSize>,\n              typename = enable_if<std::is_convertible<U, Scalar>::value>>\n    Adapter(U &&x_)\n        : Adapter(Seq(), static_cast<const Scalar &>(x_))\n    {\n    }\n\n    /// Generator constructor {{{\n    template <class F,\n              class = decltype(static_cast<Scalar>(std::declval<F>()(\n                  size_t())))>  // F returns objects that are convertible to S\n    Adapter(F &&fun);           // implementation below\n\n    // }}}\n    /// perfect forward all Base constructors\n    template <typename A0, typename... Args,\n              typename = typename std::enable_if<\n                  !Traits::is_index_sequence<A0>::value &&\n                  (sizeof...(Args) > 0 || !std::is_convertible<A0, Scalar>::value)>::type>\n    Adapter(A0 &&arg0_, Args &&... arguments_)\n        : Base(std::forward<A0>(arg0_), std::forward<Args>(arguments_)...)\n    {\n    }\n\n    /// perfect forward Base constructors that accept an initializer_list\n    template <typename T,\n              typename = decltype(Base(std::declval<const std::initializer_list<T> &>()))>\n    Adapter(const std::initializer_list<T> &l_)\n        : Base(l_)\n    {\n    }\n\n    /// Overload the new operator to adhere to the alignment requirements which C++11\n    /// ignores by default.\n    void *operator new(size_t size)\n    {\n        return Vc::Common::aligned_malloc<alignof(Adapter)>(size);\n    }\n    void *operator new(size_t, void *p_) { return p_; }\n    void *operator new[](size_t size)\n    {\n        return Vc::Common::aligned_malloc<alignof(Adapter)>(size);\n    }\n    void *operator new[](size_t , void *p_) { return p_; }\n    void operator delete(void *ptr_, size_t) { Vc::Common::free(ptr_); }\n    void operator delete(void *, void *) {}\n    void operator delete[](void *ptr_, size_t) { Vc::Common::free(ptr_); }\n    void operator delete[](void *, void *) {}\n};  // }}}\n// delete compare operators for Adapter {{{\n/**\\internal\n * Delete compare operators for simdize<tuple<...>> types because the tuple compares\n * require the compares to be bool based.\n */\ntemplate <class... TTypes, class... TTypesV, class... UTypes, class... UTypesV, size_t N>\ninline void operator==(\n    const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,\n    const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) = delete;\ntemplate <class... TTypes, class... TTypesV, class... UTypes, class... UTypesV, size_t N>\ninline void operator!=(\n    const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,\n    const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) = delete;\ntemplate <class... TTypes, class... TTypesV, class... UTypes, class... UTypesV, size_t N>\ninline void operator<=(\n    const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,\n    const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) = delete;\ntemplate <class... TTypes, class... TTypesV, class... UTypes, class... UTypesV, size_t N>\ninline void operator>=(\n    const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,\n    const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) = delete;\ntemplate <class... TTypes, class... TTypesV, class... UTypes, class... UTypesV, size_t N>\ninline void operator<(\n    const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,\n    const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) = delete;\ntemplate <class... TTypes, class... TTypesV, class... UTypes, class... UTypesV, size_t N>\ninline void operator>(\n    const Adapter<std::tuple<TTypes...>, std::tuple<TTypesV...>, N> &t,\n    const Adapter<std::tuple<UTypes...>, std::tuple<UTypesV...>, N> &u) = delete;\n// }}}\n/** @}*/\n}  // namespace SimdizeDetail }}}\n}  // namespace Vc\n\nnamespace std  // {{{\n{\n/**\\internal\n * A std::tuple_size specialization for the SimdizeDetail::Adapter class.\n */\ntemplate <typename Scalar, typename Base, size_t N>\nclass tuple_size<Vc::SimdizeDetail::Adapter<Scalar, Base, N>> : public tuple_size<Base>\n{\n};\n/**\\internal\n * A std::tuple_element specialization for the SimdizeDetail::Adapter class.\n */\ntemplate <size_t I, typename Scalar, typename Base, size_t N>\nclass tuple_element<I, Vc::SimdizeDetail::Adapter<Scalar, Base, N>>\n    : public tuple_element<I, Base>\n{\n};\n// std::get does not need additional work because Vc::Adapter derives from\n// C<Ts...> and therefore if get<N>(C<Ts...>) works it works for Adapter as well.\n\n/**\\internal\n * A std::allocator specialization for SimdizeDetail::Adapter which uses the Vc::Allocator\n * class to make allocation correctly aligned per default.\n */\ntemplate <typename S, typename T, size_t N>\nclass allocator<Vc::SimdizeDetail::Adapter<S, T, N>>\n    : public Vc::Allocator<Vc::SimdizeDetail::Adapter<S, T, N>>\n{\npublic:\n    template <typename U> struct rebind\n    {\n        typedef std::allocator<U> other;\n    };\n};\n}  // namespace std }}}\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SimdizeDetail\n{\n/**\\addtogroup Simdize\n * @{\n */\n/**\\internal\n * Since std::decay can ICE GCC (with types that are declared as may_alias), this is used\n * as an alternative approach. Using decltype the template type deduction implements the\n * std::decay behavior.\n */\ntemplate <typename T> static inline T decay_workaround(const T &x) { return x; }\n\n// assign_impl {{{\n/**\\internal\n * Generic implementation of assign using the std::tuple get interface.\n */\ntemplate <typename S, typename T, size_t N, size_t... Indexes>\ninline void assign_impl(Adapter<S, T, N> &a, size_t i, const S &x,\n                        Vc::index_sequence<Indexes...>)\n{\n    const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(x)))...> tmp(\n        decay_workaround(get_dispatcher<Indexes>(x))...);\n    auto &&unused = {(get_dispatcher<Indexes>(a)[i] = get_dispatcher<Indexes>(tmp), 0)...};\n    if (&unused == &unused) {}\n}  // }}}\n// construct (parens, braces, double-braces) {{{\ntemplate <class S, class... Args>\nS construct(std::integral_constant<int, 0>, Args &&... args)\n{\n    return S(std::forward<Args>(args)...);\n}\ntemplate <class S, class... Args>\nS construct(std::integral_constant<int, 1>, Args &&... args)\n{\n    return S{std::forward<Args>(args)...};\n}\ntemplate <class S, class... Args>\nS construct(std::integral_constant<int, 2>, Args &&... args)\n{\n    return S{{std::forward<Args>(args)...}};\n}\n// }}}\n// extract_impl {{{\n/**\\internal\n * index_sequence based implementation for extract below.\n */\ntemplate <typename S, typename T, size_t N, size_t... Indexes>\ninline S extract_impl(const Adapter<S, T, N> &a, size_t i, Vc::index_sequence<Indexes...>)\n{\n    const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(a)[i]))...> tmp(\n        decay_workaround(get_dispatcher<Indexes>(a)[i])...);\n    return construct<S>(\n        preferred_construction<S, decltype(decay_workaround(\n                                      get_dispatcher<Indexes>(a)[i]))...>(),\n        decay_workaround(get_dispatcher<Indexes>(a)[i])...);\n    //return S(get_dispatcher<Indexes>(tmp)...);\n}\n// }}}\n// shifted_impl {{{\ntemplate <typename S, typename T, std::size_t N, std::size_t... Indexes>\ninline Adapter<S, T, N> shifted_impl(const Adapter<S, T, N> &a, int shift,\n                                     Vc::index_sequence<Indexes...>)\n{\n    Adapter<S, T, N> r;\n    auto &&unused = {(get_dispatcher<Indexes>(r) = get_dispatcher<Indexes>(a).shifted(shift), 0)...};\n    if (&unused == &unused) {}\n    return r;\n}\n// }}}\n// shifted(Adapter) {{{\n/**\n * Returns a new vectorized object where each entry is shifted by \\p shift. This basically\n * calls Vector<T>::shifted on every entry.\n *\n * \\param a The object to apply the shift on.\n * \\param shift The number of entries to shift by.\n * \\returns a copy of \\p a shifted by \\p shift.\n */\ntemplate <typename S, typename T, size_t N>\ninline Adapter<S, T, N> shifted(const Adapter<S, T, N> &a, int shift)\n{\n    return shifted_impl(a, shift, Vc::make_index_sequence<determine_tuple_size<T>()>());\n}\n// }}}\n// swap_impl {{{\n/** \\internal\n * Generic implementation of simdize_swap using the std::tuple get interface.\n */\ntemplate <typename S, typename T, std::size_t N, std::size_t... Indexes>\ninline void swap_impl(Adapter<S, T, N> &a, std::size_t i, S &x,\n                      Vc::index_sequence<Indexes...>)\n{\n    const auto &a_const = a;\n    const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(a_const)[0]))...>\n        tmp{decay_workaround(get_dispatcher<Indexes>(a_const)[i])...};\n    auto &&unused = {(get_dispatcher<Indexes>(a)[i] = get_dispatcher<Indexes>(x), 0)...};\n    auto &&unused2 = {(get_dispatcher<Indexes>(x) = get_dispatcher<Indexes>(tmp), 0)...};\n    if (&unused == &unused2) {}\n}\ntemplate <typename S, typename T, std::size_t N, std::size_t... Indexes>\ninline void swap_impl(Adapter<S, T, N> &a, std::size_t i, Adapter<S, T, N> &b,\n                      std::size_t j, Vc::index_sequence<Indexes...>)\n{\n    const auto &a_const = a;\n    const auto &b_const = b;\n    const std::tuple<decltype(decay_workaround(get_dispatcher<Indexes>(a_const)[0]))...>\n        tmp{decay_workaround(get_dispatcher<Indexes>(a_const)[i])...};\n    auto &&unused = {(get_dispatcher<Indexes>(a)[i] = get_dispatcher<Indexes>(b_const)[j], 0)...};\n    auto &&unused2 = {(get_dispatcher<Indexes>(b)[j] = get_dispatcher<Indexes>(tmp), 0)...};\n    if (&unused == &unused2) {}\n}\n// }}}\n// swap(Adapter) {{{\n/**\n * Swaps one scalar object \\p x with a SIMD slot at offset \\p i in the simdized object \\p\n * a.\n */\ntemplate <typename S, typename T, std::size_t N>\ninline void swap(Adapter<S, T, N> &a, std::size_t i, S &x)\n{\n    swap_impl(a, i, x, Vc::make_index_sequence<determine_tuple_size<T>()>());\n}\ntemplate <typename S, typename T, std::size_t N>\ninline void swap(Adapter<S, T, N> &a, std::size_t i, Adapter<S, T, N> &b, std::size_t j)\n{\n    swap_impl(a, i, b, j, Vc::make_index_sequence<determine_tuple_size<T>()>());\n}\n// }}}\ntemplate <typename A> class Scalar  // {{{\n{\n    using reference = typename std::add_lvalue_reference<A>::type;\n    using S = typename A::scalar_type;\n    using IndexSeq = Vc::make_index_sequence<determine_tuple_size<S>()>;\n\npublic:\n    Scalar(reference aa, size_t ii) : a(aa), i(ii) {}\n\n    // delete copy and move to keep the type a pure proxy temporary object.\n    Scalar(const Scalar &) = delete;\n    Scalar(Scalar &&) = delete;\n    Scalar &operator=(const Scalar &) = delete;\n    Scalar &operator=(Scalar &&) = delete;\n\n    void operator=(const S &x) { assign_impl(a, i, x, IndexSeq()); }\n    operator S() const { return extract_impl(a, i, IndexSeq()); }\n\n    template <typename AA>\n    friend inline void swap(Scalar<AA> &&a, typename AA::scalar_type &b);\n    template <typename AA>\n    friend inline void swap(typename AA::scalar_type &b, Scalar<AA> &&a);\n    template <typename AA> friend inline void swap(Scalar<AA> &&a, Scalar<AA> &&b);\n\nprivate:\n    reference a;\n    size_t i;\n};  // }}}\n// swap(Scalar) {{{\n/// std::swap interface to swapping one scalar object with a (virtual) reference to\n/// another object inside a vectorized object\ntemplate <typename A> inline void swap(Scalar<A> &&a, typename A::scalar_type &b)\n{\n    swap_impl(a.a, a.i, b, typename Scalar<A>::IndexSeq());\n}\n/// std::swap interface to swapping one scalar object with a (virtual) reference to\n/// another object inside a vectorized object\ntemplate <typename A> inline void swap(typename A::scalar_type &b, Scalar<A> &&a)\n{\n    swap_impl(a.a, a.i, b, typename Scalar<A>::IndexSeq());\n}\n\ntemplate <typename A> inline void swap(Scalar<A> &&a, Scalar<A> &&b)\n{\n    swap_impl(a.a, a.i, b.a, b.i, typename Scalar<A>::IndexSeq());\n}\n// }}}\n// load_interleaved_impl {{{\ntemplate <class S, class T, size_t N, size_t... I>\ninline void load_interleaved_impl(Vc::index_sequence<I...>, Adapter<S, T, N> &a,\n                                  const S *mem)\n{\n    const InterleavedMemoryWrapper<S, decltype(decay_workaround(get_dispatcher<0>(a)))>\n    wrapper(const_cast<S *>(mem));\n    Vc::tie(get_dispatcher<I>(a)...) = wrapper[0];\n}\n// }}}\n// store_interleaved_impl {{{\ntemplate <class S, class T, size_t N, size_t... I>\ninline void store_interleaved_impl(Vc::index_sequence<I...>, const Adapter<S, T, N> &a,\n                                   S *mem)\n{\n    InterleavedMemoryWrapper<S, decltype(decay_workaround(get_dispatcher<0>(a)))> wrapper(\n        mem);\n    wrapper[0] = Vc::tie(get_dispatcher<I>(a)...);\n}\n// }}}\ntemplate <typename A> class Interface  // {{{\n{\n    using reference = typename std::add_lvalue_reference<A>::type;\n    using IndexSeq =\n        Vc::make_index_sequence<determine_tuple_size<typename A::scalar_type>()>;\n\npublic:\n    Interface(reference aa) : a(aa) {}\n\n    Scalar<A> operator[](size_t i)\n    {\n        return {a, i};\n    }\n    typename A::scalar_type operator[](size_t i) const\n    {\n        return extract_impl(a, i, IndexSeq());\n    }\n\n    A shifted(int amount) const\n    {\n        return shifted_impl(a, amount, IndexSeq());\n    }\n\n    void load(const typename A::scalar_type *mem) { load_interleaved(*this, mem); }\n    void store(typename A::scalar_type *mem) { store_interleaved(*this, mem); }\n\nprivate:\n    reference a;\n};  // }}}\n}  // namespace SimdizeDetail\n// assign {{{\n/**\n * Assigns one scalar object \\p x to a SIMD slot at offset \\p i in the simdized object \\p\n * a.\n */\ntemplate <typename S, typename T, size_t N>\ninline void assign(SimdizeDetail::Adapter<S, T, N> &a, size_t i, const S &x)\n{\n    SimdizeDetail::assign_impl(\n        a, i, x, Vc::make_index_sequence<SimdizeDetail::determine_tuple_size<T>()>());\n}\n/**\\internal\n * Overload for standard Vector/SimdArray types.\n */\ntemplate <typename V, typename = enable_if<Traits::is_simd_vector<V>::value>>\nVc_INTRINSIC void assign(V &v, size_t i, typename V::EntryType x)\n{\n    v[i] = x;\n}\n// }}}\n// extract {{{\n/**\n * Extracts and returns one scalar object from a SIMD slot at offset \\p i in the simdized\n * object \\p a.\n */\ntemplate <typename S, typename T, size_t N>\ninline S extract(const SimdizeDetail::Adapter<S, T, N> &a, size_t i)\n{\n    return SimdizeDetail::extract_impl(\n        a, i, Vc::make_index_sequence<SimdizeDetail::determine_tuple_size<S>()>());\n}\n/**\\internal\n * Overload for standard Vector/SimdArray types.\n */\ntemplate <typename V, typename = enable_if<Traits::is_simd_vector<V>::value>>\nVc_INTRINSIC typename V::EntryType extract(const V &v, size_t i)\n{\n    return v[i];\n}\n// }}}\n// load_interleaved {{{\ntemplate <class S, class T, size_t N>\ninline void load_interleaved(SimdizeDetail::Adapter<S, T, N> &a, const S *mem)\n{\n    if (SimdizeDetail::homogeneous_sizeof<S>::value == 0) {\n        Common::unrolled_loop<std::size_t, 0, N>(\n            [&](std::size_t i) { assign(a, i, mem[i]); });\n    } else {\n        constexpr size_t TupleSize = SimdizeDetail::determine_tuple_size_<S>::value;\n        SimdizeDetail::load_interleaved_impl(Vc::make_index_sequence<TupleSize>(), a,\n                                             mem);\n    }\n}\ntemplate <\n    class V, class T,\n    class = enable_if<Traits::is_simd_vector<V>::value && std::is_arithmetic<T>::value>>\nVc_INTRINSIC void load_interleaved(V &a, const T *mem)\n{\n    a.load(mem, Vc::Unaligned);\n}\n// }}}\n// store_interleaved {{{\ntemplate <class S, class T, size_t N>\ninline void store_interleaved(const SimdizeDetail::Adapter<S, T, N> &a, S *mem)\n{\n    if (SimdizeDetail::homogeneous_sizeof<S>::value == 0) {\n        Common::unrolled_loop<std::size_t, 0, N>(\n            [&](std::size_t i) { mem[i] = extract(a, i); });\n    } else {\n        constexpr size_t TupleSize = SimdizeDetail::determine_tuple_size_<S>::value;\n        SimdizeDetail::store_interleaved_impl(Vc::make_index_sequence<TupleSize>(), a,\n                                              mem);\n    }\n}\ntemplate <\n    class V, class T,\n    class = enable_if<Traits::is_simd_vector<V>::value && std::is_arithmetic<T>::value>>\nVc_INTRINSIC void store_interleaved(const V &a, T *mem)\n{\n    a.store(mem, Vc::Unaligned);\n}\n// }}}\n// decorate(Adapter) {{{\ntemplate <typename S, typename T, size_t N>\nSimdizeDetail::Interface<SimdizeDetail::Adapter<S, T, N>> decorate(\n    SimdizeDetail::Adapter<S, T, N> &a)\n{\n    return {a};\n}\ntemplate <typename S, typename T, size_t N>\nconst SimdizeDetail::Interface<const SimdizeDetail::Adapter<S, T, N>> decorate(\n    const SimdizeDetail::Adapter<S, T, N> &a)\n{\n    return {a};\n}\ntemplate <class V, class = typename std::enable_if<\n                       Traits::is_simd_vector<typename std::decay<V>::type>::value>>\nV &&decorate(V &&v)\n{\n    return std::forward<V>(v);\n}\n// }}}\nnamespace SimdizeDetail\n{\n// Adapter::Adapter(F) Generator {{{\ntemplate <typename Scalar, typename Base, size_t N>\ntemplate <class F, class>\nAdapter<Scalar, Base, N>::Adapter(F &&fun)\n{\n    for (size_t i = 0; i < N; ++i) {\n        Vc::assign(*this, i, fun(i));\n    }\n}\n// }}}\nnamespace IteratorDetails  // {{{\n{\nenum class Mutable { Yes, No };\n\ntemplate <typename It, typename V, size_t I, size_t End>\nVc_INTRINSIC V fromIteratorImpl(enable_if<(I == End), It>)\n{\n    return {};\n}\ntemplate <typename It, typename V, size_t I, size_t End>\nVc_INTRINSIC V fromIteratorImpl(enable_if<(I < End), It> it)\n{\n    V r = fromIteratorImpl<It, V, I + 1, End>(it);\n    Traits::decay<decltype(get_dispatcher<I>(r))> tmp;\n    for (size_t j = 0; j < V::size(); ++j, ++it) {\n        tmp[j] = get_dispatcher<I>(*it);\n    }\n    get_dispatcher<I>(r) = tmp;\n    return r;\n}\ntemplate <typename It, typename V>\nVc_INTRINSIC V fromIterator(enable_if<!Traits::is_simd_vector<V>::value, const It &> it)\n{\n    return fromIteratorImpl<It, V, 0, determine_tuple_size<V>()>(it);\n}\n\ntemplate <typename It, typename V>\nVc_INTRINSIC V fromIterator(\n    enable_if<\n        Traits::is_simd_vector<V>::value && Traits::has_contiguous_storage<It>::value, It>\n        it)\n{\n#ifndef _MSC_VER\n    // this check potentially moves it past the end of a container, which is UB. Some STL\n    // implementations, like MS STL, trap this.\n    Vc_ASSERT(&*it + 1 == &*(it + 1));\n#endif\n    return V(&*it, Vc::Unaligned);\n}\n\ntemplate <typename It, typename V>\nVc_INTRINSIC V fromIterator(enable_if<Traits::is_simd_vector<V>::value &&\n                                          !Traits::has_contiguous_storage<It>::value,\n                                      It>\n                                it)\n{\n    V r;\n    for (size_t j = 0; j < V::size(); ++j, ++it) {\n        r[j] = *it;\n    }\n    return r;\n}\n\n// Note: §13.5.6 says: “An expression x->m is interpreted as (x.operator->())->m for a\n// class object x of type T if T::operator->() exists and if the operator is selected as\n// the best match function by the overload resolution mechanism (13.3).”\ntemplate <typename T, typename value_vector, Mutable> class Pointer;\n\n/**\\internal\n * Proxy type for a pointer returned from operator->(). The mutable variant requires at\n * least a ForwardIterator. An InputIterator cannot work since no valid copies and\n * independent iteration can be guaranteed.\n *\n * The implementation creates the pointer-like behavior by creating an lvalue for the\n * proxied data. This\n */\ntemplate <typename T, typename value_vector> class Pointer<T, value_vector, Mutable::Yes>\n{\n    static constexpr auto Size = value_vector::size();\n\npublic:\n    /// \\returns a pointer to the (temporary) member object.\n    value_vector *operator->() { return &data; }\n\n    /**\n     * A Pointer can only be constructed from a scalar iterator or move constructed (for\n     * function returns).\n     */\n    Pointer() = delete;\n    Pointer(const Pointer &) = delete;\n    Pointer &operator=(const Pointer &) = delete;\n    Pointer &operator=(Pointer &&) = delete;\n\n    /// required for returning the Pointer\n    Pointer(Pointer &&) = default;\n\n    /**\n     * Writes the vectorized object back to the scalar objects referenced by the\n     * iterator. This store is done unconditionally for the mutable variant of the\n     * Pointer. The immutable Pointer OTOH does not store back at all.\n     */\n    ~Pointer()\n    {\n        // store data back to where it came from\n        for (size_t i = 0; i < Size; ++i, ++begin_iterator) {\n            *begin_iterator = extract(data, i);\n        }\n    }\n\n    /// Construct the Pointer object from the values returned by the scalar iterator \\p it.\n    Pointer(const T &it) : data(fromIterator<T, value_vector>(it)), begin_iterator(it) {}\n\nprivate:\n    /// The vectorized object needed for dereferencing the pointer.\n    value_vector data;\n    /// A copy of the scalar iterator, used for storing the results back.\n    T begin_iterator;\n};\n/**\\internal\n * The immutable variant of the Pointer class specialization above. It behaves the same as\n * the mutable Pointer except that it returns a const pointer from \\c operator-> and\n * avoids the write back in the destructor.\n */\ntemplate <typename T, typename value_vector> class Pointer<T, value_vector, Mutable::No>\n{\n    static constexpr auto Size = value_vector::size();\n\npublic:\n    const value_vector *operator->() const { return &data; }\n\n    Pointer() = delete;\n    Pointer(const Pointer &) = delete;\n    Pointer &operator=(const Pointer &) = delete;\n    Pointer &operator=(Pointer &&) = delete;\n\n    Pointer(Pointer &&) = default;  // required for returning the Pointer\n\n    Pointer(const T &it) : data(fromIterator<T, value_vector>(it)) {}\n\nprivate:\n    value_vector data;\n};\n\n/**\\internal\n * The Reference class behaves as much as possible like a reference to an object of type\n * \\p value_vector. The \\p Mutable parameter determines whether the referenced object my\n * be modified or not (basically whether it's a ref or a const-ref, though the semantics\n * of mutable are actually stricter than that of const. Const only determines the logical\n * constness whereas mutability identifies the constness on the bit-level.)\n *\n * \\tparam T The scalar iterator type.\n * \\tparam value_vector The vector object the scalar iterator needs to fill.\n * \\tparam M A flag that determines whether the reference acts as a mutable or immutable\n *           reference.\n */\ntemplate <typename T, typename value_vector, Mutable M> class Reference;\n\n///\\internal mutable specialization of the Reference proxy class\ntemplate <typename T, typename value_vector>\nclass Reference<T, value_vector, Mutable::Yes> : public value_vector\n{\n    static constexpr auto Size = value_vector::size();\n\n    using reference = typename std::add_lvalue_reference<T>::type;\n    reference scalar_it;\n\npublic:\n    /// Construct the reference from the given iterator \\p first_it and store a reference\n    /// to the iterator for write back in the assignment operator.\n    Reference(reference first_it)\n        : value_vector(fromIterator<T, value_vector>(first_it)), scalar_it(first_it)\n    {\n    }\n\n    /// disable all copy and move operations, except the one needed for function returns\n    Reference(const Reference &) = delete;\n    Reference(Reference &&) = default;\n    Reference &operator=(const Reference &) = delete;\n    Reference &operator=(Reference &&) = delete;\n\n    /**\n     * Assignment to the reference assigns to the storage pointed to by the scalar\n     * iterator as well as the reference object itself. (The compiler should eliminate the\n     * store to \\c this if it's never used since it is clearly a dead store.)\n     */\n    void operator=(const value_vector &x)\n    {\n        static_cast<value_vector &>(*this) = x;\n        auto it = scalar_it;\n        for (size_t i = 0; i < Size; ++i, ++it) {\n            *it = extract(x, i);\n        }\n    }\n};\n#define Vc_OP(op_)                                                                       \\\n    template <typename T0, typename V0, typename T1, typename V1>                        \\\n    decltype(std::declval<const V0 &>() op_ std::declval<const V1 &>()) operator op_(    \\\n        const Reference<T0, V0, Mutable::Yes> &x,                                        \\\n        const Reference<T1, V1, Mutable::Yes> &y)                                        \\\n    {                                                                                    \\\n        return static_cast<const V0 &>(x) op_ static_cast<const V1 &>(y);                \\\n    }\nVc_ALL_COMPARES(Vc_OP);\nVc_ALL_ARITHMETICS(Vc_OP);\nVc_ALL_BINARY(Vc_OP);\nVc_ALL_LOGICAL(Vc_OP);\nVc_ALL_SHIFTS(Vc_OP);\n#undef Vc_OP\n\n///\\internal immutable specialization of the Reference proxy class\ntemplate <typename T, typename value_vector>\nclass Reference<T, value_vector, Mutable::No> : public value_vector\n{\n    static constexpr auto Size = value_vector::size();\n\npublic:\n    Reference(const T &it) : value_vector(fromIterator<T, value_vector>(it)) {}\n\n    Reference(const Reference &) = delete;\n    Reference(Reference &&) = default;\n    Reference &operator=(const Reference &) = delete;\n    Reference &operator=(Reference &&) = delete;\n\n    /// Explicitly disable assignment to an immutable reference.\n    void operator=(const value_vector &x) = delete;\n};\n\ntemplate <typename T, size_t N,\n          IteratorDetails::Mutable M =\n              (Traits::is_output_iterator<T>::value ? Mutable::Yes : Mutable::No),\n          typename V = simdize<typename std::iterator_traits<T>::value_type, N>,\n          size_t Size = V::Size,\n          typename = typename std::iterator_traits<T>::iterator_category>\nclass Iterator;\n\ntemplate <typename T, size_t N, IteratorDetails::Mutable M, typename V, size_t Size_>\nclass Iterator<T, N, M, V, Size_, std::forward_iterator_tag>\n{\npublic:\n    using iterator_category = typename std::iterator_traits<T>::iterator_category;\n    using difference_type = typename std::iterator_traits<T>::difference_type;\n    using value_type = V;\n    using pointer = IteratorDetails::Pointer<T, V, M>;\n    using reference = IteratorDetails::Reference<T, V, M>;\n    using const_pointer = IteratorDetails::Pointer<T, V, IteratorDetails::Mutable::No>;\n    using const_reference =\n        IteratorDetails::Reference<T, V, IteratorDetails::Mutable::No>;\n\n    /// Returns the vector width the iterator covers with each step.\n    static constexpr std::size_t size() { return Size_; }\n    static constexpr std::size_t Size = Size_;\n\n    Iterator() = default;\n\n    /**\n     * A vectorizing iterator is typically initialized from a scalar iterator. The\n     * scalar iterator points to the first entry to place into the vectorized object.\n     * Subsequent entries returned by the iterator are used to fill the rest of the\n     * vectorized object.\n     */\n    Iterator(const T &x) : scalar_it(x) {}\n    /**\n     * Move optimization of the above constructor.\n     */\n    Iterator(T &&x) : scalar_it(std::move(x)) {}\n    /**\n     * Reset the vectorizing iterator to the given start point \\p x.\n     */\n    Iterator &operator=(const T &x)\n    {\n        scalar_it = x;\n        return *this;\n    }\n    /**\n     * Move optimization of the above constructor.\n     */\n    Iterator &operator=(T &&x)\n    {\n        scalar_it = std::move(x);\n        return *this;\n    }\n\n    /// Default copy constructor.\n    Iterator(const Iterator &) = default;\n    /// Default move constructor.\n    Iterator(Iterator &&) = default;\n    /// Default copy assignment.\n    Iterator &operator=(const Iterator &) = default;\n    /// Default move assignment.\n    Iterator &operator=(Iterator &&) = default;\n\n    /// Advances the iterator by one vector width, or respectively N scalar steps.\n    Iterator &operator++()\n    {\n        std::advance(scalar_it, Size);\n        return *this;\n    }\n    /// Postfix overload of the above.\n    Iterator operator++(int)\n    {\n        Iterator copy(*this);\n        operator++();\n        return copy;\n    }\n\n    /**\n     * Returns whether the two iterators point to the same scalar entry.\n     *\n     * \\warning If the end iterator you compare against is not a multiple of the SIMD\n     * width away from the incrementing iterator then the two iterators may pass each\n     * other without ever comparing equal. In debug builds (when NDEBUG is not\n     * defined) an assertion tries to locate such passing iterators.\n     */\n    bool operator==(const Iterator &rhs) const\n    {\n#ifndef NDEBUG\n        if (scalar_it == rhs.scalar_it) {\n            return true;\n        } else {\n            T it(scalar_it);\n            for (size_t i = 1; i < Size; ++i) {\n                Vc_ASSERT((++it != rhs.scalar_it));\n            }\n            return false;\n        }\n#else\n        return scalar_it == rhs.scalar_it;\n#endif\n    }\n    /**\n     * Returns whether the two iterators point to different scalar entries.\n     *\n     * \\warning If the end iterator you compare against is not a multiple of the SIMD\n     * width away from the incrementing iterator then the two iterators may pass each\n     * other without ever comparing equal. In debug builds (when NDEBUG is not\n     * defined) an assertion tries to locate such passing iterators.\n     */\n    bool operator!=(const Iterator &rhs) const\n    {\n        return !operator==(rhs);\n    }\n\n    pointer operator->() { return scalar_it; }\n\n    /**\n     * Returns a copy of the objects behind the iterator in a vectorized type. You can use\n     * the assignment operator to modify the values in the container referenced by the\n     * iterator. Use of any other mutating operation is undefined behavior and will most\n     * likely not be reflected in the container.\n     */\n    reference operator*() { return scalar_it; }\n\n    const_pointer operator->() const { return scalar_it; }\n\n    /**\n     * Returns a copy of the objects behind the iterator in a vectorized type.\n     *\n     * \\warning This does not behave like the standard iterator interface as it does not\n     * return an lvalue reference. Thus, changes to the container the iterator references\n     * will not be reflected in the reference object you receive.\n     */\n    const_reference operator*() const { return scalar_it; }\n\n    /**\n     * Returns a const lvalue reference to the underlying scalar iterator. This\n     * effectively allows you to cast simdized iterator objects to their scalar ancestor\n     * type.\n     *\n     * Example:\n     * \\code\n        const auto mask = *it == value_v;\n        if (any_of(mask)) {\n          return static_cast<ScalarIt>(it) + mask.firstOne();\n        }\n     * \\endcode\n     */\n    operator const T &() const { return scalar_it; }\n\nprotected:\n    T scalar_it;\n};\n\n/**\n * This is the iterator type created when applying simdize to a bidirectional\n * iterator type.\n */\ntemplate <typename T, size_t N, IteratorDetails::Mutable M, typename V, size_t Size>\nclass Iterator<T, N, M, V, Size, std::bidirectional_iterator_tag>\n    : public Iterator<T, N, M, V, Size, std::forward_iterator_tag>\n{\n    using Base = Iterator<T, N, M, V, Size, std::forward_iterator_tag>;\n\nprotected:\n    using Base::scalar_it;\n\npublic:\n    using pointer = typename Base::pointer;\n    using reference = typename Base::reference;\n    using const_pointer = typename Base::const_pointer;\n    using const_reference = typename Base::const_reference;\n\n    using Iterator<T, N, M, V, Size,\n                   std::forward_iterator_tag>::Iterator;  // in short: \"using\n                                                          // Base::Iterator\", but that\n                                                          // confuses ICC\n    /// Advances the iterator by one vector width, or respectively N scalar steps.\n    Iterator &operator--()\n    {\n        std::advance(scalar_it, -Size);\n        return *this;\n    }\n    /// Postfix overload of the above.\n    Iterator operator--(int)\n    {\n        Iterator copy(*this);\n        operator--();\n        return copy;\n    }\n};\n\n/**\n * This is the iterator type created when applying simdize to a random access iterator\n * type.\n */\ntemplate <typename T, size_t N, IteratorDetails::Mutable M, typename V, size_t Size>\nclass Iterator<T, N, M, V, Size, std::random_access_iterator_tag>\n    : public Iterator<T, N, M, V, Size, std::bidirectional_iterator_tag>\n{\n    using Base = Iterator<T, N, M, V, Size, std::bidirectional_iterator_tag>;\n\nprotected:\n    using Base::scalar_it;\n\npublic:\n    using pointer = typename Base::pointer;\n    using reference = typename Base::reference;\n    using const_pointer = typename Base::const_pointer;\n    using const_reference = typename Base::const_reference;\n    using difference_type = typename std::iterator_traits<T>::difference_type;\n\n    using Iterator<T, N, M, V, Size, std::bidirectional_iterator_tag>::\n        Iterator;  // in short: \"using Base::Iterator\", but that confuses ICC\n\n    Iterator &operator+=(difference_type n)\n    {\n        scalar_it += n * difference_type(Size);\n        return *this;\n    }\n    Iterator operator+(difference_type n) const { return Iterator(*this) += n; }\n\n    Iterator &operator-=(difference_type n)\n    {\n        scalar_it -= n * difference_type(Size);\n        return *this;\n    }\n    Iterator operator-(difference_type n) const { return Iterator(*this) -= n; }\n\n    difference_type operator-(const Iterator &rhs) const\n    {\n        constexpr difference_type n = Size;\n        Vc_ASSERT((scalar_it - rhs.scalar_it) % n ==\n                  0);  // if this fails the two iterators are not a multiple of the vector\n                       // width apart. The distance would be fractional and that doesn't\n                       // make too much sense for iteration. Therefore, it is a\n                       // precondition for the distance of the two iterators to be a\n                       // multiple of Size.\n        return (scalar_it - rhs.scalar_it) / n;\n    }\n\n    /**\n     * Returns whether all entries accessed via iterator dereferencing come before the\n     * iterator \\p rhs.\n     */\n    bool operator<(const Iterator &rhs) const\n    {\n        return rhs.scalar_it - scalar_it >= difference_type(Size);\n    }\n\n    bool operator>(const Iterator &rhs) const\n    {\n        return scalar_it - rhs.scalar_it >= difference_type(Size);\n    }\n\n    bool operator<=(const Iterator &rhs) const\n    {\n        return rhs.scalar_it - scalar_it >= difference_type(Size) - 1;\n    }\n\n    bool operator>=(const Iterator &rhs) const\n    {\n        return scalar_it - rhs.scalar_it >= difference_type(Size) - 1;\n    }\n\n    reference operator[](difference_type i) { return *(*this + i); }\n    const_reference operator[](difference_type i) const { return *(*this + i); }\n};\n\ntemplate <typename T, size_t N, IteratorDetails::Mutable M, typename V, size_t Size>\nIterator<T, N, M, V, Size, std::random_access_iterator_tag> operator+(\n    typename Iterator<T, N, M, V, Size, std::random_access_iterator_tag>::difference_type\n        n,\n    const Iterator<T, N, M, V, Size, std::random_access_iterator_tag> &i)\n{\n    return i + n;\n}\n\n}  // namespace IteratorDetails }}}\n\n/**\\internal\n *\n * Creates a member type \\p type that acts as a vectorizing bidirectional iterator.\n *\n * \\tparam T The bidirectional iterator type to be transformed.\n * \\tparam N The width the resulting vectorized type should have.\n * \\tparam MT The base type to use for mask types. Ignored for this specialization.\n */\ntemplate <typename T, size_t N, typename MT>\nstruct ReplaceTypes<T, N, MT, Category::ForwardIterator>\n{\n    using type = IteratorDetails::Iterator<T, N>;\n};\ntemplate <typename T, size_t N, typename MT>\nstruct ReplaceTypes<T, N, MT, Category::BidirectionalIterator>\n{\n    using type = IteratorDetails::Iterator<T, N>;\n};\ntemplate <typename T, size_t N, typename MT>\nstruct ReplaceTypes<T, N, MT, Category::RandomAccessIterator>\n{\n    using type = IteratorDetails::Iterator<T, N>;\n};\n\n/**\\internal\n * Implementation for conditional assignment of whole vectorized objects.\n */\ntemplate <Vc::Operator Op, typename S, typename T, std::size_t N, typename M, typename U,\n          std::size_t Offset>\nVc_INTRINSIC Vc::enable_if<(Offset >= determine_tuple_size_<S>::value && M::Size == N), void>\n    conditional_assign(Adapter<S, T, N> &, const M &, const U &)\n{\n}\ntemplate <Vc::Operator Op, typename S, typename T, std::size_t N, typename M, typename U,\n          std::size_t Offset = 0>\nVc_INTRINSIC Vc::enable_if<(Offset < determine_tuple_size_<S>::value && M::Size == N), void>\n    conditional_assign(Adapter<S, T, N> &lhs, const M &mask, const U &rhs)\n{\n    using V = typename std::decay<decltype(get_dispatcher<Offset>(lhs))>::type;\n    using M2 = typename V::mask_type;\n    conditional_assign<Op>(get_dispatcher<Offset>(lhs), simd_cast<M2>(mask), get_dispatcher<Offset>(rhs));\n    conditional_assign<Op, S, T, N, M, U, Offset + 1>(lhs, mask, rhs);\n}\ntemplate <Vc::Operator Op, typename S, typename T, std::size_t N, typename M,\n          std::size_t Offset>\nVc_INTRINSIC Vc::enable_if<(Offset >= determine_tuple_size_<S>::value && M::Size == N), void>\n    conditional_assign(Adapter<S, T, N> &, const M &)\n{\n}\ntemplate <Vc::Operator Op, typename S, typename T, std::size_t N, typename M,\n          std::size_t Offset = 0>\nVc_INTRINSIC Vc::enable_if<(Offset < determine_tuple_size_<S>::value && M::Size == N), void>\n    conditional_assign(Adapter<S, T, N> &lhs, const M &mask)\n{\n    using V = typename std::decay<decltype(get_dispatcher<Offset>(lhs))>::type;\n    using M2 = typename V::mask_type;\n    conditional_assign<Op>(get_dispatcher<Offset>(lhs), simd_cast<M2>(mask));\n    conditional_assign<Op, S, T, N, M, Offset + 1>(lhs, mask);\n}\n\n/** @}*/\n}  // namespace SimdizeDetail\n\n// user API {{{\n/*!\\ingroup Simdize\n * Vectorize/Simdize the given type T.\n *\n * \\tparam T This type must be a class template instance where the template arguments can\n * be recursively replaced with their vectorized variant. If the type implements a\n * specific interface for introspection and member modification, the resulting type can\n * easily be constructed from objects of type T and scalar objects of type T can be\n * extracted from it.\n *\n * \\tparam N This value determines the width of the vectorization. Per default it is set\n * to 0 making the implementation choose the value considering the compilation target and\n * the given type T.\n *\n * \\tparam MT This type determines the type to be used when replacing bool with Mask<MT>.\n * If it is set to void the implementation choosed the type as smart as possible.\n *\n * \\see Vc_SIMDIZE_STRUCT, Vc_SIMDIZE_MEMBER\n */\ntemplate <typename T, size_t N = 0, typename MT = void>\nusing simdize = SimdizeDetail::simdize<T, N, MT>;\n\n/*!\\ingroup Simdize\n * Declares functions and constants for introspection by the simdize functions. This\n * allows e.g. conversion between scalar \\c T and \\c simdize<T>.\n *\n * \\param MEMBERS_ The data members of this struct/class listed inside extra parenthesis.\n * The extra parenthesis are required because the macro would otherwise see a variable\n * number of arguments.\n *\n * Example:\n * \\code\n * template <typename T, typename U> struct X {\n *   T a;\n *   U b;\n *   Vc_SIMDIZE_INTERFACE((a, b));\n * };\n * \\endcode\n *\n * \\note You must use this macros in the public section of a class.\n */\n#define Vc_SIMDIZE_INTERFACE(MEMBERS_)                                                   \\\n    template <std::size_t N_>                                                            \\\n    inline auto vc_get_()->decltype(std::get<N_>(std::tie MEMBERS_))                     \\\n    {                                                                                    \\\n        return std::get<N_>(std::tie MEMBERS_);                                          \\\n    }                                                                                    \\\n    template <std::size_t N_>                                                            \\\n    inline auto vc_get_() const->decltype(std::get<N_>(std::tie MEMBERS_))               \\\n    {                                                                                    \\\n        return std::get<N_>(std::tie MEMBERS_);                                          \\\n    }                                                                                    \\\n    enum : std::size_t {                                                                 \\\n        tuple_size = std::tuple_size<decltype(std::make_tuple MEMBERS_)>::value          \\\n    }\n// }}}\n}  // namespace Vc\n\nnamespace std  // {{{\n{\nusing Vc::SimdizeDetail::swap;\n}  // namespace std }}}\n\n#endif  // VC_COMMON_SIMDIZE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/simdmaskarray.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SIMDMASKARRAY_H_\n#define VC_COMMON_SIMDMASKARRAY_H_\n\n#include <type_traits>\n#include <array>\n#include \"simdarrayhelper.h\"\n#include \"utility.h\"\n#include \"maskbool.h\"\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/// \\addtogroup SimdArray\n/// @{\n// atomic SimdMaskArray {{{1\n/**\\internal\n * Specialization of `SimdMaskArray<T, N, VectorType, VectorSize>` for the case where `N\n * == VectorSize`.\n *\n * This is specialized for implementation purposes: Since the general implementation uses\n * two SimdMaskArray data members it recurses over different SimdMaskArray instantiations.\n * The recursion is ended by this specialization, which has a single \\p storage_type data\n * member to which all functions are forwarded more or less directly.\n */\ntemplate <typename T, std::size_t N, typename VectorType_>\nclass SimdMaskArray<T, N, VectorType_, N>\n{\npublic:\n    using VectorType = VectorType_;\n    using vector_type = VectorType;\n    using mask_type = typename vector_type::Mask;\n    using storage_type = mask_type;\n\n    friend storage_type &internal_data(SimdMaskArray &m) { return m.data; }\n    friend const storage_type &internal_data(const SimdMaskArray &m) { return m.data; }\n\n    static constexpr std::size_t size() { return N; }\n    static constexpr std::size_t Size = size();\n    static constexpr std::size_t MemoryAlignment = storage_type::MemoryAlignment;\n    static_assert(Size == vector_type::Size, \"size mismatch\");\n\n    using vectorentry_type = typename mask_type::VectorEntryType;\n    using value_type = typename mask_type::EntryType;\n    using Mask = mask_type;\n    using VectorEntryType = vectorentry_type;\n    using EntryType = value_type;\n    using EntryReference = Vc::Detail::ElementReference<storage_type, SimdMaskArray>;\n    using reference = EntryReference;\n    using Vector = fixed_size_simd<T, N>;\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(mask_type));\n\n    // zero init\n    SimdMaskArray() = default;\n\n    // default copy ctor/operator\n    SimdMaskArray(const SimdMaskArray &) = default;\n    SimdMaskArray(SimdMaskArray &&) = default;\n    SimdMaskArray &operator=(const SimdMaskArray &) = default;\n    SimdMaskArray &operator=(SimdMaskArray &&) = default;\n\n    // broadcasts\n    Vc_INTRINSIC explicit SimdMaskArray(VectorSpecialInitializerOne one) : data(one) {}\n    Vc_INTRINSIC explicit SimdMaskArray(VectorSpecialInitializerZero zero) : data(zero) {}\n    Vc_INTRINSIC explicit SimdMaskArray(bool b) : data(b) {}\n    Vc_INTRINSIC static SimdMaskArray Zero() { return {private_init, storage_type::Zero()}; }\n    Vc_INTRINSIC static SimdMaskArray One() { return {private_init, storage_type::One()}; }\n\n    // conversion (casts); implemented in simd_cast_caller.tcc\n    template <class U, class V, class = enable_if<N == V::Size>>\n    Vc_INTRINSIC_L SimdMaskArray(const SimdMaskArray<U, N, V> &x) Vc_INTRINSIC_R;\n    template <class U, class V, class = enable_if<(N > V::Size && N <= 2 * V::Size)>,\n              class = U>\n    Vc_INTRINSIC_L SimdMaskArray(const SimdMaskArray<U, N, V> &x) Vc_INTRINSIC_R;\n    template <class U, class V, class = enable_if<(N > 2 * V::Size && N <= 4 * V::Size)>,\n              class = U, class = U>\n    Vc_INTRINSIC_L SimdMaskArray(const SimdMaskArray<U, N, V> &x) Vc_INTRINSIC_R;\n\n    // conversion from any Segment object (could be SimdMaskArray or Mask<T>)\n    template <typename M, std::size_t Pieces, std::size_t Index>\n    Vc_INTRINSIC_L SimdMaskArray(\n        Common::Segment<M, Pieces, Index> &&x,\n        enable_if<Traits::simd_vector_size<M>::value == Size * Pieces> = nullarg) Vc_INTRINSIC_R;\n\n    // conversion from Mask<T>\n    template <class M, class = enable_if<(Traits::is_simd_mask<M>::value &&\n                                          !Traits::isSimdMaskArray<M>::value &&\n                                          Traits::simd_vector_size<M>::value == Size)>>\n    Vc_INTRINSIC_L SimdMaskArray(M k) Vc_INTRINSIC_R;\n\n    // implicit conversion to Mask<U, AnyAbi> for if Mask<U, AnyAbi>::size() == N\n    template <class U, class A,\n              class = enable_if<Vc::Mask<U, A>::Size == N &&\n                                !detail::is_fixed_size_abi<A>::value>>\n    operator Vc::Mask<U, A>() const\n    {\n        return simd_cast<Vc::Mask<U, A>>(data);\n    }\n    operator fixed_size_simd_mask<T, N> &()\n    {\n        return static_cast<fixed_size_simd_mask<T, N> &>(*this);\n    }\n    operator const fixed_size_simd_mask<T, N> &() const\n    {\n        return static_cast<const fixed_size_simd_mask<T, N> &>(*this);\n    }\n\n    // load/store (from/to bool arrays)\n    template <typename Flags = DefaultLoadTag>\n    Vc_INTRINSIC explicit SimdMaskArray(const bool *mem, Flags f = Flags())\n        : data(mem, f)\n    {\n    }\n\n    Vc_INTRINSIC void load(const bool *mem) { data.load(mem); }\n    template <typename Flags> Vc_INTRINSIC void load(const bool *mem, Flags f)\n    {\n        data.load(mem, f);\n    }\n\n    Vc_INTRINSIC void store(bool *mem) const { data.store(mem); }\n    template <typename Flags> Vc_INTRINSIC void store(bool *mem, Flags f) const\n    {\n        data.store(mem, f);\n    }\n\n    // compares\n    Vc_INTRINSIC Vc_PURE bool operator==(const SimdMaskArray &rhs) const\n    {\n        return data == rhs.data;\n    }\n    Vc_INTRINSIC Vc_PURE bool operator!=(const SimdMaskArray &rhs) const\n    {\n        return data != rhs.data;\n    }\n\n    // inversion\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator!() const\n    {\n        return {private_init, !data};\n    }\n\n    // binary operators\n    Vc_INTRINSIC SimdMaskArray &operator&=(const SimdMaskArray &rhs)\n    {\n        data &= rhs.data;\n        return *this;\n    }\n    Vc_INTRINSIC SimdMaskArray &operator|=(const SimdMaskArray &rhs)\n    {\n        data |= rhs.data;\n        return *this;\n    }\n    Vc_INTRINSIC SimdMaskArray &operator^=(const SimdMaskArray &rhs)\n    {\n        data ^= rhs.data;\n        return *this;\n    }\n\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator&(\n        const SimdMaskArray &rhs) const\n    {\n        return {private_init, data & rhs.data};\n    }\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator|(\n        const SimdMaskArray &rhs) const\n    {\n        return {private_init, data | rhs.data};\n    }\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator^(\n        const SimdMaskArray &rhs) const\n    {\n        return {private_init, data ^ rhs.data};\n    }\n\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator&&(\n        const SimdMaskArray &rhs) const\n    {\n        return {private_init, data && rhs.data};\n    }\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator||(\n        const SimdMaskArray &rhs) const\n    {\n        return {private_init, data || rhs.data};\n    }\n\n    Vc_INTRINSIC Vc_PURE bool isFull() const { return data.isFull(); }\n    Vc_INTRINSIC Vc_PURE bool isNotEmpty() const { return data.isNotEmpty(); }\n    Vc_INTRINSIC Vc_PURE bool isEmpty() const { return data.isEmpty(); }\n    Vc_INTRINSIC Vc_PURE bool isMix() const { return data.isMix(); }\n\n    Vc_INTRINSIC Vc_PURE int shiftMask() const { return data.shiftMask(); }\n\n    Vc_INTRINSIC Vc_PURE int toInt() const { return data.toInt(); }\n\nprivate:\n    friend reference;\n    static Vc_INTRINSIC value_type get(const storage_type &k, int i) noexcept\n    {\n        return k[i];\n    }\n    template <typename U>\n    static Vc_INTRINSIC void set(storage_type &k, int i, U &&v) noexcept(\n        noexcept(std::declval<storage_type &>()[0] = std::declval<U>()))\n    {\n        k[i] = std::forward<U>(v);\n    }\n\npublic:\n    /**\n     * \\note the returned object models the concept of a reference and\n     * as such it can exist longer than the data it is referencing.\n     * \\note to avoid lifetime issues, we strongly advice not to store\n     * any reference objects.\n     */\n    Vc_INTRINSIC Vc_PURE reference operator[](size_t index) noexcept\n    {\n        return {data, int(index)};\n    }\n    Vc_INTRINSIC Vc_PURE value_type operator[](size_t index) const noexcept\n    {\n        return data[index];\n    }\n\n    Vc_INTRINSIC Vc_PURE int count() const { return data.count(); }\n\n    /**\n     * Returns the index of the first one in the mask.\n     *\n     * The return value is undefined if the mask is empty.\n     */\n    Vc_INTRINSIC Vc_PURE int firstOne() const { return data.firstOne(); }\n\n    template <typename G>\n    static Vc_INTRINSIC fixed_size_simd_mask<T, N> generate(const G &gen)\n    {\n        return {private_init, mask_type::generate(gen)};\n    }\n\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> shifted(int amount) const\n    {\n        return {private_init, data.shifted(amount)};\n    }\n\n    /// \\internal execute specified Operation\n    template <typename Op, typename... Args>\n    static Vc_INTRINSIC fixed_size_simd_mask<T, N> fromOperation(Op op, Args &&... args)\n    {\n        fixed_size_simd_mask<T, N> r;\n        Common::unpackArgumentsAuto(op, r.data, std::forward<Args>(args)...);\n        return r;\n    }\n\n    /// \\internal\n    Vc_INTRINSIC SimdMaskArray(private_init_t, mask_type &&x) : data(std::move(x)) {}\n\nprivate:\n    // The alignas attribute attached to the class declaration above is ignored by ICC\n    // 17.0.0 (at least). So just move the alignas attribute down here where it works for\n    // all compilers.\n    alignas(static_cast<std::size_t>(\n        Common::BoundedAlignment<Common::NextPowerOfTwo<N>::value * sizeof(VectorType_) /\n                                 VectorType_::size()>::value)) storage_type data;\n};\n\ntemplate <typename T, std::size_t N, typename VectorType> constexpr std::size_t SimdMaskArray<T, N, VectorType, N>::Size;\ntemplate <typename T, std::size_t N, typename VectorType>\nconstexpr std::size_t SimdMaskArray<T, N, VectorType, N>::MemoryAlignment;\n\n// generic SimdMaskArray {{{1\n/**\n * Data-parallel mask type with user-defined number of boolean elements.\n *\n * \\tparam T The value type of the corresponding SimdArray. Depending on the target\n *           platform this type determines a different bit representation to work most\n *           efficient with SimdArray types instantiated for \\p T.\n *\n * \\tparam N The number of boolean elements to store and process concurrently. You can\n *           choose an arbitrary number, though not every number is a good idea.\n *           Generally, a power of two value or the sum of two power of two values might\n *           work efficiently, though this depends a lot on the target system.\n *\n * \\tparam V Don't change the default value unless you really know what you are doing.\n *           This type is set to the underlying native Vc::Vector type used in the\n *           implementation of the type.\n *           Having it as part of the type name guards against some cases of ODR\n *           violations (i.e. linking incompatible translation units / libraries).\n *\n * \\tparam Wt Don't ever change the default value.\n *           This parameter is an unfortunate implementation detail shining through.\n *\n * \\headerfile simdmaskarray.h <Vc/SimdArray>\n */\ntemplate <typename T, size_t N, typename V, size_t Wt>\nclass SimdMaskArray\n{\n    static constexpr std::size_t N0 = Common::left_size<N>();\n\n    using Split = Common::Split<N0>;\n\npublic:\n    using storage_type0 = fixed_size_simd_mask<T, N0>;\n    using storage_type1 = fixed_size_simd_mask<T, N - N0>;\n    static_assert(storage_type0::size() == N0, \"\");\n\n    using vector_type = fixed_size_simd<T, N>;\n\n    friend storage_type0 &internal_data0(SimdMaskArray &m) { return m.data0; }\n    friend storage_type1 &internal_data1(SimdMaskArray &m) { return m.data1; }\n    friend const storage_type0 &internal_data0(const SimdMaskArray &m) { return m.data0; }\n    friend const storage_type1 &internal_data1(const SimdMaskArray &m) { return m.data1; }\n\n    using mask_type = SimdMaskArray;\n\n    ///\\copydoc Mask::size()\n    static constexpr std::size_t size() { return N; }\n    ///\\copydoc Mask::Size\n    static constexpr std::size_t Size = size();\n    ///\\copydoc Mask::MemoryAlignment\n    static constexpr std::size_t MemoryAlignment =\n        storage_type0::MemoryAlignment > storage_type1::MemoryAlignment\n            ? storage_type0::MemoryAlignment\n            : storage_type1::MemoryAlignment;\n    static_assert(Size == vector_type::Size, \"size mismatch\");\n\n    ///\\internal\n    using vectorentry_type = typename storage_type0::VectorEntryType;\n\n    ///\\copydoc Mask::value_type\n    using value_type = typename storage_type0::EntryType;\n    ///\\copydoc Mask::Mask\n    using MaskType = mask_type;\n    ///\\copydoc Mask::VectorEntryType\n    using VectorEntryType = vectorentry_type;\n    ///\\copydoc Mask::EntryType\n    using EntryType = value_type;\n    ///\\copydoc Mask::EntryReference\n    using EntryReference = Vc::Detail::ElementReference<SimdMaskArray>;\n    using reference = EntryReference;\n    /// An alias for the corresponding SimdArray type.\n    using Vector = fixed_size_simd<T, N>;\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(mask_type));\n\n    // zero init\n    ///\\copydoc Mask::Mask()\n    SimdMaskArray() = default;\n\n    // default copy ctor/operator\n    SimdMaskArray(const SimdMaskArray &) = default;\n    SimdMaskArray(SimdMaskArray &&) = default;\n    SimdMaskArray &operator=(const SimdMaskArray &) = default;\n    SimdMaskArray &operator=(SimdMaskArray &&) = default;\n\n    // implicit conversion from SimdMaskArray with same N\n    template <typename U, typename W>\n    Vc_INTRINSIC SimdMaskArray(const SimdMaskArray<U, N, W> &rhs)\n        : data0(Split::lo(rhs)), data1(Split::hi(rhs))\n    {\n    }\n\n    // conversion from any Segment object (could be SimdMaskArray or Mask<T>)\n    template <typename M, std::size_t Pieces, std::size_t Index>\n    Vc_INTRINSIC SimdMaskArray(\n        Common::Segment<M, Pieces, Index> &&rhs,\n        enable_if<Traits::simd_vector_size<M>::value == Size * Pieces> = nullarg)\n        : data0(Split::lo(rhs)), data1(Split::hi(rhs))\n    {\n    }\n\n    // conversion from Mask<T>\n    template <class M, class = enable_if<(Traits::is_simd_mask<M>::value &&\n                                          !Traits::isSimdMaskArray<M>::value &&\n                                          Traits::simd_vector_size<M>::value == Size)>>\n    Vc_INTRINSIC SimdMaskArray(M k) : data0(Split::lo(k)), data1(Split::hi(k))\n    {\n    }\n\n    // implicit conversion to Mask<U, AnyAbi> for if Mask<U, AnyAbi>::size() == N\n    template <class U, class A,\n              class = enable_if<Vc::Mask<U, A>::Size == N &&\n                                !detail::is_fixed_size_abi<A>::value>>\n    operator Vc::Mask<U, A>() const\n    {\n        return simd_cast<Vc::Mask<U, A>>(data0, data1);\n    }\n    Vc_INTRINSIC operator fixed_size_simd_mask<T, N> &()\n    {\n        return static_cast<fixed_size_simd_mask<T, N> &>(*this);\n    }\n    Vc_INTRINSIC operator const fixed_size_simd_mask<T, N> &() const\n    {\n        return static_cast<const fixed_size_simd_mask<T, N> &>(*this);\n    }\n\n    ///\\copybrief Mask::Mask(VectorSpecialInitializerOne)\n    Vc_INTRINSIC explicit SimdMaskArray(VectorSpecialInitializerOne one)\n        : data0(one), data1(one)\n    {\n    }\n    ///\\copybrief Mask::Mask(VectorSpecialInitializerZero)\n    Vc_INTRINSIC explicit SimdMaskArray(VectorSpecialInitializerZero zero)\n        : data0(zero), data1(zero)\n    {\n    }\n    ///\\copydoc Mask::Mask(bool)\n    Vc_INTRINSIC explicit SimdMaskArray(bool b) : data0(b), data1(b) {}\n\n    ///\\copydoc Mask::Zero()\n    Vc_INTRINSIC static fixed_size_simd_mask<T, N> Zero()\n    {\n        return {storage_type0::Zero(), storage_type1::Zero()};\n    }\n    ///\\copydoc Mask::One()\n    Vc_INTRINSIC static fixed_size_simd_mask<T, N> One()\n    {\n        return {storage_type0::One(), storage_type1::One()};\n    }\n\n    ///\\name Loads & Stores\n    ///@{\n\n    /**\n     * Load N boolean values from the consecutive addresses starting at \\p mem.\n     *\n     * \\param mem A pointer to an array of booleans.\n     * \\param f A combination of flags to modify specific behavior of the load.\n     */\n    template <typename Flags = DefaultLoadTag>\n    Vc_INTRINSIC explicit SimdMaskArray(const bool *mem, Flags f = Flags())\n        : data0(mem, f), data1(mem + storage_type0::size(), f)\n    {\n    }\n\n    /**\n     * Load N boolean values from the consecutive addresses starting at \\p mem.\n     *\n     * \\param mem A pointer to an array of booleans.\n     */\n    Vc_INTRINSIC void load(const bool *mem)\n    {\n        data0.load(mem);\n        data1.load(mem + storage_type0::size());\n    }\n\n    /**\n     * Load N boolean values from the consecutive addresses starting at \\p mem.\n     *\n     * \\param mem A pointer to an array of booleans.\n     * \\param f A combination of flags to modify specific behavior of the load.\n     */\n    template <typename Flags> Vc_INTRINSIC void load(const bool *mem, Flags f)\n    {\n        data0.load(mem, f);\n        data1.load(mem + storage_type0::size(), f);\n    }\n\n    /**\n     * Store N boolean values to the consecutive addresses starting at \\p mem.\n     *\n     * \\param mem A pointer to an array of booleans.\n     */\n    Vc_INTRINSIC void store(bool *mem) const\n    {\n        data0.store(mem);\n        data1.store(mem + storage_type0::size());\n    }\n\n    /**\n     * Store N boolean values to the consecutive addresses starting at \\p mem.\n     *\n     * \\param mem A pointer to an array of booleans.\n     * \\param f A combination of flags to modify specific behavior of the load.\n     */\n    template <typename Flags> Vc_INTRINSIC void store(bool *mem, Flags f) const\n    {\n        data0.store(mem, f);\n        data1.store(mem + storage_type0::size(), f);\n    }\n    ///@}\n\n    ///\\copydoc Mask::operator==\n    Vc_INTRINSIC Vc_PURE bool operator==(const SimdMaskArray &mask) const\n    {\n        return data0 == mask.data0 && data1 == mask.data1;\n    }\n    ///\\copydoc Mask::operator!=\n    Vc_INTRINSIC Vc_PURE bool operator!=(const SimdMaskArray &mask) const\n    {\n        return data0 != mask.data0 || data1 != mask.data1;\n    }\n\n    ///\\copybrief Mask::operator!\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator!() const\n    {\n        return {!data0, !data1};\n    }\n\n    ///\\copybrief Mask::operator&=\n    Vc_INTRINSIC SimdMaskArray &operator&=(const SimdMaskArray &rhs)\n    {\n        data0 &= rhs.data0;\n        data1 &= rhs.data1;\n        return *this;\n    }\n    ///\\copybrief Mask::operator|=\n    Vc_INTRINSIC SimdMaskArray &operator|=(const SimdMaskArray &rhs)\n    {\n        data0 |= rhs.data0;\n        data1 |= rhs.data1;\n        return *this;\n    }\n    ///\\copybrief Mask::operator^=\n    Vc_INTRINSIC SimdMaskArray &operator^=(const SimdMaskArray &rhs)\n    {\n        data0 ^= rhs.data0;\n        data1 ^= rhs.data1;\n        return *this;\n    }\n\n    ///\\copybrief Mask::operator&\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator&(\n        const SimdMaskArray &rhs) const\n    {\n        return {data0 & rhs.data0, data1 & rhs.data1};\n    }\n    ///\\copybrief Mask::operator|\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator|(\n        const SimdMaskArray &rhs) const\n    {\n        return {data0 | rhs.data0, data1 | rhs.data1};\n    }\n    ///\\copybrief Mask::operator^\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator^(\n        const SimdMaskArray &rhs) const\n    {\n        return {data0 ^ rhs.data0, data1 ^ rhs.data1};\n    }\n\n    ///\\copybrief Mask::operator&&\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator&&(\n        const SimdMaskArray &rhs) const\n    {\n        return {data0 && rhs.data0, data1 && rhs.data1};\n    }\n    ///\\copybrief Mask::operator||\n    Vc_INTRINSIC Vc_PURE fixed_size_simd_mask<T, N> operator||(\n        const SimdMaskArray &rhs) const\n    {\n        return {data0 || rhs.data0, data1 || rhs.data1};\n    }\n\n    ///\\copybrief Mask::isFull\n    Vc_INTRINSIC Vc_PURE bool isFull() const { return data0.isFull() && data1.isFull(); }\n    ///\\copybrief Mask::isNotEmpty\n    Vc_INTRINSIC Vc_PURE bool isNotEmpty() const { return data0.isNotEmpty() || data1.isNotEmpty(); }\n    ///\\copybrief Mask::isEmpty\n    Vc_INTRINSIC Vc_PURE bool isEmpty() const { return data0.isEmpty() && data1.isEmpty(); }\n    ///\\copybrief Mask::isMix\n    Vc_INTRINSIC Vc_PURE bool isMix() const { return !isFull() && !isEmpty(); }\n\n    ///\\copydoc Mask::toInt\n    Vc_INTRINSIC Vc_PURE int toInt() const\n    {\n        return data0.toInt() | (data1.toInt() << data0.size());\n    }\n\nprivate:\n    friend reference;\n    static Vc_INTRINSIC value_type get(const SimdMaskArray &o, int i) noexcept\n    {\n        if (i < int(o.data0.size())) {\n            return o.data0[i];\n        } else {\n            return o.data1[i - o.data0.size()];\n        }\n    }\n    template <typename U>\n    static Vc_INTRINSIC void set(SimdMaskArray &o, int i, U &&v) noexcept(\n        noexcept(std::declval<storage_type0 &>()[0] = std::declval<U>()) &&\n        noexcept(std::declval<storage_type1 &>()[0] = std::declval<U>()))\n    {\n        if (i < int(o.data0.size())) {\n            o.data0[i] = std::forward<U>(v);\n        } else {\n            o.data1[i - o.data0.size()] = std::forward<U>(v);\n        }\n    }\n\npublic:\n    /**\n     * Return a smart reference to the boolean element at index \\p index.\n     *\n     * \\param index The element index to be accessed.\n     *\n     * \\returns A temporary smart reference object which acts as much as an lvalue\n     * reference as possible.\n     */\n    Vc_INTRINSIC Vc_PURE reference operator[](size_t index) noexcept\n    {\n        return {*this, int(index)};\n    }\n    /**\n     * Return a copy of the boolean element at index \\p index.\n     *\n     * \\param index The element index to be accessed.\n     *\n     * \\returns A temporary boolean object with the value of the element at index \\p\n     * index.\n     */\n    Vc_INTRINSIC Vc_PURE value_type operator[](size_t index) const noexcept\n    {\n        return get(*this, index);\n    }\n\n    ///\\copybrief Mask::count\n    Vc_INTRINSIC Vc_PURE int count() const { return data0.count() + data1.count(); }\n\n    ///\\copydoc Mask::firstOne\n    Vc_INTRINSIC Vc_PURE int firstOne() const {\n        if (data0.isEmpty()) {\n            return data1.firstOne() + storage_type0::size();\n        }\n        return data0.firstOne();\n    }\n\n    ///\\copybrief Mask::generate\n    template <typename G>\n    static Vc_INTRINSIC fixed_size_simd_mask<T, N> generate(const G &gen)\n    {\n        return {storage_type0::generate(gen),\n                storage_type1::generate([&](std::size_t i) { return gen(i + N0); })};\n    }\n\n    ///\\copybrief Mask::shifted\n    inline Vc_PURE fixed_size_simd_mask<T, N> shifted(int amount) const\n    {\n        if (Vc_IS_UNLIKELY(amount == 0)) {\n            return *this;\n        }\n        return generate([&](unsigned i) {\n            // modulo arithmetic of unsigned makes the check for j >= 0 unnecessary\n            const unsigned j = i + amount;\n            return j < size() ? get(*this, j) : false;\n        });\n    }\n\n    /// \\internal execute specified Operation\n    template <typename Op, typename... Args>\n    static Vc_INTRINSIC fixed_size_simd_mask<T, N> fromOperation(Op op, Args &&... args)\n    {\n        fixed_size_simd_mask<T, N> r = {\n            storage_type0::fromOperation(op, Split::lo(args)...),  // no forward here - it\n                                                                   // could move and thus\n                                                                   // break the next line\n            storage_type1::fromOperation(op, Split::hi(std::forward<Args>(args))...)};\n        return r;\n    }\n\n    /// \\internal\n    Vc_INTRINSIC SimdMaskArray(storage_type0 &&x, storage_type1 &&y)\n        : data0(std::move(x)), data1(std::move(y))\n    {\n    }\n\nprivate:\n    // The alignas attribute attached to the class declaration above is ignored by ICC\n    // 17.0.0 (at least). So just move the alignas attribute down here where it works for\n    // all compilers.\n    alignas(static_cast<std::size_t>(\n        Common::BoundedAlignment<Common::NextPowerOfTwo<N>::value * sizeof(V) /\n                                 V::size()>::value)) storage_type0 data0;\n    storage_type1 data1;\n};\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nconstexpr std::size_t SimdMaskArray<T, N, V, M>::Size;\ntemplate <typename T, std::size_t N, typename V, std::size_t M>\nconstexpr std::size_t SimdMaskArray<T, N, V, M>::MemoryAlignment;\n\n///}}}1\n/// @}\n\n}  // namespace Vc\n\n// XXX: this include should be in <Vc/vector.h>. But at least clang 3.4 then fails to compile the\n// code. Not sure yet what is going on, but it looks a lot like a bug in clang.\n#include \"simd_cast_caller.tcc\"\n\n#endif // VC_COMMON_SIMDMASKARRAY_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/span.h",
    "content": "// -*- C++ -*-\n//===------------------------------ span ---------------------------------===//\n//\n//                     The LLVM Compiler Infrastructure\n//\n// This file is dual licensed under the MIT and the University of Illinois Open\n// Source Licenses. See LICENSE.TXT for details.\n//\n// Adapted for use with Vc:\n// Copyright © 2018 Matthias Kretz <kretz@kde.org>\n//===---------------------------------------------------------------------===//\n\n#ifndef VC_COMMON_SPAN_H_\n#define VC_COMMON_SPAN_H_\n\n#include <array>        // for array\n#include <cstddef>      // for ptrdiff_t\n#include <cstddef>      // for std::byte\n#include <iterator>     // for iterators\n#include <type_traits>  // for remove_cv, etc\n#include \"subscript.h\"  // for AdaptSubscriptOperator\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n#ifdef __cpp_inline_variables\ninline\n#endif\n    constexpr ptrdiff_t dynamic_extent = -1;\nnamespace Common\n{\ntemplate <typename T, ptrdiff_t Extent = dynamic_extent> class span;\n\ntemplate <typename T, ptrdiff_t Extent>\nconstexpr auto begin(const span<T, Extent>& s) noexcept -> decltype(s.begin())\n{\n    return s.begin();\n}\ntemplate <typename T, ptrdiff_t Extent>\nconstexpr auto end(const span<T, Extent>& s) noexcept -> decltype(s.end())\n{\n    return s.end();\n}\n\ntemplate <class T> struct _is_span_impl : public std::false_type {\n};\n\ntemplate <class T, ptrdiff_t Extent>\nstruct _is_span_impl<span<T, Extent>> : public std::true_type {\n};\n\ntemplate <class T>\nstruct _is_span : public _is_span_impl<typename std::remove_cv<T>::type> {\n};\n\ntemplate <class T> struct _is_std_array_impl : public std::false_type {\n};\n\ntemplate <class T, size_t Sz>\nstruct _is_std_array_impl<array<T, Sz>> : public std::true_type {\n};\n\ntemplate <class T>\nstruct _is_std_array : public _is_std_array_impl<typename std::remove_cv<T>::type> {\n};\n\ntemplate <class T, class ElementType, class = void>\nstruct _is_span_compatible_container : public std::false_type {\n};\n\ntemplate <class... Ts> using _void_t = void;\n\ntemplate <class C> constexpr auto _std_data(C& c) -> decltype(c.data())\n{\n    return c.data();\n}\ntemplate <class C> constexpr auto _std_data(const C& c) -> decltype(c.data())\n{\n    return c.data();\n}\ntemplate <class T, std::size_t N> constexpr T* _std_data(T (&array)[N]) noexcept\n{\n    return array;\n}\ntemplate <class E> constexpr const E* _std_data(std::initializer_list<E> il) noexcept\n{\n    return il.begin();\n}\n\ntemplate <class C> constexpr auto _std_size(const C& c) -> decltype(c.size())\n{\n    return c.size();\n}\ntemplate <class T, std::size_t N>\nconstexpr std::size_t _std_size(const T (&array)[N]) noexcept\n{\n    return N;\n}\n\ntemplate <class T, class ElementType>\nstruct _is_span_compatible_container<\n    T, ElementType,\n    _void_t<\n        // is not a specialization of span\n        typename std::enable_if<!_is_span<T>::value, std::nullptr_t>::type,\n        // is not a specialization of array\n        typename std::enable_if<!_is_std_array<T>::value, std::nullptr_t>::type,\n        // is_array_v<Container> is false,\n        typename std::enable_if<!std::is_array<T>::value, std::nullptr_t>::type,\n        // data(cont) and size(cont) are well formed\n        decltype(data(std::declval<T>())), decltype(size(std::declval<T>())),\n        // remove_pointer_t<decltype(data(cont))>(*)[] is convertible to ElementType(*)[]\n        typename std::enable_if<\n            std::is_convertible<typename std::remove_pointer<decltype(\n                                    data(std::declval<T&>()))>::type (*)[],\n                                ElementType (*)[]>::value,\n            std::nullptr_t>::type>> : public std::true_type {\n};\n\n#if defined Vc_MSVC || (defined Vc_GCC && Vc_GCC < 0x50100) || defined Vc_ICC || !defined __cpp_constexpr || __cpp_constexpr < 201304\n#define Vc_CONSTEXPR\n#else\n#define Vc_CONSTEXPR constexpr\n#endif\n\ntemplate <typename T, ptrdiff_t Extent> class span\n{\npublic:\n    //  constants and types\n    using element_type = T;\n    using value_type = typename std::remove_cv<T>::type;\n    using index_type = ptrdiff_t;\n    using difference_type = ptrdiff_t;\n    using pointer = T*;\n    using const_pointer = const T*;  // not in standard\n    using reference = T&;\n    using const_reference = const T&;  // not in standard\n    using iterator = pointer;\n    using const_iterator = const_pointer;\n    using reverse_iterator = std::reverse_iterator<iterator>;\n    using const_reverse_iterator = std::reverse_iterator<const_iterator>;\n\n    static constexpr index_type extent = Extent;\n    static_assert(Extent >= 0, \"Can't have a span with an extent < 0\");\n\n    // [span.cons], span constructors, copy, assignment, and destructor\n    Vc_CONSTEXPR span() noexcept : data_{nullptr}\n    {\n        static_assert(Extent == 0,\n                      \"Can't default construct a statically sized span with size > 0\");\n    }\n\n    Vc_CONSTEXPR span(const span&) noexcept = default;\n    Vc_CONSTEXPR span& operator=(const span&) noexcept = default;\n\n    Vc_CONSTEXPR span(pointer _ptr, index_type _count) : data_{_ptr}\n    {\n        (void)_count;\n        Vc_ASSERT(((void)\"size mismatch in span's constructor (ptr, len)\", Extent == _count));\n    }\n    Vc_CONSTEXPR span(pointer _f, pointer _l) : data_{_f}\n    {\n        (void)_l;\n        Vc_ASSERT(((void)\"size mismatch in span's constructor (ptr, ptr)\",\n                   Extent == distance(_f, _l)));\n    }\n\n    Vc_CONSTEXPR span(element_type (&_arr)[Extent]) noexcept : data_{_arr} {}\n    Vc_CONSTEXPR span(array<value_type, Extent>& _arr) noexcept : data_{_arr.data()} {}\n    Vc_CONSTEXPR span(const array<value_type, Extent>& _arr) noexcept : data_{_arr.data()} {}\n\n    template <class Container>\n    inline Vc_CONSTEXPR span(\n        Container& _c,\n        typename std::enable_if<_is_span_compatible_container<Container, T>::value,\n                                std::nullptr_t>::type = nullptr)\n        : data_{_std_data(_c)}\n    {\n        Vc_ASSERT((\"size mismatch in span's constructor (container))\",\n                   Extent == _std_size(_c)));\n    }\n\n    template <class Container>\n    inline Vc_CONSTEXPR span(\n        const Container& _c,\n        typename std::enable_if<_is_span_compatible_container<const Container, T>::value,\n                                std::nullptr_t>::type = nullptr)\n        : data_{_std_data(_c)}\n    {\n        Vc_ASSERT((\"size mismatch in span's constructor (const container)\",\n                   Extent == _std_size(_c)));\n    }\n\n    template <class OtherElementType>\n    inline Vc_CONSTEXPR span(\n        const span<OtherElementType, Extent>& _other,\n        typename std::enable_if<\n            std::is_convertible<OtherElementType (*)[], element_type (*)[]>::value,\n            std::nullptr_t>::type = nullptr)\n        : data_{_other.data()}\n    {\n    }\n\n    template <class OtherElementType>\n    inline Vc_CONSTEXPR span(\n        const span<OtherElementType, dynamic_extent>& _other,\n        typename std::enable_if<\n            std::is_convertible<OtherElementType (*)[], element_type (*)[]>::value,\n            std::nullptr_t>::type = nullptr) noexcept\n        : data_{_other.data()}\n    {\n        Vc_ASSERT((\"size mismatch in span's constructor (other span)\",\n                   Extent == _other.size()));\n    }\n\n    //  ~span() noexcept = default;\n\n    template <ptrdiff_t Count>\n    inline Vc_CONSTEXPR span<element_type, Count> first() const noexcept\n    {\n        static_assert(Count >= 0, \"Count must be >= 0 in span::first()\");\n        static_assert(Count <= Extent, \"Count out of range in span::first()\");\n        return {data(), Count};\n    }\n\n    template <ptrdiff_t Count>\n    inline Vc_CONSTEXPR span<element_type, Count> last() const noexcept\n    {\n        static_assert(Count >= 0, \"Count must be >= 0 in span::last()\");\n        static_assert(Count <= Extent, \"Count out of range in span::last()\");\n        return {data() + size() - Count, Count};\n    }\n\n    Vc_CONSTEXPR span<element_type, dynamic_extent> first(index_type _count) const noexcept\n    {\n        Vc_ASSERT((\"Count out of range in span::first(count)\",\n                   _count >= 0 && _count <= size()));\n        return {data(), _count};\n    }\n\n    Vc_CONSTEXPR span<element_type, dynamic_extent> last(index_type _count) const noexcept\n    {\n        Vc_ASSERT(\n            (\"Count out of range in span::last(count)\", _count >= 0 && _count <= size()));\n        return {data() + size() - _count, _count};\n    }\n\n#ifndef Vc_MSVC\n    // MSVC 190024215 fails with \"error C2059: syntax error: '<end Parse>'\" somewhere in\n    // this file.  Unless someone needs this function on MSVC, I don't see a reason to\n    // invest time into working around their bugs.\n    template <ptrdiff_t Offset, ptrdiff_t Count = dynamic_extent>\n    inline Vc_CONSTEXPR auto subspan() const noexcept\n        -> span<element_type, Count != dynamic_extent ? Count : Extent - Offset>\n    {\n        Vc_ASSERT(\n            (\"Offset out of range in span::subspan()\", Offset >= 0 && Offset <= size()));\n        return {data() + Offset, Count == dynamic_extent ? size() - Offset : Count};\n    }\n\n    inline Vc_CONSTEXPR span<element_type, dynamic_extent> subspan(\n        index_type offset, index_type count = dynamic_extent) const noexcept\n    {\n        Vc_ASSERT((\"Offset out of range in span::subspan(offset, count)\",\n                   offset >= 0 && offset <= size()));\n        Vc_ASSERT((\"Count out of range in span::subspan(offset, count)\",\n                   (count >= 0 && count <= size()) || count == dynamic_extent));\n        if (count == dynamic_extent) {\n            return {data() + offset, size() - offset};\n        }\n        Vc_ASSERT((\"count + offset out of range in span::subspan(offset, count)\",\n                   offset + count <= size()));\n        return {data() + offset, count};\n    }\n#endif  // Vc_MSVC\n\n    Vc_CONSTEXPR index_type size() const noexcept { return Extent; }\n    Vc_CONSTEXPR index_type size_bytes() const noexcept\n    {\n        return Extent * sizeof(element_type);\n    }\n    Vc_CONSTEXPR bool empty() const noexcept { return Extent == 0; }\n\n    Vc_CONSTEXPR reference operator[](index_type _idx) const noexcept\n    {\n        Vc_ASSERT((\"span<T,N>[] index out of bounds\", _idx >= 0 && _idx < size()));\n        return data_[_idx];\n    }\n\n    Vc_CONSTEXPR reference operator()(index_type _idx) const noexcept\n    {\n        Vc_ASSERT((\"span<T,N>() index out of bounds\", _idx >= 0 && _idx < size()));\n        return data_[_idx];\n    }\n\n    Vc_CONSTEXPR pointer data() const noexcept { return data_; }\n\n    // [span.iter], span iterator support\n    Vc_CONSTEXPR iterator begin() const noexcept { return iterator(data()); }\n    Vc_CONSTEXPR iterator end() const noexcept { return iterator(data() + size()); }\n    Vc_CONSTEXPR const_iterator cbegin() const noexcept { return const_iterator(data()); }\n    Vc_CONSTEXPR const_iterator cend() const noexcept\n    {\n        return const_iterator(data() + size());\n    }\n    Vc_CONSTEXPR reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }\n    Vc_CONSTEXPR reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }\n    Vc_CONSTEXPR const_reverse_iterator crbegin() const noexcept\n    {\n        return const_reverse_iterator(cend());\n    }\n    Vc_CONSTEXPR const_reverse_iterator crend() const noexcept\n    {\n        return const_reverse_iterator(cbegin());\n    }\n\n    Vc_CONSTEXPR void swap(span& _other) noexcept\n    {\n        pointer _p = data_;\n        data_ = _other.data_;\n        _other.data_ = _p;\n    }\n\n#ifdef __cpp_lib_byte\n    span<const std::byte, Extent * sizeof(element_type)> _as_bytes() const noexcept\n    {\n        return {reinterpret_cast<const std::byte*>(data()), size_bytes()};\n    }\n\n    span<std::byte, Extent * sizeof(element_type)> _as_writeable_bytes() const noexcept\n    {\n        return {reinterpret_cast<std::byte*>(data()), size_bytes()};\n    }\n#endif  // __cpp_lib_byte\n\nprivate:\n    pointer data_;\n};\n\ntemplate <typename T> class span<T, dynamic_extent>\n{\nprivate:\npublic:\n    //  constants and types\n    using element_type = T;\n    using value_type = typename std::remove_cv<T>::type;\n    using index_type = ptrdiff_t;\n    using difference_type = ptrdiff_t;\n    using pointer = T*;\n    using const_pointer = const T*;  // not in standard\n    using reference = T&;\n    using const_reference = const T&;  // not in standard\n    using iterator = pointer;\n    using const_iterator = const_pointer;\n    using reverse_iterator = std::reverse_iterator<iterator>;\n    using const_reverse_iterator = std::reverse_iterator<const_iterator>;\n\n    static constexpr index_type extent = dynamic_extent;\n\n    // [span.cons], span constructors, copy, assignment, and destructor\n    Vc_CONSTEXPR span() noexcept : data_{nullptr}, size_{0} {}\n\n    Vc_CONSTEXPR span(const span&) noexcept = default;\n    Vc_CONSTEXPR span& operator=(const span&) noexcept = default;\n\n    Vc_CONSTEXPR span(pointer _ptr, index_type _count) : data_{_ptr}, size_{_count} {}\n    Vc_CONSTEXPR span(pointer _f, pointer _l) : data_{_f}, size_{distance(_f, _l)} {}\n\n    template <size_t Sz>\n    inline Vc_CONSTEXPR span(element_type (&_arr)[Sz]) noexcept : data_{_arr}, size_{Sz}\n    {\n    }\n\n    template <size_t Sz>\n    inline Vc_CONSTEXPR span(array<value_type, Sz>& _arr) noexcept\n        : data_{_arr.data()}, size_{Sz}\n    {\n    }\n\n    template <size_t Sz>\n    inline Vc_CONSTEXPR span(const array<value_type, Sz>& _arr) noexcept\n        : data_{_arr.data()}, size_{Sz}\n    {\n    }\n\n    template <class Container>\n    inline Vc_CONSTEXPR span(\n        Container& _c,\n        typename std::enable_if<_is_span_compatible_container<Container, T>::value,\n                                std::nullptr_t>::type = nullptr)\n        : data_{_std_data(_c)}, size_{index_type(_std_size(_c))}\n    {\n    }\n\n    template <class Container>\n    inline Vc_CONSTEXPR span(\n        const Container& _c,\n        typename std::enable_if<_is_span_compatible_container<const Container, T>::value,\n                                std::nullptr_t>::type = nullptr)\n        : data_{_std_data(_c)}, size_{index_type(_std_size(_c))}\n    {\n    }\n\n    template <class OtherElementType, ptrdiff_t OtherExtent>\n    inline Vc_CONSTEXPR span(\n        const span<OtherElementType, OtherExtent>& _other,\n        typename std::enable_if<\n            std::is_convertible<OtherElementType (*)[], element_type (*)[]>::value,\n            std::nullptr_t>::type = nullptr) noexcept\n        : data_{_other.data()}, size_{_other.size()}\n    {\n    }\n\n    //    ~span() noexcept = default;\n\n    template <ptrdiff_t Count>\n    inline Vc_CONSTEXPR span<element_type, Count> first() const noexcept\n    {\n        static_assert(Count >= 0, \"\");\n        Vc_ASSERT((\"Count out of range in span::first()\", Count <= size()));\n        return {data(), Count};\n    }\n\n    template <ptrdiff_t Count>\n    inline Vc_CONSTEXPR span<element_type, Count> last() const noexcept\n    {\n        static_assert(Count >= 0, \"\");\n        Vc_ASSERT((\"Count out of range in span::last()\", Count <= size()));\n        return {data() + size() - Count, Count};\n    }\n\n    Vc_CONSTEXPR span<element_type, dynamic_extent> first(index_type _count) const noexcept\n    {\n        Vc_ASSERT((\"Count out of range in span::first(count)\",\n                   _count >= 0 && _count <= size()));\n        return {data(), _count};\n    }\n\n    Vc_CONSTEXPR span<element_type, dynamic_extent> last(index_type _count) const noexcept\n    {\n        Vc_ASSERT(\n            (\"Count out of range in span::last(count)\", _count >= 0 && _count <= size()));\n        return {data() + size() - _count, _count};\n    }\n\n    template <ptrdiff_t Offset, ptrdiff_t Count = dynamic_extent>\n    inline Vc_CONSTEXPR span<T, dynamic_extent> subspan() const noexcept\n    {\n        Vc_ASSERT(\n            (\"Offset out of range in span::subspan()\", Offset >= 0 && Offset <= size()));\n        Vc_ASSERT((\"Count out of range in span::subspan()\",\n                   Count == dynamic_extent || Offset + Count <= size()));\n        return {data() + Offset, Count == dynamic_extent ? size() - Offset : Count};\n    }\n\n    Vc_CONSTEXPR span<element_type, dynamic_extent> inline subspan(\n        index_type _offset, index_type _count = dynamic_extent) const noexcept\n    {\n        Vc_ASSERT((\"Offset out of range in span::subspan(offset, count)\",\n                   _offset >= 0 && _offset <= size()));\n        Vc_ASSERT((\"count out of range in span::subspan(offset, count)\",\n                   (_count >= 0 && _count <= size()) || _count == dynamic_extent));\n        if (_count == dynamic_extent)\n            return {data() + _offset, size() - _offset};\n        Vc_ASSERT((\"Offset + count out of range in span::subspan(offset, count)\",\n                   _offset + _count <= size()));\n        return {data() + _offset, _count};\n    }\n\n    Vc_CONSTEXPR index_type size() const noexcept { return size_; }\n    Vc_CONSTEXPR index_type size_bytes() const noexcept\n    {\n        return size_ * sizeof(element_type);\n    }\n    Vc_CONSTEXPR bool empty() const noexcept { return size_ == 0; }\n\n    Vc_CONSTEXPR reference operator[](index_type _idx) const noexcept\n    {\n        Vc_ASSERT((\"span<T>[] index out of bounds\", _idx >= 0 && _idx < size()));\n        return data_[_idx];\n    }\n\n    Vc_CONSTEXPR reference operator()(index_type _idx) const noexcept\n    {\n        Vc_ASSERT((\"span<T>() index out of bounds\", _idx >= 0 && _idx < size()));\n        return data_[_idx];\n    }\n\n    Vc_CONSTEXPR pointer data() const noexcept { return data_; }\n\n    // [span.iter], span iterator support\n    Vc_CONSTEXPR iterator begin() const noexcept { return iterator(data()); }\n    Vc_CONSTEXPR iterator end() const noexcept { return iterator(data() + size()); }\n    Vc_CONSTEXPR const_iterator cbegin() const noexcept { return const_iterator(data()); }\n    Vc_CONSTEXPR const_iterator cend() const noexcept\n    {\n        return const_iterator(data() + size());\n    }\n    Vc_CONSTEXPR reverse_iterator rbegin() const noexcept { return reverse_iterator(end()); }\n    Vc_CONSTEXPR reverse_iterator rend() const noexcept { return reverse_iterator(begin()); }\n    Vc_CONSTEXPR const_reverse_iterator crbegin() const noexcept\n    {\n        return const_reverse_iterator(cend());\n    }\n    Vc_CONSTEXPR const_reverse_iterator crend() const noexcept\n    {\n        return const_reverse_iterator(cbegin());\n    }\n\n    Vc_CONSTEXPR void swap(span& _other) noexcept\n    {\n        pointer _p = data_;\n        data_ = _other.data_;\n        _other.data_ = _p;\n\n        index_type _sz = size_;\n        size_ = _other.size_;\n        _other.size_ = _sz;\n    }\n\n#ifdef __cpp_lib_byte\n// Disable _as_bytes() for older MSVC versions as it leads to a compilation error due to a compiler bug.\n// When parsing the return type, MSVC will instantiate the primary template of span<> and static_assert().\n#if _MSC_VER > 1928\n    span<const std::byte, dynamic_extent> _as_bytes() const noexcept\n    {\n        return {reinterpret_cast<const std::byte*>(data()), size_bytes()};\n    }\n\n    span<std::byte, dynamic_extent> _as_writeable_bytes() const noexcept\n    {\n        return {reinterpret_cast<std::byte*>(data()), size_bytes()};\n    }\n#endif\n#endif  // __cpp_lib_byte\n\nprivate:\n    pointer data_;\n    index_type size_;\n};\n\ntemplate <class T1, ptrdiff_t Extent1, class T2, ptrdiff_t Extent2>\nVc_CONSTEXPR bool operator==(const span<T1, Extent1>& lhs, const span<T2, Extent2>& rhs)\n{\n    return equal(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());\n}\n\ntemplate <class T1, ptrdiff_t Extent1, class T2, ptrdiff_t Extent2>\nVc_CONSTEXPR bool operator!=(const span<T1, Extent1>& lhs, const span<T2, Extent2>& rhs)\n{\n    return !(rhs == lhs);\n}\n\ntemplate <class T1, ptrdiff_t Extent1, class T2, ptrdiff_t Extent2>\nVc_CONSTEXPR bool operator<(const span<T1, Extent1>& lhs, const span<T2, Extent2>& rhs)\n{\n    return lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());\n}\n\ntemplate <class T1, ptrdiff_t Extent1, class T2, ptrdiff_t Extent2>\nVc_CONSTEXPR bool operator<=(const span<T1, Extent1>& lhs, const span<T2, Extent2>& rhs)\n{\n    return !(rhs < lhs);\n}\n\ntemplate <class T1, ptrdiff_t Extent1, class T2, ptrdiff_t Extent2>\nVc_CONSTEXPR bool operator>(const span<T1, Extent1>& lhs, const span<T2, Extent2>& rhs)\n{\n    return rhs < lhs;\n}\n\ntemplate <class T1, ptrdiff_t Extent1, class T2, ptrdiff_t Extent2>\nVc_CONSTEXPR bool operator>=(const span<T1, Extent1>& lhs, const span<T2, Extent2>& rhs)\n{\n    return !(lhs < rhs);\n}\n\n//  as_bytes & as_writeable_bytes\ntemplate <class T, ptrdiff_t Extent>\nauto as_bytes(span<T, Extent> _s) noexcept -> decltype(_s._as_bytes())\n{\n    return _s._as_bytes();\n}\n\ntemplate <class T, ptrdiff_t Extent>\nauto as_writeable_bytes(span<T, Extent> _s) noexcept ->\n    typename std::enable_if<!std::is_const<T>::value,\n                            decltype(_s._as_writeable_bytes())>::type\n{\n    return _s._as_writeable_bytes();\n}\n\ntemplate <class T, ptrdiff_t Extent>\nVc_CONSTEXPR void swap(span<T, Extent>& lhs, span<T, Extent>& rhs) noexcept\n{\n    lhs.swap(rhs);\n}\n\n#undef Vc_CONSTEXPR\n\n//  Deduction guides\n#ifdef __cpp_deduction_guides\ntemplate <class T, size_t Sz> span(T (&)[Sz])->span<T, Sz>;\n\ntemplate <class T, size_t Sz> span(array<T, Sz>&)->span<T, Sz>;\n\ntemplate <class T, size_t Sz> span(const array<T, Sz>&)->span<const T, Sz>;\n\ntemplate <class Container> span(Container&)->span<typename Container::value_type>;\n\ntemplate <class Container>\nspan(const Container&)->span<const typename Container::value_type>;\n#endif  // __cpp_deduction_guides\n\n}  // namespace Common\n\n/**\n * \\ingroup Containers\n * \\headerfile span.h <Vc/span>\n *\n * An adapted `std::span` with additional subscript operators supporting gather and scatter operations.\n *\n * The [std::span](https://en.cppreference.com/w/cpp/container/span) documentation applies.\n *\n * Example:\n * \\code\n * struct Point {\n *   float x, y;\n * };\n * Point data[100];\n * // initialize values in data\n *\n * Vc::span<Point, 100> view(data);\n * float_v::IndexType indexes = ...;  // values between 0-99\n * float_v x = view[indexes][&Point::x];\n * float_v y = view[indexes][&Point::y];\n * \\endcode\n */\ntemplate <typename T, ptrdiff_t Extent = dynamic_extent>\nusing span = Common::AdaptSubscriptOperator<Common::span<T, Extent>>;\n\nnamespace Traits\n{\ntemplate <typename T, ptrdiff_t Extent>\nstruct has_contiguous_storage_impl<Vc::span<T, Extent>> : public std::true_type {\n};\ntemplate <typename T, ptrdiff_t Extent>\nstruct has_contiguous_storage_impl<Vc::Common::span<T, Extent>> : public std::true_type {\n};\n}  // namespace Traits\n\n}  // namespace Vc_VERSIONED_NAMESPACE\n\n#endif  // VC_COMMON_SPAN_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/storage.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_STORAGE_H_\n#define VC_COMMON_STORAGE_H_\n\n#include \"aliasingentryhelper.h\"\n#include \"types.h\"\n#include \"maskbool.h\"\n#ifdef Vc_IMPL_AVX\n#include \"../avx/intrinsics.h\"\n#endif\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <typename V> inline V zero();\n}  // namespace Detail\nnamespace Common\n{\nnamespace Detail\n{\n#ifdef Vc_IMPL_AVX\ntemplate <typename ValueType, size_t Size> struct IntrinsicType {\n    using type = typename std::conditional<\n        std::is_integral<ValueType>::value,\n        typename std::conditional<sizeof(ValueType) * Size == 16, __m128i, __m256i>::type,\n        typename std::conditional<\n            std::is_same<ValueType, double>::value,\n            typename std::conditional<sizeof(ValueType) * Size == 16, __m128d,\n                                      __m256d>::type,\n            typename std::conditional<sizeof(ValueType) * Size == 16, __m128,\n                                      __m256>::type>::type>::type;\n};\n#elif defined Vc_IMPL_SSE\ntemplate <typename ValueType, size_t Size> struct IntrinsicType {\n    using type = typename std::conditional<\n        std::is_integral<ValueType>::value, __m128i,\n        typename std::conditional<std::is_same<ValueType, double>::value, __m128d,\n                                  __m128>::type>::type;\n};\n#else\ntemplate <typename ValueType, size_t Size> struct IntrinsicType {\n    static_assert(Size == 1,\n                  \"IntrinsicType without SIMD target support may only have Size = 1\");\n    using type = ValueType;\n};\n#endif\ntemplate <typename ValueType, size_t Size, size_t Bytes = sizeof(ValueType) * Size>\nstruct BuiltinType;\n#ifdef Vc_USE_BUILTIN_VECTOR_TYPES\n#define Vc_VECBUILTIN __attribute__((__vector_size__(16)))\ntemplate <size_t Size> struct BuiltinType<         double   , Size, 16> { typedef          double    type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         float    , Size, 16> { typedef          float     type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         long long, Size, 16> { typedef          long long type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned long long, Size, 16> { typedef unsigned long long type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         long     , Size, 16> { typedef          long      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned long     , Size, 16> { typedef unsigned long      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         int      , Size, 16> { typedef          int       type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned int      , Size, 16> { typedef unsigned int       type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         short    , Size, 16> { typedef          short     type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned short    , Size, 16> { typedef unsigned short     type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         char     , Size, 16> { typedef          char      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned char     , Size, 16> { typedef unsigned char      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<  signed char     , Size, 16> { typedef   signed char      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         bool     , Size, 16> { typedef unsigned char      type Vc_VECBUILTIN; };\n#undef Vc_VECBUILTIN\n#define Vc_VECBUILTIN __attribute__((__vector_size__(32)))\ntemplate <size_t Size> struct BuiltinType<         double   , Size, 32> { typedef          double    type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         float    , Size, 32> { typedef          float     type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         long long, Size, 32> { typedef          long long type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned long long, Size, 32> { typedef unsigned long long type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         long     , Size, 32> { typedef          long      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned long     , Size, 32> { typedef unsigned long      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         int      , Size, 32> { typedef          int       type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned int      , Size, 32> { typedef unsigned int       type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         short    , Size, 32> { typedef          short     type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned short    , Size, 32> { typedef unsigned short     type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         char     , Size, 32> { typedef          char      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<unsigned char     , Size, 32> { typedef unsigned char      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<  signed char     , Size, 32> { typedef   signed char      type Vc_VECBUILTIN; };\ntemplate <size_t Size> struct BuiltinType<         bool     , Size, 32> { typedef unsigned char      type Vc_VECBUILTIN; };\n#undef Vc_VECBUILTIN\n#endif\n}  // namespace Detail\n\ntemplate <typename ValueType, size_t Size>\nusing IntrinsicType = typename Detail::IntrinsicType<ValueType, Size>::type;\n\ntemplate <typename ValueType, size_t Size>\nusing BuiltinType = typename Detail::BuiltinType<ValueType, Size>::type;\n\nnamespace AliasStrategy\n{\nstruct Union {};\nstruct MayAlias {};\nstruct VectorBuiltin {};\nstruct UnionMembers {};\n}  // namespace AliasStrategy\n\nusing DefaultStrategy =\n#if defined Vc_USE_BUILTIN_VECTOR_TYPES\n    AliasStrategy::VectorBuiltin;\n#elif defined Vc_MSVC\n    AliasStrategy::UnionMembers;\n#elif defined Vc_ICC\n    AliasStrategy::Union;\n#elif defined __GNUC__\n    AliasStrategy::MayAlias;\n#else\n    AliasStrategy::Union;\n#endif\n\ntemplate <typename ValueType, size_t Size, typename Strategy = DefaultStrategy>\nclass Storage;\n\n// GCC 6 forbids `EntryType m[]` altogether\ntemplate <typename ValueType, size_t Size>\nclass Storage<ValueType, Size, AliasStrategy::Union>\n{\n    static_assert(std::is_fundamental<ValueType>::value &&\n                      std::is_arithmetic<ValueType>::value,\n                  \"Only works for fundamental arithmetic types.\");\n\npublic:\n    using VectorType = IntrinsicType<ValueType, Size>;\n    using EntryType = ValueType;\n\n    union Alias {\n        Vc_INTRINSIC Alias(VectorType vv) : v(vv) {}\n        VectorType v;\n        EntryType m[Size];\n    };\n\n    Vc_INTRINSIC Storage() : data(Vc::Detail::zero<VectorType>()) {}\n    Vc_INTRINSIC Storage(const VectorType &x) : data(x) { assertCorrectAlignment(&data); }\n    template <typename U>\n    Vc_INTRINSIC explicit Storage(const U &x,\n                                  enable_if<sizeof(U) == sizeof(VectorType)> = nullarg)\n        : data(reinterpret_cast<VectorType>(x))\n    {\n        assertCorrectAlignment(&data);\n    }\n\n    Vc_INTRINSIC Storage(const Storage &) = default;\n    Vc_INTRINSIC Storage &operator=(const Storage &) = default;\n\n    Vc_INTRINSIC operator const VectorType &() const { return data; }\n    Vc_INTRINSIC Vc_PURE VectorType &v() { return data; }\n    Vc_INTRINSIC Vc_PURE const VectorType &v() const { return data; }\n    Vc_INTRINSIC Vc_PURE EntryType m(size_t i) const { return Alias(data).m[i]; }\n    Vc_INTRINSIC void set(size_t i, EntryType x)\n    {\n        Alias a(data);\n        a.m[i] = x;\n        data = a.v;\n    }\n\nprivate:\n    VectorType data;\n};\n\ntemplate <typename ValueType, size_t Size>\nclass Storage<ValueType, Size, AliasStrategy::MayAlias>\n{\n    static_assert(std::is_fundamental<ValueType>::value &&\n                      std::is_arithmetic<ValueType>::value,\n                  \"Only works for fundamental arithmetic types.\");\n\npublic:\n    using VectorType = IntrinsicType<ValueType, Size>;\n    using EntryType = ValueType;\n\n    Vc_INTRINSIC Storage() : data() { assertCorrectAlignment(&data); }\n    Vc_INTRINSIC Storage(const VectorType &x) : data(x)\n    {\n        assertCorrectAlignment(&data);\n    }\n    template <typename U>\n    Vc_INTRINSIC explicit Storage(const U &x,\n                                  enable_if<sizeof(U) == sizeof(VectorType)> = nullarg)\n        : data(reinterpret_cast<const VectorType &>(x))\n    {\n        assertCorrectAlignment(&data);\n    }\n    Vc_INTRINSIC Storage &operator=(const VectorType &x)\n    {\n        data = x;\n        return *this;\n    }\n\n    Vc_INTRINSIC Storage(const Storage &) = default;\n    Vc_INTRINSIC Storage &operator=(const Storage &) = default;\n\n    Vc_INTRINSIC operator const VectorType &() const { return v(); }\n    Vc_INTRINSIC Vc_PURE VectorType &v() { return data; }\n    Vc_INTRINSIC Vc_PURE const VectorType &v() const { return data; }\n\n    Vc_INTRINSIC Vc_PURE EntryType m(size_t i) const\n    {\n        return aliasing_cast<EntryType>(&data)[i];\n    }\n    Vc_INTRINSIC void set(size_t i, EntryType x)\n    {\n        aliasing_cast<EntryType>(&data)[i] = x;\n    }\n\nprivate:\n    VectorType data;\n};\n\ntemplate <typename ValueType, size_t Size>\nclass Storage<ValueType, Size, AliasStrategy::VectorBuiltin>\n{\n    static_assert(std::is_fundamental<ValueType>::value &&\n                      std::is_arithmetic<ValueType>::value,\n                  \"Only works for fundamental arithmetic types.\");\n\n    using Builtin = BuiltinType<ValueType, Size>;\n\npublic:\n    using VectorType =\n#ifdef Vc_TEMPLATES_DROP_ATTRIBUTES\n        MayAlias<IntrinsicType<ValueType, Size>>;\n#else\n        IntrinsicType<ValueType, Size>;\n#endif\n    using EntryType = ValueType;\n\n    Vc_INTRINSIC Storage() : data() { assertCorrectAlignment(&data); }\n    Vc_INTRINSIC Storage(const Storage &) = default;\n    Vc_INTRINSIC Storage &operator=(const Storage &) = default;\n\n    Vc_INTRINSIC Storage(const VectorType &x)\n        : data(aliasing_cast<Builtin>(x))\n    {\n        assertCorrectAlignment(&data);\n    }\n    template <typename U>\n    Vc_INTRINSIC explicit Storage(const U &x,\n                                  enable_if<sizeof(U) == sizeof(VectorType)> = nullarg)\n        : data(aliasing_cast<Builtin>(x))\n    {\n        assertCorrectAlignment(&data);\n    }\n    Vc_INTRINSIC Storage &operator=(const VectorType &x)\n    {\n        data = aliasing_cast<Builtin>(x);\n        return *this;\n    }\n\n    Vc_INTRINSIC operator const VectorType &() const { return v(); }\n    Vc_INTRINSIC Vc_PURE VectorType &v() { return reinterpret_cast<VectorType &>(data); }\n    Vc_INTRINSIC Vc_PURE const VectorType &v() const { return reinterpret_cast<const VectorType &>(data); }\n\n    Vc_INTRINSIC Vc_PURE EntryType m(size_t i) const { return data[i]; }\n    Vc_INTRINSIC void set(size_t i, EntryType x) { data[i] = x; }\n\n    Vc_INTRINSIC Builtin &builtin() { return data; }\n    Vc_INTRINSIC const Builtin &builtin() const { return data; }\n\nprivate:\n    Builtin data;\n};\n\ntemplate <typename ValueType, size_t Size>\nclass Storage<ValueType, Size, AliasStrategy::UnionMembers>\n{\n    static_assert(std::is_fundamental<ValueType>::value &&\n                      std::is_arithmetic<ValueType>::value,\n                  \"Only works for fundamental arithmetic types.\");\n\npublic:\n    using VectorType = IntrinsicType<ValueType, Size>;\n    using EntryType = ValueType;\n\n    Vc_INTRINSIC Storage() : data() { assertCorrectAlignment(&data); }\n    Vc_INTRINSIC Storage(const VectorType &x) : data(x)\n    {\n        assertCorrectAlignment(&data);\n    }\n    template <typename U>\n    Vc_INTRINSIC explicit Storage(const U &x,\n                                  enable_if<sizeof(U) == sizeof(VectorType)> = nullarg)\n        : data(reinterpret_cast<const VectorType &>(x))\n    {\n        assertCorrectAlignment(&data);\n    }\n    Vc_INTRINSIC Storage &operator=(const VectorType &x)\n    {\n        data = x;\n        return *this;\n    }\n\n    Vc_INTRINSIC Storage(const Storage &) = default;\n    Vc_INTRINSIC Storage &operator=(const Storage &) = default;\n\n    Vc_INTRINSIC Vc_PURE VectorType &v() { return data; }\n    Vc_INTRINSIC Vc_PURE const VectorType &v() const { return data; }\n\n    Vc_INTRINSIC_L Vc_PURE_L EntryType m(size_t i) const Vc_INTRINSIC_R Vc_PURE_R;\n    Vc_INTRINSIC void set(size_t i, EntryType x) { ref(i) = x; }\n\nprivate:\n    Vc_INTRINSIC_L Vc_PURE_L EntryType &ref(size_t i) Vc_INTRINSIC_R Vc_PURE_R;\n    VectorType data;\n};\n\n#ifdef Vc_MSVC\ntemplate <> Vc_INTRINSIC Vc_PURE          double Storage<         double, 2, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128d_f64[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE          float  Storage<         float , 4, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128_f32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed int    Storage<  signed int   , 4, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128i_i32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed short  Storage<  signed short , 8, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128i_i16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed char   Storage<  signed char  ,16, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128i_i8[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned int    Storage<unsigned int   , 4, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128i_u32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned short  Storage<unsigned short , 8, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128i_u16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned char   Storage<unsigned char  ,16, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m128i_u8[i]; }\n\ntemplate <> Vc_INTRINSIC Vc_PURE          double &Storage<         double, 2, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m128d_f64[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE          float  &Storage<         float , 4, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m128_f32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed int    &Storage<  signed int   , 4, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m128i_i32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed short  &Storage<  signed short , 8, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m128i_i16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed char   &Storage<  signed char  ,16, AliasStrategy::UnionMembers>::ref(size_t i) { return reinterpret_cast<signed char &>(data.m128i_i8[i]); }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned int    &Storage<unsigned int   , 4, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m128i_u32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned short  &Storage<unsigned short , 8, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m128i_u16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned char   &Storage<unsigned char  ,16, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m128i_u8[i]; }\n\n#ifdef Vc_IMPL_AVX\ntemplate <> Vc_INTRINSIC Vc_PURE          double Storage<         double, 4, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256d_f64[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE          float  Storage<         float , 8, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256_f32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed int    Storage<  signed int   , 8, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256i_i32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed short  Storage<  signed short ,16, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256i_i16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed char   Storage<  signed char  ,32, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256i_i8[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned int    Storage<unsigned int   , 8, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256i_u32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned short  Storage<unsigned short ,16, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256i_u16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned char   Storage<unsigned char  ,32, AliasStrategy::UnionMembers>::m(size_t i) const { return data.m256i_u8[i]; }\n\ntemplate <> Vc_INTRINSIC Vc_PURE          double &Storage<         double, 4, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m256d_f64[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE          float  &Storage<         float , 8, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m256_f32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed int    &Storage<  signed int   , 8, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m256i_i32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed short  &Storage<  signed short ,16, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m256i_i16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE   signed char   &Storage<  signed char  ,32, AliasStrategy::UnionMembers>::ref(size_t i) { return reinterpret_cast<signed char &>(data.m256i_i8[i]); }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned int    &Storage<unsigned int   , 8, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m256i_u32[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned short  &Storage<unsigned short ,16, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m256i_u16[i]; }\ntemplate <> Vc_INTRINSIC Vc_PURE unsigned char   &Storage<unsigned char  ,32, AliasStrategy::UnionMembers>::ref(size_t i) { return data.m256i_u8[i]; }\n#endif\n#endif  // Vc_MSVC\n\ntemplate <typename VectorType, typename EntryType>\nusing VectorMemoryUnion = Storage<EntryType, sizeof(VectorType) / sizeof(EntryType)>;\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_STORAGE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/storeinterface.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// stores\n\n/**\n * Store the vector data to \\p mem.\n *\n * \\param mem A pointer to memory, where \\VSize{T} consecutive values will be stored.\n * \\param flags The flags parameter can be used to select e.g. the Vc::Aligned,\n *              Vc::Unaligned, Vc::Streaming, and/or Vc::PrefetchDefault flags.\n */\ntemplate <\n    typename U,\n    typename Flags = DefaultStoreTag,\n    typename = enable_if<std::is_arithmetic<U>::value &&Traits::is_load_store_flag<Flags>::value>>\nVc_INTRINSIC_L void store(U *mem, Flags flags = Flags()) const Vc_INTRINSIC_R;\n\n/**\n * Store the vector data to \\p mem where \\p mask is set.\n *\n * \\param mem A pointer to memory, where \\VSize{T} consecutive values will be stored.\n * \\param mask A mask object that determines which entries of the vector should be stored\n *             to \\p mem.\n * \\param flags The flags parameter can be used to select e.g. the Vc::Aligned,\n *              Vc::Unaligned, Vc::Streaming, and/or Vc::PrefetchDefault flags.\n *\n * \\note\n * The masked store does not pack the values into memory. I.e. the value at offset \\c i\n * will be stored to `mem[i]`, independent of whether `mask[j]` for any `j < i` is \\c\n * false.\n */\ntemplate <\n    typename U,\n    typename Flags = DefaultStoreTag,\n    typename = enable_if<std::is_arithmetic<U>::value &&Traits::is_load_store_flag<Flags>::value>>\nVc_INTRINSIC_L void Vc_VDECL store(U *mem, MaskType mask, Flags flags = Flags()) const Vc_INTRINSIC_R;\n\n//@{\n/**\n * The following store overloads support classes that have a cast operator to `EntryType\n * *`.\n */\nVc_INTRINSIC void store(EntryType *mem) const\n{\n    store<EntryType, DefaultStoreTag>(mem, DefaultStoreTag());\n}\n\ntemplate <typename Flags, typename = enable_if<Traits::is_load_store_flag<Flags>::value>>\nVc_INTRINSIC void store(EntryType *mem, Flags flags) const\n{\n    store<EntryType, Flags>(mem, flags);\n}\n\nVc_INTRINSIC void Vc_VDECL store(EntryType *mem, MaskType mask) const\n{\n    store<EntryType, DefaultStoreTag>(mem, mask, DefaultStoreTag());\n}\n\ntemplate <typename Flags, typename = enable_if<Traits::is_load_store_flag<Flags>::value>>\nVc_INTRINSIC void Vc_VDECL store(EntryType *mem, MaskType mask, Flags flags) const\n{\n    store<EntryType, Flags>(mem, mask, flags);\n}\n//@}\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/subscript.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SUBSCRIPT_H_\n#define VC_COMMON_SUBSCRIPT_H_\n\n#include <initializer_list>\n#include <type_traits>\n#include <vector>\n#include \"types.h\"\n#include \"macros.h\"\n#include <assert.h>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n// AdaptSubscriptOperator {{{\ntemplate <typename Base> class AdaptSubscriptOperator : public Base\n{\npublic:\n    // perfect forward all Base constructors\n    template <typename... Args>\n    Vc_ALWAYS_INLINE AdaptSubscriptOperator(Args &&... arguments)\n        : Base(std::forward<Args>(arguments)...)\n    {\n    }\n\n    // perfect forward all Base constructors\n    template <typename T>\n    Vc_ALWAYS_INLINE AdaptSubscriptOperator(std::initializer_list<T> l)\n        : Base(l)\n    {\n    }\n\n    // explicitly enable Base::operator[] because the following would hide it\n    using Base::operator[];\n\n    /// \\internal forward to non-member subscript_operator function\n    template <typename I,\n              typename = enable_if<!std::is_arithmetic<\n                  typename std::decay<I>::type>::value>  // arithmetic types\n                                                         // should always use\n                                                         // Base::operator[] and\n                                                         // never match this one\n              >\n    Vc_ALWAYS_INLINE auto operator[](I &&arg_)\n        -> decltype(subscript_operator(*this, std::forward<I>(arg_)))\n    {\n        return subscript_operator(*this, std::forward<I>(arg_));\n    }\n\n    // const overload of the above\n    template <typename I, typename = enable_if<\n                              !std::is_arithmetic<typename std::decay<I>::type>::value>>\n    Vc_ALWAYS_INLINE auto operator[](I &&arg_) const\n        -> decltype(subscript_operator(*this, std::forward<I>(arg_)))\n    {\n        return subscript_operator(*this, std::forward<I>(arg_));\n    }\n};\n\n// }}}\n// is_valid_indexvector {{{\ntemplate <class T, class = decltype(convertIndexVector(std::declval<T>()))>\nstd::true_type is_valid_indexvector(T &&);\nstd::false_type is_valid_indexvector(...);\n\ntemplate <class IndexVector, class Test = decltype(is_valid_indexvector(\n                                 std::declval<const IndexVector &>()))>\nstruct is_valid_indexvector_ : public std::integral_constant<bool, Test::value> {\n};\nstatic_assert(!is_valid_indexvector_<const int *>::value,\n              \"Pointer is incorrectly classified as valid index vector type\");\nstatic_assert(is_valid_indexvector_<const int[4]>::value,\n              \"C-Array is incorrectly classified as invalid index vector type\");\n\n// }}}\n// apply Scale (std::ratio) functions {{{1\ntemplate <typename Scale, typename T>\nVc_ALWAYS_INLINE enable_if<Scale::num == Scale::den, Traits::decay<T>> applyScale(T &&x)\n{\n    return std::forward<T>(x);\n}\n\ntemplate <typename Scale, typename T>\nVc_ALWAYS_INLINE enable_if<\n    Scale::num != Scale::den && Traits::has_multiply_operator<T, int>::value,\n    Traits::decay<T>>\n    applyScale(T &&x)\n{\n    static_assert(Scale::num % Scale::den == 0,\n                  \"Non-integral index scaling requested. This typically happens only for \"\n                  \"Vc::Scalar on 32-bit for gathers on double. You can work around the \"\n                  \"issue by ensuring that all doubles in the structure are aligned on 8 \"\n                  \"Bytes.\");\n    constexpr int value = Scale::num / Scale::den;\n    Vc_ASSERT(Vc::all_of((x * value) / value == x));\n    return std::forward<T>(x) * value;\n}\n\ntemplate <typename Scale, typename T>\nVc_ALWAYS_INLINE enable_if<\n    Scale::num != Scale::den && !Traits::has_multiply_operator<T, int>::value,\n    T>\n    applyScale(T x)\n{\n    static_assert(Scale::num % Scale::den == 0,\n                  \"Non-integral index scaling requested. This typically happens only for \"\n                  \"Vc::Scalar on 32-bit for gathers on double. You can work around the \"\n                  \"issue by ensuring that all doubles in the structure are aligned on 8 \"\n                  \"Bytes.\");\n    constexpr int value = Scale::num / Scale::den;\n    for (size_t i = 0; i < x.size(); ++i) {\n        Vc_ASSERT((x[i] * value) / value == x[i]);\n        x[i] *= value;\n    }\n    return x;\n}\n\ntemplate <typename Scale, typename T, typename U,\n          typename = enable_if<Traits::has_multiply_operator<T, int>::value &&\n                               Traits::has_addition_operator<T, U>::value>>\nVc_ALWAYS_INLINE typename std::decay<T>::type applyScaleAndAdd(T &&x, U &&y)\n{\n    constexpr int value = Scale::num / Scale::den;\n    if (value == 1) {  // static evaluation\n        return std::forward<T>(x) + std::forward<U>(y);\n    }\n    return std::forward<T>(x) * value + std::forward<U>(y);\n}\n\ntemplate <\n    typename Scale, typename T, typename U,\n    typename = enable_if<\n        !(Traits::has_multiply_operator<T &, int>::value &&\n          Traits::has_addition_operator<T &, decltype(std::declval<U>()[0])>::value) &&\n        Traits::has_subscript_operator<U>::value>>\nVc_ALWAYS_INLINE T applyScaleAndAdd(T x, U &&y)\n{\n    constexpr int value = Scale::num / Scale::den;\n    for (size_t i = 0; i < x.size(); ++i) {\n        if (value == 1) {  // static evaluation\n            x[i] = x[i] + y[i];\n        } else {\n            x[i] = x[i] * value + y[i];\n        }\n    }\n    return x;\n}\n\ntemplate <typename Scale, typename T, typename U>\nVc_ALWAYS_INLINE enable_if<!(Traits::has_multiply_operator<T &, int>::value &&\n                             Traits::has_addition_operator<T &, U>::value) &&\n                               !Traits::has_subscript_operator<U>::value,\n                           T>\n    applyScaleAndAdd(T x, U &&y)\n{\n    constexpr int value = Scale::num / Scale::den;\n    for (size_t i = 0; i < x.size(); ++i) {\n        if (value == 1) {  // static evaluation\n            x[i] = x[i] + y;\n        } else {\n            x[i] = x[i] * value + y;\n        }\n    }\n    return x;\n}\n\n// IndexVectorSizeMatches {{{1\ntemplate <std::size_t MinSize,\n          typename IndexT,\n          bool = Traits::is_simd_vector<IndexT>::value>\nstruct IndexVectorSizeMatches\n    : public std::true_type  // you might expect this should be false_type here, but the point is\n                             // that IndexT is a type where the size is not known at compile time.\n                             // Thus it may be good but we cannot know from the type. The only check\n                             // we could do is a runtime check, but the type is fine.\n{\n};\n\ntemplate <std::size_t MinSize, typename V>\nstruct IndexVectorSizeMatches<MinSize,\n                              V,\n                              true> : public std::integral_constant<bool, (MinSize <= V::Size)>\n{\n};\n\ntemplate <std::size_t MinSize, typename T, std::size_t ArraySize>\nstruct IndexVectorSizeMatches<MinSize,\n                              T[ArraySize],\n                              false> : public std::integral_constant<bool, (MinSize <= ArraySize)>\n{\n};\n\ntemplate <std::size_t MinSize, typename T, std::size_t ArraySize>\nstruct IndexVectorSizeMatches<MinSize,\n                              std::array<T, ArraySize>,\n                              false> : public std::integral_constant<bool, (MinSize <= ArraySize)>\n{\n};\n\ntemplate <std::size_t MinSize, typename T, std::size_t ArraySize>\nstruct IndexVectorSizeMatches<MinSize,\n                              Vc::array<T, ArraySize>,\n                              false> : public std::integral_constant<bool, (MinSize <= ArraySize)>\n{\n};\n\ntemplate <std::size_t MinSize, typename T, std::ptrdiff_t N>\nstruct IndexVectorSizeMatches<MinSize, Vc::Common::span<T, N>, false>\n    : public std::integral_constant<bool, (N == -1 || static_cast<std::ptrdiff_t>(MinSize) <= N)> {\n};\n// SubscriptOperation {{{1\ntemplate <\n    typename T, typename IndexVector, typename Scale = std::ratio<1, 1>,\n    bool = is_valid_indexvector_<IndexVector>::value>\nclass SubscriptOperation\n{\n    const IndexVector m_indexes;\n    T *const m_address;\n    using ScalarType = typename std::decay<T>::type;\n\n    using IndexVectorScaled = Traits::decay<decltype(convertIndexVector(std::declval<const IndexVector &>()))>;\n\npublic:\n    // try to stop the user from forming lvalues of this type\n    SubscriptOperation &operator=(const SubscriptOperation &) = delete;\n    SubscriptOperation(const SubscriptOperation &) = delete;\n#ifndef __cpp_guaranteed_copy_elision\n    constexpr SubscriptOperation(SubscriptOperation &&) = default;\n#endif\n\n    template <typename U,\n              typename = enable_if<((std::is_convertible<const U &, IndexVector>::value ||\n                                     std::is_same<U, IndexVector>::value) &&\n                                    std::is_copy_constructible<IndexVector>::value)>>\n    constexpr Vc_ALWAYS_INLINE SubscriptOperation(T *address, const U &indexes)\n        : m_indexes(indexes), m_address(address)\n    {\n    }\n\n    template <std::size_t... Indexes>\n    constexpr Vc_ALWAYS_INLINE SubscriptOperation(T *address, const IndexVector &indexes,\n                                                  index_sequence<Indexes...>)\n        : m_indexes{indexes[Indexes]...}, m_address(address)\n    {}\n\n    template <typename U>\n    constexpr Vc_ALWAYS_INLINE SubscriptOperation(\n        T *address, const U &indexes,\n        enable_if<((std::is_convertible<const U &, IndexVector>::value ||\n                    std::is_same<U, IndexVector>::value) &&\n                   !std::is_copy_constructible<IndexVector>::value &&\n                   std::is_array<IndexVector>::value &&\n                   std::extent<IndexVector>::value > 0)> = nullarg)\n        : SubscriptOperation(address, indexes,\n                             make_index_sequence<std::extent<IndexVector>::value>())\n    {\n    }\n\n    static constexpr bool need_explicit_scaling =\n        Scale::num % Scale::den != 0 || Scale::num / Scale::den * sizeof(T) > 8;\n\n    Vc_ALWAYS_INLINE\n        GatherArguments<typename std::remove_cv<T>::type, IndexVectorScaled,\n                        (need_explicit_scaling ? 1 : Scale::num / Scale::den)>\n        gatherArguments() &&\n    {\n        static_assert(std::is_arithmetic<ScalarType>::value,\n                      \"Incorrect type for a SIMD vector gather. Must be an arithmetic type.\");\n        return {applyScale<typename std::conditional<need_explicit_scaling, Scale,\n                                                     std::ratio<1, 1>>::type>(\n                    convertIndexVector(m_indexes)),\n                m_address};\n    }\n\n    Vc_ALWAYS_INLINE ScatterArguments<T, IndexVectorScaled> scatterArguments() &&\n    {\n        static_assert(std::is_arithmetic<ScalarType>::value,\n                      \"Incorrect type for a SIMD vector scatter. Must be an arithmetic type.\");\n        return {applyScale<Scale>(convertIndexVector(m_indexes)), m_address};\n    }\n\n    template <typename V,\n              typename = enable_if<(std::is_arithmetic<ScalarType>::value &&Traits::is_simd_vector<\n                  V>::value &&IndexVectorSizeMatches<V::Size, IndexVector>::value)>>\n    Vc_INTRINSIC operator V() &&\n    {\n        return V(static_cast<SubscriptOperation &&>(*this).gatherArguments());\n    }\n\n    template <typename V,\n              typename = enable_if<(std::is_arithmetic<ScalarType>::value &&Traits::is_simd_vector<\n                  V>::value &&IndexVectorSizeMatches<V::Size, IndexVector>::value)>>\n    Vc_ALWAYS_INLINE SubscriptOperation &operator=(const V &rhs) &&\n    {\n        static_assert(std::is_arithmetic<ScalarType>::value,\n                      \"Incorrect type for a SIMD vector scatter. Must be an arithmetic type.\");\n        const auto indexes = applyScale<Scale>(convertIndexVector(m_indexes));\n        rhs.scatter(m_address, indexes);\n        return *this;\n    }\n\n    // precondition: m_address points to a struct/class/union\n    template <\n        typename U,\n        typename S,  // S must be equal to T. Still we require this template parameter -\n        // otherwise instantiation of SubscriptOperation would only be valid for\n        // structs/unions.\n        typename = enable_if<std::is_same<S, typename std::remove_cv<T>::type>::value &&(\n            std::is_class<T>::value || std::is_union<T>::value)>>\n    Vc_ALWAYS_INLINE auto operator[](U S::*member) &&\n        -> SubscriptOperation<\n              typename std::conditional<std::is_const<T>::value,\n                                        const typename std::remove_reference<U>::type,\n                                        typename std::remove_reference<U>::type>::type,\n              IndexVector,\n              // By passing the scale factor as a fraction of integers in the template\n              // arguments the value does not lose information if the division yields a\n              // non-integral value. This could happen e.g. for a struct of struct (S2 {\n              // S1, char }, with sizeof(S1) = 16, sizeof(S2) = 20. Then scale would be\n              // 20/16)\n              std::ratio_multiply<Scale, std::ratio<sizeof(S), sizeof(U)>>>\n    {\n        static_assert(std::is_same<Traits::decay<decltype(m_address->*member)>,\n                                   Traits::decay<U>>::value,\n                      \"Type mismatch that should be impossible.\");\n        // TODO: check whether scale really works for unions correctly\n        return {&(m_address->*member), m_indexes};\n    }\n\n    /*\n     * The following functions allow subscripting of nested arrays. But\n     * there are two cases of containers and only one that we want to support:\n     * 1. actual arrays (e.g. T[N] or std::array<T, N>)\n     * 2. dynamically allocated vectors (e.g. std::vector<T>)\n     *\n     * For (1.) the offset calculation is straightforward.\n     * For (2.) the m_address pointer points to memory where pointers are\n     * stored to the actual data. Meaning the data can be scattered\n     * freely in memory (and far away from what m_address points to). Supporting this leads to\n     * serious trouble with the pointer (it does not really point to the start of a memory\n     * region anymore) and inefficient code. The user is better off to write a loop that assigns the\n     * scalars to the vector object sequentially.\n     */\n\nprivate:\n    // The following is a workaround for MSVC 2015 Update 2. Whenever the ratio\n    // in the return type of the following operator[] is encountered with a sizeof\n    // expression that fails, MSVC decides to substitute a 0 for the sizeof instead of\n    // just leaving the ratio instantiation alone via proper SFINAE. The make_ratio helper\n    // ensures that the 0 from the sizeof failure does not reach the denominator of\n    // std::ratio where it would hit a static_assert.\n    template <intmax_t N, intmax_t D> struct make_ratio {\n        using type = std::ratio<N, D == 0 ? 1 : D>;\n    };\n\npublic:\n    // precondition: m_address points to a type that implements the subscript operator\n    template <typename U>\n    // U is only required to delay name lookup to the 2nd phase (on use).\n    // This is necessary because m_address[0][index] is only a correct\n    // expression if has_subscript_operator<T>::value is true.\n    Vc_ALWAYS_INLINE auto operator[](U index) && -> typename std::enable_if<\n#ifndef Vc_IMPROVE_ERROR_MESSAGES\n        Traits::has_no_allocated_data<T>::value &&\n#endif\n            std::is_convertible<U, size_t>::value,\n        SubscriptOperation<\n            // the following decltype expression must depend on index and cannot\n            // simply use [0][0] because it would yield an invalid expression in\n            // case m_address[0] returns a struct/union\n            typename std::remove_reference<decltype(m_address[0][index])>::type,\n            IndexVector,\n            std::ratio_multiply<\n                Scale,\n                typename make_ratio<sizeof(T), sizeof(m_address[0][index])>::type>>>::type\n    {\n        static_assert(Traits::has_subscript_operator<T>::value,\n                      \"The subscript operator was called on a type that does not implement it.\\n\");\n        static_assert(Traits::has_no_allocated_data<T>::value,\n                      \"Invalid container type in gather/scatter operation.\\nYou may only use \"\n                      \"nested containers that store the data inside the object (such as builtin \"\n                      \"arrays or std::array) but not containers that store data in allocated \"\n                      \"memory (such as std::vector).\\nSince this feature cannot be queried \"\n                      \"generically at compile time you need to spezialize the \"\n                      \"Vc::Traits::has_no_allocated_data_impl<T> type-trait for custom types that \"\n                      \"meet the requirements.\\n\");\n        static_assert(std::is_lvalue_reference<decltype(m_address[0][index])>::value,\n                      \"The container does not return an lvalue reference to the data at \"\n                      \"the requested offset. This makes it impossible to execute a \"\n                      \"gather operation.\\n\");\n        return {&(m_address[0][index]), m_indexes};\n    }\n\n    // precondition: m_address points to a type that implements the subscript operator\n    template <typename IT>\n    Vc_ALWAYS_INLINE typename std::enable_if<\n#ifndef Vc_IMPROVE_ERROR_MESSAGES\n        Traits::has_no_allocated_data<T>::value &&\n            Traits::has_subscript_operator<T>::value &&\n#endif\n            Traits::has_subscript_operator<IT>::value,\n        SubscriptOperation<typename std::remove_reference<decltype(\n                               m_address[0][std::declval<\n                                   const IT &>()[0]]  // std::declval<IT>()[0] could\n                                                      // be replaced with 0 if it\n                               // were not for two-phase lookup. We need to make the\n                               // m_address[0][0] expression dependent on IT\n                               )>::type,\n                           IndexVectorScaled,\n                           std::ratio<1, 1>  // reset Scale to 1 since it is applied below\n                           >>::type\n    operator[](const IT &index) &&\n    {\n        static_assert(Traits::has_subscript_operator<T>::value,\n                      \"The subscript operator was called on a type that does not implement it.\\n\");\n        static_assert(Traits::has_no_allocated_data<T>::value,\n                      \"Invalid container type in gather/scatter operation.\\nYou may only use \"\n                      \"nested containers that store the data inside the object (such as builtin \"\n                      \"arrays or std::array) but not containers that store data in allocated \"\n                      \"memory (such as std::vector).\\nSince this feature cannot be queried \"\n                      \"generically at compile time you need to spezialize the \"\n                      \"Vc::Traits::has_no_allocated_data_impl<T> type-trait for custom types that \"\n                      \"meet the requirements.\\n\");\n        return {&(m_address[0][0]),\n                applyScaleAndAdd<std::ratio_multiply<\n                    Scale, std::ratio<sizeof(T), sizeof(m_address[0][0])>>>(\n                    convertIndexVector(m_indexes), index)};\n    }\n};\n\n// specialization for invalid IndexVector type\ntemplate <typename T, typename IndexVector, typename Scale>\nclass SubscriptOperation<T, IndexVector, Scale, false>;\n\n// subscript_operator {{{1\ntemplate <\n    typename Container,\n    typename IndexVector,\n    typename = enable_if<\n        Traits::has_subscript_operator<IndexVector>::value  // The index vector must provide [] for\n                                                            // the implementations of gather/scatter\n        &&Traits::has_contiguous_storage<Container>::value  // Container must use contiguous\n                                                            // storage, otherwise the index vector\n        // cannot be used as memory offsets, which is required for efficient\n        // gather/scatter implementations\n        &&std::is_lvalue_reference<decltype(*begin(std::declval<\n            Container>()))>::value  // dereferencing the begin iterator must yield an lvalue\n                                    // reference (const or non-const). Otherwise it is not possible\n                                    // to determine a pointer to the data storage (see above).\n        >>\nVc_ALWAYS_INLINE SubscriptOperation<\n    typename std::remove_reference<decltype(*begin(std::declval<Container>()))>::\n        type,  // the type of the first value in the container is what the internal array pointer\n               // has to point to. But if the subscript operator of the container returns a\n               // reference we need to drop that part because it's useless information for us. But\n               // const and volatile, as well as array rank/extent are interesting and need not be\n               // dropped.\n    typename std::remove_const<typename std::remove_reference<\n        IndexVector>::type>::type  // keep volatile and possibly the array extent, but the const and\n                                   // & parts of the type need to be removed because\n                                   // SubscriptOperation explicitly adds them for its member type\n    > subscript_operator(Container &&c, IndexVector &&indexes)\n{\n    Vc_ASSERT(std::addressof(*begin(c)) + 1 ==\n              std::addressof(*(begin(c) + 1)));  // runtime assertion for contiguous storage, this\n                                                 // requires a RandomAccessIterator - but that\n                                                 // should be given for a container with contiguous\n                                                 // storage\n    return {std::addressof(*begin(c)), std::forward<IndexVector>(indexes)};\n}\n\n/**\n * \\internal\n * Implement subscripts of std::initializer_list. This function must be in the global scope\n * because Container arguments may be in any scope. The other argument is in std scope.\n *\n * -----\n * std::initializer_list does not have constexpr member functions in C++11, but from C++14 onwards\n * the world is a happier place. :)\n */\ntemplate <typename Container, typename I>\nVc_ALWAYS_INLINE Vc::Common::SubscriptOperation<\n    typename std::remove_reference<decltype(std::declval<Container>()[0])>::type,\n    const std::initializer_list<I> &> subscript_operator(Container &&vec,\n                                                   const std::initializer_list<I> &indexes)\n{\n    return {&vec[0], indexes};\n}\n//}}}1\n\n}  // namespace Common\n\nusing Common::subscript_operator;\n\n}  // namespace Vc\n\n#endif // VC_COMMON_SUBSCRIPT_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/support.h",
    "content": "#ifndef VC_DEPRECATED_COMMON_SUPPORT_H_\n#define VC_DEPRECATED_COMMON_SUPPORT_H_\n#ifdef __GNUC__\n#warning \"the <Vc/common/support.h> header is deprecated. Use <Vc/support.h> instead.\"\n#endif\n#include <Vc/support.h>\n#endif // VC_DEPRECATED_COMMON_SUPPORT_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/transpose.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_TRANSPOSE_H_\n#define VC_COMMON_TRANSPOSE_H_\n\n#include \"macros.h\"\n#include <tuple>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\ntemplate <typename... Inputs> struct TransposeProxy\n{\n    TransposeProxy(const Inputs &... inputs) : in{inputs...} {}\n\n    std::tuple<const Inputs &...> in;\n};\n\ntemplate <int LhsLength, size_t RhsLength> struct TransposeTag {\n};\n}  // namespace Common\n\ntemplate <typename... Vs> Common::TransposeProxy<Vs...> transpose(Vs... vs)\n{\n    return {vs...};\n}\n}  // namespace Vc\n\n#endif  // VC_COMMON_TRANSPOSE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/trigonometric.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_TRIGONOMETRIC_H_\n#define VC_COMMON_TRIGONOMETRIC_H_\n\n#include \"macros.h\"\n\n#ifdef Vc_HAVE_LIBMVEC\nextern \"C\" {\n__m128 _ZGVbN4v_sinf(__m128);\n__m128d _ZGVbN2v_sin(__m128d);\n__m128 _ZGVbN4v_cosf(__m128);\n__m128d _ZGVbN2v_cos(__m128d);\n__m256 _ZGVdN8v_sinf(__m256);\n__m256d _ZGVdN4v_sin(__m256d);\n__m256 _ZGVdN8v_cosf(__m256);\n__m256d _ZGVdN4v_cos(__m256d);\n}\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate<Vc::Implementation Impl> struct MapImpl { enum Dummy { Value = Impl }; };\ntemplate<> struct MapImpl<Vc::SSE42Impl> { enum Dummy { Value = MapImpl<Vc::SSE41Impl>::Value }; };\n\ntemplate<Vc::Implementation Impl> using TrigonometricImplementation =\n    ImplementationT<MapImpl<Impl>::Value\n#if defined(Vc_IMPL_XOP) && defined(Vc_IMPL_FMA4)\n    + Vc::XopInstructions\n    + Vc::Fma4Instructions\n#endif\n    >;\n}  // namespace Detail\n\nnamespace Common\n{\ntemplate<typename Impl> struct Trigonometric\n{\n    template<typename T> static T Vc_VDECL sin(const T &_x);\n    template<typename T> static T Vc_VDECL cos(const T &_x);\n    template<typename T> static void Vc_VDECL sincos(const T &_x, T *_sin, T *_cos);\n    template<typename T> static T Vc_VDECL asin (const T &_x);\n    template<typename T> static T Vc_VDECL atan (const T &_x);\n    template<typename T> static T Vc_VDECL atan2(const T &y, const T &x);\n};\n}  // namespace Common\n\n#if defined Vc_IMPL_SSE || defined DOXYGEN\n// this is either SSE, AVX, or AVX2\nnamespace Detail\n{\ntemplate <typename T, typename Abi>\nusing Trig = Common::Trigonometric<Detail::TrigonometricImplementation<\n    (std::is_same<Abi, VectorAbi::Sse>::value\n         ? SSE42Impl\n         : std::is_same<Abi, VectorAbi::Avx>::value ? AVXImpl : ScalarImpl)>>;\n}  // namespace Detail\n\n#ifdef Vc_HAVE_LIBMVEC\nVc_INTRINSIC __m128  sin_dispatch(__m128  x) { return ::_ZGVbN4v_sinf(x); }\nVc_INTRINSIC __m128d sin_dispatch(__m128d x) { return ::_ZGVbN2v_sin (x); }\nVc_INTRINSIC __m128  cos_dispatch(__m128  x) { return ::_ZGVbN4v_cosf(x); }\nVc_INTRINSIC __m128d cos_dispatch(__m128d x) { return ::_ZGVbN2v_cos (x); }\n#ifdef Vc_IMPL_AVX\nVc_INTRINSIC __m256  sin_dispatch(__m256  x) { return ::_ZGVdN8v_sinf(x); }\nVc_INTRINSIC __m256d sin_dispatch(__m256d x) { return ::_ZGVdN4v_sin (x); }\nVc_INTRINSIC __m256  cos_dispatch(__m256  x) { return ::_ZGVdN8v_cosf(x); }\nVc_INTRINSIC __m256d cos_dispatch(__m256d x) { return ::_ZGVdN4v_cos (x); }\n#endif\n\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vector<T, detail::not_fixed_size_abi<Abi>> sin(const Vector<T, Abi> &x)\n{\n    return sin_dispatch(x.data());\n}\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vector<T, detail::not_fixed_size_abi<Abi>> cos(const Vector<T, Abi> &x)\n{\n    return cos_dispatch(x.data());\n}\n#else\n/**\n * \\ingroup Math\n * Returns the sine of all input values in \\p x.\n *\n * \\param x The values to apply the sine function on.\n *\n * \\returns the sine of \\p x.\n *\n * \\note The single-precision implementation has a precision of max. 2 ulp (mean 0.17 ulp)\n * in the range [-8192, 8192].\n * (testSin< float_v> with a maximal distance of 2 to the reference (mean: 0.310741))\n *\n * \\note The double-precision implementation has a precision of max. 3 ulp (mean 1040 ulp)\n * in the range [-8192, 8192].\n * (testSin<double_v> with a maximal distance of 1 to the reference (mean: 0.170621))\n *\n * \\note The precision and execution latency depends on:\n *       - `Abi` (e.g. Scalar uses the `<cmath>` implementation\n *       - whether `Vc_HAVE_LIBMVEC` is defined\n *       - for the `<cmath>` fallback, the implementations differ (e.g. MacOS vs. Linux\n * vs. Windows; fpmath=sse vs. fpmath=387)\n *\n * \\note Vc versions before 1.4 had different precision.\n */\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vector<T, detail::not_fixed_size_abi<Abi>> sin(const Vector<T, Abi> &x)\n{\n    return Detail::Trig<T, Abi>::sin(x);\n}\n\n/**\n * \\ingroup Math\n * Returns the cosine of all input values in \\p x.\n *\n * \\param x The values to apply the cosine function on.\n * \\returns the cosine of \\p x.\n *\n * \\note The single-precision implementation has a precision of max. 2 ulp (mean 0.18 ulp) in the range [-8192, 8192].\n * \\note The double-precision implementation has a precision of max. 3 ulp (mean 1160 ulp) in the range [-8192, 8192].\n * \\note Vc versions before 1.4 had different precision.\n */\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vector<T, detail::not_fixed_size_abi<Abi>> cos(const Vector<T, Abi> &x)\n{\n    return Detail::Trig<T, Abi>::cos(x);\n}\n#endif\n\n/**\n * \\ingroup Math\n * Returns the arcsine of all input values in \\p x.\n *\n * \\param x The values to apply the arcsine function on.\n * \\returns the arcsine of \\p x.\n *\n * \\note The single-precision implementation has an error of max. 2 ulp (mean 0.3 ulp).\n * \\note The double-precision implementation has an error of max. 36 ulp (mean 0.4 ulp).\n */\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vector<T, detail::not_fixed_size_abi<Abi>> asin(const Vector<T, Abi> &x)\n{\n    return Detail::Trig<T, Abi>::asin(x);\n}\n\n/**\n * \\ingroup Math\n * Returns the arctangent of all input values in \\p x.\n *\n * \\param x The values to apply the arctangent function on.\n * \\returns the arctangent of \\p x.\n * \\note The single-precision implementation has an error of max. 3 ulp (mean 0.4 ulp) in the range [-8192, 8192].\n * \\note The double-precision implementation has an error of max. 2 ulp (mean 0.1 ulp) in the range [-8192, 8192].\n */\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vector<T, detail::not_fixed_size_abi<Abi>> atan(const Vector<T, Abi> &x)\n{\n    return Detail::Trig<T, Abi>::atan(x);\n}\n\n/**\n * \\ingroup Math\n * Returns the arctangent of all input values in \\p x and \\p y.\n *\n * Calculates the angle given the lengths of the opposite and adjacent legs in a right\n * triangle.\n * \\param y The opposite leg.\n * \\param x The adjacent leg.\n * \\returns the arctangent of \\p y / \\p x.\n */\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vector<T, detail::not_fixed_size_abi<Abi>> atan2(const Vector<T, Abi> &y,\n                                                              const Vector<T, Abi> &x)\n{\n    return Detail::Trig<T, Abi>::atan2(y, x);\n}\n\n/**\n * \\ingroup Math\n *\n * \\param x Input value to both sine and cosine.\n * \\param sin A non-null pointer to a potentially uninitialized object of type Vector.\n *            When \\c sincos returns, `*sin` contains the result of `sin(x)`.\n * \\param cos A non-null pointer to a potentially uninitialized object of type Vector.\n *            When \\c sincos returns, `*cos` contains the result of `cos(x)`.\n *\n * \\see sin, cos\n */\ntemplate <typename T, typename Abi>\nVc_INTRINSIC void sincos(const Vector<T, Abi> &x,\n                         Vector<T, detail::not_fixed_size_abi<Abi>> *sin,\n                         Vector<T, Abi> *cos)\n{\n    Detail::Trig<T, Abi>::sincos(x, sin, cos);\n}\n#endif\n}  // namespace Vc_VERSIONED_NAMESPACE\n\n#endif  // VC_COMMON_TRIGONOMETRIC_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/types.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_TYPES_H_\n#define VC_COMMON_TYPES_H_\n\n#ifdef Vc_CHECK_ALIGNMENT\n#include <cstdlib>\n#include <cstdio>\n#endif\n\n#include <ratio>\n#include \"../global.h\"\n#include \"../traits/type_traits.h\"\n#include \"permutation.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n///\\addtogroup Utilities\n///@{\n\n/// \\internal Allow writing \\c size_t without the `std::` prefix.\nusing std::size_t;\n\n/// long long shorthand\nusing llong = long long;\n/// unsigned long long shorthand\nusing ullong = unsigned long long;\n/// unsigned long shorthand\nusing ulong = unsigned long;\n/// unsigned int shorthand\nusing uint = unsigned int;\n/// unsigned short shorthand\nusing ushort = unsigned short;\n/// unsigned char shorthand\nusing uchar = unsigned char;\n/// signed char shorthand\nusing schar = signed char;\n\n/**\\internal\n * Tag type for explicit zero-initialization\n */\nstruct VectorSpecialInitializerZero {};\n/**\\internal\n * Tag type for explicit one-initialization\n */\nstruct VectorSpecialInitializerOne {};\n/**\\internal\n * Tag type for explicit \"iota-initialization\"\n */\nstruct VectorSpecialInitializerIndexesFromZero {};\n\n/**\n * The special object \\p Vc::Zero can be used to construct Vector and Mask objects\n * initialized to zero/\\c false.\n */\nconstexpr VectorSpecialInitializerZero Zero = {};\n/**\n * The special object \\p Vc::One can be used to construct Vector and Mask objects\n * initialized to one/\\c true.\n */\nconstexpr VectorSpecialInitializerOne One = {};\n/**\n * The special object \\p Vc::IndexesFromZero can be used to construct Vector objects\n * initialized to values 0, 1, 2, 3, 4, ...\n */\nconstexpr VectorSpecialInitializerIndexesFromZero IndexesFromZero = {};\n///@}\n\nnamespace Detail\n{\ntemplate<typename T> struct MayAliasImpl {\n#ifdef Vc_ICC\n#pragma warning(disable:2621)\n#endif\n#ifdef __GNUC__\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wattributes\"\n#endif\n    typedef T type Vc_MAY_ALIAS;\n#ifdef __GNUC__\n#pragma GCC diagnostic pop\n#endif\n#ifdef Vc_ICC\n#pragma warning(enable:2621)\n#endif\n};\n//template<size_t Bytes> struct MayAlias<MaskBool<Bytes>> { typedef MaskBool<Bytes> type; };\n}  // namespace Detail\n/**\\internal\n * Helper MayAlias<T> that turns T into the type to be used for an aliasing pointer. This\n * adds the may_alias attribute to T (with compilers that support it). But for MaskBool this\n * attribute is already part of the type and applying it a second times leads to warnings/errors,\n * therefore MaskBool is simply forwarded as is.\n */\ntemplate <typename T> using MayAlias = typename Detail::MayAliasImpl<T>::type;\n\ntemplate <class To, class From> MayAlias<To> &aliasing_cast(From &x)\n{\n    return *reinterpret_cast<MayAlias<To> *>(&x);\n}\ntemplate <class To, class From> const MayAlias<To> &aliasing_cast(const From &x)\n{\n    return *reinterpret_cast<const MayAlias<To> *>(&x);\n}\n\ntemplate <class To, class From> MayAlias<To> *aliasing_cast(From *x)\n{\n    return reinterpret_cast<MayAlias<To> *>(x);\n}\ntemplate <class To, class From> const MayAlias<To> *aliasing_cast(const From *x)\n{\n    return reinterpret_cast<const MayAlias<To> *>(x);\n}\n\n/**\\internal\n * This enumeration lists all possible operators in C++.\n *\n * The assignment and compound assignment enumerators are used with the conditional_assign\n * implementation.\n */\nenum class Operator : char {\n    Assign,\n    Multiply,\n    MultiplyAssign,\n    Divide,\n    DivideAssign,\n    Remainder,\n    RemainderAssign,\n    Plus,\n    PlusAssign,\n    Minus,\n    MinusAssign,\n    RightShift,\n    RightShiftAssign,\n    LeftShift,\n    LeftShiftAssign,\n    And,\n    AndAssign,\n    Xor,\n    XorAssign,\n    Or,\n    OrAssign,\n    PreIncrement,\n    PostIncrement,\n    PreDecrement,\n    PostDecrement,\n    LogicalAnd,\n    LogicalOr,\n    Comma,\n    UnaryPlus,\n    UnaryMinus,\n    UnaryNot,\n    UnaryOnesComplement,\n    CompareEqual,\n    CompareNotEqual,\n    CompareLess,\n    CompareGreater,\n    CompareLessEqual,\n    CompareGreaterEqual\n};\n\n// forward declaration for Vc::array in <Vc/array>\ntemplate <typename T, std::size_t N> struct array;\n// forward declaration for Vc::span in <Vc/span>\nnamespace Common {\ntemplate <typename T, std::ptrdiff_t N> class span;\n}\n\n/* TODO: add type for half-float, something along these lines:\nclass half_float\n{\n    uint16_t data;\npublic:\n    constexpr half_float() : data(0) {}\n    constexpr half_float(const half_float &) = default;\n    constexpr half_float(half_float &&) = default;\n    constexpr half_float &operator=(const half_float &) = default;\n\n    constexpr explicit half_float(float);\n    constexpr explicit half_float(double);\n    constexpr explicit half_float(int);\n    constexpr explicit half_float(unsigned int);\n\n    explicit operator float       () const;\n    explicit operator double      () const;\n    explicit operator int         () const;\n    explicit operator unsigned int() const;\n\n    bool operator==(half_float rhs) const;\n    bool operator!=(half_float rhs) const;\n    bool operator>=(half_float rhs) const;\n    bool operator<=(half_float rhs) const;\n    bool operator> (half_float rhs) const;\n    bool operator< (half_float rhs) const;\n\n    half_float operator+(half_float rhs) const;\n    half_float operator-(half_float rhs) const;\n    half_float operator*(half_float rhs) const;\n    half_float operator/(half_float rhs) const;\n};\n*/\n\n// TODO: the following doesn't really belong into the toplevel Vc namespace.\n#ifndef Vc_CHECK_ALIGNMENT\ntemplate<typename _T> static Vc_ALWAYS_INLINE void assertCorrectAlignment(const _T *){}\n#else\ntemplate<typename _T> static Vc_ALWAYS_INLINE void assertCorrectAlignment(const _T *ptr)\n{\n    const size_t s = alignof(_T);\n    if((reinterpret_cast<size_t>(ptr) & ((s ^ (s & (s - 1))) - 1)) != 0) {\n        fprintf(stderr, \"A vector with incorrect alignment has just been created. Look at the stacktrace to find the guilty object.\\n\");\n        abort();\n    }\n}\n#endif\n\nnamespace Common\n{\n// defined in common/simdarrayhelper.h\ntemplate <typename T, std::size_t Pieces, std::size_t Index> struct Segment;\n\n/**\n * \\internal\n *\n * Helper interface to make m_indexes in InterleavedMemoryAccessBase behave like an integer vector.\n * Only that the entries are successive entries from the given start index.\n */\ntemplate<size_t StructSize> class SuccessiveEntries\n{\n#ifdef Vc_MSVC\n    // scatterinterleavedmemory fails with garbage values in m_first if size_type is a\n    // 64-bit integer type. Using a 32-bit type seems to work around the miscompilation.\n    using size_type = unsigned;\n#else\n    using size_type = size_t;\n#endif\n    const size_type m_first;\n\npublic:\n    typedef SuccessiveEntries AsArg;\n    Vc_INTRINSIC SuccessiveEntries(size_type first) : m_first(first) {}\n    Vc_INTRINSIC Vc_PURE size_type operator[](size_type offset) const\n    {\n        return m_first + offset * StructSize;\n    }\n    Vc_INTRINSIC Vc_PURE size_type data() const { return m_first; }\n    Vc_INTRINSIC Vc_PURE SuccessiveEntries operator+(const SuccessiveEntries &rhs) const\n    {\n        return SuccessiveEntries(m_first + rhs.m_first);\n    }\n    Vc_INTRINSIC Vc_PURE SuccessiveEntries operator*(const SuccessiveEntries &rhs) const\n    {\n        return SuccessiveEntries(m_first * rhs.m_first);\n    }\n    Vc_INTRINSIC Vc_PURE SuccessiveEntries operator<<(size_type x) const\n    {\n        return {m_first << x};\n    }\n\n    friend Vc_INTRINSIC SuccessiveEntries &internal_data(SuccessiveEntries &x)\n    {\n        return x;\n    }\n    friend Vc_INTRINSIC const SuccessiveEntries &internal_data(const SuccessiveEntries &x)\n    {\n        return x;\n    }\n};\n\n// declaration for functions in common/malloc.h\ntemplate <std::size_t alignment>\nVc_INTRINSIC_L void *aligned_malloc(std::size_t n) Vc_INTRINSIC_R;\nVc_ALWAYS_INLINE_L void free(void *p) Vc_ALWAYS_INLINE_R;\n\n/**\\internal\n * Central definition of the type combinations that convert implicitly.\n */\ntemplate <typename Mask, typename T, typename U>\nusing enable_if_mask_converts_implicitly =\n    enable_if<(!std::is_same<Mask, Traits::decay<U>>::value &&  // that'd be the copy ctor\n               Traits::is_simd_mask<U>::value && !Traits::isSimdMaskArray<U>::value &&\n               Traits::is_implicit_cast_allowed_mask<\n                   Traits::entry_type_of<typename Traits::decay<U>::Vector>, T>::value)>;\n/**\\internal\n * Central definition of the type combinations that only convert explicitly.\n */\ntemplate <typename T, typename U>\nusing enable_if_mask_converts_explicitly = enable_if<(\n    Traits::isSimdMaskArray<U>::value ||\n    (Traits::is_simd_mask<U>::value &&\n     !Traits::is_implicit_cast_allowed_mask<\n         Traits::entry_type_of<typename Traits::decay<U>::Vector>, T>::value))>;\n\n/**\\internal\n * Tag type for overloading on the width (\\VSize{T}) of a vector.\n */\ntemplate <typename T> using WidthT = std::integral_constant<std::size_t, sizeof(T)>;\n\n// forward declaration of MaskBool in common/maskbool.h\ntemplate <std::size_t Bytes> class MaskBool;\n\n// forward declaration of SubscriptOperation in common/subscript.h\ntemplate <typename T, typename IndexVector, typename Scale, bool>\nclass SubscriptOperation;\n\n/**\n * \\internal\n * Helper type to pass along the two arguments for a gather operation.\n *\n * \\tparam IndexVector  Normally an integer SIMD vector, but an array or std::vector also\n *                      works (though often not as efficient).\n */\ntemplate <class T, class IndexVector, int Scale = 1>\nstruct GatherArguments {\n    static_assert(std::is_same<T, remove_cvref_t<T>>::value && !std::is_pointer<T>::value,\n                  \"GatherArguments expects an cv unqualified non-ref/ptr type\");\n    const IndexVector indexes;\n    const T *const address;\n};\ntemplate <int Scale, class T, class I>\nGatherArguments<T, I, Scale> make_gather(const T *m, const I &i)\n{\n    return {i, m};\n}\n\n/**\n * \\internal\n * Helper type to pass along the two arguments for a scatter operation.\n *\n * \\tparam IndexVector  Normally an integer SIMD vector, but an array or std::vector also\n *                      works (though often not as efficient).\n */\ntemplate <typename T, typename IndexVector> struct ScatterArguments\n{\n    const IndexVector indexes;\n    T *const address;\n};\n\n/**\\internal\n * Break the recursion of the function below.\n */\ntemplate <typename I, I Begin, I End, typename F>\nVc_INTRINSIC enable_if<(Begin >= End), void> unrolled_loop(F &&)\n{\n}\n\n/**\\internal\n * Force the code in the lambda \\p f to be called with indexes starting from \\p Begin up\n * to (excluding) \\p End to be called without compare and jump instructions (i.e. an\n * unrolled loop).\n */\ntemplate <typename I, I Begin, I End, typename F>\nVc_INTRINSIC Vc_FLATTEN enable_if<(Begin < End), void> unrolled_loop(F &&f)\n{\n    f(Begin);\n    unrolled_loop<I, Begin + 1, End>(f);\n}\n\n/**\\internal\n * Small simplification of the unrolled_loop call for ranges from 0 to \\p Size using\n * std::size_t as the index type.\n */\ntemplate <std::size_t Size, typename F> Vc_INTRINSIC void for_all_vector_entries(F &&f)\n{\n    unrolled_loop<std::size_t, 0u, Size>(std::forward<F>(f));\n}\n\n}  // namespace Common\n}  // namespace Vc\n\n#include \"vector.h\"\n#include \"mask.h\"\n#include \"memoryfwd.h\"\n\n#endif // VC_COMMON_TYPES_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/utility.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_UTILITY_H_\n#define VC_COMMON_UTILITY_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n/**\n * \\internal\n * Returns the next power of 2 larger than or equal to \\p x.\n */\ntemplate <size_t x, bool = (x & (x - 1)) == 0> struct NextPowerOfTwo;\ntemplate <size_t x>\nstruct NextPowerOfTwo<x, true> : public std::integral_constant<size_t, x> {\n};\ntemplate <size_t x>\nstruct NextPowerOfTwo<x, false>\n    : public std::integral_constant<\n          size_t, NextPowerOfTwo<(x | (x >> 1) | (x >> 2) | (x >> 5)) + 1>::value> {\n};\n\n/**\n * \\internal\n * Enforce an upper bound to an alignment value. This is necessary because some compilers\n * implement such an upper bound and emit a warning if it is encountered.\n */\ntemplate <size_t A>\nstruct BoundedAlignment : public std::integral_constant<size_t,\n#if defined Vc_MSVC || defined Vc_GCC\n                                                        ((A - 1) &\n#ifdef Vc_MSVC\n                                                         31\n#elif defined __AVX__\n                                                         255\n#else\n                                                         127\n#endif\n                                                         ) + 1\n#else\n                                                        A\n#endif\n                                                        > {\n};\n\n/**\n * \\internal\n * Returns the size of the left/first SimdArray member.\n */\ntemplate <std::size_t N> static constexpr std::size_t left_size()\n{\n    return Common::NextPowerOfTwo<(N + 1) / 2>::value;\n}\n/**\n * \\internal\n * Returns the size of the right/second SimdArray member.\n */\ntemplate <std::size_t N> static constexpr std::size_t right_size()\n{\n    return N - left_size<N>();\n}\n\n}  // namespace Common\n}  // namespace Vc\n\n#endif  // VC_COMMON_UTILITY_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/vector/casts.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\npublic:\n    ///////////////////////////////////////////////////////////////////////////////////////////\n    // casts - implemented in simd_cast_caller.tcc\n\n    // implict conversion from compatible Vector<U>\n    template <typename U>\n    Vc_INTRINSIC_L Vector(\n        U &&x,\n        enable_if<NEON::is_vector<Traits::decay<U>>::value &&\n                  !std::is_same<Vector, Traits::decay<U>>::value &&\n                  Traits::is_implicit_cast_allowed<Traits::entry_type_of<U>, T>::value> =\n            nullarg) Vc_INTRINSIC_R;\n\n    // static_cast from other types\n    template <typename U>\n    Vc_INTRINSIC_L explicit Vector(U &&x,\n                                   enable_if<Traits::is_simd_vector<U>::value &&\n                                             !std::is_same<Vector, Traits::decay<U>>::value>>\n                                   = nullarg) Vc_INTRINSIC_R;\n\n    ///////////////////////////////////////////////////////////////////////////////////////////\n    // broadcast\n    Vc_INTRINSIC Vector(EntryType a);\n    template <typename U>\n    Vc_INTRINSIC Vector(\n        U a,\n        typename std::enable_if<std::is_same<U, int>::value && !std::is_same<U, EntryType>::value,\n                                void *>::type = nullptr)\n        : Vector(static_cast<EntryType>(a))\n    {\n    }\n\n    ///////////////////////////////////////////////////////////////////////////////////////////\n    // explicitly forbid construction from initializer_list\n    explicit Vector(std::initializer_list<EntryType>)\n    {\n        static_assert(std::is_same<EntryType, void>::value,\n                      \"A SIMD vector object cannot be initialized from an initializer list \"\n                      \"because the number of entries in the vector is target-dependent.\");\n    }\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/vector.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_VECTOR_H_\n#define VC_COMMON_VECTOR_H_\n\n#include <ratio>\n#include \"elementreference.h\"\n#include \"types.h\"\n#include \"vectorabi.h\"\n#include \"vectortraits.h\"\n#include \"simdarrayfwd.h\"\n#include \"loadstoreflags.h\"\n#include \"writemaskedvector.h\"\n#include \"detail.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * \\ingroup Math\n * Copies the sign(s) of \\p sign to the value(s) in \\p magnitude and returns the resulting\n * vector.\n *\n * \\param magnitude This vector's magnitude will be used in the return vector.\n * \\param sign This vector's sign bit will be used in the return vector.\n *\n * \\return a value where the sign of the value equals the sign of \\p sign. I.e.\n * `sign(copysign(v, r)) == sign(r)`.\n */\ntemplate <typename T, typename Abi,\n          typename = enable_if<std::is_floating_point<T>::value &&\n                               !detail::is_fixed_size_abi<Abi>::value>>\ninline Vector<T, Abi> copysign(Vector<T, Abi> magnitude, Vector<T, Abi> sign);\n\n/**\n * \\ingroup Math\n * Extracts the exponent of each floating-point vector component.\n *\n * \\param x The vector of values to check for the sign.\n * \\return the exponent to base 2.\n *\n * This function provides efficient access to the exponent of the floating point number. The\n * returned value is a fast approximation to the logarithm of base 2. The absolute error of that\n * approximation is between [0, 1[.\n *\n * Examples:\n\\verbatim\n value | exponent | log2\n=======|==========|=======\n   1.0 |        0 | 0\n   2.0 |        1 | 1\n   3.0 |        1 | 1.585\n   3.9 |        1 | 1.963\n   4.0 |        2 | 2\n   4.1 |        2 | 2.036\n\\endverbatim\n *\n * \\warning This function assumes a positive value (non-zero). If the value is negative the sign bit will\n * modify the returned value. An input value of zero will return the bias of the floating-point\n * representation. If you compile with Vc runtime checks, the function will assert\n * values greater than or equal to zero.\n *\n * You may use abs to apply this function to negative values:\n * \\code\n * exponent(abs(v))\n * \\endcode\n */\ntemplate <typename T, typename Abi,\n          typename = enable_if<std::is_floating_point<T>::value &&\n                               !detail::is_fixed_size_abi<Abi>::value>>\ninline Vector<T, Abi> exponent(Vector<T, Abi> x);\n\n/**\n * \\ingroup Math\n * Returns for each vector component whether it stores a negative value.\n *\n * \\param x The vector of values to check for the sign.\n * \\returns a mask which is \\c true only in those components that are negative in \\p x.\n */\ntemplate <typename T, typename Abi>\nVc_INTRINSIC Vc_CONST typename Vector<T, detail::not_fixed_size_abi<Abi>>::MaskType\nisnegative(Vector<T, Abi> x)\n{\n    return x < Vector<T, Abi>::Zero();\n}\n\n/**\n * \\class Vector types.h <Vc/vector.h>\n * \\ingroup Vectors\n *\n * The main vector class for expressing data parallelism.\n *\n * are specializations of this class.\n * For most cases there are no API differences for the specializations.\n * Make use of Vector<T> for generic programming, otherwise you might prefer to use\n * the \\p *_v aliases.\n *\n * \\see Vc::float_v, Vc::double_v, Vc::int_v, Vc::uint_v, Vc::short_v, Vc::ushort_v\n * \\see Mask\n */\ntemplate<typename T, typename Abi = VectorAbi::Best<T>> class Vector\n{\npublic:\n    /**\n     * Returns the number of scalar components (\\VSize{T}) in a vector of this type.\n     *\n     * The size of the vector. I.e. the number of scalar entries in the vector. Do not\n     * make any assumptions about the size of vectors. If you need vectors of \\c float and\n     * \\c int types use Vector::IndexType or SimdArray.\n     *\n     * You can easily use if clauses to compare Vector sizes. The compiler can\n     * statically evaluate and fully optimize dead code away (very much like \\#ifdef, but\n     * with syntax checking).\n     *\n     * \\returns The number of components (i.e. \\VSize{T}) objects of this vector type\n     * store and manipulate.\n     */\n    static constexpr size_t size() { return VectorTraits<T, Abi>::size(); }\n\n    /**\n     * Specifies the alignment requirement for aligned load and store calls for objects of\n     * this vector type.\n     */\n    static constexpr size_t MemoryAlignment = VectorTraits<T, Abi>::memoryAlignment();\n\n    /// The ABI tag type of the current template instantiation.\n    using abi = Abi;\n\n    /// The type of the entries in the vector.\n    using EntryType = typename VectorTraits<T, Abi>::EntryType;\n    /// \\copydoc EntryType\n    using value_type = EntryType;\n\n    using VectorEntryType = typename VectorTraits<T, Abi>::VectorEntryType;\n    /**\\internal\n     * This type reveals the implementation-specific type used for the data member.\n     */\n    using VectorType = typename VectorTraits<T, Abi>::VectorType;\n    /**\\internal\n     * \\copydoc VectorType\n     */\n    using vector_type = VectorType;\n\n    /// The type of the mask used for masked operations and returned from comparisons.\n    using MaskType = Vc::Mask<T, Abi>;\n    /// \\copydoc MaskType\n    using mask_type = MaskType;\n\n    using MaskArgument = MaskType;\n    using VectorArgument = Vector;\n\n    /// The type of the vector used for indexes in gather and scatter operations.\n    using IndexType = Vc::fixed_size_simd<int, VectorTraits<T, Abi>::size()>;\n    /// \\copydoc IndexType\n    using index_type = IndexType;\n\n    using reference = Detail::ElementReference<Vector>;\n\n    /// \\name Generators\n    ///@{\n    /**\n     * Returns a vector with the entries initialized to zero.\n     */\n    static inline Vector Zero();\n\n    /**\n     * Returns a vector with the entries initialized to one.\n     */\n    static inline Vector One();\n\n    /**\n     * Returns a vector with the entries initialized to 0, 1, 2, 3, 4, 5, ...\n     */\n    static inline Vector IndexesFromZero();\n\n    /**\n     * Returns a vector with pseudo-random entries.\n     *\n     * Currently the state of the random number generator cannot be modified and starts\n     * off with the same state. Thus you will get the same sequence of numbers for the\n     * same sequence of calls.\n     *\n     * \\return a new random vector. Floating-point values will be in the 0-1 range.\n     * Integers will use the full range the integer representation allows.\n     *\n     * \\note This function may use a very small amount of state and thus will be a weak\n     * random number generator.\n     */\n    static inline Vector Random();\n\n    /// Generate a vector object from return values of \\p gen (static variant of \\ref fill).\n    template <typename G> static inline Vector generate(G gen);\n    ///@}\n\n    /// \\name Compile-Time Constant Initialization\n    ///@{\n    /**\n     * Construct a zero-initialized vector object.\n     *\n     * This constructor follows the behavior of the underlying arithmetic type \\p T in\n     * that the expression `T()` zero-initializes the object. On the other hand the\n     * variable \\c x in `T x;` is uninitialized.\n     * Since, for class types, both expressions call the default constructor `Vector<T> x`\n     * must zero-initialize \\c x as well.\n     */\n    inline Vector() = default;\n\n    /**\n     * Construct a vector with the entries initialized to zero.\n     *\n     * \\see Vc::Zero, Zero()\n     */\n    explicit inline Vector(VectorSpecialInitializerZero);\n\n    /**\n     * Construct a vector with the entries initialized to one.\n     *\n     * \\see Vc::One, One()\n     */\n    explicit inline Vector(VectorSpecialInitializerOne);\n\n    /**\n     * Construct a vector with the entries initialized to 0, 1, 2, 3, 4, 5, ...\n     *\n     * \\see Vc::IndexesFromZero, IndexesFromZero()\n     */\n    explicit inline Vector(VectorSpecialInitializerIndexesFromZero);\n    ///@}\n\n    /// \\name Conversion/Broadcast Constructors\n    ///@{\n    /**\n     * Implict conversion from compatible Vector<U, Abi> types.\n     */\n    template <typename U>\n    inline Vector(Vector<U, abi> x,\n                  enable_if<Traits::is_implicit_cast_allowed<U, T>::value> = nullarg);\n\n#if Vc_IS_VERSION_1\n    /**\n     * Explicit conversion (i.e. `static_cast`) from the remaining Vector<U, Abi> types.\n     *\n     * \\param x A vector object to use for initialization of the new vector object. If \\p\n     *          x contains more entries than the new object the high components will be\n     *          ignored. If \\p x contains fewer entries than the new object the high\n     *          components of the new object will be zero-initialized. Type conversion is\n     *          done according to the standard conversion rules for the underlying\n     *          fundamental arithmetic types.\n     */\n    template <typename U>\n    Vc_DEPRECATED(\"use simd_cast instead of explicit type casting to convert between \"\n                  \"vector types\") inline explicit Vector(\n        Vector<U, abi> x,\n        enable_if<!Traits::is_implicit_cast_allowed<U, T>::value> = nullarg);\n#endif\n\n    /**\n     * Broadcast Constructor.\n     *\n     * Constructs a vector with all entries of the vector filled with the given value.\n     *\n     * \\param a The scalar value to broadcast to all entries of the constructed vector.\n     */\n    inline Vector(EntryType a);\n    template <typename U>\n    inline Vector(U a, enable_if<std::is_same<U, int>::value &&\n                                 !std::is_same<U, EntryType>::value> = nullarg);\n    inline explicit Vector(reference a);\n    ///@}\n\n    /**\n     * \\name Loads & Stores\n     */\n    ///@{\n#include \"../common/loadinterface.h\"\n#include \"../common/storeinterface.h\"\n    ///@}\n\n    /**\n     * Set all entries to zero.\n     */\n    inline void setZero();\n\n    /**\n     * Set all entries to zero where the mask is set.\n     *\n     * A 4-vector with a mask of `[0111]` therefore would set the last three entries to 0.\n     *\n     * \\param mask Selects the entries to be set to zero.\n     */\n    inline void setZero(MaskType mask);\n\n    /**\n     * Set all entries to zero where the mask is not set.\n     *\n     * A 4-vector with a mask of `[0111]` therefore would set only the first entry to 0.\n     *\n     * \\param mask Selects the entries to not be set to zero.\n     */\n    inline void setZeroInverted(MaskType mask);\n\n    /**\n     * Set all entries to the bit representation of a QNaN.\n     */\n    inline void setQnan();\n\n    /**\n     * Set all entries to the bit representation of a QNaN where the mask is set.\n     *\n     * \\param mask Selects the entries to be set to QNaN.\n     */\n    inline void setQnan(MaskType mask);\n\n#define Vc_CURRENT_CLASS_NAME Vector\n#include \"../common/gatherinterface.h\"\n#include \"../common/scatterinterface.h\"\n#undef Vc_CURRENT_CLASS_NAME\n\n    /// \\name Scalar Subscript Operators\n    ///@{\n    /**\n     * This operator can be used to modify scalar entries of the vector.\n     *\n     * \\param index A value between 0 and Size. This value is not checked internally so\n     *              you must make/be sure it is in range.\n     *\n     * \\return a reference to the vector entry at the given \\p index.\n     *\n     * \\warning The use of this function may result in suboptimal performance. Please\n     *          check whether you can find a more vector-friendly way to do what you\n     *          intended.\n     * \\note the returned object models the concept of a reference and\n     * as such it can exist longer than the data it is referencing.\n     * \\note to avoid lifetime issues, we strongly advice not to store\n     * any reference objects.\n     */\n    inline reference operator[](size_t index) noexcept;\n    /**\n     * This operator can be used to read scalar entries of the vector.\n     *\n     * \\param index A value between 0 and Size. This value is not checked internally so\n     *              you must make/be sure it is in range.\n     *\n     * \\return a copy of the vector entry at the given \\p index.\n     */\n    inline EntryType operator[](size_t index) const noexcept;\n    ///@}\n\n    /// \\name Unary Operators\n    ///@{\n    /**\n     * Determine where the vector is null.\n     *\n     * \\returns a mask which denotes the zero entries of this vector object.\n     */\n    inline MaskType operator!() const;\n\n    /**\n     * Inverts all bits.\n     *\n     * \\returns a new vector which has all bits inverted. I.e. `v & ~v == 0`.\n     *\n     * \\note This operator is only defined for integral types \\p T.\n     */\n    inline Vector operator~() const;\n\n    /// Returns a new vector object with all entries negated.\n    inline Vector operator-() const;\n    /// Returns a copy of the vector object.\n    inline Vector operator+() const;\n    ///@}\n\n    /**\n     * \\name Increment and Decrement Operators\n     * The increment and decrement operators apply the increment/decrement operation per\n     * component.\n     *\n     * The semantics are equal to the semantics of the fundamental arithmetics type \\p T.\n     *\n     * \\note Over-/Underflow of signed integral types is undefined behavior and may\n     * actually break your code.\n     */\n    ///@{\n    inline Vector &operator++();  // prefix\n    inline Vector operator++(int);  // postfix\n    inline Vector &operator--();  // prefix\n    inline Vector operator--(int);  // postfix\n    ///@}\n\n#define Vc_OP(symbol)                                                                    \\\n    inline Vc_PURE Vector operator symbol(const Vector &x) const;\n    /**\n     * \\name Arithmetic Operations\n     *\n     * The arithmetic operations are implemented as component-wise\n     * application of the operator on the two vector objects.\n     *\n     * Example:\n     * \\code\n     * void foo(float_v a, float_v b) {\n     *   const float_v product    = a * b;\n     *   const float_v difference = a - b;\n     *   a += b;\n     *   auto quotient = a / b;\n     *   auto modulo = static_cast<int_v>(a) % static_cast<int_v>(b);\n     * }\n     * \\endcode\n     *\n     * \\param x The vector to add, subtract, multiply, or divide by.\n     * \\returns A vector object of the same type with the components filled according to a\n     *          component-wise application of the operator.\n     *\n     * \\note If a signed integral vector operation overflows the result is undefined.\n     * (which is in agreement to the behavior of the fundamental signed integral types in\n     * C++)\n     */\n    ///@{\n    Vc_ALL_ARITHMETICS(Vc_OP);\n    ///@}\n\n    /**\n     * \\name Binary Operations\n     *\n     * The binary operations are implemented as component-wise\n     * application of the operator on the two vector objects.\n     *\n     * Example:\n     * \\code\n     * void foo(int_v a, int_v b) {\n     *   const int_v combined_bits = a | b;\n     *   const int_v masked_bits = a & b;\n     *   a ^= b;  // flipped bits\n     * }\n     * \\endcode\n     *\n     * \\returns A vector object of the same type with the components filled according to a\n     *          component-wise application of the operator.\n     */\n    ///@{\n    Vc_ALL_BINARY(Vc_OP);\n    ///@}\n\n    /**\n     * \\name Shift Operations\n     *\n     * The shift operations are implemented as component-wise\n     * application of the operator on the two vector objects.\n     *\n     * Example:\n     * \\code\n     * void foo(int_v a, int_v b) {\n     *   const int_v right = a >> b;\n     *   a <<= b;\n     * }\n     * \\endcode\n     *\n     * \\returns A vector object of the same type with the components filled according to a\n     *          component-wise application of the operator.\n     */\n    ///@{\n    Vc_ALL_SHIFTS(Vc_OP);\n    ///@}\n#undef Vc_OP\n\n    /**\n     * \\name Comparisons\n     *\n     * All comparison operators return a mask object.\n     *\n     * Example:\n     * \\code\n     * void foo(const float_v &a, const float_v &b) {\n     *   const float_m mask = a < b;\n     *   ...\n     * }\n     * \\endcode\n     *\n     * \\param x The vector to compare against.\n     * \\returns A mask object. Its components contain the boolean results of the\n     *          component-wise compare operation.\n     */\n    ///@{\n#define Vc_CMP_OP(symbol) inline Vc_PURE MaskType operator symbol(const Vector &x) const;\n    Vc_ALL_COMPARES(Vc_CMP_OP);\n#undef Vc_CMP_OP\n    ///@}\n\n    /**\n     * Writemask the vector before an assignment.\n     *\n     * \\param mask The writemask to be used.\n     *\n     * \\return an object that can be used for any kind of masked assignment.\n     *\n     * The returned object is only to be used for assignments and should not be assigned\n     * to a variable.\n     *\n     * Examples:\n     * \\code\n     * float_v v = float_v::Zero();         // v  = [0, 0, 0, 0]\n     * int_v v2 = int_v::IndexesFromZero(); // v2 = [0, 1, 2, 3]\n     * v(v2 < 2) = 1.f;                     // v  = [1, 1, 0, 0]\n     * v(v2 < 3) += 1.f;                    // v  = [2, 2, 1, 0]\n     * ++v2(v < 1.f);                       // v2 = [0, 1, 2, 4]\n     * \\endcode\n     */\n    inline Common::WriteMaskedVector<Vector, MaskType> operator()(MaskType mask);\n\n    /**\n     * \\name Horizontal Reduction Operations\n     *\n     * Horizontal operations can be used to reduce the values of a vector to a scalar\n     * value.\n     *\n     * Example:\n     * \\code\n     * void foo(const float_v &v) {\n     *   float min = v.min(); // smallest value in v\n     *   float sum = v.sum(); // sum of all values in v\n     * }\n     * \\endcode\n     */\n    ///@{\n\n    /// Returns the smallest entry in the vector.\n    inline EntryType min() const;\n    /// Returns the largest entry in the vector.\n    inline EntryType max() const;\n    /// Returns the product of all entries in the vector.\n    inline EntryType product() const;\n    /// Returns the sum of all entries in the vector.\n    inline EntryType sum() const;\n    /// Returns a vector containing the sum of all entries with smaller index.\n    inline Vector partialSum() const;\n    /// Returns the smallest entry of the vector components selected by \\p mask.\n    inline EntryType min(MaskType mask) const;\n    /// Returns the largest entry of the vector components selected by \\p mask.\n    inline EntryType max(MaskType mask) const;\n    /// Returns the product of the vector components selected by \\p mask.\n    inline EntryType product(MaskType mask) const;\n    /// Returns the sum of the vector components selected by \\p mask.\n    inline EntryType sum(MaskType mask) const;\n    ///@}\n\n    /**\n     * \\name Shift and Rotate\n     *\n     * These functions allow to shift or rotate the entries in a vector.\n     *\n     * All functions with an \\p amount parameter support positive and negative numbers for\n     * the shift/rotate value.\n     *\n     * Example:\n     * \\code\n     * using namespace Vc;\n     * int_v foo = int_v::IndexesFromZero() + 1; // e.g. [1, 2, 3, 4] with SSE\n     * int_v x;\n     * x = foo.shifted( 1); // [2, 3, 4, 0]\n     * x = foo.shifted( 2); // [3, 4, 0, 0]\n     * x = foo.shifted( 3); // [4, 0, 0, 0]\n     * x = foo.shifted( 4); // [0, 0, 0, 0]\n     * x = foo.shifted(-1); // [0, 1, 2, 3]\n     * x = foo.shifted(-2); // [0, 0, 1, 2]\n     * x = foo.shifted(-3); // [0, 0, 0, 1]\n     * x = foo.shifted(-4); // [0, 0, 0, 0]\n     *\n     * x = foo.rotated( 1); // [2, 3, 4, 1]\n     * x = foo.rotated( 2); // [3, 4, 1, 2]\n     * x = foo.rotated( 3); // [4, 1, 2, 3]\n     * x = foo.rotated( 4); // [1, 2, 3, 4]\n     * x = foo.rotated(-1); // [4, 1, 2, 3]\n     * x = foo.rotated(-2); // [3, 4, 1, 2]\n     * x = foo.rotated(-3); // [2, 3, 4, 1]\n     * x = foo.rotated(-4); // [1, 2, 3, 4]\n     * \\endcode\n     *\n     * These functions are slightly related to the above swizzles. In any case, they are\n     * often useful for communication between SIMD lanes or binary decoding operations.\n     *\n     * \\warning Use of these functions leads to less portable code. Consider the scalar\n     * implementation where every vector has only one entry. The shift and rotate\n     * functions have no useful task to fulfil there and you will almost certainly not get\n     * any useful results. It is recommended to add a static_assert for the assumed\n     * minimum vector size.\n     */\n    ///@{\n\n    /// Shift vector entries to the left by \\p amount; shifting in zeros.\n    inline Vector shifted(int amount) const;\n    /**\n     * Shift vector entries to the left by \\p amount; shifting in values from shiftIn\n     * (instead of zeros).\n     *\n     * This function can be used to create vectors from unaligned memory locations.\n     *\n     * Example:\n     * \\code\n     * Vc::Memory<int_v, 256> mem;\n     * for (int i = 0; i < 256; ++i) { mem[i] = i + 1; }\n     * int_v a = mem.vectorAt(0);\n     * int_v b = mem.vectorAt(int_v::Size);\n     * int_v x = a.shifted(1, b);\n     * // now x == mem.vectorAt(1, Vc::Unaligned)\n     * \\endcode\n     *\n     * \\param amount  The number of entries to shift by. \\p amount must be between \\c\n     *                -Size and \\c Size, otherwise the result is undefined.\n     * \\param shiftIn The vector of values to shift in.\n     * \\return        A new vector with values from \\p this and \\p shiftIn concatenated\n     *                and then shifted by \\p amount.\n     */\n    inline Vector shifted(int amount, Vector shiftIn) const;\n    /// Rotate vector entries to the left by \\p amount.\n    inline Vector rotated(int amount) const;\n    /// Returns a vector with all components reversed.\n    inline Vector reversed() const;\n    ///@}\n\n    /**\n     * Return a sorted copy of the vector.\n     *\n     * \\returns a sorted vector. The returned values are in ascending order:\n       \\verbatim\n       v[0] <= v[1] <= v[2] <= v[3] ...\n       \\endverbatim\n     *\n     * \\note If the vector contains NaNs the result is undefined.\n     *\n     * Example:\n     * \\code\n     * int_v v = int_v::Random();\n     * int_v s = v.sorted();\n     * std::cout << v << '\\n' << s << '\\n';\n     * \\endcode\n     *\n     * With SSE the output would be:\n     *\n       \\verbatim\n       [1513634383, -963914658, 1763536262, -1285037745]\n       [-1285037745, -963914658, 1513634383, 1763536262]\n       \\endverbatim\n     *\n     * With the Scalar implementation:\n       \\verbatim\n       [1513634383]\n       [1513634383]\n       \\endverbatim\n     */\n    inline Vector sorted() const;\n\n    /*!\n     * \\name Apply/Call/Fill Functions\n     *\n     * There are still many situations where the code needs to switch from SIMD operations\n     * to scalar execution. In this case you can, of course rely on operator[]. But there\n     * are also a number of functions that can help with common patterns.\n     *\n     * The apply functions expect a function that returns a scalar value, i.e. a function\n     * of the form \"T f(T)\".  The call functions do not return a value and thus the\n     * function passed does not need a return value. The fill functions are used to\n     * serially set the entries of the vector from the return values of a function.\n     *\n     * Example:\n     * \\code\n     * void foo(float_v v) {\n     *   float_v logarithm = v.apply(std::log);\n     *   float_v exponential = v.apply(std::exp);\n     * }\n     * \\endcode\n     *\n     * Of course, you can also use lambdas here:\n     * \\code\n     *   float_v power = v.apply([](float f) { return std::pow(f, 0.6f); })\n     * \\endcode\n     *\n     * \\param f A functor: this can either be a function or an object that implements\n     * operator().\n     */\n    ///@{\n\n    /// Call \\p f sequentially, starting with the minimum up to the maximum value.\n    template <typename F> void callWithValuesSorted(F &&f);\n    /// Call \\p f with the scalar entries of the vector.\n    template <typename F> inline void call(F &&f) const;\n    /// As above, but skip the entries where \\p mask is not set.\n    template <typename F> inline void call(F &&f, MaskType mask) const;\n\n    /// Call \\p f on every entry of the vector and return the results as a new vector.\n    template <typename F> inline Vector apply(F &&f) const;\n    /// As above, but skip the entries where \\p mask is not set.\n    template <typename F> inline Vector apply(F &&f, MaskType mask) const;\n\n    /// Fill the vector with the values [f(0), f(1), f(2), ...].\n    template <typename IndexT> inline void fill(EntryType(&f)(IndexT));\n    /// Fill the vector with the values [f(), f(), f(), ...].\n    inline void fill(EntryType(&f)());\n    ///@}\n\n    /**\\internal\n     * Interleaves this vector and \\p x and returns the resulting low vector.\n     * Used to implement Vc::interleave.\n     */\n    inline Vector interleaveLow(Vector x) const;\n    /**\\internal\n     * Interleaves this vector and \\p x and returns the resulting low vector.\n     * Used to implement Vc::interleave.\n     */\n    inline Vector interleaveHigh(Vector x) const;\n\n    /**\\internal\n     * Assigns the components of \\p v where \\p m is \\c true.\n     */\n    inline void assign(const Vector &v, const MaskType &m);\n\n    /**\n     * \\internal\n     * \\name Internal Data Access\n     * Returns a (const) reference the internal data member, storing the vector data.\n     */\n    ///@{\n    inline VectorType &data();\n    inline const VectorType &data() const;\n    ///@}\n\n    /// \\name Deprecated Members\n    ///@{\n\n    /**\n     * Returns the exponents of the floating-point values in the vector.\n     *\n     * \\return A new vector object of the same type containing the exponents.\n     *\n     * \\deprecated use Vc::exponent instead.\n     */\n    Vc_DEPRECATED(\"use exponent(x) instead\") inline Vector exponent() const;\n\n    /**\n     * Returns whether a value is negative.\n     *\n     * \\return A new mask object indicating the sign of each vector element.\n     *\n     * \\deprecated use Vc::isnegative instead.\n     */\n    Vc_DEPRECATED(\"use isnegative(x) instead\") inline MaskType isNegative() const;\n\n    ///\\copydoc size\n    ///\\deprecated Use Vc::Vector::size instead.\n    static constexpr size_t Size = VectorTraits<T, Abi>::size();\n\n    /**\n     * Casts the current object to \\p V2.\n     *\n     * \\returns a converted object of type \\p Vc.\n     *\n     * \\deprecated Use Vc::simd_cast instead.\n     */\n    template <typename V2> inline V2 staticCast() const;\n\n    /**\n     * reinterpret_cast the vector components to construct a vector of type \\p V2.\n     *\n     * \\returns An object of type \\p V2 with the smae bit-representation.\n     *\n     * \\deprecated use Vc::reinterpret_components_cast instead.\n     */\n    template <typename V2>\n    Vc_DEPRECATED(\"use reinterpret_components_cast instead\") inline V2\n        reinterpretCast() const;\n\n    /**\n     * Copies the signs of the components of \\p reference to the components of the current\n     * vector, returning the result.\n     *\n     * \\param reference A vector object that determines the sign of the the result.\n     * \\returns A new vector with sign taken from \\p reference and absolute value taken\n     * from the current vector object.\n     *\n     * \\deprecated Use Vc::copysign instead.\n     */\n    Vc_DEPRECATED(\"use copysign(x, y) instead\") inline Vector\n        copySign(Vector reference) const;\n    ///@}\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(Vector));\n\nprivate:\n    VectorType d;\n};\n\n/**\n * \\ingroup Utilities\n * Constructs a new Vector object of type \\p V from the Vector \\p x, reinterpreting the\n * bits of \\p x for the new type \\p V.\n *\n * This function is only applicable if:\n * - the \\c sizeof of the input and output types is equal\n * - the Vector::size() of the input and output types is equal\n * - the \\c VectorEntryTypes of input and output have equal \\c sizeof\n *\n * \\tparam V The requested type to change \\p x into.\n * \\param x The Vector to reinterpret as an object of type \\p V.\n * \\returns A new object (rvalue) of type \\p V.\n *\n * \\warning This cast is non-portable since the applicability (see above) may change\n * depending on the default vector types of the target platform. The function is perfectly\n * safe to use with fully specified \\p Abi, though.\n */\ntemplate <typename V, typename T, typename Abi>\nVc_ALWAYS_INLINE Vc_CONST enable_if<\n    (V::size() == Vector<T, Abi>::size() &&\n     sizeof(typename V::VectorEntryType) ==\n         sizeof(typename Vector<T, Abi>::VectorEntryType) &&\n     sizeof(V) == sizeof(Vector<T, Abi>) && alignof(V) <= alignof(Vector<T, Abi>)),\n    V>\nreinterpret_components_cast(const Vector<T, Abi> &x)\n{\n    return reinterpret_cast<const V &>(x);\n}\n\n#define Vc_OP(symbol)                                                                    \\\n    template <typename T, typename Abi>                                                  \\\n    inline Vector<T, Abi> &operator symbol##=(Vector<T, Abi> &,                          \\\n                                              const Vector<T, Abi> &x);\n    //Vc_ALL_ARITHMETICS(Vc_OP);\n    //Vc_ALL_BINARY(Vc_OP);\n    //Vc_ALL_SHIFTS(Vc_OP);\n#undef Vc_OP\n\n}  // namespace Vc\n\n#endif  // VC_COMMON_VECTOR_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/vectorabi.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_VECTORABI_H_\n#define VC_COMMON_VECTORABI_H_\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace VectorAbi\n{\ntemplate <typename T>\nusing Avx1Abi = typename std::conditional<std::is_integral<T>::value, VectorAbi::Sse,\n                                          VectorAbi::Avx>::type;\n\ntemplate <typename T> struct DeduceCompatible {\n#ifdef __x86_64__\n    using type = Sse;\n#else\n    using type = Scalar;\n#endif\n};\n\ntemplate <typename T>\nstruct DeduceBest {\n    using type = typename std::conditional<\n        CurrentImplementation::is(ScalarImpl), Scalar,\n        typename std::conditional<\n            CurrentImplementation::is_between(SSE2Impl, SSE42Impl), Sse,\n            typename std::conditional<\n                CurrentImplementation::is(AVXImpl), Avx1Abi<T>,\n                typename std::conditional<CurrentImplementation::is(AVX2Impl), Avx,\n                                          void>::type>::type>::type>::type;\n};\ntemplate <typename T> using Best = typename DeduceBest<T>::type;\n}  // namespace VectorAbi\n}  // namespace Vc_VERSIONED_NAMESPACE\n\n#include \"simdarrayfwd.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace detail\n{\n// is_fixed_size_abi {{{\ntemplate <class T> struct is_fixed_size_abi : std::false_type {\n};\ntemplate <int N> struct is_fixed_size_abi<simd_abi::fixed_size<N>> : std::true_type {\n};\n//}}}\n\ntemplate <class T>\nusing not_fixed_size_abi = typename std::enable_if<!is_fixed_size_abi<T>::value, T>::type;\n\n}  // namespace detail\n}  // namespace Vc\n\n#endif  // VC_COMMON_VECTORABI_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/vectortraits.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_VECTORTRAITS_H_\n#define VC_COMMON_VECTORTRAITS_H_\n\n#include \"vectorabi.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\ntemplate <typename T, typename Abi> struct VectorTraits;\n}  // namespace Vc\n\n#endif  // VC_COMMON_VECTORTRAITS_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/vectortuple.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_VECTORTUPLE_H_\n#define VC_COMMON_VECTORTUPLE_H_\n\n#include \"transpose.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\ntemplate<size_t StructSize, typename V, typename I, bool Readonly = true> struct InterleavedMemoryReadAccess;\n\ntemplate <int Length, typename V> class VectorReferenceArray\n{\n    typedef typename V::EntryType T;\n    typedef V &Vc_RESTRICT Reference;\n    std::array<V * Vc_RESTRICT, Length> r;\n\n    typedef make_index_sequence<Length> IndexSequence;\n\n    template <typename VV, std::size_t... Indexes>\n    constexpr VectorReferenceArray<Length + 1, VV> appendOneReference(\n        VV &a, index_sequence<Indexes...>) const\n    {\n        return {*r[Indexes]..., a};\n    }\n\n    template <typename A, std::size_t... Indexes>\n    Vc_INTRINSIC void callDeinterleave(const A &access, index_sequence<Indexes...>) const\n    {\n        access.deinterleave(*r[Indexes]...);\n    }\n\npublic:\n    template <typename... Us, typename = enable_if<(sizeof...(Us) == Length)>>\n    constexpr VectorReferenceArray(Us &&... args)\n        : r{{std::addressof(std::forward<Us>(args))...}}\n    {\n    }\n\n    template <typename VV, typename = enable_if<!std::is_const<V>::value &&\n                                                std::is_same<VV, V>::value>>\n    Vc_DEPRECATED(\"build the tuple with Vc::tie instead\") constexpr VectorReferenceArray<\n        Length + 1, V>\n    operator,(VV &a) const &&\n    {\n        return appendOneReference(a, IndexSequence());\n    }\n\n    Vc_DEPRECATED(\"build the tuple with Vc::tie instead\") constexpr VectorReferenceArray<\n        Length + 1, const V>\n    operator,(const V &a) const &&\n    {\n        return appendOneReference(a, IndexSequence());\n    }\n\n    template <size_t StructSize, typename I, bool RO>\n    Vc_ALWAYS_INLINE enable_if<(Length <= StructSize), void> operator=(\n        const InterleavedMemoryReadAccess<StructSize, V, I, RO> &access) &&\n    {\n        callDeinterleave(access, IndexSequence());\n    }\n\n    template <size_t StructSize, typename I, bool RO>\n    enable_if<(Length > StructSize), void> operator=(\n        const InterleavedMemoryReadAccess<StructSize, V, I, RO> &access) && =\n        delete;  //(\"You are trying to extract more data from the struct than it has\");\n\n    template <typename... Inputs> void operator=(TransposeProxy<Inputs...> &&proxy) &&\n    {\n        transpose_impl(TransposeTag<Length, sizeof...(Inputs)>(), &r[0], proxy);\n    }\n\n    template <typename T, typename IndexVector, typename Scale, bool Flag>\n    void operator=(SubscriptOperation<T, IndexVector, Scale, Flag> &&sub) &&\n    {\n        const auto &args = std::move(sub).gatherArguments();\n        //const IndexVector args.indexes;\n        //const T *const args.address;\n        Common::InterleavedMemoryReadAccess<1, V, Traits::decay<decltype(args.indexes)>>\n            deinterleaver(args.address, args.indexes);\n        callDeinterleave(deinterleaver, IndexSequence());\n    }\n\n    Vc_ALWAYS_INLINE Reference operator[](std::size_t i) { return *r[i]; }\n};\n\n}  // namespace Common\n\ntemplate <typename T, typename Abi>\nVc_DEPRECATED(\"build the tuple with Vc::tie instead\")\nconstexpr Common::VectorReferenceArray<2, Vc::Vector<T, Abi>>\noperator,(Vc::Vector<T, Abi> &a, Vc::Vector<T, Abi> &b)\n{\n    return {a, b};\n}\n\ntemplate <typename T, typename Abi>\nVc_DEPRECATED(\"build the tuple with Vc::tie instead\")\nconstexpr Common::VectorReferenceArray<2, const Vc::Vector<T, Abi>>\noperator,(const Vc::Vector<T, Abi> &a, const Vc::Vector<T, Abi> &b)\n{\n    return {a, b};\n}\n\ntemplate <typename V, typename... Vs>\nconstexpr Common::VectorReferenceArray<sizeof...(Vs) + 1,\n                                       typename std::remove_reference<V>::type>\n    tie(V &&a, Vs &&... b)\n{\n    return {std::forward<V>(a), std::forward<Vs>(b)...};\n}\n\n}  // namespace Vc\n\n#endif // VC_COMMON_VECTORTUPLE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/where.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_WHERE_H_\n#define VC_COMMON_WHERE_H_\n\n#include \"types.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\nnamespace WhereImpl\n{\n\n    /** \\internal\n     * The default implementation covers Vc::Mask types and any \\p _LValue type that implements an\n     * overload for the Vc::conditional_assign function.\n     */\n    template<typename _Mask, typename _LValue> struct MaskedLValue\n    {\n        typedef _Mask Mask;\n        typedef _LValue LValue;\n\n        const Mask &mask;\n        LValue &lhs;\n\n        // the ctors must be present, otherwise GCC fails to warn for Vc_WARN_UNUSED_RESULT\n        constexpr MaskedLValue(const Mask &m, LValue &l) : mask(m), lhs(l) {}\n        MaskedLValue(const MaskedLValue &) = delete;\n#ifndef __cpp_guaranteed_copy_elision\n        constexpr MaskedLValue(MaskedLValue &&) = default;\n#endif\n\n        /* It is intentional that the assignment operators return void: When a bool is used for the\n         * mask the code might get skipped completely, thus nothing can be returned. This would be\n         * like requiring an if statement to return a value.\n         */\n        template<typename T> Vc_ALWAYS_INLINE void operator  =(T &&rhs) { conditional_assign<Operator::          Assign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator +=(T &&rhs) { conditional_assign<Operator::      PlusAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator -=(T &&rhs) { conditional_assign<Operator::     MinusAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator *=(T &&rhs) { conditional_assign<Operator::  MultiplyAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator /=(T &&rhs) { conditional_assign<Operator::    DivideAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator %=(T &&rhs) { conditional_assign<Operator:: RemainderAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator ^=(T &&rhs) { conditional_assign<Operator::       XorAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator &=(T &&rhs) { conditional_assign<Operator::       AndAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator |=(T &&rhs) { conditional_assign<Operator::        OrAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator<<=(T &&rhs) { conditional_assign<Operator:: LeftShiftAssign>(lhs, mask, std::forward<T>(rhs)); }\n        template<typename T> Vc_ALWAYS_INLINE void operator>>=(T &&rhs) { conditional_assign<Operator::RightShiftAssign>(lhs, mask, std::forward<T>(rhs)); }\n        Vc_ALWAYS_INLINE void operator++()    { conditional_assign<Operator:: PreIncrement>(lhs, mask); }\n        Vc_ALWAYS_INLINE void operator++(int) { conditional_assign<Operator::PostIncrement>(lhs, mask); }\n        Vc_ALWAYS_INLINE void operator--()    { conditional_assign<Operator:: PreDecrement>(lhs, mask); }\n        Vc_ALWAYS_INLINE void operator--(int) { conditional_assign<Operator::PostDecrement>(lhs, mask); }\n\n        // masked gathers\n        template <class T, class IV, class S>\n        Vc_INTRINSIC void operator=(Common::SubscriptOperation<T, IV, S, true> &&rhs)\n        {\n            lhs.gather(std::move(rhs).gatherArguments(), mask);\n        }\n        template <class T, class IV, class S>\n        void operator+=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator-=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator*=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator/=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator%=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator^=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator&=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator|=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator<<=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n        template <class T, class IV, class S>\n        void operator>>=(Common::SubscriptOperation<T, IV, S, true> &&rhs) = delete;\n    };\n\n    template <typename _Mask, typename T_, typename I_, typename S_>\n    struct MaskedLValue<_Mask, Common::SubscriptOperation<T_, I_, S_, true>>\n    {\n        typedef _Mask Mask;\n        typedef Common::SubscriptOperation<T_, I_, S_, true> SO;\n\n        const Mask &mask;\n        SO &lhs;\n\n        template <typename T> using Decay = typename std::decay<T>::type;\n\n        // the ctors must be present, otherwise GCC fails to warn for Vc_WARN_UNUSED_RESULT\n        constexpr MaskedLValue(const Mask &m, SO &&l) : mask(m), lhs(l) {}\n        MaskedLValue(const MaskedLValue &) = delete;\n#ifndef __cpp_guaranteed_copy_elision\n        constexpr MaskedLValue(MaskedLValue &&) = default;\n#endif\n\n        /* It is intentional that the assignment operators return void: When a bool is used for the\n         * mask the code might get skipped completely, thus nothing can be returned. This would be\n         * like requiring an if statement to return a value.\n         */\n        template <class T> Vc_ALWAYS_INLINE void operator=(T &&rhs) &&\n        {\n            std::forward<T>(rhs).scatter(std::move(lhs).scatterArguments(), mask);\n        }\n        /*\n         * The following operators maybe make some sense. But only if implemented directly on the\n         * scalar objects in memory. Thus, the user is probably better of with a manual loop.\n         *\n         * If implemented the operators would need to do a masked gather, one operation, and a\n         * masked scatter. There is no way this is going to be efficient.\n         *\n        template<typename T> Vc_ALWAYS_INLINE void operator +=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  + std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator -=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  - std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator *=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  * std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator /=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  / std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator %=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  % std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator ^=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  ^ std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator &=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  & std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator |=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask)  | std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator<<=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask) << std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        template<typename T> Vc_ALWAYS_INLINE void operator>>=(T &&rhs) { (Decay<T>(lhs.gatherArguments(), mask) >> std::forward<T>(rhs)).scatter(lhs.scatterArguments(), mask); }\n        Vc_ALWAYS_INLINE void operator++()    { ++lhs(mask); }\n        Vc_ALWAYS_INLINE void operator++(int) { lhs(mask)++; }\n        Vc_ALWAYS_INLINE void operator--()    { --lhs(mask); }\n        Vc_ALWAYS_INLINE void operator--(int) { lhs(mask)--; }\n        */\n    };\n\n    template<typename _LValue> struct MaskedLValue<bool, _LValue>\n    {\n        typedef bool Mask;\n        typedef _LValue LValue;\n\n        const Mask &mask;\n        LValue &lhs;\n\n        // the ctors must be present, otherwise GCC fails to warn for Vc_WARN_UNUSED_RESULT\n        constexpr MaskedLValue(const Mask &m, LValue &l) : mask(m), lhs(l) {}\n        MaskedLValue(const MaskedLValue &) = delete;\n        constexpr MaskedLValue(MaskedLValue &&) = default;\n\n        template<typename T> Vc_ALWAYS_INLINE void operator  =(T &&rhs) { if (mask) lhs   = std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator +=(T &&rhs) { if (mask) lhs  += std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator -=(T &&rhs) { if (mask) lhs  -= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator *=(T &&rhs) { if (mask) lhs  *= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator /=(T &&rhs) { if (mask) lhs  /= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator %=(T &&rhs) { if (mask) lhs  %= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator ^=(T &&rhs) { if (mask) lhs  ^= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator &=(T &&rhs) { if (mask) lhs  &= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator |=(T &&rhs) { if (mask) lhs  |= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator<<=(T &&rhs) { if (mask) lhs <<= std::forward<T>(rhs); }\n        template<typename T> Vc_ALWAYS_INLINE void operator>>=(T &&rhs) { if (mask) lhs >>= std::forward<T>(rhs); }\n        Vc_ALWAYS_INLINE void operator++()    { if (mask) ++lhs; }\n        Vc_ALWAYS_INLINE void operator++(int) { if (mask) lhs++; }\n        Vc_ALWAYS_INLINE void operator--()    { if (mask) --lhs; }\n        Vc_ALWAYS_INLINE void operator--(int) { if (mask) lhs--; }\n    };\n\n    template<typename _Mask> struct WhereMask\n    {\n        typedef _Mask Mask;\n        const Mask &mask;\n\n        // the ctors must be present, otherwise GCC fails to warn for Vc_WARN_UNUSED_RESULT\n        constexpr WhereMask(const Mask &m) : mask(m) {}\n        WhereMask(const WhereMask &) = delete;\n\n        template <typename T, typename I, typename S>\n        constexpr Vc_WARN_UNUSED_RESULT\n            MaskedLValue<Mask, Common::SubscriptOperation<T, I, S, true>>\n            operator|(Common::SubscriptOperation<T, I, S, true> &&lhs) const\n        {\n            static_assert(!std::is_const<T>::value,\n                          \"masked scatter to constant memory not possible.\");\n            return {mask, std::move(lhs)};\n        }\n\n        template<typename T> constexpr Vc_WARN_UNUSED_RESULT MaskedLValue<Mask, T> operator|(T &&lhs) const\n        {\n            static_assert(std::is_lvalue_reference<T>::value, \"Syntax error: Incorrect use of Vc::where. Maybe operator precedence got you by surprise. Examples of correct usage:\\n\"\n                    \"  Vc::where(x < 2) | x += 1;\\n\"\n                    \"  (Vc::where(x < 2) | x)++;\\n\"\n                    \"  Vc::where(x < 2)(x) += 1;\\n\"\n                    \"  Vc::where(x < 2)(x)++;\\n\"\n                    );\n            return { mask, lhs };\n        }\n\n        template <class T,\n                  class = decltype(std::declval<T>() = std::declval<const T &>())>\n        constexpr Vc_WARN_UNUSED_RESULT MaskedLValue<Mask, T> operator()(T &&lhs) const\n        {\n            return operator|(std::forward<T>(lhs));\n        }\n    };\n}  // namespace WhereImpl\n\n/**\n * \\ingroup Utilities\n *\n * Conditional assignment.\n *\n * Since compares between SIMD vectors do not return a single boolean, but rather a vector of\n * booleans (mask), one often cannot use if / else statements. Instead, one needs to state\n * that only a subset of entries of a given SIMD vector should be modified. The \\c where function\n * can be prepended to any assignment operation to execute a masked assignment.\n *\n * \\param mask The mask that selects the entries in the target vector that will be modified.\n *\n * \\return This function returns an opaque object that binds to the left operand of an assignment\n * via the binary-or operator or the functor operator. (i.e. either <code>where(mask) | x = y</code>\n * or <code>where(mask)(x) = y</code>)\n *\n * Example:\n * \\code\n * template<typename T> void f1(T &x, T &y)\n * {\n *   if (x < 2) {\n *     x *= y;\n *     y += 2;\n *   }\n * }\n * template<typename T> void f2(T &x, T &y)\n * {\n *   where(x < 2) | x *= y;\n *   where(x < 2) | y += 2;\n * }\n * \\endcode\n * The block following the if statement in \\c f1 will be executed if <code>x &lt; 2</code> evaluates\n * to \\c true. If \\c T is a scalar type you normally get what you expect. But if \\c T is a SIMD\n * vector type, the comparison will use the implicit conversion from a mask to bool, meaning\n * <code>all_of(x &lt; 2)</code>.\n *\n * Most of the time the required operation is a masked assignment as stated in \\c f2.\n *\n */\ntemplate<typename M> constexpr Vc_WARN_UNUSED_RESULT WhereImpl::WhereMask<M> where(const M &mask)\n{\n    return { mask };\n}\n\ntemplate <class M, class V>\nconstexpr Vc_WARN_UNUSED_RESULT WhereImpl::MaskedLValue<M, V> where(const M &mask,\n                                                                    V &value)\n{\n    return {mask, value};\n}\n\n// `where` overload for masked scatters. It's necessary because SubscriptOperation doesn't\n// want to become an lvalue.\ntemplate <class M, class T, class IT, class Scale>\nconstexpr Vc_WARN_UNUSED_RESULT\n    WhereImpl::MaskedLValue<M, Common::SubscriptOperation<T, IT, Scale, true>>\n    where(const M &mask, Common::SubscriptOperation<T, IT, Scale, true> &&value)\n{\n    return {mask, std::move(value)};\n}\n\ntemplate<typename M> constexpr Vc_WARN_UNUSED_RESULT WhereImpl::WhereMask<M> _if(const M &m)\n{\n    return { m };\n}\n\n}  // namespace Vc\n\n#endif // VC_COMMON_WHERE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/writemaskedvector.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_WRITEMASKEDVECTOR_H_\n#define VC_COMMON_WRITEMASKEDVECTOR_H_\n\n#include <utility>\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\ntemplate <typename V, typename M = typename V::Mask> class WriteMaskedVector\n{\n    static_assert(\n        V::Size == M::Size,\n        \"incorrect use of Vc::Common::WriteMaskedVector<V, M>. V and M must have the same «Size».\");\n\npublic:\n    typedef M Mask;\n    static constexpr size_t Size = V::Size;\n\n    Vc_FREE_STORE_OPERATORS_ALIGNED(alignof(Mask));\n\n    // implicit (allows {vec, mask} in places where WriteMaskedVector is expected)\n    Vc_INTRINSIC WriteMaskedVector(V &v, const Mask &k) : mask(k), vec(v)\n    {\n    }\n\n    // prefix\n    Vc_INTRINSIC V &operator++()\n    {\n        V one = V::One();\n        one.setZeroInverted(mask);\n        return vec += one;\n    }\n    Vc_INTRINSIC V &operator--()\n    {\n        V one = V::One();\n        one.setZeroInverted(mask);\n        return vec -= one;\n    }\n\n    // postfix\n    Vc_INTRINSIC V operator++(int)\n    {\n        V ret(vec);\n        operator++();\n        return ret;\n    }\n    Vc_INTRINSIC V operator--(int)\n    {\n        V ret(vec);\n        operator--();\n        return ret;\n    }\n\n#define Vc_OPERATOR_(op)                                                                 \\\n    template <typename U> Vc_ALWAYS_INLINE void operator op##=(U &&x)                    \\\n    {                                                                                    \\\n        operator=(static_cast<V>(vec op std::forward<U>(x)));                            \\\n    }\n    Vc_ALL_BINARY(Vc_OPERATOR_);\n    Vc_ALL_ARITHMETICS(Vc_OPERATOR_);\n    Vc_ALL_SHIFTS(Vc_OPERATOR_);\n#undef Vc_OPERATOR_\n\n    Vc_ALWAYS_INLINE void operator=(const V &x)\n    {\n        vec.assign(x, mask);\n    }\n\n    template <typename T, typename I, typename S>\n    Vc_ALWAYS_INLINE void operator=(SubscriptOperation<T, I, S, true> &&x)\n    {\n        vec.gather(std::move(x).gatherArguments(), mask);\n    }\n\n    template <typename F> Vc_INTRINSIC void call(const F &f) const\n    {\n        return vec.call(f, mask);\n    }\n    template <typename F> Vc_INTRINSIC V apply(const F &f) const\n    {\n        return vec.apply(f, mask);\n    }\n    template <typename F> Vc_INTRINSIC void call(F &&f) const\n    {\n        return vec.call(std::forward<F>(f), mask);\n    }\n    template <typename F> Vc_INTRINSIC V apply(F &&f) const\n    {\n        return vec.apply(std::forward<F>(f), mask);\n    }\n\nprivate:\n#ifdef Vc_ICC\n    // If ICC gets a by-value copy of Mask here, it'll generate a lot of superfluous\n    // stack-register copies.\n    const Mask &mask;\n#else\n    // If Clang gets a const-ref Mask here, it'll miscompile some of the masked assignment\n    // statements.\n    const Mask mask;\n#endif\n    V &vec;\n};\n}  // namespace Common\n}  // namespace Vc\n\n#endif // VC_COMMON_WRITEMASKEDVECTOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/common/x86_prefetches.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_X86_PREFETCHES_H_\n#define VC_COMMON_X86_PREFETCHES_H_\n\n#include <xmmintrin.h>\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n\nstatic constexpr int exclusive_hint = 0;\n\n// TODO: support AMD's prefetchw with correct flags and checks via cpuid\n\ntemplate <typename ExclusiveOrShared = Vc::Shared>\nVc_INTRINSIC void prefetchForOneRead(const void *addr)\n{\n    if (std::is_same<ExclusiveOrShared, Vc::Shared>::value) {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_NTA);\n    } else {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)),\n                     static_cast<decltype(_MM_HINT_NTA)>(_MM_HINT_NTA | exclusive_hint));\n    }\n}\ntemplate <typename ExclusiveOrShared = Vc::Shared>\nVc_INTRINSIC void prefetchClose(const void *addr)\n{\n    if (std::is_same<ExclusiveOrShared, Vc::Shared>::value) {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T0);\n    } else {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)),\n                     static_cast<decltype(_MM_HINT_T0)>(_MM_HINT_T0 | exclusive_hint));\n    }\n}\ntemplate <typename ExclusiveOrShared = Vc::Shared>\nVc_INTRINSIC void prefetchMid(const void *addr)\n{\n    if (std::is_same<ExclusiveOrShared, Vc::Shared>::value) {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T1);\n    } else {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)),\n                     static_cast<decltype(_MM_HINT_T1)>(_MM_HINT_T1 | exclusive_hint));\n    }\n}\ntemplate <typename ExclusiveOrShared = Vc::Shared>\nVc_INTRINSIC void prefetchFar(const void *addr)\n{\n    if (std::is_same<ExclusiveOrShared, Vc::Shared>::value) {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T2);\n    } else {\n        _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)),\n                     static_cast<decltype(_MM_HINT_T2)>(_MM_HINT_T2 | exclusive_hint));\n    }\n}\n\n/*handlePrefetch/handleLoadPrefetches/handleStorePrefetches{{{*/\nnamespace\n{\ntemplate<size_t L1, size_t L2, bool UseExclusivePrefetch> Vc_INTRINSIC void handlePrefetch(const void *addr_, typename std::enable_if<L1 != 0 && L2 != 0, void *>::type = nullptr)\n{\n    const char *addr = static_cast<const char *>(addr_);\n    prefetchClose<typename std::conditional<UseExclusivePrefetch, Vc::Exclusive, Vc::Shared>::type>(addr + L1);\n    prefetchMid  <typename std::conditional<UseExclusivePrefetch, Vc::Exclusive, Vc::Shared>::type>(addr + L2);\n}\ntemplate<size_t L1, size_t L2, bool UseExclusivePrefetch> Vc_INTRINSIC void handlePrefetch(const void *addr_, typename std::enable_if<L1 == 0 && L2 != 0, void *>::type = nullptr)\n{\n    const char *addr = static_cast<const char *>(addr_);\n    prefetchMid  <typename std::conditional<UseExclusivePrefetch, Vc::Exclusive, Vc::Shared>::type>(addr + L2);\n}\ntemplate<size_t L1, size_t L2, bool UseExclusivePrefetch> Vc_INTRINSIC void handlePrefetch(const void *addr_, typename std::enable_if<L1 != 0 && L2 == 0, void *>::type = nullptr)\n{\n    const char *addr = static_cast<const char *>(addr_);\n    prefetchClose<typename std::conditional<UseExclusivePrefetch, Vc::Exclusive, Vc::Shared>::type>(addr + L1);\n}\ntemplate<size_t L1, size_t L2, bool UseExclusivePrefetch> Vc_INTRINSIC void handlePrefetch(const void *, typename std::enable_if<L1 == 0 && L2 == 0, void *>::type = nullptr)\n{\n}\n\ntemplate<typename Flags> Vc_INTRINSIC void handleLoadPrefetches(const void *    , Flags, typename Flags::EnableIfNotPrefetch = nullptr) {}\ntemplate<typename Flags> Vc_INTRINSIC void handleLoadPrefetches(const void *addr, Flags, typename Flags::EnableIfPrefetch    = nullptr)\n{\n    // load prefetches default to Shared unless Exclusive was explicitely selected\n    handlePrefetch<Flags::L1Stride, Flags::L2Stride, Flags::IsExclusivePrefetch>(addr);\n}\n\ntemplate<typename Flags> Vc_INTRINSIC void handleStorePrefetches(const void *    , Flags, typename Flags::EnableIfNotPrefetch = nullptr) {}\ntemplate<typename Flags> Vc_INTRINSIC void handleStorePrefetches(const void *addr, Flags, typename Flags::EnableIfPrefetch    = nullptr)\n{\n    // store prefetches default to Exclusive unless Shared was explicitely selected\n    handlePrefetch<Flags::L1Stride, Flags::L2Stride, !Flags::IsSharedPrefetch>(addr);\n}\n\n} // anonymous namespace\n/*}}}*/\n\n}  // namespace Common\n\nusing Common::prefetchForOneRead;\nusing Common::prefetchClose;\nusing Common::prefetchMid;\nusing Common::prefetchFar;\n}  // namespace Vc\n\n#endif // VC_COMMON_X86_PREFETCHES_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/cpuid.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_CPUID_H_\n#define VC_CPUID_H_\n\n#include \"common/macros.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n/**\n * \\ingroup Utilities\n * \\headerfile cpuid.h <Vc/cpuid.h>\n *\n * This class is available for x86 / AMD64 systems to read and interpret information about the CPU's\n * capabilities.\n *\n * Before any of the getter functions may be called, the init() function must have been called. It\n * will be called automatically, but for any function executing before main, you better call\n * \\c CpuId::init() first.\n *\n * %Vc users will most likely not need this class directly, but rely on the\n * isImplementationSupported, bestImplementationSupported, extraInstructionsSupported, and\n * currentImplementationSupported functions.\n */\nclass CpuId\n{\n    typedef unsigned char uchar;\n    typedef unsigned short ushort;\n    typedef unsigned int uint;\n\n    public:\n        enum ProcessorType {\n            OriginalOemProcessor = 0,\n            IntelOverDriveProcessor = 1,\n            DualProcessor = 2,\n            IntelReserved = 3\n        };\n\n        /**\n         * Reads the CPU capabilities and stores them for faster subsequent access.\n         *\n         * Will be executed automatically before main, but not necessarily before other functions\n         * executing before main.\n         */\n        static void Vc_VDECL init();\n\n        //! Return the cache line size in bits.\n        static inline ushort cacheLineSize() { return static_cast<ushort>(s_cacheLineSize) * 8u; }\n        //! Return the ProcessorType.\n        static inline ProcessorType processorType() { return s_processorType; }\n        //! Return the family number of the processor (vendor dependent).\n        static inline uint processorFamily() { return s_processorFamily; }\n        //! Return the model number of the processor (vendor dependent).\n        static inline uint processorModel() { return s_processorModel; }\n        //! Return the number of logical processors.\n        static inline uint logicalProcessors() { return s_logicalProcessors; }\n        //! Return whether the CPU vendor is AMD.\n        static inline bool isAmd   () { return s_ecx0 == 0x444D4163; }\n        //! Return whether the CPU vendor is Intel.\n        static inline bool isIntel () { return s_ecx0 == 0x6C65746E; }\n        //! Return whether the CPU supports SSE3.\n        static inline bool hasSse3 () { return s_processorFeaturesC & (1 << 0); }\n        //! Return whether the CPU supports the PCLMULQDQ instruction.\n        static inline bool hasPclmulqdq() { return (s_processorFeaturesC & (1 << 1)) != 0; }\n        //! Return whether the CPU supports the MONITOR/MWAIT instructions.\n        static inline bool hasMonitor() { return (s_processorFeaturesC & (1 << 3)) != 0; }\n        //! Return whether the CPU supports the Virtual Machine Extensions.\n        static inline bool hasVmx  () { return (s_processorFeaturesC & (1 << 5)) != 0; }\n        //! Return whether the CPU supports the Safer Mode Extensions.\n        static inline bool hasSmx  () { return (s_processorFeaturesC & (1 << 6)) != 0; }\n        //! Return whether the CPU supports the Enhanced Intel SpeedStep technology.\n        static inline bool hasEist () { return (s_processorFeaturesC & (1 << 7)) != 0; }\n        //! Return whether the CPU supports Thermal Monitor 2.\n        static inline bool hasTm2  () { return (s_processorFeaturesC & (1 << 8)) != 0; }\n        //! Return whether the CPU supports SSSE3.\n        static inline bool hasSsse3() { return (s_processorFeaturesC & (1 << 9)) != 0; }\n        //! Return whether the CPU supports FMA extensions using YMM state.\n        static inline bool hasFma  () { return (s_processorFeaturesC & (1 << 12)) != 0; }\n        //! Return whether the CPU supports CMPXCHG16B.\n        static inline bool hasCmpXchg16b() { return (s_processorFeaturesC & (1 << 13)) != 0; }\n        //! Return whether the CPU supports the Perfmon and Debug Capability.\n        static inline bool hasPdcm () { return (s_processorFeaturesC & (1 << 15)) != 0; }\n        //! Return whether the CPU supports Direct Cache Access: prefetch data from a memory mapped device.\n        static inline bool hasDca()   { return (s_processorFeaturesC & (1 << 18)) != 0; }\n        //! Return whether the CPU supports SSE 4.1\n        static inline bool hasSse41() { return (s_processorFeaturesC & (1 << 19)) != 0; }\n        //! Return whether the CPU supports SSE 4.2\n        static inline bool hasSse42() { return (s_processorFeaturesC & (1 << 20)) != 0; }\n        //! Return whether the CPU supports the MOVBE instruction.\n        static inline bool hasMovbe() { return (s_processorFeaturesC & (1 << 22)) != 0; }\n        //! Return whether the CPU supports the POPCNT instruction.\n        static inline bool hasPopcnt(){ return (s_processorFeaturesC & (1 << 23)) != 0; }\n        //static inline bool hasTscDeadline() { return (s_processorFeaturesC & (1 << 24)) != 0; }\n        //! Return whether the CPU supports the AESNI instructions.\n        static inline bool hasAes  () { return (s_processorFeaturesC & (1 << 25)) != 0; }\n        //static inline bool hasXsave() { return (s_processorFeaturesC & (1 << 26)) != 0; }\n        //! Return whether the CPU and OS support the XSETBV/XGETBV instructions.\n        static inline bool hasOsxsave() { return (s_processorFeaturesC & (1 << 27)) != 0; }\n        //! Return whether the CPU supports AVX.\n        static inline bool hasAvx  () { return (s_processorFeaturesC & (1 << 28)) != 0; }\n        //! Return whether the CPU supports BMI1.\n        static inline bool hasBmi1 () { return (s_processorFeatures7B& (1 << 3)) != 0; }\n        //! Return whether the CPU supports transactional synchronization extensions.\n        static inline bool hasHle  () { return (s_processorFeatures7B& (1 << 4)) != 0; }\n        //! Return whether the CPU supports AVX2.\n        static inline bool hasAvx2 () { return (s_processorFeatures7B& (1 << 5)) != 0; }\n        //! Return whether the CPU supports BMI2.\n        static inline bool hasBmi2 () { return (s_processorFeatures7B& (1 << 8)) != 0; }\n        //! Return whether the CPU supports transactional synchronization extensions.\n        static inline bool hasRtm  () { return (s_processorFeatures7B& (1 << 11)) != 0; }\n\n        //! Return whether the CPU supports AVX512f.\n        static inline bool hasAvx512f   () { return (s_processorFeatures7B & (1u << 16)) != 0; }\n        //! Return whether the CPU supports AVX512dq.\n        static inline bool hasAvx512dq  () { return (s_processorFeatures7B & (1u << 17)) != 0; }\n        //! Return whether the CPU supports AVX512ifma.\n        static inline bool hasAvx512ifma() { return (s_processorFeatures7B & (1u << 21)) != 0; }\n        //! Return whether the CPU supports AVX512pf.\n        static inline bool hasAvx512pf  () { return (s_processorFeatures7B & (1u << 26)) != 0; }\n        //! Return whether the CPU supports AVX512er.\n        static inline bool hasAvx512er  () { return (s_processorFeatures7B & (1u << 27)) != 0; }\n        //! Return whether the CPU supports AVX512cd.\n        static inline bool hasAvx512cd  () { return (s_processorFeatures7B & (1u << 28)) != 0; }\n        //! Return whether the CPU supports AVX512bw.\n        static inline bool hasAvx512bw  () { return (s_processorFeatures7B & (1u << 30)) != 0; }\n        //! Return whether the CPU supports AVX512vl.\n        static inline bool hasAvx512vl  () { return (s_processorFeatures7B & (1u << 31)) != 0; }\n        //! Return whether the CPU supports AVX512vbmi.\n        static inline bool hasAvx512vbmi() { return (s_processorFeatures7C & (1u <<  1)) != 0; }\n\n        //! Return whether the CPU supports 16-bit floating-point conversion instructions.\n        static inline bool hasF16c () { return (s_processorFeaturesC & (1 << 29)) != 0; }\n        //! Return whether the CPU supports the RDRAND instruction.\n        static inline bool hasRdrand(){ return (s_processorFeaturesC & (1 << 30)) != 0; }\n        //! Return whether the CPU contains an x87 FPU.\n        static inline bool hasFpu  () { return (s_processorFeaturesD & (1 << 0)) != 0; }\n        static inline bool hasVme  () { return (s_processorFeaturesD & (1 << 1)) != 0; }\n        //! Return whether the CPU contains Debugging Extensions.\n        static inline bool hasDe   () { return (s_processorFeaturesD & (1 << 2)) != 0; }\n        //! Return whether the CPU contains Page Size Extensions.\n        static inline bool hasPse  () { return (s_processorFeaturesD & (1 << 3)) != 0; }\n        //! Return whether the CPU supports the RDTSC instruction.\n        static inline bool hasTsc  () { return (s_processorFeaturesD & (1 << 4)) != 0; }\n        //! Return whether the CPU supports the Model Specific Registers instructions.\n        static inline bool hasMsr  () { return (s_processorFeaturesD & (1 << 5)) != 0; }\n        //! Return whether the CPU supports the Physical Address Extension.\n        static inline bool hasPae  () { return (s_processorFeaturesD & (1 << 6)) != 0; }\n        //! Return whether the CPU supports the CMPXCHG8B instruction.\n        static inline bool hasCx8  () { return (s_processorFeaturesD & (1 << 8)) != 0; }\n        //! Return whether the CPU supports Memory Type Range Registers.\n        static inline bool hasMtrr () { return (s_processorFeaturesD & (1 << 12)) != 0; }\n        //! Return whether the CPU supports CMOV instructions.\n        static inline bool hasCmov () { return (s_processorFeaturesD & (1 << 15)) != 0; }\n        //! Return whether the CPU supports the CLFLUSH instruction.\n        static inline bool hasClfsh() { return (s_processorFeaturesD & (1 << 19)) != 0; }\n        //! Return whether the CPU supports ACPI.\n        static inline bool hasAcpi () { return (s_processorFeaturesD & (1 << 22)) != 0; }\n        //! Return whether the CPU supports MMX.\n        static inline bool hasMmx  () { return (s_processorFeaturesD & (1 << 23)) != 0; }\n        //! Return whether the CPU supports SSE.\n        static inline bool hasSse  () { return (s_processorFeaturesD & (1 << 25)) != 0; }\n        //! Return whether the CPU supports SSE2.\n        static inline bool hasSse2 () { return (s_processorFeaturesD & (1 << 26)) != 0; }\n        static inline bool hasHtt  () { return (s_processorFeaturesD & (1 << 28)) != 0; }\n        //! Return whether the CPU supports SSE4a.\n        static inline bool hasSse4a() { return (s_processorFeatures8C & (1 << 6)) != 0; }\n        //! Return whether the CPU supports misaligned SSE instructions.\n        static inline bool hasMisAlignSse() { return (s_processorFeatures8C & (1 << 7)) != 0; }\n        //! Return whether the CPU supports the AMD prefetchw instruction.\n        static inline bool hasAmdPrefetch() { return (s_processorFeatures8C & (1 << 8)) != 0; }\n        //! Return whether the CPU supports the XOP instructions.\n        static inline bool hasXop ()        { return (s_processorFeatures8C & (1 << 11)) != 0; }\n        //! Return whether the CPU supports the FMA4 instructions.\n        static inline bool hasFma4 ()       { return (s_processorFeatures8C & (1 << 16)) != 0; }\n        //! Return whether the CPU supports the RDTSCP instruction.\n        static inline bool hasRdtscp()      { return (s_processorFeatures8D & (1 << 27)) != 0; }\n        static inline bool has3DNow()       { return (s_processorFeatures8D & (1u << 31)) != 0; }\n        static inline bool has3DNowExt()    { return (s_processorFeatures8D & (1 << 30)) != 0; }\n        //! Return the size of the L1 instruction cache.\n        static inline uint   L1Instruction() { return s_L1Instruction; }\n        //! Return the size of the L1 data cache.\n        static inline uint   L1Data() { return s_L1Data; }\n        //! Return the size of the L2 cache.\n        static inline uint   L2Data() { return s_L2Data; }\n        //! Return the size of the L3 cache.\n        static inline uint   L3Data() { return s_L3Data; }\n        static inline ushort L1InstructionLineSize() { return s_L1InstructionLineSize; }\n        static inline ushort L1DataLineSize() { return s_L1DataLineSize; }\n        static inline ushort L2DataLineSize() { return s_L2DataLineSize; }\n        static inline ushort L3DataLineSize() { return s_L3DataLineSize; }\n        static inline uint   L1Associativity() { return s_L1Associativity; }\n        static inline uint   L2Associativity() { return s_L2Associativity; }\n        static inline uint   L3Associativity() { return s_L3Associativity; }\n        static inline ushort prefetch() { return s_prefetch; }\n\n    private:\n        static void interpret(uchar byte, bool *checkLeaf4);\n\n        static uint   s_ecx0;\n        static uint   s_logicalProcessors;\n        static uint   s_processorFeaturesC;\n        static uint   s_processorFeaturesD;\n        static uint   s_processorFeatures7B;\n        static uint   s_processorFeatures7C;\n        static uint   s_processorFeatures8C;\n        static uint   s_processorFeatures8D;\n        static uint   s_L1Instruction;\n        static uint   s_L1Data;\n        static uint   s_L2Data;\n        static uint   s_L3Data;\n        static ushort s_L1InstructionLineSize;\n        static ushort s_L1DataLineSize;\n        static ushort s_L2DataLineSize;\n        static ushort s_L3DataLineSize;\n        static uint   s_L1Associativity;\n        static uint   s_L2Associativity;\n        static uint   s_L3Associativity;\n        static ushort s_prefetch;\n        static uchar  s_brandIndex;\n        static uchar  s_cacheLineSize;\n        static uchar  s_processorModel;\n        static uchar  s_processorFamily;\n        static ProcessorType s_processorType;\n        static bool   s_noL2orL3;\n};\n\n#ifndef Vc_COMPILE_LIB\nnamespace detail\n{\ntemplate <int = 0> struct RunCpuIdInit {\n    RunCpuIdInit() { CpuId::init(); }\n    static RunCpuIdInit tmp;\n};\ntemplate <int N> RunCpuIdInit<N> RunCpuIdInit<N>::tmp;\nnamespace\n{\nstatic auto ctor = RunCpuIdInit<>::tmp;\n}  // unnamed namespace\n}  // namespace detail\n#endif\n\n}\n\n#endif // VC_CPUID_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/fwddecl.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2018 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_FWDDECL_H_\n#define VC_FWDDECL_H_\n\n#include <cstddef>  // for std::size_t\n\n#define Vc_VERSIONED_NAMESPACE Vc_1\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace VectorAbi\n{\nstruct Scalar {};\nstruct Sse {};\nstruct Avx {};\nstruct Mic {};\ntemplate <class T> struct DeduceCompatible;\ntemplate <class T> struct DeduceBest;\n}  // namespace VectorAbi\n\nnamespace Common\n{\ntemplate <class T, std::size_t N> struct select_best_vector_type;\n}  // namespace Common\n\ntemplate <class T, class Abi> class Mask;\ntemplate <class T, class Abi> class Vector;\n\n// === having SimdArray<T, N> in the Vc namespace leads to a ABI bug ===\n//\n// SimdArray<double, 4> can be { double[4] }, { __m128d[2] }, or { __m256d } even though the type\n// is the same.\n// The question is, what should SimdArray focus on?\n// a) A type that makes interfacing between different implementations possible?\n// b) Or a type that makes fixed size SIMD easier and efficient?\n//\n// a) can be achieved by using a union with T[N] as one member. But this may have more serious\n// performance implications than only less efficient parameter passing (because compilers have a\n// much harder time wrt. aliasing issues). Also alignment would need to be set to the sizeof in\n// order to be compatible with targets with larger alignment requirements.\n// But, the in-memory representation of masks is not portable. Thus, at the latest with AVX-512,\n// there would be a problem with requiring SimdMaskArray<T, N> to be an ABI compatible type.\n// AVX-512 uses one bit per boolean, whereas SSE/AVX use sizeof(T) Bytes per boolean. Conversion\n// between the two representations is not a trivial operation. Therefore choosing one or the other\n// representation will have a considerable impact for the targets that do not use this\n// representation. Since the future probably belongs to one bit per boolean representation, I would\n// go with that choice.\n//\n// b) requires that SimdArray<T, N> != SimdArray<T, N> if\n// SimdArray<T, N>::vector_type != SimdArray<T, N>::vector_type\n//\n// Therefore use SimdArray<T, N, V>, where V follows from the above.\ntemplate <class T, std::size_t N,\n          class V = typename Common::select_best_vector_type<T, N>::type,\n          std::size_t Wt = V::Size>\nclass SimdArray;\ntemplate <class T, std::size_t N,\n          class V = typename Common::select_best_vector_type<T, N>::type,\n          std::size_t Wt = V::Size>\nclass SimdMaskArray;\n\nnamespace simd_abi\n{\nusing scalar = VectorAbi::Scalar;\ntemplate <int N> struct fixed_size;\ntemplate <class T> using compatible = typename VectorAbi::DeduceCompatible<T>::type;\ntemplate <class T> using native = typename VectorAbi::DeduceBest<T>::type;\nusing __sse = VectorAbi::Sse;\nusing __avx = VectorAbi::Avx;\nstruct __avx512;\nstruct __neon;\n}  // namespace simd_abi\n\ntemplate <class T, class Abi = simd_abi::compatible<T>> using simd = Vector<T, Abi>;\ntemplate <class T, class Abi = simd_abi::compatible<T>> using simd_mask = Mask<T, Abi>;\ntemplate <class T> using native_simd = simd<T, simd_abi::native<T>>;\ntemplate <class T> using native_simd_mask = simd_mask<T, simd_abi::native<T>>;\ntemplate <class T, int N> using fixed_size_simd = simd<T, simd_abi::fixed_size<N>>;\ntemplate <class T, int N>\nusing fixed_size_simd_mask = simd_mask<T, simd_abi::fixed_size<N>>;\n\n}  // namespace Vc_VERSIONED_NAMESPACE\n\n#ifndef DOXYGEN\n// doxygen has Vc_VERSIONED_NAMESPACE predefined to Vc\nnamespace Vc = Vc_VERSIONED_NAMESPACE;\n#endif  // DOXYGEN\n\n#endif  // VC_FWDDECL_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/global.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_GLOBAL_H_\n#define VC_GLOBAL_H_\n\n#include <cstdint>\n#include \"fwddecl.h\"\n\n#ifdef DOXYGEN\n\n/**\n * \\name Compiler Identification Macros\n * \\ingroup Utilities\n */\n//@{\n/**\n * \\ingroup Utilities\n * This macro is defined to a number identifying the ICC version if the current\n * translation unit is compiled with the Intel compiler.\n *\n * For any other compiler this macro is not defined.\n */\n#define Vc_ICC __INTEL_COMPILER_BUILD_DATE\n#undef Vc_ICC\n/**\n * \\ingroup Utilities\n * This macro is defined to a number identifying the Clang version if the current\n * translation unit is compiled with the Clang compiler.\n *\n * For any other compiler this macro is not defined.\n */\n#define Vc_CLANG (__clang_major__ * 0x10000 + __clang_minor__ * 0x100 + __clang_patchlevel__)\n#undef Vc_CLANG\n/**\n * \\ingroup Utilities\n * This macro is defined to a number identifying the Apple Clang version if the current\n * translation unit is compiled with the Apple Clang compiler.\n *\n * For any other compiler this macro is not defined.\n */\n#define Vc_APPLECLANG (__clang_major__ * 0x10000 + __clang_minor__ * 0x100 + __clang_patchlevel__)\n#undef Vc_APPLECLANG\n/**\n * \\ingroup Utilities\n * This macro is defined to a number identifying the GCC version if the current\n * translation unit is compiled with the GCC compiler.\n *\n * For any other compiler this macro is not defined.\n */\n#define Vc_GCC (__GNUC__ * 0x10000 + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__)\n/**\n * \\ingroup Utilities\n * This macro is defined to a number identifying the Microsoft Visual C++ version if\n * the current translation unit is compiled with the Visual C++ (MSVC) compiler.\n *\n * For any other compiler this macro is not defined.\n */\n#define Vc_MSVC _MSC_FULL_VER\n#undef Vc_MSVC\n//@}\n\n#else  // DOXYGEN\n\n// Compiler defines\n#ifdef __INTEL_COMPILER\n#define Vc_ICC __INTEL_COMPILER_BUILD_DATE\n#elif defined(__clang__) && defined(__apple_build_version__)\n#define Vc_APPLECLANG (__clang_major__ * 0x10000 + __clang_minor__ * 0x100 + __clang_patchlevel__)\n#elif defined(__clang__)\n#define Vc_CLANG (__clang_major__ * 0x10000 + __clang_minor__ * 0x100 + __clang_patchlevel__)\n#elif defined(__GNUC__)\n#define Vc_GCC (__GNUC__ * 0x10000 + __GNUC_MINOR__ * 0x100 + __GNUC_PATCHLEVEL__)\n#elif defined(_MSC_VER)\n#define Vc_MSVC _MSC_FULL_VER\n#else\n#define Vc_UNSUPPORTED_COMPILER 1\n#endif\n\n#if defined Vc_GCC && Vc_GCC >= 0x60000\n#define Vc_RESET_DIAGNOSTICS _Pragma(\"GCC diagnostic pop\")\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wignored-attributes\"\n#else\n#define Vc_RESET_DIAGNOSTICS\n#endif\n\n#if defined Vc_ICC\n// 'warning #2922: template parameter \"<unnamed>\" cannot be used because it follows a\n// parameter pack and cannot be deduced from the parameters of function template'\n// This warning is stupid. The parameter is unnamed because I don't want to use it. I see\n// no other workaround than to disable the warning. Sadly, it doesn't suffice to disable\n// it for the Vc headers. It must also be disabled at the places Vc types are used.\n#pragma warning disable 2922\n#endif\n\n#if __cplusplus < 201103 && (!defined Vc_MSVC || _MSC_VER < 1900)\n# error \"Vc requires support for C++11.\"\n#elif __cplusplus >= 201402L\n# define Vc_CXX14 1\n# if __cplusplus > 201700L\n#  define Vc_CXX17 1\n# endif\n#endif\n\n#if defined(__GNUC__) && !defined(Vc_NO_INLINE_ASM)\n#define Vc_GNU_ASM 1\n#endif\n\n#ifdef Vc_GCC\n#  if Vc_GCC >= 0x70000 && defined __i386__\n     // GCC 7 changed alignof(max_align_t) to 16. glibc 2.26 followed with malloc in 2.26.\n     // 1. If GCC >= 7 and libc is not glibc max_align_t and malloc mismatch\n     // 2. If GCC >= 7 and libc is glibc < 2.26 max_align_t and malloc mismatch\n#    ifdef __GLIBC_PREREQ\n#      if __GLIBC_PREREQ(2,26)\n#        define Vc_HAVE_STD_MAX_ALIGN_T 1\n#      endif\n#    endif\n#  elif Vc_GCC >= 0x40900\n#    define Vc_HAVE_STD_MAX_ALIGN_T 1\n#  else\n#    define Vc_HAVE_MAX_ALIGN_T 1\n#  endif\n#elif !defined(Vc_CLANG) && !defined(Vc_ICC)\n//   Clang/ICC don't provide max_align_t at all\n//   TODO: Clang defines max_align_t since 3.5.0. Whether std::max_align_t is defined depends on the\n//   standard library version.\n#  define Vc_HAVE_STD_MAX_ALIGN_T 1\n#endif\n\n#if defined(Vc_GCC) || defined(Vc_CLANG) || defined Vc_APPLECLANG\n#define Vc_USE_BUILTIN_VECTOR_TYPES 1\n#endif\n\n#ifdef Vc_MSVC\n#  define Vc_CDECL __cdecl\n#  define Vc_VDECL __vectorcall\n#else\n#  define Vc_CDECL\n#  define Vc_VDECL\n#endif\n\n/* Define the following strings to a unique integer, which is the only type the preprocessor can\n * compare. This allows to use -DVc_IMPL=SSE3. The preprocessor will then consider Vc_IMPL and SSE3\n * to be equal. Of course, it is important to undefine the strings later on!\n */\n#define Scalar 0x00100000\n#define SSE    0x00200000\n#define SSE2   0x00300000\n#define SSE3   0x00400000\n#define SSSE3  0x00500000\n#define SSE4_1 0x00600000\n#define SSE4_2 0x00700000\n#define AVX    0x00800000\n#define AVX2   0x00900000\n\n#define XOP    0x00000001\n#define FMA4   0x00000002\n#define F16C   0x00000004\n#define POPCNT 0x00000008\n#define SSE4a  0x00000010\n#define FMA    0x00000020\n#define BMI2   0x00000040\n\n#define IMPL_MASK 0xFFF00000\n#define EXT_MASK  0x000FFFFF\n\n#ifdef Vc_MSVC\n# ifdef _M_IX86_FP\n#  if _M_IX86_FP >= 1\n#   ifndef __SSE__\n#    define __SSE__ 1\n#   endif\n#  endif\n#  if _M_IX86_FP >= 2\n#   ifndef __SSE2__\n#    define __SSE2__ 1\n#   endif\n#  endif\n# elif defined(_M_AMD64)\n// If the target is x86_64 then SSE2 is guaranteed\n#  ifndef __SSE__\n#   define __SSE__ 1\n#  endif\n#  ifndef __SSE2__\n#   define __SSE2__ 1\n#  endif\n# endif\n#endif\n\n#if defined Vc_ICC && !defined __POPCNT__\n# if defined __SSE4_2__ || defined __SSE4A__\n#  define __POPCNT__ 1\n# endif\n#endif\n\n#ifdef VC_IMPL\n#error \"You are using the old VC_IMPL macro. Since Vc 1.0 all Vc macros start with Vc_, i.e. a lower-case 'c'\"\n#endif\n\n#ifndef Vc_IMPL\n\n#  if defined(__AVX2__)\n#    define Vc_IMPL_AVX2 1\n#    define Vc_IMPL_AVX 1\n#  elif defined(__AVX__)\n#    define Vc_IMPL_AVX 1\n#  else\n#    if defined(__SSE4_2__)\n#      define Vc_IMPL_SSE 1\n#      define Vc_IMPL_SSE4_2 1\n#    endif\n#    if defined(__SSE4_1__)\n#      define Vc_IMPL_SSE 1\n#      define Vc_IMPL_SSE4_1 1\n#    endif\n#    if defined(__SSE3__)\n#      define Vc_IMPL_SSE 1\n#      define Vc_IMPL_SSE3 1\n#    endif\n#    if defined(__SSSE3__)\n#      define Vc_IMPL_SSE 1\n#      define Vc_IMPL_SSSE3 1\n#    endif\n#    if defined(__SSE2__)\n#      define Vc_IMPL_SSE 1\n#      define Vc_IMPL_SSE2 1\n#    endif\n\n#    if defined(Vc_IMPL_SSE)\n       // nothing\n#    else\n#      define Vc_IMPL_Scalar 1\n#    endif\n#  endif\n#  if !defined(Vc_IMPL_Scalar)\n#    ifdef __FMA4__\n#      define Vc_IMPL_FMA4 1\n#    endif\n#    ifdef __XOP__\n#      define Vc_IMPL_XOP 1\n#    endif\n#    ifdef __F16C__\n#      define Vc_IMPL_F16C 1\n#    endif\n#    ifdef __POPCNT__\n#      define Vc_IMPL_POPCNT 1\n#    endif\n#    ifdef __SSE4A__\n#      define Vc_IMPL_SSE4a 1\n#    endif\n#    ifdef __FMA__\n#      define Vc_IMPL_FMA 1\n#    endif\n#    ifdef __BMI2__\n#      define Vc_IMPL_BMI2 1\n#    endif\n#  endif\n\n#else // Vc_IMPL\n\n#  if (Vc_IMPL & IMPL_MASK) == AVX2 // AVX2 supersedes SSE\n#    define Vc_IMPL_AVX2 1\n#    define Vc_IMPL_AVX 1\n#  elif (Vc_IMPL & IMPL_MASK) == AVX // AVX supersedes SSE\n#    define Vc_IMPL_AVX 1\n#  elif (Vc_IMPL & IMPL_MASK) == Scalar\n#    define Vc_IMPL_Scalar 1\n#  elif (Vc_IMPL & IMPL_MASK) == SSE4_2\n#    define Vc_IMPL_SSE4_2 1\n#    define Vc_IMPL_SSE4_1 1\n#    define Vc_IMPL_SSSE3 1\n#    define Vc_IMPL_SSE3 1\n#    define Vc_IMPL_SSE2 1\n#    define Vc_IMPL_SSE 1\n#  elif (Vc_IMPL & IMPL_MASK) == SSE4_1\n#    define Vc_IMPL_SSE4_1 1\n#    define Vc_IMPL_SSSE3 1\n#    define Vc_IMPL_SSE3 1\n#    define Vc_IMPL_SSE2 1\n#    define Vc_IMPL_SSE 1\n#  elif (Vc_IMPL & IMPL_MASK) == SSSE3\n#    define Vc_IMPL_SSSE3 1\n#    define Vc_IMPL_SSE3 1\n#    define Vc_IMPL_SSE2 1\n#    define Vc_IMPL_SSE 1\n#  elif (Vc_IMPL & IMPL_MASK) == SSE3\n#    define Vc_IMPL_SSE3 1\n#    define Vc_IMPL_SSE2 1\n#    define Vc_IMPL_SSE 1\n#  elif (Vc_IMPL & IMPL_MASK) == SSE2\n#    define Vc_IMPL_SSE2 1\n#    define Vc_IMPL_SSE 1\n#  elif (Vc_IMPL & IMPL_MASK) == SSE\n#    define Vc_IMPL_SSE 1\n#    if defined(__SSE4_2__)\n#      define Vc_IMPL_SSE4_2 1\n#    endif\n#    if defined(__SSE4_1__)\n#      define Vc_IMPL_SSE4_1 1\n#    endif\n#    if defined(__SSE3__)\n#      define Vc_IMPL_SSE3 1\n#    endif\n#    if defined(__SSSE3__)\n#      define Vc_IMPL_SSSE3 1\n#    endif\n#    if defined(__SSE2__)\n#      define Vc_IMPL_SSE2 1\n#    endif\n#  elif (Vc_IMPL & IMPL_MASK) == 0 && (Vc_IMPL & SSE4a)\n     // this is for backward compatibility only where SSE4a was included in the main\n     // line of available SIMD instruction sets\n#    define Vc_IMPL_SSE3 1\n#    define Vc_IMPL_SSE2 1\n#    define Vc_IMPL_SSE 1\n#  endif\n#  if (Vc_IMPL & XOP)\n#    define Vc_IMPL_XOP 1\n#  endif\n#  if (Vc_IMPL & FMA4)\n#    define Vc_IMPL_FMA4 1\n#  endif\n#  if (Vc_IMPL & F16C)\n#    define Vc_IMPL_F16C 1\n#  endif\n#  if (!defined(Vc_IMPL_Scalar) && defined(__POPCNT__)) || (Vc_IMPL & POPCNT)\n#    define Vc_IMPL_POPCNT 1\n#  endif\n#  if (Vc_IMPL & SSE4a)\n#    define Vc_IMPL_SSE4a 1\n#  endif\n#  if (Vc_IMPL & FMA)\n#    define Vc_IMPL_FMA 1\n#  endif\n#  if (Vc_IMPL & BMI2)\n#    define Vc_IMPL_BMI2 1\n#  endif\n#  undef Vc_IMPL\n\n#endif // Vc_IMPL\n\n// If AVX is enabled in the compiler it will use VEX coding for the SIMD instructions.\n#ifdef __AVX__\n#  define Vc_USE_VEX_CODING 1\n#endif\n\n#ifdef Vc_IMPL_AVX\n// if we have AVX then we also have all SSE intrinsics\n#    define Vc_IMPL_SSE4_2 1\n#    define Vc_IMPL_SSE4_1 1\n#    define Vc_IMPL_SSSE3 1\n#    define Vc_IMPL_SSE3 1\n#    define Vc_IMPL_SSE2 1\n#    define Vc_IMPL_SSE 1\n#endif\n\n#if defined(Vc_CLANG) && Vc_CLANG >= 0x30600 && Vc_CLANG < 0x30700\n#    if defined(Vc_IMPL_AVX)\n#        warning \"clang 3.6.x miscompiles AVX code, frequently losing 50% of the data. Vc will fall back to SSE4 instead.\"\n#        undef Vc_IMPL_AVX\n#        if defined(Vc_IMPL_AVX2)\n#            undef Vc_IMPL_AVX2\n#        endif\n#    endif\n#endif\n\n# if !defined(Vc_IMPL_Scalar) && !defined(Vc_IMPL_SSE) && !defined(Vc_IMPL_AVX)\n#  error \"No suitable Vc implementation was selected! Probably Vc_IMPL was set to an invalid value.\"\n# elif defined(Vc_IMPL_SSE) && !defined(Vc_IMPL_SSE2)\n#  error \"SSE requested but no SSE2 support. Vc needs at least SSE2!\"\n# endif\n\n#undef Scalar\n#undef SSE\n#undef SSE2\n#undef SSE3\n#undef SSSE3\n#undef SSE4_1\n#undef SSE4_2\n#undef AVX\n#undef AVX2\n\n#undef XOP\n#undef FMA4\n#undef F16C\n#undef POPCNT\n#undef SSE4a\n#undef FMA\n#undef BMI2\n\n#undef IMPL_MASK\n#undef EXT_MASK\n\n#if defined Vc_IMPL_AVX2\n#define Vc_DEFAULT_IMPL_AVX2\n#elif defined Vc_IMPL_AVX\n#define Vc_DEFAULT_IMPL_AVX\n#elif defined Vc_IMPL_SSE\n#define Vc_DEFAULT_IMPL_SSE\n#elif defined Vc_IMPL_Scalar\n#define Vc_DEFAULT_IMPL_Scalar\n#else\n#error \"Preprocessor logic broken. Please report a bug.\"\n#endif\n\n#endif // DOXYGEN\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\ntypedef   signed char        int8_t;\ntypedef unsigned char       uint8_t;\ntypedef   signed short      int16_t;\ntypedef unsigned short     uint16_t;\ntypedef   signed int        int32_t;\ntypedef unsigned int       uint32_t;\ntypedef   signed long long  int64_t;\ntypedef unsigned long long uint64_t;\n\n/**\n * \\ingroup Utilities\n *\n * Enum that specifies the alignment and padding restrictions to use for memory allocation with\n * Vc::malloc.\n */\nenum MallocAlignment {\n    /**\n     * Align on boundary of vector sizes (e.g. 16 Bytes on SSE platforms) and pad to allow\n     * vector access to the end. Thus the allocated memory contains a multiple of\n     * VectorAlignment bytes.\n     */\n    AlignOnVector,\n    /**\n     * Align on boundary of cache line sizes (e.g. 64 Bytes on x86) and pad to allow\n     * full cache line access to the end. Thus the allocated memory contains a multiple of\n     * 64 bytes.\n     */\n    AlignOnCacheline,\n    /**\n     * Align on boundary of page sizes (e.g. 4096 Bytes on x86) and pad to allow\n     * full page access to the end. Thus the allocated memory contains a multiple of\n     * 4096 bytes.\n     */\n    AlignOnPage\n};\n\n/**\n * \\ingroup Utilities\n *\n * Enum to identify a certain SIMD instruction set.\n *\n * You can use \\ref CurrentImplementation for the currently active implementation.\n *\n * \\see ExtraInstructions\n */\nenum Implementation : std::uint_least32_t { // TODO: make enum class\n    /// uses only fundamental types\n    ScalarImpl,\n    /// x86 SSE + SSE2\n    SSE2Impl,\n    /// x86 SSE + SSE2 + SSE3\n    SSE3Impl,\n    /// x86 SSE + SSE2 + SSE3 + SSSE3\n    SSSE3Impl,\n    /// x86 SSE + SSE2 + SSE3 + SSSE3 + SSE4.1\n    SSE41Impl,\n    /// x86 SSE + SSE2 + SSE3 + SSSE3 + SSE4.1 + SSE4.2\n    SSE42Impl,\n    /// x86 AVX\n    AVXImpl,\n    /// x86 AVX + AVX2\n    AVX2Impl,\n    /// Intel Xeon Phi\n    MICImpl,\n    ImplementationMask = 0xfff\n};\n\n/**\n * \\ingroup Utilities\n *\n * The list of available instructions is not easily described by a linear list of instruction sets.\n * On x86 the following instruction sets always include their predecessors:\n * SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2\n *\n * But there are additional instructions that are not necessarily required by this list. These are\n * covered in this enum.\n */\nenum ExtraInstructions : std::uint_least32_t { // TODO: make enum class\n    //! Support for float16 conversions in hardware\n    Float16cInstructions  = 0x01000,\n    //! Support for FMA4 instructions\n    Fma4Instructions      = 0x02000,\n    //! Support for XOP instructions\n    XopInstructions       = 0x04000,\n    //! Support for the population count instruction\n    PopcntInstructions    = 0x08000,\n    //! Support for SSE4a instructions\n    Sse4aInstructions     = 0x10000,\n    //! Support for FMA instructions (3 operand variant)\n    FmaInstructions       = 0x20000,\n    //! Support for ternary instruction coding (VEX)\n    VexInstructions       = 0x40000,\n    //! Support for BMI2 instructions\n    Bmi2Instructions      = 0x80000,\n    // PclmulqdqInstructions,\n    // AesInstructions,\n    // RdrandInstructions\n    ExtraInstructionsMask = 0xfffff000u\n};\n\n/**\n * \\ingroup Utilities\n * This class identifies the specific implementation %Vc uses in the current translation\n * unit in terms of a type.\n *\n * Most importantantly, the type \\ref CurrentImplementation instantiates the class\n * template with the bitmask identifying the current implementation. The contents of the\n * bitmask can be queried with the static member functions of the class.\n */\ntemplate <unsigned int Features> struct ImplementationT {\n    /// Returns the currently used Vc::Implementation.\n    static constexpr Implementation current()\n    {\n        return static_cast<Implementation>(Features & ImplementationMask);\n    }\n    /// Returns whether \\p impl is the current Vc::Implementation.\n    static constexpr bool is(Implementation impl)\n    {\n        return static_cast<unsigned int>(impl) == current();\n    }\n    /**\n     * Returns whether the current Vc::Implementation implements at least \\p low and at\n     * most \\p high.\n     */\n    static constexpr bool is_between(Implementation low, Implementation high)\n    {\n        return static_cast<unsigned int>(low) <= current() &&\n               static_cast<unsigned int>(high) >= current();\n    }\n    /**\n     * Returns whether the current code would run on a CPU providing \\p extraInstructions.\n     */\n    static constexpr bool runs_on(unsigned int extraInstructions)\n    {\n        return (extraInstructions & Features & ExtraInstructionsMask) ==\n               (Features & ExtraInstructionsMask);\n    }\n};\n/**\n * \\ingroup Utilities\n * Identifies the %Vc implementation used in the current translation unit.\n *\n * \\see ImplementationT\n */\nusing CurrentImplementation = ImplementationT<\n#ifdef Vc_IMPL_Scalar\n    ScalarImpl\n#elif defined(Vc_IMPL_AVX2)\n    AVX2Impl\n#elif defined(Vc_IMPL_AVX)\n    AVXImpl\n#elif defined(Vc_IMPL_SSE4_2)\n    SSE42Impl\n#elif defined(Vc_IMPL_SSE4_1)\n    SSE41Impl\n#elif defined(Vc_IMPL_SSSE3)\n    SSSE3Impl\n#elif defined(Vc_IMPL_SSE3)\n    SSE3Impl\n#elif defined(Vc_IMPL_SSE2)\n    SSE2Impl\n#endif\n#ifdef Vc_IMPL_SSE4a\n    + Vc::Sse4aInstructions\n#ifdef Vc_IMPL_XOP\n    + Vc::XopInstructions\n#ifdef Vc_IMPL_FMA4\n    + Vc::Fma4Instructions\n#endif\n#endif\n#endif\n#ifdef Vc_IMPL_POPCNT\n    + Vc::PopcntInstructions\n#endif\n#ifdef Vc_IMPL_FMA\n    + Vc::FmaInstructions\n#endif\n#ifdef Vc_IMPL_BMI2\n    + Vc::Bmi2Instructions\n#endif\n#ifdef Vc_USE_VEX_CODING\n    + Vc::VexInstructions\n#endif\n    >;\n\n}  // namespace Vc\n\n#include \"version.h\"\n\n#endif // VC_GLOBAL_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/iterators",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_INCLUDE_VC_ITERATORS_H_\n#define VC_INCLUDE_VC_ITERATORS_H_\n\n#include \"common/iterators.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\n    using ::Vc::Common::begin;\n    using ::Vc::Common::end;\n    using ::Vc::Common::makeIterator;\n}\n\n#endif // VC_INCLUDE_VC_ITERATORS_H_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/limits",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_LIMITS_\n#define VC_LIMITS_\n\n#include <limits>\n#include \"vector.h\"\n#include \"common/macros.h\"\n#include <limits>\n\nnamespace std\n{\ntemplate<typename T> struct numeric_limits<Vc::Vector<T> > : public numeric_limits<typename Vc::Vector<T>::EntryType>\n{\nprivate:\n    typedef numeric_limits<typename Vc::Vector<T>::EntryType> _Base;\npublic:\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> max()           { return Vc::Vector<T>(_Base::max()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> min()           { return Vc::Vector<T>(_Base::min()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> lowest()        { return Vc::Vector<T>(_Base::lowest()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> epsilon()       { return Vc::Vector<T>(_Base::epsilon()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> round_error()   { return Vc::Vector<T>(_Base::round_error()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> infinity()      { return Vc::Vector<T>(_Base::infinity()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> quiet_NaN()     { return Vc::Vector<T>(_Base::quiet_NaN()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> signaling_NaN() { return Vc::Vector<T>(_Base::signaling_NaN()); }\n    static Vc_INTRINSIC Vc_CONST Vc::Vector<T> denorm_min()    { return Vc::Vector<T>(_Base::denorm_min()); }\n};\n} // namespace std\n\n#ifdef Vc_IMPL_Scalar\n# include \"scalar/limits.h\"\n#elif defined(Vc_IMPL_AVX)\n# include \"avx/limits.h\"\n#elif defined(Vc_IMPL_SSE)\n# include \"sse/limits.h\"\n#endif\n\n#endif // VC_LIMITS_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/detail.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2016 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_DETAIL_H_\n#define VC_SCALAR_DETAIL_H_\n\n#include \"../common/detail.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n//InterleaveImpl{{{1\ntemplate<typename V, size_t Size, size_t VSize> struct InterleaveImpl;\ntemplate<typename V, size_t VSize> struct InterleaveImpl<V, 1, VSize> {\n    template <typename I>  // interleave 2 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        data[i[0] + 0] = v0.data();\n        data[i[0] + 1] = v1.data();\n    }\n    template <typename I>  // interleave 3 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2)\n    {\n        data[i[0] + 0] = v0.data();\n        data[i[0] + 1] = v1.data();\n        data[i[0] + 2] = v2.data();\n    }\n    template <typename I>  // interleave 4 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        data[i[0] + 0] = v0.data();\n        data[i[0] + 1] = v1.data();\n        data[i[0] + 2] = v2.data();\n        data[i[0] + 3] = v3.data();\n    }\n    template <typename I>  // interleave 5 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        data[i[0] + 4] = v4.data();\n    }\n    template <typename I>  // interleave 6 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // interleave 7 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // interleave 8 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6, const typename V::AsArg v7)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6, v7);\n    }\n    //}}}2\n    template <typename I>  // deinterleave 2 args{{{2\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1)\n    {\n        v0.data() = data[i[0] + 0];\n        v1.data() = data[i[0] + 1];\n    }\n    template <typename I>  // deinterleave 3 args{{{2\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2)\n    {\n        v0.data() = data[i[0] + 0];\n        v1.data() = data[i[0] + 1];\n        v2.data() = data[i[0] + 2];\n    }\n    template <typename I>  // deinterleave 4 args{{{2\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2, V &v3)\n    {\n        v0.data() = data[i[0] + 0];\n        v1.data() = data[i[0] + 1];\n        v2.data() = data[i[0] + 2];\n        v3.data() = data[i[0] + 3];\n    }\n    template <typename I>  // deinterleave 5 args{{{2\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2, V &v3, V &v4)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        v4.data() = data[i[0] + 4];\n    }\n    template <typename I>  // deinterleave 6 args{{{2\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // deinterleave 7 args{{{2\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // deinterleave 8 args{{{2\n    static inline void deinterleave(typename V::EntryType const *const data, const I &i,\n                                    V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6,\n                                    V &v7)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5, v6, v7);\n    }\n};\n//}}}1\n}  // namespace Detail\n}  // namespace Vc\n\n#endif  // VC_SCALAR_DETAIL_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/helperimpl.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_DEINTERLEAVE_H_\n#define VC_SCALAR_DEINTERLEAVE_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <typename T, typename M, typename A>\nVc_ALWAYS_INLINE void deinterleave(Scalar::Vector<T> &a, Scalar::Vector<T> &b,\n                                   const M *mem, A)\n{\n    a = mem[0];\n    b = mem[1];\n}\n\nVc_ALWAYS_INLINE void prefetchForOneRead(const void *, VectorAbi::Scalar) {}\nVc_ALWAYS_INLINE void prefetchForModify(const void *, VectorAbi::Scalar) {}\nVc_ALWAYS_INLINE void prefetchClose(const void *, VectorAbi::Scalar) {}\nVc_ALWAYS_INLINE void prefetchMid(const void *, VectorAbi::Scalar) {}\nVc_ALWAYS_INLINE void prefetchFar(const void *, VectorAbi::Scalar) {}\n}  // namespace Detail\n}  // namespace Vc\n\n#endif // VC_SCALAR_DEINTERLEAVE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/limits.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_LIMITS_H_\n#define VC_SCALAR_LIMITS_H_\n\n\n#endif // VC_SCALAR_LIMITS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/macros.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"../common/macros.h\"\n\n#ifndef VC_SCALAR_MACROS_H_\n#define VC_SCALAR_MACROS_H_\n\n#endif // VC_SCALAR_MACROS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/mask.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_MASK_H_\n#define VC_SCALAR_MASK_H_\n\n#include \"types.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\ntemplate <typename T> class Mask<T, VectorAbi::Scalar>\n{\n    friend class Mask<  double, VectorAbi::Scalar>;\n    friend class Mask<   float, VectorAbi::Scalar>;\n    friend class Mask< int32_t, VectorAbi::Scalar>;\n    friend class Mask<uint32_t, VectorAbi::Scalar>;\n    friend class Mask< int16_t, VectorAbi::Scalar>;\n    friend class Mask<uint16_t, VectorAbi::Scalar>;\n\npublic:\n    using abi = VectorAbi::Scalar;\n\n    static constexpr size_t Size = 1;\n    static constexpr size_t MemoryAlignment = 1;\n    static constexpr std::size_t size() { return 1; }\n\n    /**\n     * The \\c EntryType of masks is always bool, independent of \\c T.\n     */\n    typedef bool EntryType;\n    using value_type = EntryType;\n\n    using EntryReference = Vc::Detail::ElementReference<Mask>;\n    using reference = EntryReference;\n\n    /**\n     * The \\c VectorEntryType, in contrast to \\c EntryType, reveals information about the SIMD\n     * implementation. This type is useful for the \\c sizeof operator in generic functions.\n     */\n    typedef bool VectorEntryType;\n\n    /**\n     * The \\c VectorType reveals the implementation-specific internal type used for the SIMD type.\n     */\n    using VectorType = bool;\n\n    /**\n     * The associated Vector<T> type.\n     */\n    using Vector = Scalar::Vector<T>;\n\n    Vc_INTRINSIC Mask() = default;\n    Vc_INTRINSIC explicit Mask(bool b) : m(b) {}\n    Vc_INTRINSIC explicit Mask(VectorSpecialInitializerZero) : m(false) {}\n    Vc_INTRINSIC explicit Mask(VectorSpecialInitializerOne) : m(true) {}\n    Vc_INTRINSIC static Mask Zero() { return Mask(false); }\n    Vc_INTRINSIC static Mask One() { return Mask(true); }\n\n    // implicit cast\n    template <typename U>\n    Vc_INTRINSIC Mask(U &&rhs, Common::enable_if_mask_converts_implicitly<Mask, T, U> = nullarg)\n        : m(rhs.m) {}\n\n#if Vc_IS_VERSION_1\n    // explicit cast, implemented via simd_cast (in scalar/simd_cast_caller.h)\n    template <typename U>\n    Vc_DEPRECATED(\n        \"use simd_cast instead of explicit type casting to convert between mask types\")\n        Vc_INTRINSIC_L\n        explicit Mask(U &&rhs, Common::enable_if_mask_converts_explicitly<T, U> = nullarg)\n            Vc_INTRINSIC_R;\n#endif\n\n        Vc_ALWAYS_INLINE explicit Mask(const bool *mem) : m(mem[0]) {}\n        template<typename Flags> Vc_ALWAYS_INLINE explicit Mask(const bool *mem, Flags) : m(mem[0]) {}\n\n        Vc_ALWAYS_INLINE void load(const bool *mem) { m = mem[0]; }\n        template<typename Flags> Vc_ALWAYS_INLINE void load(const bool *mem, Flags) { m = mem[0]; }\n\n        Vc_ALWAYS_INLINE void store(bool *mem) const { *mem = m; }\n        template<typename Flags> Vc_ALWAYS_INLINE void store(bool *mem, Flags) const { *mem = m; }\n\n        Vc_ALWAYS_INLINE bool operator==(const Mask &rhs) const { return m == rhs.m; }\n        Vc_ALWAYS_INLINE bool operator!=(const Mask &rhs) const { return m != rhs.m; }\n\n        Vc_ALWAYS_INLINE Mask operator&&(const Mask &rhs) const { return Mask(m && rhs.m); }\n        Vc_ALWAYS_INLINE Mask operator& (const Mask &rhs) const { return Mask(m && rhs.m); }\n        Vc_ALWAYS_INLINE Mask operator||(const Mask &rhs) const { return Mask(m || rhs.m); }\n        Vc_ALWAYS_INLINE Mask operator| (const Mask &rhs) const { return Mask(m || rhs.m); }\n        Vc_ALWAYS_INLINE Mask operator^ (const Mask &rhs) const { return Mask(m ^  rhs.m); }\n        Vc_ALWAYS_INLINE Mask operator!() const { return Mask(!m); }\n\n        Vc_ALWAYS_INLINE Mask &operator&=(const Mask &rhs) { m &= rhs.m; return *this; }\n        Vc_ALWAYS_INLINE Mask &operator|=(const Mask &rhs) { m |= rhs.m; return *this; }\n        Vc_ALWAYS_INLINE Mask &operator^=(const Mask &rhs) { m ^= rhs.m; return *this; }\n\n        Vc_ALWAYS_INLINE bool isFull () const { return  m; }\n        Vc_ALWAYS_INLINE bool isNotEmpty() const { return m; }\n        Vc_ALWAYS_INLINE bool isEmpty() const { return !m; }\n        Vc_ALWAYS_INLINE bool isMix  () const { return false; }\n\n        Vc_ALWAYS_INLINE bool data () const { return m; }\n        Vc_ALWAYS_INLINE bool dataI() const { return m; }\n        Vc_ALWAYS_INLINE bool dataD() const { return m; }\n\nprivate:\n    friend reference;\n    static Vc_INTRINSIC bool get(const Mask &o, int) noexcept { return o.m; }\n    template <typename U>\n    static Vc_INTRINSIC void set(Mask &o, int, U &&v) noexcept(\n        noexcept(std::declval<bool &>() = std::declval<U>()))\n    {\n        o.m = std::forward<U>(v);\n    }\n\npublic:\n    /**\n     * \\note the returned object models the concept of a reference and\n     * as such it can exist longer than the data it is referencing.\n     * \\note to avoid lifetime issues, we strongly advice not to store\n     * any reference objects.\n     */\n    Vc_ALWAYS_INLINE reference operator[](size_t i) noexcept\n    {\n        Vc_ASSERT(i == 0); if (i) {}\n        return {*this, 0};\n    }\n    Vc_ALWAYS_INLINE value_type operator[](size_t i) const noexcept\n    {\n        Vc_ASSERT(i == 0); if (i) {}\n        return m;\n    }\n\n        Vc_ALWAYS_INLINE int count() const { return m ? 1 : 0; }\n\n        /**\n         * Returns the index of the first one in the mask.\n         *\n         * The return value is undefined if the mask is empty.\n         */\n        Vc_ALWAYS_INLINE int firstOne() const { return 0; }\n        Vc_ALWAYS_INLINE int toInt() const { return m ? 1 : 0; }\n\n        template <typename G> static Vc_INTRINSIC Mask generate(G &&gen)\n        {\n            return Mask(gen(0));\n        }\n\n        Vc_INTRINSIC Vc_PURE Mask shifted(int amount) const\n        {\n            if (amount == 0) {\n                return *this;\n            } else {\n                return Zero();\n            }\n        }\n\n    private:\n        bool m;\n};\ntemplate <typename T> constexpr size_t Mask<T, VectorAbi::Scalar>::Size;\ntemplate <typename T> constexpr size_t Mask<T, VectorAbi::Scalar>::MemoryAlignment;\n\n}  // namespace Vc\n\n#endif // VC_SCALAR_MASK_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/math.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_MATH_H_\n#define VC_SCALAR_MATH_H_\n\n#include <cstdlib>\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// copysign {{{1\nVc_INTRINSIC Scalar::float_v copysign(Scalar::float_v mag, Scalar::float_v sign)\n{\n    union {\n        float f;\n        unsigned int i;\n    } value, s;\n    value.f = mag.data();\n    s.f = sign.data();\n    value.i = (s.i & 0x80000000u) | (value.i & 0x7fffffffu);\n    return Scalar::float_v{value.f};\n}\nVc_INTRINSIC Vc_CONST Scalar::double_v copysign(Scalar::double_v mag,\n                                                Scalar::double_v sign)\n{\n    union {\n        double f;\n        unsigned long long i;\n    } value, s;\n    value.f = mag.data();\n    s.f = sign.data();\n    value.i = (s.i & 0x8000000000000000ull) | (value.i & 0x7fffffffffffffffull);\n    return Scalar::double_v{value.f};\n}\n\n// }}}1\n\n#define Vc_MINMAX(V)                                                                     \\\n    static Vc_ALWAYS_INLINE Scalar::V min(const Scalar::V &x, const Scalar::V &y)        \\\n    {                                                                                    \\\n        return Scalar::V(std::min(x.data(), y.data()));                                  \\\n    }                                                                                    \\\n    static Vc_ALWAYS_INLINE Scalar::V max(const Scalar::V &x, const Scalar::V &y)        \\\n    {                                                                                    \\\n        return Scalar::V(std::max(x.data(), y.data()));                                  \\\n    }\nVc_ALL_VECTOR_TYPES(Vc_MINMAX);\n#undef Vc_MINMAX\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> sqrt (const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::sqrt(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> rsqrt(const Scalar::Vector<T> &x)\n{\n    const typename Vector<T, VectorAbi::Scalar>::EntryType one = 1; return Scalar::Vector<T>(one / std::sqrt(x.data()));\n}\n\ntemplate <typename T,\n          typename = enable_if<std::is_same<T, double>::value || std::is_same<T, float>::value ||\n                               std::is_same<T, int>::value>>\nVc_ALWAYS_INLINE Vc_PURE Scalar::Vector<T> abs(Scalar::Vector<T> x)\n{\n    return std::abs(x.data());\n}\n\nVc_ALWAYS_INLINE Vc_PURE Scalar::Vector<short> abs(Scalar::Vector<short> x)\n{\n    return std::abs(static_cast<int>(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE void sincos(const Scalar::Vector<T> &x, Scalar::Vector<T> *sin, Scalar::Vector<T> *cos)\n{\n#if defined(_WIN32) || defined(__APPLE__)\n    sin->data() = std::sin(x.data());\n    cos->data() = std::cos(x.data());\n#elif Vc_HAS_BUILTIN(__builtin_sincosf) || defined Vc_GCC\n    __builtin_sincosf(x.data(), &sin->data(), &cos->data());\n#else\n    sincosf(x.data(), &sin->data(), &cos->data());\n#endif\n}\n\ntemplate<> Vc_ALWAYS_INLINE void sincos(const Scalar::Vector<double> &x, Scalar::Vector<double> *sin, Scalar::Vector<double> *cos)\n{\n#if defined(_WIN32) || defined(__APPLE__)\n    sin->data() = std::sin(x.data());\n    cos->data() = std::cos(x.data());\n#elif Vc_HAS_BUILTIN(__builtin_sincos) || defined Vc_GCC\n    __builtin_sincos(x.data(), &sin->data(), &cos->data());\n#else\n    #if defined(__OpenBSD__)\n        sin->data() = ::sin(x.data());\n        cos->data() = ::cos(x.data());\n    #else /* OpenBSD */\n        ::sincos(x.data(), &sin->data(), &cos->data());\n    #endif /* OpenBSD */\n#endif\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> sin  (const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::sin(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> asin (const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::asin(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> cos  (const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::cos(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> log  (const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::log(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> log10(const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::log10(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> log2(const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::log2(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> exp (const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::exp(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> atan (const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::atan( x.data() ));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> atan2(const Scalar::Vector<T> &x, const Scalar::Vector<T> &y)\n{\n    return Scalar::Vector<T>(std::atan2( x.data(), y.data() ));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> trunc(const Scalar::Vector<T> &x)\n{\n    return std::trunc(x.data());\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> floor(const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::floor(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> ceil(const Scalar::Vector<T> &x)\n{\n    return Scalar::Vector<T>(std::ceil(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> round(const Scalar::Vector<T> &x)\n{\n    return x;\n}\n\nnamespace\n{\n    template<typename T> bool _realIsEvenHalf(T x) {\n        const T two = 2;\n        const T half = 0.5;\n        const T f = std::floor(x * half) * two;\n        return (x - f) == half;\n    }\n} // namespace\ntemplate<> Vc_ALWAYS_INLINE Scalar::Vector<float>  round(const Scalar::Vector<float>  &x)\n{\n    return Scalar::float_v(std::floor(x.data() + 0.5f) - (_realIsEvenHalf(x.data()) ? 1.f : 0.f));\n}\n\ntemplate<> Vc_ALWAYS_INLINE Scalar::Vector<double> round(const Scalar::Vector<double> &x)\n{\n    return Scalar::double_v(std::floor(x.data() + 0.5 ) - (_realIsEvenHalf(x.data()) ? 1.  : 0. ));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE Scalar::Vector<T> reciprocal(const Scalar::Vector<T> &x)\n{\n    const typename Vector<T, VectorAbi::Scalar>::EntryType one = 1; return Scalar::Vector<T>(one / x.data());\n}\n\n#ifdef isfinite\n#undef isfinite\n#endif\n#ifdef isnan\n#undef isnan\n#endif\ntemplate<typename T> static Vc_ALWAYS_INLINE typename Vector<T, VectorAbi::Scalar>::Mask isfinite(const Scalar::Vector<T> &x)\n{\n    return typename Vector<T, VectorAbi::Scalar>::Mask(\n#ifdef _MSC_VER\n            !!_finite(x.data())\n#elif defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1500\n            ::isfinite(x.data())\n#else\n            std::isfinite(x.data())\n#endif\n            );\n}\n\ntemplate<typename T> Vc_ALWAYS_INLINE typename Vector<T, VectorAbi::Scalar>::Mask isinf(const Scalar::Vector<T> &x)\n{\n    return typename Vector<T, VectorAbi::Scalar>::Mask(std::isinf(x.data()));\n}\n\ntemplate<typename T> static Vc_ALWAYS_INLINE typename Vector<T, VectorAbi::Scalar>::Mask isnan(const Scalar::Vector<T> &x)\n{\n    return typename Vector<T, VectorAbi::Scalar>::Mask(\n#ifdef _MSC_VER\n            !!_isnan(x.data())\n#elif defined(__INTEL_COMPILER) && __INTEL_COMPILER < 1500\n            ::isnan(x.data())\n#else\n            std::isnan(x.data())\n#endif\n            );\n}\n\nVc_ALWAYS_INLINE Scalar::Vector<float> frexp(Scalar::Vector<float> x, SimdArray<int, 1, Scalar::Vector<int>, 1> *e) {\n    return Scalar::float_v(std::frexp(x.data(), &internal_data(*e).data()));\n}\nVc_ALWAYS_INLINE Scalar::Vector<double> frexp(Scalar::Vector<double> x, SimdArray<int, 1, Scalar::Vector<int>, 1> *e) {\n    return Scalar::double_v(std::frexp(x.data(), &internal_data(*e).data()));\n}\n\nVc_ALWAYS_INLINE Scalar::Vector<float> ldexp(Scalar::Vector<float> x, const SimdArray<int, 1, Scalar::Vector<int>, 1> &e) {\n    return Scalar::float_v(std::ldexp(x.data(), internal_data(e).data()));\n}\nVc_ALWAYS_INLINE Scalar::Vector<double> ldexp(Scalar::Vector<double> x, const SimdArray<int, 1, Scalar::Vector<int>, 1> &e) {\n    return Scalar::double_v(std::ldexp(x.data(), internal_data(e).data()));\n}\n\n// fma {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vector<T, VectorAbi::Scalar> fma(Vector<T, VectorAbi::Scalar> a,\n                                                  Vector<T, VectorAbi::Scalar> b,\n                                                  Vector<T, VectorAbi::Scalar> c)\n{\n    if (std::is_integral<T>::value) {\n        return a * b + c;\n    } else {\n        return std::fma(a.data(), b.data(), c.data());\n    }\n}\n\n// }}}1\n}  // namespace Vc\n\n#endif // VC_SCALAR_MATH_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/operators.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_OPERATORS_H_\n#define VC_SCALAR_OPERATORS_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n// compare operators {{{1\n#define Vc_OP(op_)                                                                       \\\n    template <typename T>                                                                \\\n    Vc_INTRINSIC Scalar::Mask<T> operator op_(Scalar::Vector<T> a, Scalar::Vector<T> b)  \\\n    {                                                                                    \\\n        return Scalar::Mask<T>(a.data() op_ b.data());                                   \\\n    }\nVc_ALL_COMPARES(Vc_OP);\n#undef Vc_OP\n\n// bitwise operators {{{1\n#define Vc_OP(symbol)                                                                    \\\n    template <typename T>                                                                \\\n    Vc_INTRINSIC enable_if<std::is_integral<T>::value, Scalar::Vector<T>>                \\\n    operator symbol(Scalar::Vector<T> a, Scalar::Vector<T> b)                            \\\n    {                                                                                    \\\n        return a.data() symbol b.data();                                                 \\\n    }                                                                                    \\\n    template <typename T>                                                                \\\n    Vc_INTRINSIC enable_if<std::is_floating_point<T>::value, Scalar::Vector<T>>          \\\n    operator symbol(Scalar::Vector<T> &lhs, Scalar::Vector<T> rhs)                       \\\n    {                                                                                    \\\n        using uinta =                                                                    \\\n            MayAlias<typename std::conditional<sizeof(T) == sizeof(int), unsigned int,   \\\n                                               unsigned long long>::type>;               \\\n        uinta *left = reinterpret_cast<uinta *>(&lhs.data());                            \\\n        const uinta *right = reinterpret_cast<const uinta *>(&rhs.data());               \\\n        *left symbol## = *right;                                                         \\\n        return lhs;                                                                      \\\n    }\nVc_ALL_BINARY(Vc_OP);\n#undef Vc_OP\n\n// arithmetic operators {{{1\ntemplate <typename T>\nVc_INTRINSIC Scalar::Vector<T> operator+(Scalar::Vector<T> a, Scalar::Vector<T> b)\n{\n    return a.data() + b.data();\n}\ntemplate <typename T>\nVc_INTRINSIC Scalar::Vector<T> operator-(Scalar::Vector<T> a, Scalar::Vector<T> b)\n{\n    return a.data() - b.data();\n}\ntemplate <typename T>\nVc_INTRINSIC Scalar::Vector<T> operator*(Scalar::Vector<T> a, Scalar::Vector<T> b)\n{\n    return a.data() * b.data();\n}\ntemplate <typename T>\nVc_INTRINSIC Scalar::Vector<T> operator/(Scalar::Vector<T> a, Scalar::Vector<T> b)\n{\n    return a.data() / b.data();\n}\ntemplate <typename T>\nVc_INTRINSIC Scalar::Vector<T> operator%(Scalar::Vector<T> a, Scalar::Vector<T> b)\n{\n    return a.data() % b.data();\n}\n// }}}1\n}  // namespace Detail\n}  // namespace Vc\n\n#endif  // VC_SCALAR_OPERATORS_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/simd_cast.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_SIMD_CAST_H_\n#define VC_SCALAR_SIMD_CAST_H_\n\n#include \"../common/simd_cast.h\"\n#include \"type_traits.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n// Scalar::Vector to Scalar::Vector\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\n    simd_cast(Scalar::Vector<From> x, enable_if<Scalar::is_vector<To>::value> = nullarg)\n{\n    return static_cast<To>(x.data());\n}\n\n// Scalar::Mask to Scalar::Mask\ntemplate <typename To, typename From>\nVc_INTRINSIC Vc_CONST To\n    simd_cast(Scalar::Mask<From> x, enable_if<Scalar::is_mask<To>::value> = nullarg)\n{\n    return static_cast<To>(x.data());\n}\n\n// Any vector (Vector<T> or SimdArray) to multiple Scalar::Vector<T>\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    T &&x,\n    enable_if<Traits::is_simd_vector<T>::value && Scalar::is_vector<Return>::value> = nullarg)\n{\n    return Return(x[offset]);\n}\n\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<offset == 0 && Traits::is_simd_vector<Return>::value &&\n                                    !Scalar::is_vector<Return>::value,\n                                Return>\n    simd_cast(Scalar::Vector<T> x)\n{\n    Return r{};\n    r[0] = static_cast<typename Return::EntryType>(x.data());\n    return r;\n}\n\n\n// Any mask (Mask<T> or SimdMaskArray) to multiple Scalar::Mask<T>\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    T &&x,\n    enable_if<Traits::is_simd_mask<T>::value && Scalar::is_mask<Return>::value> = nullarg)\n{\n    return Return(bool(x[offset]));\n}\n\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST enable_if<\n    offset == 0 && Traits::is_simd_mask<Return>::value && !Scalar::is_mask<Return>::value,\n    Return>\n    simd_cast(Scalar::Mask<T> x)\n{\n    Return r(false);\n    r[0] = x[0];\n    return r;\n}\n\n}  // namespace Vc\n\n#endif  // VC_SCALAR_SIMD_CAST_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/simd_cast_caller.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef Vc_SCALAR_SIMD_CAST_CALLER_TCC_\n#define Vc_SCALAR_SIMD_CAST_CALLER_TCC_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n#if Vc_IS_VERSION_1\ntemplate <typename T>\ntemplate <typename U>\nVc_INTRINSIC Mask<T, VectorAbi::Scalar>::Mask(\n    U &&rhs, Common::enable_if_mask_converts_explicitly<T, U>)\n    : Mask(simd_cast<Mask>(std::forward<U>(rhs)))\n{\n}\n#endif\n}  // namespace Vc\n\n#endif  // Vc_SCALAR_SIMD_CAST_CALLER_TCC_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/type_traits.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_TYPE_TRAITS_H_\n#define VC_SCALAR_TYPE_TRAITS_H_\n\n#include \"types.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Scalar\n{\nnamespace Traits\n{\ntemplate <typename T> struct is_vector : public std::false_type {};\ntemplate <typename T> struct is_vector<Vector<T>> : public std::true_type {};\n\ntemplate <typename T> struct is_mask : public std::false_type {};\ntemplate <typename T> struct is_mask<Mask<T>> : public std::true_type {};\n}  // namespace Traits\n}\n}\n\n#endif  // VC_SCALAR_TYPE_TRAITS_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/types.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"../common/types.h\"\n#include \"../common/vectorabi.h\"\n\n#ifndef VC_SCALAR_TYPES_H_\n#define VC_SCALAR_TYPES_H_\n\n#ifdef Vc_DEFAULT_IMPL_Scalar\n#define Vc_DOUBLE_V_SIZE 1\n#define Vc_FLOAT_V_SIZE 1\n#define Vc_INT_V_SIZE 1\n#define Vc_UINT_V_SIZE 1\n#define Vc_SHORT_V_SIZE 1\n#define Vc_USHORT_V_SIZE 1\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Scalar\n{\ntemplate <typename T> using Vector = Vc::Vector<T, VectorAbi::Scalar>;\ntypedef Vector<double>         double_v;\ntypedef Vector<float>           float_v;\ntypedef Vector<int>               int_v;\ntypedef Vector<unsigned int>     uint_v;\ntypedef Vector<short>           short_v;\ntypedef Vector<unsigned short> ushort_v;\n\ntemplate <typename T> using Mask = Vc::Mask<T, VectorAbi::Scalar>;\ntypedef Mask<double>         double_m;\ntypedef Mask<float>           float_m;\ntypedef Mask<int>               int_m;\ntypedef Mask<unsigned int>     uint_m;\ntypedef Mask<short>           short_m;\ntypedef Mask<unsigned short> ushort_m;\n\ntemplate <typename T> struct is_vector : public std::false_type {};\ntemplate <typename T> struct is_vector<Vector<T>> : public std::true_type {};\ntemplate <typename T> struct is_mask : public std::false_type {};\ntemplate <typename T> struct is_mask<Mask<T>> : public std::true_type {};\n}  // namespace Scalar\n\nnamespace Traits\n{\ntemplate <typename T> struct is_simd_mask_internal<Scalar::Mask<T>>\n  : public std::true_type {};\n\ntemplate <class T> struct\nis_simd_vector_internal<Vector<T, VectorAbi::Scalar>>\n  : public is_valid_vector_argument<T> {};\n}  // namespace Traits\n}  // namespace Vc\n\n#endif // VC_SCALAR_TYPES_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/vector.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SCALAR_VECTOR_H_\n#define VC_SCALAR_VECTOR_H_\n\n#include <assert.h>\n#include <algorithm>\n#include <cmath>\n\n#ifdef _MSC_VER\n#include <float.h>\n#endif\n\n#include \"types.h\"\n#include \"detail.h\"\n#include \"mask.h\"\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n#define Vc_CURRENT_CLASS_NAME Vector\ntemplate <typename T> class Vector<T, VectorAbi::Scalar>\n{\n    static_assert(std::is_arithmetic<T>::value,\n                  \"Vector<T> only accepts arithmetic builtin types as template parameter T.\");\n\n    public:\n        using abi = VectorAbi::Scalar;\n        using EntryType = T;\n        using VectorEntryType = EntryType;\n        using value_type = EntryType;\n        using VectorType = EntryType;\n        using vector_type = VectorType;\n        using reference = Detail::ElementReference<Vector>;\n\n    protected:\n        VectorType m_data = VectorType();\n        template <typename U> using V = Vector<U, abi>;\n\n    public:\n        typedef Scalar::Mask<T> Mask;\n        using MaskType = Mask;\n        using mask_type = Mask;\n        typedef Mask MaskArgument;\n        typedef Vector AsArg;\n\n        Vc_ALWAYS_INLINE VectorType &data() { return m_data; }\n        Vc_ALWAYS_INLINE const VectorType &data() const { return m_data; }\n\n        static constexpr size_t Size = 1;\n        static constexpr size_t MemoryAlignment = alignof(VectorType);\n        using IndexType = fixed_size_simd<int, 1>;\n        using index_type = IndexType;\n\n#include \"../common/generalinterface.h\"\n\n        static Vc_INTRINSIC_L Vector Random() Vc_INTRINSIC_R;\n\n        // implict conversion from compatible Vector<U, abi>\n        template <typename U>\n        Vc_INTRINSIC Vector(\n            V<U> x, typename std::enable_if<Traits::is_implicit_cast_allowed<U, T>::value,\n                                            void *>::type = nullptr)\n            : m_data(static_cast<EntryType>(x.data()))\n        {\n        }\n\n#if Vc_IS_VERSION_1\n        // static_cast from the remaining Vector<U, abi>\n        template <typename U>\n        Vc_DEPRECATED(\"use simd_cast instead of explicit type casting to convert between \"\n                      \"vector types\") Vc_INTRINSIC\n            explicit Vector(\n                V<U> x,\n                typename std::enable_if<!Traits::is_implicit_cast_allowed<U, T>::value,\n                                        void *>::type = nullptr)\n            : m_data(static_cast<EntryType>(x.data()))\n        {\n        }\n#endif\n\n        Vc_INTRINSIC explicit Vector(reference a) : Vector(static_cast<EntryType>(a)) {}\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // broadcast\n        Vc_INTRINSIC Vector(EntryType a) : m_data(a) {}\n        template <typename U>\n        Vc_INTRINSIC Vector(U a,\n                            typename std::enable_if<std::is_same<U, int>::value &&\n                                                        !std::is_same<U, EntryType>::value,\n                                                    void *>::type = nullptr)\n            : Vector(static_cast<EntryType>(a))\n        {\n        }\n\n#include \"../common/loadinterface.h\"\n#include \"../common/storeinterface.h\"\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // zeroing\n        Vc_ALWAYS_INLINE void setZero() { m_data = 0; }\n        Vc_ALWAYS_INLINE void setZero(Mask k) { if (k.data()) m_data = 0; }\n        Vc_ALWAYS_INLINE void setZeroInverted(Mask k) { if (!k.data()) m_data = 0; }\n\n        Vc_INTRINSIC_L void setQnan() Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L void setQnan(Mask m) Vc_INTRINSIC_R;\n\n#include \"../common/gatherinterface.h\"\n#include \"../common/scatterinterface.h\"\n\n        //prefix\n        Vc_ALWAYS_INLINE Vector &operator++() { ++m_data; return *this; }\n        Vc_ALWAYS_INLINE Vector &operator--() { --m_data; return *this; }\n        //postfix\n        Vc_ALWAYS_INLINE Vector operator++(int) { return m_data++; }\n        Vc_ALWAYS_INLINE Vector operator--(int) { return m_data--; }\n\n    private:\n        friend reference;\n        Vc_INTRINSIC static value_type get(const Vector &o, int i) noexcept\n        {\n            Vc_ASSERT(i == 0); if (i) {}\n            return o.m_data;\n        }\n        template <typename U>\n        Vc_INTRINSIC static void set(Vector &o, int i, U &&v) noexcept(\n            noexcept(std::declval<value_type &>() = v))\n        {\n            Vc_ASSERT(i == 0); if (i) {}\n            o.m_data = v;\n        }\n\n    public:\n        /**\n         * \\note the returned object models the concept of a reference and\n         * as such it can exist longer than the data it is referencing.\n         * \\note to avoid lifetime issues, we strongly advice not to store\n         * any reference objects.\n         */\n        Vc_ALWAYS_INLINE reference operator[](size_t index) noexcept\n        {\n            static_assert(noexcept(reference{std::declval<Vector &>(), int()}), \"\");\n            return {*this, int(index)};\n        }\n        Vc_ALWAYS_INLINE value_type operator[](size_t index) const noexcept\n        {\n            Vc_ASSERT(index == 0); if (index) {}\n            return m_data;\n        }\n\n        Vc_ALWAYS_INLINE Mask operator!() const\n        {\n            return Mask(!m_data);\n        }\n        Vc_ALWAYS_INLINE Vector operator~() const\n        {\n#ifndef Vc_ENABLE_FLOAT_BIT_OPERATORS\n            static_assert(std::is_integral<T>::value, \"bit-complement can only be used with Vectors of integral type\");\n#endif\n            return Vector(~m_data);\n        }\n\n        Vc_ALWAYS_INLINE Vector operator-() const\n        {\n            return -m_data;\n        }\n        Vc_INTRINSIC Vector Vc_PURE operator+() const { return *this; }\n\n#define Vc_OP(symbol) \\\n        Vc_ALWAYS_INLINE Vc_PURE Vector operator symbol(const Vector &x) const { return Vector(m_data symbol x.m_data); }\n        Vc_ALL_SHIFTS(Vc_OP);\n#undef Vc_OP\n\n        Vc_DEPRECATED(\"use isnegative(x) instead\") Vc_INTRINSIC Vc_PURE Mask\n            isNegative() const\n        {\n            return Vc::isnegative(*this);\n        }\n\n        Vc_ALWAYS_INLINE void assign(const Vector &v, const Mask &m) {\n          if (m.data()) m_data = v.m_data;\n        }\n\n        template <typename V2>\n        Vc_DEPRECATED(\"Use simd_cast instead of Vector::staticCast\") Vc_ALWAYS_INLINE V2\n            staticCast() const\n        {\n            return V2(static_cast<typename V2::EntryType>(m_data));\n        }\n//        template <typename V2>\n//        Vc_DEPRECATED(\"use reinterpret_components_cast instead\") Vc_ALWAYS_INLINE V2\n//            reinterpretCast() const\n//        {\n//            typedef typename V2::EntryType AliasT2 Vc_MAY_ALIAS;\n//            return V2(*reinterpret_cast<const AliasT2 *>(&m_data));\n//        }\n\n        Vc_ALWAYS_INLINE Common::WriteMaskedVector<Vector, Mask> operator()(Mask m)\n        {\n            return {*this, m};\n        }\n\n        Vc_ALWAYS_INLINE EntryType min() const { return m_data; }\n        Vc_ALWAYS_INLINE EntryType max() const { return m_data; }\n        Vc_ALWAYS_INLINE EntryType product() const { return m_data; }\n        Vc_ALWAYS_INLINE EntryType sum() const { return m_data; }\n        Vc_ALWAYS_INLINE Vector partialSum() const { return *this; }\n        Vc_ALWAYS_INLINE EntryType min(Mask) const { return m_data; }\n        Vc_ALWAYS_INLINE EntryType max(Mask) const { return m_data; }\n        Vc_ALWAYS_INLINE EntryType product(Mask m) const\n        {\n            if (m.data()) {\n                return m_data;\n            } else {\n                return EntryType(1);\n            }\n        }\n        Vc_ALWAYS_INLINE EntryType sum(Mask m) const { if (m.data()) return m_data; return static_cast<EntryType>(0); }\n\n        Vc_INTRINSIC Vector Vc_VDECL shifted(int amount, Vector shiftIn) const {\n            Vc_ASSERT(amount >= -1 && amount <= 1);\n            return amount == 0 ? *this : shiftIn;\n        }\n        Vc_INTRINSIC Vector shifted(int amount) const { return amount == 0 ? *this : Zero(); }\n        Vc_INTRINSIC Vector rotated(int) const { return *this; }\n        Vc_INTRINSIC Vector reversed() const { return *this; }\n        Vc_INTRINSIC Vector sorted() const { return *this; }\n\n        template <typename F> void callWithValuesSorted(F &&f) { f(m_data); }\n\n        template <typename F> Vc_INTRINSIC void call(F &&f) const { f(m_data); }\n\n        template <typename F> Vc_INTRINSIC void call(F &&f, Mask mask) const\n        {\n            if (mask.data()) {\n                f(m_data);\n            }\n        }\n\n        template <typename F> Vc_INTRINSIC Vector apply(F &&f) const { return Vector(f(m_data)); }\n\n        template <typename F> Vc_INTRINSIC Vector apply(F &&f, Mask mask) const\n        {\n            if (mask.data()) {\n                return Vector(f(m_data));\n            } else {\n                return *this;\n            }\n        }\n\n        template<typename IndexT> Vc_INTRINSIC void fill(EntryType (&f)(IndexT)) {\n            m_data = f(0);\n        }\n        Vc_INTRINSIC void fill(EntryType (&f)()) {\n            m_data = f();\n        }\n\n        template <typename G> static Vc_INTRINSIC Vector generate(G gen)\n        {\n            return gen(0);\n        }\n\n        Vc_DEPRECATED(\"use copysign(x, y) instead\") Vc_INTRINSIC Vector Vc_VDECL\n            copySign(Vector x) const\n        {\n            return Vc::copysign(*this, x);\n        }\n\n        Vc_DEPRECATED(\"use exponent(x) instead\") Vc_INTRINSIC Vector exponent() const\n        {\n            return Vc::exponent(*this);\n        }\n\n        Vc_INTRINSIC Vector Vc_VDECL interleaveLow(Vector) const { return *this; }\n        Vc_INTRINSIC Vector Vc_VDECL interleaveHigh(Vector x) const { return x; }\n};\n#undef Vc_CURRENT_CLASS_NAME\ntemplate <typename T> constexpr size_t Vector<T, VectorAbi::Scalar>::Size;\ntemplate <typename T> constexpr size_t Vector<T, VectorAbi::Scalar>::MemoryAlignment;\n\n#define Vc_OP(symbol)                                                                    \\\n    template <typename T, typename U,                                                    \\\n              typename = decltype(std::declval<T &>() symbol## = std::declval<T>())>     \\\n    Vc_INTRINSIC enable_if<std::is_convertible<U, Vector<T, VectorAbi::Scalar>>::value,  \\\n                           Vector<T, VectorAbi::Scalar>>                                 \\\n        &operator symbol##=(Vector<T, VectorAbi::Scalar> &lhs, U &&rhs)                  \\\n    {                                                                                    \\\n        lhs.data() symbol## = Vector<T, VectorAbi::Scalar>(std::forward<U>(rhs)).data(); \\\n        return lhs;                                                                      \\\n    }\nVc_ALL_SHIFTS(Vc_OP);\n#undef Vc_OP\n\n#define Vc_CONDITIONAL_ASSIGN(name_, op_)                                                \\\n    template <Operator O, typename T, typename M, typename U>                            \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, void> conditional_assign(               \\\n        Vector<T, VectorAbi::Scalar> &lhs, M &&mask, U &&rhs)                            \\\n    {                                                                                    \\\n        if (mask.isFull()) {                                                             \\\n            lhs op_ std::forward<U>(rhs);                                                \\\n        }                                                                                \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(          Assign,  =);\nVc_CONDITIONAL_ASSIGN(      PlusAssign, +=);\nVc_CONDITIONAL_ASSIGN(     MinusAssign, -=);\nVc_CONDITIONAL_ASSIGN(  MultiplyAssign, *=);\nVc_CONDITIONAL_ASSIGN(    DivideAssign, /=);\nVc_CONDITIONAL_ASSIGN( RemainderAssign, %=);\nVc_CONDITIONAL_ASSIGN(       XorAssign, ^=);\nVc_CONDITIONAL_ASSIGN(       AndAssign, &=);\nVc_CONDITIONAL_ASSIGN(        OrAssign, |=);\nVc_CONDITIONAL_ASSIGN( LeftShiftAssign,<<=);\nVc_CONDITIONAL_ASSIGN(RightShiftAssign,>>=);\n#undef Vc_CONDITIONAL_ASSIGN\n\n#define Vc_CONDITIONAL_ASSIGN(name_, expr_)                                              \\\n    template <Operator O, typename T, typename M>                                        \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, Vector<T, VectorAbi::Scalar>>           \\\n    conditional_assign(Vector<T, VectorAbi::Scalar> &lhs, M &&mask)                      \\\n    {                                                                                    \\\n        return mask.isFull() ? (expr_) : lhs;                                            \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(PostIncrement, lhs++);\nVc_CONDITIONAL_ASSIGN( PreIncrement, ++lhs);\nVc_CONDITIONAL_ASSIGN(PostDecrement, lhs--);\nVc_CONDITIONAL_ASSIGN( PreDecrement, --lhs);\n#undef Vc_CONDITIONAL_ASSIGN\n\n}  // namespace Vc\n\n#include \"vector.tcc\"\n#include \"simd_cast.h\"\n\n#endif // VC_SCALAR_VECTOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/scalar/vector.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include <cmath>\n#include \"../common/data.h\"\n#include \"../common/where.h\"\n#include \"../common/transpose.h\"\n#include \"operators.h\"\n#include \"macros.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n// special value constructors{{{1\ntemplate <typename T>\nVc_INTRINSIC Vector<T, VectorAbi::Scalar>::Vector(VectorSpecialInitializerZero)\n    : m_data(0)\n{\n}\ntemplate <typename T>\nVc_INTRINSIC Vector<T, VectorAbi::Scalar>::Vector(VectorSpecialInitializerOne)\n    : m_data(1)\n{\n}\ntemplate <typename T>\nVc_INTRINSIC Vector<T, VectorAbi::Scalar>::Vector(VectorSpecialInitializerIndexesFromZero)\n    : m_data(0)\n{\n}\n\n// load member functions{{{1\ntemplate <typename T>\ntemplate <typename U, typename Flags>\nVc_INTRINSIC typename Vector<T, VectorAbi::Scalar>::\n#ifndef Vc_MSVC\ntemplate\n#endif\nload_concept<U, Flags>::type Vector<T, VectorAbi::Scalar>::load(const U *mem, Flags)\n{\n    m_data = mem[0];\n}\n\n// store member functions{{{1\ntemplate <typename T>\ntemplate <typename U, typename Flags, typename>\nVc_INTRINSIC void Vector<T, VectorAbi::Scalar>::store(U *mem, Flags) const\n{\n    mem[0] = m_data;\n}\ntemplate <typename T>\ntemplate <typename U, typename Flags, typename>\nVc_INTRINSIC void Vector<T, VectorAbi::Scalar>::store(U *mem, Mask mask, Flags) const\n{\n    if (mask.data())\n        mem[0] = m_data;\n}\n\n// gather {{{1\ntemplate <typename T>\ntemplate <class MT, class IT, int Scale>\nVc_ALWAYS_INLINE void Vector<T, VectorAbi::Scalar>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args)\n{\n    m_data = args.address[Scale * args.indexes[0]];\n}\n\ntemplate <typename T>\ntemplate <class MT, class IT, int Scale>\nVc_ALWAYS_INLINE void Vector<T, VectorAbi::Scalar>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args, MaskArgument mask)\n{\n    if (mask.data()) {\n        m_data = args.address[Scale * args.indexes[0]];\n    }\n}\n\n// scatter {{{1\ntemplate <typename T>\ntemplate <typename MT, typename IT>\nVc_ALWAYS_INLINE void Vector<T, VectorAbi::Scalar>::scatterImplementation(MT *mem,\n                                                                          IT &&indexes)\n    const\n{\n    mem[indexes[0]] = m_data;\n}\n\ntemplate <typename T>\ntemplate <typename MT, typename IT>\nVc_ALWAYS_INLINE void Vector<T, VectorAbi::Scalar>::scatterImplementation(\n    MT *mem, IT &&indexes, MaskArgument mask) const\n{\n    if (mask.data()) {\n        mem[indexes[0]] = m_data;\n    }\n}\n\n// exponent {{{1\nVc_INTRINSIC Vc_CONST Scalar::float_v exponent(Scalar::float_v x)\n{\n    Vc_ASSERT(x.data() >= 0.f);\n    union { float f; int i; } value;\n    value.f = x.data();\n    return Scalar::float_v(static_cast<float>((value.i >> 23) - 0x7f));\n}\nVc_INTRINSIC Vc_CONST Scalar::double_v Vc_VDECL exponent(Scalar::double_v x)\n{\n    Vc_ASSERT(x.data() >= 0.);\n    union { double f; long long i; } value;\n    value.f = x.data();\n    return Scalar::double_v(static_cast<double>((value.i >> 52) - 0x3ff));\n}\n\n// Random {{{1\nstatic Vc_ALWAYS_INLINE void _doRandomStep(Scalar::uint_v &state0, Scalar::uint_v &state1)\n{\n    using Scalar::uint_v;\n    state0.load(&Common::RandomState[0]);\n    state1.load(&Common::RandomState[uint_v::Size]);\n    Detail::operator+(Detail::operator*(state1, uint_v(0xdeece66du)),\n                      uint_v(11))\n        .store(&Common::RandomState[uint_v::Size]);\n    uint_v(Detail::operator+(Detail::operator*(state0, uint_v(0xdeece66du)), uint_v(11))\n               .data() ^\n           (state1.data() >> 16))\n        .store(&Common::RandomState[0]);\n}\n\ntemplate<typename T> Vc_INTRINSIC Vector<T, VectorAbi::Scalar> Vector<T, VectorAbi::Scalar>::Random()\n{\n    Scalar::uint_v state0, state1;\n    _doRandomStep(state0, state1);\n    return Vector<T, VectorAbi::Scalar>(static_cast<EntryType>(state0.data()));\n}\ntemplate<> Vc_INTRINSIC Scalar::float_v Scalar::float_v::Random()\n{\n    Scalar::uint_v state0, state1;\n    _doRandomStep(state0, state1);\n    union { unsigned int i; float f; } x;\n    x.i = (state0.data() & 0x0fffffffu) | 0x3f800000u;\n    return Scalar::float_v(x.f - 1.f);\n}\ntemplate<> Vc_INTRINSIC Scalar::double_v Scalar::double_v::Random()\n{\n    typedef unsigned long long uint64 Vc_MAY_ALIAS;\n    uint64 state0 = *reinterpret_cast<const uint64 *>(&Common::RandomState[8]);\n    state0 = (state0 * 0x5deece66dull + 11) & 0x000fffffffffffffull;\n    *reinterpret_cast<uint64 *>(&Common::RandomState[8]) = state0;\n    union { unsigned long long i; double f; } x;\n    x.i = state0 | 0x3ff0000000000000ull;\n    return Scalar::double_v(x.f - 1.);\n}\n// isnegative {{{1\nVc_INTRINSIC Vc_CONST Scalar::float_m isnegative(Scalar::float_v x)\n{\n    static_assert(sizeof(float) == sizeof(unsigned int),\n                  \"This code assumes float and unsigned int have the same number of \"\n                  \"Bytes. Please file a bug report if this is a problem.\");\n    union { float f; unsigned int i; } u;\n    u.f = x.data();\n    return Scalar::float_m(0u != (u.i & 0x80000000u));\n}\nVc_INTRINSIC Vc_CONST Scalar::double_m Vc_VDECL isnegative(Scalar::double_v x)\n{\n    static_assert(sizeof(double) == sizeof(unsigned long long),\n                  \"This code assumes double and unsigned long long have the same number \"\n                  \"of Bytes. Please file a bug report if this is a problem.\");\n    union { double d; unsigned long long l; } u;\n    u.d = x.data();\n    return Scalar::double_m(0ull != (u.l & 0x8000000000000000ull));\n}\n\n// setQnan {{{1\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Scalar>::setQnan()\n{\n    union { float f; unsigned int i; } u;\n    u.i = 0xffffffffu;\n    m_data = u.f;\n}\ntemplate<> Vc_INTRINSIC void Scalar::double_v::setQnan()\n{\n    union { double d; unsigned long long l; } u;\n    u.l = 0xffffffffffffffffull;\n    m_data = u.d;\n}\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Scalar>::setQnan(Mask m)\n{\n    if (m.data()) {\n        setQnan();\n    }\n}\ntemplate<> Vc_INTRINSIC void Scalar::double_v::setQnan(Scalar::double_v::Mask m)\n{\n    if (m.data()) {\n        setQnan();\n    }\n}\n// }}}1\n\nnamespace Common\n{\n// transpose_impl {{{1\nVc_ALWAYS_INLINE void transpose_impl(TransposeTag<1, 1>, Scalar::float_v *Vc_RESTRICT r[],\n                                     const TransposeProxy<Scalar::float_v> &proxy)\n{\n    *r[0] = std::get<0>(proxy.in).data();\n}\n// }}}1\n}  // namespace Common\n}\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/simdize",
    "content": "#include \"vector.h\"\n#include \"Allocator\"\n#include \"common/simdize.h\"\n\n// vim: ft=cpp\n"
  },
  {
    "path": "3rdparty/Vc/Vc/span",
    "content": "#include \"common/span.h\"\n\n// vim: ft=cpp\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/casts.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_CASTS_H_\n#define VC_SSE_CASTS_H_\n\n#include \"intrinsics.h\"\n#include \"types.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\nusing uint = unsigned int;\nusing ushort = unsigned short;\nusing uchar = unsigned char;\nusing schar = signed char;\n\n// sse_cast {{{1\ntemplate <typename To, typename From> Vc_ALWAYS_INLINE Vc_CONST To sse_cast(From v)\n{\n    return v;\n}\ntemplate<> Vc_ALWAYS_INLINE Vc_CONST __m128i sse_cast<__m128i, __m128 >(__m128  v) { return _mm_castps_si128(v); }\ntemplate<> Vc_ALWAYS_INLINE Vc_CONST __m128i sse_cast<__m128i, __m128d>(__m128d v) { return _mm_castpd_si128(v); }\ntemplate<> Vc_ALWAYS_INLINE Vc_CONST __m128  sse_cast<__m128 , __m128d>(__m128d v) { return _mm_castpd_ps(v);    }\ntemplate<> Vc_ALWAYS_INLINE Vc_CONST __m128  sse_cast<__m128 , __m128i>(__m128i v) { return _mm_castsi128_ps(v); }\ntemplate<> Vc_ALWAYS_INLINE Vc_CONST __m128d sse_cast<__m128d, __m128i>(__m128i v) { return _mm_castsi128_pd(v); }\ntemplate<> Vc_ALWAYS_INLINE Vc_CONST __m128d sse_cast<__m128d, __m128 >(__m128  v) { return _mm_castps_pd(v);    }\n\n// convert {{{1\ntemplate <typename From, typename To> struct ConvertTag\n{\n};\ntemplate <typename From, typename To>\nVc_INTRINSIC typename VectorTraits<To>::VectorType convert(\n    typename VectorTraits<From>::VectorType v)\n{\n    return convert(v, ConvertTag<From, To>());\n}\n\nVc_INTRINSIC __m128i convert(__m128  v, ConvertTag<float , int   >) { return _mm_cvttps_epi32(v); }\nVc_INTRINSIC __m128i convert(__m128d v, ConvertTag<double, int   >) { return _mm_cvttpd_epi32(v); }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<int   , int   >) { return v; }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<uint  , int   >) { return v; }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<short , int   >) {\n#ifdef Vc_IMPL_SSE4_1\n    return _mm_cvtepi16_epi32(v);\n#else\n    return _mm_srai_epi32(_mm_unpacklo_epi16(v, v), 16);\n#endif\n}\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<ushort, int   >) {\n#ifdef Vc_IMPL_SSE4_1\n    return _mm_cvtepu16_epi32(v);\n#else\n    return _mm_srli_epi32(_mm_unpacklo_epi16(v, v), 16);\n#endif\n}\nVc_INTRINSIC __m128i convert(__m128  v, ConvertTag<float , uint  >) {\n    return _mm_castps_si128(\n        blendv_ps(_mm_castsi128_ps(_mm_cvttps_epi32(v)),\n                  _mm_castsi128_ps(_mm_xor_si128(\n                      _mm_cvttps_epi32(_mm_sub_ps(v, _mm_set1_ps(1u << 31))),\n                      _mm_set1_epi32(1 << 31))),\n                  _mm_cmpge_ps(v, _mm_set1_ps(1u << 31))));\n}\nVc_INTRINSIC __m128i convert(__m128d v, ConvertTag<double, uint  >) {\n#ifdef Vc_IMPL_SSE4_1\n    return _mm_xor_si128(_mm_cvttpd_epi32(_mm_sub_pd(_mm_floor_pd(v), _mm_set1_pd(0x80000000u))),\n                         _mm_cvtsi64_si128(0x8000000080000000ull));\n#else\n    return blendv_epi8(_mm_cvttpd_epi32(v),\n                       _mm_xor_si128(_mm_cvttpd_epi32(_mm_sub_pd(v, _mm_set1_pd(0x80000000u))),\n                                     _mm_cvtsi64_si128(0x8000000080000000ull)),\n                       _mm_castpd_si128(_mm_cmpge_pd(v, _mm_set1_pd(0x80000000u))));\n#endif\n}\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<int   , uint  >) { return v; }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<uint  , uint  >) { return v; }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<short , uint  >) { return convert(v, ConvertTag<short, int>()); }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<ushort, uint  >) { return convert(v, ConvertTag<ushort, int>()); }\nVc_INTRINSIC __m128  convert(__m128  v, ConvertTag<float , float >) { return v; }\nVc_INTRINSIC __m128  convert(__m128d v, ConvertTag<double, float >) { return _mm_cvtpd_ps(v); }\nVc_INTRINSIC __m128  convert(__m128i v, ConvertTag<int   , float >) { return _mm_cvtepi32_ps(v); }\nVc_INTRINSIC __m128  convert(__m128i v, ConvertTag<uint  , float >) {\n    // see AVX::convert<uint, float> for an explanation of the math behind the\n    // implementation\n    using namespace SSE;\n    return blendv_ps(_mm_cvtepi32_ps(v),\n        _mm_add_ps(_mm_cvtepi32_ps(_mm_and_si128(v, _mm_set1_epi32(0x7ffffe00))),\n                      _mm_add_ps(_mm_set1_ps(1u << 31), _mm_cvtepi32_ps(_mm_and_si128(\n                                                          v, _mm_set1_epi32(0x000001ff))))),\n        _mm_castsi128_ps(_mm_cmplt_epi32(v, _mm_setzero_si128())));\n}\nVc_INTRINSIC __m128  convert(__m128i v, ConvertTag<short , float >) { return convert(convert(v, ConvertTag<short, int>()), ConvertTag<int, float>()); }\nVc_INTRINSIC __m128  convert(__m128i v, ConvertTag<ushort, float >) { return convert(convert(v, ConvertTag<ushort, int>()), ConvertTag<int, float>()); }\nVc_INTRINSIC __m128d convert(__m128  v, ConvertTag<float , double>) { return _mm_cvtps_pd(v); }\nVc_INTRINSIC __m128d convert(__m128d v, ConvertTag<double, double>) { return v; }\nVc_INTRINSIC __m128d convert(__m128i v, ConvertTag<int   , double>) { return _mm_cvtepi32_pd(v); }\nVc_INTRINSIC __m128d convert(__m128i v, ConvertTag<uint  , double>) { return _mm_add_pd(_mm_cvtepi32_pd(_mm_xor_si128(v, setmin_epi32())), _mm_set1_pd(1u << 31)); }\nVc_INTRINSIC __m128d convert(__m128i v, ConvertTag<short , double>) { return convert(convert(v, ConvertTag<short, int>()), ConvertTag<int, double>()); }\nVc_INTRINSIC __m128d convert(__m128i v, ConvertTag<ushort, double>) { return convert(convert(v, ConvertTag<ushort, int>()), ConvertTag<int, double>()); }\nVc_INTRINSIC __m128i convert(__m128  v, ConvertTag<float , short >) { return _mm_packs_epi32(_mm_cvttps_epi32(v), _mm_setzero_si128()); }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<int   , short >) { return _mm_packs_epi32(v, _mm_setzero_si128()); }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<uint  , short >) { return _mm_packs_epi32(v, _mm_setzero_si128()); }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<short , short >) { return v; }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<ushort, short >) { return v; }\nVc_INTRINSIC __m128i convert(__m128d v, ConvertTag<double, short >) { return convert(convert(v, ConvertTag<double, int>()), ConvertTag<int, short>()); }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<int   , ushort>) {\n    auto tmp0 = _mm_unpacklo_epi16(v, _mm_setzero_si128());  // 0 4 X X 1 5 X X\n    auto tmp1 = _mm_unpackhi_epi16(v, _mm_setzero_si128());  // 2 6 X X 3 7 X X\n    auto tmp2 = _mm_unpacklo_epi16(tmp0, tmp1);              // 0 2 4 6 X X X X\n    auto tmp3 = _mm_unpackhi_epi16(tmp0, tmp1);              // 1 3 5 7 X X X X\n    return _mm_unpacklo_epi16(tmp2, tmp3);                   // 0 1 2 3 4 5 6 7\n}\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<uint  , ushort>) {\n    auto tmp0 = _mm_unpacklo_epi16(v, _mm_setzero_si128());  // 0 4 X X 1 5 X X\n    auto tmp1 = _mm_unpackhi_epi16(v, _mm_setzero_si128());  // 2 6 X X 3 7 X X\n    auto tmp2 = _mm_unpacklo_epi16(tmp0, tmp1);              // 0 2 4 6 X X X X\n    auto tmp3 = _mm_unpackhi_epi16(tmp0, tmp1);              // 1 3 5 7 X X X X\n    return _mm_unpacklo_epi16(tmp2, tmp3);                   // 0 1 2 3 4 5 6 7\n}\nVc_INTRINSIC __m128i convert(__m128  v, ConvertTag<float , ushort>) { return convert(_mm_cvttps_epi32(v), ConvertTag<int, ushort>()); }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<short , ushort>) { return v; }\nVc_INTRINSIC __m128i convert(__m128i v, ConvertTag<ushort, ushort>) { return v; }\nVc_INTRINSIC __m128i convert(__m128d v, ConvertTag<double, ushort>) { return convert(convert(v, ConvertTag<double, int>()), ConvertTag<int, ushort>()); }\n\n// }}}1\n}  // namespace SSE\n}  // namespace Vc\n\n#endif // VC_SSE_CASTS_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/const.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_CONST_H_\n#define VC_SSE_CONST_H_\n\n#include \"const_data.h\"\n#include \"vector.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\n    template<typename T> struct Const\n    {\n        typedef Vector<T> V;\n        typedef Mask<T> M;\n        enum Constants { Stride = 16 / sizeof(T) };\n\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4()        { return load(&c_trig<T>::data[0 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_hi()     { return load(&c_trig<T>::data[1 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_rem1()   { return load(&c_trig<T>::data[2 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_4_rem2()   { return load(&c_trig<T>::data[3 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _1_16()        { return load(&c_trig<T>::data[4 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _16()          { return load(&c_trig<T>::data[5 * Stride]); }\n\n        static Vc_ALWAYS_INLINE Vc_CONST V atanP(int i)    { return load(&c_trig<T>::data[(12 + i) * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V atanQ(int i)    { return load(&c_trig<T>::data[(17 + i) * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V atanThrsHi()    { return load(&c_trig<T>::data[22 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V atanThrsLo()    { return load(&c_trig<T>::data[23 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_2_rem()     { return load(&c_trig<T>::data[24 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V lossThreshold() { return load(&c_trig<T>::data[8 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _4_pi()         { return load(&c_trig<T>::data[9 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi_2()         { return load(&c_trig<T>::data[10 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _pi()           { return load(&c_trig<T>::data[11 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff0(int i) { return load(&c_trig<T>::data[(28 + i) * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff1(int i) { return load(&c_trig<T>::data[(33 + i) * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff2(int i) { return load(&c_trig<T>::data[(37 + i) * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V asinCoeff3(int i) { return load(&c_trig<T>::data[(43 + i) * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V smallAsinInput()  { return load(&c_trig<T>::data[25 * Stride]); }\n        static Vc_ALWAYS_INLINE Vc_CONST V largeAsinInput()  { return load(&c_trig<T>::data[26 * Stride]); }\n\n        static Vc_ALWAYS_INLINE Vc_CONST M exponentMask() { return M(load(c_log<T>::d(1)).data()); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _1_2()         { return load(c_log<T>::d(18)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V _1_sqrt2()     { return load(c_log<T>::d(15)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V P(int i)       { return load(c_log<T>::d(2 + i)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V Q(int i)       { return load(c_log<T>::d(8 + i)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V min()          { return load(c_log<T>::d(14)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V ln2_small()    { return load(c_log<T>::d(17)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V ln2_large()    { return load(c_log<T>::d(16)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V neginf()       { return load(c_log<T>::d(13)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V log10_e()      { return load(c_log<T>::d(19)); }\n        static Vc_ALWAYS_INLINE Vc_CONST V log2_e()       { return load(c_log<T>::d(20)); }\n\n        static Vc_ALWAYS_INLINE_L Vc_CONST_L V highMask()         Vc_ALWAYS_INLINE_R Vc_CONST_R;\n        static Vc_ALWAYS_INLINE_L Vc_CONST_L V highMask(int bits) Vc_ALWAYS_INLINE_R Vc_CONST_R;\n    private:\n        static Vc_ALWAYS_INLINE_L Vc_CONST_L V load(const T *mem) Vc_ALWAYS_INLINE_R Vc_CONST_R;\n    };\n    template<typename T> Vc_ALWAYS_INLINE Vc_CONST Vector<T> Const<T>::load(const T *mem) { return V(mem); }\n\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<float> Const<float>::highMask()\n    {\n        return Vector<float>(reinterpret_cast<const float *>(&c_general::highMaskFloat));\n    }\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<double> Const<double>::highMask()\n    {\n        return Vector<double>(\n            reinterpret_cast<const double *>(&c_general::highMaskDouble));\n    }\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<float> Const<float>::highMask(int bits)\n    {\n        return _mm_castsi128_ps(_mm_slli_epi32(_mm_setallone_si128(), bits));\n    }\n    template <> Vc_ALWAYS_INLINE Vc_CONST Vector<double> Const<double>::highMask(int bits)\n    {\n        return _mm_castsi128_pd(_mm_slli_epi64(_mm_setallone_si128(), bits));\n    }\n}  // namespace SSE\n}  // namespace Vc\n\n#endif // VC_SSE_CONST_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/const_data.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_CONST_DATA_H_\n#define VC_SSE_CONST_DATA_H_\n\n#include \"../common/data.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\n\nalignas(16) extern const unsigned int   _IndexesFromZero4[4];\nalignas(16) extern const unsigned short _IndexesFromZero8[8];\nalignas(16) extern const unsigned char  _IndexesFromZero16[16];\n\nstruct c_general\n{\n    alignas(64) static const int absMaskFloat[4];\n    alignas(16) static const unsigned int signMaskFloat[4];\n    alignas(16) static const unsigned int highMaskFloat[4];\n    alignas(16) static const short minShort[8];\n\n    alignas(16) static const unsigned short one16[8];\n    alignas(16) static const unsigned int one32[4];\n    alignas(16) static const float oneFloat[4];\n\n    alignas(16) static const unsigned long long highMaskDouble[2];\n    alignas(16) static const double oneDouble[2];\n    alignas(16) static const long long absMaskDouble[2];\n    alignas(16) static const unsigned long long signMaskDouble[2];\n    alignas(16) static const unsigned long long frexpMask[2];\n};\n\ntemplate<typename T> struct c_trig\n{\n    alignas(64) static const T data[];\n};\n#ifndef Vc_MSVC\ntemplate <> alignas(64) const float c_trig<float>::data[];\ntemplate <> alignas(64) const double c_trig<double>::data[];\n#endif\n\ntemplate<typename T> struct c_log\n{\n    enum VectorSize { Size = 16 / sizeof(T) };\n    static Vc_ALWAYS_INLINE Vc_CONST const float *d(int i) { return reinterpret_cast<const  float *>(&data[i * Size]); }\n    alignas(64) static const unsigned int data[21 * Size];\n};\n#ifndef Vc_MSVC\ntemplate<> alignas(64) const unsigned int c_log<float>::data[21 * 4];\n#endif\n\ntemplate<> struct c_log<double>\n{\n    enum VectorSize { Size = 16 / sizeof(double) };\n    static Vc_ALWAYS_INLINE Vc_CONST const double *d(int i) { return reinterpret_cast<const double *>(&data[i * Size]); }\n    alignas(64) static const unsigned long long data[21 * Size];\n};\n\n}  // namespace SSE\n}  // namespace Vc\n\n#endif // VC_SSE_CONST_DATA_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/debug.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_DEBUG_H_\n#define VC_SSE_DEBUG_H_\n\n#ifndef NDEBUG\n#include \"types.h\"\n#include <iostream>\n#include <iomanip>\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\n\n#ifdef NDEBUG\nclass DebugStream\n{\n    public:\n        DebugStream(const char *, const char *, int) {}\n        template<typename T> inline DebugStream &operator<<(const T &) { return *this; }\n};\n#else\nclass DebugStream\n{\n    private:\n        static char hexChar(char x) { return x + (x > 9 ? 87 : 48); }\n        template<typename T, typename V> static void printVector(V _x)\n        {\n            std::cerr << \"0x\";\n            const auto bytes = reinterpret_cast<const std::uint8_t *>(&_x);\n            for (std::size_t i = 0; i < sizeof(V); ++i) {\n                std::cerr << hexChar(bytes[i] >> 4) << hexChar(bytes[i] & 0xf);\n                if (i % 4 == 3) {\n                    std::cerr << '\\'';\n                }\n            }\n\n            enum { Size = sizeof(V) / sizeof(T) };\n            union { V v; T m[Size]; } x = { _x };\n            std::cerr << \" = [\" << std::setprecision(24) << x.m[0];\n            for (int i = 1; i < Size; ++i) {\n                std::cerr << \", \" << std::setprecision(24) << x.m[i];\n            }\n            std::cerr << ']';\n        }\n    public:\n        DebugStream(const char *func, const char *file, int line)\n        {\n            std::cerr << \"\\033[1;40;33mDEBUG: \" << file << ':' << line << ' ' << func << ' ';\n        }\n\n        template<typename T> DebugStream &operator<<(const T &x) { std::cerr << x; return *this; }\n\n        DebugStream &operator<<(__m128 x) {\n            printVector<float, __m128>(x);\n            return *this;\n        }\n        DebugStream &operator<<(__m128d x) {\n            printVector<double, __m128d>(x);\n            return *this;\n        }\n        DebugStream &operator<<(__m128i x) {\n            printVector<int, __m128i>(x);\n            return *this;\n        }\n\n        ~DebugStream()\n        {\n            std::cerr << \"\\033[0m\" << std::endl;\n        }\n};\n#endif\n\n#define Vc_DEBUG Vc::SSE::DebugStream(__PRETTY_FUNCTION__, __FILE__, __LINE__)\n\n}  // namespace SSE\n}  // namespace Vc\n\n#endif // VC_SSE_DEBUG_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/deinterleave.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\n\ninline void deinterleave(Vector<float> &a, Vector<float> &b)\n{\n    const __m128 tmp0 = _mm_unpacklo_ps(a.data(), b.data());\n    const __m128 tmp1 = _mm_unpackhi_ps(a.data(), b.data());\n    a.data() = _mm_unpacklo_ps(tmp0, tmp1);\n    b.data() = _mm_unpackhi_ps(tmp0, tmp1);\n}\n\ninline void deinterleave(Vector<float> &a, Vector<float> &b, Vector<short>::AsArg tmp)\n{\n    a.data() = _mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(tmp.data(), 16), 16));\n    b.data() = _mm_cvtepi32_ps(_mm_srai_epi32(tmp.data(), 16));\n}\n\ninline void deinterleave(Vector<float> &a, Vector<float> &b, Vector<unsigned short>::AsArg tmp)\n{\n    a.data() = _mm_cvtepi32_ps(_mm_srli_epi32(_mm_slli_epi32(tmp.data(), 16), 16));\n    b.data() = _mm_cvtepi32_ps(_mm_srli_epi32(tmp.data(), 16));\n}\n\ninline void deinterleave(Vector<double> &a, Vector<double> &b)\n{\n    __m128d tmp = _mm_unpacklo_pd(a.data(), b.data());\n    b.data() = _mm_unpackhi_pd(a.data(), b.data());\n    a.data() = tmp;\n}\n\ninline void deinterleave(Vector<int> &a, Vector<int> &b)\n{\n    const __m128i tmp0 = _mm_unpacklo_epi32(a.data(), b.data());\n    const __m128i tmp1 = _mm_unpackhi_epi32(a.data(), b.data());\n    a.data() = _mm_unpacklo_epi32(tmp0, tmp1);\n    b.data() = _mm_unpackhi_epi32(tmp0, tmp1);\n}\n\ninline void deinterleave(Vector<unsigned int> &a, Vector<unsigned int> &b)\n{\n    const __m128i tmp0 = _mm_unpacklo_epi32(a.data(), b.data());\n    const __m128i tmp1 = _mm_unpackhi_epi32(a.data(), b.data());\n    a.data() = _mm_unpacklo_epi32(tmp0, tmp1);\n    b.data() = _mm_unpackhi_epi32(tmp0, tmp1);\n}\n\ninline void deinterleave(Vector<short> &a, Vector<short> &b)\n{\n    __m128i tmp0 = _mm_unpacklo_epi16(a.data(), b.data()); // a0 a4 b0 b4 a1 a5 b1 b5\n    __m128i tmp1 = _mm_unpackhi_epi16(a.data(), b.data()); // a2 a6 b2 b6 a3 a7 b3 b7\n    __m128i tmp2 = _mm_unpacklo_epi16(tmp0, tmp1); // a0 a2 a4 a6 b0 b2 b4 b6\n    __m128i tmp3 = _mm_unpackhi_epi16(tmp0, tmp1); // a1 a3 a5 a7 b1 b3 b5 b7\n    a.data() = _mm_unpacklo_epi16(tmp2, tmp3);\n    b.data() = _mm_unpackhi_epi16(tmp2, tmp3);\n}\n\ninline void deinterleave(Vector<unsigned short> &a, Vector<unsigned short> &b)\n{\n    __m128i tmp0 = _mm_unpacklo_epi16(a.data(), b.data()); // a0 a4 b0 b4 a1 a5 b1 b5\n    __m128i tmp1 = _mm_unpackhi_epi16(a.data(), b.data()); // a2 a6 b2 b6 a3 a7 b3 b7\n    __m128i tmp2 = _mm_unpacklo_epi16(tmp0, tmp1); // a0 a2 a4 a6 b0 b2 b4 b6\n    __m128i tmp3 = _mm_unpackhi_epi16(tmp0, tmp1); // a1 a3 a5 a7 b1 b3 b5 b7\n    a.data() = _mm_unpacklo_epi16(tmp2, tmp3);\n    b.data() = _mm_unpackhi_epi16(tmp2, tmp3);\n}\n\ninline void deinterleave(Vector<int> &a, Vector<int> &b, Vector<short>::AsArg tmp)\n{\n    a.data() = _mm_srai_epi32(_mm_slli_epi32(tmp.data(), 16), 16);\n    b.data() = _mm_srai_epi32(tmp.data(), 16);\n}\n\ninline void deinterleave(Vector<unsigned int> &a, Vector<unsigned int> &b, Vector<unsigned short>::AsArg tmp)\n{\n    a.data() = _mm_srli_epi32(_mm_slli_epi32(tmp.data(), 16), 16);\n    b.data() = _mm_srli_epi32(tmp.data(), 16);\n}\n\n}\n}\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate<typename A> inline void deinterleave(\n        SSE::float_v &a, SSE::float_v &b, const float *m, A align)\n{\n    a.load(m, align);\n    b.load(m + SSE::float_v::Size, align);\n    Vc::SSE::deinterleave(a, b);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::float_v &a, SSE::float_v &b, const short *m, A align)\n{\n    SSE::short_v tmp(m, align);\n    Vc::SSE::deinterleave(a, b, tmp);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::float_v &a, SSE::float_v &b, const unsigned short *m, A align)\n{\n    SSE::ushort_v tmp(m, align);\n    Vc::SSE::deinterleave(a, b, tmp);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::double_v &a, SSE::double_v &b, const double *m, A align)\n{\n    a.load(m, align);\n    b.load(m + SSE::double_v::Size, align);\n    Vc::SSE::deinterleave(a, b);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::int_v &a, SSE::int_v &b, const int *m, A align)\n{\n    a.load(m, align);\n    b.load(m + SSE::int_v::Size, align);\n    Vc::SSE::deinterleave(a, b);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::int_v &a, SSE::int_v &b, const short *m, A align)\n{\n    SSE::short_v tmp(m, align);\n    Vc::SSE::deinterleave(a, b, tmp);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::uint_v &a, SSE::uint_v &b, const unsigned int *m, A align)\n{\n    a.load(m, align);\n    b.load(m + SSE::uint_v::Size, align);\n    Vc::SSE::deinterleave(a, b);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::uint_v &a, SSE::uint_v &b, const unsigned short *m, A align)\n{\n    SSE::ushort_v tmp(m, align);\n    Vc::SSE::deinterleave(a, b, tmp);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::short_v &a, SSE::short_v &b, const short *m, A align)\n{\n    a.load(m, align);\n    b.load(m + SSE::short_v::Size, align);\n    Vc::SSE::deinterleave(a, b);\n}\n\ntemplate<typename A> inline void deinterleave(\n        SSE::ushort_v &a, SSE::ushort_v &b, const unsigned short *m, A align)\n{\n    a.load(m, align);\n    b.load(m + SSE::ushort_v::Size, align);\n    Vc::SSE::deinterleave(a, b);\n}\n}  // namespace Detail\n}  // namespace Vc\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/detail.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_DETAIL_H_\n#define VC_SSE_DETAIL_H_\n\n#include \"casts.h\"\n#ifdef Vc_IMPL_AVX\n#include \"../avx/intrinsics.h\"\n#endif\n#include \"vectorhelper.h\"\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n// (converting) load functions {{{1\ntemplate <typename V, typename DstT> struct LoadTag\n{\n};\n\n// when_(un)aligned{{{2\nclass when_aligned\n{\npublic:\n    template <typename F> constexpr when_aligned(F, typename F::EnableIfAligned = nullptr)\n    {\n    }\n};\n\nclass when_unaligned\n{\npublic:\n    template <typename F>\n    constexpr when_unaligned(F, typename F::EnableIfUnaligned = nullptr)\n    {\n    }\n};\n\nclass when_streaming\n{\npublic:\n    template <typename F>\n    constexpr when_streaming(F, typename F::EnableIfStreaming = nullptr)\n    {\n    }\n};\n\n// load16{{{2\nVc_INTRINSIC __m128 load16(const float *mem, when_aligned)\n{\n    return _mm_load_ps(mem);\n}\nVc_INTRINSIC __m128 load16(const float *mem, when_unaligned)\n{\n    return _mm_loadu_ps(mem);\n}\nVc_INTRINSIC __m128 load16(const float *mem, when_streaming)\n{\n    return SseIntrinsics::_mm_stream_load(mem);\n}\nVc_INTRINSIC __m128d load16(const double *mem, when_aligned)\n{\n    return _mm_load_pd(mem);\n}\nVc_INTRINSIC __m128d load16(const double *mem, when_unaligned)\n{\n    return _mm_loadu_pd(mem);\n}\nVc_INTRINSIC __m128d load16(const double *mem, when_streaming)\n{\n    return SseIntrinsics::_mm_stream_load(mem);\n}\ntemplate <class T> Vc_INTRINSIC __m128i load16(const T *mem, when_aligned)\n{\n    static_assert(std::is_integral<T>::value, \"load16<T> is only intended for integral T\");\n    return _mm_load_si128(reinterpret_cast<const __m128i *>(mem));\n}\ntemplate <class T> Vc_INTRINSIC __m128i load16(const T *mem, when_unaligned)\n{\n    static_assert(std::is_integral<T>::value, \"load16<T> is only intended for integral T\");\n    return _mm_loadu_si128(reinterpret_cast<const __m128i *>(mem));\n}\ntemplate <class T> Vc_INTRINSIC __m128i load16(const T *mem, when_streaming)\n{\n    static_assert(std::is_integral<T>::value, \"load16<T> is only intended for integral T\");\n    return SseIntrinsics::_mm_stream_load(mem);\n}\n\n// MSVC workarounds{{{2\n#ifdef Vc_MSVC\n// work around: \"fatal error C1001: An internal error has occurred in the compiler.\"\ntemplate <typename V, typename DstT, typename F>\nVc_INTRINSIC __m128d load(const double *mem, F f,\n                          enable_if<(std::is_same<DstT, double>::value &&\n                                     std::is_same<V, __m128d>::value)> = nullarg)\n{\n    return load16(mem, f);\n}\n\ntemplate <typename V, typename DstT, typename F>\nVc_INTRINSIC __m128 load(const float *mem, F f,\n                         enable_if<(std::is_same<DstT, float>::value &&\n                                    std::is_same<V, __m128>::value)> = nullarg)\n{\n    return load16(mem, f);\n}\n\ntemplate <typename V, typename DstT, typename F>\nVc_INTRINSIC __m128i load(const uint *mem, F f,\n                          enable_if<(std::is_same<DstT, uint>::value &&\n                                     std::is_same<V, __m128i>::value)> = nullarg)\n{\n    return load16(mem, f);\n}\n\ntemplate <typename V, typename DstT, typename F>\nVc_INTRINSIC __m128i load(const int *mem, F f,\n                          enable_if<(std::is_same<DstT, int>::value &&\n                                     std::is_same<V, __m128i>::value)> = nullarg)\n{\n    return load16(mem, f);\n}\n\ntemplate <typename V, typename DstT, typename F>\nVc_INTRINSIC __m128i load(const short *mem, F f,\n                          enable_if<(std::is_same<DstT, short>::value &&\n                                     std::is_same<V, __m128i>::value)> = nullarg)\n{\n    return load16(mem, f);\n}\n\ntemplate <typename V, typename DstT, typename F>\nVc_INTRINSIC __m128i load(const ushort *mem, F f,\n                          enable_if<(std::is_same<DstT, ushort>::value &&\n                                     std::is_same<V, __m128i>::value)> = nullarg)\n{\n    return load16(mem, f);\n}\n#endif  // Vc_MSVC\n\n// generic load{{{2\ntemplate <typename V, typename DstT, typename SrcT, typename Flags,\n          typename = enable_if<\n#ifdef Vc_MSVC\n              !std::is_same<DstT, SrcT>::value &&\n#endif\n              (!std::is_integral<DstT>::value || !std::is_integral<SrcT>::value ||\n               sizeof(DstT) >= sizeof(SrcT))>>\nVc_INTRINSIC V load(const SrcT *mem, Flags flags)\n{\n    return load(mem, flags, LoadTag<V, DstT>());\n}\n\n// no conversion load from any T {{{2\ntemplate <typename V, typename T, typename Flags>\nVc_INTRINSIC V\n    load(const T *mem, Flags, LoadTag<V, T>, enable_if<sizeof(V) == 16> = nullarg)\n{\n    return SSE::VectorHelper<V>::template load<Flags>(mem);\n}\n\n// short {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const ushort *mem, Flags, LoadTag<__m128i, short>)\n{\n    return SSE::VectorHelper<__m128i>::load<Flags>(mem);\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const uchar *mem, Flags, LoadTag<__m128i, short>)\n{\n    // the only available streaming load loads 16 bytes - twice as much as we need =>\n    // can't use it, or we risk an out-of-bounds read and an unaligned load exception\n    return SSE::cvtepu8_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const schar *mem, Flags, LoadTag<__m128i, short>)\n{\n    // the only available streaming load loads 16 bytes - twice as much as we need =>\n    // can't use it, or we risk an out-of-bounds read and an unaligned load exception\n    return SSE::cvtepi8_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\n\n// ushort {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const uchar *mem, Flags, LoadTag<__m128i, ushort>)\n{\n    // the only available streaming load loads 16 bytes - twice as much as we need =>\n    // can't use it, or we risk an out-of-bounds read and an unaligned load exception\n    return SSE::cvtepu8_epi16(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\n\n// int {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const uint *mem, Flags, LoadTag<__m128i, int>)\n{\n    return SSE::VectorHelper<__m128i>::load<Flags>(mem);\n}\n// no difference between streaming and alignment, because the\n// 32/64 bit loads are not available as streaming loads, and can always be unaligned\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const ushort *mem, Flags, LoadTag<__m128i, int>)\n{\n    return SSE::cvtepu16_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const short *mem, Flags, LoadTag<__m128i, int>)\n{\n    return SSE::cvtepi16_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const uchar *mem, Flags, LoadTag<__m128i, int>)\n{\n    return SSE::cvtepu8_epi32(_mm_cvtsi32_si128(*aliasing_cast<int>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const schar *mem, Flags, LoadTag<__m128i, int>)\n{\n    return SSE::cvtepi8_epi32(_mm_cvtsi32_si128(*aliasing_cast<int>(mem)));\n}\n\n// uint {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const ushort *mem, Flags, LoadTag<__m128i, uint>)\n{\n    return SSE::cvtepu16_epi32(_mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128i load(const uchar *mem, Flags, LoadTag<__m128i, uint>)\n{\n    return SSE::cvtepu8_epi32(_mm_cvtsi32_si128(*aliasing_cast<int>(mem)));\n}\n\n// double {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m128d load(const float *mem, Flags, LoadTag<__m128d, double>)\n{\n    return SSE::convert<float, double>(\n        _mm_loadl_pi(_mm_setzero_ps(), reinterpret_cast<const __m64 *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128d load(const uint *mem, Flags, LoadTag<__m128d, double>)\n{\n    return SSE::convert<uint, double>(\n        _mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128d load(const int *mem, Flags, LoadTag<__m128d, double>)\n{\n    return SSE::convert<int, double>(\n        _mm_loadl_epi64(reinterpret_cast<const __m128i *>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128d load(const ushort *mem, Flags, LoadTag<__m128d, double>)\n{\n    return SSE::convert<ushort, double>(\n        _mm_cvtsi32_si128(*aliasing_cast<int>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128d load(const short *mem, Flags, LoadTag<__m128d, double>)\n{\n    return SSE::convert<short, double>(\n        _mm_cvtsi32_si128(*aliasing_cast<int>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128d load(const uchar *mem, Flags, LoadTag<__m128d, double>)\n{\n    return SSE::convert<uchar, double>(\n        _mm_set1_epi16(*aliasing_cast<short>(mem)));\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128d load(const schar *mem, Flags, LoadTag<__m128d, double>)\n{\n    return SSE::convert<char, double>(\n        _mm_set1_epi16(*aliasing_cast<short>(mem)));\n}\n\n// float {{{2\ntemplate <typename Flags>\nVc_INTRINSIC __m128 load(const double *mem, Flags, LoadTag<__m128, float>)\n{\n#ifdef Vc_IMPL_AVX\n    if (Flags::IsUnaligned) {\n        return _mm256_cvtpd_ps(_mm256_loadu_pd(mem));\n    } else if (Flags::IsStreaming) {\n        return _mm256_cvtpd_ps(AvxIntrinsics::stream_load<__m256d>(mem));\n    } else {  // Flags::IsAligned\n        return _mm256_cvtpd_ps(_mm256_load_pd(mem));\n    }\n#else\n    return _mm_movelh_ps(_mm_cvtpd_ps(SSE::VectorHelper<__m128d>::load<Flags>(&mem[0])),\n                         _mm_cvtpd_ps(SSE::VectorHelper<__m128d>::load<Flags>(&mem[2])));\n#endif\n}\ntemplate <typename Flags>\nVc_INTRINSIC __m128 load(const uint *mem, Flags f, LoadTag<__m128, float>)\n{\n    return SSE::convert<uint, float>(load<__m128i, uint>(mem, f));\n}\ntemplate <typename T, typename Flags,\n          typename = enable_if<!std::is_same<T, float>::value>>\nVc_INTRINSIC __m128 load(const T *mem, Flags f, LoadTag<__m128, float>)\n{\n    return _mm_cvtepi32_ps(load<__m128i, int>(mem, f));\n}\n\n// shifted{{{1\ntemplate <int amount, typename T>\nVc_INTRINSIC Vc_CONST enable_if<amount == 0, T> shifted(T k)\n{\n    return k;\n}\ntemplate <int amount, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(sizeof(T) == 16 && amount > 0), T> shifted(T k)\n{\n    return _mm_srli_si128(k, amount);\n}\ntemplate <int amount, typename T>\nVc_INTRINSIC Vc_CONST enable_if<(sizeof(T) == 16 && amount < 0), T> shifted(T k)\n{\n    return _mm_slli_si128(k, -amount);\n}\n\n// IndexesFromZero{{{1\ntemplate <typename T, int Size> Vc_INTRINSIC Vc_CONST const T *IndexesFromZero()\n{\n    if (Size == 4) {\n        return reinterpret_cast<const T *>(SSE::_IndexesFromZero4);\n    } else if (Size == 8) {\n        return reinterpret_cast<const T *>(SSE::_IndexesFromZero8);\n    } else if (Size == 16) {\n        return reinterpret_cast<const T *>(SSE::_IndexesFromZero16);\n    }\n    return 0;\n}\n\n// popcnt{{{1\nVc_INTRINSIC Vc_CONST unsigned int popcnt4(unsigned int n)\n{\n#ifdef Vc_IMPL_POPCNT\n    return _mm_popcnt_u32(n);\n#else\n    n = (n & 0x5U) + ((n >> 1) & 0x5U);\n    n = (n & 0x3U) + ((n >> 2) & 0x3U);\n    return n;\n#endif\n}\nVc_INTRINSIC Vc_CONST unsigned int popcnt8(unsigned int n)\n{\n#ifdef Vc_IMPL_POPCNT\n    return _mm_popcnt_u32(n);\n#else\n    n = (n & 0x55U) + ((n >> 1) & 0x55U);\n    n = (n & 0x33U) + ((n >> 2) & 0x33U);\n    n = (n & 0x0fU) + ((n >> 4) & 0x0fU);\n    return n;\n#endif\n}\nVc_INTRINSIC Vc_CONST unsigned int popcnt16(unsigned int n)\n{\n#ifdef Vc_IMPL_POPCNT\n    return _mm_popcnt_u32(n);\n#else\n    n = (n & 0x5555U) + ((n >> 1) & 0x5555U);\n    n = (n & 0x3333U) + ((n >> 2) & 0x3333U);\n    n = (n & 0x0f0fU) + ((n >> 4) & 0x0f0fU);\n    n = (n & 0x00ffU) + ((n >> 8) & 0x00ffU);\n    return n;\n#endif\n}\nVc_INTRINSIC Vc_CONST unsigned int popcnt32(unsigned int n)\n{\n#ifdef Vc_IMPL_POPCNT\n    return _mm_popcnt_u32(n);\n#else\n    n = (n & 0x55555555U) + ((n >> 1) & 0x55555555U);\n    n = (n & 0x33333333U) + ((n >> 2) & 0x33333333U);\n    n = (n & 0x0f0f0f0fU) + ((n >> 4) & 0x0f0f0f0fU);\n    n = (n & 0x00ff00ffU) + ((n >> 8) & 0x00ff00ffU);\n    n = (n & 0x0000ffffU) + ((n >>16) & 0x0000ffffU);\n    return n;\n#endif\n}\n\n// mask_cast{{{1\ntemplate<size_t From, size_t To, typename R> Vc_INTRINSIC Vc_CONST R mask_cast(__m128i k)\n{\n    static_assert(From == To, \"Incorrect mask cast.\");\n    static_assert(std::is_same<R, __m128>::value, \"Incorrect mask cast.\");\n    return SSE::sse_cast<__m128>(k);\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<2, 4, __m128>(__m128i k)\n{\n    return SSE::sse_cast<__m128>(_mm_packs_epi16(k, _mm_setzero_si128()));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<2, 8, __m128>(__m128i k)\n{\n    return SSE::sse_cast<__m128>(\n        _mm_packs_epi16(_mm_packs_epi16(k, _mm_setzero_si128()), _mm_setzero_si128()));\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<4, 2, __m128>(__m128i k)\n{\n    return SSE::sse_cast<__m128>(_mm_unpacklo_epi32(k, k));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<4, 8, __m128>(__m128i k)\n{\n    return SSE::sse_cast<__m128>(_mm_packs_epi16(k, _mm_setzero_si128()));\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<8, 2, __m128>(__m128i k)\n{\n    const auto tmp = _mm_unpacklo_epi16(k, k);\n    return SSE::sse_cast<__m128>(_mm_unpacklo_epi32(tmp, tmp));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<8, 4, __m128>(__m128i k)\n{\n    return SSE::sse_cast<__m128>(_mm_unpacklo_epi16(k, k));\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<16, 8, __m128>(__m128i k)\n{\n    return SSE::sse_cast<__m128>(_mm_unpacklo_epi8(k, k));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<16, 4, __m128>(__m128i k)\n{\n    const auto tmp = SSE::sse_cast<__m128i>(mask_cast<16, 8, __m128>(k));\n    return SSE::sse_cast<__m128>(_mm_unpacklo_epi16(tmp, tmp));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST __m128 mask_cast<16, 2, __m128>(__m128i k)\n{\n    const auto tmp = SSE::sse_cast<__m128i>(mask_cast<16, 4, __m128>(k));\n    return SSE::sse_cast<__m128>(_mm_unpacklo_epi32(tmp, tmp));\n}\n\n// allone{{{1\ntemplate <typename V> Vc_INTRINSIC_L Vc_CONST_L V allone() Vc_INTRINSIC_R Vc_CONST_R;\ntemplate<> Vc_INTRINSIC Vc_CONST __m128  allone<__m128 >() { return SSE::_mm_setallone_ps(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m128i allone<__m128i>() { return SSE::_mm_setallone_si128(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m128d allone<__m128d>() { return SSE::_mm_setallone_pd(); }\n\n// zero{{{1\ntemplate <typename V> inline V zero();\ntemplate<> Vc_INTRINSIC Vc_CONST __m128  zero<__m128 >() { return _mm_setzero_ps(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m128i zero<__m128i>() { return _mm_setzero_si128(); }\ntemplate<> Vc_INTRINSIC Vc_CONST __m128d zero<__m128d>() { return _mm_setzero_pd(); }\n\n// negate{{{1\nVc_ALWAYS_INLINE Vc_CONST __m128 negate(__m128 v, std::integral_constant<std::size_t, 4>)\n{\n    return _mm_xor_ps(v, SSE::_mm_setsignmask_ps());\n}\nVc_ALWAYS_INLINE Vc_CONST __m128d negate(__m128d v, std::integral_constant<std::size_t, 8>)\n{\n    return _mm_xor_pd(v, SSE::_mm_setsignmask_pd());\n}\nVc_ALWAYS_INLINE Vc_CONST __m128i negate(__m128i v, std::integral_constant<std::size_t, 4>)\n{\n#ifdef Vc_IMPL_SSSE3\n    return _mm_sign_epi32(v, allone<__m128i>());\n#else\n    return _mm_sub_epi32(_mm_setzero_si128(), v);\n#endif\n}\nVc_ALWAYS_INLINE Vc_CONST __m128i negate(__m128i v, std::integral_constant<std::size_t, 2>)\n{\n#ifdef Vc_IMPL_SSSE3\n    return _mm_sign_epi16(v, allone<__m128i>());\n#else\n    return _mm_sub_epi16(_mm_setzero_si128(), v);\n#endif\n}\n\n// xor_{{{1\nVc_INTRINSIC __m128 xor_(__m128 a, __m128 b) { return _mm_xor_ps(a, b); }\nVc_INTRINSIC __m128d xor_(__m128d a, __m128d b) { return _mm_xor_pd(a, b); }\nVc_INTRINSIC __m128i xor_(__m128i a, __m128i b) { return _mm_xor_si128(a, b); }\n\n// or_{{{1\nVc_INTRINSIC __m128 or_(__m128 a, __m128 b) { return _mm_or_ps(a, b); }\nVc_INTRINSIC __m128d or_(__m128d a, __m128d b) { return _mm_or_pd(a, b); }\nVc_INTRINSIC __m128i or_(__m128i a, __m128i b) { return _mm_or_si128(a, b); }\n\n// and_{{{1\nVc_INTRINSIC __m128 and_(__m128 a, __m128 b) { return _mm_and_ps(a, b); }\nVc_INTRINSIC __m128d and_(__m128d a, __m128d b) { return _mm_and_pd(a, b); }\nVc_INTRINSIC __m128i and_(__m128i a, __m128i b) { return _mm_and_si128(a, b); }\n\n// andnot_{{{1\nVc_INTRINSIC __m128 andnot_(__m128 a, __m128 b) { return _mm_andnot_ps(a, b); }\nVc_INTRINSIC __m128d andnot_(__m128d a, __m128d b) { return _mm_andnot_pd(a, b); }\nVc_INTRINSIC __m128i andnot_(__m128i a, __m128i b) { return _mm_andnot_si128(a, b); }\n\n// not_{{{1\nVc_INTRINSIC __m128  not_(__m128  a) { return andnot_(a, allone<__m128 >()); }\nVc_INTRINSIC __m128d not_(__m128d a) { return andnot_(a, allone<__m128d>()); }\nVc_INTRINSIC __m128i not_(__m128i a) { return andnot_(a, allone<__m128i>()); }\n\n// add{{{1\nVc_INTRINSIC __m128  add(__m128  a, __m128  b,  float) { return _mm_add_ps(a, b); }\nVc_INTRINSIC __m128d add(__m128d a, __m128d b, double) { return _mm_add_pd(a, b); }\nVc_INTRINSIC __m128i add(__m128i a, __m128i b,    int) { return _mm_add_epi32(a, b); }\nVc_INTRINSIC __m128i add(__m128i a, __m128i b,   uint) { return _mm_add_epi32(a, b); }\nVc_INTRINSIC __m128i add(__m128i a, __m128i b,  short) { return _mm_add_epi16(a, b); }\nVc_INTRINSIC __m128i add(__m128i a, __m128i b, ushort) { return _mm_add_epi16(a, b); }\nVc_INTRINSIC __m128i add(__m128i a, __m128i b,  schar) { return _mm_add_epi8 (a, b); }\nVc_INTRINSIC __m128i add(__m128i a, __m128i b,  uchar) { return _mm_add_epi8 (a, b); }\n\n// sub{{{1\nVc_INTRINSIC __m128  sub(__m128  a, __m128  b,  float) { return _mm_sub_ps(a, b); }\nVc_INTRINSIC __m128d sub(__m128d a, __m128d b, double) { return _mm_sub_pd(a, b); }\nVc_INTRINSIC __m128i sub(__m128i a, __m128i b,    int) { return _mm_sub_epi32(a, b); }\nVc_INTRINSIC __m128i sub(__m128i a, __m128i b,   uint) { return _mm_sub_epi32(a, b); }\nVc_INTRINSIC __m128i sub(__m128i a, __m128i b,  short) { return _mm_sub_epi16(a, b); }\nVc_INTRINSIC __m128i sub(__m128i a, __m128i b, ushort) { return _mm_sub_epi16(a, b); }\nVc_INTRINSIC __m128i sub(__m128i a, __m128i b,  schar) { return _mm_sub_epi8 (a, b); }\nVc_INTRINSIC __m128i sub(__m128i a, __m128i b,  uchar) { return _mm_sub_epi8 (a, b); }\n\n// mul{{{1\nVc_INTRINSIC __m128  mul(__m128  a, __m128  b,  float) { return _mm_mul_ps(a, b); }\nVc_INTRINSIC __m128d mul(__m128d a, __m128d b, double) { return _mm_mul_pd(a, b); }\nVc_INTRINSIC __m128i mul(__m128i a, __m128i b,    int) {\n#ifdef Vc_IMPL_SSE4_1\n    return _mm_mullo_epi32(a, b);\n#else\n    const __m128i aShift = _mm_srli_si128(a, 4);\n    const __m128i ab02 = _mm_mul_epu32(a, b);  // [a0 * b0, a2 * b2]\n    const __m128i bShift = _mm_srli_si128(b, 4);\n    const __m128i ab13 = _mm_mul_epu32(aShift, bShift);  // [a1 * b1, a3 * b3]\n    return _mm_unpacklo_epi32(_mm_shuffle_epi32(ab02, 8), _mm_shuffle_epi32(ab13, 8));\n#endif\n}\nVc_INTRINSIC __m128i mul(__m128i a, __m128i b,   uint) { return mul(a, b, int()); }\nVc_INTRINSIC __m128i mul(__m128i a, __m128i b,  short) { return _mm_mullo_epi16(a, b); }\nVc_INTRINSIC __m128i mul(__m128i a, __m128i b, ushort) { return _mm_mullo_epi16(a, b); }\nVc_INTRINSIC __m128i mul(__m128i a, __m128i b,  schar) {\n#ifdef Vc_USE_BUILTIN_VECTOR_TYPES\n    using B = Common::BuiltinType<schar, 16>;\n    const auto x = aliasing_cast<B>(a) * aliasing_cast<B>(b);\n    return reinterpret_cast<const __m128i &>(x);\n#else\n    return or_(\n        and_(_mm_mullo_epi16(a, b), _mm_slli_epi16(allone<__m128i>(), 8)),\n        _mm_slli_epi16(_mm_mullo_epi16(_mm_srli_si128(a, 1), _mm_srli_si128(b, 1)), 8));\n#endif\n}\nVc_INTRINSIC __m128i mul(__m128i a, __m128i b,  uchar) {\n#ifdef Vc_USE_BUILTIN_VECTOR_TYPES\n    using B = Common::BuiltinType<uchar, 16>;\n    const auto x = aliasing_cast<B>(a) * aliasing_cast<B>(b);\n    return reinterpret_cast<const __m128i &>(x);\n#else\n    return or_(\n        and_(_mm_mullo_epi16(a, b), _mm_slli_epi16(allone<__m128i>(), 8)),\n        _mm_slli_epi16(_mm_mullo_epi16(_mm_srli_si128(a, 1), _mm_srli_si128(b, 1)), 8));\n#endif\n}\n\n// div{{{1\nVc_INTRINSIC __m128  div(__m128  a, __m128  b,  float) { return _mm_div_ps(a, b); }\nVc_INTRINSIC __m128d div(__m128d a, __m128d b, double) { return _mm_div_pd(a, b); }\n\n// TODO: fma{{{1\n//Vc_INTRINSIC __m128  fma(__m128  a, __m128  b, __m128  c,  float) { return _mm_mul_ps(a, b); }\n//Vc_INTRINSIC __m128d fma(__m128d a, __m128d b, __m128d c, double) { return _mm_mul_pd(a, b); }\n//Vc_INTRINSIC __m128i fma(__m128i a, __m128i b, __m128i c,    int) { }\n//Vc_INTRINSIC __m128i fma(__m128i a, __m128i b, __m128i c,   uint) { return fma(a, b, int()); }\n//Vc_INTRINSIC __m128i fma(__m128i a, __m128i b, __m128i c,  short) { return _mm_mullo_epi16(a, b); }\n//Vc_INTRINSIC __m128i fma(__m128i a, __m128i b, __m128i c, ushort) { return _mm_mullo_epi16(a, b); }\n//Vc_INTRINSIC __m128i fma(__m128i a, __m128i b, __m128i c,  schar) { }\n//Vc_INTRINSIC __m128i fma(__m128i a, __m128i b, __m128i c,  uchar) { }\n\n// min{{{1\nVc_INTRINSIC __m128  min(__m128  a, __m128  b,  float) { return _mm_min_ps(a, b); }\nVc_INTRINSIC __m128d min(__m128d a, __m128d b, double) { return _mm_min_pd(a, b); }\nVc_INTRINSIC __m128i min(__m128i a, __m128i b,    int) { return SSE::min_epi32(a, b); }\nVc_INTRINSIC __m128i min(__m128i a, __m128i b,   uint) { return SSE::min_epu32(a, b); }\nVc_INTRINSIC __m128i min(__m128i a, __m128i b,  short) { return _mm_min_epi16(a, b); }\nVc_INTRINSIC __m128i min(__m128i a, __m128i b, ushort) { return SSE::min_epu16(a, b); }\nVc_INTRINSIC __m128i min(__m128i a, __m128i b,  schar) { return SSE::min_epi8 (a, b); }\nVc_INTRINSIC __m128i min(__m128i a, __m128i b,  uchar) { return _mm_min_epu8 (a, b); }\n\n// max{{{1\nVc_INTRINSIC __m128  max(__m128  a, __m128  b,  float) { return _mm_max_ps(a, b); }\nVc_INTRINSIC __m128d max(__m128d a, __m128d b, double) { return _mm_max_pd(a, b); }\nVc_INTRINSIC __m128i max(__m128i a, __m128i b,    int) { return SSE::max_epi32(a, b); }\nVc_INTRINSIC __m128i max(__m128i a, __m128i b,   uint) { return SSE::max_epu32(a, b); }\nVc_INTRINSIC __m128i max(__m128i a, __m128i b,  short) { return _mm_max_epi16(a, b); }\nVc_INTRINSIC __m128i max(__m128i a, __m128i b, ushort) { return SSE::max_epu16(a, b); }\nVc_INTRINSIC __m128i max(__m128i a, __m128i b,  schar) { return SSE::max_epi8 (a, b); }\nVc_INTRINSIC __m128i max(__m128i a, __m128i b,  uchar) { return _mm_max_epu8 (a, b); }\n\n// horizontal add{{{1\nVc_INTRINSIC  float add(__m128  a,  float) {\n    a = _mm_add_ps(a, _mm_movehl_ps(a, a));\n    a = _mm_add_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)));\n    return _mm_cvtss_f32(a);\n}\nVc_INTRINSIC double add(__m128d a, double) {\n    a = _mm_add_sd(a, _mm_unpackhi_pd(a, a));\n    return _mm_cvtsd_f64(a);\n}\nVc_INTRINSIC    int add(__m128i a,    int) {\n    a = add(a, _mm_srli_si128(a, 8), int());\n    a = add(a, _mm_srli_si128(a, 4), int());\n    return _mm_cvtsi128_si32(a);\n}\nVc_INTRINSIC   uint add(__m128i a,   uint) { return add(a, int()); }\nVc_INTRINSIC  short add(__m128i a,  short) {\n    a = add(a, _mm_srli_si128(a, 8), short());\n    a = add(a, _mm_srli_si128(a, 4), short());\n    a = add(a, _mm_srli_si128(a, 2), short());\n    return _mm_cvtsi128_si32(a);  // & 0xffff is implicit\n}\nVc_INTRINSIC ushort add(__m128i a, ushort) { return add(a, short()); }\nVc_INTRINSIC  schar add(__m128i a,  schar) {\n    a = add(a, _mm_srli_si128(a, 8), schar());\n    a = add(a, _mm_srli_si128(a, 4), schar());\n    a = add(a, _mm_srli_si128(a, 2), schar());\n    a = add(a, _mm_srli_si128(a, 1), schar());\n    return _mm_cvtsi128_si32(a);  // & 0xff is implicit\n}\nVc_INTRINSIC  uchar add(__m128i a,  uchar) { return add(a, schar()); }\n\n// horizontal mul{{{1\nVc_INTRINSIC  float mul(__m128  a,  float) {\n    a = _mm_mul_ps(a, _mm_movehl_ps(a, a));\n    a = _mm_mul_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)));\n    return _mm_cvtss_f32(a);\n}\nVc_INTRINSIC double mul(__m128d a, double) {\n    a = _mm_mul_sd(a, _mm_unpackhi_pd(a, a));\n    return _mm_cvtsd_f64(a);\n}\nVc_INTRINSIC    int mul(__m128i a,    int) {\n    a = mul(a, _mm_srli_si128(a, 8), int());\n    a = mul(a, _mm_srli_si128(a, 4), int());\n    return _mm_cvtsi128_si32(a);\n}\nVc_INTRINSIC   uint mul(__m128i a,   uint) { return mul(a, int()); }\nVc_INTRINSIC  short mul(__m128i a,  short) {\n    a = mul(a, _mm_srli_si128(a, 8), short());\n    a = mul(a, _mm_srli_si128(a, 4), short());\n    a = mul(a, _mm_srli_si128(a, 2), short());\n    return _mm_cvtsi128_si32(a);  // & 0xffff is implicit\n}\nVc_INTRINSIC ushort mul(__m128i a, ushort) { return mul(a, short()); }\nVc_INTRINSIC  schar mul(__m128i a,  schar) {\n    // convert to two short vectors, multiply them and then do horizontal reduction\n    const __m128i s0 = _mm_srai_epi16(a, 1);\n    const __m128i s1 = Detail::and_(a, _mm_set1_epi32(0x0f0f0f0f));\n    return mul(mul(s0, s1, short()), short());\n}\nVc_INTRINSIC  uchar mul(__m128i a,  uchar) { return mul(a, schar()); }\n\n// horizontal min{{{1\nVc_INTRINSIC  float min(__m128  a,  float) {\n    a = _mm_min_ps(a, _mm_movehl_ps(a, a));\n    a = _mm_min_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)));\n    return _mm_cvtss_f32(a);\n}\nVc_INTRINSIC double min(__m128d a, double) {\n    a = _mm_min_sd(a, _mm_unpackhi_pd(a, a));\n    return _mm_cvtsd_f64(a);\n}\nVc_INTRINSIC    int min(__m128i a,    int) {\n    a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), int());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), int());\n    return _mm_cvtsi128_si32(a);\n}\nVc_INTRINSIC   uint min(__m128i a,   uint) {\n    a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), uint());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), uint());\n    return _mm_cvtsi128_si32(a);\n}\nVc_INTRINSIC  short min(__m128i a,  short) {\n    a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), short());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), short());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), short());\n    return _mm_cvtsi128_si32(a);  // & 0xffff is implicit\n}\nVc_INTRINSIC ushort min(__m128i a, ushort) {\n    a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), ushort());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), ushort());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), ushort());\n    return _mm_cvtsi128_si32(a);  // & 0xffff is implicit\n}\nVc_INTRINSIC  schar min(__m128i a,  schar) {\n    a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), schar());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), schar());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), schar());\n    return std::min(schar(_mm_cvtsi128_si32(a) >> 8), schar(_mm_cvtsi128_si32(a)));\n}\nVc_INTRINSIC  uchar min(__m128i a,  uchar) {\n    a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), uchar());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), uchar());\n    a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), uchar());\n    return std::min((_mm_cvtsi128_si32(a) >> 8) & 0xff, _mm_cvtsi128_si32(a) & 0xff);\n}\n\n// horizontal max{{{1\nVc_INTRINSIC  float max(__m128  a,  float) {\n    a = _mm_max_ps(a, _mm_movehl_ps(a, a));\n    a = _mm_max_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1)));\n    return _mm_cvtss_f32(a);\n}\nVc_INTRINSIC double max(__m128d a, double) {\n    a = _mm_max_sd(a, _mm_unpackhi_pd(a, a));\n    return _mm_cvtsd_f64(a);\n}\nVc_INTRINSIC    int max(__m128i a,    int) {\n    a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), int());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), int());\n    return _mm_cvtsi128_si32(a);\n}\nVc_INTRINSIC   uint max(__m128i a,   uint) {\n    a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), uint());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), uint());\n    return _mm_cvtsi128_si32(a);\n}\nVc_INTRINSIC  short max(__m128i a,  short) {\n    a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), short());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), short());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), short());\n    return _mm_cvtsi128_si32(a);  // & 0xffff is implicit\n}\nVc_INTRINSIC ushort max(__m128i a, ushort) {\n    a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), ushort());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), ushort());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), ushort());\n    return _mm_cvtsi128_si32(a);  // & 0xffff is implicit\n}\nVc_INTRINSIC  schar max(__m128i a,  schar) {\n    a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), schar());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), schar());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), schar());\n    return std::max(schar(_mm_cvtsi128_si32(a) >> 8), schar(_mm_cvtsi128_si32(a)));\n}\nVc_INTRINSIC  uchar max(__m128i a,  uchar) {\n    a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)), uchar());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)), uchar());\n    a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)), uchar());\n    return std::max((_mm_cvtsi128_si32(a) >> 8) & 0xff, _mm_cvtsi128_si32(a) & 0xff);\n}\n\n// sorted{{{1\ntemplate <Vc::Implementation, typename T>\nVc_CONST_L SSE::Vector<T> Vc_VDECL sorted(SSE::Vector<T> x) Vc_CONST_R;\ntemplate <typename T> Vc_INTRINSIC Vc_CONST SSE::Vector<T> sorted(SSE::Vector<T> x)\n{\n    static_assert(!CurrentImplementation::is(ScalarImpl),\n                  \"Detail::sorted can only be instantiated if a non-Scalar \"\n                  \"implementation is selected.\");\n    return sorted < CurrentImplementation::is_between(SSE2Impl, SSSE3Impl)\n               ? SSE2Impl\n               : CurrentImplementation::is_between(SSE41Impl, SSE42Impl)\n                     ? SSE41Impl\n                     : CurrentImplementation::current() > (x);\n}\n\n// sanitize{{{1\ntemplate <typename V> constexpr int sanitize(int n)\n{\n    return (n >= int(sizeof(V)) || n <= -int(sizeof(V))) ? 0 : n;\n}\n\n// rotated{{{1\ntemplate <typename T, size_t N, typename V>\nstatic Vc_INTRINSIC Vc_CONST enable_if<(sizeof(V) == 16), V> rotated(V v, int amount)\n{\n    using namespace SSE;\n    switch (static_cast<unsigned int>(amount) % N) {\n    case 0:\n        return v;\n    case 1:\n        return sse_cast<V>(_mm_alignr_epi8(v, v, sanitize<V>(1 * sizeof(T))));\n    case 2:\n        return sse_cast<V>(_mm_alignr_epi8(v, v, sanitize<V>(2 * sizeof(T))));\n    case 3:\n        return sse_cast<V>(_mm_alignr_epi8(v, v, sanitize<V>(3 * sizeof(T))));\n    case 4:\n        return sse_cast<V>(_mm_alignr_epi8(v, v, sanitize<V>(4 * sizeof(T))));\n    case 5:\n        return sse_cast<V>(_mm_alignr_epi8(v, v, sanitize<V>(5 * sizeof(T))));\n    case 6:\n        return sse_cast<V>(_mm_alignr_epi8(v, v, sanitize<V>(6 * sizeof(T))));\n    case 7:\n        return sse_cast<V>(_mm_alignr_epi8(v, v, sanitize<V>(7 * sizeof(T))));\n    }\n    return sse_cast<V>(_mm_setzero_si128());\n}\n\n//InterleaveImpl{{{1\ntemplate<typename V, size_t Size, size_t VSize> struct InterleaveImpl;\ntemplate<typename V> struct InterleaveImpl<V, 8, 16> {\n    template<typename I> static inline void interleave(typename V::EntryType *const data, const I &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        const __m128i tmp0 = _mm_unpacklo_epi16(v0.data(), v1.data());\n        const __m128i tmp1 = _mm_unpackhi_epi16(v0.data(), v1.data());\n#ifdef __x86_64__\n        const long long tmp00 = _mm_cvtsi128_si64(tmp0);\n        const long long tmp01 = _mm_cvtsi128_si64(_mm_unpackhi_epi64(tmp0, tmp0));\n        const long long tmp10 = _mm_cvtsi128_si64(tmp1);\n        const long long tmp11 = _mm_cvtsi128_si64(_mm_unpackhi_epi64(tmp1, tmp1));\n        aliasing_cast<int>(data[i[0]]) = tmp00;\n        aliasing_cast<int>(data[i[1]]) = tmp00 >> 32;\n        aliasing_cast<int>(data[i[2]]) = tmp01;\n        aliasing_cast<int>(data[i[3]]) = tmp01 >> 32;\n        aliasing_cast<int>(data[i[4]]) = tmp10;\n        aliasing_cast<int>(data[i[5]]) = tmp10 >> 32;\n        aliasing_cast<int>(data[i[6]]) = tmp11;\n        aliasing_cast<int>(data[i[7]]) = tmp11 >> 32;\n#elif defined(Vc_IMPL_SSE4_1)\n        using namespace SseIntrinsics;\n        aliasing_cast<int>(data[i[0]]) = _mm_cvtsi128_si32(tmp0);\n        aliasing_cast<int>(data[i[1]]) = extract_epi32<1>(tmp0);\n        aliasing_cast<int>(data[i[2]]) = extract_epi32<2>(tmp0);\n        aliasing_cast<int>(data[i[3]]) = extract_epi32<3>(tmp0);\n        aliasing_cast<int>(data[i[4]]) = _mm_cvtsi128_si32(tmp1);\n        aliasing_cast<int>(data[i[5]]) = extract_epi32<1>(tmp1);\n        aliasing_cast<int>(data[i[6]]) = extract_epi32<2>(tmp1);\n        aliasing_cast<int>(data[i[7]]) = extract_epi32<3>(tmp1);\n#else\n        aliasing_cast<int>(data[i[0]]) = _mm_cvtsi128_si32(tmp0);\n        aliasing_cast<int>(data[i[1]]) = _mm_cvtsi128_si32(_mm_srli_si128(tmp0, 4));\n        aliasing_cast<int>(data[i[2]]) = _mm_cvtsi128_si32(_mm_srli_si128(tmp0, 8));\n        aliasing_cast<int>(data[i[3]]) = _mm_cvtsi128_si32(_mm_srli_si128(tmp0, 12));\n        aliasing_cast<int>(data[i[4]]) = _mm_cvtsi128_si32(tmp1);\n        aliasing_cast<int>(data[i[5]]) = _mm_cvtsi128_si32(_mm_srli_si128(tmp1, 4));\n        aliasing_cast<int>(data[i[6]]) = _mm_cvtsi128_si32(_mm_srli_si128(tmp1, 8));\n        aliasing_cast<int>(data[i[7]]) = _mm_cvtsi128_si32(_mm_srli_si128(tmp1, 12));\n#endif\n    }/*}}}*/\n    static inline void interleave(typename V::EntryType *const data, const Common::SuccessiveEntries<2> &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        const __m128i tmp0 = _mm_unpacklo_epi16(v0.data(), v1.data());\n        const __m128i tmp1 = _mm_unpackhi_epi16(v0.data(), v1.data());\n        V(tmp0).store(&data[i[0]], Vc::Unaligned);\n        V(tmp1).store(&data[i[4]], Vc::Unaligned);\n    }/*}}}*/\n    template<typename I> static inline void interleave(typename V::EntryType *const data, const I &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1, const typename V::AsArg v2)\n    {\n#if defined Vc_USE_MASKMOV_SCATTER && !defined Vc_MSVC\n        // MSVC fails to compile the MMX intrinsics\n        const __m64 mask = _mm_set_pi16(0, -1, -1, -1);\n        const __m128i tmp0 = _mm_unpacklo_epi16(v0.data(), v2.data());\n        const __m128i tmp1 = _mm_unpackhi_epi16(v0.data(), v2.data());\n        const __m128i tmp2 = _mm_unpacklo_epi16(v1.data(), v1.data());\n        const __m128i tmp3 = _mm_unpackhi_epi16(v1.data(), v1.data());\n\n        const __m128i tmp4 = _mm_unpacklo_epi16(tmp0, tmp2);\n        const __m128i tmp5 = _mm_unpackhi_epi16(tmp0, tmp2);\n        const __m128i tmp6 = _mm_unpacklo_epi16(tmp1, tmp3);\n        const __m128i tmp7 = _mm_unpackhi_epi16(tmp1, tmp3);\n\n        _mm_maskmove_si64(_mm_movepi64_pi64(tmp4), mask, reinterpret_cast<char *>(&data[i[0]]));\n        _mm_maskmove_si64(_mm_movepi64_pi64(_mm_srli_si128(tmp4, 8)), mask, reinterpret_cast<char *>(&data[i[1]]));\n        _mm_maskmove_si64(_mm_movepi64_pi64(tmp5), mask, reinterpret_cast<char *>(&data[i[2]]));\n        _mm_maskmove_si64(_mm_movepi64_pi64(_mm_srli_si128(tmp5, 8)), mask, reinterpret_cast<char *>(&data[i[3]]));\n        _mm_maskmove_si64(_mm_movepi64_pi64(tmp6), mask, reinterpret_cast<char *>(&data[i[4]]));\n        _mm_maskmove_si64(_mm_movepi64_pi64(_mm_srli_si128(tmp6, 8)), mask, reinterpret_cast<char *>(&data[i[5]]));\n        _mm_maskmove_si64(_mm_movepi64_pi64(tmp7), mask, reinterpret_cast<char *>(&data[i[6]]));\n        _mm_maskmove_si64(_mm_movepi64_pi64(_mm_srli_si128(tmp7, 8)), mask, reinterpret_cast<char *>(&data[i[7]]));\n        _mm_empty();\n#else\n        interleave(data, i, v0, v1);\n        v2.scatter(data + 2, i);\n#endif\n    }/*}}}*/\n    template<typename I> static inline void interleave(typename V::EntryType *const data, const I &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1,\n            const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        const __m128i tmp0 = _mm_unpacklo_epi16(v0.data(), v2.data());\n        const __m128i tmp1 = _mm_unpackhi_epi16(v0.data(), v2.data());\n        const __m128i tmp2 = _mm_unpacklo_epi16(v1.data(), v3.data());\n        const __m128i tmp3 = _mm_unpackhi_epi16(v1.data(), v3.data());\n\n        const __m128i tmp4 = _mm_unpacklo_epi16(tmp0, tmp2);\n        const __m128i tmp5 = _mm_unpackhi_epi16(tmp0, tmp2);\n        const __m128i tmp6 = _mm_unpacklo_epi16(tmp1, tmp3);\n        const __m128i tmp7 = _mm_unpackhi_epi16(tmp1, tmp3);\n\n        _mm_storel_epi64(reinterpret_cast<__m128i *>(&data[i[0]]), tmp4);\n        _mm_storel_epi64(reinterpret_cast<__m128i *>(&data[i[2]]), tmp5);\n        _mm_storel_epi64(reinterpret_cast<__m128i *>(&data[i[4]]), tmp6);\n        _mm_storel_epi64(reinterpret_cast<__m128i *>(&data[i[6]]), tmp7);\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[1]]), _mm_castsi128_ps(tmp4));\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[3]]), _mm_castsi128_ps(tmp5));\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[5]]), _mm_castsi128_ps(tmp6));\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[7]]), _mm_castsi128_ps(tmp7));\n    }/*}}}*/\n    static inline void interleave(typename V::EntryType *const data, const Common::SuccessiveEntries<4> &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1,\n            const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        const __m128i tmp0 = _mm_unpacklo_epi16(v0.data(), v2.data());\n        const __m128i tmp1 = _mm_unpackhi_epi16(v0.data(), v2.data());\n        const __m128i tmp2 = _mm_unpacklo_epi16(v1.data(), v3.data());\n        const __m128i tmp3 = _mm_unpackhi_epi16(v1.data(), v3.data());\n\n        const __m128i tmp4 = _mm_unpacklo_epi16(tmp0, tmp2);\n        const __m128i tmp5 = _mm_unpackhi_epi16(tmp0, tmp2);\n        const __m128i tmp6 = _mm_unpacklo_epi16(tmp1, tmp3);\n        const __m128i tmp7 = _mm_unpackhi_epi16(tmp1, tmp3);\n\n        V(tmp4).store(&data[i[0]], ::Vc::Unaligned);\n        V(tmp5).store(&data[i[2]], ::Vc::Unaligned);\n        V(tmp6).store(&data[i[4]], ::Vc::Unaligned);\n        V(tmp7).store(&data[i[6]], ::Vc::Unaligned);\n    }/*}}}*/\n    template <typename I>  // interleave 5 args{{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        v4.scatter(data + 4, i);\n    }\n    template <typename I>  // interleave 6 args{{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // interleave 7 args{{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // interleave 8 args{{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6, const typename V::AsArg v7)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6, v7);\n    }\n    //}}}2\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data, /*{{{*/\n            const I &i, V &v0, V &v1)\n    {\n        const __m128i a = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[0]]));\n        const __m128i b = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[1]]));\n        const __m128i c = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[2]]));\n        const __m128i d = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[3]]));\n        const __m128i e = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[4]]));\n        const __m128i f = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[5]]));\n        const __m128i g = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[6]]));\n        const __m128i h = _mm_cvtsi32_si128(*aliasing_cast<int>(&data[i[7]]));\n\n        const __m128i tmp2  = _mm_unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4\n        const __m128i tmp3  = _mm_unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m128i tmp4  = _mm_unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m128i tmp5  = _mm_unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n\n        const __m128i tmp0  = _mm_unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6\n        const __m128i tmp1  = _mm_unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n\n        v0.data() = _mm_unpacklo_epi16(tmp0, tmp1);\n        v1.data() = _mm_unpackhi_epi16(tmp0, tmp1);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2)\n    {\n        const __m128i a = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[0]]));\n        const __m128i b = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[1]]));\n        const __m128i c = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[2]]));\n        const __m128i d = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[3]]));\n        const __m128i e = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[4]]));\n        const __m128i f = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[5]]));\n        const __m128i g = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[6]]));\n        const __m128i h = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[7]]));\n\n        const __m128i tmp2  = _mm_unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4\n        const __m128i tmp4  = _mm_unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m128i tmp3  = _mm_unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m128i tmp5  = _mm_unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n\n        const __m128i tmp0  = _mm_unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6\n        const __m128i tmp1  = _mm_unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m128i tmp6  = _mm_unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m128i tmp7  = _mm_unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n\n        v0.data() = _mm_unpacklo_epi16(tmp0, tmp1);\n        v1.data() = _mm_unpackhi_epi16(tmp0, tmp1);\n        v2.data() = _mm_unpacklo_epi16(tmp6, tmp7);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3)\n    {\n        const __m128i a = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[0]]));\n        const __m128i b = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[1]]));\n        const __m128i c = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[2]]));\n        const __m128i d = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[3]]));\n        const __m128i e = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[4]]));\n        const __m128i f = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[5]]));\n        const __m128i g = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[6]]));\n        const __m128i h = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(&data[i[7]]));\n\n        const __m128i tmp2  = _mm_unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4\n        const __m128i tmp4  = _mm_unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m128i tmp3  = _mm_unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m128i tmp5  = _mm_unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n\n        const __m128i tmp0  = _mm_unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6\n        const __m128i tmp1  = _mm_unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m128i tmp6  = _mm_unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m128i tmp7  = _mm_unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n\n        v0.data() = _mm_unpacklo_epi16(tmp0, tmp1);\n        v1.data() = _mm_unpackhi_epi16(tmp0, tmp1);\n        v2.data() = _mm_unpacklo_epi16(tmp6, tmp7);\n        v3.data() = _mm_unpackhi_epi16(tmp6, tmp7);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4)\n    {\n        const __m128i a = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]]));\n        const __m128i b = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]]));\n        const __m128i c = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]]));\n        const __m128i d = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]]));\n        const __m128i e = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]]));\n        const __m128i f = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]]));\n        const __m128i g = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]]));\n        const __m128i h = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]]));\n\n        const __m128i tmp2  = _mm_unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4\n        const __m128i tmp4  = _mm_unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m128i tmp3  = _mm_unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m128i tmp5  = _mm_unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m128i tmp10 = _mm_unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m128i tmp11 = _mm_unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m128i tmp12 = _mm_unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m128i tmp13 = _mm_unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m128i tmp0  = _mm_unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6\n        const __m128i tmp1  = _mm_unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m128i tmp6  = _mm_unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m128i tmp7  = _mm_unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m128i tmp8  = _mm_unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m128i tmp9  = _mm_unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n\n        v0.data() = _mm_unpacklo_epi16(tmp0, tmp1);\n        v1.data() = _mm_unpackhi_epi16(tmp0, tmp1);\n        v2.data() = _mm_unpacklo_epi16(tmp6, tmp7);\n        v3.data() = _mm_unpackhi_epi16(tmp6, tmp7);\n        v4.data() = _mm_unpacklo_epi16(tmp8, tmp9);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        const __m128i a = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]]));\n        const __m128i b = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]]));\n        const __m128i c = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]]));\n        const __m128i d = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]]));\n        const __m128i e = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]]));\n        const __m128i f = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]]));\n        const __m128i g = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]]));\n        const __m128i h = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]]));\n\n        const __m128i tmp2  = _mm_unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4\n        const __m128i tmp4  = _mm_unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m128i tmp3  = _mm_unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m128i tmp5  = _mm_unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m128i tmp10 = _mm_unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m128i tmp11 = _mm_unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m128i tmp12 = _mm_unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m128i tmp13 = _mm_unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m128i tmp0  = _mm_unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6\n        const __m128i tmp1  = _mm_unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m128i tmp6  = _mm_unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m128i tmp7  = _mm_unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m128i tmp8  = _mm_unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m128i tmp9  = _mm_unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n\n        v0.data() = _mm_unpacklo_epi16(tmp0, tmp1);\n        v1.data() = _mm_unpackhi_epi16(tmp0, tmp1);\n        v2.data() = _mm_unpacklo_epi16(tmp6, tmp7);\n        v3.data() = _mm_unpackhi_epi16(tmp6, tmp7);\n        v4.data() = _mm_unpacklo_epi16(tmp8, tmp9);\n        v5.data() = _mm_unpackhi_epi16(tmp8, tmp9);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6)\n    {\n        const __m128i a = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]]));\n        const __m128i b = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]]));\n        const __m128i c = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]]));\n        const __m128i d = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]]));\n        const __m128i e = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]]));\n        const __m128i f = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]]));\n        const __m128i g = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]]));\n        const __m128i h = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]]));\n\n        const __m128i tmp2  = _mm_unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4\n        const __m128i tmp4  = _mm_unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m128i tmp3  = _mm_unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m128i tmp5  = _mm_unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m128i tmp10 = _mm_unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m128i tmp11 = _mm_unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m128i tmp12 = _mm_unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m128i tmp13 = _mm_unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m128i tmp0  = _mm_unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6\n        const __m128i tmp1  = _mm_unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m128i tmp6  = _mm_unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m128i tmp7  = _mm_unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m128i tmp8  = _mm_unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m128i tmp9  = _mm_unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n        const __m128i tmp14 = _mm_unpackhi_epi16(tmp10, tmp11); // g0 g2 g4 g6 h0 h2 h4 h6\n        const __m128i tmp15 = _mm_unpackhi_epi16(tmp12, tmp13); // g1 g3 g5 g7 h1 h3 h5 h7\n\n        v0.data() = _mm_unpacklo_epi16(tmp0, tmp1);\n        v1.data() = _mm_unpackhi_epi16(tmp0, tmp1);\n        v2.data() = _mm_unpacklo_epi16(tmp6, tmp7);\n        v3.data() = _mm_unpackhi_epi16(tmp6, tmp7);\n        v4.data() = _mm_unpacklo_epi16(tmp8, tmp9);\n        v5.data() = _mm_unpackhi_epi16(tmp8, tmp9);\n        v6.data() = _mm_unpacklo_epi16(tmp14, tmp15);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6, V &v7)\n    {\n        const __m128i a = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[0]]));\n        const __m128i b = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[1]]));\n        const __m128i c = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[2]]));\n        const __m128i d = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[3]]));\n        const __m128i e = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[4]]));\n        const __m128i f = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[5]]));\n        const __m128i g = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[6]]));\n        const __m128i h = _mm_loadu_si128(reinterpret_cast<const __m128i *>(&data[i[7]]));\n\n        const __m128i tmp2  = _mm_unpacklo_epi16(a, e); // a0 a4 b0 b4 c0 c4 d0 d4\n        const __m128i tmp4  = _mm_unpacklo_epi16(b, f); // a1 a5 b1 b5 c1 c5 d1 d5\n        const __m128i tmp3  = _mm_unpacklo_epi16(c, g); // a2 a6 b2 b6 c2 c6 d2 d6\n        const __m128i tmp5  = _mm_unpacklo_epi16(d, h); // a3 a7 b3 b7 c3 c7 d3 d7\n        const __m128i tmp10 = _mm_unpackhi_epi16(a, e); // e0 e4 f0 f4 g0 g4 h0 h4\n        const __m128i tmp11 = _mm_unpackhi_epi16(c, g); // e1 e5 f1 f5 g1 g5 h1 h5\n        const __m128i tmp12 = _mm_unpackhi_epi16(b, f); // e2 e6 f2 f6 g2 g6 h2 h6\n        const __m128i tmp13 = _mm_unpackhi_epi16(d, h); // e3 e7 f3 f7 g3 g7 h3 h7\n\n        const __m128i tmp0  = _mm_unpacklo_epi16(tmp2, tmp3); // a0 a2 a4 a6 b0 b2 b4 b6\n        const __m128i tmp1  = _mm_unpacklo_epi16(tmp4, tmp5); // a1 a3 a5 a7 b1 b3 b5 b7\n        const __m128i tmp6  = _mm_unpackhi_epi16(tmp2, tmp3); // c0 c2 c4 c6 d0 d2 d4 d6\n        const __m128i tmp7  = _mm_unpackhi_epi16(tmp4, tmp5); // c1 c3 c5 c7 d1 d3 d5 d7\n        const __m128i tmp8  = _mm_unpacklo_epi16(tmp10, tmp11); // e0 e2 e4 e6 f0 f2 f4 f6\n        const __m128i tmp9  = _mm_unpacklo_epi16(tmp12, tmp13); // e1 e3 e5 e7 f1 f3 f5 f7\n        const __m128i tmp14 = _mm_unpackhi_epi16(tmp10, tmp11); // g0 g2 g4 g6 h0 h2 h4 h6\n        const __m128i tmp15 = _mm_unpackhi_epi16(tmp12, tmp13); // g1 g3 g5 g7 h1 h3 h5 h7\n\n        v0.data() = _mm_unpacklo_epi16(tmp0, tmp1);\n        v1.data() = _mm_unpackhi_epi16(tmp0, tmp1);\n        v2.data() = _mm_unpacklo_epi16(tmp6, tmp7);\n        v3.data() = _mm_unpackhi_epi16(tmp6, tmp7);\n        v4.data() = _mm_unpacklo_epi16(tmp8, tmp9);\n        v5.data() = _mm_unpackhi_epi16(tmp8, tmp9);\n        v6.data() = _mm_unpacklo_epi16(tmp14, tmp15);\n        v7.data() = _mm_unpackhi_epi16(tmp14, tmp15);\n    }/*}}}*/\n};\ntemplate<typename V> struct InterleaveImpl<V, 4, 16> {\n    static inline void interleave(typename V::EntryType *const data, const Common::SuccessiveEntries<2> &i,/*{{{*/\n            const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        const __m128 tmp0 = _mm_unpacklo_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        const __m128 tmp1 = _mm_unpackhi_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[0]]), tmp0);\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[2]]), tmp1);\n    }/*}}}*/\n    template <typename I>  // interleave 2 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        const __m128 tmp0 = _mm_unpacklo_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        const __m128 tmp1 = _mm_unpackhi_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[0]]), tmp0);\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[1]]), tmp0);\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[2]]), tmp1);\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[3]]), tmp1);\n    }\n    template <typename I>  // interleave 3 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2)\n    {\n#ifdef Vc_USE_MASKMOV_SCATTER\n        const __m128 tmp0 = _mm_unpacklo_ps(SSE::sse_cast<__m128>(v0.data()), SSE::sse_cast<__m128>(v1.data()));\n        const __m128 tmp1 = _mm_unpackhi_ps(SSE::sse_cast<__m128>(v0.data()), SSE::sse_cast<__m128>(v1.data()));\n        const __m128 tmp2 = _mm_unpacklo_ps(SSE::sse_cast<__m128>(v2.data()), SSE::sse_cast<__m128>(v2.data()));\n        const __m128 tmp3 = _mm_unpackhi_ps(SSE::sse_cast<__m128>(v2.data()), SSE::sse_cast<__m128>(v2.data()));\n        const __m128i mask = _mm_set_epi32(0, -1, -1, -1);\n        _mm_maskmoveu_si128(_mm_castps_si128(_mm_movelh_ps(tmp0, tmp2)), mask, reinterpret_cast<char *>(&data[i[0]]));\n        _mm_maskmoveu_si128(_mm_castps_si128(_mm_movehl_ps(tmp2, tmp0)), mask, reinterpret_cast<char *>(&data[i[1]]));\n        _mm_maskmoveu_si128(_mm_castps_si128(_mm_movelh_ps(tmp1, tmp3)), mask, reinterpret_cast<char *>(&data[i[2]]));\n        _mm_maskmoveu_si128(_mm_castps_si128(_mm_movehl_ps(tmp3, tmp1)), mask, reinterpret_cast<char *>(&data[i[3]]));\n#else\n        const __m128 tmp0 = _mm_unpacklo_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        const __m128 tmp1 = _mm_unpackhi_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[0]]), tmp0);\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[1]]), tmp0);\n        _mm_storel_pi(reinterpret_cast<__m64 *>(&data[i[2]]), tmp1);\n        _mm_storeh_pi(reinterpret_cast<__m64 *>(&data[i[3]]), tmp1);\n        v2.scatter(data + 2, i);\n#endif\n    }\n    template <typename I>  // interleave 4 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        const __m128 tmp0 = _mm_unpacklo_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        const __m128 tmp1 = _mm_unpackhi_ps(SSE::sse_cast<__m128>(v0.data()),SSE::sse_cast<__m128>(v1.data()));\n        const __m128 tmp2 = _mm_unpacklo_ps(SSE::sse_cast<__m128>(v2.data()),SSE::sse_cast<__m128>(v3.data()));\n        const __m128 tmp3 = _mm_unpackhi_ps(SSE::sse_cast<__m128>(v2.data()),SSE::sse_cast<__m128>(v3.data()));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[0]]), _mm_movelh_ps(tmp0, tmp2));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[1]]), _mm_movehl_ps(tmp2, tmp0));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[2]]), _mm_movelh_ps(tmp1, tmp3));\n        _mm_storeu_ps(aliasing_cast<float>(&data[i[3]]), _mm_movehl_ps(tmp3, tmp1));\n    }\n    template <typename I>  // interleave 5 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        v4.scatter(data + 4, i);\n    }\n    template <typename I>  // interleave 6 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // interleave 7 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // interleave 8 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6, const typename V::AsArg v7)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6, v7);\n    }\n    //}}}2\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1)\n    {\n        const __m128 a = _mm_castpd_ps(_mm_load_sd(aliasing_cast<double>(&data[i[0]])));\n        const __m128 b = _mm_castpd_ps(_mm_load_sd(aliasing_cast<double>(&data[i[1]])));\n        const __m128 c = _mm_castpd_ps(_mm_load_sd(aliasing_cast<double>(&data[i[2]])));\n        const __m128 d = _mm_castpd_ps(_mm_load_sd(aliasing_cast<double>(&data[i[3]])));\n\n        const __m128 tmp0 = _mm_unpacklo_ps(a, b); // [a0 a1 b0 b1]\n        const __m128 tmp1 = _mm_unpacklo_ps(c, d); // [a2 a3 b2 b3]\n\n        v0.data() = SSE::sse_cast<typename V::VectorType>(_mm_movelh_ps(tmp0, tmp1));\n        v1.data() = SSE::sse_cast<typename V::VectorType>(_mm_movehl_ps(tmp1, tmp0));\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2)\n    {\n        const __m128 a = _mm_loadu_ps(aliasing_cast<float>(&data[i[0]]));\n        const __m128 b = _mm_loadu_ps(aliasing_cast<float>(&data[i[1]]));\n        const __m128 c = _mm_loadu_ps(aliasing_cast<float>(&data[i[2]]));\n        const __m128 d = _mm_loadu_ps(aliasing_cast<float>(&data[i[3]]));\n\n        const __m128 tmp0 = _mm_unpacklo_ps(a, b); // [a0 a1 b0 b1]\n        const __m128 tmp1 = _mm_unpacklo_ps(c, d); // [a2 a3 b2 b3]\n        const __m128 tmp2 = _mm_unpackhi_ps(a, b); // [c0 c1 XX XX]\n        const __m128 tmp3 = _mm_unpackhi_ps(c, d); // [c2 c3 XX XX]\n\n        v0.data() = SSE::sse_cast<typename V::VectorType>(_mm_movelh_ps(tmp0, tmp1));\n        v1.data() = SSE::sse_cast<typename V::VectorType>(_mm_movehl_ps(tmp1, tmp0));\n        v2.data() = SSE::sse_cast<typename V::VectorType>(_mm_movelh_ps(tmp2, tmp3));\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3)\n    {\n        const __m128 a = _mm_loadu_ps(aliasing_cast<float>(&data[i[0]]));\n        const __m128 b = _mm_loadu_ps(aliasing_cast<float>(&data[i[1]]));\n        const __m128 c = _mm_loadu_ps(aliasing_cast<float>(&data[i[2]]));\n        const __m128 d = _mm_loadu_ps(aliasing_cast<float>(&data[i[3]]));\n\n        const __m128 tmp0 = _mm_unpacklo_ps(a, b); // [a0 a1 b0 b1]\n        const __m128 tmp1 = _mm_unpacklo_ps(c, d); // [a2 a3 b2 b3]\n        const __m128 tmp2 = _mm_unpackhi_ps(a, b); // [c0 c1 d0 d1]\n        const __m128 tmp3 = _mm_unpackhi_ps(c, d); // [c2 c3 d2 d3]\n\n        v0.data() = SSE::sse_cast<typename V::VectorType>(_mm_movelh_ps(tmp0, tmp1));\n        v1.data() = SSE::sse_cast<typename V::VectorType>(_mm_movehl_ps(tmp1, tmp0));\n        v2.data() = SSE::sse_cast<typename V::VectorType>(_mm_movelh_ps(tmp2, tmp3));\n        v3.data() = SSE::sse_cast<typename V::VectorType>(_mm_movehl_ps(tmp3, tmp2));\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        v4.gather(data + 4, i);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5, v6);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6, V &v7)\n    {\n        deinterleave(data, i, v0, v1, v2, v3);\n        deinterleave(data + 4, i, v4, v5, v6, v7);\n    }/*}}}*/\n};\ntemplate<typename V> struct InterleaveImpl<V, 2, 16> {\n    template <typename I>  // interleave 2 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1)\n    {\n        const __m128d tmp0 = _mm_unpacklo_pd(v0.data(), v1.data());\n        const __m128d tmp1 = _mm_unpackhi_pd(v0.data(), v1.data());\n        _mm_storeu_pd(&data[i[0]], tmp0);\n        _mm_storeu_pd(&data[i[1]], tmp1);\n    }\n    template <typename I>  // interleave 3 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2)\n    {\n        interleave(data, i, v0, v1);\n        v2.scatter(data + 2, i);\n    }\n    template <typename I>  // interleave 4 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3)\n    {\n        interleave(data, i, v0, v1);\n        interleave(data + 2, i, v2, v3);\n    }\n    template <typename I>  // interleave 5 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        v4.scatter(data + 4, i);\n    }\n    template <typename I>  // interleave 6 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5);\n    }\n    template <typename I>  // interleave 7 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6);\n    }\n    template <typename I>  // interleave 8 args {{{2\n    static inline void interleave(typename V::EntryType *const data, const I &i,\n                                  const typename V::AsArg v0, const typename V::AsArg v1,\n                                  const typename V::AsArg v2, const typename V::AsArg v3,\n                                  const typename V::AsArg v4, const typename V::AsArg v5,\n                                  const typename V::AsArg v6, const typename V::AsArg v7)\n    {\n        interleave(data, i, v0, v1, v2, v3);\n        interleave(data + 4, i, v4, v5, v6, v7);\n    }\n    //}}}2\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1)\n    {\n        const __m128d a = _mm_loadu_pd(&data[i[0]]);\n        const __m128d b = _mm_loadu_pd(&data[i[1]]);\n\n        v0.data() = _mm_unpacklo_pd(a, b);\n        v1.data() = _mm_unpackhi_pd(a, b);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2)\n    {\n        v2.gather(data + 2, i);\n        deinterleave(data, i, v0, v1);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n        v4.gather(data + 4, i);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n        v6.gather(data + 6, i);\n    }/*}}}*/\n    template<typename I> static inline void deinterleave(typename V::EntryType const *const data,/*{{{*/\n            const I &i, V &v0, V &v1, V &v2, V &v3, V &v4, V &v5, V &v6, V &v7)\n    {\n        deinterleave(data, i, v0, v1);\n        deinterleave(data + 2, i, v2, v3);\n        deinterleave(data + 4, i, v4, v5);\n        deinterleave(data + 6, i, v6, v7);\n    }/*}}}*/\n};\n\n//}}}1\n}  // namespace Detail\n}  // namespace Vc\n\n#endif  // VC_SSE_DETAIL_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/helperimpl.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_DEINTERLEAVE_H_\n#define VC_SSE_DEINTERLEAVE_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <typename A>\ninline void deinterleave(SSE::float_v &, SSE::float_v &, const float *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::float_v &, SSE::float_v &, const short *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::float_v &, SSE::float_v &, const ushort *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::double_v &, SSE::double_v &, const double *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::int_v &, SSE::int_v &, const int *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::int_v &, SSE::int_v &, const short *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::uint_v &, SSE::uint_v &, const uint *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::uint_v &, SSE::uint_v &, const ushort *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::short_v &, SSE::short_v &, const short *, A);\ntemplate <typename A>\ninline void deinterleave(SSE::ushort_v &, SSE::ushort_v &, const ushort *, A);\n\nVc_ALWAYS_INLINE_L void prefetchForOneRead(const void *addr, VectorAbi::Sse) Vc_ALWAYS_INLINE_R;\nVc_ALWAYS_INLINE_L void prefetchForModify(const void *addr, VectorAbi::Sse) Vc_ALWAYS_INLINE_R;\nVc_ALWAYS_INLINE_L void prefetchClose(const void *addr, VectorAbi::Sse) Vc_ALWAYS_INLINE_R;\nVc_ALWAYS_INLINE_L void prefetchMid(const void *addr, VectorAbi::Sse) Vc_ALWAYS_INLINE_R;\nVc_ALWAYS_INLINE_L void prefetchFar(const void *addr, VectorAbi::Sse) Vc_ALWAYS_INLINE_R;\n}  // namespace Detail\n}  // namespace Vc\n\n#include \"deinterleave.tcc\"\n#include \"prefetches.tcc\"\n\n#endif // VC_SSE_DEINTERLEAVE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/intrinsics.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_INTRINSICS_H_\n#define VC_SSE_INTRINSICS_H_\n\n#ifdef Vc_MSVC\n#include <intrin.h>\n#else\n#include <x86intrin.h>\n#endif\n\n#include \"../common/storage.h\"\n#include \"const_data.h\"\n#include <cstdlib>\n#include \"types.h\"\n#include \"debug.h\"\n\n#if defined(Vc_GCC) && !defined(__OPTIMIZE__)\n// GCC uses lots of old-style-casts in macros that disguise as intrinsics\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wold-style-cast\"\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SseIntrinsics\n{\n    using SSE::c_general;\n\n    constexpr std::size_t VectorAlignment = 16;\n\n#if defined(Vc_GCC) && Vc_GCC < 0x40600 && !defined(Vc_DONT_FIX_SSE_SHIFT)\n    static Vc_INTRINSIC Vc_CONST __m128i _mm_sll_epi16(__m128i a, __m128i count) { __asm__(\"psllw %1,%0\" : \"+x\"(a) : \"x\"(count)); return a; }\n    static Vc_INTRINSIC Vc_CONST __m128i _mm_sll_epi32(__m128i a, __m128i count) { __asm__(\"pslld %1,%0\" : \"+x\"(a) : \"x\"(count)); return a; }\n    static Vc_INTRINSIC Vc_CONST __m128i _mm_sll_epi64(__m128i a, __m128i count) { __asm__(\"psllq %1,%0\" : \"+x\"(a) : \"x\"(count)); return a; }\n    static Vc_INTRINSIC Vc_CONST __m128i _mm_srl_epi16(__m128i a, __m128i count) { __asm__(\"psrlw %1,%0\" : \"+x\"(a) : \"x\"(count)); return a; }\n    static Vc_INTRINSIC Vc_CONST __m128i _mm_srl_epi32(__m128i a, __m128i count) { __asm__(\"psrld %1,%0\" : \"+x\"(a) : \"x\"(count)); return a; }\n    static Vc_INTRINSIC Vc_CONST __m128i _mm_srl_epi64(__m128i a, __m128i count) { __asm__(\"psrlq %1,%0\" : \"+x\"(a) : \"x\"(count)); return a; }\n#endif\n\n#ifdef Vc_GCC\n    // Redefine the mul/add/sub intrinsics to use GCC-specific operators instead of builtin\n    // functions. This way the fp-contraction optimization step kicks in and creates FMAs! :)\n    static Vc_INTRINSIC Vc_CONST __m128d _mm_mul_pd(__m128d a, __m128d b) { return static_cast<__m128d>(static_cast<__v2df>(a) * static_cast<__v2df>(b)); }\n    static Vc_INTRINSIC Vc_CONST __m128d _mm_add_pd(__m128d a, __m128d b) { return static_cast<__m128d>(static_cast<__v2df>(a) + static_cast<__v2df>(b)); }\n    static Vc_INTRINSIC Vc_CONST __m128d _mm_sub_pd(__m128d a, __m128d b) { return static_cast<__m128d>(static_cast<__v2df>(a) - static_cast<__v2df>(b)); }\n    static Vc_INTRINSIC Vc_CONST __m128  _mm_mul_ps(__m128  a, __m128  b) { return static_cast<__m128 >(static_cast<__v4sf>(a) * static_cast<__v4sf>(b)); }\n    static Vc_INTRINSIC Vc_CONST __m128  _mm_add_ps(__m128  a, __m128  b) { return static_cast<__m128 >(static_cast<__v4sf>(a) + static_cast<__v4sf>(b)); }\n    static Vc_INTRINSIC Vc_CONST __m128  _mm_sub_ps(__m128  a, __m128  b) { return static_cast<__m128 >(static_cast<__v4sf>(a) - static_cast<__v4sf>(b)); }\n#endif\n\n    static Vc_INTRINSIC Vc_CONST __m128i _mm_setallone_si128() { return _mm_load_si128(reinterpret_cast<const __m128i *>(Common::AllBitsSet)); }\n    static Vc_INTRINSIC Vc_CONST __m128d _mm_setallone_pd() { return _mm_load_pd(reinterpret_cast<const double *>(Common::AllBitsSet)); }\n    static Vc_INTRINSIC Vc_CONST __m128  _mm_setallone_ps() { return _mm_load_ps(reinterpret_cast<const float *>(Common::AllBitsSet)); }\n\n    static Vc_INTRINSIC __m128i Vc_CONST _mm_setone_epi16()  { return _mm_load_si128(reinterpret_cast<const __m128i *>(c_general::one16)); }\n    static Vc_INTRINSIC __m128i Vc_CONST _mm_setone_epu16()  { return _mm_setone_epi16(); }\n    static Vc_INTRINSIC __m128i Vc_CONST _mm_setone_epi32()  { return _mm_load_si128(reinterpret_cast<const __m128i *>(c_general::one32)); }\n    static Vc_INTRINSIC __m128i Vc_CONST _mm_setone_epu32()  { return _mm_setone_epi32(); }\n\n    static Vc_INTRINSIC __m128  Vc_CONST _mm_setone_ps()     { return _mm_load_ps(c_general::oneFloat); }\n    static Vc_INTRINSIC __m128d Vc_CONST _mm_setone_pd()     { return _mm_load_pd(c_general::oneDouble); }\n\n    static Vc_INTRINSIC __m128d Vc_CONST _mm_setabsmask_pd() { return _mm_load_pd(reinterpret_cast<const double *>(c_general::absMaskDouble)); }\n    static Vc_INTRINSIC __m128  Vc_CONST _mm_setabsmask_ps() { return _mm_load_ps(reinterpret_cast<const float *>(c_general::absMaskFloat)); }\n    static Vc_INTRINSIC __m128d Vc_CONST _mm_setsignmask_pd(){ return _mm_load_pd(reinterpret_cast<const double *>(c_general::signMaskDouble)); }\n    static Vc_INTRINSIC __m128  Vc_CONST _mm_setsignmask_ps(){ return _mm_load_ps(reinterpret_cast<const float *>(c_general::signMaskFloat)); }\n\n    static Vc_INTRINSIC __m128i Vc_CONST setmin_epi8 () { return _mm_set1_epi8(-0x80); }\n    static Vc_INTRINSIC __m128i Vc_CONST setmin_epi16() { return _mm_load_si128(reinterpret_cast<const __m128i *>(c_general::minShort)); }\n    static Vc_INTRINSIC __m128i Vc_CONST setmin_epi32() { return _mm_load_si128(reinterpret_cast<const __m128i *>(c_general::signMaskFloat)); }\n\n#if defined(Vc_IMPL_XOP)\n    static Vc_INTRINSIC __m128i Vc_CONST cmpgt_epu8(__m128i a, __m128i b) { return _mm_comgt_epu8(a, b); }\n    static Vc_INTRINSIC __m128i Vc_CONST cmplt_epu16(__m128i a, __m128i b) { return _mm_comlt_epu16(a, b); }\n    static Vc_INTRINSIC __m128i Vc_CONST cmpgt_epu16(__m128i a, __m128i b) { return _mm_comgt_epu16(a, b); }\n    static Vc_INTRINSIC __m128i Vc_CONST cmplt_epu32(__m128i a, __m128i b) { return _mm_comlt_epu32(a, b); }\n    static Vc_INTRINSIC __m128i Vc_CONST cmpgt_epu32(__m128i a, __m128i b) { return _mm_comgt_epu32(a, b); }\n    static Vc_INTRINSIC __m128i Vc_CONST cmplt_epu64(__m128i a, __m128i b) { return _mm_comlt_epu64(a, b); }\n#else\n    static Vc_INTRINSIC __m128i Vc_CONST cmpgt_epu8(__m128i a, __m128i b)\n    {\n        return _mm_cmpgt_epi8(_mm_xor_si128(a, setmin_epi8()),\n                              _mm_xor_si128(b, setmin_epi8()));\n    }\n    static Vc_INTRINSIC __m128i Vc_CONST cmplt_epu16(__m128i a, __m128i b)\n    {\n        return _mm_cmplt_epi16(_mm_xor_si128(a, setmin_epi16()),\n                               _mm_xor_si128(b, setmin_epi16()));\n    }\n    static Vc_INTRINSIC __m128i Vc_CONST cmpgt_epu16(__m128i a, __m128i b)\n    {\n        return _mm_cmpgt_epi16(_mm_xor_si128(a, setmin_epi16()),\n                               _mm_xor_si128(b, setmin_epi16()));\n    }\n    static Vc_INTRINSIC __m128i Vc_CONST cmplt_epu32(__m128i a, __m128i b)\n    {\n        return _mm_cmplt_epi32(_mm_xor_si128(a, setmin_epi32()),\n                               _mm_xor_si128(b, setmin_epi32()));\n    }\n    static Vc_INTRINSIC __m128i Vc_CONST cmpgt_epu32(__m128i a, __m128i b)\n    {\n        return _mm_cmpgt_epi32(_mm_xor_si128(a, setmin_epi32()),\n                               _mm_xor_si128(b, setmin_epi32()));\n    }\n    Vc_INTRINSIC __m128i Vc_CONST cmpgt_epi64(__m128i a, __m128i b)\n    {\n#ifdef Vc_IMPL_SSE4_2\n        return _mm_cmpgt_epi64(a, b);\n#else\n        const auto aa = _mm_xor_si128(a, _mm_srli_epi64(setmin_epi32(),32));\n        const auto bb = _mm_xor_si128(b, _mm_srli_epi64(setmin_epi32(),32));\n        const auto gt = _mm_cmpgt_epi32(aa, bb);\n        const auto eq = _mm_cmpeq_epi32(aa, bb);\n        // Algorithm:\n        // 1. if the high 32 bits of gt are true, make the full 64 bits true\n        // 2. if the high 32 bits of gt are false and the high 32 bits of eq are true,\n        //    duplicate the low 32 bits of gt to the high 32 bits (note that this requires\n        //    unsigned compare on the lower 32 bits, which is the reason for the xors\n        //    above)\n        // 3. else make the full 64 bits false\n\n        const auto gt2 =\n            _mm_shuffle_epi32(gt, 0xf5);  // dup the high 32 bits to the low 32 bits\n        const auto lo =\n            _mm_shuffle_epi32(_mm_and_si128(_mm_srli_epi64(eq, 32), gt), 0xa0);\n        return _mm_or_si128(gt2, lo);\n#endif\n    }\n#endif\n}  // namespace SseIntrinsics\n}  // namespace Vc\n\n// SSSE3\n#ifdef Vc_IMPL_SSSE3\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SseIntrinsics\n{\n    // not overriding _mm_set1_epi8 because this one should only be used for non-constants\n    Vc_INTRINSIC Vc_CONST __m128i abs_epi8(__m128i a) { return _mm_abs_epi8(a); }\n    Vc_INTRINSIC Vc_CONST __m128i abs_epi16(__m128i a) { return _mm_abs_epi16(a); }\n    Vc_INTRINSIC Vc_CONST __m128i abs_epi32(__m128i a) { return _mm_abs_epi32(a); }\n    template <int s> Vc_INTRINSIC Vc_CONST __m128i alignr_epi8(__m128i a, __m128i b)\n    {\n        return _mm_alignr_epi8(a, b, s & 0x1fu);\n    }\n}  // namespace SseIntrinsics\n}  // namespace Vc\n\n#else\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SseIntrinsics\n{\n    Vc_INTRINSIC Vc_CONST __m128i abs_epi8 (__m128i a) {\n        __m128i negative = _mm_cmplt_epi8 (a, _mm_setzero_si128());\n        return _mm_add_epi8 (_mm_xor_si128(a, negative), _mm_and_si128(negative,  _mm_set1_epi8(1)));\n    }\n    // positive value:\n    //   negative == 0\n    //   a unchanged after xor\n    //   0 >> 31 -> 0\n    //   a + 0 -> a\n    // negative value:\n    //   negative == -1\n    //   a xor -1 -> -a - 1\n    //   -1 >> 31 -> 1\n    //   -a - 1 + 1 -> -a\n    Vc_INTRINSIC Vc_CONST __m128i abs_epi16(__m128i a) {\n        __m128i negative = _mm_cmplt_epi16(a, _mm_setzero_si128());\n        return _mm_add_epi16(_mm_xor_si128(a, negative), _mm_srli_epi16(negative, 15));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i abs_epi32(__m128i a) {\n        __m128i negative = _mm_cmplt_epi32(a, _mm_setzero_si128());\n        return _mm_add_epi32(_mm_xor_si128(a, negative), _mm_srli_epi32(negative, 31));\n    }\n    template <int s> Vc_INTRINSIC Vc_CONST __m128i alignr_epi8(__m128i a, __m128i b)\n    {\n        switch (s & 0x1fu) {\n            case  0: return b;\n            case  1: return _mm_or_si128(_mm_slli_si128(a, 15), _mm_srli_si128(b,  1));\n            case  2: return _mm_or_si128(_mm_slli_si128(a, 14), _mm_srli_si128(b,  2));\n            case  3: return _mm_or_si128(_mm_slli_si128(a, 13), _mm_srli_si128(b,  3));\n            case  4: return _mm_or_si128(_mm_slli_si128(a, 12), _mm_srli_si128(b,  4));\n            case  5: return _mm_or_si128(_mm_slli_si128(a, 11), _mm_srli_si128(b,  5));\n            case  6: return _mm_or_si128(_mm_slli_si128(a, 10), _mm_srli_si128(b,  6));\n            case  7: return _mm_or_si128(_mm_slli_si128(a,  9), _mm_srli_si128(b,  7));\n            case  8: return _mm_or_si128(_mm_slli_si128(a,  8), _mm_srli_si128(b,  8));\n            case  9: return _mm_or_si128(_mm_slli_si128(a,  7), _mm_srli_si128(b,  9));\n            case 10: return _mm_or_si128(_mm_slli_si128(a,  6), _mm_srli_si128(b, 10));\n            case 11: return _mm_or_si128(_mm_slli_si128(a,  5), _mm_srli_si128(b, 11));\n            case 12: return _mm_or_si128(_mm_slli_si128(a,  4), _mm_srli_si128(b, 12));\n            case 13: return _mm_or_si128(_mm_slli_si128(a,  3), _mm_srli_si128(b, 13));\n            case 14: return _mm_or_si128(_mm_slli_si128(a,  2), _mm_srli_si128(b, 14));\n            case 15: return _mm_or_si128(_mm_slli_si128(a,  1), _mm_srli_si128(b, 15));\n            case 16: return a;\n            case 17: return _mm_srli_si128(a,  1);\n            case 18: return _mm_srli_si128(a,  2);\n            case 19: return _mm_srli_si128(a,  3);\n            case 20: return _mm_srli_si128(a,  4);\n            case 21: return _mm_srli_si128(a,  5);\n            case 22: return _mm_srli_si128(a,  6);\n            case 23: return _mm_srli_si128(a,  7);\n            case 24: return _mm_srli_si128(a,  8);\n            case 25: return _mm_srli_si128(a,  9);\n            case 26: return _mm_srli_si128(a, 10);\n            case 27: return _mm_srli_si128(a, 11);\n            case 28: return _mm_srli_si128(a, 12);\n            case 29: return _mm_srli_si128(a, 13);\n            case 30: return _mm_srli_si128(a, 14);\n            case 31: return _mm_srli_si128(a, 15);\n        }\n        return _mm_setzero_si128();\n    }\n}  // namespace SseIntrinsics\n}  // namespace Vc\n#endif\n\n// SSE4.1\n#ifdef Vc_IMPL_SSE4_1\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SseIntrinsics\n{\nVc_INTRINSIC Vc_CONST __m128i cmpeq_epi64(__m128i a, __m128i b)\n{\n    return _mm_cmpeq_epi64(a, b);\n}\ntemplate <int index> Vc_INTRINSIC Vc_CONST int extract_epi32(__m128i v)\n{\n    return _mm_extract_epi32(v, index);\n}\nVc_INTRINSIC Vc_CONST __m128d blendv_pd(__m128d a, __m128d b, __m128d c)\n{\n    return _mm_blendv_pd(a, b, c);\n}\nVc_INTRINSIC Vc_CONST __m128 blendv_ps(__m128 a, __m128 b, __m128 c)\n{\n    return _mm_blendv_ps(a, b, c);\n}\nVc_INTRINSIC Vc_CONST __m128i blendv_epi8(__m128i a, __m128i b, __m128i c)\n{\n    return _mm_blendv_epi8(a, b, c);\n}\ntemplate <int mask> Vc_INTRINSIC Vc_CONST __m128d blend_pd(__m128d a, __m128d b)\n{\n    return _mm_blend_pd(a, b, mask);\n}\ntemplate <int mask> Vc_INTRINSIC Vc_CONST __m128 blend_ps(__m128 a, __m128 b)\n{\n    return _mm_blend_ps(a, b, mask);\n}\ntemplate <int mask> Vc_INTRINSIC Vc_CONST __m128i blend_epi16(__m128i a, __m128i b)\n{\n    return _mm_blend_epi16(a, b, mask);\n}\nVc_INTRINSIC Vc_CONST __m128i max_epi8(__m128i a, __m128i b)\n{\n    return _mm_max_epi8(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i max_epi32(__m128i a, __m128i b)\n{\n    return _mm_max_epi32(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i max_epu16(__m128i a, __m128i b)\n{\n    return _mm_max_epu16(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i max_epu32(__m128i a, __m128i b)\n{\n    return _mm_max_epu32(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i min_epu16(__m128i a, __m128i b)\n{\n    return _mm_min_epu16(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i min_epu32(__m128i a, __m128i b)\n{\n    return _mm_min_epu32(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i min_epi8(__m128i a, __m128i b)\n{\n    return _mm_min_epi8(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i min_epi32(__m128i a, __m128i b)\n{\n    return _mm_min_epi32(a, b);\n}\nVc_INTRINSIC Vc_CONST __m128i cvtepu8_epi16(__m128i epu8)\n{\n    return _mm_cvtepu8_epi16(epu8);\n}\nVc_INTRINSIC Vc_CONST __m128i cvtepi8_epi16(__m128i epi8)\n{\n    return _mm_cvtepi8_epi16(epi8);\n}\nVc_INTRINSIC Vc_CONST __m128i cvtepu16_epi32(__m128i epu16)\n{\n    return _mm_cvtepu16_epi32(epu16);\n}\nVc_INTRINSIC Vc_CONST __m128i cvtepi16_epi32(__m128i epu16)\n{\n    return _mm_cvtepi16_epi32(epu16);\n}\nVc_INTRINSIC Vc_CONST __m128i cvtepu8_epi32(__m128i epu8)\n{\n    return _mm_cvtepu8_epi32(epu8);\n}\nVc_INTRINSIC Vc_CONST __m128i cvtepi8_epi32(__m128i epi8)\n{\n    return _mm_cvtepi8_epi32(epi8);\n}\n}  // namespace SseIntrinsics\n}  // namespace Vc\n#else\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SseIntrinsics\n{\n    Vc_INTRINSIC Vc_CONST __m128i cmpeq_epi64(__m128i a, __m128i b) {\n        auto tmp = _mm_cmpeq_epi32(a, b);\n        return _mm_and_si128(tmp, _mm_shuffle_epi32(tmp, 1*1 + 0*4 + 3*16 + 2*64));\n    }\n    template <int index> Vc_INTRINSIC Vc_CONST int extract_epi32(__m128i v)\n    {\n#ifdef Vc_USE_BUILTIN_VECTOR_TYPES\n        typedef int int32v4 __attribute__((__vector_size__(16)));\n        return aliasing_cast<int32v4>(v)[index];\n#else\n        return _mm_cvtsi128_si32(_mm_srli_si128(v, index * 4));\n#endif\n    }\n    Vc_INTRINSIC Vc_CONST __m128d blendv_pd(__m128d a, __m128d b, __m128d c) {\n#ifdef Vc_GCC\n        return reinterpret_cast<__m128d>(\n            (~reinterpret_cast<__m128i>(c) & reinterpret_cast<__m128i>(a)) |\n            (reinterpret_cast<__m128i>(c) & reinterpret_cast<__m128i>(b)));\n#else\n        return _mm_or_pd(_mm_andnot_pd(c, a), _mm_and_pd(c, b));\n#endif\n    }\n    Vc_INTRINSIC Vc_CONST __m128  blendv_ps(__m128  a, __m128  b, __m128  c) {\n#ifdef Vc_GCC\n        return reinterpret_cast<__m128>(\n            (~reinterpret_cast<__m128i>(c) & reinterpret_cast<__m128i>(a)) |\n            (reinterpret_cast<__m128i>(c) & reinterpret_cast<__m128i>(b)));\n#else\n        return _mm_or_ps(_mm_andnot_ps(c, a), _mm_and_ps(c, b));\n#endif\n    }\n    Vc_INTRINSIC Vc_CONST __m128i blendv_epi8(__m128i a, __m128i b, __m128i c) {\n#ifdef Vc_GCC\n        return (~c & a) | (c & b);\n#else\n        return _mm_or_si128(_mm_andnot_si128(c, a), _mm_and_si128(c, b));\n#endif\n    }\n\n    // only use the following blend functions with immediates as mask and, of course, compiling\n    // with optimization\n    template <int mask> Vc_INTRINSIC Vc_CONST __m128d blend_pd(__m128d a, __m128d b)\n    {\n        switch (mask) {\n        case 0x0:\n            return a;\n        case 0x1:\n            return _mm_shuffle_pd(b, a, 2);\n        case 0x2:\n            return _mm_shuffle_pd(a, b, 2);\n        case 0x3:\n            return b;\n        default:\n            abort();\n            return a; // should never be reached, but MSVC needs it else it warns about 'not all control paths return a value'\n        }\n    }\n    template <int mask> Vc_INTRINSIC Vc_CONST __m128 blend_ps(__m128 a, __m128 b)\n    {\n        __m128i c;\n        switch (mask) {\n        case 0x0:\n            return a;\n        case 0x1:\n            c = _mm_srli_si128(_mm_setallone_si128(), 12);\n            break;\n        case 0x2:\n            c = _mm_slli_si128(_mm_srli_si128(_mm_setallone_si128(), 12), 4);\n            break;\n        case 0x3:\n            c = _mm_srli_si128(_mm_setallone_si128(), 8);\n            break;\n        case 0x4:\n            c = _mm_slli_si128(_mm_srli_si128(_mm_setallone_si128(), 12), 8);\n            break;\n        case 0x5:\n            c = _mm_set_epi32(0, -1, 0, -1);\n            break;\n        case 0x6:\n            c = _mm_slli_si128(_mm_srli_si128(_mm_setallone_si128(), 8), 4);\n            break;\n        case 0x7:\n            c = _mm_srli_si128(_mm_setallone_si128(), 4);\n            break;\n        case 0x8:\n            c = _mm_slli_si128(_mm_setallone_si128(), 12);\n            break;\n        case 0x9:\n            c = _mm_set_epi32(-1, 0, 0, -1);\n            break;\n        case 0xa:\n            c = _mm_set_epi32(-1, 0, -1, 0);\n            break;\n        case 0xb:\n            c = _mm_set_epi32(-1, 0, -1, -1);\n            break;\n        case 0xc:\n            c = _mm_slli_si128(_mm_setallone_si128(), 8);\n            break;\n        case 0xd:\n            c = _mm_set_epi32(-1, -1, 0, -1);\n            break;\n        case 0xe:\n            c = _mm_slli_si128(_mm_setallone_si128(), 4);\n            break;\n        case 0xf:\n            return b;\n        default: // may not happen\n            abort();\n            c = _mm_setzero_si128();\n            break;\n        }\n        __m128 _c = _mm_castsi128_ps(c);\n        return _mm_or_ps(_mm_andnot_ps(_c, a), _mm_and_ps(_c, b));\n    }\n    template <int mask> Vc_INTRINSIC Vc_CONST __m128i blend_epi16(__m128i a, __m128i b)\n    {\n        __m128i c;\n        switch (mask) {\n        case 0x00:\n            return a;\n        case 0x01:\n            c = _mm_srli_si128(_mm_setallone_si128(), 14);\n            break;\n        case 0x03:\n            c = _mm_srli_si128(_mm_setallone_si128(), 12);\n            break;\n        case 0x07:\n            c = _mm_srli_si128(_mm_setallone_si128(), 10);\n            break;\n        case 0x0f:\n            return _mm_unpackhi_epi64(_mm_slli_si128(b, 8), a);\n        case 0x1f:\n            c = _mm_srli_si128(_mm_setallone_si128(), 6);\n            break;\n        case 0x3f:\n            c = _mm_srli_si128(_mm_setallone_si128(), 4);\n            break;\n        case 0x7f:\n            c = _mm_srli_si128(_mm_setallone_si128(), 2);\n            break;\n        case 0x80:\n            c = _mm_slli_si128(_mm_setallone_si128(), 14);\n            break;\n        case 0xc0:\n            c = _mm_slli_si128(_mm_setallone_si128(), 12);\n            break;\n        case 0xe0:\n            c = _mm_slli_si128(_mm_setallone_si128(), 10);\n            break;\n        case 0xf0:\n            c = _mm_slli_si128(_mm_setallone_si128(), 8);\n            break;\n        case 0xf8:\n            c = _mm_slli_si128(_mm_setallone_si128(), 6);\n            break;\n        case 0xfc:\n            c = _mm_slli_si128(_mm_setallone_si128(), 4);\n            break;\n        case 0xfe:\n            c = _mm_slli_si128(_mm_setallone_si128(), 2);\n            break;\n        case 0xff:\n            return b;\n        case 0xcc:\n            return _mm_unpacklo_epi32(_mm_shuffle_epi32(a, _MM_SHUFFLE(2, 0, 2, 0)), _mm_shuffle_epi32(b, _MM_SHUFFLE(3, 1, 3, 1)));\n        case 0x33:\n            return _mm_unpacklo_epi32(_mm_shuffle_epi32(b, _MM_SHUFFLE(2, 0, 2, 0)), _mm_shuffle_epi32(a, _MM_SHUFFLE(3, 1, 3, 1)));\n        default:\n            const __m128i shift = _mm_set_epi16(0x0100, 0x0200, 0x0400, 0x0800, 0x1000, 0x2000, 0x4000, -0x7fff);\n            c = _mm_srai_epi16(_mm_mullo_epi16(_mm_set1_epi16(mask), shift), 15);\n            break;\n        }\n        return _mm_or_si128(_mm_andnot_si128(c, a), _mm_and_si128(c, b));\n    }\n\n    Vc_INTRINSIC Vc_CONST __m128i max_epi8 (__m128i a, __m128i b) {\n        return blendv_epi8(b, a, _mm_cmpgt_epi8 (a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i max_epi32(__m128i a, __m128i b) {\n        return blendv_epi8(b, a, _mm_cmpgt_epi32(a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i max_epu16(__m128i a, __m128i b) {\n        return blendv_epi8(b, a, cmpgt_epu16(a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i max_epu32(__m128i a, __m128i b) {\n        return blendv_epi8(b, a, cmpgt_epu32(a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i min_epu16(__m128i a, __m128i b) {\n        return blendv_epi8(a, b, cmpgt_epu16(a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i min_epu32(__m128i a, __m128i b) {\n        return blendv_epi8(a, b, cmpgt_epu32(a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i min_epi8 (__m128i a, __m128i b) {\n        return blendv_epi8(a, b, _mm_cmpgt_epi8 (a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i min_epi32(__m128i a, __m128i b) {\n        return blendv_epi8(a, b, _mm_cmpgt_epi32(a, b));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i cvtepu8_epi16(__m128i epu8) {\n        return _mm_unpacklo_epi8(epu8, _mm_setzero_si128());\n    }\n    Vc_INTRINSIC Vc_CONST __m128i cvtepi8_epi16(__m128i epi8) {\n        return _mm_unpacklo_epi8(epi8, _mm_cmplt_epi8(epi8, _mm_setzero_si128()));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i cvtepu16_epi32(__m128i epu16) {\n        return _mm_unpacklo_epi16(epu16, _mm_setzero_si128());\n    }\n    Vc_INTRINSIC Vc_CONST __m128i cvtepi16_epi32(__m128i epu16) {\n        return _mm_unpacklo_epi16(epu16, _mm_cmplt_epi16(epu16, _mm_setzero_si128()));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i cvtepu8_epi32(__m128i epu8) {\n        return cvtepu16_epi32(cvtepu8_epi16(epu8));\n    }\n    Vc_INTRINSIC Vc_CONST __m128i cvtepi8_epi32(__m128i epi8) {\n        const __m128i neg = _mm_cmplt_epi8(epi8, _mm_setzero_si128());\n        const __m128i epi16 = _mm_unpacklo_epi8(epi8, neg);\n        return _mm_unpacklo_epi16(epi16, _mm_unpacklo_epi8(neg, neg));\n    }\n}  // namespace SseIntrinsics\n}  // namespace Vc\n#endif\n\n// SSE4.2\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SseIntrinsics\n{\n    static Vc_INTRINSIC Vc_PURE __m128  _mm_stream_load(const float *mem) {\n#ifdef Vc_IMPL_SSE4_1\n        return _mm_castsi128_ps(_mm_stream_load_si128(reinterpret_cast<__m128i *>(const_cast<float *>(mem))));\n#else\n        return _mm_load_ps(mem);\n#endif\n    }\n    static Vc_INTRINSIC Vc_PURE __m128d _mm_stream_load(const double *mem) {\n#ifdef Vc_IMPL_SSE4_1\n        return _mm_castsi128_pd(_mm_stream_load_si128(reinterpret_cast<__m128i *>(const_cast<double *>(mem))));\n#else\n        return _mm_load_pd(mem);\n#endif\n    }\n    static Vc_INTRINSIC Vc_PURE __m128i _mm_stream_load(const int *mem) {\n#ifdef Vc_IMPL_SSE4_1\n        return _mm_stream_load_si128(reinterpret_cast<__m128i *>(const_cast<int *>(mem)));\n#else\n        return _mm_load_si128(reinterpret_cast<const __m128i *>(mem));\n#endif\n    }\n    static Vc_INTRINSIC Vc_PURE __m128i _mm_stream_load(const unsigned int *mem) {\n        return _mm_stream_load(reinterpret_cast<const int *>(mem));\n    }\n    static Vc_INTRINSIC Vc_PURE __m128i _mm_stream_load(const short *mem) {\n        return _mm_stream_load(reinterpret_cast<const int *>(mem));\n    }\n    static Vc_INTRINSIC Vc_PURE __m128i _mm_stream_load(const unsigned short *mem) {\n        return _mm_stream_load(reinterpret_cast<const int *>(mem));\n    }\n    static Vc_INTRINSIC Vc_PURE __m128i _mm_stream_load(const signed char *mem) {\n        return _mm_stream_load(reinterpret_cast<const int *>(mem));\n    }\n    static Vc_INTRINSIC Vc_PURE __m128i _mm_stream_load(const unsigned char *mem) {\n        return _mm_stream_load(reinterpret_cast<const int *>(mem));\n    }\n\n#ifndef __x86_64__\n    Vc_INTRINSIC Vc_PURE __m128i _mm_cvtsi64_si128(int64_t x) {\n        return _mm_castpd_si128(_mm_load_sd(reinterpret_cast<const double *>(&x)));\n    }\n#endif\n\n#ifdef Vc_IMPL_AVX2\ntemplate <int Scale> __m128 gather(const float *addr, __m128i idx)\n{\n    return _mm_i32gather_ps(addr, idx, Scale);\n}\ntemplate <int Scale> __m128d gather(const double *addr, __m128i idx)\n{\n    return _mm_i32gather_pd(addr, idx, Scale);\n}\ntemplate <int Scale> __m128i gather(const int *addr, __m128i idx)\n{\n    return _mm_i32gather_epi32(addr, idx, Scale);\n}\ntemplate <int Scale> __m128i gather(const unsigned *addr, __m128i idx)\n{\n    return _mm_i32gather_epi32(aliasing_cast<int>(addr), idx, Scale);\n}\n\ntemplate <int Scale> __m128 gather(__m128 src, __m128 k, const float *addr, __m128i idx)\n{\n    return _mm_mask_i32gather_ps(src, addr, idx, k, Scale);\n}\ntemplate <int Scale>\n__m128d gather(__m128d src, __m128d k, const double *addr, __m128i idx)\n{\n    return _mm_mask_i32gather_pd(src, addr, idx, k, Scale);\n}\ntemplate <int Scale> __m128i gather(__m128i src, __m128i k, const int *addr, __m128i idx)\n{\n    return _mm_mask_i32gather_epi32(src, addr, idx, k, Scale);\n}\ntemplate <int Scale>\n__m128i gather(__m128i src, __m128i k, const unsigned *addr, __m128i idx)\n{\n    return _mm_mask_i32gather_epi32(src, aliasing_cast<int>(addr), idx, k, Scale);\n}\n#endif\n\n}  // namespace SseIntrinsics\n}  // namespace Vc\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\nusing namespace SseIntrinsics;\n\ntemplate <typename T> struct ParameterHelper\n{\n    typedef T ByValue;\n    typedef T &Reference;\n    typedef const T &ConstRef;\n};\n\ntemplate <typename T> struct VectorHelper\n{\n};\n\ntemplate <typename T> struct VectorTypeHelper\n{\n    typedef __m128i Type;\n};\ntemplate <> struct VectorTypeHelper<double>\n{\n    typedef __m128d Type;\n};\ntemplate <> struct VectorTypeHelper<float>\n{\n    typedef __m128 Type;\n};\n\ntemplate <typename T> struct DetermineGatherMask\n{\n    typedef T Type;\n};\n\ntemplate <typename T> struct VectorTraits\n{\n    typedef typename VectorTypeHelper<T>::Type VectorType;\n    using EntryType = T;\n    static constexpr size_t Size = sizeof(VectorType) / sizeof(EntryType);\n    typedef Mask<T> MaskType;\n    typedef typename DetermineGatherMask<MaskType>::Type GatherMaskType;\n    typedef Common::VectorMemoryUnion<VectorType, EntryType> StorageType;\n};\n\ntemplate <typename T> struct VectorHelperSize;\n}  // namespace SSE\n}  // namespace Vc\n\n#if defined(Vc_GCC) && !defined(__OPTIMIZE__)\n#pragma GCC diagnostic pop\n#endif\n\n#include \"shuffle.h\"\n\n#endif // VC_SSE_INTRINSICS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/limits.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_LIMITS_H_\n#define VC_SSE_LIMITS_H_\n\n#include \"intrinsics.h\"\n#include \"types.h\"\n#include \"macros.h\"\n\nnamespace std\n{\ntemplate<> struct numeric_limits< ::Vc::SSE::ushort_v> : public numeric_limits<unsigned short>\n{\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v max()           Vc_NOEXCEPT { return ::Vc::SSE::_mm_setallone_si128(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v min()           Vc_NOEXCEPT { return ::Vc::SSE::ushort_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v lowest()        Vc_NOEXCEPT { return min(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v epsilon()       Vc_NOEXCEPT { return ::Vc::SSE::ushort_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v round_error()   Vc_NOEXCEPT { return ::Vc::SSE::ushort_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v infinity()      Vc_NOEXCEPT { return ::Vc::SSE::ushort_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v quiet_NaN()     Vc_NOEXCEPT { return ::Vc::SSE::ushort_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v signaling_NaN() Vc_NOEXCEPT { return ::Vc::SSE::ushort_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::ushort_v denorm_min()    Vc_NOEXCEPT { return ::Vc::SSE::ushort_v::Zero(); }\n};\ntemplate<> struct numeric_limits< ::Vc::SSE::short_v> : public numeric_limits<short>\n{\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v max()           Vc_NOEXCEPT { return _mm_srli_epi16(::Vc::SSE::_mm_setallone_si128(), 1); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v min()           Vc_NOEXCEPT { return ::Vc::SSE::setmin_epi16(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v lowest()        Vc_NOEXCEPT { return min(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v epsilon()       Vc_NOEXCEPT { return ::Vc::SSE::short_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v round_error()   Vc_NOEXCEPT { return ::Vc::SSE::short_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v infinity()      Vc_NOEXCEPT { return ::Vc::SSE::short_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v quiet_NaN()     Vc_NOEXCEPT { return ::Vc::SSE::short_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v signaling_NaN() Vc_NOEXCEPT { return ::Vc::SSE::short_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::short_v denorm_min()    Vc_NOEXCEPT { return ::Vc::SSE::short_v::Zero(); }\n};\ntemplate<> struct numeric_limits< ::Vc::SSE::uint_v> : public numeric_limits<unsigned int>\n{\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v max()           Vc_NOEXCEPT { return ::Vc::SSE::_mm_setallone_si128(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v min()           Vc_NOEXCEPT { return ::Vc::SSE::uint_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v lowest()        Vc_NOEXCEPT { return min(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v epsilon()       Vc_NOEXCEPT { return ::Vc::SSE::uint_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v round_error()   Vc_NOEXCEPT { return ::Vc::SSE::uint_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v infinity()      Vc_NOEXCEPT { return ::Vc::SSE::uint_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v quiet_NaN()     Vc_NOEXCEPT { return ::Vc::SSE::uint_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v signaling_NaN() Vc_NOEXCEPT { return ::Vc::SSE::uint_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::uint_v denorm_min()    Vc_NOEXCEPT { return ::Vc::SSE::uint_v::Zero(); }\n};\ntemplate<> struct numeric_limits< ::Vc::SSE::int_v> : public numeric_limits<int>\n{\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v max()           Vc_NOEXCEPT { return _mm_srli_epi32(::Vc::SSE::_mm_setallone_si128(), 1); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v min()           Vc_NOEXCEPT { return ::Vc::SSE::setmin_epi32(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v lowest()        Vc_NOEXCEPT { return min(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v epsilon()       Vc_NOEXCEPT { return ::Vc::SSE::int_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v round_error()   Vc_NOEXCEPT { return ::Vc::SSE::int_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v infinity()      Vc_NOEXCEPT { return ::Vc::SSE::int_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v quiet_NaN()     Vc_NOEXCEPT { return ::Vc::SSE::int_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v signaling_NaN() Vc_NOEXCEPT { return ::Vc::SSE::int_v::Zero(); }\n    static Vc_INTRINSIC Vc_CONST ::Vc::SSE::int_v denorm_min()    Vc_NOEXCEPT { return ::Vc::SSE::int_v::Zero(); }\n};\n} // namespace std\n\n#endif // VC_SSE_LIMITS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/macros.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"../common/macros.h\"\n\n#ifndef VC_SSE_MACROS_H_\n#define VC_SSE_MACROS_H_\n\n#if defined(Vc_IMPL_SSE4_1) && !defined(Vc_DISABLE_PTEST)\n#define Vc_USE_PTEST\n#endif\n\n#endif // VC_SSE_MACROS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/mask.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_MASK_H_\n#define VC_SSE_MASK_H_\n\n#include \"intrinsics.h\"\n#include \"../common/maskbool.h\"\n#include \"detail.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <size_t Size>\nVc_INTRINSIC_L Vc_CONST_L int mask_count(__m128i) Vc_INTRINSIC_R Vc_CONST_R;\ntemplate <size_t Size>\nVc_INTRINSIC_L Vc_CONST_L int mask_to_int(__m128i) Vc_INTRINSIC_R Vc_CONST_R;\ntemplate <size_t Size>\nVc_INTRINSIC_L Vc_CONST_L bool is_equal(__m128, __m128) Vc_INTRINSIC_R Vc_CONST_R;\ntemplate <size_t Size>\nVc_INTRINSIC_L Vc_CONST_L bool is_not_equal(__m128, __m128) Vc_INTRINSIC_R Vc_CONST_R;\n}  // namespace Detail\n\nusing SSE::sse_cast;\n\ntemplate <typename T> class Mask<T, VectorAbi::Sse>\n{\n    using abi = VectorAbi::Sse;\n    friend class Mask<  double, abi>;\n    friend class Mask<   float, abi>;\n    friend class Mask< int32_t, abi>;\n    friend class Mask<uint32_t, abi>;\n    friend class Mask< int16_t, abi>;\n    friend class Mask<uint16_t, abi>;\n\n    /**\n     * A helper type for aliasing the entries in the mask but behaving like a bool.\n     */\n    typedef Common::MaskBool<sizeof(T)> MaskBool;\n\n    typedef Common::Storage<T, SSE::VectorTraits<T>::Size> Storage;\n\npublic:\n\n    /**\n     * The \\c EntryType of masks is always bool, independent of \\c T.\n     */\n    typedef bool EntryType;\n    using value_type = EntryType;\n\n    /**\n     * The return type of the non-const subscript operator.\n     */\n    using EntryReference = Detail::ElementReference<Mask>;\n    using reference = EntryReference;\n\n    /**\n     * The \\c VectorEntryType, in contrast to \\c EntryType, reveals information about the SIMD\n     * implementation. This type is useful for the \\c sizeof operator in generic functions.\n     */\n    typedef MaskBool VectorEntryType;\n\n    /**\n     * The \\c VectorType reveals the implementation-specific internal type used for the SIMD type.\n     */\n    using VectorType = typename Storage::VectorType;\n\n    /**\n     * The associated Vector<T> type.\n     */\n    using Vector = SSE::Vector<T>;\n\npublic:\n    Vc_FREE_STORE_OPERATORS_ALIGNED(16);\n    static constexpr size_t Size = SSE::VectorTraits<T>::Size;\n    static constexpr size_t MemoryAlignment = Size;\n    static constexpr std::size_t size() { return Size; }\n\n        // abstracts the way Masks are passed to functions, it can easily be changed to const ref here\n#if defined Vc_MSVC && defined _WIN32\n        typedef const Mask &Argument;\n#else\n        typedef Mask Argument;\n#endif\n\n        Vc_INTRINSIC Mask() = default;\n        Vc_INTRINSIC Mask(const Mask &) = default;\n        Vc_INTRINSIC Mask &operator=(const Mask &) = default;\n\n        Vc_INTRINSIC Mask(const __m128  &x) : d(sse_cast<VectorType>(x)) {}\n        Vc_INTRINSIC Mask(const __m128d &x) : d(sse_cast<VectorType>(x)) {}\n        Vc_INTRINSIC Mask(const __m128i &x) : d(sse_cast<VectorType>(x)) {}\n        Vc_INTRINSIC explicit Mask(VectorSpecialInitializerZero) : Mask(_mm_setzero_ps()) {}\n        Vc_INTRINSIC explicit Mask(VectorSpecialInitializerOne) : Mask(SSE::_mm_setallone_ps()) {}\n        Vc_INTRINSIC explicit Mask(bool b) : Mask(b ? SSE::_mm_setallone_ps() : _mm_setzero_ps()) {}\n        Vc_INTRINSIC static Mask Zero() { return Mask{Vc::Zero}; }\n        Vc_INTRINSIC static Mask One() { return Mask{Vc::One}; }\n\n        // implicit cast\n        template <typename U>\n        Vc_INTRINSIC Mask(\n            U &&rhs, Common::enable_if_mask_converts_implicitly<Mask, T, U> = nullarg)\n            : d(sse_cast<VectorType>(\n                  Detail::mask_cast<Traits::simd_vector_size<U>::value, Size, __m128>(\n                      rhs.dataI())))\n        {\n        }\n\n#if Vc_IS_VERSION_1\n        // explicit cast, implemented via simd_cast (implementation in sse/simd_cast.h)\n        template <typename U>\n        Vc_DEPRECATED(\"use simd_cast instead of explicit type casting to convert between \"\n                      \"mask types\") Vc_INTRINSIC\n            explicit Mask(U &&rhs,\n                          Common::enable_if_mask_converts_explicitly<T, U> = nullarg);\n#endif\n\n        Vc_ALWAYS_INLINE explicit Mask(const bool *mem) { load(mem); }\n        template<typename Flags> Vc_ALWAYS_INLINE explicit Mask(const bool *mem, Flags f) { load(mem, f); }\n\n        Vc_ALWAYS_INLINE_L void load(const bool *mem) Vc_ALWAYS_INLINE_R;\n        template<typename Flags> Vc_ALWAYS_INLINE void load(const bool *mem, Flags) { load(mem); }\n\n        Vc_ALWAYS_INLINE_L void store(bool *) const Vc_ALWAYS_INLINE_R;\n        template<typename Flags> Vc_ALWAYS_INLINE void store(bool *mem, Flags) const { store(mem); }\n\n        Vc_ALWAYS_INLINE Vc_PURE bool operator==(const Mask &rhs) const\n        {\n            return Detail::is_equal<Size>(dataF(), rhs.dataF());\n        }\n        Vc_ALWAYS_INLINE Vc_PURE bool operator!=(const Mask &rhs) const\n        {\n            return Detail::is_not_equal<Size>(dataF(), rhs.dataF());\n        }\n\n        Vc_ALWAYS_INLINE Vc_PURE Mask operator!() const\n        {\n#ifdef Vc_GCC\n            return ~dataI();\n#else\n            return _mm_andnot_si128(dataI(), SSE::_mm_setallone_si128());\n#endif\n        }\n\n        Vc_ALWAYS_INLINE Mask &operator&=(const Mask &rhs) { d.v() = SSE::sse_cast<VectorType>(_mm_and_ps(dataF(), rhs.dataF())); return *this; }\n        Vc_ALWAYS_INLINE Mask &operator|=(const Mask &rhs) { d.v() = SSE::sse_cast<VectorType>(_mm_or_ps (dataF(), rhs.dataF())); return *this; }\n        Vc_ALWAYS_INLINE Mask &operator^=(const Mask &rhs) { d.v() = SSE::sse_cast<VectorType>(_mm_xor_ps(dataF(), rhs.dataF())); return *this; }\n\n        Vc_ALWAYS_INLINE Vc_PURE Mask operator&(const Mask &rhs) const { return _mm_and_ps(dataF(), rhs.dataF()); }\n        Vc_ALWAYS_INLINE Vc_PURE Mask operator|(const Mask &rhs) const { return _mm_or_ps (dataF(), rhs.dataF()); }\n        Vc_ALWAYS_INLINE Vc_PURE Mask operator^(const Mask &rhs) const { return _mm_xor_ps(dataF(), rhs.dataF()); }\n\n        Vc_ALWAYS_INLINE Vc_PURE Mask operator&&(const Mask &rhs) const { return _mm_and_ps(dataF(), rhs.dataF()); }\n        Vc_ALWAYS_INLINE Vc_PURE Mask operator||(const Mask &rhs) const { return _mm_or_ps (dataF(), rhs.dataF()); }\n\n        Vc_ALWAYS_INLINE Vc_PURE bool isFull () const { return\n#ifdef Vc_USE_PTEST\n            _mm_testc_si128(dataI(), SSE::_mm_setallone_si128()); // return 1 if (0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff) == (~0 & d.v())\n#else\n            _mm_movemask_epi8(dataI()) == 0xffff;\n#endif\n        }\n        Vc_ALWAYS_INLINE Vc_PURE bool isNotEmpty() const { return\n#ifdef Vc_USE_PTEST\n            0 == _mm_testz_si128(dataI(), dataI()); // return 1 if (0, 0, 0, 0) == (d.v() & d.v())\n#else\n            _mm_movemask_epi8(dataI()) != 0x0000;\n#endif\n        }\n        Vc_ALWAYS_INLINE Vc_PURE bool isEmpty() const { return\n#ifdef Vc_USE_PTEST\n            0 != _mm_testz_si128(dataI(), dataI()); // return 1 if (0, 0, 0, 0) == (d.v() & d.v())\n#else\n            _mm_movemask_epi8(dataI()) == 0x0000;\n#endif\n        }\n        Vc_ALWAYS_INLINE Vc_PURE bool isMix() const {\n#ifdef Vc_USE_PTEST\n            return _mm_test_mix_ones_zeros(dataI(), SSE::_mm_setallone_si128());\n#else\n            const int tmp = _mm_movemask_epi8(dataI());\n            return tmp != 0 && (tmp ^ 0xffff) != 0;\n#endif\n        }\n\n        Vc_ALWAYS_INLINE Vc_PURE int shiftMask() const { return _mm_movemask_epi8(dataI()); }\n\n        Vc_ALWAYS_INLINE Vc_PURE int toInt() const { return Detail::mask_to_int<Size>(dataI()); }\n\n        Vc_ALWAYS_INLINE Vc_PURE VectorType  data() const { return d.v(); }\n        Vc_ALWAYS_INLINE Vc_PURE __m128  dataF() const { return SSE::sse_cast<__m128 >(d.v()); }\n        Vc_ALWAYS_INLINE Vc_PURE __m128i dataI() const { return SSE::sse_cast<__m128i>(d.v()); }\n        Vc_ALWAYS_INLINE Vc_PURE __m128d dataD() const { return SSE::sse_cast<__m128d>(d.v()); }\n\nprivate:\n    friend reference;\n    static Vc_INTRINSIC Vc_PURE value_type get(const Mask &m, int i) noexcept\n    {\n        return m.toInt() & (1 << i);\n    }\n    template <typename U>\n    static Vc_INTRINSIC void set(Mask &m, int i,\n                                 U &&v) noexcept(noexcept(MaskBool(std::declval<U>())))\n    {\n        m.d.set(i, MaskBool(std::forward<U>(v)));\n    }\n\npublic:\n    /**\n     * \\note the returned object models the concept of a reference and\n     * as such it can exist longer than the data it is referencing.\n     * \\note to avoid lifetime issues, we strongly advice not to store\n     * any reference objects.\n     */\n    Vc_ALWAYS_INLINE reference operator[](size_t index) noexcept\n    {\n        return {*this, int(index)};\n    }\n    Vc_ALWAYS_INLINE Vc_PURE value_type operator[](size_t index) const noexcept\n    {\n        return get(*this, index);\n    }\n\n        Vc_ALWAYS_INLINE Vc_PURE int count() const\n        {\n            return Detail::mask_count<Size>(dataI());\n        }\n\n        /**\n         * Returns the index of the first one in the mask.\n         *\n         * The return value is undefined if the mask is empty.\n         */\n        Vc_ALWAYS_INLINE_L Vc_PURE_L int firstOne() const Vc_ALWAYS_INLINE_R Vc_PURE_R;\n\n        template <typename G> static Vc_INTRINSIC_L Mask generate(G &&gen) Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vc_PURE_L Mask shifted(int amount) const Vc_INTRINSIC_R Vc_PURE_R;\n\n    private:\n#ifdef Vc_COMPILE_BENCHMARKS\n    public:\n#endif\n        Storage d;\n};\ntemplate <typename T> constexpr size_t Mask<T, VectorAbi::Sse>::Size;\ntemplate <typename T> constexpr size_t Mask<T, VectorAbi::Sse>::MemoryAlignment;\n\n}  // namespace Vc\n\n#include \"mask.tcc\"\n\n#endif // VC_SSE_MASK_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/mask.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n/*mask_count{{{*/\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_count<2>(__m128i k)\n{\n    int mask = _mm_movemask_pd(_mm_castsi128_pd(k));\n    return (mask & 1) + (mask >> 1);\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_count<4>(__m128i k)\n{\n#ifdef Vc_IMPL_POPCNT\n    return _mm_popcnt_u32(_mm_movemask_ps(_mm_castsi128_ps(k)));\n#else\n    auto x = _mm_srli_epi32(k, 31);\n    x = _mm_add_epi32(x, _mm_shuffle_epi32(x, _MM_SHUFFLE(0, 1, 2, 3)));\n    x = _mm_add_epi32(x, _mm_shufflelo_epi16(x, _MM_SHUFFLE(1, 0, 3, 2)));\n    return _mm_cvtsi128_si32(x);\n#endif\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_count<8>(__m128i k)\n{\n#ifdef Vc_IMPL_POPCNT\n    return _mm_popcnt_u32(_mm_movemask_epi8(k)) / 2;\n#else\n    auto x = _mm_srli_epi16(k, 15);\n    x = _mm_add_epi16(x, _mm_shuffle_epi32(x, _MM_SHUFFLE(0, 1, 2, 3)));\n    x = _mm_add_epi16(x, _mm_shufflelo_epi16(x, _MM_SHUFFLE(0, 1, 2, 3)));\n    x = _mm_add_epi16(x, _mm_shufflelo_epi16(x, _MM_SHUFFLE(2, 3, 0, 1)));\n    return _mm_extract_epi16(x, 0);\n#endif\n}\n\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_count<16>(__m128i k)\n{\n    return Detail::popcnt16(_mm_movemask_epi8(k));\n}\n/*}}}*/\n// mask_to_int/*{{{*/\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_to_int<2>(__m128i k)\n{\n    return _mm_movemask_pd(_mm_castsi128_pd(k));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_to_int<4>(__m128i k)\n{\n    return _mm_movemask_ps(_mm_castsi128_ps(k));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_to_int<8>(__m128i k)\n{\n    return _mm_movemask_epi8(_mm_packs_epi16(k, _mm_setzero_si128()));\n}\ntemplate<> Vc_INTRINSIC Vc_CONST int mask_to_int<16>(__m128i k)\n{\n    return _mm_movemask_epi8(k);\n}\n/*}}}*/\n// mask_store/*{{{*/\ntemplate <size_t> Vc_ALWAYS_INLINE void mask_store(__m128i k, bool *mem);\ntemplate <> Vc_ALWAYS_INLINE void mask_store<16>(__m128i k, bool *mem)\n{\n    _mm_store_si128(reinterpret_cast<__m128i *>(mem), _mm_and_si128(k, _mm_set1_epi8(1)));\n}\ntemplate <> Vc_ALWAYS_INLINE void mask_store<8>(__m128i k, bool *mem)\n{\n    k = _mm_srli_epi16(k, 15);\n    const auto k2 = _mm_packs_epi16(k, _mm_setzero_si128());\n#ifdef __x86_64__\n    *aliasing_cast<int64_t>(mem) = _mm_cvtsi128_si64(k2);\n#else\n    _mm_store_sd(aliasing_cast<double>(mem), _mm_castsi128_pd(k2));\n#endif\n}\ntemplate <> Vc_ALWAYS_INLINE void mask_store<4>(__m128i k, bool *mem)\n{\n    *aliasing_cast<int32_t>(mem) = _mm_cvtsi128_si32(\n        _mm_packs_epi16(_mm_srli_epi16(_mm_packs_epi32(k, _mm_setzero_si128()), 15),\n                        _mm_setzero_si128()));\n}\ntemplate <> Vc_ALWAYS_INLINE void mask_store<2>(__m128i k, bool *mem)\n{\n    mem[0] = -SseIntrinsics::extract_epi32<1>(k);\n    mem[1] = -SseIntrinsics::extract_epi32<3>(k);\n}\n/*}}}*/\n// mask_load/*{{{*/\ntemplate<size_t> Vc_ALWAYS_INLINE __m128 mask_load(const bool *mem);\ntemplate<> Vc_ALWAYS_INLINE __m128 mask_load<16>(const bool *mem)\n{\n    return sse_cast<__m128>(_mm_cmpgt_epi8(\n        _mm_load_si128(reinterpret_cast<const __m128i *>(mem)), _mm_setzero_si128()));\n}\ntemplate<> Vc_ALWAYS_INLINE __m128 mask_load<8>(const bool *mem)\n{\n#ifdef __x86_64__\n    __m128i k = _mm_cvtsi64_si128(*reinterpret_cast<const int64_t *>(mem));\n#else\n    __m128i k = _mm_castpd_si128(_mm_load_sd(reinterpret_cast<const double *>(mem)));\n#endif\n    return sse_cast<__m128>(_mm_cmpgt_epi16(_mm_unpacklo_epi8(k, k), _mm_setzero_si128()));\n}\ntemplate<> Vc_ALWAYS_INLINE __m128 mask_load<4>(const bool *mem)\n{\n    __m128i k = _mm_cvtsi32_si128(*reinterpret_cast<const int *>(mem));\n    k = _mm_cmpgt_epi16(_mm_unpacklo_epi8(k, k), _mm_setzero_si128());\n    return sse_cast<__m128>(_mm_unpacklo_epi16(k, k));\n}\ntemplate<> Vc_ALWAYS_INLINE __m128 mask_load<2>(const bool *mem)\n{\n    return sse_cast<__m128>(\n        _mm_set_epi32(-int(mem[1]), -int(mem[1]), -int(mem[0]), -int(mem[0])));\n}\n/*}}}*/\n// is_equal{{{\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_equal<2>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_pd(_mm_castps_pd(k1)) == _mm_movemask_pd(_mm_castps_pd(k2));\n}\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_not_equal<2>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_pd(_mm_castps_pd(k1)) != _mm_movemask_pd(_mm_castps_pd(k2));\n}\n\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_equal<4>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_ps(k1) == _mm_movemask_ps(k2);\n}\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_not_equal<4>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_ps(k1) != _mm_movemask_ps(k2);\n}\n\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_equal<8>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_epi8(_mm_castps_si128(k1)) ==\n           _mm_movemask_epi8(_mm_castps_si128(k2));\n}\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_not_equal<8>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_epi8(_mm_castps_si128(k1)) !=\n           _mm_movemask_epi8(_mm_castps_si128(k2));\n}\n\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_equal<16>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_epi8(_mm_castps_si128(k1)) ==\n           _mm_movemask_epi8(_mm_castps_si128(k2));\n}\ntemplate <> Vc_INTRINSIC Vc_CONST bool is_not_equal<16>(__m128 k1, __m128 k2)\n{\n    return _mm_movemask_epi8(_mm_castps_si128(k1)) !=\n           _mm_movemask_epi8(_mm_castps_si128(k2));\n}\n\n// }}}\n}  // namespace Detail\n\ntemplate<> Vc_ALWAYS_INLINE void SSE::double_m::store(bool *mem) const\n{\n    *aliasing_cast<uint16_t>(mem) = _mm_movemask_epi8(dataI()) & 0x0101;\n}\ntemplate<typename T> Vc_ALWAYS_INLINE void Mask<T, VectorAbi::Sse>::store(bool *mem) const\n{\n    Detail::mask_store<Size>(dataI(), mem);\n}\ntemplate<> Vc_ALWAYS_INLINE void SSE::double_m::load(const bool *mem)\n{\n    d.set(0, MaskBool(mem[0]));\n    d.set(1, MaskBool(mem[1]));\n}\ntemplate <typename T> Vc_ALWAYS_INLINE void Mask<T, VectorAbi::Sse>::load(const bool *mem)\n{\n    d.v() = sse_cast<VectorType>(Detail::mask_load<Size>(mem));\n}\n\n// get / operator[] {{{1\ntemplate <>\nVc_INTRINSIC Vc_PURE bool SSE::short_m::get(const SSE::short_m &m, int index) noexcept\n{\n    return m.shiftMask() & (1 << 2 * index);\n}\ntemplate <>\nVc_INTRINSIC Vc_PURE bool SSE::ushort_m::get(const SSE::ushort_m &m, int index) noexcept\n{\n    return m.shiftMask() & (1 << 2 * index);\n}\n\n// firstOne {{{1\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE int Mask<T, VectorAbi::Sse>::firstOne() const\n{\n    const int mask = toInt();\n#ifdef _MSC_VER\n    unsigned long bit;\n    _BitScanForward(&bit, mask);\n#else\n    int bit;\n    __asm__(\"bsf %1,%0\" : \"=&r\"(bit) : \"r\"(mask));\n#endif\n    return bit;\n}\n\n// generate {{{1\ntemplate <typename M, typename G>\nVc_INTRINSIC M generate_impl(G &&gen, std::integral_constant<int, 2>)\n{\n    return _mm_set_epi64x(gen(1) ? 0xffffffffffffffffull : 0,\n                          gen(0) ? 0xffffffffffffffffull : 0);\n}\ntemplate <typename M, typename G>\nVc_INTRINSIC M generate_impl(G &&gen, std::integral_constant<int, 4>)\n{\n    return _mm_setr_epi32(gen(0) ? 0xfffffffful : 0, gen(1) ? 0xfffffffful : 0,\n                          gen(2) ? 0xfffffffful : 0, gen(3) ? 0xfffffffful : 0);\n}\ntemplate <typename M, typename G>\nVc_INTRINSIC M generate_impl(G &&gen, std::integral_constant<int, 8>)\n{\n    return _mm_setr_epi16(gen(0) ? 0xffffu : 0, gen(1) ? 0xffffu : 0,\n                          gen(2) ? 0xffffu : 0, gen(3) ? 0xffffu : 0,\n                          gen(4) ? 0xffffu : 0, gen(5) ? 0xffffu : 0,\n                          gen(6) ? 0xffffu : 0, gen(7) ? 0xffffu : 0);\n}\ntemplate <typename T>\ntemplate <typename G>\nVc_INTRINSIC Mask<T, VectorAbi::Sse> Mask<T, VectorAbi::Sse>::generate(G &&gen)\n{\n    return generate_impl<Mask<T, VectorAbi::Sse>>(std::forward<G>(gen),\n                                  std::integral_constant<int, Size>());\n}\n// shifted {{{1\ntemplate <typename T> Vc_INTRINSIC Vc_PURE Mask<T, VectorAbi::Sse> Mask<T, VectorAbi::Sse>::shifted(int amount) const\n{\n    switch (amount * int(sizeof(VectorEntryType))) {\n    case   0: return *this;\n    case   1: return Detail::shifted<  1>(dataI());\n    case   2: return Detail::shifted<  2>(dataI());\n    case   3: return Detail::shifted<  3>(dataI());\n    case   4: return Detail::shifted<  4>(dataI());\n    case   5: return Detail::shifted<  5>(dataI());\n    case   6: return Detail::shifted<  6>(dataI());\n    case   7: return Detail::shifted<  7>(dataI());\n    case   8: return Detail::shifted<  8>(dataI());\n    case   9: return Detail::shifted<  9>(dataI());\n    case  10: return Detail::shifted< 10>(dataI());\n    case  11: return Detail::shifted< 11>(dataI());\n    case  12: return Detail::shifted< 12>(dataI());\n    case  13: return Detail::shifted< 13>(dataI());\n    case  14: return Detail::shifted< 14>(dataI());\n    case  15: return Detail::shifted< 15>(dataI());\n    case  16: return Detail::shifted< 16>(dataI());\n    case  -1: return Detail::shifted< -1>(dataI());\n    case  -2: return Detail::shifted< -2>(dataI());\n    case  -3: return Detail::shifted< -3>(dataI());\n    case  -4: return Detail::shifted< -4>(dataI());\n    case  -5: return Detail::shifted< -5>(dataI());\n    case  -6: return Detail::shifted< -6>(dataI());\n    case  -7: return Detail::shifted< -7>(dataI());\n    case  -8: return Detail::shifted< -8>(dataI());\n    case  -9: return Detail::shifted< -9>(dataI());\n    case -10: return Detail::shifted<-10>(dataI());\n    case -11: return Detail::shifted<-11>(dataI());\n    case -12: return Detail::shifted<-12>(dataI());\n    case -13: return Detail::shifted<-13>(dataI());\n    case -14: return Detail::shifted<-14>(dataI());\n    case -15: return Detail::shifted<-15>(dataI());\n    case -16: return Detail::shifted<-16>(dataI());\n    }\n    return Zero();\n}\n// }}}1\n\n}\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/math.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_MATH_H_\n#define VC_SSE_MATH_H_\n\n#include \"const.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// copysign {{{1\nVc_INTRINSIC Vc_CONST SSE::float_v copysign(SSE::float_v mag, SSE::float_v sign)\n{\n    return _mm_or_ps(_mm_and_ps(sign.data(), SSE::_mm_setsignmask_ps()),\n                     _mm_and_ps(mag.data(), SSE::_mm_setabsmask_ps()));\n}\nVc_INTRINSIC Vc_CONST SSE::double_v copysign(SSE::double_v mag, SSE::double_v sign)\n{\n    return _mm_or_pd(_mm_and_pd(sign.data(), SSE::_mm_setsignmask_pd()),\n                     _mm_and_pd(mag.data(), SSE::_mm_setabsmask_pd()));\n}\n\n//}}}1\n\n/**\n * splits \\p v into exponent and mantissa, the sign is kept with the mantissa\n *\n * The return value will be in the range [0.5, 1.0[\n * The \\p e value will be an integer defining the power-of-two exponent\n */\ninline SSE::double_v frexp(const SSE::double_v &v,\n                           SimdArray<int, 2, Scalar::int_v, 1> *e)\n{\n    const __m128i exponentBits = SSE::Const<double>::exponentMask().dataI();\n    const __m128i exponentPart = _mm_and_si128(_mm_castpd_si128(v.data()), exponentBits);\n    SSE::int_v exponent =\n        _mm_sub_epi32(_mm_srli_epi64(exponentPart, 52), _mm_set1_epi32(0x3fe));\n    const __m128d exponentMaximized = _mm_or_pd(v.data(), _mm_castsi128_pd(exponentBits));\n    SSE::double_v ret = _mm_and_pd(\n        exponentMaximized,\n        _mm_load_pd(reinterpret_cast<const double *>(&SSE::c_general::frexpMask[0])));\n    SSE::double_m zeroMask = v == SSE::double_v::Zero();\n    ret(isnan(v) || !isfinite(v) || zeroMask) = v;\n    exponent.setZero(zeroMask.data());\n    (*e)[0] = exponent[0];\n    (*e)[1] = exponent[2];\n    return ret;\n}\ninline SSE::float_v frexp(const SSE::float_v &v, SimdArray<int, 4, SSE::int_v, 4> *e)\n{\n    const __m128i exponentBits = SSE::Const<float>::exponentMask().dataI();\n    const __m128i exponentPart = _mm_and_si128(_mm_castps_si128(v.data()), exponentBits);\n    internal_data(*e) =\n        _mm_sub_epi32(_mm_srli_epi32(exponentPart, 23), _mm_set1_epi32(0x7e));\n    const __m128 exponentMaximized = _mm_or_ps(v.data(), _mm_castsi128_ps(exponentBits));\n    SSE::float_v ret =\n        _mm_and_ps(exponentMaximized, _mm_castsi128_ps(_mm_set1_epi32(0xbf7fffffu)));\n    ret(isnan(v) || !isfinite(v) || v == SSE::float_v::Zero()) = v;\n    e->setZero(v == SSE::float_v::Zero());\n    return ret;\n}\n\n/*             -> x * 2^e\n * x == NaN    -> NaN\n * x == (-)inf -> (-)inf\n */\ninline SSE::double_v ldexp(SSE::double_v::AsArg v,\n                           const SimdArray<int, 2, Scalar::int_v, 1> &_e)\n{\n    SSE::int_v e = _mm_setr_epi32(_e[0], 0, _e[1], 0);\n    e.setZero((v == SSE::double_v::Zero()).dataI());\n    const __m128i exponentBits = _mm_slli_epi64(e.data(), 52);\n    return _mm_castsi128_pd(_mm_add_epi64(_mm_castpd_si128(v.data()), exponentBits));\n}\ninline SSE::float_v ldexp(SSE::float_v::AsArg v,\n                          const SimdArray<int, 4, SSE::int_v, 4> &_e)\n{\n    SSE::int_v e = internal_data(_e);\n    e.setZero(simd_cast<SSE::int_m>(v == SSE::float_v::Zero()));\n    return reinterpret_components_cast<SSE::float_v>(\n        reinterpret_components_cast<SSE::int_v>(v) + (e << 23));\n}\n\n#ifdef Vc_IMPL_SSE4_1\ninline SSE::double_v trunc(SSE::double_v::AsArg v) { return _mm_round_pd(v.data(), 0x3); }\ninline SSE::float_v trunc(SSE::float_v::AsArg v) { return _mm_round_ps(v.data(), 0x3); }\n\ninline SSE::double_v floor(SSE::double_v::AsArg v) { return _mm_floor_pd(v.data()); }\ninline SSE::float_v floor(SSE::float_v::AsArg v) { return _mm_floor_ps(v.data()); }\n\ninline SSE::double_v ceil(SSE::double_v::AsArg v) { return _mm_ceil_pd(v.data()); }\ninline SSE::float_v ceil(SSE::float_v::AsArg v) { return _mm_ceil_ps(v.data()); }\n#else\ninline SSE::Vector<float> trunc(SSE::Vector<float> x)\n{\n    const auto truncated = _mm_cvtepi32_ps(_mm_cvttps_epi32(x.data()));\n    const auto no_fractional_values = _mm_castsi128_ps(_mm_cmplt_epi32(\n        _mm_and_si128(_mm_castps_si128(x.data()), _mm_set1_epi32(0x7f800000u)),\n        _mm_set1_epi32(0x4b000000)));  // the exponent is so large that no mantissa bits\n                                       // signify fractional values (0x3f8 + 23*8 = 0x4b0)\n    return _mm_or_ps(_mm_andnot_ps(no_fractional_values, x.data()),\n                     _mm_and_ps(no_fractional_values, truncated));\n}\n\ninline SSE::Vector<double> trunc(SSE::Vector<double> x)\n{\n    const auto abs_x = Vc::abs(x).data();\n    const auto min_no_fractional_bits =\n        _mm_castsi128_pd(_mm_set1_epi64x(0x4330000000000000ull));  // 0x3ff + 52 = 0x433\n    __m128d truncated =\n        _mm_sub_pd(_mm_add_pd(abs_x, min_no_fractional_bits), min_no_fractional_bits);\n    // due to rounding, the result can be too large. In this case `truncated >\n    // abs(x)` holds, so subtract 1 to truncated if `abs(x) < truncated`\n    truncated = _mm_sub_pd(truncated,\n                           _mm_and_pd(_mm_cmplt_pd(abs_x, truncated), _mm_set1_pd(1.)));\n    // finally, fix the sign bit:\n    return _mm_or_pd(\n        _mm_and_pd(_mm_castsi128_pd(_mm_set1_epi64x(0x8000000000000000ull)), x.data()),\n        truncated);\n}\n\ntemplate <typename T> inline SSE::Vector<T> floor(SSE::Vector<T> x)\n{\n    auto y = trunc(x);\n    y(!(y == x) && x < 0) -= 1;\n    return y;\n}\n\ntemplate <typename T> inline SSE::Vector<T> ceil(SSE::Vector<T> x)\n{\n    auto y = trunc(x);\n    y(!(y == x || x < 0)) += 1;\n    return y;\n}\n#endif\n// fma {{{1\ntemplate <typename T>\nVc_ALWAYS_INLINE Vector<T, VectorAbi::Sse> fma(Vector<T, VectorAbi::Sse> a,\n                                               Vector<T, VectorAbi::Sse> b,\n                                               Vector<T, VectorAbi::Sse> c)\n{\n    SSE::VectorHelper<T>::fma(a.data(), b.data(), c.data());\n    return a;\n}\n// }}}1\n}  // namespace Vc\n\n#endif // VC_SSE_MATH_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/prefetches.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_PREFETCHES_TCC_\n#define VC_SSE_PREFETCHES_TCC_\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\nVc_ALWAYS_INLINE void prefetchForOneRead(const void *addr, VectorAbi::Sse)\n{\n    _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_NTA);\n}\nVc_ALWAYS_INLINE void prefetchClose(const void *addr, VectorAbi::Sse)\n{\n    _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T0);\n}\nVc_ALWAYS_INLINE void prefetchMid(const void *addr, VectorAbi::Sse)\n{\n    _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T1);\n}\nVc_ALWAYS_INLINE void prefetchFar(const void *addr, VectorAbi::Sse)\n{\n    _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T2);\n}\nVc_ALWAYS_INLINE void prefetchForModify(const void *addr, VectorAbi::Sse)\n{\n#ifdef __3dNOW__\n    _m_prefetchw(const_cast<void *>(addr));\n#else\n    _mm_prefetch(static_cast<char *>(const_cast<void *>(addr)), _MM_HINT_T0);\n#endif\n}\n}  // namespace Detail\n}  // namespace Vc\n\n#endif // VC_SSE_PREFETCHES_TCC_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/shuffle.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_SHUFFLE_H_\n#define VC_SSE_SHUFFLE_H_\n\n#include \"intrinsics.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n    enum VecPos {\n        X0, X1, X2, X3, X4, X5, X6, X7,\n        Y0, Y1, Y2, Y3, Y4, Y5, Y6, Y7,\n        Const0\n    };\n\nnamespace Mem\n{\n        // shuffle<X1, X2, Y0, Y2>([x0 x1 x2 x3], [y0 y1 y2 y3]) = [x1 x2 y0 y2]\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m128 Vc_CONST shuffle(__m128 x, __m128 y) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= Y0 && Dst3 >= Y0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= Y3 && Dst3 <= Y3, \"Incorrect_Range\");\n            return _mm_shuffle_ps(x, y, Dst0 + Dst1 * 4 + (Dst2 - Y0) * 16 + (Dst3 - Y0) * 64);\n        }\n\n        // shuffle<X1, Y0>([x0 x1], [y0 y1]) = [x1 y0]\n        template<VecPos Dst0, VecPos Dst1> static Vc_ALWAYS_INLINE __m128d Vc_CONST shuffle(__m128d x, __m128d y) {\n            static_assert(Dst0 >= X0 && Dst1 >= Y0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X1 && Dst1 <= Y1, \"Incorrect_Range\");\n            return _mm_shuffle_pd(x, y, Dst0 + (Dst1 - Y0) * 2);\n        }\n\n        // shuffle<X1, X2, Y0, Y2>([x0 x1 x2 x3], [y0 y1 y2 y3]) = [x1 x2 y0 y2]\n        template <VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3>\n        Vc_INTRINSIC Vc_CONST __m128i shuffle(__m128i x, __m128i y)\n        {\n            return _mm_castps_si128(shuffle<Dst0, Dst1, Dst2, Dst3>(_mm_castsi128_ps(x),\n                                                                    _mm_castsi128_ps(y)));\n        }\n\n        // blend<X0, Y1>([x0 x1], [y0, y1]) = [x0 y1]\n        template<VecPos Dst0, VecPos Dst1> static Vc_ALWAYS_INLINE __m128d Vc_CONST blend(__m128d x, __m128d y) {\n            static_assert(Dst0 == X0 || Dst0 == Y0, \"Incorrect_Range\");\n            static_assert(Dst1 == X1 || Dst1 == Y1, \"Incorrect_Range\");\n            return Vc::SseIntrinsics::blend_pd<(Dst0 / Y0) + (Dst1 / Y0) * 2>(x, y);\n        }\n\n        // blend<X0, Y1>([x0 x1], [y0, y1]) = [x0 y1]\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m128 Vc_CONST blend(__m128 x, __m128 y) {\n            static_assert(Dst0 == X0 || Dst0 == Y0, \"Incorrect_Range\");\n            static_assert(Dst1 == X1 || Dst1 == Y1, \"Incorrect_Range\");\n            static_assert(Dst2 == X2 || Dst2 == Y2, \"Incorrect_Range\");\n            static_assert(Dst3 == X3 || Dst3 == Y3, \"Incorrect_Range\");\n            return Vc::SseIntrinsics::blend_ps<(Dst0 / Y0) * 1 + (Dst1 / Y1) * 2 +\n                                               (Dst2 / Y2) * 4 + (Dst3 / Y3) * 8>(x, y);\n        }\n\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3, VecPos Dst4, VecPos Dst5, VecPos Dst6, VecPos Dst7>\n        static Vc_ALWAYS_INLINE __m128i Vc_CONST blend(__m128i x, __m128i y) {\n            static_assert(Dst0 == X0 || Dst0 == Y0, \"Incorrect_Range\");\n            static_assert(Dst1 == X1 || Dst1 == Y1, \"Incorrect_Range\");\n            static_assert(Dst2 == X2 || Dst2 == Y2, \"Incorrect_Range\");\n            static_assert(Dst3 == X3 || Dst3 == Y3, \"Incorrect_Range\");\n            static_assert(Dst4 == X4 || Dst4 == Y4, \"Incorrect_Range\");\n            static_assert(Dst5 == X5 || Dst5 == Y5, \"Incorrect_Range\");\n            static_assert(Dst6 == X6 || Dst6 == Y6, \"Incorrect_Range\");\n            static_assert(Dst7 == X7 || Dst7 == Y7, \"Incorrect_Range\");\n            return Vc::SseIntrinsics::blend_epi16<\n                (Dst0 / Y0) * 1 + (Dst1 / Y1) * 2 + (Dst2 / Y2) * 4 + (Dst3 / Y3) * 8 +\n                (Dst4 / Y4) * 16 + (Dst5 / Y5) * 32 + (Dst6 / Y6) * 64 +\n                (Dst7 / Y7) * 128>(x, y);\n        }\n\n        // permute<X1, X2, Y0, Y2>([x0 x1 x2 x3], [y0 y1 y2 y3]) = [x1 x2 y0 y2]\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m128 Vc_CONST permute(__m128 x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm_shuffle_ps(x, x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n\n        template<VecPos Dst0, VecPos Dst1> static Vc_ALWAYS_INLINE Vc_CONST __m128d permute(__m128d x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X1 && Dst1 <= X1, \"Incorrect_Range\");\n            return _mm_shuffle_pd(x, x, Dst0 + Dst1 * 4);\n        }\n\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m128i Vc_CONST permute(__m128i x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm_shuffle_epi32(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m128i Vc_CONST permuteLo(__m128i x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm_shufflelo_epi16(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3> static Vc_ALWAYS_INLINE __m128i Vc_CONST permuteHi(__m128i x) {\n            static_assert(Dst0 >= X4 && Dst1 >= X4 && Dst2 >= X4 && Dst3 >= X4, \"Incorrect_Range\");\n            static_assert(Dst0 <= X7 && Dst1 <= X7 && Dst2 <= X7 && Dst3 <= X7, \"Incorrect_Range\");\n            return _mm_shufflehi_epi16(x, (Dst0 - X4) + (Dst1 - X4) * 4 + (Dst2 - X4) * 16 + (Dst3 - X4) * 64);\n        }\n\n        template<VecPos Dst0, VecPos Dst1, VecPos Dst2, VecPos Dst3, VecPos Dst4, VecPos Dst5, VecPos Dst6, VecPos Dst7>\n            static Vc_ALWAYS_INLINE __m128i Vc_CONST permute(__m128i x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            static_assert(Dst4 >= X4 && Dst5 >= X4 && Dst6 >= X4 && Dst7 >= X4, \"Incorrect_Range\");\n            static_assert(Dst4 <= X7 && Dst5 <= X7 && Dst6 <= X7 && Dst7 <= X7, \"Incorrect_Range\");\n            if (Dst0 != X0 || Dst1 != X1 || Dst2 != X2 || Dst3 != X3) {\n                x = _mm_shufflelo_epi16(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n            }\n            if (Dst4 != X4 || Dst5 != X5 || Dst6 != X6 || Dst7 != X7) {\n                x = _mm_shufflehi_epi16(x, (Dst4 - X4) + (Dst5 - X4) * 4 + (Dst6 - X4) * 16 + (Dst7 - X4) * 64);\n            }\n            return x;\n        }\n}  // namespace Mem\n\n    // The shuffles and permutes above use memory ordering. The ones below use register ordering:\nnamespace Reg\n{\n        // shuffle<Y2, Y0, X2, X1>([x3 x2 x1 x0], [y3 y2 y1 y0]) = [y2 y0 x2 x1]\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128 Vc_CONST shuffle(__m128 x, __m128 y) {\n            return Mem::shuffle<Dst0, Dst1, Dst2, Dst3>(x, y);\n        }\n\n        // shuffle<Y0, X1>([x1 x0], [y1 y0]) = [y0 x1]\n        template<VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128d Vc_CONST shuffle(__m128d x, __m128d y) {\n            return Mem::shuffle<Dst0, Dst1>(x, y);\n        }\n\n        // shuffle<X3, X0, X2, X1>([x3 x2 x1 x0]) = [x3 x0 x2 x1]\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128i Vc_CONST permute(__m128i x) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= X0 && Dst3 >= X0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= X3 && Dst3 <= X3, \"Incorrect_Range\");\n            return _mm_shuffle_epi32(x, Dst0 + Dst1 * 4 + Dst2 * 16 + Dst3 * 64);\n        }\n\n        // shuffle<Y2, Y0, X2, X1>([x3 x2 x1 x0], [y3 y2 y1 y0]) = [y2 y0 x2 x1]\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128i Vc_CONST shuffle(__m128i x, __m128i y) {\n            static_assert(Dst0 >= X0 && Dst1 >= X0 && Dst2 >= Y0 && Dst3 >= Y0, \"Incorrect_Range\");\n            static_assert(Dst0 <= X3 && Dst1 <= X3 && Dst2 <= Y3 && Dst3 <= Y3, \"Incorrect_Range\");\n            return _mm_castps_si128(_mm_shuffle_ps(_mm_castsi128_ps(x), _mm_castsi128_ps(y), Dst0 + Dst1 * 4 + (Dst2 - Y0) * 16 + (Dst3 - Y0) * 64));\n        }\n\n        // blend<Y1, X0>([x1 x0], [y1, y0]) = [x1 y0]\n        template<VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128d Vc_CONST blend(__m128d x, __m128d y) {\n            return Mem::blend<Dst0, Dst1>(x, y);\n        }\n\n        template<VecPos Dst3, VecPos Dst2, VecPos Dst1, VecPos Dst0> static Vc_ALWAYS_INLINE __m128 Vc_CONST blend(__m128 x, __m128 y) {\n            return Mem::blend<Dst0, Dst1, Dst2, Dst3>(x, y);\n        }\n}  // namespace Reg\n}  // namespace Vc\n\n#endif // VC_SSE_SHUFFLE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/simd_cast.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_SIMD_CAST_H_\n#define VC_SSE_SIMD_CAST_H_\n\n#include \"../common/utility.h\"\n#ifdef Vc_IMPL_AVX\n#include \"../avx/casts.h\"\n#endif\n\n#ifndef VC_SSE_VECTOR_H_\n#error \"Vc/sse/vector.h needs to be included before Vc/sse/simd_cast.h\"\n#endif\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\n\n// Declarations: helper macros Vc_SIMD_CAST_[1248] {{{1\n#define Vc_SIMD_CAST_1(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x, enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_2(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_4(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, from_ x3,                                          \\\n        enable_if<std::is_same<To, to_>::value> = nullarg)\n\n#define Vc_SIMD_CAST_8(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(                                                  \\\n        from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, from_ x5, from_ x6, from_ x7,  \\\n        enable_if<std::is_same<To, to_>::value> = nullarg)\n\n// Declarations: Vector casts without offset {{{1\n// 1 SSE::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_1( float_v,    int_v);\nVc_SIMD_CAST_1(double_v,    int_v);\nVc_SIMD_CAST_1(  uint_v,    int_v);\nVc_SIMD_CAST_1( short_v,    int_v);\nVc_SIMD_CAST_1(ushort_v,    int_v);\nVc_SIMD_CAST_1( float_v,   uint_v);\nVc_SIMD_CAST_1(double_v,   uint_v);\nVc_SIMD_CAST_1(   int_v,   uint_v);\nVc_SIMD_CAST_1( short_v,   uint_v);\nVc_SIMD_CAST_1(ushort_v,   uint_v);\nVc_SIMD_CAST_1(double_v,  float_v);\nVc_SIMD_CAST_1(   int_v,  float_v);\nVc_SIMD_CAST_1(  uint_v,  float_v);\nVc_SIMD_CAST_1( short_v,  float_v);\nVc_SIMD_CAST_1(ushort_v,  float_v);\nVc_SIMD_CAST_1( float_v, double_v);\nVc_SIMD_CAST_1(   int_v, double_v);\nVc_SIMD_CAST_1(  uint_v, double_v);\nVc_SIMD_CAST_1( short_v, double_v);\nVc_SIMD_CAST_1(ushort_v, double_v);\nVc_SIMD_CAST_1(   int_v,  short_v);\nVc_SIMD_CAST_1(  uint_v,  short_v);\nVc_SIMD_CAST_1( float_v,  short_v);\nVc_SIMD_CAST_1(double_v,  short_v);\nVc_SIMD_CAST_1(ushort_v,  short_v);\nVc_SIMD_CAST_1(   int_v, ushort_v);\nVc_SIMD_CAST_1(  uint_v, ushort_v);\nVc_SIMD_CAST_1( float_v, ushort_v);\nVc_SIMD_CAST_1(double_v, ushort_v);\nVc_SIMD_CAST_1( short_v, ushort_v);\n\n// 2 SSE::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_2(double_v,    int_v);\nVc_SIMD_CAST_2(double_v,   uint_v);\nVc_SIMD_CAST_2(double_v,  float_v);\nVc_SIMD_CAST_2(   int_v,  short_v);\nVc_SIMD_CAST_2(  uint_v,  short_v);\nVc_SIMD_CAST_2( float_v,  short_v);\nVc_SIMD_CAST_2(double_v,  short_v);\nVc_SIMD_CAST_2(   int_v, ushort_v);\nVc_SIMD_CAST_2(  uint_v, ushort_v);\nVc_SIMD_CAST_2( float_v, ushort_v);\nVc_SIMD_CAST_2(double_v, ushort_v);\n\n// 3 SSE::Vector to 1 SSE::Vector {{{2\n#define Vc_CAST_(To_)                                                                    \\\n    template <typename Return>                                                           \\\n    Vc_INTRINSIC Vc_CONST enable_if<std::is_same<Return, To_>::value, Return>\nVc_CAST_(short_v) simd_cast(double_v a, double_v b, double_v c);\nVc_CAST_(ushort_v) simd_cast(double_v a, double_v b, double_v c);\n\n// 4 SSE::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_4(double_v,  short_v);\nVc_SIMD_CAST_4(double_v, ushort_v);\n//}}}2\n}  // namespace SSE\nusing SSE::simd_cast;\n\n// 1 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, SSE::double_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, SSE::float_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, SSE::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, SSE::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// 2 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, SSE::double_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, SSE::float_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, SSE::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, SSE::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// 3 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::float_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// 4 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::float_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::int_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::uint_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// 5 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// 6 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// 7 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// 8 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, SSE::short_v>::value> = nullarg);\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, Scalar::Vector<T> x7,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value> = nullarg);\n\n// SSE::Vector to Scalar::Vector {{{2\ntemplate <typename To, typename FromT>\nVc_INTRINSIC Vc_CONST To\nsimd_cast(SSE::Vector<FromT> x, enable_if<Scalar::is_vector<To>::value> = nullarg);\n\n// helper macros Vc_SIMD_CAST_[1248] {{{1\n#undef Vc_SIMD_CAST_1\n#undef Vc_SIMD_CAST_2\n#undef Vc_SIMD_CAST_4\n#undef Vc_SIMD_CAST_8\n#define Vc_SIMD_CAST_1(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x, enable_if<std::is_same<To, to_>::value>)\n\n#define Vc_SIMD_CAST_2(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1,                               \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#define Vc_SIMD_CAST_4(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2, from_ x3,           \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n#define Vc_SIMD_CAST_8(from_, to_)                                                       \\\n    template <typename To>                                                               \\\n    Vc_INTRINSIC Vc_CONST To simd_cast(from_ x0, from_ x1, from_ x2, from_ x3, from_ x4, \\\n                                       from_ x5, from_ x6, from_ x7,                     \\\n                                       enable_if<std::is_same<To, to_>::value>)\n\n// Vector casts without offset {{{1\nnamespace SSE\n{\n// helper functions {{{2\nVc_INTRINSIC __m128i convert_int32_to_int16(__m128i a, __m128i b)\n{\n    auto tmp0 = _mm_unpacklo_epi16(a, b);        // 0 4 X X 1 5 X X\n    auto tmp1 = _mm_unpackhi_epi16(a, b);        // 2 6 X X 3 7 X X\n    auto tmp2 = _mm_unpacklo_epi16(tmp0, tmp1);  // 0 2 4 6 X X X X\n    auto tmp3 = _mm_unpackhi_epi16(tmp0, tmp1);  // 1 3 5 7 X X X X\n    return _mm_unpacklo_epi16(tmp2, tmp3);       // 0 1 2 3 4 5 6 7\n}\n\n// 1 SSE::Vector to 1 SSE::Vector {{{2\n// to int_v {{{3\nVc_SIMD_CAST_1( float_v,    int_v) { return convert< float, int>(x.data()); }\nVc_SIMD_CAST_1(double_v,    int_v) { return convert<double, int>(x.data()); }\nVc_SIMD_CAST_1(  uint_v,    int_v) { return convert<  uint, int>(x.data()); }\nVc_SIMD_CAST_1( short_v,    int_v) { return convert< short, int>(x.data()); }\nVc_SIMD_CAST_1(ushort_v,    int_v) { return convert<ushort, int>(x.data()); }\n// to uint_v {{{3\nVc_SIMD_CAST_1( float_v,   uint_v) { return convert< float, uint>(x.data()); }\nVc_SIMD_CAST_1(double_v,   uint_v) { return convert<double, uint>(x.data()); }\nVc_SIMD_CAST_1(   int_v,   uint_v) { return convert<   int, uint>(x.data()); }\nVc_SIMD_CAST_1( short_v,   uint_v) { return convert< short, uint>(x.data()); }\nVc_SIMD_CAST_1(ushort_v,   uint_v) { return convert<ushort, uint>(x.data()); }\n// to float_v {{{3\nVc_SIMD_CAST_1(double_v,  float_v) { return convert<double, float>(x.data()); }\nVc_SIMD_CAST_1(   int_v,  float_v) { return convert<   int, float>(x.data()); }\nVc_SIMD_CAST_1(  uint_v,  float_v) { return convert<  uint, float>(x.data()); }\nVc_SIMD_CAST_1( short_v,  float_v) { return convert< short, float>(x.data()); }\nVc_SIMD_CAST_1(ushort_v,  float_v) { return convert<ushort, float>(x.data()); }\n// to double_v {{{3\nVc_SIMD_CAST_1( float_v, double_v) { return convert< float, double>(x.data()); }\nVc_SIMD_CAST_1(   int_v, double_v) { return convert<   int, double>(x.data()); }\nVc_SIMD_CAST_1(  uint_v, double_v) { return convert<  uint, double>(x.data()); }\nVc_SIMD_CAST_1( short_v, double_v) { return convert< short, double>(x.data()); }\nVc_SIMD_CAST_1(ushort_v, double_v) { return convert<ushort, double>(x.data()); }\n// to short_v {{{3\n/*\n * §4.7 p3 (integral conversions)\n *  If the destination type is signed, the value is unchanged if it can be represented in the\n *  destination type (and bit-field width); otherwise, the value is implementation-defined.\n *\n * See also below for the Vc_SIMD_CAST_2\n *\n * the alternative, which is probably incorrect for all compilers out there:\n    Vc_SIMD_CAST_1(   int_v,  short_v) { return _mm_packs_epi32(x.data(), _mm_setzero_si128()); }\n    Vc_SIMD_CAST_1(  uint_v,  short_v) { return _mm_packs_epi32(x.data(), _mm_setzero_si128()); }\n    Vc_SIMD_CAST_2(   int_v,  short_v) { return _mm_packs_epi32(x0.data(), x1.data()); }\n    Vc_SIMD_CAST_2(  uint_v,  short_v) { return _mm_packs_epi32(x0.data(), x1.data()); }\n */\nVc_SIMD_CAST_1(   int_v,  short_v) { return SSE::convert_int32_to_int16(x.data(), _mm_setzero_si128()); }\nVc_SIMD_CAST_1(  uint_v,  short_v) { return SSE::convert_int32_to_int16(x.data(), _mm_setzero_si128()); }\nVc_SIMD_CAST_1( float_v,  short_v) { return _mm_packs_epi32(simd_cast<SSE::int_v>(x).data(), _mm_setzero_si128()); }\nVc_SIMD_CAST_1(double_v,  short_v) { return _mm_packs_epi32(simd_cast<SSE::int_v>(x).data(), _mm_setzero_si128()); }\nVc_SIMD_CAST_1(ushort_v,  short_v) { return x.data(); }\n// to ushort_v {{{3\nVc_SIMD_CAST_1(   int_v, ushort_v) { return SSE::convert_int32_to_int16(x.data(), _mm_setzero_si128()); }\nVc_SIMD_CAST_1(  uint_v, ushort_v) { return SSE::convert_int32_to_int16(x.data(), _mm_setzero_si128()); }\nVc_SIMD_CAST_1( float_v, ushort_v) { return simd_cast<SSE::ushort_v>(simd_cast<SSE::int_v>(x)); }\nVc_SIMD_CAST_1(double_v, ushort_v) { return simd_cast<SSE::ushort_v>(simd_cast<SSE::int_v>(x)); }\nVc_SIMD_CAST_1( short_v, ushort_v) { return x.data(); }\n// 2 SSE::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_2(double_v,    int_v) {\n#ifdef Vc_IMPL_AVX\n    return AVX::convert<double, int>(AVX::concat(x0.data(), x1.data()));\n#else\n    return _mm_unpacklo_epi64(convert<double, int>(x0.data()), convert<double, int>(x1.data()));\n#endif\n}\nVc_SIMD_CAST_2(double_v,   uint_v) {\n#ifdef Vc_IMPL_AVX\n    return AVX::convert<double, uint>(AVX::concat(x0.data(), x1.data()));\n#else\n    return _mm_unpacklo_epi64(convert<double, uint>(x0.data()), convert<double, uint>(x1.data()));\n#endif\n}\nVc_SIMD_CAST_2(double_v,  float_v) {\n#ifdef Vc_IMPL_AVX\n    return _mm256_cvtpd_ps(AVX::concat(x0.data(), x1.data()));\n#else\n    return _mm_movelh_ps(_mm_cvtpd_ps(x0.data()), _mm_cvtpd_ps(x1.data()));\n#endif\n}\n\nVc_SIMD_CAST_2(   int_v,  short_v) { return SSE::convert_int32_to_int16(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(  uint_v,  short_v) { return SSE::convert_int32_to_int16(x0.data(), x1.data()); }\nVc_SIMD_CAST_2( float_v,  short_v) { return _mm_packs_epi32(simd_cast<SSE::int_v>(x0).data(), simd_cast<SSE::int_v>(x1).data()); }\nVc_SIMD_CAST_2(double_v,  short_v) { return _mm_packs_epi32(simd_cast<SSE::int_v>(x0, x1).data(), _mm_setzero_si128()); }\n\nVc_SIMD_CAST_2(   int_v, ushort_v) { return SSE::convert_int32_to_int16(x0.data(), x1.data()); }\nVc_SIMD_CAST_2(  uint_v, ushort_v) { return SSE::convert_int32_to_int16(x0.data(), x1.data()); }\nVc_SIMD_CAST_2( float_v, ushort_v) { return simd_cast<SSE::ushort_v>(simd_cast<SSE::int_v>(x0), simd_cast<SSE::int_v>(x1)); }\nVc_SIMD_CAST_2(double_v, ushort_v) { return simd_cast<SSE::ushort_v>(simd_cast<SSE::int_v>(x0, x1)); }\n\n// 3 SSE::Vector to 1 SSE::Vector {{{2\nVc_CAST_(short_v) simd_cast(double_v a, double_v b, double_v c)\n{\n    return simd_cast<short_v>(simd_cast<int_v>(a, b), simd_cast<int_v>(c));\n}\nVc_CAST_(ushort_v) simd_cast(double_v a, double_v b, double_v c)\n{\n    return simd_cast<ushort_v>(simd_cast<int_v>(a, b), simd_cast<int_v>(c));\n}\n#undef Vc_CAST_\n\n// 4 SSE::Vector to 1 SSE::Vector {{{2\nVc_SIMD_CAST_4(double_v,  short_v) { return _mm_packs_epi32(simd_cast<SSE::int_v>(x0, x1).data(), simd_cast<SSE::int_v>(x2, x3).data()); }\nVc_SIMD_CAST_4(double_v, ushort_v) { return simd_cast<SSE::ushort_v>(simd_cast<SSE::int_v>(x0, x1), simd_cast<SSE::int_v>(x2, x3)); }\n}  // namespace SSE\n\n// 1 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x,\n              enable_if<std::is_same<Return, SSE::double_v>::value> )\n{\n    return _mm_setr_pd(x.data(), 0.);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x,\n              enable_if<std::is_same<Return, SSE::float_v>::value> )\n{\n    return _mm_setr_ps(x.data(), 0.f, 0.f, 0.f);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x,\n              enable_if<std::is_same<Return, SSE::int_v>::value> )\n{\n    return _mm_setr_epi32(x.data(), 0, 0, 0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x,\n              enable_if<std::is_same<Return, SSE::uint_v>::value> )\n{\n    return _mm_setr_epi32(uint(x.data()), 0, 0, 0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x,\n              enable_if<std::is_same<Return, SSE::short_v>::value> )\n{\n    return _mm_setr_epi16(\n        x.data(), 0, 0, 0, 0, 0, 0, 0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x,\n              enable_if<std::is_same<Return, SSE::ushort_v>::value> )\n{\n    return _mm_setr_epi16(\n        x.data(), 0, 0, 0, 0, 0, 0, 0);  // FIXME: use register-register mov\n}\n\n// 2 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              enable_if<std::is_same<Return, SSE::double_v>::value> )\n{\n    return _mm_setr_pd(x0.data(), x1.data());  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              enable_if<std::is_same<Return, SSE::float_v>::value> )\n{\n    return _mm_setr_ps(x0.data(), x1.data(), 0.f, 0.f);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              enable_if<std::is_same<Return, SSE::int_v>::value> )\n{\n    return _mm_setr_epi32(x0.data(), x1.data(), 0, 0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              enable_if<std::is_same<Return, SSE::uint_v>::value> )\n{\n    return _mm_setr_epi32(uint(x0.data()), uint(x1.data()), 0,\n                          0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              enable_if<std::is_same<Return, SSE::short_v>::value> )\n{\n    return _mm_setr_epi16(\n        x0.data(), x1.data(), 0, 0, 0, 0, 0, 0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              enable_if<std::is_same<Return, SSE::ushort_v>::value> )\n{\n    return _mm_setr_epi16(\n        x0.data(), x1.data(), 0, 0, 0, 0, 0, 0);  // FIXME: use register-register mov\n}\n\n// 3 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, SSE::float_v>::value>)\n{\n    return _mm_setr_ps(x0.data(), x1.data(), x2.data(), 0.f);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, SSE::int_v>::value>)\n{\n    return _mm_setr_epi32(x0.data(), x1.data(), x2.data(), 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, SSE::uint_v>::value>)\n{\n    return _mm_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()),\n                          0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, SSE::short_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), 0, 0, 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), 0, 0, 0, 0, 0);\n}\n\n// 4 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              Scalar::Vector<T> x2,\n              Scalar::Vector<T> x3,\n              enable_if<std::is_same<Return, SSE::float_v>::value> )\n{\n    return _mm_setr_ps(\n        x0.data(), x1.data(), x2.data(), x3.data());  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              Scalar::Vector<T> x2,\n              Scalar::Vector<T> x3,\n              enable_if<std::is_same<Return, SSE::int_v>::value> )\n{\n    return _mm_setr_epi32(\n        x0.data(), x1.data(), x2.data(), x3.data());  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              Scalar::Vector<T> x2,\n              Scalar::Vector<T> x3,\n              enable_if<std::is_same<Return, SSE::uint_v>::value> )\n{\n    return _mm_setr_epi32(uint(x0.data()), uint(x1.data()), uint(x2.data()),\n                          uint(x3.data()));  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              Scalar::Vector<T> x2,\n              Scalar::Vector<T> x3,\n              enable_if<std::is_same<Return, SSE::short_v>::value> )\n{\n    return _mm_setr_epi16(\n        x0.data(), x1.data(), x2.data(), x3.data(), 0, 0, 0, 0);  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              Scalar::Vector<T> x2,\n              Scalar::Vector<T> x3,\n              enable_if<std::is_same<Return, SSE::ushort_v>::value> )\n{\n    return _mm_setr_epi16(\n        x0.data(), x1.data(), x2.data(), x3.data(), 0, 0, 0, 0);  // FIXME: use register-register mov\n}\n\n// 5 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, SSE::short_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(), 0, 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(), 0, 0, 0);\n}\n\n// 6 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, SSE::short_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), 0, 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          enable_if<std::is_same<Return, SSE::ushort_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), 0, 0);\n}\n\n// 7 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, enable_if<std::is_same<Return, SSE::short_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), 0);\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\nsimd_cast(Scalar::Vector<T> x0, Scalar::Vector<T> x1, Scalar::Vector<T> x2,\n          Scalar::Vector<T> x3, Scalar::Vector<T> x4, Scalar::Vector<T> x5,\n          Scalar::Vector<T> x6, enable_if<std::is_same<Return, SSE::ushort_v>::value>)\n{\n    return _mm_setr_epi16(x0.data(), x1.data(), x2.data(), x3.data(), x4.data(),\n                          x5.data(), x6.data(), 0);\n}\n\n// 8 Scalar::Vector to 1 SSE::Vector {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              Scalar::Vector<T> x2,\n              Scalar::Vector<T> x3,\n              Scalar::Vector<T> x4,\n              Scalar::Vector<T> x5,\n              Scalar::Vector<T> x6,\n              Scalar::Vector<T> x7,\n              enable_if<std::is_same<Return, SSE::short_v>::value> )\n{\n    return _mm_setr_epi16(x0.data(),\n                          x1.data(),\n                          x2.data(),\n                          x3.data(),\n                          x4.data(),\n                          x5.data(),\n                          x6.data(),\n                          x7.data());  // FIXME: use register-register mov\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Vector<T> x0,\n              Scalar::Vector<T> x1,\n              Scalar::Vector<T> x2,\n              Scalar::Vector<T> x3,\n              Scalar::Vector<T> x4,\n              Scalar::Vector<T> x5,\n              Scalar::Vector<T> x6,\n              Scalar::Vector<T> x7,\n              enable_if<std::is_same<Return, SSE::ushort_v>::value> )\n{\n    return _mm_setr_epi16(x0.data(),\n                          x1.data(),\n                          x2.data(),\n                          x3.data(),\n                          x4.data(),\n                          x5.data(),\n                          x6.data(),\n                          x7.data());  // FIXME: use register-register mov\n}\n\n// SSE::Vector to Scalar::Vector {{{2\ntemplate <typename To, typename FromT>\nVc_INTRINSIC Vc_CONST To\n    simd_cast(SSE::Vector<FromT> x, enable_if<Scalar::is_vector<To>::value> )\n{\n    return static_cast<To>(x[0]);\n}\n\n// Mask casts without offset {{{1\n// 1 SSE Mask to 1 SSE Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(SSE::Mask<T> x, enable_if<SSE::is_mask<Return>::value> = nullarg)\n{\n    using M = SSE::Mask<T>;\n    return {Detail::mask_cast<M::Size, Return::Size, __m128>(x.dataI())};\n}\n// 2 SSE Masks to 1 SSE Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    SSE::Mask<T> x0,\n    SSE::Mask<T> x1,\n    enable_if<SSE::is_mask<Return>::value && Mask<T, VectorAbi::Sse>::Size * 2 == Return::Size> = nullarg)\n{\n    return SSE::sse_cast<__m128>(_mm_packs_epi16(x0.dataI(), x1.dataI()));\n}\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    SSE::Mask<T> x0,\n    SSE::Mask<T> x1,\n    enable_if<SSE::is_mask<Return>::value && Mask<T, VectorAbi::Sse>::Size * 4 == Return::Size> = nullarg)\n{\n    return SSE::sse_cast<__m128>(\n        _mm_packs_epi16(_mm_packs_epi16(x0.dataI(), x1.dataI()), _mm_setzero_si128()));\n}\n// 4 SSE Masks to 1 SSE Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    SSE::Mask<T> x0,\n    SSE::Mask<T> x1,\n    SSE::Mask<T> x2,\n    SSE::Mask<T> x3,\n    enable_if<SSE::is_mask<Return>::value && Mask<T, VectorAbi::Sse>::Size * 4 == Return::Size> = nullarg)\n{\n    return SSE::sse_cast<__m128>(_mm_packs_epi16(_mm_packs_epi16(x0.dataI(), x1.dataI()),\n                                                 _mm_packs_epi16(x2.dataI(), x3.dataI())));\n}\n\n// 1 Scalar Mask to 1 SSE Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Mask<T> x, enable_if<SSE::is_mask<Return>::value> = nullarg)\n{\n    Return m(false);\n    m[0] = x[0];\n    return m;\n}\n// 2 Scalar Masks to 1 SSE Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(Scalar::Mask<T> x0, Scalar::Mask<T> x1, enable_if<SSE::is_mask<Return>::value> = nullarg)\n{\n    Return m(false);\n    m[0] = x0[0];\n    m[1] = x1[0];\n    return m;\n}\n// 4 Scalar Masks to 1 SSE Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(Scalar::Mask<T> x0,\n                                       Scalar::Mask<T> x1,\n                                       Scalar::Mask<T> x2,\n                                       Scalar::Mask<T> x3,\n                                       enable_if<SSE::is_mask<Return>::value> = nullarg)\n{\n    Return m(false);\n    m[0] = x0[0];\n    m[1] = x1[0];\n    if (Return::Size >= 4) {\n        m[2] = x2[0];\n        m[3] = x3[0];\n    }\n    return m;\n}\n// 8 Scalar Masks to 1 SSE Mask {{{2\ntemplate <typename Return, typename T>\nVc_INTRINSIC Vc_CONST Return simd_cast(Scalar::Mask<T> x0,\n                                       Scalar::Mask<T> x1,\n                                       Scalar::Mask<T> x2,\n                                       Scalar::Mask<T> x3,\n                                       Scalar::Mask<T> x4,\n                                       Scalar::Mask<T> x5,\n                                       Scalar::Mask<T> x6,\n                                       Scalar::Mask<T> x7,\n                                       enable_if<SSE::is_mask<Return>::value> = nullarg)\n{\n    Return m(false);\n    m[0] = x0[0];\n    m[1] = x1[0];\n    if (Return::Size >= 4) {\n        m[2] = x2[0];\n        m[3] = x3[0];\n    }\n    if (Return::Size >= 8) {\n        m[4] = x4[0];\n        m[5] = x5[0];\n        m[6] = x6[0];\n        m[7] = x7[0];\n    }\n    return m;\n}\n\n// 1 SSE::Mask to 1 Scalar::Mask {{{2\ntemplate <typename To, typename FromT>\nVc_INTRINSIC Vc_CONST To\n    simd_cast(SSE::Mask<FromT> x, enable_if<Scalar::is_mask<To>::value> = nullarg)\n{\n    return static_cast<To>(x[0]);\n}\n// offset == 0 | convert from SSE::Mask/Vector to SSE::Mask/Vector {{{1\ntemplate <typename Return, int offset, typename V>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(V &&x, enable_if<offset == 0 && ((SSE::is_vector<Traits::decay<V>>::value &&\n                                                SSE::is_vector<Return>::value) ||\n                                               (SSE::is_mask<Traits::decay<V>>::value &&\n                                                SSE::is_mask<Return>::value))> = nullarg)\n{\n    return simd_cast<Return>(x);\n}\n\ntemplate <typename Return, int offset, typename V>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(V &&x,\n              enable_if<offset == 0 && ((Scalar::is_vector<Traits::decay<V>>::value &&\n                                         SSE::is_vector<Return>::value) ||\n                                        (Scalar::is_mask<Traits::decay<V>>::value &&\n                                         SSE::is_mask<Return>::value))> = nullarg)\n{\n    return simd_cast<Return>(x);\n}\n\n// Vector casts with offset {{{1\n// SSE to SSE (Vector) {{{2\ntemplate <typename Return, int offset, typename V>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    V x,\n    enable_if<offset != 0 && (SSE::is_vector<Return>::value && SSE::is_vector<V>::value)> = nullarg)\n{\n    constexpr int shift = (sizeof(V) / V::Size) * offset * Return::Size;\n    static_assert(shift > 0 && shift < 16, \"\");\n    return simd_cast<Return>(V{SSE::sse_cast<typename V::VectorType>(\n        _mm_srli_si128(SSE::sse_cast<__m128i>(x.data()), shift & 0xff))});\n}\n\n// SSE to Scalar (Vector) {{{2\ntemplate <typename Return, int offset, typename T>\nVc_INTRINSIC Vc_CONST Return\n    simd_cast(SSE::Vector<T> x,\n              enable_if<offset != 0 && Scalar::is_vector<Return>::value> = nullarg)\n{\n    return static_cast<typename Return::EntryType>(x[offset]);\n}\n\n// Mask casts with offset {{{1\n// SSE to SSE (Mask)\ntemplate <typename Return, int offset, typename V>\nVc_INTRINSIC Vc_CONST Return simd_cast(\n    V x,\n    enable_if<offset != 0 && (SSE::is_mask<Return>::value && SSE::is_mask<V>::value)> = nullarg)\n{\n    constexpr int shift = (sizeof(V) / V::Size) * offset * Return::Size;\n    static_assert(shift > 0 && shift < 16, \"\");\n    return simd_cast<Return>(V{SSE::sse_cast<typename V::VectorType>(\n        _mm_srli_si128(SSE::sse_cast<__m128i>(x.data()), shift & 0xff))});\n}\n\n// undef Vc_SIMD_CAST_[1248] {{{1\n#undef Vc_SIMD_CAST_1\n#undef Vc_SIMD_CAST_2\n#undef Vc_SIMD_CAST_4\n#undef Vc_SIMD_CAST_8\n// }}}1\n\n}  // namespace Vc\n\n#endif // VC_SSE_SIMD_CAST_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/simd_cast_caller.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef Vc_SSE_SIMD_CAST_CALLER_TCC_\n#define Vc_SSE_SIMD_CAST_CALLER_TCC_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n#if Vc_IS_VERSION_1\ntemplate <typename T>\ntemplate <typename U>\nVc_INTRINSIC Mask<T, VectorAbi::Sse>::Mask(U &&rhs, Common::enable_if_mask_converts_explicitly<T, U>)\n    : Mask(Vc::simd_cast<Mask>(std::forward<U>(rhs)))\n{\n}\n#endif\n}\n\n#endif  // Vc_SSE_SIMD_CAST_CALLER_TCC_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/type_traits.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_TYPE_TRAITS_H_\n#define VC_SSE_TYPE_TRAITS_H_\n\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\nnamespace Traits\n{\ntemplate <typename T> struct is_vector : public std::false_type {};\ntemplate <typename T> struct is_vector<Vector<T>> : public std::true_type {};\n\ntemplate <typename T> struct is_mask : public std::false_type {};\ntemplate <typename T> struct is_mask<Mask<T>> : public std::true_type {};\n}  // namespace Traits\n}  // namespace SSE\n}  // namespace Vc\n\n#endif  // VC_SSE_TYPE_TRAITS_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/types.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"../scalar/types.h\"\n\n#ifndef VC_SSE_TYPES_H_\n#define VC_SSE_TYPES_H_\n\n#ifdef Vc_DEFAULT_IMPL_SSE\n#define Vc_DOUBLE_V_SIZE 2\n#define Vc_FLOAT_V_SIZE 4\n#define Vc_INT_V_SIZE 4\n#define Vc_UINT_V_SIZE 4\n#define Vc_SHORT_V_SIZE 8\n#define Vc_USHORT_V_SIZE 8\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\ntemplate <typename T> using Vector = Vc::Vector<T, VectorAbi::Sse>;\ntypedef Vector<double>         double_v;\ntypedef Vector<float>           float_v;\ntypedef Vector<int>               int_v;\ntypedef Vector<unsigned int>     uint_v;\ntypedef Vector<short>           short_v;\ntypedef Vector<unsigned short> ushort_v;\n\ntemplate <typename T> using Mask = Vc::Mask<T, VectorAbi::Sse>;\ntypedef Mask<double>         double_m;\ntypedef Mask<float>           float_m;\ntypedef Mask<int>               int_m;\ntypedef Mask<unsigned int>     uint_m;\ntypedef Mask<short>           short_m;\ntypedef Mask<unsigned short> ushort_m;\n\ntemplate <typename T> struct Const;\n\ntemplate <typename T> struct is_vector : public std::false_type {};\ntemplate <typename T> struct is_vector<Vector<T>> : public std::true_type {};\ntemplate <typename T> struct is_mask : public std::false_type {};\ntemplate <typename T> struct is_mask<Mask<T>> : public std::true_type {};\n}  // namespace SSE\n\nnamespace Traits\n{\ntemplate <class T> struct\nis_simd_vector_internal<Vector<T, VectorAbi::Sse>>\n  : public is_valid_vector_argument<T> {};\n\ntemplate<typename T> struct is_simd_mask_internal<Mask<T, VectorAbi::Sse>>\n  : public std::true_type {};\n}  // namespace Traits\n}  // namespace Vc\n\n#endif // VC_SSE_TYPES_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/vector.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_VECTOR_H_\n#define VC_SSE_VECTOR_H_\n\n#include \"../scalar/vector.h\"\n#include \"intrinsics.h\"\n#include \"types.h\"\n#include \"vectorhelper.h\"\n#include \"mask.h\"\n#include \"../common/writemaskedvector.h\"\n#include \"../common/aliasingentryhelper.h\"\n#include \"../common/memoryfwd.h\"\n#include \"../common/loadstoreflags.h\"\n#include <algorithm>\n#include <cmath>\n#include \"detail.h\"\n\n#include \"macros.h\"\n\n#ifdef isfinite\n#undef isfinite\n#endif\n#ifdef isnan\n#undef isnan\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n#define Vc_CURRENT_CLASS_NAME Vector\ntemplate <typename T> class Vector<T, VectorAbi::Sse>\n{\n    static_assert(std::is_arithmetic<T>::value,\n                  \"Vector<T> only accepts arithmetic builtin types as template parameter T.\");\n\n    protected:\n#ifdef Vc_COMPILE_BENCHMARKS\n    public:\n#endif\n        typedef typename SSE::VectorTraits<T>::StorageType StorageType;\n        StorageType d;\n        typedef typename SSE::VectorTraits<T>::GatherMaskType GatherMask;\n        typedef SSE::VectorHelper<typename SSE::VectorTraits<T>::VectorType> HV;\n        typedef SSE::VectorHelper<T> HT;\n    public:\n        Vc_FREE_STORE_OPERATORS_ALIGNED(16);\n\n        typedef typename SSE::VectorTraits<T>::VectorType VectorType;\n        using vector_type = VectorType;\n        static constexpr size_t Size = SSE::VectorTraits<T>::Size;\n        static constexpr size_t MemoryAlignment = alignof(VectorType);\n        typedef typename SSE::VectorTraits<T>::EntryType EntryType;\n        using value_type = EntryType;\n        using VectorEntryType = EntryType;\n        using IndexType = fixed_size_simd<int, Size>;\n        using index_type = IndexType;\n        typedef typename SSE::VectorTraits<T>::MaskType Mask;\n        using MaskType = Mask;\n        using mask_type = Mask;\n        typedef typename Mask::Argument MaskArg;\n        typedef typename Mask::Argument MaskArgument;\n        typedef const Vector AsArg;\n        using abi = VectorAbi::Sse;\n        using WriteMaskedVector = Common::WriteMaskedVector<Vector, Mask>;\n        template <typename U> using V = Vector<U, abi>;\n\n        using reference = Detail::ElementReference<Vector>;\n\n#include \"../common/generalinterface.h\"\n\n        static Vc_INTRINSIC_L Vector Random() Vc_INTRINSIC_R;\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // internal: required to enable returning objects of VectorType\n        Vc_ALWAYS_INLINE Vector(VectorType x) : d(x) {}\n\n        // implict conversion from compatible Vector<U>\n        template <typename U>\n        Vc_INTRINSIC Vector(\n            V<U> x, typename std::enable_if<Traits::is_implicit_cast_allowed<U, T>::value,\n                                            void *>::type = nullptr)\n            : d(SSE::convert<U, T>(x.data()))\n        {\n        }\n\n#if Vc_IS_VERSION_1\n        // static_cast from the remaining Vector<U>\n        template <typename U>\n        Vc_DEPRECATED(\"use simd_cast instead of explicit type casting to convert between \"\n                      \"vector types\") Vc_INTRINSIC\n            explicit Vector(\n                V<U> x,\n                typename std::enable_if<!Traits::is_implicit_cast_allowed<U, T>::value,\n                                        void *>::type = nullptr)\n            : d(SSE::convert<U, T>(x.data()))\n        {\n        }\n#endif\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // broadcast\n        Vc_INTRINSIC Vector(EntryType a) : d(HT::set(a)) {}\n        template <typename U>\n        Vc_INTRINSIC Vector(U a,\n                            typename std::enable_if<std::is_same<U, int>::value &&\n                                                        !std::is_same<U, EntryType>::value,\n                                                    void *>::type = nullptr)\n            : Vector(static_cast<EntryType>(a))\n        {\n        }\n\n        Vc_INTRINSIC explicit Vector(reference a) : Vector(static_cast<EntryType>(a)) {}\n\n#include \"../common/loadinterface.h\"\n#include \"../common/storeinterface.h\"\n\n        ///////////////////////////////////////////////////////////////////////////////////////////\n        // zeroing\n        Vc_INTRINSIC_L void setZero() Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L void setZero(const Mask &k) Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L void setZeroInverted(const Mask &k) Vc_INTRINSIC_R;\n\n        Vc_INTRINSIC_L void setQnan() Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L void setQnan(const Mask &k) Vc_INTRINSIC_R;\n\n#include \"../common/gatherinterface.h\"\n#include \"../common/scatterinterface.h\"\n#if defined Vc_IMPL_AVX2 && !defined Vc_MSVC\n        // skip this code for MSVC because it fails to do overload resolution correctly\n\n        ////////////////////////////////////////////////////////////////////////////////\n        // non-converting pd, ps, and epi32 gathers\n        template <class U, class A, int Scale, int N = Vector<U, A>::size(),\n                  class = enable_if<(Vector<U, A>::size() >= size() && sizeof(T) >= 4)>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<T, Vector<U, A>, Scale> &args)\n        {\n            d.v() = SSE::gather<sizeof(T) * Scale>(\n                args.address, simd_cast<SSE::int_v>(args.indexes).data());\n        }\n\n        // masked overload\n        template <class U, class A, int Scale, int N = Vector<U, A>::size(),\n                  class = enable_if<(Vector<U, A>::size() >= size() && sizeof(T) >= 4)>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<T, Vector<U, A>, Scale> &args, MaskArgument k)\n        {\n            d.v() = SSE::gather<sizeof(T) * Scale>(\n                d.v(), k.data(), args.address,\n                simd_cast<SSE::int_v>(args.indexes).data());\n        }\n\n        ////////////////////////////////////////////////////////////////////////////////\n        // converting (from 8-bit and 16-bit integers only) epi16 gather emulation via\n        // epi32 gathers\n        template <\n            class MT, class U, class A, int Scale,\n            class = enable_if<(sizeof(T) == 2 && std::is_integral<MT>::value &&\n                               (sizeof(MT) <= 2) && Vector<U, A>::size() >= size())>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<MT, Vector<U, A>, Scale> &args)\n        {\n            using AVX2::int_v;\n            const auto idx = simd_cast<int_v>(args.indexes).data();\n            *this = simd_cast<Vector>(int_v(\n                AVX::gather<sizeof(MT) * Scale>(aliasing_cast<int>(args.address), idx)));\n            if (sizeof(MT) == 1) {\n                if (std::is_signed<MT>::value) {\n                    d.v() = _mm_srai_epi16(_mm_slli_epi16(d.v(), 8), 8);\n                } else {\n                    *this &= 0xff;\n                }\n            }\n        }\n\n        // masked overload\n        template <\n            class MT, class U, class A, int Scale,\n            class = enable_if<(sizeof(T) == 2 && std::is_integral<MT>::value &&\n                               (sizeof(MT) <= 2) && Vector<U, A>::size() >= size())>>\n        Vc_INTRINSIC void gatherImplementation(\n            const Common::GatherArguments<MT, Vector<U, A>, Scale> &args, MaskArgument k)\n        {\n            using AVX2::int_v;\n            auto v = simd_cast<Vector>(int_v(AVX::gather<sizeof(MT) * Scale>(\n                _mm256_setzero_si256(), simd_cast<AVX2::int_m>(k).data(),\n                aliasing_cast<int>(args.address),\n                simd_cast<int_v>(args.indexes).data())));\n            if (sizeof(MT) == 1) {\n                if (std::is_signed<MT>::value) {\n                    v.data() = _mm_srai_epi16(_mm_slli_epi16(v.data(), 8), 8);\n                } else {\n                    v &= 0xff;\n                }\n            }\n            assign(v, k);\n        }\n\n        ////////////////////////////////////////////////////////////////////////////////\n        // all remaining converting gathers\n        template <class MT, class U, class A, int Scale>\n        Vc_INTRINSIC enable_if<((sizeof(T) != 2 || sizeof(MT) > 2) &&\n                                Traits::is_valid_vector_argument<MT>::value &&\n                                !std::is_same<MT, T>::value &&\n                                Vector<U, A>::size() >= size()),\n                               void>\n        gatherImplementation(const Common::GatherArguments<MT, Vector<U, A>, Scale> &args)\n        {\n            *this = simd_cast<Vector>(fixed_size_simd<MT, Size>(args));\n        }\n\n        // masked overload\n        template <class MT, class U, class A, int Scale>\n        Vc_INTRINSIC enable_if<((sizeof(T) != 2 || sizeof(MT) > 2) &&\n                                Traits::is_valid_vector_argument<MT>::value &&\n                                !std::is_same<MT, T>::value &&\n                                Vector<U, A>::size() >= size()),\n                               void>\n        gatherImplementation(const Common::GatherArguments<MT, Vector<U, A>, Scale> &args,\n                             MaskArgument k)\n        {\n            assign(simd_cast<Vector>(fixed_size_simd<MT, Size>(args, k)), k);\n        }\n#endif  // Vc_IMPL_AVX2 && !MSVC\n\n        //prefix\n        Vc_INTRINSIC Vector &operator++() { data() = HT::add(data(), HT::one()); return *this; }\n        Vc_INTRINSIC Vector &operator--() { data() = HT::sub(data(), HT::one()); return *this; }\n        //postfix\n        Vc_INTRINSIC Vector operator++(int) { const Vector r = *this; data() = HT::add(data(), HT::one()); return r; }\n        Vc_INTRINSIC Vector operator--(int) { const Vector r = *this; data() = HT::sub(data(), HT::one()); return r; }\n\n    private:\n        friend reference;\n        Vc_INTRINSIC static value_type get(const Vector &o, int i) noexcept\n        {\n            return o.d.m(i);\n        }\n        template <typename U>\n        Vc_INTRINSIC static void set(Vector &o, int i, U &&v) noexcept(\n            noexcept(std::declval<value_type &>() = v))\n        {\n            o.d.set(i, v);\n        }\n\n    public:\n        /**\n         * \\note the returned object models the concept of a reference and\n         * as such it can exist longer than the data it is referencing.\n         * \\note to avoid lifetime issues, we strongly advice not to store\n         * any reference objects.\n         */\n        Vc_ALWAYS_INLINE reference operator[](size_t index) noexcept\n        {\n            static_assert(noexcept(reference{std::declval<Vector &>(), int()}), \"\");\n            return {*this, int(index)};\n        }\n        Vc_ALWAYS_INLINE value_type operator[](size_t index) const noexcept\n        {\n            return d.m(index);\n        }\n\n        Vc_INTRINSIC_L Vector Vc_VDECL operator[](const SSE::int_v &perm) const Vc_INTRINSIC_R;\n\n        Vc_INTRINSIC Vc_PURE Mask operator!() const\n        {\n            return *this == Zero();\n        }\n        Vc_INTRINSIC Vc_PURE Vector operator~() const\n        {\n#ifndef Vc_ENABLE_FLOAT_BIT_OPERATORS\n            static_assert(std::is_integral<T>::value,\n                          \"bit-complement can only be used with Vectors of integral type\");\n#endif\n            return Detail::andnot_(data(), HV::allone());\n        }\n        Vc_ALWAYS_INLINE_L Vc_PURE_L Vector operator-() const Vc_ALWAYS_INLINE_R Vc_PURE_R;\n        Vc_INTRINSIC Vc_PURE Vector operator+() const { return *this; }\n\n        Vc_ALWAYS_INLINE Vector  Vc_VDECL operator<< (AsArg shift) const { return generate([&](int i) { return get(*this, i) << get(shift, i); }); }\n        Vc_ALWAYS_INLINE Vector  Vc_VDECL operator>> (AsArg shift) const { return generate([&](int i) { return get(*this, i) >> get(shift, i); }); }\n        Vc_ALWAYS_INLINE Vector &Vc_VDECL operator<<=(AsArg shift) { return *this = *this << shift; }\n        Vc_ALWAYS_INLINE Vector &Vc_VDECL operator>>=(AsArg shift) { return *this = *this >> shift; }\n\n        Vc_INTRINSIC_L Vector &Vc_VDECL operator<<=(  int shift)       Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector  Vc_VDECL operator<< (  int shift) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector &Vc_VDECL operator>>=(  int shift)       Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector  Vc_VDECL operator>> (  int shift) const Vc_INTRINSIC_R;\n\n        Vc_DEPRECATED(\"use isnegative(x) instead\") Vc_INTRINSIC Vc_PURE Mask\n            isNegative() const\n        {\n            return Vc::isnegative(*this);\n        }\n\n        Vc_ALWAYS_INLINE void assign(const Vector &v, const Mask &mask)\n        {\n            data() = HV::blend(data(), v.data(), mask.data());\n        }\n\n        template <typename V2>\n        Vc_DEPRECATED(\"Use simd_cast instead of Vector::staticCast\")\n            Vc_ALWAYS_INLINE Vc_PURE V2 staticCast() const\n        {\n            return SSE::convert<T, typename V2::EntryType>(data());\n        }\n        template <typename V2>\n        Vc_DEPRECATED(\"use reinterpret_components_cast instead\")\n            Vc_ALWAYS_INLINE Vc_PURE V2 reinterpretCast() const\n        {\n            return SSE::sse_cast<typename V2::VectorType>(data());\n        }\n\n        Vc_INTRINSIC WriteMaskedVector operator()(const Mask &k) { return {*this, k}; }\n\n        Vc_ALWAYS_INLINE Vc_PURE VectorType &data() { return d.v(); }\n        Vc_ALWAYS_INLINE Vc_PURE const VectorType &data() const { return d.v(); }\n\n        template<int Index>\n        Vc_INTRINSIC_L Vector broadcast() const Vc_INTRINSIC_R;\n\n        Vc_INTRINSIC EntryType min() const { return HT::min(data()); }\n        Vc_INTRINSIC EntryType max() const { return HT::max(data()); }\n        Vc_INTRINSIC EntryType product() const { return HT::mul(data()); }\n        Vc_INTRINSIC EntryType sum() const { return HT::add(data()); }\n        Vc_INTRINSIC_L Vector partialSum() const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L EntryType min(MaskArg m) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L EntryType max(MaskArg m) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L EntryType product(MaskArg m) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L EntryType sum(MaskArg m) const Vc_INTRINSIC_R;\n\n        Vc_INTRINSIC_L Vector shifted(int amount, Vector shiftIn) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector shifted(int amount) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector rotated(int amount) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vc_PURE_L Vector reversed() const Vc_INTRINSIC_R Vc_PURE_R;\n        Vc_ALWAYS_INLINE_L Vc_PURE_L Vector sorted() const Vc_ALWAYS_INLINE_R Vc_PURE_R;\n\n        template <typename F> void callWithValuesSorted(F &&f)\n        {\n            EntryType value = d.m(0);\n            f(value);\n            for (std::size_t i = 1; i < Size; ++i) {\n                if (d.m(i) != value) {\n                    value = d.m(i);\n                    f(value);\n                }\n            }\n        }\n\n        template <typename F> Vc_INTRINSIC void call(F &&f) const\n        {\n            Common::for_all_vector_entries<Size>([&](size_t i) { f(EntryType(d.m(i))); });\n        }\n\n        template <typename F> Vc_INTRINSIC void call(F &&f, const Mask &mask) const\n        {\n            for(size_t i : where(mask)) {\n                f(EntryType(d.m(i)));\n            }\n        }\n\n        template <typename F> Vc_INTRINSIC Vector apply(F &&f) const\n        {\n            Vector r;\n            Common::for_all_vector_entries<Size>(\n                [&](size_t i) { r.d.set(i, f(EntryType(d.m(i)))); });\n            return r;\n        }\n        template <typename F> Vc_INTRINSIC Vector apply(F &&f, const Mask &mask) const\n        {\n            Vector r(*this);\n            for (size_t i : where(mask)) {\n                r.d.set(i, f(EntryType(r.d.m(i))));\n            }\n            return r;\n        }\n\n        template<typename IndexT> Vc_INTRINSIC void fill(EntryType (&f)(IndexT)) {\n            Common::for_all_vector_entries<Size>([&](size_t i) { d.set(i, f(i)); });\n        }\n        Vc_INTRINSIC void fill(EntryType (&f)()) {\n            Common::for_all_vector_entries<Size>([&](size_t i) { d.set(i, f()); });\n        }\n\n        template <typename G> static Vc_INTRINSIC_L Vector generate(G gen) Vc_INTRINSIC_R;\n\n        Vc_DEPRECATED(\"use copysign(x, y) instead\") Vc_INTRINSIC Vector\n            copySign(AsArg x) const\n        {\n            return Vc::copysign(*this, x);\n        }\n\n        Vc_DEPRECATED(\"use exponent(x) instead\") Vc_INTRINSIC Vector exponent() const\n        {\n            return Vc::exponent(*this);\n        }\n\n        Vc_INTRINSIC_L Vector interleaveLow(Vector x) const Vc_INTRINSIC_R;\n        Vc_INTRINSIC_L Vector interleaveHigh(Vector x) const Vc_INTRINSIC_R;\n};\n#undef Vc_CURRENT_CLASS_NAME\ntemplate <typename T> constexpr size_t Vector<T, VectorAbi::Sse>::Size;\ntemplate <typename T> constexpr size_t Vector<T, VectorAbi::Sse>::MemoryAlignment;\n\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::int_v    min(const SSE::int_v    &x, const SSE::int_v    &y) { return SSE::min_epi32(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::uint_v   min(const SSE::uint_v   &x, const SSE::uint_v   &y) { return SSE::min_epu32(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::short_v  min(const SSE::short_v  &x, const SSE::short_v  &y) { return _mm_min_epi16(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::ushort_v min(const SSE::ushort_v &x, const SSE::ushort_v &y) { return SSE::min_epu16(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::float_v  min(const SSE::float_v  &x, const SSE::float_v  &y) { return _mm_min_ps(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::double_v min(const SSE::double_v &x, const SSE::double_v &y) { return _mm_min_pd(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::int_v    max(const SSE::int_v    &x, const SSE::int_v    &y) { return SSE::max_epi32(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::uint_v   max(const SSE::uint_v   &x, const SSE::uint_v   &y) { return SSE::max_epu32(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::short_v  max(const SSE::short_v  &x, const SSE::short_v  &y) { return _mm_max_epi16(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::ushort_v max(const SSE::ushort_v &x, const SSE::ushort_v &y) { return SSE::max_epu16(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::float_v  max(const SSE::float_v  &x, const SSE::float_v  &y) { return _mm_max_ps(x.data(), y.data()); }\nstatic Vc_ALWAYS_INLINE Vc_PURE SSE::double_v max(const SSE::double_v &x, const SSE::double_v &y) { return _mm_max_pd(x.data(), y.data()); }\n\ntemplate <typename T,\n          typename = enable_if<std::is_same<T, double>::value || std::is_same<T, float>::value ||\n                               std::is_same<T, short>::value ||\n                               std::is_same<T, int>::value>>\nVc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> abs(Vector<T, VectorAbi::Sse> x)\n{\n    return SSE::VectorHelper<T>::abs(x.data());\n}\n\n  template<typename T> Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> sqrt (const Vector<T, VectorAbi::Sse> &x) { return SSE::VectorHelper<T>::sqrt(x.data()); }\n  template<typename T> Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> rsqrt(const Vector<T, VectorAbi::Sse> &x) { return SSE::VectorHelper<T>::rsqrt(x.data()); }\n  template<typename T> Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> reciprocal(const Vector<T, VectorAbi::Sse> &x) { return SSE::VectorHelper<T>::reciprocal(x.data()); }\n  template<typename T> Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> round(const Vector<T, VectorAbi::Sse> &x) { return SSE::VectorHelper<T>::round(x.data()); }\n\n  template<typename T> Vc_ALWAYS_INLINE Vc_PURE typename Vector<T, VectorAbi::Sse>::Mask isfinite(const Vector<T, VectorAbi::Sse> &x) { return SSE::VectorHelper<T>::isFinite(x.data()); }\n  template<typename T> Vc_ALWAYS_INLINE Vc_PURE typename Vector<T, VectorAbi::Sse>::Mask isinf(const Vector<T, VectorAbi::Sse> &x) { return SSE::VectorHelper<T>::isInfinite(x.data()); }\n  template<typename T> Vc_ALWAYS_INLINE Vc_PURE typename Vector<T, VectorAbi::Sse>::Mask isnan(const Vector<T, VectorAbi::Sse> &x) { return SSE::VectorHelper<T>::isNaN(x.data()); }\n\n#define Vc_CONDITIONAL_ASSIGN(name_, op_)                                                \\\n    template <Operator O, typename T, typename M, typename U>                            \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, void> conditional_assign(               \\\n        Vector<T, VectorAbi::Sse> &lhs, M &&mask, U &&rhs)                               \\\n    {                                                                                    \\\n        lhs(mask) op_ rhs;                                                               \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(          Assign,  =);\nVc_CONDITIONAL_ASSIGN(      PlusAssign, +=);\nVc_CONDITIONAL_ASSIGN(     MinusAssign, -=);\nVc_CONDITIONAL_ASSIGN(  MultiplyAssign, *=);\nVc_CONDITIONAL_ASSIGN(    DivideAssign, /=);\nVc_CONDITIONAL_ASSIGN( RemainderAssign, %=);\nVc_CONDITIONAL_ASSIGN(       XorAssign, ^=);\nVc_CONDITIONAL_ASSIGN(       AndAssign, &=);\nVc_CONDITIONAL_ASSIGN(        OrAssign, |=);\nVc_CONDITIONAL_ASSIGN( LeftShiftAssign,<<=);\nVc_CONDITIONAL_ASSIGN(RightShiftAssign,>>=);\n#undef Vc_CONDITIONAL_ASSIGN\n\n#define Vc_CONDITIONAL_ASSIGN(name_, expr_)                                              \\\n    template <Operator O, typename T, typename M>                                        \\\n    Vc_INTRINSIC enable_if<O == Operator::name_, Vector<T, VectorAbi::Sse>>              \\\n    conditional_assign(Vector<T, VectorAbi::Sse> &lhs, M &&mask)                         \\\n    {                                                                                    \\\n        return expr_;                                                                    \\\n    }                                                                                    \\\n    Vc_NOTHING_EXPECTING_SEMICOLON\nVc_CONDITIONAL_ASSIGN(PostIncrement, lhs(mask)++);\nVc_CONDITIONAL_ASSIGN( PreIncrement, ++lhs(mask));\nVc_CONDITIONAL_ASSIGN(PostDecrement, lhs(mask)--);\nVc_CONDITIONAL_ASSIGN( PreDecrement, --lhs(mask));\n#undef Vc_CONDITIONAL_ASSIGN\n\n}  // namespace Vc\n\n#include \"vector.tcc\"\n#include \"simd_cast.h\"\n\n#endif // VC_SSE_VECTOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/vector.tcc",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include \"../common/x86_prefetches.h\"\n#include \"limits.h\"\n#include \"../common/bitscanintrinsics.h\"\n#include \"../common/set.h\"\n#include \"../common/gatherimplementation.h\"\n#include \"../common/scatterimplementation.h\"\n#include \"../common/transpose.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n// compare operators {{{1\nVc_INTRINSIC SSE::double_m operator==(SSE::double_v a, SSE::double_v b) { return _mm_cmpeq_pd(a.data(), b.data()); }\nVc_INTRINSIC SSE:: float_m operator==(SSE:: float_v a, SSE:: float_v b) { return _mm_cmpeq_ps(a.data(), b.data()); }\nVc_INTRINSIC SSE::   int_m operator==(SSE::   int_v a, SSE::   int_v b) { return _mm_cmpeq_epi32(a.data(), b.data()); }\nVc_INTRINSIC SSE::  uint_m operator==(SSE::  uint_v a, SSE::  uint_v b) { return _mm_cmpeq_epi32(a.data(), b.data()); }\nVc_INTRINSIC SSE:: short_m operator==(SSE:: short_v a, SSE:: short_v b) { return _mm_cmpeq_epi16(a.data(), b.data()); }\nVc_INTRINSIC SSE::ushort_m operator==(SSE::ushort_v a, SSE::ushort_v b) { return _mm_cmpeq_epi16(a.data(), b.data()); }\n\nVc_INTRINSIC SSE::double_m operator!=(SSE::double_v a, SSE::double_v b) { return _mm_cmpneq_pd(a.data(), b.data()); }\nVc_INTRINSIC SSE:: float_m operator!=(SSE:: float_v a, SSE:: float_v b) { return _mm_cmpneq_ps(a.data(), b.data()); }\nVc_INTRINSIC SSE::   int_m operator!=(SSE::   int_v a, SSE::   int_v b) { return not_(_mm_cmpeq_epi32(a.data(), b.data())); }\nVc_INTRINSIC SSE::  uint_m operator!=(SSE::  uint_v a, SSE::  uint_v b) { return not_(_mm_cmpeq_epi32(a.data(), b.data())); }\nVc_INTRINSIC SSE:: short_m operator!=(SSE:: short_v a, SSE:: short_v b) { return not_(_mm_cmpeq_epi16(a.data(), b.data())); }\nVc_INTRINSIC SSE::ushort_m operator!=(SSE::ushort_v a, SSE::ushort_v b) { return not_(_mm_cmpeq_epi16(a.data(), b.data())); }\n\nVc_INTRINSIC SSE::double_m operator> (SSE::double_v a, SSE::double_v b) { return _mm_cmpgt_pd(a.data(), b.data()); }\nVc_INTRINSIC SSE:: float_m operator> (SSE:: float_v a, SSE:: float_v b) { return _mm_cmpgt_ps(a.data(), b.data()); }\nVc_INTRINSIC SSE::   int_m operator> (SSE::   int_v a, SSE::   int_v b) { return _mm_cmpgt_epi32(a.data(), b.data()); }\nVc_INTRINSIC SSE::  uint_m operator> (SSE::  uint_v a, SSE::  uint_v b) {\n#ifndef USE_INCORRECT_UNSIGNED_COMPARE\n    return SSE::cmpgt_epu32(a.data(), b.data());\n#else\n    return _mm_cmpgt_epi32(a.data(), b.data());\n#endif\n}\nVc_INTRINSIC SSE:: short_m operator> (SSE:: short_v a, SSE:: short_v b) { return _mm_cmpgt_epi16(a.data(), b.data()); }\nVc_INTRINSIC SSE::ushort_m operator> (SSE::ushort_v a, SSE::ushort_v b) {\n#ifndef USE_INCORRECT_UNSIGNED_COMPARE\n    return SSE::cmpgt_epu16(a.data(), b.data());\n#else\n    return _mm_cmpgt_epi16(a.data(), b.data());\n#endif\n}\n\nVc_INTRINSIC SSE::double_m operator< (SSE::double_v a, SSE::double_v b) { return _mm_cmplt_pd(a.data(), b.data()); }\nVc_INTRINSIC SSE:: float_m operator< (SSE:: float_v a, SSE:: float_v b) { return _mm_cmplt_ps(a.data(), b.data()); }\nVc_INTRINSIC SSE::   int_m operator< (SSE::   int_v a, SSE::   int_v b) { return _mm_cmplt_epi32(a.data(), b.data()); }\nVc_INTRINSIC SSE::  uint_m operator< (SSE::  uint_v a, SSE::  uint_v b) {\n#ifndef USE_INCORRECT_UNSIGNED_COMPARE\n    return SSE::cmplt_epu32(a.data(), b.data());\n#else\n    return _mm_cmplt_epi32(a.data(), b.data());\n#endif\n}\nVc_INTRINSIC SSE:: short_m operator< (SSE:: short_v a, SSE:: short_v b) { return _mm_cmplt_epi16(a.data(), b.data()); }\nVc_INTRINSIC SSE::ushort_m operator< (SSE::ushort_v a, SSE::ushort_v b) {\n#ifndef USE_INCORRECT_UNSIGNED_COMPARE\n    return SSE::cmplt_epu16(a.data(), b.data());\n#else\n    return _mm_cmplt_epi16(a.data(), b.data());\n#endif\n}\n\nVc_INTRINSIC SSE::double_m operator>=(SSE::double_v a, SSE::double_v b) { return _mm_cmpnlt_pd(a.data(), b.data()); }\nVc_INTRINSIC SSE:: float_m operator>=(SSE:: float_v a, SSE:: float_v b) { return _mm_cmpnlt_ps(a.data(), b.data()); }\nVc_INTRINSIC SSE::   int_m operator>=(SSE::   int_v a, SSE::   int_v b) { return !(a < b); }\nVc_INTRINSIC SSE::  uint_m operator>=(SSE::  uint_v a, SSE::  uint_v b) { return !(a < b); }\nVc_INTRINSIC SSE:: short_m operator>=(SSE:: short_v a, SSE:: short_v b) { return !(a < b); }\nVc_INTRINSIC SSE::ushort_m operator>=(SSE::ushort_v a, SSE::ushort_v b) { return !(a < b); }\n\nVc_INTRINSIC SSE::double_m operator<=(SSE::double_v a, SSE::double_v b) { return _mm_cmple_pd(a.data(), b.data()); }\nVc_INTRINSIC SSE:: float_m operator<=(SSE:: float_v a, SSE:: float_v b) { return _mm_cmple_ps(a.data(), b.data()); }\nVc_INTRINSIC SSE::   int_m operator<=(SSE::   int_v a, SSE::   int_v b) { return !(a > b); }\nVc_INTRINSIC SSE::  uint_m operator<=(SSE::  uint_v a, SSE::  uint_v b) { return !(a > b); }\nVc_INTRINSIC SSE:: short_m operator<=(SSE:: short_v a, SSE:: short_v b) { return !(a > b); }\nVc_INTRINSIC SSE::ushort_m operator<=(SSE::ushort_v a, SSE::ushort_v b) { return !(a > b); }\n\n// bitwise operators {{{1\ntemplate <typename T>\nVc_INTRINSIC SSE::Vector<T> operator^(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return xor_(a.data(), b.data());\n}\ntemplate <typename T>\nVc_INTRINSIC SSE::Vector<T> operator&(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return and_(a.data(), b.data());\n}\ntemplate <typename T>\nVc_INTRINSIC SSE::Vector<T> operator|(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return or_(a.data(), b.data());\n}\n// arithmetic operators {{{1\ntemplate <typename T>\nVc_INTRINSIC SSE::Vector<T> operator+(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return add(a.data(), b.data(), T());\n}\ntemplate <typename T>\nVc_INTRINSIC SSE::Vector<T> operator-(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return sub(a.data(), b.data(), T());\n}\ntemplate <typename T>\nVc_INTRINSIC SSE::Vector<T> operator*(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return mul(a.data(), b.data(), T());\n}\ntemplate <typename T>\nVc_INTRINSIC enable_if<std::is_floating_point<T>::value, SSE::Vector<T>> operator/(\n    SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return div(a.data(), b.data(), T());\n}\ntemplate <typename T>\nVc_INTRINSIC\n    enable_if<std::is_same<int, T>::value || std::is_same<uint, T>::value, SSE::Vector<T>>\n    operator/(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return SSE::Vector<T>::generate([&](int i) { return a[i] / b[i]; });\n}\ntemplate <typename T>\nVc_INTRINSIC enable_if<std::is_same<short, T>::value || std::is_same<ushort, T>::value,\n                       SSE::Vector<T>>\noperator/(SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    using HT = SSE::VectorHelper<T>;\n    __m128 lo = _mm_cvtepi32_ps(HT::expand0(a.data()));\n    __m128 hi = _mm_cvtepi32_ps(HT::expand1(a.data()));\n    lo = _mm_div_ps(lo, _mm_cvtepi32_ps(HT::expand0(b.data())));\n    hi = _mm_div_ps(hi, _mm_cvtepi32_ps(HT::expand1(b.data())));\n    return HT::concat(_mm_cvttps_epi32(lo), _mm_cvttps_epi32(hi));\n}\ntemplate <typename T>\nVc_INTRINSIC enable_if<std::is_integral<T>::value, SSE::Vector<T>> operator%(\n    SSE::Vector<T> a, SSE::Vector<T> b)\n{\n    return a - a / b * b;\n}\n// }}}1\n}  // namespace Detail\n// constants {{{1\ntemplate<typename T> Vc_INTRINSIC Vector<T, VectorAbi::Sse>::Vector(VectorSpecialInitializerZero)\n    : d(HV::zero())\n{\n}\n\ntemplate<typename T> Vc_INTRINSIC Vector<T, VectorAbi::Sse>::Vector(VectorSpecialInitializerOne)\n    : d(HT::one())\n{\n}\n\ntemplate <typename T>\nVc_INTRINSIC Vector<T, VectorAbi::Sse>::Vector(VectorSpecialInitializerIndexesFromZero)\n    : d(Detail::load16(Detail::IndexesFromZero<EntryType, Size>(), Aligned))\n{\n#if defined Vc_GCC && Vc_GCC < 0x40903 && defined Vc_IMPL_AVX2\n    // GCC 4.9.2 (at least) miscompiles SSE::short_v::IndexesFromZero() if used implicitly\n    // from SimdArray<short, 9> compiling for AVX2 to vpmovsxwd (sign extending load from\n    // a 8x 16-bit constant to 8x 32-bit register)\n    if (std::is_same<T, short>::value) {\n        asm(\"\" ::\"x\"(d.v()));\n    }\n#endif\n}\n\ntemplate <>\nVc_INTRINSIC Vector<float, VectorAbi::Sse>::Vector(VectorSpecialInitializerIndexesFromZero)\n    : d(SSE::convert<int, float>(SSE::int_v::IndexesFromZero().data()))\n{\n}\n\ntemplate <>\nVc_INTRINSIC Vector<double, VectorAbi::Sse>::Vector(VectorSpecialInitializerIndexesFromZero)\n    : d(SSE::convert<int, double>(SSE::int_v::IndexesFromZero().data()))\n{\n}\n\n// load member functions {{{1\ntemplate <typename DstT>\ntemplate <typename SrcT, typename Flags>\nVc_INTRINSIC typename Vector<DstT, VectorAbi::Sse>::\n#ifndef Vc_MSVC\ntemplate\n#endif\nload_concept<SrcT, Flags>::type Vector<DstT, VectorAbi::Sse>::load(const SrcT *mem, Flags flags)\n{\n    Common::handleLoadPrefetches(mem, flags);\n    d.v() = Detail::load<VectorType, DstT>(mem, flags);\n}\n\n// zeroing {{{1\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Sse>::setZero()\n{\n    data() = HV::zero();\n}\n\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Sse>::setZero(const Mask &k)\n{\n    data() = Detail::andnot_(k.data(), data());\n}\n\ntemplate<typename T> Vc_INTRINSIC void Vector<T, VectorAbi::Sse>::setZeroInverted(const Mask &k)\n{\n    data() = Detail::and_(k.data(), data());\n}\n\ntemplate<> Vc_INTRINSIC void SSE::double_v::setQnan()\n{\n    data() = SSE::_mm_setallone_pd();\n}\ntemplate<> Vc_INTRINSIC void Vector<double, VectorAbi::Sse>::setQnan(const Mask &k)\n{\n    data() = _mm_or_pd(data(), k.dataD());\n}\ntemplate<> Vc_INTRINSIC void SSE::float_v::setQnan()\n{\n    data() = SSE::_mm_setallone_ps();\n}\ntemplate<> Vc_INTRINSIC void Vector<float, VectorAbi::Sse>::setQnan(const Mask &k)\n{\n    data() = _mm_or_ps(data(), k.dataF());\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// stores {{{1\ntemplate <typename T>\ntemplate <typename U, typename Flags, typename>\nVc_INTRINSIC void Vector<T, VectorAbi::Sse>::store(U *mem, Flags flags) const\n{\n    Common::handleStorePrefetches(mem, flags);\n    HV::template store<Flags>(mem, data());\n}\n\ntemplate <typename T>\ntemplate <typename U, typename Flags, typename>\nVc_INTRINSIC void Vector<T, VectorAbi::Sse>::store(U *mem, Mask mask, Flags flags) const\n{\n    Common::handleStorePrefetches(mem, flags);\n    HV::template store<Flags>(mem, data(), mask.data());\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// operator- {{{1\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::operator-() const\n{\n    return Detail::negate(d.v(), std::integral_constant<std::size_t, sizeof(T)>());\n}\n///////////////////////////////////////////////////////////////////////////////////////////\n// integer ops {{{1\n#ifdef Vc_IMPL_XOP\ntemplate <> Vc_ALWAYS_INLINE    SSE::int_v    SSE::int_v::operator<<(const    SSE::int_v shift) const { return _mm_sha_epi32(d.v(), shift.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE   SSE::uint_v   SSE::uint_v::operator<<(const   SSE::uint_v shift) const { return _mm_shl_epi32(d.v(), shift.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE  SSE::short_v  SSE::short_v::operator<<(const  SSE::short_v shift) const { return _mm_sha_epi16(d.v(), shift.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE SSE::ushort_v SSE::ushort_v::operator<<(const SSE::ushort_v shift) const { return _mm_shl_epi16(d.v(), shift.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE    SSE::int_v    SSE::int_v::operator>>(const    SSE::int_v shift) const { return operator<<(-shift); }\ntemplate <> Vc_ALWAYS_INLINE   SSE::uint_v   SSE::uint_v::operator>>(const   SSE::uint_v shift) const { return operator<<(-shift); }\ntemplate <> Vc_ALWAYS_INLINE  SSE::short_v  SSE::short_v::operator>>(const  SSE::short_v shift) const { return operator<<(-shift); }\ntemplate <> Vc_ALWAYS_INLINE SSE::ushort_v SSE::ushort_v::operator>>(const SSE::ushort_v shift) const { return operator<<(-shift); }\n#elif defined Vc_IMPL_AVX2\ntemplate <> Vc_ALWAYS_INLINE SSE::Vector<   int> Vector<   int, VectorAbi::Sse>::operator<<(const SSE::Vector<   int> x) const { return _mm_sllv_epi32(d.v(), x.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE SSE::Vector<  uint> Vector<  uint, VectorAbi::Sse>::operator<<(const SSE::Vector<  uint> x) const { return _mm_sllv_epi32(d.v(), x.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE SSE::Vector<   int> Vector<   int, VectorAbi::Sse>::operator>>(const SSE::Vector<   int> x) const { return _mm_srav_epi32(d.v(), x.d.v()); }\ntemplate <> Vc_ALWAYS_INLINE SSE::Vector<  uint> Vector<  uint, VectorAbi::Sse>::operator>>(const SSE::Vector<  uint> x) const { return _mm_srlv_epi32(d.v(), x.d.v()); }\n#endif\n\ntemplate<typename T> Vc_ALWAYS_INLINE Vector<T, VectorAbi::Sse> &Vector<T, VectorAbi::Sse>::operator>>=(int shift) {\n    d.v() = HT::shiftRight(d.v(), shift);\n    return *this;\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::operator>>(int shift) const {\n    return HT::shiftRight(d.v(), shift);\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vector<T, VectorAbi::Sse> &Vector<T, VectorAbi::Sse>::operator<<=(int shift) {\n    d.v() = HT::shiftLeft(d.v(), shift);\n    return *this;\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::operator<<(int shift) const {\n    return HT::shiftLeft(d.v(), shift);\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// isnegative {{{1\nVc_INTRINSIC Vc_CONST SSE::float_m isnegative(SSE::float_v x)\n{\n    return sse_cast<__m128>(_mm_srai_epi32(\n        sse_cast<__m128i>(_mm_and_ps(SSE::_mm_setsignmask_ps(), x.data())), 31));\n}\nVc_INTRINSIC Vc_CONST SSE::double_m isnegative(SSE::double_v x)\n{\n    return Mem::permute<X1, X1, X3, X3>(sse_cast<__m128>(_mm_srai_epi32(\n        sse_cast<__m128i>(_mm_and_pd(SSE::_mm_setsignmask_pd(), x.data())), 31)));\n}\n\n// gathers {{{1\n#define Vc_GATHER_IMPL(V_)                                                               \\\n    template <>                                                                          \\\n    template <class MT, class IT, int Scale>                                             \\\n    inline void SSE::V_::gatherImplementation(                                           \\\n        const Common::GatherArguments<MT, IT, Scale> &args)\n#define Vc_M(i_) static_cast<value_type>(args.address[Scale * args.indexes[i_]])\nVc_GATHER_IMPL(double_v) { d.v() = _mm_setr_pd(Vc_M(0), Vc_M(1)); }\nVc_GATHER_IMPL(float_v)  { d.v() = _mm_setr_ps(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3)); }\nVc_GATHER_IMPL(int_v)    { d.v() = _mm_setr_epi32(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3)); }\nVc_GATHER_IMPL(uint_v)   { d.v() = _mm_setr_epi32(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3)); }\nVc_GATHER_IMPL(short_v)\n{\n    d.v() =\n        Vc::set(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3), Vc_M(4), Vc_M(5), Vc_M(6), Vc_M(7));\n}\nVc_GATHER_IMPL(ushort_v)\n{\n    d.v() =\n        Vc::set(Vc_M(0), Vc_M(1), Vc_M(2), Vc_M(3), Vc_M(4), Vc_M(5), Vc_M(6), Vc_M(7));\n}\n#undef Vc_M\n#undef Vc_GATHER_IMPL\n\ntemplate <typename T>\ntemplate <class MT, class IT, int Scale>\ninline void Vector<T, VectorAbi::Sse>::gatherImplementation(\n    const Common::GatherArguments<MT, IT, Scale> &args, MaskArgument mask)\n{\n    const auto *mem = args.address;\n    const auto indexes = Scale * args.indexes;\n    using Selector = std::integral_constant < Common::GatherScatterImplementation,\n#ifdef Vc_USE_SET_GATHERS\n          Traits::is_simd_vector<IT>::value ? Common::GatherScatterImplementation::SetIndexZero :\n#endif\n#ifdef Vc_USE_BSF_GATHERS\n                                            Common::GatherScatterImplementation::BitScanLoop\n#elif defined Vc_USE_POPCNT_BSF_GATHERS\n              Common::GatherScatterImplementation::PopcntSwitch\n#else\n              Common::GatherScatterImplementation::SimpleLoop\n#endif\n                                                > ;\n    Common::executeGather(Selector(), *this, mem, indexes, mask);\n}\n\n// scatters {{{1\ntemplate <typename T>\ntemplate <typename MT, typename IT>\ninline void Vector<T, VectorAbi::Sse>::scatterImplementation(MT *mem, IT &&indexes) const\n{\n    Common::unrolled_loop<std::size_t, 0, Size>([&](std::size_t i) { mem[indexes[i]] = d.m(i); });\n}\n\ntemplate <typename T>\ntemplate <typename MT, typename IT>\ninline void Vector<T, VectorAbi::Sse>::scatterImplementation(MT *mem, IT &&indexes, MaskArgument mask) const\n{\n    using Selector = std::integral_constant < Common::GatherScatterImplementation,\n#ifdef Vc_USE_SET_GATHERS\n          Traits::is_simd_vector<IT>::value ? Common::GatherScatterImplementation::SetIndexZero :\n#endif\n#ifdef Vc_USE_BSF_GATHERS\n                                            Common::GatherScatterImplementation::BitScanLoop\n#elif defined Vc_USE_POPCNT_BSF_GATHERS\n              Common::GatherScatterImplementation::PopcntSwitch\n#else\n              Common::GatherScatterImplementation::SimpleLoop\n#endif\n                                                > ;\n    Common::executeScatter(Selector(), *this, mem, indexes, mask);\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// horizontal ops {{{1\ntemplate<typename T> Vc_ALWAYS_INLINE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::partialSum() const\n{\n    //   a    b    c    d    e    f    g    h\n    // +      a    b    c    d    e    f    g    -> a ab bc  cd   de    ef     fg      gh\n    // +           a    ab   bc   cd   de   ef   -> a ab abc abcd bcde  cdef   defg    efgh\n    // +                     a    ab   abc  abcd -> a ab abc abcd abcde abcdef abcdefg abcdefgh\n    Vector<T, VectorAbi::Sse> tmp = *this;\n    if (Size >  1) tmp += tmp.shifted(-1);\n    if (Size >  2) tmp += tmp.shifted(-2);\n    if (Size >  4) tmp += tmp.shifted(-4);\n    if (Size >  8) tmp += tmp.shifted(-8);\n    if (Size > 16) tmp += tmp.shifted(-16);\n    return tmp;\n}\n#ifndef Vc_IMPL_SSE4_1\n// without SSE4.1 integer multiplication is slow and we rather multiply the scalars\ntemplate<> Vc_INTRINSIC Vc_PURE int SSE::int_v::product() const\n{\n    return (d.m(0) * d.m(1)) * (d.m(2) * d.m(3));\n}\ntemplate<> Vc_INTRINSIC Vc_PURE unsigned int SSE::uint_v::product() const\n{\n    return (d.m(0) * d.m(1)) * (d.m(2) * d.m(3));\n}\n#endif\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE typename Vector<T, VectorAbi::Sse>::EntryType Vector<T, VectorAbi::Sse>::min(MaskArg m) const\n{\n    Vector<T, VectorAbi::Sse> tmp = std::numeric_limits<Vector<T, VectorAbi::Sse> >::max();\n    tmp(m) = *this;\n    return tmp.min();\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE typename Vector<T, VectorAbi::Sse>::EntryType Vector<T, VectorAbi::Sse>::max(MaskArg m) const\n{\n    Vector<T, VectorAbi::Sse> tmp = std::numeric_limits<Vector<T, VectorAbi::Sse> >::min();\n    tmp(m) = *this;\n    return tmp.max();\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE typename Vector<T, VectorAbi::Sse>::EntryType Vector<T, VectorAbi::Sse>::product(MaskArg m) const\n{\n    Vector<T, VectorAbi::Sse> tmp(Vc::One);\n    tmp(m) = *this;\n    return tmp.product();\n}\ntemplate<typename T> Vc_ALWAYS_INLINE Vc_PURE typename Vector<T, VectorAbi::Sse>::EntryType Vector<T, VectorAbi::Sse>::sum(MaskArg m) const\n{\n    Vector<T, VectorAbi::Sse> tmp(Vc::Zero);\n    tmp(m) = *this;\n    return tmp.sum();\n}\n\n///////////////////////////////////////////////////////////////////////////////////////////\n// exponent {{{1\nnamespace Detail\n{\nVc_INTRINSIC Vc_CONST __m128 exponent(__m128 v)\n{\n    __m128i tmp = _mm_srli_epi32(_mm_castps_si128(v), 23);\n    tmp = _mm_sub_epi32(tmp, _mm_set1_epi32(0x7f));\n    return _mm_cvtepi32_ps(tmp);\n}\nVc_INTRINSIC Vc_CONST __m128d exponent(__m128d v)\n{\n    __m128i tmp = _mm_srli_epi64(_mm_castpd_si128(v), 52);\n    tmp = _mm_sub_epi32(tmp, _mm_set1_epi32(0x3ff));\n    return _mm_cvtepi32_pd(_mm_shuffle_epi32(tmp, 0x08));\n}\n} // namespace Detail\n\nVc_INTRINSIC Vc_CONST SSE::float_v exponent(SSE::float_v x)\n{\n    using Detail::operator>=;\n    Vc_ASSERT((x >= x.Zero()).isFull());\n    return Detail::exponent(x.data());\n}\nVc_INTRINSIC Vc_CONST SSE::double_v exponent(SSE::double_v x)\n{\n    using Detail::operator>=;\n    Vc_ASSERT((x >= x.Zero()).isFull());\n    return Detail::exponent(x.data());\n}\n// }}}1\n// Random {{{1\nstatic void _doRandomStep(SSE::uint_v &state0,\n        SSE::uint_v &state1)\n{\n    using SSE::uint_v;\n    using Detail::operator+;\n    using Detail::operator*;\n    state0.load(&Common::RandomState[0]);\n    state1.load(&Common::RandomState[uint_v::Size]);\n    (state1 * uint_v(0xdeece66du) + uint_v(11)).store(&Common::RandomState[uint_v::Size]);\n    uint_v(_mm_xor_si128((state0 * uint_v(0xdeece66du) + uint_v(11)).data(),\n                         _mm_srli_epi32(state1.data(), 16)))\n        .store(&Common::RandomState[0]);\n}\n\ntemplate<typename T> Vc_ALWAYS_INLINE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::Random()\n{\n    SSE::uint_v state0, state1;\n    _doRandomStep(state0, state1);\n    return state0.data();\n}\n\ntemplate<> Vc_ALWAYS_INLINE SSE::float_v SSE::float_v::Random()\n{\n    SSE::uint_v state0, state1;\n    _doRandomStep(state0, state1);\n    return _mm_sub_ps(_mm_or_ps(_mm_castsi128_ps(_mm_srli_epi32(state0.data(), 2)), HT::one()), HT::one());\n}\n\ntemplate<> Vc_ALWAYS_INLINE SSE::double_v SSE::double_v::Random()\n{\n    typedef unsigned long long uint64 Vc_MAY_ALIAS;\n    uint64 state0 = *reinterpret_cast<const uint64 *>(&Common::RandomState[8]);\n    uint64 state1 = *reinterpret_cast<const uint64 *>(&Common::RandomState[10]);\n    const __m128i state = _mm_load_si128(reinterpret_cast<const __m128i *>(&Common::RandomState[8]));\n    *reinterpret_cast<uint64 *>(&Common::RandomState[ 8]) = (state0 * 0x5deece66dull + 11);\n    *reinterpret_cast<uint64 *>(&Common::RandomState[10]) = (state1 * 0x5deece66dull + 11);\n    return _mm_sub_pd(_mm_or_pd(_mm_castsi128_pd(_mm_srli_epi64(state, 12)), HT::one()), HT::one());\n}\n// shifted / rotated {{{1\ntemplate<typename T> Vc_INTRINSIC Vc_PURE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::shifted(int amount) const\n{\n    enum {\n        EntryTypeSizeof = sizeof(EntryType)\n    };\n    switch (amount) {\n    case  0: return *this;\n    case  1: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 1 * EntryTypeSizeof));\n    case  2: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 2 * EntryTypeSizeof));\n    case  3: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 3 * EntryTypeSizeof));\n    case  4: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 4 * EntryTypeSizeof));\n    case  5: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 5 * EntryTypeSizeof));\n    case  6: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 6 * EntryTypeSizeof));\n    case  7: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 7 * EntryTypeSizeof));\n    case  8: return SSE::sse_cast<VectorType>(_mm_srli_si128(SSE::sse_cast<__m128i>(d.v()), 8 * EntryTypeSizeof));\n    case -1: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 1 * EntryTypeSizeof));\n    case -2: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 2 * EntryTypeSizeof));\n    case -3: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 3 * EntryTypeSizeof));\n    case -4: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 4 * EntryTypeSizeof));\n    case -5: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 5 * EntryTypeSizeof));\n    case -6: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 6 * EntryTypeSizeof));\n    case -7: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 7 * EntryTypeSizeof));\n    case -8: return SSE::sse_cast<VectorType>(_mm_slli_si128(SSE::sse_cast<__m128i>(d.v()), 8 * EntryTypeSizeof));\n    }\n    return Zero();\n}\ntemplate<typename T> Vc_INTRINSIC Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::shifted(int amount, Vector shiftIn) const\n{\n    if (amount >= -int(size())) {\n        constexpr int VectorWidth = int(size());\n        constexpr int EntryTypeSizeof = sizeof(EntryType);\n        const __m128i v0 = sse_cast<__m128i>(d.v());\n        const __m128i v1 = sse_cast<__m128i>(shiftIn.d.v());\n        auto &&fixup = sse_cast<VectorType, __m128i>;\n        switch (amount) {\n        case  0: return *this;\n                 // alignr_epi8: [arg1 arg0] << n\n        case -1: return fixup(SSE::alignr_epi8<(VectorWidth - 1) * EntryTypeSizeof>(v0, v1));\n        case -2: return fixup(SSE::alignr_epi8<(VectorWidth - 2) * EntryTypeSizeof>(v0, v1));\n        case -3: return fixup(SSE::alignr_epi8<(VectorWidth - 3) * EntryTypeSizeof>(v0, v1));\n        case -4: return fixup(SSE::alignr_epi8<(VectorWidth - 4) * EntryTypeSizeof>(v0, v1));\n        case -5: return fixup(SSE::alignr_epi8<(VectorWidth - 5) * EntryTypeSizeof>(v0, v1));\n        case -6: return fixup(SSE::alignr_epi8<(VectorWidth - 6) * EntryTypeSizeof>(v0, v1));\n        case -7: return fixup(SSE::alignr_epi8<(VectorWidth - 7) * EntryTypeSizeof>(v0, v1));\n        case -8: return fixup(SSE::alignr_epi8<(VectorWidth - 8) * EntryTypeSizeof>(v0, v1));\n        case -9: return fixup(SSE::alignr_epi8<(VectorWidth - 9) * EntryTypeSizeof>(v0, v1));\n        case-10: return fixup(SSE::alignr_epi8<(VectorWidth -10) * EntryTypeSizeof>(v0, v1));\n        case-11: return fixup(SSE::alignr_epi8<(VectorWidth -11) * EntryTypeSizeof>(v0, v1));\n        case-12: return fixup(SSE::alignr_epi8<(VectorWidth -12) * EntryTypeSizeof>(v0, v1));\n        case-13: return fixup(SSE::alignr_epi8<(VectorWidth -13) * EntryTypeSizeof>(v0, v1));\n        case-14: return fixup(SSE::alignr_epi8<(VectorWidth -14) * EntryTypeSizeof>(v0, v1));\n        case-15: return fixup(SSE::alignr_epi8<(VectorWidth -15) * EntryTypeSizeof>(v0, v1));\n        case  1: return fixup(SSE::alignr_epi8< 1 * EntryTypeSizeof>(v1, v0));\n        case  2: return fixup(SSE::alignr_epi8< 2 * EntryTypeSizeof>(v1, v0));\n        case  3: return fixup(SSE::alignr_epi8< 3 * EntryTypeSizeof>(v1, v0));\n        case  4: return fixup(SSE::alignr_epi8< 4 * EntryTypeSizeof>(v1, v0));\n        case  5: return fixup(SSE::alignr_epi8< 5 * EntryTypeSizeof>(v1, v0));\n        case  6: return fixup(SSE::alignr_epi8< 6 * EntryTypeSizeof>(v1, v0));\n        case  7: return fixup(SSE::alignr_epi8< 7 * EntryTypeSizeof>(v1, v0));\n        case  8: return fixup(SSE::alignr_epi8< 8 * EntryTypeSizeof>(v1, v0));\n        case  9: return fixup(SSE::alignr_epi8< 9 * EntryTypeSizeof>(v1, v0));\n        case 10: return fixup(SSE::alignr_epi8<10 * EntryTypeSizeof>(v1, v0));\n        case 11: return fixup(SSE::alignr_epi8<11 * EntryTypeSizeof>(v1, v0));\n        case 12: return fixup(SSE::alignr_epi8<12 * EntryTypeSizeof>(v1, v0));\n        case 13: return fixup(SSE::alignr_epi8<13 * EntryTypeSizeof>(v1, v0));\n        case 14: return fixup(SSE::alignr_epi8<14 * EntryTypeSizeof>(v1, v0));\n        case 15: return fixup(SSE::alignr_epi8<15 * EntryTypeSizeof>(v1, v0));\n        }\n    }\n    return shiftIn.shifted(int(size()) + amount);\n}\ntemplate<typename T> Vc_INTRINSIC Vc_PURE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::rotated(int amount) const\n{\n    enum {\n        EntryTypeSizeof = sizeof(EntryType)\n    };\n    const __m128i v = SSE::sse_cast<__m128i>(d.v());\n    switch (static_cast<unsigned int>(amount) % Size) {\n    case  0: return *this;\n    case  1: return SSE::sse_cast<VectorType>(SSE::alignr_epi8<1 * EntryTypeSizeof>(v, v));\n    case  2: return SSE::sse_cast<VectorType>(SSE::alignr_epi8<2 * EntryTypeSizeof>(v, v));\n    case  3: return SSE::sse_cast<VectorType>(SSE::alignr_epi8<3 * EntryTypeSizeof>(v, v));\n             // warning \"Immediate parameter to intrinsic call too large\" disabled in VcMacros.cmake.\n             // ICC fails to see that the modulo operation (Size == sizeof(VectorType) / sizeof(EntryType))\n             // disables the following four calls unless sizeof(EntryType) == 2.\n    case  4: return SSE::sse_cast<VectorType>(SSE::alignr_epi8<4 * EntryTypeSizeof>(v, v));\n    case  5: return SSE::sse_cast<VectorType>(SSE::alignr_epi8<5 * EntryTypeSizeof>(v, v));\n    case  6: return SSE::sse_cast<VectorType>(SSE::alignr_epi8<6 * EntryTypeSizeof>(v, v));\n    case  7: return SSE::sse_cast<VectorType>(SSE::alignr_epi8<7 * EntryTypeSizeof>(v, v));\n    }\n    return Zero();\n}\n// sorted {{{1\nnamespace Detail\n{\ninline Vc_CONST SSE::double_v sorted(SSE::double_v x_)\n{\n    const __m128d x = x_.data();\n    const __m128d y = _mm_shuffle_pd(x, x, _MM_SHUFFLE2(0, 1));\n    return _mm_unpacklo_pd(_mm_min_sd(x, y), _mm_max_sd(x, y));\n}\n}  // namespace Detail\ntemplate <typename T>\nVc_ALWAYS_INLINE Vc_PURE Vector<T, VectorAbi::Sse> Vector<T, VectorAbi::Sse>::sorted()\n    const\n{\n    return Detail::sorted(*this);\n}\n// interleaveLow/-High {{{1\ntemplate <> Vc_INTRINSIC SSE::double_v SSE::double_v::interleaveLow (SSE::double_v x) const { return _mm_unpacklo_pd(data(), x.data()); }\ntemplate <> Vc_INTRINSIC SSE::double_v SSE::double_v::interleaveHigh(SSE::double_v x) const { return _mm_unpackhi_pd(data(), x.data()); }\ntemplate <> Vc_INTRINSIC  SSE::float_v  SSE::float_v::interleaveLow ( SSE::float_v x) const { return _mm_unpacklo_ps(data(), x.data()); }\ntemplate <> Vc_INTRINSIC  SSE::float_v  SSE::float_v::interleaveHigh( SSE::float_v x) const { return _mm_unpackhi_ps(data(), x.data()); }\ntemplate <> Vc_INTRINSIC    SSE::int_v    SSE::int_v::interleaveLow (   SSE::int_v x) const { return _mm_unpacklo_epi32(data(), x.data()); }\ntemplate <> Vc_INTRINSIC    SSE::int_v    SSE::int_v::interleaveHigh(   SSE::int_v x) const { return _mm_unpackhi_epi32(data(), x.data()); }\ntemplate <> Vc_INTRINSIC   SSE::uint_v   SSE::uint_v::interleaveLow (  SSE::uint_v x) const { return _mm_unpacklo_epi32(data(), x.data()); }\ntemplate <> Vc_INTRINSIC   SSE::uint_v   SSE::uint_v::interleaveHigh(  SSE::uint_v x) const { return _mm_unpackhi_epi32(data(), x.data()); }\ntemplate <> Vc_INTRINSIC  SSE::short_v  SSE::short_v::interleaveLow ( SSE::short_v x) const { return _mm_unpacklo_epi16(data(), x.data()); }\ntemplate <> Vc_INTRINSIC  SSE::short_v  SSE::short_v::interleaveHigh( SSE::short_v x) const { return _mm_unpackhi_epi16(data(), x.data()); }\ntemplate <> Vc_INTRINSIC SSE::ushort_v SSE::ushort_v::interleaveLow (SSE::ushort_v x) const { return _mm_unpacklo_epi16(data(), x.data()); }\ntemplate <> Vc_INTRINSIC SSE::ushort_v SSE::ushort_v::interleaveHigh(SSE::ushort_v x) const { return _mm_unpackhi_epi16(data(), x.data()); }\n// }}}1\n// generate {{{1\ntemplate <> template <typename G> Vc_INTRINSIC SSE::double_v SSE::double_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    return _mm_setr_pd(tmp0, tmp1);\n}\ntemplate <> template <typename G> Vc_INTRINSIC SSE::float_v SSE::float_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    return _mm_setr_ps(tmp0, tmp1, tmp2, tmp3);\n}\ntemplate <> template <typename G> Vc_INTRINSIC SSE::int_v SSE::int_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    return _mm_setr_epi32(tmp0, tmp1, tmp2, tmp3);\n}\ntemplate <> template <typename G> Vc_INTRINSIC SSE::uint_v SSE::uint_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    return _mm_setr_epi32(tmp0, tmp1, tmp2, tmp3);\n}\ntemplate <> template <typename G> Vc_INTRINSIC SSE::short_v SSE::short_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    const auto tmp4 = gen(4);\n    const auto tmp5 = gen(5);\n    const auto tmp6 = gen(6);\n    const auto tmp7 = gen(7);\n    return _mm_setr_epi16(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7);\n}\ntemplate <> template <typename G> Vc_INTRINSIC SSE::ushort_v SSE::ushort_v::generate(G gen)\n{\n    const auto tmp0 = gen(0);\n    const auto tmp1 = gen(1);\n    const auto tmp2 = gen(2);\n    const auto tmp3 = gen(3);\n    const auto tmp4 = gen(4);\n    const auto tmp5 = gen(5);\n    const auto tmp6 = gen(6);\n    const auto tmp7 = gen(7);\n    return _mm_setr_epi16(tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7);\n}\n// }}}1\n// reversed {{{1\ntemplate <> Vc_INTRINSIC Vc_PURE SSE::double_v SSE::double_v::reversed() const\n{\n    return Mem::permute<X1, X0>(d.v());\n}\ntemplate <> Vc_INTRINSIC Vc_PURE SSE::float_v SSE::float_v::reversed() const\n{\n    return Mem::permute<X3, X2, X1, X0>(d.v());\n}\ntemplate <> Vc_INTRINSIC Vc_PURE SSE::int_v SSE::int_v::reversed() const\n{\n    return Mem::permute<X3, X2, X1, X0>(d.v());\n}\ntemplate <> Vc_INTRINSIC Vc_PURE SSE::uint_v SSE::uint_v::reversed() const\n{\n    return Mem::permute<X3, X2, X1, X0>(d.v());\n}\ntemplate <> Vc_INTRINSIC Vc_PURE SSE::short_v SSE::short_v::reversed() const\n{\n    return sse_cast<__m128i>(\n        Mem::shuffle<X1, Y0>(sse_cast<__m128d>(Mem::permuteHi<X7, X6, X5, X4>(d.v())),\n                             sse_cast<__m128d>(Mem::permuteLo<X3, X2, X1, X0>(d.v()))));\n}\ntemplate <> Vc_INTRINSIC Vc_PURE SSE::ushort_v SSE::ushort_v::reversed() const\n{\n    return sse_cast<__m128i>(\n        Mem::shuffle<X1, Y0>(sse_cast<__m128d>(Mem::permuteHi<X7, X6, X5, X4>(d.v())),\n                             sse_cast<__m128d>(Mem::permuteLo<X3, X2, X1, X0>(d.v()))));\n}\n// }}}1\n// permutation via operator[] {{{1\ntemplate <>\nVc_INTRINSIC SSE::float_v SSE::float_v::operator[](const SSE::int_v &\n#ifdef Vc_IMPL_AVX\n                                             perm\n#endif\n                                         ) const\n{\n    /*\n    const int_m cross128 = concat(_mm_cmpgt_epi32(lo128(perm.data()), _mm_set1_epi32(3)),\n                                  _mm_cmplt_epi32(hi128(perm.data()), _mm_set1_epi32(4)));\n    if (cross128.isNotEmpty()) {\n    SSE::float_v x = _mm256_permutevar_ps(d.v(), perm.data());\n        x(cross128) = _mm256_permutevar_ps(Mem::permute128<X1, X0>(d.v()), perm.data());\n        return x;\n    } else {\n    */\n#ifdef Vc_IMPL_AVX\n    return _mm_permutevar_ps(d.v(), perm.data());\n#else\n    return *this;//TODO\n#endif\n}\n// broadcast from constexpr index {{{1\ntemplate <> template <int Index> Vc_INTRINSIC SSE::float_v SSE::float_v::broadcast() const\n{\n    constexpr VecPos Inner = static_cast<VecPos>(Index & 0x3);\n    return Mem::permute<Inner, Inner, Inner, Inner>(d.v());\n}\ntemplate <> template <int Index> Vc_INTRINSIC SSE::double_v SSE::double_v::broadcast() const\n{\n    constexpr VecPos Inner = static_cast<VecPos>(Index & 0x1);\n    return Mem::permute<Inner, Inner>(d.v());\n}\n// }}}1\n\nnamespace Common\n{\n// transpose_impl {{{1\nVc_ALWAYS_INLINE void transpose_impl(\n    TransposeTag<4, 4>, SSE::float_v *Vc_RESTRICT r[],\n    const TransposeProxy<SSE::float_v, SSE::float_v, SSE::float_v, SSE::float_v> &proxy)\n{\n    const auto in0 = std::get<0>(proxy.in).data();\n    const auto in1 = std::get<1>(proxy.in).data();\n    const auto in2 = std::get<2>(proxy.in).data();\n    const auto in3 = std::get<3>(proxy.in).data();\n    const auto tmp0 = _mm_unpacklo_ps(in0, in2);\n    const auto tmp1 = _mm_unpacklo_ps(in1, in3);\n    const auto tmp2 = _mm_unpackhi_ps(in0, in2);\n    const auto tmp3 = _mm_unpackhi_ps(in1, in3);\n    *r[0] = _mm_unpacklo_ps(tmp0, tmp1);\n    *r[1] = _mm_unpackhi_ps(tmp0, tmp1);\n    *r[2] = _mm_unpacklo_ps(tmp2, tmp3);\n    *r[3] = _mm_unpackhi_ps(tmp2, tmp3);\n}\n// }}}1\n}  // namespace Common\n}\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/vectorhelper.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_SSE_VECTORHELPER_H_\n#define VC_SSE_VECTORHELPER_H_\n\n#include \"types.h\"\n#include \"../common/loadstoreflags.h\"\n#include <limits>\n#include \"const_data.h\"\n#include \"macros.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\n#define Vc_OP0(name, code) static Vc_ALWAYS_INLINE Vc_CONST VectorType name() { return code; }\n#define Vc_OP1(name, code) static Vc_ALWAYS_INLINE Vc_CONST VectorType name(const VectorType a) { return code; }\n#define Vc_OP2(name, code) static Vc_ALWAYS_INLINE Vc_CONST VectorType name(const VectorType a, const VectorType b) { return code; }\n#define Vc_OP3(name, code) static Vc_ALWAYS_INLINE Vc_CONST VectorType name(const VectorType a, const VectorType b, const VectorType c) { return code; }\n\n        template<> struct VectorHelper<__m128>\n        {\n            typedef __m128 VectorType;\n\n            template<typename Flags> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const float *x, typename Flags::EnableIfAligned  = nullptr) { return _mm_load_ps(x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const float *x, typename Flags::EnableIfUnaligned = nullptr) { return _mm_loadu_ps(x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const float *x, typename Flags::EnableIfStreaming = nullptr) { return _mm_stream_load(x); }\n\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VectorType x, typename Flags::EnableIfAligned               = nullptr) { _mm_store_ps(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VectorType x, typename Flags::EnableIfUnalignedNotStreaming = nullptr) { _mm_storeu_ps(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VectorType x, typename Flags::EnableIfStreaming             = nullptr) { _mm_stream_ps(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VectorType x, typename Flags::EnableIfUnalignedAndStreaming = nullptr) { _mm_maskmoveu_si128(_mm_castps_si128(x), _mm_setallone_si128(), reinterpret_cast<char *>(mem)); }\n\n            // before AVX there was only one maskstore. load -> blend -> store would break the C++ memory model (read/write of memory that is actually not touched by this thread)\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(float *mem, VectorType x, VectorType m) { _mm_maskmoveu_si128(_mm_castps_si128(x), _mm_castps_si128(m), reinterpret_cast<char *>(mem)); }\n\n            Vc_OP0(allone, _mm_setallone_ps())\n            Vc_OP0(zero, _mm_setzero_ps())\n            Vc_OP3(blend, blendv_ps(a, b, c))\n        };\n\n\n        template<> struct VectorHelper<__m128d>\n        {\n            typedef __m128d VectorType;\n\n            template<typename Flags> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const double *x, typename Flags::EnableIfAligned   = nullptr) { return _mm_load_pd(x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const double *x, typename Flags::EnableIfUnaligned = nullptr) { return _mm_loadu_pd(x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const double *x, typename Flags::EnableIfStreaming = nullptr) { return _mm_stream_load(x); }\n\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VectorType x, typename Flags::EnableIfAligned               = nullptr) { _mm_store_pd(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VectorType x, typename Flags::EnableIfUnalignedNotStreaming = nullptr) { _mm_storeu_pd(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VectorType x, typename Flags::EnableIfStreaming             = nullptr) { _mm_stream_pd(mem, x); }\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VectorType x, typename Flags::EnableIfUnalignedAndStreaming = nullptr) { _mm_maskmoveu_si128(_mm_castpd_si128(x), _mm_setallone_si128(), reinterpret_cast<char *>(mem)); }\n\n            // before AVX there was only one maskstore. load -> blend -> store would break the C++ memory model (read/write of memory that is actually not touched by this thread)\n            template<typename Flags> static Vc_ALWAYS_INLINE void store(double *mem, VectorType x, VectorType m) { _mm_maskmoveu_si128(_mm_castpd_si128(x), _mm_castpd_si128(m), reinterpret_cast<char *>(mem)); }\n\n            Vc_OP0(allone, _mm_setallone_pd())\n            Vc_OP0(zero, _mm_setzero_pd())\n            Vc_OP3(blend, blendv_pd(a, b, c))\n        };\n\n        template<> struct VectorHelper<__m128i>\n        {\n            typedef __m128i VectorType;\n\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const T *x, typename Flags::EnableIfAligned   = nullptr) { return _mm_load_si128(reinterpret_cast<const VectorType *>(x)); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const T *x, typename Flags::EnableIfUnaligned = nullptr) { return _mm_loadu_si128(reinterpret_cast<const VectorType *>(x)); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE Vc_PURE VectorType load(const T *x, typename Flags::EnableIfStreaming = nullptr) { return _mm_stream_load(x); }\n\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VectorType x, typename Flags::EnableIfAligned               = nullptr) { _mm_store_si128(reinterpret_cast<VectorType *>(mem), x); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VectorType x, typename Flags::EnableIfUnalignedNotStreaming = nullptr) { _mm_storeu_si128(reinterpret_cast<VectorType *>(mem), x); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VectorType x, typename Flags::EnableIfStreaming             = nullptr) { _mm_stream_si128(reinterpret_cast<VectorType *>(mem), x); }\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VectorType x, typename Flags::EnableIfUnalignedAndStreaming = nullptr) { _mm_maskmoveu_si128(x, _mm_setallone_si128(), reinterpret_cast<char *>(mem)); }\n\n            // before AVX there was only one maskstore. load -> blend -> store would break the C++ memory model (read/write of memory that is actually not touched by this thread)\n            template<typename Flags, typename T> static Vc_ALWAYS_INLINE void store(T *mem, VectorType x, VectorType m) { _mm_maskmoveu_si128(x, m, reinterpret_cast<char *>(mem)); }\n\n            Vc_OP0(allone, _mm_setallone_si128())\n            Vc_OP0(zero, _mm_setzero_si128())\n            Vc_OP3(blend, blendv_epi8(a, b, c))\n        };\n\n#undef Vc_OP1\n#undef Vc_OP2\n#undef Vc_OP3\n\n#define Vc_OP1(op) \\\n        static Vc_ALWAYS_INLINE Vc_CONST VectorType op(const VectorType a) { return Vc_CAT2(_mm_##op##_, Vc_SUFFIX)(a); }\n#define Vc_OP(op) \\\n        static Vc_ALWAYS_INLINE Vc_CONST VectorType op(const VectorType a, const VectorType b) { return Vc_CAT2(_mm_##op##_ , Vc_SUFFIX)(a, b); }\n#define Vc_OP_(op) \\\n        static Vc_ALWAYS_INLINE Vc_CONST VectorType op(const VectorType a, const VectorType b) { return Vc_CAT2(_mm_##op    , Vc_SUFFIX)(a, b); }\n#define Vc_OPx(op, op2) \\\n        static Vc_ALWAYS_INLINE Vc_CONST VectorType op(const VectorType a, const VectorType b) { return Vc_CAT2(_mm_##op2##_, Vc_SUFFIX)(a, b); }\n#define Vc_OP_CAST_(op) \\\n        static Vc_ALWAYS_INLINE Vc_CONST VectorType op(const VectorType a, const VectorType b) { return Vc_CAT2(_mm_castps_, Vc_SUFFIX)( \\\n            _mm_##op##ps(Vc_CAT2(Vc_CAT2(_mm_cast, Vc_SUFFIX), _ps)(a), \\\n              Vc_CAT2(Vc_CAT2(_mm_cast, Vc_SUFFIX), _ps)(b))); \\\n        }\n#define Vc_MINMAX \\\n        static Vc_ALWAYS_INLINE Vc_CONST VectorType min(VectorType a, VectorType b) { return Vc_CAT2(_mm_min_, Vc_SUFFIX)(a, b); } \\\n        static Vc_ALWAYS_INLINE Vc_CONST VectorType max(VectorType a, VectorType b) { return Vc_CAT2(_mm_max_, Vc_SUFFIX)(a, b); }\n\n        template<> struct VectorHelper<double> {\n            typedef __m128d VectorType;\n            typedef double EntryType;\n#define Vc_SUFFIX pd\n\n            Vc_OP_(or_) Vc_OP_(and_) Vc_OP_(xor_)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType notMaskedToZero(VectorType a, __m128 mask) { return Vc_CAT2(_mm_and_, Vc_SUFFIX)(_mm_castps_pd(mask), a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const double a) { return Vc_CAT2(_mm_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const double a, const double b) { return Vc_CAT2(_mm_set_, Vc_SUFFIX)(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType zero() { return Vc_CAT2(_mm_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType one()  { return Vc_CAT2(_mm_setone_, Vc_SUFFIX)(); }// set(1.); }\n\n#ifdef Vc_IMPL_FMA4\n            static Vc_ALWAYS_INLINE void fma(VectorType &v1, VectorType v2, VectorType v3) {\n                v1 = _mm_macc_pd(v1, v2, v3);\n            }\n#else\n            static inline void fma(VectorType &v1, VectorType v2, VectorType v3) {\n                VectorType h1 = _mm_and_pd(v1, _mm_load_pd(reinterpret_cast<const double *>(&c_general::highMaskDouble)));\n                VectorType h2 = _mm_and_pd(v2, _mm_load_pd(reinterpret_cast<const double *>(&c_general::highMaskDouble)));\n#if defined(Vc_GCC) && Vc_GCC < 0x40703\n                // GCC before 4.7.3 uses an incorrect optimization where it replaces the subtraction with an andnot\n                // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54703\n                asm(\"\":\"+x\"(h1), \"+x\"(h2));\n#endif\n                const VectorType l1 = _mm_sub_pd(v1, h1);\n                const VectorType l2 = _mm_sub_pd(v2, h2);\n                const VectorType ll = mul(l1, l2);\n                const VectorType lh = add(mul(l1, h2), mul(h1, l2));\n                const VectorType hh = mul(h1, h2);\n                // ll < lh < hh for all entries is certain\n                const VectorType lh_lt_v3 = _mm_cmplt_pd(abs(lh), abs(v3)); // |lh| < |v3|\n                const VectorType b = blendv_pd(v3, lh, lh_lt_v3);\n                const VectorType c = blendv_pd(lh, v3, lh_lt_v3);\n                v1 = add(add(ll, b), add(c, hh));\n            }\n#endif\n\n            Vc_OP(add) Vc_OP(sub) Vc_OP(mul)\n\n            Vc_OP1(sqrt)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType rsqrt(VectorType x) {\n                return _mm_div_pd(one(), sqrt(x));\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType reciprocal(VectorType x) {\n                return _mm_div_pd(one(), x);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType isNaN(VectorType x) {\n                return _mm_cmpunord_pd(x, x);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType isFinite(VectorType x) {\n                return _mm_cmpord_pd(x, _mm_mul_pd(zero(), x));\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType isInfinite(VectorType x) {\n                return _mm_castsi128_pd(cmpeq_epi64(_mm_castpd_si128(abs(x)), _mm_castpd_si128(_mm_load_pd(c_log<double>::d(1)))));\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType abs(const VectorType a) {\n                return Vc_CAT2(_mm_and_, Vc_SUFFIX)(a, _mm_setabsmask_pd());\n            }\n\n            Vc_MINMAX\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VectorType a) {\n                a = _mm_min_sd(a, _mm_unpackhi_pd(a, a));\n                return _mm_cvtsd_f64(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VectorType a) {\n                a = _mm_max_sd(a, _mm_unpackhi_pd(a, a));\n                return _mm_cvtsd_f64(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VectorType a) {\n                a = _mm_mul_sd(a, _mm_shuffle_pd(a, a, _MM_SHUFFLE2(0, 1)));\n                return _mm_cvtsd_f64(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VectorType a) {\n                a = _mm_add_sd(a, _mm_shuffle_pd(a, a, _MM_SHUFFLE2(0, 1)));\n                return _mm_cvtsd_f64(a);\n            }\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VectorType a) {\n#ifdef Vc_IMPL_SSE4_1\n                return _mm_round_pd(a, _MM_FROUND_NINT);\n#else\n                //XXX: slow: _MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);\n                return _mm_cvtepi32_pd(_mm_cvtpd_epi32(a));\n#endif\n            }\n        };\n\n        template<> struct VectorHelper<float> {\n            typedef float EntryType;\n            typedef __m128 VectorType;\n#define Vc_SUFFIX ps\n\n            Vc_OP_(or_) Vc_OP_(and_) Vc_OP_(xor_)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType notMaskedToZero(VectorType a, __m128 mask) { return Vc_CAT2(_mm_and_, Vc_SUFFIX)(mask, a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const float a) { return Vc_CAT2(_mm_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const float a, const float b, const float c, const float d) { return Vc_CAT2(_mm_set_, Vc_SUFFIX)(a, b, c, d); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType zero() { return Vc_CAT2(_mm_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType one()  { return Vc_CAT2(_mm_setone_, Vc_SUFFIX)(); }// set(1.f); }\n            static Vc_ALWAYS_INLINE Vc_CONST __m128 concat(__m128d a, __m128d b) { return _mm_movelh_ps(_mm_cvtpd_ps(a), _mm_cvtpd_ps(b)); }\n\n#ifdef Vc_IMPL_FMA4\n            static Vc_ALWAYS_INLINE void fma(VectorType &v1, VectorType v2, VectorType v3) {\n                v1 = _mm_macc_ps(v1, v2, v3);\n            }\n#else\n            static inline void fma(VectorType &v1, VectorType v2, VectorType v3) {\n                __m128d v1_0 = _mm_cvtps_pd(v1);\n                __m128d v1_1 = _mm_cvtps_pd(_mm_movehl_ps(v1, v1));\n                __m128d v2_0 = _mm_cvtps_pd(v2);\n                __m128d v2_1 = _mm_cvtps_pd(_mm_movehl_ps(v2, v2));\n                __m128d v3_0 = _mm_cvtps_pd(v3);\n                __m128d v3_1 = _mm_cvtps_pd(_mm_movehl_ps(v3, v3));\n                v1 = _mm_movelh_ps(\n                        _mm_cvtpd_ps(_mm_add_pd(_mm_mul_pd(v1_0, v2_0), v3_0)),\n                        _mm_cvtpd_ps(_mm_add_pd(_mm_mul_pd(v1_1, v2_1), v3_1)));\n            }\n#endif\n\n            Vc_OP(add) Vc_OP(sub) Vc_OP(mul)\n\n            Vc_OP1(sqrt) Vc_OP1(rsqrt)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType isNaN(VectorType x) {\n                return _mm_cmpunord_ps(x, x);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType isFinite(VectorType x) {\n                return _mm_cmpord_ps(x, _mm_mul_ps(zero(), x));\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType isInfinite(VectorType x) {\n                return _mm_castsi128_ps(_mm_cmpeq_epi32(_mm_castps_si128(abs(x)), _mm_castps_si128(_mm_load_ps(c_log<float>::d(1)))));\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType reciprocal(VectorType x) {\n                return _mm_rcp_ps(x);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType abs(const VectorType a) {\n                return Vc_CAT2(_mm_and_, Vc_SUFFIX)(a, _mm_setabsmask_ps());\n            }\n\n            Vc_MINMAX\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VectorType a) {\n                a = _mm_min_ps(a, _mm_movehl_ps(a, a));   // a = min(a0, a2), min(a1, a3), min(a2, a2), min(a3, a3)\n                a = _mm_min_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1))); // a = min(a0, a1), a1, a2, a3\n                return _mm_cvtss_f32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VectorType a) {\n                a = _mm_max_ps(a, _mm_movehl_ps(a, a));   // a = max(a0, a2), max(a1, a3), max(a2, a2), max(a3, a3)\n                a = _mm_max_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(1, 1, 1, 1))); // a = max(a0, a1), a1, a2, a3\n                return _mm_cvtss_f32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VectorType a) {\n                a = _mm_mul_ps(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 2, 3)));\n                a = _mm_mul_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 0, 1)));\n                return _mm_cvtss_f32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VectorType a) {\n                a = _mm_add_ps(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(0, 1, 2, 3)));\n                a = _mm_add_ss(a, _mm_shuffle_ps(a, a, _MM_SHUFFLE(3, 2, 0, 1)));\n                return _mm_cvtss_f32(a);\n            }\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VectorType a) {\n#ifdef Vc_IMPL_SSE4_1\n                return _mm_round_ps(a, _MM_FROUND_NINT);\n#else\n                //XXX slow: _MM_SET_ROUNDING_MODE(_MM_ROUND_NEAREST);\n                return _mm_cvtepi32_ps(_mm_cvtps_epi32(a));\n#endif\n            }\n        };\n\n        template<> struct VectorHelper<int> {\n            typedef int EntryType;\n            typedef __m128i VectorType;\n#define Vc_SUFFIX si128\n\n            Vc_OP_(or_) Vc_OP_(and_) Vc_OP_(xor_)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType zero() { return Vc_CAT2(_mm_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType notMaskedToZero(VectorType a, __m128 mask) { return Vc_CAT2(_mm_and_, Vc_SUFFIX)(_mm_castps_si128(mask), a); }\n#undef Vc_SUFFIX\n#define Vc_SUFFIX epi32\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType one() { return Vc_CAT2(_mm_setone_, Vc_SUFFIX)(); }\n\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const int a) { return Vc_CAT2(_mm_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const int a, const int b, const int c, const int d) { return Vc_CAT2(_mm_set_, Vc_SUFFIX)(a, b, c, d); }\n\n            static Vc_ALWAYS_INLINE void fma(VectorType &v1, VectorType v2, VectorType v3) { v1 = add(mul(v1, v2), v3); }\n\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftLeft(VectorType a, int shift) {\n                return Vc_CAT2(_mm_slli_, Vc_SUFFIX)(a, shift);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftRight(VectorType a, int shift) {\n                return Vc_CAT2(_mm_srai_, Vc_SUFFIX)(a, shift);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType abs(const VectorType a) { return abs_epi32(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType min(VectorType a, VectorType b) { return min_epi32(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType max(VectorType a, VectorType b) { return max_epi32(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VectorType a) {\n                a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                // using lo_epi16 for speed here\n                a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VectorType a) {\n                a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                // using lo_epi16 for speed here\n                a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VectorType a) {\n                a = add(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = add(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n#ifdef Vc_IMPL_SSE4_1\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType mul(VectorType a, VectorType b) { return _mm_mullo_epi32(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VectorType a) {\n                a = mul(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = mul(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n#else\n            static inline Vc_CONST VectorType mul(const VectorType a, const VectorType b) {\n                const VectorType aShift = _mm_srli_si128(a, 4);\n                const VectorType ab02 = _mm_mul_epu32(a, b); // [a0 * b0, a2 * b2]\n                const VectorType bShift = _mm_srli_si128(b, 4);\n                const VectorType ab13 = _mm_mul_epu32(aShift, bShift); // [a1 * b1, a3 * b3]\n                return _mm_unpacklo_epi32(_mm_shuffle_epi32(ab02, 8), _mm_shuffle_epi32(ab13, 8));\n            }\n#endif\n\n            Vc_OP(add) Vc_OP(sub)\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VectorType a) { return a; }\n        };\n\n        template<> struct VectorHelper<unsigned int> {\n            typedef unsigned int EntryType;\n            typedef __m128i VectorType;\n#define Vc_SUFFIX si128\n            Vc_OP_CAST_(or_) Vc_OP_CAST_(and_) Vc_OP_CAST_(xor_)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType zero() { return Vc_CAT2(_mm_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType notMaskedToZero(VectorType a, __m128 mask) { return Vc_CAT2(_mm_and_, Vc_SUFFIX)(_mm_castps_si128(mask), a); }\n\n#undef Vc_SUFFIX\n#define Vc_SUFFIX epu32\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType one() { return Vc_CAT2(_mm_setone_, Vc_SUFFIX)(); }\n\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType min(VectorType a, VectorType b) { return min_epu32(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType max(VectorType a, VectorType b) { return max_epu32(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VectorType a) {\n                a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                // using lo_epi16 for speed here\n                a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VectorType a) {\n                a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                // using lo_epi16 for speed here\n                a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VectorType a) {\n                a = mul(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                // using lo_epi16 for speed here\n                a = mul(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VectorType a) {\n                a = add(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                // using lo_epi16 for speed here\n                a = add(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                return _mm_cvtsi128_si32(a);\n            }\n\n            static Vc_ALWAYS_INLINE void fma(VectorType &v1, VectorType v2, VectorType v3) { v1 = add(mul(v1, v2), v3); }\n\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType mul(const VectorType a, const VectorType b) {\n                return VectorHelper<int>::mul(a, b);\n            }\n//X             template<unsigned int b> static Vc_ALWAYS_INLINE Vc_CONST VectorType mul(const VectorType a) {\n//X                 switch (b) {\n//X                     case    0: return zero();\n//X                     case    1: return a;\n//X                     case    2: return _mm_slli_epi32(a,  1);\n//X                     case    4: return _mm_slli_epi32(a,  2);\n//X                     case    8: return _mm_slli_epi32(a,  3);\n//X                     case   16: return _mm_slli_epi32(a,  4);\n//X                     case   32: return _mm_slli_epi32(a,  5);\n//X                     case   64: return _mm_slli_epi32(a,  6);\n//X                     case  128: return _mm_slli_epi32(a,  7);\n//X                     case  256: return _mm_slli_epi32(a,  8);\n//X                     case  512: return _mm_slli_epi32(a,  9);\n//X                     case 1024: return _mm_slli_epi32(a, 10);\n//X                     case 2048: return _mm_slli_epi32(a, 11);\n//X                 }\n//X                 return mul(a, set(b));\n//X             }\n\n#undef Vc_SUFFIX\n#define Vc_SUFFIX epi32\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftLeft(VectorType a, int shift) {\n                return Vc_CAT2(_mm_slli_, Vc_SUFFIX)(a, shift);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftRight(VectorType a, int shift) {\n                return Vc_CAT2(_mm_srli_, Vc_SUFFIX)(a, shift);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const unsigned int a) { return Vc_CAT2(_mm_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const unsigned int a, const unsigned int b, const unsigned int c, const unsigned int d) { return Vc_CAT2(_mm_set_, Vc_SUFFIX)(a, b, c, d); }\n\n            Vc_OP(add) Vc_OP(sub)\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VectorType a) { return a; }\n        };\n\n        template<> struct VectorHelper<signed short> {\n            typedef __m128i VectorType;\n            typedef signed short EntryType;\n#define Vc_SUFFIX si128\n\n            Vc_OP_(or_) Vc_OP_(and_) Vc_OP_(xor_)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType zero() { return Vc_CAT2(_mm_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType notMaskedToZero(VectorType a, __m128 mask) { return Vc_CAT2(_mm_and_, Vc_SUFFIX)(_mm_castps_si128(mask), a); }\n            static Vc_ALWAYS_INLINE Vc_CONST __m128i concat(__m128i a, __m128i b) { return _mm_packs_epi32(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST __m128i expand0(__m128i x) { return _mm_srai_epi32(_mm_unpacklo_epi16(x, x), 16); }\n            static Vc_ALWAYS_INLINE Vc_CONST __m128i expand1(__m128i x) { return _mm_srai_epi32(_mm_unpackhi_epi16(x, x), 16); }\n\n#undef Vc_SUFFIX\n#define Vc_SUFFIX epi16\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType one() { return Vc_CAT2(_mm_setone_, Vc_SUFFIX)(); }\n\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftLeft(VectorType a, int shift) {\n                return Vc_CAT2(_mm_slli_, Vc_SUFFIX)(a, shift);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftRight(VectorType a, int shift) {\n                return Vc_CAT2(_mm_srai_, Vc_SUFFIX)(a, shift);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const EntryType a) { return Vc_CAT2(_mm_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const EntryType a, const EntryType b, const EntryType c, const EntryType d,\n                    const EntryType e, const EntryType f, const EntryType g, const EntryType h) {\n                return Vc_CAT2(_mm_set_, Vc_SUFFIX)(a, b, c, d, e, f, g, h);\n            }\n\n            static Vc_ALWAYS_INLINE void fma(VectorType &v1, VectorType v2, VectorType v3) {\n                v1 = add(mul(v1, v2), v3); }\n\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType abs(const VectorType a) { return abs_epi16(a); }\n\n            Vc_OPx(mul, mullo)\n            Vc_OP(min) Vc_OP(max)\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VectorType a) {\n                // reminder: _MM_SHUFFLE(3, 2, 1, 0) means \"no change\"\n                a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VectorType a) {\n                // reminder: _MM_SHUFFLE(3, 2, 1, 0) means \"no change\"\n                a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VectorType a) {\n                a = mul(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = mul(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = mul(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VectorType a) {\n                a = add(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = add(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = add(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n\n            Vc_OP(add) Vc_OP(sub)\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VectorType a) { return a; }\n        };\n\n        template<> struct VectorHelper<unsigned short> {\n            typedef __m128i VectorType;\n            typedef unsigned short EntryType;\n#define Vc_SUFFIX si128\n            Vc_OP_CAST_(or_) Vc_OP_CAST_(and_) Vc_OP_CAST_(xor_)\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType zero() { return Vc_CAT2(_mm_setzero_, Vc_SUFFIX)(); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType notMaskedToZero(VectorType a, __m128 mask) { return Vc_CAT2(_mm_and_, Vc_SUFFIX)(_mm_castps_si128(mask), a); }\n#ifdef Vc_IMPL_SSE4_1\n            static Vc_ALWAYS_INLINE Vc_CONST __m128i concat(__m128i a, __m128i b) { return _mm_packus_epi32(a, b); }\n#else\n            // FIXME too bad, but this is broken without SSE 4.1\n            static Vc_ALWAYS_INLINE Vc_CONST __m128i concat(__m128i a, __m128i b) {\n                auto tmp0 = _mm_unpacklo_epi16(a, b); // 0 4 X X 1 5 X X\n                auto tmp1 = _mm_unpackhi_epi16(a, b); // 2 6 X X 3 7 X X\n                auto tmp2 = _mm_unpacklo_epi16(tmp0, tmp1); // 0 2 4 6 X X X X\n                auto tmp3 = _mm_unpackhi_epi16(tmp0, tmp1); // 1 3 5 7 X X X X\n                return _mm_unpacklo_epi16(tmp2, tmp3); // 0 1 2 3 4 5 6 7\n            }\n#endif\n            static Vc_ALWAYS_INLINE Vc_CONST __m128i expand0(__m128i x) { return _mm_unpacklo_epi16(x, _mm_setzero_si128()); }\n            static Vc_ALWAYS_INLINE Vc_CONST __m128i expand1(__m128i x) { return _mm_unpackhi_epi16(x, _mm_setzero_si128()); }\n\n#undef Vc_SUFFIX\n#define Vc_SUFFIX epu16\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType one() { return Vc_CAT2(_mm_setone_, Vc_SUFFIX)(); }\n\n//X             template<unsigned int b> static Vc_ALWAYS_INLINE Vc_CONST VectorType mul(const VectorType a) {\n//X                 switch (b) {\n//X                     case    0: return zero();\n//X                     case    1: return a;\n//X                     case    2: return _mm_slli_epi16(a,  1);\n//X                     case    4: return _mm_slli_epi16(a,  2);\n//X                     case    8: return _mm_slli_epi16(a,  3);\n//X                     case   16: return _mm_slli_epi16(a,  4);\n//X                     case   32: return _mm_slli_epi16(a,  5);\n//X                     case   64: return _mm_slli_epi16(a,  6);\n//X                     case  128: return _mm_slli_epi16(a,  7);\n//X                     case  256: return _mm_slli_epi16(a,  8);\n//X                     case  512: return _mm_slli_epi16(a,  9);\n//X                     case 1024: return _mm_slli_epi16(a, 10);\n//X                     case 2048: return _mm_slli_epi16(a, 11);\n//X                 }\n//X                 return mul(a, set(b));\n//X             }\n#if !defined(USE_INCORRECT_UNSIGNED_COMPARE) || Vc_IMPL_SSE4_1\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType min(VectorType a, VectorType b) { return min_epu16(a, b); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType max(VectorType a, VectorType b) { return max_epu16(a, b); }\n#endif\n#undef Vc_SUFFIX\n#define Vc_SUFFIX epi16\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftLeft(VectorType a, int shift) {\n                return Vc_CAT2(_mm_slli_, Vc_SUFFIX)(a, shift);\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType shiftRight(VectorType a, int shift) {\n                return Vc_CAT2(_mm_srli_, Vc_SUFFIX)(a, shift);\n            }\n\n            static Vc_ALWAYS_INLINE void fma(VectorType &v1, VectorType v2, VectorType v3) { v1 = add(mul(v1, v2), v3); }\n\n            Vc_OPx(mul, mullo) // should work correctly for all values\n#if defined(USE_INCORRECT_UNSIGNED_COMPARE) && !defined(Vc_IMPL_SSE4_1)\n            Vc_OP(min) Vc_OP(max) // XXX breaks for values with MSB set\n#endif\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType min(VectorType a) {\n                // reminder: _MM_SHUFFLE(3, 2, 1, 0) means \"no change\"\n                a = min(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = min(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType max(VectorType a) {\n                // reminder: _MM_SHUFFLE(3, 2, 1, 0) means \"no change\"\n                a = max(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = max(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType mul(VectorType a) {\n                // reminder: _MM_SHUFFLE(3, 2, 1, 0) means \"no change\"\n                a = mul(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = mul(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = mul(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST EntryType add(VectorType a) {\n                // reminder: _MM_SHUFFLE(3, 2, 1, 0) means \"no change\"\n                a = add(a, _mm_shuffle_epi32(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = add(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 0, 3, 2)));\n                a = add(a, _mm_shufflelo_epi16(a, _MM_SHUFFLE(1, 1, 1, 1)));\n                return _mm_cvtsi128_si32(a); // & 0xffff is implicit\n            }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const EntryType a) { return Vc_CAT2(_mm_set1_, Vc_SUFFIX)(a); }\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType set(const EntryType a, const EntryType b, const EntryType c,\n                    const EntryType d, const EntryType e, const EntryType f,\n                    const EntryType g, const EntryType h) {\n                return Vc_CAT2(_mm_set_, Vc_SUFFIX)(a, b, c, d, e, f, g, h);\n            }\n\n            Vc_OP(add) Vc_OP(sub)\n#undef Vc_SUFFIX\n            static Vc_ALWAYS_INLINE Vc_CONST VectorType round(VectorType a) { return a; }\n        };\n#undef Vc_OP1\n#undef Vc_OP\n#undef Vc_OP_\n#undef Vc_OPx\n#undef Vc_OP_CAST_\n#undef Vc_MINMAX\n\n}  // namespace SSE\n}  // namespace Vc\n\n#include \"vectorhelper.tcc\"\n\n#endif // VC_SSE_VECTORHELPER_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/sse/vectorhelper.tcc",
    "content": ""
  },
  {
    "path": "3rdparty/Vc/Vc/support.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_COMMON_SUPPORT_H_\n#define VC_COMMON_SUPPORT_H_\n\n#ifndef VC_GLOBAL_H_\n#error \"Vc/global.h must be included first!\"\n#endif\n\n#if defined __x86_64__ || defined __amd64__ || defined __amd64 || defined __x86_64 ||    \\\n    defined _M_AMD64 || defined __i386__\n#include <Vc/cpuid.h>\n#endif\n\n#if defined(Vc_GCC) && Vc_GCC >= 0x40400 && defined __SSE__\n#define Vc_TARGET_NO_SIMD __attribute__((target(\"no-sse2,no-avx\")))\n#else\n#define Vc_TARGET_NO_SIMD\n#endif\n\n#include \"common/macros.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n/**\n * \\name Micro-Architecture Feature Tests\n */\n//@{\n/**\n * \\ingroup Utilities\n * \\headerfile support.h <Vc/support.h>\n * Determines the extra instructions supported by the current CPU.\n *\n * \\return A combination of flags from Vc::ExtraInstructions that the current CPU supports.\n */\nVc_TARGET_NO_SIMD\nunsigned int extraInstructionsSupported();\n\n/**\n * \\ingroup Utilities\n * \\headerfile support.h <Vc/support.h>\n *\n * Tests whether the given implementation is supported by the system the code is executing on.\n *\n * \\return \\c true if the OS and hardware support execution of instructions defined by \\p impl.\n * \\return \\c false otherwise\n *\n * \\param impl The SIMD target to test for.\n */\nVc_TARGET_NO_SIMD bool Vc_VDECL isImplementationSupported(Vc::Implementation impl);\n\n/**\n * \\internal\n * \\ingroup Utilities\n * \\headerfile support.h <Vc/support.h>\n *\n * Tests whether the given implementation is supported by the system the code is executing on.\n *\n * \\code\n * if (!isImplementationSupported<Vc::CurrentImplementation>()) {\n *   std::cerr << \"This code was compiled with features that this system does not support.\\n\";\n *   return EXIT_FAILURE;\n * }\n * \\endcode\n *\n * \\return \\c true if the OS and hardware support execution of instructions defined by \\p impl.\n * \\return \\c false otherwise\n *\n * \\tparam Impl The SIMD target to test for.\n */\ntemplate<typename Impl>\nVc_TARGET_NO_SIMD\nstatic inline bool isImplementationSupported()\n{\n    return isImplementationSupported(Impl::current()) &&\n           Impl::runs_on(extraInstructionsSupported());\n}\n\n/**\n * \\ingroup Utilities\n * \\headerfile support.h <Vc/support.h>\n *\n * Determines the best supported implementation for the current system.\n *\n * \\return The enum value for the best implementation.\n */\nVc_TARGET_NO_SIMD\nVc::Implementation bestImplementationSupported();\n\n#ifndef Vc_COMPILE_LIB\n/**\n * \\ingroup Utilities\n * \\headerfile support.h <Vc/support.h>\n *\n * Tests that the CPU and Operating System support the vector unit which was compiled for. This\n * function should be called before any other Vc functionality is used. It checks whether the program\n * will work. If this function returns \\c false then the program should exit with a useful error\n * message before the OS has to kill it because of an invalid instruction exception.\n *\n * If the program continues and makes use of any vector features not supported by\n * hard- or software then the program will crash.\n *\n * Example:\n * \\code\n * int main()\n * {\n *   if (!Vc::currentImplementationSupported()) {\n *     std::cerr << \"CPU or OS requirements not met for the compiled in vector unit!\\n\";\n *     exit -1;\n *   }\n *   ...\n * }\n * \\endcode\n *\n * \\return \\c true if the OS and hardware support execution of the currently selected SIMD\n *                 instructions.\n * \\return \\c false otherwise\n */\nVc_TARGET_NO_SIMD\n#ifndef DOXYGEN\nstatic\n#endif\ninline bool currentImplementationSupported()\n{\n    return isImplementationSupported<Vc::CurrentImplementation>();\n}\n#endif // Vc_COMPILE_LIB\n//@}\n\n}\n\n#undef Vc_TARGET_NO_SIMD\n\n#endif // VC_COMMON_SUPPORT_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/decay.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_DECAY_H_\n#define VC_TRAITS_DECAY_H_\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\ntemplate <typename T> using decay = typename std::decay<T>::type;\n}  // namespace Traits\n}  // namespace Vc\n\n#endif  // VC_TRAITS_DECAY_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/entry_type_of.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_ENTRY_TYPE_OF_H_\n#define VC_TRAITS_ENTRY_TYPE_OF_H_\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\nnamespace entry_type_of_internal\n{\ntemplate <typename T, bool = Traits::is_simd_vector<T>::value> struct entry_type;\n\ntemplate <typename T> struct entry_type<T, true>\n{\n    using type = typename decay<T>::EntryType;\n};\n\ntemplate <typename T> struct entry_type<T, false>\n{\n    using type = typename std::remove_cv<typename std::remove_reference<T>::type>::type;\n};\n}  // namespace entry_type_of_internal\n\n/**\n * Resolves to T::EntryType if \\p T is a SIMD type, otherwise it resolves to \\p T itself.\n */\ntemplate <typename T> using entry_type_of = typename entry_type_of_internal::entry_type<T>::type;\n\n}  // namespace Traits\n}  // namespace Vc_VERSIONED_NAMESPACE\n\n#endif  // VC_TRAITS_ENTRY_TYPE_OF_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/has_addition_operator.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_HAS_ADDITION_OPERATOR_H_\n#define VC_TRAITS_HAS_ADDITION_OPERATOR_H_\n\nnamespace has_addition_operator_impl\n{\n\ntemplate <typename T, typename U, typename = decltype(std::declval<T>() + std::declval<U>())> std::true_type test(int);\ntemplate <typename T, typename U> std::false_type test(...);\n\n}  // namespace has_addition_operator_impl\n\ntemplate <typename T, typename U = T>\nstruct has_addition_operator : public decltype(has_addition_operator_impl::test<T, U>(1))\n{\n};\n\n#endif // VC_TRAITS_HAS_ADDITION_OPERATOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/has_contiguous_storage.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2016 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_HAS_CONTIGUOUS_STORAGE_H_\n#define VC_TRAITS_HAS_CONTIGUOUS_STORAGE_H_\n\n#include <initializer_list>\n#include <memory>\n\n#ifdef _LIBCPP_BEGIN_NAMESPACE_STD\n_LIBCPP_BEGIN_NAMESPACE_STD\n#else\nnamespace std\n{\n#endif\n#ifdef _WIN32\ntemplate <typename T, size_t N> class array;\n#else\ntemplate <typename T, size_t N> struct array;\n#endif\ntemplate <typename T, typename Allocator> class vector;\n#ifdef _LIBCPP_END_NAMESPACE_STD\n_LIBCPP_END_NAMESPACE_STD\n#else\n}  // namespace std\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\nnamespace has_contiguous_storage_detail\n{\n// heuristic: consider RandomAccessIterator as abstracting contiguous storage\n// case 1: T is a container\ntemplate <typename T, typename It = typename T::iterator>\nstd::is_base_of<std::random_access_iterator_tag,\n                typename std::iterator_traits<It>::iterator_category>\ntest(int);\n\n// case 2: T is an iterator type\ntemplate <typename T>\nstd::is_base_of<std::random_access_iterator_tag,\n                typename std::iterator_traits<T>::iterator_category>\ntest(long);\n\n// case 3: everything else\ntemplate <typename T> std::false_type test(...);\n}  // namespace has_contiguous_storage_detail\n\ntemplate <typename T>\nstruct has_contiguous_storage_impl\n    : public decltype(has_contiguous_storage_detail::test<T>(int())) {\n};\n\ntemplate <typename T>\nstruct has_contiguous_storage\n    : public has_contiguous_storage_impl<\n          typename std::remove_cv<typename std::remove_reference<T>::type>::type>\n{\n};\n\n// spezializations:\ntemplate <typename T> struct has_contiguous_storage_impl<const T *> : public std::true_type {};\ntemplate <typename T> struct has_contiguous_storage_impl<T *> : public std::true_type {};\ntemplate <typename T> struct has_contiguous_storage_impl<std::unique_ptr<T[]>> : public std::true_type {};\ntemplate <typename T> struct has_contiguous_storage_impl<std::initializer_list<T>> : public std::true_type {};\ntemplate <typename T, std::size_t N> struct has_contiguous_storage_impl<T[N]> : public std::true_type {};\ntemplate <typename T, std::size_t N> struct has_contiguous_storage_impl<std::array<T, N>> : public std::true_type {};\ntemplate <typename T, typename A> struct has_contiguous_storage_impl<std::vector<T, A>> : public std::true_type {};\n\n}  // namespace Traits\n}  // namespace Vc\n\n#endif // VC_TRAITS_HAS_CONTIGUOUS_STORAGE_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/has_equality_operator.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_HAS_EQUALITY_OPERATOR_H_\n#define VC_TRAITS_HAS_EQUALITY_OPERATOR_H_\n\nnamespace has_equality_operator_impl\n{\n\ntemplate <typename T, typename U,\n          typename = enable_if<!std::is_same<void, decltype(std::declval<T>() == std::declval<U>())>::value>>\nstd::true_type test(int);\ntemplate <typename T, typename U> std::false_type test(...);\n\n}  // namespace has_equality_operator_impl\n\ntemplate <typename T, typename U = T>\nstruct has_equality_operator : public decltype(has_equality_operator_impl::test<T, U>(1))\n{\n};\n\n#endif  // VC_TRAITS_HAS_EQUALITY_OPERATOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/has_multiply_operator.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_HAS_MULTIPLY_OPERATOR_H_\n#define VC_TRAITS_HAS_MULTIPLY_OPERATOR_H_\n\nnamespace has_multiply_operator_impl\n{\n\ntemplate <typename T, typename U, typename = decltype(std::declval<T>() * std::declval<U>())> std::true_type test(int);\ntemplate <typename T, typename U> std::false_type test(...);\n\n}  // namespace has_multiply_operator_impl\n\ntemplate <typename T, typename U = T>\nstruct has_multiply_operator : public decltype(has_multiply_operator_impl::test<T, U>(1))\n{\n};\n\n#endif // VC_TRAITS_HAS_MULTIPLY_OPERATOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/has_no_allocated_data.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_HAS_NO_ALLOCATED_DATA_H_\n#define VC_TRAITS_HAS_NO_ALLOCATED_DATA_H_\n\n#include <array>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\n\n/**\n * Implements the has_no_allocated_data trait.\n *\n * Specialize this type for your container class if you need to make it usable with SIMD\n * gathers/scatters. Example:\n * \\code\n * namespace Vc\n * {\n * namespace Traits\n * {\n * template<typename T> struct has_no_allocated_data_impl<MyContainer<T>> : public std::true_type {};\n * }\n * }\n * \\endcode\n *\n * \\see has_no_allocated_data\n */\ntemplate<typename T> struct has_no_allocated_data_impl : public std::false_type {};\n\n/**\n * Type trait that tells whether a container stores its data inside the object or inside allocated\n * memory outside of the object.\n *\n * Per default the trait assumes any type to store its data outside, on the heap. The only types\n * where it knows that the storage is inside the object are std::array, Vc::array, and T[] (builtin\n * arrays).\n *\n * The trait forwards the actual decision to has_no_allocated_data_impl, but removes const/volatile\n * and references from the type \\p T to make the number of required specializations of\n * has_no_allocated_data_impl minimal.\n */\ntemplate <typename T>\nstruct has_no_allocated_data\n    : public has_no_allocated_data_impl<\n          typename std::remove_cv<typename std::remove_reference<T>::type>::type>\n{\n};\n\n// spezializations:\ntemplate<typename T, std::size_t N> struct has_no_allocated_data_impl<std::array<T, N>> : public std::true_type {};\ntemplate<typename T, std::size_t N> struct has_no_allocated_data_impl<T[N]> : public std::true_type {};\ntemplate<typename T> struct has_no_allocated_data_impl<T[]> : public std::true_type {};\n}  // namespace Traits\n}  // namespace Vc\n\n#endif // VC_TRAITS_HAS_NO_ALLOCATED_DATA_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/has_subscript_operator.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_HAS_SUBSCRIPT_OPERATOR_H_\n#define VC_TRAITS_HAS_SUBSCRIPT_OPERATOR_H_\n\nnamespace has_subscript_operator_impl\n{\n\ntemplate <typename T, typename I, typename = decltype(std::declval<T &>()[std::declval<I>()])> std::true_type test(int);\ntemplate <typename T, typename I> std::false_type test(float);\n\n}  // namespace has_subscript_operator_impl\n\ntemplate <typename T, typename I = std::size_t>\nstruct has_subscript_operator : public decltype(has_subscript_operator_impl::test<T, I>(1))\n{\n};\n\n#endif // VC_TRAITS_HAS_SUBSCRIPT_OPERATOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/is_functor_argument_immutable.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2014-2016 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_IS_FUNCTOR_ARGUMENT_IMMUTABLE_H_\n#define VC_TRAITS_IS_FUNCTOR_ARGUMENT_IMMUTABLE_H_\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\nnamespace is_functor_argument_immutable_impl\n{\ntemplate <typename F, typename A> std::true_type   test(void (F::*)(A));\ntemplate <typename F, typename A> std::true_type   test(void (F::*)(A) const);\ntemplate <typename F, typename A> std::is_const<A> test(void (F::*)(A &));\ntemplate <typename F, typename A> std::is_const<A> test(void (F::*)(A &) const);\ntemplate <typename F, typename A> std::is_const<A> test(void (F::*)(A &&));\ntemplate <typename F, typename A> std::is_const<A> test(void (F::*)(A &&) const);\n\nstruct dummy {};\n\n// generate a true_type for template operator() members in F that are callable with a\n// 'const A &' argument even if the template parameter to operator() is fixed to 'A'.\ntemplate <\n    typename F, typename A,\n#ifdef Vc_MSVC\n// MSVC fails if the template keyword is used to *correctly* tell the compiler that <A> is\n// an explicit template instantiation of operator()\n#define Vc_TEMPLATE_\n#else\n#define Vc_TEMPLATE_ template\n#endif\n    typename MemberPtr = decltype(&F::Vc_TEMPLATE_ operator()<A>)>\ndecltype(is_functor_argument_immutable_impl::test(std::declval<MemberPtr>())) test2(int);\n#undef Vc_TEMPLATE_\n\n// generate a true_type for non-template operator() members in F that are callable with a\n// 'const A &' argument.\ntemplate <typename F, typename A>\ndecltype(\n    is_functor_argument_immutable_impl::test(std::declval<decltype(&F::operator())>()))\ntest2(float);\n\ntemplate <typename A> std::true_type   test3(void(*)(A));\ntemplate <typename A> std::is_const<A> test3(void(*)(A &));\ntemplate <typename A> std::is_const<A> test3(void(*)(A &&));\n\n}  // namespace is_functor_argument_immutable_impl\n\ntemplate <typename F, typename A, bool = std::is_function<F>::value>\nstruct is_functor_argument_immutable;\ntemplate <typename F, typename A>\nstruct is_functor_argument_immutable<F, A, false>\n    : decltype(is_functor_argument_immutable_impl::test2<\n                      typename std::remove_reference<F>::type, A>(int())) {\n};\ntemplate <typename F, typename A>\nstruct is_functor_argument_immutable<F, A, true>\n    : decltype(is_functor_argument_immutable_impl::test3(std::declval<F>())) {\n};\n\n}  // namespace Traits\n}  // namespace Vc\n\n#endif  // VC_TRAITS_IS_FUNCTOR_ARGUMENT_IMMUTABLE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/is_implicit_cast_allowed.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_IS_IMPLICIT_CAST_ALLOWED_H_\n#define VC_TRAITS_IS_IMPLICIT_CAST_ALLOWED_H_\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\ntemplate <typename From, typename To, bool = std::is_integral<From>::value>\nstruct is_implicit_cast_allowed\n    : public std::integral_constant<\n          bool, std::is_same<From, To>::value ||\n                    (std::is_integral<To>::value &&\n                     (std::is_same<typename std::make_unsigned<From>::type, To>::value ||\n                      std::is_same<typename std::make_signed<From>::type, To>::value))> {\n};\n\ntemplate <typename From, typename To>\nstruct is_implicit_cast_allowed<From, To, false> : public std::is_same<From, To>::type {\n};\n\ntemplate <typename From, typename To>\nstruct is_implicit_cast_allowed_mask : public is_implicit_cast_allowed<From, To> {\n};\n}  // namespace Traits\n}  // namespace Vc\n\n#endif  // VC_TRAITS_IS_IMPLICIT_CAST_ALLOWED_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/is_index_sequence.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_IS_INDEX_SEQUENCE_H_\n#define VC_IS_INDEX_SEQUENCE_H_\n\n#include \"../common/indexsequence.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\n\ntemplate <typename T> struct is_index_sequence : public std::false_type {};\ntemplate <std::size_t... I>\nstruct is_index_sequence<Vc::index_sequence<I...>> : public std::true_type {};\n\nstatic_assert(!is_index_sequence<int>::value, \"\");\nstatic_assert(is_index_sequence<make_index_sequence<2>>::value, \"\");\n\n}  // namespace Traits\n}  // namespace Vc\n\n#endif  // VC_IS_INDEX_SEQUENCE_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/is_output_iterator.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_IS_OUTPUT_ITERATOR_H_\n#define VC_TRAITS_IS_OUTPUT_ITERATOR_H_\n\n#include <iterator>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Traits\n{\nnamespace is_output_iterator_impl\n{\ntemplate <typename T, typename ValueType = typename std::iterator_traits<T>::value_type,\n          typename = decltype(*std::declval<T &>() = std::declval<\n                                  ValueType>())  // tests that assignment to a\n                                                 // dereferenced iterator is possible, if\n                                                 // yes, T is an OutputIterator\n          >\nstd::true_type test(int);\ntemplate <typename T> std::false_type test(...);\n}  // namespace is_output_iterator_impl\n\ntemplate <typename T>\nstruct is_output_iterator\n    : public std::conditional<\n          std::is_void<typename std::iterator_traits<T>::value_type>::value,\n          std::true_type, decltype(is_output_iterator_impl::test<T>(int()))>::type\n{\n};\n\nstatic_assert(!std::is_void<std::iterator_traits<int *>::value_type>::value, \"\");\nstatic_assert(is_output_iterator<int *>::value, \"\");\nstatic_assert(!is_output_iterator<const int *>::value, \"\");\n\n}  // namespace Traits\n}  // namespace Vc\n\n#endif  // VC_TRAITS_IS_OUTPUT_ITERATOR_H_\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/traits/type_traits.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TRAITS_TYPE_TRAITS_H_\n#define VC_TRAITS_TYPE_TRAITS_H_\n\n#include <type_traits>\n#include \"decay.h\"\n#include \"has_no_allocated_data.h\"\n#include \"has_contiguous_storage.h\"\n#include \"is_functor_argument_immutable.h\"\n#include \"is_output_iterator.h\"\n#include \"is_index_sequence.h\"\n#include \"is_implicit_cast_allowed.h\"\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n// meta-programming helpers\nstruct enable_if_default_type\n{\n    constexpr enable_if_default_type() {}\n};\nstatic constexpr enable_if_default_type nullarg;\ntemplate <bool Test, typename T = enable_if_default_type> using enable_if = typename std::enable_if<Test, T>::type;\n\ntemplate <bool B, class T, class F>\nusing conditional_t = typename std::conditional<B, T, F>::type;\n\ntemplate <class T>\nusing remove_cvref_t =\n    typename std::remove_cv<typename std::remove_reference<T>::type>::type;\n\nnamespace Traits\n{\n#include \"has_subscript_operator.h\"\n#include \"has_multiply_operator.h\"\n#include \"has_addition_operator.h\"\n#include \"has_equality_operator.h\"\n\ntemplate<typename T> struct is_valid_vector_argument : public std::false_type {};\n\ntemplate <> struct is_valid_vector_argument<double> : public std::true_type {};\ntemplate <> struct is_valid_vector_argument<float>  : public std::true_type {};\ntemplate <> struct is_valid_vector_argument<int>    : public std::true_type {};\ntemplate <> struct is_valid_vector_argument<unsigned int>   : public std::true_type {};\ntemplate <> struct is_valid_vector_argument<short>  : public std::true_type {};\ntemplate <> struct is_valid_vector_argument<unsigned short> : public std::true_type {};\n\ntemplate<typename T> struct is_simd_mask_internal : public std::false_type {};\ntemplate<typename T> struct is_simd_vector_internal : public std::false_type {};\ntemplate<typename T> struct is_simdarray_internal : public std::false_type {};\ntemplate<typename T> struct is_simd_mask_array_internal : public std::false_type {};\ntemplate<typename T> struct is_loadstoreflag_internal : public std::false_type {};\n\ntemplate <typename T, bool = is_simd_vector_internal<T>::value> struct is_integral_internal;\ntemplate <typename T, bool = is_simd_vector_internal<T>::value> struct is_floating_point_internal;\ntemplate <typename T, bool = is_simd_vector_internal<T>::value> struct is_signed_internal;\ntemplate <typename T, bool = is_simd_vector_internal<T>::value> struct is_unsigned_internal;\n\ntemplate <typename T> struct is_integral_internal      <T, false> : public std::is_integral      <T> {};\ntemplate <typename T> struct is_floating_point_internal<T, false> : public std::is_floating_point<T> {};\ntemplate <typename T> struct is_signed_internal        <T, false> : public std::is_signed        <T> {};\ntemplate <typename T> struct is_unsigned_internal      <T, false> : public std::is_unsigned      <T> {};\n\ntemplate <typename V> struct is_integral_internal      <V, true> : public std::is_integral      <typename V::EntryType> {};\ntemplate <typename V> struct is_floating_point_internal<V, true> : public std::is_floating_point<typename V::EntryType> {};\ntemplate <typename V> struct is_signed_internal        <V, true> : public std::is_signed        <typename V::EntryType> {};\ntemplate <typename V> struct is_unsigned_internal      <V, true> : public std::is_unsigned      <typename V::EntryType> {};\n\ntemplate <typename T>\nstruct is_arithmetic_internal\n    : public std::integral_constant<\n          bool,\n          (is_floating_point_internal<T>::value || is_integral_internal<T>::value)>\n{\n};\n\ntemplate <class T, class = void>\nstruct vector_size_internal : std::integral_constant<std::size_t, 0> {\n};\ntemplate <class T>\nstruct vector_size_internal<T, decltype((void)(T::size() > 0))>\n    : std::integral_constant<std::size_t, T::size()> {\n};\n\n//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Identifies any SIMD mask type (independent of implementation or whether it's\n * SimdMaskArray<T, N>).\n */\ntemplate <typename T>\nstruct is_simd_mask : public std::integral_constant<bool,\n                                                    (is_simd_mask_internal<decay<T>>::value ||\n                                                     is_simd_mask_array_internal<decay<T>>::value)>\n{\n};\n\n/**\n * Identifies any SIMD vector type (independent of implementation or whether it's\n * SimdArray<T, N>).\n */\ntemplate <typename T>\nstruct is_simd_vector\n    : public std::integral_constant<bool,\n                                    (is_simd_vector_internal<decay<T>>::value ||\n                                     is_simdarray_internal<decay<T>>::value)>\n{\n};\n\n/// Identifies any possible SimdArray<T, N> type (independent of const/volatile or reference)\ntemplate <typename T>\nstruct isSimdArray : public is_simdarray_internal<decay<T>>\n{\n};\n\n/// Identifies any possible SimdMaskArray<T, N> type (independent of const/volatile or reference)\ntemplate <typename T>\nstruct isSimdMaskArray : public is_simd_mask_array_internal<decay<T>>\n{\n};\n\n/// \\internal Identifies LoadStoreFlag types\ntemplate <typename T> struct is_load_store_flag : public is_loadstoreflag_internal<decay<T>> {};\n\n/// \\internal Identifies a SimdArray type with a single Vector member\ntemplate <typename T> struct is_atomic_simdarray_internal : public std::false_type {};\ntemplate <typename T> using isAtomicSimdArray = is_atomic_simdarray_internal<decay<T>>;\n\n/// \\internal Identifies a SimdMaskArray type with a single Mask member\ntemplate <typename T> struct is_atomic_simd_mask_array_internal : public std::false_type {};\ntemplate <typename T> using isAtomicSimdMaskArray = is_atomic_simd_mask_array_internal<decay<T>>;\n\n/**\n * The \\p value member will either be the number of SIMD vector entries or 0 if \\p T is not a SIMD\n * type.\n */\ntemplate <typename T> struct simd_vector_size : public vector_size_internal<decay<T>> {};\n\ntemplate <typename T> struct is_integral : public is_integral_internal<decay<T>> {};\ntemplate <typename T> struct is_floating_point : public is_floating_point_internal<decay<T>> {};\ntemplate <typename T> struct is_arithmetic : public is_arithmetic_internal<decay<T>> {};\ntemplate <typename T> struct is_signed : public is_signed_internal<decay<T>> {};\ntemplate <typename T> struct is_unsigned : public is_unsigned_internal<decay<T>> {};\n\ntemplate <typename T, bool IsSimdVector> struct scalar_type_internal { using type = T; };\ntemplate <typename T> struct scalar_type_internal<T, true> { using type = typename T::EntryType; };\ntemplate <typename T> using scalar_type = typename scalar_type_internal<decay<T>, is_simd_vector<T>::value>::type;\n\n}  // namespace Traits\n}  // namespace Vc\n\n#include \"entry_type_of.h\"\n\n#endif // VC_TRAITS_TYPE_TRAITS_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/type_traits",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2013-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_TYPE_TRAITS_\n#define VC_TYPE_TRAITS_\n\n#include <type_traits>\n\n#include \"traits/type_traits.h\"\n#include \"common/macros.h\"\nnamespace Vc_VERSIONED_NAMESPACE\n{\nusing Traits::is_simd_mask;\nusing Traits::is_simd_vector;\nusing Traits::is_integral;\nusing Traits::is_floating_point;\nusing Traits::is_arithmetic;\nusing Traits::is_signed;\nusing Traits::is_unsigned;\n\ntemplate<typename T>\nstruct memory_alignment : public std::integral_constant<size_t, alignof(T)> {};\n\ntemplate<> struct memory_alignment<short_v> : public std::integral_constant<size_t, short_v::MemoryAlignment> {};\ntemplate<> struct memory_alignment<ushort_v> : public std::integral_constant<size_t, ushort_v::MemoryAlignment> {};\n\n}\n\n#endif // VC_TYPE_TRAITS_\n\n// vim: ft=cpp foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/Vc/vector",
    "content": "/*{{{\n    Copyright © 2013 Matthias Kretz <kretz@kde.org>\n\n    Permission to use, copy, modify, and distribute this software\n    and its documentation for any purpose and without fee is hereby\n    granted, provided that the above copyright notice appear in all\n    copies and that both that the copyright notice and this\n    permission notice and warranty disclaimer appear in supporting\n    documentation, and that the name of the author not be used in\n    advertising or publicity pertaining to distribution of the\n    software without specific, written prior permission.\n\n    The author disclaim all warranties with regard to this\n    software, including all implied warranties of merchantability\n    and fitness.  In no event shall the author be liable for any\n    special, indirect or consequential damages or any damages\n    whatsoever resulting from loss of use, data or profits, whether\n    in an action of contract, negligence or other tortious action,\n    arising out of or in connection with the use or performance of\n    this software.\n\n}}}*/\n\n#ifndef VC_VECTOR_\n#define VC_VECTOR_\n\n#include \"common/subscript.h\"\n#include <vector>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * \\ingroup Containers\n * \\headerfile vector <Vc/vector>\n *\n * An adapted `std::vector` container with an additional subscript operator which\n * implements gather and scatter operations.\n *\n * The [std::vector](https://en.cppreference.com/w/cpp/container/vector) documentation applies.\n *\n * Example:\n * \\code\n * struct Point {\n *   float x, y;\n * };\n * Vc::vector<Point> data;\n * data.resize(100);\n * // initialize values in data\n * float_v::IndexType indexes = ...;  // values between 0-99\n * float_v x = data[indexes][&Point::x];\n * float_v y = data[indexes][&Point::y];\n * \\endcode\n */\ntemplate <typename T, typename Allocator = std::allocator<T>>\nusing vector = Common::AdaptSubscriptOperator<std::vector<T, Allocator>>;\n\nnamespace Traits\n{\ntemplate <typename T, typename A>\nstruct has_contiguous_storage_impl<Vc::vector<T, A>> : public std::true_type {};\n}  // namespace Traits\n\n}  // namespace\n\n#endif  // VC_VECTOR_\n// vim: ft=cpp\n"
  },
  {
    "path": "3rdparty/Vc/Vc/vector.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_VECTOR_H_\n#define VC_VECTOR_H_\n\n// 1. define all of Vc::Scalar - this one is always present, so it makes sense to put it first\n#include \"scalar/vector.h\"\n\n#if defined(Vc_IMPL_SSE)\n# include \"sse/vector.h\"\n#endif\n#ifdef Vc_IMPL_AVX\n# include \"avx/vector.h\"\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * \\name Vector Type Aliases\n * \\ingroup Vectors\n */\n///@{\n/**\\addtogroup Vectors\n * @{\n */\n/// vector of double precision\nusing double_v = Vector<double>;\n/// vector of single precision\nusing float_v = Vector<float>;\n/// vector of signed integers\nusing int_v = Vector<int>;\n/// vector of unsigned integers\nusing uint_v = Vector<uint>;\n/// vector of signed short integers\nusing short_v = Vector<short>;\n/// vector of unsigned short integers\nusing ushort_v = Vector<ushort>;\n///\\internal vector of signed long long integers\nusing llong_v = Vector<llong>;\n///\\internal vector of unsigned long long integers\nusing ullong_v = Vector<ullong>;\n///\\internal vector of signed long integers\nusing long_v = Vector<long>;\n///\\internal vector of unsigned long integers\nusing ulong_v = Vector<ulong>;\n///\\internal vector of signed char-sized integers\nusing schar_v = Vector<schar>;\n///\\internal vector of unsigned char-sized integers\nusing uchar_v = Vector<uchar>;\n///@}\n///@}\n\n/**\n * \\name Mask Type Aliases\n * \\ingroup Masks\n */\n///@{\n/**\\addtogroup Masks\n * @{\n */\n/// mask type for double_v vectors\nusing double_m = Mask<double>;\n/// mask type for float_v vectors\nusing  float_m = Mask< float>;\n///\\internal mask type for llong_v vectors\nusing  llong_m = Mask< llong>;\n///\\internal mask type for ullong_v vectors\nusing ullong_m = Mask<ullong>;\n///\\internal mask type for long_v vectors\nusing   long_m = Mask<  long>;\n///\\internal mask type for ulong_v vectors\nusing  ulong_m = Mask< ulong>;\n/// mask type for int_v vectors\nusing    int_m = Mask<   int>;\n/// mask type for uint_v vectors\nusing   uint_m = Mask<  uint>;\n/// mask type for short_v vectors\nusing  short_m = Mask< short>;\n/// mask type for ushort_v vectors\nusing ushort_m = Mask<ushort>;\n///\\internal mask type for schar_v vectors\nusing  schar_m = Mask< schar>;\n///\\internal mask type for uchar_v vectors\nusing  uchar_m = Mask< uchar>;\n///@}\n///@}\n\n  typedef Vector<std:: int_least64_t>  int_least64_v;\n  typedef Vector<std::uint_least64_t> uint_least64_v;\n  typedef Vector<std:: int_least32_t>  int_least32_v;\n  typedef Vector<std::uint_least32_t> uint_least32_v;\n  typedef Vector<std:: int_least16_t>  int_least16_v;\n  typedef Vector<std::uint_least16_t> uint_least16_v;\n  typedef Vector<std::  int_least8_t>   int_least8_v;\n  typedef Vector<std:: uint_least8_t>  uint_least8_v;\n\n  typedef Mask<std:: int_least64_t>  int_least64_m;\n  typedef Mask<std::uint_least64_t> uint_least64_m;\n  typedef Mask<std:: int_least32_t>  int_least32_m;\n  typedef Mask<std::uint_least32_t> uint_least32_m;\n  typedef Mask<std:: int_least16_t>  int_least16_m;\n  typedef Mask<std::uint_least16_t> uint_least16_m;\n  typedef Mask<std::  int_least8_t>   int_least8_m;\n  typedef Mask<std:: uint_least8_t>  uint_least8_m;\n\n  typedef Vector<std:: int_fast64_t>  int_fast64_v;\n  typedef Vector<std::uint_fast64_t> uint_fast64_v;\n  typedef Vector<std:: int_fast32_t>  int_fast32_v;\n  typedef Vector<std::uint_fast32_t> uint_fast32_v;\n  typedef Vector<std:: int_fast16_t>  int_fast16_v;\n  typedef Vector<std::uint_fast16_t> uint_fast16_v;\n  typedef Vector<std::  int_fast8_t>   int_fast8_v;\n  typedef Vector<std:: uint_fast8_t>  uint_fast8_v;\n\n  typedef Mask<std:: int_fast64_t>  int_fast64_m;\n  typedef Mask<std::uint_fast64_t> uint_fast64_m;\n  typedef Mask<std:: int_fast32_t>  int_fast32_m;\n  typedef Mask<std::uint_fast32_t> uint_fast32_m;\n  typedef Mask<std:: int_fast16_t>  int_fast16_m;\n  typedef Mask<std::uint_fast16_t> uint_fast16_m;\n  typedef Mask<std::  int_fast8_t>   int_fast8_m;\n  typedef Mask<std:: uint_fast8_t>  uint_fast8_m;\n\n#if defined INT64_MAX && defined UINT64_MAX\n  typedef Vector<std:: int64_t>  int64_v;\n  typedef Vector<std::uint64_t> uint64_v;\n  typedef Mask<std:: int64_t>  int64_m;\n  typedef Mask<std::uint64_t> uint64_m;\n#endif\n#if defined INT32_MAX && defined UINT32_MAX\n  typedef Vector<std:: int32_t>  int32_v;\n  typedef Vector<std::uint32_t> uint32_v;\n  typedef Mask<std:: int32_t>  int32_m;\n  typedef Mask<std::uint32_t> uint32_m;\n#endif\n#if defined INT16_MAX && defined UINT16_MAX\n  typedef Vector<std:: int16_t>  int16_v;\n  typedef Vector<std::uint16_t> uint16_v;\n  typedef Mask<std:: int16_t>  int16_m;\n  typedef Mask<std::uint16_t> uint16_m;\n#endif\n#if defined INT8_MAX && defined UINT8_MAX\n  typedef Vector<std:: int8_t>  int8_v;\n  typedef Vector<std::uint8_t> uint8_v;\n  typedef Mask<std:: int8_t>  int8_m;\n  typedef Mask<std::uint8_t> uint8_m;\n#endif\n\n  namespace {\n    static_assert(double_v::Size == Vc_DOUBLE_V_SIZE, \"Vc_DOUBLE_V_SIZE macro defined to an incorrect value\");\n    static_assert(float_v::Size  == Vc_FLOAT_V_SIZE , \"Vc_FLOAT_V_SIZE macro defined to an incorrect value \");\n    static_assert(int_v::Size    == Vc_INT_V_SIZE   , \"Vc_INT_V_SIZE macro defined to an incorrect value   \");\n    static_assert(uint_v::Size   == Vc_UINT_V_SIZE  , \"Vc_UINT_V_SIZE macro defined to an incorrect value  \");\n    static_assert(short_v::Size  == Vc_SHORT_V_SIZE , \"Vc_SHORT_V_SIZE macro defined to an incorrect value \");\n    static_assert(ushort_v::Size == Vc_USHORT_V_SIZE, \"Vc_USHORT_V_SIZE macro defined to an incorrect value\");\n  }\n}\n\n\n// finally define the non-member operators\n#include \"common/operators.h\"\n\n#include \"common/simdarray.h\"\n// XXX See bottom of common/simdmaskarray.h:\n//#include \"common/simd_cast_caller.tcc\"\n\n#include \"common/alignedbase.h\"\nnamespace Vc_VERSIONED_NAMESPACE {\n/**\n * \\ingroup Vectors\n *\n * Specifies the most conservative memory alignment necessary for Vector<T> objects with\n * default VectorAbi. Use this value e.g. with an \\c alignas expression or when allocating\n * aligned memory dynamically (\\ref Vc::malloc).\n *\n * \\see Vc::MemoryAlignment\n * \\see Vc::VectorAlignedBase\n */\nconstexpr std::size_t VectorAlignment = alignof(VectorAlignedBase);\n/**\n * \\ingroup Vectors\n *\n * Specifies the most conservative memory alignment necessary for aligned loads and stores\n * of Vector types. Use this value e.g. with an \\c alignas expression or when allocating\n * aligned memory dynamically (\\ref Vc::malloc).\n *\n * \\see Vc::VectorAlignment\n * \\see Vc::Vector<T, Abi>::MemoryAlignment\n */\nconstexpr std::size_t MemoryAlignment = alignof(MemoryAlignedBase);\n} // namespace Vc_VERSIONED_NAMESPACE\n\n#define Vc_VECTOR_DECLARED_ 1\n\n#include \"scalar/helperimpl.h\"\n#include \"scalar/math.h\"\n#include \"scalar/simd_cast_caller.tcc\"\n#if defined(Vc_IMPL_SSE)\n# include \"sse/helperimpl.h\"\n# include \"sse/math.h\"\n# include \"sse/simd_cast_caller.tcc\"\n#endif\n#if defined(Vc_IMPL_AVX)\n# include \"avx/helperimpl.h\"\n# include \"avx/math.h\"\n# include \"avx/simd_cast_caller.tcc\"\n#endif\n\n#include \"common/math.h\"\n\n#ifdef isfinite\n#undef isfinite\n#endif\n#ifdef isnan\n#undef isnan\n#endif\n\n#include \"common/vectortuple.h\"\n#include \"common/where.h\"\n#include \"common/iif.h\"\n\n#ifndef Vc_NO_STD_FUNCTIONS\nnamespace std\n{\n  using Vc::min;\n  using Vc::max;\n\n  using Vc::abs;\n  using Vc::asin;\n  using Vc::atan;\n  using Vc::atan2;\n  using Vc::ceil;\n  using Vc::cos;\n  using Vc::exp;\n  using Vc::fma;\n  using Vc::trunc;\n  using Vc::floor;\n  using Vc::frexp;\n  using Vc::ldexp;\n  using Vc::log;\n  using Vc::log10;\n  using Vc::log2;\n  using Vc::round;\n  using Vc::sin;\n  using Vc::sqrt;\n\n  using Vc::isfinite;\n  using Vc::isnan;\n} // namespace std\n#endif\n\nVc_RESET_DIAGNOSTICS\n\n#endif // VC_VECTOR_H_\n"
  },
  {
    "path": "3rdparty/Vc/Vc/version.h",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#ifndef VC_VERSION_H_\n#define VC_VERSION_H_\n\n/**\n * \\name Version Macros\n * \\ingroup Utilities\n */\n//@{\n/**\n * \\ingroup Utilities\n * Contains the version string of the %Vc headers. Same as Vc::versionString().\n */\n#define Vc_VERSION_STRING \"1.4.4\"\n\n/**\n * \\ingroup Utilities\n * Contains the encoded version number of the %Vc headers. Same as Vc::versionNumber().\n */\n#define Vc_VERSION_NUMBER 0x010408\n\n/**\n * \\ingroup Utilities\n *\n * Helper macro to compare against an encoded version number.\n * Example:\n * \\code\n * #if Vc_VERSION_NUMBER >= Vc_VERSION_CHECK(1, 0, 0)\n * \\endcode\n */\n#define Vc_VERSION_CHECK(major, minor, patch) ((major << 16) | (minor << 8) | (patch << 1))\n//@}\n\n#define Vc_LIBRARY_ABI_VERSION 5\n\n///\\internal identify Vc 2.0\n#define Vc_IS_VERSION_2 (Vc_VERSION_NUMBER >= Vc_VERSION_CHECK(1, 70, 0))\n///\\internal identify Vc 1.x\n#define Vc_IS_VERSION_1 (Vc_VERSION_NUMBER < Vc_VERSION_CHECK(1, 70, 0))\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n/**\n * \\ingroup Utilities\n * \\headerfile version.h <Vc/version.h>\n *\n * \\returns the version string of the %Vc headers.\n *\n * \\note There exists a built-in check that ensures on application startup that the %Vc version of the\n * library (link time) and the headers (compile time) are equal. A mismatch between headers and\n * library could lead to errors that are very hard to debug.\n * \\note If you need to disable the check (it costs a very small amount of application startup time)\n * you can define Vc_NO_VERSION_CHECK at compile time.\n */\ninline const char *versionString() { return Vc_VERSION_STRING; }\n\n/**\n * \\ingroup Utilities\n * \\headerfile version.h <Vc/version.h>\n *\n * \\returns the version of the %Vc headers encoded in an integer.\n */\nconstexpr unsigned int versionNumber() { return Vc_VERSION_NUMBER; }\n}\n\n// @BEGIN SKIP GODBOLT@\n#if !defined(Vc_NO_VERSION_CHECK) && !defined(Vc_COMPILE_LIB)\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n/**\\internal\n * This function is implemented in the libVc library and checks whether the library is\n * compatible with the version information passed via the function parameters. If it is\n * incompatible the function prints a warning and aborts.\n */\nvoid Vc_CDECL checkLibraryAbi(unsigned int compileTimeAbi, unsigned int versionNumber,\n                              const char *versionString);\nnamespace\n{\n/**\\internal\n * This constructor function is compiled into every translation unit and thus executed on\n * startup (before main) for as many TUs as are linked into the executable. It calls\n * Vc::Common::checkLibraryAbi to ensure the TU was compiled with Vc headers that are\n * compatible to the linked libVc.\n */\nstatic struct runLibraryAbiCheck {\n    runLibraryAbiCheck()\n    {\n        checkLibraryAbi(Vc_LIBRARY_ABI_VERSION, Vc_VERSION_NUMBER, Vc_VERSION_STRING);\n    }\n} _runLibraryAbiCheck;\n}  // unnamed namespace\n}  // namespace Common\n}  // namespace Vc\n#endif\n// @END SKIP GODBOLT@\n\n#endif // VC_VERSION_H_\n"
  },
  {
    "path": "3rdparty/Vc/cmake/AddCompilerFlag.cmake",
    "content": "# - Add a given compiler flag to flags variables.\n# AddCompilerFlag(<flag> [<var>])\n# or\n# AddCompilerFlag(<flag> [C_FLAGS <var>] [CXX_FLAGS <var>] [C_RESULT <var>]\n#                        [CXX_RESULT <var>])\n\n#=============================================================================\n# Copyright 2010-2015 Matthias Kretz <kretz@kde.org>\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#  * Redistributions of source code must retain the above copyright notice,\n#    this list of conditions and the following disclaimer.\n#\n#  * Redistributions in binary form must reproduce the above copyright notice,\n#    this list of conditions and the following disclaimer in the documentation\n#    and/or other materials provided with the distribution.\n#\n#  * Neither the names of contributing organizations nor the\n#    names of its contributors may be used to endorse or promote products\n#    derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR\n# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#=============================================================================\n\nget_filename_component(_currentDir \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\ninclude(\"${_currentDir}/CheckCCompilerFlag.cmake\")\ninclude(\"${_currentDir}/CheckCXXCompilerFlag.cmake\")\n\nmacro(AddCompilerFlag _flag)\n   string(REGEX REPLACE \"[-.+/:= ]\" \"_\" _flag_esc \"${_flag}\")\n\n   set(_c_flags \"CMAKE_C_FLAGS\")\n   set(_cxx_flags \"CMAKE_CXX_FLAGS\")\n   set(_c_result tmp)\n   set(_cxx_result tmp)\n   if(${ARGC} EQUAL 2)\n      message(WARNING \"Deprecated use of the AddCompilerFlag macro.\")\n      unset(_c_result)\n      set(_cxx_result ${ARGV1})\n   elseif(${ARGC} GREATER 2)\n      set(state 0)\n      unset(_c_flags)\n      unset(_cxx_flags)\n      unset(_c_result)\n      unset(_cxx_result)\n      foreach(_arg ${ARGN})\n         if(\"x${_arg}\" STREQUAL \"xC_FLAGS\")\n            set(state 1)\n            if(NOT DEFINED _c_result)\n               set(_c_result tmp0)\n            endif()\n         elseif(\"x${_arg}\" STREQUAL \"xCXX_FLAGS\")\n            set(state 2)\n            if(NOT DEFINED _cxx_result)\n               set(_cxx_result tmp1)\n            endif()\n         elseif(\"x${_arg}\" STREQUAL \"xC_RESULT\")\n            set(state 3)\n         elseif(\"x${_arg}\" STREQUAL \"xCXX_RESULT\")\n            set(state 4)\n         elseif(state EQUAL 1)\n            set(_c_flags \"${_arg}\")\n         elseif(state EQUAL 2)\n            set(_cxx_flags \"${_arg}\")\n         elseif(state EQUAL 3)\n            set(_c_result \"${_arg}\")\n         elseif(state EQUAL 4)\n            set(_cxx_result \"${_arg}\")\n         else()\n            message(FATAL_ERROR \"Syntax error for AddCompilerFlag\")\n         endif()\n      endforeach()\n   endif()\n\n   set(_c_code \"int main() { return 0; }\")\n   set(_cxx_code \"int main() { return 0; }\")\n   if(\"${_flag}\" STREQUAL \"-mfma\")\n      # Compiling with FMA3 support may fail only at the assembler level.\n      # In that case we need to have such an instruction in the test code\n      set(_c_code \"#include <immintrin.h>\n      __m128 foo(__m128 x) { return _mm_fmadd_ps(x, x, x); }\n      int main() { return 0; }\")\n      set(_cxx_code \"${_c_code}\")\n   elseif(\"${_flag}\" STREQUAL \"-stdlib=libc++\")\n      # Compiling with libc++ not only requires a compiler that understands it, but also\n      # the libc++ headers itself\n      set(_cxx_code \"#include <iostream>\n      #include <cstdio>\n      int main() { return 0; }\")\n   else()\n      set(_cxx_code \"#include <cstdio>\n      int main() { return 0; }\")\n   endif()\n\n   if(DEFINED _c_result)\n      check_c_compiler_flag(\"${_flag}\" check_c_compiler_flag_${_flag_esc} \"${_c_code}\")\n      set(${_c_result} ${check_c_compiler_flag_${_flag_esc}})\n   endif()\n   if(DEFINED _cxx_result)\n      check_cxx_compiler_flag(\"${_flag}\" check_cxx_compiler_flag_${_flag_esc} \"${_cxx_code}\")\n      set(${_cxx_result} ${check_cxx_compiler_flag_${_flag_esc}})\n   endif()\n\n   macro(my_append _list _flag _special)\n      if(\"x${_list}\" STREQUAL \"x${_special}\")\n         set(${_list} \"${${_list}} ${_flag}\")\n      else()\n         list(APPEND ${_list} \"${_flag}\")\n      endif()\n   endmacro()\n\n   if(check_c_compiler_flag_${_flag_esc} AND DEFINED _c_flags)\n      my_append(${_c_flags} \"${_flag}\" CMAKE_C_FLAGS)\n   endif()\n   if(check_cxx_compiler_flag_${_flag_esc} AND DEFINED _cxx_flags)\n      my_append(${_cxx_flags} \"${_flag}\" CMAKE_CXX_FLAGS)\n   endif()\nendmacro(AddCompilerFlag)\n"
  },
  {
    "path": "3rdparty/Vc/cmake/AddTargetProperty.cmake",
    "content": "#=============================================================================\n# Copyright 2010-2015 Matthias Kretz <kretz@kde.org>\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#  * Redistributions of source code must retain the above copyright notice,\n#    this list of conditions and the following disclaimer.\n#  * Redistributions in binary form must reproduce the above copyright notice,\n#    this list of conditions and the following disclaimer in the documentation\n#    and/or other materials provided with the distribution.\n#  * Neither the names of contributing organizations nor the\n#    names of its contributors may be used to endorse or promote products\n#    derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR\n# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#=============================================================================\n\nmacro(add_target_property _target _prop _value)\n   get_target_property(_oldprop \"${_target}\" ${_prop})\n   if(NOT _oldprop)\n      set_target_properties(\"${_target}\" PROPERTIES ${_prop} \"${_value}\")\n   else(NOT _oldprop)\n      set_target_properties(\"${_target}\" PROPERTIES ${_prop} \"${_oldprop} ${_value}\")\n   endif(NOT _oldprop)\nendmacro(add_target_property)\n"
  },
  {
    "path": "3rdparty/Vc/cmake/CheckCCompilerFlag.cmake",
    "content": "# - Check whether the C compiler supports a given flag.\n# CHECK_C_COMPILER_FLAG(<flag> <var>)\n#  <flag> - the compiler flag\n#  <var>  - variable to store the result\n# This internally calls the check_c_source_compiles macro.\n# See help for CheckCSourceCompiles for a listing of variables\n# that can modify the build.\n\n#=============================================================================\n# Copyright 2006-2009 Kitware, Inc.\n# Copyright 2006 Alexander Neundorf <neundorf@kde.org>\n# Copyright 2011-2013 Matthias Kretz <kretz@kde.org>\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#  * Redistributions of source code must retain the above copyright notice,\n#    this list of conditions and the following disclaimer.\n#\n#  * Redistributions in binary form must reproduce the above copyright notice,\n#    this list of conditions and the following disclaimer in the documentation\n#    and/or other materials provided with the distribution.\n#\n#  * The names of Kitware, Inc., the Insight Consortium, or the names of\n#    any consortium members, or of any contributors, may not be used to\n#    endorse or promote products derived from this software without\n#    specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR\n# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#=============================================================================\n\nINCLUDE(CheckCSourceCompiles)\n\nMACRO (CHECK_C_COMPILER_FLAG _FLAG _RESULT)\n   SET(SAFE_CMAKE_REQUIRED_DEFINITIONS \"${CMAKE_REQUIRED_DEFINITIONS}\")\n   SET(CMAKE_REQUIRED_DEFINITIONS \"${_FLAG}\")\n   if(${ARGC} GREATER 2)\n      SET(TEST_SOURCE \"${ARGV2}\")\n   else()\n      SET(TEST_SOURCE \"int main() { return 0;}\")\n   endif()\n   CHECK_C_SOURCE_COMPILES(\"${TEST_SOURCE}\" ${_RESULT}\n     # Some compilers do not fail with a bad flag\n     FAIL_REGEX \"error: bad value (.*) for .* switch\"       # GNU\n     FAIL_REGEX \"argument unused during compilation\"        # clang\n     FAIL_REGEX \"is valid for .* but not for C\"             # GNU\n     FAIL_REGEX \"unrecognized .*option\"                     # GNU\n     FAIL_REGEX \"ignored for target\"                        # GNU\n     FAIL_REGEX \"ignoring unknown option\"                   # MSVC\n     FAIL_REGEX \"warning D9002\"                             # MSVC\n     FAIL_REGEX \"[Uu]nknown option\"                         # HP\n     FAIL_REGEX \"[Ww]arning: [Oo]ption\"                     # SunPro\n     FAIL_REGEX \"command option .* is not recognized\"       # XL\n     FAIL_REGEX \"WARNING: unknown flag:\"                    # Open64\n     FAIL_REGEX \"command line error\"                        # ICC\n     FAIL_REGEX \"command line warning\"                      # ICC\n     FAIL_REGEX \"#10236:\"                                   # ICC: File not found\n     FAIL_REGEX \" #10159: \"                                 # ICC\n     FAIL_REGEX \" #10353: \"                                 # ICC: option '-mfma' ignored, suggest using '-march=core-avx2'\n     )\n   SET (CMAKE_REQUIRED_DEFINITIONS \"${SAFE_CMAKE_REQUIRED_DEFINITIONS}\")\nENDMACRO (CHECK_C_COMPILER_FLAG)\n\n"
  },
  {
    "path": "3rdparty/Vc/cmake/CheckCXXCompilerFlag.cmake",
    "content": "# - Check whether the CXX compiler supports a given flag.\n# CHECK_CXX_COMPILER_FLAG(<flag> <var>)\n#  <flag> - the compiler flag\n#  <var>  - variable to store the result\n# This internally calls the check_cxx_source_compiles macro.  See help\n# for CheckCXXSourceCompiles for a listing of variables that can\n# modify the build.\n\n#=============================================================================\n# Copyright 2006-2009 Kitware, Inc.\n# Copyright 2006 Alexander Neundorf <neundorf@kde.org>\n# Copyright 2011-2013 Matthias Kretz <kretz@kde.org>\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#  * Redistributions of source code must retain the above copyright notice,\n#    this list of conditions and the following disclaimer.\n#\n#  * Redistributions in binary form must reproduce the above copyright notice,\n#    this list of conditions and the following disclaimer in the documentation\n#    and/or other materials provided with the distribution.\n#\n#  * The names of Kitware, Inc., the Insight Consortium, or the names of\n#    any consortium members, or of any contributors, may not be used to\n#    endorse or promote products derived from this software without\n#    specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR\n# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#=============================================================================\n\nINCLUDE(CheckCXXSourceCompiles)\n\nMACRO (CHECK_CXX_COMPILER_FLAG _FLAG _RESULT)\n   SET(SAFE_CMAKE_REQUIRED_DEFINITIONS \"${CMAKE_REQUIRED_DEFINITIONS}\")\n   SET(CMAKE_REQUIRED_DEFINITIONS \"${_FLAG}\")\n   if(${ARGC} GREATER 2)\n      SET(TEST_SOURCE \"${ARGV2}\")\n   else()\n      SET(TEST_SOURCE \"int main() { return 0;}\")\n   endif()\n   CHECK_CXX_SOURCE_COMPILES(\"${TEST_SOURCE}\" ${_RESULT}\n     # Some compilers do not fail with a bad flag\n     FAIL_REGEX \"error: bad value (.*) for .* switch\"       # GNU\n     FAIL_REGEX \"argument unused during compilation\"        # clang\n     FAIL_REGEX \"is valid for .* but not for C\\\\\\\\+\\\\\\\\+\"   # GNU\n     FAIL_REGEX \"unrecognized .*option\"                     # GNU\n     FAIL_REGEX \"ignored for target\"                        # GNU\n     FAIL_REGEX \"ignoring unknown option\"                   # MSVC\n     FAIL_REGEX \"warning D9002\"                             # MSVC\n     FAIL_REGEX \"[Uu]nknown option\"                         # HP\n     FAIL_REGEX \"[Ww]arning: [Oo]ption\"                     # SunPro\n     FAIL_REGEX \"command option .* is not recognized\"       # XL\n     FAIL_REGEX \"WARNING: unknown flag:\"                    # Open64\n     FAIL_REGEX \"command line error\"                        # ICC\n     FAIL_REGEX \"command line warning\"                      # ICC\n     FAIL_REGEX \"#10236:\"                                   # ICC: File not found\n     FAIL_REGEX \" #10159: \"                                 # ICC\n     FAIL_REGEX \" #10353: \"                                 # ICC: option '-mfma' ignored, suggest using '-march=core-avx2'\n     )\n   SET (CMAKE_REQUIRED_DEFINITIONS \"${SAFE_CMAKE_REQUIRED_DEFINITIONS}\")\nENDMACRO (CHECK_CXX_COMPILER_FLAG)\n\n"
  },
  {
    "path": "3rdparty/Vc/cmake/FindVc.cmake",
    "content": "# Locate the Vc template library. Vc can be found at https://github.com/VcDevel/Vc\n#\n# This file is meant to be copied into projects that want to use Vc. It will\n# search for VcConfig.cmake, which ships with Vc and will provide up-to-date\n# buildsystem changes. Thus there should not be any need to update FindVc.cmake\n# again after you integrated it into your project.\n#\n# This module defines the following variables:\n# Vc_FOUND\n# Vc_INCLUDE_DIR\n# Vc_LIBRARIES\n# Vc_DEFINITIONS\n# Vc_COMPILE_FLAGS\n# Vc_ARCHITECTURE_FLAGS\n# Vc_ALL_FLAGS (the union of the above three variables)\n# Vc_VERSION_MAJOR\n# Vc_VERSION_MINOR\n# Vc_VERSION_PATCH\n# Vc_VERSION\n# Vc_VERSION_STRING\n# Vc_INSTALL_DIR\n# Vc_LIB_DIR\n# Vc_CMAKE_MODULES_DIR\n#\n# The following two variables are set according to the compiler used. Feel free\n# to use them to skip whole compilation units.\n# Vc_SSE_INTRINSICS_BROKEN\n# Vc_AVX_INTRINSICS_BROKEN\n#\n#=============================================================================\n# Copyright 2009-2015   Matthias Kretz <kretz@kde.org>\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#  * Redistributions of source code must retain the above copyright notice,\n#    this list of conditions and the following disclaimer.\n#  * Redistributions in binary form must reproduce the above copyright notice,\n#    this list of conditions and the following disclaimer in the documentation\n#    and/or other materials provided with the distribution.\n#  * Neither the names of contributing organizations nor the\n#    names of its contributors may be used to endorse or promote products\n#    derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR\n# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#=============================================================================\n\nfind_package(Vc ${Vc_FIND_VERSION} QUIET NO_MODULE PATHS $ENV{HOME} /opt/Vc)\n\ninclude(FindPackageHandleStandardArgs)\nfind_package_handle_standard_args(Vc CONFIG_MODE)\n"
  },
  {
    "path": "3rdparty/Vc/cmake/OptimizeForArchitecture.cmake",
    "content": "# Determine the host CPU feature set and determine the best set of compiler\n# flags to enable all supported SIMD relevant features. Alternatively, the\n# target CPU can be explicitly selected (for generating more generic binaries\n# or for targeting a different system).\n# Compilers provide e.g. the -march=native flag to achieve a similar result.\n# This fails to address the need for building for a different microarchitecture\n# than the current host.\n# The script tries to deduce all settings from the model and family numbers of\n# the CPU instead of reading the CPUID flags from e.g. /proc/cpuinfo. This makes\n# the detection more independent from the CPUID code in the kernel (e.g. avx2 is\n# not listed on older kernels).\n#\n# Usage:\n# OptimizeForArchitecture()\n# If either of Vc_SSE_INTRINSICS_BROKEN, Vc_AVX_INTRINSICS_BROKEN,\n# Vc_AVX2_INTRINSICS_BROKEN is defined and set, the OptimizeForArchitecture\n# macro will consequently disable the relevant features via compiler flags.\n\n#=============================================================================\n# Copyright 2010-2016 Matthias Kretz <kretz@kde.org>\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n#  * Redistributions of source code must retain the above copyright notice,\n#    this list of conditions and the following disclaimer.\n#  * Redistributions in binary form must reproduce the above copyright notice,\n#    this list of conditions and the following disclaimer in the documentation\n#    and/or other materials provided with the distribution.\n#  * Neither the names of contributing organizations nor the\n#    names of its contributors may be used to endorse or promote products\n#    derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR\n# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#=============================================================================\n\nget_filename_component(_currentDir \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\ninclude(\"${_currentDir}/AddCompilerFlag.cmake\")\ninclude(CheckIncludeFileCXX)\n\nmacro(_my_find _list _value _ret)\n   list(FIND ${_list} \"${_value}\" _found)\n   if(_found EQUAL -1)\n      set(${_ret} FALSE)\n   else(_found EQUAL -1)\n      set(${_ret} TRUE)\n   endif(_found EQUAL -1)\nendmacro(_my_find)\n\nmacro(AutodetectHostArchitecture)\n   set(TARGET_ARCHITECTURE \"generic\")\n   set(Vc_ARCHITECTURE_FLAGS)\n   set(_vendor_id)\n   set(_cpu_family)\n   set(_cpu_model)\n   if(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n      file(READ \"/proc/cpuinfo\" _cpuinfo)\n      string(REGEX REPLACE \".*vendor_id[ \\t]*:[ \\t]+([a-zA-Z0-9_-]+).*\" \"\\\\1\" _vendor_id \"${_cpuinfo}\")\n      string(REGEX REPLACE \".*cpu family[ \\t]*:[ \\t]+([a-zA-Z0-9_-]+).*\" \"\\\\1\" _cpu_family \"${_cpuinfo}\")\n      string(REGEX REPLACE \".*model[ \\t]*:[ \\t]+([a-zA-Z0-9_-]+).*\" \"\\\\1\" _cpu_model \"${_cpuinfo}\")\n      string(REGEX REPLACE \".*flags[ \\t]*:[ \\t]+([^\\n]+).*\" \"\\\\1\" _cpu_flags \"${_cpuinfo}\")\n   elseif(CMAKE_SYSTEM_NAME STREQUAL \"Darwin\")\n      execute_process(COMMAND \"/usr/sbin/sysctl\" -n machdep.cpu.vendor machdep.cpu.model machdep.cpu.family machdep.cpu.features\n         OUTPUT_STRIP_TRAILING_WHITESPACE\n         OUTPUT_VARIABLE _sysctl_output_string)\n      mark_as_advanced(_sysctl_output_string)\n      string(REPLACE \"\\n\" \";\" _sysctl_output ${_sysctl_output_string})\n      list(GET _sysctl_output 0 _vendor_id)\n      list(GET _sysctl_output 1 _cpu_model)\n      list(GET _sysctl_output 2 _cpu_family)\n      list(GET _sysctl_output 3 _cpu_flags)\n\n      string(TOLOWER \"${_cpu_flags}\" _cpu_flags)\n      string(REPLACE \".\" \"_\" _cpu_flags \"${_cpu_flags}\")\n   elseif(CMAKE_SYSTEM_NAME STREQUAL \"Windows\")\n      get_filename_component(_vendor_id \"[HKEY_LOCAL_MACHINE\\\\Hardware\\\\Description\\\\System\\\\CentralProcessor\\\\0;VendorIdentifier]\" NAME CACHE)\n      get_filename_component(_cpu_id \"[HKEY_LOCAL_MACHINE\\\\Hardware\\\\Description\\\\System\\\\CentralProcessor\\\\0;Identifier]\" NAME CACHE)\n      mark_as_advanced(_vendor_id _cpu_id)\n      string(REGEX REPLACE \".* Family ([0-9]+) .*\" \"\\\\1\" _cpu_family \"${_cpu_id}\")\n      string(REGEX REPLACE \".* Model ([0-9]+) .*\" \"\\\\1\" _cpu_model \"${_cpu_id}\")\n   endif(CMAKE_SYSTEM_NAME STREQUAL \"Linux\")\n   if(_vendor_id STREQUAL \"GenuineIntel\")\n      if(_cpu_family EQUAL 6)\n         # taken from the Intel ORM\n         # http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html\n         # CPUID Signature Values of Of Recent Intel Microarchitectures\n         # 4E 5E       | Skylake microarchitecture\n         # 3D 47 56    | Broadwell microarchitecture\n         # 3C 45 46 3F | Haswell microarchitecture\n         # 3A 3E       | Ivy Bridge microarchitecture\n         # 2A 2D       | Sandy Bridge microarchitecture\n         # 25 2C 2F    | Intel microarchitecture Westmere\n         # 1A 1E 1F 2E | Intel microarchitecture Nehalem\n         # 17 1D       | Enhanced Intel Core microarchitecture\n         # 0F          | Intel Core microarchitecture\n         #\n         # Intel SDM Vol. 3C 35-1 / December 2016:\n         # 57          | Xeon Phi 3200, 5200, 7200  [Knights Landing]\n         # 85          | Future Xeon Phi\n         # 8E 9E       | 7th gen. Core              [Kaby Lake]\n         # 55          | Future Xeon                [Skylake w/ AVX512]\n         # 4E 5E       | 6th gen. Core / E3 v5      [Skylake w/o AVX512]\n         # 56          | Xeon D-1500                [Broadwell]\n         # 4F          | Xeon E5 v4, E7 v4, i7-69xx [Broadwell]\n         # 47          | 5th gen. Core / Xeon E3 v4 [Broadwell]\n         # 3D          | M-5xxx / 5th gen.          [Broadwell]\n         # 3F          | Xeon E5 v3, E7 v3, i7-59xx [Haswell-E]\n         # 3C 45 46    | 4th gen. Core, Xeon E3 v3  [Haswell]\n         # 3E          | Xeon E5 v2, E7 v2, i7-49xx [Ivy Bridge-E]\n         # 3A          | 3rd gen. Core, Xeon E3 v2  [Ivy Bridge]\n         # 2D          | Xeon E5, i7-39xx           [Sandy Bridge]\n         # 2F          | Xeon E7\n         # 2A          | Xeon E3, 2nd gen. Core     [Sandy Bridge]\n         # 2E          | Xeon 7500, 6500 series\n         # 25 2C       | Xeon 3600, 5600 series, Core i7, i5 and i3\n         #\n         # Values from the Intel SDE:\n         # 5C | Goldmont\n         # 5A | Silvermont\n         # 57 | Knights Landing\n         # 66 | Cannonlake\n         # 55 | Skylake Server\n         # 4E | Skylake Client\n         # 3C | Broadwell (likely a bug in the SDE)\n         # 3C | Haswell\n         if(_cpu_model EQUAL 142 OR _cpu_model EQUAL 158) # 8E, 9E\n            set(TARGET_ARCHITECTURE \"kaby-lake\")\n         elseif(_cpu_model EQUAL 106)\n            set(TARGET_ARCHITECTURE \"icelake\")\n         elseif(_cpu_model EQUAL 102)\n            set(TARGET_ARCHITECTURE \"cannonlake\")\n         elseif(_cpu_model EQUAL 87) # 57\n            set(TARGET_ARCHITECTURE \"knl\")  # Knights Landing\n         elseif(_cpu_model EQUAL 92)\n            set(TARGET_ARCHITECTURE \"goldmont\")\n         elseif(_cpu_model EQUAL 90 OR _cpu_model EQUAL 76)\n            set(TARGET_ARCHITECTURE \"silvermont\")\n         elseif(_cpu_model EQUAL 85) # 55\n            set(TARGET_ARCHITECTURE \"skylake-avx512\")\n         elseif(_cpu_model EQUAL 78 OR _cpu_model EQUAL 94) # 4E, 5E\n            set(TARGET_ARCHITECTURE \"skylake\")\n         elseif(_cpu_model EQUAL 61 OR _cpu_model EQUAL 71 OR _cpu_model EQUAL 79 OR _cpu_model EQUAL 86) # 3D, 47, 4F, 56\n            set(TARGET_ARCHITECTURE \"broadwell\")\n         elseif(_cpu_model EQUAL 60 OR _cpu_model EQUAL 69 OR _cpu_model EQUAL 70 OR _cpu_model EQUAL 63)\n            set(TARGET_ARCHITECTURE \"haswell\")\n         elseif(_cpu_model EQUAL 58 OR _cpu_model EQUAL 62)\n            set(TARGET_ARCHITECTURE \"ivy-bridge\")\n         elseif(_cpu_model EQUAL 42 OR _cpu_model EQUAL 45)\n            set(TARGET_ARCHITECTURE \"sandy-bridge\")\n         elseif(_cpu_model EQUAL 37 OR _cpu_model EQUAL 44 OR _cpu_model EQUAL 47)\n            set(TARGET_ARCHITECTURE \"westmere\")\n         elseif(_cpu_model EQUAL 26 OR _cpu_model EQUAL 30 OR _cpu_model EQUAL 31 OR _cpu_model EQUAL 46)\n            set(TARGET_ARCHITECTURE \"nehalem\")\n         elseif(_cpu_model EQUAL 23 OR _cpu_model EQUAL 29)\n            set(TARGET_ARCHITECTURE \"penryn\")\n         elseif(_cpu_model EQUAL 15)\n            set(TARGET_ARCHITECTURE \"merom\")\n         elseif(_cpu_model EQUAL 28)\n            set(TARGET_ARCHITECTURE \"atom\")\n         elseif(_cpu_model EQUAL 14)\n            set(TARGET_ARCHITECTURE \"core\")\n         elseif(_cpu_model LESS 14)\n            message(WARNING \"Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the generic CPU settings with SSE2.\")\n            set(TARGET_ARCHITECTURE \"generic\")\n         else()\n            message(WARNING \"Your CPU (family ${_cpu_family}, model ${_cpu_model}) is not known. Auto-detection of optimization flags failed and will use the 65nm Core 2 CPU settings.\")\n            set(TARGET_ARCHITECTURE \"merom\")\n         endif()\n      elseif(_cpu_family EQUAL 7) # Itanium (not supported)\n         message(WARNING \"Your CPU (Itanium: family ${_cpu_family}, model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.\")\n      elseif(_cpu_family EQUAL 15) # NetBurst\n         list(APPEND _available_vector_units_list \"sse\" \"sse2\")\n         if(_cpu_model GREATER 2) # Not sure whether this must be 3 or even 4 instead\n            list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\")\n         endif(_cpu_model GREATER 2)\n      else()\n         message(WARNING \"Your CPU family ${_cpu_family} (vendor ${_vendor_id} model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.\")\n      endif()\n   elseif(_vendor_id STREQUAL \"AuthenticAMD\")\n      if(_cpu_family EQUAL 25)\n         set(TARGET_ARCHITECTURE \"zen3\")\n      elseif(_cpu_family EQUAL 23)\n         set(TARGET_ARCHITECTURE \"zen\")\n      elseif(_cpu_family EQUAL 22) # 16h\n         set(TARGET_ARCHITECTURE \"AMD 16h\")\n      elseif(_cpu_family EQUAL 21) # 15h\n         if(_cpu_model LESS 2)\n            set(TARGET_ARCHITECTURE \"bulldozer\")\n         else()\n            set(TARGET_ARCHITECTURE \"piledriver\")\n         endif()\n      elseif(_cpu_family EQUAL 20) # 14h\n         set(TARGET_ARCHITECTURE \"AMD 14h\")\n      elseif(_cpu_family EQUAL 18) # 12h\n      elseif(_cpu_family EQUAL 16) # 10h\n         set(TARGET_ARCHITECTURE \"barcelona\")\n      elseif(_cpu_family EQUAL 15)\n         set(TARGET_ARCHITECTURE \"k8\")\n         if(_cpu_model GREATER 64) # I don't know the right number to put here. This is just a guess from the hardware I have access to\n            set(TARGET_ARCHITECTURE \"k8-sse3\")\n         endif(_cpu_model GREATER 64)\n      else()\n         message(WARNING \"Your CPU family ${_cpu_family} (vendor ${_vendor_id} model ${_cpu_model}) is not supported by OptimizeForArchitecture.cmake.\")\n      endif()\n   endif()\nendmacro()\n\nmacro(OptimizeForArchitecture)\n   if(\"${CMAKE_SYSTEM_PROCESSOR}\" MATCHES \"(x86|AMD64)\")\n      OptimizeForArchitectureX86()\n   else()\n      message(STATUS \"No support for auto-detection of the target instruction set/extension\")\n      set(TARGET_ARCHITECTURE \"unused\" CACHE STRING \"CPU architecture to optimize for. (unused)\")\n   endif()\nendmacro()\n\nmacro(OptimizeForArchitectureX86)\n   set(TARGET_ARCHITECTURE \"auto\" CACHE STRING \"CPU architecture to optimize for. \\\nUsing an incorrect setting here can result in crashes of the resulting binary because of invalid instructions used. \\\nSetting the value to \\\"auto\\\" will try to optimize for the architecture where cmake is called. \\\nOther supported values are: \\\"none\\\", \\\"generic\\\", \\\"core\\\", \\\"merom\\\" (65nm Core2), \\\n\\\"penryn\\\" (45nm Core2), \\\"nehalem\\\", \\\"westmere\\\", \\\"sandy-bridge\\\", \\\"ivy-bridge\\\", \\\n\\\"haswell\\\", \\\"broadwell\\\", \\\"skylake\\\", \\\"skylake-xeon\\\", \\\"kaby-lake\\\", \\\"cannonlake\\\", \\\"icelake\\\", \\\"silvermont\\\", \\\n\\\"goldmont\\\", \\\"knl\\\" (Knights Landing), \\\"atom\\\", \\\"k8\\\", \\\"k8-sse3\\\", \\\"barcelona\\\", \\\n\\\"istanbul\\\", \\\"magny-cours\\\", \\\"bulldozer\\\", \\\"interlagos\\\", \\\"piledriver\\\", \\\n\\\"AMD 14h\\\", \\\"AMD 16h\\\", \\\"zen\\\", \\\"zen3\\\", \\\"x86-64\\\", \\\"x86-64-v2\\\", \\\"x86-64-v3\\\", \\\"x86-64-v4\\\".\")\n   set(_force)\n   if(NOT _last_target_arch STREQUAL \"${TARGET_ARCHITECTURE}\")\n      message(STATUS \"target changed from \\\"${_last_target_arch}\\\" to \\\"${TARGET_ARCHITECTURE}\\\"\")\n      set(_force FORCE)\n   endif()\n   set(_last_target_arch \"${TARGET_ARCHITECTURE}\" CACHE STRING \"\" FORCE)\n   mark_as_advanced(_last_target_arch)\n   string(TOLOWER \"${TARGET_ARCHITECTURE}\" TARGET_ARCHITECTURE)\n\n   set(_march_flag_list)\n   set(_available_vector_units_list)\n\n   if(TARGET_ARCHITECTURE STREQUAL \"auto\")\n      AutodetectHostArchitecture()\n      message(STATUS \"Detected CPU: ${TARGET_ARCHITECTURE}\")\n   endif(TARGET_ARCHITECTURE STREQUAL \"auto\")\n\n   macro(_nehalem)\n      list(APPEND _march_flag_list \"nehalem\")\n      list(APPEND _march_flag_list \"corei7\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4.1\" \"sse4.2\")\n   endmacro()\n   macro(_westmere)\n      list(APPEND _march_flag_list \"westmere\")\n      _nehalem()\n   endmacro()\n   macro(_sandybridge)\n      list(APPEND _march_flag_list \"sandybridge\")\n      list(APPEND _march_flag_list \"corei7-avx\")\n      _westmere()\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4.1\" \"sse4.2\" \"avx\")\n   endmacro()\n   macro(_ivybridge)\n      list(APPEND _march_flag_list \"ivybridge\")\n      list(APPEND _march_flag_list \"core-avx-i\")\n      _sandybridge()\n      list(APPEND _available_vector_units_list \"rdrnd\" \"f16c\")\n   endmacro()\n   macro(_haswell)\n      list(APPEND _march_flag_list \"haswell\")\n      list(APPEND _march_flag_list \"core-avx2\")\n      _ivybridge()\n      list(APPEND _available_vector_units_list \"avx2\" \"fma\" \"bmi\" \"bmi2\")\n   endmacro()\n   macro(_broadwell)\n      list(APPEND _march_flag_list \"broadwell\")\n      _haswell()\n   endmacro()\n   macro(_skylake)\n      list(APPEND _march_flag_list \"skylake\")\n      _broadwell()\n   endmacro()\n   macro(_skylake_avx512)\n      list(APPEND _march_flag_list \"skylake-avx512\")\n      _skylake()\n      list(APPEND _available_vector_units_list \"avx512f\" \"avx512cd\" \"avx512dq\" \"avx512bw\" \"avx512vl\")\n   endmacro()\n   macro(_cannonlake)\n      list(APPEND _march_flag_list \"cannonlake\")\n      _skylake_avx512()\n      list(APPEND _available_vector_units_list \"avx512ifma\" \"avx512vbmi\")\n   endmacro()\n   macro(_knightslanding)\n      list(APPEND _march_flag_list \"knl\")\n      _broadwell()\n      list(APPEND _available_vector_units_list \"avx512f\" \"avx512pf\" \"avx512er\" \"avx512cd\")\n   endmacro()\n   macro(_silvermont)\n      list(APPEND _march_flag_list \"silvermont\")\n      _westmere()\n      list(APPEND _available_vector_units_list \"rdrnd\")\n   endmacro()\n   macro(_goldmont)\n      list(APPEND _march_flag_list \"goldmont\")\n      _silvermont()\n   endmacro()\n   macro(_x86_64)\n      list(APPEND _march_flag_list \"x86-64\")\n      list(APPEND _march_flag_list \"sse\" \"sse2\")\n   endmacro()\n   macro(_x86_64_v2)\n      list(APPEND _march_flag_list \"x86-64-v2\")\n      _x86_64()\n      list(APPEND _march_flag_list \"sse3\" \"sse4.1\" \"sse4.2\" \"ssse3\")\n   endmacro()\n   macro(_x86_64_v3)\n      list(APPEND _march_flag_list \"x86-64-v3\")\n      _x86_64_v2()\n      list(APPEND _march_flag_list \"avx\" \"avx2\" \"bmi\" \"bmi2\" \"f16c\" \"fma\")\n   endmacro()\n   macro(_x86_64_v4)\n      list(APPEND _march_flag_list \"x86-64-v4\")\n      _x86_64_v3()\n      list(APPEND _march_flag_list \"avx512f\" \"avx512bw\" \"avx512cd\" \"avx512dq\" \"avx512vl\")\n   endmacro()\n\n   if(TARGET_ARCHITECTURE STREQUAL \"core\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"merom\")\n      list(APPEND _march_flag_list \"merom\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"penryn\")\n      list(APPEND _march_flag_list \"penryn\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\")\n      message(STATUS \"Sadly the Penryn architecture exists in variants with SSE4.1 and without SSE4.1.\")\n      if(_cpu_flags MATCHES \"sse4_1\")\n         message(STATUS \"SSE4.1: enabled (auto-detected from this computer's CPU flags)\")\n         list(APPEND _available_vector_units_list \"sse4.1\")\n      else()\n         message(STATUS \"SSE4.1: disabled (auto-detected from this computer's CPU flags)\")\n      endif()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"knl\")\n      _knightslanding()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"icelake\")\n      _cannonlake()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"cannonlake\")\n      _cannonlake()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"kaby-lake\")\n      _skylake()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"skylake-xeon\" OR TARGET_ARCHITECTURE STREQUAL \"skylake-avx512\")\n      _skylake_avx512()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"skylake\")\n      _skylake()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"broadwell\")\n      _broadwell()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"haswell\")\n      _haswell()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"ivy-bridge\")\n      _ivybridge()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"sandy-bridge\")\n      _sandybridge()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"westmere\")\n      _westmere()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"nehalem\")\n      _nehalem()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"goldmont\")\n      _goldmont()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"silvermont\")\n      _silvermont()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"atom\")\n      list(APPEND _march_flag_list \"atom\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"k8\")\n      list(APPEND _march_flag_list \"k8\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"k8-sse3\")\n      list(APPEND _march_flag_list \"k8-sse3\")\n      list(APPEND _march_flag_list \"k8\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"AMD 16h\")\n      list(APPEND _march_flag_list \"btver2\")\n      list(APPEND _march_flag_list \"btver1\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4a\" \"sse4.1\" \"sse4.2\" \"avx\" \"f16c\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"AMD 14h\")\n      list(APPEND _march_flag_list \"btver1\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4a\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"zen\")\n      list(APPEND _march_flag_list \"znver1\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4a\" \"sse4.1\" \"sse4.2\" \"avx\" \"avx2\" \"fma\" \"f16c\" \"bmi\" \"bmi2\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"zen3\")\n      list(APPEND _march_flag_list \"znver3\")\n      list(APPEND _march_flag_list \"znver2\")\n      list(APPEND _march_flag_list \"znver1\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4a\" \"sse4.1\" \"sse4.2\" \"avx\" \"avx2\" \"fma\" \"f16c\" \"bmi\" \"bmi2\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"piledriver\")\n      list(APPEND _march_flag_list \"bdver2\")\n      list(APPEND _march_flag_list \"bdver1\")\n      list(APPEND _march_flag_list \"bulldozer\")\n      list(APPEND _march_flag_list \"barcelona\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4a\" \"sse4.1\" \"sse4.2\" \"avx\" \"xop\" \"fma4\" \"fma\" \"f16c\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"interlagos\")\n      list(APPEND _march_flag_list \"bdver1\")\n      list(APPEND _march_flag_list \"bulldozer\")\n      list(APPEND _march_flag_list \"barcelona\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4a\" \"sse4.1\" \"sse4.2\" \"avx\" \"xop\" \"fma4\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"bulldozer\")\n      list(APPEND _march_flag_list \"bdver1\")\n      list(APPEND _march_flag_list \"bulldozer\")\n      list(APPEND _march_flag_list \"barcelona\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"ssse3\" \"sse4a\" \"sse4.1\" \"sse4.2\" \"avx\" \"xop\" \"fma4\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"barcelona\")\n      list(APPEND _march_flag_list \"barcelona\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"sse4a\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"istanbul\")\n      list(APPEND _march_flag_list \"barcelona\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"sse4a\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"magny-cours\")\n      list(APPEND _march_flag_list \"barcelona\")\n      list(APPEND _march_flag_list \"core2\")\n      list(APPEND _available_vector_units_list \"sse\" \"sse2\" \"sse3\" \"sse4a\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"x86-64\")\n      _x86_64()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"x86-64-v2\")\n      _x86_64_v2()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"x86-64-v3\")\n      _x86_64_v3()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"x86-64-v4\")\n      _x86_64_v4()\n   elseif(TARGET_ARCHITECTURE STREQUAL \"generic\")\n      list(APPEND _march_flag_list \"generic\")\n   elseif(TARGET_ARCHITECTURE STREQUAL \"none\")\n      # add this clause to remove it from the else clause\n   else(TARGET_ARCHITECTURE STREQUAL \"core\")\n      message(FATAL_ERROR \"Unknown target architecture: \\\"${TARGET_ARCHITECTURE}\\\". Please set TARGET_ARCHITECTURE to a supported value.\")\n   endif(TARGET_ARCHITECTURE STREQUAL \"core\")\n\n   if(NOT TARGET_ARCHITECTURE STREQUAL \"none\")\n      set(_disable_vector_unit_list)\n      set(_enable_vector_unit_list)\n      if(DEFINED Vc_AVX_INTRINSICS_BROKEN AND Vc_AVX_INTRINSICS_BROKEN)\n         UserWarning(\"AVX disabled per default because of old/broken toolchain\")\n         set(_avx_broken true)\n         set(_avx2_broken true)\n         set(_fma4_broken true)\n         set(_xop_broken true)\n      else()\n         set(_avx_broken false)\n         if(DEFINED Vc_FMA4_INTRINSICS_BROKEN AND Vc_FMA4_INTRINSICS_BROKEN)\n            set(_fma4_broken true)\n         else()\n            set(_fma4_broken false)\n         endif()\n         if(DEFINED Vc_XOP_INTRINSICS_BROKEN AND Vc_XOP_INTRINSICS_BROKEN)\n            set(_xop_broken true)\n         else()\n            set(_xop_broken false)\n         endif()\n         if(DEFINED Vc_AVX2_INTRINSICS_BROKEN AND Vc_AVX2_INTRINSICS_BROKEN)\n            UserWarning(\"AVX2 disabled per default because of old/broken toolchain\")\n            set(_avx2_broken true)\n         else()\n            set(_avx2_broken false)\n         endif()\n      endif()\n\n      macro(_enable_or_disable _name _flag _documentation _broken)\n         if(_broken)\n            set(_found false)\n         else()\n            _my_find(_available_vector_units_list \"${_flag}\" _found)\n         endif()\n         set(USE_${_name} ${_found} CACHE BOOL \"${documentation}\" ${_force})\n         mark_as_advanced(USE_${_name})\n         if(USE_${_name})\n            list(APPEND _enable_vector_unit_list \"${_flag}\")\n         else()\n            list(APPEND _disable_vector_unit_list \"${_flag}\")\n         endif()\n      endmacro()\n      _enable_or_disable(SSE2 \"sse2\" \"Use SSE2. If SSE2 instructions are not enabled the SSE implementation will be disabled.\" false)\n      _enable_or_disable(SSE3 \"sse3\" \"Use SSE3. If SSE3 instructions are not enabled they will be emulated.\" false)\n      _enable_or_disable(SSSE3 \"ssse3\" \"Use SSSE3. If SSSE3 instructions are not enabled they will be emulated.\" false)\n      _enable_or_disable(SSE4_1 \"sse4.1\" \"Use SSE4.1. If SSE4.1 instructions are not enabled they will be emulated.\" false)\n      _enable_or_disable(SSE4_2 \"sse4.2\" \"Use SSE4.2. If SSE4.2 instructions are not enabled they will be emulated.\" false)\n      _enable_or_disable(SSE4a \"sse4a\" \"Use SSE4a. If SSE4a instructions are not enabled they will be emulated.\" false)\n      _enable_or_disable(AVX \"avx\" \"Use AVX. This will all floating-point vector sizes relative to SSE.\" _avx_broken)\n      _enable_or_disable(FMA \"fma\" \"Use FMA.\" _avx_broken)\n      _enable_or_disable(BMI2 \"bmi2\" \"Use BMI2.\" _avx_broken)\n      _enable_or_disable(AVX2 \"avx2\" \"Use AVX2. This will double all of the vector sizes relative to SSE.\" _avx2_broken)\n      _enable_or_disable(XOP \"xop\" \"Use XOP.\" _xop_broken)\n      _enable_or_disable(FMA4 \"fma4\" \"Use FMA4.\" _fma4_broken)\n      _enable_or_disable(AVX512F \"avx512f\" \"Use AVX512F. This will double all floating-point vector sizes relative to AVX2.\" false)\n      _enable_or_disable(AVX512VL \"avx512vl\" \"Use AVX512VL. This enables 128- and 256-bit vector length instructions with EVEX coding (improved write-masking & more vector registers).\" _avx2_broken)\n      _enable_or_disable(AVX512PF \"avx512pf\" \"Use AVX512PF. This enables prefetch instructions for gathers and scatters.\" false)\n      _enable_or_disable(AVX512ER \"avx512er\" \"Use AVX512ER. This enables exponential and reciprocal instructions.\" false)\n      _enable_or_disable(AVX512CD \"avx512cd\" \"Use AVX512CD.\" false)\n      _enable_or_disable(AVX512DQ \"avx512dq\" \"Use AVX512DQ.\" false)\n      _enable_or_disable(AVX512BW \"avx512bw\" \"Use AVX512BW.\" false)\n      _enable_or_disable(AVX512IFMA \"avx512ifma\" \"Use AVX512IFMA.\" false)\n      _enable_or_disable(AVX512VBMI \"avx512vbmi\" \"Use AVX512VBMI.\" false)\n\n      if(MSVC)\n         # SSE2 is enabled by default in MSVC\n\n         _my_find(_enable_vector_unit_list \"avx2\" _found)\n         if(_found)\n            AddCompilerFlag(\"/arch:AVX2\" CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _found)\n         else()\n            _my_find(_enable_vector_unit_list \"avx\" _found)\n            if(_found)\n               AddCompilerFlag(\"/arch:AVX\" CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _found)\n            endif()\n         endif()\n         foreach(_flag ${_enable_vector_unit_list})\n            string(TOUPPER \"${_flag}\" _flag)\n            string(REPLACE \".\" \"_\" _flag \"__${_flag}__\")\n            add_definitions(\"-D${_flag}\")\n         endforeach(_flag)\n      elseif(CMAKE_CXX_COMPILER MATCHES \"/(icpc|icc)$\") # ICC (on Linux)\n         set(OFA_map_knl \"-xMIC-AVX512\")\n         set(OFA_map_icelake \"-xCORE-AVX512\")\n         set(OFA_map_cannonlake \"-xCORE-AVX512\")\n         set(OFA_map_skylake-avx512 \"-xCORE-AVX512\")\n         set(OFA_map_skylake \"-xCORE-AVX2\")\n         set(OFA_map_broadwell \"-xCORE-AVX2\")\n         set(OFA_map_haswell \"-xCORE-AVX2\")\n         set(OFA_map_ivybridge \"-xCORE-AVX-I\")\n         set(OFA_map_sandybridge \"-xAVX\")\n         set(OFA_map_westmere \"-xSSE4.2\")\n         set(OFA_map_nehalem \"-xSSE4.2\")\n         set(OFA_map_penryn \"-xSSSE3\")\n         set(OFA_map_merom \"-xSSSE3\")\n         set(OFA_map_core2 \"-xSSE3\")\n         set(OFA_map_znver3 \"-mavx2\") # -xAVX2 does not work and causes this runtime check to appear:\n         set(OFA_map_znver2 \"-mavx2\") # Please verify that both the operating system and the processor support Intel(R) X87, CMOV, MMX, FXSAVE, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, MOVBE, POPCNT, AVX, F16C, FMA, BMI, LZCNT and AVX2 instructions.\n         set(OFA_map_znver1 \"-mavx2\")\n         set(_ok FALSE)\n         foreach(arch ${_march_flag_list})\n            if(DEFINED OFA_map_${arch})\n               AddCompilerFlag(${OFA_map_${arch}} CXX_FLAGS Vc_ARCHITECTURE_FLAGS CXX_RESULT _ok)\n               if(_ok)\n                  break()\n               endif()\n            endif()\n         endforeach()\n         if(NOT _ok)\n            # This is the Intel compiler, so SSE2 is a very reasonable baseline.\n            message(STATUS \"Did not recognize the requested architecture flag, falling back to SSE2\")\n            AddCompilerFlag(\"-xSSE2\" CXX_FLAGS Vc_ARCHITECTURE_FLAGS)\n         endif()\n      else() # not MSVC and not ICC => GCC, Clang, Open64\n         foreach(_flag ${_march_flag_list})\n            AddCompilerFlag(\"-march=${_flag}\" CXX_RESULT _good CXX_FLAGS Vc_ARCHITECTURE_FLAGS)\n            if(_good)\n               break()\n            endif(_good)\n         endforeach(_flag)\n         foreach(_flag ${_enable_vector_unit_list})\n            AddCompilerFlag(\"-m${_flag}\" CXX_RESULT _result)\n            if(_result)\n               set(_header FALSE)\n               if(_flag STREQUAL \"sse3\")\n                  set(_header \"pmmintrin.h\")\n               elseif(_flag STREQUAL \"ssse3\")\n                  set(_header \"tmmintrin.h\")\n               elseif(_flag STREQUAL \"sse4.1\")\n                  set(_header \"smmintrin.h\")\n               elseif(_flag STREQUAL \"sse4.2\")\n                  set(_header \"smmintrin.h\")\n               elseif(_flag STREQUAL \"sse4a\")\n                  set(_header \"ammintrin.h\")\n               elseif(_flag STREQUAL \"avx\")\n                  set(_header \"immintrin.h\")\n               elseif(_flag STREQUAL \"avx2\")\n                  set(_header \"immintrin.h\")\n               elseif(_flag STREQUAL \"fma4\")\n                  set(_header \"x86intrin.h\")\n               elseif(_flag STREQUAL \"xop\")\n                  set(_header \"x86intrin.h\")\n               endif()\n               set(_resultVar \"HAVE_${_header}\")\n               string(REPLACE \".\" \"_\" _resultVar \"${_resultVar}\")\n               if(_header)\n                  CHECK_INCLUDE_FILE_CXX(\"${_header}\" ${_resultVar} \"-m${_flag}\")\n                  if(NOT ${_resultVar})\n                     set(_useVar \"USE_${_flag}\")\n                     string(TOUPPER \"${_useVar}\" _useVar)\n                     string(REPLACE \".\" \"_\" _useVar \"${_useVar}\")\n                     message(STATUS \"disabling ${_useVar} because ${_header} is missing\")\n                     set(${_useVar} FALSE)\n                     list(APPEND _disable_vector_unit_list \"${_flag}\")\n                  endif()\n               endif()\n               if(NOT _header OR ${_resultVar})\n                  list(APPEND Vc_ARCHITECTURE_FLAGS \"-m${_flag}\")\n               endif()\n            endif()\n         endforeach(_flag)\n         foreach(_flag ${_disable_vector_unit_list})\n            AddCompilerFlag(\"-mno-${_flag}\" CXX_FLAGS Vc_ARCHITECTURE_FLAGS)\n         endforeach(_flag)\n      endif()\n   endif()\nendmacro()\n"
  },
  {
    "path": "3rdparty/Vc/cmake/UserWarning.cmake",
    "content": "macro(UserWarning _msg)\n   if(\"$ENV{DASHBOARD_TEST_FROM_CTEST}\" STREQUAL \"\")\n      # developer (non-dashboard) build\n      message(WARNING \"${_msg}\")\n   else()\n      # dashboard build\n      message(STATUS \"${_msg}\")\n   endif()\nendmacro()\n"
  },
  {
    "path": "3rdparty/Vc/cmake/VcConfig.cmake.in",
    "content": "@PACKAGE_INIT@\n\n### General variables for project discovery/inspection\nset_and_check(@PROJECT_NAME@_INSTALL_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@)\nset_and_check(@PROJECT_NAME@_INCLUDE_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@/include)\nset_and_check(@PROJECT_NAME@_LIB_DIR @PACKAGE_CMAKE_INSTALL_PREFIX@/lib@LIB_SUFFIX@)\nset_and_check(@PROJECT_NAME@_CMAKE_MODULES_DIR ${@PROJECT_NAME@_LIB_DIR}/cmake/Vc)\nset(@PROJECT_NAME@_VERSION_STRING \"@PROJECT_VERSION@\")\n\n### Setup @PROJECT_NAME@ defaults\nlist(APPEND CMAKE_MODULE_PATH \"${@PROJECT_NAME@_CMAKE_MODULES_DIR}\")\ninclude(\"${@PROJECT_NAME@_CMAKE_MODULES_DIR}/VcMacros.cmake\")\n\nset(@PROJECT_NAME@_DEFINITIONS)\nset(@PROJECT_NAME@_COMPILE_FLAGS)\nset(@PROJECT_NAME@_ARCHITECTURE_FLAGS)\nvc_set_preferred_compiler_flags()\nseparate_arguments(@PROJECT_NAME@_ALL_FLAGS UNIX_COMMAND \"${@PROJECT_NAME@_DEFINITIONS}\")\nlist(APPEND @PROJECT_NAME@_ALL_FLAGS ${@PROJECT_NAME@_COMPILE_FLAGS})\nlist(APPEND @PROJECT_NAME@_ALL_FLAGS ${@PROJECT_NAME@_ARCHITECTURE_FLAGS})\n\n### Import targets\ninclude(\"@PACKAGE_CMAKE_INSTALL_PREFIX@/@PACKAGE_INSTALL_DESTINATION@/@PROJECT_NAME@Targets.cmake\")\n\n### Define @PROJECT_NAME@_LIBRARIES for backwards compatibility\nget_target_property(vc_lib_location @PROJECT_NAME@::Vc INTERFACE_LOCATION)\nset_and_check(@PROJECT_NAME@_LIBRARIES ${vc_lib_location})\n\n### Handle required components - not used\ncheck_required_components(@PROJECT_NAME@)\n"
  },
  {
    "path": "3rdparty/Vc/cmake/VcMacros.cmake",
    "content": "# Macros for use with the Vc library. Vc can be found at http://code.compeng.uni-frankfurt.de/projects/vc\n#\n# The following macros are provided:\n# vc_determine_compiler\n# vc_set_preferred_compiler_flags\n#\n# =============================================================================\n# Copyright 2009-2015   Matthias Kretz <kretz@kde.org>\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright notice,\n# this list of conditions and the following disclaimer in the documentation\n# and/or other materials provided with the distribution.\n# * Neither the names of contributing organizations nor the\n# names of its contributors may be used to endorse or promote products\n# derived from this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR\n# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n# =============================================================================\n\ncmake_minimum_required(VERSION 2.8.3...3.13)\n\nget_filename_component(_currentDir \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\ninclude(\"${_currentDir}/UserWarning.cmake\")\ninclude(\"${_currentDir}/AddCompilerFlag.cmake\")\ninclude(\"${_currentDir}/OptimizeForArchitecture.cmake\")\n\nmacro(vc_determine_compiler)\n   if(NOT DEFINED Vc_COMPILER_IS_INTEL)\n      execute_process(COMMAND \"${CMAKE_CXX_COMPILER}\" \"--version\"\n         OUTPUT_VARIABLE _cxx_compiler_version\n         ERROR_VARIABLE _cxx_compiler_version)\n      set(Vc_COMPILER_IS_INTEL false)\n      set(Vc_COMPILER_IS_OPEN64 false)\n      set(Vc_COMPILER_IS_CLANG false)\n      set(Vc_COMPILER_IS_MSVC false)\n      set(Vc_COMPILER_IS_GCC false)\n\n      if(CMAKE_CXX_COMPILER MATCHES \"/(icpc|icc)$\")\n         set(Vc_COMPILER_IS_INTEL true)\n         execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion\n            OUTPUT_VARIABLE Vc_ICC_VERSION)\n         message(STATUS \"Detected Compiler: Intel ${Vc_ICC_VERSION}\")\n\n         # break build with too old clang as early as possible.\n         if(Vc_ICC_VERSION VERSION_LESS 18.0.0)\n            message(FATAL_ERROR \"Vc 1.4 requires least ICC 18\")\n         endif()\n      elseif(CMAKE_CXX_COMPILER MATCHES \"(opencc|openCC)$\")\n         set(Vc_COMPILER_IS_OPEN64 true)\n         message(STATUS \"Detected Compiler: Open64\")\n      elseif(CMAKE_CXX_COMPILER MATCHES \"clang\\\\+\\\\+$\" OR \"${_cxx_compiler_version}\" MATCHES \"clang\")\n         set(Vc_COMPILER_IS_CLANG true)\n         execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version\n            OUTPUT_VARIABLE Vc_CLANG_VERSION)\n         string(REGEX MATCH \"[0-9]+\\\\.[0-9]+(\\\\.[0-9]+)?\" Vc_CLANG_VERSION \"${Vc_CLANG_VERSION}\")\n         message(STATUS \"Detected Compiler: Clang ${Vc_CLANG_VERSION}\")\n\n         # break build with too old clang as early as possible.\n         if(Vc_CLANG_VERSION VERSION_LESS 3.4)\n            message(FATAL_ERROR \"Vc 1.x requires C++11 support. This requires at least clang 3.4\")\n         endif()\n      elseif(MSVC)\n         set(Vc_COMPILER_IS_MSVC true)\n         message(STATUS \"Detected Compiler: MSVC ${MSVC_VERSION}\")\n      elseif(CMAKE_COMPILER_IS_GNUCXX)\n         set(Vc_COMPILER_IS_GCC true)\n         execute_process(COMMAND ${CMAKE_CXX_COMPILER} ARGS -dumpversion\n            OUTPUT_VARIABLE Vc_GCC_VERSION)\n         message(STATUS \"Detected Compiler: GCC ${Vc_GCC_VERSION}\")\n\n         # some distributions patch their GCC to return nothing or only major and minor version on -dumpversion.\n         # In that case we must extract the version number from --version.\n         if(NOT Vc_GCC_VERSION OR Vc_GCC_VERSION MATCHES \"^[0-9]\\\\.[0-9]+$\")\n            execute_process(COMMAND ${CMAKE_CXX_COMPILER} ARGS --version\n               OUTPUT_VARIABLE Vc_GCC_VERSION)\n            string(REGEX MATCH \"[0-9]+\\\\.[0-9]+\\\\.[0-9]+\" Vc_GCC_VERSION \"${Vc_GCC_VERSION}\")\n            message(STATUS \"GCC Version from --version: ${Vc_GCC_VERSION}\")\n         endif()\n\n         # some distributions patch their GCC to be API incompatible to what the FSF released. In\n         # those cases we require a macro to identify the distribution version\n         find_program(Vc_lsb_release lsb_release)\n         mark_as_advanced(Vc_lsb_release)\n\n         if(Vc_lsb_release)\n            if(NOT Vc_distributor_id)\n               execute_process(COMMAND ${Vc_lsb_release} -is\n                  OUTPUT_STRIP_TRAILING_WHITESPACE\n                  OUTPUT_VARIABLE Vc_distributor_id)\n               string(TOUPPER \"${Vc_distributor_id}\" Vc_distributor_id)\n               set(Vc_distributor_id \"${Vc_distributor_id}\" CACHE STRING \"lsb distribution id\")\n               execute_process(COMMAND ${Vc_lsb_release} -rs\n                  OUTPUT_STRIP_TRAILING_WHITESPACE\n                  OUTPUT_VARIABLE Vc_distributor_release)\n               set(Vc_distributor_release \"${Vc_distributor_release}\" CACHE STRING \"lsb release id\")\n            endif()\n\n            if(Vc_distributor_id STREQUAL \"UBUNTU\")\n               execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version\n                  OUTPUT_STRIP_TRAILING_WHITESPACE\n                  OUTPUT_VARIABLE _gcc_version)\n               string(REGEX MATCH \"\\\\(.* ${Vc_GCC_VERSION}-([0-9]+).*\\\\)\" _tmp \"${_gcc_version}\")\n\n               if(_tmp)\n                  set(_patch ${CMAKE_MATCH_1})\n                  string(REGEX MATCH \"^([0-9]+)\\\\.([0-9]+)$\" _tmp \"${Vc_distributor_release}\")\n                  execute_process(COMMAND printf 0x%x%02x%02x ${CMAKE_MATCH_1} ${CMAKE_MATCH_2} ${_patch}\n                     OUTPUT_STRIP_TRAILING_WHITESPACE\n                     OUTPUT_VARIABLE _tmp)\n                  set(Vc_DEFINITIONS \"${Vc_DEFINITIONS} -D__GNUC_UBUNTU_VERSION__=${_tmp}\")\n               endif()\n            endif()\n         endif()\n\n         # break build with too old GCC as early as possible.\n         if(Vc_GCC_VERSION VERSION_LESS 4.8.1)\n            message(FATAL_ERROR \"Vc 1.x requires C++11 support. This requires at least GCC 4.8.1\")\n         endif()\n      else()\n         message(WARNING \"Untested/-supported Compiler (${CMAKE_CXX_COMPILER}) for use with Vc.\\nPlease fill out the missing parts in the CMake scripts and submit a patch to http://code.compeng.uni-frankfurt.de/projects/vc\")\n      endif()\n   endif()\nendmacro()\n\nmacro(vc_set_gnu_buildtype_flags)\n   set(CMAKE_CXX_FLAGS_DEBUG \"-g3\" CACHE STRING \"Flags used by the compiler during debug builds.\" FORCE)\n   set(CMAKE_CXX_FLAGS_MINSIZEREL \"-Os -DNDEBUG\" CACHE STRING \"Flags used by the compiler during release minsize builds.\" FORCE)\n   set(CMAKE_CXX_FLAGS_RELEASE \"-O3 -DNDEBUG\" CACHE STRING \"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).\" FORCE)\n   set(CMAKE_CXX_FLAGS_RELWITHDEBUG \"-O3\" CACHE STRING \"Flags used by the compiler during release builds containing runtime checks.\" FORCE)\n   set(CMAKE_CXX_FLAGS_RELWITHDEBINFO \"${CMAKE_CXX_FLAGS_RELWITHDEBUG} -g\" CACHE STRING \"Flags used by the compiler during Release with Debug Info builds.\" FORCE)\n   set(CMAKE_C_FLAGS_DEBUG \"${CMAKE_CXX_FLAGS_DEBUG}\" CACHE STRING \"Flags used by the compiler during debug builds.\" FORCE)\n   set(CMAKE_C_FLAGS_MINSIZEREL \"${CMAKE_CXX_FLAGS_MINSIZEREL}\" CACHE STRING \"Flags used by the compiler during release minsize builds.\" FORCE)\n   set(CMAKE_C_FLAGS_RELEASE \"${CMAKE_CXX_FLAGS_RELEASE}\" CACHE STRING \"Flags used by the compiler during release builds (/MD /Ob1 /Oi /Ot /Oy /Gs will produce slightly less optimized but smaller files).\" FORCE)\n   set(CMAKE_C_FLAGS_RELWITHDEBUG \"${CMAKE_CXX_FLAGS_RELWITHDEBUG}\" CACHE STRING \"Flags used by the compiler during release builds containing runtime checks.\" FORCE)\n   set(CMAKE_C_FLAGS_RELWITHDEBINFO \"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}\" CACHE STRING \"Flags used by the compiler during Release with Debug Info builds.\" FORCE)\n\n   if(CMAKE_BUILD_TYPE STREQUAL \"Release\" OR CMAKE_BUILD_TYPE STREQUAL \"RelWithDebInfo\" OR CMAKE_BUILD_TYPE STREQUAL \"RelWithDebug\")\n      set(ENABLE_STRICT_ALIASING true CACHE BOOL \"Enables strict aliasing rules for more aggressive optimizations\")\n\n      if(NOT ENABLE_STRICT_ALIASING)\n         AddCompilerFlag(-fno-strict-aliasing)\n      endif(NOT ENABLE_STRICT_ALIASING)\n   endif()\n\n   mark_as_advanced(CMAKE_CXX_FLAGS_RELWITHDEBUG CMAKE_C_FLAGS_RELWITHDEBUG)\nendmacro()\n\nmacro(vc_add_compiler_flag VAR _flag)\n   AddCompilerFlag(\"${_flag}\" CXX_FLAGS ${VAR})\nendmacro()\n\nmacro(vc_check_assembler)\n   execute_process(COMMAND ${CMAKE_CXX_COMPILER} -print-prog-name=as\n      OUTPUT_STRIP_TRAILING_WHITESPACE\n      OUTPUT_VARIABLE _as)\n   mark_as_advanced(_as)\n\n   if(NOT _as)\n      message(WARNING \"Could not find 'as', the assembler used by GCC. Hoping everything will work out...\")\n   else()\n      execute_process(COMMAND ${_as} --version\n         OUTPUT_VARIABLE _as_version)\n      string(REGEX REPLACE \"\\\\([^\\\\)]*\\\\)\" \"\" _as_version \"${_as_version}\")\n      string(REGEX MATCH \"[1-9]\\\\.[0-9]+(\\\\.[0-9]+)?\" _as_version \"${_as_version}\")\n      message(STATUS \"Detected assembler: ${_as} ${_as_version}\")\n\n      if(_as_version VERSION_LESS \"2.18.93\")\n         UserWarning(\"Your binutils is too old (${_as_version}). Some optimizations of Vc will be disabled.\")\n         set(Vc_DEFINITIONS \"${Vc_DEFINITIONS} -DVc_NO_XGETBV\") # old assembler doesn't know the xgetbv instruction\n         set(Vc_AVX_INTRINSICS_BROKEN true)\n         set(Vc_XOP_INTRINSICS_BROKEN true)\n         set(Vc_FMA4_INTRINSICS_BROKEN true)\n      elseif(_as_version VERSION_LESS \"2.21.0\")\n         UserWarning(\"Your binutils is too old (${_as_version}) for XOP and AVX2 instructions. They will therefore not be provided in libVc.\")\n         set(Vc_XOP_INTRINSICS_BROKEN true)\n         set(Vc_AVX2_INTRINSICS_BROKEN true)\n      endif()\n   endif()\nendmacro()\n\nmacro(vc_set_preferred_compiler_flags)\n   vc_determine_compiler()\n\n   # Look for libmvec, which provides vectorized implementations of libm\n   find_library(Vc_LIB_MVEC mvec)\n\n   if(Vc_LIB_MVEC)\n      set(SAFE_CMAKE_REQUIRED_LIBRARIES \"${CMAKE_REQUIRED_LIBRARIES}\")\n      set(CMAKE_REQUIRED_LIBRARIES ${Vc_LIB_MVEC})\n      CHECK_CXX_SOURCE_COMPILES(\"\n#include <x86intrin.h>\nextern \\\"C\\\" {\n__m128 _ZGVbN4v_sinf(__m128);\n__m128d _ZGVbN2v_sin(__m128d);\n__m128 _ZGVbN4v_cosf(__m128);\n__m128d _ZGVbN2v_cos(__m128d);\n}\n\n__m128  f0(__m128  x) { return _ZGVbN4v_cosf(_ZGVbN4v_sinf(x)); }\n__m128d f1(__m128d x) { return _ZGVbN2v_cos(_ZGVbN2v_sin(x)); }\nint main() { return 0; }\n\" Vc_HAVE_SSE_SINCOS)\n      CHECK_CXX_SOURCE_COMPILES(\"\n#include <x86intrin.h>\nextern \\\"C\\\" {\n__m256 _ZGVdN8v_sinf(__m256);\n__m256d _ZGVdN4v_sin(__m256d);\n__m256 _ZGVdN8v_cosf(__m256);\n__m256d _ZGVdN4v_cos(__m256d);\n}\n\n__m256  f0(__m256  x) { return _ZGVdN8v_cosf(_ZGVdN8v_sinf(x)); }\n__m256d f1(__m256d x) { return _ZGVdN4v_cos(_ZGVdN4v_sin(x)); }\nint main() { return 0; }\n\" Vc_HAVE_AVX_SINCOS)\n      set(CMAKE_REQUIRED_LIBRARIES \"${SAFE_CMAKE_REQUIRED_LIBRARIES}\")\n\n      if(Vc_HAVE_SSE_SINCOS AND Vc_HAVE_AVX_SINCOS)\n         option(USE_LIBMVEC \"Use GNU's libmvec for vectorized sine and cosine\" OFF)\n\n         if(USE_LIBMVEC)\n            set(Vc_DEFINITIONS \"${Vc_DEFINITIONS} -DVc_HAVE_LIBMVEC=1\")\n         endif()\n      endif()\n   endif(Vc_LIB_MVEC)\n\n   set(_add_warning_flags false)\n   set(_add_buildtype_flags false)\n\n   foreach(_arg ${ARGN})\n      if(_arg STREQUAL \"WARNING_FLAGS\")\n         set(_add_warning_flags true)\n      elseif(_arg STREQUAL \"BUILDTYPE_FLAGS\")\n         set(_add_buildtype_flags true)\n      endif()\n   endforeach()\n\n   set(Vc_SSE_INTRINSICS_BROKEN false)\n   set(Vc_AVX_INTRINSICS_BROKEN false)\n   set(Vc_AVX2_INTRINSICS_BROKEN false)\n   set(Vc_XOP_INTRINSICS_BROKEN false)\n   set(Vc_FMA4_INTRINSICS_BROKEN false)\n\n   if(Vc_COMPILER_IS_OPEN64)\n      # #################################################################################################\n      # Open64                                             #\n      # #################################################################################################\n      if(_add_warning_flags)\n         AddCompilerFlag(\"-W\")\n         AddCompilerFlag(\"-Wall\")\n         AddCompilerFlag(\"-Wimplicit\")\n         AddCompilerFlag(\"-Wswitch\")\n         AddCompilerFlag(\"-Wformat\")\n         AddCompilerFlag(\"-Wchar-subscripts\")\n         AddCompilerFlag(\"-Wparentheses\")\n         AddCompilerFlag(\"-Wmultichar\")\n         AddCompilerFlag(\"-Wtrigraphs\")\n         AddCompilerFlag(\"-Wpointer-arith\")\n         AddCompilerFlag(\"-Wcast-align\")\n         AddCompilerFlag(\"-Wreturn-type\")\n         AddCompilerFlag(\"-pedantic\")\n         AddCompilerFlag(\"-Wno-long-long\")\n         AddCompilerFlag(\"-Wshadow\")\n         AddCompilerFlag(\"-Wold-style-cast\")\n         AddCompilerFlag(\"-Wno-variadic-macros\")\n      endif()\n\n      if(_add_buildtype_flags)\n         vc_set_gnu_buildtype_flags()\n      endif()\n\n      vc_check_assembler()\n\n      # Open64 4.5.1 still doesn't ship immintrin.h\n      set(Vc_AVX_INTRINSICS_BROKEN true)\n      set(Vc_AVX2_INTRINSICS_BROKEN true)\n   elseif(Vc_COMPILER_IS_GCC)\n      # #################################################################################################\n      # GCC                                               #\n      # #################################################################################################\n      if(_add_warning_flags)\n         foreach(_f -W -Wall -Wswitch -Wformat -Wchar-subscripts -Wparentheses -Wmultichar -Wtrigraphs -Wpointer-arith -Wcast-align -Wreturn-type -pedantic -Wshadow -Wundef)\n            AddCompilerFlag(\"${_f}\")\n         endforeach()\n\n         foreach(_f -Wold-style-cast)\n            AddCompilerFlag(\"${_f}\" CXX_FLAGS CMAKE_CXX_FLAGS)\n         endforeach()\n      endif()\n\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-Wabi\")\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-fabi-version=0\") # ABI version 4 is required to make __m128 and __m256 appear as different types. 0 should give us the latest version.\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-fabi-compat-version=0\") # GCC 5 introduced this switch\n\n      # and defaults it to 2 if -fabi-version is 0. But in that case the bug -fabi-version=0 is\n      # supposed to fix resurfaces. For now just make sure that it compiles and links.\n      # Bug report pending.\n      if(_add_buildtype_flags)\n         vc_set_gnu_buildtype_flags()\n      endif()\n\n      if(APPLE)\n         # The GNU assembler (as) on Mac OS X is hopelessly outdated. The -q flag\n         # to as tells it to use the clang assembler, though, which is fine.\n         # -Wa,-q tells GCC to pass -q to as.\n         vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-Wa,-q\")\n\n         # Apparently the MacOS clang assember doesn't understand XOP instructions.\n         set(Vc_XOP_INTRINSICS_BROKEN true)\n      else()\n         vc_check_assembler()\n      endif()\n   elseif(Vc_COMPILER_IS_INTEL)\n      # #################################################################################################\n      # Intel Compiler                                        #\n      # #################################################################################################\n      if(_add_buildtype_flags)\n         set(CMAKE_CXX_FLAGS_RELEASE \"${CMAKE_CXX_FLAGS_RELEASE} -O3\")\n         set(CMAKE_CXX_FLAGS_RELWITHDEBINFO \"${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG -O3\")\n         set(CMAKE_C_FLAGS_RELEASE \"${CMAKE_C_FLAGS_RELEASE} -O3\")\n         set(CMAKE_C_FLAGS_RELWITHDEBINFO \"${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG -O3\")\n      endif()\n\n      if(CMAKE_BUILD_TYPE STREQUAL \"Release\" OR CMAKE_BUILD_TYPE STREQUAL \"RelWithDebInfo\")\n         set(ENABLE_STRICT_ALIASING true CACHE BOOL \"Enables strict aliasing rules for more aggressive optimizations\")\n\n         if(ENABLE_STRICT_ALIASING)\n            AddCompilerFlag(-ansi-alias CXX_FLAGS Vc_COMPILE_FLAGS)\n         else()\n            AddCompilerFlag(-no-ansi-alias CXX_FLAGS Vc_COMPILE_FLAGS)\n         endif()\n      endif()\n\n      if(NOT \"$ENV{DASHBOARD_TEST_FROM_CTEST}\" STREQUAL \"\")\n         # disable warning #2928: the __GXX_EXPERIMENTAL_CXX0X__ macro is disabled when using GNU version 4.6 with the c++0x option\n         # this warning just adds noise about problems in the compiler - but I'm only interested in seeing problems in Vc\n         vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-diag-disable 2928\")\n      endif()\n\n      # Intel doesn't implement the XOP or FMA4 intrinsics\n      set(Vc_XOP_INTRINSICS_BROKEN true)\n      set(Vc_FMA4_INTRINSICS_BROKEN true)\n   elseif(Vc_COMPILER_IS_MSVC)\n      # #################################################################################################\n      # Microsoft Visual Studio                                   #\n      # #################################################################################################\n      if(_add_warning_flags)\n         AddCompilerFlag(\"/wd4800\") # Disable warning \"forcing value to bool\"\n         AddCompilerFlag(\"/wd4996\") # Disable warning about strdup vs. _strdup\n         AddCompilerFlag(\"/wd4244\") # Disable warning \"conversion from 'unsigned int' to 'float', possible loss of data\"\n         AddCompilerFlag(\"/wd4146\") # Disable warning \"unary minus operator applied to unsigned type, result still unsigned\"\n         AddCompilerFlag(\"/wd4227\") # Disable warning \"anachronism used : qualifiers on reference are ignored\" (this is about 'restrict' usage on references, stupid MSVC)\n         AddCompilerFlag(\"/wd4722\") # Disable warning \"destructor never returns, potential memory leak\" (warns about ~_UnitTest_Global_Object which we don't care about)\n         AddCompilerFlag(\"/wd4748\") # Disable warning \"/GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function\" (I don't get it)\n         add_definitions(-D_CRT_SECURE_NO_WARNINGS)\n      endif()\n\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"/Gv\") # default to __vectorcall\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"/bigobj\") # required for building tests with AVX\n\n      if(MSVC_VERSION LESS 1900)\n         UserWarning(\"MSVC before 2015 does not support enough of C++11\")\n      endif()\n   elseif(Vc_COMPILER_IS_CLANG)\n      # #################################################################################################\n      # Clang                                             #\n      # #################################################################################################\n      if(Vc_CLANG_VERSION VERSION_GREATER \"3.5.99\" AND Vc_CLANG_VERSION VERSION_LESS 3.7.0)\n         UserWarning(\"Clang 3.6 has serious issues with AVX code generation, frequently losing 50% of the data. AVX is therefore disabled.\\nPlease update to a more recent clang version.\\n\")\n         set(Vc_AVX_INTRINSICS_BROKEN true)\n         set(Vc_AVX2_INTRINSICS_BROKEN true)\n      endif()\n\n      # disable these warnings because clang shows them for function overloads that were discarded via SFINAE\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-Wno-local-type-template-args\")\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-Wno-unnamed-type-template-args\")\n   endif()\n\n   if(NOT Vc_COMPILER_IS_MSVC)\n      vc_add_compiler_flag(Vc_COMPILE_FLAGS \"-ffp-contract=fast\")\n   endif()\n\n   OptimizeForArchitecture()\n   set(Vc_IMPL \"auto\" CACHE STRING \"Force the Vc implementation globally to the selected instruction set. \\\"auto\\\" lets Vc use the best available instructions.\")\n\n   if(NOT Vc_IMPL STREQUAL \"auto\")\n      set(Vc_DEFINITIONS \"${Vc_DEFINITIONS} -DVc_IMPL=${Vc_IMPL}\")\n\n      if(NOT Vc_IMPL STREQUAL \"Scalar\")\n         set(_use_var \"USE_${Vc_IMPL}\")\n\n         if(Vc_IMPL STREQUAL \"SSE\")\n            set(_use_var \"USE_SSE2\")\n         endif()\n\n         if(NOT ${_use_var})\n            message(WARNING \"The selected value for Vc_IMPL (${Vc_IMPL}) will not work because the relevant instructions are not enabled via compiler flags.\")\n         endif()\n      endif()\n   endif()\nendmacro()\n\n# helper macro for vc_compile_for_all_implementations\nmacro(_vc_compile_one_implementation _srcs _impl)\n   list(FIND _disabled_targets \"${_impl}\" _disabled_index)\n   list(FIND _only_targets \"${_impl}\" _only_index)\n\n   if(${_disabled_index} GREATER -1)\n      if(${_only_index} GREATER -1)\n         # disabled and enabled -> error\n         message(FATAL_ERROR \"vc_compile_for_all_implementations lists ${_impl} in both the ONLY and EXCLUDE lists. Please remove one.\")\n      endif()\n\n      list(REMOVE_AT _disabled_targets ${_disabled_index})\n\n   # skip the rest and return\n   elseif(NOT _only_targets OR ${_only_index} GREATER -1)\n      if(${_only_index} GREATER -1)\n         list(REMOVE_AT _only_targets ${_only_index})\n      endif()\n\n      set(_extra_flags)\n      set(_ok FALSE)\n\n      foreach(_flags_it ${ARGN})\n         if(_flags_it STREQUAL \"NO_FLAG\")\n            set(_ok TRUE)\n            break()\n         endif()\n\n         string(REPLACE \" \" \";\" _flag_list \"${_flags_it}\")\n\n         foreach(_f ${_flag_list})\n            AddCompilerFlag(${_f} CXX_RESULT _ok)\n\n            if(NOT _ok)\n               break()\n            endif()\n         endforeach()\n\n         if(_ok)\n            set(_extra_flags ${_flags_it})\n            break()\n         endif()\n      endforeach()\n\n      if(_ok)\n         get_filename_component(_out \"${_vc_compile_src}\" NAME_WE)\n         get_filename_component(_ext \"${_vc_compile_src}\" EXT)\n         set(_out \"${CMAKE_CURRENT_BINARY_DIR}/${_out}_${_impl}${_ext}\")\n         add_custom_command(OUTPUT \"${_out}\"\n            COMMAND ${CMAKE_COMMAND} -E copy \"${_vc_compile_src}\" \"${_out}\"\n            DEPENDS \"${_vc_compile_src}\"\n            COMMENT \"Copy to ${_out}\"\n            WORKING_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}\"\n            VERBATIM)\n         set_source_files_properties(\"${_out}\" PROPERTIES\n            COMPILE_DEFINITIONS \"Vc_IMPL=${_impl}\"\n            COMPILE_FLAGS \"${_flags} ${_extra_flags}\"\n         )\n         list(APPEND ${_srcs} \"${_out}\")\n      endif()\n   endif()\nendmacro()\n\n# Generate compile rules for the given C++ source file for all available implementations and return\n# the resulting list of object files in _obj\n# all remaining arguments are additional flags\n# Example:\n# vc_compile_for_all_implementations(_objs src/trigonometric.cpp FLAGS -DCOMPILE_BLAH EXCLUDE Scalar)\n# add_executable(executable main.cpp ${_objs})\nmacro(vc_compile_for_all_implementations _srcs _src)\n   set(_flags)\n   unset(_disabled_targets)\n   unset(_only_targets)\n   set(_state 0)\n\n   foreach(_arg ${ARGN})\n      if(_arg STREQUAL \"FLAGS\")\n         set(_state 1)\n      elseif(_arg STREQUAL \"EXCLUDE\")\n         set(_state 2)\n      elseif(_arg STREQUAL \"ONLY\")\n         set(_state 3)\n      elseif(_state EQUAL 1)\n         set(_flags \"${_flags} ${_arg}\")\n      elseif(_state EQUAL 2)\n         list(APPEND _disabled_targets \"${_arg}\")\n      elseif(_state EQUAL 3)\n         list(APPEND _only_targets \"${_arg}\")\n      else()\n         message(FATAL_ERROR \"incorrect argument to vc_compile_for_all_implementations\")\n      endif()\n   endforeach()\n\n   set(_vc_compile_src \"${_src}\")\n\n   _vc_compile_one_implementation(${_srcs} Scalar NO_FLAG)\n\n   if(NOT Vc_SSE_INTRINSICS_BROKEN)\n      if(Vc_COMPILER_IS_MSVC)\n         _vc_compile_one_implementation(${_srcs} SSE2 NO_FLAG)\n         _vc_compile_one_implementation(${_srcs} SSE3 NO_FLAG)\n         _vc_compile_one_implementation(${_srcs} SSSE3 NO_FLAG)\n         _vc_compile_one_implementation(${_srcs} SSE4_1 NO_FLAG)\n         _vc_compile_one_implementation(${_srcs} SSE4_2 NO_FLAG)\n         _vc_compile_one_implementation(${_srcs} SSE3+SSE4a NO_FLAG)\n      else()\n         _vc_compile_one_implementation(${_srcs} SSE2 \"-msse2\")\n         _vc_compile_one_implementation(${_srcs} SSE3 \"-msse3\")\n         _vc_compile_one_implementation(${_srcs} SSSE3 \"-mssse3\")\n         _vc_compile_one_implementation(${_srcs} SSE4_1 \"-msse4.1\")\n         _vc_compile_one_implementation(${_srcs} SSE4_2 \"-msse4.2\")\n         _vc_compile_one_implementation(${_srcs} SSE3+SSE4a \"-msse4a\")\n      endif()\n   endif()\n\n   if(NOT Vc_AVX_INTRINSICS_BROKEN)\n      _vc_compile_one_implementation(${_srcs} AVX \"-mavx\" \"/arch:AVX\")\n\n      if(NOT Vc_XOP_INTRINSICS_BROKEN)\n         if(NOT Vc_FMA4_INTRINSICS_BROKEN)\n            _vc_compile_one_implementation(${_srcs} SSE+XOP+FMA4 \"-mxop -mfma4\" \"\" \"\")\n            _vc_compile_one_implementation(${_srcs} AVX+XOP+FMA4 \"-mavx -mxop -mfma4\" \"\" \"\")\n         endif()\n\n         _vc_compile_one_implementation(${_srcs} SSE+XOP+FMA \"-mxop -mfma\" \"\" \"\")\n         _vc_compile_one_implementation(${_srcs} AVX+XOP+FMA \"-mavx -mxop -mfma\" \"\" \"\")\n      endif()\n\n      _vc_compile_one_implementation(${_srcs} AVX+FMA \"-mavx -mfma\" \"\" \"\")\n   endif()\n\n   if(NOT Vc_AVX2_INTRINSICS_BROKEN)\n      # The necessary list is not clear to me yet. At this point I'll only consider Intel CPUs, in\n      # which case AVX2 implies the availability of FMA and BMI2\n      # _vc_compile_one_implementation(${_srcs} AVX2  \"-mavx2\")\n      # _vc_compile_one_implementation(${_srcs} AVX2+BMI2 \"-mavx2 -mbmi2\")\n      _vc_compile_one_implementation(${_srcs} AVX2+FMA+BMI2 \"-march=core-avx2\" \"-mavx2 -mfma -mbmi2\" \"/arch:AVX2\")\n\n      # _vc_compile_one_implementation(${_srcs} AVX2+FMA \"-mavx2 -mfma\")\n   endif()\n\n   list(LENGTH _only_targets _len)\n\n   if(_len GREATER 0)\n      message(WARNING \"The following unknown targets where listed in the ONLY list of vc_compile_for_all_implementations: '${_only_targets}'\")\n   endif()\n\n   list(LENGTH _disabled_targets _len)\n\n   if(_len GREATER 0)\n      message(WARNING \"The following unknown targets where listed in the EXCLUDE list of vc_compile_for_all_implementations: '${_disabled_targets}'\")\n   endif()\nendmacro()\n"
  },
  {
    "path": "3rdparty/Vc/cmake/toolchain-arm-linux-gnueabi-gcc.cmake",
    "content": "SET(CMAKE_SYSTEM_NAME Linux)\nSET(CMAKE_SYSTEM_PROCESSOR arm)\n"
  },
  {
    "path": "3rdparty/Vc/cmake/toolchain-arm-linux.cmake",
    "content": "SET(CMAKE_SYSTEM_NAME Linux)\nSET(CMAKE_SYSTEM_PROCESSOR arm)\n"
  },
  {
    "path": "3rdparty/Vc/print_target_architecture.cmake",
    "content": "get_filename_component(_currentDir \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\ninclude(\"${_currentDir}/cmake/OptimizeForArchitecture.cmake\")\n\nif(arch STREQUAL \"linux\")\n   set(CMAKE_SYSTEM_NAME \"Linux\")\nelseif(arch STREQUAL \"darwin\")\n   set(CMAKE_SYSTEM_NAME \"Darwin\")\nelseif(arch MATCHES \"mingw\" OR arch MATCHES \"[Ww]indows\" OR arch MATCHES \"win7\" OR arch MATCHES \"msys\")\n   set(CMAKE_SYSTEM_NAME \"Windows\")\nelse()\n   message(FATAL_ERROR \"unhandled system\")\nendif()\n\nAutodetectHostArchitecture()\nmessage(STATUS \"${TARGET_ARCHITECTURE}\")\n"
  },
  {
    "path": "3rdparty/Vc/src/avx_sorthelper.cpp",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include <Vc/avx/vector.h>\n#include <Vc/avx/debug.h>\n#include <Vc/avx/macros.h>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\n#ifdef Vc_IMPL_AVX2\ntemplate <>\nVc_CONST AVX2::short_v sorted<CurrentImplementation::current()>(AVX2::short_v x_)\n{\n    // ab cd ef gh ij kl mn op\n    // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑\n    // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮\n    // ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮\n    // ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮\n    // <> <> <> <> <> <> <> <>\n    // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑\n    // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮\n    // ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮\n    // ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮\n    // 01 23 01 23 01 23 01 23\n    // ⎮⎮ ⎮⎮   ╳   ⎮⎮ ⎮⎮   ╳\n    // 01 23 32 10 01 23 32 10\n    // ⎮⎝ ⎮⎝ ⎠⎮ ⎠⎮ ⎮⎝ ⎮⎝ ⎠⎮ ⎠⎮\n    // ⎮ ╲⎮ ╳ ⎮╱ ⎮ ⎮ ╲⎮ ╳ ⎮╱ ⎮\n    // ⎮  ╲╱ ╲╱  ⎮ ⎮  ╲╱ ╲╱  ⎮\n    // ⎮  ╱╲ ╱╲  ⎮ ⎮  ╱╲ ╱╲  ⎮\n    // ⎮ ╱⎮ ╳ ⎮╲ ⎮ ⎮ ╱⎮ ╳ ⎮╲ ⎮\n    // ⎮⎛ ⎮⎛ ⎞⎮ ⎞⎮ ⎮⎛ ⎮⎛ ⎞⎮ ⎞⎮\n    // <> <> <> <> <> <> <> <>\n    // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑\n    // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮\n    // ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮ ⎮ ╳ ⎮\n    // ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮ ⎮⎛ ⎞⎮\n    // <> <> <> <> <> <> <> <>\n    // ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑ ↓↑\n    // ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮ ⎮⎝ ⎠⎮\n    // ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮ ⎮ o ⎮\n    // ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮ ⎮↓ ↑⎮\n    // 01 23 01 23 01 23 01 23\n\n    // sort pairs (one min/max)\n    auto x = AVX::lo128(x_.data());\n    auto y = AVX::hi128(x_.data());\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    auto l = _mm_min_epi16(x, y);\n    auto h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n\n    // merge left & right quads (two min/max)\n    x = _mm_unpacklo_epi16(l, h);\n    y = _mm_unpackhi_epi16(h, l);\n    // Vc_DEBUG << \"8x2 sorted xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h));\n    y = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n\n    // merge quads into octs (three min/max)\n    x = _mm_unpacklo_epi16(h, l);\n    y = _mm_unpackhi_epi16(l, h);\n    // Vc_DEBUG << \"4x4 sorted xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::permuteLo<X2, X3, X0, X1>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(h, l));\n    y = Mem::permuteHi<X6, X7, X4, X5>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(l, h));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h));\n    y = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h) << \" done?\";\n\n    // merge octs into hexa (four min/max)\n    x = _mm_unpacklo_epi16(l, h);\n    y = _mm_unpackhi_epi16(h, l);\n    // Vc_DEBUG << \"2x8 sorted xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = _mm_unpacklo_epi64(l, h);\n    y = _mm_unpackhi_epi64(l, h);\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = _mm_castps_si128(Mem::permute<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(h), _mm_castsi128_ps(l))));\n    y = _mm_castps_si128(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(l), _mm_castsi128_ps(h)));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h);\n    y = Mem::permuteLo<X1, X0, X3, X2>(\n        Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l)));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epi16(x, y);\n    h = _mm_max_epi16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = _mm_unpacklo_epi16(l, h);\n    y = _mm_unpackhi_epi16(l, h);\n    return AVX::concat(x, y);\n}\n\ntemplate <>\nVc_CONST AVX2::ushort_v sorted<CurrentImplementation::current()>(AVX2::ushort_v x_)\n{\n    // sort pairs (one min/max)\n    auto x = AVX::lo128(x_.data());\n    auto y = AVX::hi128(x_.data());\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    auto l = _mm_min_epu16(x, y);\n    auto h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n\n    // merge left & right quads (two min/max)\n    x = _mm_unpacklo_epi16(l, h);\n    y = _mm_unpackhi_epi16(h, l);\n    // Vc_DEBUG << \"8x2 sorted xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h));\n    y = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n\n    // merge quads into octs (three min/max)\n    x = _mm_unpacklo_epi16(h, l);\n    y = _mm_unpackhi_epi16(l, h);\n    // Vc_DEBUG << \"4x4 sorted xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::permuteLo<X2, X3, X0, X1>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(h, l));\n    y = Mem::permuteHi<X6, X7, X4, X5>(Mem::blend<X0, X1, Y2, Y3, X4, X5, Y6, Y7>(l, h));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h));\n    y = Mem::permuteLo<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h) << \" done?\";\n\n    // merge octs into hexa (four min/max)\n    x = _mm_unpacklo_epi16(l, h);\n    y = _mm_unpackhi_epi16(h, l);\n    // Vc_DEBUG << \"2x8 sorted xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = _mm_unpacklo_epi64(l, h);\n    y = _mm_unpackhi_epi64(l, h);\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = _mm_castps_si128(Mem::permute<X1, X0, X3, X2>(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(h), _mm_castsi128_ps(l))));\n    y = _mm_castps_si128(Mem::blend<X0, Y1, X2, Y3>(_mm_castsi128_ps(l), _mm_castsi128_ps(h)));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(l, h);\n    y = Mem::permuteLo<X1, X0, X3, X2>(\n        Mem::permuteHi<X5, X4, X7, X6>(Mem::blend<X0, Y1, X2, Y3, X4, Y5, X6, Y7>(h, l)));\n    // Vc_DEBUG << \"xy: \" << AVX::addType<short>(x) << AVX::addType<short>(y);\n    l = _mm_min_epu16(x, y);\n    h = _mm_max_epu16(x, y);\n    // Vc_DEBUG << \"lh: \" << AVX::addType<short>(l) << AVX::addType<short>(h);\n    x = _mm_unpacklo_epi16(l, h);\n    y = _mm_unpackhi_epi16(l, h);\n    return AVX::concat(x, y);\n}\n\ntemplate <> Vc_CONST AVX2::int_v sorted<CurrentImplementation::current()>(AVX2::int_v x_)\n{\n    using namespace AVX;\n    const __m256i hgfedcba = x_.data();\n    const __m128i hgfe = hi128(hgfedcba);\n    const __m128i dcba = lo128(hgfedcba);\n    __m128i l = _mm_min_epi32(hgfe, dcba); // ↓hd ↓gc ↓fb ↓ea\n    __m128i h = _mm_max_epi32(hgfe, dcba); // ↑hd ↑gc ↑fb ↑ea\n\n    __m128i x = _mm_unpacklo_epi32(l, h); // ↑fb ↓fb ↑ea ↓ea\n    __m128i y = _mm_unpackhi_epi32(l, h); // ↑hd ↓hd ↑gc ↓gc\n\n    l = _mm_min_epi32(x, y); // ↓(↑fb,↑hd) ↓hfdb ↓(↑ea,↑gc) ↓geca\n    h = _mm_max_epi32(x, y); // ↑hfdb ↑(↓fb,↓hd) ↑geca ↑(↓ea,↓gc)\n\n    x = _mm_min_epi32(l, Reg::permute<X2, X2, X0, X0>(h)); // 2(hfdb) 1(hfdb) 2(geca) 1(geca)\n    y = _mm_max_epi32(h, Reg::permute<X3, X3, X1, X1>(l)); // 4(hfdb) 3(hfdb) 4(geca) 3(geca)\n\n    __m128i b = Reg::shuffle<Y0, Y1, X0, X1>(y, x); // b3 <= b2 <= b1 <= b0\n    __m128i a = _mm_unpackhi_epi64(x, y);           // a3 >= a2 >= a1 >= a0\n\n    // _mm_extract_epi32 may return an unsigned int, breaking these comparisons.\n    if (Vc_IS_UNLIKELY(static_cast<int>(_mm_extract_epi32(x, 2)) >= static_cast<int>(_mm_extract_epi32(y, 1)))) {\n        return concat(Reg::permute<X0, X1, X2, X3>(b), a);\n    } else if (Vc_IS_UNLIKELY(static_cast<int>(_mm_extract_epi32(x, 0)) >= static_cast<int>(_mm_extract_epi32(y, 3)))) {\n        return concat(a, Reg::permute<X0, X1, X2, X3>(b));\n    }\n\n    // merge\n    l = _mm_min_epi32(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0\n    h = _mm_max_epi32(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0\n\n    a = _mm_unpacklo_epi32(l, h); // ↑a1b1 ↓a1b1 ↑a0b0 ↓a0b0\n    b = _mm_unpackhi_epi32(l, h); // ↑a3b3 ↓a3b3 ↑a2b2 ↓a2b2\n    l = _mm_min_epi32(a, b);      // ↓(↑a1b1,↑a3b3) ↓a1b3 ↓(↑a0b0,↑a2b2) ↓a0b2\n    h = _mm_max_epi32(a, b);      // ↑a3b1 ↑(↓a1b1,↓a3b3) ↑a2b0 ↑(↓a0b0,↓a2b2)\n\n    a = _mm_unpacklo_epi32(l, h); // ↑a2b0 ↓(↑a0b0,↑a2b2) ↑(↓a0b0,↓a2b2) ↓a0b2\n    b = _mm_unpackhi_epi32(l, h); // ↑a3b1 ↓(↑a1b1,↑a3b3) ↑(↓a1b1,↓a3b3) ↓a1b3\n    l = _mm_min_epi32(a, b); // ↓(↑a2b0,↑a3b1) ↓(↑a0b0,↑a2b2,↑a1b1,↑a3b3) ↓(↑(↓a0b0,↓a2b2) ↑(↓a1b1,↓a3b3)) ↓a0b3\n    h = _mm_max_epi32(a, b); // ↑a3b0 ↑(↓(↑a0b0,↑a2b2) ↓(↑a1b1,↑a3b3)) ↑(↓a0b0,↓a2b2,↓a1b1,↓a3b3) ↑(↓a0b2,↓a1b3)\n\n    return concat(_mm_unpacklo_epi32(l, h), _mm_unpackhi_epi32(l, h));\n}\n\ntemplate <>\nVc_CONST AVX2::uint_v sorted<CurrentImplementation::current()>(AVX2::uint_v x_)\n{\n    using namespace AVX;\n    const __m256i hgfedcba = x_.data();\n    const __m128i hgfe = hi128(hgfedcba);\n    const __m128i dcba = lo128(hgfedcba);\n    __m128i l = _mm_min_epu32(hgfe, dcba); // ↓hd ↓gc ↓fb ↓ea\n    __m128i h = _mm_max_epu32(hgfe, dcba); // ↑hd ↑gc ↑fb ↑ea\n\n    __m128i x = _mm_unpacklo_epi32(l, h); // ↑fb ↓fb ↑ea ↓ea\n    __m128i y = _mm_unpackhi_epi32(l, h); // ↑hd ↓hd ↑gc ↓gc\n\n    l = _mm_min_epu32(x, y); // ↓(↑fb,↑hd) ↓hfdb ↓(↑ea,↑gc) ↓geca\n    h = _mm_max_epu32(x, y); // ↑hfdb ↑(↓fb,↓hd) ↑geca ↑(↓ea,↓gc)\n\n    x = _mm_min_epu32(l, Reg::permute<X2, X2, X0, X0>(h)); // 2(hfdb) 1(hfdb) 2(geca) 1(geca)\n    y = _mm_max_epu32(h, Reg::permute<X3, X3, X1, X1>(l)); // 4(hfdb) 3(hfdb) 4(geca) 3(geca)\n\n    __m128i b = Reg::shuffle<Y0, Y1, X0, X1>(y, x); // b3 <= b2 <= b1 <= b0\n    __m128i a = _mm_unpackhi_epi64(x, y);           // a3 >= a2 >= a1 >= a0\n\n    if (Vc_IS_UNLIKELY(extract_epu32<2>(x) >= extract_epu32<1>(y))) {\n        return concat(Reg::permute<X0, X1, X2, X3>(b), a);\n    } else if (Vc_IS_UNLIKELY(extract_epu32<0>(x) >= extract_epu32<3>(y))) {\n        return concat(a, Reg::permute<X0, X1, X2, X3>(b));\n    }\n\n    // merge\n    l = _mm_min_epu32(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0\n    h = _mm_max_epu32(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0\n\n    a = _mm_unpacklo_epi32(l, h); // ↑a1b1 ↓a1b1 ↑a0b0 ↓a0b0\n    b = _mm_unpackhi_epi32(l, h); // ↑a3b3 ↓a3b3 ↑a2b2 ↓a2b2\n    l = _mm_min_epu32(a, b);      // ↓(↑a1b1,↑a3b3) ↓a1b3 ↓(↑a0b0,↑a2b2) ↓a0b2\n    h = _mm_max_epu32(a, b);      // ↑a3b1 ↑(↓a1b1,↓a3b3) ↑a2b0 ↑(↓a0b0,↓a2b2)\n\n    a = _mm_unpacklo_epi32(l, h); // ↑a2b0 ↓(↑a0b0,↑a2b2) ↑(↓a0b0,↓a2b2) ↓a0b2\n    b = _mm_unpackhi_epi32(l, h); // ↑a3b1 ↓(↑a1b1,↑a3b3) ↑(↓a1b1,↓a3b3) ↓a1b3\n    l = _mm_min_epu32(a, b); // ↓(↑a2b0,↑a3b1) ↓(↑a0b0,↑a2b2,↑a1b1,↑a3b3) ↓(↑(↓a0b0,↓a2b2) ↑(↓a1b1,↓a3b3)) ↓a0b3\n    h = _mm_max_epu32(a, b); // ↑a3b0 ↑(↓(↑a0b0,↑a2b2) ↓(↑a1b1,↑a3b3)) ↑(↓a0b0,↓a2b2,↓a1b1,↓a3b3) ↑(↓a0b2,↓a1b3)\n\n    return concat(_mm_unpacklo_epi32(l, h), _mm_unpackhi_epi32(l, h));\n}\n#endif  // AVX2\n\ntemplate <>\nVc_CONST AVX2::float_v sorted<CurrentImplementation::current()>(AVX2::float_v x_)\n{\n    __m256 hgfedcba = x_.data();\n    const __m128 hgfe = AVX::hi128(hgfedcba);\n    const __m128 dcba = AVX::lo128(hgfedcba);\n    __m128 l = _mm_min_ps(hgfe, dcba); // ↓hd ↓gc ↓fb ↓ea\n    __m128 h = _mm_max_ps(hgfe, dcba); // ↑hd ↑gc ↑fb ↑ea\n\n    __m128 x = _mm_unpacklo_ps(l, h); // ↑fb ↓fb ↑ea ↓ea\n    __m128 y = _mm_unpackhi_ps(l, h); // ↑hd ↓hd ↑gc ↓gc\n\n    l = _mm_min_ps(x, y); // ↓(↑fb,↑hd) ↓hfdb ↓(↑ea,↑gc) ↓geca\n    h = _mm_max_ps(x, y); // ↑hfdb ↑(↓fb,↓hd) ↑geca ↑(↓ea,↓gc)\n\n    x = _mm_min_ps(l, Reg::permute<X2, X2, X0, X0>(h)); // 2(hfdb) 1(hfdb) 2(geca) 1(geca)\n    y = _mm_max_ps(h, Reg::permute<X3, X3, X1, X1>(l)); // 4(hfdb) 3(hfdb) 4(geca) 3(geca)\n\n    __m128 a = _mm_castpd_ps(_mm_unpackhi_pd(_mm_castps_pd(x), _mm_castps_pd(y))); // a3 >= a2 >= a1 >= a0\n    __m128 b = Reg::shuffle<Y0, Y1, X0, X1>(y, x); // b3 <= b2 <= b1 <= b0\n\n    // merge\n    l = _mm_min_ps(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0\n    h = _mm_max_ps(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0\n\n    a = _mm_unpacklo_ps(l, h); // ↑a1b1 ↓a1b1 ↑a0b0 ↓a0b0\n    b = _mm_unpackhi_ps(l, h); // ↑a3b3 ↓a3b3 ↑a2b2 ↓a2b2\n    l = _mm_min_ps(a, b);      // ↓(↑a1b1,↑a3b3) ↓a1b3 ↓(↑a0b0,↑a2b2) ↓a0b2\n    h = _mm_max_ps(a, b);      // ↑a3b1 ↑(↓a1b1,↓a3b3) ↑a2b0 ↑(↓a0b0,↓a2b2)\n\n    a = _mm_unpacklo_ps(l, h); // ↑a2b0 ↓(↑a0b0,↑a2b2) ↑(↓a0b0,↓a2b2) ↓a0b2\n    b = _mm_unpackhi_ps(l, h); // ↑a3b1 ↓(↑a1b1,↑a3b3) ↑(↓a1b1,↓a3b3) ↓a1b3\n    l = _mm_min_ps(a, b); // ↓(↑a2b0,↑a3b1) ↓(↑a0b0,↑a2b2,↑a1b1,↑a3b3) ↓(↑(↓a0b0,↓a2b2),↑(↓a1b1,↓a3b3)) ↓a0b3\n    h = _mm_max_ps(a, b); // ↑a3b0 ↑(↓(↑a0b0,↑a2b2),↓(↑a1b1,↑a3b3)) ↑(↓a0b0,↓a2b2,↓a1b1,↓a3b3) ↑(↓a0b2,↓a1b3)\n\n    return AVX::concat(_mm_unpacklo_ps(l, h), _mm_unpackhi_ps(l, h));\n}\n\n#if 0\ntemplate<> void SortHelper<double>::sort(__m256d &Vc_RESTRICT x, __m256d &Vc_RESTRICT y)\n{\n    __m256d l = _mm256_min_pd(x, y); // ↓x3y3 ↓x2y2 ↓x1y1 ↓x0y0\n    __m256d h = _mm256_max_pd(x, y); // ↑x3y3 ↑x2y2 ↑x1y1 ↑x0y0\n    x = _mm256_unpacklo_pd(l, h); // ↑x2y2 ↓x2y2 ↑x0y0 ↓x0y0\n    y = _mm256_unpackhi_pd(l, h); // ↑x3y3 ↓x3y3 ↑x1y1 ↓x1y1\n    l = _mm256_min_pd(x, y); // ↓(↑x2y2,↑x3y3) ↓x3x2y3y2 ↓(↑x0y0,↑x1y1) ↓x1x0y1y0\n    h = _mm256_max_pd(x, y); // ↑x3x2y3y2 ↑(↓x2y2,↓x3y3) ↑x1x0y1y0 ↑(↓x0y0,↓x1y1)\n    x = _mm256_unpacklo_pd(l, h); // ↑(↓x2y2,↓x3y3) ↓x3x2y3y2 ↑(↓x0y0,↓x1y1) ↓x1x0y1y0\n    y = _mm256_unpackhi_pd(h, l); // ↓(↑x2y2,↑x3y3) ↑x3x2y3y2 ↓(↑x0y0,↑x1y1) ↑x1x0y1y0\n    l = _mm256_min_pd(x, y); // ↓(↑(↓x2y2,↓x3y3) ↓(↑x2y2,↑x3y3)) ↓x3x2y3y2 ↓(↑(↓x0y0,↓x1y1) ↓(↑x0y0,↑x1y1)) ↓x1x0y1y0\n    h = _mm256_max_pd(x, y); // ↑(↑(↓x2y2,↓x3y3) ↓(↑x2y2,↑x3y3)) ↑x3x2y3y2 ↑(↑(↓x0y0,↓x1y1) ↓(↑x0y0,↑x1y1)) ↑x1x0y1y0\n    __m256d a = Reg::permute<X2, X3, X1, X0>(Reg::permute128<X0, X1>(h, h)); // h0 h1 h3 h2\n    __m256d b = Reg::permute<X2, X3, X1, X0>(l);                             // l2 l3 l1 l0\n\n    // a3 >= a2 >= b1 >= b0\n    // b3 <= b2 <= a1 <= a0\n\n    // merge\n    l = _mm256_min_pd(a, b); // ↓a3b3 ↓a2b2 ↓a1b1 ↓a0b0\n    h = _mm256_min_pd(a, b); // ↑a3b3 ↑a2b2 ↑a1b1 ↑a0b0\n\n    x = _mm256_unpacklo_pd(l, h); // ↑a2b2 ↓a2b2 ↑a0b0 ↓a0b0\n    y = _mm256_unpackhi_pd(l, h); // ↑a3b3 ↓a3b3 ↑a1b1 ↓a1b1\n    l = _mm256_min_pd(x, y);      // ↓(↑a2b2,↑a3b3) ↓a2b3 ↓(↑a0b0,↑a1b1) ↓a1b0\n    h = _mm256_min_pd(x, y);      // ↑a3b2 ↑(↓a2b2,↓a3b3) ↑a0b1 ↑(↓a0b0,↓a1b1)\n\n    x = Reg::permute128<Y0, X0>(l, h); // ↑a0b1 ↑(↓a0b0,↓a1b1) ↓(↑a0b0,↑a1b1) ↓a1b0\n    y = Reg::permute128<Y1, X1>(l, h); // ↑a3b2 ↑(↓a2b2,↓a3b3) ↓(↑a2b2,↑a3b3) ↓a2b3\n    l = _mm256_min_pd(x, y);      // ↓(↑a0b1,↑a3b2) ↓(↑(↓a0b0,↓a1b1) ↑(↓a2b2,↓a3b3)) ↓(↑a0b0,↑a1b1,↑a2b2,↑a3b3) ↓b0b3\n    h = _mm256_min_pd(x, y);      // ↑a0a3 ↑(↓a0b0,↓a1b1,↓a2b2,↓a3b3) ↑(↓(↑a0b0,↑a1b1) ↓(↑a2b2,↑a3b3)) ↑(↓a1b0,↓a2b3)\n\n    x = _mm256_unpacklo_pd(l, h); // h2 l2 h0 l0\n    y = _mm256_unpackhi_pd(l, h); // h3 l3 h1 l1\n}\n#endif\ntemplate <>\nVc_CONST AVX2::double_v sorted<CurrentImplementation::current()>(AVX2::double_v x_)\n{\n    __m256d dcba = x_.data();\n    /*\n     * to find the second largest number find\n     * max(min(max(ab),max(cd)), min(max(ad),max(bc)))\n     *  or\n     * max(max(min(ab),min(cd)), min(max(ab),max(cd)))\n     *\n    const __m256d adcb = avx_cast<__m256d>(AVX::concat(_mm_alignr_epi8(avx_cast<__m128i>(dc), avx_cast<__m128i>(ba), 8), _mm_alignr_epi8(avx_cast<__m128i>(ba), avx_cast<__m128i>(dc), 8)));\n    const __m256d l = _mm256_min_pd(dcba, adcb); // min(ad cd bc ab)\n    const __m256d h = _mm256_max_pd(dcba, adcb); // max(ad cd bc ab)\n    // max(h3, h1)\n    // max(min(h0,h2), min(h3,h1))\n    // min(max(l0,l2), max(l3,l1))\n    // min(l3, l1)\n\n    const __m256d ll = _mm256_min_pd(h, Reg::permute128<X0, X1>(h, h)); // min(h3h1 h2h0 h1h3 h0h2)\n    //const __m256d hh = _mm256_max_pd(h3 ll1_3 l1 l0, h1 ll0_2 l3 l2);\n    const __m256d hh = _mm256_max_pd(\n            Reg::permute128<X1, Y0>(_mm256_unpackhi_pd(ll, h), l),\n            Reg::permute128<X0, Y1>(_mm256_blend_pd(h ll, 0x1), l));\n    _mm256_min_pd(hh0, hh1\n     */\n\n    //////////////////////////////////////////////////////////////////////////////////\n    // max(max(ac), max(bd))\n    // max(max(min(ac),min(bd)), min(max(ac),max(bd)))\n    // min(max(min(ac),min(bd)), min(max(ac),max(bd)))\n    // min(min(ac), min(bd))\n    __m128d l = _mm_min_pd(AVX::lo128(dcba), AVX::hi128(dcba)); // min(bd) min(ac)\n    __m128d h = _mm_max_pd(AVX::lo128(dcba), AVX::hi128(dcba)); // max(bd) max(ac)\n    __m128d h0_l0 = _mm_unpacklo_pd(l, h);\n    __m128d h1_l1 = _mm_unpackhi_pd(l, h);\n    l = _mm_min_pd(h0_l0, h1_l1);\n    h = _mm_max_pd(h0_l0, h1_l1);\n    return AVX::concat(\n        _mm_min_pd(l, Reg::permute<X0, X0>(h)),\n        _mm_max_pd(h, Reg::permute<X1, X1>(l))\n            );\n    // extract: 1 cycle\n    // min/max: 4 cycles\n    // unpacklo/hi: 2 cycles\n    // min/max: 4 cycles\n    // permute: 1 cycle\n    // min/max: 4 cycles\n    // insert:  1 cycle\n    // ----------------------\n    // total:   17 cycles\n\n    /*\n    __m256d cdab = Reg::permute<X2, X3, X0, X1>(dcba);\n    __m256d l = _mm256_min_pd(dcba, cdab);\n    __m256d h = _mm256_max_pd(dcba, cdab);\n    __m256d maxmin_ba = Reg::permute128<X0, Y0>(l, h);\n    __m256d maxmin_dc = Reg::permute128<X1, Y1>(l, h);\n\n    l = _mm256_min_pd(maxmin_ba, maxmin_dc);\n    h = _mm256_max_pd(maxmin_ba, maxmin_dc);\n\n    return _mm256_blend_pd(h, l, 0x55);\n    */\n\n    /*\n    // a b c d\n    // b a d c\n    // sort pairs\n    __m256d y, l, h;\n    __m128d l2, h2;\n    y = shuffle<X1, Y0, X3, Y2>(x, x);\n    l = _mm256_min_pd(x, y); // min[ab ab cd cd]\n    h = _mm256_max_pd(x, y); // max[ab ab cd cd]\n\n    // 1 of 2 is at [0]\n    // 1 of 4 is at [1]\n    // 1 of 4 is at [2]\n    // 1 of 2 is at [3]\n\n    // don't be fooled by unpack here. It works differently for AVX pd than for SSE ps\n    x = _mm256_unpacklo_pd(l, h); // l_ab h_ab l_cd h_cd\n    l2 = _mm_min_pd(AVX::lo128(x), AVX::hi128(x)); // l_abcd l(h_ab hcd)\n    h2 = _mm_max_pd(AVX::lo128(x), AVX::hi128(x)); // h(l_ab l_cd) h_abcd\n\n    // either it is:\n    return AVX::concat(l2, h2);\n    // or:\n    // AVX::concat(_mm_unpacklo_pd(l2, h2), _mm_unpackhi_pd(l2, h2));\n\n    // I'd like to have four useful compares\n    const __m128d dc = AVX::hi128(dcba);\n    const __m128d ba = AVX::lo128(dcba);\n    const __m256d adcb = avx_cast<__m256d>(AVX::concat(_mm_alignr_epi8(avx_cast<__m128i>(dc), avx_cast<__m128i>(ba), 8), _mm_alignr_epi8(avx_cast<__m128i>(ba), avx_cast<__m128i>(dc), 8)));\n\n    const int extraCmp = _mm_movemask_pd(_mm_cmpgt_pd(dc, ba));\n    // 0x0: d <= b && c <= a\n    // 0x1: d <= b && c >  a\n    // 0x2: d >  b && c <= a\n    // 0x3: d >  b && c >  a\n\n    switch (_mm256_movemask_pd(_mm256_cmpgt_pd(dcba, adcb))) {\n    // impossible: 0x0, 0xf\n    case 0x1: // a <= b && b <= c && c <= d && d >  a\n        // abcd\n        return Reg::permute<X2, X3, X0, X1>(Reg::permute<X0, X1>(dcba, dcba));\n    case 0x2: // a <= b && b <= c && c >  d && d <= a\n        // dabc\n        return Reg::permute<X2, X3, X0, X1>(adcb);\n    case 0x3: // a <= b && b <= c && c >  d && d >  a\n        // a[bd]c\n        if (extraCmp & 2) {\n            // abdc\n            return Reg::permute<X2, X3, X1, X0>(Reg::permute<X0, X1>(dcba, dcba));\n        } else {\n            // adbc\n            return Reg::permute<X3, X2, X0, X1>(adcb);\n        }\n    case 0x4: // a <= b && b >  c && c <= d && d <= a\n        // cdab;\n        return Reg::permute<X2, X3, X0, X1>(dcba);\n    case 0x5: // a <= b && b >  c && c <= d && d >  a\n        // [ac] < [bd]\n        switch (extraCmp) {\n        case 0x0: // d <= b && c <= a\n            // cadb\n            return shuffle<>(dcba, bcda);\n        case 0x1: // d <= b && c >  a\n        case 0x2: // d >  b && c <= a\n        case 0x3: // d >  b && c >  a\n        }\n    case 0x6: // a <= b && b >  c && c >  d && d <= a\n        // d[ac]b\n    case 0x7: // a <= b && b >  c && c >  d && d >  a\n        // adcb;\n        return permute<X1, X0, X3, X2>(permute128<X1, X0>(bcda, bcda));\n    case 0x8: // a >  b && b <= c && c <= d && d <= a\n        return bcda;\n    case 0x9: // a >  b && b <= c && c <= d && d >  a\n        // b[ac]d;\n    case 0xa: // a >  b && b <= c && c >  d && d <= a\n        // [ac] > [bd]\n    case 0xb: // a >  b && b <= c && c >  d && d >  a\n        // badc;\n        return permute128<X1, X0>(dcba);\n    case 0xc: // a >  b && b >  c && c <= d && d <= a\n        // c[bd]a;\n    case 0xd: // a >  b && b >  c && c <= d && d >  a\n        // cbad;\n        return permute<X1, X0, X3, X2>(bcda);\n    case 0xe: // a >  b && b >  c && c >  d && d <= a\n        return dcba;\n    }\n    */\n}\n\n}  // namespace Detail\n}  // namespace Vc\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/src/const.cpp",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include <Vc/avx/const_data.h>\n#include <Vc/sse/const_data.h>\n#include <Vc/version.h>\n\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n\n#include <Vc/common/const.h>\n#include <Vc/common/macros.h>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace AVX\n{\n    using Detail::doubleConstant;\n    using Detail::floatConstant;\n\n    // cacheline 1\n    alignas(64) extern const unsigned int   _IndexesFromZero32[ 8] = { 0, 1, 2, 3, 4, 5, 6, 7 };\n    alignas(16) extern const unsigned short _IndexesFromZero16[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };\n    alignas(16) extern const unsigned char  _IndexesFromZero8 [32] = { 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 };\n\n    template <>\n    alignas(64) const double c_trig<double>::data[] = {\n    // cacheline 4\n        doubleConstant<1, 0x921fb54442d18ull, -1>(), // π/4\n        doubleConstant<1, 0x921fb40000000ull, -1>(), // π/4 - 30bits precision\n        doubleConstant<1, 0x4442d00000000ull, -25>(), // π/4 remainder1 - 32bits precision\n        doubleConstant<1, 0x8469898cc5170ull, -49>(), // π/4 remainder2\n        0.0625,\n        16.,\n        0., // padding\n        0., // padding\n        0., // padding (for alignment with float)\n        doubleConstant<1, 0x8BE60DB939105ull,  0>(), // 4/π\n        doubleConstant<1, 0x921fb54442d18ull,  0>(), // π/2\n        doubleConstant<1, 0x921fb54442d18ull,  1>(), // π\n    // cacheline 10\n        doubleConstant<-1, 0xc007fa1f72594ull, -1>(), // atan P coefficients\n        doubleConstant<-1, 0x028545b6b807aull,  4>(), // atan P coefficients\n        doubleConstant<-1, 0x2c08c36880273ull,  6>(), // atan P coefficients\n        doubleConstant<-1, 0xeb8bf2d05ba25ull,  6>(), // atan P coefficients\n        doubleConstant<-1, 0x03669fd28ec8eull,  6>(), // atan P coefficients\n        doubleConstant< 1, 0x8dbc45b14603cull,  4>(), // atan Q coefficients\n        doubleConstant< 1, 0x4a0dd43b8fa25ull,  7>(), // atan Q coefficients\n        doubleConstant< 1, 0xb0e18d2e2be3bull,  8>(), // atan Q coefficients\n    // cacheline 12\n        doubleConstant< 1, 0xe563f13b049eaull,  8>(), // atan Q coefficients\n        doubleConstant< 1, 0x8519efbbd62ecull,  7>(), // atan Q coefficients\n        doubleConstant< 1, 0x3504f333f9de6ull,  1>(), // tan( 3/8 π )\n        0.66,                                    // lower threshold for special casing in atan\n        doubleConstant<1, 0x1A62633145C07ull, -54>(), // remainder of pi/2\n        1.e-8, // small asin input threshold\n        0.625, // large asin input threshold\n        0., // padding\n    // cacheline 14\n        doubleConstant< 1, 0x84fc3988e9f08ull, -9>(), // asinCoeff0\n        doubleConstant<-1, 0x2079259f9290full, -1>(), // asinCoeff0\n        doubleConstant< 1, 0xbdff5baf33e6aull,  2>(), // asinCoeff0\n        doubleConstant<-1, 0x991aaac01ab68ull,  4>(), // asinCoeff0\n        doubleConstant< 1, 0xc896240f3081dull,  4>(), // asinCoeff0\n        doubleConstant<-1, 0x5f2a2b6bf5d8cull,  4>(), // asinCoeff1\n        doubleConstant< 1, 0x26219af6a7f42ull,  7>(), // asinCoeff1\n        doubleConstant<-1, 0x7fe08959063eeull,  8>(), // asinCoeff1\n    // cacheline 16\n        doubleConstant< 1, 0x56709b0b644beull,  8>(), // asinCoeff1\n        doubleConstant< 1, 0x16b9b0bd48ad3ull, -8>(), // asinCoeff2\n        doubleConstant<-1, 0x34341333e5c16ull, -1>(), // asinCoeff2\n        doubleConstant< 1, 0x5c74b178a2dd9ull,  2>(), // asinCoeff2\n        doubleConstant<-1, 0x04331de27907bull,  4>(), // asinCoeff2\n        doubleConstant< 1, 0x39007da779259ull,  4>(), // asinCoeff2\n        doubleConstant<-1, 0x0656c06ceafd5ull,  3>(), // asinCoeff2\n        doubleConstant<-1, 0xd7b590b5e0eabull,  3>(), // asinCoeff3\n    // cacheline 18\n        doubleConstant< 1, 0x19fc025fe9054ull,  6>(), // asinCoeff3\n        doubleConstant<-1, 0x265bb6d3576d7ull,  7>(), // asinCoeff3\n        doubleConstant< 1, 0x1705684ffbf9dull,  7>(), // asinCoeff3\n        doubleConstant<-1, 0x898220a3607acull,  5>(), // asinCoeff3\n    };\n#define Vc_4(x) x\n    template <>\n    alignas(64) const float c_trig<float>::data[] = {\n    // cacheline\n        Vc_4((floatConstant< 1, 0x490FDB,  -1>())), // π/4\n        Vc_4((floatConstant< 1, 0x491000,  -1>())), // π/4 - 12 bits precision\n        Vc_4((floatConstant<-1, 0x157000, -19>())), // π/4 remainder1 - 12 bits precision\n        Vc_4((floatConstant<-1, 0x6F4B9F, -32>())), // π/4 remainder2\n        Vc_4(0.0625f),\n        Vc_4(16.f),\n        Vc_4(0.f), // padding\n        Vc_4(0.f), // padding\n    // cacheline\n        Vc_4(8192.f), // loss threshold\n        Vc_4((floatConstant<1, 0x22F983, 0>())), // 1.27323949337005615234375 = 4/π\n        Vc_4((floatConstant<1, 0x490FDB, 0>())), // π/2\n        Vc_4((floatConstant<1, 0x490FDB, 1>())), // π\n        Vc_4(8.05374449538e-2f), // atan P coefficients\n        Vc_4(1.38776856032e-1f), // atan P coefficients\n        Vc_4(1.99777106478e-1f), // atan P coefficients\n        Vc_4(3.33329491539e-1f), // atan P coefficients\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    // cacheline\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(2.414213562373095f), // tan( 3/8 π )\n        Vc_4(0.414213562373095f), // tan( 1/8 π ) lower threshold for special casing in atan\n        Vc_4((floatConstant<-1, 0x3BBD2E, -25>())), // remainder of pi/2\n        Vc_4(1.e-4f), // small asin input threshold\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(4.2163199048e-2f), // asinCoeff0\n        Vc_4(2.4181311049e-2f), // asinCoeff0\n        Vc_4(4.5470025998e-2f), // asinCoeff0\n        Vc_4(7.4953002686e-2f), // asinCoeff0\n        Vc_4(1.6666752422e-1f), // asinCoeff0\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    // cacheline\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    };\n#undef Vc_4\n\n    const unsigned       int c_general::absMaskFloat[2] = { 0xffffffffu, 0x7fffffffu };\n    const unsigned       int c_general::signMaskFloat[2] = { 0x0u, 0x80000000u };\n    const unsigned       int c_general::highMaskFloat = 0xfffff000u;\n    const              float c_general::oneFloat = 1.f;\n    const unsigned     short c_general::minShort[2] = { 0x8000u, 0x8000u };\n    const unsigned     short c_general::one16[2] = { 1, 1 };\n    const              float c_general::_2power31 = 1u << 31;\n\n    // cacheline 4\n    const unsigned long long c_general::highMaskDouble = 0xfffffffff8000000ull;\n    const             double c_general::oneDouble = 1.;\n    const unsigned long long c_general::frexpMask = 0xbfefffffffffffffull;\n\n    alignas(64) const unsigned long long c_log<double>::data[21] = {\n        0x000003ff000003ffull // bias TODO: remove\n      , 0x7ff0000000000000ull // exponentMask (+inf)\n\n      , 0x3f1ab4c293c31bb0ull // P[0]\n      , 0x3fdfd6f53f5652f2ull // P[1]\n      , 0x4012d2baed926911ull // P[2]\n      , 0x402cff72c63eeb2eull // P[3]\n      , 0x4031efd6924bc84dull // P[4]\n      , 0x401ed5637d7edcf8ull // P[5]\n\n      , 0x40269320ae97ef8eull // Q[0]\n      , 0x40469d2c4e19c033ull // Q[1]\n      , 0x4054bf33a326bdbdull // Q[2]\n      , 0x4051c9e2eb5eae21ull // Q[3]\n      , 0x4037200a9e1f25b2ull // Q[4]\n\n      , 0xfff0000000000000ull // -inf\n      , 0x0010000000000000ull // min()\n      , 0x3fe6a09e667f3bcdull // 1/sqrt(2)\n      , 0x3fe6300000000000ull // round(ln(2) * 512) / 512\n      , 0xbf2bd0105c610ca8ull // ln(2) - round(ln(2) * 512) / 512\n      , 0x3fe0000000000000ull // 0.5\n      , 0x3fdbcb7b1526e50eull // log10(e)\n      , 0x3ff71547652b82feull // log2(e)\n    };\n\n    template <>\n    alignas(64) const unsigned int c_log<float>::data[21] = {\n        0x0000007fu // bias TODO: remove\n      , 0x7f800000u // exponentMask (+inf)\n\n      , 0x3d9021bbu //  7.0376836292e-2f // P[0]\n      , 0xbdebd1b8u // -1.1514610310e-1f // P[1]\n      , 0x3def251au //  1.1676998740e-1f // P[2]\n      , 0xbdfe5d4fu // -1.2420140846e-1f // P[3]\n      , 0x3e11e9bfu //  1.4249322787e-1f // P[4]\n      , 0xbe2aae50u // -1.6668057665e-1f // P[5]\n      , 0x3e4cceacu //  2.0000714765e-1f // P[6]\n      , 0xbe7ffffcu // -2.4999993993e-1f // P[7]\n      , 0x3eaaaaaau //  3.3333331174e-1f // P[8]\n      , 0           // padding because of c_log<double>\n      , 0           // padding because of c_log<double>\n\n      , 0xff800000u // -inf\n      , 0x00800000u // min()\n      , 0x3f3504f3u // 1/sqrt(2)\n      , 0x3f318000u // round(ln(2) * 512) / 512\n      , 0xb95e8083u // ln(2) - round(ln(2) * 512) / 512\n      , 0x3f000000u // 0.5\n      , 0x3ede5bd9u // log10(e)\n      , 0x3fb8aa3bu // log2(e)\n    };\n}\n}\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\n    alignas(64) unsigned int RandomState[16] = {\n        0x5a383a4fu, 0xc68bd45eu, 0x691d6d86u, 0xb367e14fu,\n        0xd689dbaau, 0xfde442aau, 0x3d265423u, 0x1a77885cu,\n        0x36ed2684u, 0xfb1f049du, 0x19e52f31u, 0x821e4dd7u,\n        0x23996d25u, 0x5962725au, 0x6aced4ceu, 0xd4c610f3u\n    };\n\n    alignas(32) const unsigned int AllBitsSet[8] = {\n        0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU, 0xffffffffU\n    };\n\n    const char LIBRARY_VERSION[] = Vc_VERSION_STRING;\n    const unsigned int LIBRARY_VERSION_NUMBER = Vc_VERSION_NUMBER;\n    const unsigned int LIBRARY_ABI_VERSION = Vc_LIBRARY_ABI_VERSION;\n\n    void Vc_CDECL checkLibraryAbi(unsigned int compileTimeAbi, unsigned int versionNumber,\n                                  const char *compileTimeVersion)\n    {\n        if (LIBRARY_ABI_VERSION != compileTimeAbi || LIBRARY_VERSION_NUMBER < versionNumber) {\n            printf(\"The versions of libVc.a (%s) and Vc/version.h (%s) are incompatible. Aborting.\\n\", LIBRARY_VERSION, compileTimeVersion);\n            abort();\n        }\n    }\n}\n}\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace SSE\n{\n    using Detail::doubleConstant;\n    using Detail::floatConstant;\n\n    // cacheline 1\n    alignas(64) const int c_general::absMaskFloat[4] = { 0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff };\n    alignas(16) const unsigned int c_general::signMaskFloat[4] = { 0x80000000, 0x80000000, 0x80000000, 0x80000000 };\n    alignas(16) const unsigned int c_general::highMaskFloat[4] = { 0xfffff000u, 0xfffff000u, 0xfffff000u, 0xfffff000u };\n    alignas(16) const short c_general::minShort[8] = { -0x8000, -0x8000, -0x8000, -0x8000, -0x8000, -0x8000, -0x8000, -0x8000 };\n    alignas(16) extern const unsigned short _IndexesFromZero8[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };\n\n    // cacheline 2\n    alignas(16) extern const unsigned int   _IndexesFromZero4[4] = { 0, 1, 2, 3 };\n    alignas(16) const unsigned short c_general::one16[8] = { 1, 1, 1, 1, 1, 1, 1, 1 };\n    alignas(16) const unsigned int c_general::one32[4] = { 1, 1, 1, 1 };\n    alignas(16) const float c_general::oneFloat[4] = { 1.f, 1.f, 1.f, 1.f };\n\n    // cacheline 3\n    alignas(16) const unsigned long long c_general::highMaskDouble[2] = { 0xfffffffff8000000ull, 0xfffffffff8000000ull };\n    alignas(16) const double c_general::oneDouble[2] = { 1., 1. };\n    alignas(16) const long long c_general::absMaskDouble[2] = { 0x7fffffffffffffffll, 0x7fffffffffffffffll };\n    alignas(16) const unsigned long long c_general::signMaskDouble[2] = { 0x8000000000000000ull, 0x8000000000000000ull };\n    alignas(16) const unsigned long long c_general::frexpMask[2] = { 0xbfefffffffffffffull, 0xbfefffffffffffffull };\n\n#define Vc_2(x) x, x\n    template <>\n    alignas(64) const double c_trig<double>::data[] = {\n    // cacheline 4\n        Vc_2((doubleConstant<1, 0x921fb54442d18ull, -1>())), // π/4\n        Vc_2((doubleConstant<1, 0x921fb40000000ull, -1>())), // π/4 - 30bits precision\n        Vc_2((doubleConstant<1, 0x4442d00000000ull, -25>())), // π/4 remainder1 - 32bits precision\n        Vc_2((doubleConstant<1, 0x8469898cc5170ull, -49>())), // π/4 remainder2\n    // cacheline 5\n        Vc_2(0.0625),\n        Vc_2(16.),\n        Vc_2(0.), // padding\n        Vc_2(0.), // padding\n    // cacheline 6\n        Vc_2(0.), // padding (for alignment with float)\n        Vc_2((doubleConstant<1, 0x8BE60DB939105ull,  0>())), // 4/π\n        Vc_2((doubleConstant<1, 0x921fb54442d18ull,  0>())), // π/2\n        Vc_2((doubleConstant<1, 0x921fb54442d18ull,  1>())), // π\n    // cacheline 7\n        Vc_2((doubleConstant<-1, 0xc007fa1f72594ull, -1>())), // atan P coefficients\n        Vc_2((doubleConstant<-1, 0x028545b6b807aull,  4>())), // atan P coefficients\n        Vc_2((doubleConstant<-1, 0x2c08c36880273ull,  6>())), // atan P coefficients\n        Vc_2((doubleConstant<-1, 0xeb8bf2d05ba25ull,  6>())), // atan P coefficients\n    // cacheline 8\n        Vc_2((doubleConstant<-1, 0x03669fd28ec8eull,  6>())), // atan P coefficients\n        Vc_2((doubleConstant< 1, 0x8dbc45b14603cull,  4>())), // atan Q coefficients\n        Vc_2((doubleConstant< 1, 0x4a0dd43b8fa25ull,  7>())), // atan Q coefficients\n        Vc_2((doubleConstant< 1, 0xb0e18d2e2be3bull,  8>())), // atan Q coefficients\n    // cacheline 9\n        Vc_2((doubleConstant< 1, 0xe563f13b049eaull,  8>())), // atan Q coefficients\n        Vc_2((doubleConstant< 1, 0x8519efbbd62ecull,  7>())), // atan Q coefficients\n        Vc_2((doubleConstant< 1, 0x3504f333f9de6ull,  1>())), // tan( 3/8 π )\n        Vc_2(0.66),                                    // lower threshold for special casing in atan\n    // cacheline 10\n        Vc_2((doubleConstant<1, 0x1A62633145C07ull, -54>())), // remainder of pi/2\n        Vc_2(1.e-8), // small asin input threshold\n        Vc_2(0.625), // large asin input threshold\n        Vc_2(0.), // padding\n    // cacheline 11\n        Vc_2((doubleConstant< 1, 0x84fc3988e9f08ull, -9>())), // asinCoeff0\n        Vc_2((doubleConstant<-1, 0x2079259f9290full, -1>())), // asinCoeff0\n        Vc_2((doubleConstant< 1, 0xbdff5baf33e6aull,  2>())), // asinCoeff0\n        Vc_2((doubleConstant<-1, 0x991aaac01ab68ull,  4>())), // asinCoeff0\n    // cacheline 12\n        Vc_2((doubleConstant< 1, 0xc896240f3081dull,  4>())), // asinCoeff0\n        Vc_2((doubleConstant<-1, 0x5f2a2b6bf5d8cull,  4>())), // asinCoeff1\n        Vc_2((doubleConstant< 1, 0x26219af6a7f42ull,  7>())), // asinCoeff1\n        Vc_2((doubleConstant<-1, 0x7fe08959063eeull,  8>())), // asinCoeff1\n    // cacheline 13\n        Vc_2((doubleConstant< 1, 0x56709b0b644beull,  8>())), // asinCoeff1\n        Vc_2((doubleConstant< 1, 0x16b9b0bd48ad3ull, -8>())), // asinCoeff2\n        Vc_2((doubleConstant<-1, 0x34341333e5c16ull, -1>())), // asinCoeff2\n        Vc_2((doubleConstant< 1, 0x5c74b178a2dd9ull,  2>())), // asinCoeff2\n    // cacheline 14\n        Vc_2((doubleConstant<-1, 0x04331de27907bull,  4>())), // asinCoeff2\n        Vc_2((doubleConstant< 1, 0x39007da779259ull,  4>())), // asinCoeff2\n        Vc_2((doubleConstant<-1, 0x0656c06ceafd5ull,  3>())), // asinCoeff2\n        Vc_2((doubleConstant<-1, 0xd7b590b5e0eabull,  3>())), // asinCoeff3\n    // cacheline 15\n        Vc_2((doubleConstant< 1, 0x19fc025fe9054ull,  6>())), // asinCoeff3\n        Vc_2((doubleConstant<-1, 0x265bb6d3576d7ull,  7>())), // asinCoeff3\n        Vc_2((doubleConstant< 1, 0x1705684ffbf9dull,  7>())), // asinCoeff3\n        Vc_2((doubleConstant<-1, 0x898220a3607acull,  5>())), // asinCoeff3\n    };\n#undef Vc_2\n#define Vc_4(x) x, x, x, x\n    template <>\n    alignas(64) const float c_trig<float>::data[] = {\n    // cacheline\n        Vc_4((floatConstant< 1, 0x490FDB,  -1>())), // π/4\n        Vc_4((floatConstant< 1, 0x491000,  -1>())), // π/4 - 12 bits precision\n        Vc_4((floatConstant<-1, 0x157000, -19>())), // π/4 remainder1 - 12 bits precision\n        Vc_4((floatConstant<-1, 0x6F4B9F, -32>())), // π/4 remainder2\n    // cacheline\n        Vc_4(0.0625f),\n        Vc_4(16.f),\n        Vc_4(0.f), // padding\n        Vc_4(0.f), // padding\n    // cacheline\n        Vc_4(8192.f), // loss threshold\n        Vc_4((floatConstant<1, 0x22F983, 0>())), // 1.27323949337005615234375 = 4/π\n        Vc_4((floatConstant<1, 0x490FDB, 0>())), // π/2\n        Vc_4((floatConstant<1, 0x490FDB, 1>())), // π\n    // cacheline\n        Vc_4(8.05374449538e-2f), // atan P coefficients\n        Vc_4(1.38776856032e-1f), // atan P coefficients\n        Vc_4(1.99777106478e-1f), // atan P coefficients\n        Vc_4(3.33329491539e-1f), // atan P coefficients\n    // cacheline\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    // cacheline\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(2.414213562373095f), // tan( 3/8 π )\n        Vc_4(0.414213562373095f), // tan( 1/8 π ) lower threshold for special casing in atan\n    // cacheline\n        Vc_4((floatConstant<-1, 0x3BBD2E, -25>())), // remainder of pi/2\n        Vc_4(1.e-4f), // small asin input threshold\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    // cacheline\n        Vc_4(4.2163199048e-2f), // asinCoeff0\n        Vc_4(2.4181311049e-2f), // asinCoeff0\n        Vc_4(4.5470025998e-2f), // asinCoeff0\n        Vc_4(7.4953002686e-2f), // asinCoeff0\n    // cacheline\n        Vc_4(1.6666752422e-1f), // asinCoeff0\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    // cacheline\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    // cacheline\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    // cacheline\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n        Vc_4(0.f), // padding (for alignment with double)\n    };\n#undef Vc_4\n\n    // cacheline 8\n    alignas(16) extern const unsigned char _IndexesFromZero16[16] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };\n\n    alignas(64) const unsigned long long c_log<double>::data[21 * 2] = {\n      /* 0*/   0x000003ff000003ffull, 0x000003ff000003ffull // bias TODO: remove\n      /* 1*/ , 0x7ff0000000000000ull, 0x7ff0000000000000ull // exponentMask (+inf)\n\n      /* 2*/ , 0x3f1ab4c293c31bb0ull, 0x3f1ab4c293c31bb0ull // P[0]\n      /* 3*/ , 0x3fdfd6f53f5652f2ull, 0x3fdfd6f53f5652f2ull // P[1]\n      /* 4*/ , 0x4012d2baed926911ull, 0x4012d2baed926911ull // P[2]\n      /* 5*/ , 0x402cff72c63eeb2eull, 0x402cff72c63eeb2eull // P[3]\n      /* 6*/ , 0x4031efd6924bc84dull, 0x4031efd6924bc84dull // P[4]\n      /* 7*/ , 0x401ed5637d7edcf8ull, 0x401ed5637d7edcf8ull // P[5]\n\n      /* 8*/ , 0x40269320ae97ef8eull, 0x40269320ae97ef8eull // Q[0]\n      /* 9*/ , 0x40469d2c4e19c033ull, 0x40469d2c4e19c033ull // Q[1]\n      /*10*/ , 0x4054bf33a326bdbdull, 0x4054bf33a326bdbdull // Q[2]\n      /*11*/ , 0x4051c9e2eb5eae21ull, 0x4051c9e2eb5eae21ull // Q[3]\n      /*12*/ , 0x4037200a9e1f25b2ull, 0x4037200a9e1f25b2ull // Q[4]\n\n      /*13*/ , 0xfff0000000000000ull, 0xfff0000000000000ull // -inf\n      /*14*/ , 0x0010000000000000ull, 0x0010000000000000ull // min()\n      /*15*/ , 0x3fe6a09e667f3bcdull, 0x3fe6a09e667f3bcdull // 1/sqrt(2)\n      /*16*/ , 0x3fe6300000000000ull, 0x3fe6300000000000ull // round(ln(2) * 512) / 512\n      /*17*/ , 0xbf2bd0105c610ca8ull, 0xbf2bd0105c610ca8ull // ln(2) - round(ln(2) * 512) / 512\n      /*18*/ , 0x3fe0000000000000ull, 0x3fe0000000000000ull // 0.5\n      /*19*/ , 0x3fdbcb7b1526e50eull, 0x3fdbcb7b1526e50eull // log10(e)\n      /*20*/ , 0x3ff71547652b82feull, 0x3ff71547652b82feull // log2(e)\n    };\n\n    template<> alignas(64) const unsigned int c_log<float>::data[21 * 4] = {\n        0x0000007fu, 0x0000007fu, 0x0000007fu, 0x0000007fu, // bias TODO: remove\n        0x7f800000u, 0x7f800000u, 0x7f800000u, 0x7f800000u, // exponentMask (+inf)\n\n        0x3d9021bbu, 0x3d9021bbu, 0x3d9021bbu, 0x3d9021bbu, //  7.0376836292e-2f // P[0]\n        0xbdebd1b8u, 0xbdebd1b8u, 0xbdebd1b8u, 0xbdebd1b8u, // -1.1514610310e-1f // P[1]\n        0x3def251au, 0x3def251au, 0x3def251au, 0x3def251au, //  1.1676998740e-1f // P[2]\n        0xbdfe5d4fu, 0xbdfe5d4fu, 0xbdfe5d4fu, 0xbdfe5d4fu, // -1.2420140846e-1f // P[3]\n        0x3e11e9bfu, 0x3e11e9bfu, 0x3e11e9bfu, 0x3e11e9bfu, //  1.4249322787e-1f // P[4]\n        0xbe2aae50u, 0xbe2aae50u, 0xbe2aae50u, 0xbe2aae50u, // -1.6668057665e-1f // P[5]\n        0x3e4cceacu, 0x3e4cceacu, 0x3e4cceacu, 0x3e4cceacu, //  2.0000714765e-1f // P[6]\n        0xbe7ffffcu, 0xbe7ffffcu, 0xbe7ffffcu, 0xbe7ffffcu, // -2.4999993993e-1f // P[7]\n        0x3eaaaaaau, 0x3eaaaaaau, 0x3eaaaaaau, 0x3eaaaaaau, //  3.3333331174e-1f // P[8]\n        0,           0,           0,           0,           // padding because of c_log<double>\n        0,           0,           0,           0,           // padding because of c_log<double>\n\n        0xff800000u, 0xff800000u, 0xff800000u, 0xff800000u, // -inf\n        0x00800000u, 0x00800000u, 0x00800000u, 0x00800000u, // min()\n        0x3f3504f3u, 0x3f3504f3u, 0x3f3504f3u, 0x3f3504f3u, // 1/sqrt(2)\n        // ln(2) = 0x3fe62e42fefa39ef\n        // ln(2) = doubleConstant< 1, 0x00062e42fefa39ef, -1>()\n        //       = floatConstant< 1, 0x00317217(f7d>(), -1) + floatConstant< 1, 0x0077d1cd, -25>()\n        //       = floatConstant< 1, 0x00318000(000>(), -1) + floatConstant<-1, 0x005e8083, -13>()\n        0x3f318000u, 0x3f318000u, 0x3f318000u, 0x3f318000u, // round(ln(2) * 512) / 512\n        0xb95e8083u, 0xb95e8083u, 0xb95e8083u, 0xb95e8083u, // ln(2) - round(ln(2) * 512) / 512\n        0x3f000000u, 0x3f000000u, 0x3f000000u, 0x3f000000u, // 0.5\n        0x3ede5bd9u, 0x3ede5bd9u, 0x3ede5bd9u, 0x3ede5bd9u, // log10(e)\n        0x3fb8aa3bu, 0x3fb8aa3bu, 0x3fb8aa3bu, 0x3fb8aa3bu, // log2(e)\n        // log10(2) = 0x3fd34413509f79ff\n        //          = doubleConstant< 1, 0x00034413509f79ff, -2>()\n        //          = floatConstant< 1, 0x001a209a(84fbcff8>(), -2) + floatConstant< 1, 0x0004fbcff(8>(), -26)\n        //floatConstant< 1, 0x001a209a, -2>(), // log10(2)\n        //floatConstant< 1, 0x001a209a, -2>(), // log10(2)\n        //floatConstant< 1, 0x001a209a, -2>(), // log10(2)\n        //floatConstant< 1, 0x001a209a, -2>(), // log10(2)\n    };\n}\n}\n"
  },
  {
    "path": "3rdparty/Vc/src/cpuid.cpp",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2011-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include <Vc/cpuid.h>\n#include <Vc/global.h>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\nCpuId::uint   CpuId::s_ecx0 = 0;\nCpuId::uint   CpuId::s_logicalProcessors = 0;\nCpuId::uint   CpuId::s_processorFeaturesC = 0;\nCpuId::uint   CpuId::s_processorFeaturesD = 0;\nCpuId::uint   CpuId::s_processorFeatures7B = 0;\nCpuId::uint   CpuId::s_processorFeatures7C = 0;\nCpuId::uint   CpuId::s_processorFeatures8C = 0;\nCpuId::uint   CpuId::s_processorFeatures8D = 0;\nCpuId::uint   CpuId::s_L1Instruction = 0;\nCpuId::uint   CpuId::s_L1Data = 0;\nCpuId::uint   CpuId::s_L2Data = 0;\nCpuId::uint   CpuId::s_L3Data = 0;\nCpuId::ushort CpuId::s_L1InstructionLineSize = 0;\nCpuId::ushort CpuId::s_L1DataLineSize = 0;\nCpuId::ushort CpuId::s_L2DataLineSize = 0;\nCpuId::ushort CpuId::s_L3DataLineSize = 0;\nCpuId::uint   CpuId::s_L1Associativity = 0;\nCpuId::uint   CpuId::s_L2Associativity = 0;\nCpuId::uint   CpuId::s_L3Associativity = 0;\nCpuId::ushort CpuId::s_prefetch = 32; // The Intel ORM says that if Vc_CPUID(2) doesn't set the prefetch size it is 32\nCpuId::uchar  CpuId::s_brandIndex = 0;\nCpuId::uchar  CpuId::s_cacheLineSize = 0;\nCpuId::uchar  CpuId::s_processorModel = 0;\nCpuId::uchar  CpuId::s_processorFamily = 0;\nCpuId::ProcessorType CpuId::s_processorType = CpuId::IntelReserved;\nbool   CpuId::s_noL2orL3 = false;\n\n#ifdef _WIN32\n\n}\n// better not include intrin.h inside the Vc namespace :)\n#include <intrin.h>\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\n#define Vc_CPUID(leaf) \\\n    do { \\\n        int out[4]; \\\n        __cpuid(out, leaf); \\\n        eax = out[0]; \\\n        ebx = out[1]; \\\n        ecx = out[2]; \\\n        edx = out[3]; \\\n    } while (false)\n#define Vc_CPUID_C(leaf, ecx_)                                                           \\\n    do {                                                                                 \\\n        int out[4];                                                                      \\\n        __cpuidex(out, leaf, ecx_);                                                      \\\n        eax = out[0];                                                                    \\\n        ebx = out[1];                                                                    \\\n        ecx = out[2];                                                                    \\\n        edx = out[3];                                                                    \\\n    } while (false)\n#elif defined(__i386__) && defined(__PIC__)\n// %ebx may be the PIC register.\nstatic inline void _Vc_cpuid(int leaf, unsigned int &eax, unsigned int &ebx, unsigned int &ecx, unsigned int &edx)\n{\n    int tmpb;\n    asm(\"mov %%ebx, %[tmpb]\\n\\t\"\n        \"cpuid\\n\\t\"\n        \"mov %%ebx, %[ebx]\\n\\t\"\n        \"mov %[tmpb], %%ebx\\n\\t\"\n        : [tmpb]\"=m\"(tmpb), \"=a\"(eax), [ebx] \"=m\"(ebx), \"+c\"(ecx), \"=d\"(edx)\n        : [leaf] \"a\"(leaf)\n      );\n}\n#define Vc_CPUID(leaf) \\\n    ecx = 0; \\\n    _Vc_cpuid(leaf, eax, ebx, ecx, edx)\n#define Vc_CPUID_C(leaf, ecx_)                                                           \\\n    ecx = ecx_;                                                                          \\\n    _Vc_cpuid(leaf, eax, ebx, ecx, edx)\n#else\n#define Vc_CPUID(leaf) \\\n    __asm__(\"cpuid\" : \"=a\"(eax), \"=b\"(ebx), \"=c\"(ecx), \"=d\"(edx) : \"a\"(leaf))\n#define Vc_CPUID_C(leaf, ecx_)                                                           \\\n    __asm__(\"cpuid\" : \"=a\"(eax), \"=b\"(ebx), \"=c\"(ecx), \"=d\"(edx) : \"a\"(leaf), \"c\"(ecx_))\n#endif\nstatic unsigned int CpuIdAmdAssociativityTable(int bits)\n{\n    switch (bits) {\n    case 0x0: return 0;\n    case 0x1: return 1;\n    case 0x2: return 2;\n    case 0x4: return 4;\n    case 0x6: return 8;\n    case 0x8: return 16;\n    case 0xA: return 32;\n    case 0xB: return 48;\n    case 0xC: return 64;\n    case 0xD: return 96;\n    case 0xE: return 128;\n    case 0xF: return 0xff;\n    }\n    return 0xffffffffu;\n}\n\nvoid CpuId::init()\n{\n    {\n        static bool done = false;\n        if (done) return;\n        done = true;\n    }\n    uint eax, ebx, ecx, edx;\n\n    Vc_CPUID(0);\n    s_ecx0 = ecx;\n\n    Vc_CPUID(1);\n    s_processorFeaturesC = ecx;\n    s_processorFeaturesD = edx;\n    s_processorModel  = (eax & 0x000000f0) >> 4;\n    s_processorFamily = (eax & 0x00000f00) >> 8;\n    if (isAmd()) {\n        if (s_processorFamily >= 0xf) {\n            const uchar processorFamilyExt = (eax & 0x0ff00000) >> 16;\n            s_processorFamily += processorFamilyExt;\n            const uchar processorModelExt = (eax & 0x000f0000) >> 12;\n            s_processorModel += processorModelExt;\n        }\n    } else if (s_processorFamily == 0xf) {\n        const uchar processorFamilyExt = (eax & 0x0ff00000) >> 16;\n        s_processorFamily += processorFamilyExt;\n        const uchar processorModelExt = (eax & 0x000f0000) >> 12;\n        s_processorModel += processorModelExt;\n    } else if (s_processorFamily == 0x6) {\n        const uchar processorModelExt = (eax & 0x000f0000) >> 12;\n        s_processorModel += processorModelExt;\n    } else if (s_processorFamily == 0xB) {\n        const uchar processorFamilyExt = (eax & 0x0ff00000) >> 16;\n        s_processorFamily += processorFamilyExt;\n        const uchar processorModelExt = (eax & 0x000f0000) >> 12;\n        s_processorModel += processorModelExt;\n    }\n    s_processorType = static_cast<ProcessorType>((eax & 0x00003000) >> 12);\n\n    s_brandIndex = ebx & 0xff;\n    ebx >>= 8;\n    s_cacheLineSize = ebx & 0xff;\n    ebx >>= 8;\n    s_logicalProcessors = ebx & 0xff;\n\n    Vc_CPUID_C(7, 0);\n    s_processorFeatures7B = ebx;\n    s_processorFeatures7C = ecx;\n\n    Vc_CPUID(0x80000001);\n    s_processorFeatures8C = ecx;\n    s_processorFeatures8D = edx;\n\n    if (isAmd()) {\n        s_prefetch = cacheLineSize();\n\n        Vc_CPUID(0x80000005);\n        s_L1DataLineSize = ecx & 0xff;\n        s_L1Data = (ecx >> 24) * 1024;\n        s_L1Associativity = (ecx >> 16) & 0xff;\n        s_L1InstructionLineSize = edx & 0xff;\n        s_L1Instruction = (edx >> 24) * 1024;\n\n        Vc_CPUID(0x80000006);\n        s_L2DataLineSize = ecx & 0xff;\n        s_L2Data = (ecx >> 16) * 1024;\n        s_L2Associativity = CpuIdAmdAssociativityTable((ecx >> 12) & 0xf);\n        s_L3DataLineSize = edx & 0xff;\n        s_L3Data = (edx >> 18) * 512 * 1024;\n        s_L3Associativity = CpuIdAmdAssociativityTable((ecx >> 12) & 0xf);\n        return;\n    }\n\n    // Intel only\n    int repeat = 0;\n    bool checkLeaf4 = false;\n    do {\n        Vc_CPUID(2);\n        if (repeat == 0) {\n            if (eax == 0 && ebx == 0 && ecx == 0 && edx == 0) {\n                // this is the case on MIC\n                checkLeaf4 = true;\n                break;\n            }\n            repeat = eax & 0xff;\n        }\n        if (0 == (0x80000000u & eax)) {\n            for (int i = 0; i < 3; ++i) {\n                eax >>= 8;\n                interpret(eax & 0xff, &checkLeaf4);\n            }\n        }\n        if (0 == (0x80000000u & ebx)) {\n            for (int i = 0; i < 4; ++i) {\n                interpret(ebx & 0xff, &checkLeaf4);\n                ebx >>= 8;\n            }\n        }\n        if (0 == (0x80000000u & ecx)) {\n            for (int i = 0; i < 4; ++i) {\n                interpret(ecx & 0xff, &checkLeaf4);\n                ecx >>= 8;\n            }\n        }\n        if (0 == (0x80000000u & edx)) {\n            for (int i = 0; i < 4; ++i) {\n                interpret(edx & 0xff, &checkLeaf4);\n                edx >>= 8;\n            }\n        }\n    } while (--repeat > 0);\n    if (checkLeaf4) {\n        s_prefetch = cacheLineSize();\n        if (s_prefetch == 0) {\n            s_prefetch = 64;\n        }\n        eax = 1;\n        for (int i = 0; eax & 0x1f; ++i) {\n            Vc_CPUID_C(4, i);\n            const int cacheLevel = (eax >> 5) & 7;\n            //const int sharedBy = 1 + ((eax >> 14) & 0xfff);\n            const int linesize = 1 + (ebx & 0xfff);   ebx >>= 12;\n            const int partitions = 1 + (ebx & 0x3ff); ebx >>= 10;\n            const int ways = 1 + (ebx & 0x3ff);\n            const int sets = 1 + ecx;\n            const int size = ways * partitions * linesize * sets;\n            switch (eax & 0x1f) {\n                case 1: // data cache\n                    switch (cacheLevel) {\n                        case 1:\n                            s_L1Data = size;\n                            s_L1DataLineSize = linesize;\n                            s_L1Associativity = ways;\n                            break;\n                        case 2:\n                            s_L2Data = size;\n                            s_L2DataLineSize = linesize;\n                            s_L2Associativity = ways;\n                            break;\n                        case 3:\n                            s_L3Data = size;\n                            s_L3DataLineSize = linesize;\n                            s_L3Associativity = ways;\n                            break;\n                    }\n                    break;\n                case 2: // instruction cache\n                    switch (cacheLevel) {\n                        case 1:\n                            s_L1Instruction = size;\n                            s_L1InstructionLineSize = linesize;\n                            break;\n                    }\n                    break;\n                case 3: // unified cache\n                    switch (cacheLevel) {\n                        case 1:\n                            s_L1Data = size;// / sharedBy;\n                            s_L1DataLineSize = linesize;\n                            s_L1Associativity = ways;\n                            break;\n                        case 2:\n                            s_L2Data = size;// / sharedBy;\n                            s_L2DataLineSize = linesize;\n                            s_L2Associativity = ways;\n                            break;\n                        case 3:\n                            s_L3Data = size;// / sharedBy;\n                            s_L3DataLineSize = linesize;\n                            s_L3Associativity = ways;\n                            break;\n                    }\n                    break;\n                case 0: // no more caches\n                    break;\n                default: // reserved\n                    break;\n            }\n        }\n    }\n}\n\nvoid CpuId::interpret(uchar byte, bool *checkLeaf4)\n{\n    switch (byte) {\n    case 0x06:\n        s_L1Instruction = 8 * 1024;\n        s_L1InstructionLineSize = 32;\n        s_L1Associativity = 4;\n        break;\n    case 0x08:\n        s_L1Instruction = 16 * 1024;\n        s_L1InstructionLineSize = 32;\n        s_L1Associativity = 4;\n        break;\n    case 0x09:\n        s_L1Instruction = 32 * 1024;\n        s_L1InstructionLineSize = 64;\n        s_L1Associativity = 4;\n        break;\n    case 0x0A:\n        s_L1Data = 8 * 1024;\n        s_L1DataLineSize = 32;\n        s_L1Associativity = 2;\n        break;\n    case 0x0C:\n        s_L1Data = 16 * 1024;\n        s_L1DataLineSize = 32;\n        s_L1Associativity = 4;\n        break;\n    case 0x0D:\n        s_L1Data = 16 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 4;\n        break;\n    case 0x0E:\n        s_L1Data = 24 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 6;\n        break;\n    case 0x21:\n        s_L2Data = 256 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0x22:\n        s_L3Data = 512 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 4;\n        break;\n    case 0x23:\n        s_L3Data = 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 8;\n        break;\n    case 0x25:\n        s_L3Data = 2 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 8;\n        break;\n    case 0x29:\n        s_L3Data = 4 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 8;\n        break;\n    case 0x2C:\n        s_L1Data = 32 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 8;\n        break;\n    case 0x30:\n        s_L1Data = 32 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 8;\n        break;\n    case 0x40:\n        s_noL2orL3 = true;\n        break;\n    case 0x41:\n        s_L2Data = 128 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 4;\n        break;\n    case 0x42:\n        s_L2Data = 256 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 4;\n        break;\n    case 0x43:\n        s_L2Data = 512 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 4;\n        break;\n    case 0x44:\n        s_L2Data = 1024 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 4;\n        break;\n    case 0x45:\n        s_L2Data = 2 * 1024 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 4;\n        break;\n    case 0x46:\n        s_L3Data = 4 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 4;\n        break;\n    case 0x47:\n        s_L3Data = 8 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 8;\n        break;\n    case 0x48:\n        s_L2Data = 3 * 1024 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 12;\n        break;\n    case 0x49:\n        if (s_processorFamily == 0xf && s_processorModel == 0x6) {\n            s_L3Data = 4 * 1024 * 1024;\n            s_L3DataLineSize = 64;\n            s_L3Associativity = 16;\n        } else {\n            s_L2Data = 4 * 1024 * 1024;\n            s_L2DataLineSize = 64;\n            s_L2Associativity = 16;\n        }\n        break;\n    case 0x4A:\n        s_L3Data = 6 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 12;\n        break;\n    case 0x4B:\n        s_L3Data = 8 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 16;\n        break;\n    case 0x4C:\n        s_L3Data = 12 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 12;\n        break;\n    case 0x4D:\n        s_L3Data = 16 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 16;\n        break;\n    case 0x4E:\n        s_L2Data = 6 * 1024 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 24;\n        break;\n    case 0x60:\n        s_L1Data = 16 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 8;\n        break;\n    case 0x66:\n        s_L1Data = 8 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 4;\n        break;\n    case 0x67:\n        s_L1Data = 16 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 4;\n        break;\n    case 0x68:\n        s_L1Data = 32 * 1024;\n        s_L1DataLineSize = 64;\n        s_L1Associativity = 4;\n        break;\n    case 0x78:\n        s_L2Data = 1024 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 4;\n        break;\n    case 0x79:\n        s_L2Data = 128 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0x7A:\n        s_L2Data = 256 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0x7B:\n        s_L2Data = 512 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0x7C:\n        s_L2Data = 1024 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0x7D:\n        s_L2Data = 2 * 1024 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0x7F:\n        s_L2Data = 512 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 2;\n        break;\n    case 0x80:\n        s_L2Data = 512 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0x82:\n        s_L2Data = 256 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 8;\n        break;\n    case 0x83:\n        s_L2Data = 512 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 8;\n        break;\n    case 0x84:\n        s_L2Data = 1024 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 8;\n        break;\n    case 0x85:\n        s_L2Data = 2 * 1024 * 1024;\n        s_L2DataLineSize = 32;\n        s_L2Associativity = 8;\n        break;\n    case 0x86:\n        s_L2Data = 512 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 4;\n        break;\n    case 0x87:\n        s_L2Data = 1024 * 1024;\n        s_L2DataLineSize = 64;\n        s_L2Associativity = 8;\n        break;\n    case 0xD0:\n        s_L3Data = 512 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 4;\n        break;\n    case 0xD1:\n        s_L3Data = 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 4;\n        break;\n    case 0xD2:\n        s_L3Data = 2 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 4;\n        break;\n    case 0xD6:\n        s_L3Data = 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 8;\n        break;\n    case 0xD7:\n        s_L3Data = 2 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 8;\n        break;\n    case 0xD8:\n        s_L3Data = 4 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 8;\n        break;\n    case 0xDC:\n        s_L3Data = 3 * 512 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 12;\n        break;\n    case 0xDD:\n        s_L3Data = 3 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 12;\n        break;\n    case 0xDE:\n        s_L3Data = 6 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 12;\n        break;\n    case 0xE2:\n        s_L3Data = 2 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 16;\n        break;\n    case 0xE3:\n        s_L3Data = 4 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 16;\n        break;\n    case 0xE4:\n        s_L3Data = 8 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 16;\n        break;\n    case 0xEA:\n        s_L3Data = 12 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 24;\n        break;\n    case 0xEB:\n        s_L3Data = 18 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 24;\n        break;\n    case 0xEC:\n        s_L3Data = 24 * 1024 * 1024;\n        s_L3DataLineSize = 64;\n        s_L3Associativity = 24;\n        break;\n    case 0xF0:\n        s_prefetch = 64;\n        break;\n    case 0xF1:\n        s_prefetch = 128;\n        break;\n    case 0xFF:\n        // we have to use Vc_CPUID(4) to find out\n        *checkLeaf4 = true;\n        break;\n    default:\n        break;\n    }\n}\n\n}\n\n// vim: sw=4 sts=4 et tw=100\n"
  },
  {
    "path": "3rdparty/Vc/src/sse_sorthelper.cpp",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2009-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include <Vc/sse/vector.h>\n#include <Vc/sse/macros.h>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Detail\n{\ntemplate <>\nVc_CONST SSE::short_v sorted<CurrentImplementation::current()>(SSE::short_v x_)\n{\n    __m128i lo, hi, y, x = x_.data();\n    // sort pairs\n    y = Mem::permute<X1, X0, X3, X2, X5, X4, X7, X6>(x);\n    lo = _mm_min_epi16(x, y);\n    hi = _mm_max_epi16(x, y);\n    x = SSE::blend_epi16<0xaa>(lo, hi);\n\n    // merge left and right quads\n    y = Mem::permute<X3, X2, X1, X0, X7, X6, X5, X4>(x);\n    lo = _mm_min_epi16(x, y);\n    hi = _mm_max_epi16(x, y);\n    x = SSE::blend_epi16<0xcc>(lo, hi);\n    y = _mm_srli_si128(x, 2);\n    lo = _mm_min_epi16(x, y);\n    hi = _mm_max_epi16(x, y);\n    x = SSE::blend_epi16<0xaa>(lo, _mm_slli_si128(hi, 2));\n\n    // merge quads into octs\n    y = _mm_shuffle_epi32(x, _MM_SHUFFLE(1, 0, 3, 2));\n    y = _mm_shufflelo_epi16(y, _MM_SHUFFLE(0, 1, 2, 3));\n    lo = _mm_min_epi16(x, y);\n    hi = _mm_max_epi16(x, y);\n\n    x = _mm_unpacklo_epi16(lo, hi);\n    y = _mm_srli_si128(x, 8);\n    lo = _mm_min_epi16(x, y);\n    hi = _mm_max_epi16(x, y);\n\n    x = _mm_unpacklo_epi16(lo, hi);\n    y = _mm_srli_si128(x, 8);\n    lo = _mm_min_epi16(x, y);\n    hi = _mm_max_epi16(x, y);\n\n    return _mm_unpacklo_epi16(lo, hi);\n}\n\ntemplate <>\nVc_CONST SSE::ushort_v sorted<CurrentImplementation::current()>(SSE::ushort_v x_)\n{\n    __m128i lo, hi, y, x = x_.data();\n    // sort pairs\n    y = Mem::permute<X1, X0, X3, X2, X5, X4, X7, X6>(x);\n    lo = SSE::min_epu16(x, y);\n    hi = SSE::max_epu16(x, y);\n    x = SSE::blend_epi16<0xaa>(lo, hi);\n\n    // merge left and right quads\n    y = Mem::permute<X3, X2, X1, X0, X7, X6, X5, X4>(x);\n    lo = SSE::min_epu16(x, y);\n    hi = SSE::max_epu16(x, y);\n    x = SSE::blend_epi16<0xcc>(lo, hi);\n    y = _mm_srli_si128(x, 2);\n    lo = SSE::min_epu16(x, y);\n    hi = SSE::max_epu16(x, y);\n    x = SSE::blend_epi16<0xaa>(lo, _mm_slli_si128(hi, 2));\n\n    // merge quads into octs\n    y = _mm_shuffle_epi32(x, _MM_SHUFFLE(1, 0, 3, 2));\n    y = _mm_shufflelo_epi16(y, _MM_SHUFFLE(0, 1, 2, 3));\n    lo = SSE::min_epu16(x, y);\n    hi = SSE::max_epu16(x, y);\n\n    x = _mm_unpacklo_epi16(lo, hi);\n    y = _mm_srli_si128(x, 8);\n    lo = SSE::min_epu16(x, y);\n    hi = SSE::max_epu16(x, y);\n\n    x = _mm_unpacklo_epi16(lo, hi);\n    y = _mm_srli_si128(x, 8);\n    lo = SSE::min_epu16(x, y);\n    hi = SSE::max_epu16(x, y);\n\n    return _mm_unpacklo_epi16(lo, hi);\n}\n\ntemplate <> Vc_CONST SSE::int_v sorted<CurrentImplementation::current()>(SSE::int_v x_)\n{\n    __m128i x = x_.data();\n    /*\n    // in 16,67% of the cases the merge can be replaced by an append\n\n    // x = [a b c d]\n    // y = [c d a b]\n    __m128i y = _mm_shuffle_epi32(x, _MM_SHUFFLE(1, 0, 3, 2));\n    __m128i l = SSE::min_epi32(x, y); // min[ac bd ac bd]\n    __m128i h = SSE::max_epi32(x, y); // max[ac bd ac bd]\n    if (IS_UNLIKELY(_mm_cvtsi128_si32(h) <= l[1])) { // l[0] < h[0] < l[1] < h[1]\n        return _mm_unpacklo_epi32(l, h);\n    }\n    // h[0] > l[1]\n    */\n\n    // sort pairs\n    __m128i y = _mm_shuffle_epi32(x, _MM_SHUFFLE(2, 3, 0, 1));\n    __m128i l = SSE::min_epi32(x, y);\n    __m128i h = SSE::max_epi32(x, y);\n    x = _mm_unpacklo_epi32(l, h);\n    y = _mm_unpackhi_epi32(h, l);\n\n    // sort quads\n    l = SSE::min_epi32(x, y);\n    h = SSE::max_epi32(x, y);\n    x = _mm_unpacklo_epi32(l, h);\n    y = _mm_unpackhi_epi64(x, x);\n\n    l = SSE::min_epi32(x, y);\n    h = SSE::max_epi32(x, y);\n    return _mm_unpacklo_epi32(l, h);\n}\n\ntemplate <> Vc_CONST SSE::uint_v sorted<CurrentImplementation::current()>(SSE::uint_v x_)\n{\n    __m128i x = x_.data();\n    __m128i y = _mm_shuffle_epi32(x, _MM_SHUFFLE(2, 3, 0, 1));\n    __m128i l = SSE::min_epu32(x, y);\n    __m128i h = SSE::max_epu32(x, y);\n    x = _mm_unpacklo_epi32(l, h);\n    y = _mm_unpackhi_epi32(h, l);\n\n    // sort quads\n    l = SSE::min_epu32(x, y);\n    h = SSE::max_epu32(x, y);\n    x = _mm_unpacklo_epi32(l, h);\n    y = _mm_unpackhi_epi64(x, x);\n\n    l = SSE::min_epu32(x, y);\n    h = SSE::max_epu32(x, y);\n    return _mm_unpacklo_epi32(l, h);\n}\n\ntemplate <>\nVc_CONST SSE::float_v sorted<CurrentImplementation::current()>(SSE::float_v x_)\n{\n    __m128 x = x_.data();\n    __m128 y = _mm_shuffle_ps(x, x, _MM_SHUFFLE(2, 3, 0, 1));\n    __m128 l = _mm_min_ps(x, y);\n    __m128 h = _mm_max_ps(x, y);\n    x = _mm_unpacklo_ps(l, h);\n    y = _mm_unpackhi_ps(h, l);\n\n    l = _mm_min_ps(x, y);\n    h = _mm_max_ps(x, y);\n    x = _mm_unpacklo_ps(l, h);\n    y = _mm_movehl_ps(x, x);\n\n    l = _mm_min_ps(x, y);\n    h = _mm_max_ps(x, y);\n    return _mm_unpacklo_ps(l, h);\n    // X         __m128 k = _mm_cmpgt_ps(x, y);\n    // X         k = _mm_shuffle_ps(k, k, _MM_SHUFFLE(2, 2, 0, 0));\n    // X         x = SSE::blendv_ps(x, y, k);\n    // X         y = _mm_shuffle_ps(x, x, _MM_SHUFFLE(1, 0, 3, 2));\n    // X         k = _mm_cmpgt_ps(x, y);\n    // X         k = _mm_shuffle_ps(k, k, _MM_SHUFFLE(1, 0, 1, 0));\n    // X         x = SSE::blendv_ps(x, y, k);\n    // X         y = _mm_shuffle_ps(x, x, _MM_SHUFFLE(3, 1, 2, 0));\n    // X         k = _mm_cmpgt_ps(x, y);\n    // X         k = _mm_shuffle_ps(k, k, _MM_SHUFFLE(0, 1, 1, 0));\n    // X         return SSE::blendv_ps(x, y, k);\n}\n\n}  // namespace Detail\n}  // namespace Vc\n\n// vim: foldmethod=marker\n"
  },
  {
    "path": "3rdparty/Vc/src/support_dummy.cpp",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2017 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include <Vc/global.h>\n#include <Vc/support.h>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nbool isImplementationSupported(Implementation impl) { return impl == ScalarImpl; }\n\nVc::Implementation bestImplementationSupported() { return Vc::ScalarImpl; }\n\nunsigned int extraInstructionsSupported() { return 0; }\n}\n\n#undef Vc_TARGET_NO_SIMD\n\n// vim: sw=4 sts=4 et tw=100\n"
  },
  {
    "path": "3rdparty/Vc/src/support_x86.cpp",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2010-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n#include <Vc/global.h>\n#include <Vc/cpuid.h>\n#include <Vc/support.h>\n\n#ifdef Vc_MSVC\n#include <intrin.h>\n#endif\n\n#if defined(Vc_GCC) && Vc_GCC >= 0x40400\n#define Vc_TARGET_NO_SIMD __attribute__((target(\"no-sse2,no-avx\")))\n#else\n#define Vc_TARGET_NO_SIMD\n#endif\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\n\nVc_TARGET_NO_SIMD\nstatic inline bool xgetbvCheck(unsigned int bits)\n{\n#if defined(Vc_MSVC) && Vc_MSVC >= 160040219 // MSVC 2010 SP1 introduced _xgetbv\n    unsigned long long xcrFeatureMask = _xgetbv(_XCR_XFEATURE_ENABLED_MASK);\n    return (xcrFeatureMask & bits) == bits;\n#elif defined(Vc_GNU_ASM) && !defined(Vc_NO_XGETBV)\n    unsigned int eax;\n    asm(\"xgetbv\" : \"=a\"(eax) : \"c\"(0) : \"edx\");\n    return (eax & bits) == bits;\n#else\n    // can't check, but if OSXSAVE is true let's assume it'll work\n    return bits > 0; // ignore 'warning: unused parameter'\n#endif\n}\n\nVc_TARGET_NO_SIMD\nbool Vc_VDECL isImplementationSupported(Implementation impl)\n{\n    CpuId::init();\n\n    switch (impl) {\n    case ScalarImpl:\n        return true;\n    case SSE2Impl:\n        return CpuId::hasSse2();\n    case SSE3Impl:\n        return CpuId::hasSse3();\n    case SSSE3Impl:\n        return CpuId::hasSsse3();\n    case SSE41Impl:\n        return CpuId::hasSse41();\n    case SSE42Impl:\n        return CpuId::hasSse42();\n    case AVXImpl:\n        return CpuId::hasOsxsave() && CpuId::hasAvx() && xgetbvCheck(0x6);\n    case AVX2Impl:\n        return CpuId::hasOsxsave() && CpuId::hasAvx2() && xgetbvCheck(0x6);\n    case MICImpl:\n        return CpuId::processorFamily() == 0xB && CpuId::processorModel() == 0x1\n            && CpuId::isIntel();\n    case ImplementationMask:\n        return false;\n    }\n    return false;\n}\n\nVc_TARGET_NO_SIMD\nVc::Implementation bestImplementationSupported()\n{\n    CpuId::init();\n\n    if (CpuId::processorFamily() == 0xB && CpuId::processorModel() == 0x1\n            && CpuId::isIntel()) {\n        return Vc::MICImpl;\n    }\n    if (!CpuId::hasSse2 ()) return Vc::ScalarImpl;\n    if (!CpuId::hasSse3 ()) return Vc::SSE2Impl;\n    if (!CpuId::hasSsse3()) return Vc::SSE3Impl;\n    if (!CpuId::hasSse41()) return Vc::SSSE3Impl;\n    if (!CpuId::hasSse42()) return Vc::SSE41Impl;\n    if (CpuId::hasAvx() && CpuId::hasOsxsave() && xgetbvCheck(0x6)) {\n        if (!CpuId::hasAvx2()) return Vc::AVXImpl;\n        return Vc::AVX2Impl;\n    }\n    return Vc::SSE42Impl;\n}\n\nVc_TARGET_NO_SIMD\nunsigned int extraInstructionsSupported()\n{\n    unsigned int flags = 0;\n    if (CpuId::hasF16c()) flags |= Vc::Float16cInstructions;\n    if (CpuId::hasFma4()) flags |= Vc::Fma4Instructions;\n    if (CpuId::hasXop ()) flags |= Vc::XopInstructions;\n    if (CpuId::hasPopcnt()) flags |= Vc::PopcntInstructions;\n    if (CpuId::hasSse4a()) flags |= Vc::Sse4aInstructions;\n    if (CpuId::hasFma ()) flags |= Vc::FmaInstructions;\n    if (CpuId::hasBmi2()) flags |= Vc::Bmi2Instructions;\n    if (CpuId::hasOsxsave() && CpuId::hasAvx() && xgetbvCheck(0x6)) flags |= Vc::VexInstructions;\n    //if (CpuId::hasPclmulqdq()) flags |= Vc::PclmulqdqInstructions;\n    //if (CpuId::hasAes()) flags |= Vc::AesInstructions;\n    //if (CpuId::hasRdrand()) flags |= Vc::RdrandInstructions;\n    return flags;\n}\n\n}\n\n#undef Vc_TARGET_NO_SIMD\n\n// vim: sw=4 sts=4 et tw=100\n"
  },
  {
    "path": "3rdparty/Vc/src/trigonometric.cpp",
    "content": "/*  This file is part of the Vc library. {{{\nCopyright © 2012-2015 Matthias Kretz <kretz@kde.org>\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n    * Redistributions of source code must retain the above copyright\n      notice, this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n      notice, this list of conditions and the following disclaimer in the\n      documentation and/or other materials provided with the distribution.\n    * Neither the names of contributing organizations nor the\n      names of its contributors may be used to endorse or promote products\n      derived from this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n}}}*/\n\n// enable bit operators for easier portable bit manipulation on floats\n#define Vc_ENABLE_FLOAT_BIT_OPERATORS 1\n\n#include <Vc/vector.h>\n#if defined(Vc_IMPL_SSE) || defined(Vc_IMPL_AVX)\n#include <Vc/common/macros.h>\n//#include <Vc/IO>\n\nnamespace Vc_VERSIONED_NAMESPACE\n{\nnamespace Common\n{\nnamespace\n{\nusing Vc::Vector;\ntemplate <typename T, typename Abi>\nusing Const = typename std::conditional<std::is_same<Abi, VectorAbi::Avx>::value,\n                                        AVX::Const<T>, SSE::Const<T>>::type;\n\ntemplate <typename V>\nusing best_int_v_for =\n    typename std::conditional<(V::size() <= Vector<int, VectorAbi::Best<int>>::size()),\n                              Vector<int, VectorAbi::Best<int>>,\n                              SimdArray<int, V::size()>>::type;\ntemplate <typename Abi> using float_int_v = best_int_v_for<Vector<float, Abi>>;\ntemplate <typename Abi> using double_int_v = best_int_v_for<Vector<double, Abi>>;\n\ntemplate <typename Abi>\nstatic Vc_ALWAYS_INLINE Vector<float, Abi> cosSeries(const Vector<float, Abi> &x)\n{\n    const Vector<float, Abi> x2 = x * x;\n    Vector<float, Abi> y;\n    y =          Vc::Detail::floatConstant< 1, 0x500000, -16>();  //  1/8!\n    y = y * x2 + Vc::Detail::floatConstant<-1, 0x360800, -10>();  // -1/6!\n    y = y * x2 + Vc::Detail::floatConstant< 1, 0x2AAAAB,  -5>();  //  1/4!\n    return y * (x2 * x2) - .5f * x2 + 1.f;\n    // alternative (appears neither faster nor more precise):\n    // return (y * x2 - .5f) * x2 + 1.f;\n}\n\ntemplate <typename Abi>\nstatic Vc_ALWAYS_INLINE Vector<double, Abi> cosSeries(const Vector<double, Abi> &x)\n{\n    const Vector<double, Abi> x2 = x * x;\n    Vector<double, Abi> y;\n    y =          Vc::Detail::doubleConstant< 1, 0xAC00000000000, -45>();  //  1/16!\n    y = y * x2 + Vc::Detail::doubleConstant<-1, 0x9394000000000, -37>();  // -1/14!\n    y = y * x2 + Vc::Detail::doubleConstant< 1, 0x1EED8C0000000, -29>();  //  1/12!\n    y = y * x2 + Vc::Detail::doubleConstant<-1, 0x27E4FB7400000, -22>();  // -1/10!\n    y = y * x2 + Vc::Detail::doubleConstant< 1, 0xA01A01A018000, -16>();  //  1/8!\n    y = y * x2 + Vc::Detail::doubleConstant<-1, 0x6C16C16C16C00, -10>();  // -1/6!\n    y = y * x2 + Vc::Detail::doubleConstant< 1, 0x5555555555554,  -5>();  //  1/4!\n    return (y * x2 - .5f) * x2 + 1.f;\n}\n\ntemplate <typename Abi>\nstatic Vc_ALWAYS_INLINE Vector<float, Abi> sinSeries(const Vector<float, Abi> &x)\n{\n    const Vector<float, Abi> x2 = x * x;\n    Vector<float, Abi> y;\n    y =          Vc::Detail::floatConstant<-1, 0x4E6000, -13>();  // -1/7!\n    y = y * x2 + Vc::Detail::floatConstant< 1, 0x088880,  -7>();  //  1/5!\n    y = y * x2 + Vc::Detail::floatConstant<-1, 0x2AAAAB,  -3>();  // -1/3!\n    return y * (x2 * x) + x;\n}\n\ntemplate <typename Abi>\nstatic Vc_ALWAYS_INLINE Vector<double, Abi> sinSeries(const Vector<double, Abi> &x)\n{\n    // x  = [0, 0.7854 = pi/4]\n    // x² = [0, 0.6169 = pi²/8]\n    const Vector<double, Abi> x2 = x * x;\n    Vector<double, Abi> y;\n    y =          Vc::Detail::doubleConstant<-1, 0xACF0000000000, -41>();  // -1/15!\n    y = y * x2 + Vc::Detail::doubleConstant< 1, 0x6124400000000, -33>();  //  1/13!\n    y = y * x2 + Vc::Detail::doubleConstant<-1, 0xAE64567000000, -26>();  // -1/11!\n    y = y * x2 + Vc::Detail::doubleConstant< 1, 0x71DE3A5540000, -19>();  //  1/9!\n    y = y * x2 + Vc::Detail::doubleConstant<-1, 0xA01A01A01A000, -13>();  // -1/7!\n    y = y * x2 + Vc::Detail::doubleConstant< 1, 0x1111111111110,  -7>();  //  1/5!\n    y = y * x2 + Vc::Detail::doubleConstant<-1, 0x5555555555555,  -3>();  // -1/3!\n    return y * (x2 * x) + x;\n}\n\n/**\\internal\n * Fold \\p x into [-¼π, ¼π] and remember the quadrant it came from:\n * quadrant 0: [-¼π,  ¼π]\n * quadrant 1: [ ¼π,  ¾π]\n * quadrant 2: [ ¾π, 1¼π]\n * quadrant 3: [1¼π, 1¾π]\n *\n * The algorithm determines `y` as the multiple `x - y * ¼π = [-¼π, ¼π]`. Using a bitmask,\n * `y` is reduced to `quadrant`. `y` can be calculated as\n * ```\n * y = trunc(x / ¼π);\n * y += fmod(y, 2);\n * ```\n * This can be simplified by moving the (implicit) division by 2 into the truncation\n * expression. The `+= fmod` effect can the be achieved by using rounding instead of\n * truncation:\n * `y = round(x / ½π) * 2`.\n * If precision allows, `2/π * x` is better (faster).\n */\ntemplate <class T, class Abi> struct folded {\n    Vector<T, Abi> x, quadrant;\n};\n\ntemplate <typename Abi>\nstatic Vc_ALWAYS_INLINE folded<float, Abi> foldInput(const Vector<float, Abi> &x)\n{\n    using V = Vector<float, Abi>;\n    using IV = best_int_v_for<V>;\n    using C = Const<float, Abi>;\n\n    folded<float, Abi> r;\n    r.x = abs(x);\n    if (Vc_IS_UNLIKELY(all_of(r.x < C::_pi_4()))) {\n        r.quadrant = 0;\n    } else if (Vc_IS_LIKELY(all_of(r.x < 33 * C::_pi_4()))) {\n        const float _2_over_pi = Vc::Detail::floatConstant<1, 0x22F983, -1>();  // ½π\n        V y = round(r.x * _2_over_pi);\n        r.quadrant = simd_cast<V>(simd_cast<IV>(y) & 3);            // y mod 4\n        r.x -= y * Vc::Detail::floatConstant<1, 0x490fe0, 0>();     // pi/2\n        r.x -= y * Vc::Detail::floatConstant<-1, 0x2bbbd3, -21>();  // pi/2 remainder\n    } else {\n        typedef SimdArray<double, V::size()> VD;\n        VD xd = simd_cast<VD>(abs(r.x));\n        constexpr double _2_over_pi =\n            Vc::Detail::doubleConstant<1, 0x45F306DC9C883, -1>();\n        VD y = round(xd * _2_over_pi);\n        r.quadrant = simd_cast<V>(simd_cast<IV>(y) & 3);  // = y mod 4\n        constexpr double pi_over_2 = Vc::Detail::doubleConstant<1, 0x921FB54442D18, 0>();\n        r.x = simd_cast<V>(xd - y * pi_over_2);\n    }\n    //std::cout << std::hexfloat << r.x << ' ' << r.quadrant << std::defaultfloat << '\\n';\n    return r;\n\n    /*\n    More alternatives to avoid double precision calculation follow. Their main problem\n    is unfortunate rounding on intermediate values of x (after subtraction):\n\n    if (all_of(y <= 0x1000)) {\n        // 0 <= x <= 0x1.921fb6p12\n        // π/4 - 12 bits precision (12 zero bits):\n        //const auto _pi_4_1 = Vc::Detail::floatConstant< 1, 0x491000,  -1>();\n        //const auto _pi_4_2 = Vc::Detail::floatConstant<-1, 0x157000, -19>();\n        //const auto _pi_4_3 = Vc::Detail::floatConstant<-1, 0x6F4B9F, -32>();\n        x -= y * C::_pi_4_hi();\n        x -= y * C::_pi_4_rem1();\n        x -= y * C::_pi_4_rem2();\n    } else { //if (all_of(y <= 0x10000)) {\n        // consider y = 0x1.fffep+16 / x = 0x1.921e24p+16\n        // critical input: 0x1.921fb6p+12 <= x <= 0x1.921fb6p+16\n        // π/4 - 8 bits precision (16 zero bits):\n        const auto _pi_4_1 = Vc::Detail::floatConstant<+1, 0x490000,  -1>();\n        const auto _pi_4_2 = Vc::Detail::floatConstant<+1, 0x7E0000, -13>();\n        const auto _pi_4_3 = Vc::Detail::floatConstant<-1, 0x2C0000, -22>();\n        const auto _pi_4_4 = Vc::Detail::floatConstant<+1, 0x085A31, -31>();\n        x -= y * _pi_4_1; // (x -= 0x1.91fe6ep+16) ->  0x1.fb6000p+4\n        x -= y * _pi_4_2; // (x -= 0x1.fbfe04p+4)  -> -0x1.3c0800p-6\n        x -= y * _pi_4_3; // (x -= 0x1.57fea8p-5)  ->  0x1.bf5a80p-9\n        x -= y * _pi_4_4; // (x -= 0x1.10b352p-14) ->  0x1.b6e4e6p-9\n        x.setQnan(y > 0x10000);\n    }\n    */\n}\n\ntemplate <typename Abi>\nstatic Vc_ALWAYS_INLINE folded<double, Abi> foldInput(const Vector<double, Abi> &x)\n{\n    using V = Vector<double, Abi>;\n    using IV = best_int_v_for<V>;\n    using C = Const<double, Abi> ;\n\n    folded<double, Abi> r;\n    r.x = abs(x);\n    constexpr double pi_over_4 = Vc::Detail::doubleConstant<1, 0x921FB54442D18, -1>();\n    if (Vc_IS_UNLIKELY(all_of(r.x < pi_over_4))) {\n        r.quadrant = 0;\n        return r;\n    }\n    const V y = round(r.x / (2 * pi_over_4));\n    r.quadrant = simd_cast<V>(simd_cast<IV>(y) & 3);\n\n    if (Vc_IS_LIKELY(all_of(r.x < 1025 * pi_over_4))) {\n        // x - y * pi/2, y uses no more than 11 mantissa bits\n        r.x -= y * Vc::Detail::doubleConstant< 1, 0x921FB54443000,   0>();\n        r.x -= y * Vc::Detail::doubleConstant<-1, 0x73DCB3B39A000, -43>();\n        r.x -= y * Vc::Detail::doubleConstant< 1, 0x45C06E0E68948, -86>();\n    } else if (Vc_IS_LIKELY(all_of(y <= Vc::Detail::doubleConstant<1, 0, 30>()))) {\n        // x - y * pi/2, y uses no more than 29 mantissa bits\n        r.x -= y * Vc::Detail::doubleConstant<1, 0x921FB40000000,   0>();\n        r.x -= y * Vc::Detail::doubleConstant<1, 0x4442D00000000, -24>();\n        r.x -= y * Vc::Detail::doubleConstant<1, 0x8469898CC5170, -48>();\n    } else {\n        // x - y * pi/2, y may require all mantissa bits\n        const V y_hi = y & C::highMask(26);\n        const V y_lo = y - y_hi;\n        const auto _pi_2_1 = Vc::Detail::doubleConstant<1, 0x921FB50000000,   0>();\n        const auto _pi_2_2 = Vc::Detail::doubleConstant<1, 0x110B460000000, -26>();\n        const auto _pi_2_3 = Vc::Detail::doubleConstant<1, 0x1A62630000000, -54>();\n        const auto _pi_2_4 = Vc::Detail::doubleConstant<1, 0x8A2E03707344A, -81>();\n        /*\n        std::cout << std::hexfloat;\n        std::cout\n            << y_hi << '\\n'\n            << y_lo << '\\n'\n            << _pi_2_1 << '\\n'\n            << _pi_2_2 << '\\n'\n            << _pi_2_3 << '\\n'\n            << y_hi * _pi_2_1 << '\\n'\n            << y_hi * _pi_2_2 << '\\n'\n            << y_hi * _pi_2_3 << '\\n'\n            << y * _pi_2_4 << '\\n'\n            << y_lo * _pi_2_1 << '\\n'\n            << y_lo * _pi_2_2 << '\\n'\n            << y_lo * _pi_2_3 << '\\n';\n        std::cout << std::defaultfloat;\n        */\n        r.x = r.x\n            - y_hi * _pi_2_1\n            - max(y_hi * _pi_2_2, y_lo * _pi_2_1)\n            - min(y_hi * _pi_2_2, y_lo * _pi_2_1)\n            - max(y_hi * _pi_2_3, y_lo * _pi_2_2)\n            - min(y_hi * _pi_2_3, y_lo * _pi_2_2)\n            - max(y    * _pi_2_4, y_lo * _pi_2_3)\n            - min(y    * _pi_2_4, y_lo * _pi_2_3);\n    }\n    return r;\n}\n\nconstexpr double signmask = -0.;\nconstexpr float signmaskf = -0.f;\n} // anonymous namespace\n\n/*\n * algorithm for sine and cosine:\n *\n * The result can be calculated with sine or cosine depending on the π/4 section the input is\n * in.\n * sine   ≈ x + x³\n * cosine ≈ 1 - x²\n *\n * sine:\n * Map -x to x and invert the output\n * Extend precision of x - n * π/4 by calculating\n * ((x - n * p1) - n * p2) - n * p3 (p1 + p2 + p3 = π/4)\n *\n * Calculate Taylor series with tuned coefficients.\n * Fix sign.\n */\ntemplate <>\ntemplate <>\nVc::double_v Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::sin(const Vc::double_v &x)\n{\n    using V = Vc::double_v;\n    const auto f = foldInput(x);\n    // quadrant | effect\n    //        0 | sinSeries\n    //        1 | cosSeries\n    //        2 | sinSeries, sign flip\n    //        3 | cosSeries, sign flip\n    const V sin_sign = (x ^ (1 - f.quadrant)) & signmask;\n\n    const V sin_s = sinSeries(f.x);\n    const V cos_s = cosSeries(f.x);\n    return sin_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, sin_s, cos_s);\n}\n\ntemplate <>\ntemplate <>\nVc::float_v Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::sin(const Vc::float_v &x)\n{\n    using V = Vc::float_v;\n    if (Vc_IS_UNLIKELY(any_of(abs(x) >= 527449))) {\n        return simd_cast<V>(sin(simd_cast<Vc::double_v, 0>(x)),\n                            sin(simd_cast<Vc::double_v, 1>(x)));\n    }\n\n    const auto f = foldInput(x);\n    const V sin_sign = (x ^ (1 - f.quadrant)) & signmaskf;\n\n    const V sin_s = sinSeries(f.x);\n    const V cos_s = cosSeries(f.x);\n    return sin_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, sin_s, cos_s);\n}\n\ntemplate <>\ntemplate <>\nVc::double_v Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::cos(const Vc::double_v &x)\n{\n    using V = Vc::double_v;\n    const auto f = foldInput(x);\n    // quadrant | effect\n    //        0 | cosSeries, +\n    //        1 | sinSeries, -\n    //        2 | cosSeries, -\n    //        3 | sinSeries, +\n    const V cos_sign = ((0.5 - f.quadrant) & (f.quadrant - 2.5)) & signmask;\n\n    const V sin_s = sinSeries(f.x);\n    const V cos_s = cosSeries(f.x);\n    return cos_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, cos_s, sin_s);\n}\n\ntemplate <>\ntemplate <>\nVc::float_v Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::cos(const Vc::float_v &x)\n{\n    using V = Vc::float_v;\n    if (Vc_IS_UNLIKELY(any_of(abs(x) >= 393382))) {\n        return simd_cast<V>(cos(simd_cast<Vc::double_v, 0>(x)),\n                            cos(simd_cast<Vc::double_v, 1>(x)));\n    }\n    const auto f = foldInput(x);\n    const V cos_sign = ((0.5f - f.quadrant) & (f.quadrant - 2.5f)) & signmaskf;\n\n    const V sin_s = sinSeries(f.x);\n    const V cos_s = cosSeries(f.x);\n    return cos_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, cos_s, sin_s);\n}\n\ntemplate <>\ntemplate <>\nvoid Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::sincos(const Vc::double_v &x, Vc::double_v *s,\n                                                   Vc::double_v *c)\n{\n    using V = Vc::double_v;\n    const auto f = foldInput(x);\n    // quadrant | cosine       | sine\n    //        0 | cosSeries, + | sinSeries\n    //        1 | sinSeries, - | cosSeries\n    //        2 | cosSeries, - | sinSeries, sign flip\n    //        3 | sinSeries, + | cosSeries, sign flip\n    const V sin_sign = (x ^ (1 - f.quadrant)) & signmask;\n    const V cos_sign = ((0.5 - f.quadrant) & (f.quadrant - 2.5)) & signmask;\n\n    const V sin_s = sinSeries(f.x);\n    const V cos_s = cosSeries(f.x);\n    *s = sin_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, sin_s, cos_s);\n    *c = cos_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, cos_s, sin_s);\n}\n\ntemplate <>\ntemplate <>\nvoid Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::sincos(const Vc::float_v &x, Vc::float_v *s,\n                                                   Vc::float_v *c)\n{\n    using V = Vc::float_v;\n    if (Vc_IS_UNLIKELY(any_of(abs(x) >= 393382))) {\n        Vc::double_v s0, s1, c0, c1;\n        sincos(simd_cast<Vc::double_v, 0>(x), &s0, &c0);\n        sincos(simd_cast<Vc::double_v, 1>(x), &s1, &c1);\n        *s = simd_cast<V>(s0, s1);\n        *c = simd_cast<V>(c0, c1);\n        return;\n    }\n    const auto f = foldInput(x);\n    const V sin_sign = (x ^ (1 - f.quadrant)) & signmaskf;\n    const V cos_sign = ((0.5f - f.quadrant) & (f.quadrant - 2.5f)) & signmaskf;\n\n    const V sin_s = sinSeries(f.x);\n    const V cos_s = cosSeries(f.x);\n    *s = sin_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, sin_s, cos_s);\n    *c = cos_sign ^ iif(f.quadrant == 0 || f.quadrant == 2, cos_s, sin_s);\n}\n\ntemplate <>\ntemplate <>\nVc::float_v Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::asin(const Vc::float_v &_x)\n{\n    typedef Vc::float_v V;\n    typedef Const<float, V::abi> C;\n    typedef V::Mask M;\n\n    const M &negative = _x < V::Zero();\n\n    const V &a = abs(_x);\n    const M outOfRange = a > V::One();\n    const M &small = a < C::smallAsinInput();\n    const M &gt_0_5 = a > C::_1_2();\n    V x = a;\n    V z = a * a;\n    z(gt_0_5) = (V::One() - a) * C::_1_2();\n    x(gt_0_5) = sqrt(z);\n    z = ((((C::asinCoeff0(0)  * z\n          + C::asinCoeff0(1)) * z\n          + C::asinCoeff0(2)) * z\n          + C::asinCoeff0(3)) * z\n          + C::asinCoeff0(4)) * z * x\n          + x;\n    z(gt_0_5) = C::_pi_2() - (z + z);\n    z(small) = a;\n    z(negative) = -z;\n    z.setQnan(outOfRange);\n\n    return z;\n}\ntemplate<> template<> Vc::double_v Trigonometric<Vc::Detail::TrigonometricImplementation<Vc::CurrentImplementation::current()>>::asin (const Vc::double_v &_x) {\n    typedef Vc::double_v V;\n    typedef Const<double, V::abi> C;\n    typedef V::Mask M;\n\n    const M negative = _x < V::Zero();\n\n    const V a = abs(_x);\n    const M outOfRange = a > V::One();\n    const M small = a < C::smallAsinInput();\n    const M large = a > C::largeAsinInput();\n\n    V zz = V::One() - a;\n    const V r = (((C::asinCoeff0(0) * zz + C::asinCoeff0(1)) * zz + C::asinCoeff0(2)) * zz +\n            C::asinCoeff0(3)) * zz + C::asinCoeff0(4);\n    const V s = (((zz + C::asinCoeff1(0)) * zz + C::asinCoeff1(1)) * zz +\n            C::asinCoeff1(2)) * zz + C::asinCoeff1(3);\n    V sqrtzz = sqrt(zz + zz);\n    V z = C::_pi_4() - sqrtzz;\n    z -= sqrtzz * (zz * r / s) - C::_pi_2_rem();\n    z += C::_pi_4();\n\n    V a2 = a * a;\n    const V p = ((((C::asinCoeff2(0) * a2 + C::asinCoeff2(1)) * a2 + C::asinCoeff2(2)) * a2 +\n                C::asinCoeff2(3)) * a2 + C::asinCoeff2(4)) * a2 + C::asinCoeff2(5);\n    const V q = ((((a2 + C::asinCoeff3(0)) * a2 + C::asinCoeff3(1)) * a2 +\n                C::asinCoeff3(2)) * a2 + C::asinCoeff3(3)) * a2 + C::asinCoeff3(4);\n    z(!large) = a * (a2 * p / q) + a;\n\n    z(negative) = -z;\n    z(small) = _x;\n    z.setQnan(outOfRange);\n\n    return z;\n}\ntemplate <>\ntemplate <>\nVc::float_v Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::atan(const Vc::float_v &_x)\n{\n    using V = Vc::float_v;\n    typedef Const<float, V::abi> C;\n    typedef V::Mask M;\n    V x = abs(_x);\n    const M &gt_tan_3pi_8 = x > C::atanThrsHi();\n    const M &gt_tan_pi_8  = x > C::atanThrsLo() && !gt_tan_3pi_8;\n    V y = V::Zero();\n    y(gt_tan_3pi_8) = C::_pi_2();\n    y(gt_tan_pi_8)  = C::_pi_4();\n    x(gt_tan_3pi_8) = -V::One() / x;\n    x(gt_tan_pi_8)  = (x - V::One()) / (x + V::One());\n    const V &x2 = x * x;\n    y += (((C::atanP(0)  * x2\n          - C::atanP(1)) * x2\n          + C::atanP(2)) * x2\n          - C::atanP(3)) * x2 * x\n          + x;\n    y(_x < V::Zero()) = -y;\n    y.setQnan(isnan(_x));\n    return y;\n}\ntemplate<> template<> Vc::double_v Trigonometric<Vc::Detail::TrigonometricImplementation<Vc::CurrentImplementation::current()>>::atan (const Vc::double_v &_x) {\n    typedef Vc::double_v V;\n    typedef Const<double, V::abi> C;\n    typedef V::Mask M;\n\n    M sign = _x < V::Zero();\n    V x = abs(_x);\n    M finite = isfinite(_x);\n    V ret = C::_pi_2();\n    V y = V::Zero();\n    const M large = x > C::atanThrsHi();\n    const M gt_06 = x > C::atanThrsLo();\n    V tmp = (x - V::One()) / (x + V::One());\n    tmp(large) = -V::One() / x;\n    x(gt_06) = tmp;\n    y(gt_06) = C::_pi_4();\n    y(large) = C::_pi_2();\n    V z = x * x;\n    const V p = (((C::atanP(0) * z + C::atanP(1)) * z + C::atanP(2)) * z + C::atanP(3)) * z + C::atanP(4);\n    const V q = ((((z + C::atanQ(0)) * z + C::atanQ(1)) * z + C::atanQ(2)) * z + C::atanQ(3)) * z + C::atanQ(4);\n    z = z * p / q;\n    z = x * z + x;\n    V morebits = C::_pi_2_rem();\n    morebits(!large) *= C::_1_2();\n    z(gt_06) += morebits;\n    ret(finite) = y + z;\n    ret(sign) = -ret;\n    ret.setQnan(isnan(_x));\n    return ret;\n}\ntemplate <>\ntemplate <>\nVc::float_v Trigonometric<Vc::Detail::TrigonometricImplementation<\n    Vc::CurrentImplementation::current()>>::atan2(const Vc::float_v &y,\n                                                  const Vc::float_v &x)\n{\n    using V = Vc::float_v;\n    typedef Const<float, V::abi> C;\n    typedef V::Mask M;\n\n    const M xZero = x == V::Zero();\n    const M yZero = y == V::Zero();\n    const M xMinusZero = xZero && isnegative(x);\n    const M yNeg = y < V::Zero();\n    const M xInf = !isfinite(x);\n    const M yInf = !isfinite(y);\n\n    V a = copysign(C::_pi(), y);\n    a.setZero(x >= V::Zero());\n\n    // setting x to any finite value will have atan(y/x) return sign(y/x)*pi/2, just in case x is inf\n    V _x = x;\n    _x(yInf) = copysign(V::One(), x);\n\n    a += atan(y / _x);\n\n    // if x is +0 and y is +/-0 the result is +0\n    a.setZero(xZero && yZero);\n\n    // for x = -0 we add/subtract pi to get the correct result\n    a(xMinusZero) += copysign(C::_pi(), y);\n\n    // atan2(-Y, +/-0) = -pi/2\n    a(xZero && yNeg) = -C::_pi_2();\n\n    // if both inputs are inf the output is +/- (3)pi/4\n    a(xInf && yInf) += copysign(C::_pi_4(), x ^ ~y);\n\n    // correct the sign of y if the result is 0\n    a(a == V::Zero()) = copysign(a, y);\n\n    // any NaN input will lead to NaN output\n    a.setQnan(isnan(y) || isnan(x));\n\n    return a;\n}\ntemplate<> template<> Vc::double_v Trigonometric<Vc::Detail::TrigonometricImplementation<Vc::CurrentImplementation::current()>>::atan2 (const Vc::double_v &y, const Vc::double_v &x) {\n    typedef Vc::double_v V;\n    typedef Const<double, V::abi> C;\n    typedef V::Mask M;\n\n    const M xZero = x == V::Zero();\n    const M yZero = y == V::Zero();\n    const M xMinusZero = xZero && isnegative(x);\n    const M yNeg = y < V::Zero();\n    const M xInf = !isfinite(x);\n    const M yInf = !isfinite(y);\n\n    V a = copysign(V(C::_pi()), y);\n    a.setZero(x >= V::Zero());\n\n    // setting x to any finite value will have atan(y/x) return sign(y/x)*pi/2, just in case x is inf\n    V _x = x;\n    _x(yInf) = copysign(V::One(), x);\n\n    a += atan(y / _x);\n\n    // if x is +0 and y is +/-0 the result is +0\n    a.setZero(xZero && yZero);\n\n    // for x = -0 we add/subtract pi to get the correct result\n    a(xMinusZero) += copysign(C::_pi(), y);\n\n    // atan2(-Y, +/-0) = -pi/2\n    a(xZero && yNeg) = -C::_pi_2();\n\n    // if both inputs are inf the output is +/- (3)pi/4\n    a(xInf && yInf) += copysign(C::_pi_4(), x ^ ~y);\n\n    // correct the sign of y if the result is 0\n    a(a == V::Zero()) = copysign(a, y);\n\n    // any NaN input will lead to NaN output\n    a.setQnan(isnan(y) || isnan(x));\n\n    return a;\n}\n\n}\n}\n\n#endif\n"
  },
  {
    "path": "3rdparty/toluapp/.gitignore",
    "content": "build/\n\n# ignore generated Makefile; keep stub\nMakefile\n"
  },
  {
    "path": "3rdparty/toluapp/.travis.yml",
    "content": "language: cpp\ncache: ccache\ndist: xenial\nmatrix:\n  include:\n    - os: linux\n      addons:\n        apt:\n          sources:\n            - ubuntu-toolchain-r-test\n          packages:\n            - g++-5\n            - liblua5.3-dev\n      env:\n         - MATRIX_EVAL=\"CC=gcc-5 && CXX=g++-5\"\n    - os: linux\n      addons:\n        apt:\n          sources:\n            - ubuntu-toolchain-r-test\n          packages:\n            - g++-6\n            - liblua5.3-dev\n      env:\n        - MATRIX_EVAL=\"CC=gcc-6 && CXX=g++-6\"\n    - os: linux\n      addons:\n        apt:\n          sources:\n            - ubuntu-toolchain-r-test\n          packages:\n            - g++-7\n            - liblua5.3-dev\n      env:\n        - MATRIX_EVAL=\"CC=gcc-7 && CXX=g++-7\"\n    - os: linux\n      addons:\n        apt:\n          sources:\n            - ubuntu-toolchain-r-test\n          packages:\n            - g++-8\n            - liblua5.3-dev\n      env:\n        - MATRIX_EVAL=\"CC=gcc-8 && CXX=g++-8\"\n    - os: linux\n      addons:\n        apt:\n          sources:\n            - llvm-toolchain-xenial-6.0\n          packages:\n            - clang-6.0\n            - liblua5.3-dev\n      env:\n        - MATRIX_EVAL=\"CC=clang-6.0 && CXX=clang++-6.0\"\n    - os: linux\n      addons:\n        apt:\n          sources:\n            - llvm-toolchain-xenial-7\n          packages:\n            - clang-7\n            - liblua5.3-dev\n      env:\n        - MATRIX_EVAL=\"CC=clang-7 && CXX=clang++-7\"\n    - os: osx\n      osx_image: xcode9.4\n    - os: osx\n      osx_image: xcode10\n    - os: osx\n      osx_image: xcode10.1\n\nbefore_install:\n    - |\n     if [[ \"$TRAVIS_OS_NAME\" == \"osx\" ]]; then\n       HOMEBREW_NO_AUTO_UPDATE=1 brew install lua ccache;\n       export PATH=\"/usr/local/opt/ccache/libexec:$PATH\";\n     fi\n    - eval \"${MATRIX_EVAL}\"\n    # Combine global build options with OS/compiler-dependent options\n    - export CMAKE_OPTIONS=\"${CMAKE_OPTIONS} ${ENV_CMAKE_OPTIONS} -DCMAKE_CXX_COMPILER_LAUNCHER=ccache\"\n    - export CXX_FLAGS=\"${CXX_FLAGS} ${ENV_CXX_FLAGS} -Wall -Werror -Wextra -Wunused -pedantic\"\n    - export C_FLAGS=\"${C_FLAGS} ${ENV_C_FLAGS} -Wall -Werror -Wextra -Wunused -pedantic -std=c99\"\n\ninstall:\n    - echo ${PATH}\n    - echo ${CXX}\n    - ${CXX} --version\n    - ${CXX} -v\n\nscript:\n     - mkdir -p build\n     - cd build\n     - cmake ${CMAKE_OPTIONS} -DCMAKE_C_FLAGS=${C_FLAGS} -DCMAKE_CXX_FLAGS=${CXX_FLAGS} ..\n     - make -j4\n\n# Only watch the master branch\nbranches:\n  only:\n    - master\n"
  },
  {
    "path": "3rdparty/toluapp/CMakeLists.txt",
    "content": "# Copyright (C) 2007-2012 LuaDist.\n# Created by Peter Kapec\n# Redistribution and use of this file is allowed according to the terms of the MIT license.\n# For details see the COPYRIGHT file distributed with LuaDist.\n# Please note that the package source code is licensed under its own license.\n\nproject ( toluapp C )\ncmake_minimum_required ( VERSION 3.15 )\n# Disable dist stuff, we're not installing this as a lib\n# include ( cmake/dist.cmake )\n\ninclude(FindPkgConfig)\ninclude(FindLua)\ninclude_directories ( include src/lib ${LUA_INCLUDE_DIR} )\n\n# Build lib\nfile ( GLOB SRC_LIBTOLUAPP src/lib/*.c )\nif ( MSVC )\n  set ( DEF_FILE libtoluapp.def )\nendif ( )\n\n# add_library ( toluapp_lib SHARED ${SRC_LIBTOLUAPP} ${DEF_FILE} )\nadd_library ( toluapp_lib_static STATIC ${SRC_LIBTOLUAPP} ${DEF_FILE} )\ntarget_link_libraries ( toluapp_lib_static ${LUA_LIBRARIES} )\nset_target_properties ( toluapp_lib_static PROPERTIES COMPILE_FLAGS -fPIC) # -fPIC required for static linking\nset_target_properties ( toluapp_lib_static PROPERTIES OUTPUT_NAME toluapp CLEAN_DIRECT_OUTPUT\n  1 )\n\n# Build app\ninclude_directories ( src/bin )\nset ( SRC_TOLUA src/bin/tolua.c src/bin/toluabind.c )\nadd_executable ( toluapp ${SRC_TOLUA} )\ntarget_link_libraries ( toluapp toluapp_lib_static ${LUA_LIBRARIES} )\n\n# Disable installation, we don't need these at runtime for Conky\n# Install\n#install_library ( toluapp_lib )\n#install_executable ( toluapp )\n#install_header ( include/ )\n#install_data ( README INSTALL )\n#install_doc ( doc/ )\n"
  },
  {
    "path": "3rdparty/toluapp/COPYRIGHT",
    "content": "tolua++ License\n---------------\n\ntolua++ is based on toLua (www.tecgraf.puc-rio.br/~celes/tolua), and\nit's licensed under the terms of the MIT license reproduced below.\nThis means that Lua is free software and can be used for both academic\nand commercial purposes at absolutely no cost.\n\n===============================================================================\n\nCopyright (C) 2009 Ariel Manzur.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n===============================================================================\n\n(end of COPYRIGHT)\n"
  },
  {
    "path": "3rdparty/toluapp/INSTALL",
    "content": "This version of tolua++ uses SCons to compile (http://www.scons.org). SCons uses\npythin. If you don't want to install python, check \"Installation without scons\"\nbelow.\n\n* Installation\n\n\t1. Edit the \"config\" file for your platform to suit your environment,\n\t   if at all necessary (for cygwin, mingw, BSD and mac OSX use\n\t   'config_posix')\n\t2. Then, type \"scons\".\n\t\n  You can use 'scons -h' to see a list of available command line options.\n\n* What you get\n\n  If \"scons\" succeeds, you get:\n\t* an executable to generate binding code in ./bin;\n\t* the C library to be linked in your application in ./lib;\n\t* the include file needed to compile your application in ./include.\n  These are the only directories you need for development, besides Lua.\n\n  You can use 'scons install' to install the files, see the 'prefix' option.\n\n* Installation without scons\n\n  The instructions for building tolua++ without scons depend on the particular\n  compiler you are using.\n  The simplest way is to create a folder with all .c and .h files except\n  'toluabind_default.c', and then create a project for the executable and the\n  library, as follows:\n\n  tolua.exe: all *.c *.h in src/bin (except toluabind_default.c)\n  tolua.lib: all *.c *.h in src/lib.\n\n* Installation with Microsoft Visual Studio\n\n  The directory 'win32' contains project files for Microsoft Visual Studio 7\n  (contributed by Makoto Hamanaka). The project has 4 different build options:\n  withLua50_Release, withLua51_Release, withLua50_Debug and withLua51_Debug.\n  They all expect the lua library names used by the LuaBinaries packages\n  (http://luabinaries.luaforge.net/). The resulting files are built on /lib and\n  /bin (for the library and tolua++.exe).\n"
  },
  {
    "path": "3rdparty/toluapp/README-5.1",
    "content": "Compiling for lua 5.1\n---------------------\n\nStarting from version 1.0.8pre1, tolua++ can be compiled with both lua 5.0 and\n5.1. Both versions will output the same code, and the C API (tolua++.h) is the\nsame.\n\nThe build system is not yet ready to detect/decide when to compile for 5.1,\nthe easiest way right now is to add a file called 'custom.py' on the root of\nthe package, with the following:\n\n## BEGIN custom.py\n\nCCFLAGS = ['-I/usr/local/include/lua5.1', '-O2', '-ansi']\nLIBPATH = ['/usr/local/lib']\nLIBS = ['lua5.1', 'dl', 'm']\ntolua_bin = 'tolua++5.1'\ntolua_lib = 'tolua++5.1'\nTOLUAPP = 'tolua++5.1'\n\n## END custom.py\n\nThis will build the binary as 'tolua++5.1' and the library as 'libtolua++5.1.a'\n(taken from tolua_bin and tolua_lib), and take the lua headers and libraries\nfrom /usr/local/include/lua5.1 and /usr/local/lib. It will also link with\n'-llua5.1'. Modify the parameters acording to your system.\n\nCompatibility\n-------------\n\nThere are a couple of things to keep in mind when running code inside tolua\nusing the -L option:\n\n* `...' and arg: you can still use 'arg' on 5.1, this is done automatically by\nadding the 'arg' declaration to functions on files loaded with dofile.\n\nFor example, the line:\n\nfunction foo( ... )\n\nbecomes\n\nfunction foo( ... ) local arg = {n=select('#', ...), ...};\n\nThis lets you use the same code on both versions without having to make any\nmodifications.\n\n* keep in mind that there are slight differences on the way string.gsub works,\nand the original version of the function is always kept, so it will behave\ndiffently depending on which version of lua you're using.\n"
  },
  {
    "path": "3rdparty/toluapp/README.md",
    "content": "[![Build Status](https://travis-ci.org/brndnmtthws/toluapp.svg?branch=master)](https://travis-ci.org/brndnmtthws/toluapp)\n\n# tolua++\n\n## What is tolua++?\n\ntolua++ is an extension of toLua, a tool to integrate C/C++ code with\nLua. tolua++ includes new features oriented to c++, such as class\ntemplates.\n\ntolua is a tool that greatly simplifies the integration of C/C++ code\nwith Lua. Based on a \"cleaned\" header file, tolua automatically generates\nthe binding code to access C/C++ features from Lua. Using Lua-5.0 API and\nmetamethod facilities, the current version automatically maps C/C++\nconstants, external variables, functions, namespace, classes, and methods\nto Lua. It also provides facilities to create Lua modules.\n\n## Availability\n\ntolua++ is freely available for both academic and commercial purposes.\nSee COPYRIGHT for details.\n\ntolua++ can be downloaded from the sites below:\nhttp://www.codenix.com/~tolua/\n\n## Installation\n\nSee INSTALL.\n\nContacting the author\ntolua has been designed and implemented by Waldemar Celes.\ntolua++ is maintained by Ariel Manzur.\nSend your comments, bug reports and anything else to\ntolua@codenix.com\n"
  },
  {
    "path": "3rdparty/toluapp/SConstruct",
    "content": "import sys;\nimport os\n\ntools = ['default']\nif os.name == 'nt':\n\ttools = ['mingw']\n\nenv = Environment(tools = tools)\n\noptions_file = None\nif sys.platform == 'linux2':\n\toptions_file = \"linux\"\n\nelif 'msvc' in env['TOOLS']:\n\toptions_file = \"msvc\"\nelse:\n\toptions_file = \"posix\"\n\nopts = Options([\"config_\"+options_file+\".py\", \"custom.py\", \"custom_\"+options_file+\".py\"], ARGUMENTS)\nopts.Add('CC', 'The C compiler.')\nopts.Add('CXX', 'The C++ compiler (for the tests)')\nopts.Add('CCFLAGS', 'Flags for the compiler.', ['-O2', '-Wall'])\nopts.Add('LINK', 'The linker.')\nopts.Add('LINKFLAGS', 'Linker flags.', [])\nopts.Add('no_cygwin', 'Use -mno-cygwin to build using the mingw compiler on cygwin', 0)\nopts.Add('LIBS', 'libraries', [])\nopts.Add('LIBPATH', 'library path', [])\n\nopts.Add('tolua_bin', 'the resulting binary', 'tolua++')\nopts.Add('tolua_lib', 'the resulting library', 'tolua++')\nopts.Add('TOLUAPP', 'the name of the tolua++ binary (to use with built_dev=1)', 'tolua++')\n\nopts.Add('prefix', 'The installation prefix')\nopts.Add('build_dev', 'Build for development (uses tolua to rebuild toluabind.c with the embeded scripts', 0)\nopts.Add('build_failsafe', \"Build using 'factory default' toluabind file (in case build_dev fails)\", 0)\nopts.Add('ENV', 'The environment variables')\nopts.Add('shared', 'Build a shared object', False)\nopts.Update(env)\nHelp(opts.GenerateHelpText(env))\n\ndef save_config(target, source, env):\n\topts.Save('custom.py', env)\n\ncust = env.Command('custom.py', [], save_config)\nenv.Alias('configure', [cust])\n\nenv['TOLUAPP_BOOTSTRAP'] = env['tolua_bin']+\"_bootstrap\"+env['PROGSUFFIX']\n\nenv['build_dev'] = int(env['build_dev'])\n\n## detecting the install directory on win32\nif 'msvc' in env['TOOLS'] and not (env.has_key('prefix') or env['prefix']):\n\n\tif env['MSVS'].has_key('PLATFORMSDKDIR'):\n\t\tenv['prefix'] = env['MSVS']['PLATFORMSDKDIR']\n\n\nSConscriptChdir(0)\n\n############ helper builders\ndef pkg_scan_dep(self, target, source):\n\n\timport re\n\n\t## TODO: detectar si el archivo existe antes de abrirlo asi nomas\n\tpkg = open(source, \"rt\")\n\n\tfor linea in pkg.xreadlines():\n\t\tdep = re.search(\"^[\\t\\w]*\\$[cphl]file\\s*\\\"([^\\\"]+)\\\"\", linea)\n\t\tif dep:\n\t\t\tself.Depends(target, '#' + dep.groups()[0]);\n\n\t\t\tif dep.groups()[0][-4:] == '.pkg':\n\t\t\t\t# recursividad\n\t\t\t\tself.pkg_scan_dep(target, dep.groups()[0])\n\n\ndef make_tolua_code(self, target, source, pkgname = None, bootstrap = False, use_own = False, use_typeid=None):\n\n\tptarget = Dir('.').path + '/' + target\n\tpsource = Dir('.').path + '/' + source\n\theader = target[:-2] + '.h'\n\tpheader = Dir('.').path + '/' + header\n\n\tprint(\"Generating \", target, \" from \", source)\n\n\ttolua = \"\"\n\tif bootstrap:\n\t\tif os.name == 'nt':\n\t\t\ttolua = 'bin\\\\'+self['TOLUAPP_BOOTSTRAP']\n\t\telse:\n\t\t\ttolua = 'bin/'+self['TOLUAPP_BOOTSTRAP']\n\t\tprint(\"********* tolua is \", tolua)\n\telse:\n\t\tif use_own:\n\t\t\tif 'msvc' in self['TOOLS']:\n\t\t\t\ttolua = 'bin\\\\$tolua_bin'\n\t\t\telse:\n\t\t\t\ttolua = 'bin/$tolua_bin'\n\t\telse:\n\t\t\ttolua = \"$TOLUAPP\"\n\n\tif pkgname:\n\t\tpkgname = ' -n '+pkgname\n\telse:\n\t\tpkgname = ''\n\n\tif use_typeid:\n\t\ttolua = tolua+' -t'\n\n\tcomando = tolua + ' -C -H ' + pheader + ' -o ' + ptarget + pkgname + ' ' + psource\n\tcommand = self.Command(target, source, comando)\n\n\tself.SideEffect(header, target)\n\tself.Depends(target, source)\n\n\tself.pkg_scan_dep(target, psource)\n\n\tif bootstrap:\n\t\tself.Depends(target, \"#/bin/$TOLUAPP_BOOTSTRAP\")\n\tif use_own:\n\t\tself.Depends(target, \"#/bin/$tolua_bin\")\n\t\n\treturn command\n\n\nenv.__class__.LuaBinding = make_tolua_code;\nenv.__class__.pkg_scan_dep = pkg_scan_dep;\n\ndef print_install_error(target, source, env):\n\n\tmsg = \"\"\"Error: no install prefix was specified, or detected.\n\nyou can use the 'prefix' option on command line to specify one. Examples:\n\n\tscons prefix=/usr/local install\n\nor on Windows:\n\n\tscons \"prefix=c:\\\\program files\\\\visual basic\" install\n\nFiles will be installed on <prefix>/bin, <prefix>/lib and <prefix>/include\n\"\"\"\n\timport SCons.Errors\n\traise SCons.Errors.UserError(msg)\n\n########### end of helper builders\n\nenv['CPPPATH'] = '#/include'\nenv['LIBPATH'] =  ['#/lib'] + env['LIBPATH']\n\nif env['no_cygwin']:\n\n\tenv['CCFLAGS'] += ['-mno-cygwin']\n\tenv['LINKFLAGS'] += ['-mno-cygwin']\n\nimport string\n\nExport('env')\n\nSConscript('src/lib/SCsub')\nSConscript('src/bin/SCsub')\n#SConscript('src/lib/SCsub')\nSConscript('src/tests/SCsub')\n\nenv.Alias('all', [env.bin_target, env.lib_target])\nenv.Alias('test', env.test_targets)\n\nDefault('all')\n\nif env['prefix']:\n\tenv.Install(env['prefix']+'/bin', env.bin_target)\n\tenv.Install(env['prefix']+'/lib', env.lib_target)\n\tenv.Install(env['prefix']+'/include', '#include/tolua++.h')\n\n\tenv.Alias('install', [env['prefix']+'/bin', env['prefix']+'/include', env['prefix']+'/lib'])\nelse:\n\tenv.Command('install', [], print_install_error)\n\tenv.Depends('install', 'all')\n\nenv.Command('deb', [], 'dpkg-buildpackage -I.svn -Icustom.py -Itoluabind_dev.c -Itoluabind_dev.h -Itoluabind_default.o -Icustom.lua -I.sconsign', ENV=os.environ)\n\n"
  },
  {
    "path": "3rdparty/toluapp/cmake/dist.cmake",
    "content": "# LuaDist CMake utility library.\n# Provides sane project defaults and macros common to LuaDist CMake builds.\n# \n# Copyright (C) 2007-2012 LuaDist.\n# by David Manura, Peter Drahoš\n# Redistribution and use of this file is allowed according to the terms of the MIT license.\n# For details see the COPYRIGHT file distributed with LuaDist.\n# Please note that the package source code is licensed under its own license.\n\n## Extract information from dist.info\nif ( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/dist.info )\n  message ( FATAL_ERROR\n    \"Missing dist.info file (${CMAKE_CURRENT_SOURCE_DIR}/dist.info).\" )\nendif ()\nfile ( READ ${CMAKE_CURRENT_SOURCE_DIR}/dist.info DIST_INFO )\nif ( \"${DIST_INFO}\" STREQUAL \"\" )\n  message ( FATAL_ERROR \"Failed to load dist.info.\" )\nendif ()\n# Reads field `name` from dist.info string `DIST_INFO` into variable `var`.\nmacro ( _parse_dist_field name var )\n  string ( REGEX REPLACE \".*${name}[ \\t]?=[ \\t]?[\\\"']([^\\\"']+)[\\\"'].*\" \"\\\\1\"\n           ${var} \"${DIST_INFO}\" )\n  if ( ${var} STREQUAL DIST_INFO )\n    message ( FATAL_ERROR \"Failed to extract \\\"${var}\\\" from dist.info\" )\n  endif ()\nendmacro ()\n#\n_parse_dist_field ( name DIST_NAME )\n_parse_dist_field ( version DIST_VERSION )\n_parse_dist_field ( license DIST_LICENSE )\n_parse_dist_field ( author DIST_AUTHOR )\n_parse_dist_field ( maintainer DIST_MAINTAINER )\n_parse_dist_field ( url DIST_URL )\n_parse_dist_field ( desc DIST_DESC )\nmessage ( \"DIST_NAME: ${DIST_NAME}\")\nmessage ( \"DIST_VERSION: ${DIST_VERSION}\")\nmessage ( \"DIST_LICENSE: ${DIST_LICENSE}\")\nmessage ( \"DIST_AUTHOR: ${DIST_AUTHOR}\")\nmessage ( \"DIST_MAINTAINER: ${DIST_MAINTAINER}\")\nmessage ( \"DIST_URL: ${DIST_URL}\")\nmessage ( \"DIST_DESC: ${DIST_DESC}\")\nstring ( REGEX REPLACE \".*depends[ \\t]?=[ \\t]?[\\\"']([^\\\"']+)[\\\"'].*\" \"\\\\1\"\n         DIST_DEPENDS ${DIST_INFO} )\nif ( DIST_DEPENDS STREQUAL DIST_INFO )\n  set ( DIST_DEPENDS \"\" )\nendif ()\nmessage ( \"DIST_DEPENDS: ${DIST_DEPENDS}\")\n## 2DO: Parse DIST_DEPENDS and try to install Dependencies with automatically using externalproject_add\n\n\n## INSTALL DEFAULTS (Relative to CMAKE_INSTALL_PREFIX)\n# Primary paths\nset ( INSTALL_BIN bin CACHE PATH \"Where to install binaries to.\" )\nset ( INSTALL_LIB lib CACHE PATH \"Where to install libraries to.\" )\nset ( INSTALL_INC include CACHE PATH \"Where to install headers to.\" )\nset ( INSTALL_ETC etc CACHE PATH \"Where to store configuration files\" )\nset ( INSTALL_SHARE share CACHE PATH \"Directory for shared data.\" )\n\n# Secondary paths\noption ( INSTALL_VERSION\n      \"Install runtime libraries and executables with version information.\" OFF)\nset ( INSTALL_DATA ${INSTALL_SHARE}/${DIST_NAME} CACHE PATH\n      \"Directory the package can store documentation, tests or other data in.\")  \nset ( INSTALL_DOC  ${INSTALL_DATA}/doc CACHE PATH\n      \"Recommended directory to install documentation into.\")\nset ( INSTALL_EXAMPLE ${INSTALL_DATA}/example CACHE PATH\n      \"Recommended directory to install examples into.\")\nset ( INSTALL_TEST ${INSTALL_DATA}/test CACHE PATH\n      \"Recommended directory to install tests into.\")\nset ( INSTALL_FOO  ${INSTALL_DATA}/etc CACHE PATH\n      \"Where to install additional files\")\n\n# Tweaks and other defaults\n# Setting CMAKE to use loose block and search for find modules in source directory\nset ( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )\nset ( CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/cmake\" ${CMAKE_MODULE_PATH} )\noption ( BUILD_SHARED_LIBS \"Build shared libraries\" ON )\n\n# In MSVC, prevent warnings that can occur when using standard libraries.\nif ( MSVC )\n  add_definitions ( -D_CRT_SECURE_NO_WARNINGS )\nendif ()\n\n## MACROS\n# Parser macro\nmacro ( parse_arguments prefix arg_names option_names)\n  set ( DEFAULT_ARGS )\n  foreach ( arg_name ${arg_names} )\n    set ( ${prefix}_${arg_name} )\n  endforeach ()\n  foreach ( option ${option_names} )\n    set ( ${prefix}_${option} FALSE )\n  endforeach ()\n\n  set ( current_arg_name DEFAULT_ARGS )\n  set ( current_arg_list )\n  foreach ( arg ${ARGN} )            \n    set ( larg_names ${arg_names} )    \n    list ( FIND larg_names \"${arg}\" is_arg_name )                   \n    if ( is_arg_name GREATER -1 )\n      set ( ${prefix}_${current_arg_name} ${current_arg_list} )\n      set ( current_arg_name ${arg} )\n      set ( current_arg_list )\n    else ()\n      set ( loption_names ${option_names} )    \n      list ( FIND loption_names \"${arg}\" is_option )            \n      if ( is_option GREATER -1 )\n        set ( ${prefix}_${arg} TRUE )\n      else ()\n        set ( current_arg_list ${current_arg_list} ${arg} )\n      endif ()\n    endif ()\n  endforeach ()\n  set ( ${prefix}_${current_arg_name} ${current_arg_list} )\nendmacro ()\n\n\n# install_executable ( executable_targets )\n# Installs any executables generated using \"add_executable\".\n# USE: install_executable ( lua )\n# NOTE: subdirectories are NOT supported\nset ( CPACK_COMPONENT_RUNTIME_DISPLAY_NAME \"${DIST_NAME} Runtime\" )\nset ( CPACK_COMPONENT_RUNTIME_DESCRIPTION\n      \"Executables and runtime libraries. Installed into ${INSTALL_BIN}.\" )\nmacro ( install_executable )\n  foreach ( _file ${ARGN} )\n    if ( INSTALL_VERSION )\n      set_target_properties ( ${_file} PROPERTIES VERSION ${DIST_VERSION}\n                              SOVERSION ${DIST_VERSION} )\n    endif ()\n    install ( TARGETS ${_file} RUNTIME DESTINATION ${INSTALL_BIN}\n              COMPONENT Runtime )\n  endforeach()\nendmacro ()\n\n# install_library ( library_targets )\n# Installs any libraries generated using \"add_library\" into apropriate places.\n# USE: install_library ( libexpat )\n# NOTE: subdirectories are NOT supported\nset ( CPACK_COMPONENT_LIBRARY_DISPLAY_NAME \"${DIST_NAME} Development Libraries\" )\nset ( CPACK_COMPONENT_LIBRARY_DESCRIPTION\n  \"Static and import libraries needed for development. Installed into ${INSTALL_LIB} or ${INSTALL_BIN}.\" )\nmacro ( install_library )\n  foreach ( _file ${ARGN} )\n    if ( INSTALL_VERSION )\n      set_target_properties ( ${_file} PROPERTIES VERSION ${DIST_VERSION}\n                              SOVERSION ${DIST_VERSION} )\n    endif ()\n    install ( TARGETS ${_file}\n              RUNTIME DESTINATION ${INSTALL_BIN} COMPONENT Runtime\n              LIBRARY DESTINATION ${INSTALL_LIB} COMPONENT Runtime \n              ARCHIVE DESTINATION ${INSTALL_LIB} COMPONENT Library )\n  endforeach()\nendmacro ()\n\n# helper function for various install_* functions, for PATTERN/REGEX args.\nmacro ( _complete_install_args )\n  if ( NOT(\"${_ARG_PATTERN}\" STREQUAL \"\") )\n    set ( _ARG_PATTERN PATTERN ${_ARG_PATTERN} )\n  endif ()\n  if ( NOT(\"${_ARG_REGEX}\" STREQUAL \"\") )\n    set ( _ARG_REGEX REGEX ${_ARG_REGEX} )\n  endif ()\nendmacro ()\n\n# install_header ( files/directories [INTO destination] )\n# Install a directories or files into header destination.\n# USE: install_header ( lua.h luaconf.h ) or install_header ( GL )\n# USE: install_header ( mylib.h INTO mylib )\n# For directories, supports optional PATTERN/REGEX arguments like install().\nset ( CPACK_COMPONENT_HEADER_DISPLAY_NAME \"${DIST_NAME} Development Headers\" )\nset ( CPACK_COMPONENT_HEADER_DESCRIPTION\n      \"Headers needed for development. Installed into ${INSTALL_INC}.\" )\nmacro ( install_header )\n  parse_arguments ( _ARG \"INTO;PATTERN;REGEX\" \"\" ${ARGN} )\n  _complete_install_args()\n  foreach ( _file ${_ARG_DEFAULT_ARGS} )\n    if ( IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/${_file}\" )\n      install ( DIRECTORY ${_file} DESTINATION ${INSTALL_INC}/${_ARG_INTO}\n                COMPONENT Header ${_ARG_PATTERN} ${_ARG_REGEX} )\n    else ()\n      install ( FILES ${_file} DESTINATION ${INSTALL_INC}/${_ARG_INTO}\n                COMPONENT Header )\n    endif ()\n  endforeach()\nendmacro ()\n\n# install_data ( files/directories [INTO destination] )\n# This installs additional data files or directories.\n# USE: install_data ( extra data.dat )\n# USE: install_data ( image1.png image2.png INTO images )\n# For directories, supports optional PATTERN/REGEX arguments like install().\nset ( CPACK_COMPONENT_DATA_DISPLAY_NAME \"${DIST_NAME} Data\" )\nset ( CPACK_COMPONENT_DATA_DESCRIPTION\n      \"Application data. Installed into ${INSTALL_DATA}.\" )\nmacro ( install_data )\n  parse_arguments ( _ARG \"INTO;PATTERN;REGEX\" \"\" ${ARGN} )\n  _complete_install_args()\n  foreach ( _file ${_ARG_DEFAULT_ARGS} )\n    if ( IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/${_file}\" )\n      install ( DIRECTORY ${_file}\n                DESTINATION ${INSTALL_DATA}/${_ARG_INTO}\n                COMPONENT Data ${_ARG_PATTERN} ${_ARG_REGEX} )\n    else ()\n      install ( FILES ${_file} DESTINATION ${INSTALL_DATA}/${_ARG_INTO}\n                COMPONENT Data )\n    endif ()\n  endforeach()\nendmacro ()\n\n# INSTALL_DOC ( files/directories [INTO destination] )\n# This installs documentation content\n# USE: install_doc ( doc/ doc.pdf )\n# USE: install_doc ( index.html INTO html )\n# For directories, supports optional PATTERN/REGEX arguments like install().\nset ( CPACK_COMPONENT_DOCUMENTATION_DISPLAY_NAME \"${DIST_NAME} Documentation\" )\nset ( CPACK_COMPONENT_DOCUMENTATION_DESCRIPTION\n      \"Application documentation. Installed into ${INSTALL_DOC}.\" )\nmacro ( install_doc )\n  parse_arguments ( _ARG \"INTO;PATTERN;REGEX\" \"\" ${ARGN} )\n  _complete_install_args()\n  foreach ( _file ${_ARG_DEFAULT_ARGS} )\n    if ( IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/${_file}\" )\n      install ( DIRECTORY ${_file} DESTINATION ${INSTALL_DOC}/${_ARG_INTO}\n                COMPONENT Documentation ${_ARG_PATTERN} ${_ARG_REGEX} )\n    else ()\n      install ( FILES ${_file} DESTINATION ${INSTALL_DOC}/${_ARG_INTO}\n                COMPONENT Documentation )\n    endif ()\n  endforeach()\nendmacro ()\n\n# install_example ( files/directories [INTO destination]  )\n# This installs additional examples\n# USE: install_example ( examples/ exampleA )\n# USE: install_example ( super_example super_data INTO super)\n# For directories, supports optional PATTERN/REGEX argument like install().\nset ( CPACK_COMPONENT_EXAMPLE_DISPLAY_NAME \"${DIST_NAME} Examples\" )\nset ( CPACK_COMPONENT_EXAMPLE_DESCRIPTION\n    \"Examples and their associated data. Installed into ${INSTALL_EXAMPLE}.\" )\nmacro ( install_example )\n  parse_arguments ( _ARG \"INTO;PATTERN;REGEX\" \"\" ${ARGN} )\n  _complete_install_args()\n  foreach ( _file ${_ARG_DEFAULT_ARGS} )\n    if ( IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/${_file}\" )\n      install ( DIRECTORY ${_file} DESTINATION ${INSTALL_EXAMPLE}/${_ARG_INTO}\n                COMPONENT Example ${_ARG_PATTERN} ${_ARG_REGEX} )\n    else ()\n      install ( FILES ${_file} DESTINATION ${INSTALL_EXAMPLE}/${_ARG_INTO}\n                COMPONENT Example )\n    endif ()\n  endforeach()\nendmacro ()\n\n# install_test ( files/directories [INTO destination] )\n# This installs tests and test files, DOES NOT EXECUTE TESTS\n# USE: install_test ( my_test data.sql )\n# USE: install_test ( feature_x_test INTO x )\n# For directories, supports optional PATTERN/REGEX argument like install().\nset ( CPACK_COMPONENT_TEST_DISPLAY_NAME \"${DIST_NAME} Tests\" )\nset ( CPACK_COMPONENT_TEST_DESCRIPTION\n      \"Tests and associated data. Installed into ${INSTALL_TEST}.\" )\nmacro ( install_test )\n  parse_arguments ( _ARG \"INTO;PATTERN;REGEX\" \"\" ${ARGN} )\n  _complete_install_args()\n  foreach ( _file ${_ARG_DEFAULT_ARGS} )\n    if ( IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/${_file}\" )\n      install ( DIRECTORY ${_file} DESTINATION ${INSTALL_TEST}/${_ARG_INTO}\n                COMPONENT Test ${_ARG_PATTERN} ${_ARG_REGEX} )\n    else ()\n      install ( FILES ${_file} DESTINATION ${INSTALL_TEST}/${_ARG_INTO}\n                COMPONENT Test )\n    endif ()\n  endforeach()\nendmacro ()\n\n# install_foo ( files/directories [INTO destination] )\n# This installs optional or otherwise unneeded content\n# USE: install_foo ( etc/ example.doc )\n# USE: install_foo ( icon.png logo.png INTO icons)\n# For directories, supports optional PATTERN/REGEX argument like install().\nset ( CPACK_COMPONENT_OTHER_DISPLAY_NAME \"${DIST_NAME} Unspecified Content\" )\nset ( CPACK_COMPONENT_OTHER_DESCRIPTION\n      \"Other unspecified content. Installed into ${INSTALL_FOO}.\" )\nmacro ( install_foo )\n  parse_arguments ( _ARG \"INTO;PATTERN;REGEX\" \"\" ${ARGN} )\n  _complete_install_args()\n  foreach ( _file ${_ARG_DEFAULT_ARGS} )\n    if ( IS_DIRECTORY \"${CMAKE_CURRENT_SOURCE_DIR}/${_file}\" )\n      install ( DIRECTORY ${_file} DESTINATION ${INSTALL_FOO}/${_ARG_INTO}\n                COMPONENT Other ${_ARG_PATTERN} ${_ARG_REGEX} )\n    else ()\n      install ( FILES ${_file} DESTINATION ${INSTALL_FOO}/${_ARG_INTO}\n                COMPONENT Other )\n    endif ()\n  endforeach()\nendmacro ()\n\n## CTest defaults\n\n## CPack defaults\nset ( CPACK_GENERATOR \"ZIP\" )\nset ( CPACK_STRIP_FILES TRUE )\nset ( CPACK_PACKAGE_NAME \"${DIST_NAME}\" )\nset ( CPACK_PACKAGE_VERSION \"${DIST_VERSION}\")\nset ( CPACK_PACKAGE_VENDOR \"LuaDist\" )\nset ( CPACK_COMPONENTS_ALL Runtime Library Header Data Documentation Example Other )\ninclude ( CPack )\n"
  },
  {
    "path": "3rdparty/toluapp/cmake/lua.cmake",
    "content": "# LuaDist CMake utility library for Lua.\n# \n# Copyright (C) 2007-2012 LuaDist.\n# by David Manura, Peter Drahos\n# Redistribution and use of this file is allowed according to the terms of the MIT license.\n# For details see the COPYRIGHT file distributed with LuaDist.\n# Please note that the package source code is licensed under its own license.\n\nset ( INSTALL_LMOD ${INSTALL_LIB}/lua\n      CACHE PATH \"Directory to install Lua modules.\" )\nset ( INSTALL_CMOD ${INSTALL_LIB}/lua\n      CACHE PATH \"Directory to install Lua binary modules.\" )\n\noption ( SKIP_LUA_WRAPPER\n         \"Do not build and install Lua executable wrappers.\" OFF)\n\n# List of (Lua module name, file path) pairs.\n# Used internally by add_lua_test.  Built by add_lua_module.\nset ( _lua_modules )\n\n# utility function: appends path `path` to path `basepath`, properly\n# handling cases when `path` may be relative or absolute.\nmacro ( _append_path basepath path result )\n  if ( IS_ABSOLUTE \"${path}\" )\n    set ( ${result} \"${path}\" )\n  else ()\n    set ( ${result} \"${basepath}/${path}\" )\n  endif ()\nendmacro ()\n\n# install_lua_executable ( target source )\n# Automatically generate a binary if srlua package is available\n# The application or its source will be placed into /bin \n# If the application source did not have .lua suffix then it will be added\n# USE: lua_executable ( sputnik src/sputnik.lua )\nmacro ( install_lua_executable _name _source )\n  get_filename_component ( _source_name ${_source} NAME_WE )\n  # Find srlua and glue\n  find_program( SRLUA_EXECUTABLE NAMES srlua )\n  find_program( GLUE_EXECUTABLE NAMES glue )\n  # Executable output\n  set ( _exe ${CMAKE_CURRENT_BINARY_DIR}/${_name}${CMAKE_EXECUTABLE_SUFFIX} )\n  if ( NOT SKIP_LUA_WRAPPER AND SRLUA_EXECUTABLE AND GLUE_EXECUTABLE )\n    # Generate binary gluing the lua code to srlua, this is a robuust approach for most systems\n    add_custom_command(\n      OUTPUT ${_exe}\n      COMMAND ${GLUE_EXECUTABLE} \n      ARGS ${SRLUA_EXECUTABLE} ${_source} ${_exe}\n      DEPENDS ${_source}\n      WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}\n      VERBATIM\n    )\n    # Make sure we have a target associated with the binary\n    add_custom_target(${_name} ALL\n        DEPENDS ${_exe}\n    )\n    # Install with run permissions\n    install ( PROGRAMS ${_exe} DESTINATION ${INSTALL_BIN} COMPONENT Runtime)\n\t# Also install source as optional resurce\n\tinstall ( FILES ${_source} DESTINATION ${INSTALL_FOO} COMPONENT Other )\n  else()\n    # Install into bin as is but without the lua suffix, we assume the executable uses UNIX shebang/hash-bang magic\n    install ( PROGRAMS ${_source} DESTINATION ${INSTALL_BIN}\n            RENAME ${_source_name}\n            COMPONENT Runtime\n    )\n  endif()\nendmacro ()\n\nmacro ( _lua_module_helper is_install _name ) \n  parse_arguments ( _MODULE \"LINK;ALL_IN_ONE\" \"\" ${ARGN} )\n  # _target is CMake-compatible target name for module (e.g. socket_core).\n  # _module is relative path of target (e.g. socket/core),\n  #   without extension (e.g. .lua/.so/.dll).\n  # _MODULE_SRC is list of module source files (e.g. .lua and .c files).\n  # _MODULE_NAMES is list of module names (e.g. socket.core).\n  if ( _MODULE_ALL_IN_ONE )\n    string ( REGEX REPLACE \"\\\\..*\" \"\" _target \"${_name}\" )\n    string ( REGEX REPLACE \"\\\\..*\" \"\" _module \"${_name}\" )\n    set ( _target \"${_target}_all_in_one\")\n    set ( _MODULE_SRC ${_MODULE_ALL_IN_ONE} )\n    set ( _MODULE_NAMES ${_name} ${_MODULE_DEFAULT_ARGS} )\n  else ()\n    string ( REPLACE \".\" \"_\" _target \"${_name}\" )\n    string ( REPLACE \".\" \"/\" _module \"${_name}\" )\n    set ( _MODULE_SRC ${_MODULE_DEFAULT_ARGS} )\n    set ( _MODULE_NAMES ${_name} )\n  endif ()\n  if ( NOT _MODULE_SRC )\n    message ( FATAL_ERROR \"no module sources specified\" )\n  endif ()\n  list ( GET _MODULE_SRC 0 _first_source )\n  \n  get_filename_component ( _ext ${_first_source} EXT )\n  if ( _ext STREQUAL \".lua\" )  # Lua source module\n    list ( LENGTH _MODULE_SRC _len )\n    if ( _len GREATER 1 )\n      message ( FATAL_ERROR \"more than one source file specified\" )\n    endif ()\n  \n    set ( _module \"${_module}.lua\" )\n\n    get_filename_component ( _module_dir ${_module} PATH )\n    get_filename_component ( _module_filename ${_module} NAME )\n    _append_path ( \"${CMAKE_CURRENT_SOURCE_DIR}\" \"${_first_source}\" _module_path )\n    list ( APPEND _lua_modules \"${_name}\" \"${_module_path}\" )\n\n    if ( ${is_install} )\n      install ( FILES ${_first_source} DESTINATION ${INSTALL_LMOD}/${_module_dir}\n                RENAME ${_module_filename} \n                COMPONENT Runtime\n      )\n    endif ()\n  else ()  # Lua C binary module\n    enable_language ( C )\n    find_package ( Lua REQUIRED )\n    include_directories ( ${LUA_INCLUDE_DIR} )\n\n    set ( _module \"${_module}${CMAKE_SHARED_MODULE_SUFFIX}\" )\n\n    get_filename_component ( _module_dir ${_module} PATH )\n    get_filename_component ( _module_filenamebase ${_module} NAME_WE )\n    foreach ( _thisname ${_MODULE_NAMES} )\n      list ( APPEND _lua_modules \"${_thisname}\"\n             \"${CMAKE_CURRENT_BINARY_DIR}/\\${CMAKE_CFG_INTDIR}/${_module}\" )\n    endforeach ()\n   \n    add_library( ${_target} MODULE ${_MODULE_SRC})\n    target_link_libraries ( ${_target} ${LUA_LIBRARY} ${_MODULE_LINK} )\n    set_target_properties ( ${_target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY\n                \"${_module_dir}\" PREFIX \"\" OUTPUT_NAME \"${_module_filenamebase}\" )\n    if ( ${is_install} )\n      install ( TARGETS ${_target} DESTINATION ${INSTALL_CMOD}/${_module_dir} COMPONENT Runtime)\n    endif ()\n  endif ()\nendmacro ()\n\n# add_lua_module\n# Builds a Lua source module into a destination locatable by Lua\n# require syntax.\n# Binary modules are also supported where this function takes sources and\n# libraries to compile separated by LINK keyword.\n# USE: add_lua_module ( socket.http src/http.lua )\n# USE2: add_lua_module ( mime.core src/mime.c )\n# USE3: add_lua_module ( socket.core ${SRC_SOCKET} LINK ${LIB_SOCKET} )\n# USE4: add_lua_module ( ssl.context ssl.core ALL_IN_ONE src/context.c src/ssl.c )\n#   This form builds an \"all-in-one\" module (e.g. ssl.so or ssl.dll containing\n#   both modules ssl.context and ssl.core).  The CMake target name will be\n#   ssl_all_in_one.\n# Also sets variable _module_path (relative path where module typically\n# would be installed).\nmacro ( add_lua_module )\n  _lua_module_helper ( 0 ${ARGN} )\nendmacro ()\n\n\n# install_lua_module\n# This is the same as `add_lua_module` but also installs the module.\n# USE: install_lua_module ( socket.http src/http.lua )\n# USE2: install_lua_module ( mime.core src/mime.c )\n# USE3: install_lua_module ( socket.core ${SRC_SOCKET} LINK ${LIB_SOCKET} )\nmacro ( install_lua_module )\n  _lua_module_helper ( 1 ${ARGN} )\nendmacro ()\n\n# Builds string representing Lua table mapping Lua modules names to file\n# paths.  Used internally.\nmacro ( _make_module_table _outvar )\n  set ( ${_outvar} )\n  list ( LENGTH _lua_modules _n )\n  if ( ${_n} GREATER 0 ) # avoids cmake complaint\n  foreach ( _i RANGE 1 ${_n} 2 )\n    list ( GET _lua_modules ${_i} _path )\n    math ( EXPR _ii ${_i}-1 )\n    list ( GET _lua_modules ${_ii} _name )\n    set ( ${_outvar} \"${_table}  ['${_name}'] = '${_path}'\\;\\n\")\n  endforeach ()\n  endif ()\n  set ( ${_outvar}\n\"local modules = {\n${_table}}\" )\nendmacro ()\n\n# add_lua_test ( _testfile [ WORKING_DIRECTORY _working_dir ] )\n# Runs Lua script `_testfile` under CTest tester.\n# Optional named argument `WORKING_DIRECTORY` is current working directory to\n# run test under (defaults to ${CMAKE_CURRENT_BINARY_DIR}).\n# Both paths, if relative, are relative to ${CMAKE_CURRENT_SOURCE_DIR}.\n# Any modules previously defined with install_lua_module are automatically\n# preloaded (via package.preload) prior to running the test script.\n# Under LuaDist, set test=true in config.lua to enable testing.\n# USE: add_lua_test ( test/test1.lua [args...] [WORKING_DIRECTORY dir])\nmacro ( add_lua_test _testfile )\n  if ( NOT SKIP_TESTING )\n    parse_arguments ( _ARG \"WORKING_DIRECTORY\" \"\" ${ARGN} )\n    include ( CTest )\n    find_program ( LUA NAMES lua lua.bat )\n    get_filename_component ( TESTFILEABS ${_testfile} ABSOLUTE )\n    get_filename_component ( TESTFILENAME ${_testfile} NAME )\n    get_filename_component ( TESTFILEBASE ${_testfile} NAME_WE )\n\n    # Write wrapper script.\n    # Note: One simple way to allow the script to find modules is\n    # to just put them in package.preload.\n    set ( TESTWRAPPER ${CMAKE_CURRENT_BINARY_DIR}/${TESTFILENAME} )\n    _make_module_table ( _table )\n    set ( TESTWRAPPERSOURCE\n\"local CMAKE_CFG_INTDIR = ... or '.'\n${_table}\nlocal function preload_modules(modules)\n  for name, path in pairs(modules) do\n    if path:match'%.lua' then\n      package.preload[name] = assert(loadfile(path))\n    else\n      local name = name:gsub('.*%-', '') -- remove any hyphen prefix\n      local symbol = 'luaopen_' .. name:gsub('%.', '_')\n          --improve: generalize to support all-in-one loader?\n      local path = path:gsub('%$%{CMAKE_CFG_INTDIR%}', CMAKE_CFG_INTDIR)\n      package.preload[name] = assert(package.loadlib(path, symbol))\n    end\n  end\nend\npreload_modules(modules)\narg[0] = '${TESTFILEABS}'\ntable.remove(arg, 1)\nreturn assert(loadfile '${TESTFILEABS}')(unpack(arg))\n\"    )\n    if ( _ARG_WORKING_DIRECTORY )\n      get_filename_component (\n         TESTCURRENTDIRABS ${_ARG_WORKING_DIRECTORY} ABSOLUTE )\n      # note: CMake 2.6 (unlike 2.8) lacks WORKING_DIRECTORY parameter.\n      set ( _pre ${CMAKE_COMMAND} -E chdir \"${TESTCURRENTDIRABS}\" )\n    endif ()\n    file ( WRITE ${TESTWRAPPER} ${TESTWRAPPERSOURCE})\n    add_test ( NAME ${TESTFILEBASE} COMMAND ${_pre} ${LUA}\n               ${TESTWRAPPER} \"${CMAKE_CFG_INTDIR}\"\n               ${_ARG_DEFAULT_ARGS} )\n  endif ()\n  # see also http://gdcm.svn.sourceforge.net/viewvc/gdcm/Sandbox/CMakeModules/UsePythonTest.cmake\n  # Note: ${CMAKE_CFG_INTDIR} is a command-line argument to allow proper\n  # expansion by the native build tool.\nendmacro ()\n\n\n# Converts Lua source file `_source` to binary string embedded in C source\n# file `_target`.  Optionally compiles Lua source to byte code (not available\n# under LuaJIT2, which doesn't have a bytecode loader).  Additionally, Lua\n# versions of bin2c [1] and luac [2] may be passed respectively as additional\n# arguments.\n#\n# [1] http://lua-users.org/wiki/BinToCee\n# [2] http://lua-users.org/wiki/LuaCompilerInLua\nfunction ( add_lua_bin2c _target _source )\n  find_program ( LUA NAMES lua lua.bat )\n  execute_process ( COMMAND ${LUA} -e \"string.dump(function()end)\"\n                    RESULT_VARIABLE _LUA_DUMP_RESULT ERROR_QUIET )\n  if ( NOT ${_LUA_DUMP_RESULT} )\n    SET ( HAVE_LUA_DUMP true )\n  endif ()\n  message ( \"-- string.dump=${HAVE_LUA_DUMP}\" )\n\n  if ( ARGV2 )\n    get_filename_component ( BIN2C ${ARGV2} ABSOLUTE )\n    set ( BIN2C ${LUA} ${BIN2C} )\n  else ()\n    find_program ( BIN2C NAMES bin2c bin2c.bat )\n  endif ()\n  if ( HAVE_LUA_DUMP )\n    if ( ARGV3 )\n      get_filename_component ( LUAC ${ARGV3} ABSOLUTE )\n      set ( LUAC ${LUA} ${LUAC} )\n    else ()\n      find_program ( LUAC NAMES luac luac.bat )\n    endif ()\n  endif ( HAVE_LUA_DUMP )\n  message ( \"-- bin2c=${BIN2C}\" )\n  message ( \"-- luac=${LUAC}\" )\n\n  get_filename_component ( SOURCEABS ${_source} ABSOLUTE )\n  if ( HAVE_LUA_DUMP )\n    get_filename_component ( SOURCEBASE ${_source} NAME_WE )\n    add_custom_command (\n      OUTPUT  ${_target} DEPENDS ${_source}\n      COMMAND ${LUAC} -o ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo\n              ${SOURCEABS}\n      COMMAND ${BIN2C} ${CMAKE_CURRENT_BINARY_DIR}/${SOURCEBASE}.lo\n              \">${_target}\" )\n  else ()\n    add_custom_command (\n      OUTPUT  ${_target} DEPENDS ${SOURCEABS}\n      COMMAND ${BIN2C} ${_source} \">${_target}\" )\n  endif ()\nendfunction()\n"
  },
  {
    "path": "3rdparty/toluapp/config_linux.py",
    "content": "\n## This is the linux configuration file\n# use 'scons -h' to see the list of command line options available\n\n# Compiler flags (based on Debian's installation of lua)\n#LINKFLAGS = ['-g']\nCCFLAGS = ['-O2', '-ansi', '-Wall']\n#CCFLAGS = ['-I/usr/include/lua50', '-g']\n\n# this is the default directory for installation. Files will be installed on\n# <prefix>/bin, <prefix>/lib and <prefix>/include when you run 'scons install'\n#\n# You can also specify this directory on the command line with the 'prefix'\n# option\n#\n# You can see more 'generic' options for POSIX systems on config_posix.py\n\nprefix = '/usr/local'\n\n# libraries (based on Debian's installation of lua)\nLIBS = ['lua', 'dl', 'm']\n\n"
  },
  {
    "path": "3rdparty/toluapp/config_msvc.py",
    "content": "\r\n## This is the MSVC configuration file\r\n# use 'scons -h' to see the list of command line options available\r\n\r\n# flags for the compiler\r\nCCFLAGS = ['/nologo']\r\n\r\n# this is the default directory for installation. Files will be installed on\r\n# <prefix>/bin, <prefix>/lib and <prefix>/include when you run 'scons install'\r\n#\r\n# You can also specify this directory on the command line with the 'prefix'\r\n# option\r\n#\r\n# If you leave it as 'None', we'll try to auto-detect it (as 'PLATFORMSDKDIR'\r\n# detected by SCons).\r\n\r\nprefix = None # (it's a string)\r\n\r\n# the libraries\r\nLIBS = ['lua', 'lualib']\r\n\r\n# linkflags\r\nLINKFLAGS = ['/nologo']\r\n\r\n## We need to specifiy the environment for the PATH and LIB and all those\r\n# parameters cl tales from it\r\nimport os\r\nENV = os.environ\r\n"
  },
  {
    "path": "3rdparty/toluapp/config_posix.py",
    "content": "\n## This is the POSIX configuration file (will be included for cygwin, mingw\n# and possibly mac OSX and BSDs)\n# use 'scons -h' to see the list of command line options available\n\n# flags for the compiler\n#CCFLAGS = []\nCCFLAGS = ['-O2', '-ansi', '-Wall']\n\n# this is the default directory for installation. Files will be installed on\n# <prefix>/bin, <prefix>/lib and <prefix>/include when you run 'scons install'\n#\n# You can also specify this directory on the command line with the 'prefix'\n# option\n\nprefix = '/usr/local'\n\n# libraries\nLIBS = ['lua', 'lualib', 'm']\n\n\n\nimport os\n"
  },
  {
    "path": "3rdparty/toluapp/custom-5.1.py",
    "content": "CCFLAGS = ['-I/usr/include/lua5.1', '-O2', '-ansi']\n#LIBPATH = ['/usr/local/lib']\nLIBS = ['lua5.1', 'dl', 'm']\nprefix = '/mingw'\n#build_dev=1\ntolua_bin = 'tolua++5.1'\ntolua_lib = 'tolua++5.1'\nTOLUAPP = 'tolua++5.1'\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/README.Debian",
    "content": "tolua++ for Debian\n------------------\n\n<possible notes regarding this package - if none, delete this file>\n\n -- Ariel Manzur <puntob@gmail.com>, Thu, 30 Dec 2004 11:59:14 -0300\n"
  },
  {
    "path": "3rdparty/toluapp/debian/changelog",
    "content": "tolua++ (1.0.92pre1-1) unstable; urgency=low\n\n  * fixed array bound check bug\n  * moved parsing of 'extern' keyword to the parser\n  * fixed bug in module name generation from package filename\n  * added -E command line option\n\n -- Ariel Manzur <puntob@gmail.com>  Mon, 13 Mar 2006 19:28:14 -0300\n\ntolua++ (1.0.8pre3-1) unstable; urgency=low\n\n  * changed tolua_touserdata\n  * fixed bugs\n\n -- Ariel Manzur <puntob@gmail.com>  Tue, 13 Dec 2005 01:46:33 +0100\n\ntolua++ (1.0.7-1) unstable; urgency=low\n\n  * added -C flag\n  * added object access\n  * added parser_hook\n  * merged Mildred's patch (sorry, no last name): code on open function is\n    nested, embedded lua chunks have better names\n\n -- Ariel Manzur <puntob@gmail.com>  Tue, 18 Oct 2005 22:51:04 -0300\n\ntolua++ (1.0.6-1) unstable; urgency=low\n\n  * fixed parser bugs\n  * added tolua_property\n  * added TOLUA_PROTECTED_DESTRUCTOR\n  * added inheritance from C objects by lua objects\n  * fixed class constructor bug (calling the class name directly works)\n\n -- Ariel Manzur <puntob@gmail.com>  Sat,  6 Aug 2005 09:24:10 -0300\n\ntolua++ (1.0.6pre3-1) unstable; urgency=low\n\n  * fixed tolua_tocppstring\n\n -- Ariel Manzur <puntob@gmail.com>  Sun, 26 Jun 2005 21:01:50 -0300\n\ntolua++ (1.0.6pre2-1) unstable; urgency=low\n\n  * fixed c compilation bug\n  * added -D flag\n  * fixed tolua.releaseownership?\n  \n -- Ariel Manzur <puntob@gmail.com>  Mon,  2 May 2005 20:56:04 -0300\n\ntolua++ (1.0.6pre1-1) unstable; urgency=low\n\n  * something\n\n -- Ariel Manzur <puntob@gmail.com>  Wed, 27 Apr 2005 00:09:41 -0300\n\ntolua++ (1.0.5-1) unstable; urgency=low\n\n  * fixed missed inheritance bug.\n  * ready for 1.0.5\n\n -- Ariel Manzur <puntob@gmail.com>  Fri,  8 Apr 2005 23:15:19 -0300\n\ntolua++ (1.0.5~pre6-1) unstable; urgency=low\n\n  * fixed bug in tolua.cast (introduced on previous version)\n\n -- Ariel Manzur <puntob@gmail.com>  Sat,  2 Apr 2005 00:36:45 -0300\n\ntolua++ (1.0.5~pre5-1) unstable; urgency=low\n\n  * fixed bug in tolua.cast\n\n -- Ariel Manzur <puntob@gmail.com>  Fri, 18 Mar 2005 01:13:55 -0300\n\ntolua++ (1.0.5~pre4-1) unstable; urgency=low\n\n  * fixed support for overloading methods across multiple class definitions\n\n -- Ariel Manzur <puntob@gmail.com>  Thu,  3 Mar 2005 19:03:04 -0300\n\ntolua++ (1.0.5~pre3-1) unstable; urgency=low\n\n  * fixed bugs in parser\n\n -- Ariel Manzur <puntob@gmail.com>  Sun, 20 Feb 2005 19:56:32 -0300\n\ntolua++ (1.0.5~pre2-1) unstable; urgency=low\n\n  * added tolua_outside\n\n -- Ariel Manzur <puntob@gmail.com>  Fri, 11 Feb 2005 02:50:45 -0300\n\ntolua++ (1.0.5~pre1-1) unstable; urgency=low\n\n  * fixed bug in type detection\n  * fixed bug in code output for static variables\n\n -- Ariel Manzur <puntob@gmail.com>  Thu,  3 Feb 2005 02:05:43 -0300\n\ntolua++ (1.0.4-3) unstable; urgency=low\n\n  * jumped the gun on the previous release\n\n -- Ariel Manzur <puntob@gmail.com>  Thu, 20 Jan 2005 23:20:17 -0300\n\ntolua++ (1.0.4-2) unstable; urgency=low\n\n  * added optimize flags for binary package \n\n -- Ariel Manzur <puntob@gmail.com>  Fri, 14 Jan 2005 00:43:09 -0300\n\ntolua++ (1.0.4-1) unstable; urgency=low\n\n  * Initial Release.\n\n -- Ariel Manzur <puntob@gmail.com>  Thu, 30 Dec 2004 11:59:14 -0300\n\nLocal variables:\nmode: debian-changelog\nEnd:\n"
  },
  {
    "path": "3rdparty/toluapp/debian/compat",
    "content": "4\n"
  },
  {
    "path": "3rdparty/toluapp/debian/conffiles.ex",
    "content": "#\n# If you want to use this conffile, remove all comments and put files that\n# you want dpkg to process here using their absolute pathnames.\n# See the policy manual\n#\n# for example:\n# /etc/tolua++/tolua++.conf\n"
  },
  {
    "path": "3rdparty/toluapp/debian/control",
    "content": "Source: tolua++\nSection: unknown\nPriority: optional\nMaintainer: Ariel Manzur <puntob@gmail.com>\nBuild-Depends: debhelper (>= 4.0.0), scons, liblua50-dev, liblualib50-dev\nStandards-Version: 3.6.1\n\nPackage: tolua++\nArchitecture: any\nDepends: ${shlibs:Depends}, ${misc:Depends}, liblua50-dev, liblualib50-dev\nDescription: tolua++\n tolua++ is an extended version of tolua, a tool to integrate C/C++ code with\n Lua. tolua++ includes new features oriented to c++.\n"
  },
  {
    "path": "3rdparty/toluapp/debian/copyright",
    "content": "This package is maintained by Ariel Manzur <puntob@gmail.com> on\nSat, 08 Jan 2005 06:11:22 -0300\n\nLatest version can be found on http://www.codenix.com/~tolua/\n\nUpstream Author(s): Waldemar Celes <celes@tecgraf.puc-rio.br>,\n Ariel Manzur <puntob@gmail.com>\n\nCopyright:\n\nQuoted from the README file accompanying tolua:\n\n 'tolua is freely available; you can redistribute it and/or modify it.\n  The software provided hereunder is on an \"as is\" basis, and\n  the author has no obligation to provide maintenance, support,\n  updates, enhancements, or modifications.'\n"
  },
  {
    "path": "3rdparty/toluapp/debian/cron.d.ex",
    "content": "#\n# Regular cron jobs for the tolua++ package\n#\n0 4\t* * *\troot\ttolua++_maintenance\n"
  },
  {
    "path": "3rdparty/toluapp/debian/dirs",
    "content": "usr/bin\nusr/lib\nusr/include\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/docs",
    "content": "README\n"
  },
  {
    "path": "3rdparty/toluapp/debian/emacsen-install.ex",
    "content": "#! /bin/sh -e\n# /usr/lib/emacsen-common/packages/install/tolua++\n\n# Written by Jim Van Zandt <jrv@vanzandt.mv.com>, borrowing heavily\n# from the install scripts for gettext by Santiago Vila\n# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>.\n\nFLAVOR=$1\nPACKAGE=tolua++\n\nif [ ${FLAVOR} = emacs ]; then exit 0; fi\n\necho install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}\n\n#FLAVORTEST=`echo $FLAVOR | cut -c-6`\n#if [ ${FLAVORTEST} = xemacs ] ; then\n#    SITEFLAG=\"-no-site-file\"\n#else\n#    SITEFLAG=\"--no-site-file\"\n#fi\nFLAGS=\"${SITEFLAG} -q -batch -l path.el -f batch-byte-compile\"\n\nELDIR=/usr/share/emacs/site-lisp/${PACKAGE}\nELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}\n\n# Install-info-altdir does not actually exist. \n# Maybe somebody will write it.\nif test -x /usr/sbin/install-info-altdir; then\n    echo install/${PACKAGE}: install Info links for ${FLAVOR}\n    install-info-altdir --quiet --section \"\" \"\" --dirname=${FLAVOR} /usr/info/${PACKAGE}.info.gz\nfi\n\ninstall -m 755 -d ${ELCDIR}\ncd ${ELDIR}\nFILES=`echo *.el`\ncp ${FILES} ${ELCDIR}\ncd ${ELCDIR}\n\ncat << EOF > path.el\n(setq load-path (cons \".\" load-path) byte-compile-warnings nil)\nEOF\n${FLAVOR} ${FLAGS} ${FILES}\nrm -f *.el path.el\n\nexit 0\n"
  },
  {
    "path": "3rdparty/toluapp/debian/emacsen-remove.ex",
    "content": "#!/bin/sh -e\n# /usr/lib/emacsen-common/packages/remove/tolua++\n\nFLAVOR=$1\nPACKAGE=tolua++\n\nif [ ${FLAVOR} != emacs ]; then\n    if test -x /usr/sbin/install-info-altdir; then\n        echo remove/${PACKAGE}: removing Info links for ${FLAVOR}\n        install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/info/tolua++.info.gz\n    fi\n\n    echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}\n    rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}\nfi\n"
  },
  {
    "path": "3rdparty/toluapp/debian/emacsen-startup.ex",
    "content": ";; -*-emacs-lisp-*-\n;;\n;; Emacs startup file for the Debian tolua++ package\n;;\n;; Originally contributed by Nils Naumann <naumann@unileoben.ac.at>\n;; Modified by Dirk Eddelbuettel <edd@debian.org>\n;; Adapted for dh-make by Jim Van Zandt <jrv@vanzandt.mv.com>\n\n;; The tolua++ package follows the Debian/GNU Linux 'emacsen' policy and\n;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,\n;; xemacs19, emacs20, xemacs20...).  The compiled code is then\n;; installed in a subdirectory of the respective site-lisp directory.\n;; We have to add this to the load-path:\n(let ((package-dir (concat \"/usr/share/\"\n                           (symbol-name flavor)\n                           \"/site-lisp/tolua++\")))\n  (when (file-directory-p package-dir)\n        (setq load-path (cons package-dir load-path))))\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/init.d.ex",
    "content": "#! /bin/sh\n#\n# skeleton\texample file to build /etc/init.d/ scripts.\n#\t\tThis file should be used to construct scripts for /etc/init.d.\n#\n#\t\tWritten by Miquel van Smoorenburg <miquels@cistron.nl>.\n#\t\tModified for Debian \n#\t\tby Ian Murdock <imurdock@gnu.ai.mit.edu>.\n#\n# Version:\t@(#)skeleton  1.9  26-Feb-2001  miquels@cistron.nl\n#\n\nPATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin\nDAEMON=/usr/sbin/tolua++\nNAME=tolua++\nDESC=tolua++\n\ntest -x $DAEMON || exit 0\n\n# Include tolua++ defaults if available\nif [ -f /etc/default/tolua++ ] ; then\n\t. /etc/default/tolua++\nfi\n\nset -e\n\ncase \"$1\" in\n  start)\n\techo -n \"Starting $DESC: \"\n\tstart-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \\\n\t\t--exec $DAEMON -- $DAEMON_OPTS\n\techo \"$NAME.\"\n\t;;\n  stop)\n\techo -n \"Stopping $DESC: \"\n\tstart-stop-daemon --stop --quiet --pidfile /var/run/$NAME.pid \\\n\t\t--exec $DAEMON\n\techo \"$NAME.\"\n\t;;\n  #reload)\n\t#\n\t#\tIf the daemon can reload its config files on the fly\n\t#\tfor example by sending it SIGHUP, do it here.\n\t#\n\t#\tIf the daemon responds to changes in its config file\n\t#\tdirectly anyway, make this a do-nothing entry.\n\t#\n\t# echo \"Reloading $DESC configuration files.\"\n\t# start-stop-daemon --stop --signal 1 --quiet --pidfile \\\n\t#\t/var/run/$NAME.pid --exec $DAEMON\n  #;;\n  restart|force-reload)\n\t#\n\t#\tIf the \"reload\" option is implemented, move the \"force-reload\"\n\t#\toption to the \"reload\" entry above. If not, \"force-reload\" is\n\t#\tjust the same as \"restart\".\n\t#\n\techo -n \"Restarting $DESC: \"\n\tstart-stop-daemon --stop --quiet --pidfile \\\n\t\t/var/run/$NAME.pid --exec $DAEMON\n\tsleep 1\n\tstart-stop-daemon --start --quiet --pidfile \\\n\t\t/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS\n\techo \"$NAME.\"\n\t;;\n  *)\n\tN=/etc/init.d/$NAME\n\t# echo \"Usage: $N {start|stop|restart|reload|force-reload}\" >&2\n\techo \"Usage: $N {start|stop|restart|force-reload}\" >&2\n\texit 1\n\t;;\nesac\n\nexit 0\n"
  },
  {
    "path": "3rdparty/toluapp/debian/manpage.1.ex",
    "content": ".\\\"                                      Hey, EMACS: -*- nroff -*-\n.\\\" First parameter, NAME, should be all caps\n.\\\" Second parameter, SECTION, should be 1-8, maybe w/ subsection\n.\\\" other parameters are allowed: see man(7), man(1)\n.TH TOLUA++ SECTION \"December 30, 2004\"\n.\\\" Please adjust this date whenever revising the manpage.\n.\\\"\n.\\\" Some roff macros, for reference:\n.\\\" .nh        disable hyphenation\n.\\\" .hy        enable hyphenation\n.\\\" .ad l      left justify\n.\\\" .ad b      justify to both left and right margins\n.\\\" .nf        disable filling\n.\\\" .fi        enable filling\n.\\\" .br        insert line break\n.\\\" .sp <n>    insert n+1 empty lines\n.\\\" for manpage-specific macros, see man(7)\n.SH NAME\ntolua++ \\- program to do something\n.SH SYNOPSIS\n.B tolua++\n.RI [ options ] \" files\" ...\n.br\n.B bar\n.RI [ options ] \" files\" ...\n.SH DESCRIPTION\nThis manual page documents briefly the\n.B tolua++\nand\n.B bar\ncommands.\n.PP\n.\\\" TeX users may be more comfortable with the \\fB<whatever>\\fP and\n.\\\" \\fI<whatever>\\fP escape sequences to invode bold face and italics, \n.\\\" respectively.\n\\fBtolua++\\fP is a program that...\n.SH OPTIONS\nThese programs follow the usual GNU command line syntax, with long\noptions starting with two dashes (`-').\nA summary of options is included below.\nFor a complete description, see the Info files.\n.TP\n.B \\-h, \\-\\-help\nShow summary of options.\n.TP\n.B \\-v, \\-\\-version\nShow version of program.\n.SH SEE ALSO\n.BR bar (1),\n.BR baz (1).\n.br\nThe programs are documented fully by\n.IR \"The Rise and Fall of a Fooish Bar\" ,\navailable via the Info system.\n.SH AUTHOR\ntolua++ was written by <upstream author>.\n.PP\nThis manual page was written by Ariel Manzur <puntob@gmail.com>,\nfor the Debian project (but may be used by others).\n"
  },
  {
    "path": "3rdparty/toluapp/debian/manpage.sgml.ex",
    "content": "<!doctype refentry PUBLIC \"-//OASIS//DTD DocBook V4.1//EN\" [\n\n<!-- Process this file with docbook-to-man to generate an nroff manual\n     page: `docbook-to-man manpage.sgml > manpage.1'.  You may view\n     the manual page with: `docbook-to-man manpage.sgml | nroff -man |\n     less'.  A typical entry in a Makefile or Makefile.am is:\n\nmanpage.1: manpage.sgml\n\tdocbook-to-man $< > $@\n\n    \n\tThe docbook-to-man binary is found in the docbook-to-man package.\n\tPlease remember that if you create the nroff version in one of the\n\tdebian/rules file targets (such as build), you will need to include\n\tdocbook-to-man in your Build-Depends control field.\n\n  -->\n\n  <!-- Fill in your name for FIRSTNAME and SURNAME. -->\n  <!ENTITY dhfirstname \"<firstname>FIRSTNAME</firstname>\">\n  <!ENTITY dhsurname   \"<surname>SURNAME</surname>\">\n  <!-- Please adjust the date whenever revising the manpage. -->\n  <!ENTITY dhdate      \"<date>December 30, 2004</date>\">\n  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are\n       allowed: see man(7), man(1). -->\n  <!ENTITY dhsection   \"<manvolnum>SECTION</manvolnum>\">\n  <!ENTITY dhemail     \"<email>puntob@gmail.com</email>\">\n  <!ENTITY dhusername  \"Ariel Manzur\">\n  <!ENTITY dhucpackage \"<refentrytitle>TOLUA++</refentrytitle>\">\n  <!ENTITY dhpackage   \"tolua++\">\n\n  <!ENTITY debian      \"<productname>Debian</productname>\">\n  <!ENTITY gnu         \"<acronym>GNU</acronym>\">\n  <!ENTITY gpl         \"&gnu; <acronym>GPL</acronym>\">\n]>\n\n<refentry>\n  <refentryinfo>\n    <address>\n      &dhemail;\n    </address>\n    <author>\n      &dhfirstname;\n      &dhsurname;\n    </author>\n    <copyright>\n      <year>2003</year>\n      <holder>&dhusername;</holder>\n    </copyright>\n    &dhdate;\n  </refentryinfo>\n  <refmeta>\n    &dhucpackage;\n\n    &dhsection;\n  </refmeta>\n  <refnamediv>\n    <refname>&dhpackage;</refname>\n\n    <refpurpose>program to do something</refpurpose>\n  </refnamediv>\n  <refsynopsisdiv>\n    <cmdsynopsis>\n      <command>&dhpackage;</command>\n\n      <arg><option>-e <replaceable>this</replaceable></option></arg>\n\n      <arg><option>--example <replaceable>that</replaceable></option></arg>\n    </cmdsynopsis>\n  </refsynopsisdiv>\n  <refsect1>\n    <title>DESCRIPTION</title>\n\n    <para>This manual page documents briefly the\n      <command>&dhpackage;</command> and <command>bar</command>\n      commands.</para>\n\n    <para>This manual page was written for the &debian; distribution\n      because the original program does not have a manual page.\n      Instead, it has documentation in the &gnu;\n      <application>Info</application> format; see below.</para>\n\n    <para><command>&dhpackage;</command> is a program that...</para>\n\n  </refsect1>\n  <refsect1>\n    <title>OPTIONS</title>\n\n    <para>These programs follow the usual &gnu; command line syntax,\n      with long options starting with two dashes (`-').  A summary of\n      options is included below.  For a complete description, see the\n      <application>Info</application> files.</para>\n\n    <variablelist>\n      <varlistentry>\n        <term><option>-h</option>\n          <option>--help</option>\n        </term>\n        <listitem>\n          <para>Show summary of options.</para>\n        </listitem>\n      </varlistentry>\n      <varlistentry>\n        <term><option>-v</option>\n          <option>--version</option>\n        </term>\n        <listitem>\n          <para>Show version of program.</para>\n        </listitem>\n      </varlistentry>\n    </variablelist>\n  </refsect1>\n  <refsect1>\n    <title>SEE ALSO</title>\n\n    <para>bar (1), baz (1).</para>\n\n    <para>The programs are documented fully by <citetitle>The Rise and\n      Fall of a Fooish Bar</citetitle> available via the\n      <application>Info</application> system.</para>\n  </refsect1>\n  <refsect1>\n    <title>AUTHOR</title>\n\n    <para>This manual page was written by &dhusername; &dhemail; for\n      the &debian; system (but may be used by others).  Permission is\n      granted to copy, distribute and/or modify this document under\n      the terms of the &gnu; General Public License, Version 2 any \n\t  later version published by the Free Software Foundation.\n    </para>\n\t<para>\n\t  On Debian systems, the complete text of the GNU General Public\n\t  License can be found in /usr/share/common-licenses/GPL.\n\t</para>\n\n  </refsect1>\n</refentry>\n\n<!-- Keep this comment at the end of the file\nLocal variables:\nmode: sgml\nsgml-omittag:t\nsgml-shorttag:t\nsgml-minimize-attributes:nil\nsgml-always-quote-attributes:t\nsgml-indent-step:2\nsgml-indent-data:t\nsgml-parent-document:nil\nsgml-default-dtd-file:nil\nsgml-exposed-tags:nil\nsgml-local-catalogs:nil\nsgml-local-ecat-files:nil\nEnd:\n-->\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/manpage.xml.ex",
    "content": "<?xml version='1.0' encoding='ISO-8859-1'?>\n<!DOCTYPE refentry PUBLIC \"-//OASIS//DTD DocBook XML V4.2//EN\"\n\"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd\" [\n\n<!--\n\nProcess this file with an XSLT processor: `xsltproc \\\n-''-nonet /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\\\nmanpages/docbook.xsl manpage.dbk'.  A manual page\n<package>.<section> will be generated.  You may view the\nmanual page with: nroff -man <package>.<section> | less'.  A\ntypical entry in a Makefile or Makefile.am is:\n\nDB2MAN=/usr/share/sgml/docbook/stylesheet/xsl/nwalsh/\\\nmanpages/docbook.xsl\nXP=xsltproc -''-nonet\n\nmanpage.1: manpage.dbk\n        $(XP) $(DB2MAN) $<\n    \nThe xsltproc binary is found in the xsltproc package.  The\nXSL files are in docbook-xsl.  Please remember that if you\ncreate the nroff version in one of the debian/rules file\ntargets (such as build), you will need to include xsltproc\nand docbook-xsl in your Build-Depends control field.\n\n-->\n\n  <!-- Fill in your name for FIRSTNAME and SURNAME. -->\n  <!ENTITY dhfirstname \"<firstname>FIRSTNAME</firstname>\">\n  <!ENTITY dhsurname   \"<surname>SURNAME</surname>\">\n  <!-- Please adjust the date whenever revising the manpage. -->\n  <!ENTITY dhdate      \"<date>December 30, 2004</date>\">\n  <!-- SECTION should be 1-8, maybe w/ subsection other parameters are\n       allowed: see man(7), man(1). -->\n  <!ENTITY dhsection   \"<manvolnum>SECTION</manvolnum>\">\n  <!ENTITY dhemail     \"<email>puntob@gmail.com</email>\">\n  <!ENTITY dhusername  \"Ariel Manzur\">\n  <!ENTITY dhucpackage \"<refentrytitle>TOLUA++</refentrytitle>\">\n  <!ENTITY dhpackage   \"tolua++\">\n\n  <!ENTITY debian      \"<productname>Debian</productname>\">\n  <!ENTITY gnu         \"<acronym>GNU</acronym>\">\n  <!ENTITY gpl         \"&gnu; <acronym>GPL</acronym>\">\n]>\n\n<refentry>\n  <refentryinfo>\n    <address>\n      &dhemail;\n    </address>\n    <author>\n      &dhfirstname;\n      &dhsurname;\n    </author>\n    <copyright>\n      <year>2003</year>\n      <holder>&dhusername;</holder>\n    </copyright>\n    &dhdate;\n  </refentryinfo>\n  <refmeta>\n    &dhucpackage;\n\n    &dhsection;\n  </refmeta>\n  <refnamediv>\n    <refname>&dhpackage;</refname>\n\n    <refpurpose>program to do something</refpurpose>\n  </refnamediv>\n  <refsynopsisdiv>\n    <cmdsynopsis>\n      <command>&dhpackage;</command>\n\n      <arg><option>-e <replaceable>this</replaceable></option></arg>\n\n      <arg><option>--example <replaceable>that</replaceable></option></arg>\n    </cmdsynopsis>\n  </refsynopsisdiv>\n  <refsect1>\n    <title>DESCRIPTION</title>\n\n    <para>This manual page documents briefly the\n      <command>&dhpackage;</command> and <command>bar</command>\n      commands.</para>\n\n    <para>This manual page was written for the &debian; distribution\n      because the original program does not have a manual page.\n      Instead, it has documentation in the &gnu;\n      <application>Info</application> format; see below.</para>\n\n    <para><command>&dhpackage;</command> is a program that...</para>\n\n  </refsect1>\n  <refsect1>\n    <title>OPTIONS</title>\n\n    <para>These programs follow the usual &gnu; command line syntax,\n      with long options starting with two dashes (`-').  A summary of\n      options is included below.  For a complete description, see the\n      <application>Info</application> files.</para>\n\n    <variablelist>\n      <varlistentry>\n        <term><option>-h</option>\n          <option>--help</option>\n        </term>\n        <listitem>\n          <para>Show summary of options.</para>\n        </listitem>\n      </varlistentry>\n      <varlistentry>\n        <term><option>-v</option>\n          <option>--version</option>\n        </term>\n        <listitem>\n          <para>Show version of program.</para>\n        </listitem>\n      </varlistentry>\n    </variablelist>\n  </refsect1>\n  <refsect1>\n    <title>SEE ALSO</title>\n\n    <para>bar (1), baz (1).</para>\n\n    <para>The programs are documented fully by <citetitle>The Rise and\n      Fall of a Fooish Bar</citetitle> available via the\n      <application>Info</application> system.</para>\n  </refsect1>\n  <refsect1>\n    <title>AUTHOR</title>\n\n    <para>This manual page was written by &dhusername; &dhemail; for\n      the &debian; system (but may be used by others).  Permission is\n      granted to copy, distribute and/or modify this document under\n      the terms of the &gnu; General Public License, Version 2 any \n\t  later version published by the Free Software Foundation.\n    </para>\n\t<para>\n\t  On Debian systems, the complete text of the GNU General Public\n\t  License can be found in /usr/share/common-licenses/GPL.\n\t</para>\n\n  </refsect1>\n</refentry>\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/menu.ex",
    "content": "?package(tolua++):needs=\"X11|text|vc|wm\" section=\"Apps/see-menu-manual\"\\\n  title=\"tolua++\" command=\"/usr/bin/tolua++\"\n"
  },
  {
    "path": "3rdparty/toluapp/debian/postinst.ex",
    "content": "#! /bin/sh\n# postinst script for tolua++\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n#        * <postinst> `configure' <most-recently-configured-version>\n#        * <old-postinst> `abort-upgrade' <new version>\n#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>\n#          <new-version>\n#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'\n#          <failed-install-package> <version> `removing'\n#          <conflicting-package> <version>\n# for details, see http://www.debian.org/doc/debian-policy/ or\n# the debian-policy package\n#\n\ncase \"$1\" in\n    configure)\n\n    ;;\n\n    abort-upgrade|abort-remove|abort-deconfigure)\n\n    ;;\n\n    *)\n        echo \"postinst called with unknown argument \\`$1'\" >&2\n        exit 1\n    ;;\nesac\n\n# dh_installdeb will replace this with shell code automatically\n# generated by other debhelper scripts.\n\n#DEBHELPER#\n\nexit 0\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/postrm.ex",
    "content": "#! /bin/sh\n# postrm script for tolua++\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n#        * <postrm> `remove'\n#        * <postrm> `purge'\n#        * <old-postrm> `upgrade' <new-version>\n#        * <new-postrm> `failed-upgrade' <old-version>\n#        * <new-postrm> `abort-install'\n#        * <new-postrm> `abort-install' <old-version>\n#        * <new-postrm> `abort-upgrade' <old-version>\n#        * <disappearer's-postrm> `disappear' <r>overwrit>r> <new-version>\n# for details, see http://www.debian.org/doc/debian-policy/ or\n# the debian-policy package\n\n\ncase \"$1\" in\n       purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)\n\n\n        ;;\n\n    *)\n        echo \"postrm called with unknown argument \\`$1'\" >&2\n        exit 1\n\nesac\n\n# dh_installdeb will replace this with shell code automatically\n# generated by other debhelper scripts.\n\n#DEBHELPER#\n\nexit 0\n"
  },
  {
    "path": "3rdparty/toluapp/debian/preinst.ex",
    "content": "#! /bin/sh\n# preinst script for tolua++\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n#        * <new-preinst> `install'\n#        * <new-preinst> `install' <old-version>\n#        * <new-preinst> `upgrade' <old-version>\n#        * <old-preinst> `abort-upgrade' <new-version>\n#\n# for details, see http://www.debian.org/doc/debian-policy/ or\n# the debian-policy package\n\n\ncase \"$1\" in\n    install|upgrade)\n#        if [ \"$1\" = \"upgrade\" ]\n#        then\n#            start-stop-daemon --stop --quiet --oknodo  \\\n#                --pidfile /var/run/tolua++.pid  \\\n#                --exec /usr/sbin/tolua++ 2>/dev/null || true\n#        fi\n    ;;\n\n    abort-upgrade)\n    ;;\n\n    *)\n        echo \"preinst called with unknown argument \\`$1'\" >&2\n        exit 1\n    ;;\nesac\n\n# dh_installdeb will replace this with shell code automatically\n# generated by other debhelper scripts.\n\n#DEBHELPER#\n\nexit 0\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/prerm.ex",
    "content": "#! /bin/sh\n# prerm script for tolua++\n#\n# see: dh_installdeb(1)\n\nset -e\n\n# summary of how this script can be called:\n#        * <prerm> `remove'\n#        * <old-prerm> `upgrade' <new-version>\n#        * <new-prerm> `failed-upgrade' <old-version>\n#        * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>\n#        * <deconfigured's-prerm> `deconfigure' `in-favour'\n#          <package-being-installed> <version> `removing'\n#          <conflicting-package> <version>\n# for details, see http://www.debian.org/doc/debian-policy/ or\n# the debian-policy package\n\n\ncase \"$1\" in\n    remove|upgrade|deconfigure)\n#       install-info --quiet --remove /usr/info/tolua++.info.gz\n        ;;\n    failed-upgrade)\n        ;;\n    *)\n        echo \"prerm called with unknown argument \\`$1'\" >&2\n        exit 1\n    ;;\nesac\n\n# dh_installdeb will replace this with shell code automatically\n# generated by other debhelper scripts.\n\n#DEBHELPER#\n\nexit 0\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/debian/rules",
    "content": "#!/usr/bin/make -f\n# -*- makefile -*-\n# Sample debian/rules that uses debhelper.\n# This file was originally written by Joey Hess and Craig Small.\n# As a special exception, when this file is copied by dh-make into a\n# dh-make output file, you may use that output file without restriction.\n# This special exception was added by Craig Small in version 0.37 of dh-make.\n\n# Uncomment this to turn on verbose mode.\n#export DH_VERBOSE=1\n\n\n\n\nCFLAGS = -Wall -g\n\nifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))\n\tCFLAGS += -O0\nelse\n\tCFLAGS += -O2\nendif\n\nconfigure: configure-stamp\nconfigure-stamp:\n\tdh_testdir\n\t# Add here commands to configure the package.\n\tscons build_dev=0 prefix=$(CURDIR)/debian/tolua++/usr configure\n\n\ttouch configure-stamp\n\n\nbuild: build-stamp\n\nbuild-stamp: configure-stamp \n\tdh_testdir\n\n\t# Add here commands to compile the package.\n\t#$(MAKE)\n\tscons all\n\t#docbook-to-man debian/tolua++.sgml > tolua++.1\n\n\ttouch build-stamp\n\nclean:\n\tdh_testdir\n\tdh_testroot\n\trm -f build-stamp configure-stamp\n\n\t# Add here commands to clean up after the build process.\n\t#-$(MAKE) clean\n\tscons -c build_dev=0 all configure\n\n\tdh_clean \n\ninstall: build\n\tdh_testdir\n\tdh_testroot\n\tdh_clean -k \n\tdh_installdirs\n\n\t# Add here commands to install the package into debian/tolua++.\n\t#$(MAKE) install DESTDIR=$(CURDIR)/debian/tolua++\n\tscons install\n\n\n# Build architecture-independent files here.\nbinary-indep: build install\n# We have nothing to do by default.\n\n# Build architecture-dependent files here.\nbinary-arch: build install\n\tdh_testdir\n\tdh_testroot\n\tdh_installchangelogs \n\tdh_installdocs\n\tdh_installexamples\n#\tdh_install\n#\tdh_installmenu\n#\tdh_installdebconf\t\n#\tdh_installlogrotate\n#\tdh_installemacsen\n#\tdh_installpam\n#\tdh_installmime\n#\tdh_installinit\n#\tdh_installcron\n#\tdh_installinfo\n\tdh_installman\n\tdh_link\n\tdh_strip\n\tdh_compress\n\tdh_fixperms\n#\tdh_perl\n#\tdh_python\n#\tdh_makeshlibs\n\tdh_installdeb\n\tdh_shlibdeps\n\tdh_gencontrol\n\tdh_md5sums\n\tdh_builddeb\n\nbinary: binary-indep binary-arch\n.PHONY: build clean binary-indep binary-arch binary install configure\n"
  },
  {
    "path": "3rdparty/toluapp/debian/tolua++-default.ex",
    "content": "# Defaults for tolua++ initscript\n# sourced by /etc/init.d/tolua++\n# installed at /etc/default/tolua++ by the maintainer scripts\n\n#\n# This is a POSIX shell fragment\n#\n\n# Additional options that are passed to the Daemon.\nDAEMON_OPTS=\"\"\n"
  },
  {
    "path": "3rdparty/toluapp/debian/tolua++.doc-base.EX",
    "content": "Document: tolua++\nTitle: Debian tolua++ Manual\nAuthor: <insert document author here>\nAbstract: This manual describes what tolua++ is\n and how it can be used to\n manage online manuals on Debian systems.\nSection: unknown\n\nFormat: debiandoc-sgml\nFiles: /usr/share/doc/tolua++/tolua++.sgml.gz\n\nFormat: postscript\nFiles: /usr/share/doc/tolua++/tolua++.ps.gz\n\nFormat: text\nFiles: /usr/share/doc/tolua++/tolua++.text.gz\n\nFormat: HTML\nIndex: /usr/share/doc/tolua++/html/index.html\nFiles: /usr/share/doc/tolua++/html/*.html\n\n  \n"
  },
  {
    "path": "3rdparty/toluapp/debian/watch.ex",
    "content": "# Example watch control file for uscan\n# Rename this file to \"watch\" and then you can run the \"uscan\" command\n# to check for upstream updates and more.\n# Site\t\tDirectory\t\tPattern\t\t\tVersion\tScript\nversion=2\nsunsite.unc.edu\t/pub/Linux/Incoming\ttolua++-(.*)\\.tar\\.gz\tdebian\tuupdate\n"
  },
  {
    "path": "3rdparty/toluapp/dist.info",
    "content": "--- This file is part of LuaDist project\n\nname = \"toluapp\"\nversion = \"1.0.93\"\n\ndesc = \"tolua++ is an extension of toLua, a tool to integrate C/Cpp code with Lua.\"\nauthor = \"Waldemar Celes, Ariel Manzur\"\nlicense = \"as-is\"\nurl = \"http://www.codenix.com/~tolua/\"\nmaintainer = \"Peter Kapec\"\n\ndepends = {\n\t\"lua ~> 5.1\"\n}\n"
  },
  {
    "path": "3rdparty/toluapp/doc/index.html",
    "content": "<head>\n<title>toLua++ - binding c/c++ code to lua</title>\n</head>\n\n<body bgcolor=\"white\">\n\n<h1>\n<img src=\"toluapp.gif\">tolua++ - Home</h1>\n<p>\n\n<a href=\"#news\">news</a> -\n<a href=\"#download\">download</a> - <a href=\"#documentation\">documentation</a> - <a href=\"#installing\">installing</a> -\n<a href=\"mailto:tolua@codenix.com\">contact</a> - <a href=\"lua_qt/\">lua_qt</a> - <a href=\"http://www.codenix.com\">Codenix</a>\n<br>\n\n<hr>\n\n<b>tolua++</b> is an extended version of <a href=\"http://www.tecgraf.puc-rio.br/~celes/tolua/\">tolua</a>, a tool to integrate\nC/C++ code with <A HREF=\"http://www.tecgraf.puc-rio.br/lua\">Lua</A>. <b>tolua++</b>\nincludes new features oriented to c++ such as:\n<p>\n\n<ul>\n<li> Support for <b>std::string</b> as a <a href=\"#basics\">basic type</a> (this can be turned off by a command line option).</li>\n<li> Support for <a href=\"#templates\">class templates</a></li>\n</ul>\n<p>\n\nAs well as other features and bugfixes.\n\n<hr>\n<a name=\"news\"></a>\n<h3>News:</h3>\n<p>\n\n<b>15/02/09</b>: Version <b><a href=\"tolua++-1.0.93.tar.bz2\">1.0.93</a></b> released. Some bugfixes and new features:\n<p>\n<ul>\n<li> Build process bootstraps.\n<li> Added hooks to handle custom types.\n<li> Added hooks to handle exceptions.\n<li> Fixed issues with newer GCC compilers.\n<li> Changed to MIT license. See <a href=\"COPYRIGHT\">COPYRIGHT</a> file for details.\n</ul>\n\n<b>27/04/06</b>: Version <b><a href=\"tolua++-1.0.92.tar.bz2\">1.0.92</a></b> released. Some bugfixes and new features:\n<p>\n<ul>\n<li> Fixed garbage collector bug for C objects.\n<li> Fixed problems with C compilers (including microsoft's)\n<li> Added a .proj file to build with Visual Studio 7 (contributed by Makoto Hamanaka).\n<li> New command line option: <tt>-E</tt> to define extra values\n<li> New command line option: <tt>-t</tt> to associate C++ types with their lua names  (see the <a href=\"tolua++.html\">manual</a> for details)\n</ul>\n\n<b>25/02/06</b>: Version <b><a href=\"tolua++-1.0.91.tar.bz2\">1.0.91</a></b> released. This version contains a small garbage collection bugfix for 1.0.90 (thanks to Rolf E. Thorup for the report), everyone should upgrade.\n<p>\n\n<b>18/02/06</b>: Version <b><a href=\"tolua++-1.0.90.tar.bz2\">1.0.90</a></b> released. Some bugfixes and new features:\n<p>\n<ul>\n<li> <b>lua 5.1</b> support (see <tt>README-5.1</tt>)\n<li> Support for casting operators (for example <tt>operator const char();</tt>)\n<li> New utility functions, <tt>tolua.setpeer</tt> and <tt>tolua.getpeer</tt>, for easier (and faster) inheritance from C/C++ objects (only for lua 5.1)\n<li> Some small API changes (see the <a href=\"tolua++.html#compatibility\">compatibility section</a> of the manual)\n</ul>\n<p>\n\n<b>18/10/05</b>: Version <b><a href=\"tolua++_1.0.7-1.tar.gz\">1.0.7</a></b> released. Some bugfixes and new features:\n<p>\n<ul>\n<li> New command line option: -C, to disable the cleanup of included lua code (for easier debugging).\n<li> Merged <a href=\"http://lua-users.org/lists/lua-l/2005-09/msg00227.html\">Mildred's</a> patch: embedded lua chunks have better names, code on package initializer function is nested.\n<li> New hook: <tt>parser_hook</tt>, allows modifications to the behavior of the main parser.\n<li> Objects can be private (or protected). This doesn't affect the normal usage (everything is public by default), but it's useful to declare types that don't export any code, but serve\nas 'support' for other declarations.\n<li> Misc bugfixes.\n</ul>\n<p>\n\n<b>01/9/05</b>: Version <b><a href=\"tolua++_1.0.6-1.tar.gz\">1.0.6</a></b> released. Several bugfixes and new features:\n<p>\n<ul>\n<li> Classes can have properties, using the 'tolua_property' keyboard. Property types are customizable.\n<li> Added a command line flag -D, to disable automatic generation of destructors for all classes with constructors (for compatibility with tolua5)\n<li> Classes with protected or private destructors can be tagged individually using the \"TOLUA_PROTECTED_DESTRUCTOR\" macro.\n<li> Added utility function \"tolua.inherit\", to allow a lua table to \"inherit\" from an instance of a C/C++ class\n<li> Fixed class constructor bug (it is now possible to use 'ClassName()' to create a lua-owned instance of the class without problems)\n<li> Misc bugfixes.\n</ul>\n<p>\n\n<b>10/4/05</b>: Version <b><a href=\"tolua++_1.0.5-1.tar.gz\">1.0.5</a></b> released. This version contains some minor bugfixes and a new feature,\nthe <b>tolua_outside</b> keyword, used to specify regular functions as methods of classes or structs. This release is also paired with <a href=\"lua_qt/\">lua_qt</a>\nversion 0.0.1a.\n<p>\n\n<b>1/2/05</b>: version <b><a href=\"tolua++-1.0.4.tar.bz2\">1.0.4</a></b> released. This version contains some bugfixes and new features:\n<p>\n<ul>\n<li> Ability to customize tolua++'s behaviour to add functionality.\n<li> Basic support for multiple inheritance.\n<li> Several bugfixes on the parser.\n<li> <a href=\"tolua++_1.0.4-3_i386.deb\">Debian package</a> available for download.\n</ul>\n<p>\n\nMost of the changes on this version were added for <a href=\"lua_qt/\">lua_qt</a>, a package\nto bind the <a href=\"http://www.trolltech.com/products/qt/index.html\">Qt</a> toolkit to lua.\n<p>\n\n<b>20/9/04</b>: version <b><a href=\"tolua++-1.0.3.tar.bz2\">1.0.3</a></b> released. This version contains major bugfixes:\n<p>\n<ul>\n<li> Fixed bugs in object tracking (the 'memory address' bug; there's still some work left, but people should be able to use <tt>union</tt>s with no problems)</li>\n<li> Fixed parser bugs, functions with template parameters should work, also functions with default parameters that call constructos and with commas on them should work.</li>\n<li> Added a <tt>__call</tt> method for class names, to replace <tt>new_local</tt> to create instances owned by lua.\n<li> Fixed other minor bugs.</li>\n<li> Removed the link to win32 binaries, since I aparently don't know what the hell I'm doing with a microsoft compiler ;-)</li>\n</ul>\n<p>\n\nEveryone should upgrade.\n<p>\n\n<b>23/10/03</b>: version <b><a href=\"tolua++-1.0.2.tar.bz2\">1.0.2</a></b> released. This version contains major bugfixes:\n<p>\n<ul>\n<li> Fixed bugs in gargabe collection (thanks to <b>Christian Vogler</b> for doing all the work :-)</li>\n<li> <tt>namespace</tt>s and nested types are now fully supported.</li>\n<li> Fixed other minor bugs.</li>\n</ul>\n<p>\n\nEveryone should upgrade.\n\n<hr>\n\n<a name=\"download\"></a>\n<h3>Downloading</B></H3>\n\nThe latest development version of the code is available through SVN from tolua++'s BerliOS project page. You can checkout using: \n\nsvn checkout svn://svn.berlios.de/toluapp/trunk\n\nThe <B>tolua++</B> source is freely available by http.\nThe software provided under the terms of the MIT license. See the <a href=\"COPYRIGHT\">COPYRIGHT</a> file distributed\nwith the source.\n<p>\n\nCurrent version is <b><a href=\"tolua++-1.0.93.tar.bz2\">1.0.93</a></b>, older versions:\n<p>\n<li> <a href=\"tolua++-1.0.93.tar.bz2\">tolua++-1.0.93.tar.bz2</a>\n<li> <a href=\"tolua++-1.0.92.tar.bz2\">tolua++-1.0.92.tar.bz2</a>\n<li> <a href=\"tolua++-1.0.91.tar.bz2\">tolua++-1.0.91.tar.bz2</a>\n<li> <a href=\"tolua++_1.0.7-1.tar.gz\">tolua++_1.0.7-1.tar.gz</a> [<a href=\"tolua++_1.0.7-1_i386.deb\">deb</a>]\n<li> <a href=\"tolua++_1.0.6-1.tar.gz\">tolua++_1.0.6-1.tar.gz</a> [<a href=\"tolua++_1.0.6-1_i386.deb\">deb</a>]\n<li> <a href=\"tolua++_1.0.5-1.tar.gz\">tolua++_1.0.5-1.tar.gz</a> [<a href=\"tolua++_1.0.5-1_i386.deb\">deb</a>]\n<li> <a href=\"tolua++-1.0.4.tar.bz2\">tolua++-1.0.4.tar.bz2</a> [<a href=\"tolua++_1.0.4-3_i386.deb\">deb</a>]\n<li> <a href=\"tolua++-1.0.3.tar.bz2\">tolua++-1.0.3.tar.bz2</a>\n<li> <a href=\"tolua++-1.0.2.tar.bz2\">tolua++-1.0.2.tar.bz2</a>\n<li> <a href=\"tolua++-1.0.tar.bz2\">tolua++-1.0.tar.bz2</a>\n\n<hr>\n\n<a name=\"documentation\"></a>\n<h3>Documentation</h3>\n<p>\nYou can find the manual <a href=\"tolua++.html\">here</a> or under the doc/ directory\non the distribution.\n<p>\n\nI'll also be adding interesting addons/examples to <a href=\"http://lua-users.org/wiki/ArielManzur\">my page</a>\non the <a href=\"http://lua-users.org/\">lua-users wiki</a>.\n\n<hr>\n\n<a name=\"installing\"></a>\n<h3>Instalation</h3>\n<p>\n\ntolua++ uses <a href=\"http://www.scons.org\">SCons</a> to build. SCons is based on\npython, you can get a stand-alone version on <a href=\"http://www.scons.org\">\ntheir website</a>. After you have SCons, follow this simple instructions:\n<p>\n\n<li> Type '<b>scons all</b>' to compile.</li>\n<li> Type '<b>scons install</b>'. The default install prefix is /usr/local, so if you are\non a POSIX system, it should work. On other systems, you can change it with the\n'<b>prefix</b>' option on command line.\n<p>\n\n<b>scons prefix=/usr install</b>\n<p>\n<i>or on windows</i>\n<p>\n<b>scons \"prefix=c:\\Program Files\\Visual C\" install</b>\n<p>\n\nUse <b>scons -h</b> to see a list of available command line options.\n\n<p>\nThe files you need (in case you want to do a <b>manual install</b>) are:\n<ul>\n\t<li> bin/tolua++[.exe] - the main binary\n\t<li> include/tolua++.h - the header file\n\t<li> lib/libtolua++.a <i>or</i> lib/tolua++.lib - the library\n</ul>\n\n<li> See INSTALL for instructions on how to install without SCons. There are also instructions on how\nto build without scons at the <a href=\"http://lua-users.org/wiki/CompilingToluappWithoutScons\">lua-users wiki</a>\n(if you know the author of this, <a href=\"mailto:tolua@codenix.com\">contact me</a>)</li>\n\n<li> For <b>lua 5.1</b>, see <tt>README-5.1</tt>\n\n<hr>\n\n<b>tolua++</b> and this website are maintained by Ariel Manzur.<br>\n<a href=\"http://www.codenix.com/index.php?section=contact\">Contact us</a> with any\nbugs, fixes, suggestions, or questions about this package.\n\n<hr>\n\n\n</body>\n\n"
  },
  {
    "path": "3rdparty/toluapp/doc/tolua++.html",
    "content": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\r\n<HTML>\r\n<HEAD>\r\n   <META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\r\n   <META NAME=\"GENERATOR\" CONTENT=\"Textpad\">\r\n   <META NAME=\"Author\" CONTENT=\"Waldemar Celes, Ariel Manzur\">\r\n   <TITLE>tolua++ reference manual</TITLE>\r\n</HEAD>\r\n<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#551A8B\" ALINK=\"#FF0000\">\r\n\r\n<H1>\r\n<IMG SRC=\"toluapp.gif\">tolua++ - Reference Manual</I></H1>\r\nby Waldemar Celes, Ariel Manzur.\r\n\r\n<H1>\r\n\r\n</h1>\r\n\r\n<HR ALIGN=LEFT SIZE=5 WIDTH=\"100%\">\r\n\r\n<b>tolua++</b> is an extended version of <a href=\"http://www.tecgraf.puc-rio.br/~celes/tolua/\">tolua</a>, a tool to integrate\r\nC/C++ code with <A HREF=\"http://www.tecgraf.puc-rio.br/lua\">Lua</A>. <b>tolua++</b>\r\nincludes new features oriented to c++ such as:\r\n<p>\r\n\r\n<ul>\r\n<li> Support for <b>std::string</b> as a <a href=\"#basics\">basic type</a> (this can be turned off by a command line option).</li>\r\n<li> Support for <a href=\"#templates\">class templates</a></li>\r\n</ul>\r\n<p>\r\n\r\nAs well as other features and bugfixes.\r\n<p>\r\n\r\n\r\n<B>tolua</B> is a tool that greatly simplifies the integration of C/C++\r\ncode with <A HREF=\"http://www.tecgraf.puc-rio.br/lua\">Lua</A>. Based on\r\na <I>cleaned</I> <I>header file</I> (or extracts from real header files),\r\n<B>tolua</B> automatically generates\r\nthe binding code to access C/C++ features from Lua. Using Lua API and tag\r\nmethod facilities, <B>tolua </B>maps C/C++ constants, external variables,\r\nfunctions, classes, and methods to Lua.\r\n<P>This manual is for <B>tolua++</B> version 1.0 and is implemented upon Lua\r\n5.0 and based on <b>tolua 5.0</b>. See <A HREF=\"#changes-v30\">Compatibility</A>\r\nfor details on switching from older versions.\r\n<P>The sections below describe how to use <B>tolua</B>. Please <A HREF=\"mailto:tolua@codenix.com\">contact us</A>\r\nwith bug reports, suggestions, and comments.\r\n<UL>\r\n<LI>\r\nShortcuts:</LI>\r\n\r\n<UL>\r\n<LI>\r\n<A HREF=\"#introduction\">How <B>tolua</B> works</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#using\">How to use <B>tolua</B></A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#basics\">Basic Concepts</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#constants\">Binding constants</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#variables\">Binding external variables</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#functions\">Binding functions</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#structs\">Binding struct fields</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#classes\">Binding classes and methods</A></LI>\r\n\r\n<li>\r\n<a href=\"#propeties\">Binding properties</a></li>\r\n\r\n<li>\r\n<a href=\"#templates\">Class Templates</a></li>\r\n\r\n<LI>\r\n<A HREF=\"#modules\">Module definition</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#renaming\">Renaming constants, variables and functions</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#additional\">Storing additional fields</A></LI>\r\n\r\n<li>\r\n<a href=\"#additional_features\">Additional features</a></li>\r\n\r\n<LI>\r\n<A HREF=\"#utilities\">Exported utility functions</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#embedded\">Embedded Lua code</A></LI>\r\n\r\n<LI>\r\n<a HREF=\"#customizing\">Customizing tolua++</a></li>\r\n\r\n<li>\r\n<a href=\"#compatibility\">Compatibility with older versions</a></li>\r\n\r\n<li>\r\n<A HREF=\"#changes-v30\">Changes since v3 *</A></li>\r\n\r\n<LI>\r\n<A HREF=\"#changes-v2\">Changes since v2.*</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#changes-v1\">Changes since v1.*</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#credits\">Credits</A></LI>\r\n\r\n<LI>\r\n<A HREF=\"#availability\">Availability</A></LI>\r\n</UL>\r\n</UL>\r\n\r\n<HR WIDTH=\"100%\">\r\n<H3>\r\n<A NAME=\"introduction\"></A>How tolua works</H3>\r\nTo use <B>tolua</B>, we create a <I>package file</I>, a C/C++ cleaned header\r\nfile<I>,</I> listing the constants, variables, functions, classes, and\r\nmethods we want to export to the Lua environment. Then <B>tolua</B> parses\r\nthis file and creates a C/C++ file that automatically binds the C/C++ code\r\nto Lua. If we link the created file with our application, the specified\r\nC/C++ code can be accessed from Lua.<br>\r\nA package file can also include regular header files, other package files,\r\nor lua files.<br>\r\n<P>Let's start with some examples. If we specify as input the following\r\nC-like header file to <B>tolua</B>:\r\n<PRE>#define FALSE 0\r\n#define TRUE 1\r\n\r\nenum {&nbsp;\r\n&nbsp;POINT = 100,&nbsp;\r\n&nbsp;LINE,&nbsp;\r\n&nbsp;POLYGON\r\n}</PRE>\r\n\r\n<PRE>Object* createObejct (int type);\r\nvoid drawObject (Object* obj, double red, double green, double blue);\r\nint isSelected (Object* obj);</PRE>\r\nA C file that binds such a code to Lua is automatically generated. Therefore,\r\nin Lua code, we can access the C code, writing, for instance:\r\n<PRE>...\r\nmyLine = createObject(LINE)\r\n...\r\nif isSelected(myLine) == TRUE then\r\n&nbsp; drawObject(myLine, 1.0, 0.0, 0.0);\r\nelse\r\n&nbsp; drawObject(myLine, 1.0, 1.0, 1.0);\r\nend\r\n...</PRE>\r\nAlso, consider a C++-like header file:\r\n<PRE>#define FALSE 0\r\n#define TRUE 1</PRE>\r\n\r\n<PRE>class Shape\r\n{\r\n&nbsp; void draw (void);\r\n&nbsp; void draw (double red, double green, double blue);\r\n&nbsp; int isSelected (void);\r\n};</PRE>\r\n\r\n<PRE>class Line : public Shape\r\n{\r\n&nbsp;Line (double x1, double y1, double x2, double y2);\r\n&nbsp;~Line (void);\r\n};</PRE>\r\nIf this file is used as input to <B>tolua</B>, a C++ file is automatically\r\ngenerated proving access to such a code from Lua. Therefore, it would be\r\nvalid to write Lua statements like:\r\n<PRE>...\r\nmyLine = Line:new (0,0,1,1)\r\n...\r\nif myLine:isSelected() == TRUE then\r\n&nbsp;myLine:draw(1.0,0.0,0.0)\r\nelse\r\n&nbsp;myLine:draw()\r\nend\r\n...\r\nmyLine:delete()\r\n...</PRE>\r\nThe package file (usually with extension <TT>.pkg</TT>) passed to <B>tolua</B>\r\nis not the real C/C++ header file, but a <I>cleaned </I>version of it.\r\n<B>tolua</B>\r\ndoes not implement a complete parse to interpret C/C++ code, but it understands\r\na few declarations that are used to describe the features that are to be\r\nexported to Lua. Regular header files can be included into packages files; <b>tolua</b>\r\nwill extract the code specified by the user to parse from the header (see <a href=\"#basics\">Basic Concepts</a>).\r\n<H3>\r\n<A NAME=\"using\"></A>How to use toLua</H3>\r\n<B>tolua </B>is composed by two pieces of code: an executable and a library.\r\nThe executable represents the parser that reads a package file and output\r\na C/C++ code that implements the binding to access the C/C++ features from\r\nLua. If the package file is a C++ like code (i.e., includes class definitions),\r\na C++ code is generated. If the cleaned header file is a C like code (i.e.,\r\nwithout classes), a C code is generated. <B>tolua</B> accepts a set of\r\noptions. Running <TT>\"tolua -h\"</TT> displays the current accepted options.\r\nFor instance, to parse a file called <TT>myfile.pkg\r\n</TT>generating the\r\nbinding code in <TT>myfile.c</TT>, we do:\r\n<P><TT>tolua -o myfile.c myfile.pkg</TT>\r\n<P>The generated code must be compiled and linked with the application\r\nto provide the desired access from Lua. Each parsed file represents a package\r\nbeing exported to Lua. By default, the package name is the input file root\r\nname (<TT>myfile </TT>in the example). The user can specify a different\r\nname for the package:\r\n<P><TT>tolua -n pkgname -o myfile.c myfile.pkg</TT>\r\n<P>The package should also be explicitly initialized. To initialize the\r\npackage from our C/C++ code, we must declare and call the initialization\r\nfunction. The initialization function is defined as\r\n<P><TT>int tolua_<I>pkgname</I>_open (lua_State*);</TT>\r\n<P>where <I><TT>pkgname </TT></I>represents the name of the package being\r\nbound. If we are using C++, we can opt for automatic initialization:\r\n<P><TT>tolua -a -n pkgname -o myfile.c myfile.pkg</TT>\r\n<P>In that case, the initialization function is automatically called. However,\r\nif we are planning to use multiple Lua states, automatic initialization\r\ndoes not work, because the order static variables are initialized in C++\r\nis not defined.\r\n<!--\r\n<P>The current <B>tolua</B> version also exports a closing function, which\r\ncan be called to unbind the package.\r\n<P><TT>void tolua_<I>pkgname</I>_close (void);</TT>\r\n-->\r\n<P>Optionally, the prototype of the <TT>open</TT> function\r\ncan be outputted to a header file, which name is given by the <TT>-H</TT>\r\noption.\r\n<P>The binding code generated by <B>tolua </B>uses a set of functions defined\r\nin the <B>tolua </B>library. Thus, this library also has to be linked with\r\nthe application. The file <TT>tolua.h</TT> is also necessary to compile\r\nthe generated code.\r\n<P>An application can use tolua object oriented framework (see <A HREF=\"#utilities\">exported\r\nutility functions</A>) without binding any package. In that case, the application\r\nmust call <B>tolua </B>initialization function (this function is called\r\nby any package file initialization function):\r\n<P><TT>int tolua_open (void);</TT>\r\n<!--\r\n<P>If multiple Lua states are to be used, after setting a Lua state, we\r\nneed to call a function to restore <B>tolua </B>internal state:\r\n<P><TT>void tolua_restorestate (void);</TT>\r\n-->\r\n<H3>\r\n<A NAME=\"basics\"></A>Basic Concepts</H3>\r\nThe first step in using <B>tolua</B> is to create the package file. Starting\r\nwith the real header files, we clean them by declaring the features we\r\nwant to access from Lua in a format that <B>tolua</B> can understand. The\r\nformat <B>tolua</B> understands is simple C/C++ declarations as described\r\nbelow.\r\n\r\n<H4>Including files</h4>\r\n\r\nA package file may include other package file. The general format\r\nto do that is:\r\n<p>\r\n<TT>$pfile \"<I>include_file</I>\"</TT>\r\n<p>\r\nA package file may also include regular C/C++ header files, using the <TT>hfile</TT>\r\nor <TT>cfile</tt> directive:\r\n<p>\r\n\r\n<tt>$cfile \"example.h\"</tt>\r\n<p>\r\nIn which case, <b>tolua</b> will extract the code enclosed between <tt>tolua_begin</tt>\r\nand <tt>tolua_end</tt>, or or <tt>tolua_export</tt> for a single line. Consider this C++ header as example:\r\n\r\n<PRE>\r\n\r\n#ifndef EXAMPLE_H\r\n#define EXAMPLE_H\r\n\r\nclass Example { // tolua_export\r\n\r\nprivate:\r\n\r\n\tstring name;\r\n\tint number;\r\n\r\npublic:\r\n\r\n\tvoid set_number(int number);\r\n\r\n\t//tolua_begin\r\n\r\n\tstring get_name();\r\n\tint get_number();\r\n};\r\n// tolua_end\r\n\r\n#endif\r\n</pre>\r\n\r\n<p>\r\nIn this case, the code that's not supported by <b>tolua</b> (the\r\nprivate part of the class), along with the function <tt>set_number</tt>\r\nis left outside of the package that includes this header.\r\n<p>\r\n\r\nFinally, lua files can be included on a package file, using <tt>$lfile</tt>:\r\n<p>\r\n\r\n<tt>$lfile \"example.lua\"</tt>\r\n<p>\r\n\r\n<b>New on tolua++</b>: an extra way to include source files is available since\r\nversion 1.0.4 of <b>tolua++</b>, using <tt>ifile</tt>:\r\n<p>\r\n\r\n<tt>$ifile \"filename\"</tt>\r\n<p>\r\n\r\n<tt>ifile</tt> also takes extra optional parameters after the filename, for example:\r\n<p>\r\n\r\n<tt>\r\n$ifile \"widget.h\", GUI<br>\r\n$ifile \"vector.h\", math, 3d\r\n</tt>\r\n<p>\r\n\r\n<tt>ifile</tt>'s default behaviour is to include the whole file, untouched. However,\r\nthe contents of the file and the extra parameters are put through the <tt>include_file_hook</tt>\r\nfunction before being included into the package (see <a href=\"#customizing\">Customizing tolua++</a>\r\nfor more details).\r\n<p>\r\n\r\n<H4>\r\nBasic types</H4>\r\n<B>tolua </B>automatically maps C/C++ basic types to Lua basic types. Thus,\r\n<TT>char</TT>,\r\n<TT>int</TT>,\r\n<TT>float</TT>, and <TT>double </TT>are mapped to the Lua type <TT>number</TT>;<TT>\r\nchar*</TT> is mapped to <TT>string</TT>; and<TT> void*</TT> is mapped to\r\n<TT>userdata</TT>. Types may be preceded by modifiers (<TT>unsigned</TT>,\r\n<TT>static</TT>, <TT>short</TT>, <TT>const</TT>, etc.); however, be aware\r\nthat <B>tolua </B>ignores the modifier <TT>const</TT> if applied to basic\r\ntypes. Thus, if we pass a constant basic type to Lua and then pass it back\r\nto C/C++ code where a non constant is expected, the constant to non constant\r\nconversion will be silently done.\r\n<P>Functions in C/C++ can also manipulate Lua objects explicitly. Thus\r\n<TT>lua_Object</TT>\r\nis also considered a basic type. In this case, any Lua value matches it.\r\n<p>\r\n\r\n<b>New on tolua++</b>: The C++ type <tt>string</tt> is also considered a basic type, and is passed as\r\na value to lua (using the <tt>c_str()</tt> method). This feature can be turned off\r\nwith the command line option <tt>-S</tt>.\r\n\r\n<H4>\r\nUser defined types</H4>\r\nAll other types that appear in the package file being processed are considered\r\nuser defined types. These are mapped to tagged userdata type in Lua. Lua\r\ncan only store pointers to user defined types; although, <B>tolua\r\n</B>automatically\r\nmakes the necessary arrangement to deal with references and values. For\r\ninstance, if a function or method returns a value of user defined type,\r\n<B>tolua\r\n</B>allocates\r\na clone object when returning it to Lua and sets the garbage collection\r\ntag method to automatically free the allocated object when no longer in\r\nuse by Lua.\r\n<P>For user defined types, <tt>const</tt>ness is preserved. Thus passing a non constant\r\nuser defined type to a function that expects constant type generates an\r\ntype mismatching error.\r\n<H4>\r\n<TT>NULL </TT>and <TT>nil</TT></H4>\r\nC/C++ <TT>NULL</TT> or <TT>0 </TT>pointers are mapped to Lua\r\n<TT>nil </TT>type;\r\nconversely, <TT>nil </TT>may be specified wherever a C/C++ pointer is expected.\r\nThis is valid for any type: <TT>char*</TT>,\r\n<TT>void*</TT>, and pointers\r\nto user defined types.\r\n<H4>\r\nTypedefs</H4>\r\n<B>tolua </B>also accepts simple typedef<I>'s </I>inside the package files.\r\nAny occurrence of a type after its definition is mapped by <B>tolua\r\n</B>to\r\nthe base type. They are useful because several packages redefine the basic\r\nC/C++ types to their own types. For instance, one can define the type <TT>real\r\n</TT>to\r\nrepresent a <TT>double</TT>. In that case, <TT>real\r\n</TT>can be used to\r\nspecify the variable types inside the package file interpreted by <B>tolua</B>,\r\nbut only if we include the following definition before any use of the type\r\n<TT>real</TT>.\r\n<P><TT>typedef double real;</TT>\r\n<P>Otherwise, <TT>real </TT>would be interpreted as a user defined type\r\nand would not be mapped to Lua numbers.\r\n<H4>\r\nIncluding real header files</H4>\r\nIn the package file, we must specify which are the real header files that\r\nshould be included so that the generated code can access the constants,\r\nvariables, functions, and classes we are binding. Any line in the package\r\nfile beginning with a <B>$ </B>(except $[hclp]file, $[ , and $] lines) is\r\ninserted into the generated binding C/C++ code without any change, but the\r\nelimination of the <B>$</B> itself. We use this feature to include the\r\nreal header files. So, our package files will usually start with a set\r\nof <B>$</B> beginning lines specifying the files that must be included,\r\nthat is, the files the package file is based on.\r\n<PRE>/* specify the files to be included */</PRE>\r\n\r\n<PRE>$#include &quot;header1.h&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // include first header\r\n$#include &quot;header2.h&quot;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // include second header</PRE>\r\nAs illustrated, <B>tolua </B>also accepts comments, using C or C++ convention,\r\ninside the package file. Nested C-like comments can also be used.\r\n<p>\r\nAlso note that files included with <tt>$cfile</tt> or <tt>$hfile</tt> don't\r\nneed to be included using this method, this is done automatically by <b>tolua</b>.\r\n\r\n<P>In the following sections, we describe how to specify the C/C++ code\r\nwe want to bind to Lua. The formats are simplified valid C/C++ statements.\r\n\r\n<H3>\r\n<A NAME=\"constants\"></A>Binding constants</H3>\r\nTo bind constants, <B>tolua </B>accepts both define's and enum's. For define's\r\nthe general format is:\r\n<PRE><B>#define</B> <I>NAME </I>[ <I>VALUE </I>]</PRE>\r\nThe value, as showed above, is optional. If such a code is inserted inside\r\nthe file being processed, <B>tolua </B>generates a code that allows the\r\nuse of <I><TT>NAME </TT></I>as a Lua global variable that has the corresponding\r\nC/C++ constant value. Only numeric constants are accepted.\r\n<p>\r\n<b>New on tolua++</b>: All other preprocessor directives are ignored.\r\n<P>For enum's, the general format is:\r\n<PRE><B>enum {\r\n</B>&nbsp; <I><TT>NAME1 </TT></I>[ <B>=</B> <I>VALUE1 </I>] <B>,\r\n</B>&nbsp; <I>NAM</I>E2 [ <B>=</B> <I>VALUE2 </I>] <B>,\r\n</B>&nbsp; ...\r\n&nbsp; <I>NAMEn </I>[ <B>=</B> <I>VALUEn </I>]\r\n<B>};</B></PRE>\r\nSimilarly, <B>tolua</B> creates a set of global variables, named <I><TT>NAMEi</TT></I>,\r\nwith their corresponding values.\r\n<H3>\r\n<A NAME=\"variables\"></A>Binding external variables</H3>\r\nGlobal extern variables can also be exported. In the cleaned header file\r\nthey are specified as:\r\n<PRE><TT>[</TT><B>extern</B><TT>]</TT><B> </B><I>type var</I><B>;</B></PRE>\r\n<B>tolua</B> binds such declarations to Lua global variables. Thus, in\r\nLua, we can access the C/C++ variable naturally. If the variable is non\r\nconstant, we can also assign the variable a new value from Lua. Global\r\nvariables that represent arrays of value can also be bound to Lua. Arrays\r\ncan be of any type. The corresponding Lua objects for arrays are Lua tables\r\nindexed with numeric values; however, be aware that index 1 in Lua is mapped\r\nto index 0 in an C/C++ array. Arrays must be pre dimensioned. For instance:\r\n<P><TT>double v[10];</TT>\r\n\r\n<p>\r\n<b>New on tolua++</b>: External variables can use the <tt>tolua_readonly</tt> modifier (see <a href=\"#additional_features\">Additional Features</a>)\r\n\r\n<H3>\r\n<A NAME=\"functions\"></A>Binding functions</H3>\r\nFunctions are also specified as conventional C/C++ declarations:\r\n<PRE><I>type funcname </I><B>(</B><I>type1 par1</I>[<B>,</B> <I>type2 <TT>par2</TT></I>[<B>,.</B>..<I>typeN parN</I>]]<B>);</B></PRE>\r\nThe returned type can be <TT>void</TT>, meaning no value is returned. A\r\nfunction can also have no parameter. In that case, <TT>void </TT>may be\r\nspecified in the place of the list of parameters. The parameter types must\r\nfollow the rules already posted. <B>tolua </B>creates a Lua function binding\r\nthe C/C++ function. When calling a function from Lua, the parameter types\r\nmust match the corresponding C/C++ types, otherwise, <B>tolua\r\n</B>generates\r\nan error and reports which parameter is wrongly specified. If a parameter\r\nname is omitted, <B>tolua </B>names it automatically, but its type should\r\nbe a basic type or user type previously used.\r\n<H4>\r\nArrays</H4>\r\n<B>tolua </B>also deals with function or method parameters that represent\r\narrays of values. The nice thing about arrays is that the corresponding\r\nLua tables have their values updated if the C/C++ function changes the\r\narray contents.\r\n<P>The arrays must be pre dimensioned. For instance:\r\n<P><TT>void func (double a[3]);</TT>\r\n<P>is a valid function declaration for <B>tolua</B> and calling this function\r\nfrom Lua would be done by, for instance:\r\n<P><TT>p = {1.0,1.5,8.6}</TT>\r\n<BR><TT>func (p)</TT>\r\n<P>The array dimension need not be a constant expression; the dimension\r\ncan also be specified by any expression that can be evaluated in run time.\r\nFor instance:\r\n<P><TT>void func (int n, int m, double image[n*m]);</TT>\r\n<P>is also valid since the expression <TT>n*m</TT> is valid in the binding\r\nfunction scope. However, be aware that <B>tolua </B>uses dynamic allocation\r\nfor binding this function, what can degrade the performance.\r\n<P>Despite the dimension specification, it is important to know that all\r\narrays passed to the actual C/C++ function are in the local scope of the\r\nbinding function. So, if the C/C++ function being called needs to hold\r\nthe array pointer for later use, the binding code will <I>not </I>work\r\nproperly.\r\n<H4>\r\nOverloaded functions</H4>\r\nOverloaded functions are accepted. Remember that the distinction between\r\ntwo functions with the same name is made based on the parameter types that\r\nare mapped to Lua. So, although\r\n<P><TT>void func (int a);</TT>\r\n<BR><TT>void func (double a);</TT>\r\n<P>represent two different functions in C++, they are the same function\r\nfor <B>tolua</B>, because both <TT>int </TT>and <TT>double </TT>are mapped\r\nto the same Lua type: <TT>number</TT>.\r\n<P>Another tricky situation occurs when expecting pointers. Suppose:\r\n<PRE>void func (char* s);\r\nvoid func (void* p);\r\nvoid func (Object1* ptr);\r\nvoid func (Object2* prt);</PRE>\r\nAlthough these four functions represent different functions in C++, a Lua\r\nstatement like:\r\n<PRE>func(nil)</PRE>\r\nmatches all of them.\r\n<P>It is important to know that <B>tolua </B>decides which function will\r\nbe called in run-time, trying to match each provided function. <B>tolua\r\n</B>first\r\ntries to call the last specified function; if it fails, <B>tolua\r\n</B>then\r\ntries the previous one. This process is repeated until one function matches\r\nthe calling code or the first function is reached. For that reason, the\r\nmismatching error message, when it occurs, is based on the first function\r\nspecification. When performance is important, we can specify the most used\r\nfunction as the last one, because it will be tried first.\r\n<P><B>tolua</B> allows the use of overloaded functions in C, see <A HREF=\"#renaming\">Renaming\r\n</A>for\r\ndetails.\r\n<H4>\r\nDefault parameter values</H4>\r\nThe last function parameters can have associated default values. In that\r\ncase, if the function is called with fewer parameters, the default values\r\nare assumed. The format to specify the default values is the same as the\r\none used in C++ code:\r\n<P><TT><I>type funcname </I><B>(</B><I>...</I><B>,</B><I> typeN-1 parN-1\r\n[= valueN-1]<B>,</B> typeN parN [= valueN]</I><B>);</B></TT>\r\n<P><B>toLua </B>implements this feature without using any C++ mechanism;\r\nso, it can be used also to bind C functions.\r\n<P>We can also specify default values for the elements of an array (there\r\nis no way to specify a default value for the array itself, though). For\r\ninstance:\r\n<P><TT>void func (int a[5]=0);</TT>\r\n<P>sets the default element values to zero, thus the function can be called\r\nfrom Lua with an uninitialized table.\r\n<P>For Lua object types (<TT>lua_Object</TT>), <B>tolua </B>defines a constant\r\nthat can be used to specify <TT>nil </TT>as default value:\r\n<P><TT>void func (lua_Object lo = TOLUA_NIL);</TT>\r\n<p>\r\n\r\n<b>New on tolua++</b>: C++ class constructors are valid\r\nas default parameters. For example:\r\n<p>\r\n<tt>void set_color(const Color& color = Color(0,0,0));</tt>\r\n<p>\r\n\r\n<H4>\r\nMultiple returned values</H4>\r\nIn Lua, a function may return any number of values. <B>tolua </B>uses this\r\nfeature to simulate values passed by reference. If a function parameter\r\nis specified as a pointer to or reference of a basic type or a pointer\r\nto or reference of a pointer to an user defined type, <B>tolua </B>accepts\r\nthe corresponding type as input and returns, besides the conventional function\r\nreturned value, if any, the updated parameter value.\r\n<P>For instance, consider a C function that swaps two values:\r\n<P><TT>void swap (double* x, double* y);</TT>\r\n<P>or\r\n<P><TT>void swap (double&amp; x, double&amp; y);</TT>\r\n<P>If such a function is declared in the package file, <B>tolua </B>binds\r\nit as a function receiving two numbers as input and returning two numbers.\r\nSo, a valid Lua code would be:\r\n<P><TT>x,y = swap(x,y)</TT>\r\n<P>If the input values are not used, the use of default parameter value\r\nallows calling the function from Lua without specifying them:\r\n<P><TT>void getBox (double* xmin=0, double* xmax=0, double* ymin=0, double*\r\nymax=0);</TT>\r\n<P>In Lua:\r\n<P><TT>xmin, xmax, ymin, ymax = getBox()</TT>\r\n<P>With user defined types, we would have for instance:\r\n<P><TT>void update (Point** p);</TT>\r\n<P>or\r\n<P><TT>void update (Point*&amp; p);</TT>\r\n<H3>\r\n<A NAME=\"structs\"></A>Binding struct fields</H3>\r\nUser defined types are nicely bound by <B>tolua</B>. For each variable\r\nor function type that does not correspond to a basic type, <B>tolua </B>automatically\r\ncreates a tagged userdata to represent the C/C++ type. If the type corresponds\r\nto a struct, the struct fields can be directly accessed from Lua, indexing\r\na variable that holds an object of such a type. In C code, these types\r\nare commonly defined using typedef's:\r\n<PRE><B>typedef struct [name]</B><I> </I><B>{\r\n</B>&nbsp;&nbsp; <I>type1 fieldname1</I><B>;\r\n</B>&nbsp;&nbsp; <I>type2 fieldname2</I><B>;\r\n</B>&nbsp;&nbsp; ...\r\n&nbsp;&nbsp; <I>typeN fieldnameN</I><B>;\r\n} </B><I>typename</I><B>;</B></PRE>\r\nIf such a code is inserted in the package file being processed, <B>tolua\r\n</B>allows\r\nany variable that holds an object of type <I><TT>typename </TT></I>to access\r\nany listed field indexing the variable by the field name. For instance,\r\nif <TT>var </TT>holds a such object, <I><TT>var.fieldnamei</TT></I> accesses\r\nthe field named <I><TT>fieldnamei</TT></I>.\r\n<P>Fields that represent arrays of values can also be mapped:\r\n<P><TT>typedef struct {</TT>\r\n<BR><TT>&nbsp; int x[10];</TT>\r\n<BR><TT>&nbsp; int y[10];</TT>\r\n<BR><TT>} Example;</TT>\r\n<BR>&nbsp;\r\n<H3>\r\n<A NAME=\"classes\"></A>Binding classes and methods</H3>\r\nC++ class definitions are also supported by <B>tolua</B>. Actually, the\r\n<B>tolua\r\n</B>deals\r\nwith single inheritance and polymorphism in a natural way. The subsections\r\nbelow describe what can be exported by a class definition.\r\n<H4>\r\nSpecifying inheritance</H4>\r\nIf <TT>var </TT>is a Lua variable that holds an object of a derived class,\r\n<TT>var\r\n</TT>can\r\nbe used wherever its base class type is expected and <TT>var\r\n</TT>can access\r\nany method of its base class. For this mechanism to take effect, we must\r\nindicate that the derived class actually inherits the base class. This\r\nis done in the conventional way:\r\n<PRE><B>class </B><I>classname </I><B>: public</B> <I>basename\r\n</I><B>{</B></PRE>\r\n\r\n<PRE>&nbsp;/* class definition */</PRE>\r\n\r\n<PRE><B>};</B></PRE>\r\n<p>\r\n\r\nIn this case, the definition of <tt>basename</tt> needs to appear before <tt>classname</tt>\r\nif the inheritance properties are to be taken advantage of from lua.\r\n\r\n<h4>Multiple inheritance</h4>\r\n\r\n<b>tolua++</b> (starting from version 1.0.4) supports multiple inheritance by allowing you\r\nto access the extra parents 'manually'.\r\n<p>\r\nFor example, consider the following class:\r\n<p>\r\n\r\n<PRE>\r\nclass Slider : public Widget, public Range {\r\n\t...\r\n};\r\n</PRE>\r\n<p>\r\n\r\nAn object of type 'Slider' will fully retain its inheritance with Widget,\r\nand will contain a 'member' of type Range, which will return the object\r\ncast to the correct base type.\r\n<p>\r\n\r\nFor example:\r\n<p>\r\n\r\n<PRE>\r\nslider = Slider:new()\r\nslider:show() -- a Widget method\r\n\r\nslider:set_range(0, 100) -- this won't work, because\r\n                         -- set_range is a method from Range\r\n\r\nslider.__Range__:set_range(0, 100) -- this is the correct way\r\n</PRE>\r\n\r\n<p>\r\n\r\nThis is an experimental feature.\r\n<p>\r\n\r\n<H4>\r\nSpecifying exported members and methods</H4>\r\nAs for struct fields, class fields, static or not, can be exported. Class\r\nmethods and class static methods can also be exported. Of course, they\r\nmust be declared as public in the actual C++ code (the\r\n<TT>public:</TT>keyword may appear in the package files, it will be ignored by <b>tolua</b>).\r\n<P>For each bound class, <B>tolua </B>creates a Lua table and stores it\r\nat a variable which name is the name of the C++ class. This tables may contain other\r\ntables that represent other tables, the way C++ classes may contain other classes and structs.\r\nStatic exported\r\nfields are accessed by indexing this table with the field names (similar\r\nto struct fields). Static methods are also called using this table, with a colon.\r\nNon static exported fields are accessed by indexing\r\nthe variable that holds the object. Class methods follow the format of\r\nthe function declaration showed above. They can be accessed from Lua code\r\nusing the conventional way Lua uses to call methods, applied of course\r\nto a variable that holds the appropriate object or to the class table,\r\nfor static methods.\r\n<P>There are a few special methods that are also supported by <B>tolua</B>.\r\nConstructors are called as static methods, named <TT>new</TT>, <tt>new_local</tt> (on <b>tolua++</b>),\r\nor calling the class name directly (also on <b>tolua++</b>, see below for the difference betwheen these methods). Destructors\r\nare called as a conventional method called <TT>delete</TT>.\r\n<P>Note that <B>tolua </B>does support overload. This applies even for\r\nconstructors. Also note that the <TT>virtual </TT>keyword has no effect\r\nin the package file.\r\n<P>The following code exemplifies class definitions that can be interpreted\r\nby <B>tolua</B>.\r\n<PRE>class Point {\r\n&nbsp;&nbsp; static int n;&nbsp;&nbsp;&nbsp; // represents the total number of created Points\r\n&nbsp;&nbsp; static int get_n();&nbsp;&nbsp;&nbsp; // static method\r\n\r\n&nbsp;&nbsp; double x;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // represents the x coordinate\r\n&nbsp;&nbsp; double y;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // represents the y coordinate</PRE>\r\n\r\n<PRE>&nbsp;&nbsp; static char* className (void);&nbsp;&nbsp; // returns the name of the class</PRE>\r\n\r\n<PRE>&nbsp;&nbsp; Point (void);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // constructor 1\r\n&nbsp;&nbsp; Point (double px, double py);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // constructor 2\r\n&nbsp;&nbsp; ~Point (void);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // destructor</PRE>\r\n\r\n<PRE>&nbsp;&nbsp; Point add (Point&amp; other);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add points, returning another one\r\n};</PRE>\r\n\r\n<PRE>class ColorPoint : public Color {\r\n&nbsp;&nbsp; int red;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // red color component [0 - 255]\r\n&nbsp;&nbsp; int green;&nbsp;&nbsp;&nbsp; // green color component [0 - 255]\r\n&nbsp;&nbsp; int blue;&nbsp;&nbsp;&nbsp;&nbsp; // blue color component [0 - 255]</PRE>\r\n\r\n<PRE>&nbsp;&nbsp; ColorPoint (double px, double py, int r, int g, int b);\r\n};</PRE>\r\nIf this segment of code is processed by <B>tolua</B>, we would be able\r\nto write the following Lua statements:\r\n<PRE>p1 = Point:new(0.0,1.0)\r\np2 = ColorPoint:new(1.5,2.2,0,0,255)\r\nprint(Point.n)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- would print 2\r\nprint(Point:get_n())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- would also print 2\r\np3 = p1:add(p2)\r\nlocal p4 = ColorPoint()\r\nprint(p3.x,p3.y)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- would print 1.5 and 3.2\r\nprint(p2.red,p2.green,p2.blue)&nbsp;&nbsp;&nbsp;&nbsp; -- would print 0, 0, and 255\r\np1:delete()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- call destructor\r\np2:delete()&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- call destructor</PRE>\r\n\r\nNote that we can only explicitly delete objects that we explicitly create.\r\nIn the example above, the point <TT>p3</TT> will be garbage-collected by\r\n<B>tolua\r\n</B>automatically;\r\nwe cannot delete it.\r\n<p>\r\n<b>New on tolua++</b>: Also note that <tt>p4</tt> is created by calling the class name directly (<tt>ColorPoint()</tt>); this has the same effect as calling <tt>new_local</tt>, which\r\nleaves the object to be deleted by the garbaje collector, and it should not be\r\ndeleted using <tt>delete</tt>. For each constructor on the pkg, one <tt>new</tt>,\r\n<tt>new_local</tt> and <tt>.call</tt> callback for the class is created.\r\n<P>Of course, we need to specify only the methods and members we want to\r\naccess from Lua. Sometimes, it will be necessary to declare a class with\r\nno member or method just for the sake of not breaking a chain of inheritances.\r\n\r\n<h4>Using Regular functions as class methods</h4>\r\n<p>\r\n\r\n<b>tolua++</b> (starting from version 1.0.5) uses the keyword <b>tolua_outside</b> to specify regular functions\r\nas methods and static methods of a class or struct. For example:\r\n\r\n<PRE><tt>\r\n/////////////// position.h:\r\n\r\ntypedef struct {\r\n\r\n\tint x;\r\n\tint y;\r\n} Position;\r\n\r\nPosition* position_create();\r\nvoid position_set(Position* pos, int x, int y);\r\n\r\n/////////////// position.pkg:\r\n\r\nstruct Position {\r\n\r\n\tint x;\r\n\tint y;\r\n\r\n\tstatic tolua_outside Position* position_create @ create();\r\n\ttolua_outside void position_set @ set(int x, int y);\r\n};\r\n\r\n--------------- position.lua\r\n\r\nlocal pos = Position:create()\r\n\r\npos:set(10, 10)\r\n\r\n</tt></pre>\r\n\r\nNote that the <b>position_set</b> method takes a pointer to <b>Position</b> as its first parameter,\r\nthis is ommited on the <b>tolua_outside</b> declaration. Also note that we cannot name our methods\r\n<b>new</b> or <b>new_local</b>, or as overloaded operators (see next section), this will result in\r\nundefined behaviour.\r\n\r\n\r\n<H4>\r\nOverloaded operators</H4>\r\n<B>tolua </B>automatically binds the following binary operators:\r\n<UL>\r\n<PRE>operator+&nbsp;&nbsp; operator-&nbsp;&nbsp; operator*&nbsp;&nbsp; operator/&nbsp;\r\noperator&lt;&nbsp;&nbsp; operator&gt;=&nbsp;&nbsp;operator==&nbsp;&nbsp;operator[]</PRE>\r\n</UL>\r\nFor the relational operators, <B>toLua </B>also automatically converts\r\na returned <TT>0</TT> value into <TT>nil</TT>, so <I>false </I>in C becomes\r\n<I>false\r\n</I>in\r\nLua.\r\n<P>As an example, suppose that in the code above, instead of having:\r\n<PRE>&nbsp;&nbsp; Point add (Point&amp; other);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add points, returning another one</PRE>\r\nwe had:\r\n<PRE>&nbsp;&nbsp; Point operator+ (Point&amp; other);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // add points, returning another one</PRE>\r\nIn that case, in Lua, we could simply write:\r\n<PRE>p3 = p1 + p2</PRE>\r\nThe indexing operator (<TT>operator[]</TT>) when receiving a numeric parameter\r\ncan also be exported to Lua. In this case, <B>tolua </B>accepts reference\r\nas returned value, even for basic types. Then if a reference is returned,\r\nfrom Lua, the programmer can either get or set the value. If the returned\r\nvalue is not a reference, the programmer can only get the value. An example\r\nmay clarify: suppose we have a vector class and bind the following operator:\r\n<PRE>&nbsp;&nbsp; double&amp; operator[] (int index);</PRE>\r\nIn this case, in Lua, we would be able to write: <TT>value = myVector[i]</TT>\r\nand also <TT>myVector[i] = value</TT>, which updates the C++ object. However,\r\nif the bound operator was:\r\n<PRE>&nbsp;&nbsp; double operator[] (int index);</PRE>\r\nwe would only be able to write: <TT>value = myVector[i]</TT>.\r\n<P>Free functions (i.e., not class members) that overload operators are\r\nnot supported.\r\n\r\n<p>\r\n\r\n<H4>\r\nCast operators</H4>\r\n\r\n<b>New on tolua++</b> (versions 1.0.90 and up): casting operators are also supported.\r\nFor example:\r\n\r\n<pre>\r\n/////////////// node.h\r\n\r\n// a class that holds a value that can be of type int, double, string or Object*\r\nclass Node { // tolua_export\r\n\r\nprivate:\r\n\tunion {\r\n\t\tint int_value;\r\n\t\tdouble double_value;\r\n\t\tstring string_value;\r\n\t\tObject* object_value;\r\n\t};\r\n\r\n// tolua_begin\r\npublic:\r\n\r\n\tenum Type {\r\n\t\tT_INT,\r\n\t\tT_DOUBLE,\r\n\t\tT_STRING,\r\n\t\tT_OBJECT,\r\n\t\tT_MAX,\r\n\t};\r\n\r\n\tType get_type();\r\n\r\n\toperator int();\r\n\toperator double();\r\n\toperator string();\r\n\toperator Object*();\r\n};\r\n// tolua_end\r\n</pre>\r\n\r\n<b>tolua++</b> will produce code that calls the operators by casting the object Node (using C++ <tt>static_cast</tt>),\r\nand register them inside the class as \".typename\". For example:\r\n\r\n<pre>\r\n-- node.lua\r\n\r\nlocal node = list.get_node(\"some_node\") -- returns a Node object\r\n\r\nif node.get_type() == Node.T_STRING then\r\n\r\n\tprint(\"node is \"..node[\".string\"]())\r\n\r\nelseif node.get_type() == Node.T_OBJECT then\r\n\r\n\tlocal object = node[\".Object*\"]()\r\n\tobject:method()\r\nend\r\n\r\n</pre>\r\n\r\n<h3><a name=\"properties\"></a>Binding Properties</h3>\r\n\r\n<b>tolua++</b> (starting from version 1.0.6) supports declaration of class propeties,\r\nusing the <tt>tolua_property</tt> keyword. A\r\nproperty will look like a 'field' of the class, but it's value will be retrieved\r\nusing class methods. For example:\r\n\r\n<pre>\r\n/////////////// label.h\r\n\r\nclass Label {\r\n\r\npublic:\r\n\r\n\tstring get_name();\r\n\tvoid set_name(string p_name);\r\n\r\n\tWidget* get_parent();\r\n};\r\n\r\n/////////////// label.pkg\r\nclass Label {\r\n\r\n\ttolua_property string name;\r\n\r\n\ttolua_readonly tolua_property Widget* parent;\r\n};\r\n\r\n--------------- label.lua\r\n\r\nlocal label = Label()\r\n\r\nlabel.name = \"hello\"\r\nprint(label.name)\r\n\r\nlabel.parent:show()\r\n\r\n</pre>\r\n\r\n<h4>Property types</h4>\r\n<p>\r\n\r\nA property can have differt types, which determine how it's value will be set and retrieved.\r\n<b>tolua++</b> comes with 3 different built-in types:\r\n<p>\r\n\r\n<li> <tt>default</tt> will use 'get_name' and 'set_name' methods to access a property called 'name'\r\n<li> <tt>qt</tt> will use 'name' and 'setName'\r\n<li> <tt>overload</tt> will use 'name' and 'name' (as in 'string name(void);' to get and 'void name(string);' to set)\r\n<p>\r\n\r\nThe property type can be appended at the end of the 'tolua_property' keyword on the declaration:\r\n\r\n<ul><tt>tolua_property__qt string name;</tt></ul>\r\n\r\nWhen no type is specified, <tt>default</tt> will be used, but this can be changed (see below).\r\n<p>\r\n\r\n<h4>Changing the default property type</h4>\r\n<p>\r\n\r\nThe default property type can be changed using the 'TOLUA_PROPERTY_TYPE' macro. This will change the\r\ndefault type from the point of its invocation, until the end of the block that contains it. For example:\r\n<p>\r\n\r\n<pre>\r\n\r\nTOLUA_PROPERTY_TYPE(default); // default type for the 'global' scope\r\n\r\nnamespace GUI {\r\n\r\n\tclass Point {\r\n\r\n\t\ttolua_property int x; // will use get_x/set_x\r\n\t\ttolua_property int y; // will use get_y/set_y\r\n\t};\r\n\r\n\tTOLUA_PROPERTY_TYPE(qt); // changes default type to 'qt' for the rest of the 'GUI' namespace\r\n\r\n\tclass Label {\r\n\r\n\t\ttolua_property string name; // will use name/setName\r\n\t};\r\n};\r\n\r\nclass Sprite {\r\n\r\n\ttolua_property GUI::Point position; // will use get_position/set_position\r\n\r\n\ttolua_property__overload string name; // will use name/name\r\n};\r\n\r\n</pre>\r\n\r\n<h4>Adding custom property types</h4>\r\n<p>\r\n\r\nCustom property types can be added by redefining the function \"get_property_methods_hook\"\r\n(see <a href=\"#customizing\">Customizing tolua++</a> for more details). The functions takes\r\nthe property type and the name, and returns the setter and getter function names. For example:\r\n<p>\r\n\r\n<pre>\r\n\r\n/////////////// custom.lua\r\n\r\nfunction get_property_methods_hook(ptype, name)\r\n\r\n\tif ptype == \"hungarian_string\" then\r\n\r\n\t\treturn \"sGet\"..name, \"Set\"..name\r\n\tend\r\n\r\n\tif ptype == \"hungarian_int\" then\r\n\r\n\t\treturn \"iGet\"..name, \"Set\"..name\r\n\tend\r\n\t-- etc\r\nend\r\n\r\n/////////////// label.pkg\r\nclass Label {\r\n\r\n\ttolua_property__hungarian_string string Name; // uses 'sGetName' and 'SetName'\r\n\r\n\ttolua_property__hungarian_int string Type; // uses 'iGetType' and 'SetType'\r\n};\r\n\r\n</pre>\r\n\r\n<h3><a name=\"templates\"></a>Class Templates</h3>\r\n\r\nOne of the additional features of <b>tolua++</b> is the support for class templates,\r\nby using the <tt>TOLUA_TEMPLATE_BIND</tt> directive. For example:\r\n\r\n<pre>\r\nclass vector {\r\n\r\n\tTOLUA_TEMPLATE_BIND(T, int, string, Vector3D, double)\r\n\r\n\tvoid clear();\r\n\tint size() const;\r\n\r\n\tconst T& operator[](int index) const;\r\n\tT& operator[](int index);\r\n\tvoid push_back(T val);\r\n\r\n\tvector();\r\n\t~vector();\r\n};\r\n</pre>\r\n\r\nThe <tt>TOLUA_TEMPLATE_BIND</tt> directive has to be the first thing on the class declaration, otherwise it will be ignored.\r\nThis code will create 4 versions of the class <tt>vector</tt>, one for each type\r\nspecified on the <tt>TOLUA_TEMPLATE_BIND</tt> parameters, each replacing the macro <tt>T</tt>\r\n(specified as the first argument of <tt>TOLUA_TEMPLATE_BIND</tt>).\r\nThus, the functions <tt>operator[]</tt>, <tt>&operator[]</tt> and <tt>push_back</tt>\r\nwill have different signatures on each version of the object. The objects will be\r\nrecognized as <tt>vector&lt;type&gt;</tt> on further declarations, and the name of\r\nthe table on Lua will be <tt>vector_type_</tt>. Thus, the following Lua code could be used:\r\n\r\n<pre>\r\nstring_vector = vector_string_:new_local()\r\nstring_vector:push_back(\"hello\")\r\nstring_vector:push_back(\"world\")\r\nprint(string_vector[0]..\" \"..string_vector[1])\r\n</pre>\r\n\r\nSimilarily, a template with more than 1 macro could be bound, and it could also\r\ninherit from another template:\r\n\r\n<pre>\r\nclass hash_map : public map&lt;K,V&gt; {\r\n\r\n\tTOLUA_TEMPLATE_BIND(K V, int string, string vector&lt;double&gt;)\r\n\r\n\tV get_element(K key);\r\n\tvoid set_element(K key, V value);\r\n\r\n\thash_map();\r\n\t~hash_map();\r\n};\r\n</tt></pre>\r\n\r\nIn this example, one of the objects has another template as one of its types, so\r\nit will be recognized as <tt>hash_map&lt;string,vector&lt;double&gt; &gt;</tt> while\r\nits constructor will be on the Lua table hash_map_string_vector_double___ (see\r\n<a href=\"#type_renaming\">Type Renaming</a> for a better way to access these objects).\r\n<p>\r\n\r\nNote that due to the complexity in the definition of some templates, you should be\r\ncareful on how you declare them. For example, if you create an object with type\r\n<tt>hash_map&lt;string,vector&lt;double&gt; &gt;</tt> and then declare a variable\r\nwith type <tt>hash_map&lt;string, vector&lt;double&gt; &gt;</tt> (note the space\r\nbetween string and vector), the type of the variable will not be recognized. The\r\nsafest way is to declare a typedef, and use that to use each type (this is also a\r\ncommon practice on C++ programming). For example, using the previous declaration of\r\n<tt>vector</tt>:\r\n<p>\r\n\r\n<pre>\r\ntypedef vector<int> VectorInt;\r\n\r\nVectorInt variable;\r\n</pre>\r\n\r\n<tt>TOLUA_TEMPLATE_BIND</tt> can be used with more than one parenthesis to open and close,\r\nin order to be valid as a macro inside a regular .h file. The <tt>TOLUA_TEMPLATE_BIND</tt>\r\nmacro is declared on <tt>tolua.h</tt> as:\r\n<p>\r\n<tt>#define TOLUA_TEMPLATE_BIND(x)</tt>\r\n<p>\r\n\r\nAlso, the parameters can have double quotes. Thus, the following uses are valid:\r\n<p>\r\n\r\n<pre>\r\nTOLUA_TEMPLATE_BIND((T, int, float)) // to be used inside a real header file\r\nTOLUA_TEMPLATE_BIND(\"K V\", \"string string\", int double)\r\n</pre>\r\n\r\nFunction templates are not supported on this version.\r\n\r\n<H3>\r\n<A NAME=\"modules\"></A>Module definition</H3>\r\n<B>tolua </B>allows us to group constants, variables, and functions in\r\na module. The module itself is mapped to a table in Lua, and its constants,\r\nvariables, and functions are mapped to fields in that table. The general\r\nformat to specify a module is:\r\n<P><TT><B>module</B> name</TT>\r\n<BR><B><TT>{</TT></B>\r\n<BR><TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... // constant, variable, and function\r\ndeclarations</TT>\r\n<BR><B><TT>}</TT></B>\r\n<P>Thus, if we bound the following module declaration:\r\n<P><TT>module mod</TT>\r\n<BR><TT>{</TT>\r\n<BR><TT>&nbsp;#define N</TT>\r\n<BR><TT>&nbsp;extern int var;</TT>\r\n<BR><TT>&nbsp;int func (...):</TT>\r\n<BR><TT>}</TT>\r\n<P>In Lua we would be able to access such features by indexing the module:\r\n<TT>mod.N</TT>,\r\n<TT>mod.var</TT>,\r\n<TT>mod.func</TT>.\r\n<H3>\r\n<A NAME=\"renaming\"></A>Renaming constants, variables and functions</H3>\r\nWhen exporting constants, variable, and functions (members of a class or\r\nnot), we can rename them, such that they will be bound with a different\r\nname from their C/C++ counterparts. To do that, we write the name they\r\nwill be referenced in Lua after the character <TT>@</TT>. For instance:\r\n<P><TT>extern int cvar @ lvar;</TT>\r\n<P><TT>#define CNAME @ LNAME</TT>\r\n<P><TT>enum {</TT>\r\n<BR><TT>&nbsp; CITEM1 @ LITEM1,</TT>\r\n<BR><TT>&nbsp; CITEM2 @ LITEM2,</TT>\r\n<BR><TT>&nbsp; ...</TT>\r\n<BR><TT>};</TT>\r\n<P><TT>void cfunc @ lfunc (...);</TT>\r\n<P><TT>class T</TT>\r\n<BR><TT>{</TT>\r\n<BR><TT>&nbsp;&nbsp; double cfield @ lfield;</TT>\r\n<BR><TT>&nbsp;&nbsp; void cmeth @ lmeth (...);</TT>\r\n<BR><TT>&nbsp;&nbsp; ...</TT>\r\n<BR><TT>};</TT>\r\n<P>In such a case, the global variable <TT>cvar </TT>would be identified\r\nin Lua by <TT>lvar</TT>, the constant <TT>CNAME </TT>by <TT>LNAME</TT>,\r\nand so on. Note that class cannot be renamed, because they represent types\r\nin C.\r\n<P>This renaming feature allows function overload in C, because we can\r\nchoose to export two different C functions with a same Lua name:\r\n<P><TT>void glVertex3d @ glVertex (double x, double y, double z=0.0);</TT>\r\n<BR><TT>void glVertexdv @ glVertex (double v[3]=0.0);</TT>\r\n\r\n<a name=\"type_renaming\"></a><h3>Renaming Types</h3>\r\n\r\nTypes can be renamed using the <tt>$renaming</tt> directive on pkg files, using the\r\nformat:\r\n<p>\r\n\r\n<tt>$renaming real_name @ new_name</tt>\r\n<p>\r\n\r\nThe parameters to renaming can be Lua <i>patterns</i>. For example:\r\n<p>\r\n\r\n<pre>\r\n$renaming ^_+ @\r\n$renaming hash_map&lt;string,vector&lt;double&gt; &gt; @ StringHash\r\n</pre>\r\n\r\nThe first example will remove all underscores at the beginning of all types,\r\nthe second will rename the template type hash_map&lt;string,vector&lt;double&gt; &gt;\r\nto StringHash. Once renamed, the Lua table for each type can be accessed only by their\r\nnew name, for example: <tt>StringHash:new()</tt>\r\n\r\n<A NAME=\"additional\"></A><h3>Storing additional fields</H3>\r\nFinally, it is important to know that even though the variables that hold\r\nC/C++ objects are actually tagged userdata for Lua,<B> tolua</B> creates\r\na mechanism that allows us to store any additional field attached to these\r\nobjects. That is, these objects can be seen as conventional Lua tables.\r\n<PRE>obj = <I>ClassName</I>:new()</PRE>\r\n\r\n<PRE>obj.myfield = 1&nbsp; -- even though &quot;myfield&quot; does not represent a field of ClassName</PRE>\r\nSuch a construction is possible because, if needed, <B>tolua </B>automatically\r\ncreates a Lua table and associates it with the object. So that, the object\r\ncan store additional fields not mapped to C/C++, but actually stored in\r\nthe conjugate table. The Lua programmer accesses the C/C++ features and\r\nthese additional fields in an uniform way. Note that, in fact, these additional\r\nfields overwrite C/C++ fields or methods when the names are the same.\r\n\r\n\r\n\r\n<a name=\"additional_features\"></a><h3>Additional features on tolua++</h3>\r\n\r\n<h4>Multiple variable declarations</h4>\r\n\r\nMultiple variables of the same type can be declared at the same time, for example:\r\n<p>\r\n<tt>float x,y,z;</tt>\r\n<p>\r\nwill create 3 different variables of type float. Make sure you don't leave any\r\nspaces between the commas, as that will raise a parse error.\r\n<p>\r\n\r\n<h4>tolua_readonly</h4>\r\n\r\nAny variable declaration can use the <tt>tolua_readonly</tt> modifier, to ensure\r\nthat the variable is read-only, even when its type is not <tt>const</tt>. Example:\r\n\r\n<pre>\r\nclass Widget {\r\n\r\n\ttolua_readonly string name;\r\n};\r\n</pre>\r\n\r\nThis feature could be used to 'hack' the support for other unsupported things like\r\n<tt>operator-&gt;</tt>. Consider this example <tt>pkg</tt> file:\r\n\r\n<pre>\r\n$hfile \"node.h\"\r\n$#define __operator_arrow operator->()\r\n$#define __get_name get_name()\r\n</pre>\r\n\r\nAnd on the file <tt>node.h</tt>:\r\n\r\n<pre>\r\ntemplate class&lt;T&gt;\r\nclass Node { // tolua_export\r\n\r\nprivate:\r\n\tstring name;\r\n\tT* value;\r\n\r\npublic:\r\n\r\n\tT* operator->() {return value;};\r\n\tstring get_name() {return name;};\r\n\r\n\t// tolua_begin\r\n\r\n\t#if 0\r\n\tTOLUA_TEMPLATE_BIND(T, Vector3D)\r\n\r\n\ttolua_readonly __operator_arrow @ p;\r\n\ttolua_readonly __get_name @ name;\r\n\t#endif\r\n\r\n\r\n\tNode* next;\r\n\tNode* prev;\r\n\r\n\tvoid set_name(string p_name) {name = p_name;};\r\n\r\n\tNode();\r\n};\r\n// tolua_end\r\n</pre>\r\n\r\nWhile not a pretty thing to do to a header file, this accomplishes a number of\r\nthings:\r\n<p>\r\n\r\n<li> The method <tt>operator->()</tt> can be used from Lua by calling the variable\r\n<tt>p</tt> on the object.</li>\r\n<li> The method <tt>get_name()</tt> can be using from Lua by calling the variable\r\n<tt>name</tt> on the boject.</li>\r\n\r\nExample lua usage:\r\n\r\n<pre>\r\nnode = Node_Vector3D_:new_local()\r\n-- do something with the node here --\r\nprint(\"node name is \"..node.name)\r\nprint(\"node value is \".. node.p.x ..\", \".. node.p.y ..\", \".. node.p.z)\r\n</pre>\r\n\r\nSince <b>tolua++</b> ignores all preprocessor directives (except for #define), <tt>node.h</tt>\r\nremains a valid C++ header file, and also a valid source for <b>tolua++</b>,\r\neliminating the need to maintain 2 different files, even for objects with\r\nunusual features such as these ones.\r\n\r\n<p>\r\n\r\nThe ability to rename functions as variables might be expanded on future versions.\r\n\r\n<h4>Defining values on command line</h4>\r\n\r\nStarting from version 1.0.92, the command line option <tt>-E</tt> allows\r\nyou to introduce values into to the luastate where <b>tolua++</b> runs,\r\nsimilar to GCC's <tt>-D</tt>. For example:\r\n<p>\r\n\r\n<pre>$ tolua++ -E VERSION=5.1 -E HAVE_ZLIB package.pkg > package_bind.cpp</pre>\r\n\r\n<p>\r\nThis will add 2 fields to the global table <tt>_extra_parameters</tt>:\r\n\"VERSION\", with the string value \"5.1\", and \"HAVE_ZLIB\" with the boolean value\r\n<tt>true</tt>. For the moment, there is no way to 'use' these values, except\r\nin custom scripts defined by the user (see\r\n<a href=\"#customizing\">customizing tolua++</a> for details).\r\n\r\n<h4>Using C++ typeid</h4>\r\n\r\nStarting from version 1.0.92, the command line option <tt>-t</tt> is available,\r\nwhich generates a list of calls to the empty macro <tt>Mtolua_typeid</tt>, with its\r\nC++ <tt>type_info object</tt>, and the name used by tolua++ to identify the type. For example,\r\nif you have a package that binds 2 classes, <tt>Foo</tt> and <tt>Bar</tt>, using <tt>-t</tt>\r\nwill produce the following output:\r\n\r\n<pre>\r\n#ifndef Mtolua_typeid\r\n#define Mtolua_typeid(L,TI,T)\r\n#endif\r\n Mtolua_typeid(tolua_S,typeid(Foo), \"Foo\");\r\n Mtolua_typeid(tolua_S,typeid(Bar), \"Bar\");\r\n</pre>\r\n\r\nThe implementation of Mtolua_typename is left as an exercise to the user.\r\n\r\n<H3>\r\n<A NAME=\"utilities\"></A>Exported utility functions</H3>\r\n<B>tolua </B>uses itself to export some utility functions to Lua, including\r\nits object-oriented framework. The package file used by <B>tolua </B>is\r\n\r\nshown below:\r\n<P><TT>module tolua</TT>\r\n<BR><TT>{</TT>\r\n<BR><TT>&nbsp;char* tolua_bnd_type @ type (lua_Object lo);</TT>\r\n\r\n<BR><TT>&nbsp;void tolua_bnd_takeownership @ takeownership (lua_Object lo);</TT>\r\n<BR><TT>&nbsp;void tolua_bnd_releaseownership @ releaseownership (lua_Object lo);</TT>\r\n\r\n<BR><TT>&nbsp;lua_Object tolua_bnd_cast @ cast (lua_Object lo, char* type);</TT>\r\n\r\n<BR><TT>&nbsp;void tolua_bnd_inherit @ inherit (lua_Object table, lua_Object instance);</TT>\r\n<p>\r\n<TT>/* for lua 5.1 */</tt>\r\n<BR><TT>&nbsp;void tolua_bnd_setpeer @ setpeer (lua_Object object, lua_Object peer_table);</TT>\r\n<BR><TT>&nbsp;void tolua_bnd_getpeer @ getpeer (lua_Object object);</TT>\r\n\r\n<BR><TT>}</TT>\r\n\r\n<H4>\r\ntolua.type (<I>var</I>)</H4>\r\nReturns a string representing the object type. For instance, <TT>tolua.type(tolua)</TT>\r\nreturns the string <TT>table</TT> and <TT>tolua.type(tolua.type)</TT>\r\nreturns <TT>cfunction</TT>. Similarly, if <TT>var </TT>is a variable holding\r\na user defined type <TT>T</TT>, <TT>tolua.type(var)</TT> would return\r\n<TT>const\r\nT</TT> or <TT>T</TT>, depending whether it is a constant reference.\r\n<p>\r\n\r\n<h4>tolua.takeownership (<I>var</i>)</h4>\r\n\r\nTakes ownership of the object referenced <i>var</i>. This means that when all references\r\nto that object are lost, the objects itself will be deleted by lua.\r\n<p>\r\n\r\n<h4>tolua.releaseownership (<i>var</i>)</h4>\r\n\r\nReleases ownership of the object referenced by <i>var</i>.\r\n<p>\r\n\r\n<h4>tolua.cast (<i>var</i>, <i>type</i>)</h4>\r\n\r\nChanges the metatable of <i>var</i> in order to make it of type <i>type</i>. <i>type</i> needs\r\nto be a string with the complete C type of the object (including namespaces, etc).\r\n\r\n<h4>tolua.inherit (<i>table</i>, <i>var</i>)</h4> (new on <b>tolua++</b>)\r\n\r\nCauses <b>tolua++</b> to recognise <i>table</i> as an object with the same type as <i>var</i>,\r\nand to use <i>var</i> when necesary. For example, consider this method:\r\n<p>\r\n\r\n<ul><tt>void set_parent(Widget* p_parent);</tt></ul>\r\n<p>\r\n\r\nA lua object could be used like this:\r\n<p>\r\n\r\n<pre>\r\nlocal w = Widget()\r\nlocal lua_widget = {}\r\ntolua.inherit(lua_widget, w)\r\n\r\nset_parent(lua_widget);\r\n\r\n</pre>\r\n\r\nRemember that this will only cause the table to be recognised as type 'Widget' when\r\nnecesary. To be able to access Widget's methods, you'll have to implement your own\r\nobject system. A simple example:\r\n<p>\r\n\r\n<pre>\r\n\r\nlua_widget.show = Widget.show\r\n\r\nlua_widget:show() -- this will call the 'show' method from 'Widget', using the lua\r\n                  -- table as 'self'. Since lua_widget inherits from a widget instance,\r\n                  -- tolua++ will recognise 'self' as a 'Widget', and call the method\r\n\r\n</pre>\r\n<p>\r\n\r\nOf course a better way would be to add a __index metamethod for the lua object.\r\n<p>\r\n\r\nSimilarily, to implement virtual functions, you'll need to create a c++ object that inherits\r\nfrom the desired type, implement its virtual functions, and use that to inherit from lua. The\r\nobject would have a reference to the lua table, and call its methods from the c++ virtual\r\nmethods.\r\n<p>\r\n\r\n<b>Note:</b> the current implementation (as of version 1.0.6) stores the C instance\r\ninside the lua table on the field \".c_instance\", and looks that up when necesary. This\r\nmight change in the future, so it is recommended to use an alternative way to store the\r\nC instance to use with your own object system.\r\n\r\n<h4>tolua.setpeer (<i>object</i>, <i>peer_table</i>) (lua 5.1 only)</h4>\r\n\r\nSets the table as the object's <i>peer</i> table (can be <tt>nil</tt>). The peer table is where all the custom\r\nlua fields for the object are stored. When compiled with lua 5.1, <b>tolua++</b> stores the\r\npeer as the object's <i>envirnment table</i>, and uses uses <tT>lua_gettable/settable</tT> (instead of\r\n<tt>lua_rawget/set</tt> for lua 5.0) to retrieve and store fields on it. This allows us to implement our own\r\nobject system on our table (using metatables), and use it as a way to inherit from the userdata object.\r\nConsider an alternative to the previous example:\r\n\r\n<pre>\r\n-- a 'LuaWidget' class\r\nLuaWidget = {}\r\nLuaWidget.__index = LuaWidget\r\n\r\nfunction LuaWidget:add_button(caption)\r\n\r\n\t-- add a button to our widget here. 'self' will be the userdata Widget\r\nend\r\n\r\n\r\nlocal w = Widget()\r\nlocal t = {}\r\nsetmetatable(t, LuaWidget) -- make 't' an instance of LuaWidget\r\n\r\ntolua.setpeer(w, t) -- make 't' the peer table of 'w'\r\n\r\nset_parent(w) -- we use 'w' as the object now\r\n\r\nw:show() -- a method from 'Widget'\r\nw:add_button(\"Quit\") -- a method from LuaWidget (but we still use 'w' to call it)\r\n</pre>\r\n\r\nWhen indexing our object, the peer table (if present) will be consulted first, so we\r\ndon't need to implement our own __index metamethod to call the C++ functions.\r\n\r\n<h4>tolua.getpeer (<i>object</i>) (lua 5.1 only)</h4>\r\n\r\nRetrieves the peer table from the object (can be <tt>nil</tt>).\r\n\r\n<!--\r\n<H3>\r\n<A NAME=\"utilities\"></A>Exported utility functions</H3>\r\n<B>tolua </B>uses itself to export some utility functions to Lua, including\r\nits object-oriented framework. The package file used by <B>tolua </B>is\r\nshown below:\r\n<P><TT>module tolua</TT>\r\n<BR><TT>{</TT>\r\n<BR><TT>&nbsp;void tolua_using @ using (lua_Table module);</TT>\r\n<BR><TT>&nbsp;char* tolua_type @ type (lua_Object lo);</TT>\r\n<BR><TT>&nbsp;void tolua_foreach @ foreach (lua_Object lo, lua_Function\r\nf);</TT>\r\n<BR><TT>&nbsp;void tolua_class @ class (lua_Table derived, lua_Table base=TOLUA_NIL);</TT>\r\n<BR><TT>&nbsp;void tolua_instance @ instance (lua_Table instance, lua_Table\r\nclassobj);</TT>\r\n<BR><TT>&nbsp;lua_Object tolua_base @ base (lua_Object lo);</TT>\r\n<BR><TT>}</TT>\r\n<H4>\r\ntolua.using (<I>table</I>)</H4>\r\nThis functions receives a table and maps all its fields to the global environment.\r\nThus we can map an entire module and access its features without the module\r\nprefix. For instance, if in our Lua code we do:\r\n<P><TT>tolua.using(tolua)</TT>\r\n<P>all <B>tolua </B>utility functions are mapped to the global environment.\r\n<H4>\r\ntolua.type (<I>var</I>)</H4>\r\nReturns a string representing the object type. For instance, <TT>tolua.type(tolua)</TT>\r\nreturns the string <TT>generic module</TT> and <TT>tolua.type(tolua.type)</TT>\r\nreturns <TT>cfunction</TT>. Similarly, if <TT>var </TT>is a variable holding\r\na user defined type <TT>T</TT>, <TT>tolua.type(var)</TT> would return\r\n<TT>const\r\nT</TT> or <TT>T</TT>, depending whether it is a constant reference.\r\n<H4>\r\ntolua.tag (<I>\"type\"</I>)</H4>\r\nReturns type corresponding tag number.\r\n<H4>\r\ntolua.foreach (<I>object</I>)</H4>\r\nAllows us to traverse the conjugate table of an user defined instance.\r\nIf applied to conventional table, it has a similar behavior as the Lua\r\nbuilt-in <TT>foreach </TT>function. The difference is that this function\r\nfilters all fields starting with a dot, not passing them to the provided\r\ncallback function. This filter is need because <B>tolua </B>adds \"hidden\"\r\nfields to the tables it manipulates, and all its \"hidden\" fields start\r\nwith a dot.\r\n<H4>\r\ntolua.cast (<I>object, \"typename\"</I>)</H4>\r\nReturns the object \"casted\" to the given type. The object must represent\r\nan user type, otherwise the function returns <B><TT>nil</TT></B>.\r\n<H4>\r\ntolua.takeownership (<I>object</I>)</H4>\r\nAsks <B>tolua</B> to take the ownership of the given object. This means\r\nthe C/C++ object will be freed/ destructed when garbage-collected by Lua.&nbsp;\r\nThe object must represent an user type, otherwise an execution error is\r\ngenerated.\r\n<H4>\r\ntolua.class (<I>table</I>, <I>base=nil</I>)</H4>\r\nCreates a class by setting the appropriate tag methods to the given table.\r\nThe created class can inherit from a base class, previously created.\r\n<H4>\r\ntolua.instance (<I>table</I>, <I>class</I>)</H4>\r\nSets the given table to be an instance of the given class. This and the\r\nprevious utility functions allow object-oriented programming in Lua. As\r\nan example consider:\r\n<P><TT>-- define a Point class</TT>\r\n<BR><TT>classPoint = { x=0, y=0 }</TT>\r\n<BR><TT>tolua.class(classPoint) -- set as a class</TT>\r\n<P><TT>-- define print method</TT>\r\n<BR><TT>function classPoint:print ()</TT>\r\n<BR><TT>&nbsp;&nbsp; print(self.x,self.y)</TT>\r\n<BR><TT>end</TT>\r\n<P><TT>-- define add method</TT>\r\n<BR><TT>function classPoint:add (p2)</TT>\r\n<BR><TT>&nbsp;&nbsp; return Point{x=self.x+p2.x,y=self.y+p2.y}</TT>\r\n<BR><TT>end</TT>\r\n<P><TT>-- define a Point constructor</TT>\r\n<BR><TT>function Point (p)</TT>\r\n<BR><TT>&nbsp;&nbsp; tolua.instance(p,classPoint) -- set as an instance\r\nof classPoint</TT>\r\n<BR><TT>return p end</TT>\r\n<P><TT>-- define a Color Point class</TT>\r\n<BR><TT>classColorPoint = { color = 'black' }</TT>\r\n<BR><TT>tolua.class(classColorPoint,classPoint) -- set as class inheriting\r\nfrom classPoint</TT>\r\n<P><TT>-- define class methods</TT>\r\n<BR><TT>function classColorPoint:print ()</TT>\r\n<BR><TT>&nbsp;&nbsp; print(self.x,self.y,self.color)</TT>\r\n<BR><TT>end</TT>\r\n<P><TT>-- define Color Point constructor</TT>\r\n<BR><TT>function ColorPoint (p)</TT>\r\n<BR><TT>&nbsp;&nbsp; tolua.instance(p,classColorPoint) -- set as an instance\r\nof classColorPoint</TT>\r\n<BR><TT>&nbsp;&nbsp; return p</TT>\r\n<BR><TT>end</TT>\r\n<P><TT>-- Some valid codes would then be</TT>\r\n<BR><TT>p = Point{x=1}</TT>\r\n<BR><TT>q = ColorPoint{x=2,y=3,color=2}</TT>\r\n<BR><TT>r = p:add(q)</TT>\r\n<BR><TT>r:print() --&gt; would print \"3 3\"</TT>\r\n<BR>&nbsp;\r\n-->\r\n\r\n<H3>\r\n<A NAME=\"embedded\"></A>Embedded Lua code</H3>\r\n<B>tolua</B> allows us to embed Lua code in the C/C++ generated code. To\r\ndo that, it compiles the specified Lua code and creates a C constant string,\r\nstoring the corresponding bytecodes, in the generated code.&nbsp; When\r\nthe package is opened, such a string is executed. The format to embed Lua\r\ncode is:\r\n<P><B><TT>$[</TT></B>\r\n<P><I><TT>embedded Lua code</TT></I>\r\n<BR><I><TT>...</TT></I>\r\n<P><B><TT>$]</TT></B>\r\n<P>As an example consider the following .pkg excerpt:\r\n<P><TT>/* Bind a Point class */</TT>\r\n<BR><TT>class Point</TT>\r\n<BR><TT>{</TT>\r\n<BR><TT>&nbsp;Point (int x, int y);</TT>\r\n<BR><TT>&nbsp;~Point ();</TT>\r\n<BR><TT>&nbsp;void print ();</TT>\r\n<BR><TT>&nbsp;...</TT>\r\n<BR><TT>} CPoint;</TT>\r\n<P><TT>$[</TT>\r\n<P><TT>-- Create a Point constructor</TT>\r\n<BR><TT>function Point (self)</TT>\r\n<BR><TT>&nbsp;local cobj = CPoint:new(self.x or 0, self.y or 0)</TT>\r\n<BR><TT>&nbsp;tolua.takeownership(cobj)</TT>\r\n<BR><TT>&nbsp;return cobj</TT>\r\n<BR><TT>end</TT>\r\n<P><TT>$]</TT>\r\n<P>Binding such a code would allow us to write the following Lua code:\r\n<P><TT>p = Point{ x=2, y=3 }</TT>\r\n<BR><TT>p:print()</TT>\r\n<BR><TT>...</TT>\r\n<BR>&nbsp;\r\n\r\n<h3><a name=\"customizing\"></a>Customizing tolua++</h3>\r\n<p>\r\n\r\n<b>tolua++</b> calls empty functions at specific points of its execution. This functions\r\ncan be redefined on a separate lua file (and included using the -L command line option)\r\nand be used to control the way <b>tolua++</b> behaves. This is the list of functions\r\n(taken from basic.lua on the <b>tolua++</b> source):\r\n<p>\r\n\r\n<PRE>\r\n\r\n-- called right after processing the $[ichl]file directives,\r\n-- right before processing anything else\r\n-- takes the package object as the parameter\r\nfunction preprocess_hook(p)\r\n\t-- p.code has all the input code from the pkg\r\nend\r\n\r\n\r\n-- called for every $ifile directive\r\n-- takes a table with a string called 'code' inside, the filename, and any extra arguments\r\n-- passed to $ifile. no return value\r\nfunction include_file_hook(t, filename, ...)\r\n\r\nend\r\n\r\n-- called after processing anything that's not code (like '$renaming', comments, etc)\r\n-- and right before parsing the actual code.\r\n-- takes the Package object with all the code on the 'code' key. no return value\r\nfunction preparse_hook(package)\r\n\r\nend\r\n\r\n\r\n-- called after writing all the output.\r\n-- takes the Package object\r\nfunction post_output_hook(package)\r\n\r\nend\r\n\r\n-- called at the beginning of the main parser function, with the code being parsed as a parameter\r\n-- it can return nil if nothing was foind, or the contents of 'code', modified by the function\r\n-- Usually a parser hook will search the beginning of the string for a token, and if it finds\r\n-- anything, return the string without that token (after doing whatever it has to do with the token).\r\nfunction parser_hook(code)\r\n\r\nend\r\n\r\n\r\n-- called from classFunction:supcode, before the call to the function is output\r\n-- the classFunction object is passed.\r\nfunction pre_call_hook(f)\r\n\r\nend\r\n\r\n-- called from classFunction:supcode, after the call to the function is output\r\n-- the classFunction object is passed.\r\nfunction post_call_hook(f)\r\n\r\nend\r\n\r\n-- called before the register code is output\r\nfunction pre_register_hook(package)\r\n\r\nend\r\n\r\n-- called to output an error message\r\nfunction output_error_hook(...)\r\n\treturn string.format(...)\r\nend\r\n\r\n\r\n</PRE>\r\n<p>\r\n\r\n<h4>Handling custom types</h4>\r\n\r\nStarting from version 1.0.93, it is possible to specify custom functions to handle certain types. There are 3\r\ntypes of functions: a <tt>'push function'</tt>, used to push the C value onto the Lua stack, a <tt>'to function'</tt>,\r\nused to retrieve the value from the Lua stack, and return it as a C value, and an <tt>'is function'</tt>, used to\r\ncheck if the value on the stack is valid (or convertible to a C value by the <tt>to function</tt>). These functions are modelled upon\r\n<tt>tolua_pushusertype</tt>, <tt>tolua_tousertype</tt> and <tt>tolua_isusertype</tt>, declared in <tt>tolua++.h</tt>.\r\n<p>\r\nA number of arrays found in <tt>basic.lua</tt> are used to specify these functions:\r\n<p>\r\n\r\n<PRE>\r\n-- for specific types\r\n_push_functions = {}\r\n_is_functions = {}\r\n_to_functions = {}\r\n\r\n-- for base types\r\n_base_push_functions = {}\r\n_base_is_functions = {}\r\n_base_to_functions = {}\r\n</PRE>\r\n\r\n<b>Example (using the -L command line option):</b>\r\n<p>\r\n\r\n<PRE>\r\n_is_functions['Vector3'] = 'custom_is_vector3' -- checks for a 3d vector\r\n                                               -- (either userdata, or a table with 3 values)\r\n_to_functions['Vector3'] = 'custom_to_vector3' -- convertes the eventual table to a Vector3\r\n\r\n_base_push_functions['Widget'] = 'custom_push_widget' -- pushes anything that inherits from Widget\r\n</PRE>\r\n\r\nThe <tt>_base</tt> tables are used to lookup functions for types that are up in the inheritance chain. \r\n\r\n<h4>Access</h4>\r\n\r\nStarting from version 1.0.7, all objects have a an <tt>access</tt> flag, which determines the object's access\r\ninside its container. Container objects also have a member called <tt>curr_member_access</tt>, which determines\r\nthe access of each child object at the moment of its addition to the container. If the <tt>access</tt> flag has\r\nthe value <tt>nil</tt> (default), <tt>false</tt> or <tt>0</tt>, the object is public. Otherwise, the object\r\nis not public, and <b>tolua++</b> will not export any code for that object (and any objects it may contain).\r\n<p>\r\n\r\nAnother 'interesting' function is <tt>extract_code</tt>, defined on basic.lua, which\r\nextracs the code from files included with $cfile and $hfile (by looking for tolua_begin/end and tolua_export).\r\n<p>\r\n\r\n<h3><a name=\"compatibility\"></a>Compatibility with older versions.</h3>\r\n\r\n<h4>tolua++ &lt;1.0.90</h4>\r\n<p>\r\nVersion 1.0.90 of <b>tolua++</b> introduces 2 small API changes the might be incompatible\r\nwith older versions on some cases:\r\n<p>\r\n<b>TEMPLATE_BIND</b>\r\n<p>\r\n<tt>TEMPLATE_BIND</tt> is deprecated. Use <tt>TOLUA_TEMPLATE_BIND</tt> instead. Also, when\r\ndeclaring a template, the <tt>TOLUA_TEMPLATE_BIND</tt> statement has to be the first thing\r\ninside the class declaration, otherwise it will be ignored. This fixes a possible problem\r\nwith nested template declarations.\r\n<p>\r\n\r\n<b>Retrieving Objects</b>\r\n<p>\r\n\r\nWhen passing a full userdata to a function that accepts light userdata parameters (void*),\r\nthe <b>tolua++</b> library function <tt>tolua_touserdata</tt> will detect the full userdata and dereference\r\nthe void** pointer if necesary. This is a change on the function's behaviour (which used to return the pointer as-is). This allows us to pass pointers to objects to a function that accepts\r\nvoid* pointers. Note that this was a problem when switching from <b>toLua</b> version 4 to version 5 (and <b>tolua++</b> versions &lt; 1.0.90).\r\n\r\n<h4>toLua 4</h4>\r\n<p>\r\n\r\n<b>Retrieving Objects</b>\r\n<p>\r\n\r\nUsers switching from <b>tolua</b> v4 should know that <b>tolua++</b> stores the objects as\r\n<tt>void**</tt> on Lua, so when retrieving an object from the luastate using <tt>lua_touserdata</tt>,\r\nthe pointer should be dereferenced. The library function <tt>tolua_tousertype</tt>\r\nshould work as expected. Example:\r\n<p>\r\n\r\n<pre>\r\nlua_pushglobal(lua_state, \"get_Object\");\r\nlua_call(lua_state, 0, 1);  // calling a function that returns an Object\r\n\r\nObject *new_object = (Object*)(*lua_touserdata(lua_state, -1));\r\n<i>or</i>\r\nObject *new_object = (Object*)tolua_tousertype(lua_state, -1, NULL);\r\n</pre>\r\n\r\n<b>C++ Strings</b>\r\n<p>\r\n\r\n<b>tolua++</b> binds the c++ type <tt>std::string</tt> as a basic type, passing it\r\nto Lua as a regular string (using the method <tt>c_str()</tt>). This feature can be\r\nturned off with the command line option <tt>-S</tt>.\r\n<p>\r\n\r\n<b>Operators</b>\r\n<p>\r\n\r\nThe list of supported operators has changed, see <a href=\"#classes\">Binding classes and methods</a>\r\nfor more information.\r\n<p>\r\n\r\n<h4>toLua 5</h4>\r\n<p>\r\n\r\n<b>Class destructors.</b>\r\n<p>\r\n\r\nWith every class constructor, <b>tolua++</b> exports a 'local' constructor, to create an instance\r\nof the class that is owned by the lua state. To implement this, <b>tolua++</b> will also export\r\na function that will <tt>delete</tt> the class. There are 2 options to prevent this:\r\n<p>\r\n\r\nUsing the <b>-D</b> command line option will turn this off completely. Destructor functions will\r\nonly be exported when a destructor for the class is explicitly declared, or when there is a function\r\nor method that returns an object of the type by value (this is compatible with <b>tolua</b>'s behaviour).\r\n<p>\r\n\r\nUsing the <tt>TOLUA_PROTECTED_DESTRUCTOR</tt> directive inside the class declaration, to specify that the\r\nclass has a private or protected destructor. In this case, no destructor will be exported for that class.\r\n<p>\r\n\r\n<b><tt>operator[]</tt> index</b>\r\n<p>\r\n\r\nUsers switching from <b>tolua</b> v5 should know that <b>tolua</b> 5 substracts 1\r\nfrom the index on operator[] functions, for compatibility with lua's method for indexing arrays\r\n(1 is the first element). This feature is turned off by default on <b>tolua++</b>\r\n(making it compatible with <b>tolua</b> 4). It can be turned back on with the\r\ncommand line option <tt>-1</tt>\r\n<p>\r\n\r\n<b>C++ Strings</b>\r\n<p>\r\n\r\n(see c++ strings on <b>tolua</b> 4 below)\r\n\r\n\r\n<H3>\r\n<A NAME=\"changes-v30\"></A>Changes since v. 3.0</H3>\r\n\r\n<ul>\r\n\r\n<LI>\r\nSupport for binding arrays as variables and struct/class fields;</LI>\r\n\r\n<LI>\r\nSupport for embedding Lua code into the generated binding code;</LI>\r\n\r\n<LI>\r\nNew utility functions: <I>cast</I> and <I>takeownership</I>;</LI>\r\n\r\n<LI>\r\nOption to create the corresponding header file of the binding code;</LI>\r\n\r\n<LI>\r\nNew \"close\" package function;</LI>\r\n\r\n<LI>\r\nFixed bug on cloning objects in C++;</LI>\r\n\r\n<LI>\r\nFixed bug on enum and struct parsing;</LI>\r\n</ul>\r\n<H3>\r\n<A NAME=\"changes-v2\"></A>Changes since v. 2.0</H3>\r\n<ul>\r\n\r\n<LI>\r\nThere is a new executable parser;</LI>\r\n\r\n<LI>\r\nSupport for multiple Lua states is provided;</LI>\r\n\r\n<LI>\r\nSupport for module definition is provided;</LI>\r\n\r\n<LI>\r\nGlobal variables is now directly bound to Lua global variables;</LI>\r\n\r\n<LI>\r\nConstness of user defined types is preserved in Lua;</LI>\r\n\r\n<LI>\r\nSupport for multiple returned values from C/C++ is provided (simulating\r\nparameters passed by reference);</LI>\r\n\r\n<LI>\r\nConstants, variables, and functions bound to Lua can have different names\r\nfrom their C/C++ counterparts;</LI>\r\n\r\n<LI>\r\nObject-oriented framework (and other utility functions) used in <B>tolua\r\n</B>is\r\nnow exported for Lua programmers;</LI>\r\n\r\n<H4>\r\nIncompatibilities</H4>\r\nLua code based on <B>tolua</B> v2.* should run with no change on <B>tolua\r\n</B>v3.0.\r\nAlthough, it may be necessary to change the .pkg file in order to get the\r\nsame behavior. The following incompatibilities exist:\r\n<UL>\r\n<LI>\r\nParameters defined as pointer to basic types are no longer converted to\r\narrays of dimension one; they are now considered parameters passed by reference.</LI>\r\n\r\n<LI>\r\nAutomatic initialization for C++ code must be explicitly requested when\r\nusing the new parser;</LI>\r\n\r\n<LI>\r\nGlobal variables are no longer mapped to a table; the definition of a module\r\nincluding the global variables may be used to simulate the old behavior;</LI>\r\n\r\n<LI>\r\nThe initialization function is no longer toLua_<I>package</I>_open but\r\ntolua_<I>package</I>_open, without the capital letter (sorry!).</LI>\r\n</UL>\r\n</ul>\r\n<H3>\r\n<A NAME=\"changes-v1\"></A>Changes since v. 1.*</H3>\r\n\r\n<ul>\r\n<LI>\r\nThe binding code should run much faster;</LI>\r\n\r\n<LI>\r\nThe <I>cleaned header file </I>extension should now be <TT>.pkg</TT> instead\r\nof <TT>.L</TT>;</LI>\r\n\r\n<LI>\r\nType modifiers is now accepted (though the current version ignores\r\n<TT>const</TT>'s);</LI>\r\n\r\n<LI>\r\nReturning object by value is accepted and memory allocation is controlled\r\nby Lua garbage collection;</LI>\r\n\r\n<LI>\r\nOverloaded functions/methods are accepted;</LI>\r\n\r\n<LI>\r\nParameters with default values are accepted;</LI>\r\n\r\n<LI>\r\nSome overloaded operators are automatically bound.</LI>\r\n</ul>\r\n\r\n<H3>\r\n<A NAME=\"credits\"></A>Credits</H3>\r\nLuiz Henrique de Figueiredo had the idea of creating a tool to automatically\r\nbind C code to Lua. L.H.F. wrote the very first version of such a tool\r\n(that bound C functions, variables, and constants) in <I>awk</I>. At that\r\ntime, Waldemar Celes (now the main author) was only responsible for the C code that supported the generated\r\nbinding code.\r\n<p>\r\nWhile working at NGD Studios, Ariel Manzur made some changes to tolua4 for their\r\ngame engine. After the release of tolua5, having left NGD, enough changes were\r\nmade to tolua to justify a separate release (with Waldemar's blessing :-)\r\n<BR>&nbsp;\r\n<H3>\r\n<A NAME=\"availability\"></A><B>Availability</B></H3>\r\n<B>tolua++ </B>is freely available by <A HREF=\"http://www.codenix.com/~tolua/tolua++-current.tar.bz2\">http</A>.\r\nThe software provided hereunder is on an \"as is\" basis, and the author\r\nhas no obligation to provide maintenance, support, updates, enhancements,\r\nor modifications.\r\n<P>\r\n<HR WIDTH=\"100%\">This document was created by <A HREF=\"http://www.tecgraf.puc-rio.br/~celes/\">Waldemar Celes</A>\r\nWith modifications by <a href=\"http://www.codenix.com/index.php?section=contact\">Ariel Manzur</a>/\r\n<BR>Last update: Sept 2003<BODT>\r\n</BODY>\r\n</HTML>\r\n"
  },
  {
    "path": "3rdparty/toluapp/include/tolua++.h",
    "content": "/* tolua\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Apr 2003\n** $Id: $\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#ifndef TOLUA_H\n#define TOLUA_H\n\n#ifndef TOLUA_API\n#ifdef __cplusplus\n#define TOLUA_API extern \"C\"\n#else /* __cplusplus */\n#define TOLUA_API extern\n#endif /* __cplusplus */\n#endif\n\n#define TOLUA_VERSION \"tolua++-1.0.92\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n#define tolua_pushcppstring(x, y) tolua_pushstring(x, y.c_str())\n#define tolua_iscppstring tolua_isstring\n\n#define tolua_iscppstringarray tolua_isstringarray\n#define tolua_pushfieldcppstring(L, lo, idx, s) \\\n  tolua_pushfieldstring(L, lo, idx, s.c_str())\n\n#ifndef TEMPLATE_BIND\n#define TEMPLATE_BIND(p)\n#endif\n\n#define TOLUA_TEMPLATE_BIND(p)\n\n#define TOLUA_PROTECTED_DESTRUCTOR\n#define TOLUA_PROPERTY_TYPE(p)\n\ntypedef int lua_Object;\n\n#include <lauxlib.h>\n#include <lua.h>\n\nstruct tolua_Error {\n  int index;\n  int array;\n  const char* type;\n};\ntypedef struct tolua_Error tolua_Error;\n\n#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */\n\nTOLUA_API const char* tolua_typename(lua_State* L, int lo);\nTOLUA_API void tolua_error(lua_State* L, const char* msg, tolua_Error* err);\nTOLUA_API int tolua_isnoobj(lua_State* L, int lo, tolua_Error* err);\nTOLUA_API int tolua_isvalue(lua_State* L, int lo, int def, tolua_Error* err);\nTOLUA_API int tolua_isvaluenil(lua_State* L, int lo, tolua_Error* err);\nTOLUA_API int tolua_isboolean(lua_State* L, int lo, int def, tolua_Error* err);\nTOLUA_API int tolua_isnumber(lua_State* L, int lo, int def, tolua_Error* err);\nTOLUA_API int tolua_isstring(lua_State* L, int lo, int def, tolua_Error* err);\nTOLUA_API int tolua_istable(lua_State* L, int lo, int def, tolua_Error* err);\nTOLUA_API int tolua_isusertable(lua_State* L, int lo, const char* type, int def,\n                                tolua_Error* err);\nTOLUA_API int tolua_isuserdata(lua_State* L, int lo, int def, tolua_Error* err);\nTOLUA_API int tolua_isusertype(lua_State* L, int lo, const char* type, int def,\n                               tolua_Error* err);\nTOLUA_API int tolua_isvaluearray(lua_State* L, int lo, int dim, int def,\n                                 tolua_Error* err);\nTOLUA_API int tolua_isbooleanarray(lua_State* L, int lo, int dim, int def,\n                                   tolua_Error* err);\nTOLUA_API int tolua_isnumberarray(lua_State* L, int lo, int dim, int def,\n                                  tolua_Error* err);\nTOLUA_API int tolua_isstringarray(lua_State* L, int lo, int dim, int def,\n                                  tolua_Error* err);\nTOLUA_API int tolua_istablearray(lua_State* L, int lo, int dim, int def,\n                                 tolua_Error* err);\nTOLUA_API int tolua_isuserdataarray(lua_State* L, int lo, int dim, int def,\n                                    tolua_Error* err);\nTOLUA_API int tolua_isusertypearray(lua_State* L, int lo, const char* type,\n                                    int dim, int def, tolua_Error* err);\n\nTOLUA_API void tolua_open(lua_State* L);\n\nTOLUA_API void* tolua_copy(lua_State* L, void* value, unsigned int size);\nTOLUA_API int tolua_register_gc(lua_State* L, int lo);\nTOLUA_API int tolua_default_collect(lua_State* tolua_S);\n\nTOLUA_API void tolua_usertype(lua_State* L, const char* type);\nTOLUA_API void tolua_beginmodule(lua_State* L, const char* name);\nTOLUA_API void tolua_endmodule(lua_State* L);\nTOLUA_API void tolua_module(lua_State* L, const char* name, int hasvar);\nTOLUA_API void tolua_class(lua_State* L, const char* name, const char* base);\nTOLUA_API void tolua_cclass(lua_State* L, const char* lname, const char* name,\n                            const char* base, lua_CFunction col);\nTOLUA_API void tolua_function(lua_State* L, const char* name,\n                              lua_CFunction func);\nTOLUA_API void tolua_constant(lua_State* L, const char* name, lua_Number value);\nTOLUA_API void tolua_variable(lua_State* L, const char* name, lua_CFunction get,\n                              lua_CFunction set);\nTOLUA_API void tolua_array(lua_State* L, const char* name, lua_CFunction get,\n                           lua_CFunction set);\n\n/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char*\n * type); */\n/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */\n\nTOLUA_API void tolua_pushvalue(lua_State* L, int lo);\nTOLUA_API void tolua_pushboolean(lua_State* L, int value);\nTOLUA_API void tolua_pushnumber(lua_State* L, lua_Number value);\nTOLUA_API void tolua_pushstring(lua_State* L, const char* value);\nTOLUA_API void tolua_pushuserdata(lua_State* L, void* value);\nTOLUA_API void tolua_pushusertype(lua_State* L, void* value, const char* type);\nTOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value,\n                                                    const char* type);\nTOLUA_API void tolua_pushfieldvalue(lua_State* L, int lo, int index, int v);\nTOLUA_API void tolua_pushfieldboolean(lua_State* L, int lo, int index, int v);\nTOLUA_API void tolua_pushfieldnumber(lua_State* L, int lo, int index,\n                                     lua_Number v);\nTOLUA_API void tolua_pushfieldstring(lua_State* L, int lo, int index,\n                                     const char* v);\nTOLUA_API void tolua_pushfielduserdata(lua_State* L, int lo, int index,\n                                       void* v);\nTOLUA_API void tolua_pushfieldusertype(lua_State* L, int lo, int index, void* v,\n                                       const char* type);\nTOLUA_API void tolua_pushfieldusertype_and_takeownership(lua_State* L, int lo,\n                                                         int index, void* v,\n                                                         const char* type);\n\nTOLUA_API lua_Number tolua_tonumber(lua_State* L, int narg, lua_Number def);\nTOLUA_API const char* tolua_tostring(lua_State* L, int narg, const char* def);\nTOLUA_API void* tolua_touserdata(lua_State* L, int narg, void* def);\nTOLUA_API void* tolua_tousertype(lua_State* L, int narg, void* def);\nTOLUA_API int tolua_tovalue(lua_State* L, int narg, int def);\nTOLUA_API int tolua_toboolean(lua_State* L, int narg, int def);\nTOLUA_API lua_Number tolua_tofieldnumber(lua_State* L, int lo, int index,\n                                         lua_Number def);\nTOLUA_API const char* tolua_tofieldstring(lua_State* L, int lo, int index,\n                                          const char* def);\nTOLUA_API void* tolua_tofielduserdata(lua_State* L, int lo, int index,\n                                      void* def);\nTOLUA_API void* tolua_tofieldusertype(lua_State* L, int lo, int index,\n                                      void* def);\nTOLUA_API int tolua_tofieldvalue(lua_State* L, int lo, int index, int def);\nTOLUA_API int tolua_getfieldboolean(lua_State* L, int lo, int index, int def);\n\nTOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size,\n                              const char* name);\n\nTOLUA_API int class_gc_event(lua_State* L);\n\n#ifdef __cplusplus\nstatic inline const char* tolua_tocppstring(lua_State* L, int narg,\n                                            const char* def) {\n  const char* s = tolua_tostring(L, narg, def);\n  return s ? s : \"\";\n}\n\nstatic inline const char* tolua_tofieldcppstring(lua_State* L, int lo,\n                                                 int index, const char* def) {\n  const char* s = tolua_tofieldstring(L, lo, index, def);\n  return s ? s : \"\";\n}\n\n#else\n#define tolua_tocppstring tolua_tostring\n#define tolua_tofieldcppstring tolua_tofieldstring\n#endif\n\nTOLUA_API int tolua_fast_isa(lua_State* L, int mt_indexa, int mt_indexb,\n                             int super_index);\n\n#ifndef Mtolua_new\n#define Mtolua_new(EXP) new EXP\n#endif\n\n#ifndef Mtolua_delete\n#define Mtolua_delete(EXP) delete EXP\n#endif\n\n#ifndef Mtolua_new_dim\n#define Mtolua_new_dim(EXP, len) new EXP[len]\n#endif\n\n#ifndef Mtolua_delete_dim\n#define Mtolua_delete_dim(EXP) delete[] EXP\n#endif\n\n#ifndef tolua_outside\n#define tolua_outside\n#endif\n\n#ifndef tolua_owned\n#define tolua_owned\n#endif\n\n#ifdef __cplusplus\n}\n#endif\n\n#endif\n"
  },
  {
    "path": "3rdparty/toluapp/libtoluapp.def",
    "content": "EXPORTS\r\nclass_gc_event\r\npush_table_instance\r\ntolua_array\r\ntolua_beginmodule\r\ntolua_cclass\r\ntolua_classevents\r\ntolua_constant\r\ntolua_copy\r\ntolua_default_collect\r\ntolua_dobuffer\r\ntolua_endmodule\r\ntolua_error\r\ntolua_fast_isa\r\ntolua_function\r\ntolua_getfieldboolean\r\ntolua_isboolean\r\ntolua_isbooleanarray\r\ntolua_ismodulemetatable\r\ntolua_isnoobj\r\ntolua_isnumber\r\ntolua_isnumberarray\r\ntolua_isstring\r\ntolua_isstringarray\r\ntolua_istable\r\ntolua_istablearray\r\ntolua_isuserdata\r\ntolua_isuserdataarray\r\ntolua_isusertable\r\ntolua_isusertype\r\ntolua_isusertypearray\r\ntolua_isvalue\r\ntolua_isvaluearray\r\ntolua_module\r\ntolua_moduleevents\r\ntolua_open\r\ntolua_pushboolean\r\ntolua_pushfieldboolean\r\ntolua_pushfieldnumber\r\ntolua_pushfieldstring\r\ntolua_pushfielduserdata\r\ntolua_pushfieldusertype\r\ntolua_pushfieldusertype_and_takeownership\r\ntolua_pushfieldvalue\r\ntolua_pushnumber\r\ntolua_pushstring\r\ntolua_pushuserdata\r\ntolua_pushusertype\r\ntolua_pushusertype_and_takeownership\r\ntolua_pushvalue\r\ntolua_register_gc\r\ntolua_toboolean\r\ntolua_tofieldnumber\r\ntolua_tofieldstring\r\ntolua_tofielduserdata\r\ntolua_tofieldusertype\r\ntolua_tofieldvalue\r\ntolua_tonumber\r\ntolua_tostring\r\ntolua_touserdata\r\ntolua_tousertype\r\ntolua_tovalue\r\ntolua_typename\r\ntolua_usertype\r\ntolua_variable\r\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/SCsub",
    "content": "Import('env')\n\nsrc = [\n\tenv.Object('tolua.c'),\n\t]\n\n\n#toluabind = env.LuaBinding('toluabind.c', 'tolua_scons.pkg', 'tolua', bootstrap = True)\n\nenv.bin_target = env.Program('#/bin/'+env['tolua_bin'], src, LIBS = ['$tolua_lib'] + env['LIBS'])\n\nenv.bootstrap_target = env.Program('#/bin/'+env['TOLUAPP_BOOTSTRAP'], src + ['toluabind_default.c', env.lib_target_static], LIBS = env['LIBS'])\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/all.lua",
    "content": "dofile(path..\"compat-5.1.lua\")\ndofile(path..\"compat.lua\")\ndofile(path..\"feature.lua\")\ndofile(path..\"verbatim.lua\")\ndofile(path..\"basic.lua\")\ndofile(path..\"code.lua\")\ndofile(path..\"typedef.lua\")\ndofile(path..\"container.lua\")\ndofile(path..\"ordered_pairs.lua\")\ndofile(path..\"package.lua\")\ndofile(path..\"module.lua\")\ndofile(path..\"namespace.lua\")\ndofile(path..\"define.lua\")\ndofile(path..\"enumerate.lua\")\ndofile(path..\"declaration.lua\")\ndofile(path..\"variable.lua\")\ndofile(path..\"array.lua\")\ndofile(path..\"function.lua\")\ndofile(path..\"operator.lua\")\ndofile(path..\"template_class.lua\")\ndofile(path..\"class.lua\")\ndofile(path..\"clean.lua\")\n--dofile(path..\"custom.lua\")\ndofile(path..\"doit.lua\")\n\nlocal err,msg = xpcall(doit, debug.traceback)\nif not err then\n--print(\"**** msg is \"..tostring(msg))\n local _,_,label,msg = strfind(msg,\"(.-:.-:%s*)(.*)\")\n tolua_error(msg,label)\nend\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/array.lua",
    "content": "-- tolua: array class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1999\n-- $Id: array.lua,v 1.1 2000/11/06 22:03:57 celes Exp $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Array class\n-- Represents a extern array variable or a public member of a class.\n-- Stores all fields present in a declaration.\nclassArray = {\n}\nclassArray.__index = classArray\nsetmetatable(classArray,classDeclaration)\n\n-- Print method\nfunction classArray:print (ident,close)\n print(ident..\"Array{\")\n print(ident..\" mod  = '\"..self.mod..\"',\")\n print(ident..\" type = '\"..self.type..\"',\")\n print(ident..\" ptr  = '\"..self.ptr..\"',\")\n print(ident..\" name = '\"..self.name..\"',\")\n print(ident..\" def  = '\"..self.def..\"',\")\n print(ident..\" dim  = '\"..self.dim..\"',\")\n print(ident..\" ret  = '\"..self.ret..\"',\")\n print(ident..\"}\"..close)\nend\n\n-- check if it is a variable\nfunction classArray:isvariable ()\n return true\nend\n\n\n-- get variable value\nfunction classArray:getvalue (class,static)\n if class and static then\n  return class..'::'..self.name..'[tolua_index]'\n elseif class then\n  return 'self->'..self.name..'[tolua_index]'\n else\n  return self.name..'[tolua_index]'\n end\nend\n\n-- Write binding functions\nfunction classArray:supcode ()\n local class = self:inclass()\n\n -- get function ------------------------------------------------\n if class then\n  output(\"/* get function:\",self.name,\" of class \",class,\" */\")\n else\n  output(\"/* get function:\",self.name,\" */\")\n end\n self.cgetname = self:cfuncname(\"tolua_get\")\n output(\"#ifndef TOLUA_DISABLE_\"..self.cgetname)\n output(\"\\nstatic int\",self.cgetname,\"(lua_State* tolua_S)\")\n output(\"{\")\n output(\" int tolua_index;\")\n\n -- declare self, if the case\n local _,_,static = strfind(self.mod,'^%s*(static)')\n if class and static==nil then\n  output(' ',self.parent.type,'*','self;')\n  output(' lua_pushstring(tolua_S,\".self\");')\n  output(' lua_rawget(tolua_S,1);')\n  output(' self = ')\n  output('(',self.parent.type,'*) ')\n  output('lua_touserdata(tolua_S,-1);')\n elseif static then\n  _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')\n end\n\n -- check index\n\toutput('#ifndef TOLUA_RELEASE\\n')\n\toutput(' {')\n\toutput('  tolua_Error tolua_err;')\n output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')\n output('   tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);')\n\toutput(' }')\n\toutput('#endif\\n')\n\tif flags['1'] then -- for compatibility with tolua5 ?\n\t\toutput(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')\n\telse\n\t\toutput(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')\n\tend\n\toutput('#ifndef TOLUA_RELEASE\\n')\n\tif self.dim and self.dim ~= '' then\n\t  output(' if (tolua_index<0 || tolua_index>='..self.dim..')')\n\telse\n\t  output(' if (tolua_index<0)')\n\tend\n output('  tolua_error(tolua_S,\"array indexing out of range.\",NULL);')\n\toutput('#endif\\n')\n\n -- return value\n local t,ct = isbasic(self.type)\n local push_func = get_push_function(t)\n if t then\n  output(' tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static)..');')\n else\n\t\tt = self.type\n  if self.ptr == '&' or self.ptr == '' then\n   output(' ',push_func,'(tolua_S,(void*)&'..self:getvalue(class,static)..',\"',t,'\");')\n  else\n   output(' ',push_func,'(tolua_S,(void*)'..self:getvalue(class,static)..',\"',t,'\");')\n  end\n end\n output(' return 1;')\n output('}')\n output('#endif //#ifndef TOLUA_DISABLE\\n')\n output('\\n')\n\n -- set function ------------------------------------------------\n if not strfind(self.type,'const') then\n  if class then\n   output(\"/* set function:\",self.name,\" of class \",class,\" */\")\n  else\n   output(\"/* set function:\",self.name,\" */\")\n  end\n  self.csetname = self:cfuncname(\"tolua_set\")\n  output(\"#ifndef TOLUA_DISABLE_\"..self.csetname)\n  output(\"\\nstatic int\",self.csetname,\"(lua_State* tolua_S)\")\n  output(\"{\")\n\n  -- declare index\n  output(' int tolua_index;')\n\n  -- declare self, if the case\n  local _,_,static = strfind(self.mod,'^%s*(static)')\n  if class and static==nil then\n   output(' ',self.parent.type,'*','self;')\n   output(' lua_pushstring(tolua_S,\".self\");')\n   output(' lua_rawget(tolua_S,1);')\n   output(' self = ')\n   output('(',self.parent.type,'*) ')\n   output('lua_touserdata(tolua_S,-1);')\n  elseif static then\n   _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')\n  end\n\n  -- check index\n\t output('#ifndef TOLUA_RELEASE\\n')\n\t output(' {')\n\t output('  tolua_Error tolua_err;')\n  output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')\n  output('   tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);')\n\t\toutput(' }')\n\t\toutput('#endif\\n')\n\n\tif flags['1'] then -- for compatibility with tolua5 ?\n\t\toutput(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')\n\telse\n\t\toutput(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')\n\tend\n\n\t output('#ifndef TOLUA_RELEASE\\n')\n\tif self.dim and self.dim ~= '' then\n\t  output(' if (tolua_index<0 || tolua_index>='..self.dim..')')\n\telse\n\t  output(' if (tolua_index<0)')\n\tend\n  output('  tolua_error(tolua_S,\"array indexing out of range.\",NULL);')\n\t\toutput('#endif\\n')\n\n  -- assign value\n  local ptr = ''\n  if self.ptr~='' then ptr = '*' end\n  output(' ')\n  if class and static then\n   output(class..'::'..self.name..'[tolua_index]')\n  elseif class then\n   output('self->'..self.name..'[tolua_index]')\n  else\n   output(self.name..'[tolua_index]')\n  end\n  local t = isbasic(self.type)\n  output(' = ')\n  if not t and ptr=='' then output('*') end\n  output('((',self.mod,self.type)\n  if not t then\n   output('*')\n  end\n  output(') ')\n  local def = 0\n  if self.def ~= '' then def = self.def end\n  if t then\n   output('tolua_to'..t,'(tolua_S,3,',def,'));')\n  else\n   local to_func = get_to_function(self.type)\n   output(to_func,'(tolua_S,3,',def,'));')\n  end\n  output(' return 0;')\n  output('}')\n  output('#endif //#ifndef TOLUA_DISABLE\\n')\n  output('\\n')\n end\n\nend\n\nfunction classArray:register (pre)\n\tif not self:check_public_access() then\n\t\treturn\n\tend\n\n pre = pre or ''\n if self.csetname then\n  output(pre..'tolua_array(tolua_S,\"'..self.lname..'\",'..self.cgetname..','..self.csetname..');')\n else\n  output(pre..'tolua_array(tolua_S,\"'..self.lname..'\",'..self.cgetname..',NULL);')\n end\nend\n\n-- Internal constructor\nfunction _Array (t)\n setmetatable(t,classArray)\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects a string representing the variable declaration.\nfunction Array (s)\n return _Array (Declaration(s,'var'))\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/basic.lua",
    "content": "-- tolua: basic utility functions\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- Last update: Apr 2003\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Basic C types and their corresponding Lua types\n-- All occurrences of \"char*\" will be replaced by \"_cstring\",\n-- and all occurrences of \"void*\" will be replaced by \"_userdata\"\n_basic = {\n ['void'] = '',\n ['char'] = 'number',\n ['int'] = 'number',\n ['short'] = 'number',\n ['long'] = 'number',\n ['unsigned'] = 'number',\n ['float'] = 'number',\n ['double'] = 'number',\n ['_cstring'] = 'string',\n ['_userdata'] = 'userdata',\n ['char*'] = 'string',\n ['void*'] = 'userdata',\n ['bool'] = 'boolean',\n ['lua_Object'] = 'value',\n ['LUA_VALUE'] = 'value',    -- for compatibility with tolua 4.0\n ['lua_State*'] = 'state',\n ['_lstate'] = 'state',\n ['lua_Function'] = 'value',\n}\n\n_basic_ctype = {\n number = \"lua_Number\",\n string = \"const char*\",\n userdata = \"void*\",\n boolean = \"bool\",\n value = \"int\",\n state = \"lua_State*\",\n}\n\n-- functions the are used to do a 'raw push' of basic types\n_basic_raw_push = {}\n\n-- List of user defined types\n-- Each type corresponds to a variable name that stores its tag value.\n_usertype = {}\n\n-- List of types that have to be collected\n_collect = {}\n\n-- List of types\n_global_types = {n=0}\n_global_types_hash = {}\n\n-- list of classes\n_global_classes = {}\n\n-- List of enum constants\n_global_enums = {}\n\n-- List of auto renaming\n_renaming = {}\nfunction appendrenaming (s)\n local b,e,old,new = strfind(s,\"%s*(.-)%s*@%s*(.-)%s*$\")\n\tif not b then\n\t error(\"#Invalid renaming syntax; it should be of the form: pattern@pattern\")\n\tend\n\ttinsert(_renaming,{old=old, new=new})\nend\n\nfunction applyrenaming (s)\n\tfor i,v in ipairs(_renaming) do\n\t local m,n = gsub(s,v.old,v.new)\n\t\tif n ~= 0 then\n\t\t return m\n\t\tend\n\tend\n\treturn nil\nend\n\n-- Error handler\nfunction tolua_error (s,f)\nif _curr_code then\n\tprint(\"***curr code for error is \"..tostring(_curr_code))\n\tprint(debug.traceback())\nend\n local out = _OUTPUT\n _OUTPUT = _STDERR\n if strsub(s,1,1) == '#' then\n  write(\"\\n** tolua: \"..strsub(s,2)..\".\\n\\n\")\n  if _curr_code then\n   local _,_,s = strfind(_curr_code,\"^%s*(.-\\n)\") -- extract first line\n   if s==nil then s = _curr_code end\n   s = gsub(s,\"_userdata\",\"void*\") -- return with 'void*'\n   s = gsub(s,\"_cstring\",\"char*\")  -- return with 'char*'\n   s = gsub(s,\"_lstate\",\"lua_State*\")  -- return with 'lua_State*'\n   write(\"Code being processed:\\n\"..s..\"\\n\")\n  end\n else\n if not f then f = \"(f is nil)\" end\n  print(\"\\n** tolua internal error: \"..f..s..\".\\n\\n\")\n  return\n end\n _OUTPUT = out\nend\n\nfunction warning (msg)\n if flags.q then return end\n local out = _OUTPUT\n _OUTPUT = _STDERR\n write(\"\\n** tolua warning: \"..msg..\".\\n\\n\")\n _OUTPUT = out\nend\n\n-- register an user defined type: returns full type\nfunction regtype (t)\n\t--if isbasic(t) then\n\t--\treturn t\n\t--end\n\tlocal ft = findtype(t)\n\n\tif not _usertype[ft] then\n\t\treturn appendusertype(t)\n\tend\n\treturn ft\nend\n\n-- return type name: returns full type\nfunction typevar(type)\n\tif type == '' or type == 'void' then\n\t\treturn type\n\telse\n\t\tlocal ft = findtype(type)\n\t\tif ft then\n\t\t\treturn ft\n\t\tend\n\t\t_usertype[type] = type\n\t\treturn type\n\tend\nend\n\n-- check if basic type\nfunction isbasic (type)\n local t = gsub(type,'const ','')\n local m,t = applytypedef('', t)\n local b = _basic[t]\n if b then\n  return b,_basic_ctype[b]\n end\n return nil\nend\n\n-- split string using a token\nfunction split (s,t)\n local l = {n=0}\n local f = function (s)\n  l.n = l.n + 1\n  l[l.n] = s\n  return \"\"\n end\n local p = \"%s*(.-)%s*\"..t..\"%s*\"\n s = gsub(s,\"^%s+\",\"\")\n s = gsub(s,\"%s+$\",\"\")\n s = gsub(s,p,f)\n l.n = l.n + 1\n l[l.n] = gsub(s,\"(%s%s*)$\",\"\")\n return l\nend\n\n-- splits a string using a pattern, considering the spacial cases of C code (templates, function parameters, etc)\n-- pattern can't contain the '^' (as used to identify the begining of the line)\n-- also strips whitespace\nfunction split_c_tokens(s, pat)\n\n\ts = string.gsub(s, \"^%s*\", \"\")\n\ts = string.gsub(s, \"%s*$\", \"\")\n\n\tlocal token_begin = 1\n\tlocal token_end = 1\n\tlocal ofs = 1\n\tlocal ret = {n=0}\n\n\tfunction add_token(ofs)\n\n\t\tlocal t = string.sub(s, token_begin, ofs)\n\t\tt = string.gsub(t, \"^%s*\", \"\")\n\t\tt = string.gsub(t, \"%s*$\", \"\")\n\t\tret.n = ret.n + 1\n\t\tret[ret.n] = t\n\tend\n\n\twhile ofs <= string.len(s) do\n\n\t\tlocal sub = string.sub(s, ofs, -1)\n\t\tlocal b,e = string.find(sub, \"^\"..pat)\n\t\tif b then\n\t\t\tadd_token(ofs-1)\n\t\t\tofs = ofs+e\n\t\t\ttoken_begin = ofs\n\t\telse\n\t\t\tlocal char = string.sub(s, ofs, ofs)\n\t\t\tif char == \"(\" or char == \"<\" then\n\n\t\t\t\tlocal block\n\t\t\t\tif char == \"(\" then block = \"^%b()\" end\n\t\t\t\tif char == \"<\" then block = \"^%b<>\" end\n\n\t\t\t\tb,e = string.find(sub, block)\n\t\t\t\tif not b then\n\t\t\t\t\t-- unterminated block?\n\t\t\t\t\tofs = ofs+1\n\t\t\t\telse\n\t\t\t\t\tofs = ofs + e\n\t\t\t\tend\n\n\t\t\telse\n\t\t\t\tofs = ofs+1\n\t\t\tend\n\t\tend\n\n\tend\n\tadd_token(ofs)\n\t--if ret.n == 0 then\n\n\t--\tret.n=1\n\t--\tret[1] = \"\"\n\t--end\n\n\treturn ret\n\nend\n\n-- concatenate strings of a table\nfunction concat (t,f,l,jstr)\n\tjstr = jstr or \" \"\n local s = ''\n local i=f\n while i<=l do\n  s = s..t[i]\n  i = i+1\n  if i <= l then s = s..jstr end\n end\n return s\nend\n\n-- concatenate all parameters, following output rules\nfunction concatparam (line, ...)\n local i=1\n local arg={...}\n while i<=#arg do\n  if _cont and not strfind(_cont,'[%(,\"]') and\n     strfind(arg[i],\"^[%a_~]\") then\n\t    line = line .. ' '\n  end\n  line = line .. arg[i]\n  if arg[i] ~= '' then\n   _cont = strsub(arg[i],-1,-1)\n  end\n  i = i+1\n end\n if strfind(arg[#arg],\"[%/%)%;%{%}]$\") then\n  _cont=nil line = line .. '\\n'\n end\n\treturn line\nend\n\n-- output line\nfunction output (...)\n local i=1\n local arg = {...}\n while i<=#arg do\n  if _cont and not strfind(_cont,'[%(,\"]') and\n     strfind(arg[i],\"^[%a_~]\") then\n\t    write(' ')\n  end\n  write(arg[i])\n  if arg[i] ~= '' then\n   _cont = strsub(arg[i],-1,-1)\n  end\n  i = i+1\n end\n if strfind(arg[#arg],\"[%/%)%;%{%}]$\") then\n  _cont=nil write('\\n')\n end\nend\n\nfunction get_property_methods(ptype, name)\n\n\tif get_property_methods_hook and get_property_methods_hook(ptype,name) then\n\t\treturn get_property_methods_hook(ptype, name)\n\tend\n\n\tif ptype == \"default\" then -- get_name, set_name\n\t\treturn \"get_\"..name, \"set_\"..name\n\tend\n\n\tif ptype == \"qt\" then -- name, setName\n\t\treturn name, \"set\"..string.upper(string.sub(name, 1, 1))..string.sub(name, 2, -1)\n\tend\n\n\tif ptype == \"overload\" then -- name, name\n\t\treturn name,name\n\tend\n\n\treturn nil\nend\n\n-------------- the hooks\n\n-- called right after processing the $[ichl]file directives,\n-- right before processing anything else\n-- takes the package object as the parameter\nfunction preprocess_hook(p)\n\t-- p.code has all the input code from the pkg\nend\n\n\n-- called for every $ifile directive\n-- takes a table with a string called 'code' inside, the filename, and any extra arguments\n-- passed to $ifile. no return value\nfunction include_file_hook(t, filename, ...)\n\nend\n\n-- called after processing anything that's not code (like '$renaming', comments, etc)\n-- and right before parsing the actual code.\n-- takes the Package object with all the code on the 'code' key. no return value\nfunction preparse_hook(package)\n\nend\n\n-- called before starting output\nfunction pre_output_hook(package)\n\nend\n\n-- called after writing all the output.\n-- takes the Package object\nfunction post_output_hook(package)\n\nend\n\n\n-- called from 'get_property_methods' to get the methods to retrieve a property\n-- according to its type\nfunction get_property_methods_hook(property_type, name)\n\nend\n\n-- called from ClassContainer:doparse with the string being parsed\n-- return nil, or a substring\nfunction parser_hook(s)\n\n\treturn nil\nend\n\n-- called from classFunction:supcode, before the call to the function is output\nfunction pre_call_hook(f)\n\nend\n\n-- called from classFunction:supcode, after the call to the function is output\nfunction post_call_hook(f)\n\nend\n\n-- called before the register code is output\nfunction pre_register_hook(package)\n\nend\n\n\n-- called to output an error message\nfunction output_error_hook(...)\n\treturn string.format(table.unpack{...})\nend\n\n-- custom pushers\n\n_push_functions = {}\n_is_functions = {}\n_to_functions = {}\n\n_base_push_functions = {}\n_base_is_functions = {}\n_base_to_functions = {}\n\nlocal function search_base(t, funcs)\n\n\tlocal class = _global_classes[t]\n\n\twhile class do\n\t\tif funcs[class.type] then\n\t\t\treturn funcs[class.type]\n\t\tend\n\t\tclass = _global_classes[class.btype]\n\tend\n\treturn nil\nend\n\nfunction get_push_function(t)\n\treturn _push_functions[t] or search_base(t, _base_push_functions) or \"tolua_pushusertype\"\nend\n\nfunction get_to_function(t)\n\treturn _to_functions[t] or search_base(t, _base_to_functions) or \"tolua_tousertype\"\nend\n\nfunction get_is_function(t)\n\treturn _is_functions[t] or search_base(t, _base_is_functions) or \"tolua_isusertype\"\nend\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/class.lua",
    "content": "-- tolua: class class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Class class\n-- Represents a class definition.\n-- Stores the following fields:\n--    name = class name\n--    base = class base, if any (only single inheritance is supported)\n--    {i}  = list of members\nclassClass = {\n classtype = 'class',\n name = '',\n base = '',\n type = '',\n btype = '',\n ctype = '',\n}\nclassClass.__index = classClass\nsetmetatable(classClass,classContainer)\n\n\n-- register class\nfunction classClass:register (pre)\n\n\tif not self:check_public_access() then\n\t\treturn\n\tend\n\n pre = pre or ''\n push(self)\n\tif _collect[self.type] then\n\t\toutput(pre,'#ifdef __cplusplus\\n')\n  output(pre..'tolua_cclass(tolua_S,\"'..self.lname..'\",\"'..self.type..'\",\"'..self.btype..'\",'.._collect[self.type]..');')\n\t\toutput(pre,'#else\\n')\n  output(pre..'tolua_cclass(tolua_S,\"'..self.lname..'\",\"'..self.type..'\",\"'..self.btype..'\",NULL);')\n\t\toutput(pre,'#endif\\n')\n\telse\n  output(pre..'tolua_cclass(tolua_S,\"'..self.lname..'\",\"'..self.type..'\",\"'..self.btype..'\",NULL);')\n\tend\n\tif self.extra_bases then\n\t\tfor k,base in ipairs(self.extra_bases) do\n\t\t\t-- not now\n   --output(pre..' tolua_addbase(tolua_S, \"'..self.type..'\", \"'..base..'\");')\n\t\tend\n\tend\n output(pre..'tolua_beginmodule(tolua_S,\"'..self.lname..'\");')\n local i=1\n while self[i] do\n  self[i]:register(pre..' ')\n  i = i+1\n end\n output(pre..'tolua_endmodule(tolua_S);')\n\tpop()\nend\n\n-- return collection requirement\nfunction classClass:requirecollection (t)\n\tif self.flags.protected_destructor or (not self:check_public_access()) then\n\t\treturn false\n\tend\n push(self)\n\tlocal r = false\n local i=1\n while self[i] do\n  r = self[i]:requirecollection(t) or r\n  i = i+1\n end\n\tpop()\n\t-- only class that exports destructor can be appropriately collected\n\t-- classes that export constructors need to have a collector (overrided by -D flag on command line)\n\tif self._delete or ((not flags['D']) and self._new) then\n\t\t--t[self.type] = \"tolua_collect_\" .. gsub(self.type,\"::\",\"_\")\n\t\tt[self.type] = \"tolua_collect_\" .. clean_template(self.type)\n\t\tr = true\n\tend\n return r\nend\n\n-- output tags\nfunction classClass:decltype ()\n push(self)\n\tself.type = regtype(self.original_name or self.name)\n\tself.btype = typevar(self.base)\n\tself.ctype = 'const '..self.type\n\tif self.extra_bases then\n\t\tfor i=1,#self.extra_bases do\n\t\t\tself.extra_bases[i] = typevar(self.extra_bases[i])\n\t\tend\n\tend\n local i=1\n while self[i] do\n  self[i]:decltype()\n  i = i+1\n end\n\tpop()\nend\n\n\n-- Print method\nfunction classClass:print (ident,close)\n print(ident..\"Class{\")\n print(ident..\" name = '\"..self.name..\"',\")\n print(ident..\" base = '\"..self.base..\"';\")\n print(ident..\" lname = '\"..self.lname..\"',\")\n print(ident..\" type = '\"..self.type..\"',\")\n print(ident..\" btype = '\"..self.btype..\"',\")\n print(ident..\" ctype = '\"..self.ctype..\"',\")\n local i=1\n while self[i] do\n  self[i]:print(ident..\" \",\",\")\n  i = i+1\n end\n print(ident..\"}\"..close)\nend\n\nfunction classClass:set_protected_destructor(p)\n\tself.flags.protected_destructor = self.flags.protected_destructor or p\nend\n\n-- Internal constructor\nfunction _Class (t)\n setmetatable(t,classClass)\n t:buildnames()\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects the name, the base (array) and the body of the class.\nfunction Class (n,p,b)\n\n\tif #p > 1 then\n\t\tb = string.sub(b, 1, -2)\n\t\tfor i=2,#p,1 do\n\t\t\tb = b..\"\\n tolua_inherits \"..p[i]..\" __\"..p[i]..\"__;\\n\"\n\t\tend\n\t\tb = b..\"\\n}\"\n\tend\n\n\t-- check for template\n\tb = string.gsub(b, \"^{%s*TEMPLATE_BIND\", \"{\\nTOLUA_TEMPLATE_BIND\")\n\tlocal t,_,T,I = string.find(b, '^{%s*TOLUA_TEMPLATE_BIND%s*%(+%s*\\\"?([^\\\",]*)\\\"?%s*,%s*([^%)]*)%s*%)+')\n\tif t then\n\n\t\t-- remove quotes\n\t\tI = string.gsub(I, \"\\\"\", \"\")\n\t\tT = string.gsub(T, \"\\\"\", \"\")\n\t\t-- get type list\n\t\tlocal types = split_c_tokens(I, \",\")\n\t\t-- remove TEMPLATE_BIND line\n\t\tlocal bs = string.gsub(b, \"^{%s*TOLUA_TEMPLATE_BIND[^\\n]*\\n\", \"{\\n\")\n\t\t\t\n\t\tlocal Tl = split(T, \" \")\n\t\tlocal tc = TemplateClass(n, p, bs, Tl)\n\n\t\t\n\t\ttc:throw(types, true)\n\t\t--for i=1,types.n do\n\t\t--\ttc:throw(split_c_tokens(types[i], \" \"), true)\n\t\t--end\n\t\treturn\n\tend\n\t\n\tlocal mbase\n\n\tif p then\n\t\tmbase = table.remove(p, 1)\n\t\tif not p[1] then p = nil end\n\tend\n\n\tmbase = mbase and resolve_template_types(mbase)\n\n\tlocal c\n\tlocal oname = string.gsub(n, \"@.*$\", \"\")\n\toname = getnamespace(classContainer.curr)..oname\n\n\tif _global_classes[oname] then\n\t\tc = _global_classes[oname]\n\t\tif mbase and ((not c.base) or c.base == \"\") then\n\t\t\tc.base = mbase\n\t\tend\n\telse\n\t\tc = _Class(_Container{name=n, base=mbase, extra_bases=p})\n\n\t\tlocal ft = getnamespace(c.parent)..c.original_name\n\t\tappend_global_type(ft, c)\n\tend\n\n\tpush(c)\n\tc:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces\n\tpop()\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/clean.lua",
    "content": "-- mark up comments and strings\nSTR1 = \"\\001\"\nSTR2 = \"\\002\"\nSTR3 = \"\\003\"\nSTR4 = \"\\004\"\nREM  = \"\\005\"\nANY  = \"([\\001-\\005])\"\nESC1 = \"\\006\"\nESC2 = \"\\007\"\n\nMASK = { -- the substitution order is important\n {ESC1, \"\\\\'\"},\n {ESC2, '\\\\\"'},\n {STR1, \"'\"},\n {STR2, '\"'},\n {STR3, \"%[%[\"},\n {STR4, \"%]%]\"},\n {REM , \"%-%-\"},\n}\n\nfunction mask (s)\n for i = 1,#MASK  do\n  s = gsub(s,MASK[i][2],MASK[i][1])\n end\n return s\nend\n\nfunction unmask (s)\n for i = 1,#MASK  do\n  s = gsub(s,MASK[i][1],MASK[i][2])\n end\n return s\nend\n\nfunction clean (s)\n -- check for compilation error\n local code = \"return function ()\\n\" .. s .. \"\\n end\"\n if not dostring(code) then\n  return nil\n end\n\n if flags['C'] then\n \treturn s\n end\n\n local S = \"\" -- saved string\n\n s = mask(s)\n\n -- remove blanks and comments\n while 1 do\n  local b,e,d = strfind(s,ANY)\n  if b then\n   S = S..strsub(s,1,b-1)\n   s = strsub(s,b+1)\n   if d==STR1 or d==STR2 then\n    e = strfind(s,d)\n    S = S ..d..strsub(s,1,e)\n    s = strsub(s,e+1)\n   elseif d==STR3 then\n    e = strfind(s,STR4)\n    S = S..d..strsub(s,1,e)\n    s = strsub(s,e+1)\n   elseif d==REM then\n    s = gsub(s,\"[^\\n]*(\\n?)\",\"%1\",1)\n   end\n  else\n   S = S..s\n   break\n  end\n end\n -- eliminate unecessary spaces\n S = gsub(S,\"[ \\t]+\",\" \")\n S = gsub(S,\"[ \\t]*\\n[ \\t]*\",\"\\n\")\n\tS = gsub(S,\"\\n+\",\"\\n\")\n S = unmask(S)\n return S\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/code.lua",
    "content": "-- tolua: code class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1999\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n-- global\ncode_n = 1\n\n-- Code class\n-- Represents Lua code to be compiled and included\n-- in the initialization function.\n-- The following fields are stored:\n--   text = text code\nclassCode = {\n text = '',\n}\nclassCode.__index = classCode\nsetmetatable(classCode,classFeature)\n\n-- register code\nfunction classCode:register (pre)\n pre = pre or ''\n -- clean Lua code\n local s = clean(self.text)\n if not s then\n  --print(self.text)\n  error(\"parser error in embedded code\")\n end\n\n -- get first line\n local _, _, first_line=string.find(self.text, \"^([^\\n\\r]*)\")\n if string.find(first_line, \"^%s*%-%-\") then\n\t if string.find(first_line, \"^%-%-##\") then\n\t\tfirst_line = string.gsub(first_line, \"^%-%-##\", \"\")\n\t\tif flags['C'] then\n\t\t\ts = string.gsub(s, \"^%-%-##[^\\n\\r]*\\n\", \"\")\n\t\tend\n\t end\n else\n \tfirst_line = \"\"\n end\n\n -- pad to 16 bytes\n local npad = 16 - (#s % 16)\n local spad = \"\"\n for i=1,npad do\n \tspad = spad .. \"-\"\n end\n s = s..spad\n \n -- convert to C\n output('\\n'..pre..'{ /* begin embedded lua code */\\n')\n output(pre..' int top = lua_gettop(tolua_S);')\n output(pre..' static const unsigned char B[] = {\\n   ')\n local t={n=0}\n\n local b = gsub(s,'(.)',function (c)\n                         local e = ''\n                         t.n=t.n+1 if t.n==15 then t.n=0 e='\\n'..pre..'  ' end\n                         return format('%3u,%s',strbyte(c),e)\n                        end\n               )\n output(b..strbyte(\" \"))\n output('\\n'..pre..' };\\n')\n if first_line and first_line ~= \"\" then\n \toutput(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: '..first_line..'\");')\n else\n \toutput(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua: embedded Lua code '..code_n..'\");')\n end\n output(pre..' lua_settop(tolua_S, top);')\n output(pre..'} /* end of embedded lua code */\\n\\n')\n code_n = code_n +1\nend\n\n\n-- Print method\nfunction classCode:print (ident,close)\n print(ident..\"Code{\")\n print(ident..\" text = [[\"..self.text..\"]],\")\n print(ident..\"}\"..close)\nend\n\n\n-- Internal constructor\nfunction _Code (t)\n setmetatable(t,classCode)\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects a string representing the code text\nfunction Code (l)\n return _Code {\n  text = l\n }\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/compat-5.1.lua",
    "content": "if string.find(_VERSION, \"5%.0\") then\r\n\treturn\r\nend\r\n\r\n-- \"loadfile\"\r\nlocal function pp_dofile(path)\r\n\r\n\tlocal loaded = false\r\n\tlocal getfile = function()\r\n\r\n\t\tif loaded then\r\n\t\t\treturn\r\n\t\telse\r\n\t\t\tlocal file,err = io.open(path)\r\n\t\t\tif not file then\r\n\t\t\t\terror(\"error loading file \"..path..\": \"..err)\r\n\t\t\tend\r\n\t\t\tlocal ret = file:read(\"*a\")\r\n\t\t\tfile:close()\r\n\r\n\t\t\tret = string.gsub(ret, \"%.%.%.%s*%)\", \"...) local arg = {n=select('#', ...), ...};\")\r\n\r\n\t\t\tloaded = true\r\n\t\t\treturn ret\r\n\t\tend\r\n\tend\r\n\r\n\tlocal f = load(getfile, path)\r\n\tif not f then\r\n\r\n        error(\"error loading file \"..path ..\": \" .. errmsg)\t\r\n\tend\r\n\treturn f()\r\nend\r\n\r\nold_dofile = dofile\r\ndofile = pp_dofile\r\n\r\n\r\n-- string.gsub\r\n--[[\r\nlocal ogsub = string.gsub\r\nlocal function compgsub(a,b,c,d)\r\n  if type(c) == \"function\" then\r\n    local oc = c\r\n    c = function (...) return oc(...) or '' end\r\n  end\r\n  return ogsub(a,b,c,d)\r\nend\r\nstring.repl = ogsub\r\n--]]\r\n\r\n--string.gsub = compgsub\r\n\r\n\r\n\r\n\r\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/compat.lua",
    "content": "-------------------------------------------------------------------\n-- Real globals\n-- _ALERT\n-- _ERRORMESSAGE\n-- _VERSION\n-- _G\n-- assert\n-- error\n-- metatable\n-- next\n-- print\n-- require\n-- tonumber\n-- tostring\n-- type\n-- unpack\n\n-------------------------------------------------------------------\n-- collectgarbage\n-- gcinfo\n\n-- globals\n\n-- call   -> protect(f, err)\n-- loadfile\n-- loadstring\n\n-- rawget\n-- rawset\n\n-- getargs = Main.getargs ??\n\nrawtype = type\n\nfunction do_ (f, err)\n  if not f then print(err); return end\n  local a,b = pcall(f)\n  if not a then print(b); return nil\n  else return b or true\n  end\nend\n\nfunction dostring(s) return do_(load(s)) end\n-- function dofile(s) return do_(loadfile(s)) end\n\n-------------------------------------------------------------------\n-- Table library\nlocal tab = table\ngetn = function (tab) return #tab end\ntinsert = tab.insert\ntremove = tab.remove\nsort = tab.sort\n\n-------------------------------------------------------------------\n-- Debug library\nlocal dbg = debug\ngetinfo = dbg.getinfo\ngetlocal = dbg.getlocal\nsetcallhook = function () error\"`setcallhook' is deprecated\" end\nsetlinehook = function () error\"`setlinehook' is deprecated\" end\nsetlocal = dbg.setlocal\n\n-------------------------------------------------------------------\n-- math library\nlocal math = math\nabs = math.abs\nacos = function (x) return math.deg(math.acos(x)) end\nasin = function (x) return math.deg(math.asin(x)) end\natan = function (x) return math.deg(math.atan(x)) end\natan2 = function (x,y) return math.deg(math.atan2(x,y)) end\nceil = math.ceil\ncos = function (x) return math.cos(math.rad(x)) end\ndeg = math.deg\nexp = math.exp\nfloor = math.floor\nfrexp = math.frexp\nldexp = math.ldexp\nlog = math.log\nlog10 = function(val) return math.log(10, val) end\nmax = math.max\nmin = math.min\nmod = math.mod\nPI = math.pi\n--??? pow = math.pow  \nrad = math.rad\nrandom = math.random\nrandomseed = math.randomseed\nsin = function (x) return math.sin(math.rad(x)) end\nsqrt = math.sqrt\ntan = function (x) return math.tan(math.rad(x)) end\n\n-------------------------------------------------------------------\n-- string library\nlocal str = string\nstrbyte = str.byte\nstrchar = str.char\nstrfind = str.find\nformat = str.format\ngsub = str.gsub\nstrlen = str.len\nstrlower = str.lower\nstrrep = str.rep\nstrsub = str.sub\nstrupper = str.upper\n\n-------------------------------------------------------------------\n-- os library\nclock = os.clock\ndate = os.date\ndifftime = os.difftime\nexecute = os.execute --?\nexit = os.exit\ngetenv = os.getenv\nremove = os.remove\nrename = os.rename\nsetlocale = os.setlocale\ntime = os.time\ntmpname = os.tmpname\n\n-------------------------------------------------------------------\n-- compatibility only\ngetglobal = function (n) return _G[n] end\nsetglobal = function (n,v) _G[n] = v end\n\n-------------------------------------------------------------------\n\nlocal io, tab = io, table\n\n-- IO library (files)\n_STDIN = io.stdin\n_STDERR = io.stderr\n_STDOUT = io.stdout\n_INPUT = io.stdin\n_OUTPUT = io.stdout\nseek = io.stdin.seek   -- sick ;-)\ntmpfile = io.tmpfile\nclosefile = io.close\nopenfile = io.open\n\nfunction flush (f)\n  if f then f:flush()\n  else _OUTPUT:flush()\n  end\nend\n\nfunction readfrom (name)\n  if name == nil then\n    local f, err, cod = io.close(_INPUT)\n    _INPUT = io.stdin\n    return f, err, cod\n  else\n    local f, err, cod = io.open(name, \"r\")\n    _INPUT = f or _INPUT\n    return f, err, cod\n  end\nend\n\nfunction writeto (name)\n  if name == nil then\n    local f, err, cod = io.close(_OUTPUT)\n    _OUTPUT = io.stdout\n    return f, err, cod\n  else\n    local f, err, cod = io.open(name, \"w\")\n    _OUTPUT = f or _OUTPUT\n    return f, err, cod\n  end\nend\n\nfunction appendto (name)\n  local f, err, cod = io.open(name, \"a\")\n  _OUTPUT = f or _OUTPUT\n  return f, err, cod\nend\n\nfunction read (...)\n  local f = _INPUT\n  local arg = {...}\n  if rawtype(arg[1]) == 'userdata' then\n    f = tab.remove(arg, 1)\n  end\n  return f:read(table.unpack(arg))\nend\n\nfunction write (...)\n  local f = _OUTPUT\n  local arg = {...}\n  if rawtype(arg[1]) == 'userdata' then\n    f = tab.remove(arg, 1)\n  end\n  return f:write(table.unpack(arg))\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/container.lua",
    "content": "-- tolua: container abstract class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n-- table to store namespaced typedefs/enums in global scope\nglobal_typedefs = {}\nglobal_enums = {}\n\n-- Container class\n-- Represents a container of features to be bound\n-- to lua.\nclassContainer =\n{\n curr = nil,\n}\nclassContainer.__index = classContainer\nsetmetatable(classContainer,classFeature)\n\n-- output tags\nfunction classContainer:decltype ()\n push(self)\n local i=1\n while self[i] do\n  self[i]:decltype()\n  i = i+1\n end\n pop()\nend\n\n\n-- write support code\nfunction classContainer:supcode ()\n\n\tif not self:check_public_access() then\n\t\treturn\n\tend\n\n push(self)\n local i=1\n while self[i] do\n  if self[i]:check_public_access() then\n  \tself[i]:supcode()\n  end\n  i = i+1\n end\n pop()\nend\n\nfunction classContainer:hasvar ()\n local i=1\n while self[i] do\n  if self[i]:isvariable() then\n\t\t return 1\n\t\tend\n  i = i+1\n end\n\treturn 0\nend\n\n-- Internal container constructor\nfunction _Container (self)\n setmetatable(self,classContainer)\n self.n = 0\n self.typedefs = {tolua_n=0}\n self.usertypes = {}\n self.enums = {tolua_n=0}\n self.lnames = {}\n return self\nend\n\n-- push container\nfunction push (t)\n\tt.prox = classContainer.curr\n classContainer.curr = t\nend\n\n-- pop container\nfunction pop ()\n--print(\"name\",classContainer.curr.name)\n--foreach(classContainer.curr.usertypes,print)\n--print(\"______________\")\n classContainer.curr = classContainer.curr.prox\nend\n\n-- get current namespace\nfunction getcurrnamespace ()\n\treturn getnamespace(classContainer.curr)\nend\n\n-- append to current container\nfunction append (t)\n return classContainer.curr:append(t)\nend\n\n-- append typedef to current container\nfunction appendtypedef (t)\n return classContainer.curr:appendtypedef(t)\nend\n\n-- append usertype to current container\nfunction appendusertype (t)\n return classContainer.curr:appendusertype(t)\nend\n\n-- append enum to current container\nfunction appendenum (t)\n return classContainer.curr:appendenum(t)\nend\n\n-- substitute typedef\nfunction applytypedef (mod,type)\n return classContainer.curr:applytypedef(mod,type)\nend\n\n-- check if is type\nfunction findtype (type)\n local t = classContainer.curr:findtype(type)\n\treturn t\nend\n\n-- check if is typedef\nfunction istypedef (type)\n return classContainer.curr:istypedef(type)\nend\n\n-- get fulltype (with namespace)\nfunction fulltype (t)\n local curr =  classContainer.curr\n\twhile curr do\n\t if curr then\n\t\t if curr.typedefs and curr.typedefs[t] then\n\t\t  return curr.typedefs[t]\n\t\t elseif curr.usertypes and curr.usertypes[t] then\n\t\t  return curr.usertypes[t]\n\t\t\tend\n\t\tend\n\t curr = curr.prox\n\tend\n\treturn t\nend\n\n-- checks if it requires collection\nfunction classContainer:requirecollection (t)\n push(self)\n local i=1\n\tlocal r = false\n while self[i] do\n  r = self[i]:requirecollection(t) or r\n  i = i+1\n end\n\tpop()\n\treturn r\nend\n\n\n-- get namesapce\nfunction getnamespace (curr)\n\tlocal namespace = ''\n\twhile curr do\n\t if curr and\n\t\t   ( curr.classtype == 'class' or curr.classtype == 'namespace')\n\t\tthen\n\t\t namespace = (curr.original_name or curr.name) .. '::' .. namespace\n\t\t --namespace = curr.name .. '::' .. namespace\n\t\tend\n\t curr = curr.prox\n\tend\n\treturn namespace\nend\n\n-- get namespace (only namespace)\nfunction getonlynamespace ()\n local curr = classContainer.curr\n\tlocal namespace = ''\n\twhile curr do\n\t\tif curr.classtype == 'class' then\n\t\t return namespace\n\t\telseif curr.classtype == 'namespace' then\n\t\t namespace = curr.name .. '::' .. namespace\n\t\tend\n\t curr = curr.prox\n\tend\n\treturn namespace\nend\n\n-- check if is enum\nfunction isenum (type)\n return classContainer.curr:isenum(type)\nend\n\n-- append feature to container\nfunction classContainer:append (t)\n self.n = self.n + 1\n self[self.n] = t\n t.parent = self\nend\n\n-- append typedef\nfunction classContainer:appendtypedef (t)\n local namespace = getnamespace(classContainer.curr)\n self.typedefs.tolua_n = self.typedefs.tolua_n + 1\n self.typedefs[self.typedefs.tolua_n] = t\n\tself.typedefs[t.utype] = namespace .. t.utype\n\tglobal_typedefs[namespace..t.utype] = t\n\tt.ftype = findtype(t.type) or t.type\n\t--print(\"appending typedef \"..t.utype..\" as \"..namespace..t.utype..\" with ftype \"..t.ftype)\n\tappend_global_type(namespace..t.utype)\n\tif t.ftype and isenum(t.ftype) then\n\n\t\tglobal_enums[namespace..t.utype] = true\n\tend\nend\n\n-- append usertype: return full type\nfunction classContainer:appendusertype (t)\n\tlocal container\n\tif t == (self.original_name or self.name) then\n\t\tcontainer = self.prox\n\telse\n\t\tcontainer = self\n\tend\n\tlocal ft = getnamespace(container) .. t\n\tcontainer.usertypes[t] = ft\n\t_usertype[ft] = ft\n\treturn ft\nend\n\n-- append enum\nfunction classContainer:appendenum (t)\n local namespace = getnamespace(classContainer.curr)\n self.enums.tolua_n = self.enums.tolua_n + 1\n self.enums[self.enums.tolua_n] = t\n\tglobal_enums[namespace..t.name] = t\nend\n\n-- determine lua function name overload\nfunction classContainer:overload (lname)\n if not self.lnames[lname] then\n  self.lnames[lname] = 0\n else\n  self.lnames[lname] = self.lnames[lname] + 1\n end\n return format(\"%02d\",self.lnames[lname])\nend\n\n-- applies typedef: returns the 'the facto' modifier and type\nfunction classContainer:applytypedef (mod,type)\n\tif global_typedefs[type] then\n\t\t--print(\"found typedef \"..global_typedefs[type].type)\n\t\tlocal mod1, type1 = global_typedefs[type].mod, global_typedefs[type].ftype\n\t\tlocal mod2, type2 = applytypedef(mod..\" \"..mod1, type1)\n\t\t--return mod2 .. ' ' .. mod1, type2\n\t\treturn mod2, type2\n\tend\n\tdo return mod,type end\nend\n\n-- check if it is a typedef\nfunction classContainer:istypedef (type)\n local env = self\n while env do\n  if env.typedefs then\n   local i=1\n   while env.typedefs[i] do\n    if env.typedefs[i].utype == type then\n         return type\n        end\n        i = i+1\n   end\n  end\n  env = env.parent\n end\n return nil\nend\n\nfunction find_enum_var(var)\n\n\tif tonumber(var) then return var end\n\n\tlocal c = classContainer.curr\n\twhile c do\n\t\tlocal ns = getnamespace(c)\n\t\tfor k,v in pairs(_global_enums) do\n\t\t\tif match_type(var, v, ns) then\n\t\t\t\treturn v\n\t\t\tend\n\t\tend\n\t\tif c.base and c.base ~= '' then\n\t\t\tc = _global_classes[c:findtype(c.base)]\n\t\telse\n\t\t\tc = nil\n\t\tend\n\tend\n\n\treturn var\nend\n\n-- check if is a registered type: return full type or nil\nfunction classContainer:findtype (t)\n\n\tt = string.gsub(t, \"=.*\", \"\")\n\tif _basic[t] then\n\t return t\n\tend\n\n\tlocal _,_,em = string.find(t, \"([&%*])%s*$\")\n\tt = string.gsub(t, \"%s*([&%*])%s*$\", \"\")\n\tp = self\n\twhile p and type(p)=='table' do\n\t\tlocal st = getnamespace(p)\n\n\t\tfor i=_global_types.n,1,-1 do -- in reverse order\n\n\t\t\tif match_type(t, _global_types[i], st) then\n\t\t\t\treturn _global_types[i]..(em or \"\")\n\t\t\tend\n\t\tend\n\t\tif p.base and p.base ~= '' and p.base ~= t then\n\t\t\t--print(\"type is \"..t..\", p is \"..p.base..\" self.type is \"..self.type..\" self.name is \"..self.name)\n\t\t\tp = _global_classes[p:findtype(p.base)]\n\t\telse\n\t\t\tp = nil\n\t\tend\n\tend\n\n\treturn nil\nend\n\nfunction append_global_type(t, class)\n\t_global_types.n = _global_types.n +1\n\t_global_types[_global_types.n] = t\n\t_global_types_hash[t] = 1\n\tif class then append_class_type(t, class) end\nend\n\nfunction append_class_type(t,class)\n\tif _global_classes[t] then\n\t\tclass.flags = _global_classes[t].flags\n\t\tclass.lnames = _global_classes[t].lnames\n\t\tif _global_classes[t].base and (_global_classes[t].base ~= '') then\n\t\t\tclass.base = _global_classes[t].base or class.base\n\t\tend\n\tend\n\t_global_classes[t] = class\n\tclass.flags = class.flags or {}\nend\n\nfunction match_type(childtype, regtype, st)\n--print(\"findtype \"..childtype..\", \"..regtype..\", \"..st)\n\tlocal b,e = string.find(regtype, childtype, -string.len(childtype), true)\n\tif b then\n\n\t\tif e == string.len(regtype) and\n\t\t\t\t(b == 1 or (string.sub(regtype, b-1, b-1) == ':' and\n\t\t\t\tstring.sub(regtype, 1, b-1) == string.sub(st, 1, b-1))) then\n\t\t\treturn true\n\t\tend\n\tend\n\n\treturn false\nend\n\nfunction findtype_on_childs(self, t)\n\n\tlocal tchild\n\tif self.classtype == 'class' or self.classtype == 'namespace' then\n\t\tfor k,v in ipairs(self) do\n\t\t\tif v.classtype == 'class' or v.classtype == 'namespace' then\n\t\t\t\tif v.typedefs and v.typedefs[t] then\n\t\t\t\t return v.typedefs[t]\n\t\t\t\telseif v.usertypes and v.usertypes[t] then\n\t\t\t\t return v.usertypes[t]\n\t\t\t\tend\n\t\t\t\ttchild = findtype_on_childs(v, t)\n\t\t\t\tif tchild then return tchild end\n\t\t\tend\n\t\tend\n\tend\n\treturn nil\n\nend\n\nfunction classContainer:isenum (type)\n if global_enums[type] then\n\treturn type\n else\n \treturn false\n end\n\n local basetype = gsub(type,\"^.*::\",\"\")\n local env = self\n while env do\n  if env.enums then\n   local i=1\n   while env.enums[i] do\n    if env.enums[i].name == basetype then\n         return true\n        end\n        i = i+1\n   end\n  end\n  env = env.parent\n end\n return false\nend\n\nmethodisvirtual = false -- a global\n\n-- parse chunk\nfunction classContainer:doparse (s)\n--print (\"parse \"..s)\n\n -- try the parser hook\n do\n \tlocal sub = parser_hook(s)\n \tif sub then\n \t\treturn sub\n \tend\n end\n\n -- try the null statement\n do\n \tlocal b,e,code = string.find(s, \"^%s*;\")\n \tif b then\n \t\treturn strsub(s,e+1)\n \tend\n end\n\n -- try empty verbatim line\n do\n \tlocal b,e,code = string.find(s, \"^%s*$\\n\")\n \tif b then\n \t\treturn strsub(s,e+1)\n \tend\n end\n\n -- try Lua code\n do\n  local b,e,code = strfind(s,\"^%s*(%b\\1\\2)\")\n  if b then\n   Code(strsub(code,2,-2))\n   return strsub(s,e+1)\n  end\n end\n\n -- try C code\n do\n  local b,e,code = strfind(s,\"^%s*(%b\\3\\4)\")\n  if b then\n\tcode = '{'..strsub(code,2,-2)..'\\n}\\n'\n\tVerbatim(code,'r')        -- verbatim code for 'r'egister fragment\n\treturn strsub(s,e+1)\n  end\n end\n\n -- try C code for preamble section\n do\n \tlocal b,e,code = string.find(s, \"^%s*(%b\\5\\6)\")\n \tif b then\n \t\tcode = string.sub(code, 2, -2)..\"\\n\"\n\t\tVerbatim(code, '')\n\t\treturn string.sub(s, e+1)\n \tend\n end\n\n -- try default_property directive\n do\n \tlocal b,e,ptype = strfind(s, \"^%s*TOLUA_PROPERTY_TYPE%s*%(+%s*([^%)%s]*)%s*%)+%s*;?\")\n \tif b then\n \t\tif not ptype or ptype == \"\" then\n \t\t\tptype = \"default\"\n \t\tend\n \t\tself:set_property_type(ptype)\n\t \treturn strsub(s, e+1)\n \tend\n end\n\n -- try protected_destructor directive\n do\n \tlocal b,e = string.find(s, \"^%s*TOLUA_PROTECTED_DESTRUCTOR%s*;?\")\n\tif b then\n\t\tif self.set_protected_destructor then\n\t \t\tself:set_protected_destructor(true)\n\t \tend\n \t\treturn strsub(s, e+1)\n \tend\n end\n\n -- try 'extern' keyword\n do\n \tlocal b,e = string.find(s, \"^%s*extern%s+\")\n \tif b then\n\t\t-- do nothing\n \t\treturn strsub(s, e+1)\n \tend\n end\n\n -- try 'virtual' keyworkd\n do\n \tlocal b,e = string.find(s, \"^%s*virtual%s+\")\n \tif b then\n \t\tmethodisvirtual = true\n \t\treturn strsub(s, e+1)\n \tend\n end\n\n -- try labels (public, private, etc)\n do\n \tlocal b,e = string.find(s, \"^%s*%w*%s*:[^:]\")\n \tif b then\n \t\treturn strsub(s, e) -- preserve the [^:]\n \tend\n end\n\n -- try module\n do\n  local b,e,name,body = strfind(s,\"^%s*module%s%s*([_%w][_%w]*)%s*(%b{})%s*\")\n  if b then\n   _curr_code = strsub(s,b,e)\n   Module(name,body)\n   return strsub(s,e+1)\n  end\n end\n\n -- try namesapce\n do\n  local b,e,name,body = strfind(s,\"^%s*namespace%s%s*([_%w][_%w]*)%s*(%b{})%s*;?\")\n  if b then\n   _curr_code = strsub(s,b,e)\n   Namespace(name,body)\n   return strsub(s,e+1)\n  end\n end\n\n -- try define\n do\n  local b,e,name = strfind(s,\"^%s*#define%s%s*([^%s]*)[^\\n]*\\n%s*\")\n  if b then\n   _curr_code = strsub(s,b,e)\n   Define(name)\n   return strsub(s,e+1)\n  end\n end\n\n -- try enumerates\n\n do\n  local b,e,name,body,varname = strfind(s,\"^%s*enum%s+(%S*)%s*(%b{})%s*([^%s;]*)%s*;?%s*\")\n  if b then\n   --error(\"#Sorry, declaration of enums and variables on the same statement is not supported.\\nDeclare your variable separately (example: '\"..name..\" \"..varname..\";')\")\n   _curr_code = strsub(s,b,e)\n   Enumerate(name,body,varname)\n   return strsub(s,e+1)\n  end\n end\n\n-- do\n--  local b,e,name,body = strfind(s,\"^%s*enum%s+(%S*)%s*(%b{})%s*;?%s*\")\n--  if b then\n--   _curr_code = strsub(s,b,e)\n--   Enumerate(name,body)\n--  return strsub(s,e+1)\n--  end\n-- end\n\n do\n  local b,e,body,name = strfind(s,\"^%s*typedef%s+enum[^{]*(%b{})%s*([%w_][^%s]*)%s*;%s*\")\n  if b then\n   _curr_code = strsub(s,b,e)\n   Enumerate(name,body)\n   return strsub(s,e+1)\n  end\n end\n\n -- try operator\n do\n  local b,e,decl,kind,arg,const = strfind(s,\"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)%s*;%s*\")\n  if not b then\n\t\t -- try inline\n   b,e,decl,kind,arg,const = strfind(s,\"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)[%s\\n]*%b{}%s*;?%s*\")\n  end\n  if not b then\n  \t-- try cast operator\n  \tb,e,decl,kind,arg,const = strfind(s, \"^%s*(operator)%s+([%w_:%d<>%*%&%s]+)%s*(%b())%s*(c?o?n?s?t?)\");\n  \tif b then\n  \t\tlocal _,ie = string.find(s, \"^%s*%b{}\", e+1)\n  \t\tif ie then\n  \t\t\te = ie\n  \t\tend\n  \tend\n  end\n  if b then\n   _curr_code = strsub(s,b,e)\n   Operator(decl,kind,arg,const)\n   return strsub(s,e+1)\n  end\n end\n\n -- try function\n do\n  --local b,e,decl,arg,const = strfind(s,\"^%s*([~_%w][_@%w%s%*&:<>]*[_%w])%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*\")\n  local b,e,decl,arg,const,virt = strfind(s,\"^%s*([^%(\\n]+)%s*(%b())%s*(c?o?n?s?t?)%s*(=?%s*0?)%s*;%s*\")\n  if not b then\n  \t-- try function with template\n  \tb,e,decl,arg,const = strfind(s,\"^%s*([~_%w][_@%w%s%*&:<>]*[_%w]%b<>)%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*\")\n  end\n  if not b then\n   -- try a single letter function name\n   b,e,decl,arg,const = strfind(s,\"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)%s*;%s*\")\n  end\n  if not b then\n   -- try function pointer\n   b,e,decl,arg,const = strfind(s,\"^%s*([^%(;\\n]+%b())%s*(%b())%s*;%s*\")\n   if b then\n    decl = string.gsub(decl, \"%(%s*%*([^%)]*)%s*%)\", \" %1 \")\n   end\n  end\n  if b then\n  \tif virt and string.find(virt, \"[=0]\") then\n  \t\tif self.flags then\n  \t\t\tself.flags.pure_virtual = true\n  \t\tend\n  \tend\n   _curr_code = strsub(s,b,e)\n   Function(decl,arg,const)\n   return strsub(s,e+1)\n  end\n end\n\n -- try inline function\n do\n  local b,e,decl,arg,const = strfind(s,\"^%s*([^%(\\n]+)%s*(%b())%s*(c?o?n?s?t?)[^;{]*%b{}%s*;?%s*\")\n  --local b,e,decl,arg,const = strfind(s,\"^%s*([~_%w][_@%w%s%*&:<>]*[_%w>])%s*(%b())%s*(c?o?n?s?t?)[^;]*%b{}%s*;?%s*\")\n  if not b then\n   -- try a single letter function name\n   b,e,decl,arg,const = strfind(s,\"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?).-%b{}%s*;?%s*\")\n  end\n  if b then\n   _curr_code = strsub(s,b,e)\n   Function(decl,arg,const)\n   return strsub(s,e+1)\n  end\n end\n\n -- try class\n do\n\t local b,e,name,base,body\n\t\tbase = '' body = ''\n\t\tb,e,name = strfind(s,\"^%s*class%s*([_%w][_%w@]*)%s*;\")  -- dummy class\n\t\tlocal dummy = false\n\t\tif not b then\n\t\t\tb,e,name = strfind(s,\"^%s*struct%s*([_%w][_%w@]*)%s*;\")    -- dummy struct\n\t\t\tif not b then\n\t\t\t\tb,e,name,base,body = strfind(s,\"^%s*class%s*([_%w][_%w@]*)%s*([^{]-)%s*(%b{})%s*\")\n\t\t\t\tif not b then\n\t\t\t\t\tb,e,name,base,body = strfind(s,\"^%s*struct%s+([_%w][_%w@]*)%s*([^{]-)%s*(%b{})%s*\")\n\t\t\t\t\tif not b then\n\t\t\t\t\t\tb,e,name,base,body = strfind(s,\"^%s*union%s*([_%w][_%w@]*)%s*([^{]-)%s*(%b{})%s*\")\n\t\t\t\t\t\tif not b then\n\t\t\t\t\t\t\tbase = ''\n\t\t\t\t\t\t\tb,e,body,name = strfind(s,\"^%s*typedef%s%s*struct%s%s*[_%w]*%s*(%b{})%s*([_%w][_%w@]*)%s*;\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\telse dummy = 1 end\n\t\telse dummy = 1 end\n\t\tif b then\n\t\t\tif base ~= '' then\n\t\t\t\tbase = string.gsub(base, \"^%s*:%s*\", \"\")\n\t\t\t\tbase = string.gsub(base, \"%s*public%s*\", \"\")\n\t\t\t\tbase = split(base, \",\")\n\t\t\t\t--local b,e\n\t\t\t\t--b,e,base = strfind(base,\".-([_%w][_%w<>,:]*)$\")\n\t\t\telse\n\t\t\t\tbase = {}\n\t\t\tend\n\t\t\t_curr_code = strsub(s,b,e)\n\t\t\tClass(name,base,body)\n\t\t\tif not dummy then\n\t\t\t\tvarb,vare,varname = string.find(s, \"^%s*([_%w]+)%s*;\", e+1)\n\t\t\t\tif varb then\n\t\t\t\t\tVariable(name..\" \"..varname)\n\t\t\t\t\te = vare\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn strsub(s,e+1)\n\t\tend\n\tend\n\n -- try typedef\n do\n  local b,e,types = strfind(s,\"^%s*typedef%s%s*(.-)%s*;%s*\")\n  if b then\n   _curr_code = strsub(s,b,e)\n   Typedef(types)\n   return strsub(s,e+1)\n  end\n end\n\n -- try variable\n do\n  local b,e,decl = strfind(s,\"^%s*([_%w][_@%s%w%d%*&:<>,]*[_%w%d])%s*;%s*\")\n  if b then\n   _curr_code = strsub(s,b,e)\n\n\tlocal list = split_c_tokens(decl, \",\")\n\tVariable(list[1])\n\tif list.n > 1 then\n\t\tlocal _,_,type = strfind(list[1], \"(.-)%s+([^%s]*)$\");\n\n\t\tlocal i =2;\n\t\twhile list[i] do\n\t\t\tVariable(type..\" \"..list[i])\n\t\t\ti=i+1\n\t\tend\n\tend\n   --Variable(decl)\n   return strsub(s,e+1)\n  end\n end\n\n\t-- try string\n do\n  local b,e,decl = strfind(s,\"^%s*([_%w]?[_%s%w%d]-char%s+[_@%w%d]*%s*%[%s*%S+%s*%])%s*;%s*\")\n  if b then\n   _curr_code = strsub(s,b,e)\n   Variable(decl)\n   return strsub(s,e+1)\n  end\n end\n\n -- try array\n do\n  local b,e,decl = strfind(s,\"^%s*([_%w][][_@%s%w%d%*&:<>]*[]_%w%d])%s*;%s*\")\n  if b then\n   _curr_code = strsub(s,b,e)\n   Array(decl)\n   return strsub(s,e+1)\n  end\n end\n\n -- no matching\n if gsub(s,\"%s%s*\",\"\") ~= \"\" then\n  _curr_code = s\n  error(\"#parse error\")\n else\n  return \"\"\n end\n\nend\n\nfunction classContainer:parse (s)\n\n\t--self.curr_member_access = nil\n\n while s ~= '' do\n  s = self:doparse(s)\n  methodisvirtual = false\n end\nend\n\n\n-- property types\n\nfunction get_property_type()\n\n\treturn classContainer.curr:get_property_type()\nend\n\nfunction classContainer:set_property_type(ptype)\n\tptype = string.gsub(ptype, \"^%s*\", \"\")\n\tptype = string.gsub(ptype, \"%s*$\", \"\")\n\n\tself.property_type = ptype\nend\n\nfunction classContainer:get_property_type()\n\treturn self.property_type or (self.parent and self.parent:get_property_type()) or \"default\"\nend\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/custom.lua",
    "content": "\r\nfunction extract_code(fn,s)\r\n\tlocal code = \"\"\r\n\tif fn then\r\n\t\tcode = '\\n$#include \"'..fn..'\"\\n'\r\n\tend\r\n\ts= \"\\n\" .. s .. \"\\n\" -- add blank lines as sentinels\r\n\tlocal _,e,c,t = strfind(s, \"\\n([^\\n]-)SCRIPT_([%w_]*)[^\\n]*\\n\")\r\n\twhile e do\r\n\t\tt = strlower(t)\r\n\t\tif t == \"bind_begin\" then\r\n\t\t\t_,e,c = strfind(s,\"(.-)\\n[^\\n]*SCRIPT_BIND_END[^\\n]*\\n\",e)\r\n\t\t\tif not e then\r\n\t\t\t tolua_error(\"Unbalanced 'SCRIPT_BIND_BEGIN' directive in header file\")\r\n\t\t\tend\r\n\t\tend\r\n\t\tif t == \"bind_class\" or t == \"bind_block\" then\r\n\t\t\tlocal b\r\n\t\t\t_,e,c,b = string.find(s, \"([^{]-)(%b{})\", e)\r\n\t\t\tc = c..'{\\n'..extract_code(nil, b)..'\\n};\\n'\r\n\t\tend\r\n\t\tcode = code .. c .. \"\\n\"\r\n\t _,e,c,t = strfind(s, \"\\n([^\\n]-)SCRIPT_([%w_]*)[^\\n]*\\n\",e)\r\n\tend\r\n\treturn code\r\nend\r\n\r\nfunction preprocess_hook(p)\r\nend\r\n\r\nfunction preparse_hook(p)\r\nend\r\n\r\nfunction include_file_hook(p, filename)\r\n\tdo return end\r\n--print(\"FILENAME is \"..filename)\r\n\tp.code = string.gsub(p.code, \"\\n%s*SigC::Signal\", \"\\n\\ttolua_readonly SigC::Signal\")\r\n\tp.code = string.gsub(p.code, \"#ifdef __cplusplus\\nextern \\\"C\\\" {\\n#endif\", \"\")\r\n\tp.code = string.gsub(p.code, \"#ifdef __cplusplus\\n};?\\n#endif\", \"\")\r\n\tp.code = string.gsub(p.code, \"DECLSPEC\", \"\")\r\n\tp.code = string.gsub(p.code, \"SDLCALL\", \"\")\r\n\tp.code = string.gsub(p.code, \"DLLINTERFACE\", \"\")\r\n\tp.code = string.gsub(p.code, \"#define[^\\n]*_[hH]_?%s*\\n\", \"\\n\")\r\n--print(\"code is \"..p.code)\r\nend\r\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/declaration.lua",
    "content": "-- tolua: declaration class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Declaration class\n-- Represents variable, function, or argument declaration.\n-- Stores the following fields:\n--  mod  = type modifiers\n--  type = type\n--  ptr  = \"*\" or \"&\", if representing a pointer or a reference\n--  name = name\n--  dim  = dimension, if a vector\n--  def  = default value, if any (only for arguments)\n--  ret  = \"*\" or \"&\", if value is to be returned (only for arguments)\nclassDeclaration = {\n mod = '',\n type = '',\n ptr = '',\n name = '',\n dim = '',\n ret = '',\n def = ''\n}\nclassDeclaration.__index = classDeclaration\nsetmetatable(classDeclaration,classFeature)\n\n-- Create an unique variable name\nfunction create_varname ()\n if not _varnumber then _varnumber = 0 end\n _varnumber = _varnumber + 1\n return \"tolua_var_\".._varnumber\nend\n\n-- Check declaration name\n-- It also identifies default values\nfunction classDeclaration:checkname ()\n\n if strsub(self.name,1,1) == '[' and not findtype(self.type) then\n  self.name = self.type..self.name\n  local m = split(self.mod,'%s%s*')\n  self.type = m[m.n]\n  self.mod = concat(m,1,m.n-1)\n end\n\n local t = split(self.name,'=')\n if t.n==2 then\n  self.name = t[1]\n  self.def = find_enum_var(t[t.n])\n end\n\n local b,e,d = strfind(self.name,\"%[(.-)%]\")\n if b then\n  self.name = strsub(self.name,1,b-1)\n  self.dim = find_enum_var(d)\n end\n\n\n if self.type ~= '' and self.type ~= 'void' and self.name == '' then\n  self.name = create_varname()\n elseif self.kind=='var' then\n  if self.type=='' and self.name~='' then\n   self.type = self.type..self.name\n   self.name = create_varname()\n  elseif findtype(self.name) then\n   if self.type=='' then self.type = self.name\n   else self.type = self.type..' '..self.name end\n   self.name = create_varname()\n  end\n end\n\n -- adjust type of string\n if self.type == 'char' and self.dim ~= '' then\n\t self.type = 'char*'\n end\n\n\tif self.kind and self.kind == 'var' then\n\t\tself.name = string.gsub(self.name, \":.*$\", \"\") -- ???\n\tend\nend\n\n-- Check declaration type\n-- Substitutes typedef's.\nfunction classDeclaration:checktype ()\n\n -- check if there is a pointer to basic type\n local basic = isbasic(self.type)\n if self.kind == 'func' and basic=='number' and string.find(self.ptr, \"%*\") then\n \tself.type = '_userdata'\n \tself.ptr = \"\"\n end\n if basic and self.ptr~='' then\n  self.ret = self.ptr\n  self.ptr = nil\n  if isbasic(self.type) == 'number' then\n  \tself.return_userdata = true\n  end\n end\n\n -- check if there is array to be returned\n if self.dim~='' and self.ret~='' then\n   error('#invalid parameter: cannot return an array of values')\n end\n -- restore 'void*' and 'string*'\n if self.type == '_userdata' then self.type = 'void*'\n elseif self.type == '_cstring' then self.type = 'char*'\n elseif self.type == '_lstate' then self.type = 'lua_State*'\n end\n\n -- resolve types inside the templates\n if self.type then\n\t self.type = resolve_template_types(self.type)\n end\n\n--\n-- -- if returning value, automatically set default value\n-- if self.ret ~= '' and self.def == '' then\n--  self.def = '0'\n-- end\n--\n\nend\n\nfunction resolve_template_types(type)\n\n\tif isbasic(type) then\n\t\treturn type\n\tend\n\tlocal b,_,m = string.find(type, \"(%b<>)\")\n\tif b then\n\n\t\tm = split_c_tokens(string.sub(m, 2, -2), \",\")\n\t\tfor i=1, #m do\n\t\t\tm[i] = string.gsub(m[i],\"%s*([%*&])\", \"%1\")\n\t\t\tif not isbasic(m[i]) then\n\t\t\t\tif not isenum(m[i]) then _, m[i] = applytypedef(\"\", m[i]) end\n\t\t\t\tm[i] = findtype(m[i]) or m[i]\n\t\t\t\tm[i] = resolve_template_types(m[i])\n\t\t\tend\n\t\tend\n\n\t\tlocal b,i\n\t\ttype,b,i = break_template(type)\n--print(\"concat is \",concat(m, 1, m.n))\n\t\tlocal template_part = \"<\"..concat(m, 1, m.n, \",\")..\">\"\n\t\ttype = rebuild_template(type, b, template_part)\n\t\ttype = string.gsub(type, \">>\", \"> >\")\n\tend\n\treturn type\nend\n\nfunction break_template(s)\n\tlocal b,e,timpl = string.find(s, \"(%b<>)\")\n\tif timpl then\n\t\ts = string.gsub(s, \"%b<>\", \"\")\n\t\treturn s, b, timpl\n\telse\n\t\treturn s, 0, nil\n\tend\nend\n\nfunction rebuild_template(s, b, timpl)\n\n\tif b == 0 then\n\t\treturn s\n\tend\n\n\treturn string.sub(s, 1, b-1)..timpl..string.sub(s, b, -1)\nend\n\n-- Print method\nfunction classDeclaration:print (ident,close)\n print(ident..\"Declaration{\")\n print(ident..\" mod  = '\"..self.mod..\"',\")\n print(ident..\" type = '\"..self.type..\"',\")\n print(ident..\" ptr  = '\"..self.ptr..\"',\")\n print(ident..\" name = '\"..self.name..\"',\")\n print(ident..\" dim  = '\"..self.dim..\"',\")\n print(ident..\" def  = '\"..self.def..\"',\")\n print(ident..\" ret  = '\"..self.ret..\"',\")\n print(ident..\"}\"..close)\nend\n\n-- check if array of values are returned to Lua\nfunction classDeclaration:requirecollection (t)\n if self.mod ~= 'const' and\n\t    self.dim and self.dim ~= '' and\n\t\t\t\t not isbasic(self.type) and\n\t\t\t\t self.ptr == '' and self:check_public_access() then\n\t\tlocal type = gsub(self.type,\"%s*const%s+\",\"\")\n\t\tt[type] = \"tolua_collect_\" .. clean_template(type)\n\t\treturn true\n\tend\n\treturn false\nend\n\n-- declare tag\nfunction classDeclaration:decltype ()\n\n\tself.type = typevar(self.type)\n\tif strfind(self.mod,'const') then\n\t\tself.type = 'const '..self.type\n\t\tself.mod = gsub(self.mod,'const%s*','')\n\tend\nend\n\n\n-- output type checking\nfunction classDeclaration:outchecktype (narg)\n local def\n local t = isbasic(self.type)\n if self.def~='' then\n  def = 1\n else\n  def = 0\n end\n if self.dim ~= '' then\n\t--if t=='string' then\n\t--\treturn 'tolua_isstringarray(tolua_S,'..narg..','..def..',&tolua_err)'\n\t--else\n\treturn '!tolua_istable(tolua_S,'..narg..',0,&tolua_err)'\n \t--end\n elseif t then\n\treturn '!tolua_is'..t..'(tolua_S,'..narg..','..def..',&tolua_err)'\n else\n  local is_func = get_is_function(self.type)\n  if self.ptr == '&' or self.ptr == '' then\n  \treturn '(tolua_isvaluenil(tolua_S,'..narg..',&tolua_err) || !'..is_func..'(tolua_S,'..narg..',\"'..self.type..'\",'..def..',&tolua_err))'\n  else\n\treturn '!'..is_func..'(tolua_S,'..narg..',\"'..self.type..'\",'..def..',&tolua_err)'\n  end\n end\nend\n\nfunction classDeclaration:builddeclaration (narg, cplusplus)\n local array = self.dim ~= '' and tonumber(self.dim)==nil\n\tlocal line = \"\"\n local ptr = ''\n local mod\n local type = self.type\n local nctype = gsub(self.type,'const%s+','')\n if self.dim ~= '' then\n\t type = gsub(self.type,'const%s+','')  -- eliminates const modifier for arrays\n end\n if self.ptr~='' and not isbasic(type) then ptr = '*' end\n line = concatparam(line,\" \",self.mod,type,ptr)\n if array then\n  line = concatparam(line,'*')\n end\n line = concatparam(line,self.name)\n if self.dim ~= '' then\n  if tonumber(self.dim)~=nil then\n   line = concatparam(line,'[',self.dim,'];')\n  else\n\tif cplusplus then\n\t\tline = concatparam(line,' = Mtolua_new_dim(',type,ptr,', '..self.dim..');')\n\telse\n\t\tline = concatparam(line,' = (',type,ptr,'*)',\n\t\t'malloc((',self.dim,')*sizeof(',type,ptr,'));')\n\tend\n  end\n else\n  local t = isbasic(type)\n  line = concatparam(line,' = ')\n  if t == 'state' then\n  \tline = concatparam(line, 'tolua_S;')\n  else\n  \t--print(\"t is \"..tostring(t)..\", ptr is \"..tostring(self.ptr))\n  \tif t == 'number' and string.find(self.ptr, \"%*\") then\n  \t\tt = 'userdata'\n  \tend\n\tif not t and ptr=='' then line = concatparam(line,'*') end\n\tline = concatparam(line,'((',self.mod,type)\n\tif not t then\n\t\tline = concatparam(line,'*')\n\tend\n\tline = concatparam(line,') ')\n\tif isenum(nctype) then\n\t\tline = concatparam(line,'(int) ')\n\tend\n\tlocal def = 0\n\tif self.def ~= '' then\n\t\tdef = self.def\n\t\tif (ptr == '' or self.ptr == '&') and not t then\n\t\t\tdef = \"(void*)&(const \"..type..\")\"..def\n\t\tend\n\tend\n\tif t then\n\t\tline = concatparam(line,'tolua_to'..t,'(tolua_S,',narg,',',def,'));')\n\telse\n\t\tlocal to_func = get_to_function(type)\n\t\tline = concatparam(line,to_func..'(tolua_S,',narg,',',def,'));')\n\tend\n  end\n end\n\treturn line\nend\n\n-- Declare variable\nfunction classDeclaration:declare (narg)\n if self.dim ~= '' and tonumber(self.dim)==nil then\n\t output('#ifdef __cplusplus\\n')\n\t\toutput(self:builddeclaration(narg,true))\n\t\toutput('#else\\n')\n\t\toutput(self:builddeclaration(narg,false))\n\t output('#endif\\n')\n\telse\n\t\toutput(self:builddeclaration(narg,false))\n\tend\nend\n\n-- Get parameter value\nfunction classDeclaration:getarray (narg)\n if self.dim ~= '' then\n\t local type = gsub(self.type,'const ','')\n  output('  {')\n\t output('#ifndef TOLUA_RELEASE\\n')\n  local def; if self.def~='' then def=1 else def=0 end\n\t\tlocal t = isbasic(type)\n\t\tif (t) then\n\t\t   output('   if (!tolua_is'..t..'array(tolua_S,',narg,',',self.dim,',',def,',&tolua_err))')\n\t\telse\n\t\t   output('   if (!tolua_isusertypearray(tolua_S,',narg,',\"',type,'\",',self.dim,',',def,',&tolua_err))')\n\t\tend\n  output('    goto tolua_lerror;')\n  output('   else\\n')\n\t output('#endif\\n')\n  output('   {')\n  output('    int i;')\n  output('    for(i=0; i<'..self.dim..';i++)')\n  local t = isbasic(type)\n  local ptr = ''\n  if self.ptr~='' then ptr = '*' end\n  output('   ',self.name..'[i] = ')\n  if not t and ptr=='' then output('*') end\n  output('((',type)\n  if not t then\n   output('*')\n  end\n  output(') ')\n  local def = 0\n  if self.def ~= '' then def = self.def end\n  if t then\n   output('tolua_tofield'..t..'(tolua_S,',narg,',i+1,',def,'));')\n  else\n   output('tolua_tofieldusertype(tolua_S,',narg,',i+1,',def,'));')\n  end\n  output('   }')\n  output('  }')\n end\nend\n\n-- Get parameter value\nfunction classDeclaration:setarray (narg)\n if not strfind(self.type,'const%s+') and self.dim ~= '' then\n\t local type = gsub(self.type,'const ','')\n  output('  {')\n  output('   int i;')\n  output('   for(i=0; i<'..self.dim..';i++)')\n  local t,ct = isbasic(type)\n  if t then\n   output('    tolua_pushfield'..t..'(tolua_S,',narg,',i+1,(',ct,')',self.name,'[i]);')\n  else\n   if self.ptr == '' then\n     output('   {')\n     output('#ifdef __cplusplus\\n')\n     output('    void* tolua_obj = Mtolua_new((',type,')(',self.name,'[i]));')\n     output('    tolua_pushfieldusertype_and_takeownership(tolua_S,',narg,',i+1,tolua_obj,\"',type,'\");')\n     output('#else\\n')\n     output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&',self.name,'[i],sizeof(',type,'));')\n     output('    tolua_pushfieldusertype(tolua_S,',narg,',i+1,tolua_obj,\"',type,'\");')\n     output('#endif\\n')\n     output('   }')\n   else\n    output('   tolua_pushfieldusertype(tolua_S,',narg,',i+1,(void*)',self.name,'[i],\"',type,'\");')\n   end\n  end\n  output('  }')\n end\nend\n\n-- Free dynamically allocated array\nfunction classDeclaration:freearray ()\n if self.dim ~= '' and tonumber(self.dim)==nil then\n\t output('#ifdef __cplusplus\\n')\n\t\toutput('  Mtolua_delete_dim(',self.name,');')\n\t output('#else\\n')\n  output('  free(',self.name,');')\n\t output('#endif\\n')\n end\nend\n\n-- Pass parameter\nfunction classDeclaration:passpar ()\n if self.ptr=='&' and not isbasic(self.type) then\n  output('*'..self.name)\n elseif self.ret=='*' then\n  output('&'..self.name)\n else\n  output(self.name)\n end\nend\n\n-- Return parameter value\nfunction classDeclaration:retvalue ()\n if self.ret ~= '' then\n  local t,ct = isbasic(self.type)\n  if t and t~='' then\n   output('   tolua_push'..t..'(tolua_S,(',ct,')'..self.name..');')\n  else\n   local push_func = get_push_function(self.type)\n   output('   ',push_func,'(tolua_S,(void*)'..self.name..',\"',self.type,'\");')\n  end\n  return 1\n end\n return 0\nend\n\n-- Internal constructor\nfunction _Declaration (t)\n\n setmetatable(t,classDeclaration)\n t:buildnames()\n t:checkname()\n t:checktype()\n local ft = findtype(t.type) or t.type\n if not isenum(ft) then\n\tt.mod, t.type = applytypedef(t.mod, ft)\n end\n\n if t.kind==\"var\" and (string.find(t.mod, \"tolua_property%s\") or string.find(t.mod, \"tolua_property$\")) then\n \tt.mod = string.gsub(t.mod, \"tolua_property\", \"tolua_property__\"..get_property_type())\n end\n\n return t\nend\n\n-- Constructor\n-- Expects the string declaration.\n-- The kind of declaration can be \"var\" or \"func\".\nfunction Declaration (s,kind,is_parameter)\n\n -- eliminate spaces if default value is provided\n s = gsub(s,\"%s*=%s*\",\"=\")\n s = gsub(s, \"%s*<\", \"<\")\n\n local defb,tmpdef\n defb,_,tmpdef = string.find(s, \"(=.*)$\")\n if defb then\n \ts = string.gsub(s, \"=.*$\", \"\")\n else\n \ttmpdef = ''\n end\n if kind == \"var\" then\n  -- check the form: void\n  if s == '' or s == 'void' then\n   return _Declaration{type = 'void', kind = kind, is_parameter = is_parameter}\n  end\n end\n\n -- check the form: mod type*& name\n local t = split_c_tokens(s,'%*%s*&')\n if t.n == 2 then\n  if kind == 'func' then\n   error(\"#invalid function return type: \"..s)\n  end\n  --local m = split(t[1],'%s%s*')\n  local m = split_c_tokens(t[1],'%s+')\n  return _Declaration{\n   name = t[2]..tmpdef,\n   ptr = '*',\n   ret = '&',\n   --type = rebuild_template(m[m.n], tb, timpl),\n   type = m[m.n],\n   mod = concat(m,1,m.n-1),\n   is_parameter = is_parameter,\n   kind = kind\n  }\n end\n\n -- check the form: mod type** name\n t = split_c_tokens(s,'%*%s*%*')\n if t.n == 2 then\n  if kind == 'func' then\n   error(\"#invalid function return type: \"..s)\n  end\n  --local m = split(t[1],'%s%s*')\n  local m = split_c_tokens(t[1],'%s+')\n  return _Declaration{\n   name = t[2]..tmpdef,\n   ptr = '*',\n   ret = '*',\n   --type = rebuild_template(m[m.n], tb, timpl),\n   type = m[m.n],\n   mod = concat(m,1,m.n-1),\n   is_parameter = is_parameter,\n   kind = kind\n  }\n end\n\n -- check the form: mod type& name\n t = split_c_tokens(s,'&')\n if t.n == 2 then\n  --local m = split(t[1],'%s%s*')\n  local m = split_c_tokens(t[1],'%s+')\n  return _Declaration{\n   name = t[2]..tmpdef,\n   ptr = '&',\n   --type = rebuild_template(m[m.n], tb, timpl),\n   type = m[m.n],\n   mod = concat(m,1,m.n-1),\n   is_parameter = is_parameter,\n   kind = kind\n  }\n end\n\n -- check the form: mod type* name\n local s1 = gsub(s,\"(%b%[%])\",function (n) return gsub(n,'%*','\\1') end)\n t = split_c_tokens(s1,'%*')\n if t.n == 2 then\n  t[2] = gsub(t[2],'\\1','%*') -- restore * in dimension expression\n  --local m = split(t[1],'%s%s*')\n  local m = split_c_tokens(t[1],'%s+')\n  return _Declaration{\n   name = t[2]..tmpdef,\n   ptr = '*',\n   type = m[m.n],\n   --type = rebuild_template(m[m.n], tb, timpl),\n   mod = concat(m,1,m.n-1)   ,\n   is_parameter = is_parameter,\n   kind = kind\n  }\n end\n\n if kind == 'var' then\n  -- check the form: mod type name\n  --t = split(s,'%s%s*')\n  t = split_c_tokens(s,'%s+')\n  local v\n  if findtype(t[t.n]) then v = create_varname() else v = t[t.n]; t.n = t.n-1 end\n  return _Declaration{\n   name = v..tmpdef,\n   --type = rebuild_template(t[t.n], tb, timpl),\n   type = t[t.n],\n   mod = concat(t,1,t.n-1),\n   is_parameter = is_parameter,\n   kind = kind\n  }\n\n else -- kind == \"func\"\n\n  -- check the form: mod type name\n  --t = split(s,'%s%s*')\n  t = split_c_tokens(s,'%s+')\n  local v = t[t.n]  -- last word is the function name\n  local tp,md\n  if t.n>1 then\n   tp = t[t.n-1]\n   md = concat(t,1,t.n-2)\n  end\n  --if tp then tp = rebuild_template(tp, tb, timpl) end\n  return _Declaration{\n   name = v,\n   type = tp,\n   mod = md,\n   is_parameter = is_parameter,\n   kind = kind\n  }\n end\n\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/define.lua",
    "content": "-- tolua: define class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: define.lua,v 1.2 1999/07/28 22:21:08 celes Exp $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Define class\n-- Represents a numeric const definition\n-- The following filds are stored:\n--   name = constant name\nclassDefine = {\n name = '',\n}\nclassDefine.__index = classDefine\nsetmetatable(classDefine,classFeature)\n\n-- register define\nfunction classDefine:register (pre)\n\tif not self:check_public_access() then\n\t\treturn\n\tend\n\n pre = pre or ''\n output(pre..'tolua_constant(tolua_S,\"'..self.lname..'\",'..self.name..');')\nend\n\n-- Print method\nfunction classDefine:print (ident,close)\n print(ident..\"Define{\")\n print(ident..\" name = '\"..self.name..\"',\")\n print(ident..\" lname = '\"..self.lname..\"',\")\n print(ident..\"}\"..close)\nend\n\n\n-- Internal constructor\nfunction _Define (t)\n setmetatable(t,classDefine)\n t:buildnames()\n\n if t.name == '' then\n  error(\"#invalid define\")\n end\n\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects a string representing the constant name\nfunction Define (n)\n return _Define{\n  name = n\n }\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/doit.lua",
    "content": "-- Generate binding code\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- Last update: Apr 2003\n-- $Id: $\n\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\nfunction parse_extra()\n\n\tfor k,v in ipairs(_extra_parameters or {}) do\n\t\t\n\t\tlocal b,e,name,value = string.find(v, \"^([^=]*)=(.*)$\")\n\t\tif b then\n\t\t\t_extra_parameters[name] = value\n\t\telse\n\t\t\t_extra_parameters[v] = true\n\t\tend\n\tend\nend\n\nfunction doit ()\n\t-- define package name, if not provided\n\tif not flags.n then\n\t\tif flags.f then\n\t\t\tflags.n = gsub(flags.f,\"%..*$\",\"\")\n\t\t\t_,_,flags.n = string.find(flags.n, \"([^/\\\\]*)$\")\n\t\telse\n\t\t\terror(\"#no package name nor input file provided\")\n\t\tend\n\tend\n\n\t-- parse table with extra paramters\n\tparse_extra()\n\n\t-- do this after setting the package name\n\tif flags['L'] then\n\t\tdofile(flags['L'])\n\tend\n\n\t-- add cppstring\n\tif not flags['S'] then\n\t\t_basic['string'] = 'cppstring'\n\t\t_basic['std::string'] = 'cppstring'\n\t\t_basic_ctype.cppstring = 'const char*'\n\tend\n\n\t-- proccess package\n\tlocal p  = Package(flags.n,flags.f)\n\n\tif flags.p then\n\t\treturn        -- only parse\n\tend\n\n\tif flags.o then\n\t\tlocal st,msg = writeto(flags.o)\n\t\tif not st then\n\t\t\terror('#'..msg)\n\t\tend\n\tend\n\n\tp:decltype()\n\tif flags.P then\n\t\tp:print()\n\telse\n\t\tpush(p)\n\t\tpre_output_hook(p)\n\t\tpop()\n\t\tp:preamble()\n\t\tp:supcode()\n\t\tpush(p)\n\t\tpre_register_hook(p)\n\t\tpop()\n\t\tp:register()\n\t\tpush(p)\n\t\tpost_output_hook(p)\n\t\tpop()\n\tend\n\n\tif flags.o then\n\t\twriteto()\n\tend\n\n\t-- write header file\n\tif not flags.P then\n\t\tif flags.H then\n\t\t\tlocal st,msg = writeto(flags.H)\n\t\t\tif not st then\n\t\t\t\terror('#'..msg)\n\t\t\tend\n\t\t\tp:header()\n\t\t\twriteto()\n\t\tend\n\tend\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/enumerate.lua",
    "content": "-- tolua: enumerate class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: enumerate.lua,v 1.3 2000/01/24 20:41:15 celes Exp $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Enumerate class\n-- Represents enumeration\n-- The following fields are stored:\n--    {i} = list of constant names\nclassEnumerate = {\n}\nclassEnumerate.__index = classEnumerate\nsetmetatable(classEnumerate,classFeature)\n\n-- register enumeration\nfunction classEnumerate:register (pre)\n\tif not self:check_public_access() then\n\t\treturn\n\tend\n pre = pre or ''\n local nspace = getnamespace(classContainer.curr)\n local i=1\n while self[i] do\n \tif self.lnames[i] and self.lnames[i] ~= \"\" then\n\t\n\t\toutput(pre..'tolua_constant(tolua_S,\"'..self.lnames[i]..'\",'..nspace..self[i]..');')\n\tend\n  i = i+1\n end\nend\n\n-- Print method\nfunction classEnumerate:print (ident,close)\n print(ident..\"Enumerate{\")\n print(ident..\" name = \"..self.name)\n local i=1\n while self[i] do\n  print(ident..\" '\"..self[i]..\"'(\"..self.lnames[i]..\"),\")\n  i = i+1\n end\n print(ident..\"}\"..close)\nend\n\n-- Internal constructor\nfunction _Enumerate (t,varname)\n setmetatable(t,classEnumerate)\n append(t)\n appendenum(t)\n\t if varname and varname ~= \"\" then\n\t\tif t.name ~= \"\" then\n\t\t\tVariable(t.name..\" \"..varname)\n\t\telse\n\t\t\tlocal ns = getcurrnamespace()\n\t\t\twarning(\"Variable \"..ns..varname..\" of type <anonymous enum> is declared as read-only\")\n\t\t\tVariable(\"tolua_readonly int \"..varname)\n\t\tend\n\tend\n\t local parent = classContainer.curr\n\t if parent then\n\t\tt.access = parent.curr_member_access\n\t\tt.global_access = t:check_public_access()\n\t end\nreturn t\nend\n\n-- Constructor\n-- Expects a string representing the enumerate body\nfunction Enumerate (n,b,varname)\n\tb = string.gsub(b, \",[%s\\n]*}\", \"\\n}\") -- eliminate last ','\n local t = split(strsub(b,2,-2),',') -- eliminate braces\n local i = 1\n local e = {n=0}\n while t[i] do\n  local tt = split(t[i],'=')  -- discard initial value\n  e.n = e.n + 1\n  e[e.n] = tt[1]\n  i = i+1\n end\n -- set lua names\n i  = 1\n e.lnames = {}\n local ns = getcurrnamespace()\n while e[i] do\n  local t = split(e[i],'@')\n  e[i] = t[1]\n\t\tif not t[2] then\n\t\t t[2] = applyrenaming(t[1])\n\t\tend\n  e.lnames[i] = t[2] or t[1]\n  _global_enums[ ns..e[i] ] = (ns..e[i])\n  i = i+1\n end\n\te.name = n\n\tif n ~= \"\" then\n\t\tTypedef(\"int \"..n)\n\tend\n return _Enumerate(e, varname)\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/feature.lua",
    "content": "-- tolua: abstract feature class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Feature class\n-- Represents the base class of all mapped feature.\nclassFeature = {\n}\nclassFeature.__index = classFeature\n\n-- write support code\nfunction classFeature:supcode ()\nend\n\n-- output tag\nfunction classFeature:decltype ()\nend\n\n-- register feature\nfunction classFeature:register (pre)\nend\n\n-- translate verbatim\nfunction classFeature:preamble ()\nend\n\n-- check if it is a variable\nfunction classFeature:isvariable ()\n return false\nend\n\n-- check if it requires collection\nfunction classFeature:requirecollection (t)\n return false\nend\n\n-- build names\nfunction classFeature:buildnames ()\n if self.name and self.name~='' then\n  local n = split(self.name,'@')\n  self.name = n[1]\n  self.name = string.gsub(self.name, \":%d*$\", \"\")\n  if not n[2] then\n   n[2] = applyrenaming(n[1])\n  end\n  self.lname = n[2] or gsub(n[1],\"%[.-%]\",\"\")\n  self.lname = string.gsub(self.lname, \":%d*$\", \"\")\n  self.original_name = self.name\n  self.lname = clean_template(self.lname)\n end\n if not self.is_parameter then\n\t self.name = getonlynamespace() .. self.name\n end\n\n local parent = classContainer.curr\n if parent then\n \tself.access = parent.curr_member_access\n\tself.global_access = self:check_public_access()\n else\n end\nend\n\nfunction classFeature:check_public_access()\n\n\tif type(self.global_access) == \"boolean\" then\n\t\treturn self.global_access\n\tend\n\n\tif self.access and self.access ~= 0 then\n\t\treturn false\n\tend\n\n\tlocal parent = classContainer.curr\n\twhile parent do\n\t\tif parent.access and parent.access ~= 0 then\n\t\t\treturn false\n\t\tend\n\t\tparent = parent.prox\n\tend\n\treturn true\nend\n\nfunction clean_template(t)\n\n\treturn string.gsub(t, \"[<>:, %*]\", \"_\")\nend\n\n-- check if feature is inside a container definition\n-- it returns the container class name or nil.\nfunction classFeature:incontainer (which)\n if self.parent then\n  local parent = self.parent\n  while parent do\n   if parent.classtype == which then\n    return parent.name\n   end\n   parent = parent.parent\n  end\n end\n return nil\nend\n\nfunction classFeature:inclass ()\n return self:incontainer('class')\nend\n\nfunction classFeature:inmodule ()\n return self:incontainer('module')\nend\n\nfunction classFeature:innamespace ()\n return self:incontainer('namespace')\nend\n\n-- return C binding function name based on name\n-- the client specifies a prefix\nfunction classFeature:cfuncname (n)\n\n if self.parent then\n  n = self.parent:cfuncname(n)\n end\n\n local fname = self.lname\n if not fname or fname == '' then\n \tfname = self.name\n end\n  n = string.gsub(n..'_'.. (fname), \"[<>:, \\\\.%*&]\", \"_\")\n\n  return n\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/function.lua",
    "content": "-- tolua: function class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n\n-- Function class\n-- Represents a function or a class method.\n-- The following fields are stored:\n--  mod  = type modifiers\n--  type = type\n--  ptr  = \"*\" or \"&\", if representing a pointer or a reference\n--  name = name\n--  lname = lua name\n--  args  = list of argument declarations\n--  const = if it is a method receiving a const \"this\".\nclassFunction = {\n mod = '',\n type = '',\n ptr = '',\n name = '',\n args = {n=0},\n const = '',\n}\nclassFunction.__index = classFunction\nsetmetatable(classFunction,classFeature)\n\n-- declare tags\nfunction classFunction:decltype ()\n self.type = typevar(self.type)\n if strfind(self.mod,'const') then\n\t self.type = 'const '..self.type\n\t\tself.mod = gsub(self.mod,'const','')\n\tend\n local i=1\n while self.args[i] do\n  self.args[i]:decltype()\n  i = i+1\n end\nend\n\n\n-- Write binding function\n-- Outputs C/C++ binding function.\nfunction classFunction:supcode (local_constructor)\n\n local overload = strsub(self.cname,-2,-1) - 1  -- indicate overloaded func\n local nret = 0      -- number of returned values\n local class = self:inclass()\n local _,_,static = strfind(self.mod,'^%s*(static)')\n if class then\n\n \tif self.name == 'new' and self.parent.flags.pure_virtual then\n \t\t-- no constructor for classes with pure virtual methods\n \t\treturn\n \tend\n\n \tif local_constructor then\n\t\toutput(\"/* method: new_local of class \",class,\" */\")\n\telse\n\t\toutput(\"/* method:\",self.name,\" of class \",class,\" */\")\n\tend\n else\n  output(\"/* function:\",self.name,\" */\")\n end\n\n if local_constructor then\n  output(\"#ifndef TOLUA_DISABLE_\"..self.cname..\"_local\")\n  output(\"\\nstatic int\",self.cname..\"_local\",\"(lua_State* tolua_S)\")\n else\n  output(\"#ifndef TOLUA_DISABLE_\"..self.cname)\n  output(\"\\nstatic int\",self.cname,\"(lua_State* tolua_S)\")\n end\n output(\"{\")\n\n -- check types\n\tif overload < 0 then\n\t output('#ifndef TOLUA_RELEASE\\n')\n\tend\n\toutput(' tolua_Error tolua_err;')\n output(' if (\\n')\n -- check self\n local narg\n if class then narg=2 else narg=1 end\n if class then\n\t\tlocal func = get_is_function(self.parent.type)\n\t\tlocal type = self.parent.type\n\t\tif self.name=='new' or static~=nil then\n\t\t\tfunc = 'tolua_isusertable'\n\t\t\ttype = self.parent.type\n\t\tend\n\t\tif self.const ~= '' then\n\t\t\ttype = \"const \"..type\n\t\tend\n\t\toutput('     !'..func..'(tolua_S,1,\"'..type..'\",0,&tolua_err) ||\\n')\n end\n -- check args\n if self.args[1].type ~= 'void' then\n  local i=1\n  while self.args[i] do\n   local btype = isbasic(self.args[i].type)\n   if btype ~= 'value' and btype ~= 'state' then\n    output('     '..self.args[i]:outchecktype(narg)..' ||\\n')\n   end\n   if btype ~= 'state' then\n\t   narg = narg+1\n   end\n   i = i+1\n  end\n end\n -- check end of list\n output('     !tolua_isnoobj(tolua_S,'..narg..',&tolua_err)\\n )')\n\toutput('  goto tolua_lerror;')\n\n output(' else\\n')\n\tif overload < 0 then\n\t output('#endif\\n')\n\tend\n\toutput(' {')\n\n -- declare self, if the case\n local narg\n if class then narg=2 else narg=1 end\n if class and self.name~='new' and static==nil then\n  output(' ',self.const,self.parent.type,'*','self = ')\n  output('(',self.const,self.parent.type,'*) ')\n  local to_func = get_to_function(self.parent.type)\n  output(to_func,'(tolua_S,1,0);')\n elseif static then\n  _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')\n end\n -- declare parameters\n if self.args[1].type ~= 'void' then\n  local i=1\n  while self.args[i] do\n   self.args[i]:declare(narg)\n   if isbasic(self.args[i].type) ~= \"state\" then\n\t   narg = narg+1\n   end\n   i = i+1\n  end\n end\n\n -- check self\n if class and self.name~='new' and static==nil then\n\t output('#ifndef TOLUA_RELEASE\\n')\n\t output('  if (!self) tolua_error(tolua_S,\"'..output_error_hook(\"invalid \\'self\\' in function \\'%s\\'\", self.name)..'\", NULL);');\n\t output('#endif\\n')\n end\n\n -- get array element values\n if class then narg=2 else narg=1 end\n if self.args[1].type ~= 'void' then\n  local i=1\n  while self.args[i] do\n   self.args[i]:getarray(narg)\n   narg = narg+1\n   i = i+1\n  end\n end\n\n pre_call_hook(self)\n\n local out = string.find(self.mod, \"tolua_outside\")\n -- call function\n if class and self.name=='delete' then\n  output('  Mtolua_delete(self);')\n elseif class and self.name == 'operator&[]' then\n  if flags['1'] then -- for compatibility with tolua5 ?\n\toutput('  self->operator[](',self.args[1].name,'-1) = ',self.args[2].name,';')\n  else\n    output('  self->operator[](',self.args[1].name,') = ',self.args[2].name,';')\n  end\n else\n  output('  {')\n  if self.type ~= '' and self.type ~= 'void' then\n   output('  ',self.mod,self.type,self.ptr,'tolua_ret = ')\n   output('(',self.mod,self.type,self.ptr,') ')\n  else\n   output('  ')\n  end\n  if class and self.name=='new' then\n   output('Mtolua_new((',self.type,')(')\n  elseif class and static then\n\tif out then\n\t\toutput(self.name,'(')\n\telse\n\t\toutput(class..'::'..self.name,'(')\n\tend\n  elseif class then\n\tif out then\n\t\toutput(self.name,'(')\n\telse\n\t  if self.cast_operator then\n\t  \t--output('static_cast<',self.mod,self.type,self.ptr,' >(*self')\n\t\toutput('self->operator ',self.mod,self.type,'(')\n\t  else\n\t\toutput('self->'..self.name,'(')\n\t  end\n\tend\n  else\n   output(self.name,'(')\n  end\n\n  if out and not static then\n  \toutput('self')\n\tif self.args[1] and self.args[1].name ~= '' then\n\t\toutput(',')\n\tend\n  end\n  -- write parameters\n  local i=1\n  while self.args[i] do\n   self.args[i]:passpar()\n   i = i+1\n   if self.args[i] then\n    output(',')\n   end\n  end\n\n  if class and self.name == 'operator[]' and flags['1'] then\n\toutput('-1);')\n  else\n\tif class and self.name=='new' then\n\t\toutput('));') -- close Mtolua_new(\n\telse\n\t\toutput(');')\n\tend\n  end\n\n  -- return values\n  if self.type ~= '' and self.type ~= 'void' then\n   nret = nret + 1\n   local t,ct = isbasic(self.type)\n   if t and self.name ~= \"new\" then\n   \tif self.cast_operator and _basic_raw_push[t] then\n\t\toutput('   ',_basic_raw_push[t],'(tolua_S,(',ct,')tolua_ret);')\n   \telse\n\t    output('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')\n\tend\n   else\n\tt = self.type\n\tnew_t = string.gsub(t, \"const%s+\", \"\")\n\tlocal owned = false\n\tif string.find(self.mod, \"tolua_owned\") then\n\t\towned = true\n\tend\n    local push_func = get_push_function(t)\n    if self.ptr == '' then\n     output('   {')\n     output('#ifdef __cplusplus\\n')\n     output('    void* tolua_obj = Mtolua_new((',new_t,')(tolua_ret));')\n     output('    ',push_func,'(tolua_S,tolua_obj,\"',t,'\");')\n     output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')\n     output('#else\\n')\n     output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')\n     output('    ',push_func,'(tolua_S,tolua_obj,\"',t,'\");')\n     output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')\n     output('#endif\\n')\n     output('   }')\n    elseif self.ptr == '&' then\n     output('   ',push_func,'(tolua_S,(void*)&tolua_ret,\"',t,'\");')\n    else\n\t output('   ',push_func,'(tolua_S,(void*)tolua_ret,\"',t,'\");')\n\t if owned or local_constructor then\n      output('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')\n\t end\n    end\n   end\n  end\n  local i=1\n  while self.args[i] do\n   nret = nret + self.args[i]:retvalue()\n   i = i+1\n  end\n  output('  }')\n\n  -- set array element values\n  if class then narg=2 else narg=1 end\n  if self.args[1].type ~= 'void' then\n   local i=1\n   while self.args[i] do\n    self.args[i]:setarray(narg)\n    narg = narg+1\n    i = i+1\n   end\n  end\n\n  -- free dynamically allocated array\n  if self.args[1].type ~= 'void' then\n   local i=1\n   while self.args[i] do\n    self.args[i]:freearray()\n    i = i+1\n   end\n  end\n end\n\n post_call_hook(self)\n\n output(' }')\n output(' return '..nret..';')\n\n -- call overloaded function or generate error\n\tif overload < 0 then\n\n\t\toutput('#ifndef TOLUA_RELEASE\\n')\n\t\toutput('tolua_lerror:\\n')\n\t\toutput(' tolua_error(tolua_S,\"'..output_error_hook(\"#ferror in function \\'%s\\'.\", self.lname)..'\",&tolua_err);')\n\t\toutput(' return 0;')\n\t\toutput('#endif\\n')\n\telse\n\t\tlocal _local = \"\"\n\t\tif local_constructor then\n\t\t\t_local = \"_local\"\n\t\tend\n\t\toutput('tolua_lerror:\\n')\n\t\toutput(' return '..strsub(self.cname,1,-3)..format(\"%02d\",overload).._local..'(tolua_S);')\n\tend\n output('}')\n output('#endif //#ifndef TOLUA_DISABLE\\n')\n output('\\n')\n\n\t-- recursive call to write local constructor\n\tif class and self.name=='new' and not local_constructor then\n\n\t\tself:supcode(1)\n\tend\n\nend\n\n\n-- register function\nfunction classFunction:register (pre)\n\n\tif not self:check_public_access() then\n\t\treturn\n\tend\n\n \tif self.name == 'new' and self.parent.flags.pure_virtual then\n \t\t-- no constructor for classes with pure virtual methods\n \t\treturn\n \tend\n\n output(pre..'tolua_function(tolua_S,\"'..self.lname..'\",'..self.cname..');')\n  if self.name == 'new' then\n\t  output(pre..'tolua_function(tolua_S,\"new_local\",'..self.cname..'_local);')\n\t  output(pre..'tolua_function(tolua_S,\".call\",'..self.cname..'_local);')\n\t  --output(' tolua_set_call_event(tolua_S,'..self.cname..'_local, \"'..self.parent.type..'\");')\n  end\nend\n\n-- Print method\nfunction classFunction:print (ident,close)\n print(ident..\"Function{\")\n print(ident..\" mod  = '\"..self.mod..\"',\")\n print(ident..\" type = '\"..self.type..\"',\")\n print(ident..\" ptr  = '\"..self.ptr..\"',\")\n print(ident..\" name = '\"..self.name..\"',\")\n print(ident..\" lname = '\"..self.lname..\"',\")\n print(ident..\" const = '\"..self.const..\"',\")\n print(ident..\" cname = '\"..self.cname..\"',\")\n print(ident..\" lname = '\"..self.lname..\"',\")\n print(ident..\" args = {\")\n local i=1\n while self.args[i] do\n  self.args[i]:print(ident..\"  \",\",\")\n  i = i+1\n end\n print(ident..\" }\")\n print(ident..\"}\"..close)\nend\n\n-- check if it returns an object by value\nfunction classFunction:requirecollection (t)\n\tlocal r = false\n\tif self.type ~= '' and not isbasic(self.type) and self.ptr=='' then\n\t\tlocal type = gsub(self.type,\"%s*const%s+\",\"\")\n\t t[type] = \"tolua_collect_\" .. clean_template(type)\n\t r = true\n\tend\n\tlocal i=1\n\twhile self.args[i] do\n\t\tr = self.args[i]:requirecollection(t) or r\n\t\ti = i+1\n\tend\n\treturn r\nend\n\n-- determine lua function name overload\nfunction classFunction:overload ()\n return self.parent:overload(self.lname)\nend\n\n\nfunction param_object(par) -- returns true if the parameter has an object as its default value\n\n\tif not string.find(par, '=') then return false end -- it has no default value\n\n\tlocal _,_,def = string.find(par, \"=(.*)$\")\n\n\tif string.find(par, \"|\") then -- a list of flags\n\n\t\treturn true\n\tend\n\n\tif string.find(par, \"%*\") then -- it's a pointer with a default value\n\n\t\tif string.find(par, '=%s*new') or string.find(par, \"%(\") then -- it's a pointer with an instance as default parameter.. is that valid?\n\t\t\treturn true\n\t\tend\n\t\treturn false -- default value is 'NULL' or something\n\tend\n\n\n\tif string.find(par, \"[%(&]\") then\n\t\treturn true\n\tend -- default value is a constructor call (most likely for a const reference)\n\n\t--if string.find(par, \"&\") then\n\n\t--\tif string.find(def, \":\") or string.find(def, \"^%s*new%s+\") then\n\n\t--\t\t-- it's a reference with default to something like Class::member, or 'new Class'\n\t--\t\treturn true\n\t--\tend\n\t--end\n\n\treturn false -- ?\nend\n\nfunction strip_last_arg(all_args, last_arg) -- strips the default value from the last argument\n\n\tlocal _,_,s_arg = string.find(last_arg, \"^([^=]+)\")\n\tlast_arg = string.gsub(last_arg, \"([%%%(%)])\", \"%%%1\");\n\tall_args = string.gsub(all_args, \"%s*,%s*\"..last_arg..\"%s*%)%s*$\", \")\")\n\treturn all_args, s_arg\nend\n\n\n\n-- Internal constructor\nfunction _Function (t)\n setmetatable(t,classFunction)\n\n if t.const ~= 'const' and t.const ~= '' then\n  error(\"#invalid 'const' specification\")\n end\n\n append(t)\n if t:inclass() then\n --print ('t.name is '..t.name..', parent.name is '..t.parent.name)\n  if string.gsub(t.name, \"%b<>\", \"\") == string.gsub(t.parent.original_name or t.parent.name, \"%b<>\", \"\") then\n   t.name = 'new'\n   t.lname = 'new'\n   t.parent._new = true\n   t.type = t.parent.name\n   t.ptr = '*'\n  elseif string.gsub(t.name, \"%b<>\", \"\") == '~'..string.gsub(t.parent.original_name or t.parent.name, \"%b<>\", \"\") then\n   t.name = 'delete'\n   t.lname = 'delete'\n   t.parent._delete = true\n  end\n end\n t.cname = t:cfuncname(\"tolua\")..t:overload(t)\n return t\nend\n\n-- Constructor\n-- Expects three strings: one representing the function declaration,\n-- another representing the argument list, and the third representing\n-- the \"const\" or empty string.\nfunction Function (d,a,c)\n --local t = split(strsub(a,2,-2),',') -- eliminate braces\n --local t = split_params(strsub(a,2,-2))\n\n\tif not flags['W'] and string.find(a, \"%.%.%.%s*%)\") then\n\n\t\twarning(\"Functions with variable arguments (`...') are not supported. Ignoring \"..d..a..c)\n\t\treturn nil\n\tend\n\n\n local i=1\n local l = {n=0}\n\n \ta = string.gsub(a, \"%s*([%(%)])%s*\", \"%1\")\n\tlocal t,strip,last = strip_pars(strsub(a,2,-2));\n\tif strip then\n\t\t--local ns = string.sub(strsub(a,1,-2), 1, -(string.len(last)+1))\n\t\tlocal ns = join(t, \",\", 1, last-1)\n\n\t\tns = \"(\"..string.gsub(ns, \"%s*,%s*$\", \"\")..')'\n\t\t--ns = strip_defaults(ns)\n\n\t\tlocal f = Function(d, ns, c)\n\t\tfor i=1,last do\n\t\t\tt[i] = string.gsub(t[i], \"=.*$\", \"\")\n\t\tend\n\tend\n\n while t[i] do\n  l.n = l.n+1\n  l[l.n] = Declaration(t[i],'var',true)\n  i = i+1\n end\n local f = Declaration(d,'func')\n f.args = l\n f.const = c\n return _Function(f)\nend\n\nfunction join(t, sep, first, last)\n\n\tfirst = first or 1\n\tlast = last or #t\n\tlocal lsep = \"\"\n\tlocal ret = \"\"\n\tlocal loop = false\n\tfor i = first,last do\n\n\t\tret = ret..lsep..t[i]\n\t\tlsep = sep\n\t\tloop = true\n\tend\n\tif not loop then\n\t\treturn \"\"\n\tend\n\n\treturn ret\nend\n\nfunction strip_pars(s)\n\n\tlocal t = split_c_tokens(s, ',')\n\tlocal strip = false\n\tlocal last\n\n\tfor i=t.n,1,-1 do\n\n\t\tif not strip and param_object(t[i]) then\n\t\t\tlast = i\n\t\t\tstrip = true\n\t\tend\n\t\t--if strip then\n\t\t--\tt[i] = string.gsub(t[i], \"=.*$\", \"\")\n\t\t--end\n\tend\n\n\treturn t,strip,last\n\nend\n\nfunction strip_defaults(s)\n\n\ts = string.gsub(s, \"^%(\", \"\")\n\ts = string.gsub(s, \"%)$\", \"\")\n\n\tlocal t = split_c_tokens(s, \",\")\n\tlocal sep, ret = \"\",\"\"\n\tfor i=1,t.n do\n\t\tt[i] = string.gsub(t[i], \"=.*$\", \"\")\n\t\tret = ret..sep..t[i]\n\t\tsep = \",\"\n\tend\n\n\treturn \"(\"..ret..\")\"\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/module.lua",
    "content": "-- tolua: module class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n\n-- Module class\n-- Represents module.\n-- The following fields are stored:\n--    {i} = list of objects in the module.\nclassModule = {\n classtype = 'module'\n}\nclassModule.__index = classModule\nsetmetatable(classModule,classContainer)\n\n-- register module\nfunction classModule:register (pre)\n pre = pre or ''\n push(self)\n output(pre..'tolua_module(tolua_S,\"'..self.name..'\",',self:hasvar(),');')\n output(pre..'tolua_beginmodule(tolua_S,\"'..self.name..'\");')\n local i=1\n while self[i] do\n  self[i]:register(pre..' ')\n  i = i+1\n end\n output(pre..'tolua_endmodule(tolua_S);')\n\tpop()\nend\n\n-- Print method\nfunction classModule:print (ident,close)\n print(ident..\"Module{\")\n print(ident..\" name = '\"..self.name..\"';\")\n local i=1\n while self[i] do\n  self[i]:print(ident..\" \",\",\")\n  i = i+1\n end\n print(ident..\"}\"..close)\nend\n\n-- Internal constructor\nfunction _Module (t)\n setmetatable(t,classModule)\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects two string representing the module name and body.\nfunction Module (n,b)\n local t = _Module(_Container{name=n})\n push(t)\n t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces\n pop()\n return t\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/namespace.lua",
    "content": "-- tolua: namespace class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 2003\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Namespace class\n-- Represents a namesapce definition.\n-- Stores the following fields:\n--    name = class name\n--    {i}  = list of members\nclassNamespace = {\n classtype = 'namespace',\n name = '',\n}\nclassNamespace.__index = classNamespace\nsetmetatable(classNamespace,classModule)\n\n-- Print method\nfunction classNamespace:print (ident,close)\n print(ident..\"Namespace{\")\n print(ident..\" name = '\"..self.name..\"',\")\n local i=1\n while self[i] do\n  self[i]:print(ident..\" \",\",\")\n  i = i+1\n end\n print(ident..\"}\"..close)\nend\n\n-- Internal constructor\nfunction _Namespace (t)\n setmetatable(t,classNamespace)\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects the name and the body of the namespace.\nfunction Namespace (n,b)\n local c = _Namespace(_Container{name=n})\n push(c)\n c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces\n pop()\nend\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/operator.lua",
    "content": "-- tolua: operator class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Operator class\n-- Represents an operator function or a class operator method.\n-- It stores the same fields as functions do plus:\n--  kind = set of character representing the operator (as it appers in C++ code)\nclassOperator = {\n kind = '',\n}\nclassOperator.__index = classOperator\nsetmetatable(classOperator,classFunction)\n\n-- table to transform operator kind into the appropriate tag method name\n_TM = {['+'] = 'add',\n       ['-'] = 'sub',\n       ['*'] = 'mul',\n       ['/'] = 'div',\n       ['<'] = 'lt',\n       ['<='] = 'le',\n       ['=='] = 'eq',\n       ['[]'] = 'geti',\n       ['&[]'] = 'seti',\n       --['->'] = 'flechita',\n      }\n\n\n-- Print method\nfunction classOperator:print (ident,close)\n print(ident..\"Operator{\")\n print(ident..\" kind  = '\"..self.kind..\"',\")\n print(ident..\" mod  = '\"..self.mod..\"',\")\n print(ident..\" type = '\"..self.type..\"',\")\n print(ident..\" ptr  = '\"..self.ptr..\"',\")\n print(ident..\" name = '\"..self.name..\"',\")\n print(ident..\" const = '\"..self.const..\"',\")\n print(ident..\" cname = '\"..self.cname..\"',\")\n print(ident..\" lname = '\"..self.lname..\"',\")\n print(ident..\" args = {\")\n local i=1\n while self.args[i] do\n  self.args[i]:print(ident..\"  \",\",\")\n  i = i+1\n end\n print(ident..\" }\")\n print(ident..\"}\"..close)\nend\n\nfunction classOperator:supcode_tmp()\n\n\tif not _TM[self.kind] then\n\t\treturn classFunction.supcode(self)\n\tend\n\n\t-- no overload, no parameters, always inclass\n\toutput(\"/* method:\",self.name,\" of class \",self:inclass(),\" */\")\n\n\toutput(\"#ifndef TOLUA_DISABLE_\"..self.cname)\n\toutput(\"\\nstatic int\",self.cname,\"(lua_State* tolua_S)\")\n\n\tif overload < 0 then\n\t output('#ifndef TOLUA_RELEASE\\n')\n\tend\n\toutput(' tolua_Error tolua_err;')\n\toutput(' if (\\n')\n\t-- check self\n\tlocal is_func = get_is_function(self.parent.type)\n\toutput('     !'..is_func..'(tolua_S,1,\"'..self.parent.type..'\",0,&tolua_err) ||\\n')\n\toutput('     !tolua_isnoobj(tolua_S,2,&tolua_err)\\n )')\n\toutput('  goto tolua_lerror;')\n\n\toutput(' else\\n')\n\toutput('#endif\\n') -- tolua_release\n\toutput(' {')\n\n\t-- declare self\n\toutput(' ',self.const,self.parent.type,'*','self = ')\n\toutput('(',self.const,self.parent.type,'*) ')\n\tlocal to_func = get_to_func(self.parent.type)\n\toutput(to_func,'(tolua_S,1,0);')\n\n\t-- check self\n\toutput('#ifndef TOLUA_RELEASE\\n')\n\toutput('  if (!self) tolua_error(tolua_S,\"'..output_error_hook(\"invalid \\'self\\' in function \\'%s\\'\", self.name)..'\",NULL);');\n\toutput('#endif\\n')\n\n\t-- cast self\n\toutput('  ',self.mod,self.type,self.ptr,'tolua_ret = ')\n\toutput('(',self.mod,self.type,self.ptr,')(*self);')\n\n\t-- return value\n\tlocal t,ct = isbasic(self.type)\n\tif t then\n\t\toutput('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')\n\telse\n\t\tt = self.type\n\t\tlocal push_func = get_push_function(t)\n\t\tnew_t = string.gsub(t, \"const%s+\", \"\")\n\t\tif self.ptr == '' then\n\t\t\toutput('   {')\n\t\t\toutput('#ifdef __cplusplus\\n')\n\t\t\toutput('    void* tolua_obj = Mtolua_new((',new_t,')(tolua_ret));')\n\t\t\toutput('    ',push_func,'(tolua_S,tolua_obj,\"',t,'\");')\n\t\t\toutput('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')\n\t\t\toutput('#else\\n')\n\t\t\toutput('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')\n\t\t\toutput('    ',push_func,'(tolua_S,tolua_obj,\"',t,'\");')\n\t\t\toutput('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')\n\t\t\toutput('#endif\\n')\n\t\t\toutput('   }')\n\t\telseif self.ptr == '&' then\n\t\t\toutput('   ',push_func,'(tolua_S,(void*)&tolua_ret,\"',t,'\");')\n\t\telse\n\t\t\tif local_constructor then\n\t\t\t\toutput('   ',push_func,'(tolua_S,(void *)tolua_ret,\"',t,'\");')\n\t\t\t\toutput('    tolua_register_gc(tolua_S,lua_gettop(tolua_S));')\n\t\t\telse\n\t\t\t\toutput('   ',push_func,'(tolua_S,(void*)tolua_ret,\"',t,'\");')\n\t\t\tend\n\t\tend\n\tend\n\n\toutput('  }')\n\toutput(' return 1;')\n\n\toutput('#ifndef TOLUA_RELEASE\\n')\n\toutput('tolua_lerror:\\n')\n\toutput(' tolua_error(tolua_S,\"'..output_error_hook(\"#ferror in function \\'%s\\'.\", self.lname)..'\",&tolua_err);')\n\toutput(' return 0;')\n\toutput('#endif\\n')\n\n\n\toutput('}')\n\toutput('#endif //#ifndef TOLUA_DISABLE\\n')\n\toutput('\\n')\nend\n\n-- Internal constructor\nfunction _Operator (t)\n setmetatable(t,classOperator)\n\n if t.const ~= 'const' and t.const ~= '' then\n  error(\"#invalid 'const' specification\")\n end\n\n append(t)\n if not t:inclass() then\n  error(\"#operator can only be defined as class member\")\n end\n\n --t.name = t.name .. \"_\" .. (_TM[t.kind] or t.kind)\n t.cname = t:cfuncname(\"tolua\")..t:overload(t)\n t.name = \"operator\" .. t.kind  -- set appropriate calling name\n return t\nend\n\n-- Constructor\nfunction Operator (d,k,a,c)\n\n\tlocal op_k = string.gsub(k, \"^%s*\", \"\")\n\top_k = string.gsub(k, \"%s*$\", \"\")\n\t--if string.find(k, \"^[%w_:%d<>%*%&]+$\") then\n\tif d == \"operator\" and k ~= '' then\n\n\t\td = k..\" operator\"\n\telseif not _TM[op_k] then\n\n\t\tif flags['W'] then\n\t\t\terror(\"tolua: no support for operator\" .. f.kind)\n\t\telse\n\t\t\twarning(\"No support for operator \"..op_k..\", ignoring\")\n\t\t\treturn nil\n\t\tend\n\tend\n\n\tlocal ref = ''\n local t = split_c_tokens(strsub(a,2,strlen(a)-1),',') -- eliminate braces\n local i=1\n local l = {n=0}\n while t[i] do\n  l.n = l.n+1\n  l[l.n] = Declaration(t[i],'var')\n  i = i+1\n end\n if k == '[]' then\n\t local _\n\t _, _, ref = strfind(d,'(&)')\n  d = gsub(d,'&','')\n elseif k=='&[]' then\n  l.n = l.n+1\n  l[l.n] = Declaration(d,'var')\n  l[l.n].name = 'tolua_value'\n end\n local f = Declaration(d,'func')\n if k == '[]' and (l[1]==nil or isbasic(l[1].type)~='number') then\n  error('operator[] can only be defined for numeric index.')\n end\n f.args = l\n f.const = c\n f.kind = op_k\n f.lname = \".\"..(_TM[f.kind] or f.kind)\n if not _TM[f.kind] then\n \tf.cast_operator = true\n end\n if f.kind == '[]' and ref=='&' and f.const~='const' then\n  Operator(d,'&'..k,a,c) \t-- create correspoding set operator\n end\n return _Operator(f)\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/ordered_pairs.lua",
    "content": "local P = {}\nop = P\n\nfunction P:ordered_pairs(t)\n  local i = {}\n  for k in next, t do\n    table.insert(i, k)\n  end\n  table.sort(i)\n  return function()\n    local k = table.remove(i)\n    if k ~= nil then\n      return k, t[k]\n    end\n  end\nend\n\nreturn op\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/package.lua",
    "content": "-- tolua: package class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n\n-- Package class\n-- Represents the whole package being bound.\n-- The following fields are stored:\n--    {i} = list of objects in the package.\nclassPackage = {\n\tclasstype = 'package'\n}\nclassPackage.__index = classPackage\nsetmetatable(classPackage, classContainer)\n\n-- Print method\nfunction classPackage:print()\n\tprint(\"Package: \" .. self.name)\n\tlocal i = 1\n\twhile self[i] do\n\t\tself[i]:print(\"\", \"\")\n\t\ti = i + 1\n\tend\nend\n\nfunction classPackage:preprocess()\n\t-- avoid preprocessing embedded Lua code\n\tlocal L = {}\n\tself.code = gsub(self.code, \"\\n%s*%$%[\", \"\\1\") -- deal with embedded lua code\n\tself.code = gsub(self.code, \"\\n%s*%$%]\", \"\\2\")\n\tself.code = gsub(self.code, \"(%b\\1\\2)\", function(c)\n\t\ttinsert(L, c)\n\t\treturn \"\\n#[\" .. #L .. \"]#\"\n\tend)\n\t-- avoid preprocessing embedded C code\n\tlocal C = {}\n\tself.code = gsub(self.code, \"\\n%s*%$%<\", \"\\3\") -- deal with embedded C code\n\tself.code = gsub(self.code, \"\\n%s*%$%>\", \"\\4\")\n\tself.code = gsub(self.code, \"(%b\\3\\4)\", function(c)\n\t\ttinsert(C, c)\n\t\treturn \"\\n#<\" .. #C .. \">#\"\n\tend)\n\t-- avoid preprocessing embedded C code\n\tself.code = gsub(self.code, \"\\n%s*%$%{\", \"\\5\") -- deal with embedded C code\n\tself.code = gsub(self.code, \"\\n%s*%$%}\", \"\\6\")\n\tself.code = gsub(self.code, \"(%b\\5\\6)\", function(c)\n\t\ttinsert(C, c)\n\t\treturn \"\\n#<\" .. #C .. \">#\"\n\tend)\n\n\t--self.code = gsub(self.code,\"\\n%s*#[^d][^\\n]*\\n\", \"\\n\\n\") -- eliminate preprocessor directives that don't start with 'd'\n\tself.code = gsub(self.code, \"\\n[ \\t]*#[ \\t]*[^d%<%[]\", \"\\n//\") -- eliminate preprocessor directives that don't start with 'd'\n\n\t-- avoid preprocessing verbatim lines\n\tlocal V = {}\n\tself.code = gsub(self.code, \"\\n(%s*%$[^%[%]][^\\n]*)\", function(v)\n\t\ttinsert(V, v)\n\t\treturn \"\\n#\" .. #V .. \"#\"\n\tend)\n\n\t-- perform global substitution\n\n\tself.code = gsub(self.code, \"(//[^\\n]*)\", \"\") -- eliminate C++ comments\n\tself.code = gsub(self.code, \"/%*\", \"\\1\")\n\tself.code = gsub(self.code, \"%*/\", \"\\2\")\n\tself.code = gsub(self.code, \"%b\\1\\2\", \"\")\n\tself.code = gsub(self.code, \"\\1\", \"/%*\")\n\tself.code = gsub(self.code, \"\\2\", \"%*/\")\n\tself.code = gsub(self.code, \"%s*@%s*\", \"@\")   -- eliminate spaces beside @\n\tself.code = gsub(self.code, \"%s?inline(%s)\", \"%1\") -- eliminate 'inline' keyword\n\t--self.code = gsub(self.code,\"%s?extern(%s)\",\"%1\") -- eliminate 'extern' keyword\n\t--self.code = gsub(self.code,\"%s?virtual(%s)\",\"%1\") -- eliminate 'virtual' keyword\n\t--self.code = gsub(self.code,\"public:\",\"\") -- eliminate 'public:' keyword\n\tself.code = gsub(self.code, \"([^%w_])void%s*%*\", \"%1_userdata \") -- substitute 'void*'\n\tself.code = gsub(self.code, \"([^%w_])void%s*%*\", \"%1_userdata \") -- substitute 'void*'\n\tself.code = gsub(self.code, \"([^%w_])char%s*%*\", \"%1_cstring \") -- substitute 'char*'\n\tself.code = gsub(self.code, \"([^%w_])lua_State%s*%*\", \"%1_lstate \") -- substitute 'lua_State*'\n\n\t-- restore embedded Lua code\n\tself.code = gsub(self.code, \"%#%[(%d+)%]%#\", function(n)\n\t\treturn L[tonumber(n)]\n\tend)\n\t-- restore embedded C code\n\tself.code = gsub(self.code, \"%#%<(%d+)%>%#\", function(n)\n\t\treturn C[tonumber(n)]\n\tend)\n\t-- restore verbatim lines\n\tself.code = gsub(self.code, \"%#(%d+)%#\", function(n)\n\t\treturn V[tonumber(n)]\n\tend)\n\n\tself.code = string.gsub(self.code, \"\\n%s*%$([^\\n]+)\", function(l)\n\t\tVerbatim(l .. \"\\n\")\n\t\treturn \"\\n\"\n\tend)\nend\n\n-- translate verbatim\nfunction classPackage:preamble()\n\toutput('/*\\n')\n\toutput('** Lua binding: ' .. self.name .. '\\n')\n\toutput('** Generated automatically by ' .. TOLUA_VERSION .. '.\\n')\n\toutput('*/\\n\\n')\n\n\toutput('#ifndef __cplusplus\\n')\n\toutput('#include \"stdlib.h\"\\n')\n\toutput('#endif\\n')\n\toutput('#include \"string.h\"\\n\\n')\n\toutput('#include \"tolua++.h\"\\n\\n')\n\n\tif not flags.h then\n\t\toutput('/* Exported function */')\n\t\toutput('TOLUA_API int  tolua_' .. self.name .. '_open (lua_State* tolua_S);')\n\t\toutput('\\n')\n\tend\n\n\tlocal i = 1\n\twhile self[i] do\n\t\tself[i]:preamble()\n\t\ti = i + 1\n\tend\n\n\tif self:requirecollection(_collect) then\n\t\toutput('\\n')\n\t\toutput('/* function to release collected object via destructor */')\n\t\toutput('#ifdef __cplusplus\\n')\n\t\tfor i, v in op:ordered_pairs(_collect) do\n\t\t\toutput('\\nstatic int ' .. v .. ' (lua_State* tolua_S)')\n\t\t\toutput('{')\n\t\t\toutput(' ' .. i .. '* self = (' .. i .. '*) tolua_tousertype(tolua_S,1,0);')\n\t\t\toutput('\tMtolua_delete(self);')\n\t\t\toutput('\treturn 0;')\n\t\t\toutput('}')\n\t\tend\n\t\toutput('#endif\\n\\n')\n\tend\n\n\toutput('\\n')\n\toutput('/* function to register type */')\n\toutput('static void tolua_reg_types (lua_State* tolua_S)')\n\toutput('{')\n\n\tif flags.t then\n\t\toutput(\"#ifndef Mtolua_typeid\\n#define Mtolua_typeid(L,TI,T)\\n#endif\\n\")\n\tend\n\tfor n, v in op:ordered_pairs(_usertype) do\n\t\tif (not _global_classes[v]) or _global_classes[v]:check_public_access() then\n\t\t\toutput(' tolua_usertype(tolua_S,\"', v, '\");')\n\t\t\tif flags.t then\n\t\t\t\toutput(' Mtolua_typeid(tolua_S,typeid(', v, '), \"', v, '\");')\n\t\t\tend\n\t\tend\n\tend\n\toutput('}')\n\toutput('\\n')\nend\n\n-- register package\n-- write package open function\nfunction classPackage:register(pre)\n\tpre = pre or ''\n\tpush(self)\n\toutput(pre .. \"/* Open function */\")\n\toutput(pre .. \"TOLUA_API int tolua_\" .. self.name .. \"_open (lua_State* tolua_S)\")\n\toutput(pre .. \"{\")\n\toutput(pre .. \" tolua_open(tolua_S);\")\n\toutput(pre .. \" tolua_reg_types(tolua_S);\")\n\toutput(pre .. \" tolua_module(tolua_S,NULL,\", self:hasvar(), \");\")\n\toutput(pre .. \" tolua_beginmodule(tolua_S,NULL);\")\n\tlocal i = 1\n\twhile self[i] do\n\t\tself[i]:register(pre .. \"  \")\n\t\ti = i + 1\n\tend\n\toutput(pre .. \" tolua_endmodule(tolua_S);\")\n\toutput(pre .. \" return 1;\")\n\toutput(pre .. \"}\")\n\n\toutput(\"\\n\\n\")\n\toutput(\"#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501\\n\");\n\toutput(pre .. \"TOLUA_API int luaopen_\" .. self.name .. \" (lua_State* tolua_S) {\")\n\toutput(pre .. \" return tolua_\" .. self.name .. \"_open(tolua_S);\")\n\toutput(pre .. \"}\")\n\toutput(\"#endif\\n\\n\")\n\n\tpop()\nend\n\n-- write header file\nfunction classPackage:header()\n\toutput('/*\\n')\n\toutput('** Lua binding: ' .. self.name .. '\\n')\n\toutput('** Generated automatically by ' .. TOLUA_VERSION .. ' on ' .. date() .. '.\\n')\n\toutput('*/\\n\\n')\n\n\tif not flags.h then\n\t\toutput('/* Exported function */')\n\t\toutput('TOLUA_API int  tolua_' .. self.name .. '_open (lua_State* tolua_S);')\n\t\toutput('\\n')\n\tend\nend\n\n-- Internal constructor\nfunction _Package(self)\n\tsetmetatable(self, classPackage)\n\treturn self\nend\n\n-- Parse C header file with tolua directives\n-- *** Thanks to Ariel Manzur for fixing bugs in nested directives ***\nfunction extract_code(fn, s)\n\tlocal code = '\\n$#include \"' .. fn .. '\"\\n'\n\ts = \"\\n\" .. s .. \"\\n\" -- add blank lines as sentinels\n\tlocal _, e, c, t = strfind(s, \"\\n([^\\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\\n]*\\n\")\n\twhile e do\n\t\tt = strlower(t)\n\t\tif t == \"begin\" then\n\t\t\t_, e, c = strfind(s, \"(.-)\\n[^\\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\\n]*\\n\", e)\n\t\t\tif not e then\n\t\t\t\ttolua_error(\"Unbalanced 'tolua_begin' directive in header file\")\n\t\t\tend\n\t\tend\n\t\tcode = code .. c .. \"\\n\"\n\t\t_, e, c, t = strfind(s, \"\\n([^\\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\\n]*\\n\", e)\n\tend\n\treturn code\nend\n\n-- Constructor\n-- Expects the package name, the file extension, and the file text.\nfunction Package(name, fn)\n\tlocal ext = \"pkg\"\n\n\t-- open input file, if any\n\tlocal st, msg\n\tif fn then\n\t\tst, msg = readfrom(flags.f)\n\t\tif not st then\n\t\t\terror('#' .. msg)\n\t\tend\n\t\tlocal _; _, _, ext = strfind(fn, \".*%.(.*)$\")\n\tend\n\tlocal code\n\tif ext == 'pkg' then\n\t\tcode = prep(st)\n\telse\n\t\tcode = \"\\n\" .. read('*a')\n\t\tif ext == 'h' or ext == 'hpp' then\n\t\t\tcode = extract_code(fn, code)\n\t\tend\n\tend\n\n\t-- close file\n\tif fn then\n\t\treadfrom()\n\tend\n\n\t-- deal with include directive\n\tlocal nsubst\n\trepeat\n\t\tcode, nsubst = gsub(code, '\\n%s*%$(.)file%s*\"(.-)\"([^\\n]*)\\n',\n\t\t\tfunction(kind, fn, extra)\n\t\t\t\tlocal _, _, ext = strfind(fn, \".*%.(.*)$\")\n\t\t\t\tlocal fp, msg = openfile(fn, 'r')\n\t\t\t\tif not fp then\n\t\t\t\t\terror('#' .. msg .. ': ' .. fn)\n\t\t\t\tend\n\t\t\t\tif kind == 'p' then\n\t\t\t\t\tlocal s = prep(fp)\n\t\t\t\t\tclosefile(fp)\n\t\t\t\t\treturn s\n\t\t\t\tend\n\t\t\t\tlocal s = read(fp, '*a')\n\t\t\t\tclosefile(fp)\n\t\t\t\tif kind == 'c' or kind == 'h' then\n\t\t\t\t\treturn extract_code(fn, s)\n\t\t\t\telseif kind == 'l' then\n\t\t\t\t\treturn \"\\n$[--##\" .. fn .. \"\\n\" .. s .. \"\\n$]\\n\"\n\t\t\t\telseif kind == 'i' then\n\t\t\t\t\tlocal t = { code = s }\n\t\t\t\t\textra = string.gsub(extra, \"^%s*,%s*\", \"\")\n\t\t\t\t\tlocal pars = split_c_tokens(extra, \",\")\n\t\t\t\t\tinclude_file_hook(t, fn, table.unpack(pars))\n\t\t\t\t\treturn \"\\n\\n\" .. t.code\n\t\t\t\telse\n\t\t\t\t\terror('#Invalid include directive (use $cfile, $pfile, $lfile or $ifile)')\n\t\t\t\tend\n\t\t\tend)\n\tuntil nsubst == 0\n\n\t-- deal with renaming directive\n\trepeat -- I don't know why this is necesary\n\t\tcode, nsubst = gsub(code, '\\n%s*%$renaming%s*(.-)%s*\\n', function(r)\n\t\t\tappendrenaming(r)\n\t\t\treturn \"\\n\"\n\t\tend)\n\tuntil nsubst == 0\n\n\tlocal t = _Package(_Container { name = name, code = code })\n\tpush(t)\n\tpreprocess_hook(t)\n\tt:preprocess()\n\tpreparse_hook(t)\n\tt:parse(t.code)\n\tpop()\n\treturn t\nend\n\nsetmetatable(_extra_parameters, { __index = _G })\n\nfunction prep(file)\n\tlocal chunk = { 'local __ret = {\"\\\\n\"}\\n' }\n\tfor line in file:lines() do\n\t\tif string.find(line, \"^##\") then\n\t\t\ttable.insert(chunk, string.sub(line, 3) .. \"\\n\")\n\t\telse\n\t\t\tlocal last = 1\n\t\t\tfor text, expr, index in string.gmatch(line, \"(.-)$(%b())()\") do\n\t\t\t\tlast = index\n\t\t\t\tif text ~= \"\" then\n\t\t\t\t\ttable.insert(chunk, string.format('table.insert(__ret, %q )', text))\n\t\t\t\tend\n\t\t\t\ttable.insert(chunk, string.format('table.insert(__ret, %s )', expr))\n\t\t\tend\n\t\t\ttable.insert(chunk, string.format('table.insert(__ret, %q)\\n',\n\t\t\t\tstring.sub(line, last) .. \"\\n\"))\n\t\tend\n\tend\n\ttable.insert(chunk, '\\nreturn table.concat(__ret)\\n')\n\tlocal f, e = load(table.concat(chunk), nil, \"t\", _extra_parameters)\n\tif e then\n\t\terror(\"#\" .. e)\n\tend\n\treturn f()\nend\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/template_class.lua",
    "content": "\n_global_templates = {}\n\nclassTemplateClass = {\n\n\tname = '',\n\tbody = '',\n\tparents = {},\n\targs = {}, -- the template arguments\n}\n\nclassTemplateClass.__index = classTemplateClass\n\n\nfunction classTemplateClass:throw(types, local_scope)\n\n\t--if table.getn(types) ~= table.getn(self.args) then\n\t--\terror(\"#invalid parameter count\")\n\t--end\n\n\t-- replace\n\tfor i =1 , types.n do\n\n\t\tlocal Il = split_c_tokens(types[i], \" \")\n\t\tif #Il ~= #self.args then\n\t\t\terror(\"#invalid parameter count for \"..types[i])\n\t\tend\n\t\tlocal bI = self.body\n\t\tlocal pI = {}\n\t\tfor j = 1,self.args.n do\n\t\t\t--Tl[j] = findtype(Tl[j]) or Tl[j]\n\t\t\tbI = string.gsub(bI, \"([^_%w])\"..self.args[j]..\"([^_%w])\", \"%1\"..Il[j]..\"%2\")\n\t\t\tif self.parents then\n\t\t\t\tfor i=1,#self.parents do\n\t\t\t\t\tpI[i] = string.gsub(self.parents[i], \"([^_%w]?)\"..self.args[j]..\"([^_%w]?)\", \"%1\"..Il[j]..\"%2\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t--local append = \"<\"..string.gsub(types[i], \"%s+\", \",\")..\">\"\n\t\tlocal append = \"<\"..concat(Il, 1, #Il, \",\")..\">\"\n\t\tappend = string.gsub(append, \"%s*,%s*\", \",\")\n\t\tappend = string.gsub(append, \">>\", \"> >\")\n\t\tfor i=1,#pI do\n\t\t\t--pI[i] = string.gsub(pI[i], \">>\", \"> >\")\n\t\t\tpI[i] = resolve_template_types(pI[i])\n\t\tend\n\t\tbI = string.gsub(bI, \">>\", \"> >\")\n\t\tlocal n = self.name\n\t\tif local_scope then\n\t\t\tn = self.local_name\n\t\tend\n\n\t\tClass(n..append, pI, bI)\n\tend\nend\n\n\nfunction TemplateClass(name, parents, body, parameters)\n\n\tlocal o = {\n\t\n\t\tparents = parents,\n\t\tbody = body,\n\t\targs = parameters,\n\t}\n\t\n\tlocal oname = string.gsub(name, \"@.*$\", \"\")\n\toname = getnamespace(classContainer.curr)..oname\n\to.name = oname\n\n\to.local_name = name\n\t\n\tsetmetatable(o, classTemplateClass)\n\n\tif _global_templates[oname] then\n\t\twarning(\"Duplicate declaration of template \"..oname)\n\telse\n\t\t_global_templates[oname] = o\n\tend\n\n\treturn o\nend\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/typedef.lua",
    "content": "-- tolua: typedef class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n\n-- Typedef class\n-- Represents a type synonym.\n-- The 'de facto' type replaces the typedef before the\n-- remaining code is parsed.\n-- The following fields are stored:\n--   utype = typedef name\n--   type = 'the facto' type\n--   mod = modifiers to the 'de facto' type\nclassTypedef = {\n utype = '',\n mod = '',\n type = ''\n}\nclassTypedef.__index = classTypedef\n\n-- Print method\nfunction classTypedef:print (ident,close)\n print(ident..\"Typedef{\")\n print(ident..\" utype = '\"..self.utype..\"',\")\n print(ident..\" mod = '\"..self.mod..\"',\")\n print(ident..\" type = '\"..self.type..\"',\")\n print(ident..\"}\"..close)\nend\n\n-- Return it's not a variable\nfunction classTypedef:isvariable ()\n return false\nend\n\n-- Internal constructor\nfunction _Typedef (t)\n setmetatable(t,classTypedef)\n t.type = resolve_template_types(t.type)\n appendtypedef(t)\n return t\nend\n\n-- Constructor\n-- Expects one string representing the type definition.\nfunction Typedef (s)\n if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then\n  tolua_error(\"#invalid typedef: pointers (and references) are not supported\")\n end\n local o = {mod = ''}\n if string.find(s, \"[<>]\") then\n \t_,_,o.type,o.utype = string.find(s, \"^%s*([^<>]+%b<>[^%s]*)%s+(.-)$\")\n else\n \tlocal t = split(gsub(s,\"%s%s*\",\" \"),\" \")\n \to = {\n\t  utype = t[t.n],\n\t  type = t[t.n-1],\n\t  mod = concat(t,1,t.n-2),\n\t }\n end\n return _Typedef(o)\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/variable.lua",
    "content": "-- tolua: variable class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n-- Variable class\n-- Represents a extern variable or a public member of a class.\n-- Stores all fields present in a declaration.\nclassVariable = {\n _get = {},   -- mapped get functions\n _set = {},   -- mapped set functions\n}\nclassVariable.__index = classVariable\nsetmetatable(classVariable,classDeclaration)\n\n-- Print method\nfunction classVariable:print (ident,close)\n print(ident..\"Variable{\")\n print(ident..\" mod  = '\"..self.mod..\"',\")\n print(ident..\" type = '\"..self.type..\"',\")\n print(ident..\" ptr  = '\"..self.ptr..\"',\")\n print(ident..\" name = '\"..self.name..\"',\")\n if self.dim then print(ident..\" dim = '\"..self.dim..\"',\") end\n print(ident..\" def  = '\"..self.def..\"',\")\n print(ident..\" ret  = '\"..self.ret..\"',\")\n print(ident..\"}\"..close)\nend\n\n-- Generates C function name\nfunction classVariable:cfuncname (prefix)\n local parent = \"\"\n local unsigned = \"\"\n local ptr = \"\"\n\n local p = self:inmodule() or self:innamespace() or self:inclass()\n\n if p then\n \tif self.parent.classtype == 'class' then\n\t\tparent = \"_\" .. self.parent.type\n\telse\n\t  parent = \"_\" .. p\n\tend\n end\n\n if strfind(self.mod,\"(unsigned)\") then\n  unsigned = \"_unsigned\"\n end\n\n if self.ptr == \"*\" then ptr = \"_ptr\"\n elseif self.ptr == \"&\" then ptr = \"_ref\"\n end\n\n local name =  prefix .. parent .. unsigned .. \"_\" .. gsub(self.lname or self.name,\".*::\",\"\") .. ptr\n\n\tname = clean_template(name)\n return name\n\nend\n\n-- check if it is a variable\nfunction classVariable:isvariable ()\n return true\nend\n\n-- get variable value\nfunction classVariable:getvalue (class,static, prop_get)\n\n\tlocal name\n\tif prop_get then\n\n\t\tname = prop_get..\"()\"\n\telse\n\t\tname = self.name\n\tend\n\n\tif class and static then\n\t return self.parent.type..'::'..name\n\telseif class then\n\t return 'self->'..name\n\telse\n\t return name\n\tend\nend\n\n-- get variable pointer value\nfunction classVariable:getpointervalue (class,static)\n if class and static then\n  return class..'::p'\n elseif class then\n  return 'self->p'\n else\n  return 'p'\n end\nend\n\n-- Write binding functions\nfunction classVariable:supcode ()\n\n local class = self:inclass()\n\n\tlocal prop_get,prop_set\n\tif string.find(self.mod, 'tolua_property') then\n\n\t\tlocal _,_,type = string.find(self.mod, \"tolua_property__([^%s]*)\")\n\t\ttype = type or \"default\"\n\t\tprop_get,prop_set = get_property_methods(type, self.name)\n\t\tself.mod = string.gsub(self.mod, \"tolua_property[^%s]*\", \"\")\n\tend\n\n -- get function ------------------------------------------------\n if class then\n  output(\"/* get function:\",self.name,\" of class \",class,\" */\")\n else\n  output(\"/* get function:\",self.name,\" */\")\n end\n self.cgetname = self:cfuncname(\"tolua_get\")\n output(\"#ifndef TOLUA_DISABLE_\"..self.cgetname)\n output(\"\\nstatic int\",self.cgetname,\"(lua_State* tolua_S)\")\n output(\"{\")\n\n -- declare self, if the case\n local _,_,static = strfind(self.mod,'^%s*(static)')\n if class and static==nil then\n  output(' ',self.parent.type,'*','self = ')\n  output('(',self.parent.type,'*) ')\n  local to_func = get_to_function(self.parent.type)\n  output(to_func,'(tolua_S,1,0);')\n elseif static then\n  _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')\n end\n\n\n -- check self value\n if class and static==nil then\n\t output('#ifndef TOLUA_RELEASE\\n')\n  output('  if (!self) tolua_error(tolua_S,\"'..output_error_hook(\"invalid \\'self\\' in accessing variable \\'%s\\'\", self.name)..'\",NULL);');\n\t\toutput('#endif\\n')\n end\n\n -- return value\n if string.find(self.mod, 'tolua_inherits') then\n\tlocal push_func = get_push_function(self.type)\n \toutput('#ifdef __cplusplus\\n')\n\toutput('  ',push_func,'(tolua_S,(void*)static_cast<'..self.type..'*>(self), \"',self.type,'\");')\n\toutput('#else\\n')\n\toutput('  ',push_func,'(tolua_S,(void*)(('..self.type..'*)self), \"',self.type,'\");')\n\toutput('#endif\\n')\n else\n\tlocal t,ct = isbasic(self.type)\n\tif t then\n\t\toutput('  tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static,prop_get)..');')\n\telse\n\t\tlocal push_func = get_push_function(self.type)\n\t\tt = self.type\n\t\tif self.ptr == '&' or self.ptr == '' then\n\t\t\toutput('  ',push_func,'(tolua_S,(void*)&'..self:getvalue(class,static,prop_get)..',\"',t,'\");')\n\t\telse\n\t\t\toutput('  ',push_func,'(tolua_S,(void*)'..self:getvalue(class,static,prop_get)..',\"',t,'\");')\n\t\tend\n\tend\n end\n output(' return 1;')\n output('}')\n output('#endif //#ifndef TOLUA_DISABLE\\n')\n output('\\n')\n\n -- set function ------------------------------------------------\n if not (strfind(self.type,'const%s+') or string.find(self.mod, 'tolua_readonly') or string.find(self.mod, 'tolua_inherits'))  then\n  if class then\n   output(\"/* set function:\",self.name,\" of class \",class,\" */\")\n  else\n   output(\"/* set function:\",self.name,\" */\")\n  end\n  self.csetname = self:cfuncname(\"tolua_set\")\n  output(\"#ifndef TOLUA_DISABLE_\"..self.csetname)\n  output(\"\\nstatic int\",self.csetname,\"(lua_State* tolua_S)\")\n  output(\"{\")\n\n  -- declare self, if the case\n  if class and static==nil then\n   output(' ',self.parent.type,'*','self = ')\n   output('(',self.parent.type,'*) ')\n   local to_func = get_to_function(self.parent.type)\n   output(to_func,'(tolua_S,1,0);')\n   -- check self value\n\t\tend\n  -- check types\n\t\toutput('#ifndef TOLUA_RELEASE\\n')\n\t\toutput('  tolua_Error tolua_err;')\n  if class and static==nil then\n   output('  if (!self) tolua_error(tolua_S,\"'..output_error_hook(\"invalid \\'self\\' in accessing variable \\'%s\\'\", self.name)..'\",NULL);');\n  elseif static then\n   _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')\n  end\n\n  -- check variable type\n  output('  if ('..self:outchecktype(2)..')')\n  output('   tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);')\n\t\toutput('#endif\\n')\n\n  -- assign value\n\t\tlocal def = 0\n\t\tif self.def ~= '' then def = self.def end\n\t\tif self.type == 'char*' and self.dim ~= '' then -- is string\n\t\t\toutput(' strncpy((char*)')\n\t\t\tif class and static then\n\t\t\t\toutput(self.parent.type..'::'..self.name)\n\t\t\telseif class then\n\t\t\t\toutput('self->'..self.name)\n\t\t\telse\n\t\t\t\toutput(self.name)\n\t\t\tend\n\t\t\toutput(',(const char*)tolua_tostring(tolua_S,2,',def,'),',self.dim,'-1);')\n\t\telse\n\t\t\tlocal ptr = ''\n\t\t\tif self.ptr~='' then ptr = '*' end\n\t\t\toutput(' ')\n\t\t\tlocal name = prop_set or self.name\n\t\t\tif class and static then\n\t\t\t\toutput(self.parent.type..'::'..name)\n\t\t\telseif class then\n\t\t\t\toutput('self->'..name)\n\t\t\telse\n\t\t\t\toutput(name)\n\t\t\tend\n\t\t\tlocal t = isbasic(self.type)\n\t\t\tif prop_set then\n\t\t\t\toutput('(')\n\t\t\telse\n\t\t\t\toutput(' = ')\n\t\t\tend\n\t\t\tif not t and ptr=='' then output('*') end\n\t\t\toutput('((',self.mod,self.type)\n\t\t\tif not t then\n\t\t\t\toutput('*')\n\t\t\tend\n\t\t\toutput(') ')\n\t\t\tif t then\n\t\t\t\tif isenum(self.type) then\n\t\t\t\t\toutput('(int) ')\n\t\t\t\tend\n\t\t\t\toutput('tolua_to'..t,'(tolua_S,2,',def,'))')\n\t\t\telse\n\t\t\t\tlocal to_func = get_to_function(self.type)\n\t\t\t\toutput(to_func,'(tolua_S,2,',def,'))')\n\t\t\tend\n\t\t\tif prop_set then\n\t\t\t\toutput(\")\")\n\t\t\tend\n\t\t\toutput(\";\")\n\t\tend\n  output(' return 0;')\n  output('}')\n  output('#endif //#ifndef TOLUA_DISABLE\\n')\n  output('\\n')\n end\n\nend\n\nfunction classVariable:register (pre)\n\n\tif not self:check_public_access() then\n\t\treturn\n\tend\n pre = pre or ''\n local parent = self:inmodule() or self:innamespace() or self:inclass()\n if not parent then\n  if classVariable._warning==nil then\n   warning(\"Mapping variable to global may degrade performance\")\n   classVariable._warning = 1\n  end\n end\n if self.csetname then\n  output(pre..'tolua_variable(tolua_S,\"'..self.lname..'\",'..self.cgetname..','..self.csetname..');')\n else\n  output(pre..'tolua_variable(tolua_S,\"'..self.lname..'\",'..self.cgetname..',NULL);')\n end\nend\n\n-- Internal constructor\nfunction _Variable (t)\n setmetatable(t,classVariable)\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects a string representing the variable declaration.\nfunction Variable (s)\n return _Variable (Declaration(s,'var'))\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/lua/verbatim.lua",
    "content": "-- tolua: verbatim class\n-- Written by Waldemar Celes\n-- TeCGraf/PUC-Rio\n-- Jul 1998\n-- $Id: verbatim.lua,v 1.3 2000/01/24 20:41:16 celes Exp $\n\n-- This code is free software; you can redistribute it and/or modify it.\n-- The software provided hereunder is on an \"as is\" basis, and\n-- the author has no obligation to provide maintenance, support, updates,\n-- enhancements, or modifications.\n\n\n\n-- Verbatim class\n-- Represents a line translated directed to the binding file.\n-- The following filds are stored:\n--   line = line text\nclassVerbatim = {\n line = '',\n\tcond = nil,    -- condition: where to generate the code (s=suport, r=register)\n}\nclassVerbatim.__index = classVerbatim\nsetmetatable(classVerbatim,classFeature)\n\n-- preamble verbatim\nfunction classVerbatim:preamble ()\n if self.cond == '' then\n  write(self.line)\n end\nend\n\n-- support code\nfunction classVerbatim:supcode ()\n if strfind(self.cond,'s') then\n  write(self.line)\n  write('\\n')\n end\nend\n\n-- register code\nfunction classVerbatim:register (pre)\n if strfind(self.cond,'r') then\n  write(self.line)\n end\nend\n\n\n-- Print method\nfunction classVerbatim:print (ident,close)\n print(ident..\"Verbatim{\")\n print(ident..\" line = '\"..self.line..\"',\")\n print(ident..\"}\"..close)\nend\n\n\n-- Internal constructor\nfunction _Verbatim (t)\n setmetatable(t,classVerbatim)\n append(t)\n return t\nend\n\n-- Constructor\n-- Expects a string representing the text line\nfunction Verbatim (l,cond)\n if strsub(l,1,1) == \"'\" then\n  l = strsub(l,2)\n elseif strsub(l,1,1) == '$' then\n  cond = 'sr'       -- generates in both suport and register fragments\n  l = strsub(l,2)\n end\n return _Verbatim {\n  line = l,\n  cond = cond or '',\n }\nend\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/tolua.c",
    "content": "/* tolua\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Aug 2003\n** $Id:$\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#include \"tolua++.h\"\n\n#include \"lauxlib.h\"\n#include \"lua.h\"\n#include \"lualib.h\"\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n\nstatic void help(void) {\n  fprintf(\n      stderr,\n      \"\\n\"\n      \"usage: tolua++ [options] input_file\\n\"\n      \"\\n\"\n      \"Command line options are:\\n\"\n      \"  -v       : print version information.\\n\"\n      \"  -o  file : set output file; default is stdout.\\n\"\n      \"  -H  file : create include file.\\n\"\n      \"  -n  name : set package name; default is input file root name.\\n\"\n      \"  -p       : parse only.\\n\"\n      \"  -P       : parse and print structure information (for debug).\\n\"\n      \"  -S       : disable support for c++ strings.\\n\"\n      \"  -1       : substract 1 to operator[] index (for compatibility with \"\n      \"tolua5).\\n\"\n      \"  -L  file : run lua file (with dofile()) before doing anything.\\n\"\n      \"  -D       : disable automatic exporting of destructors for classes \"\n      \"that have\\n\"\n      \"             constructors (for compatibility with tolua5)\\n\"\n      \"  -W       : disable warnings for unsupported features (for \"\n      \"compatibility\\n\"\n      \"             with tolua5)\\n\"\n      \"  -C       : disable cleanup of included lua code (for easier \"\n      \"debugging)\\n\"\n      \"  -E  value[=value] : add extra values to the luastate\\n\"\n      \"  -t       : export a list of types asociates with the C++ typeid name\\n\"\n      \"  -q       : don't print warnings to the console\\n\"\n      \"  -h       : print this message.\\n\"\n      \"Should the input file be omitted, stdin is assumed;\\n\"\n      \"in that case, the package name must be explicitly set.\\n\\n\");\n}\n\nstatic void version(void) {\n  fprintf(stderr, \"%s (written by W. Celes, A. Manzur)\\n\", TOLUA_VERSION);\n}\n\nstatic void setfield(lua_State *L, int table, const char *f, const char *v) {\n  lua_pushstring(L, f);\n  lua_pushstring(L, v);\n  lua_settable(L, table);\n}\n\nstatic void add_extra(lua_State *L, const char *value) {\n  int len;\n  lua_getglobal(L, \"_extra_parameters\");\n#if LUA_VERSION_NUM > 501\n  len = lua_rawlen(L, -1);\n#else\n  len = luaL_getn(L, -1);\n#endif\n  lua_pushstring(L, value);\n  lua_rawseti(L, -2, len + 1);\n  lua_pop(L, 1);\n}\n\nstatic void error(char *o) __attribute__((noreturn));\n\nstatic void error(char *o) {\n  fprintf(stderr, \"tolua: unknown option '%s'\\n\", o);\n  help();\n  exit(1);\n}\n\nint main(int argc, char *argv[]) {\n#ifdef LUA_VERSION_NUM /* lua 5.1 */\n  lua_State *L = luaL_newstate();\n  luaL_openlibs(L);\n#else\n  lua_State *L = lua_open();\n  luaopen_base(L);\n  luaopen_io(L);\n  luaopen_string(L);\n  luaopen_table(L);\n  luaopen_math(L);\n  luaopen_debug(L);\n#endif\n\n  lua_pushstring(L, TOLUA_VERSION);\n  lua_setglobal(L, \"TOLUA_VERSION\");\n  lua_pushstring(L, LUA_VERSION);\n  lua_setglobal(L, \"TOLUA_LUA_VERSION\");\n\n  if (argc == 1) {\n    help();\n    return 0;\n  } else {\n    int i, t;\n    lua_newtable(L);\n    lua_setglobal(L, \"_extra_parameters\");\n    lua_newtable(L);\n    lua_pushvalue(L, -1);\n    lua_setglobal(L, \"flags\");\n    t = lua_gettop(L);\n    // Ignore the last arg in the arg list.\n    for (i = 1; i < argc - 1; ++i) {\n      if (*argv[i] == '-') {\n        switch (argv[i][1]) {\n          case 'v':\n            version();\n            return 0;\n          case 'h':\n            help();\n            return 0;\n          case 'p':\n            setfield(L, t, \"p\", \"\");\n            break;\n          case 'P':\n            setfield(L, t, \"P\", \"\");\n            break;\n          case 'o':\n            setfield(L, t, \"o\", argv[++i]);\n            break;\n          case 'n':\n            setfield(L, t, \"n\", argv[++i]);\n            break;\n          case 'H':\n            setfield(L, t, \"H\", argv[++i]);\n            break;\n          case 'S':\n            setfield(L, t, \"S\", \"\");\n            break;\n          case '1':\n            setfield(L, t, \"1\", \"\");\n            break;\n          case 'L':\n            setfield(L, t, \"L\", argv[++i]);\n            break;\n          case 'D':\n            setfield(L, t, \"D\", \"\");\n            break;\n          case 'W':\n            setfield(L, t, \"W\", \"\");\n            break;\n          case 'C':\n            setfield(L, t, \"C\", \"\");\n            break;\n          case 'E':\n            add_extra(L, argv[++i]);\n            break;\n          case 't':\n            setfield(L, t, \"t\", \"\");\n            break;\n          case 'q':\n            setfield(L, t, \"q\", \"\");\n            break;\n          default:\n            error(argv[i]);\n            break;\n        }\n      } else {\n        setfield(L, t, \"f\", argv[i]);\n        break;\n      }\n    }\n    lua_pop(L, 1);\n  }\n#define TOLUA_SCRIPT_RUN\n#ifndef TOLUA_SCRIPT_RUN\n  {\n    int tolua_tolua_open(lua_State * L);\n    tolua_tolua_open(L);\n  }\n#else\n  {\n    // Take the path to the Lua sources from the last arg.\n    char *pkg_path = argv[argc - 1];\n    char full_path[1024];\n    strcpy(full_path, pkg_path);\n    strcat(full_path, \"all.lua\");\n\n    lua_pushstring(L, pkg_path);\n    lua_setglobal(L, \"path\");\n    if (luaL_loadfile(L, full_path) != 0) {\n      fprintf(stderr, \"luaL_loadfile failed\\n\");\n      return 1;\n    }\n    if (lua_pcall(L, 0, 0, 0) != 0) {\n      const char *errmsg = lua_tostring(L, -1);\n      fprintf(stderr, \"lua_pcall failed: %s\\n\", errmsg);\n      lua_pop(L, 1);\n      return 1;\n    }\n  }\n#endif\n  return 0;\n}\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/tolua_scons.pkg",
    "content": "$lfile \"src/bin/lua/compat-5.1.lua\"\n$lfile \"src/bin/lua/compat.lua\"\n$lfile \"src/bin/lua/basic.lua\"\n$lfile \"src/bin/lua/feature.lua\"\n$lfile \"src/bin/lua/verbatim.lua\"\n$lfile \"src/bin/lua/code.lua\"\n$lfile \"src/bin/lua/typedef.lua\"\n$lfile \"src/bin/lua/container.lua\"\n$lfile \"src/bin/lua/package.lua\"\n$lfile \"src/bin/lua/module.lua\"\n$lfile \"src/bin/lua/namespace.lua\"\n$lfile \"src/bin/lua/define.lua\"\n$lfile \"src/bin/lua/enumerate.lua\"\n$lfile \"src/bin/lua/declaration.lua\"\n$lfile \"src/bin/lua/variable.lua\"\n$lfile \"src/bin/lua/array.lua\"\n$lfile \"src/bin/lua/function.lua\"\n$lfile \"src/bin/lua/operator.lua\"\n$lfile \"src/bin/lua/template_class.lua\"\n$lfile \"src/bin/lua/class.lua\"\n$lfile \"src/bin/lua/clean.lua\"\n$lfile \"src/bin/lua/doit.lua\"\n\n$[\nlocal err,msg = pcall(doit)\nif not err then\n local _,_,label,msg = strfind(msg,\"(.-:.-:%s*)(.*)\")\n tolua_error(msg,label)\n print(debug.traceback())\nend\n$]\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/toluabind.c",
    "content": "/*\n** Lua binding: tolua\n** Generated automatically by tolua++-1.0.92 on Sun Feb 15 22:29:47 2009.\n*/\n\n#ifndef __cplusplus\n#include \"stdlib.h\"\n#endif\n#include \"string.h\"\n\n#include \"tolua++.h\"\n\n/* Exported function */\nTOLUA_API int  tolua_tolua_open (lua_State* tolua_S);\n\n\n/* function to register type */\nstatic void tolua_reg_types (lua_State* tolua_S)\n{\n  (void)tolua_S;\n}\n\n/* Open function */\nTOLUA_API int tolua_tolua_open (lua_State* tolua_S)\n{\n tolua_open(tolua_S);\n tolua_reg_types(tolua_S);\n tolua_module(tolua_S,NULL,0);\n tolua_beginmodule(tolua_S,NULL);\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n   105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n     95, 86, 69, 82, 83, 73, 79, 78, 44, 32, 34, 53, 37, 46, 48,\n     34, 41, 32,116,104,101,110, 13, 10,  9,114,101,116,117,114,\n    110, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 32, 34,108,\n    111, 97,100,102,105,108,101, 34, 13, 10,108,111, 99, 97,108,\n     32,102,117,110, 99,116,105,111,110, 32,112,112, 95,100,111,\n    102,105,108,101, 40,112, 97,116,104, 41, 13, 10, 13, 10,  9,\n    108,111, 99, 97,108, 32,108,111, 97,100,101,100, 32, 61, 32,\n    102, 97,108,115,101, 13, 10,  9,108,111, 99, 97,108, 32,103,\n    101,116,102,105,108,101, 32, 61, 32,102,117,110, 99,116,105,\n    111,110, 40, 41, 13, 10, 13, 10,  9,  9,105,102, 32,108,111,\n     97,100,101,100, 32,116,104,101,110, 13, 10,  9,  9,  9,114,\n    101,116,117,114,110, 13, 10,  9,  9,101,108,115,101, 13, 10,\n      9,  9,  9,108,111, 99, 97,108, 32,102,105,108,101, 44,101,\n    114,114, 32, 61, 32,105,111, 46,111,112,101,110, 40,112, 97,\n    116,104, 41, 13, 10,  9,  9,  9,105,102, 32,110,111,116, 32,\n    102,105,108,101, 32,116,104,101,110, 13, 10,  9,  9,  9,  9,\n    101,114,114,111,114, 40, 34,101,114,114,111,114, 32,108,111,\n     97,100,105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112,\n     97,116,104, 46, 46, 34, 58, 32, 34, 46, 46,101,114,114, 41,\n     13, 10,  9,  9,  9,101,110,100, 13, 10,  9,  9,  9,108,111,\n     99, 97,108, 32,114,101,116, 32, 61, 32,102,105,108,101, 58,\n    114,101, 97,100, 40, 34, 42, 97, 34, 41, 13, 10,  9,  9,  9,\n    102,105,108,101, 58, 99,108,111,115,101, 40, 41, 13, 10, 13,\n     10,  9,  9,  9,114,101,116, 32, 61, 32,115,116,114,105,110,\n    103, 46,103,115,117, 98, 40,114,101,116, 44, 32, 34, 37, 46,\n     37, 46, 37, 46, 37,115, 42, 37, 41, 34, 44, 32, 34, 46, 46,\n     46, 41, 32,108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32,\n    123,110, 61,115,101,108,101, 99,116, 40, 39, 35, 39, 44, 32,\n     46, 46, 46, 41, 44, 32, 46, 46, 46,125, 59, 34, 41, 13, 10,\n     13, 10,  9,  9,  9,108,111, 97,100,101,100, 32, 61, 32,116,\n    114,117,101, 13, 10,  9,  9,  9,114,101,116,117,114,110, 32,\n    114,101,116, 13, 10,  9,  9,101,110,100, 13, 10,  9,101,110,\n    100, 13, 10, 13, 10,  9,108,111, 99, 97,108, 32,102, 32, 61,\n     32,108,111, 97,100, 40,103,101,116,102,105,108,101, 44, 32,\n    112, 97,116,104, 41, 13, 10,  9,105,102, 32,110,111,116, 32,\n    102, 32,116,104,101,110, 13, 10,  9, 13, 10,  9,  9,101,114,\n    114,111,114, 40, 34,101,114,114,111,114, 32,108,111, 97,100,\n    105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112, 97,116,\n    104, 41, 13, 10,  9,101,110,100, 13, 10,  9,114,101,116,117,\n    114,110, 32,102, 40, 41, 13, 10,101,110,100, 13, 10, 13, 10,\n    111,108,100, 95,100,111,102,105,108,101, 32, 61, 32,100,111,\n    102,105,108,101, 13, 10,100,111,102,105,108,101, 32, 61, 32,\n    112,112, 95,100,111,102,105,108,101, 13, 10, 13, 10, 13, 10,\n     45, 45, 32,115,116,114,105,110,103, 46,103,115,117, 98, 13,\n     10, 45, 45, 91, 91, 13, 10,108,111, 99, 97,108, 32,111,103,\n    115,117, 98, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 13, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,\n    105,111,110, 32, 99,111,109,112,103,115,117, 98, 40, 97, 44,\n     98, 44, 99, 44,100, 41, 13, 10, 32, 32,105,102, 32,116,121,\n    112,101, 40, 99, 41, 32, 61, 61, 32, 34,102,117,110, 99,116,\n    105,111,110, 34, 32,116,104,101,110, 13, 10, 32, 32, 32, 32,\n    108,111, 99, 97,108, 32,111, 99, 32, 61, 32, 99, 13, 10, 32,\n     32, 32, 32, 99, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40, 46, 46, 46, 41, 32,114,101,116,117,114,110, 32,111,\n     99, 40, 46, 46, 46, 41, 32,111,114, 32, 39, 39, 32,101,110,\n    100, 13, 10, 32, 32,101,110,100, 13, 10, 32, 32,114,101,116,\n    117,114,110, 32,111,103,115,117, 98, 40, 97, 44, 98, 44, 99,\n     44,100, 41, 13, 10,101,110,100, 13, 10,115,116,114,105,110,\n    103, 46,114,101,112,108, 32, 61, 32,111,103,115,117, 98, 13,\n     10, 45, 45, 93, 93, 13, 10, 13, 10, 45, 45,115,116,114,105,\n    110,103, 46,103,115,117, 98, 32, 61, 32, 99,111,109,112,103,\n    115,117, 98, 13,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/compat-5.1.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 82,101, 97,108,\n     32,103,108,111, 98, 97,108,115, 10, 45, 45, 32, 95, 65, 76,\n     69, 82, 84, 10, 45, 45, 32, 95, 69, 82, 82, 79, 82, 77, 69,\n     83, 83, 65, 71, 69, 10, 45, 45, 32, 95, 86, 69, 82, 83, 73,\n     79, 78, 10, 45, 45, 32, 95, 71, 10, 45, 45, 32, 97,115,115,\n    101,114,116, 10, 45, 45, 32,101,114,114,111,114, 10, 45, 45,\n     32,109,101,116, 97,116, 97, 98,108,101, 10, 45, 45, 32,110,\n    101,120,116, 10, 45, 45, 32,112,114,105,110,116, 10, 45, 45,\n     32,114,101,113,117,105,114,101, 10, 45, 45, 32,116,111,110,\n    117,109, 98,101,114, 10, 45, 45, 32,116,111,115,116,114,105,\n    110,103, 10, 45, 45, 32,116,121,112,101, 10, 45, 45, 32,117,\n    110,112, 97, 99,107, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,\n     45, 45, 32, 99,111,108,108,101, 99,116,103, 97,114, 98, 97,\n    103,101, 10, 45, 45, 32,103, 99,105,110,102,111, 10, 10, 45,\n     45, 32,103,108,111, 98, 97,108,115, 10, 10, 45, 45, 32, 99,\n     97,108,108, 32, 32, 32, 45, 62, 32,112,114,111,116,101, 99,\n    116, 40,102, 44, 32,101,114,114, 41, 10, 45, 45, 32,108,111,\n     97,100,102,105,108,101, 10, 45, 45, 32,108,111, 97,100,115,\n    116,114,105,110,103, 10, 10, 45, 45, 32,114, 97,119,103,101,\n    116, 10, 45, 45, 32,114, 97,119,115,101,116, 10, 10, 45, 45,\n     32,103,101,116, 97,114,103,115, 32, 61, 32, 77, 97,105,110,\n     46,103,101,116, 97,114,103,115, 32, 63, 63, 10, 10,114, 97,\n    119,116,121,112,101, 32, 61, 32,116,121,112,101, 10, 10,102,\n    117,110, 99,116,105,111,110, 32,100,111, 95, 32, 40,102, 44,\n     32,101,114,114, 41, 10, 32, 32,105,102, 32,110,111,116, 32,\n    102, 32,116,104,101,110, 32,112,114,105,110,116, 40,101,114,\n    114, 41, 59, 32,114,101,116,117,114,110, 32,101,110,100, 10,\n     32, 32,108,111, 99, 97,108, 32, 97, 44, 98, 32, 61, 32,112,\n     99, 97,108,108, 40,102, 41, 10, 32, 32,105,102, 32,110,111,\n    116, 32, 97, 32,116,104,101,110, 32,112,114,105,110,116, 40,\n     98, 41, 59, 32,114,101,116,117,114,110, 32,110,105,108, 10,\n     32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, 98,\n     32,111,114, 32,116,114,117,101, 10, 32, 32,101,110,100, 10,\n    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,100,\n    111,115,116,114,105,110,103, 40,115, 41, 32,114,101,116,117,\n    114,110, 32,100,111, 95, 40,108,111, 97,100,115,116,114,105,\n    110,103, 40,115, 41, 41, 32,101,110,100, 10, 45, 45, 32,102,\n    117,110, 99,116,105,111,110, 32,100,111,102,105,108,101, 40,\n    115, 41, 32,114,101,116,117,114,110, 32,100,111, 95, 40,108,\n    111, 97,100,102,105,108,101, 40,115, 41, 41, 32,101,110,100,\n     10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 84, 97,\n     98,108,101, 32,108,105, 98,114, 97,114,121, 10,108,111, 99,\n     97,108, 32,116, 97, 98, 32, 61, 32,116, 97, 98,108,101, 10,\n    102,111,114,101, 97, 99,104, 32, 61, 32,116, 97, 98, 46,102,\n    111,114,101, 97, 99,104, 10,102,111,114,101, 97, 99,104,105,\n     32, 61, 32,116, 97, 98, 46,102,111,114,101, 97, 99,104,105,\n     10,103,101,116,110, 32, 61, 32,116, 97, 98, 46,103,101,116,\n    110, 10,116,105,110,115,101,114,116, 32, 61, 32,116, 97, 98,\n     46,105,110,115,101,114,116, 10,116,114,101,109,111,118,101,\n     32, 61, 32,116, 97, 98, 46,114,101,109,111,118,101, 10,115,\n    111,114,116, 32, 61, 32,116, 97, 98, 46,115,111,114,116, 10,\n     10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 98,\n    117,103, 32,108,105, 98,114, 97,114,121, 10,108,111, 99, 97,\n    108, 32,100, 98,103, 32, 61, 32,100,101, 98,117,103, 10,103,\n    101,116,105,110,102,111, 32, 61, 32,100, 98,103, 46,103,101,\n    116,105,110,102,111, 10,103,101,116,108,111, 99, 97,108, 32,\n     61, 32,100, 98,103, 46,103,101,116,108,111, 99, 97,108, 10,\n    115,101,116, 99, 97,108,108,104,111,111,107, 32, 61, 32,102,\n    117,110, 99,116,105,111,110, 32, 40, 41, 32,101,114,114,111,\n    114, 34, 96,115,101,116, 99, 97,108,108,104,111,111,107, 39,\n     32,105,115, 32,100,101,112,114,101, 99, 97,116,101,100, 34,\n     32,101,110,100, 10,115,101,116,108,105,110,101,104,111,111,\n    107, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, 41,\n     32,101,114,114,111,114, 34, 96,115,101,116,108,105,110,101,\n    104,111,111,107, 39, 32,105,115, 32,100,101,112,114,101, 99,\n     97,116,101,100, 34, 32,101,110,100, 10,115,101,116,108,111,\n     99, 97,108, 32, 61, 32,100, 98,103, 46,115,101,116,108,111,\n     99, 97,108, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45,\n     32,109, 97,116,104, 32,108,105, 98,114, 97,114,121, 10,108,\n    111, 99, 97,108, 32,109, 97,116,104, 32, 61, 32,109, 97,116,\n    104, 10, 97, 98,115, 32, 61, 32,109, 97,116,104, 46, 97, 98,\n    115, 10, 97, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,\n    111,110, 32, 40,120, 41, 32,114,101,116,117,114,110, 32,109,\n     97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97, 99,\n    111,115, 40,120, 41, 41, 32,101,110,100, 10, 97,115,105,110,\n     32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,120, 41,\n     32,114,101,116,117,114,110, 32,109, 97,116,104, 46,100,101,\n    103, 40,109, 97,116,104, 46, 97,115,105,110, 40,120, 41, 41,\n     32,101,110,100, 10, 97,116, 97,110, 32, 61, 32,102,117,110,\n     99,116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,\n    110, 32,109, 97,116,104, 46,100,101,103, 40,109, 97,116,104,\n     46, 97,116, 97,110, 40,120, 41, 41, 32,101,110,100, 10, 97,\n    116, 97,110, 50, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40,120, 44,121, 41, 32,114,101,116,117,114,110, 32,109,\n     97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97,116,\n     97,110, 50, 40,120, 44,121, 41, 41, 32,101,110,100, 10, 99,\n    101,105,108, 32, 61, 32,109, 97,116,104, 46, 99,101,105,108,\n     10, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40,120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,\n    104, 46, 99,111,115, 40,109, 97,116,104, 46,114, 97,100, 40,\n    120, 41, 41, 32,101,110,100, 10,100,101,103, 32, 61, 32,109,\n     97,116,104, 46,100,101,103, 10,101,120,112, 32, 61, 32,109,\n     97,116,104, 46,101,120,112, 10,102,108,111,111,114, 32, 61,\n     32,109, 97,116,104, 46,102,108,111,111,114, 10,102,114,101,\n    120,112, 32, 61, 32,109, 97,116,104, 46,102,114,101,120,112,\n     10,108,100,101,120,112, 32, 61, 32,109, 97,116,104, 46,108,\n    100,101,120,112, 10,108,111,103, 32, 61, 32,109, 97,116,104,\n     46,108,111,103, 10,108,111,103, 49, 48, 32, 61, 32,109, 97,\n    116,104, 46,108,111,103, 49, 48, 10,109, 97,120, 32, 61, 32,\n    109, 97,116,104, 46,109, 97,120, 10,109,105,110, 32, 61, 32,\n    109, 97,116,104, 46,109,105,110, 10,109,111,100, 32, 61, 32,\n    109, 97,116,104, 46,109,111,100, 10, 80, 73, 32, 61, 32,109,\n     97,116,104, 46,112,105, 10, 45, 45, 63, 63, 63, 32,112,111,\n    119, 32, 61, 32,109, 97,116,104, 46,112,111,119, 32, 32, 10,\n    114, 97,100, 32, 61, 32,109, 97,116,104, 46,114, 97,100, 10,\n    114, 97,110,100,111,109, 32, 61, 32,109, 97,116,104, 46,114,\n     97,110,100,111,109, 10,114, 97,110,100,111,109,115,101,101,\n    100, 32, 61, 32,109, 97,116,104, 46,114, 97,110,100,111,109,\n    115,101,101,100, 10,115,105,110, 32, 61, 32,102,117,110, 99,\n    116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,110,\n     32,109, 97,116,104, 46,115,105,110, 40,109, 97,116,104, 46,\n    114, 97,100, 40,120, 41, 41, 32,101,110,100, 10,115,113,114,\n    116, 32, 61, 32,109, 97,116,104, 46,115,113,114,116, 10,116,\n     97,110, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,\n    120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,104, 46,\n    116, 97,110, 40,109, 97,116,104, 46,114, 97,100, 40,120, 41,\n     41, 32,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,\n     45, 45, 32,115,116,114,105,110,103, 32,108,105, 98,114, 97,\n    114,121, 10,108,111, 99, 97,108, 32,115,116,114, 32, 61, 32,\n    115,116,114,105,110,103, 10,115,116,114, 98,121,116,101, 32,\n     61, 32,115,116,114, 46, 98,121,116,101, 10,115,116,114, 99,\n    104, 97,114, 32, 61, 32,115,116,114, 46, 99,104, 97,114, 10,\n    115,116,114,102,105,110,100, 32, 61, 32,115,116,114, 46,102,\n    105,110,100, 10,102,111,114,109, 97,116, 32, 61, 32,115,116,\n    114, 46,102,111,114,109, 97,116, 10,103,115,117, 98, 32, 61,\n     32,115,116,114, 46,103,115,117, 98, 10,115,116,114,108,101,\n    110, 32, 61, 32,115,116,114, 46,108,101,110, 10,115,116,114,\n    108,111,119,101,114, 32, 61, 32,115,116,114, 46,108,111,119,\n    101,114, 10,115,116,114,114,101,112, 32, 61, 32,115,116,114,\n     46,114,101,112, 10,115,116,114,115,117, 98, 32, 61, 32,115,\n    116,114, 46,115,117, 98, 10,115,116,114,117,112,112,101,114,\n     32, 61, 32,115,116,114, 46,117,112,112,101,114, 10, 10, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 10, 45, 45, 32,111,115, 32,108,105,\n     98,114, 97,114,121, 10, 99,108,111, 99,107, 32, 61, 32,111,\n    115, 46, 99,108,111, 99,107, 10,100, 97,116,101, 32, 61, 32,\n    111,115, 46,100, 97,116,101, 10,100,105,102,102,116,105,109,\n    101, 32, 61, 32,111,115, 46,100,105,102,102,116,105,109,101,\n     10,101,120,101, 99,117,116,101, 32, 61, 32,111,115, 46,101,\n    120,101, 99,117,116,101, 32, 45, 45, 63, 10,101,120,105,116,\n     32, 61, 32,111,115, 46,101,120,105,116, 10,103,101,116,101,\n    110,118, 32, 61, 32,111,115, 46,103,101,116,101,110,118, 10,\n    114,101,109,111,118,101, 32, 61, 32,111,115, 46,114,101,109,\n    111,118,101, 10,114,101,110, 97,109,101, 32, 61, 32,111,115,\n     46,114,101,110, 97,109,101, 10,115,101,116,108,111, 99, 97,\n    108,101, 32, 61, 32,111,115, 46,115,101,116,108,111, 99, 97,\n    108,101, 10,116,105,109,101, 32, 61, 32,111,115, 46,116,105,\n    109,101, 10,116,109,112,110, 97,109,101, 32, 61, 32,111,115,\n     46,116,109,112,110, 97,109,101, 10, 10, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 10, 45, 45, 32, 99,111,109,112, 97,116,105, 98,105,\n    108,105,116,121, 32,111,110,108,121, 10,103,101,116,103,108,\n    111, 98, 97,108, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40,110, 41, 32,114,101,116,117,114,110, 32, 95, 71, 91,\n    110, 93, 32,101,110,100, 10,115,101,116,103,108,111, 98, 97,\n    108, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,110,\n     44,118, 41, 32, 95, 71, 91,110, 93, 32, 61, 32,118, 32,101,\n    110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10,108,111,\n     99, 97,108, 32,105,111, 44, 32,116, 97, 98, 32, 61, 32,105,\n    111, 44, 32,116, 97, 98,108,101, 10, 10, 45, 45, 32, 73, 79,\n     32,108,105, 98,114, 97,114,121, 32, 40,102,105,108,101,115,\n     41, 10, 95, 83, 84, 68, 73, 78, 32, 61, 32,105,111, 46,115,\n    116,100,105,110, 10, 95, 83, 84, 68, 69, 82, 82, 32, 61, 32,\n    105,111, 46,115,116,100,101,114,114, 10, 95, 83, 84, 68, 79,\n     85, 84, 32, 61, 32,105,111, 46,115,116,100,111,117,116, 10,\n     95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,116,100,\n    105,110, 10, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,111,\n     46,115,116,100,111,117,116, 10,115,101,101,107, 32, 61, 32,\n    105,111, 46,115,116,100,105,110, 46,115,101,101,107, 32, 32,\n     32, 45, 45, 32,115,105, 99,107, 32, 59, 45, 41, 10,116,109,\n    112,102,105,108,101, 32, 61, 32,105,111, 46,116,109,112,102,\n    105,108,101, 10, 99,108,111,115,101,102,105,108,101, 32, 61,\n     32,105,111, 46, 99,108,111,115,101, 10,111,112,101,110,102,\n    105,108,101, 32, 61, 32,105,111, 46,111,112,101,110, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,102,108,117,115,104, 32,\n     40,102, 41, 10, 32, 32,105,102, 32,102, 32,116,104,101,110,\n     32,102, 58,102,108,117,115,104, 40, 41, 10, 32, 32,101,108,\n    115,101, 32, 95, 79, 85, 84, 80, 85, 84, 58,102,108,117,115,\n    104, 40, 41, 10, 32, 32,101,110,100, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,114,101, 97,100,102,114,\n    111,109, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102, 32,\n    110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,101,\n    110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,\n    101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46, 99,\n    108,111,115,101, 40, 95, 73, 78, 80, 85, 84, 41, 10, 32, 32,\n     32, 32, 95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,\n    116,100,105,110, 10, 32, 32, 32, 32,114,101,116,117,114,110,\n     32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,\n    101,108,115,101, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,\n    102, 44, 32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,\n    111, 46,111,112,101,110, 40,110, 97,109,101, 44, 32, 34,114,\n     34, 41, 10, 32, 32, 32, 32, 95, 73, 78, 80, 85, 84, 32, 61,\n     32,102, 32,111,114, 32, 95, 73, 78, 80, 85, 84, 10, 32, 32,\n     32, 32,114,101,116,117,114,110, 32,102, 44, 32,101,114,114,\n     44, 32, 99,111,100, 10, 32, 32,101,110,100, 10,101,110,100,\n     10, 10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,\n    101,116,111, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102,\n     32,110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,\n    101,110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44,\n     32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,\n     99,108,111,115,101, 40, 95, 79, 85, 84, 80, 85, 84, 41, 10,\n     32, 32, 32, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,\n    111, 46,115,116,100,111,117,116, 10, 32, 32, 32, 32,114,101,\n    116,117,114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,\n    100, 10, 32, 32,101,108,115,101, 10, 32, 32, 32, 32,108,111,\n     99, 97,108, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100,\n     32, 61, 32,105,111, 46,111,112,101,110, 40,110, 97,109,101,\n     44, 32, 34,119, 34, 41, 10, 32, 32, 32, 32, 95, 79, 85, 84,\n     80, 85, 84, 32, 61, 32,102, 32,111,114, 32, 95, 79, 85, 84,\n     80, 85, 84, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,\n    102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,101,\n    110,100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 97,112,112,101,110,100,116,111, 32, 40,110, 97,109,\n    101, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,101,\n    114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,111,112,\n    101,110, 40,110, 97,109,101, 44, 32, 34, 97, 34, 41, 10, 32,\n     32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,102, 32,111,114,\n     32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,114,101,116,117,\n    114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10,\n    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,\n    101, 97,100, 32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99,\n     97,108, 32,102, 32, 61, 32, 95, 73, 78, 80, 85, 84, 10, 32,\n     32,105,102, 32,114, 97,119,116,121,112,101, 40, 97,114,103,\n     91, 49, 93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,\n    116, 97, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32,\n     61, 32,116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,\n    103, 44, 32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,\n    101,116,117,114,110, 32,102, 58,114,101, 97,100, 40,117,110,\n    112, 97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100, 10,\n     10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,101,\n     32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99, 97,108, 32,\n    102, 32, 61, 32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,105,\n    102, 32,114, 97,119,116,121,112,101, 40, 97,114,103, 91, 49,\n     93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,116, 97,\n     39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32, 61, 32,\n    116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,103, 44,\n     32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,101,116,\n    117,114,110, 32,102, 58,119,114,105,116,101, 40,117,110,112,\n     97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/compat.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 98, 97,115,105, 99,\n     32,117,116,105,108,105,116,121, 32,102,117,110, 99,116,105,\n    111,110,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32,\n     98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,\n    101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80,\n     85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49,\n     57, 57, 56, 10, 45, 45, 32, 76, 97,115,116, 32,117,112,100,\n     97,116,101, 58, 32, 65,112,114, 32, 50, 48, 48, 51, 10, 45,\n     45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,\n    105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101,\n     32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32,\n     99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,\n    101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,\n    105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,\n    115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,\n    101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115,\n     32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32,\n     98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,\n    104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,\n    111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111,\n     32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,\n    110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44,\n     32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,\n    104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,\n    109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10,\n     10, 10, 45, 45, 32, 66, 97,115,105, 99, 32, 67, 32,116,121,\n    112,101,115, 32, 97,110,100, 32,116,104,101,105,114, 32, 99,\n    111,114,114,101,115,112,111,110,100,105,110,103, 32, 76,117,\n     97, 32,116,121,112,101,115, 10, 45, 45, 32, 65,108,108, 32,\n    111, 99, 99,117,114,114,101,110, 99,101,115, 32,111,102, 32,\n     34, 99,104, 97,114, 42, 34, 32,119,105,108,108, 32, 98,101,\n     32,114,101,112,108, 97, 99,101,100, 32, 98,121, 32, 34, 95,\n     99,115,116,114,105,110,103, 34, 44, 10, 45, 45, 32, 97,110,\n    100, 32, 97,108,108, 32,111, 99, 99,117,114,114,101,110, 99,\n    101,115, 32,111,102, 32, 34,118,111,105,100, 42, 34, 32,119,\n    105,108,108, 32, 98,101, 32,114,101,112,108, 97, 99,101,100,\n     32, 98,121, 32, 34, 95,117,115,101,114,100, 97,116, 97, 34,\n     10, 95, 98, 97,115,105, 99, 32, 61, 32,123, 10, 32, 91, 39,\n    118,111,105,100, 39, 93, 32, 61, 32, 39, 39, 44, 10, 32, 91,\n     39, 99,104, 97,114, 39, 93, 32, 61, 32, 39,110,117,109, 98,\n    101,114, 39, 44, 10, 32, 91, 39,105,110,116, 39, 93, 32, 61,\n     32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,115,\n    104,111,114,116, 39, 93, 32, 61, 32, 39,110,117,109, 98,101,\n    114, 39, 44, 10, 32, 91, 39,108,111,110,103, 39, 93, 32, 61,\n     32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,117,\n    110,115,105,103,110,101,100, 39, 93, 32, 61, 32, 39,110,117,\n    109, 98,101,114, 39, 44, 10, 32, 91, 39,102,108,111, 97,116,\n     39, 93, 32, 61, 32, 39,110,117,109, 98,101,114, 39, 44, 10,\n     32, 91, 39,100,111,117, 98,108,101, 39, 93, 32, 61, 32, 39,\n    110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39, 95, 99,115,\n    116,114,105,110,103, 39, 93, 32, 61, 32, 39,115,116,114,105,\n    110,103, 39, 44, 10, 32, 91, 39, 95,117,115,101,114,100, 97,\n    116, 97, 39, 93, 32, 61, 32, 39,117,115,101,114,100, 97,116,\n     97, 39, 44, 10, 32, 91, 39, 99,104, 97,114, 42, 39, 93, 32,\n     61, 32, 39,115,116,114,105,110,103, 39, 44, 10, 32, 91, 39,\n    118,111,105,100, 42, 39, 93, 32, 61, 32, 39,117,115,101,114,\n    100, 97,116, 97, 39, 44, 10, 32, 91, 39, 98,111,111,108, 39,\n     93, 32, 61, 32, 39, 98,111,111,108,101, 97,110, 39, 44, 10,\n     32, 91, 39,108,117, 97, 95, 79, 98,106,101, 99,116, 39, 93,\n     32, 61, 32, 39,118, 97,108,117,101, 39, 44, 10, 32, 91, 39,\n     76, 85, 65, 95, 86, 65, 76, 85, 69, 39, 93, 32, 61, 32, 39,\n    118, 97,108,117,101, 39, 44, 32, 32, 32, 32, 45, 45, 32,102,\n    111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,116,\n    121, 32,119,105,116,104, 32,116,111,108,117, 97, 32, 52, 46,\n     48, 10, 32, 91, 39,108,117, 97, 95, 83,116, 97,116,101, 42,\n     39, 93, 32, 61, 32, 39,115,116, 97,116,101, 39, 44, 10, 32,\n     91, 39, 95,108,115,116, 97,116,101, 39, 93, 32, 61, 32, 39,\n    115,116, 97,116,101, 39, 44, 10, 32, 91, 39,108,117, 97, 95,\n     70,117,110, 99,116,105,111,110, 39, 93, 32, 61, 32, 39,118,\n     97,108,117,101, 39, 44, 10,125, 10, 10, 95, 98, 97,115,105,\n     99, 95, 99,116,121,112,101, 32, 61, 32,123, 10, 32,110,117,\n    109, 98,101,114, 32, 61, 32, 34,108,117, 97, 95, 78,117,109,\n     98,101,114, 34, 44, 10, 32,115,116,114,105,110,103, 32, 61,\n     32, 34, 99,111,110,115,116, 32, 99,104, 97,114, 42, 34, 44,\n     10, 32,117,115,101,114,100, 97,116, 97, 32, 61, 32, 34,118,\n    111,105,100, 42, 34, 44, 10, 32, 98,111,111,108,101, 97,110,\n     32, 61, 32, 34, 98,111,111,108, 34, 44, 10, 32,118, 97,108,\n    117,101, 32, 61, 32, 34,105,110,116, 34, 44, 10, 32,115,116,\n     97,116,101, 32, 61, 32, 34,108,117, 97, 95, 83,116, 97,116,\n    101, 42, 34, 44, 10,125, 10, 10, 45, 45, 32,102,117,110, 99,\n    116,105,111,110,115, 32,116,104,101, 32, 97,114,101, 32,117,\n    115,101,100, 32,116,111, 32,100,111, 32, 97, 32, 39,114, 97,\n    119, 32,112,117,115,104, 39, 32,111,102, 32, 98, 97,115,105,\n     99, 32,116,121,112,101,115, 10, 95, 98, 97,115,105, 99, 95,\n    114, 97,119, 95,112,117,115,104, 32, 61, 32,123,125, 10, 10,\n     45, 45, 32, 76,105,115,116, 32,111,102, 32,117,115,101,114,\n     32,100,101,102,105,110,101,100, 32,116,121,112,101,115, 10,\n     45, 45, 32, 69, 97, 99,104, 32,116,121,112,101, 32, 99,111,\n    114,114,101,115,112,111,110,100,115, 32,116,111, 32, 97, 32,\n    118, 97,114,105, 97, 98,108,101, 32,110, 97,109,101, 32,116,\n    104, 97,116, 32,115,116,111,114,101,115, 32,105,116,115, 32,\n    116, 97,103, 32,118, 97,108,117,101, 46, 10, 95,117,115,101,\n    114,116,121,112,101, 32, 61, 32,123,125, 10, 10, 45, 45, 32,\n     76,105,115,116, 32,111,102, 32,116,121,112,101,115, 32,116,\n    104, 97,116, 32,104, 97,118,101, 32,116,111, 32, 98,101, 32,\n     99,111,108,108,101, 99,116,101,100, 10, 95, 99,111,108,108,\n    101, 99,116, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105,\n    115,116, 32,111,102, 32,116,121,112,101,115, 10, 95,103,108,\n    111, 98, 97,108, 95,116,121,112,101,115, 32, 61, 32,123,110,\n     61, 48,125, 10, 95,103,108,111, 98, 97,108, 95,116,121,112,\n    101,115, 95,104, 97,115,104, 32, 61, 32,123,125, 10, 10, 45,\n     45, 32,108,105,115,116, 32,111,102, 32, 99,108, 97,115,115,\n    101,115, 10, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,\n    115,101,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105,\n    115,116, 32,111,102, 32,101,110,117,109, 32, 99,111,110,115,\n    116, 97,110,116,115, 10, 95,103,108,111, 98, 97,108, 95,101,\n    110,117,109,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,\n    105,115,116, 32,111,102, 32, 97,117,116,111, 32,114,101,110,\n     97,109,105,110,103, 10, 95,114,101,110, 97,109,105,110,103,\n     32, 61, 32,123,125, 10,102,117,110, 99,116,105,111,110, 32,\n     97,112,112,101,110,100,114,101,110, 97,109,105,110,103, 32,\n     40,115, 41, 10, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    111,108,100, 44,110,101,119, 32, 61, 32,115,116,114,102,105,\n    110,100, 40,115, 44, 34, 37,115, 42, 40, 46, 45, 41, 37,115,\n     42, 64, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 36, 34, 41,\n     10,  9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110,\n     10,  9, 32,101,114,114,111,114, 40, 34, 35, 73,110,118, 97,\n    108,105,100, 32,114,101,110, 97,109,105,110,103, 32,115,121,\n    110,116, 97,120, 59, 32,105,116, 32,115,104,111,117,108,100,\n     32, 98,101, 32,111,102, 32,116,104,101, 32,102,111,114,109,\n     58, 32,112, 97,116,116,101,114,110, 64,112, 97,116,116,101,\n    114,110, 34, 41, 10,  9,101,110,100, 10,  9,116,105,110,115,\n    101,114,116, 40, 95,114,101,110, 97,109,105,110,103, 44,123,\n    111,108,100, 61,111,108,100, 44, 32,110,101,119, 61,110,101,\n    119,125, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,\n    111,110, 32, 97,112,112,108,121,114,101,110, 97,109,105,110,\n    103, 32, 40,115, 41, 10,  9,102,111,114, 32,105, 61, 49, 44,\n    103,101,116,110, 40, 95,114,101,110, 97,109,105,110,103, 41,\n     32,100,111, 10,  9, 32,108,111, 99, 97,108, 32,109, 44,110,\n     32, 61, 32,103,115,117, 98, 40,115, 44, 95,114,101,110, 97,\n    109,105,110,103, 91,105, 93, 46,111,108,100, 44, 95,114,101,\n    110, 97,109,105,110,103, 91,105, 93, 46,110,101,119, 41, 10,\n      9,  9,105,102, 32,110, 32,126, 61, 32, 48, 32,116,104,101,\n    110, 10,  9,  9, 32,114,101,116,117,114,110, 32,109, 10,  9,\n      9,101,110,100, 10,  9,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32,110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,\n     69,114,114,111,114, 32,104, 97,110,100,108,101,114, 10,102,\n    117,110, 99,116,105,111,110, 32,116,111,108,117, 97, 95,101,\n    114,114,111,114, 32, 40,115, 44,102, 41, 10,105,102, 32, 95,\n     99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110, 10,\n      9,112,114,105,110,116, 40, 34, 42, 42, 42, 99,117,114,114,\n     32, 99,111,100,101, 32,102,111,114, 32,101,114,114,111,114,\n     32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103,\n     40, 95, 99,117,114,114, 95, 99,111,100,101, 41, 41, 10,  9,\n    112,114,105,110,116, 40,100,101, 98,117,103, 46,116,114, 97,\n     99,101, 98, 97, 99,107, 40, 41, 41, 10,101,110,100, 10, 32,\n    108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79, 85,\n     84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61,\n     32, 95, 83, 84, 68, 69, 82, 82, 10, 32,105,102, 32,115,116,\n    114,115,117, 98, 40,115, 44, 49, 44, 49, 41, 32, 61, 61, 32,\n     39, 35, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,\n    101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 58, 32,\n     34, 46, 46,115,116,114,115,117, 98, 40,115, 44, 50, 41, 46,\n     46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 32,105,102, 32,\n     95, 99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110,\n     10, 32, 32, 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,115,\n     32, 61, 32,115,116,114,102,105,110,100, 40, 95, 99,117,114,\n    114, 95, 99,111,100,101, 44, 34, 94, 37,115, 42, 40, 46, 45,\n     92,110, 41, 34, 41, 32, 45, 45, 32,101,120,116,114, 97, 99,\n    116, 32,102,105,114,115,116, 32,108,105,110,101, 10, 32, 32,\n     32,105,102, 32,115, 61, 61,110,105,108, 32,116,104,101,110,\n     32,115, 32, 61, 32, 95, 99,117,114,114, 95, 99,111,100,101,\n     32,101,110,100, 10, 32, 32, 32,115, 32, 61, 32,103,115,117,\n     98, 40,115, 44, 34, 95,117,115,101,114,100, 97,116, 97, 34,\n     44, 34,118,111,105,100, 42, 34, 41, 32, 45, 45, 32,114,101,\n    116,117,114,110, 32,119,105,116,104, 32, 39,118,111,105,100,\n     42, 39, 10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,\n    115, 44, 34, 95, 99,115,116,114,105,110,103, 34, 44, 34, 99,\n    104, 97,114, 42, 34, 41, 32, 32, 45, 45, 32,114,101,116,117,\n    114,110, 32,119,105,116,104, 32, 39, 99,104, 97,114, 42, 39,\n     10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,\n     34, 95,108,115,116, 97,116,101, 34, 44, 34,108,117, 97, 95,\n     83,116, 97,116,101, 42, 34, 41, 32, 32, 45, 45, 32,114,101,\n    116,117,114,110, 32,119,105,116,104, 32, 39,108,117, 97, 95,\n     83,116, 97,116,101, 42, 39, 10, 32, 32, 32,119,114,105,116,\n    101, 40, 34, 67,111,100,101, 32, 98,101,105,110,103, 32,112,\n    114,111, 99,101,115,115,101,100, 58, 92,110, 34, 46, 46,115,\n     46, 46, 34, 92,110, 34, 41, 10, 32, 32,101,110,100, 10, 32,\n    101,108,115,101, 10, 32,105,102, 32,110,111,116, 32,102, 32,\n    116,104,101,110, 32,102, 32, 61, 32, 34, 40,102, 32,105,115,\n     32,110,105,108, 41, 34, 32,101,110,100, 10, 32, 32,112,114,\n    105,110,116, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97,\n     32,105,110,116,101,114,110, 97,108, 32,101,114,114,111,114,\n     58, 32, 34, 46, 46,102, 46, 46,115, 46, 46, 34, 46, 92,110,\n     92,110, 34, 41, 10, 32, 32,114,101,116,117,114,110, 10, 32,\n    101,110,100, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,\n    111,117,116, 10,101,110,100, 10, 10,102,117,110, 99,116,105,\n    111,110, 32,119, 97,114,110,105,110,103, 32, 40,109,115,103,\n     41, 10, 32,105,102, 32,102,108, 97,103,115, 46,113, 32,116,\n    104,101,110, 32,114,101,116,117,114,110, 32,101,110,100, 10,\n     32,108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79,\n     85, 84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32,\n     61, 32, 95, 83, 84, 68, 69, 82, 82, 10, 32,119,114,105,116,\n    101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 32,119,\n     97,114,110,105,110,103, 58, 32, 34, 46, 46,109,115,103, 46,\n     46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 95, 79, 85, 84,\n     80, 85, 84, 32, 61, 32,111,117,116, 10,101,110,100, 10, 10,\n     45, 45, 32,114,101,103,105,115,116,101,114, 32, 97,110, 32,\n    117,115,101,114, 32,100,101,102,105,110,101,100, 32,116,121,\n    112,101, 58, 32,114,101,116,117,114,110,115, 32,102,117,108,\n    108, 32,116,121,112,101, 10,102,117,110, 99,116,105,111,110,\n     32,114,101,103,116,121,112,101, 32, 40,116, 41, 10,  9, 45,\n     45,105,102, 32,105,115, 98, 97,115,105, 99, 40,116, 41, 32,\n    116,104,101,110, 10,  9, 45, 45,  9,114,101,116,117,114,110,\n     32,116, 10,  9, 45, 45,101,110,100, 10,  9,108,111, 99, 97,\n    108, 32,102,116, 32, 61, 32,102,105,110,100,116,121,112,101,\n     40,116, 41, 10, 10,  9,105,102, 32,110,111,116, 32, 95,117,\n    115,101,114,116,121,112,101, 91,102,116, 93, 32,116,104,101,\n    110, 10,  9,  9,114,101,116,117,114,110, 32, 97,112,112,101,\n    110,100,117,115,101,114,116,121,112,101, 40,116, 41, 10,  9,\n    101,110,100, 10,  9,114,101,116,117,114,110, 32,102,116, 10,\n    101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, 32,\n    116,121,112,101, 32,110, 97,109,101, 58, 32,114,101,116,117,\n    114,110,115, 32,102,117,108,108, 32,116,121,112,101, 10,102,\n    117,110, 99,116,105,111,110, 32,116,121,112,101,118, 97,114,\n     40,116,121,112,101, 41, 10,  9,105,102, 32,116,121,112,101,\n     32, 61, 61, 32, 39, 39, 32,111,114, 32,116,121,112,101, 32,\n     61, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10,\n      9,  9,114,101,116,117,114,110, 32,116,121,112,101, 10,  9,\n    101,108,115,101, 10,  9,  9,108,111, 99, 97,108, 32,102,116,\n     32, 61, 32,102,105,110,100,116,121,112,101, 40,116,121,112,\n    101, 41, 10,  9,  9,105,102, 32,102,116, 32,116,104,101,110,\n     10,  9,  9,  9,114,101,116,117,114,110, 32,102,116, 10,  9,\n      9,101,110,100, 10,  9,  9, 95,117,115,101,114,116,121,112,\n    101, 91,116,121,112,101, 93, 32, 61, 32,116,121,112,101, 10,\n      9,  9,114,101,116,117,114,110, 32,116,121,112,101, 10,  9,\n    101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101,\n     99,107, 32,105,102, 32, 98, 97,115,105, 99, 32,116,121,112,\n    101, 10,102,117,110, 99,116,105,111,110, 32,105,115, 98, 97,\n    115,105, 99, 32, 40,116,121,112,101, 41, 10, 32,108,111, 99,\n     97,108, 32,116, 32, 61, 32,103,115,117, 98, 40,116,121,112,\n    101, 44, 39, 99,111,110,115,116, 32, 39, 44, 39, 39, 41, 10,\n     32,108,111, 99, 97,108, 32,109, 44,116, 32, 61, 32, 97,112,\n    112,108,121,116,121,112,101,100,101,102, 40, 39, 39, 44, 32,\n    116, 41, 10, 32,108,111, 99, 97,108, 32, 98, 32, 61, 32, 95,\n     98, 97,115,105, 99, 91,116, 93, 10, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 98,\n     44, 95, 98, 97,115,105, 99, 95, 99,116,121,112,101, 91, 98,\n     93, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, 32,\n    110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,115,112,108,\n    105,116, 32,115,116,114,105,110,103, 32,117,115,105,110,103,\n     32, 97, 32,116,111,107,101,110, 10,102,117,110, 99,116,105,\n    111,110, 32,115,112,108,105,116, 32, 40,115, 44,116, 41, 10,\n     32,108,111, 99, 97,108, 32,108, 32, 61, 32,123,110, 61, 48,\n    125, 10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32,102,117,\n    110, 99,116,105,111,110, 32, 40,115, 41, 10, 32, 32,108, 46,\n    110, 32, 61, 32,108, 46,110, 32, 43, 32, 49, 10, 32, 32,108,\n     91,108, 46,110, 93, 32, 61, 32,115, 10, 32, 32,114,101,116,\n    117,114,110, 32, 34, 34, 10, 32,101,110,100, 10, 32,108,111,\n     99, 97,108, 32,112, 32, 61, 32, 34, 37,115, 42, 40, 46, 45,\n     41, 37,115, 42, 34, 46, 46,116, 46, 46, 34, 37,115, 42, 34,\n     10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 94,\n     37,115, 43, 34, 44, 34, 34, 41, 10, 32,115, 32, 61, 32,103,\n    115,117, 98, 40,115, 44, 34, 37,115, 43, 36, 34, 44, 34, 34,\n     41, 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,112,\n     44,102, 41, 10, 32,108, 46,110, 32, 61, 32,108, 46,110, 32,\n     43, 32, 49, 10, 32,108, 91,108, 46,110, 93, 32, 61, 32,103,\n    115,117, 98, 40,115, 44, 34, 40, 37,115, 37,115, 42, 41, 36,\n     34, 44, 34, 34, 41, 10, 32,114,101,116,117,114,110, 32,108,\n     10,101,110,100, 10, 10, 45, 45, 32,115,112,108,105,116,115,\n     32, 97, 32,115,116,114,105,110,103, 32,117,115,105,110,103,\n     32, 97, 32,112, 97,116,116,101,114,110, 44, 32, 99,111,110,\n    115,105,100,101,114,105,110,103, 32,116,104,101, 32,115,112,\n     97, 99,105, 97,108, 32, 99, 97,115,101,115, 32,111,102, 32,\n     67, 32, 99,111,100,101, 32, 40,116,101,109,112,108, 97,116,\n    101,115, 44, 32,102,117,110, 99,116,105,111,110, 32,112, 97,\n    114, 97,109,101,116,101,114,115, 44, 32,101,116, 99, 41, 10,\n     45, 45, 32,112, 97,116,116,101,114,110, 32, 99, 97,110, 39,\n    116, 32, 99,111,110,116, 97,105,110, 32,116,104,101, 32, 39,\n     94, 39, 32, 40, 97,115, 32,117,115,101,100, 32,116,111, 32,\n    105,100,101,110,116,105,102,121, 32,116,104,101, 32, 98,101,\n    103,105,110,105,110,103, 32,111,102, 32,116,104,101, 32,108,\n    105,110,101, 41, 10, 45, 45, 32, 97,108,115,111, 32,115,116,\n    114,105,112,115, 32,119,104,105,116,101,115,112, 97, 99,101,\n     10,102,117,110, 99,116,105,111,110, 32,115,112,108,105,116,\n     95, 99, 95,116,111,107,101,110,115, 40,115, 44, 32,112, 97,\n    116, 41, 10, 10,  9,115, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,115, 44, 32, 34, 94, 37,115, 42, 34,\n     44, 32, 34, 34, 41, 10,  9,115, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 37,115, 42,\n     36, 34, 44, 32, 34, 34, 41, 10, 10,  9,108,111, 99, 97,108,\n     32,116,111,107,101,110, 95, 98,101,103,105,110, 32, 61, 32,\n     49, 10,  9,108,111, 99, 97,108, 32,116,111,107,101,110, 95,\n    101,110,100, 32, 61, 32, 49, 10,  9,108,111, 99, 97,108, 32,\n    111,102,115, 32, 61, 32, 49, 10,  9,108,111, 99, 97,108, 32,\n    114,101,116, 32, 61, 32,123,110, 61, 48,125, 10, 10,  9,102,\n    117,110, 99,116,105,111,110, 32, 97,100,100, 95,116,111,107,\n    101,110, 40,111,102,115, 41, 10, 10,  9,  9,108,111, 99, 97,\n    108, 32,116, 32, 61, 32,115,116,114,105,110,103, 46,115,117,\n     98, 40,115, 44, 32,116,111,107,101,110, 95, 98,101,103,105,\n    110, 44, 32,111,102,115, 41, 10,  9,  9,116, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34,\n     94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,  9,116, 32,\n     61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,\n     44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,\n      9,114,101,116, 46,110, 32, 61, 32,114,101,116, 46,110, 32,\n     43, 32, 49, 10,  9,  9,114,101,116, 91,114,101,116, 46,110,\n     93, 32, 61, 32,116, 10,  9,101,110,100, 10, 10,  9,119,104,\n    105,108,101, 32,111,102,115, 32, 60, 61, 32,115,116,114,105,\n    110,103, 46,108,101,110, 40,115, 41, 32,100,111, 10, 10,  9,\n      9,108,111, 99, 97,108, 32,115,117, 98, 32, 61, 32,115,116,\n    114,105,110,103, 46,115,117, 98, 40,115, 44, 32,111,102,115,\n     44, 32, 45, 49, 41, 10,  9,  9,108,111, 99, 97,108, 32, 98,\n     44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,\n    100, 40,115,117, 98, 44, 32, 34, 94, 34, 46, 46,112, 97,116,\n     41, 10,  9,  9,105,102, 32, 98, 32,116,104,101,110, 10,  9,\n      9,  9, 97,100,100, 95,116,111,107,101,110, 40,111,102,115,\n     45, 49, 41, 10,  9,  9,  9,111,102,115, 32, 61, 32,111,102,\n    115, 43,101, 10,  9,  9,  9,116,111,107,101,110, 95, 98,101,\n    103,105,110, 32, 61, 32,111,102,115, 10,  9,  9,101,108,115,\n    101, 10,  9,  9,  9,108,111, 99, 97,108, 32, 99,104, 97,114,\n     32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115,\n     44, 32,111,102,115, 44, 32,111,102,115, 41, 10,  9,  9,  9,\n    105,102, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32,\n    111,114, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 60, 34, 32,\n    116,104,101,110, 10, 10,  9,  9,  9,  9,108,111, 99, 97,108,\n     32, 98,108,111, 99,107, 10,  9,  9,  9,  9,105,102, 32, 99,\n    104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32,116,104,101,110,\n     32, 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 40, 41,\n     34, 32,101,110,100, 10,  9,  9,  9,  9,105,102, 32, 99,104,\n     97,114, 32, 61, 61, 32, 34, 60, 34, 32,116,104,101,110, 32,\n     98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 60, 62, 34,\n     32,101,110,100, 10, 10,  9,  9,  9,  9, 98, 44,101, 32, 61,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,117,\n     98, 44, 32, 98,108,111, 99,107, 41, 10,  9,  9,  9,  9,105,\n    102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,  9,  9,\n      9,  9,  9, 45, 45, 32,117,110,116,101,114,109,105,110, 97,\n    116,101,100, 32, 98,108,111, 99,107, 63, 10,  9,  9,  9,  9,\n      9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10,  9,  9,\n      9,  9,101,108,115,101, 10,  9,  9,  9,  9,  9,111,102,115,\n     32, 61, 32,111,102,115, 32, 43, 32,101, 10,  9,  9,  9,  9,\n    101,110,100, 10, 10,  9,  9,  9,101,108,115,101, 10,  9,  9,\n      9,  9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10,  9,\n      9,  9,101,110,100, 10,  9,  9,101,110,100, 10, 10,  9,101,\n    110,100, 10,  9, 97,100,100, 95,116,111,107,101,110, 40,111,\n    102,115, 41, 10,  9, 45, 45,105,102, 32,114,101,116, 46,110,\n     32, 61, 61, 32, 48, 32,116,104,101,110, 10, 10,  9, 45, 45,\n      9,114,101,116, 46,110, 61, 49, 10,  9, 45, 45,  9,114,101,\n    116, 91, 49, 93, 32, 61, 32, 34, 34, 10,  9, 45, 45,101,110,\n    100, 10, 10,  9,114,101,116,117,114,110, 32,114,101,116, 10,\n     10,101,110,100, 10, 10, 45, 45, 32, 99,111,110, 99, 97,116,\n    101,110, 97,116,101, 32,115,116,114,105,110,103,115, 32,111,\n    102, 32, 97, 32,116, 97, 98,108,101, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,111,110, 99, 97,116, 32, 40,116, 44,102,\n     44,108, 44,106,115,116,114, 41, 10,  9,106,115,116,114, 32,\n     61, 32,106,115,116,114, 32,111,114, 32, 34, 32, 34, 10, 32,\n    108,111, 99, 97,108, 32,115, 32, 61, 32, 39, 39, 10, 32,108,\n    111, 99, 97,108, 32,105, 61,102, 10, 32,119,104,105,108,101,\n     32,105, 60, 61,108, 32,100,111, 10, 32, 32,115, 32, 61, 32,\n    115, 46, 46,116, 91,105, 93, 10, 32, 32,105, 32, 61, 32,105,\n     43, 49, 10, 32, 32,105,102, 32,105, 32, 60, 61, 32,108, 32,\n    116,104,101,110, 32,115, 32, 61, 32,115, 46, 46,106,115,116,\n    114, 32,101,110,100, 10, 32,101,110,100, 10, 32,114,101,116,\n    117,114,110, 32,115, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n    111,110, 99, 97,116,101,110, 97,116,101, 32, 97,108,108, 32,\n    112, 97,114, 97,109,101,116,101,114,115, 44, 32,102,111,108,\n    108,111,119,105,110,103, 32,111,117,116,112,117,116, 32,114,\n    117,108,101,115, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    111,110, 99, 97,116,112, 97,114, 97,109, 32, 40,108,105,110,\n    101, 44, 32, 46, 46, 46, 41, 10, 32,108,111, 99, 97,108, 32,\n    105, 61, 49, 10, 32,119,104,105,108,101, 32,105, 60, 61, 97,\n    114,103, 46,110, 32,100,111, 10, 32, 32,105,102, 32, 95, 99,\n    111,110,116, 32, 97,110,100, 32,110,111,116, 32,115,116,114,\n    102,105,110,100, 40, 95, 99,111,110,116, 44, 39, 91, 37, 40,\n     44, 34, 93, 39, 41, 32, 97,110,100, 10, 32, 32, 32, 32, 32,\n    115,116,114,102,105,110,100, 40, 97,114,103, 91,105, 93, 44,\n     34, 94, 91, 37, 97, 95,126, 93, 34, 41, 32,116,104,101,110,\n     10,  9, 32, 32, 32, 32,108,105,110,101, 32, 61, 32,108,105,\n    110,101, 32, 46, 46, 32, 39, 32, 39, 10, 32, 32,101,110,100,\n     10, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32,\n     46, 46, 32, 97,114,103, 91,105, 93, 10, 32, 32,105,102, 32,\n     97,114,103, 91,105, 93, 32,126, 61, 32, 39, 39, 32,116,104,\n    101,110, 10, 32, 32, 32, 95, 99,111,110,116, 32, 61, 32,115,\n    116,114,115,117, 98, 40, 97,114,103, 91,105, 93, 44, 45, 49,\n     44, 45, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,105,102, 32,\n    115,116,114,102,105,110,100, 40, 97,114,103, 91, 97,114,103,\n     46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37, 59, 37,123, 37,\n    125, 93, 36, 34, 41, 32,116,104,101,110, 10, 32, 32, 95, 99,\n    111,110,116, 61,110,105,108, 32,108,105,110,101, 32, 61, 32,\n    108,105,110,101, 32, 46, 46, 32, 39, 92,110, 39, 10, 32,101,\n    110,100, 10,  9,114,101,116,117,114,110, 32,108,105,110,101,\n     10,101,110,100, 10, 10, 45, 45, 32,111,117,116,112,117,116,\n     32,108,105,110,101, 10,102,117,110, 99,116,105,111,110, 32,\n    111,117,116,112,117,116, 32, 40, 46, 46, 46, 41, 10, 32,108,\n    111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101,\n     32,105, 60, 61, 97,114,103, 46,110, 32,100,111, 10, 32, 32,\n    105,102, 32, 95, 99,111,110,116, 32, 97,110,100, 32,110,111,\n    116, 32,115,116,114,102,105,110,100, 40, 95, 99,111,110,116,\n     44, 39, 91, 37, 40, 44, 34, 93, 39, 41, 32, 97,110,100, 10,\n     32, 32, 32, 32, 32,115,116,114,102,105,110,100, 40, 97,114,\n    103, 91,105, 93, 44, 34, 94, 91, 37, 97, 95,126, 93, 34, 41,\n     32,116,104,101,110, 10,  9, 32, 32, 32, 32,119,114,105,116,\n    101, 40, 39, 32, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32,\n    119,114,105,116,101, 40, 97,114,103, 91,105, 93, 41, 10, 32,\n     32,105,102, 32, 97,114,103, 91,105, 93, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,111,110,116,\n     32, 61, 32,115,116,114,115,117, 98, 40, 97,114,103, 91,105,\n     93, 44, 45, 49, 44, 45, 49, 41, 10, 32, 32,101,110,100, 10,\n     32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,\n     32,105,102, 32,115,116,114,102,105,110,100, 40, 97,114,103,\n     91, 97,114,103, 46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37,\n     59, 37,123, 37,125, 93, 36, 34, 41, 32,116,104,101,110, 10,\n     32, 32, 95, 99,111,110,116, 61,110,105,108, 32,119,114,105,\n    116,101, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101,\n    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,103,101,\n    116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104,\n    111,100,115, 40,112,116,121,112,101, 44, 32,110, 97,109,101,\n     41, 10, 10,  9,105,102, 32,103,101,116, 95,112,114,111,112,\n    101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111,\n    111,107, 32, 97,110,100, 32,103,101,116, 95,112,114,111,112,\n    101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111,\n    111,107, 40,112,116,121,112,101, 44,110, 97,109,101, 41, 32,\n    116,104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,103,\n    101,116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,\n    104,111,100,115, 95,104,111,111,107, 40,112,116,121,112,101,\n     44, 32,110, 97,109,101, 41, 10,  9,101,110,100, 10, 10,  9,\n    105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,100,101,\n    102, 97,117,108,116, 34, 32,116,104,101,110, 32, 45, 45, 32,\n    103,101,116, 95,110, 97,109,101, 44, 32,115,101,116, 95,110,\n     97,109,101, 10,  9,  9,114,101,116,117,114,110, 32, 34,103,\n    101,116, 95, 34, 46, 46,110, 97,109,101, 44, 32, 34,115,101,\n    116, 95, 34, 46, 46,110, 97,109,101, 10,  9,101,110,100, 10,\n     10,  9,105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,\n    113,116, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97,109,\n    101, 44, 32,115,101,116, 78, 97,109,101, 10,  9,  9,114,101,\n    116,117,114,110, 32,110, 97,109,101, 44, 32, 34,115,101,116,\n     34, 46, 46,115,116,114,105,110,103, 46,117,112,112,101,114,\n     40,115,116,114,105,110,103, 46,115,117, 98, 40,110, 97,109,\n    101, 44, 32, 49, 44, 32, 49, 41, 41, 46, 46,115,116,114,105,\n    110,103, 46,115,117, 98, 40,110, 97,109,101, 44, 32, 50, 44,\n     32, 45, 49, 41, 10,  9,101,110,100, 10, 10,  9,105,102, 32,\n    112,116,121,112,101, 32, 61, 61, 32, 34,111,118,101,114,108,\n    111, 97,100, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97,\n    109,101, 44, 32,110, 97,109,101, 10,  9,  9,114,101,116,117,\n    114,110, 32,110, 97,109,101, 44,110, 97,109,101, 10,  9,101,\n    110,100, 10, 10,  9,114,101,116,117,114,110, 32,110,105,108,\n     10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 32,116,104,101, 32,104,111,111,107,115,\n     10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32,114,105,103,\n    104,116, 32, 97,102,116,101,114, 32,112,114,111, 99,101,115,\n    115,105,110,103, 32,116,104,101, 32, 36, 91,105, 99,104,108,\n     93,102,105,108,101, 32,100,105,114,101, 99,116,105,118,101,\n    115, 44, 10, 45, 45, 32,114,105,103,104,116, 32, 98,101,102,\n    111,114,101, 32,112,114,111, 99,101,115,115,105,110,103, 32,\n     97,110,121,116,104,105,110,103, 32,101,108,115,101, 10, 45,\n     45, 32,116, 97,107,101,115, 32,116,104,101, 32,112, 97, 99,\n    107, 97,103,101, 32,111, 98,106,101, 99,116, 32, 97,115, 32,\n    116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 10,102,\n    117,110, 99,116,105,111,110, 32,112,114,101,112,114,111, 99,\n    101,115,115, 95,104,111,111,107, 40,112, 41, 10,  9, 45, 45,\n     32,112, 46, 99,111,100,101, 32,104, 97,115, 32, 97,108,108,\n     32,116,104,101, 32,105,110,112,117,116, 32, 99,111,100,101,\n     32,102,114,111,109, 32,116,104,101, 32,112,107,103, 10,101,\n    110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32,\n    102,111,114, 32,101,118,101,114,121, 32, 36,105,102,105,108,\n    101, 32,100,105,114,101, 99,116,105,118,101, 10, 45, 45, 32,\n    116, 97,107,101,115, 32, 97, 32,116, 97, 98,108,101, 32,119,\n    105,116,104, 32, 97, 32,115,116,114,105,110,103, 32, 99, 97,\n    108,108,101,100, 32, 39, 99,111,100,101, 39, 32,105,110,115,\n    105,100,101, 44, 32,116,104,101, 32,102,105,108,101,110, 97,\n    109,101, 44, 32, 97,110,100, 32, 97,110,121, 32,101,120,116,\n    114, 97, 32, 97,114,103,117,109,101,110,116,115, 10, 45, 45,\n     32,112, 97,115,115,101,100, 32,116,111, 32, 36,105,102,105,\n    108,101, 46, 32,110,111, 32,114,101,116,117,114,110, 32,118,\n     97,108,117,101, 10,102,117,110, 99,116,105,111,110, 32,105,\n    110, 99,108,117,100,101, 95,102,105,108,101, 95,104,111,111,\n    107, 40,116, 44, 32,102,105,108,101,110, 97,109,101, 44, 32,\n     46, 46, 46, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n     97,108,108,101,100, 32, 97,102,116,101,114, 32,112,114,111,\n     99,101,115,115,105,110,103, 32, 97,110,121,116,104,105,110,\n    103, 32,116,104, 97,116, 39,115, 32,110,111,116, 32, 99,111,\n    100,101, 32, 40,108,105,107,101, 32, 39, 36,114,101,110, 97,\n    109,105,110,103, 39, 44, 32, 99,111,109,109,101,110,116,115,\n     44, 32,101,116, 99, 41, 10, 45, 45, 32, 97,110,100, 32,114,\n    105,103,104,116, 32, 98,101,102,111,114,101, 32,112, 97,114,\n    115,105,110,103, 32,116,104,101, 32, 97, 99,116,117, 97,108,\n     32, 99,111,100,101, 46, 10, 45, 45, 32,116, 97,107,101,115,\n     32,116,104,101, 32, 80, 97, 99,107, 97,103,101, 32,111, 98,\n    106,101, 99,116, 32,119,105,116,104, 32, 97,108,108, 32,116,\n    104,101, 32, 99,111,100,101, 32,111,110, 32,116,104,101, 32,\n     39, 99,111,100,101, 39, 32,107,101,121, 46, 32,110,111, 32,\n    114,101,116,117,114,110, 32,118, 97,108,117,101, 10,102,117,\n    110, 99,116,105,111,110, 32,112,114,101,112, 97,114,115,101,\n     95,104,111,111,107, 40,112, 97, 99,107, 97,103,101, 41, 10,\n     10,101,110,100, 10, 10, 45, 45, 32, 99, 97,108,108,101,100,\n     32, 98,101,102,111,114,101, 32,115,116, 97,114,116,105,110,\n    103, 32,111,117,116,112,117,116, 10,102,117,110, 99,116,105,\n    111,110, 32,112,114,101, 95,111,117,116,112,117,116, 95,104,\n    111,111,107, 40,112, 97, 99,107, 97,103,101, 41, 10, 10,101,\n    110,100, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32, 97,\n    102,116,101,114, 32,119,114,105,116,105,110,103, 32, 97,108,\n    108, 32,116,104,101, 32,111,117,116,112,117,116, 46, 10, 45,\n     45, 32,116, 97,107,101,115, 32,116,104,101, 32, 80, 97, 99,\n    107, 97,103,101, 32,111, 98,106,101, 99,116, 10,102,117,110,\n     99,116,105,111,110, 32,112,111,115,116, 95,111,117,116,112,\n    117,116, 95,104,111,111,107, 40,112, 97, 99,107, 97,103,101,\n     41, 10, 10,101,110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,\n    108,101,100, 32,102,114,111,109, 32, 39,103,101,116, 95,112,\n    114,111,112,101,114,116,121, 95,109,101,116,104,111,100,115,\n     39, 32,116,111, 32,103,101,116, 32,116,104,101, 32,109,101,\n    116,104,111,100,115, 32,116,111, 32,114,101,116,114,105,101,\n    118,101, 32, 97, 32,112,114,111,112,101,114,116,121, 10, 45,\n     45, 32, 97, 99, 99,111,114,100,105,110,103, 32,116,111, 32,\n    105,116,115, 32,116,121,112,101, 10,102,117,110, 99,116,105,\n    111,110, 32,103,101,116, 95,112,114,111,112,101,114,116,121,\n     95,109,101,116,104,111,100,115, 95,104,111,111,107, 40,112,\n    114,111,112,101,114,116,121, 95,116,121,112,101, 44, 32,110,\n     97,109,101, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n     97,108,108,101,100, 32,102,114,111,109, 32, 67,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 58,100,111,112, 97,\n    114,115,101, 32,119,105,116,104, 32,116,104,101, 32,115,116,\n    114,105,110,103, 32, 98,101,105,110,103, 32,112, 97,114,115,\n    101,100, 10, 45, 45, 32,114,101,116,117,114,110, 32,110,105,\n    108, 44, 32,111,114, 32, 97, 32,115,117, 98,115,116,114,105,\n    110,103, 10,102,117,110, 99,116,105,111,110, 32,112, 97,114,\n    115,101,114, 95,104,111,111,107, 40,115, 41, 10, 10,  9,114,\n    101,116,117,114,110, 32,110,105,108, 10,101,110,100, 10, 10,\n     45, 45, 32, 99, 97,108,108,101,100, 32,102,114,111,109, 32,\n     99,108, 97,115,115, 70,117,110, 99,116,105,111,110, 58,115,\n    117,112, 99,111,100,101, 44, 32, 98,101,102,111,114,101, 32,\n    116,104,101, 32, 99, 97,108,108, 32,116,111, 32,116,104,101,\n     32,102,117,110, 99,116,105,111,110, 32,105,115, 32,111,117,\n    116,112,117,116, 10,102,117,110, 99,116,105,111,110, 32,112,\n    114,101, 95, 99, 97,108,108, 95,104,111,111,107, 40,102, 41,\n     10, 10,101,110,100, 10, 10, 45, 45, 32, 99, 97,108,108,101,\n    100, 32,102,114,111,109, 32, 99,108, 97,115,115, 70,117,110,\n     99,116,105,111,110, 58,115,117,112, 99,111,100,101, 44, 32,\n     97,102,116,101,114, 32,116,104,101, 32, 99, 97,108,108, 32,\n    116,111, 32,116,104,101, 32,102,117,110, 99,116,105,111,110,\n     32,105,115, 32,111,117,116,112,117,116, 10,102,117,110, 99,\n    116,105,111,110, 32,112,111,115,116, 95, 99, 97,108,108, 95,\n    104,111,111,107, 40,102, 41, 10, 10,101,110,100, 10, 10, 45,\n     45, 32, 99, 97,108,108,101,100, 32, 98,101,102,111,114,101,\n     32,116,104,101, 32,114,101,103,105,115,116,101,114, 32, 99,\n    111,100,101, 32,105,115, 32,111,117,116,112,117,116, 10,102,\n    117,110, 99,116,105,111,110, 32,112,114,101, 95,114,101,103,\n    105,115,116,101,114, 95,104,111,111,107, 40,112, 97, 99,107,\n     97,103,101, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n     97,108,108,101,100, 32,116,111, 32,111,117,116,112,117,116,\n     32, 97,110, 32,101,114,114,111,114, 32,109,101,115,115, 97,\n    103,101, 10,102,117,110, 99,116,105,111,110, 32,111,117,116,\n    112,117,116, 95,101,114,114,111,114, 95,104,111,111,107, 40,\n     46, 46, 46, 41, 10,  9,114,101,116,117,114,110, 32,115,116,\n    114,105,110,103, 46,102,111,114,109, 97,116, 40, 46, 46, 46,\n     41, 10,101,110,100, 10, 10, 45, 45, 32, 99,117,115,116,111,\n    109, 32,112,117,115,104,101,114,115, 10, 10, 95,112,117,115,\n    104, 95,102,117,110, 99,116,105,111,110,115, 32, 61, 32,123,\n    125, 10, 95,105,115, 95,102,117,110, 99,116,105,111,110,115,\n     32, 61, 32,123,125, 10, 95,116,111, 95,102,117,110, 99,116,\n    105,111,110,115, 32, 61, 32,123,125, 10, 10, 95, 98, 97,115,\n    101, 95,112,117,115,104, 95,102,117,110, 99,116,105,111,110,\n    115, 32, 61, 32,123,125, 10, 95, 98, 97,115,101, 95,105,115,\n     95,102,117,110, 99,116,105,111,110,115, 32, 61, 32,123,125,\n     10, 95, 98, 97,115,101, 95,116,111, 95,102,117,110, 99,116,\n    105,111,110,115, 32, 61, 32,123,125, 10, 10,108,111, 99, 97,\n    108, 32,102,117,110, 99,116,105,111,110, 32,115,101, 97,114,\n     99,104, 95, 98, 97,115,101, 40,116, 44, 32,102,117,110, 99,\n    115, 41, 10, 10,  9,108,111, 99, 97,108, 32, 99,108, 97,115,\n    115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,\n    115,115,101,115, 91,116, 93, 10, 10,  9,119,104,105,108,101,\n     32, 99,108, 97,115,115, 32,100,111, 10,  9,  9,105,102, 32,\n    102,117,110, 99,115, 91, 99,108, 97,115,115, 46,116,121,112,\n    101, 93, 32,116,104,101,110, 10,  9,  9,  9,114,101,116,117,\n    114,110, 32,102,117,110, 99,115, 91, 99,108, 97,115,115, 46,\n    116,121,112,101, 93, 10,  9,  9,101,110,100, 10,  9,  9, 99,\n    108, 97,115,115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95,\n     99,108, 97,115,115,101,115, 91, 99,108, 97,115,115, 46, 98,\n    116,121,112,101, 93, 10,  9,101,110,100, 10,  9,114,101,116,\n    117,114,110, 32,110,105,108, 10,101,110,100, 10, 10,102,117,\n    110, 99,116,105,111,110, 32,103,101,116, 95,112,117,115,104,\n     95,102,117,110, 99,116,105,111,110, 40,116, 41, 10,  9,114,\n    101,116,117,114,110, 32, 95,112,117,115,104, 95,102,117,110,\n     99,116,105,111,110,115, 91,116, 93, 32,111,114, 32,115,101,\n     97,114, 99,104, 95, 98, 97,115,101, 40,116, 44, 32, 95, 98,\n     97,115,101, 95,112,117,115,104, 95,102,117,110, 99,116,105,\n    111,110,115, 41, 32,111,114, 32, 34,116,111,108,117, 97, 95,\n    112,117,115,104,117,115,101,114,116,121,112,101, 34, 10,101,\n    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,103,101,\n    116, 95,116,111, 95,102,117,110, 99,116,105,111,110, 40,116,\n     41, 10,  9,114,101,116,117,114,110, 32, 95,116,111, 95,102,\n    117,110, 99,116,105,111,110,115, 91,116, 93, 32,111,114, 32,\n    115,101, 97,114, 99,104, 95, 98, 97,115,101, 40,116, 44, 32,\n     95, 98, 97,115,101, 95,116,111, 95,102,117,110, 99,116,105,\n    111,110,115, 41, 32,111,114, 32, 34,116,111,108,117, 97, 95,\n    116,111,117,115,101,114,116,121,112,101, 34, 10,101,110,100,\n     10, 10,102,117,110, 99,116,105,111,110, 32,103,101,116, 95,\n    105,115, 95,102,117,110, 99,116,105,111,110, 40,116, 41, 10,\n      9,114,101,116,117,114,110, 32, 95,105,115, 95,102,117,110,\n     99,116,105,111,110,115, 91,116, 93, 32,111,114, 32,115,101,\n     97,114, 99,104, 95, 98, 97,115,101, 40,116, 44, 32, 95, 98,\n     97,115,101, 95,105,115, 95,102,117,110, 99,116,105,111,110,\n    115, 41, 32,111,114, 32, 34,116,111,108,117, 97, 95,105,115,\n    117,115,101,114,116,121,112,101, 34, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/basic.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 97, 98,115,116,114,\n     97, 99,116, 32,102,101, 97,116,117,114,101, 32, 99,108, 97,\n    115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32, 98,\n    121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,101,\n    115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80, 85,\n     67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49, 57,\n     57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45,\n     45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,\n    102,114,101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,\n    121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,\n    105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,111,114,\n     32,109,111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32,\n     84,104,101, 32,115,111,102,116,119, 97,114,101, 32,112,114,\n    111,118,105,100,101,100, 32,104,101,114,101,117,110,100,101,\n    114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,\n    105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10,\n     45, 45, 32,116,104,101, 32, 97,117,116,104,111,114, 32,104,\n     97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,105,111,\n    110, 32,116,111, 32,112,114,111,118,105,100,101, 32,109, 97,\n    105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,\n    111,114,116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45,\n     45, 32,101,110,104, 97,110, 99,101,109,101,110,116,115, 44,\n     32,111,114, 32,109,111,100,105,102,105, 99, 97,116,105,111,\n    110,115, 46, 10, 10, 10, 45, 45, 32, 70,101, 97,116,117,114,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,\n    101,115,101,110,116,115, 32,116,104,101, 32, 98, 97,115,101,\n     32, 99,108, 97,115,115, 32,111,102, 32, 97,108,108, 32,109,\n     97,112,112,101,100, 32,102,101, 97,116,117,114,101, 46, 10,\n     99,108, 97,115,115, 70,101, 97,116,117,114,101, 32, 61, 32,\n    123, 10,125, 10, 99,108, 97,115,115, 70,101, 97,116,117,114,\n    101, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,\n    115,115, 70,101, 97,116,117,114,101, 10, 10, 45, 45, 32,119,\n    114,105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,\n    100,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 70,101, 97,116,117,114,101, 58,115,117,112, 99,111,\n    100,101, 32, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,111,\n    117,116,112,117,116, 32,116, 97,103, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,\n    101, 58,100,101, 99,108,116,121,112,101, 32, 40, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,114,\n     32,102,101, 97,116,117,114,101, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101,\n     58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41,\n     10,101,110,100, 10, 10, 45, 45, 32,116,114, 97,110,115,108,\n     97,116,101, 32,118,101,114, 98, 97,116,105,109, 10,102,117,\n    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,\n    116,117,114,101, 58,112,114,101, 97,109, 98,108,101, 32, 40,\n     41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107,\n     32,105,102, 32,105,116, 32,105,115, 32, 97, 32,118, 97,114,\n    105, 97, 98,108,101, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,115,\n    118, 97,114,105, 97, 98,108,101, 32, 40, 41, 10, 32,114,101,\n    116,117,114,110, 32,102, 97,108,115,101, 10,101,110,100, 10,\n     10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,105,116,\n     32,114,101,113,117,105,114,101,115, 32, 99,111,108,108,101,\n     99,116,105,111,110, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,114,101,\n    113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,110,\n     32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,102, 97,\n    108,115,101, 10,101,110,100, 10, 10, 45, 45, 32, 98,117,105,\n    108,100, 32,110, 97,109,101,115, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101,\n     58, 98,117,105,108,100,110, 97,109,101,115, 32, 40, 41, 10,\n     32,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32, 97,\n    110,100, 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,\n     39, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32,\n    110, 32, 61, 32,115,112,108,105,116, 40,115,101,108,102, 46,\n    110, 97,109,101, 44, 39, 64, 39, 41, 10, 32, 32,115,101,108,\n    102, 46,110, 97,109,101, 32, 61, 32,110, 91, 49, 93, 10, 32,\n     32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40,115,101,108,102, 46,\n    110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36, 34, 44, 32,\n     34, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32,110, 91,\n     50, 93, 32,116,104,101,110, 10, 32, 32, 32,110, 91, 50, 93,\n     32, 61, 32, 97,112,112,108,121,114,101,110, 97,109,105,110,\n    103, 40,110, 91, 49, 93, 41, 10, 32, 32,101,110,100, 10, 32,\n     32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32,110,\n     91, 50, 93, 32,111,114, 32,103,115,117, 98, 40,110, 91, 49,\n     93, 44, 34, 37, 91, 46, 45, 37, 93, 34, 44, 34, 34, 41, 10,\n     32, 32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32,\n    115,116,114,105,110,103, 46,103,115,117, 98, 40,115,101,108,\n    102, 46,108,110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36,\n     34, 44, 32, 34, 34, 41, 10, 32, 32,115,101,108,102, 46,111,\n    114,105,103,105,110, 97,108, 95,110, 97,109,101, 32, 61, 32,\n    115,101,108,102, 46,110, 97,109,101, 10, 32, 32,115,101,108,\n    102, 46,108,110, 97,109,101, 32, 61, 32, 99,108,101, 97,110,\n     95,116,101,109,112,108, 97,116,101, 40,115,101,108,102, 46,\n    108,110, 97,109,101, 41, 10, 32,101,110,100, 10, 32,105,102,\n     32,110,111,116, 32,115,101,108,102, 46,105,115, 95,112, 97,\n    114, 97,109,101,116,101,114, 32,116,104,101,110, 10,  9, 32,\n    115,101,108,102, 46,110, 97,109,101, 32, 61, 32,103,101,116,\n    111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 40, 41,\n     32, 46, 46, 32,115,101,108,102, 46,110, 97,109,101, 10, 32,\n    101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,112, 97,114,\n    101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 46, 99,117,114,114, 10, 32,105,102, 32,\n    112, 97,114,101,110,116, 32,116,104,101,110, 10, 32,  9,115,\n    101,108,102, 46, 97, 99, 99,101,115,115, 32, 61, 32,112, 97,\n    114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98,101,\n    114, 95, 97, 99, 99,101,115,115, 10,  9,115,101,108,102, 46,\n    103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61,\n     32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98,\n    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 32,101,\n    108,115,101, 10, 32,101,110,100, 10,101,110,100, 10, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101,\n     97,116,117,114,101, 58, 99,104,101, 99,107, 95,112,117, 98,\n    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 10,  9,\n    105,102, 32,116,121,112,101, 40,115,101,108,102, 46,103,108,\n    111, 98, 97,108, 95, 97, 99, 99,101,115,115, 41, 32, 61, 61,\n     32, 34, 98,111,111,108,101, 97,110, 34, 32,116,104,101,110,\n     10,  9,  9,114,101,116,117,114,110, 32,115,101,108,102, 46,\n    103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 10,  9,\n    101,110,100, 10, 10,  9,105,102, 32,115,101,108,102, 46, 97,\n     99, 99,101,115,115, 32, 97,110,100, 32,115,101,108,102, 46,\n     97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104,101,\n    110, 10,  9,  9,114,101,116,117,114,110, 32,102, 97,108,115,\n    101, 10,  9,101,110,100, 10, 10,  9,108,111, 99, 97,108, 32,\n    112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,  9,\n    119,104,105,108,101, 32,112, 97,114,101,110,116, 32,100,111,\n     10,  9,  9,105,102, 32,112, 97,114,101,110,116, 46, 97, 99,\n     99,101,115,115, 32, 97,110,100, 32,112, 97,114,101,110,116,\n     46, 97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104,\n    101,110, 10,  9,  9,  9,114,101,116,117,114,110, 32,102, 97,\n    108,115,101, 10,  9,  9,101,110,100, 10,  9,  9,112, 97,114,\n    101,110,116, 32, 61, 32,112, 97,114,101,110,116, 46,112,114,\n    111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,114,110,\n     32,116,114,117,101, 10,101,110,100, 10, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108,101, 97,110, 95,116,101,109,112,\n    108, 97,116,101, 40,116, 41, 10, 10,  9,114,101,116,117,114,\n    110, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,\n     44, 32, 34, 91, 60, 62, 58, 44, 32, 37, 42, 93, 34, 44, 32,\n     34, 95, 34, 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,\n    101, 99,107, 32,105,102, 32,102,101, 97,116,117,114,101, 32,\n    105,115, 32,105,110,115,105,100,101, 32, 97, 32, 99,111,110,\n    116, 97,105,110,101,114, 32,100,101,102,105,110,105,116,105,\n    111,110, 10, 45, 45, 32,105,116, 32,114,101,116,117,114,110,\n    115, 32,116,104,101, 32, 99,111,110,116, 97,105,110,101,114,\n     32, 99,108, 97,115,115, 32,110, 97,109,101, 32,111,114, 32,\n    110,105,108, 46, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,110, 99,\n    111,110,116, 97,105,110,101,114, 32, 40,119,104,105, 99,104,\n     41, 10, 32,105,102, 32,115,101,108,102, 46,112, 97,114,101,\n    110,116, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108,\n     32,112, 97,114,101,110,116, 32, 61, 32,115,101,108,102, 46,\n    112, 97,114,101,110,116, 10, 32, 32,119,104,105,108,101, 32,\n    112, 97,114,101,110,116, 32,100,111, 10, 32, 32, 32,105,102,\n     32,112, 97,114,101,110,116, 46, 99,108, 97,115,115,116,121,\n    112,101, 32, 61, 61, 32,119,104,105, 99,104, 32,116,104,101,\n    110, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,112, 97,\n    114,101,110,116, 46,110, 97,109,101, 10, 32, 32, 32,101,110,\n    100, 10, 32, 32, 32,112, 97,114,101,110,116, 32, 61, 32,112,\n     97,114,101,110,116, 46,112, 97,114,101,110,116, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 32,114,101,116,117,114,\n    110, 32,110,105,108, 10,101,110,100, 10, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,\n    114,101, 58,105,110, 99,108, 97,115,115, 32, 40, 41, 10, 32,\n    114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99,\n    111,110,116, 97,105,110,101,114, 40, 39, 99,108, 97,115,115,\n     39, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,\n    105,110,109,111,100,117,108,101, 32, 40, 41, 10, 32,114,101,\n    116,117,114,110, 32,115,101,108,102, 58,105,110, 99,111,110,\n    116, 97,105,110,101,114, 40, 39,109,111,100,117,108,101, 39,\n     41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,\n    110,110, 97,109,101,115,112, 97, 99,101, 32, 40, 41, 10, 32,\n    114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99,\n    111,110,116, 97,105,110,101,114, 40, 39,110, 97,109,101,115,\n    112, 97, 99,101, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,\n    114,101,116,117,114,110, 32, 67, 32, 98,105,110,100,105,110,\n    103, 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101,\n     32, 98, 97,115,101,100, 32,111,110, 32,110, 97,109,101, 10,\n     45, 45, 32,116,104,101, 32, 99,108,105,101,110,116, 32,115,\n    112,101, 99,105,102,105,101,115, 32, 97, 32,112,114,101,102,\n    105,120, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 70,101, 97,116,117,114,101, 58, 99,102,117,110, 99,\n    110, 97,109,101, 32, 40,110, 41, 10, 10, 32,105,102, 32,115,\n    101,108,102, 46,112, 97,114,101,110,116, 32,116,104,101,110,\n     10, 32, 32,110, 32, 61, 32,115,101,108,102, 46,112, 97,114,\n    101,110,116, 58, 99,102,117,110, 99,110, 97,109,101, 40,110,\n     41, 10, 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,\n    102,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,108,110,\n     97,109,101, 10, 32,105,102, 32,110,111,116, 32,102,110, 97,\n    109,101, 32,111,114, 32,102,110, 97,109,101, 32, 61, 61, 32,\n     39, 39, 32,116,104,101,110, 10, 32,  9,102,110, 97,109,101,\n     32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10, 32,101,\n    110,100, 10, 32, 32,110, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,110, 46, 46, 39, 95, 39, 46, 46, 32,\n     40,102,110, 97,109,101, 41, 44, 32, 34, 91, 60, 62, 58, 44,\n     32, 92, 46, 37, 42, 38, 93, 34, 44, 32, 34, 95, 34, 41, 10,\n     10, 32, 32,114,101,116,117,114,110, 32,110, 10,101,110,100,\n    32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/feature.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,118,101,114, 98, 97,\n    116,105,109, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32,118,101,114, 98, 97,116,105,109, 46,108,117, 97,\n     44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48, 49, 47,\n     50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 54, 32, 99,101,108,\n    101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,\n    105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101,\n     32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32,\n     99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,\n    101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,\n    105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,\n    115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,\n    101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115,\n     32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32,\n     98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,\n    104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,\n    111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111,\n     32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,\n    110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44,\n     32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,\n    104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,\n    109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10,\n     10, 10, 10, 45, 45, 32, 86,101,114, 98, 97,116,105,109, 32,\n     99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115,\n    101,110,116,115, 32, 97, 32,108,105,110,101, 32,116,114, 97,\n    110,115,108, 97,116,101,100, 32,100,105,114,101, 99,116,101,\n    100, 32,116,111, 32,116,104,101, 32, 98,105,110,100,105,110,\n    103, 32,102,105,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,\n    102,111,108,108,111,119,105,110,103, 32,102,105,108,100,115,\n     32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45,\n     32, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32,\n    116,101,120,116, 10, 99,108, 97,115,115, 86,101,114, 98, 97,\n    116,105,109, 32, 61, 32,123, 10, 32,108,105,110,101, 32, 61,\n     32, 39, 39, 44, 10,  9, 99,111,110,100, 32, 61, 32,110,105,\n    108, 44, 32, 32, 32, 32, 45, 45, 32, 99,111,110,100,105,116,\n    105,111,110, 58, 32,119,104,101,114,101, 32,116,111, 32,103,\n    101,110,101,114, 97,116,101, 32,116,104,101, 32, 99,111,100,\n    101, 32, 40,115, 61,115,117,112,111,114,116, 44, 32,114, 61,\n    114,101,103,105,115,116,101,114, 41, 10,125, 10, 99,108, 97,\n    115,115, 86,101,114, 98, 97,116,105,109, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 86,101,114, 98,\n     97,116,105,109, 10,115,101,116,109,101,116, 97,116, 97, 98,\n    108,101, 40, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,\n    109, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41,\n     10, 10, 45, 45, 32,112,114,101, 97,109, 98,108,101, 32,118,\n    101,114, 98, 97,116,105,109, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109,\n     58,112,114,101, 97,109, 98,108,101, 32, 40, 41, 10, 32,105,\n    102, 32,115,101,108,102, 46, 99,111,110,100, 32, 61, 61, 32,\n     39, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,101,\n     40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,110,\n    100, 10,101,110,100, 10, 10, 45, 45, 32,115,117,112,112,111,\n    114,116, 32, 99,111,100,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109,\n     58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,105,102,\n     32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, 99,\n    111,110,100, 44, 39,115, 39, 41, 32,116,104,101,110, 10, 32,\n     32,119,114,105,116,101, 40,115,101,108,102, 46,108,105,110,\n    101, 41, 10, 32, 32,119,114,105,116,101, 40, 39, 92,110, 39,\n     41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n    114,101,103,105,115,116,101,114, 32, 99,111,100,101, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 86,101,\n    114, 98, 97,116,105,109, 58,114,101,103,105,115,116,101,114,\n     32, 40,112,114,101, 41, 10, 32,105,102, 32,115,116,114,102,\n    105,110,100, 40,115,101,108,102, 46, 99,111,110,100, 44, 39,\n    114, 39, 41, 32,116,104,101,110, 10, 32, 32,119,114,105,116,\n    101, 40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,\n    110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,114,105,\n    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,\n    105,109, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,\n     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 86,101,114, 98, 97,116,105,\n    109,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,108,105,110,101, 32, 61, 32, 39, 34,\n     46, 46,115,101,108,102, 46,108,105,110,101, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,\n    101,110,100, 10, 10, 10, 45, 45, 32, 73,110,116,101,114,110,\n     97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,\n    102,117,110, 99,116,105,111,110, 32, 95, 86,101,114, 98, 97,\n    116,105,109, 32, 40,116, 41, 10, 32,115,101,116,109,101,116,\n     97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 86,\n    101,114, 98, 97,116,105,109, 41, 10, 32, 97,112,112,101,110,\n    100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, 10,\n    101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117,\n     99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,115,\n     32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114,101,\n    115,101,110,116,105,110,103, 32,116,104,101, 32,116,101,120,\n    116, 32,108,105,110,101, 10,102,117,110, 99,116,105,111,110,\n     32, 86,101,114, 98, 97,116,105,109, 32, 40,108, 44, 99,111,\n    110,100, 41, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,\n    108, 44, 49, 44, 49, 41, 32, 61, 61, 32, 34, 39, 34, 32,116,\n    104,101,110, 10, 32, 32,108, 32, 61, 32,115,116,114,115,117,\n     98, 40,108, 44, 50, 41, 10, 32,101,108,115,101,105,102, 32,\n    115,116,114,115,117, 98, 40,108, 44, 49, 44, 49, 41, 32, 61,\n     61, 32, 39, 36, 39, 32,116,104,101,110, 10, 32, 32, 99,111,\n    110,100, 32, 61, 32, 39,115,114, 39, 32, 32, 32, 32, 32, 32,\n     32, 45, 45, 32,103,101,110,101,114, 97,116,101,115, 32,105,\n    110, 32, 98,111,116,104, 32,115,117,112,111,114,116, 32, 97,\n    110,100, 32,114,101,103,105,115,116,101,114, 32,102,114, 97,\n    103,109,101,110,116,115, 10, 32, 32,108, 32, 61, 32,115,116,\n    114,115,117, 98, 40,108, 44, 50, 41, 10, 32,101,110,100, 10,\n     32,114,101,116,117,114,110, 32, 95, 86,101,114, 98, 97,116,\n    105,109, 32,123, 10, 32, 32,108,105,110,101, 32, 61, 32,108,\n     44, 10, 32, 32, 99,111,110,100, 32, 61, 32, 99,111,110,100,\n     32,111,114, 32, 39, 39, 44, 10, 32,125, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/verbatim.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,100,101, 32,\n     99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,\n    110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,\n    101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102,\n     47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108,\n     32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32, 36,\n     10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,\n    105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,\n    101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,\n    115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100,\n     47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10,\n     45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101,\n     32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117,\n    110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34,\n     97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,\n    110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,\n    114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,\n    116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101,\n     32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,\n    117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115,\n     44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,\n    116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,\n    116,105,111,110,115, 46, 10, 10, 45, 45, 32,103,108,111, 98,\n     97,108, 10, 99,111,100,101, 95,110, 32, 61, 32, 49, 10, 10,\n     45, 45, 32, 67,111,100,101, 32, 99,108, 97,115,115, 10, 45,\n     45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 76,117,\n     97, 32, 99,111,100,101, 32,116,111, 32, 98,101, 32, 99,111,\n    109,112,105,108,101,100, 32, 97,110,100, 32,105,110, 99,108,\n    117,100,101,100, 10, 45, 45, 32,105,110, 32,116,104,101, 32,\n    105,110,105,116,105, 97,108,105,122, 97,116,105,111,110, 32,\n    102,117,110, 99,116,105,111,110, 46, 10, 45, 45, 32, 84,104,\n    101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,101,\n    108,100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58,\n     10, 45, 45, 32, 32, 32,116,101,120,116, 32, 61, 32,116,101,\n    120,116, 32, 99,111,100,101, 10, 99,108, 97,115,115, 67,111,\n    100,101, 32, 61, 32,123, 10, 32,116,101,120,116, 32, 61, 32,\n     39, 39, 44, 10,125, 10, 99,108, 97,115,115, 67,111,100,101,\n     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,\n    115, 67,111,100,101, 10,115,101,116,109,101,116, 97,116, 97,\n     98,108,101, 40, 99,108, 97,115,115, 67,111,100,101, 44, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,\n     45, 32,114,101,103,105,115,116,101,114, 32, 99,111,100,101,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     67,111,100,101, 58,114,101,103,105,115,116,101,114, 32, 40,\n    112,114,101, 41, 10, 32,112,114,101, 32, 61, 32,112,114,101,\n     32,111,114, 32, 39, 39, 10, 32, 45, 45, 32, 99,108,101, 97,\n    110, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99,\n     97,108, 32,115, 32, 61, 32, 99,108,101, 97,110, 40,115,101,\n    108,102, 46,116,101,120,116, 41, 10, 32,105,102, 32,110,111,\n    116, 32,115, 32,116,104,101,110, 10, 32, 32, 45, 45,112,114,\n    105,110,116, 40,115,101,108,102, 46,116,101,120,116, 41, 10,\n     32, 32,101,114,114,111,114, 40, 34,112, 97,114,115,101,114,\n     32,101,114,114,111,114, 32,105,110, 32,101,109, 98,101,100,\n    100,101,100, 32, 99,111,100,101, 34, 41, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32,103,101,116, 32,102,105,114,115,116,\n     32,108,105,110,101, 10, 32,108,111, 99, 97,108, 32, 95, 44,\n     32, 95, 44, 32,102,105,114,115,116, 95,108,105,110,101, 61,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,\n    102, 46,116,101,120,116, 44, 32, 34, 94, 40, 91, 94, 92,110,\n     92,114, 93, 42, 41, 34, 41, 10, 32,105,102, 32,115,116,114,\n    105,110,103, 46,102,105,110,100, 40,102,105,114,115,116, 95,\n    108,105,110,101, 44, 32, 34, 94, 37,115, 42, 37, 45, 37, 45,\n     34, 41, 32,116,104,101,110, 10,  9, 32,105,102, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,102,105,114,115,116,\n     95,108,105,110,101, 44, 32, 34, 94, 37, 45, 37, 45, 35, 35,\n     34, 41, 32,116,104,101,110, 10,  9,  9,102,105,114,115,116,\n     95,108,105,110,101, 32, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40,102,105,114,115,116, 95,108,105,110,101,\n     44, 32, 34, 94, 37, 45, 37, 45, 35, 35, 34, 44, 32, 34, 34,\n     41, 10,  9,  9,105,102, 32,102,108, 97,103,115, 91, 39, 67,\n     39, 93, 32,116,104,101,110, 10,  9,  9,  9,115, 32, 61, 32,\n    115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32,\n     34, 94, 37, 45, 37, 45, 35, 35, 91, 94, 92,110, 92,114, 93,\n     42, 92,110, 34, 44, 32, 34, 34, 41, 10,  9,  9,101,110,100,\n     10,  9, 32,101,110,100, 10, 32,101,108,115,101, 10, 32,  9,\n    102,105,114,115,116, 95,108,105,110,101, 32, 61, 32, 34, 34,\n     10, 32,101,110,100, 10, 10, 32, 45, 45, 32,112, 97,100, 32,\n    116,111, 32, 49, 54, 32, 98,121,116,101,115, 10, 32,108,111,\n     99, 97,108, 32,110,112, 97,100, 32, 61, 32, 49, 54, 32, 45,\n     32, 40, 35,115, 32, 37, 32, 49, 54, 41, 10, 32,108,111, 99,\n     97,108, 32,115,112, 97,100, 32, 61, 32, 34, 34, 10, 32,102,\n    111,114, 32,105, 61, 49, 44,110,112, 97,100, 32,100,111, 10,\n     32,  9,115,112, 97,100, 32, 61, 32,115,112, 97,100, 32, 46,\n     46, 32, 34, 45, 34, 10, 32,101,110,100, 10, 32,115, 32, 61,\n     32,115, 46, 46,115,112, 97,100, 10, 32, 10, 32, 45, 45, 32,\n     99,111,110,118,101,114,116, 32,116,111, 32, 67, 10, 32,111,\n    117,116,112,117,116, 40, 39, 92,110, 39, 46, 46,112,114,101,\n     46, 46, 39,123, 32, 47, 42, 32, 98,101,103,105,110, 32,101,\n    109, 98,101,100,100,101,100, 32,108,117, 97, 32, 99,111,100,\n    101, 32, 42, 47, 92,110, 39, 41, 10, 32,111,117,116,112,117,\n    116, 40,112,114,101, 46, 46, 39, 32,105,110,116, 32,116,111,\n    112, 32, 61, 32,108,117, 97, 95,103,101,116,116,111,112, 40,\n    116,111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 32,111,117,\n    116,112,117,116, 40,112,114,101, 46, 46, 39, 32,115,116, 97,\n    116,105, 99, 32, 99,111,110,115,116, 32,117,110,115,105,103,\n    110,101,100, 32, 99,104, 97,114, 32, 66, 91, 93, 32, 61, 32,\n    123, 92,110, 32, 32, 32, 39, 41, 10, 32,108,111, 99, 97,108,\n     32,116, 61,123,110, 61, 48,125, 10, 10, 32,108,111, 99, 97,\n    108, 32, 98, 32, 61, 32,103,115,117, 98, 40,115, 44, 39, 40,\n     46, 41, 39, 44,102,117,110, 99,116,105,111,110, 32, 40, 99,\n     41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,108,111, 99,\n     97,108, 32,101, 32, 61, 32, 39, 39, 10, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32,116, 46,110, 61,116, 46,110, 43, 49, 32,\n    105,102, 32,116, 46,110, 61, 61, 49, 53, 32,116,104,101,110,\n     32,116, 46,110, 61, 48, 32,101, 61, 39, 92,110, 39, 46, 46,\n    112,114,101, 46, 46, 39, 32, 32, 39, 32,101,110,100, 10, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,114,110,\n     32,102,111,114,109, 97,116, 40, 39, 37, 51,117, 44, 37,115,\n     39, 44,115,116,114, 98,121,116,101, 40, 99, 41, 44,101, 41,\n     10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 41,\n     10, 32,111,117,116,112,117,116, 40, 98, 46, 46,115,116,114,\n     98,121,116,101, 40, 34, 32, 34, 41, 41, 10, 32,111,117,116,\n    112,117,116, 40, 39, 92,110, 39, 46, 46,112,114,101, 46, 46,\n     39, 32,125, 59, 92,110, 39, 41, 10, 32,105,102, 32,102,105,\n    114,115,116, 95,108,105,110,101, 32, 97,110,100, 32,102,105,\n    114,115,116, 95,108,105,110,101, 32,126, 61, 32, 34, 34, 32,\n    116,104,101,110, 10, 32,  9,111,117,116,112,117,116, 40,112,\n    114,101, 46, 46, 39, 32,116,111,108,117, 97, 95,100,111, 98,\n    117,102,102,101,114, 40,116,111,108,117, 97, 95, 83, 44, 40,\n     99,104, 97,114, 42, 41, 66, 44,115,105,122,101,111,102, 40,\n     66, 41, 44, 34,116,111,108,117, 97, 32,101,109, 98,101,100,\n    100,101,100, 58, 32, 39, 46, 46,102,105,114,115,116, 95,108,\n    105,110,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32,101,108,\n    115,101, 10, 32,  9,111,117,116,112,117,116, 40,112,114,101,\n     46, 46, 39, 32,116,111,108,117, 97, 95,100,111, 98,117,102,\n    102,101,114, 40,116,111,108,117, 97, 95, 83, 44, 40, 99,104,\n     97,114, 42, 41, 66, 44,115,105,122,101,111,102, 40, 66, 41,\n     44, 34,116,111,108,117, 97, 58, 32,101,109, 98,101,100,100,\n    101,100, 32, 76,117, 97, 32, 99,111,100,101, 32, 39, 46, 46,\n     99,111,100,101, 95,110, 46, 46, 39, 34, 41, 59, 39, 41, 10,\n     32,101,110,100, 10, 32,111,117,116,112,117,116, 40,112,114,\n    101, 46, 46, 39, 32,108,117, 97, 95,115,101,116,116,111,112,\n     40,116,111,108,117, 97, 95, 83, 44, 32,116,111,112, 41, 59,\n     39, 41, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46,\n     46, 39,125, 32, 47, 42, 32,101,110,100, 32,111,102, 32,101,\n    109, 98,101,100,100,101,100, 32,108,117, 97, 32, 99,111,100,\n    101, 32, 42, 47, 92,110, 92,110, 39, 41, 10, 32, 99,111,100,\n    101, 95,110, 32, 61, 32, 99,111,100,101, 95,110, 32, 43, 49,\n     10,101,110,100, 10, 10, 10, 45, 45, 32, 80,114,105,110,116,\n     32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 67,111,100,101, 58,112,114,105,\n    110,116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 67,111,100,101,123, 34, 41, 10, 32,112,114,105,110,\n    116, 40,105,100,101,110,116, 46, 46, 34, 32,116,101,120,116,\n     32, 61, 32, 91, 91, 34, 46, 46,115,101,108,102, 46,116,101,\n    120,116, 46, 46, 34, 93, 93, 44, 34, 41, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46,\n     99,108,111,115,101, 41, 10,101,110,100, 10, 10, 10, 45, 45,\n     32, 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,\n    114,117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110,\n     32, 95, 67,111,100,101, 32, 40,116, 41, 10, 32,115,101,116,\n    109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,\n    115,115, 67,111,100,101, 41, 10, 32, 97,112,112,101,110,100,\n     40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, 10,101,\n    110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,\n    116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, 32,\n     97, 32,115,116,114,105,110,103, 32,114,101,112,114,101,115,\n    101,110,116,105,110,103, 32,116,104,101, 32, 99,111,100,101,\n     32,116,101,120,116, 10,102,117,110, 99,116,105,111,110, 32,\n     67,111,100,101, 32, 40,108, 41, 10, 32,114,101,116,117,114,\n    110, 32, 95, 67,111,100,101, 32,123, 10, 32, 32,116,101,120,\n    116, 32, 61, 32,108, 10, 32,125, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/code.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,116,121,112,101,100,\n    101,102, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,\n    116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,\n    114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,\n    114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32,\n     74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100,\n     58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,\n    100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,\n    119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,\n    101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32,\n     97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,\n    116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119,\n     97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,\n    114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,\n    110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115,\n     44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,\n    116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,\n    105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,\n    105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101,\n     44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,\n    116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,\n    109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,\n    105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45,\n     32, 84,121,112,101,100,101,102, 32, 99,108, 97,115,115, 10,\n     45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97,\n     32,116,121,112,101, 32,115,121,110,111,110,121,109, 46, 10,\n     45, 45, 32, 84,104,101, 32, 39,100,101, 32,102, 97, 99,116,\n    111, 39, 32,116,121,112,101, 32,114,101,112,108, 97, 99,101,\n    115, 32,116,104,101, 32,116,121,112,101,100,101,102, 32, 98,\n    101,102,111,114,101, 32,116,104,101, 10, 45, 45, 32,114,101,\n    109, 97,105,110,105,110,103, 32, 99,111,100,101, 32,105,115,\n     32,112, 97,114,115,101,100, 46, 10, 45, 45, 32, 84,104,101,\n     32,102,111,108,108,111,119,105,110,103, 32,102,105,101,108,\n    100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10,\n     45, 45, 32, 32, 32,117,116,121,112,101, 32, 61, 32,116,121,\n    112,101,100,101,102, 32,110, 97,109,101, 10, 45, 45, 32, 32,\n     32,116,121,112,101, 32, 61, 32, 39,116,104,101, 32,102, 97,\n     99,116,111, 39, 32,116,121,112,101, 10, 45, 45, 32, 32, 32,\n    109,111,100, 32, 61, 32,109,111,100,105,102,105,101,114,115,\n     32,116,111, 32,116,104,101, 32, 39,100,101, 32,102, 97, 99,\n    116,111, 39, 32,116,121,112,101, 10, 99,108, 97,115,115, 84,\n    121,112,101,100,101,102, 32, 61, 32,123, 10, 32,117,116,121,\n    112,101, 32, 61, 32, 39, 39, 44, 10, 32,109,111,100, 32, 61,\n     32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, 39,\n     10,125, 10, 99,108, 97,115,115, 84,121,112,101,100,101,102,\n     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,\n    115, 84,121,112,101,100,101,102, 10, 10, 45, 45, 32, 80,114,\n    105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 84,121,112,101,100,\n    101,102, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,\n     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 84,121,112,101,100,101,102,\n    123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32,117,116,121,112,101, 32, 61, 32, 39, 34,\n     46, 46,115,101,108,102, 46,117,116,121,112,101, 46, 46, 34,\n     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,109,111,100, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100,\n     10, 10, 45, 45, 32, 82,101,116,117,114,110, 32,105,116, 39,\n    115, 32,110,111,116, 32, 97, 32,118, 97,114,105, 97, 98,108,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 84,121,112,101,100,101,102, 58,105,115,118, 97,114,105,\n     97, 98,108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110,\n     32,102, 97,108,115,101, 10,101,110,100, 10, 10, 45, 45, 32,\n     73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,\n    117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32,\n     95, 84,121,112,101,100,101,102, 32, 40,116, 41, 10, 32,115,\n    101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,\n    108, 97,115,115, 84,121,112,101,100,101,102, 41, 10, 32,116,\n     46,116,121,112,101, 32, 61, 32,114,101,115,111,108,118,101,\n     95,116,101,109,112,108, 97,116,101, 95,116,121,112,101,115,\n     40,116, 46,116,121,112,101, 41, 10, 32, 97,112,112,101,110,\n    100,116,121,112,101,100,101,102, 40,116, 41, 10, 32,114,101,\n    116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,\n     67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32,\n     69,120,112,101, 99,116,115, 32,111,110,101, 32,115,116,114,\n    105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110,\n    103, 32,116,104,101, 32,116,121,112,101, 32,100,101,102,105,\n    110,105,116,105,111,110, 46, 10,102,117,110, 99,116,105,111,\n    110, 32, 84,121,112,101,100,101,102, 32, 40,115, 41, 10, 32,\n    105,102, 32,115,116,114,102,105,110,100, 40,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,115, 44, 32, 39, 37, 98, 60,\n     62, 39, 44, 32, 39, 39, 41, 44, 39, 91, 37, 42, 38, 93, 39,\n     41, 32,116,104,101,110, 10, 32, 32,116,111,108,117, 97, 95,\n    101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105,100,\n     32,116,121,112,101,100,101,102, 58, 32,112,111,105,110,116,\n    101,114,115, 32, 40, 97,110,100, 32,114,101,102,101,114,101,\n    110, 99,101,115, 41, 32, 97,114,101, 32,110,111,116, 32,115,\n    117,112,112,111,114,116,101,100, 34, 41, 10, 32,101,110,100,\n     10, 32,108,111, 99, 97,108, 32,111, 32, 61, 32,123,109,111,\n    100, 32, 61, 32, 39, 39,125, 10, 32,105,102, 32,115,116,114,\n    105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 91, 60,\n     62, 93, 34, 41, 32,116,104,101,110, 10, 32,  9, 95, 44, 95,\n     44,111, 46,116,121,112,101, 44,111, 46,117,116,121,112,101,\n     32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    115, 44, 32, 34, 94, 37,115, 42, 40, 91, 94, 60, 62, 93, 43,\n     37, 98, 60, 62, 91, 94, 37,115, 93, 42, 41, 37,115, 43, 40,\n     46, 45, 41, 36, 34, 41, 10, 32,101,108,115,101, 10, 32,  9,\n    108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116,\n     40,103,115,117, 98, 40,115, 44, 34, 37,115, 37,115, 42, 34,\n     44, 34, 32, 34, 41, 44, 34, 32, 34, 41, 10, 32,  9,111, 32,\n     61, 32,123, 10,  9, 32, 32,117,116,121,112,101, 32, 61, 32,\n    116, 91,116, 46,110, 93, 44, 10,  9, 32, 32,116,121,112,101,\n     32, 61, 32,116, 91,116, 46,110, 45, 49, 93, 44, 10,  9, 32,\n     32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,116,\n     44, 49, 44,116, 46,110, 45, 50, 41, 44, 10,  9, 32,125, 10,\n     32,101,110,100, 10, 32,114,101,116,117,114,110, 32, 95, 84,\n    121,112,101,100,101,102, 40,111, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/typedef.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,110,116, 97,\n    105,110,101,114, 32, 97, 98,115,116,114, 97, 99,116, 32, 99,\n    108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110,\n     32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,\n    108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47,\n     80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32,\n     49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10,\n     10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,\n    115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,101,\n     59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,\n    116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,\n    111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, 45,\n     45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, 32,\n    112,114,111,118,105,100,101,100, 32,104,101,114,101,117,110,\n    100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,\n    115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,\n    100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,114,\n     32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,\n    105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, 32,\n    109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,\n    112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, 44,\n     10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,116,\n    115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,116,\n    105,111,110,115, 46, 10, 10, 45, 45, 32,116, 97, 98,108,101,\n     32,116,111, 32,115,116,111,114,101, 32,110, 97,109,101,115,\n    112, 97, 99,101,100, 32,116,121,112,101,100,101,102,115, 47,\n    101,110,117,109,115, 32,105,110, 32,103,108,111, 98, 97,108,\n     32,115, 99,111,112,101, 10,103,108,111, 98, 97,108, 95,116,\n    121,112,101,100,101,102,115, 32, 61, 32,123,125, 10,103,108,\n    111, 98, 97,108, 95,101,110,117,109,115, 32, 61, 32,123,125,\n     10, 10, 45, 45, 32, 67,111,110,116, 97,105,110,101,114, 32,\n     99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115,\n    101,110,116,115, 32, 97, 32, 99,111,110,116, 97,105,110,101,\n    114, 32,111,102, 32,102,101, 97,116,117,114,101,115, 32,116,\n    111, 32, 98,101, 32, 98,111,117,110,100, 10, 45, 45, 32,116,\n    111, 32,108,117, 97, 46, 10, 99,108, 97,115,115, 67,111,110,\n    116, 97,105,110,101,114, 32, 61, 10,123, 10, 32, 99,117,114,\n    114, 32, 61, 32,110,105,108, 44, 10,125, 10, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 10,115,101,116,109,101,116, 97,116, 97,\n     98,108,101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,\n    110,101,114, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,\n    101, 41, 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116,\n     97,103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 67,111,110,116, 97,105,110,101,114, 58,100,101,\n     99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117,115,104,\n     40,115,101,108,102, 41, 10, 32,108,111, 99, 97,108, 32,105,\n     61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,\n    105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105, 93,\n     58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32,105,\n     32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,111,\n    112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32,119,114,\n    105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,100,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 58,115,117,112, 99,\n    111,100,101, 32, 40, 41, 10, 10,  9,105,102, 32,110,111,116,\n     32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98,\n    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,\n    101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,110,\n    100, 10, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10,\n     32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,\n    108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32,\n     32,105,102, 32,115,101,108,102, 91,105, 93, 58, 99,104,101,\n     99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,\n    115, 40, 41, 32,116,104,101,110, 10, 32, 32,  9,115,101,108,\n    102, 91,105, 93, 58,115,117,112, 99,111,100,101, 40, 41, 10,\n     32, 32,101,110,100, 10, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32,101,110,100, 10, 32,112,111,112, 40, 41, 10,101,110,\n    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 58,104, 97,115,\n    118, 97,114, 32, 40, 41, 10, 32,108,111, 99, 97,108, 32,105,\n     61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,\n    105, 93, 32,100,111, 10, 32, 32,105,102, 32,115,101,108,102,\n     91,105, 93, 58,105,115,118, 97,114,105, 97, 98,108,101, 40,\n     41, 32,116,104,101,110, 10,  9,  9, 32,114,101,116,117,114,\n    110, 32, 49, 10,  9,  9,101,110,100, 10, 32, 32,105, 32, 61,\n     32,105, 43, 49, 10, 32,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32, 48, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,\n    116,101,114,110, 97,108, 32, 99,111,110,116, 97,105,110,101,\n    114, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,\n    117,110, 99,116,105,111,110, 32, 95, 67,111,110,116, 97,105,\n    110,101,114, 32, 40,115,101,108,102, 41, 10, 32,115,101,116,\n    109,101,116, 97,116, 97, 98,108,101, 40,115,101,108,102, 44,\n     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 41,\n     10, 32,115,101,108,102, 46,110, 32, 61, 32, 48, 10, 32,115,\n    101,108,102, 46,116,121,112,101,100,101,102,115, 32, 61, 32,\n    123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,115,101,\n    108,102, 46,117,115,101,114,116,121,112,101,115, 32, 61, 32,\n    123,125, 10, 32,115,101,108,102, 46,101,110,117,109,115, 32,\n     61, 32,123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,\n    115,101,108,102, 46,108,110, 97,109,101,115, 32, 61, 32,123,\n    125, 10, 32,114,101,116,117,114,110, 32,115,101,108,102, 10,\n    101,110,100, 10, 10, 45, 45, 32,112,117,115,104, 32, 99,111,\n    110,116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,\n    110, 32,112,117,115,104, 32, 40,116, 41, 10,  9,116, 46,112,\n    114,111,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 46, 99,117,114,114, 10, 32, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,\n    114, 32, 61, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,112,\n    111,112, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117,\n    110, 99,116,105,111,110, 32,112,111,112, 32, 40, 41, 10, 45,\n     45,112,114,105,110,116, 40, 34,110, 97,109,101, 34, 44, 99,\n    108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,\n    117,114,114, 46,110, 97,109,101, 41, 10, 45, 45,102,111,114,\n    101, 97, 99,104, 40, 99,108, 97,115,115, 67,111,110,116, 97,\n    105,110,101,114, 46, 99,117,114,114, 46,117,115,101,114,116,\n    121,112,101,115, 44,112,114,105,110,116, 41, 10, 45, 45,112,\n    114,105,110,116, 40, 34, 95, 95, 95, 95, 95, 95, 95, 95, 95,\n     95, 95, 95, 95, 95, 34, 41, 10, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 32, 61,\n     32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,\n     46, 99,117,114,114, 46,112,114,111,120, 10,101,110,100, 10,\n     10, 45, 45, 32,103,101,116, 32, 99,117,114,114,101,110,116,\n     32,110, 97,109,101,115,112, 97, 99,101, 10,102,117,110, 99,\n    116,105,111,110, 32,103,101,116, 99,117,114,114,110, 97,109,\n    101,115,112, 97, 99,101, 32, 40, 41, 10,  9,114,101,116,117,\n    114,110, 32,103,101,116,110, 97,109,101,115,112, 97, 99,101,\n     40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,\n     46, 99,117,114,114, 41, 10,101,110,100, 10, 10, 45, 45, 32,\n     97,112,112,101,110,100, 32,116,111, 32, 99,117,114,114,101,\n    110,116, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117,\n    110, 99,116,105,111,110, 32, 97,112,112,101,110,100, 32, 40,\n    116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,\n     58, 97,112,112,101,110,100, 40,116, 41, 10,101,110,100, 10,\n     10, 45, 45, 32, 97,112,112,101,110,100, 32,116,121,112,101,\n    100,101,102, 32,116,111, 32, 99,117,114,114,101,110,116, 32,\n     99,111,110,116, 97,105,110,101,114, 10,102,117,110, 99,116,\n    105,111,110, 32, 97,112,112,101,110,100,116,121,112,101,100,\n    101,102, 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,\n     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46,\n     99,117,114,114, 58, 97,112,112,101,110,100,116,121,112,101,\n    100,101,102, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32,\n     97,112,112,101,110,100, 32,117,115,101,114,116,121,112,101,\n     32,116,111, 32, 99,117,114,114,101,110,116, 32, 99,111,110,\n    116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,110,\n     32, 97,112,112,101,110,100,117,115,101,114,116,121,112,101,\n     32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108,\n     97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,\n    114,114, 58, 97,112,112,101,110,100,117,115,101,114,116,121,\n    112,101, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32, 97,\n    112,112,101,110,100, 32,101,110,117,109, 32,116,111, 32, 99,\n    117,114,114,101,110,116, 32, 99,111,110,116, 97,105,110,101,\n    114, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,101,\n    110,100,101,110,117,109, 32, 40,116, 41, 10, 32,114,101,116,\n    117,114,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,\n    110,101,114, 46, 99,117,114,114, 58, 97,112,112,101,110,100,\n    101,110,117,109, 40,116, 41, 10,101,110,100, 10, 10, 45, 45,\n     32,115,117, 98,115,116,105,116,117,116,101, 32,116,121,112,\n    101,100,101,102, 10,102,117,110, 99,116,105,111,110, 32, 97,\n    112,112,108,121,116,121,112,101,100,101,102, 32, 40,109,111,\n    100, 44,116,121,112,101, 41, 10, 32,114,101,116,117,114,110,\n     32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,\n     46, 99,117,114,114, 58, 97,112,112,108,121,116,121,112,101,\n    100,101,102, 40,109,111,100, 44,116,121,112,101, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102,\n     32,105,115, 32,116,121,112,101, 10,102,117,110, 99,116,105,\n    111,110, 32,102,105,110,100,116,121,112,101, 32, 40,116,121,\n    112,101, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46,\n     99,117,114,114, 58,102,105,110,100,116,121,112,101, 40,116,\n    121,112,101, 41, 10,  9,114,101,116,117,114,110, 32,116, 10,\n    101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,\n    102, 32,105,115, 32,116,121,112,101,100,101,102, 10,102,117,\n    110, 99,116,105,111,110, 32,105,115,116,121,112,101,100,101,\n    102, 32, 40,116,121,112,101, 41, 10, 32,114,101,116,117,114,\n    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 46, 99,117,114,114, 58,105,115,116,121,112,101,100,101,\n    102, 40,116,121,112,101, 41, 10,101,110,100, 10, 10, 45, 45,\n     32,103,101,116, 32,102,117,108,108,116,121,112,101, 32, 40,\n    119,105,116,104, 32,110, 97,109,101,115,112, 97, 99,101, 41,\n     10,102,117,110, 99,116,105,111,110, 32,102,117,108,108,116,\n    121,112,101, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32,\n     99,117,114,114, 32, 61, 32, 32, 99,108, 97,115,115, 67,111,\n    110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,  9,119,\n    104,105,108,101, 32, 99,117,114,114, 32,100,111, 10,  9, 32,\n    105,102, 32, 99,117,114,114, 32,116,104,101,110, 10,  9,  9,\n     32,105,102, 32, 99,117,114,114, 46,116,121,112,101,100,101,\n    102,115, 32, 97,110,100, 32, 99,117,114,114, 46,116,121,112,\n    101,100,101,102,115, 91,116, 93, 32,116,104,101,110, 10,  9,\n      9, 32, 32,114,101,116,117,114,110, 32, 99,117,114,114, 46,\n    116,121,112,101,100,101,102,115, 91,116, 93, 10,  9,  9, 32,\n    101,108,115,101,105,102, 32, 99,117,114,114, 46,117,115,101,\n    114,116,121,112,101,115, 32, 97,110,100, 32, 99,117,114,114,\n     46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116,\n    104,101,110, 10,  9,  9, 32, 32,114,101,116,117,114,110, 32,\n     99,117,114,114, 46,117,115,101,114,116,121,112,101,115, 91,\n    116, 93, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,110,100,\n     10,  9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,\n    112,114,111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,\n    101, 99,107,115, 32,105,102, 32,105,116, 32,114,101,113,117,\n    105,114,101,115, 32, 99,111,108,108,101, 99,116,105,111,110,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 58,114,101,113,117,105,\n    114,101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116,\n     41, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10,  9,108,111, 99, 97,\n    108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,\n     32, 32,114, 32, 61, 32,115,101,108,102, 91,105, 93, 58,114,\n    101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,\n    110, 40,116, 41, 32,111,114, 32,114, 10, 32, 32,105, 32, 61,\n     32,105, 43, 49, 10, 32,101,110,100, 10,  9,112,111,112, 40,\n     41, 10,  9,114,101,116,117,114,110, 32,114, 10,101,110,100,\n     10, 10, 10, 45, 45, 32,103,101,116, 32,110, 97,109,101,115,\n     97,112, 99,101, 10,102,117,110, 99,116,105,111,110, 32,103,\n    101,116,110, 97,109,101,115,112, 97, 99,101, 32, 40, 99,117,\n    114,114, 41, 10,  9,108,111, 99, 97,108, 32,110, 97,109,101,\n    115,112, 97, 99,101, 32, 61, 32, 39, 39, 10,  9,119,104,105,\n    108,101, 32, 99,117,114,114, 32,100,111, 10,  9, 32,105,102,\n     32, 99,117,114,114, 32, 97,110,100, 10,  9,  9, 32, 32, 32,\n     40, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,\n    101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,114,\n     32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,101,\n     32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101, 39,\n     41, 10,  9,  9,116,104,101,110, 10,  9,  9, 32,110, 97,109,\n    101,115,112, 97, 99,101, 32, 61, 32, 40, 99,117,114,114, 46,\n    111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,\n    114, 32, 99,117,114,114, 46,110, 97,109,101, 41, 32, 46, 46,\n     32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,101,115,112,\n     97, 99,101, 10,  9,  9, 32, 45, 45,110, 97,109,101,115,112,\n     97, 99,101, 32, 61, 32, 99,117,114,114, 46,110, 97,109,101,\n     32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,\n    101,115,112, 97, 99,101, 10,  9,  9,101,110,100, 10,  9, 32,\n     99,117,114,114, 32, 61, 32, 99,117,114,114, 46,112,114,111,\n    120, 10,  9,101,110,100, 10,  9,114,101,116,117,114,110, 32,\n    110, 97,109,101,115,112, 97, 99,101, 10,101,110,100, 10, 10,\n     45, 45, 32,103,101,116, 32,110, 97,109,101,115,112, 97, 99,\n    101, 32, 40,111,110,108,121, 32,110, 97,109,101,115,112, 97,\n     99,101, 41, 10,102,117,110, 99,116,105,111,110, 32,103,101,\n    116,111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 32,\n     40, 41, 10, 32,108,111, 99, 97,108, 32, 99,117,114,114, 32,\n     61, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 46, 99,117,114,114, 10,  9,108,111, 99, 97,108, 32,110,\n     97,109,101,115,112, 97, 99,101, 32, 61, 32, 39, 39, 10,  9,\n    119,104,105,108,101, 32, 99,117,114,114, 32,100,111, 10,  9,\n      9,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,\n    121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,\n    116,104,101,110, 10,  9,  9, 32,114,101,116,117,114,110, 32,\n    110, 97,109,101,115,112, 97, 99,101, 10,  9,  9,101,108,115,\n    101,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,\n    121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97,\n     99,101, 39, 32,116,104,101,110, 10,  9,  9, 32,110, 97,109,\n    101,115,112, 97, 99,101, 32, 61, 32, 99,117,114,114, 46,110,\n     97,109,101, 32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,\n    110, 97,109,101,115,112, 97, 99,101, 10,  9,  9,101,110,100,\n     10,  9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,\n    112,114,111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32,110, 97,109,101,115,112, 97, 99,101, 10,101,110,\n    100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,\n    105,115, 32,101,110,117,109, 10,102,117,110, 99,116,105,111,\n    110, 32,105,115,101,110,117,109, 32, 40,116,121,112,101, 41,\n     10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,105,\n    115,101,110,117,109, 40,116,121,112,101, 41, 10,101,110,100,\n     10, 10, 45, 45, 32, 97,112,112,101,110,100, 32,102,101, 97,\n    116,117,114,101, 32,116,111, 32, 99,111,110,116, 97,105,110,\n    101,114, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 58, 97,112,112,\n    101,110,100, 32, 40,116, 41, 10, 32,115,101,108,102, 46,110,\n     32, 61, 32,115,101,108,102, 46,110, 32, 43, 32, 49, 10, 32,\n    115,101,108,102, 91,115,101,108,102, 46,110, 93, 32, 61, 32,\n    116, 10, 32,116, 46,112, 97,114,101,110,116, 32, 61, 32,115,\n    101,108,102, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,\n    101,110,100, 32,116,121,112,101,100,101,102, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 58, 97,112,112,101,110,100,116,121,112,\n    101,100,101,102, 32, 40,116, 41, 10, 32,108,111, 99, 97,108,\n     32,110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,\n    116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,\n     41, 10, 32,115,101,108,102, 46,116,121,112,101,100,101,102,\n    115, 46,116,111,108,117, 97, 95,110, 32, 61, 32,115,101,108,\n    102, 46,116,121,112,101,100,101,102,115, 46,116,111,108,117,\n     97, 95,110, 32, 43, 32, 49, 10, 32,115,101,108,102, 46,116,\n    121,112,101,100,101,102,115, 91,115,101,108,102, 46,116,121,\n    112,101,100,101,102,115, 46,116,111,108,117, 97, 95,110, 93,\n     32, 61, 32,116, 10,  9,115,101,108,102, 46,116,121,112,101,\n    100,101,102,115, 91,116, 46,117,116,121,112,101, 93, 32, 61,\n     32,110, 97,109,101,115,112, 97, 99,101, 32, 46, 46, 32,116,\n     46,117,116,121,112,101, 10,  9,103,108,111, 98, 97,108, 95,\n    116,121,112,101,100,101,102,115, 91,110, 97,109,101,115,112,\n     97, 99,101, 46, 46,116, 46,117,116,121,112,101, 93, 32, 61,\n     32,116, 10,  9,116, 46,102,116,121,112,101, 32, 61, 32,102,\n    105,110,100,116,121,112,101, 40,116, 46,116,121,112,101, 41,\n     32,111,114, 32,116, 46,116,121,112,101, 10,  9, 45, 45,112,\n    114,105,110,116, 40, 34, 97,112,112,101,110,100,105,110,103,\n     32,116,121,112,101,100,101,102, 32, 34, 46, 46,116, 46,117,\n    116,121,112,101, 46, 46, 34, 32, 97,115, 32, 34, 46, 46,110,\n     97,109,101,115,112, 97, 99,101, 46, 46,116, 46,117,116,121,\n    112,101, 46, 46, 34, 32,119,105,116,104, 32,102,116,121,112,\n    101, 32, 34, 46, 46,116, 46,102,116,121,112,101, 41, 10,  9,\n     97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,116,\n    121,112,101, 40,110, 97,109,101,115,112, 97, 99,101, 46, 46,\n    116, 46,117,116,121,112,101, 41, 10,  9,105,102, 32,116, 46,\n    102,116,121,112,101, 32, 97,110,100, 32,105,115,101,110,117,\n    109, 40,116, 46,102,116,121,112,101, 41, 32,116,104,101,110,\n     10, 10,  9,  9,103,108,111, 98, 97,108, 95,101,110,117,109,\n    115, 91,110, 97,109,101,115,112, 97, 99,101, 46, 46,116, 46,\n    117,116,121,112,101, 93, 32, 61, 32,116,114,117,101, 10,  9,\n    101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,\n    101,110,100, 32,117,115,101,114,116,121,112,101, 58, 32,114,\n    101,116,117,114,110, 32,102,117,108,108, 32,116,121,112,101,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 58, 97,112,112,101,110,\n    100,117,115,101,114,116,121,112,101, 32, 40,116, 41, 10,  9,\n    108,111, 99, 97,108, 32, 99,111,110,116, 97,105,110,101,114,\n     10,  9,105,102, 32,116, 32, 61, 61, 32, 40,115,101,108,102,\n     46,111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,\n    111,114, 32,115,101,108,102, 46,110, 97,109,101, 41, 32,116,\n    104,101,110, 10,  9,  9, 99,111,110,116, 97,105,110,101,114,\n     32, 61, 32,115,101,108,102, 46,112,114,111,120, 10,  9,101,\n    108,115,101, 10,  9,  9, 99,111,110,116, 97,105,110,101,114,\n     32, 61, 32,115,101,108,102, 10,  9,101,110,100, 10,  9,108,\n    111, 99, 97,108, 32,102,116, 32, 61, 32,103,101,116,110, 97,\n    109,101,115,112, 97, 99,101, 40, 99,111,110,116, 97,105,110,\n    101,114, 41, 32, 46, 46, 32,116, 10,  9, 99,111,110,116, 97,\n    105,110,101,114, 46,117,115,101,114,116,121,112,101,115, 91,\n    116, 93, 32, 61, 32,102,116, 10,  9, 95,117,115,101,114,116,\n    121,112,101, 91,102,116, 93, 32, 61, 32,102,116, 10,  9,114,\n    101,116,117,114,110, 32,102,116, 10,101,110,100, 10, 10, 45,\n     45, 32, 97,112,112,101,110,100, 32,101,110,117,109, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,\n    110,116, 97,105,110,101,114, 58, 97,112,112,101,110,100,101,\n    110,117,109, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32,\n    110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,116,\n    110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 41,\n     10, 32,115,101,108,102, 46,101,110,117,109,115, 46,116,111,\n    108,117, 97, 95,110, 32, 61, 32,115,101,108,102, 46,101,110,\n    117,109,115, 46,116,111,108,117, 97, 95,110, 32, 43, 32, 49,\n     10, 32,115,101,108,102, 46,101,110,117,109,115, 91,115,101,\n    108,102, 46,101,110,117,109,115, 46,116,111,108,117, 97, 95,\n    110, 93, 32, 61, 32,116, 10,  9,103,108,111, 98, 97,108, 95,\n    101,110,117,109,115, 91,110, 97,109,101,115,112, 97, 99,101,\n     46, 46,116, 46,110, 97,109,101, 93, 32, 61, 32,116, 10,101,\n    110,100, 10, 10, 45, 45, 32,100,101,116,101,114,109,105,110,\n    101, 32,108,117, 97, 32,102,117,110, 99,116,105,111,110, 32,\n    110, 97,109,101, 32,111,118,101,114,108,111, 97,100, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,\n    110,116, 97,105,110,101,114, 58,111,118,101,114,108,111, 97,\n    100, 32, 40,108,110, 97,109,101, 41, 10, 32,105,102, 32,110,\n    111,116, 32,115,101,108,102, 46,108,110, 97,109,101,115, 91,\n    108,110, 97,109,101, 93, 32,116,104,101,110, 10, 32, 32,115,\n    101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,109,\n    101, 93, 32, 61, 32, 48, 10, 32,101,108,115,101, 10, 32, 32,\n    115,101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,\n    109,101, 93, 32, 61, 32,115,101,108,102, 46,108,110, 97,109,\n    101,115, 91,108,110, 97,109,101, 93, 32, 43, 32, 49, 10, 32,\n    101,110,100, 10, 32,114,101,116,117,114,110, 32,102,111,114,\n    109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,115,101,108,102,\n     46,108,110, 97,109,101,115, 91,108,110, 97,109,101, 93, 41,\n     10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,108,105,101,\n    115, 32,116,121,112,101,100,101,102, 58, 32,114,101,116,117,\n    114,110,115, 32,116,104,101, 32, 39,116,104,101, 32,102, 97,\n     99,116,111, 39, 32,109,111,100,105,102,105,101,114, 32, 97,\n    110,100, 32,116,121,112,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 58, 97,112,112,108,121,116,121,112,101,100,101,102, 32,\n     40,109,111,100, 44,116,121,112,101, 41, 10,  9,105,102, 32,\n    103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115,\n     91,116,121,112,101, 93, 32,116,104,101,110, 10,  9,  9, 45,\n     45,112,114,105,110,116, 40, 34,102,111,117,110,100, 32,116,\n    121,112,101,100,101,102, 32, 34, 46, 46,103,108,111, 98, 97,\n    108, 95,116,121,112,101,100,101,102,115, 91,116,121,112,101,\n     93, 46,116,121,112,101, 41, 10,  9,  9,108,111, 99, 97,108,\n     32,109,111,100, 49, 44, 32,116,121,112,101, 49, 32, 61, 32,\n    103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115,\n     91,116,121,112,101, 93, 46,109,111,100, 44, 32,103,108,111,\n     98, 97,108, 95,116,121,112,101,100,101,102,115, 91,116,121,\n    112,101, 93, 46,102,116,121,112,101, 10,  9,  9,108,111, 99,\n     97,108, 32,109,111,100, 50, 44, 32,116,121,112,101, 50, 32,\n     61, 32, 97,112,112,108,121,116,121,112,101,100,101,102, 40,\n    109,111,100, 46, 46, 34, 32, 34, 46, 46,109,111,100, 49, 44,\n     32,116,121,112,101, 49, 41, 10,  9,  9, 45, 45,114,101,116,\n    117,114,110, 32,109,111,100, 50, 32, 46, 46, 32, 39, 32, 39,\n     32, 46, 46, 32,109,111,100, 49, 44, 32,116,121,112,101, 50,\n     10,  9,  9,114,101,116,117,114,110, 32,109,111,100, 50, 44,\n     32,116,121,112,101, 50, 10,  9,101,110,100, 10,  9,100,111,\n     32,114,101,116,117,114,110, 32,109,111,100, 44,116,121,112,\n    101, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n    104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97,\n     32,116,121,112,101,100,101,102, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,\n    101,114, 58,105,115,116,121,112,101,100,101,102, 32, 40,116,\n    121,112,101, 41, 10, 32,108,111, 99, 97,108, 32,101,110,118,\n     32, 61, 32,115,101,108,102, 10, 32,119,104,105,108,101, 32,\n    101,110,118, 32,100,111, 10, 32, 32,105,102, 32,101,110,118,\n     46,116,121,112,101,100,101,102,115, 32,116,104,101,110, 10,\n     32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,\n     32,119,104,105,108,101, 32,101,110,118, 46,116,121,112,101,\n    100,101,102,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,\n    105,102, 32,101,110,118, 46,116,121,112,101,100,101,102,115,\n     91,105, 93, 46,117,116,121,112,101, 32, 61, 61, 32,116,121,\n    112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,114,101,116,117,114,110, 32,116,121,112,101, 10, 32,\n     32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,\n     32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118,\n     32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32,\n    101,110,100, 10, 32,114,101,116,117,114,110, 32,110,105,108,\n     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,\n    102,105,110,100, 95,101,110,117,109, 95,118, 97,114, 40,118,\n     97,114, 41, 10, 10,  9,105,102, 32,116,111,110,117,109, 98,\n    101,114, 40,118, 97,114, 41, 32,116,104,101,110, 32,114,101,\n    116,117,114,110, 32,118, 97,114, 32,101,110,100, 10, 10,  9,\n    108,111, 99, 97,108, 32, 99, 32, 61, 32, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,\n      9,119,104,105,108,101, 32, 99, 32,100,111, 10,  9,  9,108,\n    111, 99, 97,108, 32,110,115, 32, 61, 32,103,101,116,110, 97,\n    109,101,115,112, 97, 99,101, 40, 99, 41, 10,  9,  9,102,111,\n    114, 32,107, 44,118, 32,105,110, 32,112, 97,105,114,115, 40,\n     95,103,108,111, 98, 97,108, 95,101,110,117,109,115, 41, 32,\n    100,111, 10,  9,  9,  9,105,102, 32,109, 97,116, 99,104, 95,\n    116,121,112,101, 40,118, 97,114, 44, 32,118, 44, 32,110,115,\n     41, 32,116,104,101,110, 10,  9,  9,  9,  9,114,101,116,117,\n    114,110, 32,118, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,\n    110,100, 10,  9,  9,105,102, 32, 99, 46, 98, 97,115,101, 32,\n     97,110,100, 32, 99, 46, 98, 97,115,101, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10,  9,  9,  9, 99, 32, 61, 32, 95,\n    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,\n     99, 58,102,105,110,100,116,121,112,101, 40, 99, 46, 98, 97,\n    115,101, 41, 93, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,\n     99, 32, 61, 32,110,105,108, 10,  9,  9,101,110,100, 10,  9,\n    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,118, 97,\n    114, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107,\n     32,105,102, 32,105,115, 32, 97, 32,114,101,103,105,115,116,\n    101,114,101,100, 32,116,121,112,101, 58, 32,114,101,116,117,\n    114,110, 32,102,117,108,108, 32,116,121,112,101, 32,111,114,\n     32,110,105,108, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,102,\n    105,110,100,116,121,112,101, 32, 40,116, 41, 10, 10,  9,116,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    116, 44, 32, 34, 61, 46, 42, 34, 44, 32, 34, 34, 41, 10,  9,\n    105,102, 32, 95, 98, 97,115,105, 99, 91,116, 93, 32,116,104,\n    101,110, 10,  9, 32,114,101,116,117,114,110, 32,116, 10,  9,\n    101,110,100, 10, 10,  9,108,111, 99, 97,108, 32, 95, 44, 95,\n     44,101,109, 32, 61, 32,115,116,114,105,110,103, 46,102,105,\n    110,100, 40,116, 44, 32, 34, 40, 91, 38, 37, 42, 93, 41, 37,\n    115, 42, 36, 34, 41, 10,  9,116, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, 37,115, 42,\n     40, 91, 38, 37, 42, 93, 41, 37,115, 42, 36, 34, 44, 32, 34,\n     34, 41, 10,  9,112, 32, 61, 32,115,101,108,102, 10,  9,119,\n    104,105,108,101, 32,112, 32, 97,110,100, 32,116,121,112,101,\n     40,112, 41, 61, 61, 39,116, 97, 98,108,101, 39, 32,100,111,\n     10,  9,  9,108,111, 99, 97,108, 32,115,116, 32, 61, 32,103,\n    101,116,110, 97,109,101,115,112, 97, 99,101, 40,112, 41, 10,\n     10,  9,  9,102,111,114, 32,105, 61, 95,103,108,111, 98, 97,\n    108, 95,116,121,112,101,115, 46,110, 44, 49, 44, 45, 49, 32,\n    100,111, 32, 45, 45, 32,105,110, 32,114,101,118,101,114,115,\n    101, 32,111,114,100,101,114, 10, 10,  9,  9,  9,105,102, 32,\n    109, 97,116, 99,104, 95,116,121,112,101, 40,116, 44, 32, 95,\n    103,108,111, 98, 97,108, 95,116,121,112,101,115, 91,105, 93,\n     44, 32,115,116, 41, 32,116,104,101,110, 10,  9,  9,  9,  9,\n    114,101,116,117,114,110, 32, 95,103,108,111, 98, 97,108, 95,\n    116,121,112,101,115, 91,105, 93, 46, 46, 40,101,109, 32,111,\n    114, 32, 34, 34, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,\n    101,110,100, 10,  9,  9,105,102, 32,112, 46, 98, 97,115,101,\n     32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126, 61, 32,\n     39, 39, 32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126,\n     61, 32,116, 32,116,104,101,110, 10,  9,  9,  9, 45, 45,112,\n    114,105,110,116, 40, 34,116,121,112,101, 32,105,115, 32, 34,\n     46, 46,116, 46, 46, 34, 44, 32,112, 32,105,115, 32, 34, 46,\n     46,112, 46, 98, 97,115,101, 46, 46, 34, 32,115,101,108,102,\n     46,116,121,112,101, 32,105,115, 32, 34, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 34, 32,115,101,108,102, 46,\n    110, 97,109,101, 32,105,115, 32, 34, 46, 46,115,101,108,102,\n     46,110, 97,109,101, 41, 10,  9,  9,  9,112, 32, 61, 32, 95,\n    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,\n    112, 58,102,105,110,100,116,121,112,101, 40,112, 46, 98, 97,\n    115,101, 41, 93, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,\n    112, 32, 61, 32,110,105,108, 10,  9,  9,101,110,100, 10,  9,\n    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,110,105,\n    108, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32, 97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,\n    116,121,112,101, 40,116, 44, 32, 99,108, 97,115,115, 41, 10,\n      9, 95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 46,\n    110, 32, 61, 32, 95,103,108,111, 98, 97,108, 95,116,121,112,\n    101,115, 46,110, 32, 43, 49, 10,  9, 95,103,108,111, 98, 97,\n    108, 95,116,121,112,101,115, 91, 95,103,108,111, 98, 97,108,\n     95,116,121,112,101,115, 46,110, 93, 32, 61, 32,116, 10,  9,\n     95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 95,104,\n     97,115,104, 91,116, 93, 32, 61, 32, 49, 10,  9,105,102, 32,\n     99,108, 97,115,115, 32,116,104,101,110, 32, 97,112,112,101,\n    110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,116,\n     44, 32, 99,108, 97,115,115, 41, 32,101,110,100, 10,101,110,\n    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,\n    101,110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,\n    116, 44, 99,108, 97,115,115, 41, 10,  9,105,102, 32, 95,103,\n    108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116,\n     93, 32,116,104,101,110, 10,  9,  9, 99,108, 97,115,115, 46,\n    102,108, 97,103,115, 32, 61, 32, 95,103,108,111, 98, 97,108,\n     95, 99,108, 97,115,115,101,115, 91,116, 93, 46,102,108, 97,\n    103,115, 10,  9,  9, 99,108, 97,115,115, 46,108,110, 97,109,\n    101,115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108,\n     97,115,115,101,115, 91,116, 93, 46,108,110, 97,109,101,115,\n     10,  9,  9,105,102, 32, 95,103,108,111, 98, 97,108, 95, 99,\n    108, 97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,\n     97,110,100, 32, 40, 95,103,108,111, 98, 97,108, 95, 99,108,\n     97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,126,\n     61, 32, 39, 39, 41, 32,116,104,101,110, 10,  9,  9,  9, 99,\n    108, 97,115,115, 46, 98, 97,115,101, 32, 61, 32, 95,103,108,\n    111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116, 93,\n     46, 98, 97,115,101, 32,111,114, 32, 99,108, 97,115,115, 46,\n     98, 97,115,101, 10,  9,  9,101,110,100, 10,  9,101,110,100,\n     10,  9, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115,\n    101,115, 91,116, 93, 32, 61, 32, 99,108, 97,115,115, 10,  9,\n     99,108, 97,115,115, 46,102,108, 97,103,115, 32, 61, 32, 99,\n    108, 97,115,115, 46,102,108, 97,103,115, 32,111,114, 32,123,\n    125, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32,109, 97,116, 99,104, 95,116,121,112,101, 40, 99,104,105,\n    108,100,116,121,112,101, 44, 32,114,101,103,116,121,112,101,\n     44, 32,115,116, 41, 10, 45, 45,112,114,105,110,116, 40, 34,\n    102,105,110,100,116,121,112,101, 32, 34, 46, 46, 99,104,105,\n    108,100,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,114,\n    101,103,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,115,\n    116, 41, 10,  9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,114,101,\n    103,116,121,112,101, 44, 32, 99,104,105,108,100,116,121,112,\n    101, 44, 32, 45,115,116,114,105,110,103, 46,108,101,110, 40,\n     99,104,105,108,100,116,121,112,101, 41, 44, 32,116,114,117,\n    101, 41, 10,  9,105,102, 32, 98, 32,116,104,101,110, 10, 10,\n      9,  9,105,102, 32,101, 32, 61, 61, 32,115,116,114,105,110,\n    103, 46,108,101,110, 40,114,101,103,116,121,112,101, 41, 32,\n     97,110,100, 10,  9,  9,  9,  9, 40, 98, 32, 61, 61, 32, 49,\n     32,111,114, 32, 40,115,116,114,105,110,103, 46,115,117, 98,\n     40,114,101,103,116,121,112,101, 44, 32, 98, 45, 49, 44, 32,\n     98, 45, 49, 41, 32, 61, 61, 32, 39, 58, 39, 32, 97,110,100,\n     10,  9,  9,  9,  9,115,116,114,105,110,103, 46,115,117, 98,\n     40,114,101,103,116,121,112,101, 44, 32, 49, 44, 32, 98, 45,\n     49, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,115,117,\n     98, 40,115,116, 44, 32, 49, 44, 32, 98, 45, 49, 41, 41, 41,\n     32,116,104,101,110, 10,  9,  9,  9,114,101,116,117,114,110,\n     32,116,114,117,101, 10,  9,  9,101,110,100, 10,  9,101,110,\n    100, 10, 10,  9,114,101,116,117,114,110, 32,102, 97,108,115,\n    101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32,102,105,110,100,116,121,112,101, 95,111,110, 95, 99,104,\n    105,108,100,115, 40,115,101,108,102, 44, 32,116, 41, 10, 10,\n      9,108,111, 99, 97,108, 32,116, 99,104,105,108,100, 10,  9,\n    105,102, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,\n    112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,\n    114, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,112,\n    101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101,\n     39, 32,116,104,101,110, 10,  9,  9,102,111,114, 32,107, 44,\n    118, 32,105,110, 32,105,112, 97,105,114,115, 40,115,101,108,\n    102, 41, 32,100,111, 10,  9,  9,  9,105,102, 32,118, 46, 99,\n    108, 97,115,115,116,121,112,101, 32, 61, 61, 32, 39, 99,108,\n     97,115,115, 39, 32,111,114, 32,118, 46, 99,108, 97,115,115,\n    116,121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112,\n     97, 99,101, 39, 32,116,104,101,110, 10,  9,  9,  9,  9,105,\n    102, 32,118, 46,116,121,112,101,100,101,102,115, 32, 97,110,\n    100, 32,118, 46,116,121,112,101,100,101,102,115, 91,116, 93,\n     32,116,104,101,110, 10,  9,  9,  9,  9, 32,114,101,116,117,\n    114,110, 32,118, 46,116,121,112,101,100,101,102,115, 91,116,\n     93, 10,  9,  9,  9,  9,101,108,115,101,105,102, 32,118, 46,\n    117,115,101,114,116,121,112,101,115, 32, 97,110,100, 32,118,\n     46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116,\n    104,101,110, 10,  9,  9,  9,  9, 32,114,101,116,117,114,110,\n     32,118, 46,117,115,101,114,116,121,112,101,115, 91,116, 93,\n     10,  9,  9,  9,  9,101,110,100, 10,  9,  9,  9,  9,116, 99,\n    104,105,108,100, 32, 61, 32,102,105,110,100,116,121,112,101,\n     95,111,110, 95, 99,104,105,108,100,115, 40,118, 44, 32,116,\n     41, 10,  9,  9,  9,  9,105,102, 32,116, 99,104,105,108,100,\n     32,116,104,101,110, 32,114,101,116,117,114,110, 32,116, 99,\n    104,105,108,100, 32,101,110,100, 10,  9,  9,  9,101,110,100,\n     10,  9,  9,101,110,100, 10,  9,101,110,100, 10,  9,114,101,\n    116,117,114,110, 32,110,105,108, 10, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 58,105,115,101,110,117,109,\n     32, 40,116,121,112,101, 41, 10, 32,105,102, 32,103,108,111,\n     98, 97,108, 95,101,110,117,109,115, 91,116,121,112,101, 93,\n     32,116,104,101,110, 10,  9,114,101,116,117,114,110, 32,116,\n    121,112,101, 10, 32,101,108,115,101, 10, 32,  9,114,101,116,\n    117,114,110, 32,102, 97,108,115,101, 10, 32,101,110,100, 10,\n     10, 32,108,111, 99, 97,108, 32, 98, 97,115,101,116,121,112,\n    101, 32, 61, 32,103,115,117, 98, 40,116,121,112,101, 44, 34,\n     94, 46, 42, 58, 58, 34, 44, 34, 34, 41, 10, 32,108,111, 99,\n     97,108, 32,101,110,118, 32, 61, 32,115,101,108,102, 10, 32,\n    119,104,105,108,101, 32,101,110,118, 32,100,111, 10, 32, 32,\n    105,102, 32,101,110,118, 46,101,110,117,109,115, 32,116,104,\n    101,110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49,\n     10, 32, 32, 32,119,104,105,108,101, 32,101,110,118, 46,101,\n    110,117,109,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,\n    105,102, 32,101,110,118, 46,101,110,117,109,115, 91,105, 93,\n     46,110, 97,109,101, 32, 61, 61, 32, 98, 97,115,101,116,121,\n    112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,114,101,116,117,114,110, 32,116,114,117,101, 10, 32,\n     32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,\n     32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118,\n     32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32,\n    101,110,100, 10, 32,114,101,116,117,114,110, 32,102, 97,108,\n    115,101, 10,101,110,100, 10, 10,109,101,116,104,111,100,105,\n    115,118,105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115,\n    101, 32, 45, 45, 32, 97, 32,103,108,111, 98, 97,108, 10, 10,\n     45, 45, 32,112, 97,114,115,101, 32, 99,104,117,110,107, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 58,100,111,112, 97,114,115,\n    101, 32, 40,115, 41, 10, 45, 45,112,114,105,110,116, 32, 40,\n     34,112, 97,114,115,101, 32, 34, 46, 46,115, 41, 10, 10, 32,\n     45, 45, 32,116,114,121, 32,116,104,101, 32,112, 97,114,115,\n    101,114, 32,104,111,111,107, 10, 32,100,111, 10, 32,  9,108,\n    111, 99, 97,108, 32,115,117, 98, 32, 61, 32,112, 97,114,115,\n    101,114, 95,104,111,111,107, 40,115, 41, 10, 32,  9,105,102,\n     32,115,117, 98, 32,116,104,101,110, 10, 32,  9,  9,114,101,\n    116,117,114,110, 32,115,117, 98, 10, 32,  9,101,110,100, 10,\n     32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,116,\n    104,101, 32,110,117,108,108, 32,115,116, 97,116,101,109,101,\n    110,116, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115,\n     42, 59, 34, 41, 10, 32,  9,105,102, 32, 98, 32,116,104,101,\n    110, 10, 32,  9,  9,114,101,116,117,114,110, 32,115,116,114,\n    115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,  9,101,110,\n    100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121,\n     32,101,109,112,116,121, 32,118,101,114, 98, 97,116,105,109,\n     32,108,105,110,101, 10, 32,100,111, 10, 32,  9,108,111, 99,\n     97,108, 32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34,\n     94, 37,115, 42, 36, 92,110, 34, 41, 10, 32,  9,105,102, 32,\n     98, 32,116,104,101,110, 10, 32,  9,  9,114,101,116,117,114,\n    110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41,\n     10, 32,  9,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45,\n     45, 32,116,114,121, 32, 76,117, 97, 32, 99,111,100,101, 10,\n     32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101,\n     44, 99,111,100,101, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44, 34, 94, 37,115, 42, 40, 37, 98, 92, 49, 92, 50,\n     41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,\n     10, 32, 32, 32, 67,111,100,101, 40,115,116,114,115,117, 98,\n     40, 99,111,100,101, 44, 50, 44, 45, 50, 41, 41, 10, 32, 32,\n     32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,\n    115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,\n    110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 67, 32, 99,\n    111,100,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108,\n     32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,\n    102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 37, 98,\n     92, 51, 92, 52, 41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10,  9, 99,111,100,101, 32, 61, 32, 39,123,\n     39, 46, 46,115,116,114,115,117, 98, 40, 99,111,100,101, 44,\n     50, 44, 45, 50, 41, 46, 46, 39, 92,110,125, 92,110, 39, 10,\n      9, 86,101,114, 98, 97,116,105,109, 40, 99,111,100,101, 44,\n     39,114, 39, 41, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,\n    118,101,114, 98, 97,116,105,109, 32, 99,111,100,101, 32,102,\n    111,114, 32, 39,114, 39,101,103,105,115,116,101,114, 32,102,\n    114, 97,103,109,101,110,116, 10,  9,114,101,116,117,114,110,\n     32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10,\n     32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45,\n     32,116,114,121, 32, 67, 32, 99,111,100,101, 32,102,111,114,\n     32,112,114,101, 97,109, 98,108,101, 32,115,101, 99,116,105,\n    111,110, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115,\n     42, 40, 37, 98, 92, 53, 92, 54, 41, 34, 41, 10, 32,  9,105,\n    102, 32, 98, 32,116,104,101,110, 10, 32,  9,  9, 99,111,100,\n    101, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,\n     99,111,100,101, 44, 32, 50, 44, 32, 45, 50, 41, 46, 46, 34,\n     92,110, 34, 10,  9,  9, 86,101,114, 98, 97,116,105,109, 40,\n     99,111,100,101, 44, 32, 39, 39, 41, 10,  9,  9,114,101,116,\n    117,114,110, 32,115,116,114,105,110,103, 46,115,117, 98, 40,\n    115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,100,101,\n    102, 97,117,108,116, 95,112,114,111,112,101,114,116,121, 32,\n    100,105,114,101, 99,116,105,118,101, 10, 32,100,111, 10, 32,\n      9,108,111, 99, 97,108, 32, 98, 44,101, 44,112,116,121,112,\n    101, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32,\n     34, 94, 37,115, 42, 84, 79, 76, 85, 65, 95, 80, 82, 79, 80,\n     69, 82, 84, 89, 95, 84, 89, 80, 69, 37,115, 42, 37, 40, 43,\n     37,115, 42, 40, 91, 94, 37, 41, 37,115, 93, 42, 41, 37,115,\n     42, 37, 41, 43, 37,115, 42, 59, 63, 34, 41, 10, 32,  9,105,\n    102, 32, 98, 32,116,104,101,110, 10, 32,  9,  9,105,102, 32,\n    110,111,116, 32,112,116,121,112,101, 32,111,114, 32,112,116,\n    121,112,101, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 10,\n     32,  9,  9,  9,112,116,121,112,101, 32, 61, 32, 34,100,101,\n    102, 97,117,108,116, 34, 10, 32,  9,  9,101,110,100, 10, 32,\n      9,  9,115,101,108,102, 58,115,101,116, 95,112,114,111,112,\n    101,114,116,121, 95,116,121,112,101, 40,112,116,121,112,101,\n     41, 10,  9, 32,  9,114,101,116,117,114,110, 32,115,116,114,\n    115,117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,\n    110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,\n    121, 32,112,114,111,116,101, 99,116,101,100, 95,100,101,115,\n    116,114,117, 99,116,111,114, 32,100,105,114,101, 99,116,105,\n    118,101, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,\n    110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 84, 79, 76, 85,\n     65, 95, 80, 82, 79, 84, 69, 67, 84, 69, 68, 95, 68, 69, 83,\n     84, 82, 85, 67, 84, 79, 82, 37,115, 42, 59, 63, 34, 41, 10,\n      9,105,102, 32, 98, 32,116,104,101,110, 10,  9,  9,105,102,\n     32,115,101,108,102, 46,115,101,116, 95,112,114,111,116,101,\n     99,116,101,100, 95,100,101,115,116,114,117, 99,116,111,114,\n     32,116,104,101,110, 10,  9, 32,  9,  9,115,101,108,102, 58,\n    115,101,116, 95,112,114,111,116,101, 99,116,101,100, 95,100,\n    101,115,116,114,117, 99,116,111,114, 40,116,114,117,101, 41,\n     10,  9, 32,  9,101,110,100, 10, 32,  9,  9,114,101,116,117,\n    114,110, 32,115,116,114,115,117, 98, 40,115, 44, 32,101, 43,\n     49, 41, 10, 32,  9,101,110,100, 10, 32,101,110,100, 10, 10,\n     32, 45, 45, 32,116,114,121, 32, 39,101,120,116,101,114,110,\n     39, 32,107,101,121,119,111,114,100, 10, 32,100,111, 10, 32,\n      9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94,\n     37,115, 42,101,120,116,101,114,110, 37,115, 43, 34, 41, 10,\n     32,  9,105,102, 32, 98, 32,116,104,101,110, 10,  9,  9, 45,\n     45, 32,100,111, 32,110,111,116,104,105,110,103, 10, 32,  9,\n      9,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,\n    115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 39,118,\n    105,114,116,117, 97,108, 39, 32,107,101,121,119,111,114,107,\n    100, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32, 98,\n     44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,\n    100, 40,115, 44, 32, 34, 94, 37,115, 42,118,105,114,116,117,\n     97,108, 37,115, 43, 34, 41, 10, 32,  9,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32,  9,  9,109,101,116,104,111,100,105,\n    115,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101,\n     10, 32,  9,  9,114,101,116,117,114,110, 32,115,116,114,115,\n    117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,\n    100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121,\n     32,108, 97, 98,101,108,115, 32, 40,112,117, 98,108,105, 99,\n     44, 32,112,114,105,118, 97,116,101, 44, 32,101,116, 99, 41,\n     10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32, 98, 44,\n    101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100,\n     40,115, 44, 32, 34, 94, 37,115, 42, 37,119, 42, 37,115, 42,\n     58, 91, 94, 58, 93, 34, 41, 10, 32,  9,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32,  9,  9,114,101,116,117,114,110, 32,\n    115,116,114,115,117, 98, 40,115, 44, 32,101, 41, 32, 45, 45,\n     32,112,114,101,115,101,114,118,101, 32,116,104,101, 32, 91,\n     94, 58, 93, 10, 32,  9,101,110,100, 10, 32,101,110,100, 10,\n     10, 32, 45, 45, 32,116,114,121, 32,109,111,100,117,108,101,\n     10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,\n    101, 44,110, 97,109,101, 44, 98,111,100,121, 32, 61, 32,115,\n    116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,109,\n    111,100,117,108,101, 37,115, 37,115, 42, 40, 91, 95, 37,119,\n     93, 91, 95, 37,119, 93, 42, 41, 37,115, 42, 40, 37, 98,123,\n    125, 41, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,\n    111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,\n     98, 44,101, 41, 10, 32, 32, 32, 77,111,100,117,108,101, 40,\n    110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114,\n    101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,\n    101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32,116,114,121, 32,110, 97,109,101,115,\n     97,112, 99,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,\n    108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94,\n     37,115, 42,110, 97,109,101,115,112, 97, 99,101, 37,115, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 93, 42, 41,\n     37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 59, 63, 34,\n     41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32,\n     32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,\n    115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32,\n     32, 32, 78, 97,109,101,115,112, 97, 99,101, 40,110, 97,109,\n    101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114,101,116,117,\n    114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49,\n     41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32,\n     45, 45, 32,116,114,121, 32,100,101,102,105,110,101, 10, 32,\n    100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100, 40,\n    115, 44, 34, 94, 37,115, 42, 35,100,101,102,105,110,101, 37,\n    115, 37,115, 42, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92,\n    110, 93, 42, 92,110, 37,115, 42, 34, 41, 10, 32, 32,105,102,\n     32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,\n    114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98,\n     40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 68,101,102,105,\n    110,101, 40,110, 97,109,101, 41, 10, 32, 32, 32,114,101,116,\n    117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43,\n     49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10,\n     32, 45, 45, 32,116,114,121, 32,101,110,117,109,101,114, 97,\n    116,101,115, 10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,\n    108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121,\n     44,118, 97,114,110, 97,109,101, 32, 61, 32,115,116,114,102,\n    105,110,100, 40,115, 44, 34, 94, 37,115, 42,101,110,117,109,\n     37,115, 43, 40, 37, 83, 42, 41, 37,115, 42, 40, 37, 98,123,\n    125, 41, 37,115, 42, 40, 91, 94, 37,115, 59, 93, 42, 41, 37,\n    115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32,\n     98, 32,116,104,101,110, 10, 32, 32, 32, 45, 45,101,114,114,\n    111,114, 40, 34, 35, 83,111,114,114,121, 44, 32,100,101, 99,\n    108, 97,114, 97,116,105,111,110, 32,111,102, 32,101,110,117,\n    109,115, 32, 97,110,100, 32,118, 97,114,105, 97, 98,108,101,\n    115, 32,111,110, 32,116,104,101, 32,115, 97,109,101, 32,115,\n    116, 97,116,101,109,101,110,116, 32,105,115, 32,110,111,116,\n     32,115,117,112,112,111,114,116,101,100, 46, 92,110, 68,101,\n     99,108, 97,114,101, 32,121,111,117,114, 32,118, 97,114,105,\n     97, 98,108,101, 32,115,101,112, 97,114, 97,116,101,108,121,\n     32, 40,101,120, 97,109,112,108,101, 58, 32, 39, 34, 46, 46,\n    110, 97,109,101, 46, 46, 34, 32, 34, 46, 46,118, 97,114,110,\n     97,109,101, 46, 46, 34, 59, 39, 41, 34, 41, 10, 32, 32, 32,\n     95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,\n    114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32,\n     69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44,\n     98,111,100,121, 44,118, 97,114,110, 97,109,101, 41, 10, 32,\n     32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98,\n     40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 10, 45, 45, 32,100,111, 10, 45, 45, 32, 32,\n    108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101, 44,\n     98,111,100,121, 32, 61, 32,115,116,114,102,105,110,100, 40,\n    115, 44, 34, 94, 37,115, 42,101,110,117,109, 37,115, 43, 40,\n     37, 83, 42, 41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115,\n     42, 59, 63, 37,115, 42, 34, 41, 10, 45, 45, 32, 32,105,102,\n     32, 98, 32,116,104,101,110, 10, 45, 45, 32, 32, 32, 95, 99,\n    117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,\n    117, 98, 40,115, 44, 98, 44,101, 41, 10, 45, 45, 32, 32, 32,\n     69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44,\n     98,111,100,121, 41, 10, 45, 45, 32, 32,114,101,116,117,114,\n    110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41,\n     10, 45, 45, 32, 32,101,110,100, 10, 45, 45, 32,101,110,100,\n     10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98,\n     44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,\n    116,121,112,101,100,101,102, 37,115, 43,101,110,117,109, 91,\n     94,123, 93, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91,\n     37,119, 95, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42, 59,\n     37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,\n    101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,\n    101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,\n    101, 41, 10, 32, 32, 32, 69,110,117,109,101,114, 97,116,101,\n     40,110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,\n    114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115,\n     44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,\n    100, 10, 10, 32, 45, 45, 32,116,114,121, 32,111,112,101,114,\n     97,116,111,114, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,\n    108, 32, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100,\n     44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,\n     95, 37,119, 93, 91, 95, 37,119, 37,115, 37, 42, 38, 58, 60,\n     62, 44, 93, 45, 37,115, 43,111,112,101,114, 97,116,111,114,\n     41, 37,115, 42, 40, 91, 94, 37,115, 93, 91, 94, 37,115, 93,\n     42, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40,\n     99, 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59,\n     37,115, 42, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32,\n     98, 32,116,104,101,110, 10,  9,  9, 32, 45, 45, 32,116,114,\n    121, 32,105,110,108,105,110,101, 10, 32, 32, 32, 98, 44,101,\n     44,100,101, 99,108, 44,107,105,110,100, 44, 97,114,103, 44,\n     99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91,\n     95, 37,119, 37,115, 37, 42, 38, 58, 60, 62, 44, 93, 45, 37,\n    115, 43,111,112,101,114, 97,116,111,114, 41, 37,115, 42, 40,\n     91, 94, 37,115, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42,\n     40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110,\n     63,115, 63,116, 63, 41, 91, 37,115, 92,110, 93, 42, 37, 98,\n    123,125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32,\n    116,104,101,110, 10, 32, 32,  9, 45, 45, 32,116,114,121, 32,\n     99, 97,115,116, 32,111,112,101,114, 97,116,111,114, 10, 32,\n     32,  9, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100,\n     44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40,\n    111,112,101,114, 97,116,111,114, 41, 37,115, 43, 40, 91, 37,\n    119, 95, 58, 37,100, 60, 62, 37, 42, 37, 38, 37,115, 93, 43,\n     41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99,\n     63,111, 63,110, 63,115, 63,116, 63, 41, 34, 41, 59, 10, 32,\n     32,  9,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32,  9,\n      9,108,111, 99, 97,108, 32, 95, 44,105,101, 32, 61, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34,\n     94, 37,115, 42, 37, 98,123,125, 34, 44, 32,101, 43, 49, 41,\n     10, 32, 32,  9,  9,105,102, 32,105,101, 32,116,104,101,110,\n     10, 32, 32,  9,  9,  9,101, 32, 61, 32,105,101, 10, 32, 32,\n      9,  9,101,110,100, 10, 32, 32,  9,101,110,100, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,\n     10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32,\n     61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41,\n     10, 32, 32, 32, 79,112,101,114, 97,116,111,114, 40,100,101,\n     99,108, 44,107,105,110,100, 44, 97,114,103, 44, 99,111,110,\n    115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,\n    116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,\n    114,121, 32,102,117,110, 99,116,105,111,110, 10, 32,100,111,\n     10, 32, 32, 45, 45,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,\n    115, 42, 40, 91,126, 95, 37,119, 93, 91, 95, 64, 37,119, 37,\n    115, 37, 42, 38, 58, 60, 62, 93, 42, 91, 95, 37,119, 93, 41,\n     37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,\n    111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37,\n    115, 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32,\n     32,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108,\n     44, 97,114,103, 44, 99,111,110,115,116, 44,118,105,114,116,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94,\n     37,115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115,\n     42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,\n    110, 63,115, 63,116, 63, 41, 37,115, 42, 40, 61, 63, 37,115,\n     42, 48, 63, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32,\n     32,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,\n     32, 32,  9, 45, 45, 32,116,114,121, 32,102,117,110, 99,116,\n    105,111,110, 32,119,105,116,104, 32,116,101,109,112,108, 97,\n    116,101, 10, 32, 32,  9, 98, 44,101, 44,100,101, 99,108, 44,\n     97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,114,\n    102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,126,\n     95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38, 58,\n     60, 62, 93, 42, 91, 95, 37,119, 93, 37, 98, 60, 62, 41, 37,\n    115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111,\n     63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37,115,\n     42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32,\n    116,104,101,110, 10, 32, 32, 32, 45, 45, 32,116,114,121, 32,\n     97, 32,115,105,110,103,108,101, 32,108,101,116,116,101,114,\n     32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 10,\n     32, 32, 32, 98, 44,101, 44,100,101, 99,108, 44, 97,114,103,\n     44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93,\n     41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99,\n     63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59, 37,\n    115, 42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102,\n     32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32,\n     45, 45, 32,116,114,121, 32,102,117,110, 99,116,105,111,110,\n     32,112,111,105,110,116,101,114, 10, 32, 32, 32, 98, 44,101,\n     44,100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94,\n     37,115, 42, 40, 91, 94, 37, 40, 59, 92,110, 93, 43, 37, 98,\n     40, 41, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42,\n     59, 37,115, 42, 34, 41, 10, 32, 32, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32, 32, 32, 32,100,101, 99,108, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,100,101,\n     99,108, 44, 32, 34, 37, 40, 37,115, 42, 37, 42, 40, 91, 94,\n     37, 41, 93, 42, 41, 37,115, 42, 37, 41, 34, 44, 32, 34, 32,\n     37, 49, 32, 34, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,\n     10, 32, 32,  9,105,102, 32,118,105,114,116, 32, 97,110,100,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,118,105,\n    114,116, 44, 32, 34, 91, 61, 48, 93, 34, 41, 32,116,104,101,\n    110, 10, 32, 32,  9,  9,105,102, 32,115,101,108,102, 46,102,\n    108, 97,103,115, 32,116,104,101,110, 10, 32, 32,  9,  9,  9,\n    115,101,108,102, 46,102,108, 97,103,115, 46,112,117,114,101,\n     95,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101,\n     10, 32, 32,  9,  9,101,110,100, 10, 32, 32,  9,101,110,100,\n     10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32,\n     61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41,\n     10, 32, 32, 32, 70,117,110, 99,116,105,111,110, 40,100,101,\n     99,108, 44, 97,114,103, 44, 99,111,110,115,116, 41, 10, 32,\n     32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98,\n     40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,105,110,\n    108,105,110,101, 32,102,117,110, 99,116,105,111,110, 10, 32,\n    100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,\n    115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115, 42,\n     40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110,\n     63,115, 63,116, 63, 41, 91, 94, 59,123, 93, 42, 37, 98,123,\n    125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32, 45,\n     45,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108,\n     44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,\n    126, 95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38,\n     58, 60, 62, 93, 42, 91, 95, 37,119, 62, 93, 41, 37,115, 42,\n     40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110,\n     63,115, 63,116, 63, 41, 91, 94, 59, 93, 42, 37, 98,123,125,\n     37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102,\n     32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32,\n     45, 45, 32,116,114,121, 32, 97, 32,115,105,110,103,108,101,\n     32,108,101,116,116,101,114, 32,102,117,110, 99,116,105,111,\n    110, 32,110, 97,109,101, 10, 32, 32, 32, 98, 44,101, 44,100,\n    101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,\n     42, 40, 91, 95, 37,119, 93, 41, 37,115, 42, 40, 37, 98, 40,\n     41, 41, 37,115, 42, 40, 99, 63,111, 63,110, 63,115, 63,116,\n     63, 41, 46, 45, 37, 98,123,125, 37,115, 42, 59, 63, 37,115,\n     42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, 32,\n     98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114,\n     95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,\n    115, 44, 98, 44,101, 41, 10, 32, 32, 32, 70,117,110, 99,116,\n    105,111,110, 40,100,101, 99,108, 44, 97,114,103, 44, 99,111,\n    110,115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,\n    115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,\n     32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,\n    116,114,121, 32, 99,108, 97,115,115, 10, 32,100,111, 10,  9,\n     32,108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101,\n     44, 98, 97,115,101, 44, 98,111,100,121, 10,  9,  9, 98, 97,\n    115,101, 32, 61, 32, 39, 39, 32, 98,111,100,121, 32, 61, 32,\n     39, 39, 10,  9,  9, 98, 44,101, 44,110, 97,109,101, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,\n     42, 99,108, 97,115,115, 37,115, 42, 40, 91, 95, 37,119, 93,\n     91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59, 34, 41, 32,\n     32, 45, 45, 32,100,117,109,109,121, 32, 99,108, 97,115,115,\n     10,  9,  9,108,111, 99, 97,108, 32,100,117,109,109,121, 32,\n     61, 32,102, 97,108,115,101, 10,  9,  9,105,102, 32,110,111,\n    116, 32, 98, 32,116,104,101,110, 10,  9,  9,  9, 98, 44,101,\n     44,110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99,116, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42,\n     41, 37,115, 42, 59, 34, 41, 32, 32, 32, 32, 45, 45, 32,100,\n    117,109,109,121, 32,115,116,114,117, 99,116, 10,  9,  9,  9,\n    105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,  9,\n      9,  9,  9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97,115,\n    101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,115, 44, 34, 94, 37,115, 42, 99,108, 97,115,115, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42,\n     41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115, 42, 40,\n     37, 98,123,125, 41, 37,115, 42, 34, 41, 10,  9,  9,  9,  9,\n    105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,  9,\n      9,  9,  9,  9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97,\n    115,101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,\n    110,100, 40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99,\n    116, 37,115, 43, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64,\n     93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115,\n     42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41, 10,  9,  9,\n      9,  9,  9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,\n    110, 10,  9,  9,  9,  9,  9,  9, 98, 44,101, 44,110, 97,109,\n    101, 44, 98, 97,115,101, 44, 98,111,100,121, 32, 61, 32,115,\n    116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,117,\n    110,105,111,110, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95,\n     37,119, 64, 93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45,\n     41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41,\n     10,  9,  9,  9,  9,  9,  9,105,102, 32,110,111,116, 32, 98,\n     32,116,104,101,110, 10,  9,  9,  9,  9,  9,  9,  9, 98, 97,\n    115,101, 32, 61, 32, 39, 39, 10,  9,  9,  9,  9,  9,  9,  9,\n     98, 44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,\n     42,116,121,112,101,100,101,102, 37,115, 37,115, 42,115,116,\n    114,117, 99,116, 37,115, 37,115, 42, 91, 95, 37,119, 93, 42,\n     37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91, 95,\n     37,119, 93, 91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59,\n     34, 41, 10,  9,  9,  9,  9,  9,  9,101,110,100, 10,  9,  9,\n      9,  9,  9,101,110,100, 10,  9,  9,  9,  9,101,110,100, 10,\n      9,  9,  9,101,108,115,101, 32,100,117,109,109,121, 32, 61,\n     32, 49, 32,101,110,100, 10,  9,  9,101,108,115,101, 32,100,\n    117,109,109,121, 32, 61, 32, 49, 32,101,110,100, 10,  9,  9,\n    105,102, 32, 98, 32,116,104,101,110, 10,  9,  9,  9,105,102,\n     32, 98, 97,115,101, 32,126, 61, 32, 39, 39, 32,116,104,101,\n    110, 10,  9,  9,  9,  9, 98, 97,115,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44,\n     32, 34, 94, 37,115, 42, 58, 37,115, 42, 34, 44, 32, 34, 34,\n     41, 10,  9,  9,  9,  9, 98, 97,115,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44,\n     32, 34, 37,115, 42,112,117, 98,108,105, 99, 37,115, 42, 34,\n     44, 32, 34, 34, 41, 10,  9,  9,  9,  9, 98, 97,115,101, 32,\n     61, 32,115,112,108,105,116, 40, 98, 97,115,101, 44, 32, 34,\n     44, 34, 41, 10,  9,  9,  9,  9, 45, 45,108,111, 99, 97,108,\n     32, 98, 44,101, 10,  9,  9,  9,  9, 45, 45, 98, 44,101, 44,\n     98, 97,115,101, 32, 61, 32,115,116,114,102,105,110,100, 40,\n     98, 97,115,101, 44, 34, 46, 45, 40, 91, 95, 37,119, 93, 91,\n     95, 37,119, 60, 62, 44, 58, 93, 42, 41, 36, 34, 41, 10,  9,\n      9,  9,101,108,115,101, 10,  9,  9,  9,  9, 98, 97,115,101,\n     32, 61, 32,123,125, 10,  9,  9,  9,101,110,100, 10,  9,  9,\n      9, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,\n    116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10,  9,  9,\n      9, 67,108, 97,115,115, 40,110, 97,109,101, 44, 98, 97,115,\n    101, 44, 98,111,100,121, 41, 10,  9,  9,  9,105,102, 32,110,\n    111,116, 32,100,117,109,109,121, 32,116,104,101,110, 10,  9,\n      9,  9,  9,118, 97,114, 98, 44,118, 97,114,101, 44,118, 97,\n    114,110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46,\n    102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40, 91,\n     95, 37,119, 93, 43, 41, 37,115, 42, 59, 34, 44, 32,101, 43,\n     49, 41, 10,  9,  9,  9,  9,105,102, 32,118, 97,114, 98, 32,\n    116,104,101,110, 10,  9,  9,  9,  9,  9, 86, 97,114,105, 97,\n     98,108,101, 40,110, 97,109,101, 46, 46, 34, 32, 34, 46, 46,\n    118, 97,114,110, 97,109,101, 41, 10,  9,  9,  9,  9,  9,101,\n     32, 61, 32,118, 97,114,101, 10,  9,  9,  9,  9,101,110,100,\n     10,  9,  9,  9,101,110,100, 10,  9,  9,  9,114,101,116,117,\n    114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49,\n     41, 10,  9,  9,101,110,100, 10,  9,101,110,100, 10, 10, 32,\n     45, 45, 32,116,114,121, 32,116,121,112,101,100,101,102, 10,\n     32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101,\n     44,116,121,112,101,115, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,115, 44, 34, 94, 37,115, 42,116,121,112,101,100,101,\n    102, 37,115, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 59, 37,\n    115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,\n    110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101,\n     32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101,\n     41, 10, 32, 32, 32, 84,121,112,101,100,101,102, 40,116,121,\n    112,101,115, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,\n    115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,\n     32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,\n    116,114,121, 32,118, 97,114,105, 97, 98,108,101, 10, 32,100,\n    111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100,\n    101, 99,108, 32, 61, 32,115,116,114,102,105,110,100, 40,115,\n     44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 64,\n     37,115, 37,119, 37,100, 37, 42, 38, 58, 60, 62, 44, 93, 42,\n     91, 95, 37,119, 37,100, 93, 41, 37,115, 42, 59, 37,115, 42,\n     34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10,\n     32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61,\n     32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10,\n     10,  9,108,111, 99, 97,108, 32,108,105,115,116, 32, 61, 32,\n    115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,\n    100,101, 99,108, 44, 32, 34, 44, 34, 41, 10,  9, 86, 97,114,\n    105, 97, 98,108,101, 40,108,105,115,116, 91, 49, 93, 41, 10,\n      9,105,102, 32,108,105,115,116, 46,110, 32, 62, 32, 49, 32,\n    116,104,101,110, 10,  9,  9,108,111, 99, 97,108, 32, 95, 44,\n     95, 44,116,121,112,101, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,108,105,115,116, 91, 49, 93, 44, 32, 34, 40, 46, 45,\n     41, 37,115, 43, 40, 91, 94, 37,115, 93, 42, 41, 36, 34, 41,\n     59, 10, 10,  9,  9,108,111, 99, 97,108, 32,105, 32, 61, 50,\n     59, 10,  9,  9,119,104,105,108,101, 32,108,105,115,116, 91,\n    105, 93, 32,100,111, 10,  9,  9,  9, 86, 97,114,105, 97, 98,\n    108,101, 40,116,121,112,101, 46, 46, 34, 32, 34, 46, 46,108,\n    105,115,116, 91,105, 93, 41, 10,  9,  9,  9,105, 61,105, 43,\n     49, 10,  9,  9,101,110,100, 10,  9,101,110,100, 10, 32, 32,\n     32, 45, 45, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99,\n    108, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116,\n    114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,\n    110,100, 10, 32,101,110,100, 10, 10,  9, 45, 45, 32,116,114,\n    121, 32,115,116,114,105,110,103, 10, 32,100,111, 10, 32, 32,\n    108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 63, 91, 95, 37,115, 37,119,\n     37,100, 93, 45, 99,104, 97,114, 37,115, 43, 91, 95, 64, 37,\n    119, 37,100, 93, 42, 37,115, 42, 37, 91, 37,115, 42, 37, 83,\n     43, 37,115, 42, 37, 93, 41, 37,115, 42, 59, 37,115, 42, 34,\n     41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32,\n     32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,\n    115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32,\n     32, 32, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99,108,\n     41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116,114,\n    115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,\n    100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121,\n     32, 97,114,114, 97,121, 10, 32,100,111, 10, 32, 32,108,111,\n     99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,\n     40, 91, 95, 37,119, 93, 91, 93, 91, 95, 64, 37,115, 37,119,\n     37,100, 37, 42, 38, 58, 60, 62, 93, 42, 91, 93, 95, 37,119,\n     37,100, 93, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32,\n     32,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95,\n     99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,\n    115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 65,\n    114,114, 97,121, 40,100,101, 99,108, 41, 10, 32, 32, 32,114,\n    101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,\n    101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32,110,111, 32,109, 97,116, 99,104,105,\n    110,103, 10, 32,105,102, 32,103,115,117, 98, 40,115, 44, 34,\n     37,115, 37,115, 42, 34, 44, 34, 34, 41, 32,126, 61, 32, 34,\n     34, 32,116,104,101,110, 10, 32, 32, 95, 99,117,114,114, 95,\n     99,111,100,101, 32, 61, 32,115, 10, 32, 32,101,114,114,111,\n    114, 40, 34, 35,112, 97,114,115,101, 32,101,114,114,111,114,\n     34, 41, 10, 32,101,108,115,101, 10, 32, 32,114,101,116,117,\n    114,110, 32, 34, 34, 10, 32,101,110,100, 10, 10,101,110,100,\n     10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 58,112, 97,114,115,\n    101, 32, 40,115, 41, 10, 10,  9, 45, 45,115,101,108,102, 46,\n     99,117,114,114, 95,109,101,109, 98,101,114, 95, 97, 99, 99,\n    101,115,115, 32, 61, 32,110,105,108, 10, 10, 32,119,104,105,\n    108,101, 32,115, 32,126, 61, 32, 39, 39, 32,100,111, 10, 32,\n     32,115, 32, 61, 32,115,101,108,102, 58,100,111,112, 97,114,\n    115,101, 40,115, 41, 10, 32, 32,109,101,116,104,111,100,105,\n    115,118,105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115,\n    101, 10, 32,101,110,100, 10,101,110,100, 10, 10, 10, 45, 45,\n     32,112,114,111,112,101,114,116,121, 32,116,121,112,101,115,\n     10, 10,102,117,110, 99,116,105,111,110, 32,103,101,116, 95,\n    112,114,111,112,101,114,116,121, 95,116,121,112,101, 40, 41,\n     10, 10,  9,114,101,116,117,114,110, 32, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,\n    103,101,116, 95,112,114,111,112,101,114,116,121, 95,116,121,\n    112,101, 40, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,\n    110,101,114, 58,115,101,116, 95,112,114,111,112,101,114,116,\n    121, 95,116,121,112,101, 40,112,116,121,112,101, 41, 10,  9,\n    112,116,121,112,101, 32, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40,112,116,121,112,101, 44, 32, 34, 94, 37,\n    115, 42, 34, 44, 32, 34, 34, 41, 10,  9,112,116,121,112,101,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    112,116,121,112,101, 44, 32, 34, 37,115, 42, 36, 34, 44, 32,\n     34, 34, 41, 10, 10,  9,115,101,108,102, 46,112,114,111,112,\n    101,114,116,121, 95,116,121,112,101, 32, 61, 32,112,116,121,\n    112,101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 58,103,101,116, 95,112,114,111,112,101,114,116,121, 95,\n    116,121,112,101, 40, 41, 10,  9,114,101,116,117,114,110, 32,\n    115,101,108,102, 46,112,114,111,112,101,114,116,121, 95,116,\n    121,112,101, 32,111,114, 32, 40,115,101,108,102, 46,112, 97,\n    114,101,110,116, 32, 97,110,100, 32,115,101,108,102, 46,112,\n     97,114,101,110,116, 58,103,101,116, 95,112,114,111,112,101,\n    114,116,121, 95,116,121,112,101, 40, 41, 41, 32,111,114, 32,\n     34,100,101,102, 97,117,108,116, 34, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/container.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,112, 97, 99,107, 97,\n    103,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,\n    116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,\n    114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,\n    114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32,\n     74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100,\n     58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,\n    100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,\n    119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,\n    101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32,\n     97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,\n    116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119,\n     97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,\n    114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,\n    110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115,\n     44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,\n    116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,\n    105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,\n    105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101,\n     44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,\n    116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,\n    109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,\n    105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45,\n     32, 80, 97, 99,107, 97,103,101, 32, 99,108, 97,115,115, 10,\n     45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,116,\n    104,101, 32,119,104,111,108,101, 32,112, 97, 99,107, 97,103,\n    101, 32, 98,101,105,110,103, 32, 98,111,117,110,100, 46, 10,\n     45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,110,\n    103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,116,\n    111,114,101,100, 58, 10, 45, 45, 32, 32, 32, 32,123,105,125,\n     32, 61, 32,108,105,115,116, 32,111,102, 32,111, 98,106,101,\n     99,116,115, 32,105,110, 32,116,104,101, 32,112, 97, 99,107,\n     97,103,101, 46, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,\n    103,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,\n    112,101, 32, 61, 32, 39,112, 97, 99,107, 97,103,101, 39, 10,\n    125, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 46,\n     95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115,\n     80, 97, 99,107, 97,103,101, 10,115,101,116,109,101,116, 97,\n    116, 97, 98,108,101, 40, 99,108, 97,115,115, 80, 97, 99,107,\n     97,103,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,\n    110,101,114, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,\n    109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110,\n     32, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,\n    114,105,110,116, 32, 40, 41, 10, 32,112,114,105,110,116, 40,\n     34, 80, 97, 99,107, 97,103,101, 58, 32, 34, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 41, 10, 32,108,111, 99, 97,108,\n     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,\n    102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,\n    105, 93, 58,112,114,105,110,116, 40, 34, 34, 44, 34, 34, 41,\n     10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100,\n     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114,\n    101,112,114,111, 99,101,115,115, 32, 40, 41, 10, 10, 32, 45,\n     45, 32, 97,118,111,105,100, 32,112,114,101,112,114,111, 99,\n    101,115,115,105,110,103, 32,101,109, 98,101,100,100,101,100,\n     32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99, 97,\n    108, 32, 76, 32, 61, 32,123,125, 10, 32,115,101,108,102, 46,\n     99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,\n    102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 37, 36,\n     37, 91, 34, 44, 34, 92, 49, 34, 41, 32, 45, 45, 32,100,101,\n     97,108, 32,119,105,116,104, 32,101,109, 98,101,100,100,101,\n    100, 32,108,117, 97, 32, 99,111,100,101, 10, 32,115,101,108,\n    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,\n    101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42,\n     37, 36, 37, 93, 34, 44, 34, 92, 50, 34, 41, 10, 32,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98, 92,\n     49, 92, 50, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,117,\n    110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,105,\n    110,115,101,114,116, 40, 76, 44, 99, 41, 10, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,\n    116,117,114,110, 32, 34, 92,110, 35, 91, 34, 46, 46,103,101,\n    116,110, 40, 76, 41, 46, 46, 34, 93, 35, 34, 10, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,\n    100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,\n    101,112,114,111, 99,101,115,115,105,110,103, 32,101,109, 98,\n    101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,108,\n    111, 99, 97,108, 32, 67, 32, 61, 32,123,125, 10, 32,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115,\n     42, 37, 36, 37, 60, 34, 44, 34, 92, 51, 34, 41, 32, 45, 45,\n     32,100,101, 97,108, 32,119,105,116,104, 32,101,109, 98,101,\n    100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115,\n     42, 37, 36, 37, 62, 34, 44, 34, 92, 52, 34, 41, 10, 32,115,\n    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,\n     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98,\n     92, 51, 92, 52, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,\n    117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,\n    105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,\n    101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46, 46,103,\n    101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,\n    110,100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,\n    114,101,112,114,111, 99,101,115,115,105,110,103, 32,101,109,\n     98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,\n    115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117,\n     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110,\n     37,115, 42, 37, 36, 37,123, 34, 44, 34, 92, 53, 34, 41, 32,\n     45, 45, 32,100,101, 97,108, 32,119,105,116,104, 32,101,109,\n     98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,\n    115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117,\n     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110,\n     37,115, 42, 37, 36, 37,125, 34, 44, 34, 92, 54, 34, 41, 10,\n     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,\n    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40,\n     37, 98, 92, 53, 92, 54, 41, 34, 44, 32, 32, 32, 32, 32, 32,\n     32,102,117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,116,105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,114,101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46,\n     46,103,101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,101,110,100, 41, 10, 10, 32, 45, 45,115,101,108,102, 46,\n     99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,\n    102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 35, 91,\n     94,100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34,\n     92,110, 92,110, 34, 41, 32, 45, 45, 32,101,108,105,109,105,\n    110, 97,116,101, 32,112,114,101,112,114,111, 99,101,115,115,\n    111,114, 32,100,105,114,101, 99,116,105,118,101,115, 32,116,\n    104, 97,116, 32,100,111,110, 39,116, 32,115,116, 97,114,116,\n     32,119,105,116,104, 32, 39,100, 39, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 92,110, 91, 32, 92,116,\n     93, 42, 35, 91, 32, 92,116, 93, 42, 91, 94,100, 37, 60, 37,\n     91, 93, 34, 44, 32, 34, 92,110, 47, 47, 34, 41, 32, 45, 45,\n     32,101,108,105,109,105,110, 97,116,101, 32,112,114,101,112,\n    114,111, 99,101,115,115,111,114, 32,100,105,114,101, 99,116,\n    105,118,101,115, 32,116,104, 97,116, 32,100,111,110, 39,116,\n     32,115,116, 97,114,116, 32,119,105,116,104, 32, 39,100, 39,\n     10, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,101,\n    112,114,111, 99,101,115,115,105,110,103, 32,118,101,114, 98,\n     97,116,105,109, 32,108,105,110,101,115, 10, 32,108,111, 99,\n     97,108, 32, 86, 32, 61, 32,123,125, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 92,110, 40, 37,115, 42,\n     37, 36, 91, 94, 37, 91, 37, 93, 93, 91, 94, 92,110, 93, 42,\n     41, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,118, 41,\n     10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32,116,105,110,115,101,114,116, 40, 86, 44,118, 41,\n     10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32,114,101,116,117,114,110, 32, 34, 92,110, 35, 34,\n     46, 46,103,101,116,110, 40, 86, 41, 46, 46, 34, 35, 34, 10,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,101,110,100, 41, 10, 10, 32, 45, 45, 32,112,101,114,102,\n    111,114,109, 32,103,108,111, 98, 97,108, 32,115,117, 98,115,\n    116,105,116,117,116,105,111,110, 10, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 40, 47, 47, 91, 94, 92,\n    110, 93, 42, 41, 34, 44, 34, 34, 41, 32, 32, 32, 32, 32, 45,\n     45, 32,101,108,105,109,105,110, 97,116,101, 32, 67, 43, 43,\n     32, 99,111,109,109,101,110,116,115, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 47, 37, 42, 34, 44, 34,\n     92, 49, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,101,\n     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,\n    100,101, 44, 34, 37, 42, 47, 34, 44, 34, 92, 50, 34, 41, 10,\n     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,\n    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,\n     98, 92, 49, 92, 50, 34, 44, 34, 34, 41, 10, 32,115,101,108,\n    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,\n    101,108,102, 46, 99,111,100,101, 44, 34, 92, 49, 34, 44, 34,\n     47, 37, 42, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,\n    101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,\n    111,100,101, 44, 34, 92, 50, 34, 44, 34, 37, 42, 47, 34, 41,\n     10, 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,\n    115,117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34,\n     37,115, 42, 64, 37,115, 42, 34, 44, 34, 64, 34, 41, 32, 45,\n     45, 32,101,108,105,109,105,110, 97,116,101, 32,115,112, 97,\n     99,101,115, 32, 98,101,115,105,100,101, 32, 64, 10, 32,115,\n    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,\n     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,\n    105,110,108,105,110,101, 40, 37,115, 41, 34, 44, 34, 37, 49,\n     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 39,105,110,108,105,110,101, 39, 32,107,101,121,119,111,\n    114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,101,\n     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,\n    100,101, 44, 34, 37,115, 63,101,120,116,101,114,110, 40, 37,\n    115, 41, 34, 44, 34, 37, 49, 34, 41, 32, 45, 45, 32,101,108,\n    105,109,105,110, 97,116,101, 32, 39,101,120,116,101,114,110,\n     39, 32,107,101,121,119,111,114,100, 10, 32, 45, 45,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,118,\n    105,114,116,117, 97,108, 40, 37,115, 41, 34, 44, 34, 37, 49,\n     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 39,118,105,114,116,117, 97,108, 39, 32,107,101,121,119,\n    111,114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,\n    101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,\n    111,100,101, 44, 34,112,117, 98,108,105, 99, 58, 34, 44, 34,\n     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 39,112,117, 98,108,105, 99, 58, 39, 32,107,101,121,119,\n    111,114,100, 10, 32,115,101,108,102, 46, 99,111,100,101, 32,\n     61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,100,\n    101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,118,111,105,100,\n     37,115, 42, 37, 42, 34, 44, 34, 37, 49, 95,117,115,101,114,\n    100, 97,116, 97, 32, 34, 41, 32, 45, 45, 32,115,117, 98,115,\n    116,105,116,117,116,101, 32, 39,118,111,105,100, 42, 39, 10,\n     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,\n    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40,\n     91, 94, 37,119, 95, 93, 41,118,111,105,100, 37,115, 42, 37,\n     42, 34, 44, 34, 37, 49, 95,117,115,101,114,100, 97,116, 97,\n     32, 34, 41, 32, 45, 45, 32,115,117, 98,115,116,105,116,117,\n    116,101, 32, 39,118,111,105,100, 42, 39, 10, 32,115,101,108,\n    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,\n    101,108,102, 46, 99,111,100,101, 44, 34, 40, 91, 94, 37,119,\n     95, 93, 41, 99,104, 97,114, 37,115, 42, 37, 42, 34, 44, 34,\n     37, 49, 95, 99,115,116,114,105,110,103, 32, 34, 41, 32, 32,\n     45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39,\n     99,104, 97,114, 42, 39, 10, 32,115,101,108,102, 46, 99,111,\n    100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46,\n     99,111,100,101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,108,\n    117, 97, 95, 83,116, 97,116,101, 37,115, 42, 37, 42, 34, 44,\n     34, 37, 49, 95,108,115,116, 97,116,101, 32, 34, 41, 32, 32,\n     45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39,\n    108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10, 10, 32, 45,\n     45, 32,114,101,115,116,111,114,101, 32,101,109, 98,101,100,\n    100,101,100, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,115,\n    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,\n     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37, 35, 37,\n     91, 40, 37,100, 43, 41, 37, 93, 37, 35, 34, 44,102,117,110,\n     99,116,105,111,110, 32, 40,110, 41, 10, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,\n    114,110, 32, 76, 91,116,111,110,117,109, 98,101,114, 40,110,\n     41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,101,110,100, 41, 10, 32, 45, 45, 32,114,101,115,116,\n    111,114,101, 32,101,109, 98,101,100,100,101,100, 32, 67, 32,\n     99,111,100,101, 10, 32,115,101,108,102, 46, 99,111,100,101,\n     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,\n    100,101, 44, 34, 37, 35, 37, 60, 40, 37,100, 43, 41, 37, 62,\n     37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,110,\n     41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,114,101,116,117,114,110, 32, 67, 91,116,111,110,117,\n    109, 98,101,114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 41, 10, 32, 45,\n     45, 32,114,101,115,116,111,114,101, 32,118,101,114, 98, 97,\n    116,105,109, 32,108,105,110,101,115, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 37, 35, 40, 37,100, 43,\n     41, 37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,\n    110, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,\n    101,116,117,114,110, 32, 86, 91,116,111,110,117,109, 98,101,\n    114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,101,110,100, 41, 10, 10, 32,115,101,108,102, 46, 99,111,\n    100,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 32, 34, 92,\n    110, 37,115, 42, 37, 36, 40, 91, 94, 92,110, 93, 43, 41, 34,\n     44, 32,102,117,110, 99,116,105,111,110, 32, 40,108, 41, 10,\n      9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 86,101,114, 98,\n     97,116,105,109, 40,108, 46, 46, 34, 92,110, 34, 41, 10,  9,\n      9,  9,  9,  9,  9,  9,  9,  9,  9,  9,114,101,116,117,114,\n    110, 32, 34, 92,110, 34, 10,  9,  9,  9,  9,  9,  9,  9,  9,\n      9,  9, 32, 32,101,110,100, 41, 10,101,110,100, 10, 10, 45,\n     45, 32,116,114, 97,110,115,108, 97,116,101, 32,118,101,114,\n     98, 97,116,105,109, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114,\n    101, 97,109, 98,108,101, 32, 40, 41, 10, 32,111,117,116,112,\n    117,116, 40, 39, 47, 42, 92,110, 39, 41, 10, 32,111,117,116,\n    112,117,116, 40, 39, 42, 42, 32, 76,117, 97, 32, 98,105,110,\n    100,105,110,103, 58, 32, 39, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 39, 92,110, 39, 41, 10, 32,111,117,116,\n    112,117,116, 40, 39, 42, 42, 32, 71,101,110,101,114, 97,116,\n    101,100, 32, 97,117,116,111,109, 97,116,105, 99, 97,108,108,\n    121, 32, 98,121, 32, 39, 46, 46, 84, 79, 76, 85, 65, 95, 86,\n     69, 82, 83, 73, 79, 78, 46, 46, 39, 32,111,110, 32, 39, 46,\n     46,100, 97,116,101, 40, 41, 46, 46, 39, 46, 92,110, 39, 41,\n     10, 32,111,117,116,112,117,116, 40, 39, 42, 47, 92,110, 92,\n    110, 39, 41, 10, 10,  9,111,117,116,112,117,116, 40, 39, 35,\n    105,102,110,100,101,102, 32, 95, 95, 99,112,108,117,115,112,\n    108,117,115, 92,110, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 35,105,110, 99,108,117,100,101, 32, 34,115,116,100,\n    108,105, 98, 46,104, 34, 92,110, 39, 41, 10,  9,111,117,116,\n    112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41,\n     10,  9,111,117,116,112,117,116, 40, 39, 35,105,110, 99,108,\n    117,100,101, 32, 34,115,116,114,105,110,103, 46,104, 34, 92,\n    110, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,\n     35,105,110, 99,108,117,100,101, 32, 34,116,111,108,117, 97,\n     43, 43, 46,104, 34, 92,110, 92,110, 39, 41, 10, 10, 32,105,\n    102, 32,110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,\n    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47,\n     42, 32, 69,120,112,111,114,116,101,100, 32,102,117,110, 99,\n    116,105,111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,\n    112,117,116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,\n    105,110,116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,\n    101,108,102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,\n    110, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,\n    111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100,\n     10, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,\n    104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111,\n     10, 32, 32,115,101,108,102, 91,105, 93, 58,112,114,101, 97,\n    109, 98,108,101, 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43,\n     49, 10, 32,101,110,100, 10, 10,  9,105,102, 32,115,101,108,\n    102, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99,\n    116,105,111,110, 40, 95, 99,111,108,108,101, 99,116, 41, 32,\n    116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40, 39,\n     92,110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39,\n     47, 42, 32,102,117,110, 99,116,105,111,110, 32,116,111, 32,\n    114,101,108,101, 97,115,101, 32, 99,111,108,108,101, 99,116,\n    101,100, 32,111, 98,106,101, 99,116, 32,118,105, 97, 32,100,\n    101,115,116,114,117, 99,116,111,114, 32, 42, 47, 39, 41, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101,\n    102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110,\n     39, 41, 10,  9,  9,102,111,114, 32,105, 44,118, 32,105,110,\n     32,112, 97,105,114,115, 40, 95, 99,111,108,108,101, 99,116,\n     41, 32,100,111, 10,  9,  9, 32,111,117,116,112,117,116, 40,\n     39, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 32, 39,\n     46, 46,118, 46, 46, 39, 32, 40,108,117, 97, 95, 83,116, 97,\n    116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39,123, 39, 41, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 39, 46, 46,\n    105, 46, 46, 39, 42, 32,115,101,108,102, 32, 61, 32, 40, 39,\n     46, 46,105, 46, 46, 39, 42, 41, 32,116,111,108,117, 97, 95,\n    116,111,117,115,101,114,116,121,112,101, 40,116,111,108,117,\n     97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39,  9, 77,116,111,108,117, 97,\n     95,100,101,108,101,116,101, 40,115,101,108,102, 41, 59, 39,\n     41, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39,  9,114,\n    101,116,117,114,110, 32, 48, 59, 39, 41, 10,  9,  9,  9,111,\n    117,116,112,117,116, 40, 39,125, 39, 41, 10,  9,  9,101,110,\n    100, 10,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,\n    100,105,102, 92,110, 92,110, 39, 41, 10,  9,101,110,100, 10,\n     10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10,\n     32,111,117,116,112,117,116, 40, 39, 47, 42, 32,102,117,110,\n     99,116,105,111,110, 32,116,111, 32,114,101,103,105,115,116,\n    101,114, 32,116,121,112,101, 32, 42, 47, 39, 41, 10, 32,111,\n    117,116,112,117,116, 40, 39,115,116, 97,116,105, 99, 32,118,\n    111,105,100, 32,116,111,108,117, 97, 95,114,101,103, 95,116,\n    121,112,101,115, 32, 40,108,117, 97, 95, 83,116, 97,116,101,\n     42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10, 32,111,\n    117,116,112,117,116, 40, 39,123, 39, 41, 10, 10,  9,105,102,\n     32,102,108, 97,103,115, 46,116, 32,116,104,101,110, 10,  9,\n      9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,\n    102, 32, 77,116,111,108,117, 97, 95,116,121,112,101,105,100,\n     92,110, 35,100,101,102,105,110,101, 32, 77,116,111,108,117,\n     97, 95,116,121,112,101,105,100, 40, 76, 44, 84, 73, 44, 84,\n     41, 92,110, 35,101,110,100,105,102, 92,110, 34, 41, 10,  9,\n    101,110,100, 10,  9,102,111,114,101, 97, 99,104, 40, 95,117,\n    115,101,114,116,121,112,101, 44,102,117,110, 99,116,105,111,\n    110, 40,110, 44,118, 41, 10,  9,  9,105,102, 32, 40,110,111,\n    116, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115,\n    101,115, 91,118, 93, 41, 32,111,114, 32, 95,103,108,111, 98,\n     97,108, 95, 99,108, 97,115,115,101,115, 91,118, 93, 58, 99,\n    104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,\n    101,115,115, 40, 41, 32,116,104,101,110, 10,  9,  9,  9,111,\n    117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,117,\n    115,101,114,116,121,112,101, 40,116,111,108,117, 97, 95, 83,\n     44, 34, 39, 44,118, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,\n      9,105,102, 32,102,108, 97,103,115, 46,116, 32,116,104,101,\n    110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32,\n     77,116,111,108,117, 97, 95,116,121,112,101,105,100, 40,116,\n    111,108,117, 97, 95, 83, 44,116,121,112,101,105,100, 40, 39,\n     44,118, 44, 39, 41, 44, 32, 34, 39, 44,118, 44, 39, 34, 41,\n     59, 39, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,110,\n    100, 10,  9, 32,101,110,100, 41, 10, 32,111,117,116,112,117,\n    116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n     39, 92,110, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,114,\n    101,103,105,115,116,101,114, 32,112, 97, 99,107, 97,103,101,\n     10, 45, 45, 32,119,114,105,116,101, 32,112, 97, 99,107, 97,\n    103,101, 32,111,112,101,110, 32,102,117,110, 99,116,105,111,\n    110, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 80, 97, 99,107, 97,103,101, 58,114,101,103,105,115,116,\n    101,114, 32, 40,112,114,101, 41, 10, 32,112,114,101, 32, 61,\n     32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,112,117,115,\n    104, 40,115,101,108,102, 41, 10, 32,111,117,116,112,117,116,\n     40,112,114,101, 46, 46, 34, 47, 42, 32, 79,112,101,110, 32,\n    102,117,110, 99,116,105,111,110, 32, 42, 47, 34, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79,\n     76, 85, 65, 95, 65, 80, 73, 32,105,110,116, 32,116,111,108,\n    117, 97, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 34, 95,111,112,101,110, 32, 40,108,117, 97, 95, 83,\n    116, 97,116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34,\n     41, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,\n     34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40,112,114,\n    101, 46, 46, 34, 32,116,111,108,117, 97, 95,111,112,101,110,\n     40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,\n    117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,\n    108,117, 97, 95,114,101,103, 95,116,121,112,101,115, 40,116,\n    111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,117,116,\n    112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,108,117,\n     97, 95,109,111,100,117,108,101, 40,116,111,108,117, 97, 95,\n     83, 44, 78, 85, 76, 76, 44, 34, 44,115,101,108,102, 58,104,\n     97,115,118, 97,114, 40, 41, 44, 34, 41, 59, 34, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,\n    111,108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,\n    101, 40,116,111,108,117, 97, 95, 83, 44, 78, 85, 76, 76, 41,\n     59, 34, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10,\n     32,119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,\n    100,111, 10, 32, 32,115,101,108,102, 91,105, 93, 58,114,101,\n    103,105,115,116,101,114, 40,112,114,101, 46, 46, 34, 32, 32,\n     34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,\n    110,100, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46,\n     46, 34, 32,116,111,108,117, 97, 95,101,110,100,109,111,100,\n    117,108,101, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41,\n     10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,\n     32,114,101,116,117,114,110, 32, 49, 59, 34, 41, 10, 32,111,\n    117,116,112,117,116, 40,112,114,101, 46, 46, 34,125, 34, 41,\n     10, 10, 32,111,117,116,112,117,116, 40, 34, 92,110, 92,110,\n     34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102,\n     32,100,101,102,105,110,101,100, 40, 76, 85, 65, 95, 86, 69,\n     82, 83, 73, 79, 78, 95, 78, 85, 77, 41, 32, 38, 38, 32, 76,\n     85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 95, 78, 85, 77, 32,\n     62, 61, 32, 53, 48, 49, 92,110, 34, 41, 59, 10, 32,111,117,\n    116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79, 76, 85,\n     65, 95, 65, 80, 73, 32,105,110,116, 32,108,117, 97,111,112,\n    101,110, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 34, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42,\n     32,116,111,108,117, 97, 95, 83, 41, 32,123, 34, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,114,\n    101,116,117,114,110, 32,116,111,108,117, 97, 95, 34, 46, 46,\n    115,101,108,102, 46,110, 97,109,101, 46, 46, 34, 95,111,112,\n    101,110, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10,\n     32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,125,\n     59, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,101,\n    110,100,105,102, 92,110, 92,110, 34, 41, 10, 10,  9,112,111,\n    112, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,119,114,105,\n    116,101, 32,104,101, 97,100,101,114, 32,102,105,108,101, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 80,\n     97, 99,107, 97,103,101, 58,104,101, 97,100,101,114, 32, 40,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 47, 42, 92,110,\n     39, 41, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 76,\n    117, 97, 32, 98,105,110,100,105,110,103, 58, 32, 39, 46, 46,\n    115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 92,110, 39,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 71,\n    101,110,101,114, 97,116,101,100, 32, 97,117,116,111,109, 97,\n    116,105, 99, 97,108,108,121, 32, 98,121, 32, 39, 46, 46, 84,\n     79, 76, 85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 46, 46, 39,\n     32,111,110, 32, 39, 46, 46,100, 97,116,101, 40, 41, 46, 46,\n     39, 46, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n     39, 42, 47, 92,110, 92,110, 39, 41, 10, 10, 32,105,102, 32,\n    110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,104,101,\n    110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47, 42, 32,\n     69,120,112,111,114,116,101,100, 32,102,117,110, 99,116,105,\n    111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,105,110,\n    116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,110, 32,\n     40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,\n    117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101,\n    110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108,\n     32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117,\n    110, 99,116,105,111,110, 32, 95, 80, 97, 99,107, 97,103,101,\n     32, 40,115,101,108,102, 41, 10, 32,115,101,116,109,101,116,\n     97,116, 97, 98,108,101, 40,115,101,108,102, 44, 99,108, 97,\n    115,115, 80, 97, 99,107, 97,103,101, 41, 10, 32,114,101,116,\n    117,114,110, 32,115,101,108,102, 10,101,110,100, 10, 10, 45,\n     45, 32, 80, 97,114,115,101, 32, 67, 32,104,101, 97,100,101,\n    114, 32,102,105,108,101, 32,119,105,116,104, 32,116,111,108,\n    117, 97, 32,100,105,114,101, 99,116,105,118,101,115, 10, 45,\n     45, 32, 42, 42, 42, 32, 84,104, 97,110,107,115, 32,116,111,\n     32, 65,114,105,101,108, 32, 77, 97,110,122,117,114, 32,102,\n    111,114, 32,102,105,120,105,110,103, 32, 98,117,103,115, 32,\n    105,110, 32,110,101,115,116,101,100, 32,100,105,114,101, 99,\n    116,105,118,101,115, 32, 42, 42, 42, 10,102,117,110, 99,116,\n    105,111,110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,\n    101, 40,102,110, 44,115, 41, 10,  9,108,111, 99, 97,108, 32,\n     99,111,100,101, 32, 61, 32, 39, 92,110, 36, 35,105,110, 99,\n    108,117,100,101, 32, 34, 39, 46, 46,102,110, 46, 46, 39, 34,\n     92,110, 39, 10,  9,115, 61, 32, 34, 92,110, 34, 32, 46, 46,\n     32,115, 32, 46, 46, 32, 34, 92,110, 34, 32, 45, 45, 32, 97,\n    100,100, 32, 98,108, 97,110,107, 32,108,105,110,101,115, 32,\n     97,115, 32,115,101,110,116,105,110,101,108,115, 10,  9,108,\n    111, 99, 97,108, 32, 95, 44,101, 44, 99, 44,116, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115, 44, 32, 34, 92,110, 40,\n     91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91, 79,111, 93,\n     91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93, 95, 40, 91,\n     94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42, 92,110, 34,\n     41, 10,  9,119,104,105,108,101, 32,101, 32,100,111, 10,  9,\n      9,116, 32, 61, 32,115,116,114,108,111,119,101,114, 40,116,\n     41, 10,  9,  9,105,102, 32,116, 32, 61, 61, 32, 34, 98,101,\n    103,105,110, 34, 32,116,104,101,110, 10,  9,  9,  9, 95, 44,\n    101, 44, 99, 32, 61, 32,115,116,114,102,105,110,100, 40,115,\n     44, 34, 40, 46, 45, 41, 92,110, 91, 94, 92,110, 93, 42, 91,\n     84,116, 93, 91, 79,111, 93, 91, 76,108, 93, 91, 85,117, 93,\n     91, 65, 97, 93, 95, 91, 69,101, 93, 91, 78,110, 93, 91, 68,\n    100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44,101, 41, 10,\n      9,  9,  9,105,102, 32,110,111,116, 32,101, 32,116,104,101,\n    110, 10,  9,  9,  9, 32,116,111,108,117, 97, 95,101,114,114,\n    111,114, 40, 34, 85,110, 98, 97,108, 97,110, 99,101,100, 32,\n     39,116,111,108,117, 97, 95, 98,101,103,105,110, 39, 32,100,\n    105,114,101, 99,116,105,118,101, 32,105,110, 32,104,101, 97,\n    100,101,114, 32,102,105,108,101, 34, 41, 10,  9,  9,  9,101,\n    110,100, 10,  9,  9,101,110,100, 10,  9,  9, 99,111,100,101,\n     32, 61, 32, 99,111,100,101, 32, 46, 46, 32, 99, 32, 46, 46,\n     32, 34, 92,110, 34, 10,  9, 32, 95, 44,101, 44, 99, 44,116,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32, 34,\n     92,110, 40, 91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91,\n     79,111, 93, 91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93,\n     95, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42,\n     92,110, 34, 44,101, 41, 10,  9,101,110,100, 10,  9,114,101,\n    116,117,114,110, 32, 99,111,100,101, 10,101,110,100, 10, 10,\n     45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10,\n     45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,101, 32,\n    112, 97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,116,\n    104,101, 32,102,105,108,101, 32,101,120,116,101,110,115,105,\n    111,110, 44, 32, 97,110,100, 32,116,104,101, 32,102,105,108,\n    101, 32,116,101,120,116, 46, 10,102,117,110, 99,116,105,111,\n    110, 32, 80, 97, 99,107, 97,103,101, 32, 40,110, 97,109,101,\n     44,102,110, 41, 10, 32,108,111, 99, 97,108, 32,101,120,116,\n     32, 61, 32, 34,112,107,103, 34, 10, 10, 32, 45, 45, 32,111,\n    112,101,110, 32,105,110,112,117,116, 32,102,105,108,101, 44,\n     32,105,102, 32, 97,110,121, 10, 32,108,111, 99, 97,108, 32,\n    115,116, 44,109,115,103, 10, 32,105,102, 32,102,110, 32,116,\n    104,101,110, 10, 32, 32,115,116, 44, 32,109,115,103, 32, 61,\n     32,114,101, 97,100,102,114,111,109, 40,102,108, 97,103,115,\n     46,102, 41, 10, 32, 32,105,102, 32,110,111,116, 32,115,116,\n     32,116,104,101,110, 10, 32, 32, 32,101,114,114,111,114, 40,\n     39, 35, 39, 46, 46,109,115,103, 41, 10, 32, 32,101,110,100,\n     10, 32, 32,108,111, 99, 97,108, 32, 95, 59, 32, 95, 44, 32,\n     95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42, 41, 36,\n     34, 41, 10, 32,101,110,100, 10, 32,108,111, 99, 97,108, 32,\n     99,111,100,101, 10, 32,105,102, 32,101,120,116, 32, 61, 61,\n     32, 39,112,107,103, 39, 32,116,104,101,110, 10, 32, 32, 99,\n    111,100,101, 32, 61, 32,112,114,101,112, 40,115,116, 41, 10,\n     32,101,108,115,101, 10, 32, 32, 99,111,100,101, 32, 61, 32,\n     34, 92,110, 34, 32, 46, 46, 32,114,101, 97,100, 40, 39, 42,\n     97, 39, 41, 10, 32, 32,105,102, 32,101,120,116, 32, 61, 61,\n     32, 39,104, 39, 32,111,114, 32,101,120,116, 32, 61, 61, 32,\n     39,104,112,112, 39, 32,116,104,101,110, 10, 32, 32, 32, 99,\n    111,100,101, 32, 61, 32,101,120,116,114, 97, 99,116, 95, 99,\n    111,100,101, 40,102,110, 44, 99,111,100,101, 41, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,\n    108,111,115,101, 32,102,105,108,101, 10, 32,105,102, 32,102,\n    110, 32,116,104,101,110, 10, 32, 32,114,101, 97,100,102,114,\n    111,109, 40, 41, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,\n    100,101, 97,108, 32,119,105,116,104, 32,105,110, 99,108,117,\n    100,101, 32,100,105,114,101, 99,116,105,118,101, 10, 32,108,\n    111, 99, 97,108, 32,110,115,117, 98,115,116, 10, 32,114,101,\n    112,101, 97,116, 10, 32, 32, 99,111,100,101, 44,110,115,117,\n     98,115,116, 32, 61, 32,103,115,117, 98, 40, 99,111,100,101,\n     44, 39, 92,110, 37,115, 42, 37, 36, 40, 46, 41,102,105,108,\n    101, 37,115, 42, 34, 40, 46, 45, 41, 34, 40, 91, 94, 92,110,\n     93, 42, 41, 92,110, 39, 44, 10,  9,  9,102,117,110, 99,116,\n    105,111,110, 32, 40,107,105,110,100, 44,102,110, 44,101,120,\n    116,114, 97, 41, 10,  9,  9,  9,108,111, 99, 97,108, 32, 95,\n     44, 32, 95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102,\n    105,110,100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42,\n     41, 36, 34, 41, 10,  9,  9,  9,108,111, 99, 97,108, 32,102,\n    112, 44,109,115,103, 32, 61, 32,111,112,101,110,102,105,108,\n    101, 40,102,110, 44, 39,114, 39, 41, 10,  9,  9,  9,105,102,\n     32,110,111,116, 32,102,112, 32,116,104,101,110, 10,  9,  9,\n      9,  9,101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115,\n    103, 46, 46, 39, 58, 32, 39, 46, 46,102,110, 41, 10,  9,  9,\n      9,101,110,100, 10,  9,  9,  9,105,102, 32,107,105,110,100,\n     32, 61, 61, 32, 39,112, 39, 32,116,104,101,110, 10,  9,  9,\n      9,  9,108,111, 99, 97,108, 32,115, 32, 61, 32,112,114,101,\n    112, 40,102,112, 41, 10,  9,  9,  9,  9, 99,108,111,115,101,\n    102,105,108,101, 40,102,112, 41, 10,  9,  9,  9,  9,114,101,\n    116,117,114,110, 32,115, 10,  9,  9,  9,101,110,100, 10,  9,\n      9,  9,108,111, 99, 97,108, 32,115, 32, 61, 32,114,101, 97,\n    100, 40,102,112, 44, 39, 42, 97, 39, 41, 10,  9,  9,  9, 99,\n    108,111,115,101,102,105,108,101, 40,102,112, 41, 10,  9,  9,\n      9,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39, 99, 39,\n     32,111,114, 32,107,105,110,100, 32, 61, 61, 32, 39,104, 39,\n     32,116,104,101,110, 10,  9,  9,  9,  9,114,101,116,117,114,\n    110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,101, 40,\n    102,110, 44,115, 41, 10,  9,  9,  9,101,108,115,101,105,102,\n     32,107,105,110,100, 32, 61, 61, 32, 39,108, 39, 32,116,104,\n    101,110, 10,  9,  9,  9,  9,114,101,116,117,114,110, 32, 34,\n     92,110, 36, 91, 45, 45, 35, 35, 34, 46, 46,102,110, 46, 46,\n     34, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34, 92,\n    110, 36, 93, 92,110, 34, 10,  9,  9,  9,101,108,115,101,105,\n    102, 32,107,105,110,100, 32, 61, 61, 32, 39,105, 39, 32,116,\n    104,101,110, 10,  9,  9,  9,  9,108,111, 99, 97,108, 32,116,\n     32, 61, 32,123, 99,111,100,101, 61,115,125, 10,  9,  9,  9,\n      9,101,120,116,114, 97, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,101,120,116,114, 97, 44, 32, 34, 94,\n     37,115, 42, 44, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,\n      9,  9,  9,108,111, 99, 97,108, 32,112, 97,114,115, 32, 61,\n     32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115,\n     40,101,120,116,114, 97, 44, 32, 34, 44, 34, 41, 10,  9,  9,\n      9,  9,105,110, 99,108,117,100,101, 95,102,105,108,101, 95,\n    104,111,111,107, 40,116, 44, 32,102,110, 44, 32,117,110,112,\n     97, 99,107, 40,112, 97,114,115, 41, 41, 10,  9,  9,  9,  9,\n    114,101,116,117,114,110, 32, 34, 92,110, 92,110, 34, 32, 46,\n     46, 32,116, 46, 99,111,100,101, 10,  9,  9,  9,101,108,115,\n    101, 10,  9,  9,  9,  9,101,114,114,111,114, 40, 39, 35, 73,\n    110,118, 97,108,105,100, 32,105,110, 99,108,117,100,101, 32,\n    100,105,114,101, 99,116,105,118,101, 32, 40,117,115,101, 32,\n     36, 99,102,105,108,101, 44, 32, 36,112,102,105,108,101, 44,\n     32, 36,108,102,105,108,101, 32,111,114, 32, 36,105,102,105,\n    108,101, 41, 39, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,\n    101,110,100, 41, 10, 32,117,110,116,105,108, 32,110,115,117,\n     98,115,116, 61, 61, 48, 10, 10, 32, 45, 45, 32,100,101, 97,\n    108, 32,119,105,116,104, 32,114,101,110, 97,109,105,110,103,\n     32,100,105,114,101, 99,116,105,118,101, 10, 32,114,101,112,\n    101, 97,116, 32, 45, 45, 32, 73, 32,100,111,110, 39,116, 32,\n    107,110,111,119, 32,119,104,121, 32,116,104,105,115, 32,105,\n    115, 32,110,101, 99,101,115, 97,114,121, 10,  9, 99,111,100,\n    101, 44,110,115,117, 98,115,116, 32, 61, 32,103,115,117, 98,\n     40, 99,111,100,101, 44, 39, 92,110, 37,115, 42, 37, 36,114,\n    101,110, 97,109,105,110,103, 37,115, 42, 40, 46, 45, 41, 37,\n    115, 42, 92,110, 39, 44, 32,102,117,110, 99,116,105,111,110,\n     32, 40,114, 41, 32, 97,112,112,101,110,100,114,101,110, 97,\n    109,105,110,103, 40,114, 41, 32,114,101,116,117,114,110, 32,\n     34, 92,110, 34, 32,101,110,100, 41, 10, 32,117,110,116,105,\n    108, 32,110,115,117, 98,115,116, 32, 61, 61, 32, 48, 10, 10,\n     32,108,111, 99, 97,108, 32,116, 32, 61, 32, 95, 80, 97, 99,\n    107, 97,103,101, 40, 95, 67,111,110,116, 97,105,110,101,114,\n    123,110, 97,109,101, 61,110, 97,109,101, 44, 32, 99,111,100,\n    101, 61, 99,111,100,101,125, 41, 10, 32,112,117,115,104, 40,\n    116, 41, 10, 32,112,114,101,112,114,111, 99,101,115,115, 95,\n    104,111,111,107, 40,116, 41, 10, 32,116, 58,112,114,101,112,\n    114,111, 99,101,115,115, 40, 41, 10, 32,112,114,101,112, 97,\n    114,115,101, 95,104,111,111,107, 40,116, 41, 10, 32,116, 58,\n    112, 97,114,115,101, 40,116, 46, 99,111,100,101, 41, 10, 32,\n    112,111,112, 40, 41, 10, 32,114,101,116,117,114,110, 32,116,\n     10,101,110,100, 10, 10, 10,115,101,116,109,101,116, 97,116,\n     97, 98,108,101, 40, 95,101,120,116,114, 97, 95,112, 97,114,\n     97,109,101,116,101,114,115, 44, 32,123, 32, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 95, 71, 32,125, 41, 10, 10,102,117,\n    110, 99,116,105,111,110, 32,112,114,101,112, 40,102,105,108,\n    101, 41, 10, 10, 32, 32,108,111, 99, 97,108, 32, 99,104,117,\n    110,107, 32, 61, 32,123, 39,108,111, 99, 97,108, 32, 95, 95,\n    114,101,116, 32, 61, 32,123, 34, 92, 92,110, 34,125, 92,110,\n     39,125, 10, 32, 32,102,111,114, 32,108,105,110,101, 32,105,\n    110, 32,102,105,108,101, 58,108,105,110,101,115, 40, 41, 32,\n    100,111, 10, 32, 32, 32, 32, 32,105,102, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,108,105,110,101, 44, 32, 34,\n     94, 35, 35, 34, 41, 32,116,104,101,110, 10, 32, 32, 32, 32,\n     32, 32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40,\n     99,104,117,110,107, 44, 32,115,116,114,105,110,103, 46,115,\n    117, 98, 40,108,105,110,101, 44, 32, 51, 41, 32, 46, 46, 32,\n     34, 92,110, 34, 41, 10, 32, 32, 32, 32, 32,101,108,115,101,\n     10, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,108, 97,\n    115,116, 32, 61, 32, 49, 10, 32, 32, 32, 32, 32, 32,102,111,\n    114, 32,116,101,120,116, 44, 32,101,120,112,114, 44, 32,105,\n    110,100,101,120, 32,105,110, 32,115,116,114,105,110,103, 46,\n    103,102,105,110,100, 40,108,105,110,101, 44, 32, 34, 40, 46,\n     45, 41, 36, 40, 37, 98, 40, 41, 41, 40, 41, 34, 41, 32,100,\n    111, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32,108, 97,115,116,\n     32, 61, 32,105,110,100,101,120, 10, 32, 32, 32, 32, 32, 32,\n     32, 32,105,102, 32,116,101,120,116, 32,126, 61, 32, 34, 34,\n     32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99,\n    104,117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111,\n    114,109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115,\n    101,114,116, 40, 95, 95,114,101,116, 44, 32, 37,113, 32, 41,\n     39, 44, 32,116,101,120,116, 41, 41, 10, 32, 32, 32, 32, 32,\n     32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,\n    116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99,104,\n    117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111,114,\n    109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115,101,\n    114,116, 40, 95, 95,114,101,116, 44, 32, 37,115, 32, 41, 39,\n     44, 32,101,120,112,114, 41, 41, 10, 32, 32, 32, 32, 32, 32,\n    101,110,100, 10, 32, 32, 32, 32, 32, 32,116, 97, 98,108,101,\n     46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44, 32,\n    115,116,114,105,110,103, 46,102,111,114,109, 97,116, 40, 39,\n    116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 95, 95,\n    114,101,116, 44, 32, 37,113, 41, 92,110, 39, 44, 10, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32,115,116,114,105,110,103,\n     46,115,117, 98, 40,108,105,110,101, 44, 32,108, 97,115,116,\n     41, 46, 46, 34, 92,110, 34, 41, 41, 10, 32, 32, 32, 32,101,\n    110,100, 10, 32, 32,101,110,100, 10, 32, 32,116, 97, 98,108,\n    101, 46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44,\n     32, 39, 92,110,114,101,116,117,114,110, 32,116, 97, 98,108,\n    101, 46, 99,111,110, 99, 97,116, 40, 95, 95,114,101,116, 41,\n     92,110, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44,\n    101, 32, 61, 32,108,111, 97,100,115,116,114,105,110,103, 40,\n    116, 97, 98,108,101, 46, 99,111,110, 99, 97,116, 40, 99,104,\n    117,110,107, 41, 41, 10, 32, 32,105,102, 32,101, 32,116,104,\n    101,110, 10, 32, 32,  9,101,114,114,111,114, 40, 34, 35, 34,\n     46, 46,101, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,101,\n    116,102,101,110,118, 40,102, 44, 32, 95,101,120,116,114, 97,\n     95,112, 97,114, 97,109,101,116,101,114,115, 41, 10, 32, 32,\n    114,101,116,117,114,110, 32,102, 40, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/package.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,109,111,100,117,108,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,\n    116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114,\n     32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114,\n     97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,\n    117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58,\n     32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,\n    101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119,\n     97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,\n    100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,\n    110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116,\n     46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,\n    114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,\n    101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110,\n     32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44,\n     32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,\n    104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,\n    103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,\n    100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44,\n     32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,\n    101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,\n    101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105,\n     99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, 32,\n     77,111,100,117,108,101, 32, 99,108, 97,115,115, 10, 45, 45,\n     32, 82,101,112,114,101,115,101,110,116,115, 32,109,111,100,\n    117,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,102,111,108,\n    108,111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,\n    114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32,\n     32, 32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102,\n     32,111, 98,106,101, 99,116,115, 32,105,110, 32,116,104,101,\n     32,109,111,100,117,108,101, 46, 10, 99,108, 97,115,115, 77,\n    111,100,117,108,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,\n    115,116,121,112,101, 32, 61, 32, 39,109,111,100,117,108,101,\n     39, 10,125, 10, 99,108, 97,115,115, 77,111,100,117,108,101,\n     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,\n    115, 77,111,100,117,108,101, 10,115,101,116,109,101,116, 97,\n    116, 97, 98,108,101, 40, 99,108, 97,115,115, 77,111,100,117,\n    108,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,110,\n    101,114, 41, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,\n    114, 32,109,111,100,117,108,101, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58,\n    114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, 10,\n     32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39,\n     39, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95,109,111,100,117,108,101, 40,116,111,108,117,\n     97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,110, 97,\n    109,101, 46, 46, 39, 34, 44, 39, 44,115,101,108,102, 58,104,\n     97,115,118, 97,114, 40, 41, 44, 39, 41, 59, 39, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,101,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41,\n     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,\n     32, 32,115,101,108,102, 91,105, 93, 58,114,101,103,105,115,\n    116,101,114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32,\n     32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95,101,110,100,109,111,100,117,108,101, 40,116,\n    111,108,117, 97, 95, 83, 41, 59, 39, 41, 10,  9,112,111,112,\n     40, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110,\n    116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 77,111,100,117,108,101,123, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 34, 39, 59, 34, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,\n    101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,\n    115,101,108,102, 91,105, 93, 58,112,114,105,110,116, 40,105,\n    100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34, 41, 10,\n     32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,\n     10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,\n    110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,\n    105,111,110, 32, 95, 77,111,100,117,108,101, 32, 40,116, 41,\n     10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,\n    116, 44, 99,108, 97,115,115, 77,111,100,117,108,101, 41, 10,\n     32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,\n    117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,\n    111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,\n    120,112,101, 99,116,115, 32,116,119,111, 32,115,116,114,105,\n    110,103, 32,114,101,112,114,101,115,101,110,116,105,110,103,\n     32,116,104,101, 32,109,111,100,117,108,101, 32,110, 97,109,\n    101, 32, 97,110,100, 32, 98,111,100,121, 46, 10,102,117,110,\n     99,116,105,111,110, 32, 77,111,100,117,108,101, 32, 40,110,\n     44, 98, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n     95, 77,111,100,117,108,101, 40, 95, 67,111,110,116, 97,105,\n    110,101,114,123,110, 97,109,101, 61,110,125, 41, 10, 32,112,\n    117,115,104, 40,116, 41, 10, 32,116, 58,112, 97,114,115,101,\n     40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,\n    108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,\n    108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,101,115,\n     10, 32,112,111,112, 40, 41, 10, 32,114,101,116,117,114,110,\n     32,116, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/module.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,110, 97,109,101,115,\n    112, 97, 99,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,\n    114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,\n    109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101,\n     67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45,\n     45, 32, 74,117,108, 32, 50, 48, 48, 51, 10, 45, 45, 32, 36,\n     73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32,\n     99,111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,\n    102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110,\n     32,114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,\n    116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121,\n     32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,\n    116,119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,\n    104,101,114,101,117,110,100,101,114, 32,105,115, 32,111,110,\n     32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,\n    105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32,\n     97,117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111,\n     98,108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,\n    111,118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110,\n     99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,\n    100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110,\n     99,101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,\n    105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45,\n     45, 32, 78, 97,109,101,115,112, 97, 99,101, 32, 99,108, 97,\n    115,115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,\n    115, 32, 97, 32,110, 97,109,101,115, 97,112, 99,101, 32,100,\n    101,102,105,110,105,116,105,111,110, 46, 10, 45, 45, 32, 83,\n    116,111,114,101,115, 32,116,104,101, 32,102,111,108,108,111,\n    119,105,110,103, 32,102,105,101,108,100,115, 58, 10, 45, 45,\n     32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,108, 97,115,\n    115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32, 32,123,105,\n    125, 32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,\n    109, 98,101,114,115, 10, 99,108, 97,115,115, 78, 97,109,101,\n    115,112, 97, 99,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,\n    115,116,121,112,101, 32, 61, 32, 39,110, 97,109,101,115,112,\n     97, 99,101, 39, 44, 10, 32,110, 97,109,101, 32, 61, 32, 39,\n     39, 44, 10,125, 10, 99,108, 97,115,115, 78, 97,109,101,115,\n    112, 97, 99,101, 46, 95, 95,105,110,100,101,120, 32, 61, 32,\n     99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 10,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108,\n     97,115,115, 78, 97,109,101,115,112, 97, 99,101, 44, 99,108,\n     97,115,115, 77,111,100,117,108,101, 41, 10, 10, 45, 45, 32,\n     80,114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,\n    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 78, 97,109,\n    101,115,112, 97, 99,101, 58,112,114,105,110,116, 32, 40,105,\n    100,101,110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 78, 97,109,\n    101,115,112, 97, 99,101,123, 34, 41, 10, 32,112,114,105,110,\n    116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101,\n     32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,\n    101, 46, 46, 34, 39, 44, 34, 41, 10, 32,108,111, 99, 97,108,\n     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,\n    102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,\n    105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, 61,\n     32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,110,\n    116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,\n    108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 73,\n    110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117,\n     99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95,\n     78, 97,109,101,115,112, 97, 99,101, 32, 40,116, 41, 10, 32,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44,\n     99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 41,\n     10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,\n    116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,\n     67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32,\n     69,120,112,101, 99,116,115, 32,116,104,101, 32,110, 97,109,\n    101, 32, 97,110,100, 32,116,104,101, 32, 98,111,100,121, 32,\n    111,102, 32,116,104,101, 32,110, 97,109,101,115,112, 97, 99,\n    101, 46, 10,102,117,110, 99,116,105,111,110, 32, 78, 97,109,\n    101,115,112, 97, 99,101, 32, 40,110, 44, 98, 41, 10, 32,108,\n    111, 99, 97,108, 32, 99, 32, 61, 32, 95, 78, 97,109,101,115,\n    112, 97, 99,101, 40, 95, 67,111,110,116, 97,105,110,101,114,\n    123,110, 97,109,101, 61,110,125, 41, 10, 32,112,117,115,104,\n     40, 99, 41, 10, 32, 99, 58,112, 97,114,115,101, 40,115,116,\n    114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,108,101,110,\n     40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,108,105,109,\n    105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10, 32,112,\n    111,112, 40, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/namespace.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,100,101,102,105,110,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,\n    116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114,\n     32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114,\n     97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,\n    117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58,\n     32,100,101,102,105,110,101, 46,108,117, 97, 44,118, 32, 49,\n     46, 50, 32, 49, 57, 57, 57, 47, 48, 55, 47, 50, 56, 32, 50,\n     50, 58, 50, 49, 58, 48, 56, 32, 99,101,108,101,115, 32, 69,\n    120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,\n     32, 68,101,102,105,110,101, 32, 99,108, 97,115,115, 10, 45,\n     45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97, 32,\n    110,117,109,101,114,105, 99, 32, 99,111,110,115,116, 32,100,\n    101,102,105,110,105,116,105,111,110, 10, 45, 45, 32, 84,104,\n    101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,108,\n    100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10,\n     45, 45, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,111,110,\n    115,116, 97,110,116, 32,110, 97,109,101, 10, 99,108, 97,115,\n    115, 68,101,102,105,110,101, 32, 61, 32,123, 10, 32,110, 97,\n    109,101, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,115,\n    115, 68,101,102,105,110,101, 46, 95, 95,105,110,100,101,120,\n     32, 61, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 10,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108,\n     97,115,115, 68,101,102,105,110,101, 44, 99,108, 97,115,115,\n     70,101, 97,116,117,114,101, 41, 10, 10, 45, 45, 32,114,101,\n    103,105,115,116,101,114, 32,100,101,102,105,110,101, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101,\n    102,105,110,101, 58,114,101,103,105,115,116,101,114, 32, 40,\n    112,114,101, 41, 10,  9,105,102, 32,110,111,116, 32,115,101,\n    108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99,\n     95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,\n      9,  9,114,101,116,117,114,110, 10,  9,101,110,100, 10, 10,\n     32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39,\n     39, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,\n     39,116,111,108,117, 97, 95, 99,111,110,115,116, 97,110,116,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,\n    108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46,\n     46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 41, 59,\n     39, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110,\n    116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 68,101,102,105,110,101,123, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,\n     10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,\n    111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,\n    116,105,111,110, 32, 95, 68,101,102,105,110,101, 32, 40,116,\n     41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101,\n     40,116, 44, 99,108, 97,115,115, 68,101,102,105,110,101, 41,\n     10, 32,116, 58, 98,117,105,108,100,110, 97,109,101,115, 40,\n     41, 10, 10, 32,105,102, 32,116, 46,110, 97,109,101, 32, 61,\n     61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,101,114,114,\n    111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,100,101,\n    102,105,110,101, 34, 41, 10, 32,101,110,100, 10, 10, 32, 97,\n    112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,\n    110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,\n    115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,\n    101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,\n    101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101,\n     32, 99,111,110,115,116, 97,110,116, 32,110, 97,109,101, 10,\n    102,117,110, 99,116,105,111,110, 32, 68,101,102,105,110,101,\n     32, 40,110, 41, 10, 32,114,101,116,117,114,110, 32, 95, 68,\n    101,102,105,110,101,123, 10, 32, 32,110, 97,109,101, 32, 61,\n     32,110, 10, 32,125, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/define.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,101,110,117,109,101,\n    114, 97,116,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,\n    114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,\n    109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101,\n     67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45,\n     45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36,\n     73,100, 58, 32,101,110,117,109,101,114, 97,116,101, 46,108,\n    117, 97, 44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48,\n     49, 47, 50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 53, 32, 99,\n    101,108,101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32,\n     84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,\n    101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,121,111,\n    117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,105, 98,\n    117,116,101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,\n    111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,\n    101, 32,115,111,102,116,119, 97,114,101, 32,112,114,111,118,\n    105,100,101,100, 32,104,101,114,101,117,110,100,101,114, 32,\n    105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115,\n     34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45,\n     32,116,104,101, 32, 97,117,116,104,111,114, 32,104, 97,115,\n     32,110,111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,\n    116,111, 32,112,114,111,118,105,100,101, 32,109, 97,105,110,\n    116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,\n    116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,\n    101,110,104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,\n    114, 32,109,111,100,105,102,105, 99, 97,116,105,111,110,115,\n     46, 10, 10, 10, 45, 45, 32, 69,110,117,109,101,114, 97,116,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,\n    101,115,101,110,116,115, 32,101,110,117,109,101,114, 97,116,\n    105,111,110, 10, 45, 45, 32, 84,104,101, 32,102,111,108,108,\n    111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,114,\n    101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32, 32,\n     32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102, 32,\n     99,111,110,115,116, 97,110,116, 32,110, 97,109,101,115, 10,\n     99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 32,\n     61, 32,123, 10,125, 10, 99,108, 97,115,115, 69,110,117,109,\n    101,114, 97,116,101, 46, 95, 95,105,110,100,101,120, 32, 61,\n     32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101,\n     10,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,\n    108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 44, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,\n     45, 32,114,101,103,105,115,116,101,114, 32,101,110,117,109,\n    101,114, 97,116,105,111,110, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,\n    101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114,101,\n     41, 10,  9,105,102, 32,110,111,116, 32,115,101,108,102, 58,\n     99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99,\n     99,101,115,115, 40, 41, 32,116,104,101,110, 10,  9,  9,114,\n    101,116,117,114,110, 10,  9,101,110,100, 10, 32,112,114,101,\n     32, 61, 32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,108,\n    111, 99, 97,108, 32,110,115,112, 97, 99,101, 32, 61, 32,103,\n    101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,\n    114, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,\n    119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,\n    111, 10, 32,  9,105,102, 32,115,101,108,102, 46,108,110, 97,\n    109,101,115, 91,105, 93, 32, 97,110,100, 32,115,101,108,102,\n     46,108,110, 97,109,101,115, 91,105, 93, 32,126, 61, 32, 34,\n     34, 32,116,104,101,110, 10,  9, 10,  9,  9,111,117,116,112,\n    117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,\n     99,111,110,115,116, 97,110,116, 40,116,111,108,117, 97, 95,\n     83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,\n    101,115, 91,105, 93, 46, 46, 39, 34, 44, 39, 46, 46,110,115,\n    112, 97, 99,101, 46, 46,115,101,108,102, 91,105, 93, 46, 46,\n     39, 41, 59, 39, 41, 10,  9,101,110,100, 10, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32,101,110,100, 10,101,110,100, 10,\n     10, 45, 45, 32, 80,114,105,110,116, 32,109,101,116,104,111,\n    100, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 69,110,117,109,101,114, 97,116,101, 58,112,114,105,110,\n    116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 69,110,117,109,101,114, 97,116,101,123, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    110, 97,109,101, 32, 61, 32, 34, 46, 46,115,101,108,102, 46,\n    110, 97,109,101, 41, 10, 32,108,111, 99, 97,108, 32,105, 61,\n     49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,105,\n     93, 32,100,111, 10, 32, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 32, 39, 34, 46, 46,115,101,108,102,\n     91,105, 93, 46, 46, 34, 39, 40, 34, 46, 46,115,101,108,102,\n     46,108,110, 97,109,101,115, 91,105, 93, 46, 46, 34, 41, 44,\n     34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,\n    110,100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108,\n     32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117,\n    110, 99,116,105,111,110, 32, 95, 69,110,117,109,101,114, 97,\n    116,101, 32, 40,116, 44,118, 97,114,110, 97,109,101, 41, 10,\n     32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116,\n     44, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101,\n     41, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32, 97,\n    112,112,101,110,100,101,110,117,109, 40,116, 41, 10,  9, 32,\n    105,102, 32,118, 97,114,110, 97,109,101, 32, 97,110,100, 32,\n    118, 97,114,110, 97,109,101, 32,126, 61, 32, 34, 34, 32,116,\n    104,101,110, 10,  9,  9,105,102, 32,116, 46,110, 97,109,101,\n     32,126, 61, 32, 34, 34, 32,116,104,101,110, 10,  9,  9,  9,\n     86, 97,114,105, 97, 98,108,101, 40,116, 46,110, 97,109,101,\n     46, 46, 34, 32, 34, 46, 46,118, 97,114,110, 97,109,101, 41,\n     10,  9,  9,101,108,115,101, 10,  9,  9,  9,108,111, 99, 97,\n    108, 32,110,115, 32, 61, 32,103,101,116, 99,117,114,114,110,\n     97,109,101,115,112, 97, 99,101, 40, 41, 10,  9,  9,  9,119,\n     97,114,110,105,110,103, 40, 34, 86, 97,114,105, 97, 98,108,\n    101, 32, 34, 46, 46,110,115, 46, 46,118, 97,114,110, 97,109,\n    101, 46, 46, 34, 32,111,102, 32,116,121,112,101, 32, 60, 97,\n    110,111,110,121,109,111,117,115, 32,101,110,117,109, 62, 32,\n    105,115, 32,100,101, 99,108, 97,114,101,100, 32, 97,115, 32,\n    114,101, 97,100, 45,111,110,108,121, 34, 41, 10,  9,  9,  9,\n     86, 97,114,105, 97, 98,108,101, 40, 34,116,111,108,117, 97,\n     95,114,101, 97,100,111,110,108,121, 32,105,110,116, 32, 34,\n     46, 46,118, 97,114,110, 97,109,101, 41, 10,  9,  9,101,110,\n    100, 10,  9,101,110,100, 10,  9, 32,108,111, 99, 97,108, 32,\n    112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,  9,\n     32,105,102, 32,112, 97,114,101,110,116, 32,116,104,101,110,\n     10,  9,  9,116, 46, 97, 99, 99,101,115,115, 32, 61, 32,112,\n     97,114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98,\n    101,114, 95, 97, 99, 99,101,115,115, 10,  9,  9,116, 46,103,\n    108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61, 32,\n    116, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95,\n     97, 99, 99,101,115,115, 40, 41, 10,  9, 32,101,110,100, 10,\n    114,101,116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45,\n     45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10, 45,\n     45, 32, 69,120,112,101, 99,116,115, 32, 97, 32,115,116,114,\n    105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110,\n    103, 32,116,104,101, 32,101,110,117,109,101,114, 97,116,101,\n     32, 98,111,100,121, 10,102,117,110, 99,116,105,111,110, 32,\n     69,110,117,109,101,114, 97,116,101, 32, 40,110, 44, 98, 44,\n    118, 97,114,110, 97,109,101, 41, 10,  9, 98, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40, 98, 44, 32, 34,\n     44, 91, 37,115, 92,110, 93, 42,125, 34, 44, 32, 34, 92,110,\n    125, 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,\n    101, 32,108, 97,115,116, 32, 39, 44, 39, 10, 32,108,111, 99,\n     97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116,\n    114,115,117, 98, 40, 98, 44, 50, 44, 45, 50, 41, 44, 39, 44,\n     39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 98,114, 97, 99,101,115, 10, 32,108,111, 99, 97,108, 32,\n    105, 32, 61, 32, 49, 10, 32,108,111, 99, 97,108, 32,101, 32,\n     61, 32,123,110, 61, 48,125, 10, 32,119,104,105,108,101, 32,\n    116, 91,105, 93, 32,100,111, 10, 32, 32,108,111, 99, 97,108,\n     32,116,116, 32, 61, 32,115,112,108,105,116, 40,116, 91,105,\n     93, 44, 39, 61, 39, 41, 32, 32, 45, 45, 32,100,105,115, 99,\n     97,114,100, 32,105,110,105,116,105, 97,108, 32,118, 97,108,\n    117,101, 10, 32, 32,101, 46,110, 32, 61, 32,101, 46,110, 32,\n     43, 32, 49, 10, 32, 32,101, 91,101, 46,110, 93, 32, 61, 32,\n    116,116, 91, 49, 93, 10, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32,101,110,100, 10, 32, 45, 45, 32,115,101,116, 32,108,\n    117, 97, 32,110, 97,109,101,115, 10, 32,105, 32, 32, 61, 32,\n     49, 10, 32,101, 46,108,110, 97,109,101,115, 32, 61, 32,123,\n    125, 10, 32,108,111, 99, 97,108, 32,110,115, 32, 61, 32,103,\n    101,116, 99,117,114,114,110, 97,109,101,115,112, 97, 99,101,\n     40, 41, 10, 32,119,104,105,108,101, 32,101, 91,105, 93, 32,\n    100,111, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n    115,112,108,105,116, 40,101, 91,105, 93, 44, 39, 64, 39, 41,\n     10, 32, 32,101, 91,105, 93, 32, 61, 32,116, 91, 49, 93, 10,\n      9,  9,105,102, 32,110,111,116, 32,116, 91, 50, 93, 32,116,\n    104,101,110, 10,  9,  9, 32,116, 91, 50, 93, 32, 61, 32, 97,\n    112,112,108,121,114,101,110, 97,109,105,110,103, 40,116, 91,\n     49, 93, 41, 10,  9,  9,101,110,100, 10, 32, 32,101, 46,108,\n    110, 97,109,101,115, 91,105, 93, 32, 61, 32,116, 91, 50, 93,\n     32,111,114, 32,116, 91, 49, 93, 10, 32, 32, 95,103,108,111,\n     98, 97,108, 95,101,110,117,109,115, 91, 32,110,115, 46, 46,\n    101, 91,105, 93, 32, 93, 32, 61, 32, 40,110,115, 46, 46,101,\n     91,105, 93, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10,\n     32,101,110,100, 10,  9,101, 46,110, 97,109,101, 32, 61, 32,\n    110, 10,  9,105,102, 32,110, 32,126, 61, 32, 34, 34, 32,116,\n    104,101,110, 10,  9,  9, 84,121,112,101,100,101,102, 40, 34,\n    105,110,116, 32, 34, 46, 46,110, 41, 10,  9,101,110,100, 10,\n     32,114,101,116,117,114,110, 32, 95, 69,110,117,109,101,114,\n     97,116,101, 40,101, 44, 32,118, 97,114,110, 97,109,101, 41,\n     10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/enumerate.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,100,101, 99,108, 97,\n    114, 97,116,105,111,110, 32, 99,108, 97,115,115, 10, 45, 45,\n     32, 87,114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,\n    100,101,109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32,\n     84,101, 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111,\n     10, 45, 45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45,\n     32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,\n    115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, 32,\n    115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99,\n     97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,101,\n     32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,\n    102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,\n    111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,101,\n    100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, 32,\n    111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98,\n     97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,\n    101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,111,\n     32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, 32,\n    112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,110,\n     97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,\n    117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104,\n     97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,109,\n    111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10,\n     10, 45, 45, 32, 68,101, 99,108, 97,114, 97,116,105,111,110,\n     32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,\n    115,101,110,116,115, 32,118, 97,114,105, 97, 98,108,101, 44,\n     32,102,117,110, 99,116,105,111,110, 44, 32,111,114, 32, 97,\n    114,103,117,109,101,110,116, 32,100,101, 99,108, 97,114, 97,\n    116,105,111,110, 46, 10, 45, 45, 32, 83,116,111,114,101,115,\n     32,116,104,101, 32,102,111,108,108,111,119,105,110,103, 32,\n    102,105,101,108,100,115, 58, 10, 45, 45, 32, 32,109,111,100,\n     32, 32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,\n    101,114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,\n    116,121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61,\n     32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102,\n     32,114,101,112,114,101,115,101,110,116,105,110,103, 32, 97,\n     32,112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,\n    101,102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,\n    109,101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,100,\n    105,109, 32, 32, 61, 32,100,105,109,101,110,115,105,111,110,\n     44, 32,105,102, 32, 97, 32,118,101, 99,116,111,114, 10, 45,\n     45, 32, 32,100,101,102, 32, 32, 61, 32,100,101,102, 97,117,\n    108,116, 32,118, 97,108,117,101, 44, 32,105,102, 32, 97,110,\n    121, 32, 40,111,110,108,121, 32,102,111,114, 32, 97,114,103,\n    117,109,101,110,116,115, 41, 10, 45, 45, 32, 32,114,101,116,\n     32, 32, 61, 32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44,\n     32,105,102, 32,118, 97,108,117,101, 32,105,115, 32,116,111,\n     32, 98,101, 32,114,101,116,117,114,110,101,100, 32, 40,111,\n    110,108,121, 32,102,111,114, 32, 97,114,103,117,109,101,110,\n    116,115, 41, 10, 99,108, 97,115,115, 68,101, 99,108, 97,114,\n     97,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100, 32,\n     61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39,\n     39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10, 32,\n    110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32,100,105,109,\n     32, 61, 32, 39, 39, 44, 10, 32,114,101,116, 32, 61, 32, 39,\n     39, 44, 10, 32,100,101,102, 32, 61, 32, 39, 39, 10,125, 10,\n     99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,\n    110, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,\n    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 10,115,\n    101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,\n    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 44, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,\n     45, 32, 67,114,101, 97,116,101, 32, 97,110, 32,117,110,105,\n    113,117,101, 32,118, 97,114,105, 97, 98,108,101, 32,110, 97,\n    109,101, 10,102,117,110, 99,116,105,111,110, 32, 99,114,101,\n     97,116,101, 95,118, 97,114,110, 97,109,101, 32, 40, 41, 10,\n     32,105,102, 32,110,111,116, 32, 95,118, 97,114,110,117,109,\n     98,101,114, 32,116,104,101,110, 32, 95,118, 97,114,110,117,\n    109, 98,101,114, 32, 61, 32, 48, 32,101,110,100, 10, 32, 95,\n    118, 97,114,110,117,109, 98,101,114, 32, 61, 32, 95,118, 97,\n    114,110,117,109, 98,101,114, 32, 43, 32, 49, 10, 32,114,101,\n    116,117,114,110, 32, 34,116,111,108,117, 97, 95,118, 97,114,\n     95, 34, 46, 46, 95,118, 97,114,110,117,109, 98,101,114, 10,\n    101,110,100, 10, 10, 45, 45, 32, 67,104,101, 99,107, 32,100,\n    101, 99,108, 97,114, 97,116,105,111,110, 32,110, 97,109,101,\n     10, 45, 45, 32, 73,116, 32, 97,108,115,111, 32,105,100,101,\n    110,116,105,102,105,101,115, 32,100,101,102, 97,117,108,116,\n     32,118, 97,108,117,101,115, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 58, 99,104,101, 99,107,110, 97,109,101, 32, 40,\n     41, 10, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,115,\n    101,108,102, 46,110, 97,109,101, 44, 49, 44, 49, 41, 32, 61,\n     61, 32, 39, 91, 39, 32, 97,110,100, 32,110,111,116, 32,102,\n    105,110,100,116,121,112,101, 40,115,101,108,102, 46,116,121,\n    112,101, 41, 32,116,104,101,110, 10, 32, 32,115,101,108,102,\n     46,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,116,121,\n    112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10, 32,\n     32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,\n    116, 40,115,101,108,102, 46,109,111,100, 44, 39, 37,115, 37,\n    115, 42, 39, 41, 10, 32, 32,115,101,108,102, 46,116,121,112,\n    101, 32, 61, 32,109, 91,109, 46,110, 93, 10, 32, 32,115,101,\n    108,102, 46,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116,\n     40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 10, 32,101,110,\n    100, 10, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,115,\n    112,108,105,116, 40,115,101,108,102, 46,110, 97,109,101, 44,\n     39, 61, 39, 41, 10, 32,105,102, 32,116, 46,110, 61, 61, 50,\n     32,116,104,101,110, 10, 32, 32,115,101,108,102, 46,110, 97,\n    109,101, 32, 61, 32,116, 91, 49, 93, 10, 32, 32,115,101,108,\n    102, 46,100,101,102, 32, 61, 32,102,105,110,100, 95,101,110,\n    117,109, 95,118, 97,114, 40,116, 91,116, 46,110, 93, 41, 10,\n     32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32, 98, 44,\n    101, 44,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,\n    101,108,102, 46,110, 97,109,101, 44, 34, 37, 91, 40, 46, 45,\n     41, 37, 93, 34, 41, 10, 32,105,102, 32, 98, 32,116,104,101,\n    110, 10, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61,\n     32,115,116,114,115,117, 98, 40,115,101,108,102, 46,110, 97,\n    109,101, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32,115,101,108,\n    102, 46,100,105,109, 32, 61, 32,102,105,110,100, 95,101,110,\n    117,109, 95,118, 97,114, 40,100, 41, 10, 32,101,110,100, 10,\n     10, 10, 32,105,102, 32,115,101,108,102, 46,116,121,112,101,\n     32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102,\n     46,116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39,\n     32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 32,\n     61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,115,101,\n    108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,101, 97,116,\n    101, 95,118, 97,114,110, 97,109,101, 40, 41, 10, 32,101,108,\n    115,101,105,102, 32,115,101,108,102, 46,107,105,110,100, 61,\n     61, 39,118, 97,114, 39, 32,116,104,101,110, 10, 32, 32,105,\n    102, 32,115,101,108,102, 46,116,121,112,101, 61, 61, 39, 39,\n     32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101,126,\n     61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 32,115,101,108,102, 46,116,\n    121,112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10,\n     32, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,\n     99,114,101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40,\n     41, 10, 32, 32,101,108,115,101,105,102, 32,102,105,110,100,\n    116,121,112,101, 40,115,101,108,102, 46,110, 97,109,101, 41,\n     32,116,104,101,110, 10, 32, 32, 32,105,102, 32,115,101,108,\n    102, 46,116,121,112,101, 61, 61, 39, 39, 32,116,104,101,110,\n     32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101,\n    108,102, 46,110, 97,109,101, 10, 32, 32, 32,101,108,115,101,\n     32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101,\n    108,102, 46,116,121,112,101, 46, 46, 39, 32, 39, 46, 46,115,\n    101,108,102, 46,110, 97,109,101, 32,101,110,100, 10, 32, 32,\n     32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,\n    101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, 41, 10,\n     32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45,\n     32, 97,100,106,117,115,116, 32,116,121,112,101, 32,111,102,\n     32,115,116,114,105,110,103, 10, 32,105,102, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 61, 32, 39, 99,104, 97,114,\n     39, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32,\n    126, 61, 32, 39, 39, 32,116,104,101,110, 10,  9, 32,115,101,\n    108,102, 46,116,121,112,101, 32, 61, 32, 39, 99,104, 97,114,\n     42, 39, 10, 32,101,110,100, 10, 10,  9,105,102, 32,115,101,\n    108,102, 46,107,105,110,100, 32, 97,110,100, 32,115,101,108,\n    102, 46,107,105,110,100, 32, 61, 61, 32, 39,118, 97,114, 39,\n     32,116,104,101,110, 10,  9,  9,115,101,108,102, 46,110, 97,\n    109,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40,115,101,108,102, 46,110, 97,109,101, 44, 32, 34, 58,\n     46, 42, 36, 34, 44, 32, 34, 34, 41, 32, 45, 45, 32, 63, 63,\n     63, 10,  9,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n     67,104,101, 99,107, 32,100,101, 99,108, 97,114, 97,116,105,\n    111,110, 32,116,121,112,101, 10, 45, 45, 32, 83,117, 98,115,\n    116,105,116,117,116,101,115, 32,116,121,112,101,100,101,102,\n     39,115, 46, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,\n     99,104,101, 99,107,116,121,112,101, 32, 40, 41, 10, 10, 32,\n     45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,116,104,101,\n    114,101, 32,105,115, 32, 97, 32,112,111,105,110,116,101,114,\n     32,116,111, 32, 98, 97,115,105, 99, 32,116,121,112,101, 10,\n     32,108,111, 99, 97,108, 32, 98, 97,115,105, 99, 32, 61, 32,\n    105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,\n    112,101, 41, 10, 32,105,102, 32,115,101,108,102, 46,107,105,\n    110,100, 32, 61, 61, 32, 39,102,117,110, 99, 39, 32, 97,110,\n    100, 32, 98, 97,115,105, 99, 61, 61, 39,110,117,109, 98,101,\n    114, 39, 32, 97,110,100, 32,115,116,114,105,110,103, 46,102,\n    105,110,100, 40,115,101,108,102, 46,112,116,114, 44, 32, 34,\n     37, 42, 34, 41, 32,116,104,101,110, 10, 32,  9,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 32, 39, 95,117,115,101,114,\n    100, 97,116, 97, 39, 10, 32,  9,115,101,108,102, 46,112,116,\n    114, 32, 61, 32, 34, 34, 10, 32,101,110,100, 10, 32,105,102,\n     32, 98, 97,115,105, 99, 32, 97,110,100, 32,115,101,108,102,\n     46,112,116,114,126, 61, 39, 39, 32,116,104,101,110, 10, 32,\n     32,115,101,108,102, 46,114,101,116, 32, 61, 32,115,101,108,\n    102, 46,112,116,114, 10, 32, 32,115,101,108,102, 46,112,116,\n    114, 32, 61, 32,110,105,108, 10, 32, 32,105,102, 32,105,115,\n     98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101,\n     41, 32, 61, 61, 32, 39,110,117,109, 98,101,114, 39, 32,116,\n    104,101,110, 10, 32, 32,  9,115,101,108,102, 46,114,101,116,\n    117,114,110, 95,117,115,101,114,100, 97,116, 97, 32, 61, 32,\n    116,114,117,101, 10, 32, 32,101,110,100, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,\n    116,104,101,114,101, 32,105,115, 32, 97,114,114, 97,121, 32,\n    116,111, 32, 98,101, 32,114,101,116,117,114,110,101,100, 10,\n     32,105,102, 32,115,101,108,102, 46,100,105,109,126, 61, 39,\n     39, 32, 97,110,100, 32,115,101,108,102, 46,114,101,116,126,\n     61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114,114,\n    111,114, 40, 39, 35,105,110,118, 97,108,105,100, 32,112, 97,\n    114, 97,109,101,116,101,114, 58, 32, 99, 97,110,110,111,116,\n     32,114,101,116,117,114,110, 32, 97,110, 32, 97,114,114, 97,\n    121, 32,111,102, 32,118, 97,108,117,101,115, 39, 41, 10, 32,\n    101,110,100, 10, 32, 45, 45, 32,114,101,115,116,111,114,101,\n     32, 39,118,111,105,100, 42, 39, 32, 97,110,100, 32, 39,115,\n    116,114,105,110,103, 42, 39, 10, 32,105,102, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 61, 32, 39, 95,117,115,101,\n    114,100, 97,116, 97, 39, 32,116,104,101,110, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 32, 39,118,111,105,100, 42,\n     39, 10, 32,101,108,115,101,105,102, 32,115,101,108,102, 46,\n    116,121,112,101, 32, 61, 61, 32, 39, 95, 99,115,116,114,105,\n    110,103, 39, 32,116,104,101,110, 32,115,101,108,102, 46,116,\n    121,112,101, 32, 61, 32, 39, 99,104, 97,114, 42, 39, 10, 32,\n    101,108,115,101,105,102, 32,115,101,108,102, 46,116,121,112,\n    101, 32, 61, 61, 32, 39, 95,108,115,116, 97,116,101, 39, 32,\n    116,104,101,110, 32,115,101,108,102, 46,116,121,112,101, 32,\n     61, 32, 39,108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10,\n     32,101,110,100, 10, 10, 32, 45, 45, 32,114,101,115,111,108,\n    118,101, 32,116,121,112,101,115, 32,105,110,115,105,100,101,\n     32,116,104,101, 32,116,101,109,112,108, 97,116,101,115, 10,\n     32,105,102, 32,115,101,108,102, 46,116,121,112,101, 32,116,\n    104,101,110, 10,  9, 32,115,101,108,102, 46,116,121,112,101,\n     32, 61, 32,114,101,115,111,108,118,101, 95,116,101,109,112,\n    108, 97,116,101, 95,116,121,112,101,115, 40,115,101,108,102,\n     46,116,121,112,101, 41, 10, 32,101,110,100, 10, 10, 45, 45,\n     10, 45, 45, 32, 45, 45, 32,105,102, 32,114,101,116,117,114,\n    110,105,110,103, 32,118, 97,108,117,101, 44, 32, 97,117,116,\n    111,109, 97,116,105, 99, 97,108,108,121, 32,115,101,116, 32,\n    100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 10, 45,\n     45, 32,105,102, 32,115,101,108,102, 46,114,101,116, 32,126,\n     61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, 46,100,\n    101,102, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 45,\n     45, 32, 32,115,101,108,102, 46,100,101,102, 32, 61, 32, 39,\n     48, 39, 10, 45, 45, 32,101,110,100, 10, 45, 45, 10, 10,101,\n    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,101,\n    115,111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,\n    116,121,112,101,115, 40,116,121,112,101, 41, 10, 10,  9,105,\n    102, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, 41,\n     32,116,104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,\n    116,121,112,101, 10,  9,101,110,100, 10,  9,108,111, 99, 97,\n    108, 32, 98, 44, 95, 44,109, 32, 61, 32,115,116,114,105,110,\n    103, 46,102,105,110,100, 40,116,121,112,101, 44, 32, 34, 40,\n     37, 98, 60, 62, 41, 34, 41, 10,  9,105,102, 32, 98, 32,116,\n    104,101,110, 10, 10,  9,  9,109, 32, 61, 32,115,112,108,105,\n    116, 95, 99, 95,116,111,107,101,110,115, 40,115,116,114,105,\n    110,103, 46,115,117, 98, 40,109, 44, 32, 50, 44, 32, 45, 50,\n     41, 44, 32, 34, 44, 34, 41, 10,  9,  9,102,111,114, 32,105,\n     61, 49, 44, 32,116, 97, 98,108,101, 46,103,101,116,110, 40,\n    109, 41, 32,100,111, 10,  9,  9,  9,109, 91,105, 93, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109, 91,\n    105, 93, 44, 34, 37,115, 42, 40, 91, 37, 42, 38, 93, 41, 34,\n     44, 32, 34, 37, 49, 34, 41, 10,  9,  9,  9,105,102, 32,110,\n    111,116, 32,105,115, 98, 97,115,105, 99, 40,109, 91,105, 93,\n     41, 32,116,104,101,110, 10,  9,  9,  9,  9,105,102, 32,110,\n    111,116, 32,105,115,101,110,117,109, 40,109, 91,105, 93, 41,\n     32,116,104,101,110, 32, 95, 44, 32,109, 91,105, 93, 32, 61,\n     32, 97,112,112,108,121,116,121,112,101,100,101,102, 40, 34,\n     34, 44, 32,109, 91,105, 93, 41, 32,101,110,100, 10,  9,  9,\n      9,  9,109, 91,105, 93, 32, 61, 32,102,105,110,100,116,121,\n    112,101, 40,109, 91,105, 93, 41, 32,111,114, 32,109, 91,105,\n     93, 10,  9,  9,  9,  9,109, 91,105, 93, 32, 61, 32,114,101,\n    115,111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,\n    116,121,112,101,115, 40,109, 91,105, 93, 41, 10,  9,  9,  9,\n    101,110,100, 10,  9,  9,101,110,100, 10, 10,  9,  9,108,111,\n     99, 97,108, 32, 98, 44,105, 10,  9,  9,116,121,112,101, 44,\n     98, 44,105, 32, 61, 32, 98,114,101, 97,107, 95,116,101,109,\n    112,108, 97,116,101, 40,116,121,112,101, 41, 10, 45, 45,112,\n    114,105,110,116, 40, 34, 99,111,110, 99, 97,116, 32,105,115,\n     32, 34, 44, 99,111,110, 99, 97,116, 40,109, 44, 32, 49, 44,\n     32,109, 46,110, 41, 41, 10,  9,  9,108,111, 99, 97,108, 32,\n    116,101,109,112,108, 97,116,101, 95,112, 97,114,116, 32, 61,\n     32, 34, 60, 34, 46, 46, 99,111,110, 99, 97,116, 40,109, 44,\n     32, 49, 44, 32,109, 46,110, 44, 32, 34, 44, 34, 41, 46, 46,\n     34, 62, 34, 10,  9,  9,116,121,112,101, 32, 61, 32,114,101,\n     98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40,\n    116,121,112,101, 44, 32, 98, 44, 32,116,101,109,112,108, 97,\n    116,101, 95,112, 97,114,116, 41, 10,  9,  9,116,121,112,101,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    116,121,112,101, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32,\n     62, 34, 41, 10,  9,101,110,100, 10,  9,114,101,116,117,114,\n    110, 32,116,121,112,101, 10,101,110,100, 10, 10,102,117,110,\n     99,116,105,111,110, 32, 98,114,101, 97,107, 95,116,101,109,\n    112,108, 97,116,101, 40,115, 41, 10,  9,108,111, 99, 97,108,\n     32, 98, 44,101, 44,116,105,109,112,108, 32, 61, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 40,\n     37, 98, 60, 62, 41, 34, 41, 10,  9,105,102, 32,116,105,109,\n    112,108, 32,116,104,101,110, 10,  9,  9,115, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, 34,\n     37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 10,  9,  9,114,101,\n    116,117,114,110, 32,115, 44, 32, 98, 44, 32,116,105,109,112,\n    108, 10,  9,101,108,115,101, 10,  9,  9,114,101,116,117,114,\n    110, 32,115, 44, 32, 48, 44, 32,110,105,108, 10,  9,101,110,\n    100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32,114,101, 98,117,105,108,100, 95,116,101,109,112,108, 97,\n    116,101, 40,115, 44, 32, 98, 44, 32,116,105,109,112,108, 41,\n     10, 10,  9,105,102, 32, 98, 32, 61, 61, 32, 48, 32,116,104,\n    101,110, 10,  9,  9,114,101,116,117,114,110, 32,115, 10,  9,\n    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,115,116,\n    114,105,110,103, 46,115,117, 98, 40,115, 44, 32, 49, 44, 32,\n     98, 45, 49, 41, 46, 46,116,105,109,112,108, 46, 46,115,116,\n    114,105,110,103, 46,115,117, 98, 40,115, 44, 32, 98, 44, 32,\n     45, 49, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,\n    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114,\n     97,116,105,111,110, 58,112,114,105,110,116, 32, 40,105,100,\n    101,110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34, 68,101, 99,108,\n     97,114, 97,116,105,111,110,123, 34, 41, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,109,111,100,\n     32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,109,111,\n    100, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 32,116,121,112,101, 32,\n     61, 32, 39, 34, 46, 46,115,101,108,102, 46,116,121,112,101,\n     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 32,112,116,114, 32, 32, 61,\n     32, 39, 34, 46, 46,115,101,108,102, 46,112,116,114, 46, 46,\n     34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 32,110, 97,109,101, 32, 61, 32, 39,\n     34, 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 34,\n     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,100,105,109, 32, 32, 61, 32, 39, 34,\n     46, 46,115,101,108,102, 46,100,105,109, 46, 46, 34, 39, 44,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34, 32,100,101,102, 32, 32, 61, 32, 39, 34, 46, 46,\n    115,101,108,102, 46,100,101,102, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32,114,101,116, 32, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46,114,101,116, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,125,\n     34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, 10,\n     45, 45, 32, 99,104,101, 99,107, 32,105,102, 32, 97,114,114,\n     97,121, 32,111,102, 32,118, 97,108,117,101,115, 32, 97,114,\n    101, 32,114,101,116,117,114,110,101,100, 32,116,111, 32, 76,\n    117, 97, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,114,\n    101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,\n    110, 32, 40,116, 41, 10, 32,105,102, 32,115,101,108,102, 46,\n    109,111,100, 32,126, 61, 32, 39, 99,111,110,115,116, 39, 32,\n     97,110,100, 10,  9, 32, 32, 32, 32,115,101,108,102, 46,100,\n    105,109, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109,\n     32,126, 61, 32, 39, 39, 32, 97,110,100, 10,  9,  9,  9,  9,\n     32,110,111,116, 32,105,115, 98, 97,115,105, 99, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 32, 97,110,100, 10,  9,  9,\n      9,  9, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32,\n     39, 39, 32, 97,110,100, 32,115,101,108,102, 58, 99,104,101,\n     99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,\n    115, 40, 41, 32,116,104,101,110, 10,  9,  9,108,111, 99, 97,\n    108, 32,116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115,\n    101,108,102, 46,116,121,112,101, 44, 34, 37,115, 42, 99,111,\n    110,115,116, 37,115, 43, 34, 44, 34, 34, 41, 10,  9,  9,116,\n     91,116,121,112,101, 93, 32, 61, 32, 34,116,111,108,117, 97,\n     95, 99,111,108,108,101, 99,116, 95, 34, 32, 46, 46, 32, 99,\n    108,101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,116,\n    121,112,101, 41, 10,  9,  9,114,101,116,117,114,110, 32,116,\n    114,117,101, 10,  9,101,110,100, 10,  9,114,101,116,117,114,\n    110, 32,102, 97,108,115,101, 10,101,110,100, 10, 10, 45, 45,\n     32,100,101, 99,108, 97,114,101, 32,116, 97,103, 10,102,117,\n    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,\n    108, 97,114, 97,116,105,111,110, 58,100,101, 99,108,116,121,\n    112,101, 32, 40, 41, 10, 10,  9,115,101,108,102, 46,116,121,\n    112,101, 32, 61, 32,116,121,112,101,118, 97,114, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 10,  9,105,102, 32,115,116,\n    114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44,\n     39, 99,111,110,115,116, 39, 41, 32,116,104,101,110, 10,  9,\n      9,115,101,108,102, 46,116,121,112,101, 32, 61, 32, 39, 99,\n    111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116,121,\n    112,101, 10,  9,  9,115,101,108,102, 46,109,111,100, 32, 61,\n     32,103,115,117, 98, 40,115,101,108,102, 46,109,111,100, 44,\n     39, 99,111,110,115,116, 37,115, 42, 39, 44, 39, 39, 41, 10,\n      9,101,110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32,111,\n    117,116,112,117,116, 32,116,121,112,101, 32, 99,104,101, 99,\n    107,105,110,103, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110,\n     58,111,117,116, 99,104,101, 99,107,116,121,112,101, 32, 40,\n    110, 97,114,103, 41, 10, 32,108,111, 99, 97,108, 32,100,101,\n    102, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,105,115,\n     98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101,\n     41, 10, 32,105,102, 32,115,101,108,102, 46,100,101,102,126,\n     61, 39, 39, 32,116,104,101,110, 10, 32, 32,100,101,102, 32,\n     61, 32, 49, 10, 32,101,108,115,101, 10, 32, 32,100,101,102,\n     32, 61, 32, 48, 10, 32,101,110,100, 10, 32,105,102, 32,115,\n    101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,\n    104,101,110, 10,  9, 45, 45,105,102, 32,116, 61, 61, 39,115,\n    116,114,105,110,103, 39, 32,116,104,101,110, 10,  9, 45, 45,\n      9,114,101,116,117,114,110, 32, 39,116,111,108,117, 97, 95,\n    105,115,115,116,114,105,110,103, 97,114,114, 97,121, 40,116,\n    111,108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46,\n     46, 39, 44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,116,\n    111,108,117, 97, 95,101,114,114, 41, 39, 10,  9, 45, 45,101,\n    108,115,101, 10,  9,114,101,116,117,114,110, 32, 39, 33,116,\n    111,108,117, 97, 95,105,115,116, 97, 98,108,101, 40,116,111,\n    108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46,\n     39, 44, 48, 44, 38,116,111,108,117, 97, 95,101,114,114, 41,\n     39, 10, 32,  9, 45, 45,101,110,100, 10, 32,101,108,115,101,\n    105,102, 32,116, 32,116,104,101,110, 10,  9,114,101,116,117,\n    114,110, 32, 39, 33,116,111,108,117, 97, 95,105,115, 39, 46,\n     46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 39,\n     46, 46,110, 97,114,103, 46, 46, 39, 44, 39, 46, 46,100,101,\n    102, 46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,114,\n     41, 39, 10, 32,101,108,115,101, 10, 32, 32,108,111, 99, 97,\n    108, 32,105,115, 95,102,117,110, 99, 32, 61, 32,103,101,116,\n     95,105,115, 95,102,117,110, 99,116,105,111,110, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102, 32,115,\n    101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39, 32,\n    111,114, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32,\n     39, 39, 32,116,104,101,110, 10, 32, 32,  9,114,101,116,117,\n    114,110, 32, 39, 40,116,111,108,117, 97, 95,105,115,118, 97,\n    108,117,101,110,105,108, 40,116,111,108,117, 97, 95, 83, 44,\n     39, 46, 46,110, 97,114,103, 46, 46, 39, 44, 38,116,111,108,\n    117, 97, 95,101,114,114, 41, 32,124,124, 32, 33, 39, 46, 46,\n    105,115, 95,102,117,110, 99, 46, 46, 39, 40,116,111,108,117,\n     97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, 44,\n     34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, 46, 46,\n     39, 34, 44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,116,\n    111,108,117, 97, 95,101,114,114, 41, 41, 39, 10, 32, 32,101,\n    108,115,101, 10,  9,114,101,116,117,114,110, 32, 39, 33, 39,\n     46, 46,105,115, 95,102,117,110, 99, 46, 46, 39, 40,116,111,\n    108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46,\n     39, 44, 34, 39, 46, 46,115,101,108,102, 46,116,121,112,101,\n     46, 46, 39, 34, 44, 39, 46, 46,100,101,102, 46, 46, 39, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 39, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10,101,110,100, 10, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101,\n     99,108, 97,114, 97,116,105,111,110, 58, 98,117,105,108,100,\n    100,101, 99,108, 97,114, 97,116,105,111,110, 32, 40,110, 97,\n    114,103, 44, 32, 99,112,108,117,115,112,108,117,115, 41, 10,\n     32,108,111, 99, 97,108, 32, 97,114,114, 97,121, 32, 61, 32,\n    115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,\n     97,110,100, 32,116,111,110,117,109, 98,101,114, 40,115,101,\n    108,102, 46,100,105,109, 41, 61, 61,110,105,108, 10,  9,108,\n    111, 99, 97,108, 32,108,105,110,101, 32, 61, 32, 34, 34, 10,\n     32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39,\n     10, 32,108,111, 99, 97,108, 32,109,111,100, 10, 32,108,111,\n     99, 97,108, 32,116,121,112,101, 32, 61, 32,115,101,108,102,\n     46,116,121,112,101, 10, 32,108,111, 99, 97,108, 32,110, 99,\n    116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,\n    102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 37,115,\n     43, 39, 44, 39, 39, 41, 10, 32,105,102, 32,115,101,108,102,\n     46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110,\n     10,  9, 32,116,121,112,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,\n    116, 37,115, 43, 39, 44, 39, 39, 41, 32, 32, 45, 45, 32,101,\n    108,105,109,105,110, 97,116,101,115, 32, 99,111,110,115,116,\n     32,109,111,100,105,102,105,101,114, 32,102,111,114, 32, 97,\n    114,114, 97,121,115, 10, 32,101,110,100, 10, 32,105,102, 32,\n    115,101,108,102, 46,112,116,114,126, 61, 39, 39, 32, 97,110,\n    100, 32,110,111,116, 32,105,115, 98, 97,115,105, 99, 40,116,\n    121,112,101, 41, 32,116,104,101,110, 32,112,116,114, 32, 61,\n     32, 39, 42, 39, 32,101,110,100, 10, 32,108,105,110,101, 32,\n     61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,\n    105,110,101, 44, 34, 32, 34, 44,115,101,108,102, 46,109,111,\n    100, 44,116,121,112,101, 44,112,116,114, 41, 10, 32,105,102,\n     32, 97,114,114, 97,121, 32,116,104,101,110, 10, 32, 32,108,\n    105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114,\n     97,109, 40,108,105,110,101, 44, 39, 42, 39, 41, 10, 32,101,\n    110,100, 10, 32,108,105,110,101, 32, 61, 32, 99,111,110, 99,\n     97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,115,101,\n    108,102, 46,110, 97,109,101, 41, 10, 32,105,102, 32,115,101,\n    108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,\n    101,110, 10, 32, 32,105,102, 32,116,111,110,117,109, 98,101,\n    114, 40,115,101,108,102, 46,100,105,109, 41,126, 61,110,105,\n    108, 32,116,104,101,110, 10, 32, 32, 32,108,105,110,101, 32,\n     61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,\n    105,110,101, 44, 39, 91, 39, 44,115,101,108,102, 46,100,105,\n    109, 44, 39, 93, 59, 39, 41, 10, 32, 32,101,108,115,101, 10,\n      9,105,102, 32, 99,112,108,117,115,112,108,117,115, 32,116,\n    104,101,110, 10,  9,  9,108,105,110,101, 32, 61, 32, 99,111,\n    110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,\n     39, 32, 61, 32, 77,116,111,108,117, 97, 95,110,101,119, 95,\n    100,105,109, 40, 39, 44,116,121,112,101, 44,112,116,114, 44,\n     39, 44, 32, 39, 46, 46,115,101,108,102, 46,100,105,109, 46,\n     46, 39, 41, 59, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,\n    108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,\n    114, 97,109, 40,108,105,110,101, 44, 39, 32, 61, 32, 40, 39,\n     44,116,121,112,101, 44,112,116,114, 44, 39, 42, 41, 39, 44,\n     10,  9,  9, 39,109, 97,108,108,111, 99, 40, 40, 39, 44,115,\n    101,108,102, 46,100,105,109, 44, 39, 41, 42,115,105,122,101,\n    111,102, 40, 39, 44,116,121,112,101, 44,112,116,114, 44, 39,\n     41, 41, 59, 39, 41, 10,  9,101,110,100, 10, 32, 32,101,110,\n    100, 10, 32,101,108,115,101, 10, 32, 32,108,111, 99, 97,108,\n     32,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121,\n    112,101, 41, 10, 32, 32,108,105,110,101, 32, 61, 32, 99,111,\n    110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,\n     39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, 32,116, 32, 61,\n     61, 32, 39,115,116, 97,116,101, 39, 32,116,104,101,110, 10,\n     32, 32,  9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,\n    116,112, 97,114, 97,109, 40,108,105,110,101, 44, 32, 39,116,\n    111,108,117, 97, 95, 83, 59, 39, 41, 10, 32, 32,101,108,115,\n    101, 10, 32, 32,  9, 45, 45,112,114,105,110,116, 40, 34,116,\n     32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103,\n     40,116, 41, 46, 46, 34, 44, 32,112,116,114, 32,105,115, 32,\n     34, 46, 46,116,111,115,116,114,105,110,103, 40,115,101,108,\n    102, 46,112,116,114, 41, 41, 10, 32, 32,  9,105,102, 32,116,\n     32, 61, 61, 32, 39,110,117,109, 98,101,114, 39, 32, 97,110,\n    100, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,\n    101,108,102, 46,112,116,114, 44, 32, 34, 37, 42, 34, 41, 32,\n    116,104,101,110, 10, 32, 32,  9,  9,116, 32, 61, 32, 39,117,\n    115,101,114,100, 97,116, 97, 39, 10, 32, 32,  9,101,110,100,\n     10,  9,105,102, 32,110,111,116, 32,116, 32, 97,110,100, 32,\n    112,116,114, 61, 61, 39, 39, 32,116,104,101,110, 32,108,105,\n    110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,\n    109, 40,108,105,110,101, 44, 39, 42, 39, 41, 32,101,110,100,\n     10,  9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,\n    112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 40, 40, 39,\n     44,115,101,108,102, 46,109,111,100, 44,116,121,112,101, 41,\n     10,  9,105,102, 32,110,111,116, 32,116, 32,116,104,101,110,\n     10,  9,  9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,\n    116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 42, 39,\n     41, 10,  9,101,110,100, 10,  9,108,105,110,101, 32, 61, 32,\n     99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,\n    101, 44, 39, 41, 32, 39, 41, 10,  9,105,102, 32,105,115,101,\n    110,117,109, 40,110, 99,116,121,112,101, 41, 32,116,104,101,\n    110, 10,  9,  9,108,105,110,101, 32, 61, 32, 99,111,110, 99,\n     97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 40,\n    105,110,116, 41, 32, 39, 41, 10,  9,101,110,100, 10,  9,108,\n    111, 99, 97,108, 32,100,101,102, 32, 61, 32, 48, 10,  9,105,\n    102, 32,115,101,108,102, 46,100,101,102, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10,  9,  9,100,101,102, 32, 61, 32,\n    115,101,108,102, 46,100,101,102, 10,  9,  9,105,102, 32, 40,\n    112,116,114, 32, 61, 61, 32, 39, 39, 32,111,114, 32,115,101,\n    108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39, 41, 32,\n     97,110,100, 32,110,111,116, 32,116, 32,116,104,101,110, 10,\n      9,  9,  9,100,101,102, 32, 61, 32, 34, 40,118,111,105,100,\n     42, 41, 38, 40, 99,111,110,115,116, 32, 34, 46, 46,116,121,\n    112,101, 46, 46, 34, 41, 34, 46, 46,100,101,102, 10,  9,  9,\n    101,110,100, 10,  9,101,110,100, 10,  9,105,102, 32,116, 32,\n    116,104,101,110, 10,  9,  9,108,105,110,101, 32, 61, 32, 99,\n    111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101,\n     44, 39,116,111,108,117, 97, 95,116,111, 39, 46, 46,116, 44,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,\n    103, 44, 39, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39,\n     41, 10,  9,101,108,115,101, 10,  9,  9,108,111, 99, 97,108,\n     32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,\n    116,111, 95,102,117,110, 99,116,105,111,110, 40,116,121,112,\n    101, 41, 10,  9,  9,108,105,110,101, 32, 61, 32, 99,111,110,\n     99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,116,\n    111, 95,102,117,110, 99, 46, 46, 39, 40,116,111,108,117, 97,\n     95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44, 39, 44,100,\n    101,102, 44, 39, 41, 41, 59, 39, 41, 10,  9,101,110,100, 10,\n     32, 32,101,110,100, 10, 32,101,110,100, 10,  9,114,101,116,\n    117,114,110, 32,108,105,110,101, 10,101,110,100, 10, 10, 45,\n     45, 32, 68,101, 99,108, 97,114,101, 32,118, 97,114,105, 97,\n     98,108,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,\n    100,101, 99,108, 97,114,101, 32, 40,110, 97,114,103, 41, 10,\n     32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126, 61,\n     32, 39, 39, 32, 97,110,100, 32,116,111,110,117,109, 98,101,\n    114, 40,115,101,108,102, 46,100,105,109, 41, 61, 61,110,105,\n    108, 32,116,104,101,110, 10,  9, 32,111,117,116,112,117,116,\n     40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,\n    115,112,108,117,115, 92,110, 39, 41, 10,  9,  9,111,117,116,\n    112,117,116, 40,115,101,108,102, 58, 98,117,105,108,100,100,\n    101, 99,108, 97,114, 97,116,105,111,110, 40,110, 97,114,103,\n     44,116,114,117,101, 41, 41, 10,  9,  9,111,117,116,112,117,\n    116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10,  9,  9,\n    111,117,116,112,117,116, 40,115,101,108,102, 58, 98,117,105,\n    108,100,100,101, 99,108, 97,114, 97,116,105,111,110, 40,110,\n     97,114,103, 44,102, 97,108,115,101, 41, 41, 10,  9, 32,111,\n    117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110,\n     39, 41, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,112,\n    117,116, 40,115,101,108,102, 58, 98,117,105,108,100,100,101,\n     99,108, 97,114, 97,116,105,111,110, 40,110, 97,114,103, 44,\n    102, 97,108,115,101, 41, 41, 10,  9,101,110,100, 10,101,110,\n    100, 10, 10, 45, 45, 32, 71,101,116, 32,112, 97,114, 97,109,\n    101,116,101,114, 32,118, 97,108,117,101, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,\n    114, 97,116,105,111,110, 58,103,101,116, 97,114,114, 97,121,\n     32, 40,110, 97,114,103, 41, 10, 32,105,102, 32,115,101,108,\n    102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,\n    110, 10,  9, 32,108,111, 99, 97,108, 32,116,121,112,101, 32,\n     61, 32,103,115,117, 98, 40,115,101,108,102, 46,116,121,112,\n    101, 44, 39, 99,111,110,115,116, 32, 39, 44, 39, 39, 41, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32,123, 39, 41,\n     10,  9, 32,111,117,116,112,117,116, 40, 39, 35,105,102,110,\n    100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65,\n     83, 69, 92,110, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,\n    100,101,102, 59, 32,105,102, 32,115,101,108,102, 46,100,101,\n    102,126, 61, 39, 39, 32,116,104,101,110, 32,100,101,102, 61,\n     49, 32,101,108,115,101, 32,100,101,102, 61, 48, 32,101,110,\n    100, 10,  9,  9,108,111, 99, 97,108, 32,116, 32, 61, 32,105,\n    115, 98, 97,115,105, 99, 40,116,121,112,101, 41, 10,  9,  9,\n    105,102, 32, 40,116, 41, 32,116,104,101,110, 10,  9,  9, 32,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,105,102,\n     32, 40, 33,116,111,108,117, 97, 95,105,115, 39, 46, 46,116,\n     46, 46, 39, 97,114,114, 97,121, 40,116,111,108,117, 97, 95,\n     83, 44, 39, 44,110, 97,114,103, 44, 39, 44, 39, 44,115,101,\n    108,102, 46,100,105,109, 44, 39, 44, 39, 44,100,101,102, 44,\n     39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39,\n     41, 10,  9,  9,101,108,115,101, 10,  9,  9, 32, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32,105,102, 32, 40, 33,\n    116,111,108,117, 97, 95,105,115,117,115,101,114,116,121,112,\n    101, 97,114,114, 97,121, 40,116,111,108,117, 97, 95, 83, 44,\n     39, 44,110, 97,114,103, 44, 39, 44, 34, 39, 44,116,121,112,\n    101, 44, 39, 34, 44, 39, 44,115,101,108,102, 46,100,105,109,\n     44, 39, 44, 39, 44,100,101,102, 44, 39, 44, 38,116,111,108,\n    117, 97, 95,101,114,114, 41, 41, 39, 41, 10,  9,  9,101,110,\n    100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n     32,103,111,116,111, 32,116,111,108,117, 97, 95,108,101,114,\n    114,111,114, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32, 32,101,108,115,101, 92,110, 39, 41, 10,  9,\n     32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102,\n     92,110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 32, 32,123, 39, 41, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32, 32, 32,105,110,116, 32,105, 59, 39, 41, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,102,\n    111,114, 40,105, 61, 48, 59, 32,105, 60, 39, 46, 46,115,101,\n    108,102, 46,100,105,109, 46, 46, 39, 59,105, 43, 43, 41, 39,\n     41, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,105,\n    115, 98, 97,115,105, 99, 40,116,121,112,101, 41, 10, 32, 32,\n    108,111, 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10,\n     32, 32,105,102, 32,115,101,108,102, 46,112,116,114,126, 61,\n     39, 39, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39,\n     42, 39, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32, 32, 39, 44,115,101,108,102, 46,110, 97,109,\n    101, 46, 46, 39, 91,105, 93, 32, 61, 32, 39, 41, 10, 32, 32,\n    105,102, 32,110,111,116, 32,116, 32, 97,110,100, 32,112,116,\n    114, 61, 61, 39, 39, 32,116,104,101,110, 32,111,117,116,112,\n    117,116, 40, 39, 42, 39, 41, 32,101,110,100, 10, 32, 32,111,\n    117,116,112,117,116, 40, 39, 40, 40, 39, 44,116,121,112,101,\n     41, 10, 32, 32,105,102, 32,110,111,116, 32,116, 32,116,104,\n    101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 42,\n     39, 41, 10, 32, 32,101,110,100, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 41, 32, 39, 41, 10, 32, 32,108,111, 99, 97,\n    108, 32,100,101,102, 32, 61, 32, 48, 10, 32, 32,105,102, 32,\n    115,101,108,102, 46,100,101,102, 32,126, 61, 32, 39, 39, 32,\n    116,104,101,110, 32,100,101,102, 32, 61, 32,115,101,108,102,\n     46,100,101,102, 32,101,110,100, 10, 32, 32,105,102, 32,116,\n     32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116,\n     40, 39,116,111,108,117, 97, 95,116,111,102,105,101,108,100,\n     39, 46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83,\n     44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, 44, 39,\n     44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101,\n    108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39,\n    116,111,108,117, 97, 95,116,111,102,105,101,108,100,117,115,\n    101,114,116,121,112,101, 40,116,111,108,117, 97, 95, 83, 44,\n     39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, 44, 39, 44,\n    100,101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101,110,\n    100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n    125, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32,125, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10, 10,\n     45, 45, 32, 71,101,116, 32,112, 97,114, 97,109,101,116,101,\n    114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 58,115,101,116, 97,114,114, 97,121, 32, 40,110,\n     97,114,103, 41, 10, 32,105,102, 32,110,111,116, 32,115,116,\n    114,102,105,110,100, 40,115,101,108,102, 46,116,121,112,101,\n     44, 39, 99,111,110,115,116, 37,115, 43, 39, 41, 32, 97,110,\n    100, 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10,  9, 32,108,111, 99, 97,108, 32,\n    116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,\n    102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 32, 39,\n     44, 39, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 32,123, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,\n     39, 32, 32, 32,105,110,116, 32,105, 59, 39, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 39, 32, 32, 32,102,111,114, 40,\n    105, 61, 48, 59, 32,105, 60, 39, 46, 46,115,101,108,102, 46,\n    100,105,109, 46, 46, 39, 59,105, 43, 43, 41, 39, 41, 10, 32,\n     32,108,111, 99, 97,108, 32,116, 44, 99,116, 32, 61, 32,105,\n    115, 98, 97,115,105, 99, 40,116,121,112,101, 41, 10, 32, 32,\n    105,102, 32,116, 32,116,104,101,110, 10, 32, 32, 32,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97,\n     95,112,117,115,104,102,105,101,108,100, 39, 46, 46,116, 46,\n     46, 39, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,\n    114,103, 44, 39, 44,105, 43, 49, 44, 40, 39, 44, 99,116, 44,\n     39, 41, 39, 44,115,101,108,102, 46,110, 97,109,101, 44, 39,\n     91,105, 93, 41, 59, 39, 41, 10, 32, 32,101,108,115,101, 10,\n     32, 32, 32,105,102, 32,115,101,108,102, 46,112,116,114, 32,\n     61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32, 32,123, 39, 41,\n     10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 35,\n    105,102,100,101,102, 32, 95, 95, 99,112,108,117,115,112,108,\n    117,115, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,\n    112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,100, 42, 32,\n    116,111,108,117, 97, 95,111, 98,106, 32, 61, 32, 77,116,111,\n    108,117, 97, 95,110,101,119, 40, 40, 39, 44,116,121,112,101,\n     44, 39, 41, 40, 39, 44,115,101,108,102, 46,110, 97,109,101,\n     44, 39, 91,105, 93, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,\n    108,117, 97, 95,112,117,115,104,102,105,101,108,100,117,115,\n    101,114,116,121,112,101, 95, 97,110,100, 95,116, 97,107,101,\n    111,119,110,101,114,115,104,105,112, 40,116,111,108,117, 97,\n     95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49,\n     44,116,111,108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116,\n    121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 35,101,108,115,101, 92,\n    110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32, 32, 32,118,111,105,100, 42, 32,116,111,108,\n    117, 97, 95,111, 98,106, 32, 61, 32,116,111,108,117, 97, 95,\n     99,111,112,121, 40,116,111,108,117, 97, 95, 83, 44, 40,118,\n    111,105,100, 42, 41, 38, 39, 44,115,101,108,102, 46,110, 97,\n    109,101, 44, 39, 91,105, 93, 44,115,105,122,101,111,102, 40,\n     39, 44,116,121,112,101, 44, 39, 41, 41, 59, 39, 41, 10, 32,\n     32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n     32,116,111,108,117, 97, 95,112,117,115,104,102,105,101,108,\n    100,117,115,101,114,116,121,112,101, 40,116,111,108,117, 97,\n     95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49,\n     44,116,111,108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116,\n    121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102,\n     92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32,125, 39, 41, 10, 32, 32, 32,101,108,\n    115,101, 10, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 32, 32,116,111,108,117, 97, 95,112,117,115,104,102,105,\n    101,108,100,117,115,101,114,116,121,112,101, 40,116,111,108,\n    117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105,\n     43, 49, 44, 40,118,111,105,100, 42, 41, 39, 44,115,101,108,\n    102, 46,110, 97,109,101, 44, 39, 91,105, 93, 44, 34, 39, 44,\n    116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,111,117,116,\n    112,117,116, 40, 39, 32, 32,125, 39, 41, 10, 32,101,110,100,\n     10,101,110,100, 10, 10, 45, 45, 32, 70,114,101,101, 32,100,\n    121,110, 97,109,105, 99, 97,108,108,121, 32, 97,108,108,111,\n     99, 97,116,101,100, 32, 97,114,114, 97,121, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108,\n     97,114, 97,116,105,111,110, 58,102,114,101,101, 97,114,114,\n     97,121, 32, 40, 41, 10, 32,105,102, 32,115,101,108,102, 46,\n    100,105,109, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,116,\n    111,110,117,109, 98,101,114, 40,115,101,108,102, 46,100,105,\n    109, 41, 61, 61,110,105,108, 32,116,104,101,110, 10,  9, 32,\n    111,117,116,112,117,116, 40, 39, 35,105,102,100,101,102, 32,\n     95, 95, 99,112,108,117,115,112,108,117,115, 92,110, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32, 77,116,\n    111,108,117, 97, 95,100,101,108,101,116,101, 95,100,105,109,\n     40, 39, 44,115,101,108,102, 46,110, 97,109,101, 44, 39, 41,\n     59, 39, 41, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,\n    101,108,115,101, 92,110, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 32,102,114,101,101, 40, 39, 44,115,101,\n    108,102, 46,110, 97,109,101, 44, 39, 41, 59, 39, 41, 10,  9,\n     32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102,\n     92,110, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10, 10,\n     45, 45, 32, 80, 97,115,115, 32,112, 97,114, 97,109,101,116,\n    101,114, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,112,\n     97,115,115,112, 97,114, 32, 40, 41, 10, 32,105,102, 32,115,\n    101,108,102, 46,112,116,114, 61, 61, 39, 38, 39, 32, 97,110,\n    100, 32,110,111,116, 32,105,115, 98, 97,115,105, 99, 40,115,\n    101,108,102, 46,116,121,112,101, 41, 32,116,104,101,110, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 42, 39, 46, 46,115,\n    101,108,102, 46,110, 97,109,101, 41, 10, 32,101,108,115,101,\n    105,102, 32,115,101,108,102, 46,114,101,116, 61, 61, 39, 42,\n     39, 32,116,104,101,110, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 38, 39, 46, 46,115,101,108,102, 46,110, 97,109,101,\n     41, 10, 32,101,108,115,101, 10, 32, 32,111,117,116,112,117,\n    116, 40,115,101,108,102, 46,110, 97,109,101, 41, 10, 32,101,\n    110,100, 10,101,110,100, 10, 10, 45, 45, 32, 82,101,116,117,\n    114,110, 32,112, 97,114, 97,109,101,116,101,114, 32,118, 97,\n    108,117,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,\n    114,101,116,118, 97,108,117,101, 32, 40, 41, 10, 32,105,102,\n     32,115,101,108,102, 46,114,101,116, 32,126, 61, 32, 39, 39,\n     32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32,116,\n     44, 99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,\n    101,108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102, 32,\n    116, 32, 97,110,100, 32,116,126, 61, 39, 39, 32,116,104,101,\n    110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,\n     32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116,\n     46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44,\n     99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 46,110, 97,\n    109,101, 46, 46, 39, 41, 59, 39, 41, 10, 32, 32,101,108,115,\n    101, 10, 32, 32, 32,108,111, 99, 97,108, 32,112,117,115,104,\n     95,102,117,110, 99, 32, 61, 32,103,101,116, 95,112,117,115,\n    104, 95,102,117,110, 99,116,105,111,110, 40,115,101,108,102,\n     46,116,121,112,101, 41, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117,\n    110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,\n    111,105,100, 42, 41, 39, 46, 46,115,101,108,102, 46,110, 97,\n    109,101, 46, 46, 39, 44, 34, 39, 44,115,101,108,102, 46,116,\n    121,112,101, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32,101,110,\n    100, 10, 32, 32,114,101,116,117,114,110, 32, 49, 10, 32,101,\n    110,100, 10, 32,114,101,116,117,114,110, 32, 48, 10,101,110,\n    100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32,\n     99,111,110,115,116,114,117, 99,116,111,114, 10,102,117,110,\n     99,116,105,111,110, 32, 95, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 32, 40,116, 41, 10, 10, 32,115,101,116,109,101,\n    116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115,\n     68,101, 99,108, 97,114, 97,116,105,111,110, 41, 10, 32,116,\n     58, 98,117,105,108,100,110, 97,109,101,115, 40, 41, 10, 32,\n    116, 58, 99,104,101, 99,107,110, 97,109,101, 40, 41, 10, 32,\n    116, 58, 99,104,101, 99,107,116,121,112,101, 40, 41, 10, 32,\n    108,111, 99, 97,108, 32,102,116, 32, 61, 32,102,105,110,100,\n    116,121,112,101, 40,116, 46,116,121,112,101, 41, 32,111,114,\n     32,116, 46,116,121,112,101, 10, 32,105,102, 32,110,111,116,\n     32,105,115,101,110,117,109, 40,102,116, 41, 32,116,104,101,\n    110, 10,  9,116, 46,109,111,100, 44, 32,116, 46,116,121,112,\n    101, 32, 61, 32, 97,112,112,108,121,116,121,112,101,100,101,\n    102, 40,116, 46,109,111,100, 44, 32,102,116, 41, 10, 32,101,\n    110,100, 10, 10, 32,105,102, 32,116, 46,107,105,110,100, 61,\n     61, 34,118, 97,114, 34, 32, 97,110,100, 32, 40,115,116,114,\n    105,110,103, 46,102,105,110,100, 40,116, 46,109,111,100, 44,\n     32, 34,116,111,108,117, 97, 95,112,114,111,112,101,114,116,\n    121, 37,115, 34, 41, 32,111,114, 32,115,116,114,105,110,103,\n     46,102,105,110,100, 40,116, 46,109,111,100, 44, 32, 34,116,\n    111,108,117, 97, 95,112,114,111,112,101,114,116,121, 36, 34,\n     41, 41, 32,116,104,101,110, 10, 32,  9,116, 46,109,111,100,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    116, 46,109,111,100, 44, 32, 34,116,111,108,117, 97, 95,112,\n    114,111,112,101,114,116,121, 34, 44, 32, 34,116,111,108,117,\n     97, 95,112,114,111,112,101,114,116,121, 95, 95, 34, 46, 46,\n    103,101,116, 95,112,114,111,112,101,114,116,121, 95,116,121,\n    112,101, 40, 41, 41, 10, 32,101,110,100, 10, 10, 32,114,101,\n    116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,\n     67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32,\n     69,120,112,101, 99,116,115, 32,116,104,101, 32,115,116,114,\n    105,110,103, 32,100,101, 99,108, 97,114, 97,116,105,111,110,\n     46, 10, 45, 45, 32, 84,104,101, 32,107,105,110,100, 32,111,\n    102, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 32, 99,\n     97,110, 32, 98,101, 32, 34,118, 97,114, 34, 32,111,114, 32,\n     34,102,117,110, 99, 34, 46, 10,102,117,110, 99,116,105,111,\n    110, 32, 68,101, 99,108, 97,114, 97,116,105,111,110, 32, 40,\n    115, 44,107,105,110,100, 44,105,115, 95,112, 97,114, 97,109,\n    101,116,101,114, 41, 10, 10, 32, 45, 45, 32,101,108,105,109,\n    105,110, 97,116,101, 32,115,112, 97, 99,101,115, 32,105,102,\n     32,100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 32,\n    105,115, 32,112,114,111,118,105,100,101,100, 10, 32,115, 32,\n     61, 32,103,115,117, 98, 40,115, 44, 34, 37,115, 42, 61, 37,\n    115, 42, 34, 44, 34, 61, 34, 41, 10, 32,115, 32, 61, 32,103,\n    115,117, 98, 40,115, 44, 32, 34, 37,115, 42, 60, 34, 44, 32,\n     34, 60, 34, 41, 10, 10, 32,108,111, 99, 97,108, 32,100,101,\n    102, 98, 44,116,109,112,100,101,102, 10, 32,100,101,102, 98,\n     44, 95, 44,116,109,112,100,101,102, 32, 61, 32,115,116,114,\n    105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 40, 61,\n     46, 42, 41, 36, 34, 41, 10, 32,105,102, 32,100,101,102, 98,\n     32,116,104,101,110, 10, 32,  9,115, 32, 61, 32,115,116,114,\n    105,110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 61, 46,\n     42, 36, 34, 44, 32, 34, 34, 41, 10, 32,101,108,115,101, 10,\n     32,  9,116,109,112,100,101,102, 32, 61, 32, 39, 39, 10, 32,\n    101,110,100, 10, 32,105,102, 32,107,105,110,100, 32, 61, 61,\n     32, 34,118, 97,114, 34, 32,116,104,101,110, 10, 32, 32, 45,\n     45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,111,114,\n    109, 58, 32,118,111,105,100, 10, 32, 32,105,102, 32,115, 32,\n     61, 61, 32, 39, 39, 32,111,114, 32,115, 32, 61, 61, 32, 39,\n    118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32, 32,114,\n    101,116,117,114,110, 32, 95, 68,101, 99,108, 97,114, 97,116,\n    105,111,110,123,116,121,112,101, 32, 61, 32, 39,118,111,105,\n    100, 39, 44, 32,107,105,110,100, 32, 61, 32,107,105,110,100,\n     44, 32,105,115, 95,112, 97,114, 97,109,101,116,101,114, 32,\n     61, 32,105,115, 95,112, 97,114, 97,109,101,116,101,114,125,\n     10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45,\n     45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,111,114,\n    109, 58, 32,109,111,100, 32,116,121,112,101, 42, 38, 32,110,\n     97,109,101, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n    115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,\n    115, 44, 39, 37, 42, 37,115, 42, 38, 39, 41, 10, 32,105,102,\n     32,116, 46,110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10,\n     32, 32,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,102,\n    117,110, 99, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114,\n    114,111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,102,\n    117,110, 99,116,105,111,110, 32,114,101,116,117,114,110, 32,\n    116,121,112,101, 58, 32, 34, 46, 46,115, 41, 10, 32, 32,101,\n    110,100, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32,109, 32,\n     61, 32,115,112,108,105,116, 40,116, 91, 49, 93, 44, 39, 37,\n    115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,\n    109, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,\n    101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115, 43, 39, 41,\n     10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108,\n     97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110, 97,109,\n    101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109,112,100,101,\n    102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32, 39, 42, 39,\n     44, 10, 32, 32, 32,114,101,116, 32, 61, 32, 39, 38, 39, 44,\n     10, 32, 32, 32, 45, 45,116,121,112,101, 32, 61, 32,114,101,\n     98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40,\n    109, 91,109, 46,110, 93, 44, 32,116, 98, 44, 32,116,105,109,\n    112,108, 41, 44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32,\n    109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,109,111,100, 32,\n     61, 32, 99,111,110, 99, 97,116, 40,109, 44, 49, 44,109, 46,\n    110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,112, 97,114,\n     97,109,101,116,101,114, 32, 61, 32,105,115, 95,112, 97,114,\n     97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105,110,100,\n     32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 32,101,110,\n    100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,\n    101, 32,102,111,114,109, 58, 32,109,111,100, 32,116,121,112,\n    101, 42, 42, 32,110, 97,109,101, 10, 32,116, 32, 61, 32,115,\n    112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115,\n     44, 39, 37, 42, 37,115, 42, 37, 42, 39, 41, 10, 32,105,102,\n     32,116, 46,110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10,\n     32, 32,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,102,\n    117,110, 99, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114,\n    114,111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,102,\n    117,110, 99,116,105,111,110, 32,114,101,116,117,114,110, 32,\n    116,121,112,101, 58, 32, 34, 46, 46,115, 41, 10, 32, 32,101,\n    110,100, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32,109, 32,\n     61, 32,115,112,108,105,116, 40,116, 91, 49, 93, 44, 39, 37,\n    115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,\n    109, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,\n    101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115, 43, 39, 41,\n     10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108,\n     97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110, 97,109,\n    101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109,112,100,101,\n    102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32, 39, 42, 39,\n     44, 10, 32, 32, 32,114,101,116, 32, 61, 32, 39, 42, 39, 44,\n     10, 32, 32, 32, 45, 45,116,121,112,101, 32, 61, 32,114,101,\n     98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40,\n    109, 91,109, 46,110, 93, 44, 32,116, 98, 44, 32,116,105,109,\n    112,108, 41, 44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32,\n    109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,109,111,100, 32,\n     61, 32, 99,111,110, 99, 97,116, 40,109, 44, 49, 44,109, 46,\n    110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,112, 97,114,\n     97,109,101,116,101,114, 32, 61, 32,105,115, 95,112, 97,114,\n     97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105,110,100,\n     32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 32,101,110,\n    100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,\n    101, 32,102,111,114,109, 58, 32,109,111,100, 32,116,121,112,\n    101, 38, 32,110, 97,109,101, 10, 32,116, 32, 61, 32,115,112,\n    108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44,\n     39, 38, 39, 41, 10, 32,105,102, 32,116, 46,110, 32, 61, 61,\n     32, 50, 32,116,104,101,110, 10, 32, 32, 45, 45,108,111, 99,\n     97,108, 32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91,\n     49, 93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,\n    111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95,\n     99, 95,116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39,\n     37,115, 43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32,\n     95, 68,101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32,\n     32, 32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,\n    116,109,112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32,\n     61, 32, 39, 38, 39, 44, 10, 32, 32, 32, 45, 45,116,121,112,\n    101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101,109,\n    112,108, 97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,116,\n     98, 44, 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116,\n    121,112,101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32,\n     32, 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,\n    109, 44, 49, 44,109, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,\n    105,115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,\n    105,115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32,\n     32, 32,107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32,\n     32,125, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,\n    101, 99,107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,\n    111,100, 32,116,121,112,101, 42, 32,110, 97,109,101, 10, 32,\n    108,111, 99, 97,108, 32,115, 49, 32, 61, 32,103,115,117, 98,\n     40,115, 44, 34, 40, 37, 98, 92, 91, 92, 93, 41, 34, 44,102,\n    117,110, 99,116,105,111,110, 32, 40,110, 41, 32,114,101,116,\n    117,114,110, 32,103,115,117, 98, 40,110, 44, 39, 37, 42, 39,\n     44, 39, 92, 49, 39, 41, 32,101,110,100, 41, 10, 32,116, 32,\n     61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,\n    115, 40,115, 49, 44, 39, 37, 42, 39, 41, 10, 32,105,102, 32,\n    116, 46,110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, 32,\n     32,116, 91, 50, 93, 32, 61, 32,103,115,117, 98, 40,116, 91,\n     50, 93, 44, 39, 92, 49, 39, 44, 39, 37, 42, 39, 41, 32, 45,\n     45, 32,114,101,115,116,111,114,101, 32, 42, 32,105,110, 32,\n    100,105,109,101,110,115,105,111,110, 32,101,120,112,114,101,\n    115,115,105,111,110, 10, 32, 32, 45, 45,108,111, 99, 97,108,\n     32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91, 49, 93,\n     44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99,\n     97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95, 99, 95,\n    116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115,\n     43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32, 95, 68,\n    101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, 32,\n    110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109,\n    112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32,\n     39, 42, 39, 44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32,\n    109, 91,109, 46,110, 93, 44, 10, 32, 32, 32, 45, 45,116,121,\n    112,101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101,\n    109,112,108, 97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,\n    116, 98, 44, 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,\n    109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44,\n     49, 44,109, 46,110, 45, 49, 41, 32, 32, 32, 44, 10, 32, 32,\n     32,105,115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61,\n     32,105,115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10,\n     32, 32, 32,107,105,110,100, 32, 61, 32,107,105,110,100, 10,\n     32, 32,125, 10, 32,101,110,100, 10, 10, 32,105,102, 32,107,\n    105,110,100, 32, 61, 61, 32, 39,118, 97,114, 39, 32,116,104,\n    101,110, 10, 32, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,\n    104,101, 32,102,111,114,109, 58, 32,109,111,100, 32,116,121,\n    112,101, 32,110, 97,109,101, 10, 32, 32, 45, 45,116, 32, 61,\n     32,115,112,108,105,116, 40,115, 44, 39, 37,115, 37,115, 42,\n     39, 41, 10, 32, 32,116, 32, 61, 32,115,112,108,105,116, 95,\n     99, 95,116,111,107,101,110,115, 40,115, 44, 39, 37,115, 43,\n     39, 41, 10, 32, 32,108,111, 99, 97,108, 32,118, 10, 32, 32,\n    105,102, 32,102,105,110,100,116,121,112,101, 40,116, 91,116,\n     46,110, 93, 41, 32,116,104,101,110, 32,118, 32, 61, 32, 99,\n    114,101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, 41,\n     32,101,108,115,101, 32,118, 32, 61, 32,116, 91,116, 46,110,\n     93, 59, 32,116, 46,110, 32, 61, 32,116, 46,110, 45, 49, 32,\n    101,110,100, 10, 32, 32,114,101,116,117,114,110, 32, 95, 68,\n    101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, 32,\n    110, 97,109,101, 32, 61, 32,118, 46, 46,116,109,112,100,101,\n    102, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32, 61, 32,\n    114,101, 98,117,105,108,100, 95,116,101,109,112,108, 97,116,\n    101, 40,116, 91,116, 46,110, 93, 44, 32,116, 98, 44, 32,116,\n    105,109,112,108, 41, 44, 10, 32, 32, 32,116,121,112,101, 32,\n     61, 32,116, 91,116, 46,110, 93, 44, 10, 32, 32, 32,109,111,\n    100, 32, 61, 32, 99,111,110, 99, 97,116, 40,116, 44, 49, 44,\n    116, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,112,\n     97,114, 97,109,101,116,101,114, 32, 61, 32,105,115, 95,112,\n     97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105,\n    110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 10,\n     32,101,108,115,101, 32, 45, 45, 32,107,105,110,100, 32, 61,\n     61, 32, 34,102,117,110, 99, 34, 10, 10, 32, 32, 45, 45, 32,\n     99,104,101, 99,107, 32,116,104,101, 32,102,111,114,109, 58,\n     32,109,111,100, 32,116,121,112,101, 32,110, 97,109,101, 10,\n     32, 32, 45, 45,116, 32, 61, 32,115,112,108,105,116, 40,115,\n     44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,116, 32, 61,\n     32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115,\n     40,115, 44, 39, 37,115, 43, 39, 41, 10, 32, 32,108,111, 99,\n     97,108, 32,118, 32, 61, 32,116, 91,116, 46,110, 93, 32, 32,\n     45, 45, 32,108, 97,115,116, 32,119,111,114,100, 32,105,115,\n     32,116,104,101, 32,102,117,110, 99,116,105,111,110, 32,110,\n     97,109,101, 10, 32, 32,108,111, 99, 97,108, 32,116,112, 44,\n    109,100, 10, 32, 32,105,102, 32,116, 46,110, 62, 49, 32,116,\n    104,101,110, 10, 32, 32, 32,116,112, 32, 61, 32,116, 91,116,\n     46,110, 45, 49, 93, 10, 32, 32, 32,109,100, 32, 61, 32, 99,\n    111,110, 99, 97,116, 40,116, 44, 49, 44,116, 46,110, 45, 50,\n     41, 10, 32, 32,101,110,100, 10, 32, 32, 45, 45,105,102, 32,\n    116,112, 32,116,104,101,110, 32,116,112, 32, 61, 32,114,101,\n     98,117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40,\n    116,112, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41, 32,\n    101,110,100, 10, 32, 32,114,101,116,117,114,110, 32, 95, 68,\n    101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, 32,\n    110, 97,109,101, 32, 61, 32,118, 44, 10, 32, 32, 32,116,121,\n    112,101, 32, 61, 32,116,112, 44, 10, 32, 32, 32,109,111,100,\n     32, 61, 32,109,100, 44, 10, 32, 32, 32,105,115, 95,112, 97,\n    114, 97,109,101,116,101,114, 32, 61, 32,105,115, 95,112, 97,\n    114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,107,105,110,\n    100, 32, 61, 32,107,105,110,100, 10, 32, 32,125, 10, 32,101,\n    110,100, 10, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/declaration.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,118, 97,114,105, 97,\n     98,108,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,\n     32, 86, 97,114,105, 97, 98,108,101, 32, 99,108, 97,115,115,\n     10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,\n     97, 32,101,120,116,101,114,110, 32,118, 97,114,105, 97, 98,\n    108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99, 32,\n    109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108, 97,\n    115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32, 97,\n    108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,101,\n    110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114, 97,\n    116,105,111,110, 46, 10, 99,108, 97,115,115, 86, 97,114,105,\n     97, 98,108,101, 32, 61, 32,123, 10, 32, 95,103,101,116, 32,\n     61, 32,123,125, 44, 32, 32, 32, 45, 45, 32,109, 97,112,112,\n    101,100, 32,103,101,116, 32,102,117,110, 99,116,105,111,110,\n    115, 10, 32, 95,115,101,116, 32, 61, 32,123,125, 44, 32, 32,\n     32, 45, 45, 32,109, 97,112,112,101,100, 32,115,101,116, 32,\n    102,117,110, 99,116,105,111,110,115, 10,125, 10, 99,108, 97,\n    115,115, 86, 97,114,105, 97, 98,108,101, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 86, 97,114,105,\n     97, 98,108,101, 10,115,101,116,109,101,116, 97,116, 97, 98,\n    108,101, 40, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,\n    101, 44, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,\n    109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110,\n     32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 86, 97,114,105, 97, 98,108,101,123, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,\n     46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,\n    109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,105,102, 32,\n    115,101,108,102, 46,100,105,109, 32,116,104,101,110, 32,112,\n    114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100,\n    105,109, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,\n    105,109, 46, 46, 34, 39, 44, 34, 41, 32,101,110,100, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    100,101,102, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,\n     46,100,101,102, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,114,101,\n    116, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,114,\n    101,116, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,\n    116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,\n    108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 71,\n    101,110,101,114, 97,116,101,115, 32, 67, 32,102,117,110, 99,\n    116,105,111,110, 32,110, 97,109,101, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,\n    108,101, 58, 99,102,117,110, 99,110, 97,109,101, 32, 40,112,\n    114,101,102,105,120, 41, 10, 32,108,111, 99, 97,108, 32,112,\n     97,114,101,110,116, 32, 61, 32, 34, 34, 10, 32,108,111, 99,\n     97,108, 32,117,110,115,105,103,110,101,100, 32, 61, 32, 34,\n     34, 10, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32,\n     34, 34, 10, 10, 32,108,111, 99, 97,108, 32,112, 32, 61, 32,\n    115,101,108,102, 58,105,110,109,111,100,117,108,101, 40, 41,\n     32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109,101,\n    115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108,102,\n     58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32,105,102,\n     32,112, 32,116,104,101,110, 10, 32,  9,105,102, 32,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46, 99,108, 97,115,115,\n    116,121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39,\n     32,116,104,101,110, 10,  9,  9,112, 97,114,101,110,116, 32,\n     61, 32, 34, 95, 34, 32, 46, 46, 32,115,101,108,102, 46,112,\n     97,114,101,110,116, 46,116,121,112,101, 10,  9,101,108,115,\n    101, 10,  9, 32, 32,112, 97,114,101,110,116, 32, 61, 32, 34,\n     95, 34, 32, 46, 46, 32,112, 10,  9,101,110,100, 10, 32,101,\n    110,100, 10, 10, 32,105,102, 32,115,116,114,102,105,110,100,\n     40,115,101,108,102, 46,109,111,100, 44, 34, 40,117,110,115,\n    105,103,110,101,100, 41, 34, 41, 32,116,104,101,110, 10, 32,\n     32,117,110,115,105,103,110,101,100, 32, 61, 32, 34, 95,117,\n    110,115,105,103,110,101,100, 34, 10, 32,101,110,100, 10, 10,\n     32,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61,\n     32, 34, 42, 34, 32,116,104,101,110, 32,112,116,114, 32, 61,\n     32, 34, 95,112,116,114, 34, 10, 32,101,108,115,101,105,102,\n     32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 34, 38,\n     34, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 34, 95,\n    114,101,102, 34, 10, 32,101,110,100, 10, 10, 32,108,111, 99,\n     97,108, 32,110, 97,109,101, 32, 61, 32, 32,112,114,101,102,\n    105,120, 32, 46, 46, 32,112, 97,114,101,110,116, 32, 46, 46,\n     32,117,110,115,105,103,110,101,100, 32, 46, 46, 32, 34, 95,\n     34, 32, 46, 46, 32,103,115,117, 98, 40,115,101,108,102, 46,\n    108,110, 97,109,101, 32,111,114, 32,115,101,108,102, 46,110,\n     97,109,101, 44, 34, 46, 42, 58, 58, 34, 44, 34, 34, 41, 32,\n     46, 46, 32,112,116,114, 10, 10,  9,110, 97,109,101, 32, 61,\n     32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116,101,\n     40,110, 97,109,101, 41, 10, 32,114,101,116,117,114,110, 32,\n    110, 97,109,101, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n    104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97,\n     32,118, 97,114,105, 97, 98,108,101, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,\n    108,101, 58,105,115,118, 97,114,105, 97, 98,108,101, 32, 40,\n     41, 10, 32,114,101,116,117,114,110, 32,116,114,117,101, 10,\n    101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,118, 97,114,\n    105, 97, 98,108,101, 32,118, 97,108,117,101, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105,\n     97, 98,108,101, 58,103,101,116,118, 97,108,117,101, 32, 40,\n     99,108, 97,115,115, 44,115,116, 97,116,105, 99, 44, 32,112,\n    114,111,112, 95,103,101,116, 41, 10, 10,  9,108,111, 99, 97,\n    108, 32,110, 97,109,101, 10,  9,105,102, 32,112,114,111,112,\n     95,103,101,116, 32,116,104,101,110, 10, 10,  9,  9,110, 97,\n    109,101, 32, 61, 32,112,114,111,112, 95,103,101,116, 46, 46,\n     34, 40, 41, 34, 10,  9,101,108,115,101, 10,  9,  9,110, 97,\n    109,101, 32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10,\n      9,101,110,100, 10, 10,  9,105,102, 32, 99,108, 97,115,115,\n     32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,\n    110, 10,  9, 32,114,101,116,117,114,110, 32,115,101,108,102,\n     46,112, 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39,\n     58, 58, 39, 46, 46,110, 97,109,101, 10,  9,101,108,115,101,\n    105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10,  9,\n     32,114,101,116,117,114,110, 32, 39,115,101,108,102, 45, 62,\n     39, 46, 46,110, 97,109,101, 10,  9,101,108,115,101, 10,  9,\n     32,114,101,116,117,114,110, 32,110, 97,109,101, 10,  9,101,\n    110,100, 10,101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,\n    118, 97,114,105, 97, 98,108,101, 32,112,111,105,110,116,101,\n    114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101,\n     58,103,101,116,112,111,105,110,116,101,114,118, 97,108,117,\n    101, 32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99,\n     41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,\n     32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,\n    114,101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39,\n     58, 58,112, 39, 10, 32,101,108,115,101,105,102, 32, 99,108,\n     97,115,115, 32,116,104,101,110, 10, 32, 32,114,101,116,117,\n    114,110, 32, 39,115,101,108,102, 45, 62,112, 39, 10, 32,101,\n    108,115,101, 10, 32, 32,114,101,116,117,114,110, 32, 39,112,\n     39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n     87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,102,\n    117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,\n    101, 58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 10, 32,\n    108,111, 99, 97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,\n    101,108,102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10,\n      9,108,111, 99, 97,108, 32,112,114,111,112, 95,103,101,116,\n     44,112,114,111,112, 95,115,101,116, 10,  9,105,102, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,102,\n     46,109,111,100, 44, 32, 39,116,111,108,117, 97, 95,112,114,\n    111,112,101,114,116,121, 39, 41, 32,116,104,101,110, 10, 10,\n      9,  9,108,111, 99, 97,108, 32, 95, 44, 95, 44,116,121,112,\n    101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100,\n     40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108,\n    117, 97, 95,112,114,111,112,101,114,116,121, 95, 95, 40, 91,\n     94, 37,115, 93, 42, 41, 34, 41, 10,  9,  9,116,121,112,101,\n     32, 61, 32,116,121,112,101, 32,111,114, 32, 34,100,101,102,\n     97,117,108,116, 34, 10,  9,  9,112,114,111,112, 95,103,101,\n    116, 44,112,114,111,112, 95,115,101,116, 32, 61, 32,103,101,\n    116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104,\n    111,100,115, 40,116,121,112,101, 44, 32,115,101,108,102, 46,\n    110, 97,109,101, 41, 10,  9,  9,115,101,108,102, 46,109,111,\n    100, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98,\n     40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108,\n    117, 97, 95,112,114,111,112,101,114,116,121, 91, 94, 37,115,\n     93, 42, 34, 44, 32, 34, 34, 41, 10,  9,101,110,100, 10, 10,\n     32, 45, 45, 32,103,101,116, 32,102,117,110, 99,116,105,111,\n    110, 32, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 10, 32,105,102, 32, 99,108, 97,115,115,\n     32,116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40,\n     34, 47, 42, 32,103,101,116, 32,102,117,110, 99,116,105,111,\n    110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34,\n     32,111,102, 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,\n    115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101,\n     10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,103,\n    101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,115,\n    101,108,102, 46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41,\n     10, 32,101,110,100, 10, 32,115,101,108,102, 46, 99,103,101,\n    116,110, 97,109,101, 32, 61, 32,115,101,108,102, 58, 99,102,\n    117,110, 99,110, 97,109,101, 40, 34,116,111,108,117, 97, 95,\n    103,101,116, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34,\n     35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68,\n     73, 83, 65, 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46,\n     99,103,101,116,110, 97,109,101, 41, 10, 32,111,117,116,112,\n    117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,105,110,\n    116, 34, 44,115,101,108,102, 46, 99,103,101,116,110, 97,109,\n    101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,\n    116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116,\n    112,117,116, 40, 34,123, 34, 41, 10, 10, 32, 45, 45, 32,100,\n    101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,102,\n     32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111, 99, 97,\n    108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,\n    100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41,\n     39, 41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,\n    100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,\n    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,\n    121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32, 61,\n     32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 40,\n     39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,\n    121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111,\n     99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,\n    101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110, 40,\n    115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,\n    101, 41, 10, 32, 32,111,117,116,112,117,116, 40,116,111, 95,\n    102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44,\n     49, 44, 48, 41, 59, 39, 41, 10, 32,101,108,115,101,105,102,\n     32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,\n     95, 44, 95, 44,115,101,108,102, 46,109,111,100, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,\n    100, 44, 39, 94, 37,115, 42,115,116, 97,116,105, 99, 37,115,\n     37,115, 42, 40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10,\n     10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,\n    102, 32,118, 97,108,117,101, 10, 32,105,102, 32, 99,108, 97,\n    115,115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,\n    110,105,108, 32,116,104,101,110, 10,  9, 32,111,117,116,112,\n    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32,\n     40, 33,115,101,108,102, 41, 32,116,111,108,117, 97, 95,101,\n    114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34, 39,\n     46, 46,111,117,116,112,117,116, 95,101,114,114,111,114, 95,\n    104,111,111,107, 40, 34,105,110,118, 97,108,105,100, 32, 92,\n     39,115,101,108,102, 92, 39, 32,105,110, 32, 97, 99, 99,101,\n    115,115,105,110,103, 32,118, 97,114,105, 97, 98,108,101, 32,\n     92, 39, 37,115, 92, 39, 34, 44, 32,115,101,108,102, 46,110,\n     97,109,101, 41, 46, 46, 39, 34, 44, 78, 85, 76, 76, 41, 59,\n     39, 41, 59, 10,  9,  9,111,117,116,112,117,116, 40, 39, 35,\n    101,110,100,105,102, 92,110, 39, 41, 10, 32,101,110,100, 10,\n     10, 32, 45, 45, 32,114,101,116,117,114,110, 32,118, 97,108,\n    117,101, 10, 32,105,102, 32,115,116,114,105,110,103, 46,102,\n    105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 32, 39,\n    116,111,108,117, 97, 95,105,110,104,101,114,105,116,115, 39,\n     41, 32,116,104,101,110, 10,  9,108,111, 99, 97,108, 32,112,\n    117,115,104, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,\n    112,117,115,104, 95,102,117,110, 99,116,105,111,110, 40,115,\n    101,108,102, 46,116,121,112,101, 41, 10, 32,  9,111,117,116,\n    112,117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,\n    112,108,117,115,112,108,117,115, 92,110, 39, 41, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117,115,104,\n     95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83,\n     44, 40,118,111,105,100, 42, 41,115,116, 97,116,105, 99, 95,\n     99, 97,115,116, 60, 39, 46, 46,115,101,108,102, 46,116,121,\n    112,101, 46, 46, 39, 42, 62, 40,115,101,108,102, 41, 44, 32,\n     34, 39, 44,115,101,108,102, 46,116,121,112,101, 44, 39, 34,\n     41, 59, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 35,\n    101,108,115,101, 92,110, 39, 41, 10,  9,111,117,116,112,117,\n    116, 40, 39, 32, 32, 39, 44,112,117,115,104, 95,102,117,110,\n     99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,\n    105,100, 42, 41, 40, 40, 39, 46, 46,115,101,108,102, 46,116,\n    121,112,101, 46, 46, 39, 42, 41,115,101,108,102, 41, 44, 32,\n     34, 39, 44,115,101,108,102, 46,116,121,112,101, 44, 39, 34,\n     41, 59, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 35,\n    101,110,100,105,102, 92,110, 39, 41, 10, 32,101,108,115,101,\n     10,  9,108,111, 99, 97,108, 32,116, 44, 99,116, 32, 61, 32,\n    105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,\n    112,101, 41, 10,  9,105,102, 32,116, 32,116,104,101,110, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108,\n    117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46, 39, 40,\n    116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116, 44, 39,\n     41, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108,\n    117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99,\n     44,112,114,111,112, 95,103,101,116, 41, 46, 46, 39, 41, 59,\n     39, 41, 10,  9,101,108,115,101, 10,  9,  9,108,111, 99, 97,\n    108, 32,112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103,\n    101,116, 95,112,117,115,104, 95,102,117,110, 99,116,105,111,\n    110, 40,115,101,108,102, 46,116,121,112,101, 41, 10,  9,  9,\n    116, 32, 61, 32,115,101,108,102, 46,116,121,112,101, 10,  9,\n      9,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61,\n     32, 39, 38, 39, 32,111,114, 32,115,101,108,102, 46,112,116,\n    114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10,  9,  9,\n      9,111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117,\n    115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97,\n     95, 83, 44, 40,118,111,105,100, 42, 41, 38, 39, 46, 46,115,\n    101,108,102, 58,103,101,116,118, 97,108,117,101, 40, 99,108,\n     97,115,115, 44,115,116, 97,116,105, 99, 44,112,114,111,112,\n     95,103,101,116, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39,\n     34, 41, 59, 39, 41, 10,  9,  9,101,108,115,101, 10,  9,  9,\n      9,111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117,\n    115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97,\n     95, 83, 44, 40,118,111,105,100, 42, 41, 39, 46, 46,115,101,\n    108,102, 58,103,101,116,118, 97,108,117,101, 40, 99,108, 97,\n    115,115, 44,115,116, 97,116,105, 99, 44,112,114,111,112, 95,\n    103,101,116, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, 34,\n     41, 59, 39, 41, 10,  9,  9,101,110,100, 10,  9,101,110,100,\n     10, 32,101,110,100, 10, 32,111,117,116,112,117,116, 40, 39,\n     32,114,101,116,117,114,110, 32, 49, 59, 39, 41, 10, 32,111,\n    117,116,112,117,116, 40, 39,125, 39, 41, 10, 32,111,117,116,\n    112,117,116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,\n    105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73,\n     83, 65, 66, 76, 69, 92,110, 39, 41, 10, 32,111,117,116,112,\n    117,116, 40, 39, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,115,\n    101,116, 32,102,117,110, 99,116,105,111,110, 32, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     10, 32,105,102, 32,110,111,116, 32, 40,115,116,114,102,105,\n    110,100, 40,115,101,108,102, 46,116,121,112,101, 44, 39, 99,\n    111,110,115,116, 37,115, 43, 39, 41, 32,111,114, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,115,101,108,102, 46,\n    109,111,100, 44, 32, 39,116,111,108,117, 97, 95,114,101, 97,\n    100,111,110,108,121, 39, 41, 32,111,114, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,115,101,108,102, 46,109,111,\n    100, 44, 32, 39,116,111,108,117, 97, 95,105,110,104,101,114,\n    105,116,115, 39, 41, 41, 32, 32,116,104,101,110, 10, 32, 32,\n    105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32,\n     32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,115,101,\n    116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,\n    108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108,\n     97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42,\n     47, 34, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,\n    117,116,112,117,116, 40, 34, 47, 42, 32,115,101,116, 32,102,\n    117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,\n    110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,101,\n    110,100, 10, 32, 32,115,101,108,102, 46, 99,115,101,116,110,\n     97,109,101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110,\n     99,110, 97,109,101, 40, 34,116,111,108,117, 97, 95,115,101,\n    116, 34, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 35,\n    105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73,\n     83, 65, 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99,\n    115,101,116,110, 97,109,101, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,105,110,\n    116, 34, 44,115,101,108,102, 46, 99,115,101,116,110, 97,109,\n    101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,\n    116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 34,123, 34, 41, 10, 10, 32, 32, 45, 45,\n     32,100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,\n    105,102, 32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,105,\n    102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116, 97,\n    116,105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10, 32,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44,\n     39, 42, 39, 44, 39,115,101,108,102, 32, 61, 32, 39, 41, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 40, 39, 44,115,\n    101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101,\n     44, 39, 42, 41, 32, 39, 41, 10, 32, 32, 32,108,111, 99, 97,\n    108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116,\n     95,116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 41,\n     10, 32, 32, 32,111,117,116,112,117,116, 40,116,111, 95,102,\n    117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 49,\n     44, 48, 41, 59, 39, 41, 10, 32, 32, 32, 45, 45, 32, 99,104,\n    101, 99,107, 32,115,101,108,102, 32,118, 97,108,117,101, 10,\n      9,  9,101,110,100, 10, 32, 32, 45, 45, 32, 99,104,101, 99,\n    107, 32,116,121,112,101,115, 10,  9,  9,111,117,116,112,117,\n    116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85,\n     65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,\n      9,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108,117,\n     97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, 95,101,\n    114,114, 59, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,\n    115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110,\n    105,108, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,102,\n     41, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,\n    111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,111,117,116,112,\n    117,116, 95,101,114,114,111,114, 95,104,111,111,107, 40, 34,\n    105,110,118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92,\n     39, 32,105,110, 32, 97, 99, 99,101,115,115,105,110,103, 32,\n    118, 97,114,105, 97, 98,108,101, 32, 92, 39, 37,115, 92, 39,\n     34, 44, 32,115,101,108,102, 46,110, 97,109,101, 41, 46, 46,\n     39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 59, 10, 32, 32,\n    101,108,115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,\n    104,101,110, 10, 32, 32, 32, 95, 44, 95, 44,115,101,108,102,\n     46,109,111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,\n    115,101,108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,\n    116, 97,116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39,\n     41, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, 99,\n    104,101, 99,107, 32,118, 97,114,105, 97, 98,108,101, 32,116,\n    121,112,101, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32,105,102, 32, 40, 39, 46, 46,115,101,108,102, 58,111,117,\n    116, 99,104,101, 99,107,116,121,112,101, 40, 50, 41, 46, 46,\n     39, 41, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,\n    116,111,108,117, 97, 95, 83, 44, 34, 35,118,105,110,118, 97,\n    108,105,100, 32,116,121,112,101, 32,105,110, 32,118, 97,114,\n    105, 97, 98,108,101, 32, 97,115,115,105,103,110,109,101,110,\n    116, 46, 34, 44, 38,116,111,108,117, 97, 95,101,114,114, 41,\n     59, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39, 35,\n    101,110,100,105,102, 92,110, 39, 41, 10, 10, 32, 32, 45, 45,\n     32, 97,115,115,105,103,110, 32,118, 97,108,117,101, 10,  9,\n      9,108,111, 99, 97,108, 32,100,101,102, 32, 61, 32, 48, 10,\n      9,  9,105,102, 32,115,101,108,102, 46,100,101,102, 32,126,\n     61, 32, 39, 39, 32,116,104,101,110, 32,100,101,102, 32, 61,\n     32,115,101,108,102, 46,100,101,102, 32,101,110,100, 10,  9,\n      9,105,102, 32,115,101,108,102, 46,116,121,112,101, 32, 61,\n     61, 32, 39, 99,104, 97,114, 42, 39, 32, 97,110,100, 32,115,\n    101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,\n    104,101,110, 32, 45, 45, 32,105,115, 32,115,116,114,105,110,\n    103, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32,115,\n    116,114,110, 99,112,121, 40, 40, 99,104, 97,114, 42, 41, 39,\n     41, 10,  9,  9,  9,105,102, 32, 99,108, 97,115,115, 32, 97,\n    110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10,\n      9,  9,  9,  9,111,117,116,112,117,116, 40,115,101,108,102,\n     46,112, 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39,\n     58, 58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 41,\n     10,  9,  9,  9,101,108,115,101,105,102, 32, 99,108, 97,115,\n    115, 32,116,104,101,110, 10,  9,  9,  9,  9,111,117,116,112,\n    117,116, 40, 39,115,101,108,102, 45, 62, 39, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 41, 10,  9,  9,  9,101,108,115,\n    101, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40,115,101,\n    108,102, 46,110, 97,109,101, 41, 10,  9,  9,  9,101,110,100,\n     10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 44, 40, 99,\n    111,110,115,116, 32, 99,104, 97,114, 42, 41,116,111,108,117,\n     97, 95,116,111,115,116,114,105,110,103, 40,116,111,108,117,\n     97, 95, 83, 44, 50, 44, 39, 44,100,101,102, 44, 39, 41, 44,\n     39, 44,115,101,108,102, 46,100,105,109, 44, 39, 45, 49, 41,\n     59, 39, 41, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,108,\n    111, 99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10,  9,\n      9,  9,105,102, 32,115,101,108,102, 46,112,116,114,126, 61,\n     39, 39, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39,\n     42, 39, 32,101,110,100, 10,  9,  9,  9,111,117,116,112,117,\n    116, 40, 39, 32, 39, 41, 10,  9,  9,  9,108,111, 99, 97,108,\n     32,110, 97,109,101, 32, 61, 32,112,114,111,112, 95,115,101,\n    116, 32,111,114, 32,115,101,108,102, 46,110, 97,109,101, 10,\n      9,  9,  9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,\n     32,115,116, 97,116,105, 99, 32,116,104,101,110, 10,  9,  9,\n      9,  9,111,117,116,112,117,116, 40,115,101,108,102, 46,112,\n     97,114,101,110,116, 46,116,121,112,101, 46, 46, 39, 58, 58,\n     39, 46, 46,110, 97,109,101, 41, 10,  9,  9,  9,101,108,115,\n    101,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10,\n      9,  9,  9,  9,111,117,116,112,117,116, 40, 39,115,101,108,\n    102, 45, 62, 39, 46, 46,110, 97,109,101, 41, 10,  9,  9,  9,\n    101,108,115,101, 10,  9,  9,  9,  9,111,117,116,112,117,116,\n     40,110, 97,109,101, 41, 10,  9,  9,  9,101,110,100, 10,  9,\n      9,  9,108,111, 99, 97,108, 32,116, 32, 61, 32,105,115, 98,\n     97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101, 41,\n     10,  9,  9,  9,105,102, 32,112,114,111,112, 95,115,101,116,\n     32,116,104,101,110, 10,  9,  9,  9,  9,111,117,116,112,117,\n    116, 40, 39, 40, 39, 41, 10,  9,  9,  9,101,108,115,101, 10,\n      9,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 61, 32,\n     39, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,  9,105,102,\n     32,110,111,116, 32,116, 32, 97,110,100, 32,112,116,114, 61,\n     61, 39, 39, 32,116,104,101,110, 32,111,117,116,112,117,116,\n     40, 39, 42, 39, 41, 32,101,110,100, 10,  9,  9,  9,111,117,\n    116,112,117,116, 40, 39, 40, 40, 39, 44,115,101,108,102, 46,\n    109,111,100, 44,115,101,108,102, 46,116,121,112,101, 41, 10,\n      9,  9,  9,105,102, 32,110,111,116, 32,116, 32,116,104,101,\n    110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40, 39, 42,\n     39, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,  9,111,117,\n    116,112,117,116, 40, 39, 41, 32, 39, 41, 10,  9,  9,  9,105,\n    102, 32,116, 32,116,104,101,110, 10,  9,  9,  9,  9,105,102,\n     32,105,115,101,110,117,109, 40,115,101,108,102, 46,116,121,\n    112,101, 41, 32,116,104,101,110, 10,  9,  9,  9,  9,  9,111,\n    117,116,112,117,116, 40, 39, 40,105,110,116, 41, 32, 39, 41,\n     10,  9,  9,  9,  9,101,110,100, 10,  9,  9,  9,  9,111,117,\n    116,112,117,116, 40, 39,116,111,108,117, 97, 95,116,111, 39,\n     46, 46,116, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 50,\n     44, 39, 44,100,101,102, 44, 39, 41, 41, 39, 41, 10,  9,  9,\n      9,101,108,115,101, 10,  9,  9,  9,  9,108,111, 99, 97,108,\n     32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,\n    116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101,108,\n    102, 46,116,121,112,101, 41, 10,  9,  9,  9,  9,111,117,116,\n    112,117,116, 40,116,111, 95,102,117,110, 99, 44, 39, 40,116,\n    111,108,117, 97, 95, 83, 44, 50, 44, 39, 44,100,101,102, 44,\n     39, 41, 41, 39, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,\n      9,105,102, 32,112,114,111,112, 95,115,101,116, 32,116,104,\n    101,110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40, 34,\n     41, 34, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,  9,111,\n    117,116,112,117,116, 40, 34, 59, 34, 41, 10,  9,  9,101,110,\n    100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,114,101,\n    116,117,114,110, 32, 48, 59, 39, 41, 10, 32, 32,111,117,116,\n    112,117,116, 40, 39,125, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,\n    102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83,\n     65, 66, 76, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10, 10,\n    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 58,114,101,\n    103,105,115,116,101,114, 32, 40,112,114,101, 41, 10, 10,  9,\n    105,102, 32,110,111,116, 32,115,101,108,102, 58, 99,104,101,\n     99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,\n    115, 40, 41, 32,116,104,101,110, 10,  9,  9,114,101,116,117,\n    114,110, 10,  9,101,110,100, 10, 32,112,114,101, 32, 61, 32,\n    112,114,101, 32,111,114, 32, 39, 39, 10, 32,108,111, 99, 97,\n    108, 32,112, 97,114,101,110,116, 32, 61, 32,115,101,108,102,\n     58,105,110,109,111,100,117,108,101, 40, 41, 32,111,114, 32,\n    115,101,108,102, 58,105,110,110, 97,109,101,115,112, 97, 99,\n    101, 40, 41, 32,111,114, 32,115,101,108,102, 58,105,110, 99,\n    108, 97,115,115, 40, 41, 10, 32,105,102, 32,110,111,116, 32,\n    112, 97,114,101,110,116, 32,116,104,101,110, 10, 32, 32,105,\n    102, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101,\n     46, 95,119, 97,114,110,105,110,103, 61, 61,110,105,108, 32,\n    116,104,101,110, 10, 32, 32, 32,119, 97,114,110,105,110,103,\n     40, 34, 77, 97,112,112,105,110,103, 32,118, 97,114,105, 97,\n     98,108,101, 32,116,111, 32,103,108,111, 98, 97,108, 32,109,\n     97,121, 32,100,101,103,114, 97,100,101, 32,112,101,114,102,\n    111,114,109, 97,110, 99,101, 34, 41, 10, 32, 32, 32, 99,108,\n     97,115,115, 86, 97,114,105, 97, 98,108,101, 46, 95,119, 97,\n    114,110,105,110,103, 32, 61, 32, 49, 10, 32, 32,101,110,100,\n     10, 32,101,110,100, 10, 32,105,102, 32,115,101,108,102, 46,\n     99,115,101,116,110, 97,109,101, 32,116,104,101,110, 10, 32,\n     32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,\n    111,108,117, 97, 95,118, 97,114,105, 97, 98,108,101, 40,116,\n    111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102,\n     46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,\n    101,108,102, 46, 99,103,101,116,110, 97,109,101, 46, 46, 39,\n     44, 39, 46, 46,115,101,108,102, 46, 99,115,101,116,110, 97,\n    109,101, 46, 46, 39, 41, 59, 39, 41, 10, 32,101,108,115,101,\n     10, 32, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,\n     39,116,111,108,117, 97, 95,118, 97,114,105, 97, 98,108,101,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,\n    108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46,\n     46,115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 46,\n     46, 39, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10, 32,101,110,\n    100, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,\n    110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114,\n     10,102,117,110, 99,116,105,111,110, 32, 95, 86, 97,114,105,\n     97, 98,108,101, 32, 40,116, 41, 10, 32,115,101,116,109,101,\n    116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115,\n     86, 97,114,105, 97, 98,108,101, 41, 10, 32, 97,112,112,101,\n    110,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116,\n     10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,\n    117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,\n    115, 32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114,\n    101,115,101,110,116,105,110,103, 32,116,104,101, 32,118, 97,\n    114,105, 97, 98,108,101, 32,100,101, 99,108, 97,114, 97,116,\n    105,111,110, 46, 10,102,117,110, 99,116,105,111,110, 32, 86,\n     97,114,105, 97, 98,108,101, 32, 40,115, 41, 10, 32,114,101,\n    116,117,114,110, 32, 95, 86, 97,114,105, 97, 98,108,101, 32,\n     40, 68,101, 99,108, 97,114, 97,116,105,111,110, 40,115, 44,\n     39,118, 97,114, 39, 41, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/variable.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 97,114,114, 97,121,\n     32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,\n    101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32,\n     67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,\n    102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,\n    108, 32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32,\n     97,114,114, 97,121, 46,108,117, 97, 44,118, 32, 49, 46, 49,\n     32, 50, 48, 48, 48, 47, 49, 49, 47, 48, 54, 32, 50, 50, 58,\n     48, 51, 58, 53, 55, 32, 99,101,108,101,115, 32, 69,120,112,\n     32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,\n    101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119,\n     97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,\n    100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,\n    110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116,\n     46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,\n    114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,\n    101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110,\n     32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44,\n     32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,\n    104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,\n    103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,\n    100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44,\n     32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,\n    101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,\n    101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105,\n     99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 65,\n    114,114, 97,121, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,\n    101,112,114,101,115,101,110,116,115, 32, 97, 32,101,120,116,\n    101,114,110, 32, 97,114,114, 97,121, 32,118, 97,114,105, 97,\n     98,108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99,\n     32,109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108,\n     97,115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32,\n     97,108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,\n    101,110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114,\n     97,116,105,111,110, 46, 10, 99,108, 97,115,115, 65,114,114,\n     97,121, 32, 61, 32,123, 10,125, 10, 99,108, 97,115,115, 65,\n    114,114, 97,121, 46, 95, 95,105,110,100,101,120, 32, 61, 32,\n     99,108, 97,115,115, 65,114,114, 97,121, 10,115,101,116,109,\n    101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 65,\n    114,114, 97,121, 44, 99,108, 97,115,115, 68,101, 99,108, 97,\n    114, 97,116,105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,\n    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 65,114,114, 97,121,123, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,\n     46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,116,121,\n    112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,116,\n    121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,112,116,114,\n     32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,112,116,\n    114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, 32,\n     61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 32,100,101,102, 32, 32, 61,\n     32, 39, 34, 46, 46,115,101,108,102, 46,100,101,102, 46, 46,\n     34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 32,100,105,109, 32, 32, 61, 32, 39,\n     34, 46, 46,115,101,108,102, 46,100,105,109, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32,114,101,116, 32, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,114,101,116, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,\n    100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,\n    105,116, 32,105,115, 32, 97, 32,118, 97,114,105, 97, 98,108,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 65,114,114, 97,121, 58,105,115,118, 97,114,105, 97, 98,\n    108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,116,\n    114,117,101, 10,101,110,100, 10, 10, 10, 45, 45, 32,103,101,\n    116, 32,118, 97,114,105, 97, 98,108,101, 32,118, 97,108,117,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 65,114,114, 97,121, 58,103,101,116,118, 97,108,117,101,\n     32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 41,\n     10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,\n    115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,114,\n    101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39, 58,\n     58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46,\n     39, 91,116,111,108,117, 97, 95,105,110,100,101,120, 93, 39,\n     10, 32,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32,\n    116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 39,\n    115,101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,\n    100,101,120, 93, 39, 10, 32,101,108,115,101, 10, 32, 32,114,\n    101,116,117,114,110, 32,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 39, 91,116,111,108,117, 97, 95,105,110,100,101,120,\n     93, 39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45,\n     32, 87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,\n    102,117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58,\n    115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,108,111, 99,\n     97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,101,108,102,\n     58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32, 45, 45,\n     32,103,101,116, 32,102,117,110, 99,116,105,111,110, 32, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,\n    101,110, 10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42,\n     32,103,101,116, 32,102,117,110, 99,116,105,111,110, 58, 34,\n     44,115,101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102,\n     32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44,\n     34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,\n    111,117,116,112,117,116, 40, 34, 47, 42, 32,103,101,116, 32,\n    102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102,\n     46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,\n    110,100, 10, 32,115,101,108,102, 46, 99,103,101,116,110, 97,\n    109,101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110, 99,\n    110, 97,109,101, 40, 34,116,111,108,117, 97, 95,103,101,116,\n     34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102,\n    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,\n     66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99,103,101,\n    116,110, 97,109,101, 41, 10, 32,111,117,116,112,117,116, 40,\n     34, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 34, 44,\n    115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 44, 34,\n     40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,\n    117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116,112,117,116,\n     40, 34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34,\n     32,105,110,116, 32,116,111,108,117, 97, 95,105,110,100,101,\n    120, 59, 34, 41, 10, 10, 32, 45, 45, 32,100,101, 99,108, 97,\n    114,101, 32,115,101,108,102, 44, 32,105,102, 32,116,104,101,\n     32, 99, 97,115,101, 10, 32,108,111, 99, 97,108, 32, 95, 44,\n     95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,114,102,\n    105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94,\n     37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41, 10, 32,\n    105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116,\n     97,116,105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44,\n     39, 42, 39, 44, 39,115,101,108,102, 59, 39, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,112,117,\n    115,104,115,116,114,105,110,103, 40,116,111,108,117, 97, 95,\n     83, 44, 34, 46,115,101,108,102, 34, 41, 59, 39, 41, 10, 32,\n     32,111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,114,\n     97,119,103,101,116, 40,116,111,108,117, 97, 95, 83, 44, 49,\n     41, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32,115,101,108,102, 32, 61, 32, 39, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,112,\n     97,114,101,110,116, 46,116,121,112,101, 44, 39, 42, 41, 32,\n     39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,108,117,\n     97, 95,116,111,117,115,101,114,100, 97,116, 97, 40,116,111,\n    108,117, 97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32,101,\n    108,115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,\n    101,110, 10, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,\n    111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101,\n    108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,\n    116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10,\n     32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107,\n     32,105,110,100,101,120, 10,  9,111,117,116,112,117,116, 40,\n     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,\n     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,111,117,\n    116,112,117,116, 40, 39, 32,123, 39, 41, 10,  9,111,117,116,\n    112,117,116, 40, 39, 32, 32,116,111,108,117, 97, 95, 69,114,\n    114,111,114, 32,116,111,108,117, 97, 95,101,114,114, 59, 39,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102,\n     32, 40, 33,116,111,108,117, 97, 95,105,115,110,117,109, 98,\n    101,114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10,\n     32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108,\n    117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95,\n     83, 44, 34, 35,118,105,110,118, 97,108,105,100, 32,116,121,\n    112,101, 32,105,110, 32, 97,114,114, 97,121, 32,105,110,100,\n    101,120,105,110,103, 46, 34, 44, 38,116,111,108,117, 97, 95,\n    101,114,114, 41, 59, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 32,125, 39, 41, 10,  9,111,117,116,112,117,116, 40,\n     39, 35,101,110,100,105,102, 92,110, 39, 41, 10,  9,105,102,\n     32,102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,101,\n    110, 32, 45, 45, 32,102,111,114, 32, 99,111,109,112, 97,116,\n    105, 98,105,108,105,116,121, 32,119,105,116,104, 32,116,111,\n    108,117, 97, 53, 32, 63, 10,  9,  9,111,117,116,112,117,116,\n     40, 39, 32,116,111,108,117, 97, 95,105,110,100,101,120, 32,\n     61, 32, 40,105,110,116, 41,116,111,108,117, 97, 95,116,111,\n    110,117,109, 98,101,114, 40,116,111,108,117, 97, 95, 83, 44,\n     50, 44, 48, 41, 45, 49, 59, 39, 41, 10,  9,101,108,115,101,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 32,116,111,108,\n    117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,116,\n     41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,114,\n     40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 59, 39,\n     41, 10,  9,101,110,100, 10,  9,111,117,116,112,117,116, 40,\n     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,\n     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,105,102,\n     32,115,101,108,102, 46,100,105,109, 32, 97,110,100, 32,115,\n    101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,\n    104,101,110, 10,  9, 32, 32,111,117,116,112,117,116, 40, 39,\n     32,105,102, 32, 40,116,111,108,117, 97, 95,105,110,100,101,\n    120, 60, 48, 32,124,124, 32,116,111,108,117, 97, 95,105,110,\n    100,101,120, 62, 61, 39, 46, 46,115,101,108,102, 46,100,105,\n    109, 46, 46, 39, 41, 39, 41, 10,  9,101,108,115,101, 10,  9,\n     32, 32,111,117,116,112,117,116, 40, 39, 32,105,102, 32, 40,\n    116,111,108,117, 97, 95,105,110,100,101,120, 60, 48, 41, 39,\n     41, 10,  9,101,110,100, 10, 32,111,117,116,112,117,116, 40,\n     39, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,\n    116,111,108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,\n    105,110,100,101,120,105,110,103, 32,111,117,116, 32,111,102,\n     32,114, 97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59,\n     39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,110,\n    100,105,102, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,114,101,\n    116,117,114,110, 32,118, 97,108,117,101, 10, 32,108,111, 99,\n     97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,\n    105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32,\n    108,111, 99, 97,108, 32,112,117,115,104, 95,102,117,110, 99,\n     32, 61, 32,103,101,116, 95,112,117,115,104, 95,102,117,110,\n     99,116,105,111,110, 40,116, 41, 10, 32,105,102, 32,116, 32,\n    116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116,\n     46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44,\n     99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 58,103,101,\n    116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116,\n     97,116,105, 99, 41, 46, 46, 39, 41, 59, 39, 41, 10, 32,101,\n    108,115,101, 10,  9,  9,116, 32, 61, 32,115,101,108,102, 46,\n    116,121,112,101, 10, 32, 32,105,102, 32,115,101,108,102, 46,\n    112,116,114, 32, 61, 61, 32, 39, 38, 39, 32,111,114, 32,115,\n    101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,\n    104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,\n    116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41,\n     38, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108,\n    117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99,\n     41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39,\n     41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,\n    112,117,116, 40, 39, 32, 39, 44,112,117,115,104, 95,102,117,\n    110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,\n    111,105,100, 42, 41, 39, 46, 46,115,101,108,102, 58,103,101,\n    116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116,\n     97,116,105, 99, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39,\n     34, 41, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,101,110,\n    100, 10, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116,\n    117,114,110, 32, 49, 59, 39, 41, 10, 32,111,117,116,112,117,\n    116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n     39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,110,100,\n    101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76,\n     69, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,\n     92,110, 39, 41, 10, 10, 32, 45, 45, 32,115,101,116, 32,102,\n    117,110, 99,116,105,111,110, 32, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32,105,102,\n     32,110,111,116, 32,115,116,114,102,105,110,100, 40,115,101,\n    108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 39,\n     41, 32,116,104,101,110, 10, 32, 32,105,102, 32, 99,108, 97,\n    115,115, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40, 34, 47, 42, 32,115,101,116, 32,102,117,110, 99,\n    116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, 97,109,\n    101, 44, 34, 32,111,102, 32, 99,108, 97,115,115, 32, 34, 44,\n     99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,\n    101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40,\n     34, 47, 42, 32,115,101,116, 32,102,117,110, 99,116,105,111,\n    110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34,\n     32, 42, 47, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,\n    101,108,102, 46, 99,115,101,116,110, 97,109,101, 32, 61, 32,\n    115,101,108,102, 58, 99,102,117,110, 99,110, 97,109,101, 40,\n     34,116,111,108,117, 97, 95,115,101,116, 34, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,102,\n     32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95,\n     34, 46, 46,115,101,108,102, 46, 99,115,101,116,110, 97,109,\n    101, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 92,110,\n    115,116, 97,116,105, 99, 32,105,110,116, 34, 44,115,101,108,\n    102, 46, 99,115,101,116,110, 97,109,101, 44, 34, 40,108,117,\n     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,\n     83, 41, 34, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34,\n    123, 34, 41, 10, 10, 32, 32, 45, 45, 32,100,101, 99,108, 97,\n    114,101, 32,105,110,100,101,120, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32,105,110,116, 32,116,111,108,117, 97, 95,\n    105,110,100,101,120, 59, 39, 41, 10, 10, 32, 32, 45, 45, 32,\n    100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,\n    102, 32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,108,111,\n     99, 97,108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46,\n    109,111,100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105,\n     99, 41, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115,\n     32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110,105,\n    108, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 39, 44,115,101,108,102, 46,112, 97,114,101,\n    110,116, 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,\n    108,102, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116,\n     40, 39, 32,108,117, 97, 95,112,117,115,104,115,116,114,105,\n    110,103, 40,116,111,108,117, 97, 95, 83, 44, 34, 46,115,101,\n    108,102, 34, 41, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32,108,117, 97, 95,114, 97,119,103,101,116,\n     40,116,111,108,117, 97, 95, 83, 44, 49, 41, 59, 39, 41, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 32,115,101,108,\n    102, 32, 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 40, 39, 44,115,101,108,102, 46,112, 97,114,101,\n    110,116, 46,116,121,112,101, 44, 39, 42, 41, 32, 39, 41, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39,108,117, 97, 95,\n    116,111,117,115,101,114,100, 97,116, 97, 40,116,111,108,117,\n     97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32, 32,101,108,\n    115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,101,\n    110, 10, 32, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,\n    111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101,\n    108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,\n    116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10,\n     32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, 99,104,101,\n     99,107, 32,105,110,100,101,120, 10,  9, 32,111,117,116,112,\n    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,\n      9, 32,111,117,116,112,117,116, 40, 39, 32,123, 39, 41, 10,\n      9, 32,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108,\n    117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, 95,\n    101,114,114, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95,\n    105,115,110,117,109, 98,101,114, 40,116,111,108,117, 97, 95,\n     83, 44, 50, 44, 48, 44, 38,116,111,108,117, 97, 95,101,114,\n    114, 41, 41, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,\n     39, 32, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 35,118,105,110,118,\n     97,108,105,100, 32,116,121,112,101, 32,105,110, 32, 97,114,\n    114, 97,121, 32,105,110,100,101,120,105,110,103, 46, 34, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 32,125, 39, 41, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,\n    102, 92,110, 39, 41, 10, 10,  9,105,102, 32,102,108, 97,103,\n    115, 91, 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, 32,\n    102,111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,\n    116,121, 32,119,105,116,104, 32,116,111,108,117, 97, 53, 32,\n     63, 10,  9,  9,111,117,116,112,117,116, 40, 39, 32,116,111,\n    108,117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,\n    116, 41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,\n    114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 45,\n     49, 59, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,111,117,\n    116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,105,110,\n    100,101,120, 32, 61, 32, 40,105,110,116, 41,116,111,108,117,\n     97, 95,116,111,110,117,109, 98,101,114, 40,116,111,108,117,\n     97, 95, 83, 44, 50, 44, 48, 41, 59, 39, 41, 10,  9,101,110,\n    100, 10, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,105,\n    102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76,\n     69, 65, 83, 69, 92,110, 39, 41, 10,  9,105,102, 32,115,101,\n    108,102, 46,100,105,109, 32, 97,110,100, 32,115,101,108,102,\n     46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110,\n     10,  9, 32, 32,111,117,116,112,117,116, 40, 39, 32,105,102,\n     32, 40,116,111,108,117, 97, 95,105,110,100,101,120, 60, 48,\n     32,124,124, 32,116,111,108,117, 97, 95,105,110,100,101,120,\n     62, 61, 39, 46, 46,115,101,108,102, 46,100,105,109, 46, 46,\n     39, 41, 39, 41, 10,  9,101,108,115,101, 10,  9, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32,105,102, 32, 40,116,111,108,\n    117, 97, 95,105,110,100,101,120, 60, 48, 41, 39, 41, 10,  9,\n    101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111,\n    108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,105,110,\n    100,101,120,105,110,103, 32,111,117,116, 32,111,102, 32,114,\n     97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 10, 10, 32, 32, 45, 45, 32, 97,115,\n    115,105,103,110, 32,118, 97,108,117,101, 10, 32, 32,108,111,\n     99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10, 32, 32,\n    105,102, 32,115,101,108,102, 46,112,116,114,126, 61, 39, 39,\n     32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, 42, 39,\n     32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,\n     97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,110,\n     10, 32, 32, 32,111,117,116,112,117,116, 40, 99,108, 97,115,\n    115, 46, 46, 39, 58, 58, 39, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,\n    100,101,120, 93, 39, 41, 10, 32, 32,101,108,115,101,105,102,\n     32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32, 32, 32,\n    111,117,116,112,117,116, 40, 39,115,101,108,102, 45, 62, 39,\n     46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91,\n    116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10,\n     32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91,\n    116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10,\n     32, 32,101,110,100, 10, 32, 32,108,111, 99, 97,108, 32,116,\n     32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102,\n     46,116,121,112,101, 41, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, 32,110,111,\n    116, 32,116, 32, 97,110,100, 32,112,116,114, 61, 61, 39, 39,\n     32,116,104,101,110, 32,111,117,116,112,117,116, 40, 39, 42,\n     39, 41, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 40, 40, 39, 44,115,101,108,102, 46,109,111,100, 44,\n    115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102,\n     32,110,111,116, 32,116, 32,116,104,101,110, 10, 32, 32, 32,\n    111,117,116,112,117,116, 40, 39, 42, 39, 41, 10, 32, 32,101,\n    110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 41, 32,\n     39, 41, 10, 32, 32,108,111, 99, 97,108, 32,100,101,102, 32,\n     61, 32, 48, 10, 32, 32,105,102, 32,115,101,108,102, 46,100,\n    101,102, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32,100,\n    101,102, 32, 61, 32,115,101,108,102, 46,100,101,102, 32,101,\n    110,100, 10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39,116,111,108,117,\n     97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,108,117,\n     97, 95, 83, 44, 51, 44, 39, 44,100,101,102, 44, 39, 41, 41,\n     59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,108,\n    111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,\n    103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110,\n     40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32, 32,\n    111,117,116,112,117,116, 40,116,111, 95,102,117,110, 99, 44,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 51, 44, 39, 44,100,\n    101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101,110,100,\n     10, 32, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116,\n    117,114,110, 32, 48, 59, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39,125, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,\n    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,\n     66, 76, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10, 10,101,\n    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 65,114,114, 97,121, 58,114,101,103,105,115,116,\n    101,114, 32, 40,112,114,101, 41, 10,  9,105,102, 32,110,111,\n    116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117,\n     98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,\n    104,101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,\n    110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32,\n    111,114, 32, 39, 39, 10, 32,105,102, 32,115,101,108,102, 46,\n     99,115,101,116,110, 97,109,101, 32,116,104,101,110, 10, 32,\n     32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,\n    111,108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117,\n     97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110,\n     97,109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102,\n     46, 99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 39, 46,\n     46,115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 46,\n     46, 39, 41, 59, 39, 41, 10, 32,101,108,115,101, 10, 32, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117, 97,\n     95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,\n    109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102, 46,\n     99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 78, 85, 76,\n     76, 41, 59, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10,\n     10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,\n    110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,\n    105,111,110, 32, 95, 65,114,114, 97,121, 32, 40,116, 41, 10,\n     32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116,\n     44, 99,108, 97,115,115, 65,114,114, 97,121, 41, 10, 32, 97,\n    112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,\n    110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,\n    115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,\n    101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,\n    101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101,\n     32,118, 97,114,105, 97, 98,108,101, 32,100,101, 99,108, 97,\n    114, 97,116,105,111,110, 46, 10,102,117,110, 99,116,105,111,\n    110, 32, 65,114,114, 97,121, 32, 40,115, 41, 10, 32,114,101,\n    116,117,114,110, 32, 95, 65,114,114, 97,121, 32, 40, 68,101,\n     99,108, 97,114, 97,116,105,111,110, 40,115, 44, 39,118, 97,\n    114, 39, 41, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/array.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45,\n     45, 32, 70,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115,\n     32, 97, 32,102,117,110, 99,116,105,111,110, 32,111,114, 32,\n     97, 32, 99,108, 97,115,115, 32,109,101,116,104,111,100, 46,\n     10, 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,\n    110,103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,\n    116,111,114,101,100, 58, 10, 45, 45, 32, 32,109,111,100, 32,\n     32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,101,\n    114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,116,\n    121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61, 32,\n     34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102, 32,\n    114,101,112,114,101,115,101,110,116,105,110,103, 32, 97, 32,\n    112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,101,\n    102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,109,\n    101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,108,110,\n     97,109,101, 32, 61, 32,108,117, 97, 32,110, 97,109,101, 10,\n     45, 45, 32, 32, 97,114,103,115, 32, 32, 61, 32,108,105,115,\n    116, 32,111,102, 32, 97,114,103,117,109,101,110,116, 32,100,\n    101, 99,108, 97,114, 97,116,105,111,110,115, 10, 45, 45, 32,\n     32, 99,111,110,115,116, 32, 61, 32,105,102, 32,105,116, 32,\n    105,115, 32, 97, 32,109,101,116,104,111,100, 32,114,101, 99,\n    101,105,118,105,110,103, 32, 97, 32, 99,111,110,115,116, 32,\n     34,116,104,105,115, 34, 46, 10, 99,108, 97,115,115, 70,117,\n    110, 99,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100,\n     32, 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32,\n     39, 39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10,\n     32,110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32, 97,114,\n    103,115, 32, 61, 32,123,110, 61, 48,125, 44, 10, 32, 99,111,\n    110,115,116, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,\n    115,115, 70,117,110, 99,116,105,111,110, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 70,117,110, 99,\n    116,105,111,110, 10,115,101,116,109,101,116, 97,116, 97, 98,\n    108,101, 40, 99,108, 97,115,115, 70,117,110, 99,116,105,111,\n    110, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41,\n     10, 10, 45, 45, 32,100,101, 99,108, 97,114,101, 32,116, 97,\n    103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 70,117,110, 99,116,105,111,110, 58,100,101, 99,108,\n    116,121,112,101, 32, 40, 41, 10, 32,115,101,108,102, 46,116,\n    121,112,101, 32, 61, 32,116,121,112,101,118, 97,114, 40,115,\n    101,108,102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115,\n    116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,100,\n     44, 39, 99,111,110,115,116, 39, 41, 32,116,104,101,110, 10,\n      9, 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32, 39,\n     99,111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116,\n    121,112,101, 10,  9,  9,115,101,108,102, 46,109,111,100, 32,\n     61, 32,103,115,117, 98, 40,115,101,108,102, 46,109,111,100,\n     44, 39, 99,111,110,115,116, 39, 44, 39, 39, 41, 10,  9,101,\n    110,100, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,\n    119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115,\n     91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97,\n    114,103,115, 91,105, 93, 58,100,101, 99,108,116,121,112,101,\n     40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,\n    110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 87,114,105,\n    116,101, 32, 98,105,110,100,105,110,103, 32,102,117,110, 99,\n    116,105,111,110, 10, 45, 45, 32, 79,117,116,112,117,116,115,\n     32, 67, 47, 67, 43, 43, 32, 98,105,110,100,105,110,103, 32,\n    102,117,110, 99,116,105,111,110, 46, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,\n    111,110, 58,115,117,112, 99,111,100,101, 32, 40,108,111, 99,\n     97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 41,\n     10, 10, 32,108,111, 99, 97,108, 32,111,118,101,114,108,111,\n     97,100, 32, 61, 32,115,116,114,115,117, 98, 40,115,101,108,\n    102, 46, 99,110, 97,109,101, 44, 45, 50, 44, 45, 49, 41, 32,\n     45, 32, 49, 32, 32, 45, 45, 32,105,110,100,105, 99, 97,116,\n    101, 32,111,118,101,114,108,111, 97,100,101,100, 32,102,117,\n    110, 99, 10, 32,108,111, 99, 97,108, 32,110,114,101,116, 32,\n     61, 32, 48, 32, 32, 32, 32, 32, 32, 45, 45, 32,110,117,109,\n     98,101,114, 32,111,102, 32,114,101,116,117,114,110,101,100,\n     32,118, 97,108,117,101,115, 10, 32,108,111, 99, 97,108, 32,\n     99,108, 97,115,115, 32, 61, 32,115,101,108,102, 58,105,110,\n     99,108, 97,115,115, 40, 41, 10, 32,108,111, 99, 97,108, 32,\n     95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44,\n     39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41,\n     10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110,\n     10, 10, 32,  9,105,102, 32,115,101,108,102, 46,110, 97,109,\n    101, 32, 61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32,\n    115,101,108,102, 46,112, 97,114,101,110,116, 46,102,108, 97,\n    103,115, 46,112,117,114,101, 95,118,105,114,116,117, 97,108,\n     32,116,104,101,110, 10, 32,  9,  9, 45, 45, 32,110,111, 32,\n     99,111,110,115,116,114,117, 99,116,111,114, 32,102,111,114,\n     32, 99,108, 97,115,115,101,115, 32,119,105,116,104, 32,112,\n    117,114,101, 32,118,105,114,116,117, 97,108, 32,109,101,116,\n    104,111,100,115, 10, 32,  9,  9,114,101,116,117,114,110, 10,\n     32,  9,101,110,100, 10, 10, 32,  9,105,102, 32,108,111, 99,\n     97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,\n    116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40, 34,\n     47, 42, 32,109,101,116,104,111,100, 58, 32,110,101,119, 95,\n    108,111, 99, 97,108, 32,111,102, 32, 99,108, 97,115,115, 32,\n     34, 44, 99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10,\n      9,101,108,115,101, 10,  9,  9,111,117,116,112,117,116, 40,\n     34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,101,\n    108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108,\n     97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42,\n     47, 34, 41, 10,  9,101,110,100, 10, 32,101,108,115,101, 10,\n     32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,102,117,\n    110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,110,\n     97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,110,100,\n     10, 10, 32,105,102, 32,108,111, 99, 97,108, 95, 99,111,110,\n    115,116,114,117, 99,116,111,114, 32,116,104,101,110, 10, 32,\n     32,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,\n    102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69,\n     95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46,\n     46, 34, 95,108,111, 99, 97,108, 34, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,\n    105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,109,101,\n     46, 46, 34, 95,108,111, 99, 97,108, 34, 44, 34, 40,108,117,\n     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,\n     83, 41, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,111,117,\n    116,112,117,116, 40, 34, 35,105,102,110,100,101,102, 32, 84,\n     79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, 34, 46,\n     46,115,101,108,102, 46, 99,110, 97,109,101, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,116,105,\n     99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,\n    109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42,\n     32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,101,110,\n    100, 10, 32,111,117,116,112,117,116, 40, 34,123, 34, 41, 10,\n     10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,121,112,101,\n    115, 10,  9,105,102, 32,111,118,101,114,108,111, 97,100, 32,\n     60, 32, 48, 32,116,104,101,110, 10,  9, 32,111,117,116,112,\n    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,\n      9,101,110,100, 10,  9,111,117,116,112,117,116, 40, 39, 32,\n    116,111,108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,\n    117, 97, 95,101,114,114, 59, 39, 41, 10, 32,111,117,116,112,\n    117,116, 40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10, 32,\n     45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10, 32,\n    108,111, 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32,\n     99,108, 97,115,115, 32,116,104,101,110, 32,110, 97,114,103,\n     61, 50, 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,\n    101,110,100, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,\n    104,101,110, 10,  9,  9,108,111, 99, 97,108, 32,102,117,110,\n     99, 32, 61, 32,103,101,116, 95,105,115, 95,102,117,110, 99,\n    116,105,111,110, 40,115,101,108,102, 46,112, 97,114,101,110,\n    116, 46,116,121,112,101, 41, 10,  9,  9,108,111, 99, 97,108,\n     32,116,121,112,101, 32, 61, 32,115,101,108,102, 46,112, 97,\n    114,101,110,116, 46,116,121,112,101, 10,  9,  9,105,102, 32,\n    115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,119,\n     39, 32,111,114, 32,115,116, 97,116,105, 99,126, 61,110,105,\n    108, 32,116,104,101,110, 10,  9,  9,  9,102,117,110, 99, 32,\n     61, 32, 39,116,111,108,117, 97, 95,105,115,117,115,101,114,\n    116, 97, 98,108,101, 39, 10,  9,  9,  9,116,121,112,101, 32,\n     61, 32,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,\n    121,112,101, 10,  9,  9,101,110,100, 10,  9,  9,105,102, 32,\n    115,101,108,102, 46, 99,111,110,115,116, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10,  9,  9,  9,116,121,112,101, 32,\n     61, 32, 34, 99,111,110,115,116, 32, 34, 46, 46,116,121,112,\n    101, 10,  9,  9,101,110,100, 10,  9,  9,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32, 32, 32, 33, 39, 46, 46,102,117,110,\n     99, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44,\n     34, 39, 46, 46,116,121,112,101, 46, 46, 39, 34, 44, 48, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 32,124,124, 92,\n    110, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45, 32, 99,104,\n    101, 99,107, 32, 97,114,103,115, 10, 32,105,102, 32,115,101,\n    108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101,\n     32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110,\n     10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,\n    119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115,\n     91,105, 93, 32,100,111, 10, 32, 32, 32,108,111, 99, 97,108,\n     32, 98,116,121,112,101, 32, 61, 32,105,115, 98, 97,115,105,\n     99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46,\n    116,121,112,101, 41, 10, 32, 32, 32,105,102, 32, 98,116,121,\n    112,101, 32,126, 61, 32, 39,118, 97,108,117,101, 39, 32, 97,\n    110,100, 32, 98,116,121,112,101, 32,126, 61, 32, 39,115,116,\n     97,116,101, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 39, 46, 46,\n    115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,111,117,\n    116, 99,104,101, 99,107,116,121,112,101, 40,110, 97,114,103,\n     41, 46, 46, 39, 32,124,124, 92,110, 39, 41, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32, 32,105,102, 32, 98,116,121,112,101,\n     32,126, 61, 32, 39,115,116, 97,116,101, 39, 32,116,104,101,\n    110, 10,  9, 32, 32, 32,110, 97,114,103, 32, 61, 32,110, 97,\n    114,103, 43, 49, 10, 32, 32, 32,101,110,100, 10, 32, 32, 32,\n    105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,101,\n    110,100, 32,111,102, 32,108,105,115,116, 10, 32,111,117,116,\n    112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111,108,117,\n     97, 95,105,115,110,111,111, 98,106, 40,116,111,108,117, 97,\n     95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, 44, 38,\n    116,111,108,117, 97, 95,101,114,114, 41, 92,110, 32, 41, 39,\n     41, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32,103,111,\n    116,111, 32,116,111,108,117, 97, 95,108,101,114,114,111,114,\n     59, 39, 41, 10, 10, 32,111,117,116,112,117,116, 40, 39, 32,\n    101,108,115,101, 92,110, 39, 41, 10,  9,105,102, 32,111,118,\n    101,114,108,111, 97,100, 32, 60, 32, 48, 32,116,104,101,110,\n     10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 10,  9,101,110,100, 10,  9,111,117,\n    116,112,117,116, 40, 39, 32,123, 39, 41, 10, 10, 32, 45, 45,\n     32,100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,\n    105,102, 32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111,\n     99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32, 99,108,\n     97,115,115, 32,116,104,101,110, 32,110, 97,114,103, 61, 50,\n     32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,101,110,\n    100, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,\n     32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,110,101,\n    119, 39, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,\n    110,105,108, 32,116,104,101,110, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111,110,\n    115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,\n    116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32,\n     61, 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115,\n    101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101,\n     44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111, 99, 97,108,\n     32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,\n    116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101,108,\n    102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 41, 10,\n     32, 32,111,117,116,112,117,116, 40,116,111, 95,102,117,110,\n     99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 48,\n     41, 59, 39, 41, 10, 32,101,108,115,101,105,102, 32,115,116,\n     97,116,105, 99, 32,116,104,101,110, 10, 32, 32, 95, 44, 95,\n     44,115,101,108,102, 46,109,111,100, 32, 61, 32,115,116,114,\n    102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39,\n     94, 37,115, 42,115,116, 97,116,105, 99, 37,115, 37,115, 42,\n     40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45,\n     32,100,101, 99,108, 97,114,101, 32,112, 97,114, 97,109,101,\n    116,101,114,115, 10, 32,105,102, 32,115,101,108,102, 46, 97,\n    114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126, 61, 32,\n     39,118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32,108,\n    111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,105,108,\n    101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,\n    100,111, 10, 32, 32, 32,115,101,108,102, 46, 97,114,103,115,\n     91,105, 93, 58,100,101, 99,108, 97,114,101, 40,110, 97,114,\n    103, 41, 10, 32, 32, 32,105,102, 32,105,115, 98, 97,115,105,\n     99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46,\n    116,121,112,101, 41, 32,126, 61, 32, 34,115,116, 97,116,101,\n     34, 32,116,104,101,110, 10,  9, 32, 32, 32,110, 97,114,103,\n     32, 61, 32,110, 97,114,103, 43, 49, 10, 32, 32, 32,101,110,\n    100, 10, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,\n    104,101, 99,107, 32,115,101,108,102, 10, 32,105,102, 32, 99,\n    108, 97,115,115, 32, 97,110,100, 32,115,101,108,102, 46,110,\n     97,109,101,126, 61, 39,110,101,119, 39, 32, 97,110,100, 32,\n    115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,104,101,\n    110, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,105,102,\n    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69,\n     65, 83, 69, 92,110, 39, 41, 10,  9, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,102, 41,\n     32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111,\n    108,117, 97, 95, 83, 44, 34, 39, 46, 46,111,117,116,112,117,\n    116, 95,101,114,114,111,114, 95,104,111,111,107, 40, 34,105,\n    110,118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92, 39,\n     32,105,110, 32,102,117,110, 99,116,105,111,110, 32, 92, 39,\n     37,115, 92, 39, 34, 44, 32,115,101,108,102, 46,110, 97,109,\n    101, 41, 46, 46, 39, 34, 44, 32, 78, 85, 76, 76, 41, 59, 39,\n     41, 59, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,\n    110,100,105,102, 92,110, 39, 41, 10, 32,101,110,100, 10, 10,\n     32, 45, 45, 32,103,101,116, 32, 97,114,114, 97,121, 32,101,\n    108,101,109,101,110,116, 32,118, 97,108,117,101,115, 10, 32,\n    105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 32,110,\n     97,114,103, 61, 50, 32,101,108,115,101, 32,110, 97,114,103,\n     61, 49, 32,101,110,100, 10, 32,105,102, 32,115,101,108,102,\n     46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126,\n     61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, 32,\n     32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,\n    105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105,\n     93, 32,100,111, 10, 32, 32, 32,115,101,108,102, 46, 97,114,\n    103,115, 91,105, 93, 58,103,101,116, 97,114,114, 97,121, 40,\n    110, 97,114,103, 41, 10, 32, 32, 32,110, 97,114,103, 32, 61,\n     32,110, 97,114,103, 43, 49, 10, 32, 32, 32,105, 32, 61, 32,\n    105, 43, 49, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10,\n     10, 32,112,114,101, 95, 99, 97,108,108, 95,104,111,111,107,\n     40,115,101,108,102, 41, 10, 10, 32,108,111, 99, 97,108, 32,\n    111,117,116, 32, 61, 32,115,116,114,105,110,103, 46,102,105,\n    110,100, 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,\n    111,108,117, 97, 95,111,117,116,115,105,100,101, 34, 41, 10,\n     32, 45, 45, 32, 99, 97,108,108, 32,102,117,110, 99,116,105,\n    111,110, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,\n    100, 32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,100,\n    101,108,101,116,101, 39, 32,116,104,101,110, 10, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32, 32, 77,116,111,108,117, 97,\n     95,100,101,108,101,116,101, 40,115,101,108,102, 41, 59, 39,\n     41, 10, 32,101,108,115,101,105,102, 32, 99,108, 97,115,115,\n     32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 32,\n     61, 61, 32, 39,111,112,101,114, 97,116,111,114, 38, 91, 93,\n     39, 32,116,104,101,110, 10, 32, 32,105,102, 32,102,108, 97,\n    103,115, 91, 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45,\n     32,102,111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,\n    105,116,121, 32,119,105,116,104, 32,116,111,108,117, 97, 53,\n     32, 63, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32,115,\n    101,108,102, 45, 62,111,112,101,114, 97,116,111,114, 91, 93,\n     40, 39, 44,115,101,108,102, 46, 97,114,103,115, 91, 49, 93,\n     46,110, 97,109,101, 44, 39, 45, 49, 41, 32, 61, 32, 39, 44,\n    115,101,108,102, 46, 97,114,103,115, 91, 50, 93, 46,110, 97,\n    109,101, 44, 39, 59, 39, 41, 10, 32, 32,101,108,115,101, 10,\n     32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,115,\n    101,108,102, 45, 62,111,112,101,114, 97,116,111,114, 91, 93,\n     40, 39, 44,115,101,108,102, 46, 97,114,103,115, 91, 49, 93,\n     46,110, 97,109,101, 44, 39, 41, 32, 61, 32, 39, 44,115,101,\n    108,102, 46, 97,114,103,115, 91, 50, 93, 46,110, 97,109,101,\n     44, 39, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,101,108,\n    115,101, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,\n    123, 39, 41, 10, 32, 32,105,102, 32,115,101,108,102, 46,116,\n    121,112,101, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,\n    101,108,102, 46,116,121,112,101, 32,126, 61, 32, 39,118,111,\n    105,100, 39, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,\n    112,117,116, 40, 39, 32, 32, 39, 44,115,101,108,102, 46,109,\n    111,100, 44,115,101,108,102, 46,116,121,112,101, 44,115,101,\n    108,102, 46,112,116,114, 44, 39,116,111,108,117, 97, 95,114,\n    101,116, 32, 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,109,111,100,\n     44,115,101,108,102, 46,116,121,112,101, 44,115,101,108,102,\n     46,112,116,114, 44, 39, 41, 32, 39, 41, 10, 32, 32,101,108,\n    115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, 32,\n     99,108, 97,115,115, 32, 97,110,100, 32,115,101,108,102, 46,\n    110, 97,109,101, 61, 61, 39,110,101,119, 39, 32,116,104,101,\n    110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39, 77,116,\n    111,108,117, 97, 95,110,101,119, 40, 40, 39, 44,115,101,108,\n    102, 46,116,121,112,101, 44, 39, 41, 40, 39, 41, 10, 32, 32,\n    101,108,115,101,105,102, 32, 99,108, 97,115,115, 32, 97,110,\n    100, 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10,  9,\n    105,102, 32,111,117,116, 32,116,104,101,110, 10,  9,  9,111,\n    117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109,101,\n     44, 39, 40, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,111,\n    117,116,112,117,116, 40, 99,108, 97,115,115, 46, 46, 39, 58,\n     58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 44, 39,\n     40, 39, 41, 10,  9,101,110,100, 10, 32, 32,101,108,115,101,\n    105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10,  9,\n    105,102, 32,111,117,116, 32,116,104,101,110, 10,  9,  9,111,\n    117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109,101,\n     44, 39, 40, 39, 41, 10,  9,101,108,115,101, 10,  9, 32, 32,\n    105,102, 32,115,101,108,102, 46, 99, 97,115,116, 95,111,112,\n    101,114, 97,116,111,114, 32,116,104,101,110, 10,  9, 32, 32,\n      9, 45, 45,111,117,116,112,117,116, 40, 39,115,116, 97,116,\n    105, 99, 95, 99, 97,115,116, 60, 39, 44,115,101,108,102, 46,\n    109,111,100, 44,115,101,108,102, 46,116,121,112,101, 44,115,\n    101,108,102, 46,112,116,114, 44, 39, 32, 62, 40, 42,115,101,\n    108,102, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39,\n    115,101,108,102, 45, 62,111,112,101,114, 97,116,111,114, 32,\n     39, 44,115,101,108,102, 46,109,111,100, 44,115,101,108,102,\n     46,116,121,112,101, 44, 39, 40, 39, 41, 10,  9, 32, 32,101,\n    108,115,101, 10,  9,  9,111,117,116,112,117,116, 40, 39,115,\n    101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,110, 97,\n    109,101, 44, 39, 40, 39, 41, 10,  9, 32, 32,101,110,100, 10,\n      9,101,110,100, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,\n    111,117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109,\n    101, 44, 39, 40, 39, 41, 10, 32, 32,101,110,100, 10, 10, 32,\n     32,105,102, 32,111,117,116, 32, 97,110,100, 32,110,111,116,\n     32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,\n      9,111,117,116,112,117,116, 40, 39,115,101,108,102, 39, 41,\n     10,  9,105,102, 32,115,101,108,102, 46, 97,114,103,115, 91,\n     49, 93, 32, 97,110,100, 32,115,101,108,102, 46, 97,114,103,\n    115, 91, 49, 93, 46,110, 97,109,101, 32,126, 61, 32, 39, 39,\n     32,116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40,\n     39, 44, 39, 41, 10,  9,101,110,100, 10, 32, 32,101,110,100,\n     10, 32, 32, 45, 45, 32,119,114,105,116,101, 32,112, 97,114,\n     97,109,101,116,101,114,115, 10, 32, 32,108,111, 99, 97,108,\n     32,105, 61, 49, 10, 32, 32,119,104,105,108,101, 32,115,101,\n    108,102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, 32,\n     32, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,\n    112, 97,115,115,112, 97,114, 40, 41, 10, 32, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32, 32, 32,105,102, 32,115,101,108,\n    102, 46, 97,114,103,115, 91,105, 93, 32,116,104,101,110, 10,\n     32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 44, 39, 41,\n     10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 10,\n     32, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,\n    115,101,108,102, 46,110, 97,109,101, 32, 61, 61, 32, 39,111,\n    112,101,114, 97,116,111,114, 91, 93, 39, 32, 97,110,100, 32,\n    102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,101,110,\n     10,  9,111,117,116,112,117,116, 40, 39, 45, 49, 41, 59, 39,\n     41, 10, 32, 32,101,108,115,101, 10,  9,105,102, 32, 99,108,\n     97,115,115, 32, 97,110,100, 32,115,101,108,102, 46,110, 97,\n    109,101, 61, 61, 39,110,101,119, 39, 32,116,104,101,110, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 41, 41, 59, 39, 41,\n     32, 45, 45, 32, 99,108,111,115,101, 32, 77,116,111,108,117,\n     97, 95,110,101,119, 40, 10,  9,101,108,115,101, 10,  9,  9,\n    111,117,116,112,117,116, 40, 39, 41, 59, 39, 41, 10,  9,101,\n    110,100, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32,\n    114,101,116,117,114,110, 32,118, 97,108,117,101,115, 10, 32,\n     32,105,102, 32,115,101,108,102, 46,116,121,112,101, 32,126,\n     61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, 46,116,\n    121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,116,\n    104,101,110, 10, 32, 32, 32,110,114,101,116, 32, 61, 32,110,\n    114,101,116, 32, 43, 32, 49, 10, 32, 32, 32,108,111, 99, 97,\n    108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,105,\n     99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32,\n     32,105,102, 32,116, 32, 97,110,100, 32,115,101,108,102, 46,\n    110, 97,109,101, 32,126, 61, 32, 34,110,101,119, 34, 32,116,\n    104,101,110, 10, 32, 32, 32,  9,105,102, 32,115,101,108,102,\n     46, 99, 97,115,116, 95,111,112,101,114, 97,116,111,114, 32,\n     97,110,100, 32, 95, 98, 97,115,105, 99, 95,114, 97,119, 95,\n    112,117,115,104, 91,116, 93, 32,116,104,101,110, 10,  9,  9,\n    111,117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44, 95, 98,\n     97,115,105, 99, 95,114, 97,119, 95,112,117,115,104, 91,116,\n     93, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44,\n     99,116, 44, 39, 41,116,111,108,117, 97, 95,114,101,116, 41,\n     59, 39, 41, 10, 32, 32, 32,  9,101,108,115,101, 10,  9, 32,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,\n    111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116,\n     44, 39, 41,116,111,108,117, 97, 95,114,101,116, 41, 59, 39,\n     41, 10,  9,101,110,100, 10, 32, 32, 32,101,108,115,101, 10,\n      9,116, 32, 61, 32,115,101,108,102, 46,116,121,112,101, 10,\n      9,110,101,119, 95,116, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,116, 44, 32, 34, 99,111,110,115,116,\n     37,115, 43, 34, 44, 32, 34, 34, 41, 10,  9,108,111, 99, 97,\n    108, 32,111,119,110,101,100, 32, 61, 32,102, 97,108,115,101,\n     10,  9,105,102, 32,115,116,114,105,110,103, 46,102,105,110,\n    100, 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,\n    108,117, 97, 95,111,119,110,101,100, 34, 41, 32,116,104,101,\n    110, 10,  9,  9,111,119,110,101,100, 32, 61, 32,116,114,117,\n    101, 10,  9,101,110,100, 10, 32, 32, 32, 32,108,111, 99, 97,\n    108, 32,112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103,\n    101,116, 95,112,117,115,104, 95,102,117,110, 99,116,105,111,\n    110, 40,116, 41, 10, 32, 32, 32, 32,105,102, 32,115,101,108,\n    102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,\n    110, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 32, 32,123, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,\n    112,117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,\n    112,108,117,115,112,108,117,115, 92,110, 39, 41, 10, 32, 32,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,\n    118,111,105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106,\n     32, 61, 32, 77,116,111,108,117, 97, 95,110,101,119, 40, 40,\n     39, 44,110,101,119, 95,116, 44, 39, 41, 40,116,111,108,117,\n     97, 95,114,101,116, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, 39, 44,\n    112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,\n    117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, 98,106, 44,\n     34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32, 32,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,\n    111,108,117, 97, 95,114,101,103,105,115,116,101,114, 95,103,\n     99, 40,116,111,108,117, 97, 95, 83, 44,108,117, 97, 95,103,\n    101,116,116,111,112, 40,116,111,108,117, 97, 95, 83, 41, 41,\n     59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116,\n     40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, 32, 32, 32,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,\n    111,105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32,\n     61, 32,116,111,108,117, 97, 95, 99,111,112,121, 40,116,111,\n    108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38,116,\n    111,108,117, 97, 95,114,101,116, 44,115,105,122,101,111,102,\n     40, 39, 44,116, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32, 32,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, 39,\n     44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,\n    108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, 98,106,\n     44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,\n    116,111,108,117, 97, 95,114,101,103,105,115,116,101,114, 95,\n    103, 99, 40,116,111,108,117, 97, 95, 83, 44,108,117, 97, 95,\n    103,101,116,116,111,112, 40,116,111,108,117, 97, 95, 83, 41,\n     41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 32,\n     32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n    125, 39, 41, 10, 32, 32, 32, 32,101,108,115,101,105,102, 32,\n    115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39,\n     32,116,104,101,110, 10, 32, 32, 32, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95,102,\n    117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,\n    118,111,105,100, 42, 41, 38,116,111,108,117, 97, 95,114,101,\n    116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32,\n     32, 32, 32,101,108,115,101, 10,  9, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117,\n    110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,\n    111,105,100, 42, 41,116,111,108,117, 97, 95,114,101,116, 44,\n     34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9, 32,105,\n    102, 32,111,119,110,101,100, 32,111,114, 32,108,111, 99, 97,\n    108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,116,\n    104,101,110, 10, 32, 32, 32, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101,\n    103,105,115,116,101,114, 95,103, 99, 40,116,111,108,117, 97,\n     95, 83, 44,108,117, 97, 95,103,101,116,116,111,112, 40,116,\n    111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10,  9, 32,101,\n    110,100, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32,101,\n    110,100, 10, 32, 32,101,110,100, 10, 32, 32,108,111, 99, 97,\n    108, 32,105, 61, 49, 10, 32, 32,119,104,105,108,101, 32,115,\n    101,108,102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10,\n     32, 32, 32,110,114,101,116, 32, 61, 32,110,114,101,116, 32,\n     43, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,\n    114,101,116,118, 97,108,117,101, 40, 41, 10, 32, 32, 32,105,\n     32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32, 32,\n    111,117,116,112,117,116, 40, 39, 32, 32,125, 39, 41, 10, 10,\n     32, 32, 45, 45, 32,115,101,116, 32, 97,114,114, 97,121, 32,\n    101,108,101,109,101,110,116, 32,118, 97,108,117,101,115, 10,\n     32, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110,\n     32,110, 97,114,103, 61, 50, 32,101,108,115,101, 32,110, 97,\n    114,103, 61, 49, 32,101,110,100, 10, 32, 32,105,102, 32,115,\n    101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,\n    101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,\n    110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10,\n     32, 32, 32,119,104,105,108,101, 32,115,101,108,102, 46, 97,\n    114,103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,115,\n    101,108,102, 46, 97,114,103,115, 91,105, 93, 58,115,101,116,\n     97,114,114, 97,121, 40,110, 97,114,103, 41, 10, 32, 32, 32,\n     32,110, 97,114,103, 32, 61, 32,110, 97,114,103, 43, 49, 10,\n     32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45, 45,\n     32,102,114,101,101, 32,100,121,110, 97,109,105, 99, 97,108,\n    108,121, 32, 97,108,108,111, 99, 97,116,101,100, 32, 97,114,\n    114, 97,121, 10, 32, 32,105,102, 32,115,101,108,102, 46, 97,\n    114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126, 61, 32,\n     39,118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, 32,119,104,\n    105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105,\n     93, 32,100,111, 10, 32, 32, 32, 32,115,101,108,102, 46, 97,\n    114,103,115, 91,105, 93, 58,102,114,101,101, 97,114,114, 97,\n    121, 40, 41, 10, 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32,112,111,115,116, 95, 99, 97,108,108,\n     95,104,111,111,107, 40,115,101,108,102, 41, 10, 10, 32,111,\n    117,116,112,117,116, 40, 39, 32,125, 39, 41, 10, 32,111,117,\n    116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 39,\n     46, 46,110,114,101,116, 46, 46, 39, 59, 39, 41, 10, 10, 32,\n     45, 45, 32, 99, 97,108,108, 32,111,118,101,114,108,111, 97,\n    100,101,100, 32,102,117,110, 99,116,105,111,110, 32,111,114,\n     32,103,101,110,101,114, 97,116,101, 32,101,114,114,111,114,\n     10,  9,105,102, 32,111,118,101,114,108,111, 97,100, 32, 60,\n     32, 48, 32,116,104,101,110, 10, 10,  9,  9,111,117,116,112,\n    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,\n      9,  9,111,117,116,112,117,116, 40, 39,116,111,108,117, 97,\n     95,108,101,114,114,111,114, 58, 92,110, 39, 41, 10,  9,  9,\n    111,117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,\n    101,114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34,\n     39, 46, 46,111,117,116,112,117,116, 95,101,114,114,111,114,\n     95,104,111,111,107, 40, 34, 35,102,101,114,114,111,114, 32,\n    105,110, 32,102,117,110, 99,116,105,111,110, 32, 92, 39, 37,\n    115, 92, 39, 46, 34, 44, 32,115,101,108,102, 46,108,110, 97,\n    109,101, 41, 46, 46, 39, 34, 44, 38,116,111,108,117, 97, 95,\n    101,114,114, 41, 59, 39, 41, 10,  9,  9,111,117,116,112,117,\n    116, 40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,\n    108,111, 99, 97,108, 32, 95,108,111, 99, 97,108, 32, 61, 32,\n     34, 34, 10,  9,  9,105,102, 32,108,111, 99, 97,108, 95, 99,\n    111,110,115,116,114,117, 99,116,111,114, 32,116,104,101,110,\n     10,  9,  9,  9, 95,108,111, 99, 97,108, 32, 61, 32, 34, 95,\n    108,111, 99, 97,108, 34, 10,  9,  9,101,110,100, 10,  9,  9,\n    111,117,116,112,117,116, 40, 39,116,111,108,117, 97, 95,108,\n    101,114,114,111,114, 58, 92,110, 39, 41, 10,  9,  9,111,117,\n    116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 39,\n     46, 46,115,116,114,115,117, 98, 40,115,101,108,102, 46, 99,\n    110, 97,109,101, 44, 49, 44, 45, 51, 41, 46, 46,102,111,114,\n    109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,111,118,101,114,\n    108,111, 97,100, 41, 46, 46, 95,108,111, 99, 97,108, 46, 46,\n     39, 40,116,111,108,117, 97, 95, 83, 41, 59, 39, 41, 10,  9,\n    101,110,100, 10, 32,111,117,116,112,117,116, 40, 39,125, 39,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79,\n     76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41,\n     10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10,\n     10,  9, 45, 45, 32,114,101, 99,117,114,115,105,118,101, 32,\n     99, 97,108,108, 32,116,111, 32,119,114,105,116,101, 32,108,\n    111, 99, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,\n    114, 10,  9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,\n     32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,\n    119, 39, 32, 97,110,100, 32,110,111,116, 32,108,111, 99, 97,\n    108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,116,\n    104,101,110, 10, 10,  9,  9,115,101,108,102, 58,115,117,112,\n     99,111,100,101, 40, 49, 41, 10,  9,101,110,100, 10, 10,101,\n    110,100, 10, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,\n    114, 32,102,117,110, 99,116,105,111,110, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,\n    105,111,110, 58,114,101,103,105,115,116,101,114, 32, 40,112,\n    114,101, 41, 10, 10,  9,105,102, 32,110,111,116, 32,115,101,\n    108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99,\n     95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,\n      9,  9,114,101,116,117,114,110, 10,  9,101,110,100, 10, 10,\n     32,  9,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32,\n     61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46,102,108, 97,103,115,\n     46,112,117,114,101, 95,118,105,114,116,117, 97,108, 32,116,\n    104,101,110, 10, 32,  9,  9, 45, 45, 32,110,111, 32, 99,111,\n    110,115,116,114,117, 99,116,111,114, 32,102,111,114, 32, 99,\n    108, 97,115,115,101,115, 32,119,105,116,104, 32,112,117,114,\n    101, 32,118,105,114,116,117, 97,108, 32,109,101,116,104,111,\n    100,115, 10, 32,  9,  9,114,101,116,117,114,110, 10, 32,  9,\n    101,110,100, 10, 10, 32,111,117,116,112,117,116, 40,112,114,\n    101, 46, 46, 39,116,111,108,117, 97, 95,102,117,110, 99,116,\n    105,111,110, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46,\n     46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34,\n     44, 39, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46,\n     46, 39, 41, 59, 39, 41, 10, 32, 32,105,102, 32,115,101,108,\n    102, 46,110, 97,109,101, 32, 61, 61, 32, 39,110,101,119, 39,\n     32,116,104,101,110, 10,  9, 32, 32,111,117,116,112,117,116,\n     40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,102,117,\n    110, 99,116,105,111,110, 40,116,111,108,117, 97, 95, 83, 44,\n     34,110,101,119, 95,108,111, 99, 97,108, 34, 44, 39, 46, 46,\n    115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108,\n    111, 99, 97,108, 41, 59, 39, 41, 10,  9, 32, 32,111,117,116,\n    112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97,\n     95,102,117,110, 99,116,105,111,110, 40,116,111,108,117, 97,\n     95, 83, 44, 34, 46, 99, 97,108,108, 34, 44, 39, 46, 46,115,\n    101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108,111,\n     99, 97,108, 41, 59, 39, 41, 10,  9, 32, 32, 45, 45,111,117,\n    116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,115,101,\n    116, 95, 99, 97,108,108, 95,101,118,101,110,116, 40,116,111,\n    108,117, 97, 95, 83, 44, 39, 46, 46,115,101,108,102, 46, 99,\n    110, 97,109,101, 46, 46, 39, 95,108,111, 99, 97,108, 44, 32,\n     34, 39, 46, 46,115,101,108,102, 46,112, 97,114,101,110,116,\n     46,116,121,112,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32,\n     32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,\n    105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,\n    105,111,110, 58,112,114,105,110,116, 32, 40,105,100,101,110,\n    116, 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 70,117,110, 99,116,105,\n    111,110,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39,\n     34, 46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,\n    115,101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32, 99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,\n    115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41,\n     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105,\n     93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103,\n    115, 91,105, 93, 58,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,\n    105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,\n    114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102,\n     32,105,116, 32,114,101,116,117,114,110,115, 32, 97,110, 32,\n    111, 98,106,101, 99,116, 32, 98,121, 32,118, 97,108,117,101,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     70,117,110, 99,116,105,111,110, 58,114,101,113,117,105,114,\n    101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116, 41,\n     10,  9,108,111, 99, 97,108, 32,114, 32, 61, 32,102, 97,108,\n    115,101, 10,  9,105,102, 32,115,101,108,102, 46,116,121,112,\n    101, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,110,111,116,\n     32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,\n    121,112,101, 41, 32, 97,110,100, 32,115,101,108,102, 46,112,\n    116,114, 61, 61, 39, 39, 32,116,104,101,110, 10,  9,  9,108,\n    111, 99, 97,108, 32,116,121,112,101, 32, 61, 32,103,115,117,\n     98, 40,115,101,108,102, 46,116,121,112,101, 44, 34, 37,115,\n     42, 99,111,110,115,116, 37,115, 43, 34, 44, 34, 34, 41, 10,\n      9, 32,116, 91,116,121,112,101, 93, 32, 61, 32, 34,116,111,\n    108,117, 97, 95, 99,111,108,108,101, 99,116, 95, 34, 32, 46,\n     46, 32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116,\n    101, 40,116,121,112,101, 41, 10,  9, 32,114, 32, 61, 32,116,\n    114,117,101, 10,  9,101,110,100, 10,  9,108,111, 99, 97,108,\n     32,105, 61, 49, 10,  9,119,104,105,108,101, 32,115,101,108,\n    102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10,  9,  9,\n    114, 32, 61, 32,115,101,108,102, 46, 97,114,103,115, 91,105,\n     93, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99,\n    116,105,111,110, 40,116, 41, 32,111,114, 32,114, 10,  9,  9,\n    105, 32, 61, 32,105, 43, 49, 10,  9,101,110,100, 10,  9,114,\n    101,116,117,114,110, 32,114, 10,101,110,100, 10, 10, 45, 45,\n     32,100,101,116,101,114,109,105,110,101, 32,108,117, 97, 32,\n    102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 32,111,\n    118,101,114,108,111, 97,100, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110,\n     58,111,118,101,114,108,111, 97,100, 32, 40, 41, 10, 32,114,\n    101,116,117,114,110, 32,115,101,108,102, 46,112, 97,114,101,\n    110,116, 58,111,118,101,114,108,111, 97,100, 40,115,101,108,\n    102, 46,108,110, 97,109,101, 41, 10,101,110,100, 10, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,112, 97,114, 97,109, 95,\n    111, 98,106,101, 99,116, 40,112, 97,114, 41, 32, 45, 45, 32,\n    114,101,116,117,114,110,115, 32,116,114,117,101, 32,105,102,\n     32,116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 32,\n    104, 97,115, 32, 97,110, 32,111, 98,106,101, 99,116, 32, 97,\n    115, 32,105,116,115, 32,100,101,102, 97,117,108,116, 32,118,\n     97,108,117,101, 10, 10,  9,105,102, 32,110,111,116, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44,\n     32, 39, 61, 39, 41, 32,116,104,101,110, 32,114,101,116,117,\n    114,110, 32,102, 97,108,115,101, 32,101,110,100, 32, 45, 45,\n     32,105,116, 32,104, 97,115, 32,110,111, 32,100,101,102, 97,\n    117,108,116, 32,118, 97,108,117,101, 10, 10,  9,108,111, 99,\n     97,108, 32, 95, 44, 95, 44,100,101,102, 32, 61, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32,\n     34, 61, 40, 46, 42, 41, 36, 34, 41, 10, 10,  9,105,102, 32,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114,\n     44, 32, 34,124, 34, 41, 32,116,104,101,110, 32, 45, 45, 32,\n     97, 32,108,105,115,116, 32,111,102, 32,102,108, 97,103,115,\n     10, 10,  9,  9,114,101,116,117,114,110, 32,116,114,117,101,\n     10,  9,101,110,100, 10, 10,  9,105,102, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37,\n     42, 34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39,\n    115, 32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116,\n    104, 32, 97, 32,100,101,102, 97,117,108,116, 32,118, 97,108,\n    117,101, 10, 10,  9,  9,105,102, 32,115,116,114,105,110,103,\n     46,102,105,110,100, 40,112, 97,114, 44, 32, 39, 61, 37,115,\n     42,110,101,119, 39, 41, 32,111,114, 32,115,116,114,105,110,\n    103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37, 40,\n     34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39,115,\n     32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116,104,\n     32, 97,110, 32,105,110,115,116, 97,110, 99,101, 32, 97,115,\n     32,100,101,102, 97,117,108,116, 32,112, 97,114, 97,109,101,\n    116,101,114, 46, 46, 32,105,115, 32,116,104, 97,116, 32,118,\n     97,108,105,100, 63, 10,  9,  9,  9,114,101,116,117,114,110,\n     32,116,114,117,101, 10,  9,  9,101,110,100, 10,  9,  9,114,\n    101,116,117,114,110, 32,102, 97,108,115,101, 32, 45, 45, 32,\n    100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 32,105,\n    115, 32, 39, 78, 85, 76, 76, 39, 32,111,114, 32,115,111,109,\n    101,116,104,105,110,103, 10,  9,101,110,100, 10, 10, 10,  9,\n    105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    112, 97,114, 44, 32, 34, 91, 37, 40, 38, 93, 34, 41, 32,116,\n    104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,116,114,\n    117,101, 10,  9,101,110,100, 32, 45, 45, 32,100,101,102, 97,\n    117,108,116, 32,118, 97,108,117,101, 32,105,115, 32, 97, 32,\n     99,111,110,115,116,114,117, 99,116,111,114, 32, 99, 97,108,\n    108, 32, 40,109,111,115,116, 32,108,105,107,101,108,121, 32,\n    102,111,114, 32, 97, 32, 99,111,110,115,116, 32,114,101,102,\n    101,114,101,110, 99,101, 41, 10, 10,  9, 45, 45,105,102, 32,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114,\n     44, 32, 34, 38, 34, 41, 32,116,104,101,110, 10, 10,  9, 45,\n     45,  9,105,102, 32,115,116,114,105,110,103, 46,102,105,110,\n    100, 40,100,101,102, 44, 32, 34, 58, 34, 41, 32,111,114, 32,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,100,101,102,\n     44, 32, 34, 94, 37,115, 42,110,101,119, 37,115, 43, 34, 41,\n     32,116,104,101,110, 10, 10,  9, 45, 45,  9,  9, 45, 45, 32,\n    105,116, 39,115, 32, 97, 32,114,101,102,101,114,101,110, 99,\n    101, 32,119,105,116,104, 32,100,101,102, 97,117,108,116, 32,\n    116,111, 32,115,111,109,101,116,104,105,110,103, 32,108,105,\n    107,101, 32, 67,108, 97,115,115, 58, 58,109,101,109, 98,101,\n    114, 44, 32,111,114, 32, 39,110,101,119, 32, 67,108, 97,115,\n    115, 39, 10,  9, 45, 45,  9,  9,114,101,116,117,114,110, 32,\n    116,114,117,101, 10,  9, 45, 45,  9,101,110,100, 10,  9, 45,\n     45,101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,102,\n     97,108,115,101, 32, 45, 45, 32, 63, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,115,116,114,105,112, 95,\n    108, 97,115,116, 95, 97,114,103, 40, 97,108,108, 95, 97,114,\n    103,115, 44, 32,108, 97,115,116, 95, 97,114,103, 41, 32, 45,\n     45, 32,115,116,114,105,112,115, 32,116,104,101, 32,100,101,\n    102, 97,117,108,116, 32,118, 97,108,117,101, 32,102,114,111,\n    109, 32,116,104,101, 32,108, 97,115,116, 32, 97,114,103,117,\n    109,101,110,116, 10, 10,  9,108,111, 99, 97,108, 32, 95, 44,\n     95, 44,115, 95, 97,114,103, 32, 61, 32,115,116,114,105,110,\n    103, 46,102,105,110,100, 40,108, 97,115,116, 95, 97,114,103,\n     44, 32, 34, 94, 40, 91, 94, 61, 93, 43, 41, 34, 41, 10,  9,\n    108, 97,115,116, 95, 97,114,103, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,108, 97,115,116, 95, 97,114,\n    103, 44, 32, 34, 40, 91, 37, 37, 37, 40, 37, 41, 93, 41, 34,\n     44, 32, 34, 37, 37, 37, 49, 34, 41, 59, 10,  9, 97,108,108,\n     95, 97,114,103,115, 32, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40, 97,108,108, 95, 97,114,103,115, 44, 32,\n     34, 37,115, 42, 44, 37,115, 42, 34, 46, 46,108, 97,115,116,\n     95, 97,114,103, 46, 46, 34, 37,115, 42, 37, 41, 37,115, 42,\n     36, 34, 44, 32, 34, 41, 34, 41, 10,  9,114,101,116,117,114,\n    110, 32, 97,108,108, 95, 97,114,103,115, 44, 32,115, 95, 97,\n    114,103, 10,101,110,100, 10, 10, 10, 10, 45, 45, 32, 73,110,\n    116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117, 99,\n    116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95, 70,\n    117,110, 99,116,105,111,110, 32, 40,116, 41, 10, 32,115,101,\n    116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108,\n     97,115,115, 70,117,110, 99,116,105,111,110, 41, 10, 10, 32,\n    105,102, 32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39,\n     99,111,110,115,116, 39, 32, 97,110,100, 32,116, 46, 99,111,\n    110,115,116, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 10,\n     32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,\n    105,100, 32, 39, 99,111,110,115,116, 39, 32,115,112,101, 99,\n    105,102,105, 99, 97,116,105,111,110, 34, 41, 10, 32,101,110,\n    100, 10, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,\n    105,102, 32,116, 58,105,110, 99,108, 97,115,115, 40, 41, 32,\n    116,104,101,110, 10, 32, 45, 45,112,114,105,110,116, 32, 40,\n     39,116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116,\n     46,110, 97,109,101, 46, 46, 39, 44, 32,112, 97,114,101,110,\n    116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116, 46,\n    112, 97,114,101,110,116, 46,110, 97,109,101, 41, 10, 32, 32,\n    105,102, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    116, 46,110, 97,109,101, 44, 32, 34, 37, 98, 60, 62, 34, 44,\n     32, 34, 34, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40,116, 46,112, 97,114,101,110,116, 46,111,\n    114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,114,\n     32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 44,\n     32, 34, 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,\n    101,110, 10, 32, 32, 32,116, 46,110, 97,109,101, 32, 61, 32,\n     39,110,101,119, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,\n    101, 32, 61, 32, 39,110,101,119, 39, 10, 32, 32, 32,116, 46,\n    112, 97,114,101,110,116, 46, 95,110,101,119, 32, 61, 32,116,\n    114,117,101, 10, 32, 32, 32,116, 46,116,121,112,101, 32, 61,\n     32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 10,\n     32, 32, 32,116, 46,112,116,114, 32, 61, 32, 39, 42, 39, 10,\n     32, 32,101,108,115,101,105,102, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,116, 46,110, 97,109,101, 44, 32, 34,\n     37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32, 61, 61, 32, 39,\n    126, 39, 46, 46,115,116,114,105,110,103, 46,103,115,117, 98,\n     40,116, 46,112, 97,114,101,110,116, 46,111,114,105,103,105,\n    110, 97,108, 95,110, 97,109,101, 32,111,114, 32,116, 46,112,\n     97,114,101,110,116, 46,110, 97,109,101, 44, 32, 34, 37, 98,\n     60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,101,110, 10, 32,\n     32, 32,116, 46,110, 97,109,101, 32, 61, 32, 39,100,101,108,\n    101,116,101, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,101,\n     32, 61, 32, 39,100,101,108,101,116,101, 39, 10, 32, 32, 32,\n    116, 46,112, 97,114,101,110,116, 46, 95,100,101,108,101,116,\n    101, 32, 61, 32,116,114,117,101, 10, 32, 32,101,110,100, 10,\n     32,101,110,100, 10, 32,116, 46, 99,110, 97,109,101, 32, 61,\n     32,116, 58, 99,102,117,110, 99,110, 97,109,101, 40, 34,116,\n    111,108,117, 97, 34, 41, 46, 46,116, 58,111,118,101,114,108,\n    111, 97,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,\n    116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,\n    114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,\n    116,115, 32,116,104,114,101,101, 32,115,116,114,105,110,103,\n    115, 58, 32,111,110,101, 32,114,101,112,114,101,115,101,110,\n    116,105,110,103, 32,116,104,101, 32,102,117,110, 99,116,105,\n    111,110, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 44,\n     10, 45, 45, 32, 97,110,111,116,104,101,114, 32,114,101,112,\n    114,101,115,101,110,116,105,110,103, 32,116,104,101, 32, 97,\n    114,103,117,109,101,110,116, 32,108,105,115,116, 44, 32, 97,\n    110,100, 32,116,104,101, 32,116,104,105,114,100, 32,114,101,\n    112,114,101,115,101,110,116,105,110,103, 10, 45, 45, 32,116,\n    104,101, 32, 34, 99,111,110,115,116, 34, 32,111,114, 32,101,\n    109,112,116,121, 32,115,116,114,105,110,103, 46, 10,102,117,\n    110, 99,116,105,111,110, 32, 70,117,110, 99,116,105,111,110,\n     32, 40,100, 44, 97, 44, 99, 41, 10, 32, 45, 45,108,111, 99,\n     97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116,\n    114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 44, 39, 44,\n     39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 98,114, 97, 99,101,115, 10, 32, 45, 45,108,111, 99, 97,\n    108, 32,116, 32, 61, 32,115,112,108,105,116, 95,112, 97,114,\n     97,109,115, 40,115,116,114,115,117, 98, 40, 97, 44, 50, 44,\n     45, 50, 41, 41, 10, 10,  9,105,102, 32,110,111,116, 32,102,\n    108, 97,103,115, 91, 39, 87, 39, 93, 32, 97,110,100, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40, 97, 44, 32, 34,\n     37, 46, 37, 46, 37, 46, 37,115, 42, 37, 41, 34, 41, 32,116,\n    104,101,110, 10, 10,  9,  9,119, 97,114,110,105,110,103, 40,\n     34, 70,117,110, 99,116,105,111,110,115, 32,119,105,116,104,\n     32,118, 97,114,105, 97, 98,108,101, 32, 97,114,103,117,109,\n    101,110,116,115, 32, 40, 96, 46, 46, 46, 39, 41, 32, 97,114,\n    101, 32,110,111,116, 32,115,117,112,112,111,114,116,101,100,\n     46, 32, 73,103,110,111,114,105,110,103, 32, 34, 46, 46,100,\n     46, 46, 97, 46, 46, 99, 41, 10,  9,  9,114,101,116,117,114,\n    110, 32,110,105,108, 10,  9,101,110,100, 10, 10, 10, 32,108,\n    111, 99, 97,108, 32,105, 61, 49, 10, 32,108,111, 99, 97,108,\n     32,108, 32, 61, 32,123,110, 61, 48,125, 10, 10, 32,  9, 97,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n     97, 44, 32, 34, 37,115, 42, 40, 91, 37, 40, 37, 41, 93, 41,\n     37,115, 42, 34, 44, 32, 34, 37, 49, 34, 41, 10,  9,108,111,\n     99, 97,108, 32,116, 44,115,116,114,105,112, 44,108, 97,115,\n    116, 32, 61, 32,115,116,114,105,112, 95,112, 97,114,115, 40,\n    115,116,114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 41,\n     59, 10,  9,105,102, 32,115,116,114,105,112, 32,116,104,101,\n    110, 10,  9,  9, 45, 45,108,111, 99, 97,108, 32,110,115, 32,\n     61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115,116,\n    114,115,117, 98, 40, 97, 44, 49, 44, 45, 50, 41, 44, 32, 49,\n     44, 32, 45, 40,115,116,114,105,110,103, 46,108,101,110, 40,\n    108, 97,115,116, 41, 43, 49, 41, 41, 10,  9,  9,108,111, 99,\n     97,108, 32,110,115, 32, 61, 32,106,111,105,110, 40,116, 44,\n     32, 34, 44, 34, 44, 32, 49, 44, 32,108, 97,115,116, 45, 49,\n     41, 10, 10,  9,  9,110,115, 32, 61, 32, 34, 40, 34, 46, 46,\n    115,116,114,105,110,103, 46,103,115,117, 98, 40,110,115, 44,\n     32, 34, 37,115, 42, 44, 37,115, 42, 36, 34, 44, 32, 34, 34,\n     41, 46, 46, 39, 41, 39, 10,  9,  9, 45, 45,110,115, 32, 61,\n     32,115,116,114,105,112, 95,100,101,102, 97,117,108,116,115,\n     40,110,115, 41, 10, 10,  9,  9,108,111, 99, 97,108, 32,102,\n     32, 61, 32, 70,117,110, 99,116,105,111,110, 40,100, 44, 32,\n    110,115, 44, 32, 99, 41, 10,  9,  9,102,111,114, 32,105, 61,\n     49, 44,108, 97,115,116, 32,100,111, 10,  9,  9,  9,116, 91,\n    105, 93, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40,116, 91,105, 93, 44, 32, 34, 61, 46, 42, 36, 34, 44,\n     32, 34, 34, 41, 10,  9,  9,101,110,100, 10,  9,101,110,100,\n     10, 10, 32,119,104,105,108,101, 32,116, 91,105, 93, 32,100,\n    111, 10, 32, 32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49,\n     10, 32, 32,108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99,\n    108, 97,114, 97,116,105,111,110, 40,116, 91,105, 93, 44, 39,\n    118, 97,114, 39, 44,116,114,117,101, 41, 10, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,108,111, 99,\n     97,108, 32,102, 32, 61, 32, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 40,100, 44, 39,102,117,110, 99, 39, 41, 10, 32,\n    102, 46, 97,114,103,115, 32, 61, 32,108, 10, 32,102, 46, 99,\n    111,110,115,116, 32, 61, 32, 99, 10, 32,114,101,116,117,114,\n    110, 32, 95, 70,117,110, 99,116,105,111,110, 40,102, 41, 10,\n    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,106,\n    111,105,110, 40,116, 44, 32,115,101,112, 44, 32,102,105,114,\n    115,116, 44, 32,108, 97,115,116, 41, 10, 10,  9,102,105,114,\n    115,116, 32, 61, 32,102,105,114,115,116, 32,111,114, 32, 49,\n     10,  9,108, 97,115,116, 32, 61, 32,108, 97,115,116, 32,111,\n    114, 32,116, 97, 98,108,101, 46,103,101,116,110, 40,116, 41,\n     10,  9,108,111, 99, 97,108, 32,108,115,101,112, 32, 61, 32,\n     34, 34, 10,  9,108,111, 99, 97,108, 32,114,101,116, 32, 61,\n     32, 34, 34, 10,  9,108,111, 99, 97,108, 32,108,111,111,112,\n     32, 61, 32,102, 97,108,115,101, 10,  9,102,111,114, 32,105,\n     32, 61, 32,102,105,114,115,116, 44,108, 97,115,116, 32,100,\n    111, 10, 10,  9,  9,114,101,116, 32, 61, 32,114,101,116, 46,\n     46,108,115,101,112, 46, 46,116, 91,105, 93, 10,  9,  9,108,\n    115,101,112, 32, 61, 32,115,101,112, 10,  9,  9,108,111,111,\n    112, 32, 61, 32,116,114,117,101, 10,  9,101,110,100, 10,  9,\n    105,102, 32,110,111,116, 32,108,111,111,112, 32,116,104,101,\n    110, 10,  9,  9,114,101,116,117,114,110, 32, 34, 34, 10,  9,\n    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,114,101,\n    116, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32,115,116,114,105,112, 95,112, 97,114,115, 40,115, 41, 10,\n     10,  9,108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,\n    105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44, 32,\n     39, 44, 39, 41, 10,  9,108,111, 99, 97,108, 32,115,116,114,\n    105,112, 32, 61, 32,102, 97,108,115,101, 10,  9,108,111, 99,\n     97,108, 32,108, 97,115,116, 10, 10,  9,102,111,114, 32,105,\n     61,116, 46,110, 44, 49, 44, 45, 49, 32,100,111, 10, 10,  9,\n      9,105,102, 32,110,111,116, 32,115,116,114,105,112, 32, 97,\n    110,100, 32,112, 97,114, 97,109, 95,111, 98,106,101, 99,116,\n     40,116, 91,105, 93, 41, 32,116,104,101,110, 10,  9,  9,  9,\n    108, 97,115,116, 32, 61, 32,105, 10,  9,  9,  9,115,116,114,\n    105,112, 32, 61, 32,116,114,117,101, 10,  9,  9,101,110,100,\n     10,  9,  9, 45, 45,105,102, 32,115,116,114,105,112, 32,116,\n    104,101,110, 10,  9,  9, 45, 45,  9,116, 91,105, 93, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116, 91,\n    105, 93, 44, 32, 34, 61, 46, 42, 36, 34, 44, 32, 34, 34, 41,\n     10,  9,  9, 45, 45,101,110,100, 10,  9,101,110,100, 10, 10,\n      9,114,101,116,117,114,110, 32,116, 44,115,116,114,105,112,\n     44,108, 97,115,116, 10, 10,101,110,100, 10, 10,102,117,110,\n     99,116,105,111,110, 32,115,116,114,105,112, 95,100,101,102,\n     97,117,108,116,115, 40,115, 41, 10, 10,  9,115, 32, 61, 32,\n    115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32,\n     34, 94, 37, 40, 34, 44, 32, 34, 34, 41, 10,  9,115, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44,\n     32, 34, 37, 41, 36, 34, 44, 32, 34, 34, 41, 10, 10,  9,108,\n    111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116, 95,\n     99, 95,116,111,107,101,110,115, 40,115, 44, 32, 34, 44, 34,\n     41, 10,  9,108,111, 99, 97,108, 32,115,101,112, 44, 32,114,\n    101,116, 32, 61, 32, 34, 34, 44, 34, 34, 10,  9,102,111,114,\n     32,105, 61, 49, 44,116, 46,110, 32,100,111, 10,  9,  9,116,\n     91,105, 93, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 40,116, 91,105, 93, 44, 32, 34, 61, 46, 42, 36, 34,\n     44, 32, 34, 34, 41, 10,  9,  9,114,101,116, 32, 61, 32,114,\n    101,116, 46, 46,115,101,112, 46, 46,116, 91,105, 93, 10,  9,\n      9,115,101,112, 32, 61, 32, 34, 44, 34, 10,  9,101,110,100,\n     10, 10,  9,114,101,116,117,114,110, 32, 34, 40, 34, 46, 46,\n    114,101,116, 46, 46, 34, 41, 34, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/function.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,111,112,101,114, 97,\n    116,111,114, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,\n     32, 79,112,101,114, 97,116,111,114, 32, 99,108, 97,115,115,\n     10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,\n     97,110, 32,111,112,101,114, 97,116,111,114, 32,102,117,110,\n     99,116,105,111,110, 32,111,114, 32, 97, 32, 99,108, 97,115,\n    115, 32,111,112,101,114, 97,116,111,114, 32,109,101,116,104,\n    111,100, 46, 10, 45, 45, 32, 73,116, 32,115,116,111,114,101,\n    115, 32,116,104,101, 32,115, 97,109,101, 32,102,105,101,108,\n    100,115, 32, 97,115, 32,102,117,110, 99,116,105,111,110,115,\n     32,100,111, 32,112,108,117,115, 58, 10, 45, 45, 32, 32,107,\n    105,110,100, 32, 61, 32,115,101,116, 32,111,102, 32, 99,104,\n     97,114, 97, 99,116,101,114, 32,114,101,112,114,101,115,101,\n    110,116,105,110,103, 32,116,104,101, 32,111,112,101,114, 97,\n    116,111,114, 32, 40, 97,115, 32,105,116, 32, 97,112,112,101,\n    114,115, 32,105,110, 32, 67, 43, 43, 32, 99,111,100,101, 41,\n     10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,114, 32,\n     61, 32,123, 10, 32,107,105,110,100, 32, 61, 32, 39, 39, 44,\n     10,125, 10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,\n    114, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,\n    115,115, 79,112,101,114, 97,116,111,114, 10,115,101,116,109,\n    101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 79,\n    112,101,114, 97,116,111,114, 44, 99,108, 97,115,115, 70,117,\n    110, 99,116,105,111,110, 41, 10, 10, 45, 45, 32,116, 97, 98,\n    108,101, 32,116,111, 32,116,114, 97,110,115,102,111,114,109,\n     32,111,112,101,114, 97,116,111,114, 32,107,105,110,100, 32,\n    105,110,116,111, 32,116,104,101, 32, 97,112,112,114,111,112,\n    114,105, 97,116,101, 32,116, 97,103, 32,109,101,116,104,111,\n    100, 32,110, 97,109,101, 10, 95, 84, 77, 32, 61, 32,123, 91,\n     39, 43, 39, 93, 32, 61, 32, 39, 97,100,100, 39, 44, 10, 32,\n     32, 32, 32, 32, 32, 32, 91, 39, 45, 39, 93, 32, 61, 32, 39,\n    115,117, 98, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39,\n     42, 39, 93, 32, 61, 32, 39,109,117,108, 39, 44, 10, 32, 32,\n     32, 32, 32, 32, 32, 91, 39, 47, 39, 93, 32, 61, 32, 39,100,\n    105,118, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 60,\n     39, 93, 32, 61, 32, 39,108,116, 39, 44, 10, 32, 32, 32, 32,\n     32, 32, 32, 91, 39, 60, 61, 39, 93, 32, 61, 32, 39,108,101,\n     39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 61, 61, 39,\n     93, 32, 61, 32, 39,101,113, 39, 44, 10, 32, 32, 32, 32, 32,\n     32, 32, 91, 39, 91, 93, 39, 93, 32, 61, 32, 39,103,101,116,\n    105, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 38, 91,\n     93, 39, 93, 32, 61, 32, 39,115,101,116,105, 39, 44, 10, 32,\n     32, 32, 32, 32, 32, 32, 45, 45, 91, 39, 45, 62, 39, 93, 32,\n     61, 32, 39,102,108,101, 99,104,105,116, 97, 39, 44, 10, 32,\n     32, 32, 32, 32, 32,125, 10, 10, 10, 45, 45, 32, 80,114,105,\n    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 79,112,101,114, 97,116,\n    111,114, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,\n     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 79,112,101,114, 97,116,111,\n    114,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,107,105,110,100, 32, 32, 61, 32, 39,\n     34, 46, 46,115,101,108,102, 46,107,105,110,100, 46, 46, 34,\n     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34,\n     46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,\n    115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n     99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,\n    101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,\n    100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103,115, 91,\n    105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100,\n     10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 79,112,101,114, 97,116,111,114, 58,115,117,112, 99,111,\n    100,101, 95,116,109,112, 40, 41, 10, 10,  9,105,102, 32,110,\n    111,116, 32, 95, 84, 77, 91,115,101,108,102, 46,107,105,110,\n    100, 93, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,\n    110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110,\n     46,115,117,112, 99,111,100,101, 40,115,101,108,102, 41, 10,\n      9,101,110,100, 10, 10,  9, 45, 45, 32,110,111, 32,111,118,\n    101,114,108,111, 97,100, 44, 32,110,111, 32,112, 97,114, 97,\n    109,101,116,101,114,115, 44, 32, 97,108,119, 97,121,115, 32,\n    105,110, 99,108, 97,115,115, 10,  9,111,117,116,112,117,116,\n     40, 34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,\n    101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,\n    108, 97,115,115, 32, 34, 44,115,101,108,102, 58,105,110, 99,\n    108, 97,115,115, 40, 41, 44, 34, 32, 42, 47, 34, 41, 10, 10,\n      9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,\n    102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69,\n     95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 41,\n     10,  9,111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,\n    116,105, 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,\n    110, 97,109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,\n    101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 10,\n      9,105,102, 32,111,118,101,114,108,111, 97,100, 32, 60, 32,\n     48, 32,116,104,101,110, 10,  9, 32,111,117,116,112,117,116,\n     40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65,\n     95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,101,\n    110,100, 10,  9,111,117,116,112,117,116, 40, 39, 32,116,111,\n    108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97,\n     95,101,114,114, 59, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10,  9, 45, 45,\n     32, 99,104,101, 99,107, 32,115,101,108,102, 10,  9,108,111,\n     99, 97,108, 32,105,115, 95,102,117,110, 99, 32, 61, 32,103,\n    101,116, 95,105,115, 95,102,117,110, 99,116,105,111,110, 40,\n    115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,\n    101, 41, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n     32, 32, 33, 39, 46, 46,105,115, 95,102,117,110, 99, 46, 46,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 34, 39, 46,\n     46,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,\n    112,101, 46, 46, 39, 34, 44, 48, 44, 38,116,111,108,117, 97,\n     95,101,114,114, 41, 32,124,124, 92,110, 39, 41, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111,\n    108,117, 97, 95,105,115,110,111,111, 98,106, 40,116,111,108,\n    117, 97, 95, 83, 44, 50, 44, 38,116,111,108,117, 97, 95,101,\n    114,114, 41, 92,110, 32, 41, 39, 41, 10,  9,111,117,116,112,\n    117,116, 40, 39, 32, 32,103,111,116,111, 32,116,111,108,117,\n     97, 95,108,101,114,114,111,114, 59, 39, 41, 10, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32,101,108,115,101, 92,110, 39,\n     41, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 32, 45, 45, 32,116,111,108,117, 97,\n     95,114,101,108,101, 97,115,101, 10,  9,111,117,116,112,117,\n    116, 40, 39, 32,123, 39, 41, 10, 10,  9, 45, 45, 32,100,101,\n     99,108, 97,114,101, 32,115,101,108,102, 10,  9,111,117,116,\n    112,117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111,\n    110,115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116,\n     46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102,\n     32, 61, 32, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39,\n     40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115,\n    101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101,\n     44, 39, 42, 41, 32, 39, 41, 10,  9,108,111, 99, 97,108, 32,\n    116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,116,\n    111, 95,102,117,110, 99, 40,115,101,108,102, 46,112, 97,114,\n    101,110,116, 46,116,121,112,101, 41, 10,  9,111,117,116,112,\n    117,116, 40,116,111, 95,102,117,110, 99, 44, 39, 40,116,111,\n    108,117, 97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 10,\n      9, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10,\n      9,111,117,116,112,117,116, 40, 39, 35,105,102,110,100,101,\n    102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69,\n     92,110, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 32,\n     32,105,102, 32, 40, 33,115,101,108,102, 41, 32,116,111,108,\n    117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95,\n     83, 44, 34, 39, 46, 46,111,117,116,112,117,116, 95,101,114,\n    114,111,114, 95,104,111,111,107, 40, 34,105,110,118, 97,108,\n    105,100, 32, 92, 39,115,101,108,102, 92, 39, 32,105,110, 32,\n    102,117,110, 99,116,105,111,110, 32, 92, 39, 37,115, 92, 39,\n     34, 44, 32,115,101,108,102, 46,110, 97,109,101, 41, 46, 46,\n     39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 59, 10,  9,111,\n    117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110,\n     39, 41, 10, 10,  9, 45, 45, 32, 99, 97,115,116, 32,115,101,\n    108,102, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32, 39,\n     44,115,101,108,102, 46,109,111,100, 44,115,101,108,102, 46,\n    116,121,112,101, 44,115,101,108,102, 46,112,116,114, 44, 39,\n    116,111,108,117, 97, 95,114,101,116, 32, 61, 32, 39, 41, 10,\n      9,111,117,116,112,117,116, 40, 39, 40, 39, 44,115,101,108,\n    102, 46,109,111,100, 44,115,101,108,102, 46,116,121,112,101,\n     44,115,101,108,102, 46,112,116,114, 44, 39, 41, 40, 42,115,\n    101,108,102, 41, 59, 39, 41, 10, 10,  9, 45, 45, 32,114,101,\n    116,117,114,110, 32,118, 97,108,117,101, 10,  9,108,111, 99,\n     97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,\n    105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10,  9,\n    105,102, 32,116, 32,116,104,101,110, 10,  9,  9,111,117,116,\n    112,117,116, 40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,\n    117,115,104, 39, 46, 46,116, 46, 46, 39, 40,116,111,108,117,\n     97, 95, 83, 44, 40, 39, 44, 99,116, 44, 39, 41,116,111,108,\n    117, 97, 95,114,101,116, 41, 59, 39, 41, 10,  9,101,108,115,\n    101, 10,  9,  9,116, 32, 61, 32,115,101,108,102, 46,116,121,\n    112,101, 10,  9,  9,108,111, 99, 97,108, 32,112,117,115,104,\n     95,102,117,110, 99, 32, 61, 32,103,101,116, 95,112,117,115,\n    104, 95,102,117,110, 99,116,105,111,110, 40,116, 41, 10,  9,\n      9,110,101,119, 95,116, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,116, 44, 32, 34, 99,111,110,115,116,\n     37,115, 43, 34, 44, 32, 34, 34, 41, 10,  9,  9,105,102, 32,\n    115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,\n    116,104,101,110, 10,  9,  9,  9,111,117,116,112,117,116, 40,\n     39, 32, 32, 32,123, 39, 41, 10,  9,  9,  9,111,117,116,112,\n    117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,\n    108,117,115,112,108,117,115, 92,110, 39, 41, 10,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,\n    100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61, 32,\n     77,116,111,108,117, 97, 95,110,101,119, 40, 40, 39, 44,110,\n    101,119, 95,116, 44, 39, 41, 40,116,111,108,117, 97, 95,114,\n    101,116, 41, 41, 59, 39, 41, 10,  9,  9,  9,111,117,116,112,\n    117,116, 40, 39, 32, 32, 32, 32, 39, 44,112,117,115,104, 95,\n    102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44,\n    116,111,108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, 44,\n     39, 34, 41, 59, 39, 41, 10,  9,  9,  9,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101,\n    103,105,115,116,101,114, 95,103, 99, 40,116,111,108,117, 97,\n     95, 83, 44,108,117, 97, 95,103,101,116,116,111,112, 40,116,\n    111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39, 35,101,108,115,101, 92,110,\n     39, 41, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32,\n     32, 32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95,\n    111, 98,106, 32, 61, 32,116,111,108,117, 97, 95, 99,111,112,\n    121, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100,\n     42, 41, 38,116,111,108,117, 97, 95,114,101,116, 44,115,105,\n    122,101,111,102, 40, 39, 44,116, 44, 39, 41, 41, 59, 39, 41,\n     10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n     32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,\n    116,111,108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,111,\n     98,106, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,\n    116,111,108,117, 97, 95,114,101,103,105,115,116,101,114, 95,\n    103, 99, 40,116,111,108,117, 97, 95, 83, 44,108,117, 97, 95,\n    103,101,116,116,111,112, 40,116,111,108,117, 97, 95, 83, 41,\n     41, 59, 39, 41, 10,  9,  9,  9,111,117,116,112,117,116, 40,\n     39, 35,101,110,100,105,102, 92,110, 39, 41, 10,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39, 32, 32, 32,125, 39, 41, 10,\n      9,  9,101,108,115,101,105,102, 32,115,101,108,102, 46,112,\n    116,114, 32, 61, 61, 32, 39, 38, 39, 32,116,104,101,110, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 39,\n     44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,\n    108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38,116,\n    111,108,117, 97, 95,114,101,116, 44, 34, 39, 44,116, 44, 39,\n     34, 41, 59, 39, 41, 10,  9,  9,101,108,115,101, 10,  9,  9,\n      9,105,102, 32,108,111, 99, 97,108, 95, 99,111,110,115,116,\n    114,117, 99,116,111,114, 32,116,104,101,110, 10,  9,  9,  9,\n      9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112,\n    117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117,\n     97, 95, 83, 44, 40,118,111,105,100, 32, 42, 41,116,111,108,\n    117, 97, 95,114,101,116, 44, 34, 39, 44,116, 44, 39, 34, 41,\n     59, 39, 41, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40,\n     39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101,103,105,\n    115,116,101,114, 95,103, 99, 40,116,111,108,117, 97, 95, 83,\n     44,108,117, 97, 95,103,101,116,116,111,112, 40,116,111,108,\n    117, 97, 95, 83, 41, 41, 59, 39, 41, 10,  9,  9,  9,101,108,\n    115,101, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40, 39,\n     32, 32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100,\n     42, 41,116,111,108,117, 97, 95,114,101,116, 44, 34, 39, 44,\n    116, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,  9,101,110,100,\n     10,  9,  9,101,110,100, 10,  9,101,110,100, 10, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32, 32,125, 39, 41, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32,\n     49, 59, 39, 41, 10, 10,  9,111,117,116,112,117,116, 40, 39,\n     35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82,\n     69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,111,117,116,\n    112,117,116, 40, 39,116,111,108,117, 97, 95,108,101,114,114,\n    111,114, 58, 92,110, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,\n    116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,111,117,116,\n    112,117,116, 95,101,114,114,111,114, 95,104,111,111,107, 40,\n     34, 35,102,101,114,114,111,114, 32,105,110, 32,102,117,110,\n     99,116,105,111,110, 32, 92, 39, 37,115, 92, 39, 46, 34, 44,\n     32,115,101,108,102, 46,108,110, 97,109,101, 41, 46, 46, 39,\n     34, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39,\n     41, 10,  9,111,117,116,112,117,116, 40, 39, 32,114,101,116,\n    117,114,110, 32, 48, 59, 39, 41, 10,  9,111,117,116,112,117,\n    116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 10,\n     10,  9,111,117,116,112,117,116, 40, 39,125, 39, 41, 10,  9,\n    111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 32,\n     47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65,\n     95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10,  9,111,\n    117,116,112,117,116, 40, 39, 92,110, 39, 41, 10,101,110,100,\n     10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,\n    111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,\n    116,105,111,110, 32, 95, 79,112,101,114, 97,116,111,114, 32,\n     40,116, 41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98,\n    108,101, 40,116, 44, 99,108, 97,115,115, 79,112,101,114, 97,\n    116,111,114, 41, 10, 10, 32,105,102, 32,116, 46, 99,111,110,\n    115,116, 32,126, 61, 32, 39, 99,111,110,115,116, 39, 32, 97,\n    110,100, 32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10, 32, 32,101,114,114,111,114, 40,\n     34, 35,105,110,118, 97,108,105,100, 32, 39, 99,111,110,115,\n    116, 39, 32,115,112,101, 99,105,102,105, 99, 97,116,105,111,\n    110, 34, 41, 10, 32,101,110,100, 10, 10, 32, 97,112,112,101,\n    110,100, 40,116, 41, 10, 32,105,102, 32,110,111,116, 32,116,\n     58,105,110, 99,108, 97,115,115, 40, 41, 32,116,104,101,110,\n     10, 32, 32,101,114,114,111,114, 40, 34, 35,111,112,101,114,\n     97,116,111,114, 32, 99, 97,110, 32,111,110,108,121, 32, 98,\n    101, 32,100,101,102,105,110,101,100, 32, 97,115, 32, 99,108,\n     97,115,115, 32,109,101,109, 98,101,114, 34, 41, 10, 32,101,\n    110,100, 10, 10, 32, 45, 45,116, 46,110, 97,109,101, 32, 61,\n     32,116, 46,110, 97,109,101, 32, 46, 46, 32, 34, 95, 34, 32,\n     46, 46, 32, 40, 95, 84, 77, 91,116, 46,107,105,110,100, 93,\n     32,111,114, 32,116, 46,107,105,110,100, 41, 10, 32,116, 46,\n     99,110, 97,109,101, 32, 61, 32,116, 58, 99,102,117,110, 99,\n    110, 97,109,101, 40, 34,116,111,108,117, 97, 34, 41, 46, 46,\n    116, 58,111,118,101,114,108,111, 97,100, 40,116, 41, 10, 32,\n    116, 46,110, 97,109,101, 32, 61, 32, 34,111,112,101,114, 97,\n    116,111,114, 34, 32, 46, 46, 32,116, 46,107,105,110,100, 32,\n     32, 45, 45, 32,115,101,116, 32, 97,112,112,114,111,112,114,\n    105, 97,116,101, 32, 99, 97,108,108,105,110,103, 32,110, 97,\n    109,101, 10, 32,114,101,116,117,114,110, 32,116, 10,101,110,\n    100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,\n    111,114, 10,102,117,110, 99,116,105,111,110, 32, 79,112,101,\n    114, 97,116,111,114, 32, 40,100, 44,107, 44, 97, 44, 99, 41,\n     10, 10,  9,108,111, 99, 97,108, 32,111,112, 95,107, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,107, 44,\n     32, 34, 94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,111,\n    112, 95,107, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 40,107, 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34,\n     34, 41, 10,  9, 45, 45,105,102, 32,115,116,114,105,110,103,\n     46,102,105,110,100, 40,107, 44, 32, 34, 94, 91, 37,119, 95,\n     58, 37,100, 60, 62, 37, 42, 37, 38, 93, 43, 36, 34, 41, 32,\n    116,104,101,110, 10,  9,105,102, 32,100, 32, 61, 61, 32, 34,\n    111,112,101,114, 97,116,111,114, 34, 32, 97,110,100, 32,107,\n     32,126, 61, 32, 39, 39, 32,116,104,101,110, 10, 10,  9,  9,\n    100, 32, 61, 32,107, 46, 46, 34, 32,111,112,101,114, 97,116,\n    111,114, 34, 10,  9,101,108,115,101,105,102, 32,110,111,116,\n     32, 95, 84, 77, 91,111,112, 95,107, 93, 32,116,104,101,110,\n     10, 10,  9,  9,105,102, 32,102,108, 97,103,115, 91, 39, 87,\n     39, 93, 32,116,104,101,110, 10,  9,  9,  9,101,114,114,111,\n    114, 40, 34,116,111,108,117, 97, 58, 32,110,111, 32,115,117,\n    112,112,111,114,116, 32,102,111,114, 32,111,112,101,114, 97,\n    116,111,114, 34, 32, 46, 46, 32,102, 46,107,105,110,100, 41,\n     10,  9,  9,101,108,115,101, 10,  9,  9,  9,119, 97,114,110,\n    105,110,103, 40, 34, 78,111, 32,115,117,112,112,111,114,116,\n     32,102,111,114, 32,111,112,101,114, 97,116,111,114, 32, 34,\n     46, 46,111,112, 95,107, 46, 46, 34, 44, 32,105,103,110,111,\n    114,105,110,103, 34, 41, 10,  9,  9,  9,114,101,116,117,114,\n    110, 32,110,105,108, 10,  9,  9,101,110,100, 10,  9,101,110,\n    100, 10, 10,  9,108,111, 99, 97,108, 32,114,101,102, 32, 61,\n     32, 39, 39, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n    115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,\n    115,116,114,115,117, 98, 40, 97, 44, 50, 44,115,116,114,108,\n    101,110, 40, 97, 41, 45, 49, 41, 44, 39, 44, 39, 41, 32, 45,\n     45, 32,101,108,105,109,105,110, 97,116,101, 32, 98,114, 97,\n     99,101,115, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10,\n     32,108,111, 99, 97,108, 32,108, 32, 61, 32,123,110, 61, 48,\n    125, 10, 32,119,104,105,108,101, 32,116, 91,105, 93, 32,100,\n    111, 10, 32, 32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49,\n     10, 32, 32,108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99,\n    108, 97,114, 97,116,105,111,110, 40,116, 91,105, 93, 44, 39,\n    118, 97,114, 39, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32,101,110,100, 10, 32,105,102, 32,107, 32, 61, 61, 32,\n     39, 91, 93, 39, 32,116,104,101,110, 10,  9, 32,108,111, 99,\n     97,108, 32, 95, 10,  9, 32, 95, 44, 32, 95, 44, 32,114,101,\n    102, 32, 61, 32,115,116,114,102,105,110,100, 40,100, 44, 39,\n     40, 38, 41, 39, 41, 10, 32, 32,100, 32, 61, 32,103,115,117,\n     98, 40,100, 44, 39, 38, 39, 44, 39, 39, 41, 10, 32,101,108,\n    115,101,105,102, 32,107, 61, 61, 39, 38, 91, 93, 39, 32,116,\n    104,101,110, 10, 32, 32,108, 46,110, 32, 61, 32,108, 46,110,\n     43, 49, 10, 32, 32,108, 91,108, 46,110, 93, 32, 61, 32, 68,\n    101, 99,108, 97,114, 97,116,105,111,110, 40,100, 44, 39,118,\n     97,114, 39, 41, 10, 32, 32,108, 91,108, 46,110, 93, 46,110,\n     97,109,101, 32, 61, 32, 39,116,111,108,117, 97, 95,118, 97,\n    108,117,101, 39, 10, 32,101,110,100, 10, 32,108,111, 99, 97,\n    108, 32,102, 32, 61, 32, 68,101, 99,108, 97,114, 97,116,105,\n    111,110, 40,100, 44, 39,102,117,110, 99, 39, 41, 10, 32,105,\n    102, 32,107, 32, 61, 61, 32, 39, 91, 93, 39, 32, 97,110,100,\n     32, 40,108, 91, 49, 93, 61, 61,110,105,108, 32,111,114, 32,\n    105,115, 98, 97,115,105, 99, 40,108, 91, 49, 93, 46,116,121,\n    112,101, 41,126, 61, 39,110,117,109, 98,101,114, 39, 41, 32,\n    116,104,101,110, 10, 32, 32,101,114,114,111,114, 40, 39,111,\n    112,101,114, 97,116,111,114, 91, 93, 32, 99, 97,110, 32,111,\n    110,108,121, 32, 98,101, 32,100,101,102,105,110,101,100, 32,\n    102,111,114, 32,110,117,109,101,114,105, 99, 32,105,110,100,\n    101,120, 46, 39, 41, 10, 32,101,110,100, 10, 32,102, 46, 97,\n    114,103,115, 32, 61, 32,108, 10, 32,102, 46, 99,111,110,115,\n    116, 32, 61, 32, 99, 10, 32,102, 46,107,105,110,100, 32, 61,\n     32,111,112, 95,107, 10, 32,102, 46,108,110, 97,109,101, 32,\n     61, 32, 34, 46, 34, 46, 46, 40, 95, 84, 77, 91,102, 46,107,\n    105,110,100, 93, 32,111,114, 32,102, 46,107,105,110,100, 41,\n     10, 32,105,102, 32,110,111,116, 32, 95, 84, 77, 91,102, 46,\n    107,105,110,100, 93, 32,116,104,101,110, 10, 32,  9,102, 46,\n     99, 97,115,116, 95,111,112,101,114, 97,116,111,114, 32, 61,\n     32,116,114,117,101, 10, 32,101,110,100, 10, 32,105,102, 32,\n    102, 46,107,105,110,100, 32, 61, 61, 32, 39, 91, 93, 39, 32,\n     97,110,100, 32,114,101,102, 61, 61, 39, 38, 39, 32, 97,110,\n    100, 32,102, 46, 99,111,110,115,116,126, 61, 39, 99,111,110,\n    115,116, 39, 32,116,104,101,110, 10, 32, 32, 79,112,101,114,\n     97,116,111,114, 40,100, 44, 39, 38, 39, 46, 46,107, 44, 97,\n     44, 99, 41, 32,  9, 45, 45, 32, 99,114,101, 97,116,101, 32,\n     99,111,114,114,101,115,112,111,100,105,110,103, 32,115,101,\n    116, 32,111,112,101,114, 97,116,111,114, 10, 32,101,110,100,\n     10, 32,114,101,116,117,114,110, 32, 95, 79,112,101,114, 97,\n    116,111,114, 40,102, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/operator.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    10, 95,103,108,111, 98, 97,108, 95,116,101,109,112,108, 97,\n    116,101,115, 32, 61, 32,123,125, 10, 10, 99,108, 97,115,115,\n     84,101,109,112,108, 97,116,101, 67,108, 97,115,115, 32, 61,\n     32,123, 10, 10,  9,110, 97,109,101, 32, 61, 32, 39, 39, 44,\n     10,  9, 98,111,100,121, 32, 61, 32, 39, 39, 44, 10,  9,112,\n     97,114,101,110,116,115, 32, 61, 32,123,125, 44, 10,  9, 97,\n    114,103,115, 32, 61, 32,123,125, 44, 32, 45, 45, 32,116,104,\n    101, 32,116,101,109,112,108, 97,116,101, 32, 97,114,103,117,\n    109,101,110,116,115, 10,125, 10, 10, 99,108, 97,115,115, 84,\n    101,109,112,108, 97,116,101, 67,108, 97,115,115, 46, 95, 95,\n    105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 84,101,\n    109,112,108, 97,116,101, 67,108, 97,115,115, 10, 10, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 84,101,\n    109,112,108, 97,116,101, 67,108, 97,115,115, 58,116,104,114,\n    111,119, 40,116,121,112,101,115, 44, 32,108,111, 99, 97,108,\n     95,115, 99,111,112,101, 41, 10, 10,  9, 45, 45,105,102, 32,\n    116, 97, 98,108,101, 46,103,101,116,110, 40,116,121,112,101,\n    115, 41, 32,126, 61, 32,116, 97, 98,108,101, 46,103,101,116,\n    110, 40,115,101,108,102, 46, 97,114,103,115, 41, 32,116,104,\n    101,110, 10,  9, 45, 45,  9,101,114,114,111,114, 40, 34, 35,\n    105,110,118, 97,108,105,100, 32,112, 97,114, 97,109,101,116,\n    101,114, 32, 99,111,117,110,116, 34, 41, 10,  9, 45, 45,101,\n    110,100, 10, 10,  9, 45, 45, 32,114,101,112,108, 97, 99,101,\n     10,  9,102,111,114, 32,105, 32, 61, 49, 32, 44, 32,116,121,\n    112,101,115, 46,110, 32,100,111, 10, 10,  9,  9,108,111, 99,\n     97,108, 32, 73,108, 32, 61, 32,115,112,108,105,116, 95, 99,\n     95,116,111,107,101,110,115, 40,116,121,112,101,115, 91,105,\n     93, 44, 32, 34, 32, 34, 41, 10,  9,  9,105,102, 32,116, 97,\n     98,108,101, 46,103,101,116,110, 40, 73,108, 41, 32,126, 61,\n     32,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108,\n    102, 46, 97,114,103,115, 41, 32,116,104,101,110, 10,  9,  9,\n      9,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105,\n    100, 32,112, 97,114, 97,109,101,116,101,114, 32, 99,111,117,\n    110,116, 32,102,111,114, 32, 34, 46, 46,116,121,112,101,115,\n     91,105, 93, 41, 10,  9,  9,101,110,100, 10,  9,  9,108,111,\n     99, 97,108, 32, 98, 73, 32, 61, 32,115,101,108,102, 46, 98,\n    111,100,121, 10,  9,  9,108,111, 99, 97,108, 32,112, 73, 32,\n     61, 32,123,125, 10,  9,  9,102,111,114, 32,106, 32, 61, 32,\n     49, 44,115,101,108,102, 46, 97,114,103,115, 46,110, 32,100,\n    111, 10,  9,  9,  9, 45, 45, 84,108, 91,106, 93, 32, 61, 32,\n    102,105,110,100,116,121,112,101, 40, 84,108, 91,106, 93, 41,\n     32,111,114, 32, 84,108, 91,106, 93, 10,  9,  9,  9, 98, 73,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n     98, 73, 44, 32, 34, 40, 91, 94, 95, 37,119, 93, 41, 34, 46,\n     46,115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46,\n     34, 40, 91, 94, 95, 37,119, 93, 41, 34, 44, 32, 34, 37, 49,\n     34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41,\n     10,  9,  9,  9,105,102, 32,115,101,108,102, 46,112, 97,114,\n    101,110,116,115, 32,116,104,101,110, 10,  9,  9,  9,  9,102,\n    111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103,101,\n    116,110, 40,115,101,108,102, 46,112, 97,114,101,110,116,115,\n     41, 32,100,111, 10,  9,  9,  9,  9,  9,112, 73, 91,105, 93,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    115,101,108,102, 46,112, 97,114,101,110,116,115, 91,105, 93,\n     44, 32, 34, 40, 91, 94, 95, 37,119, 93, 63, 41, 34, 46, 46,\n    115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46, 34,\n     40, 91, 94, 95, 37,119, 93, 63, 41, 34, 44, 32, 34, 37, 49,\n     34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41,\n     10,  9,  9,  9,  9,101,110,100, 10,  9,  9,  9,101,110,100,\n     10,  9,  9,101,110,100, 10,  9,  9, 45, 45,108,111, 99, 97,\n    108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34, 46,\n     46,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,121,\n    112,101,115, 91,105, 93, 44, 32, 34, 37,115, 43, 34, 44, 32,\n     34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,  9,108,111, 99,\n     97,108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34,\n     46, 46, 99,111,110, 99, 97,116, 40, 73,108, 44, 32, 49, 44,\n     32,116, 97, 98,108,101, 46,103,101,116,110, 40, 73,108, 41,\n     44, 32, 34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,  9, 97,\n    112,112,101,110,100, 32, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32, 34, 37,\n    115, 42, 44, 37,115, 42, 34, 44, 32, 34, 44, 34, 41, 10,  9,\n      9, 97,112,112,101,110,100, 32, 61, 32,115,116,114,105,110,\n    103, 46,103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32,\n     34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10,  9,  9,\n    102,111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103,\n    101,116,110, 40,112, 73, 41, 32,100,111, 10,  9,  9,  9, 45,\n     45,112, 73, 91,105, 93, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,112, 73, 91,105, 93, 44, 32, 34, 62,\n     62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10,  9,  9,  9,112,\n     73, 91,105, 93, 32, 61, 32,114,101,115,111,108,118,101, 95,\n    116,101,109,112,108, 97,116,101, 95,116,121,112,101,115, 40,\n    112, 73, 91,105, 93, 41, 10,  9,  9,101,110,100, 10,  9,  9,\n     98, 73, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40, 98, 73, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32,\n     62, 34, 41, 10,  9,  9,108,111, 99, 97,108, 32,110, 32, 61,\n     32,115,101,108,102, 46,110, 97,109,101, 10,  9,  9,105,102,\n     32,108,111, 99, 97,108, 95,115, 99,111,112,101, 32,116,104,\n    101,110, 10,  9,  9,  9,110, 32, 61, 32,115,101,108,102, 46,\n    108,111, 99, 97,108, 95,110, 97,109,101, 10,  9,  9,101,110,\n    100, 10, 10,  9,  9, 67,108, 97,115,115, 40,110, 46, 46, 97,\n    112,112,101,110,100, 44, 32,112, 73, 44, 32, 98, 73, 41, 10,\n      9,101,110,100, 10,101,110,100, 10, 10, 10,102,117,110, 99,\n    116,105,111,110, 32, 84,101,109,112,108, 97,116,101, 67,108,\n     97,115,115, 40,110, 97,109,101, 44, 32,112, 97,114,101,110,\n    116,115, 44, 32, 98,111,100,121, 44, 32,112, 97,114, 97,109,\n    101,116,101,114,115, 41, 10, 10,  9,108,111, 99, 97,108, 32,\n    111, 32, 61, 32,123, 10,  9, 10,  9,  9,112, 97,114,101,110,\n    116,115, 32, 61, 32,112, 97,114,101,110,116,115, 44, 10,  9,\n      9, 98,111,100,121, 32, 61, 32, 98,111,100,121, 44, 10,  9,\n      9, 97,114,103,115, 32, 61, 32,112, 97,114, 97,109,101,116,\n    101,114,115, 44, 10,  9,125, 10,  9, 10,  9,108,111, 99, 97,\n    108, 32,111,110, 97,109,101, 32, 61, 32,115,116,114,105,110,\n    103, 46,103,115,117, 98, 40,110, 97,109,101, 44, 32, 34, 64,\n     46, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,111,110, 97,109,\n    101, 32, 61, 32,103,101,116,110, 97,109,101,115,112, 97, 99,\n    101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 46, 99,117,114,114, 41, 46, 46,111,110, 97,109,101, 10,\n      9,111, 46,110, 97,109,101, 32, 61, 32,111,110, 97,109,101,\n     10, 10,  9,111, 46,108,111, 99, 97,108, 95,110, 97,109,101,\n     32, 61, 32,110, 97,109,101, 10,  9, 10,  9,115,101,116,109,\n    101,116, 97,116, 97, 98,108,101, 40,111, 44, 32, 99,108, 97,\n    115,115, 84,101,109,112,108, 97,116,101, 67,108, 97,115,115,\n     41, 10, 10,  9,105,102, 32, 95,103,108,111, 98, 97,108, 95,\n    116,101,109,112,108, 97,116,101,115, 91,111,110, 97,109,101,\n     93, 32,116,104,101,110, 10,  9,  9,119, 97,114,110,105,110,\n    103, 40, 34, 68,117,112,108,105, 99, 97,116,101, 32,100,101,\n     99,108, 97,114, 97,116,105,111,110, 32,111,102, 32,116,101,\n    109,112,108, 97,116,101, 32, 34, 46, 46,111,110, 97,109,101,\n     41, 10,  9,101,108,115,101, 10,  9,  9, 95,103,108,111, 98,\n     97,108, 95,116,101,109,112,108, 97,116,101,115, 91,111,110,\n     97,109,101, 93, 32, 61, 32,111, 10,  9,101,110,100, 10, 10,\n      9,114,101,116,117,114,110, 32,111, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/template_class.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 99,108, 97,115,115,\n     32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,\n    101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32,\n     67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,\n    102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,\n    108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32,\n     36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101,\n     32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,\n    114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,\n    105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,\n    100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46,\n     10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,\n    101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,101,\n    117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32,\n     34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32,\n     97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,\n    111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103,\n     97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,\n    101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,\n    115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,\n    115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,\n    110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99,\n     97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 67,108,\n     97,115,115, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,\n    112,114,101,115,101,110,116,115, 32, 97, 32, 99,108, 97,115,\n    115, 32,100,101,102,105,110,105,116,105,111,110, 46, 10, 45,\n     45, 32, 83,116,111,114,101,115, 32,116,104,101, 32,102,111,\n    108,108,111,119,105,110,103, 32,102,105,101,108,100,115, 58,\n     10, 45, 45, 32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,\n    108, 97,115,115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32,\n     32, 98, 97,115,101, 32, 61, 32, 99,108, 97,115,115, 32, 98,\n     97,115,101, 44, 32,105,102, 32, 97,110,121, 32, 40,111,110,\n    108,121, 32,115,105,110,103,108,101, 32,105,110,104,101,114,\n    105,116, 97,110, 99,101, 32,105,115, 32,115,117,112,112,111,\n    114,116,101,100, 41, 10, 45, 45, 32, 32, 32, 32,123,105,125,\n     32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,109,\n     98,101,114,115, 10, 99,108, 97,115,115, 67,108, 97,115,115,\n     32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,112,101,\n     32, 61, 32, 39, 99,108, 97,115,115, 39, 44, 10, 32,110, 97,\n    109,101, 32, 61, 32, 39, 39, 44, 10, 32, 98, 97,115,101, 32,\n     61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39,\n     39, 44, 10, 32, 98,116,121,112,101, 32, 61, 32, 39, 39, 44,\n     10, 32, 99,116,121,112,101, 32, 61, 32, 39, 39, 44, 10,125,\n     10, 99,108, 97,115,115, 67,108, 97,115,115, 46, 95, 95,105,\n    110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,108, 97,\n    115,115, 10,115,101,116,109,101,116, 97,116, 97, 98,108,101,\n     40, 99,108, 97,115,115, 67,108, 97,115,115, 44, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 41, 10, 10, 10,\n     45, 45, 32,114,101,103,105,115,116,101,114, 32, 99,108, 97,\n    115,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,108, 97,115,115, 58,114,101,103,105,115,116,101,\n    114, 32, 40,112,114,101, 41, 10, 10,  9,105,102, 32,110,111,\n    116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117,\n     98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,\n    104,101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,\n    110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32,\n    111,114, 32, 39, 39, 10, 32,112,117,115,104, 40,115,101,108,\n    102, 41, 10,  9,105,102, 32, 95, 99,111,108,108,101, 99,116,\n     91,115,101,108,102, 46,116,121,112,101, 93, 32,116,104,101,\n    110, 10,  9,  9,111,117,116,112,117,116, 40,112,114,101, 44,\n     39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,115,\n    112,108,117,115, 92,110, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,\n     99, 99,108, 97,115,115, 40,116,111,108,117, 97, 95, 83, 44,\n     34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46,\n     46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46,116,121,\n    112,101, 46, 46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102,\n     46, 98,116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46, 95,\n     99,111,108,108,101, 99,116, 91,115,101,108,102, 46,116,121,\n    112,101, 93, 46, 46, 39, 41, 59, 39, 41, 10,  9,  9,111,117,\n    116,112,117,116, 40,112,114,101, 44, 39, 35,101,108,115,101,\n     92,110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,112,\n    114,101, 46, 46, 39,116,111,108,117, 97, 95, 99, 99,108, 97,\n    115,115, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,\n    115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44,\n     34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, 46, 46,\n     39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46, 98,116,121,\n    112,101, 46, 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40,112,114,101, 44, 39,\n     35,101,110,100,105,102, 92,110, 39, 41, 10,  9,101,108,115,\n    101, 10, 32, 32,111,117,116,112,117,116, 40,112,114,101, 46,\n     46, 39,116,111,108,117, 97, 95, 99, 99,108, 97,115,115, 40,\n    116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,\n    102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 34, 39, 46,\n     46,115,101,108,102, 46,116,121,112,101, 46, 46, 39, 34, 44,\n     34, 39, 46, 46,115,101,108,102, 46, 98,116,121,112,101, 46,\n     46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10,  9,101,\n    110,100, 10,  9,105,102, 32,115,101,108,102, 46,101,120,116,\n    114, 97, 95, 98, 97,115,101,115, 32,116,104,101,110, 10,  9,\n      9,102,111,114, 32,107, 44, 98, 97,115,101, 32,105,110, 32,\n    105,112, 97,105,114,115, 40,115,101,108,102, 46,101,120,116,\n    114, 97, 95, 98, 97,115,101,115, 41, 32,100,111, 10,  9,  9,\n      9, 45, 45, 32,110,111,116, 32,110,111,119, 10, 32, 32, 32,\n     45, 45,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,\n     32,116,111,108,117, 97, 95, 97,100,100, 98, 97,115,101, 40,\n    116,111,108,117, 97, 95, 83, 44, 32, 34, 39, 46, 46,115,101,\n    108,102, 46,116,121,112,101, 46, 46, 39, 34, 44, 32, 34, 39,\n     46, 46, 98, 97,115,101, 46, 46, 39, 34, 41, 59, 39, 41, 10,\n      9,  9,101,110,100, 10,  9,101,110,100, 10, 32,111,117,116,\n    112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97,\n     95, 98,101,103,105,110,109,111,100,117,108,101, 40,116,111,\n    108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,\n    108,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,\n    101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,\n    115,101,108,102, 91,105, 93, 58,114,101,103,105,115,116,101,\n    114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32, 32,105,\n     32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,111,117,\n    116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117,\n     97, 95,101,110,100,109,111,100,117,108,101, 40,116,111,108,\n    117, 97, 95, 83, 41, 59, 39, 41, 10,  9,112,111,112, 40, 41,\n     10,101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110,\n     32, 99,111,108,108,101, 99,116,105,111,110, 32,114,101,113,\n    117,105,114,101,109,101,110,116, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58,114,\n    101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,\n    110, 32, 40,116, 41, 10,  9,105,102, 32,115,101,108,102, 46,\n    102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101,100,\n     95,100,101,115,116,114,117, 99,116,111,114, 32,111,114, 32,\n     40,110,111,116, 32,115,101,108,102, 58, 99,104,101, 99,107,\n     95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40,\n     41, 41, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,\n    110, 32,102, 97,108,115,101, 10,  9,101,110,100, 10, 32,112,\n    117,115,104, 40,115,101,108,102, 41, 10,  9,108,111, 99, 97,\n    108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,108,111,\n     99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,\n    115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,114, 32,\n     61, 32,115,101,108,102, 91,105, 93, 58,114,101,113,117,105,\n    114,101, 99,111,108,108,101, 99,116,105,111,110, 40,116, 41,\n     32,111,114, 32,114, 10, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32,101,110,100, 10,  9,112,111,112, 40, 41, 10,  9, 45,\n     45, 32,111,110,108,121, 32, 99,108, 97,115,115, 32,116,104,\n     97,116, 32,101,120,112,111,114,116,115, 32,100,101,115,116,\n    114,117, 99,116,111,114, 32, 99, 97,110, 32, 98,101, 32, 97,\n    112,112,114,111,112,114,105, 97,116,101,108,121, 32, 99,111,\n    108,108,101, 99,116,101,100, 10,  9, 45, 45, 32, 99,108, 97,\n    115,115,101,115, 32,116,104, 97,116, 32,101,120,112,111,114,\n    116, 32, 99,111,110,115,116,114,117, 99,116,111,114,115, 32,\n    110,101,101,100, 32,116,111, 32,104, 97,118,101, 32, 97, 32,\n     99,111,108,108,101, 99,116,111,114, 32, 40,111,118,101,114,\n    114,105,100,101,100, 32, 98,121, 32, 45, 68, 32,102,108, 97,\n    103, 32,111,110, 32, 99,111,109,109, 97,110,100, 32,108,105,\n    110,101, 41, 10,  9,105,102, 32,115,101,108,102, 46, 95,100,\n    101,108,101,116,101, 32,111,114, 32, 40, 40,110,111,116, 32,\n    102,108, 97,103,115, 91, 39, 68, 39, 93, 41, 32, 97,110,100,\n     32,115,101,108,102, 46, 95,110,101,119, 41, 32,116,104,101,\n    110, 10,  9,  9, 45, 45,116, 91,115,101,108,102, 46,116,121,\n    112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95, 99,111,\n    108,108,101, 99,116, 95, 34, 32, 46, 46, 32,103,115,117, 98,\n     40,115,101,108,102, 46,116,121,112,101, 44, 34, 58, 58, 34,\n     44, 34, 95, 34, 41, 10,  9,  9,116, 91,115,101,108,102, 46,\n    116,121,112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95,\n     99,111,108,108,101, 99,116, 95, 34, 32, 46, 46, 32, 99,108,\n    101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 10,  9,  9,114, 32, 61, 32,\n    116,114,117,101, 10,  9,101,110,100, 10, 32,114,101,116,117,\n    114,110, 32,114, 10,101,110,100, 10, 10, 45, 45, 32,111,117,\n    116,112,117,116, 32,116, 97,103,115, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58,\n    100,101, 99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117,\n    115,104, 40,115,101,108,102, 41, 10,  9,115,101,108,102, 46,\n    116,121,112,101, 32, 61, 32,114,101,103,116,121,112,101, 40,\n    115,101,108,102, 46,111,114,105,103,105,110, 97,108, 95,110,\n     97,109,101, 32,111,114, 32,115,101,108,102, 46,110, 97,109,\n    101, 41, 10,  9,115,101,108,102, 46, 98,116,121,112,101, 32,\n     61, 32,116,121,112,101,118, 97,114, 40,115,101,108,102, 46,\n     98, 97,115,101, 41, 10,  9,115,101,108,102, 46, 99,116,121,\n    112,101, 32, 61, 32, 39, 99,111,110,115,116, 32, 39, 46, 46,\n    115,101,108,102, 46,116,121,112,101, 10,  9,105,102, 32,115,\n    101,108,102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115,\n     32,116,104,101,110, 10,  9,  9,102,111,114, 32,105, 61, 49,\n     44,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108,\n    102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115, 41, 32,\n    100,111, 10,  9,  9,  9,115,101,108,102, 46,101,120,116,114,\n     97, 95, 98, 97,115,101,115, 91,105, 93, 32, 61, 32,116,121,\n    112,101,118, 97,114, 40,115,101,108,102, 46,101,120,116,114,\n     97, 95, 98, 97,115,101,115, 91,105, 93, 41, 10,  9,  9,101,\n    110,100, 10,  9,101,110,100, 10, 32,108,111, 99, 97,108, 32,\n    105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102,\n     91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105,\n     93, 58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32,\n    105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,  9,112,\n    111,112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,\n    114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115,\n    115, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, 44,\n     99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,\n    100,101,110,116, 46, 46, 34, 67,108, 97,115,115,123, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32, 98, 97,115,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46, 98, 97,115,101, 46, 46, 34, 39, 59, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n     98,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46, 98,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32, 99,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46, 99,116,121,112,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,\n     32, 32,115,101,108,102, 91,105, 93, 58,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34,\n     41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,\n    100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,\n    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,108, 97,115,115, 58,115,101,116, 95,112,114,111,\n    116,101, 99,116,101,100, 95,100,101,115,116,114,117, 99,116,\n    111,114, 40,112, 41, 10,  9,115,101,108,102, 46,102,108, 97,\n    103,115, 46,112,114,111,116,101, 99,116,101,100, 95,100,101,\n    115,116,114,117, 99,116,111,114, 32, 61, 32,115,101,108,102,\n     46,102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101,\n    100, 95,100,101,115,116,114,117, 99,116,111,114, 32,111,114,\n     32,112, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101,\n    114,110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,\n    114, 10,102,117,110, 99,116,105,111,110, 32, 95, 67,108, 97,\n    115,115, 32, 40,116, 41, 10, 32,115,101,116,109,101,116, 97,\n    116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 67,108,\n     97,115,115, 41, 10, 32,116, 58, 98,117,105,108,100,110, 97,\n    109,101,115, 40, 41, 10, 32, 97,112,112,101,110,100, 40,116,\n     41, 10, 32,114,101,116,117,114,110, 32,116, 10,101,110,100,\n     10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,\n    114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,\n    101, 32,110, 97,109,101, 44, 32,116,104,101, 32, 98, 97,115,\n    101, 32, 40, 97,114,114, 97,121, 41, 32, 97,110,100, 32,116,\n    104,101, 32, 98,111,100,121, 32,111,102, 32,116,104,101, 32,\n     99,108, 97,115,115, 46, 10,102,117,110, 99,116,105,111,110,\n     32, 67,108, 97,115,115, 32, 40,110, 44,112, 44, 98, 41, 10,\n     10,  9,105,102, 32,116, 97, 98,108,101, 46,103,101,116,110,\n     40,112, 41, 32, 62, 32, 49, 32,116,104,101,110, 10,  9,  9,\n     98, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,\n     98, 44, 32, 49, 44, 32, 45, 50, 41, 10,  9,  9,102,111,114,\n     32,105, 61, 50, 44,116, 97, 98,108,101, 46,103,101,116,110,\n     40,112, 41, 44, 49, 32,100,111, 10,  9,  9,  9, 98, 32, 61,\n     32, 98, 46, 46, 34, 92,110, 32,116,111,108,117, 97, 95,105,\n    110,104,101,114,105,116,115, 32, 34, 46, 46,112, 91,105, 93,\n     46, 46, 34, 32, 95, 95, 34, 46, 46,112, 91,105, 93, 46, 46,\n     34, 95, 95, 59, 92,110, 34, 10,  9,  9,101,110,100, 10,  9,\n      9, 98, 32, 61, 32, 98, 46, 46, 34, 92,110,125, 34, 10,  9,\n    101,110,100, 10, 10,  9, 45, 45, 32, 99,104,101, 99,107, 32,\n    102,111,114, 32,116,101,109,112,108, 97,116,101, 10,  9, 98,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n     98, 44, 32, 34, 94,123, 37,115, 42, 84, 69, 77, 80, 76, 65,\n     84, 69, 95, 66, 73, 78, 68, 34, 44, 32, 34,123, 92,110, 84,\n     79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66,\n     73, 78, 68, 34, 41, 10,  9,108,111, 99, 97,108, 32,116, 44,\n     95, 44, 84, 44, 73, 32, 61, 32,115,116,114,105,110,103, 46,\n    102,105,110,100, 40, 98, 44, 32, 39, 94,123, 37,115, 42, 84,\n     79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66,\n     73, 78, 68, 37,115, 42, 37, 40, 43, 37,115, 42, 92, 34, 63,\n     40, 91, 94, 92, 34, 44, 93, 42, 41, 92, 34, 63, 37,115, 42,\n     44, 37,115, 42, 40, 91, 94, 37, 41, 93, 42, 41, 37,115, 42,\n     37, 41, 43, 39, 41, 10,  9,105,102, 32,116, 32,116,104,101,\n    110, 10, 10,  9,  9, 45, 45, 32,114,101,109,111,118,101, 32,\n    113,117,111,116,101,115, 10,  9,  9, 73, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40, 73, 44, 32, 34, 92,\n     34, 34, 44, 32, 34, 34, 41, 10,  9,  9, 84, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40, 84, 44, 32, 34,\n     92, 34, 34, 44, 32, 34, 34, 41, 10,  9,  9, 45, 45, 32,103,\n    101,116, 32,116,121,112,101, 32,108,105,115,116, 10,  9,  9,\n    108,111, 99, 97,108, 32,116,121,112,101,115, 32, 61, 32,115,\n    112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, 73,\n     44, 32, 34, 44, 34, 41, 10,  9,  9, 45, 45, 32,114,101,109,\n    111,118,101, 32, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73,\n     78, 68, 32,108,105,110,101, 10,  9,  9,108,111, 99, 97,108,\n     32, 98,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 40, 98, 44, 32, 34, 94,123, 37,115, 42, 84, 79, 76,\n     85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73, 78,\n     68, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34,123, 92,\n    110, 34, 41, 10,  9,  9,  9, 10,  9,  9,108,111, 99, 97,108,\n     32, 84,108, 32, 61, 32,115,112,108,105,116, 40, 84, 44, 32,\n     34, 32, 34, 41, 10,  9,  9,108,111, 99, 97,108, 32,116, 99,\n     32, 61, 32, 84,101,109,112,108, 97,116,101, 67,108, 97,115,\n    115, 40,110, 44, 32,112, 44, 32, 98,115, 44, 32, 84,108, 41,\n     10, 10,  9,  9, 10,  9,  9,116, 99, 58,116,104,114,111,119,\n     40,116,121,112,101,115, 44, 32,116,114,117,101, 41, 10,  9,\n      9, 45, 45,102,111,114, 32,105, 61, 49, 44,116,121,112,101,\n    115, 46,110, 32,100,111, 10,  9,  9, 45, 45,  9,116, 99, 58,\n    116,104,114,111,119, 40,115,112,108,105,116, 95, 99, 95,116,\n    111,107,101,110,115, 40,116,121,112,101,115, 91,105, 93, 44,\n     32, 34, 32, 34, 41, 44, 32,116,114,117,101, 41, 10,  9,  9,\n     45, 45,101,110,100, 10,  9,  9,114,101,116,117,114,110, 10,\n      9,101,110,100, 10,  9, 10,  9,108,111, 99, 97,108, 32,109,\n     98, 97,115,101, 10, 10,  9,105,102, 32,112, 32,116,104,101,\n    110, 10,  9,  9,109, 98, 97,115,101, 32, 61, 32,116, 97, 98,\n    108,101, 46,114,101,109,111,118,101, 40,112, 44, 32, 49, 41,\n     10,  9,  9,105,102, 32,110,111,116, 32,112, 91, 49, 93, 32,\n    116,104,101,110, 32,112, 32, 61, 32,110,105,108, 32,101,110,\n    100, 10,  9,101,110,100, 10, 10,  9,109, 98, 97,115,101, 32,\n     61, 32,109, 98, 97,115,101, 32, 97,110,100, 32,114,101,115,\n    111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,116,\n    121,112,101,115, 40,109, 98, 97,115,101, 41, 10, 10,  9,108,\n    111, 99, 97,108, 32, 99, 10,  9,108,111, 99, 97,108, 32,111,\n    110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46,103,\n    115,117, 98, 40,110, 44, 32, 34, 64, 46, 42, 36, 34, 44, 32,\n     34, 34, 41, 10,  9,111,110, 97,109,101, 32, 61, 32,103,101,\n    116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,\n     41, 46, 46,111,110, 97,109,101, 10, 10,  9,105,102, 32, 95,\n    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,\n    111,110, 97,109,101, 93, 32,116,104,101,110, 10,  9,  9, 99,\n     32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,\n    115,101,115, 91,111,110, 97,109,101, 93, 10,  9,  9,105,102,\n     32,109, 98, 97,115,101, 32, 97,110,100, 32, 40, 40,110,111,\n    116, 32, 99, 46, 98, 97,115,101, 41, 32,111,114, 32, 99, 46,\n     98, 97,115,101, 32, 61, 61, 32, 34, 34, 41, 32,116,104,101,\n    110, 10,  9,  9,  9, 99, 46, 98, 97,115,101, 32, 61, 32,109,\n     98, 97,115,101, 10,  9,  9,101,110,100, 10,  9,101,108,115,\n    101, 10,  9,  9, 99, 32, 61, 32, 95, 67,108, 97,115,115, 40,\n     95, 67,111,110,116, 97,105,110,101,114,123,110, 97,109,101,\n     61,110, 44, 32, 98, 97,115,101, 61,109, 98, 97,115,101, 44,\n     32,101,120,116,114, 97, 95, 98, 97,115,101,115, 61,112,125,\n     41, 10, 10,  9,  9,108,111, 99, 97,108, 32,102,116, 32, 61,\n     32,103,101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99,\n     46,112, 97,114,101,110,116, 41, 46, 46, 99, 46,111,114,105,\n    103,105,110, 97,108, 95,110, 97,109,101, 10,  9,  9, 97,112,\n    112,101,110,100, 95,103,108,111, 98, 97,108, 95,116,121,112,\n    101, 40,102,116, 44, 32, 99, 41, 10,  9,101,110,100, 10, 10,\n      9,112,117,115,104, 40, 99, 41, 10,  9, 99, 58,112, 97,114,\n    115,101, 40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115,\n    116,114,108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45,\n     32,101,108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,\n    101,115, 10,  9,112,111,112, 40, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/class.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,109, 97,114,107, 32,117,112, 32, 99,111,109,109,\n    101,110,116,115, 32, 97,110,100, 32,115,116,114,105,110,103,\n    115, 10, 83, 84, 82, 49, 32, 61, 32, 34, 92, 48, 48, 49, 34,\n     10, 83, 84, 82, 50, 32, 61, 32, 34, 92, 48, 48, 50, 34, 10,\n     83, 84, 82, 51, 32, 61, 32, 34, 92, 48, 48, 51, 34, 10, 83,\n     84, 82, 52, 32, 61, 32, 34, 92, 48, 48, 52, 34, 10, 82, 69,\n     77, 32, 32, 61, 32, 34, 92, 48, 48, 53, 34, 10, 65, 78, 89,\n     32, 32, 61, 32, 34, 40, 91, 92, 48, 48, 49, 45, 92, 48, 48,\n     53, 93, 41, 34, 10, 69, 83, 67, 49, 32, 61, 32, 34, 92, 48,\n     48, 54, 34, 10, 69, 83, 67, 50, 32, 61, 32, 34, 92, 48, 48,\n     55, 34, 10, 10, 77, 65, 83, 75, 32, 61, 32,123, 32, 45, 45,\n     32,116,104,101, 32,115,117, 98,115,116,105,116,117,116,105,\n    111,110, 32,111,114,100,101,114, 32,105,115, 32,105,109,112,\n    111,114,116, 97,110,116, 10, 32,123, 69, 83, 67, 49, 44, 32,\n     34, 92, 92, 39, 34,125, 44, 10, 32,123, 69, 83, 67, 50, 44,\n     32, 39, 92, 92, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 49,\n     44, 32, 34, 39, 34,125, 44, 10, 32,123, 83, 84, 82, 50, 44,\n     32, 39, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 51, 44, 32,\n     34, 37, 91, 37, 91, 34,125, 44, 10, 32,123, 83, 84, 82, 52,\n     44, 32, 34, 37, 93, 37, 93, 34,125, 44, 10, 32,123, 82, 69,\n     77, 32, 44, 32, 34, 37, 45, 37, 45, 34,125, 44, 10,125, 10,\n     10,102,117,110, 99,116,105,111,110, 32,109, 97,115,107, 32,\n     40,115, 41, 10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,\n    103,101,116,110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10,\n     32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65,\n     83, 75, 91,105, 93, 91, 50, 93, 44, 77, 65, 83, 75, 91,105,\n     93, 91, 49, 93, 41, 10, 32,101,110,100, 10, 32,114,101,116,\n    117,114,110, 32,115, 10,101,110,100, 10, 10,102,117,110, 99,\n    116,105,111,110, 32,117,110,109, 97,115,107, 32, 40,115, 41,\n     10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,103,101,116,\n    110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10, 32, 32,115,\n     32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65, 83, 75, 91,\n    105, 93, 91, 49, 93, 44, 77, 65, 83, 75, 91,105, 93, 91, 50,\n     93, 41, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110,\n     32,115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108,101, 97,110, 32, 40,115, 41, 10, 32, 45, 45,\n     32, 99,104,101, 99,107, 32,102,111,114, 32, 99,111,109,112,\n    105,108, 97,116,105,111,110, 32,101,114,114,111,114, 10, 32,\n    108,111, 99, 97,108, 32, 99,111,100,101, 32, 61, 32, 34,114,\n    101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 32,\n     40, 41, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34,\n     92,110, 32,101,110,100, 34, 10, 32,105,102, 32,110,111,116,\n     32,100,111,115,116,114,105,110,103, 40, 99,111,100,101, 41,\n     32,116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32,\n    110,105,108, 10, 32,101,110,100, 10, 10, 32,105,102, 32,102,\n    108, 97,103,115, 91, 39, 67, 39, 93, 32,116,104,101,110, 10,\n     32,  9,114,101,116,117,114,110, 32,115, 10, 32,101,110,100,\n     10, 10, 32,108,111, 99, 97,108, 32, 83, 32, 61, 32, 34, 34,\n     32, 45, 45, 32,115, 97,118,101,100, 32,115,116,114,105,110,\n    103, 10, 10, 32,115, 32, 61, 32,109, 97,115,107, 40,115, 41,\n     10, 10, 32, 45, 45, 32,114,101,109,111,118,101, 32, 98,108,\n     97,110,107,115, 32, 97,110,100, 32, 99,111,109,109,101,110,\n    116,115, 10, 32,119,104,105,108,101, 32, 49, 32,100,111, 10,\n     32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 65, 78, 89, 41,\n     10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32,\n     32, 83, 32, 61, 32, 83, 46, 46,115,116,114,115,117, 98, 40,\n    115, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32, 32,115, 32, 61,\n     32,115,116,114,115,117, 98, 40,115, 44, 98, 43, 49, 41, 10,\n     32, 32, 32,105,102, 32,100, 61, 61, 83, 84, 82, 49, 32,111,\n    114, 32,100, 61, 61, 83, 84, 82, 50, 32,116,104,101,110, 10,\n     32, 32, 32, 32,101, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44,100, 41, 10, 32, 32, 32, 32, 83, 32, 61, 32, 83,\n     32, 46, 46,100, 46, 46,115,116,114,115,117, 98, 40,115, 44,\n     49, 44,101, 41, 10, 32, 32, 32, 32,115, 32, 61, 32,115,116,\n    114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32, 32,\n    101,108,115,101,105,102, 32,100, 61, 61, 83, 84, 82, 51, 32,\n    116,104,101,110, 10, 32, 32, 32, 32,101, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 83, 84, 82, 52, 41, 10, 32,\n     32, 32, 32, 83, 32, 61, 32, 83, 46, 46,100, 46, 46,115,116,\n    114,115,117, 98, 40,115, 44, 49, 44,101, 41, 10, 32, 32, 32,\n     32,115, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,101,\n     43, 49, 41, 10, 32, 32, 32,101,108,115,101,105,102, 32,100,\n     61, 61, 82, 69, 77, 32,116,104,101,110, 10, 32, 32, 32, 32,\n    115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 91, 94, 92,\n    110, 93, 42, 40, 92,110, 63, 41, 34, 44, 34, 37, 49, 34, 44,\n     49, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,108,115,\n    101, 10, 32, 32, 32, 83, 32, 61, 32, 83, 46, 46,115, 10, 32,\n     32, 32, 98,114,101, 97,107, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 32, 45, 45, 32,101,108,105,109,105,110, 97,\n    116,101, 32,117,110,101, 99,101,115,115, 97,114,121, 32,115,\n    112, 97, 99,101,115, 10, 32, 83, 32, 61, 32,103,115,117, 98,\n     40, 83, 44, 34, 91, 32, 92,116, 93, 43, 34, 44, 34, 32, 34,\n     41, 10, 32, 83, 32, 61, 32,103,115,117, 98, 40, 83, 44, 34,\n     91, 32, 92,116, 93, 42, 92,110, 91, 32, 92,116, 93, 42, 34,\n     44, 34, 92,110, 34, 41, 10,  9, 83, 32, 61, 32,103,115,117,\n     98, 40, 83, 44, 34, 92,110, 43, 34, 44, 34, 92,110, 34, 41,\n     10, 32, 83, 32, 61, 32,117,110,109, 97,115,107, 40, 83, 41,\n     10, 32,114,101,116,117,114,110, 32, 83, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/clean.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32, 71,101,110,101,114, 97,116,101, 32, 98,105,110,\n    100,105,110,103, 32, 99,111,100,101, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 76, 97,\n    115,116, 32,117,112,100, 97,116,101, 58, 32, 65,112,114, 32,\n     50, 48, 48, 51, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10,\n     10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,\n    105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,\n    101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,\n    115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100,\n     47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10,\n     45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101,\n     32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117,\n    110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34,\n     97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,\n    110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,\n    114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,\n    116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101,\n     32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,\n    117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115,\n     44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,\n    116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,\n    116,105,111,110,115, 46, 10, 10,102,117,110, 99,116,105,111,\n    110, 32,112, 97,114,115,101, 95,101,120,116,114, 97, 40, 41,\n     10, 10,  9,102,111,114, 32,107, 44,118, 32,105,110, 32,105,\n    112, 97,105,114,115, 40, 95,101,120,116,114, 97, 95,112, 97,\n    114, 97,109,101,116,101,114,115, 32,111,114, 32,123,125, 41,\n     32,100,111, 10,  9,  9, 10,  9,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 44,110, 97,109,101, 44,118, 97,108,117,101, 32,\n     61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,118,\n     44, 32, 34, 94, 40, 91, 94, 61, 93, 42, 41, 61, 40, 46, 42,\n     41, 36, 34, 41, 10,  9,  9,105,102, 32, 98, 32,116,104,101,\n    110, 10,  9,  9,  9, 95,101,120,116,114, 97, 95,112, 97,114,\n     97,109,101,116,101,114,115, 91,110, 97,109,101, 93, 32, 61,\n     32,118, 97,108,117,101, 10,  9,  9,101,108,115,101, 10,  9,\n      9,  9, 95,101,120,116,114, 97, 95,112, 97,114, 97,109,101,\n    116,101,114,115, 91,118, 93, 32, 61, 32,116,114,117,101, 10,\n      9,  9,101,110,100, 10,  9,101,110,100, 10,101,110,100, 10,\n     10,102,117,110, 99,116,105,111,110, 32,100,111,105,116, 32,\n     40, 41, 10,  9, 45, 45, 32,100,101,102,105,110,101, 32,112,\n     97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,105,102,\n     32,110,111,116, 32,112,114,111,118,105,100,101,100, 10,  9,\n    105,102, 32,110,111,116, 32,102,108, 97,103,115, 46,110, 32,\n    116,104,101,110, 10,  9,  9,105,102, 32,102,108, 97,103,115,\n     46,102, 32,116,104,101,110, 10,  9,  9,  9,102,108, 97,103,\n    115, 46,110, 32, 61, 32,103,115,117, 98, 40,102,108, 97,103,\n    115, 46,102, 44, 34, 37, 46, 46, 42, 36, 34, 44, 34, 34, 41,\n     10,  9,  9,  9, 95, 44, 95, 44,102,108, 97,103,115, 46,110,\n     32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    102,108, 97,103,115, 46,110, 44, 32, 34, 40, 91, 94, 47, 92,\n     92, 93, 42, 41, 36, 34, 41, 10,  9,  9,101,108,115,101, 10,\n      9,  9,  9,101,114,114,111,114, 40, 34, 35,110,111, 32,112,\n     97, 99,107, 97,103,101, 32,110, 97,109,101, 32,110,111,114,\n     32,105,110,112,117,116, 32,102,105,108,101, 32,112,114,111,\n    118,105,100,101,100, 34, 41, 10,  9,  9,101,110,100, 10,  9,\n    101,110,100, 10, 10,  9, 45, 45, 32,112, 97,114,115,101, 32,\n    116, 97, 98,108,101, 32,119,105,116,104, 32,101,120,116,114,\n     97, 32,112, 97,114, 97,109,116,101,114,115, 10,  9,112, 97,\n    114,115,101, 95,101,120,116,114, 97, 40, 41, 10, 10,  9, 45,\n     45, 32,100,111, 32,116,104,105,115, 32, 97,102,116,101,114,\n     32,115,101,116,116,105,110,103, 32,116,104,101, 32,112, 97,\n     99,107, 97,103,101, 32,110, 97,109,101, 10,  9,105,102, 32,\n    102,108, 97,103,115, 91, 39, 76, 39, 93, 32,116,104,101,110,\n     10,  9,  9,100,111,102,105,108,101, 40,102,108, 97,103,115,\n     91, 39, 76, 39, 93, 41, 10,  9,101,110,100, 10, 10,  9, 45,\n     45, 32, 97,100,100, 32, 99,112,112,115,116,114,105,110,103,\n     10,  9,105,102, 32,110,111,116, 32,102,108, 97,103,115, 91,\n     39, 83, 39, 93, 32,116,104,101,110, 10,  9,  9, 95, 98, 97,\n    115,105, 99, 91, 39,115,116,114,105,110,103, 39, 93, 32, 61,\n     32, 39, 99,112,112,115,116,114,105,110,103, 39, 10,  9,  9,\n     95, 98, 97,115,105, 99, 91, 39,115,116,100, 58, 58,115,116,\n    114,105,110,103, 39, 93, 32, 61, 32, 39, 99,112,112,115,116,\n    114,105,110,103, 39, 10,  9,  9, 95, 98, 97,115,105, 99, 95,\n     99,116,121,112,101, 46, 99,112,112,115,116,114,105,110,103,\n     32, 61, 32, 39, 99,111,110,115,116, 32, 99,104, 97,114, 42,\n     39, 10,  9,101,110,100, 10, 10,  9, 45, 45, 32,112,114,111,\n     99, 99,101,115,115, 32,112, 97, 99,107, 97,103,101, 10,  9,\n    108,111, 99, 97,108, 32,112, 32, 32, 61, 32, 80, 97, 99,107,\n     97,103,101, 40,102,108, 97,103,115, 46,110, 44,102,108, 97,\n    103,115, 46,102, 41, 10, 10,  9,105,102, 32,102,108, 97,103,\n    115, 46,112, 32,116,104,101,110, 10,  9,  9,114,101,116,117,\n    114,110, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,111,110,\n    108,121, 32,112, 97,114,115,101, 10,  9,101,110,100, 10, 10,\n      9,105,102, 32,102,108, 97,103,115, 46,111, 32,116,104,101,\n    110, 10,  9,  9,108,111, 99, 97,108, 32,115,116, 44,109,115,\n    103, 32, 61, 32,119,114,105,116,101,116,111, 40,102,108, 97,\n    103,115, 46,111, 41, 10,  9,  9,105,102, 32,110,111,116, 32,\n    115,116, 32,116,104,101,110, 10,  9,  9,  9,101,114,114,111,\n    114, 40, 39, 35, 39, 46, 46,109,115,103, 41, 10,  9,  9,101,\n    110,100, 10,  9,101,110,100, 10, 10,  9,112, 58,100,101, 99,\n    108,116,121,112,101, 40, 41, 10,  9,105,102, 32,102,108, 97,\n    103,115, 46, 80, 32,116,104,101,110, 10,  9,  9,112, 58,112,\n    114,105,110,116, 40, 41, 10,  9,101,108,115,101, 10,  9,  9,\n    112,117,115,104, 40,112, 41, 10,  9,  9,112,114,101, 95,111,\n    117,116,112,117,116, 95,104,111,111,107, 40,112, 41, 10,  9,\n      9,112,111,112, 40, 41, 10,  9,  9,112, 58,112,114,101, 97,\n    109, 98,108,101, 40, 41, 10,  9,  9,112, 58,115,117,112, 99,\n    111,100,101, 40, 41, 10,  9,  9,112,117,115,104, 40,112, 41,\n     10,  9,  9,112,114,101, 95,114,101,103,105,115,116,101,114,\n     95,104,111,111,107, 40,112, 41, 10,  9,  9,112,111,112, 40,\n     41, 10,  9,  9,112, 58,114,101,103,105,115,116,101,114, 40,\n     41, 10,  9,  9,112,117,115,104, 40,112, 41, 10,  9,  9,112,\n    111,115,116, 95,111,117,116,112,117,116, 95,104,111,111,107,\n     40,112, 41, 10,  9,  9,112,111,112, 40, 41, 10,  9,101,110,\n    100, 10, 10,  9,105,102, 32,102,108, 97,103,115, 46,111, 32,\n    116,104,101,110, 10,  9,  9,119,114,105,116,101,116,111, 40,\n     41, 10,  9,101,110,100, 10, 10,  9, 45, 45, 32,119,114,105,\n    116,101, 32,104,101, 97,100,101,114, 32,102,105,108,101, 10,\n      9,105,102, 32,110,111,116, 32,102,108, 97,103,115, 46, 80,\n     32,116,104,101,110, 10,  9,  9,105,102, 32,102,108, 97,103,\n    115, 46, 72, 32,116,104,101,110, 10,  9,  9,  9,108,111, 99,\n     97,108, 32,115,116, 44,109,115,103, 32, 61, 32,119,114,105,\n    116,101,116,111, 40,102,108, 97,103,115, 46, 72, 41, 10,  9,\n      9,  9,105,102, 32,110,111,116, 32,115,116, 32,116,104,101,\n    110, 10,  9,  9,  9,  9,101,114,114,111,114, 40, 39, 35, 39,\n     46, 46,109,115,103, 41, 10,  9,  9,  9,101,110,100, 10,  9,\n      9,  9,112, 58,104,101, 97,100,101,114, 40, 41, 10,  9,  9,\n      9,119,114,105,116,101,116,111, 40, 41, 10,  9,  9,101,110,\n    100, 10,  9,101,110,100, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: src/bin/lua/doit.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    10,108,111, 99, 97,108, 32,101,114,114, 44,109,115,103, 32,\n     61, 32,112, 99, 97,108,108, 40,100,111,105,116, 41, 10,105,\n    102, 32,110,111,116, 32,101,114,114, 32,116,104,101,110, 10,\n     32,108,111, 99, 97,108, 32, 95, 44, 95, 44,108, 97, 98,101,\n    108, 44,109,115,103, 32, 61, 32,115,116,114,102,105,110,100,\n     40,109,115,103, 44, 34, 40, 46, 45, 58, 46, 45, 58, 37,115,\n     42, 41, 40, 46, 42, 41, 34, 41, 10, 32,116,111,108,117, 97,\n     95,101,114,114,111,114, 40,109,115,103, 44,108, 97, 98,101,\n    108, 41, 10, 32,112,114,105,110,116, 40,100,101, 98,117,103,\n     46,116,114, 97, 99,101, 98, 97, 99,107, 40, 41, 41, 10,101,\n    110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua: embedded Lua code 23\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n tolua_endmodule(tolua_S);\n return 1;\n}\n\n\n#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501\n TOLUA_API int luaopen_tolua (lua_State* tolua_S) {\n return tolua_tolua_open(tolua_S);\n}\n#endif\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/toluabind.h",
    "content": "/*\n** Lua binding: tolua\n** Generated automatically by tolua++-1.0.92 on Sun Feb 15 22:29:48 2009.\n*/\n\n/* Exported function */\nTOLUA_API int  tolua_tolua_open (lua_State* tolua_S);\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/toluabind_default.c",
    "content": "/*\n** Lua binding: tolua\n** Generated automatically by tolua++-1.0.92 on Fri Dec 28 21:37:36 2007.\n*/\n\n#ifndef __cplusplus\n#include \"stdlib.h\"\n#endif\n#include \"string.h\"\n\n#include \"tolua++.h\"\n\n/* Exported function */\nTOLUA_API int  tolua_tolua_open (lua_State* tolua_S);\n\n\n/* function to register type */\nstatic void tolua_reg_types (lua_State* tolua_S)\n{\n}\n\n/* Open function */\nTOLUA_API int tolua_tolua_open (lua_State* tolua_S)\n{\n tolua_open(tolua_S);\n tolua_reg_types(tolua_S);\n tolua_module(tolua_S,NULL,0);\n tolua_beginmodule(tolua_S,NULL);\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n   105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n     95, 86, 69, 82, 83, 73, 79, 78, 44, 32, 34, 53, 37, 46, 48,\n     34, 41, 32,116,104,101,110, 13, 10,  9,114,101,116,117,114,\n    110, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 32, 34,108,\n    111, 97,100,102,105,108,101, 34, 13, 10,108,111, 99, 97,108,\n     32,102,117,110, 99,116,105,111,110, 32,112,112, 95,100,111,\n    102,105,108,101, 40,112, 97,116,104, 41, 13, 10, 13, 10,  9,\n    108,111, 99, 97,108, 32,108,111, 97,100,101,100, 32, 61, 32,\n    102, 97,108,115,101, 13, 10,  9,108,111, 99, 97,108, 32,103,\n    101,116,102,105,108,101, 32, 61, 32,102,117,110, 99,116,105,\n    111,110, 40, 41, 13, 10, 13, 10,  9,  9,105,102, 32,108,111,\n     97,100,101,100, 32,116,104,101,110, 13, 10,  9,  9,  9,114,\n    101,116,117,114,110, 13, 10,  9,  9,101,108,115,101, 13, 10,\n      9,  9,  9,108,111, 99, 97,108, 32,102,105,108,101, 44,101,\n    114,114, 32, 61, 32,105,111, 46,111,112,101,110, 40,112, 97,\n    116,104, 41, 13, 10,  9,  9,  9,105,102, 32,110,111,116, 32,\n    102,105,108,101, 32,116,104,101,110, 13, 10,  9,  9,  9,  9,\n    101,114,114,111,114, 40, 34,101,114,114,111,114, 32,108,111,\n     97,100,105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112,\n     97,116,104, 46, 46, 34, 58, 32, 34, 46, 46,101,114,114, 41,\n     13, 10,  9,  9,  9,101,110,100, 13, 10,  9,  9,  9,108,111,\n     99, 97,108, 32,114,101,116, 32, 61, 32,102,105,108,101, 58,\n    114,101, 97,100, 40, 34, 42, 97, 34, 41, 13, 10,  9,  9,  9,\n    102,105,108,101, 58, 99,108,111,115,101, 40, 41, 13, 10, 13,\n     10,  9,  9,  9,114,101,116, 32, 61, 32,115,116,114,105,110,\n    103, 46,103,115,117, 98, 40,114,101,116, 44, 32, 34, 37, 46,\n     37, 46, 37, 46, 37,115, 42, 37, 41, 34, 44, 32, 34, 46, 46,\n     46, 41, 32,108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32,\n    123,110, 61,115,101,108,101, 99,116, 40, 39, 35, 39, 44, 32,\n     46, 46, 46, 41, 44, 32, 46, 46, 46,125, 59, 34, 41, 13, 10,\n     13, 10,  9,  9,  9,108,111, 97,100,101,100, 32, 61, 32,116,\n    114,117,101, 13, 10,  9,  9,  9,114,101,116,117,114,110, 32,\n    114,101,116, 13, 10,  9,  9,101,110,100, 13, 10,  9,101,110,\n    100, 13, 10, 13, 10,  9,108,111, 99, 97,108, 32,102, 32, 61,\n     32,108,111, 97,100, 40,103,101,116,102,105,108,101, 44, 32,\n    112, 97,116,104, 41, 13, 10,  9,105,102, 32,110,111,116, 32,\n    102, 32,116,104,101,110, 13, 10,  9, 13, 10,  9,  9,101,114,\n    114,111,114, 40, 34,101,114,114,111,114, 32,108,111, 97,100,\n    105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112, 97,116,\n    104, 41, 13, 10,  9,101,110,100, 13, 10,  9,114,101,116,117,\n    114,110, 32,102, 40, 41, 13, 10,101,110,100, 13, 10, 13, 10,\n    111,108,100, 95,100,111,102,105,108,101, 32, 61, 32,100,111,\n    102,105,108,101, 13, 10,100,111,102,105,108,101, 32, 61, 32,\n    112,112, 95,100,111,102,105,108,101, 13, 10, 13, 10, 13, 10,\n     45, 45, 32,115,116,114,105,110,103, 46,103,115,117, 98, 13,\n     10, 45, 45, 91, 91, 13, 10,108,111, 99, 97,108, 32,111,103,\n    115,117, 98, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 13, 10,108,111, 99, 97,108, 32,102,117,110, 99,116,\n    105,111,110, 32, 99,111,109,112,103,115,117, 98, 40, 97, 44,\n     98, 44, 99, 44,100, 41, 13, 10, 32, 32,105,102, 32,116,121,\n    112,101, 40, 99, 41, 32, 61, 61, 32, 34,102,117,110, 99,116,\n    105,111,110, 34, 32,116,104,101,110, 13, 10, 32, 32, 32, 32,\n    108,111, 99, 97,108, 32,111, 99, 32, 61, 32, 99, 13, 10, 32,\n     32, 32, 32, 99, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40, 46, 46, 46, 41, 32,114,101,116,117,114,110, 32,111,\n     99, 40, 46, 46, 46, 41, 32,111,114, 32, 39, 39, 32,101,110,\n    100, 13, 10, 32, 32,101,110,100, 13, 10, 32, 32,114,101,116,\n    117,114,110, 32,111,103,115,117, 98, 40, 97, 44, 98, 44, 99,\n     44,100, 41, 13, 10,101,110,100, 13, 10,115,116,114,105,110,\n    103, 46,114,101,112,108, 32, 61, 32,111,103,115,117, 98, 13,\n     10, 45, 45, 93, 93, 13, 10, 13, 10, 45, 45,115,116,114,105,\n    110,103, 46,103,115,117, 98, 32, 61, 32, 99,111,109,112,103,\n    115,117, 98, 13,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/compat-5.1.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 82,101, 97,108,\n     32,103,108,111, 98, 97,108,115, 10, 45, 45, 32, 95, 65, 76,\n     69, 82, 84, 10, 45, 45, 32, 95, 69, 82, 82, 79, 82, 77, 69,\n     83, 83, 65, 71, 69, 10, 45, 45, 32, 95, 86, 69, 82, 83, 73,\n     79, 78, 10, 45, 45, 32, 95, 71, 10, 45, 45, 32, 97,115,115,\n    101,114,116, 10, 45, 45, 32,101,114,114,111,114, 10, 45, 45,\n     32,109,101,116, 97,116, 97, 98,108,101, 10, 45, 45, 32,110,\n    101,120,116, 10, 45, 45, 32,112,114,105,110,116, 10, 45, 45,\n     32,114,101,113,117,105,114,101, 10, 45, 45, 32,116,111,110,\n    117,109, 98,101,114, 10, 45, 45, 32,116,111,115,116,114,105,\n    110,103, 10, 45, 45, 32,116,121,112,101, 10, 45, 45, 32,117,\n    110,112, 97, 99,107, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,\n     45, 45, 32, 99,111,108,108,101, 99,116,103, 97,114, 98, 97,\n    103,101, 10, 45, 45, 32,103, 99,105,110,102,111, 10, 10, 45,\n     45, 32,103,108,111, 98, 97,108,115, 10, 10, 45, 45, 32, 99,\n     97,108,108, 32, 32, 32, 45, 62, 32,112,114,111,116,101, 99,\n    116, 40,102, 44, 32,101,114,114, 41, 10, 45, 45, 32,108,111,\n     97,100,102,105,108,101, 10, 45, 45, 32,108,111, 97,100,115,\n    116,114,105,110,103, 10, 10, 45, 45, 32,114, 97,119,103,101,\n    116, 10, 45, 45, 32,114, 97,119,115,101,116, 10, 10, 45, 45,\n     32,103,101,116, 97,114,103,115, 32, 61, 32, 77, 97,105,110,\n     46,103,101,116, 97,114,103,115, 32, 63, 63, 10, 10,114, 97,\n    119,116,121,112,101, 32, 61, 32,116,121,112,101, 10, 10,102,\n    117,110, 99,116,105,111,110, 32,100,111, 95, 32, 40,102, 44,\n     32,101,114,114, 41, 10, 32, 32,105,102, 32,110,111,116, 32,\n    102, 32,116,104,101,110, 32,112,114,105,110,116, 40,101,114,\n    114, 41, 59, 32,114,101,116,117,114,110, 32,101,110,100, 10,\n     32, 32,108,111, 99, 97,108, 32, 97, 44, 98, 32, 61, 32,112,\n     99, 97,108,108, 40,102, 41, 10, 32, 32,105,102, 32,110,111,\n    116, 32, 97, 32,116,104,101,110, 32,112,114,105,110,116, 40,\n     98, 41, 59, 32,114,101,116,117,114,110, 32,110,105,108, 10,\n     32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, 98,\n     32,111,114, 32,116,114,117,101, 10, 32, 32,101,110,100, 10,\n    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,100,\n    111,115,116,114,105,110,103, 40,115, 41, 32,114,101,116,117,\n    114,110, 32,100,111, 95, 40,108,111, 97,100,115,116,114,105,\n    110,103, 40,115, 41, 41, 32,101,110,100, 10, 45, 45, 32,102,\n    117,110, 99,116,105,111,110, 32,100,111,102,105,108,101, 40,\n    115, 41, 32,114,101,116,117,114,110, 32,100,111, 95, 40,108,\n    111, 97,100,102,105,108,101, 40,115, 41, 41, 32,101,110,100,\n     10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 84, 97,\n     98,108,101, 32,108,105, 98,114, 97,114,121, 10,108,111, 99,\n     97,108, 32,116, 97, 98, 32, 61, 32,116, 97, 98,108,101, 10,\n    102,111,114,101, 97, 99,104, 32, 61, 32,116, 97, 98, 46,102,\n    111,114,101, 97, 99,104, 10,102,111,114,101, 97, 99,104,105,\n     32, 61, 32,116, 97, 98, 46,102,111,114,101, 97, 99,104,105,\n     10,103,101,116,110, 32, 61, 32,116, 97, 98, 46,103,101,116,\n    110, 10,116,105,110,115,101,114,116, 32, 61, 32,116, 97, 98,\n     46,105,110,115,101,114,116, 10,116,114,101,109,111,118,101,\n     32, 61, 32,116, 97, 98, 46,114,101,109,111,118,101, 10,115,\n    111,114,116, 32, 61, 32,116, 97, 98, 46,115,111,114,116, 10,\n     10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 98,\n    117,103, 32,108,105, 98,114, 97,114,121, 10,108,111, 99, 97,\n    108, 32,100, 98,103, 32, 61, 32,100,101, 98,117,103, 10,103,\n    101,116,105,110,102,111, 32, 61, 32,100, 98,103, 46,103,101,\n    116,105,110,102,111, 10,103,101,116,108,111, 99, 97,108, 32,\n     61, 32,100, 98,103, 46,103,101,116,108,111, 99, 97,108, 10,\n    115,101,116, 99, 97,108,108,104,111,111,107, 32, 61, 32,102,\n    117,110, 99,116,105,111,110, 32, 40, 41, 32,101,114,114,111,\n    114, 34, 96,115,101,116, 99, 97,108,108,104,111,111,107, 39,\n     32,105,115, 32,100,101,112,114,101, 99, 97,116,101,100, 34,\n     32,101,110,100, 10,115,101,116,108,105,110,101,104,111,111,\n    107, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, 41,\n     32,101,114,114,111,114, 34, 96,115,101,116,108,105,110,101,\n    104,111,111,107, 39, 32,105,115, 32,100,101,112,114,101, 99,\n     97,116,101,100, 34, 32,101,110,100, 10,115,101,116,108,111,\n     99, 97,108, 32, 61, 32,100, 98,103, 46,115,101,116,108,111,\n     99, 97,108, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45,\n     32,109, 97,116,104, 32,108,105, 98,114, 97,114,121, 10,108,\n    111, 99, 97,108, 32,109, 97,116,104, 32, 61, 32,109, 97,116,\n    104, 10, 97, 98,115, 32, 61, 32,109, 97,116,104, 46, 97, 98,\n    115, 10, 97, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,\n    111,110, 32, 40,120, 41, 32,114,101,116,117,114,110, 32,109,\n     97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97, 99,\n    111,115, 40,120, 41, 41, 32,101,110,100, 10, 97,115,105,110,\n     32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,120, 41,\n     32,114,101,116,117,114,110, 32,109, 97,116,104, 46,100,101,\n    103, 40,109, 97,116,104, 46, 97,115,105,110, 40,120, 41, 41,\n     32,101,110,100, 10, 97,116, 97,110, 32, 61, 32,102,117,110,\n     99,116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,\n    110, 32,109, 97,116,104, 46,100,101,103, 40,109, 97,116,104,\n     46, 97,116, 97,110, 40,120, 41, 41, 32,101,110,100, 10, 97,\n    116, 97,110, 50, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40,120, 44,121, 41, 32,114,101,116,117,114,110, 32,109,\n     97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97,116,\n     97,110, 50, 40,120, 44,121, 41, 41, 32,101,110,100, 10, 99,\n    101,105,108, 32, 61, 32,109, 97,116,104, 46, 99,101,105,108,\n     10, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40,120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,\n    104, 46, 99,111,115, 40,109, 97,116,104, 46,114, 97,100, 40,\n    120, 41, 41, 32,101,110,100, 10,100,101,103, 32, 61, 32,109,\n     97,116,104, 46,100,101,103, 10,101,120,112, 32, 61, 32,109,\n     97,116,104, 46,101,120,112, 10,102,108,111,111,114, 32, 61,\n     32,109, 97,116,104, 46,102,108,111,111,114, 10,102,114,101,\n    120,112, 32, 61, 32,109, 97,116,104, 46,102,114,101,120,112,\n     10,108,100,101,120,112, 32, 61, 32,109, 97,116,104, 46,108,\n    100,101,120,112, 10,108,111,103, 32, 61, 32,109, 97,116,104,\n     46,108,111,103, 10,108,111,103, 49, 48, 32, 61, 32,109, 97,\n    116,104, 46,108,111,103, 49, 48, 10,109, 97,120, 32, 61, 32,\n    109, 97,116,104, 46,109, 97,120, 10,109,105,110, 32, 61, 32,\n    109, 97,116,104, 46,109,105,110, 10,109,111,100, 32, 61, 32,\n    109, 97,116,104, 46,109,111,100, 10, 80, 73, 32, 61, 32,109,\n     97,116,104, 46,112,105, 10, 45, 45, 63, 63, 63, 32,112,111,\n    119, 32, 61, 32,109, 97,116,104, 46,112,111,119, 32, 32, 10,\n    114, 97,100, 32, 61, 32,109, 97,116,104, 46,114, 97,100, 10,\n    114, 97,110,100,111,109, 32, 61, 32,109, 97,116,104, 46,114,\n     97,110,100,111,109, 10,114, 97,110,100,111,109,115,101,101,\n    100, 32, 61, 32,109, 97,116,104, 46,114, 97,110,100,111,109,\n    115,101,101,100, 10,115,105,110, 32, 61, 32,102,117,110, 99,\n    116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,110,\n     32,109, 97,116,104, 46,115,105,110, 40,109, 97,116,104, 46,\n    114, 97,100, 40,120, 41, 41, 32,101,110,100, 10,115,113,114,\n    116, 32, 61, 32,109, 97,116,104, 46,115,113,114,116, 10,116,\n     97,110, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,\n    120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,104, 46,\n    116, 97,110, 40,109, 97,116,104, 46,114, 97,100, 40,120, 41,\n     41, 32,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,\n     45, 45, 32,115,116,114,105,110,103, 32,108,105, 98,114, 97,\n    114,121, 10,108,111, 99, 97,108, 32,115,116,114, 32, 61, 32,\n    115,116,114,105,110,103, 10,115,116,114, 98,121,116,101, 32,\n     61, 32,115,116,114, 46, 98,121,116,101, 10,115,116,114, 99,\n    104, 97,114, 32, 61, 32,115,116,114, 46, 99,104, 97,114, 10,\n    115,116,114,102,105,110,100, 32, 61, 32,115,116,114, 46,102,\n    105,110,100, 10,102,111,114,109, 97,116, 32, 61, 32,115,116,\n    114, 46,102,111,114,109, 97,116, 10,103,115,117, 98, 32, 61,\n     32,115,116,114, 46,103,115,117, 98, 10,115,116,114,108,101,\n    110, 32, 61, 32,115,116,114, 46,108,101,110, 10,115,116,114,\n    108,111,119,101,114, 32, 61, 32,115,116,114, 46,108,111,119,\n    101,114, 10,115,116,114,114,101,112, 32, 61, 32,115,116,114,\n     46,114,101,112, 10,115,116,114,115,117, 98, 32, 61, 32,115,\n    116,114, 46,115,117, 98, 10,115,116,114,117,112,112,101,114,\n     32, 61, 32,115,116,114, 46,117,112,112,101,114, 10, 10, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 10, 45, 45, 32,111,115, 32,108,105,\n     98,114, 97,114,121, 10, 99,108,111, 99,107, 32, 61, 32,111,\n    115, 46, 99,108,111, 99,107, 10,100, 97,116,101, 32, 61, 32,\n    111,115, 46,100, 97,116,101, 10,100,105,102,102,116,105,109,\n    101, 32, 61, 32,111,115, 46,100,105,102,102,116,105,109,101,\n     10,101,120,101, 99,117,116,101, 32, 61, 32,111,115, 46,101,\n    120,101, 99,117,116,101, 32, 45, 45, 63, 10,101,120,105,116,\n     32, 61, 32,111,115, 46,101,120,105,116, 10,103,101,116,101,\n    110,118, 32, 61, 32,111,115, 46,103,101,116,101,110,118, 10,\n    114,101,109,111,118,101, 32, 61, 32,111,115, 46,114,101,109,\n    111,118,101, 10,114,101,110, 97,109,101, 32, 61, 32,111,115,\n     46,114,101,110, 97,109,101, 10,115,101,116,108,111, 99, 97,\n    108,101, 32, 61, 32,111,115, 46,115,101,116,108,111, 99, 97,\n    108,101, 10,116,105,109,101, 32, 61, 32,111,115, 46,116,105,\n    109,101, 10,116,109,112,110, 97,109,101, 32, 61, 32,111,115,\n     46,116,109,112,110, 97,109,101, 10, 10, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 10, 45, 45, 32, 99,111,109,112, 97,116,105, 98,105,\n    108,105,116,121, 32,111,110,108,121, 10,103,101,116,103,108,\n    111, 98, 97,108, 32, 61, 32,102,117,110, 99,116,105,111,110,\n     32, 40,110, 41, 32,114,101,116,117,114,110, 32, 95, 71, 91,\n    110, 93, 32,101,110,100, 10,115,101,116,103,108,111, 98, 97,\n    108, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,110,\n     44,118, 41, 32, 95, 71, 91,110, 93, 32, 61, 32,118, 32,101,\n    110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10,108,111,\n     99, 97,108, 32,105,111, 44, 32,116, 97, 98, 32, 61, 32,105,\n    111, 44, 32,116, 97, 98,108,101, 10, 10, 45, 45, 32, 73, 79,\n     32,108,105, 98,114, 97,114,121, 32, 40,102,105,108,101,115,\n     41, 10, 95, 83, 84, 68, 73, 78, 32, 61, 32,105,111, 46,115,\n    116,100,105,110, 10, 95, 83, 84, 68, 69, 82, 82, 32, 61, 32,\n    105,111, 46,115,116,100,101,114,114, 10, 95, 83, 84, 68, 79,\n     85, 84, 32, 61, 32,105,111, 46,115,116,100,111,117,116, 10,\n     95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,116,100,\n    105,110, 10, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,111,\n     46,115,116,100,111,117,116, 10,115,101,101,107, 32, 61, 32,\n    105,111, 46,115,116,100,105,110, 46,115,101,101,107, 32, 32,\n     32, 45, 45, 32,115,105, 99,107, 32, 59, 45, 41, 10,116,109,\n    112,102,105,108,101, 32, 61, 32,105,111, 46,116,109,112,102,\n    105,108,101, 10, 99,108,111,115,101,102,105,108,101, 32, 61,\n     32,105,111, 46, 99,108,111,115,101, 10,111,112,101,110,102,\n    105,108,101, 32, 61, 32,105,111, 46,111,112,101,110, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,102,108,117,115,104, 32,\n     40,102, 41, 10, 32, 32,105,102, 32,102, 32,116,104,101,110,\n     32,102, 58,102,108,117,115,104, 40, 41, 10, 32, 32,101,108,\n    115,101, 32, 95, 79, 85, 84, 80, 85, 84, 58,102,108,117,115,\n    104, 40, 41, 10, 32, 32,101,110,100, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,114,101, 97,100,102,114,\n    111,109, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102, 32,\n    110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,101,\n    110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,\n    101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46, 99,\n    108,111,115,101, 40, 95, 73, 78, 80, 85, 84, 41, 10, 32, 32,\n     32, 32, 95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,\n    116,100,105,110, 10, 32, 32, 32, 32,114,101,116,117,114,110,\n     32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,\n    101,108,115,101, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,\n    102, 44, 32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,\n    111, 46,111,112,101,110, 40,110, 97,109,101, 44, 32, 34,114,\n     34, 41, 10, 32, 32, 32, 32, 95, 73, 78, 80, 85, 84, 32, 61,\n     32,102, 32,111,114, 32, 95, 73, 78, 80, 85, 84, 10, 32, 32,\n     32, 32,114,101,116,117,114,110, 32,102, 44, 32,101,114,114,\n     44, 32, 99,111,100, 10, 32, 32,101,110,100, 10,101,110,100,\n     10, 10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,\n    101,116,111, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102,\n     32,110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,\n    101,110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44,\n     32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,\n     99,108,111,115,101, 40, 95, 79, 85, 84, 80, 85, 84, 41, 10,\n     32, 32, 32, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,\n    111, 46,115,116,100,111,117,116, 10, 32, 32, 32, 32,114,101,\n    116,117,114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,\n    100, 10, 32, 32,101,108,115,101, 10, 32, 32, 32, 32,108,111,\n     99, 97,108, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100,\n     32, 61, 32,105,111, 46,111,112,101,110, 40,110, 97,109,101,\n     44, 32, 34,119, 34, 41, 10, 32, 32, 32, 32, 95, 79, 85, 84,\n     80, 85, 84, 32, 61, 32,102, 32,111,114, 32, 95, 79, 85, 84,\n     80, 85, 84, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,\n    102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,101,\n    110,100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 97,112,112,101,110,100,116,111, 32, 40,110, 97,109,\n    101, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,101,\n    114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,111,112,\n    101,110, 40,110, 97,109,101, 44, 32, 34, 97, 34, 41, 10, 32,\n     32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,102, 32,111,114,\n     32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,114,101,116,117,\n    114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10,\n    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,\n    101, 97,100, 32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99,\n     97,108, 32,102, 32, 61, 32, 95, 73, 78, 80, 85, 84, 10, 32,\n     32,105,102, 32,114, 97,119,116,121,112,101, 40, 97,114,103,\n     91, 49, 93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,\n    116, 97, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32,\n     61, 32,116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,\n    103, 44, 32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,\n    101,116,117,114,110, 32,102, 58,114,101, 97,100, 40,117,110,\n    112, 97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100, 10,\n     10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,101,\n     32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99, 97,108, 32,\n    102, 32, 61, 32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,105,\n    102, 32,114, 97,119,116,121,112,101, 40, 97,114,103, 91, 49,\n     93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,116, 97,\n     39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32, 61, 32,\n    116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,103, 44,\n     32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,101,116,\n    117,114,110, 32,102, 58,119,114,105,116,101, 40,117,110,112,\n     97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/compat.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 98, 97,115,105, 99,\n     32,117,116,105,108,105,116,121, 32,102,117,110, 99,116,105,\n    111,110,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32,\n     98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,\n    101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80,\n     85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49,\n     57, 57, 56, 10, 45, 45, 32, 76, 97,115,116, 32,117,112,100,\n     97,116,101, 58, 32, 65,112,114, 32, 50, 48, 48, 51, 10, 45,\n     45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,\n    105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101,\n     32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32,\n     99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,\n    101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,\n    105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,\n    115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,\n    101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115,\n     32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32,\n     98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,\n    104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,\n    111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111,\n     32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,\n    110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44,\n     32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,\n    104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,\n    109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10,\n     10, 10, 45, 45, 32, 66, 97,115,105, 99, 32, 67, 32,116,121,\n    112,101,115, 32, 97,110,100, 32,116,104,101,105,114, 32, 99,\n    111,114,114,101,115,112,111,110,100,105,110,103, 32, 76,117,\n     97, 32,116,121,112,101,115, 10, 45, 45, 32, 65,108,108, 32,\n    111, 99, 99,117,114,114,101,110, 99,101,115, 32,111,102, 32,\n     34, 99,104, 97,114, 42, 34, 32,119,105,108,108, 32, 98,101,\n     32,114,101,112,108, 97, 99,101,100, 32, 98,121, 32, 34, 95,\n     99,115,116,114,105,110,103, 34, 44, 10, 45, 45, 32, 97,110,\n    100, 32, 97,108,108, 32,111, 99, 99,117,114,114,101,110, 99,\n    101,115, 32,111,102, 32, 34,118,111,105,100, 42, 34, 32,119,\n    105,108,108, 32, 98,101, 32,114,101,112,108, 97, 99,101,100,\n     32, 98,121, 32, 34, 95,117,115,101,114,100, 97,116, 97, 34,\n     10, 95, 98, 97,115,105, 99, 32, 61, 32,123, 10, 32, 91, 39,\n    118,111,105,100, 39, 93, 32, 61, 32, 39, 39, 44, 10, 32, 91,\n     39, 99,104, 97,114, 39, 93, 32, 61, 32, 39,110,117,109, 98,\n    101,114, 39, 44, 10, 32, 91, 39,105,110,116, 39, 93, 32, 61,\n     32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,115,\n    104,111,114,116, 39, 93, 32, 61, 32, 39,110,117,109, 98,101,\n    114, 39, 44, 10, 32, 91, 39,108,111,110,103, 39, 93, 32, 61,\n     32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,117,\n    110,115,105,103,110,101,100, 39, 93, 32, 61, 32, 39,110,117,\n    109, 98,101,114, 39, 44, 10, 32, 91, 39,102,108,111, 97,116,\n     39, 93, 32, 61, 32, 39,110,117,109, 98,101,114, 39, 44, 10,\n     32, 91, 39,100,111,117, 98,108,101, 39, 93, 32, 61, 32, 39,\n    110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39, 95, 99,115,\n    116,114,105,110,103, 39, 93, 32, 61, 32, 39,115,116,114,105,\n    110,103, 39, 44, 10, 32, 91, 39, 95,117,115,101,114,100, 97,\n    116, 97, 39, 93, 32, 61, 32, 39,117,115,101,114,100, 97,116,\n     97, 39, 44, 10, 32, 91, 39, 99,104, 97,114, 42, 39, 93, 32,\n     61, 32, 39,115,116,114,105,110,103, 39, 44, 10, 32, 91, 39,\n    118,111,105,100, 42, 39, 93, 32, 61, 32, 39,117,115,101,114,\n    100, 97,116, 97, 39, 44, 10, 32, 91, 39, 98,111,111,108, 39,\n     93, 32, 61, 32, 39, 98,111,111,108,101, 97,110, 39, 44, 10,\n     32, 91, 39,108,117, 97, 95, 79, 98,106,101, 99,116, 39, 93,\n     32, 61, 32, 39,118, 97,108,117,101, 39, 44, 10, 32, 91, 39,\n     76, 85, 65, 95, 86, 65, 76, 85, 69, 39, 93, 32, 61, 32, 39,\n    118, 97,108,117,101, 39, 44, 32, 32, 32, 32, 45, 45, 32,102,\n    111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,116,\n    121, 32,119,105,116,104, 32,116,111,108,117, 97, 32, 52, 46,\n     48, 10, 32, 91, 39,108,117, 97, 95, 83,116, 97,116,101, 42,\n     39, 93, 32, 61, 32, 39,115,116, 97,116,101, 39, 44, 10, 32,\n     91, 39, 95,108,115,116, 97,116,101, 39, 93, 32, 61, 32, 39,\n    115,116, 97,116,101, 39, 44, 10, 32, 91, 39,108,117, 97, 95,\n     70,117,110, 99,116,105,111,110, 39, 93, 32, 61, 32, 39,118,\n     97,108,117,101, 39, 44, 10,125, 10, 10, 95, 98, 97,115,105,\n     99, 95, 99,116,121,112,101, 32, 61, 32,123, 10, 32,110,117,\n    109, 98,101,114, 32, 61, 32, 34,108,117, 97, 95, 78,117,109,\n     98,101,114, 34, 44, 10, 32,115,116,114,105,110,103, 32, 61,\n     32, 34, 99,111,110,115,116, 32, 99,104, 97,114, 42, 34, 44,\n     10, 32,117,115,101,114,100, 97,116, 97, 32, 61, 32, 34,118,\n    111,105,100, 42, 34, 44, 10, 32, 98,111,111,108,101, 97,110,\n     32, 61, 32, 34, 98,111,111,108, 34, 44, 10, 32,118, 97,108,\n    117,101, 32, 61, 32, 34,105,110,116, 34, 44, 10, 32,115,116,\n     97,116,101, 32, 61, 32, 34,108,117, 97, 95, 83,116, 97,116,\n    101, 42, 34, 44, 10,125, 10, 10, 45, 45, 32,102,117,110, 99,\n    116,105,111,110,115, 32,116,104,101, 32, 97,114,101, 32,117,\n    115,101,100, 32,116,111, 32,100,111, 32, 97, 32, 39,114, 97,\n    119, 32,112,117,115,104, 39, 32,111,102, 32, 98, 97,115,105,\n     99, 32,116,121,112,101,115, 10, 95, 98, 97,115,105, 99, 95,\n    114, 97,119, 95,112,117,115,104, 32, 61, 32,123,125, 10, 10,\n     45, 45, 32, 76,105,115,116, 32,111,102, 32,117,115,101,114,\n     32,100,101,102,105,110,101,100, 32,116,121,112,101,115, 10,\n     45, 45, 32, 69, 97, 99,104, 32,116,121,112,101, 32, 99,111,\n    114,114,101,115,112,111,110,100,115, 32,116,111, 32, 97, 32,\n    118, 97,114,105, 97, 98,108,101, 32,110, 97,109,101, 32,116,\n    104, 97,116, 32,115,116,111,114,101,115, 32,105,116,115, 32,\n    116, 97,103, 32,118, 97,108,117,101, 46, 10, 95,117,115,101,\n    114,116,121,112,101, 32, 61, 32,123,125, 10, 10, 45, 45, 32,\n     76,105,115,116, 32,111,102, 32,116,121,112,101,115, 32,116,\n    104, 97,116, 32,104, 97,118,101, 32,116,111, 32, 98,101, 32,\n     99,111,108,108,101, 99,116,101,100, 10, 95, 99,111,108,108,\n    101, 99,116, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105,\n    115,116, 32,111,102, 32,116,121,112,101,115, 10, 95,103,108,\n    111, 98, 97,108, 95,116,121,112,101,115, 32, 61, 32,123,110,\n     61, 48,125, 10, 95,103,108,111, 98, 97,108, 95,116,121,112,\n    101,115, 95,104, 97,115,104, 32, 61, 32,123,125, 10, 10, 45,\n     45, 32,108,105,115,116, 32,111,102, 32, 99,108, 97,115,115,\n    101,115, 10, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,\n    115,101,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105,\n    115,116, 32,111,102, 32,101,110,117,109, 32, 99,111,110,115,\n    116, 97,110,116,115, 10, 95,103,108,111, 98, 97,108, 95,101,\n    110,117,109,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,\n    105,115,116, 32,111,102, 32, 97,117,116,111, 32,114,101,110,\n     97,109,105,110,103, 10, 95,114,101,110, 97,109,105,110,103,\n     32, 61, 32,123,125, 10,102,117,110, 99,116,105,111,110, 32,\n     97,112,112,101,110,100,114,101,110, 97,109,105,110,103, 32,\n     40,115, 41, 10, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    111,108,100, 44,110,101,119, 32, 61, 32,115,116,114,102,105,\n    110,100, 40,115, 44, 34, 37,115, 42, 40, 46, 45, 41, 37,115,\n     42, 64, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 36, 34, 41,\n     10,  9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110,\n     10,  9, 32,101,114,114,111,114, 40, 34, 35, 73,110,118, 97,\n    108,105,100, 32,114,101,110, 97,109,105,110,103, 32,115,121,\n    110,116, 97,120, 59, 32,105,116, 32,115,104,111,117,108,100,\n     32, 98,101, 32,111,102, 32,116,104,101, 32,102,111,114,109,\n     58, 32,112, 97,116,116,101,114,110, 64,112, 97,116,116,101,\n    114,110, 34, 41, 10,  9,101,110,100, 10,  9,116,105,110,115,\n    101,114,116, 40, 95,114,101,110, 97,109,105,110,103, 44,123,\n    111,108,100, 61,111,108,100, 44, 32,110,101,119, 61,110,101,\n    119,125, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,\n    111,110, 32, 97,112,112,108,121,114,101,110, 97,109,105,110,\n    103, 32, 40,115, 41, 10,  9,102,111,114, 32,105, 61, 49, 44,\n    103,101,116,110, 40, 95,114,101,110, 97,109,105,110,103, 41,\n     32,100,111, 10,  9, 32,108,111, 99, 97,108, 32,109, 44,110,\n     32, 61, 32,103,115,117, 98, 40,115, 44, 95,114,101,110, 97,\n    109,105,110,103, 91,105, 93, 46,111,108,100, 44, 95,114,101,\n    110, 97,109,105,110,103, 91,105, 93, 46,110,101,119, 41, 10,\n      9,  9,105,102, 32,110, 32,126, 61, 32, 48, 32,116,104,101,\n    110, 10,  9,  9, 32,114,101,116,117,114,110, 32,109, 10,  9,\n      9,101,110,100, 10,  9,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32,110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,\n     69,114,114,111,114, 32,104, 97,110,100,108,101,114, 10,102,\n    117,110, 99,116,105,111,110, 32,116,111,108,117, 97, 95,101,\n    114,114,111,114, 32, 40,115, 44,102, 41, 10,105,102, 32, 95,\n     99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110, 10,\n      9,112,114,105,110,116, 40, 34, 42, 42, 42, 99,117,114,114,\n     32, 99,111,100,101, 32,102,111,114, 32,101,114,114,111,114,\n     32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103,\n     40, 95, 99,117,114,114, 95, 99,111,100,101, 41, 41, 10,  9,\n    112,114,105,110,116, 40,100,101, 98,117,103, 46,116,114, 97,\n     99,101, 98, 97, 99,107, 40, 41, 41, 10,101,110,100, 10, 32,\n    108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79, 85,\n     84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61,\n     32, 95, 83, 84, 68, 69, 82, 82, 10, 32,105,102, 32,115,116,\n    114,115,117, 98, 40,115, 44, 49, 44, 49, 41, 32, 61, 61, 32,\n     39, 35, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,\n    101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 58, 32,\n     34, 46, 46,115,116,114,115,117, 98, 40,115, 44, 50, 41, 46,\n     46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 32,105,102, 32,\n     95, 99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110,\n     10, 32, 32, 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,115,\n     32, 61, 32,115,116,114,102,105,110,100, 40, 95, 99,117,114,\n    114, 95, 99,111,100,101, 44, 34, 94, 37,115, 42, 40, 46, 45,\n     92,110, 41, 34, 41, 32, 45, 45, 32,101,120,116,114, 97, 99,\n    116, 32,102,105,114,115,116, 32,108,105,110,101, 10, 32, 32,\n     32,105,102, 32,115, 61, 61,110,105,108, 32,116,104,101,110,\n     32,115, 32, 61, 32, 95, 99,117,114,114, 95, 99,111,100,101,\n     32,101,110,100, 10, 32, 32, 32,115, 32, 61, 32,103,115,117,\n     98, 40,115, 44, 34, 95,117,115,101,114,100, 97,116, 97, 34,\n     44, 34,118,111,105,100, 42, 34, 41, 32, 45, 45, 32,114,101,\n    116,117,114,110, 32,119,105,116,104, 32, 39,118,111,105,100,\n     42, 39, 10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,\n    115, 44, 34, 95, 99,115,116,114,105,110,103, 34, 44, 34, 99,\n    104, 97,114, 42, 34, 41, 32, 32, 45, 45, 32,114,101,116,117,\n    114,110, 32,119,105,116,104, 32, 39, 99,104, 97,114, 42, 39,\n     10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,\n     34, 95,108,115,116, 97,116,101, 34, 44, 34,108,117, 97, 95,\n     83,116, 97,116,101, 42, 34, 41, 32, 32, 45, 45, 32,114,101,\n    116,117,114,110, 32,119,105,116,104, 32, 39,108,117, 97, 95,\n     83,116, 97,116,101, 42, 39, 10, 32, 32, 32,119,114,105,116,\n    101, 40, 34, 67,111,100,101, 32, 98,101,105,110,103, 32,112,\n    114,111, 99,101,115,115,101,100, 58, 92,110, 34, 46, 46,115,\n     46, 46, 34, 92,110, 34, 41, 10, 32, 32,101,110,100, 10, 32,\n    101,108,115,101, 10, 32,105,102, 32,110,111,116, 32,102, 32,\n    116,104,101,110, 32,102, 32, 61, 32, 34, 40,102, 32,105,115,\n     32,110,105,108, 41, 34, 32,101,110,100, 10, 32, 32,112,114,\n    105,110,116, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97,\n     32,105,110,116,101,114,110, 97,108, 32,101,114,114,111,114,\n     58, 32, 34, 46, 46,102, 46, 46,115, 46, 46, 34, 46, 92,110,\n     92,110, 34, 41, 10, 32, 32,114,101,116,117,114,110, 10, 32,\n    101,110,100, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,\n    111,117,116, 10,101,110,100, 10, 10,102,117,110, 99,116,105,\n    111,110, 32,119, 97,114,110,105,110,103, 32, 40,109,115,103,\n     41, 10, 32,105,102, 32,102,108, 97,103,115, 46,113, 32,116,\n    104,101,110, 32,114,101,116,117,114,110, 32,101,110,100, 10,\n     32,108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79,\n     85, 84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32,\n     61, 32, 95, 83, 84, 68, 69, 82, 82, 10, 32,119,114,105,116,\n    101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 32,119,\n     97,114,110,105,110,103, 58, 32, 34, 46, 46,109,115,103, 46,\n     46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 95, 79, 85, 84,\n     80, 85, 84, 32, 61, 32,111,117,116, 10,101,110,100, 10, 10,\n     45, 45, 32,114,101,103,105,115,116,101,114, 32, 97,110, 32,\n    117,115,101,114, 32,100,101,102,105,110,101,100, 32,116,121,\n    112,101, 58, 32,114,101,116,117,114,110,115, 32,102,117,108,\n    108, 32,116,121,112,101, 10,102,117,110, 99,116,105,111,110,\n     32,114,101,103,116,121,112,101, 32, 40,116, 41, 10,  9, 45,\n     45,105,102, 32,105,115, 98, 97,115,105, 99, 40,116, 41, 32,\n    116,104,101,110, 10,  9, 45, 45,  9,114,101,116,117,114,110,\n     32,116, 10,  9, 45, 45,101,110,100, 10,  9,108,111, 99, 97,\n    108, 32,102,116, 32, 61, 32,102,105,110,100,116,121,112,101,\n     40,116, 41, 10, 10,  9,105,102, 32,110,111,116, 32, 95,117,\n    115,101,114,116,121,112,101, 91,102,116, 93, 32,116,104,101,\n    110, 10,  9,  9,114,101,116,117,114,110, 32, 97,112,112,101,\n    110,100,117,115,101,114,116,121,112,101, 40,116, 41, 10,  9,\n    101,110,100, 10,  9,114,101,116,117,114,110, 32,102,116, 10,\n    101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, 32,\n    116,121,112,101, 32,110, 97,109,101, 58, 32,114,101,116,117,\n    114,110,115, 32,102,117,108,108, 32,116,121,112,101, 10,102,\n    117,110, 99,116,105,111,110, 32,116,121,112,101,118, 97,114,\n     40,116,121,112,101, 41, 10,  9,105,102, 32,116,121,112,101,\n     32, 61, 61, 32, 39, 39, 32,111,114, 32,116,121,112,101, 32,\n     61, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10,\n      9,  9,114,101,116,117,114,110, 32,116,121,112,101, 10,  9,\n    101,108,115,101, 10,  9,  9,108,111, 99, 97,108, 32,102,116,\n     32, 61, 32,102,105,110,100,116,121,112,101, 40,116,121,112,\n    101, 41, 10,  9,  9,105,102, 32,102,116, 32,116,104,101,110,\n     10,  9,  9,  9,114,101,116,117,114,110, 32,102,116, 10,  9,\n      9,101,110,100, 10,  9,  9, 95,117,115,101,114,116,121,112,\n    101, 91,116,121,112,101, 93, 32, 61, 32,116,121,112,101, 10,\n      9,  9,114,101,116,117,114,110, 32,116,121,112,101, 10,  9,\n    101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101,\n     99,107, 32,105,102, 32, 98, 97,115,105, 99, 32,116,121,112,\n    101, 10,102,117,110, 99,116,105,111,110, 32,105,115, 98, 97,\n    115,105, 99, 32, 40,116,121,112,101, 41, 10, 32,108,111, 99,\n     97,108, 32,116, 32, 61, 32,103,115,117, 98, 40,116,121,112,\n    101, 44, 39, 99,111,110,115,116, 32, 39, 44, 39, 39, 41, 10,\n     32,108,111, 99, 97,108, 32,109, 44,116, 32, 61, 32, 97,112,\n    112,108,121,116,121,112,101,100,101,102, 40, 39, 39, 44, 32,\n    116, 41, 10, 32,108,111, 99, 97,108, 32, 98, 32, 61, 32, 95,\n     98, 97,115,105, 99, 91,116, 93, 10, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 98,\n     44, 95, 98, 97,115,105, 99, 95, 99,116,121,112,101, 91, 98,\n     93, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, 32,\n    110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,115,112,108,\n    105,116, 32,115,116,114,105,110,103, 32,117,115,105,110,103,\n     32, 97, 32,116,111,107,101,110, 10,102,117,110, 99,116,105,\n    111,110, 32,115,112,108,105,116, 32, 40,115, 44,116, 41, 10,\n     32,108,111, 99, 97,108, 32,108, 32, 61, 32,123,110, 61, 48,\n    125, 10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32,102,117,\n    110, 99,116,105,111,110, 32, 40,115, 41, 10, 32, 32,108, 46,\n    110, 32, 61, 32,108, 46,110, 32, 43, 32, 49, 10, 32, 32,108,\n     91,108, 46,110, 93, 32, 61, 32,115, 10, 32, 32,114,101,116,\n    117,114,110, 32, 34, 34, 10, 32,101,110,100, 10, 32,108,111,\n     99, 97,108, 32,112, 32, 61, 32, 34, 37,115, 42, 40, 46, 45,\n     41, 37,115, 42, 34, 46, 46,116, 46, 46, 34, 37,115, 42, 34,\n     10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 94,\n     37,115, 43, 34, 44, 34, 34, 41, 10, 32,115, 32, 61, 32,103,\n    115,117, 98, 40,115, 44, 34, 37,115, 43, 36, 34, 44, 34, 34,\n     41, 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,112,\n     44,102, 41, 10, 32,108, 46,110, 32, 61, 32,108, 46,110, 32,\n     43, 32, 49, 10, 32,108, 91,108, 46,110, 93, 32, 61, 32,103,\n    115,117, 98, 40,115, 44, 34, 40, 37,115, 37,115, 42, 41, 36,\n     34, 44, 34, 34, 41, 10, 32,114,101,116,117,114,110, 32,108,\n     10,101,110,100, 10, 10, 45, 45, 32,115,112,108,105,116,115,\n     32, 97, 32,115,116,114,105,110,103, 32,117,115,105,110,103,\n     32, 97, 32,112, 97,116,116,101,114,110, 44, 32, 99,111,110,\n    115,105,100,101,114,105,110,103, 32,116,104,101, 32,115,112,\n     97, 99,105, 97,108, 32, 99, 97,115,101,115, 32,111,102, 32,\n     67, 32, 99,111,100,101, 32, 40,116,101,109,112,108, 97,116,\n    101,115, 44, 32,102,117,110, 99,116,105,111,110, 32,112, 97,\n    114, 97,109,101,116,101,114,115, 44, 32,101,116, 99, 41, 10,\n     45, 45, 32,112, 97,116,116,101,114,110, 32, 99, 97,110, 39,\n    116, 32, 99,111,110,116, 97,105,110, 32,116,104,101, 32, 39,\n     94, 39, 32, 40, 97,115, 32,117,115,101,100, 32,116,111, 32,\n    105,100,101,110,116,105,102,121, 32,116,104,101, 32, 98,101,\n    103,105,110,105,110,103, 32,111,102, 32,116,104,101, 32,108,\n    105,110,101, 41, 10, 45, 45, 32, 97,108,115,111, 32,115,116,\n    114,105,112,115, 32,119,104,105,116,101,115,112, 97, 99,101,\n     10,102,117,110, 99,116,105,111,110, 32,115,112,108,105,116,\n     95, 99, 95,116,111,107,101,110,115, 40,115, 44, 32,112, 97,\n    116, 41, 10, 10,  9,115, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,115, 44, 32, 34, 94, 37,115, 42, 34,\n     44, 32, 34, 34, 41, 10,  9,115, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 37,115, 42,\n     36, 34, 44, 32, 34, 34, 41, 10, 10,  9,108,111, 99, 97,108,\n     32,116,111,107,101,110, 95, 98,101,103,105,110, 32, 61, 32,\n     49, 10,  9,108,111, 99, 97,108, 32,116,111,107,101,110, 95,\n    101,110,100, 32, 61, 32, 49, 10,  9,108,111, 99, 97,108, 32,\n    111,102,115, 32, 61, 32, 49, 10,  9,108,111, 99, 97,108, 32,\n    114,101,116, 32, 61, 32,123,110, 61, 48,125, 10, 10,  9,102,\n    117,110, 99,116,105,111,110, 32, 97,100,100, 95,116,111,107,\n    101,110, 40,111,102,115, 41, 10, 10,  9,  9,108,111, 99, 97,\n    108, 32,116, 32, 61, 32,115,116,114,105,110,103, 46,115,117,\n     98, 40,115, 44, 32,116,111,107,101,110, 95, 98,101,103,105,\n    110, 44, 32,111,102,115, 41, 10,  9,  9,116, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34,\n     94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,  9,116, 32,\n     61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,\n     44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,\n      9,114,101,116, 46,110, 32, 61, 32,114,101,116, 46,110, 32,\n     43, 32, 49, 10,  9,  9,114,101,116, 91,114,101,116, 46,110,\n     93, 32, 61, 32,116, 10,  9,101,110,100, 10, 10,  9,119,104,\n    105,108,101, 32,111,102,115, 32, 60, 61, 32,115,116,114,105,\n    110,103, 46,108,101,110, 40,115, 41, 32,100,111, 10, 10,  9,\n      9,108,111, 99, 97,108, 32,115,117, 98, 32, 61, 32,115,116,\n    114,105,110,103, 46,115,117, 98, 40,115, 44, 32,111,102,115,\n     44, 32, 45, 49, 41, 10,  9,  9,108,111, 99, 97,108, 32, 98,\n     44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,\n    100, 40,115,117, 98, 44, 32, 34, 94, 34, 46, 46,112, 97,116,\n     41, 10,  9,  9,105,102, 32, 98, 32,116,104,101,110, 10,  9,\n      9,  9, 97,100,100, 95,116,111,107,101,110, 40,111,102,115,\n     45, 49, 41, 10,  9,  9,  9,111,102,115, 32, 61, 32,111,102,\n    115, 43,101, 10,  9,  9,  9,116,111,107,101,110, 95, 98,101,\n    103,105,110, 32, 61, 32,111,102,115, 10,  9,  9,101,108,115,\n    101, 10,  9,  9,  9,108,111, 99, 97,108, 32, 99,104, 97,114,\n     32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115,\n     44, 32,111,102,115, 44, 32,111,102,115, 41, 10,  9,  9,  9,\n    105,102, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32,\n    111,114, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 60, 34, 32,\n    116,104,101,110, 10, 10,  9,  9,  9,  9,108,111, 99, 97,108,\n     32, 98,108,111, 99,107, 10,  9,  9,  9,  9,105,102, 32, 99,\n    104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32,116,104,101,110,\n     32, 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 40, 41,\n     34, 32,101,110,100, 10,  9,  9,  9,  9,105,102, 32, 99,104,\n     97,114, 32, 61, 61, 32, 34, 60, 34, 32,116,104,101,110, 32,\n     98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 60, 62, 34,\n     32,101,110,100, 10, 10,  9,  9,  9,  9, 98, 44,101, 32, 61,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,117,\n     98, 44, 32, 98,108,111, 99,107, 41, 10,  9,  9,  9,  9,105,\n    102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,  9,  9,\n      9,  9,  9, 45, 45, 32,117,110,116,101,114,109,105,110, 97,\n    116,101,100, 32, 98,108,111, 99,107, 63, 10,  9,  9,  9,  9,\n      9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10,  9,  9,\n      9,  9,101,108,115,101, 10,  9,  9,  9,  9,  9,111,102,115,\n     32, 61, 32,111,102,115, 32, 43, 32,101, 10,  9,  9,  9,  9,\n    101,110,100, 10, 10,  9,  9,  9,101,108,115,101, 10,  9,  9,\n      9,  9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10,  9,\n      9,  9,101,110,100, 10,  9,  9,101,110,100, 10, 10,  9,101,\n    110,100, 10,  9, 97,100,100, 95,116,111,107,101,110, 40,111,\n    102,115, 41, 10,  9, 45, 45,105,102, 32,114,101,116, 46,110,\n     32, 61, 61, 32, 48, 32,116,104,101,110, 10, 10,  9, 45, 45,\n      9,114,101,116, 46,110, 61, 49, 10,  9, 45, 45,  9,114,101,\n    116, 91, 49, 93, 32, 61, 32, 34, 34, 10,  9, 45, 45,101,110,\n    100, 10, 10,  9,114,101,116,117,114,110, 32,114,101,116, 10,\n     10,101,110,100, 10, 10, 45, 45, 32, 99,111,110, 99, 97,116,\n    101,110, 97,116,101, 32,115,116,114,105,110,103,115, 32,111,\n    102, 32, 97, 32,116, 97, 98,108,101, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,111,110, 99, 97,116, 32, 40,116, 44,102,\n     44,108, 44,106,115,116,114, 41, 10,  9,106,115,116,114, 32,\n     61, 32,106,115,116,114, 32,111,114, 32, 34, 32, 34, 10, 32,\n    108,111, 99, 97,108, 32,115, 32, 61, 32, 39, 39, 10, 32,108,\n    111, 99, 97,108, 32,105, 61,102, 10, 32,119,104,105,108,101,\n     32,105, 60, 61,108, 32,100,111, 10, 32, 32,115, 32, 61, 32,\n    115, 46, 46,116, 91,105, 93, 10, 32, 32,105, 32, 61, 32,105,\n     43, 49, 10, 32, 32,105,102, 32,105, 32, 60, 61, 32,108, 32,\n    116,104,101,110, 32,115, 32, 61, 32,115, 46, 46,106,115,116,\n    114, 32,101,110,100, 10, 32,101,110,100, 10, 32,114,101,116,\n    117,114,110, 32,115, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n    111,110, 99, 97,116,101,110, 97,116,101, 32, 97,108,108, 32,\n    112, 97,114, 97,109,101,116,101,114,115, 44, 32,102,111,108,\n    108,111,119,105,110,103, 32,111,117,116,112,117,116, 32,114,\n    117,108,101,115, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    111,110, 99, 97,116,112, 97,114, 97,109, 32, 40,108,105,110,\n    101, 44, 32, 46, 46, 46, 41, 10, 32,108,111, 99, 97,108, 32,\n    105, 61, 49, 10, 32,119,104,105,108,101, 32,105, 60, 61, 97,\n    114,103, 46,110, 32,100,111, 10, 32, 32,105,102, 32, 95, 99,\n    111,110,116, 32, 97,110,100, 32,110,111,116, 32,115,116,114,\n    102,105,110,100, 40, 95, 99,111,110,116, 44, 39, 91, 37, 40,\n     44, 34, 93, 39, 41, 32, 97,110,100, 10, 32, 32, 32, 32, 32,\n    115,116,114,102,105,110,100, 40, 97,114,103, 91,105, 93, 44,\n     34, 94, 91, 37, 97, 95,126, 93, 34, 41, 32,116,104,101,110,\n     10,  9, 32, 32, 32, 32,108,105,110,101, 32, 61, 32,108,105,\n    110,101, 32, 46, 46, 32, 39, 32, 39, 10, 32, 32,101,110,100,\n     10, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32,\n     46, 46, 32, 97,114,103, 91,105, 93, 10, 32, 32,105,102, 32,\n     97,114,103, 91,105, 93, 32,126, 61, 32, 39, 39, 32,116,104,\n    101,110, 10, 32, 32, 32, 95, 99,111,110,116, 32, 61, 32,115,\n    116,114,115,117, 98, 40, 97,114,103, 91,105, 93, 44, 45, 49,\n     44, 45, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,105,102, 32,\n    115,116,114,102,105,110,100, 40, 97,114,103, 91, 97,114,103,\n     46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37, 59, 37,123, 37,\n    125, 93, 36, 34, 41, 32,116,104,101,110, 10, 32, 32, 95, 99,\n    111,110,116, 61,110,105,108, 32,108,105,110,101, 32, 61, 32,\n    108,105,110,101, 32, 46, 46, 32, 39, 92,110, 39, 10, 32,101,\n    110,100, 10,  9,114,101,116,117,114,110, 32,108,105,110,101,\n     10,101,110,100, 10, 10, 45, 45, 32,111,117,116,112,117,116,\n     32,108,105,110,101, 10,102,117,110, 99,116,105,111,110, 32,\n    111,117,116,112,117,116, 32, 40, 46, 46, 46, 41, 10, 32,108,\n    111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101,\n     32,105, 60, 61, 97,114,103, 46,110, 32,100,111, 10, 32, 32,\n    105,102, 32, 95, 99,111,110,116, 32, 97,110,100, 32,110,111,\n    116, 32,115,116,114,102,105,110,100, 40, 95, 99,111,110,116,\n     44, 39, 91, 37, 40, 44, 34, 93, 39, 41, 32, 97,110,100, 10,\n     32, 32, 32, 32, 32,115,116,114,102,105,110,100, 40, 97,114,\n    103, 91,105, 93, 44, 34, 94, 91, 37, 97, 95,126, 93, 34, 41,\n     32,116,104,101,110, 10,  9, 32, 32, 32, 32,119,114,105,116,\n    101, 40, 39, 32, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32,\n    119,114,105,116,101, 40, 97,114,103, 91,105, 93, 41, 10, 32,\n     32,105,102, 32, 97,114,103, 91,105, 93, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,111,110,116,\n     32, 61, 32,115,116,114,115,117, 98, 40, 97,114,103, 91,105,\n     93, 44, 45, 49, 44, 45, 49, 41, 10, 32, 32,101,110,100, 10,\n     32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,\n     32,105,102, 32,115,116,114,102,105,110,100, 40, 97,114,103,\n     91, 97,114,103, 46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37,\n     59, 37,123, 37,125, 93, 36, 34, 41, 32,116,104,101,110, 10,\n     32, 32, 95, 99,111,110,116, 61,110,105,108, 32,119,114,105,\n    116,101, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101,\n    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,103,101,\n    116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104,\n    111,100,115, 40,112,116,121,112,101, 44, 32,110, 97,109,101,\n     41, 10, 10,  9,105,102, 32,103,101,116, 95,112,114,111,112,\n    101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111,\n    111,107, 32, 97,110,100, 32,103,101,116, 95,112,114,111,112,\n    101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,111,\n    111,107, 40,112,116,121,112,101, 44,110, 97,109,101, 41, 32,\n    116,104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,103,\n    101,116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,\n    104,111,100,115, 95,104,111,111,107, 40,112,116,121,112,101,\n     44, 32,110, 97,109,101, 41, 10,  9,101,110,100, 10, 10,  9,\n    105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,100,101,\n    102, 97,117,108,116, 34, 32,116,104,101,110, 32, 45, 45, 32,\n    103,101,116, 95,110, 97,109,101, 44, 32,115,101,116, 95,110,\n     97,109,101, 10,  9,  9,114,101,116,117,114,110, 32, 34,103,\n    101,116, 95, 34, 46, 46,110, 97,109,101, 44, 32, 34,115,101,\n    116, 95, 34, 46, 46,110, 97,109,101, 10,  9,101,110,100, 10,\n     10,  9,105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,\n    113,116, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97,109,\n    101, 44, 32,115,101,116, 78, 97,109,101, 10,  9,  9,114,101,\n    116,117,114,110, 32,110, 97,109,101, 44, 32, 34,115,101,116,\n     34, 46, 46,115,116,114,105,110,103, 46,117,112,112,101,114,\n     40,115,116,114,105,110,103, 46,115,117, 98, 40,110, 97,109,\n    101, 44, 32, 49, 44, 32, 49, 41, 41, 46, 46,115,116,114,105,\n    110,103, 46,115,117, 98, 40,110, 97,109,101, 44, 32, 50, 44,\n     32, 45, 49, 41, 10,  9,101,110,100, 10, 10,  9,105,102, 32,\n    112,116,121,112,101, 32, 61, 61, 32, 34,111,118,101,114,108,\n    111, 97,100, 34, 32,116,104,101,110, 32, 45, 45, 32,110, 97,\n    109,101, 44, 32,110, 97,109,101, 10,  9,  9,114,101,116,117,\n    114,110, 32,110, 97,109,101, 44,110, 97,109,101, 10,  9,101,\n    110,100, 10, 10,  9,114,101,116,117,114,110, 32,110,105,108,\n     10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 32,116,104,101, 32,104,111,111,107,115,\n     10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32,114,105,103,\n    104,116, 32, 97,102,116,101,114, 32,112,114,111, 99,101,115,\n    115,105,110,103, 32,116,104,101, 32, 36, 91,105, 99,104,108,\n     93,102,105,108,101, 32,100,105,114,101, 99,116,105,118,101,\n    115, 44, 10, 45, 45, 32,114,105,103,104,116, 32, 98,101,102,\n    111,114,101, 32,112,114,111, 99,101,115,115,105,110,103, 32,\n     97,110,121,116,104,105,110,103, 32,101,108,115,101, 10, 45,\n     45, 32,116, 97,107,101,115, 32,116,104,101, 32,112, 97, 99,\n    107, 97,103,101, 32,111, 98,106,101, 99,116, 32, 97,115, 32,\n    116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 10,102,\n    117,110, 99,116,105,111,110, 32,112,114,101,112,114,111, 99,\n    101,115,115, 95,104,111,111,107, 40,112, 41, 10,  9, 45, 45,\n     32,112, 46, 99,111,100,101, 32,104, 97,115, 32, 97,108,108,\n     32,116,104,101, 32,105,110,112,117,116, 32, 99,111,100,101,\n     32,102,114,111,109, 32,116,104,101, 32,112,107,103, 10,101,\n    110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32,\n    102,111,114, 32,101,118,101,114,121, 32, 36,105,102,105,108,\n    101, 32,100,105,114,101, 99,116,105,118,101, 10, 45, 45, 32,\n    116, 97,107,101,115, 32, 97, 32,116, 97, 98,108,101, 32,119,\n    105,116,104, 32, 97, 32,115,116,114,105,110,103, 32, 99, 97,\n    108,108,101,100, 32, 39, 99,111,100,101, 39, 32,105,110,115,\n    105,100,101, 44, 32,116,104,101, 32,102,105,108,101,110, 97,\n    109,101, 44, 32, 97,110,100, 32, 97,110,121, 32,101,120,116,\n    114, 97, 32, 97,114,103,117,109,101,110,116,115, 10, 45, 45,\n     32,112, 97,115,115,101,100, 32,116,111, 32, 36,105,102,105,\n    108,101, 46, 32,110,111, 32,114,101,116,117,114,110, 32,118,\n     97,108,117,101, 10,102,117,110, 99,116,105,111,110, 32,105,\n    110, 99,108,117,100,101, 95,102,105,108,101, 95,104,111,111,\n    107, 40,116, 44, 32,102,105,108,101,110, 97,109,101, 44, 32,\n     46, 46, 46, 41, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n     97,108,108,101,100, 32, 97,102,116,101,114, 32,112,114,111,\n     99,101,115,115,105,110,103, 32, 97,110,121,116,104,105,110,\n    103, 32,116,104, 97,116, 39,115, 32,110,111,116, 32, 99,111,\n    100,101, 32, 40,108,105,107,101, 32, 39, 36,114,101,110, 97,\n    109,105,110,103, 39, 44, 32, 99,111,109,109,101,110,116,115,\n     44, 32,101,116, 99, 41, 10, 45, 45, 32, 97,110,100, 32,114,\n    105,103,104,116, 32, 98,101,102,111,114,101, 32,112, 97,114,\n    115,105,110,103, 32,116,104,101, 32, 97, 99,116,117, 97,108,\n     32, 99,111,100,101, 46, 10, 45, 45, 32,116, 97,107,101,115,\n     32,116,104,101, 32, 80, 97, 99,107, 97,103,101, 32,111, 98,\n    106,101, 99,116, 32,119,105,116,104, 32, 97,108,108, 32,116,\n    104,101, 32, 99,111,100,101, 32,111,110, 32,116,104,101, 32,\n     39, 99,111,100,101, 39, 32,107,101,121, 46, 32,110,111, 32,\n    114,101,116,117,114,110, 32,118, 97,108,117,101, 10,102,117,\n    110, 99,116,105,111,110, 32,112,114,101,112, 97,114,115,101,\n     95,104,111,111,107, 40,112, 97, 99,107, 97,103,101, 41, 10,\n     10,101,110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,108,101,\n    100, 32, 97,102,116,101,114, 32,119,114,105,116,105,110,103,\n     32, 97,108,108, 32,116,104,101, 32,111,117,116,112,117,116,\n     46, 10, 45, 45, 32,116, 97,107,101,115, 32,116,104,101, 32,\n     80, 97, 99,107, 97,103,101, 32,111, 98,106,101, 99,116, 10,\n    102,117,110, 99,116,105,111,110, 32,112,111,115,116, 95,111,\n    117,116,112,117,116, 95,104,111,111,107, 40,112, 97, 99,107,\n     97,103,101, 41, 10, 10,101,110,100, 10, 10, 10, 45, 45, 32,\n     99, 97,108,108,101,100, 32,102,114,111,109, 32, 39,103,101,\n    116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104,\n    111,100,115, 39, 32,116,111, 32,103,101,116, 32,116,104,101,\n     32,109,101,116,104,111,100,115, 32,116,111, 32,114,101,116,\n    114,105,101,118,101, 32, 97, 32,112,114,111,112,101,114,116,\n    121, 10, 45, 45, 32, 97, 99, 99,111,114,100,105,110,103, 32,\n    116,111, 32,105,116,115, 32,116,121,112,101, 10,102,117,110,\n     99,116,105,111,110, 32,103,101,116, 95,112,114,111,112,101,\n    114,116,121, 95,109,101,116,104,111,100,115, 95,104,111,111,\n    107, 40,112,114,111,112,101,114,116,121, 95,116,121,112,101,\n     44, 32,110, 97,109,101, 41, 10, 10,101,110,100, 10, 10, 45,\n     45, 32, 99, 97,108,108,101,100, 32,102,114,111,109, 32, 67,\n    108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,100,\n    111,112, 97,114,115,101, 32,119,105,116,104, 32,116,104,101,\n     32,115,116,114,105,110,103, 32, 98,101,105,110,103, 32,112,\n     97,114,115,101,100, 10, 45, 45, 32,114,101,116,117,114,110,\n     32,110,105,108, 44, 32,111,114, 32, 97, 32,115,117, 98,115,\n    116,114,105,110,103, 10,102,117,110, 99,116,105,111,110, 32,\n    112, 97,114,115,101,114, 95,104,111,111,107, 40,115, 41, 10,\n     10,  9,114,101,116,117,114,110, 32,110,105,108, 10,101,110,\n    100, 10, 10, 45, 45, 32, 99,117,115,116,111,109, 32,112,117,\n    115,104,101,114,115, 10, 10, 95,112,117,115,104, 95,102,117,\n    110, 99,116,105,111,110,115, 32, 61, 32,123,125, 10, 95,105,\n    115, 95,102,117,110, 99,116,105,111,110,115, 32, 61, 32,123,\n    125, 10, 95,116,111, 95,102,117,110, 99,116,105,111,110,115,\n     32, 61, 32,123,125, 10, 10, 95, 98, 97,115,101, 95,112,117,\n    115,104, 95,102,117,110, 99,116,105,111,110,115, 32, 61, 32,\n    123,125, 10, 95, 98, 97,115,101, 95,105,115, 95,102,117,110,\n     99,116,105,111,110,115, 32, 61, 32,123,125, 10, 95, 98, 97,\n    115,101, 95,116,111, 95,102,117,110, 99,116,105,111,110,115,\n     32, 61, 32,123,125, 10, 10,108,111, 99, 97,108, 32,102,117,\n    110, 99,116,105,111,110, 32,115,101, 97,114, 99,104, 95, 98,\n     97,115,101, 40,116, 44, 32,102,117,110, 99,115, 41, 10, 10,\n      9,108,111, 99, 97,108, 32, 99,108, 97,115,115, 32, 61, 32,\n     95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115,\n     91,116, 93, 10, 10,  9,119,104,105,108,101, 32, 99,108, 97,\n    115,115, 32,100,111, 10,  9,  9,105,102, 32,102,117,110, 99,\n    115, 91, 99,108, 97,115,115, 46,116,121,112,101, 93, 32,116,\n    104,101,110, 10,  9,  9,  9,114,101,116,117,114,110, 32,102,\n    117,110, 99,115, 91, 99,108, 97,115,115, 46,116,121,112,101,\n     93, 10,  9,  9,101,110,100, 10,  9,  9, 99,108, 97,115,115,\n     32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,\n    115,101,115, 91, 99,108, 97,115,115, 46, 98,116,121,112,101,\n     93, 10,  9,101,110,100, 10,  9,114,101,116,117,114,110, 32,\n    110,105,108, 10,101,110,100, 10, 10,102,117,110, 99,116,105,\n    111,110, 32,103,101,116, 95,112,117,115,104, 95,102,117,110,\n     99,116,105,111,110, 40,116, 41, 10,  9,114,101,116,117,114,\n    110, 32, 95,112,117,115,104, 95,102,117,110, 99,116,105,111,\n    110,115, 91,116, 93, 32,111,114, 32,115,101, 97,114, 99,104,\n     95, 98, 97,115,101, 40,116, 44, 32, 95, 98, 97,115,101, 95,\n    112,117,115,104, 95,102,117,110, 99,116,105,111,110,115, 41,\n     32,111,114, 32, 34,116,111,108,117, 97, 95,112,117,115,104,\n    117,115,101,114,116,121,112,101, 34, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,103,101,116, 95,116,111,\n     95,102,117,110, 99,116,105,111,110, 40,116, 41, 10,  9,114,\n    101,116,117,114,110, 32, 95,116,111, 95,102,117,110, 99,116,\n    105,111,110,115, 91,116, 93, 32,111,114, 32,115,101, 97,114,\n     99,104, 95, 98, 97,115,101, 40,116, 44, 32, 95, 98, 97,115,\n    101, 95,116,111, 95,102,117,110, 99,116,105,111,110,115, 41,\n     32,111,114, 32, 34,116,111,108,117, 97, 95,116,111,117,115,\n    101,114,116,121,112,101, 34, 10,101,110,100, 10, 10,102,117,\n    110, 99,116,105,111,110, 32,103,101,116, 95,105,115, 95,102,\n    117,110, 99,116,105,111,110, 40,116, 41, 10,  9,114,101,116,\n    117,114,110, 32, 95,105,115, 95,102,117,110, 99,116,105,111,\n    110,115, 91,116, 93, 32,111,114, 32,115,101, 97,114, 99,104,\n     95, 98, 97,115,101, 40,116, 44, 32, 95, 98, 97,115,101, 95,\n    105,115, 95,102,117,110, 99,116,105,111,110,115, 41, 32,111,\n    114, 32, 34,116,111,108,117, 97, 95,105,115,117,115,101,114,\n    116,121,112,101, 34, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/basic.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 97, 98,115,116,114,\n     97, 99,116, 32,102,101, 97,116,117,114,101, 32, 99,108, 97,\n    115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32, 98,\n    121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,101,\n    115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80, 85,\n     67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49, 57,\n     57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45,\n     45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,\n    102,114,101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,\n    121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,\n    105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,111,114,\n     32,109,111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32,\n     84,104,101, 32,115,111,102,116,119, 97,114,101, 32,112,114,\n    111,118,105,100,101,100, 32,104,101,114,101,117,110,100,101,\n    114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,\n    105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10,\n     45, 45, 32,116,104,101, 32, 97,117,116,104,111,114, 32,104,\n     97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,105,111,\n    110, 32,116,111, 32,112,114,111,118,105,100,101, 32,109, 97,\n    105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,\n    111,114,116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45,\n     45, 32,101,110,104, 97,110, 99,101,109,101,110,116,115, 44,\n     32,111,114, 32,109,111,100,105,102,105, 99, 97,116,105,111,\n    110,115, 46, 10, 10, 10, 45, 45, 32, 70,101, 97,116,117,114,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,\n    101,115,101,110,116,115, 32,116,104,101, 32, 98, 97,115,101,\n     32, 99,108, 97,115,115, 32,111,102, 32, 97,108,108, 32,109,\n     97,112,112,101,100, 32,102,101, 97,116,117,114,101, 46, 10,\n     99,108, 97,115,115, 70,101, 97,116,117,114,101, 32, 61, 32,\n    123, 10,125, 10, 99,108, 97,115,115, 70,101, 97,116,117,114,\n    101, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,\n    115,115, 70,101, 97,116,117,114,101, 10, 10, 45, 45, 32,119,\n    114,105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,\n    100,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 70,101, 97,116,117,114,101, 58,115,117,112, 99,111,\n    100,101, 32, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,111,\n    117,116,112,117,116, 32,116, 97,103, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,\n    101, 58,100,101, 99,108,116,121,112,101, 32, 40, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,114,\n     32,102,101, 97,116,117,114,101, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101,\n     58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41,\n     10,101,110,100, 10, 10, 45, 45, 32,116,114, 97,110,115,108,\n     97,116,101, 32,118,101,114, 98, 97,116,105,109, 10,102,117,\n    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,\n    116,117,114,101, 58,112,114,101, 97,109, 98,108,101, 32, 40,\n     41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107,\n     32,105,102, 32,105,116, 32,105,115, 32, 97, 32,118, 97,114,\n    105, 97, 98,108,101, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,115,\n    118, 97,114,105, 97, 98,108,101, 32, 40, 41, 10, 32,114,101,\n    116,117,114,110, 32,102, 97,108,115,101, 10,101,110,100, 10,\n     10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,105,116,\n     32,114,101,113,117,105,114,101,115, 32, 99,111,108,108,101,\n     99,116,105,111,110, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,114,101,\n    113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,110,\n     32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,102, 97,\n    108,115,101, 10,101,110,100, 10, 10, 45, 45, 32, 98,117,105,\n    108,100, 32,110, 97,109,101,115, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101,\n     58, 98,117,105,108,100,110, 97,109,101,115, 32, 40, 41, 10,\n     32,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32, 97,\n    110,100, 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,\n     39, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32,\n    110, 32, 61, 32,115,112,108,105,116, 40,115,101,108,102, 46,\n    110, 97,109,101, 44, 39, 64, 39, 41, 10, 32, 32,115,101,108,\n    102, 46,110, 97,109,101, 32, 61, 32,110, 91, 49, 93, 10, 32,\n     32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40,115,101,108,102, 46,\n    110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36, 34, 44, 32,\n     34, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32,110, 91,\n     50, 93, 32,116,104,101,110, 10, 32, 32, 32,110, 91, 50, 93,\n     32, 61, 32, 97,112,112,108,121,114,101,110, 97,109,105,110,\n    103, 40,110, 91, 49, 93, 41, 10, 32, 32,101,110,100, 10, 32,\n     32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32,110,\n     91, 50, 93, 32,111,114, 32,103,115,117, 98, 40,110, 91, 49,\n     93, 44, 34, 37, 91, 46, 45, 37, 93, 34, 44, 34, 34, 41, 10,\n     32, 32,115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32,\n    115,116,114,105,110,103, 46,103,115,117, 98, 40,115,101,108,\n    102, 46,108,110, 97,109,101, 44, 32, 34, 58, 37,100, 42, 36,\n     34, 44, 32, 34, 34, 41, 10, 32, 32,115,101,108,102, 46,111,\n    114,105,103,105,110, 97,108, 95,110, 97,109,101, 32, 61, 32,\n    115,101,108,102, 46,110, 97,109,101, 10, 32, 32,115,101,108,\n    102, 46,108,110, 97,109,101, 32, 61, 32, 99,108,101, 97,110,\n     95,116,101,109,112,108, 97,116,101, 40,115,101,108,102, 46,\n    108,110, 97,109,101, 41, 10, 32,101,110,100, 10, 32,105,102,\n     32,110,111,116, 32,115,101,108,102, 46,105,115, 95,112, 97,\n    114, 97,109,101,116,101,114, 32,116,104,101,110, 10,  9, 32,\n    115,101,108,102, 46,110, 97,109,101, 32, 61, 32,103,101,116,\n    111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 40, 41,\n     32, 46, 46, 32,115,101,108,102, 46,110, 97,109,101, 10, 32,\n    101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,112, 97,114,\n    101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 46, 99,117,114,114, 10, 32,105,102, 32,\n    112, 97,114,101,110,116, 32,116,104,101,110, 10, 32,  9,115,\n    101,108,102, 46, 97, 99, 99,101,115,115, 32, 61, 32,112, 97,\n    114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98,101,\n    114, 95, 97, 99, 99,101,115,115, 10,  9,115,101,108,102, 46,\n    103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61,\n     32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98,\n    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 32,101,\n    108,115,101, 10, 32,101,110,100, 10,101,110,100, 10, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101,\n     97,116,117,114,101, 58, 99,104,101, 99,107, 95,112,117, 98,\n    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 10,  9,\n    105,102, 32,116,121,112,101, 40,115,101,108,102, 46,103,108,\n    111, 98, 97,108, 95, 97, 99, 99,101,115,115, 41, 32, 61, 61,\n     32, 34, 98,111,111,108,101, 97,110, 34, 32,116,104,101,110,\n     10,  9,  9,114,101,116,117,114,110, 32,115,101,108,102, 46,\n    103,108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 10,  9,\n    101,110,100, 10, 10,  9,105,102, 32,115,101,108,102, 46, 97,\n     99, 99,101,115,115, 32, 97,110,100, 32,115,101,108,102, 46,\n     97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104,101,\n    110, 10,  9,  9,114,101,116,117,114,110, 32,102, 97,108,115,\n    101, 10,  9,101,110,100, 10, 10,  9,108,111, 99, 97,108, 32,\n    112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,  9,\n    119,104,105,108,101, 32,112, 97,114,101,110,116, 32,100,111,\n     10,  9,  9,105,102, 32,112, 97,114,101,110,116, 46, 97, 99,\n     99,101,115,115, 32, 97,110,100, 32,112, 97,114,101,110,116,\n     46, 97, 99, 99,101,115,115, 32,126, 61, 32, 48, 32,116,104,\n    101,110, 10,  9,  9,  9,114,101,116,117,114,110, 32,102, 97,\n    108,115,101, 10,  9,  9,101,110,100, 10,  9,  9,112, 97,114,\n    101,110,116, 32, 61, 32,112, 97,114,101,110,116, 46,112,114,\n    111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,114,110,\n     32,116,114,117,101, 10,101,110,100, 10, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108,101, 97,110, 95,116,101,109,112,\n    108, 97,116,101, 40,116, 41, 10, 10,  9,114,101,116,117,114,\n    110, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,\n     44, 32, 34, 91, 60, 62, 58, 44, 32, 37, 42, 93, 34, 44, 32,\n     34, 95, 34, 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,\n    101, 99,107, 32,105,102, 32,102,101, 97,116,117,114,101, 32,\n    105,115, 32,105,110,115,105,100,101, 32, 97, 32, 99,111,110,\n    116, 97,105,110,101,114, 32,100,101,102,105,110,105,116,105,\n    111,110, 10, 45, 45, 32,105,116, 32,114,101,116,117,114,110,\n    115, 32,116,104,101, 32, 99,111,110,116, 97,105,110,101,114,\n     32, 99,108, 97,115,115, 32,110, 97,109,101, 32,111,114, 32,\n    110,105,108, 46, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,110, 99,\n    111,110,116, 97,105,110,101,114, 32, 40,119,104,105, 99,104,\n     41, 10, 32,105,102, 32,115,101,108,102, 46,112, 97,114,101,\n    110,116, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108,\n     32,112, 97,114,101,110,116, 32, 61, 32,115,101,108,102, 46,\n    112, 97,114,101,110,116, 10, 32, 32,119,104,105,108,101, 32,\n    112, 97,114,101,110,116, 32,100,111, 10, 32, 32, 32,105,102,\n     32,112, 97,114,101,110,116, 46, 99,108, 97,115,115,116,121,\n    112,101, 32, 61, 61, 32,119,104,105, 99,104, 32,116,104,101,\n    110, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,112, 97,\n    114,101,110,116, 46,110, 97,109,101, 10, 32, 32, 32,101,110,\n    100, 10, 32, 32, 32,112, 97,114,101,110,116, 32, 61, 32,112,\n     97,114,101,110,116, 46,112, 97,114,101,110,116, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 32,114,101,116,117,114,\n    110, 32,110,105,108, 10,101,110,100, 10, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,\n    114,101, 58,105,110, 99,108, 97,115,115, 32, 40, 41, 10, 32,\n    114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99,\n    111,110,116, 97,105,110,101,114, 40, 39, 99,108, 97,115,115,\n     39, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,\n    105,110,109,111,100,117,108,101, 32, 40, 41, 10, 32,114,101,\n    116,117,114,110, 32,115,101,108,102, 58,105,110, 99,111,110,\n    116, 97,105,110,101,114, 40, 39,109,111,100,117,108,101, 39,\n     41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,\n    110,110, 97,109,101,115,112, 97, 99,101, 32, 40, 41, 10, 32,\n    114,101,116,117,114,110, 32,115,101,108,102, 58,105,110, 99,\n    111,110,116, 97,105,110,101,114, 40, 39,110, 97,109,101,115,\n    112, 97, 99,101, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,\n    114,101,116,117,114,110, 32, 67, 32, 98,105,110,100,105,110,\n    103, 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101,\n     32, 98, 97,115,101,100, 32,111,110, 32,110, 97,109,101, 10,\n     45, 45, 32,116,104,101, 32, 99,108,105,101,110,116, 32,115,\n    112,101, 99,105,102,105,101,115, 32, 97, 32,112,114,101,102,\n    105,120, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 70,101, 97,116,117,114,101, 58, 99,102,117,110, 99,\n    110, 97,109,101, 32, 40,110, 41, 10, 10, 32,105,102, 32,115,\n    101,108,102, 46,112, 97,114,101,110,116, 32,116,104,101,110,\n     10, 32, 32,110, 32, 61, 32,115,101,108,102, 46,112, 97,114,\n    101,110,116, 58, 99,102,117,110, 99,110, 97,109,101, 40,110,\n     41, 10, 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,\n    102,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,108,110,\n     97,109,101, 10, 32,105,102, 32,110,111,116, 32,102,110, 97,\n    109,101, 32,111,114, 32,102,110, 97,109,101, 32, 61, 61, 32,\n     39, 39, 32,116,104,101,110, 10, 32,  9,102,110, 97,109,101,\n     32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10, 32,101,\n    110,100, 10, 32, 32,110, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,110, 46, 46, 39, 95, 39, 46, 46, 32,\n     40,102,110, 97,109,101, 41, 44, 32, 34, 91, 60, 62, 58, 44,\n     32, 92, 46, 37, 42, 38, 93, 34, 44, 32, 34, 95, 34, 41, 10,\n     10, 32, 32,114,101,116,117,114,110, 32,110, 10,101,110,100,\n    32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/feature.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,118,101,114, 98, 97,\n    116,105,109, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32,118,101,114, 98, 97,116,105,109, 46,108,117, 97,\n     44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48, 49, 47,\n     50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 54, 32, 99,101,108,\n    101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,\n    105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101,\n     32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32,\n     99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,\n    101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,\n    105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,\n    115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,\n    101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115,\n     32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32,\n     98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,\n    104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,\n    111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111,\n     32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,\n    110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44,\n     32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,\n    104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,\n    109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10,\n     10, 10, 10, 45, 45, 32, 86,101,114, 98, 97,116,105,109, 32,\n     99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115,\n    101,110,116,115, 32, 97, 32,108,105,110,101, 32,116,114, 97,\n    110,115,108, 97,116,101,100, 32,100,105,114,101, 99,116,101,\n    100, 32,116,111, 32,116,104,101, 32, 98,105,110,100,105,110,\n    103, 32,102,105,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,\n    102,111,108,108,111,119,105,110,103, 32,102,105,108,100,115,\n     32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45,\n     32, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32,\n    116,101,120,116, 10, 99,108, 97,115,115, 86,101,114, 98, 97,\n    116,105,109, 32, 61, 32,123, 10, 32,108,105,110,101, 32, 61,\n     32, 39, 39, 44, 10,  9, 99,111,110,100, 32, 61, 32,110,105,\n    108, 44, 32, 32, 32, 32, 45, 45, 32, 99,111,110,100,105,116,\n    105,111,110, 58, 32,119,104,101,114,101, 32,116,111, 32,103,\n    101,110,101,114, 97,116,101, 32,116,104,101, 32, 99,111,100,\n    101, 32, 40,115, 61,115,117,112,111,114,116, 44, 32,114, 61,\n    114,101,103,105,115,116,101,114, 41, 10,125, 10, 99,108, 97,\n    115,115, 86,101,114, 98, 97,116,105,109, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 86,101,114, 98,\n     97,116,105,109, 10,115,101,116,109,101,116, 97,116, 97, 98,\n    108,101, 40, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,\n    109, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41,\n     10, 10, 45, 45, 32,112,114,101, 97,109, 98,108,101, 32,118,\n    101,114, 98, 97,116,105,109, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109,\n     58,112,114,101, 97,109, 98,108,101, 32, 40, 41, 10, 32,105,\n    102, 32,115,101,108,102, 46, 99,111,110,100, 32, 61, 61, 32,\n     39, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,101,\n     40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,110,\n    100, 10,101,110,100, 10, 10, 45, 45, 32,115,117,112,112,111,\n    114,116, 32, 99,111,100,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109,\n     58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,105,102,\n     32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, 99,\n    111,110,100, 44, 39,115, 39, 41, 32,116,104,101,110, 10, 32,\n     32,119,114,105,116,101, 40,115,101,108,102, 46,108,105,110,\n    101, 41, 10, 32, 32,119,114,105,116,101, 40, 39, 92,110, 39,\n     41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n    114,101,103,105,115,116,101,114, 32, 99,111,100,101, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 86,101,\n    114, 98, 97,116,105,109, 58,114,101,103,105,115,116,101,114,\n     32, 40,112,114,101, 41, 10, 32,105,102, 32,115,116,114,102,\n    105,110,100, 40,115,101,108,102, 46, 99,111,110,100, 44, 39,\n    114, 39, 41, 32,116,104,101,110, 10, 32, 32,119,114,105,116,\n    101, 40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,\n    110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,114,105,\n    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,\n    105,109, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,\n     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 86,101,114, 98, 97,116,105,\n    109,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,108,105,110,101, 32, 61, 32, 39, 34,\n     46, 46,115,101,108,102, 46,108,105,110,101, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,\n    101,110,100, 10, 10, 10, 45, 45, 32, 73,110,116,101,114,110,\n     97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,\n    102,117,110, 99,116,105,111,110, 32, 95, 86,101,114, 98, 97,\n    116,105,109, 32, 40,116, 41, 10, 32,115,101,116,109,101,116,\n     97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 86,\n    101,114, 98, 97,116,105,109, 41, 10, 32, 97,112,112,101,110,\n    100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, 10,\n    101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117,\n     99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,115,\n     32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114,101,\n    115,101,110,116,105,110,103, 32,116,104,101, 32,116,101,120,\n    116, 32,108,105,110,101, 10,102,117,110, 99,116,105,111,110,\n     32, 86,101,114, 98, 97,116,105,109, 32, 40,108, 44, 99,111,\n    110,100, 41, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,\n    108, 44, 49, 44, 49, 41, 32, 61, 61, 32, 34, 39, 34, 32,116,\n    104,101,110, 10, 32, 32,108, 32, 61, 32,115,116,114,115,117,\n     98, 40,108, 44, 50, 41, 10, 32,101,108,115,101,105,102, 32,\n    115,116,114,115,117, 98, 40,108, 44, 49, 44, 49, 41, 32, 61,\n     61, 32, 39, 36, 39, 32,116,104,101,110, 10, 32, 32, 99,111,\n    110,100, 32, 61, 32, 39,115,114, 39, 32, 32, 32, 32, 32, 32,\n     32, 45, 45, 32,103,101,110,101,114, 97,116,101,115, 32,105,\n    110, 32, 98,111,116,104, 32,115,117,112,111,114,116, 32, 97,\n    110,100, 32,114,101,103,105,115,116,101,114, 32,102,114, 97,\n    103,109,101,110,116,115, 10, 32, 32,108, 32, 61, 32,115,116,\n    114,115,117, 98, 40,108, 44, 50, 41, 10, 32,101,110,100, 10,\n     32,114,101,116,117,114,110, 32, 95, 86,101,114, 98, 97,116,\n    105,109, 32,123, 10, 32, 32,108,105,110,101, 32, 61, 32,108,\n     44, 10, 32, 32, 99,111,110,100, 32, 61, 32, 99,111,110,100,\n     32,111,114, 32, 39, 39, 44, 10, 32,125, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/verbatim.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,100,101, 32,\n     99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,\n    110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,\n    101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102,\n     47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108,\n     32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32, 36,\n     10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,\n    105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,\n    101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,\n    115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100,\n     47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10,\n     45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101,\n     32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117,\n    110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34,\n     97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,\n    110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,\n    114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,\n    116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101,\n     32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,\n    117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115,\n     44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,\n    116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,\n    116,105,111,110,115, 46, 10, 10, 45, 45, 32,103,108,111, 98,\n     97,108, 10, 99,111,100,101, 95,110, 32, 61, 32, 49, 10, 10,\n     45, 45, 32, 67,111,100,101, 32, 99,108, 97,115,115, 10, 45,\n     45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 76,117,\n     97, 32, 99,111,100,101, 32,116,111, 32, 98,101, 32, 99,111,\n    109,112,105,108,101,100, 32, 97,110,100, 32,105,110, 99,108,\n    117,100,101,100, 10, 45, 45, 32,105,110, 32,116,104,101, 32,\n    105,110,105,116,105, 97,108,105,122, 97,116,105,111,110, 32,\n    102,117,110, 99,116,105,111,110, 46, 10, 45, 45, 32, 84,104,\n    101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,101,\n    108,100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58,\n     10, 45, 45, 32, 32, 32,116,101,120,116, 32, 61, 32,116,101,\n    120,116, 32, 99,111,100,101, 10, 99,108, 97,115,115, 67,111,\n    100,101, 32, 61, 32,123, 10, 32,116,101,120,116, 32, 61, 32,\n     39, 39, 44, 10,125, 10, 99,108, 97,115,115, 67,111,100,101,\n     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,\n    115, 67,111,100,101, 10,115,101,116,109,101,116, 97,116, 97,\n     98,108,101, 40, 99,108, 97,115,115, 67,111,100,101, 44, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,\n     45, 32,114,101,103,105,115,116,101,114, 32, 99,111,100,101,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     67,111,100,101, 58,114,101,103,105,115,116,101,114, 32, 40,\n    112,114,101, 41, 10, 32,112,114,101, 32, 61, 32,112,114,101,\n     32,111,114, 32, 39, 39, 10, 32, 45, 45, 32, 99,108,101, 97,\n    110, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99,\n     97,108, 32,115, 32, 61, 32, 99,108,101, 97,110, 40,115,101,\n    108,102, 46,116,101,120,116, 41, 10, 32,105,102, 32,110,111,\n    116, 32,115, 32,116,104,101,110, 10, 32, 32, 45, 45,112,114,\n    105,110,116, 40,115,101,108,102, 46,116,101,120,116, 41, 10,\n     32, 32,101,114,114,111,114, 40, 34,112, 97,114,115,101,114,\n     32,101,114,114,111,114, 32,105,110, 32,101,109, 98,101,100,\n    100,101,100, 32, 99,111,100,101, 34, 41, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32,103,101,116, 32,102,105,114,115,116,\n     32,108,105,110,101, 10, 32,108,111, 99, 97,108, 32, 95, 44,\n     32, 95, 44, 32,102,105,114,115,116, 95,108,105,110,101, 61,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,\n    102, 46,116,101,120,116, 44, 32, 34, 94, 40, 91, 94, 92,110,\n     92,114, 93, 42, 41, 34, 41, 10, 32,105,102, 32,115,116,114,\n    105,110,103, 46,102,105,110,100, 40,102,105,114,115,116, 95,\n    108,105,110,101, 44, 32, 34, 94, 37,115, 42, 37, 45, 37, 45,\n     34, 41, 32,116,104,101,110, 10,  9, 32,105,102, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,102,105,114,115,116,\n     95,108,105,110,101, 44, 32, 34, 94, 37, 45, 37, 45, 35, 35,\n     34, 41, 32,116,104,101,110, 10,  9,  9,102,105,114,115,116,\n     95,108,105,110,101, 32, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40,102,105,114,115,116, 95,108,105,110,101,\n     44, 32, 34, 94, 37, 45, 37, 45, 35, 35, 34, 44, 32, 34, 34,\n     41, 10,  9,  9,105,102, 32,102,108, 97,103,115, 91, 39, 67,\n     39, 93, 32,116,104,101,110, 10,  9,  9,  9,115, 32, 61, 32,\n    115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32,\n     34, 94, 37, 45, 37, 45, 35, 35, 91, 94, 92,110, 92,114, 93,\n     42, 92,110, 34, 44, 32, 34, 34, 41, 10,  9,  9,101,110,100,\n     10,  9, 32,101,110,100, 10, 32,101,108,115,101, 10, 32,  9,\n    102,105,114,115,116, 95,108,105,110,101, 32, 61, 32, 34, 34,\n     10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,111,110,118,\n    101,114,116, 32,116,111, 32, 67, 10, 32,111,117,116,112,117,\n    116, 40, 39, 92,110, 39, 46, 46,112,114,101, 46, 46, 39,123,\n     32, 47, 42, 32, 98,101,103,105,110, 32,101,109, 98,101,100,\n    100,101,100, 32,108,117, 97, 32, 99,111,100,101, 32, 42, 47,\n     92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40,112,114,\n    101, 46, 46, 39, 32,105,110,116, 32,116,111,112, 32, 61, 32,\n    108,117, 97, 95,103,101,116,116,111,112, 40,116,111,108,117,\n     97, 95, 83, 41, 59, 39, 41, 10, 32,111,117,116,112,117,116,\n     40,112,114,101, 46, 46, 39, 32,115,116, 97,116,105, 99, 32,\n    117,110,115,105,103,110,101,100, 32, 99,104, 97,114, 32, 66,\n     91, 93, 32, 61, 32,123, 92,110, 32, 32, 32, 39, 41, 10, 32,\n    108,111, 99, 97,108, 32,116, 61,123,110, 61, 48,125, 10, 32,\n    108,111, 99, 97,108, 32, 98, 32, 61, 32,103,115,117, 98, 40,\n    115, 44, 39, 40, 46, 41, 39, 44,102,117,110, 99,116,105,111,\n    110, 32, 40, 99, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,108,111, 99, 97,108, 32,101, 32, 61, 32, 39, 39, 10, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32,116, 46,110, 61,116, 46,\n    110, 43, 49, 32,105,102, 32,116, 46,110, 61, 61, 49, 53, 32,\n    116,104,101,110, 32,116, 46,110, 61, 48, 32,101, 61, 39, 92,\n    110, 39, 46, 46,112,114,101, 46, 46, 39, 32, 32, 39, 32,101,\n    110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,\n    116,117,114,110, 32,102,111,114,109, 97,116, 40, 39, 37, 51,\n    117, 44, 37,115, 39, 44,115,116,114, 98,121,116,101, 40, 99,\n     41, 44,101, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,\n    110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 41, 10, 32,111,117,116,112,117,116, 40, 98, 46,\n     46,115,116,114, 98,121,116,101, 40, 34, 32, 34, 41, 41, 10,\n     32,111,117,116,112,117,116, 40, 39, 92,110, 39, 46, 46,112,\n    114,101, 46, 46, 39, 32,125, 59, 92,110, 39, 41, 10, 32,105,\n    102, 32,102,105,114,115,116, 95,108,105,110,101, 32, 97,110,\n    100, 32,102,105,114,115,116, 95,108,105,110,101, 32,126, 61,\n     32, 34, 34, 32,116,104,101,110, 10, 32,  9,111,117,116,112,\n    117,116, 40,112,114,101, 46, 46, 39, 32,116,111,108,117, 97,\n     95,100,111, 98,117,102,102,101,114, 40,116,111,108,117, 97,\n     95, 83, 44, 40, 99,104, 97,114, 42, 41, 66, 44,115,105,122,\n    101,111,102, 40, 66, 41, 44, 34,116,111,108,117, 97, 32,101,\n    109, 98,101,100,100,101,100, 58, 32, 39, 46, 46,102,105,114,\n    115,116, 95,108,105,110,101, 46, 46, 39, 34, 41, 59, 39, 41,\n     10, 32,101,108,115,101, 10, 32,  9,111,117,116,112,117,116,\n     40,112,114,101, 46, 46, 39, 32,116,111,108,117, 97, 95,100,\n    111, 98,117,102,102,101,114, 40,116,111,108,117, 97, 95, 83,\n     44, 40, 99,104, 97,114, 42, 41, 66, 44,115,105,122,101,111,\n    102, 40, 66, 41, 44, 34,116,111,108,117, 97, 58, 32,101,109,\n     98,101,100,100,101,100, 32, 76,117, 97, 32, 99,111,100,101,\n     32, 39, 46, 46, 99,111,100,101, 95,110, 46, 46, 39, 34, 41,\n     59, 39, 41, 10, 32,101,110,100, 10, 32,111,117,116,112,117,\n    116, 40,112,114,101, 46, 46, 39, 32,108,117, 97, 95,115,101,\n    116,116,111,112, 40,116,111,108,117, 97, 95, 83, 44, 32,116,\n    111,112, 41, 59, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n    112,114,101, 46, 46, 39,125, 32, 47, 42, 32,101,110,100, 32,\n    111,102, 32,101,109, 98,101,100,100,101,100, 32,108,117, 97,\n     32, 99,111,100,101, 32, 42, 47, 92,110, 92,110, 39, 41, 10,\n     32, 99,111,100,101, 95,110, 32, 61, 32, 99,111,100,101, 95,\n    110, 32, 43, 49, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,\n    114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,100,101,\n     58,112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,\n    108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 67,111,100,101,123, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    116,101,120,116, 32, 61, 32, 91, 91, 34, 46, 46,115,101,108,\n    102, 46,116,101,120,116, 46, 46, 34, 93, 93, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,\n     10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,\n    111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,\n    116,105,111,110, 32, 95, 67,111,100,101, 32, 40,116, 41, 10,\n     32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116,\n     44, 99,108, 97,115,115, 67,111,100,101, 41, 10, 32, 97,112,\n    112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,110,\n     32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,\n    116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101,\n     99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,101,\n    112,114,101,115,101,110,116,105,110,103, 32,116,104,101, 32,\n     99,111,100,101, 32,116,101,120,116, 10,102,117,110, 99,116,\n    105,111,110, 32, 67,111,100,101, 32, 40,108, 41, 10, 32,114,\n    101,116,117,114,110, 32, 95, 67,111,100,101, 32,123, 10, 32,\n     32,116,101,120,116, 32, 61, 32,108, 10, 32,125, 10,101,110,\n    100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/code.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,116,121,112,101,100,\n    101,102, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,\n    116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,\n    114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,\n    114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32,\n     74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100,\n     58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,\n    100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,\n    119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,\n    101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32,\n     97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,\n    116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119,\n     97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,\n    114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,\n    110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115,\n     44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,\n    116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,\n    105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,\n    105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101,\n     44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,\n    116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,\n    109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,\n    105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45,\n     32, 84,121,112,101,100,101,102, 32, 99,108, 97,115,115, 10,\n     45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97,\n     32,116,121,112,101, 32,115,121,110,111,110,121,109, 46, 10,\n     45, 45, 32, 84,104,101, 32, 39,100,101, 32,102, 97, 99,116,\n    111, 39, 32,116,121,112,101, 32,114,101,112,108, 97, 99,101,\n    115, 32,116,104,101, 32,116,121,112,101,100,101,102, 32, 98,\n    101,102,111,114,101, 32,116,104,101, 10, 45, 45, 32,114,101,\n    109, 97,105,110,105,110,103, 32, 99,111,100,101, 32,105,115,\n     32,112, 97,114,115,101,100, 46, 10, 45, 45, 32, 84,104,101,\n     32,102,111,108,108,111,119,105,110,103, 32,102,105,101,108,\n    100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10,\n     45, 45, 32, 32, 32,117,116,121,112,101, 32, 61, 32,116,121,\n    112,101,100,101,102, 32,110, 97,109,101, 10, 45, 45, 32, 32,\n     32,116,121,112,101, 32, 61, 32, 39,116,104,101, 32,102, 97,\n     99,116,111, 39, 32,116,121,112,101, 10, 45, 45, 32, 32, 32,\n    109,111,100, 32, 61, 32,109,111,100,105,102,105,101,114,115,\n     32,116,111, 32,116,104,101, 32, 39,100,101, 32,102, 97, 99,\n    116,111, 39, 32,116,121,112,101, 10, 99,108, 97,115,115, 84,\n    121,112,101,100,101,102, 32, 61, 32,123, 10, 32,117,116,121,\n    112,101, 32, 61, 32, 39, 39, 44, 10, 32,109,111,100, 32, 61,\n     32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, 39,\n     10,125, 10, 99,108, 97,115,115, 84,121,112,101,100,101,102,\n     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,\n    115, 84,121,112,101,100,101,102, 10, 10, 45, 45, 32, 80,114,\n    105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 84,121,112,101,100,\n    101,102, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,\n     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 84,121,112,101,100,101,102,\n    123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32,117,116,121,112,101, 32, 61, 32, 39, 34,\n     46, 46,115,101,108,102, 46,117,116,121,112,101, 46, 46, 34,\n     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,109,111,100, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100,\n     10, 10, 45, 45, 32, 82,101,116,117,114,110, 32,105,116, 39,\n    115, 32,110,111,116, 32, 97, 32,118, 97,114,105, 97, 98,108,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 84,121,112,101,100,101,102, 58,105,115,118, 97,114,105,\n     97, 98,108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110,\n     32,102, 97,108,115,101, 10,101,110,100, 10, 10, 45, 45, 32,\n     73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,\n    117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32,\n     95, 84,121,112,101,100,101,102, 32, 40,116, 41, 10, 32,115,\n    101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,\n    108, 97,115,115, 84,121,112,101,100,101,102, 41, 10, 32,116,\n     46,116,121,112,101, 32, 61, 32,114,101,115,111,108,118,101,\n     95,116,101,109,112,108, 97,116,101, 95,116,121,112,101,115,\n     40,116, 46,116,121,112,101, 41, 10, 32, 97,112,112,101,110,\n    100,116,121,112,101,100,101,102, 40,116, 41, 10, 32,114,101,\n    116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,\n     67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32,\n     69,120,112,101, 99,116,115, 32,111,110,101, 32,115,116,114,\n    105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110,\n    103, 32,116,104,101, 32,116,121,112,101, 32,100,101,102,105,\n    110,105,116,105,111,110, 46, 10,102,117,110, 99,116,105,111,\n    110, 32, 84,121,112,101,100,101,102, 32, 40,115, 41, 10, 32,\n    105,102, 32,115,116,114,102,105,110,100, 40,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,115, 44, 32, 39, 37, 98, 60,\n     62, 39, 44, 32, 39, 39, 41, 44, 39, 91, 37, 42, 38, 93, 39,\n     41, 32,116,104,101,110, 10, 32, 32,116,111,108,117, 97, 95,\n    101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105,100,\n     32,116,121,112,101,100,101,102, 58, 32,112,111,105,110,116,\n    101,114,115, 32, 40, 97,110,100, 32,114,101,102,101,114,101,\n    110, 99,101,115, 41, 32, 97,114,101, 32,110,111,116, 32,115,\n    117,112,112,111,114,116,101,100, 34, 41, 10, 32,101,110,100,\n     10, 32,108,111, 99, 97,108, 32,111, 32, 61, 32,123,109,111,\n    100, 32, 61, 32, 39, 39,125, 10, 32,105,102, 32,115,116,114,\n    105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 91, 60,\n     62, 93, 34, 41, 32,116,104,101,110, 10, 32,  9, 95, 44, 95,\n     44,111, 46,116,121,112,101, 44,111, 46,117,116,121,112,101,\n     32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    115, 44, 32, 34, 94, 37,115, 42, 40, 91, 94, 60, 62, 93, 43,\n     37, 98, 60, 62, 91, 94, 37,115, 93, 42, 41, 37,115, 43, 40,\n     46, 45, 41, 36, 34, 41, 10, 32,101,108,115,101, 10, 32,  9,\n    108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116,\n     40,103,115,117, 98, 40,115, 44, 34, 37,115, 37,115, 42, 34,\n     44, 34, 32, 34, 41, 44, 34, 32, 34, 41, 10, 32,  9,111, 32,\n     61, 32,123, 10,  9, 32, 32,117,116,121,112,101, 32, 61, 32,\n    116, 91,116, 46,110, 93, 44, 10,  9, 32, 32,116,121,112,101,\n     32, 61, 32,116, 91,116, 46,110, 45, 49, 93, 44, 10,  9, 32,\n     32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,116,\n     44, 49, 44,116, 46,110, 45, 50, 41, 44, 10,  9, 32,125, 10,\n     32,101,110,100, 10, 32,114,101,116,117,114,110, 32, 95, 84,\n    121,112,101,100,101,102, 40,111, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/typedef.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,110,116, 97,\n    105,110,101,114, 32, 97, 98,115,116,114, 97, 99,116, 32, 99,\n    108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110,\n     32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,\n    108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47,\n     80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32,\n     49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10,\n     10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,\n    115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,101,\n     59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,\n    116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,\n    111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, 45,\n     45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, 32,\n    112,114,111,118,105,100,101,100, 32,104,101,114,101,117,110,\n    100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,\n    115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,\n    100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,114,\n     32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,\n    105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, 32,\n    109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,\n    112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, 44,\n     10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,116,\n    115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,116,\n    105,111,110,115, 46, 10, 10, 45, 45, 32,116, 97, 98,108,101,\n     32,116,111, 32,115,116,111,114,101, 32,110, 97,109,101,115,\n    112, 97, 99,101,100, 32,116,121,112,101,100,101,102,115, 47,\n    101,110,117,109,115, 32,105,110, 32,103,108,111, 98, 97,108,\n     32,115, 99,111,112,101, 10,103,108,111, 98, 97,108, 95,116,\n    121,112,101,100,101,102,115, 32, 61, 32,123,125, 10,103,108,\n    111, 98, 97,108, 95,101,110,117,109,115, 32, 61, 32,123,125,\n     10, 10, 45, 45, 32, 67,111,110,116, 97,105,110,101,114, 32,\n     99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115,\n    101,110,116,115, 32, 97, 32, 99,111,110,116, 97,105,110,101,\n    114, 32,111,102, 32,102,101, 97,116,117,114,101,115, 32,116,\n    111, 32, 98,101, 32, 98,111,117,110,100, 10, 45, 45, 32,116,\n    111, 32,108,117, 97, 46, 10, 99,108, 97,115,115, 67,111,110,\n    116, 97,105,110,101,114, 32, 61, 10,123, 10, 32, 99,117,114,\n    114, 32, 61, 32,110,105,108, 44, 10,125, 10, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 10,115,101,116,109,101,116, 97,116, 97,\n     98,108,101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,\n    110,101,114, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,\n    101, 41, 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116,\n     97,103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 67,111,110,116, 97,105,110,101,114, 58,100,101,\n     99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117,115,104,\n     40,115,101,108,102, 41, 10, 32,108,111, 99, 97,108, 32,105,\n     61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,\n    105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105, 93,\n     58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32,105,\n     32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,111,\n    112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32,119,114,\n    105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,100,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 58,115,117,112, 99,\n    111,100,101, 32, 40, 41, 10, 10,  9,105,102, 32,110,111,116,\n     32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98,\n    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,\n    101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,110,\n    100, 10, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10,\n     32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,\n    108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32,\n     32,105,102, 32,115,101,108,102, 91,105, 93, 58, 99,104,101,\n     99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,\n    115, 40, 41, 32,116,104,101,110, 10, 32, 32,  9,115,101,108,\n    102, 91,105, 93, 58,115,117,112, 99,111,100,101, 40, 41, 10,\n     32, 32,101,110,100, 10, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32,101,110,100, 10, 32,112,111,112, 40, 41, 10,101,110,\n    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 58,104, 97,115,\n    118, 97,114, 32, 40, 41, 10, 32,108,111, 99, 97,108, 32,105,\n     61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,\n    105, 93, 32,100,111, 10, 32, 32,105,102, 32,115,101,108,102,\n     91,105, 93, 58,105,115,118, 97,114,105, 97, 98,108,101, 40,\n     41, 32,116,104,101,110, 10,  9,  9, 32,114,101,116,117,114,\n    110, 32, 49, 10,  9,  9,101,110,100, 10, 32, 32,105, 32, 61,\n     32,105, 43, 49, 10, 32,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32, 48, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,\n    116,101,114,110, 97,108, 32, 99,111,110,116, 97,105,110,101,\n    114, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,\n    117,110, 99,116,105,111,110, 32, 95, 67,111,110,116, 97,105,\n    110,101,114, 32, 40,115,101,108,102, 41, 10, 32,115,101,116,\n    109,101,116, 97,116, 97, 98,108,101, 40,115,101,108,102, 44,\n     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 41,\n     10, 32,115,101,108,102, 46,110, 32, 61, 32, 48, 10, 32,115,\n    101,108,102, 46,116,121,112,101,100,101,102,115, 32, 61, 32,\n    123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,115,101,\n    108,102, 46,117,115,101,114,116,121,112,101,115, 32, 61, 32,\n    123,125, 10, 32,115,101,108,102, 46,101,110,117,109,115, 32,\n     61, 32,123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,\n    115,101,108,102, 46,108,110, 97,109,101,115, 32, 61, 32,123,\n    125, 10, 32,114,101,116,117,114,110, 32,115,101,108,102, 10,\n    101,110,100, 10, 10, 45, 45, 32,112,117,115,104, 32, 99,111,\n    110,116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,\n    110, 32,112,117,115,104, 32, 40,116, 41, 10,  9,116, 46,112,\n    114,111,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 46, 99,117,114,114, 10, 32, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,\n    114, 32, 61, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,112,\n    111,112, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117,\n    110, 99,116,105,111,110, 32,112,111,112, 32, 40, 41, 10, 45,\n     45,112,114,105,110,116, 40, 34,110, 97,109,101, 34, 44, 99,\n    108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,\n    117,114,114, 46,110, 97,109,101, 41, 10, 45, 45,102,111,114,\n    101, 97, 99,104, 40, 99,108, 97,115,115, 67,111,110,116, 97,\n    105,110,101,114, 46, 99,117,114,114, 46,117,115,101,114,116,\n    121,112,101,115, 44,112,114,105,110,116, 41, 10, 45, 45,112,\n    114,105,110,116, 40, 34, 95, 95, 95, 95, 95, 95, 95, 95, 95,\n     95, 95, 95, 95, 95, 34, 41, 10, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 32, 61,\n     32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,\n     46, 99,117,114,114, 46,112,114,111,120, 10,101,110,100, 10,\n     10, 45, 45, 32,103,101,116, 32, 99,117,114,114,101,110,116,\n     32,110, 97,109,101,115,112, 97, 99,101, 10,102,117,110, 99,\n    116,105,111,110, 32,103,101,116, 99,117,114,114,110, 97,109,\n    101,115,112, 97, 99,101, 32, 40, 41, 10,  9,114,101,116,117,\n    114,110, 32,103,101,116,110, 97,109,101,115,112, 97, 99,101,\n     40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,\n     46, 99,117,114,114, 41, 10,101,110,100, 10, 10, 45, 45, 32,\n     97,112,112,101,110,100, 32,116,111, 32, 99,117,114,114,101,\n    110,116, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117,\n    110, 99,116,105,111,110, 32, 97,112,112,101,110,100, 32, 40,\n    116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,\n     58, 97,112,112,101,110,100, 40,116, 41, 10,101,110,100, 10,\n     10, 45, 45, 32, 97,112,112,101,110,100, 32,116,121,112,101,\n    100,101,102, 32,116,111, 32, 99,117,114,114,101,110,116, 32,\n     99,111,110,116, 97,105,110,101,114, 10,102,117,110, 99,116,\n    105,111,110, 32, 97,112,112,101,110,100,116,121,112,101,100,\n    101,102, 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,\n     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46,\n     99,117,114,114, 58, 97,112,112,101,110,100,116,121,112,101,\n    100,101,102, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32,\n     97,112,112,101,110,100, 32,117,115,101,114,116,121,112,101,\n     32,116,111, 32, 99,117,114,114,101,110,116, 32, 99,111,110,\n    116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,110,\n     32, 97,112,112,101,110,100,117,115,101,114,116,121,112,101,\n     32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108,\n     97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,\n    114,114, 58, 97,112,112,101,110,100,117,115,101,114,116,121,\n    112,101, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32, 97,\n    112,112,101,110,100, 32,101,110,117,109, 32,116,111, 32, 99,\n    117,114,114,101,110,116, 32, 99,111,110,116, 97,105,110,101,\n    114, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,101,\n    110,100,101,110,117,109, 32, 40,116, 41, 10, 32,114,101,116,\n    117,114,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,\n    110,101,114, 46, 99,117,114,114, 58, 97,112,112,101,110,100,\n    101,110,117,109, 40,116, 41, 10,101,110,100, 10, 10, 45, 45,\n     32,115,117, 98,115,116,105,116,117,116,101, 32,116,121,112,\n    101,100,101,102, 10,102,117,110, 99,116,105,111,110, 32, 97,\n    112,112,108,121,116,121,112,101,100,101,102, 32, 40,109,111,\n    100, 44,116,121,112,101, 41, 10, 32,114,101,116,117,114,110,\n     32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,\n     46, 99,117,114,114, 58, 97,112,112,108,121,116,121,112,101,\n    100,101,102, 40,109,111,100, 44,116,121,112,101, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102,\n     32,105,115, 32,116,121,112,101, 10,102,117,110, 99,116,105,\n    111,110, 32,102,105,110,100,116,121,112,101, 32, 40,116,121,\n    112,101, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46,\n     99,117,114,114, 58,102,105,110,100,116,121,112,101, 40,116,\n    121,112,101, 41, 10,  9,114,101,116,117,114,110, 32,116, 10,\n    101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,\n    102, 32,105,115, 32,116,121,112,101,100,101,102, 10,102,117,\n    110, 99,116,105,111,110, 32,105,115,116,121,112,101,100,101,\n    102, 32, 40,116,121,112,101, 41, 10, 32,114,101,116,117,114,\n    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 46, 99,117,114,114, 58,105,115,116,121,112,101,100,101,\n    102, 40,116,121,112,101, 41, 10,101,110,100, 10, 10, 45, 45,\n     32,103,101,116, 32,102,117,108,108,116,121,112,101, 32, 40,\n    119,105,116,104, 32,110, 97,109,101,115,112, 97, 99,101, 41,\n     10,102,117,110, 99,116,105,111,110, 32,102,117,108,108,116,\n    121,112,101, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32,\n     99,117,114,114, 32, 61, 32, 32, 99,108, 97,115,115, 67,111,\n    110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,  9,119,\n    104,105,108,101, 32, 99,117,114,114, 32,100,111, 10,  9, 32,\n    105,102, 32, 99,117,114,114, 32,116,104,101,110, 10,  9,  9,\n     32,105,102, 32, 99,117,114,114, 46,116,121,112,101,100,101,\n    102,115, 32, 97,110,100, 32, 99,117,114,114, 46,116,121,112,\n    101,100,101,102,115, 91,116, 93, 32,116,104,101,110, 10,  9,\n      9, 32, 32,114,101,116,117,114,110, 32, 99,117,114,114, 46,\n    116,121,112,101,100,101,102,115, 91,116, 93, 10,  9,  9, 32,\n    101,108,115,101,105,102, 32, 99,117,114,114, 46,117,115,101,\n    114,116,121,112,101,115, 32, 97,110,100, 32, 99,117,114,114,\n     46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116,\n    104,101,110, 10,  9,  9, 32, 32,114,101,116,117,114,110, 32,\n     99,117,114,114, 46,117,115,101,114,116,121,112,101,115, 91,\n    116, 93, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,110,100,\n     10,  9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,\n    112,114,111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,\n    101, 99,107,115, 32,105,102, 32,105,116, 32,114,101,113,117,\n    105,114,101,115, 32, 99,111,108,108,101, 99,116,105,111,110,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 58,114,101,113,117,105,\n    114,101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116,\n     41, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10,  9,108,111, 99, 97,\n    108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,\n     32, 32,114, 32, 61, 32,115,101,108,102, 91,105, 93, 58,114,\n    101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,\n    110, 40,116, 41, 32,111,114, 32,114, 10, 32, 32,105, 32, 61,\n     32,105, 43, 49, 10, 32,101,110,100, 10,  9,112,111,112, 40,\n     41, 10,  9,114,101,116,117,114,110, 32,114, 10,101,110,100,\n     10, 10, 10, 45, 45, 32,103,101,116, 32,110, 97,109,101,115,\n     97,112, 99,101, 10,102,117,110, 99,116,105,111,110, 32,103,\n    101,116,110, 97,109,101,115,112, 97, 99,101, 32, 40, 99,117,\n    114,114, 41, 10,  9,108,111, 99, 97,108, 32,110, 97,109,101,\n    115,112, 97, 99,101, 32, 61, 32, 39, 39, 10,  9,119,104,105,\n    108,101, 32, 99,117,114,114, 32,100,111, 10,  9, 32,105,102,\n     32, 99,117,114,114, 32, 97,110,100, 10,  9,  9, 32, 32, 32,\n     40, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,\n    101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,114,\n     32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,101,\n     32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101, 39,\n     41, 10,  9,  9,116,104,101,110, 10,  9,  9, 32,110, 97,109,\n    101,115,112, 97, 99,101, 32, 61, 32, 40, 99,117,114,114, 46,\n    111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,\n    114, 32, 99,117,114,114, 46,110, 97,109,101, 41, 32, 46, 46,\n     32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,101,115,112,\n     97, 99,101, 10,  9,  9, 32, 45, 45,110, 97,109,101,115,112,\n     97, 99,101, 32, 61, 32, 99,117,114,114, 46,110, 97,109,101,\n     32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,\n    101,115,112, 97, 99,101, 10,  9,  9,101,110,100, 10,  9, 32,\n     99,117,114,114, 32, 61, 32, 99,117,114,114, 46,112,114,111,\n    120, 10,  9,101,110,100, 10,  9,114,101,116,117,114,110, 32,\n    110, 97,109,101,115,112, 97, 99,101, 10,101,110,100, 10, 10,\n     45, 45, 32,103,101,116, 32,110, 97,109,101,115,112, 97, 99,\n    101, 32, 40,111,110,108,121, 32,110, 97,109,101,115,112, 97,\n     99,101, 41, 10,102,117,110, 99,116,105,111,110, 32,103,101,\n    116,111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 32,\n     40, 41, 10, 32,108,111, 99, 97,108, 32, 99,117,114,114, 32,\n     61, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 46, 99,117,114,114, 10,  9,108,111, 99, 97,108, 32,110,\n     97,109,101,115,112, 97, 99,101, 32, 61, 32, 39, 39, 10,  9,\n    119,104,105,108,101, 32, 99,117,114,114, 32,100,111, 10,  9,\n      9,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,\n    121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,\n    116,104,101,110, 10,  9,  9, 32,114,101,116,117,114,110, 32,\n    110, 97,109,101,115,112, 97, 99,101, 10,  9,  9,101,108,115,\n    101,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,\n    121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97,\n     99,101, 39, 32,116,104,101,110, 10,  9,  9, 32,110, 97,109,\n    101,115,112, 97, 99,101, 32, 61, 32, 99,117,114,114, 46,110,\n     97,109,101, 32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,\n    110, 97,109,101,115,112, 97, 99,101, 10,  9,  9,101,110,100,\n     10,  9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,\n    112,114,111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,\n    114,110, 32,110, 97,109,101,115,112, 97, 99,101, 10,101,110,\n    100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,\n    105,115, 32,101,110,117,109, 10,102,117,110, 99,116,105,111,\n    110, 32,105,115,101,110,117,109, 32, 40,116,121,112,101, 41,\n     10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,105,\n    115,101,110,117,109, 40,116,121,112,101, 41, 10,101,110,100,\n     10, 10, 45, 45, 32, 97,112,112,101,110,100, 32,102,101, 97,\n    116,117,114,101, 32,116,111, 32, 99,111,110,116, 97,105,110,\n    101,114, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 58, 97,112,112,\n    101,110,100, 32, 40,116, 41, 10, 32,115,101,108,102, 46,110,\n     32, 61, 32,115,101,108,102, 46,110, 32, 43, 32, 49, 10, 32,\n    115,101,108,102, 91,115,101,108,102, 46,110, 93, 32, 61, 32,\n    116, 10, 32,116, 46,112, 97,114,101,110,116, 32, 61, 32,115,\n    101,108,102, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,\n    101,110,100, 32,116,121,112,101,100,101,102, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,110,116,\n     97,105,110,101,114, 58, 97,112,112,101,110,100,116,121,112,\n    101,100,101,102, 32, 40,116, 41, 10, 32,108,111, 99, 97,108,\n     32,110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,\n    116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,\n     41, 10, 32,115,101,108,102, 46,116,121,112,101,100,101,102,\n    115, 46,116,111,108,117, 97, 95,110, 32, 61, 32,115,101,108,\n    102, 46,116,121,112,101,100,101,102,115, 46,116,111,108,117,\n     97, 95,110, 32, 43, 32, 49, 10, 32,115,101,108,102, 46,116,\n    121,112,101,100,101,102,115, 91,115,101,108,102, 46,116,121,\n    112,101,100,101,102,115, 46,116,111,108,117, 97, 95,110, 93,\n     32, 61, 32,116, 10,  9,115,101,108,102, 46,116,121,112,101,\n    100,101,102,115, 91,116, 46,117,116,121,112,101, 93, 32, 61,\n     32,110, 97,109,101,115,112, 97, 99,101, 32, 46, 46, 32,116,\n     46,117,116,121,112,101, 10,  9,103,108,111, 98, 97,108, 95,\n    116,121,112,101,100,101,102,115, 91,110, 97,109,101,115,112,\n     97, 99,101, 46, 46,116, 46,117,116,121,112,101, 93, 32, 61,\n     32,116, 10,  9,116, 46,102,116,121,112,101, 32, 61, 32,102,\n    105,110,100,116,121,112,101, 40,116, 46,116,121,112,101, 41,\n     32,111,114, 32,116, 46,116,121,112,101, 10,  9, 45, 45,112,\n    114,105,110,116, 40, 34, 97,112,112,101,110,100,105,110,103,\n     32,116,121,112,101,100,101,102, 32, 34, 46, 46,116, 46,117,\n    116,121,112,101, 46, 46, 34, 32, 97,115, 32, 34, 46, 46,110,\n     97,109,101,115,112, 97, 99,101, 46, 46,116, 46,117,116,121,\n    112,101, 46, 46, 34, 32,119,105,116,104, 32,102,116,121,112,\n    101, 32, 34, 46, 46,116, 46,102,116,121,112,101, 41, 10,  9,\n     97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,116,\n    121,112,101, 40,110, 97,109,101,115,112, 97, 99,101, 46, 46,\n    116, 46,117,116,121,112,101, 41, 10,  9,105,102, 32,116, 46,\n    102,116,121,112,101, 32, 97,110,100, 32,105,115,101,110,117,\n    109, 40,116, 46,102,116,121,112,101, 41, 32,116,104,101,110,\n     10, 10,  9,  9,103,108,111, 98, 97,108, 95,101,110,117,109,\n    115, 91,110, 97,109,101,115,112, 97, 99,101, 46, 46,116, 46,\n    117,116,121,112,101, 93, 32, 61, 32,116,114,117,101, 10,  9,\n    101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,\n    101,110,100, 32,117,115,101,114,116,121,112,101, 58, 32,114,\n    101,116,117,114,110, 32,102,117,108,108, 32,116,121,112,101,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 58, 97,112,112,101,110,\n    100,117,115,101,114,116,121,112,101, 32, 40,116, 41, 10,  9,\n    108,111, 99, 97,108, 32, 99,111,110,116, 97,105,110,101,114,\n     10,  9,105,102, 32,116, 32, 61, 61, 32, 40,115,101,108,102,\n     46,111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,\n    111,114, 32,115,101,108,102, 46,110, 97,109,101, 41, 32,116,\n    104,101,110, 10,  9,  9, 99,111,110,116, 97,105,110,101,114,\n     32, 61, 32,115,101,108,102, 46,112,114,111,120, 10,  9,101,\n    108,115,101, 10,  9,  9, 99,111,110,116, 97,105,110,101,114,\n     32, 61, 32,115,101,108,102, 10,  9,101,110,100, 10,  9,108,\n    111, 99, 97,108, 32,102,116, 32, 61, 32,103,101,116,110, 97,\n    109,101,115,112, 97, 99,101, 40, 99,111,110,116, 97,105,110,\n    101,114, 41, 32, 46, 46, 32,116, 10,  9, 99,111,110,116, 97,\n    105,110,101,114, 46,117,115,101,114,116,121,112,101,115, 91,\n    116, 93, 32, 61, 32,102,116, 10,  9, 95,117,115,101,114,116,\n    121,112,101, 91,102,116, 93, 32, 61, 32,102,116, 10,  9,114,\n    101,116,117,114,110, 32,102,116, 10,101,110,100, 10, 10, 45,\n     45, 32, 97,112,112,101,110,100, 32,101,110,117,109, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,\n    110,116, 97,105,110,101,114, 58, 97,112,112,101,110,100,101,\n    110,117,109, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32,\n    110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,116,\n    110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 41,\n     10, 32,115,101,108,102, 46,101,110,117,109,115, 46,116,111,\n    108,117, 97, 95,110, 32, 61, 32,115,101,108,102, 46,101,110,\n    117,109,115, 46,116,111,108,117, 97, 95,110, 32, 43, 32, 49,\n     10, 32,115,101,108,102, 46,101,110,117,109,115, 91,115,101,\n    108,102, 46,101,110,117,109,115, 46,116,111,108,117, 97, 95,\n    110, 93, 32, 61, 32,116, 10,  9,103,108,111, 98, 97,108, 95,\n    101,110,117,109,115, 91,110, 97,109,101,115,112, 97, 99,101,\n     46, 46,116, 46,110, 97,109,101, 93, 32, 61, 32,116, 10,101,\n    110,100, 10, 10, 45, 45, 32,100,101,116,101,114,109,105,110,\n    101, 32,108,117, 97, 32,102,117,110, 99,116,105,111,110, 32,\n    110, 97,109,101, 32,111,118,101,114,108,111, 97,100, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,\n    110,116, 97,105,110,101,114, 58,111,118,101,114,108,111, 97,\n    100, 32, 40,108,110, 97,109,101, 41, 10, 32,105,102, 32,110,\n    111,116, 32,115,101,108,102, 46,108,110, 97,109,101,115, 91,\n    108,110, 97,109,101, 93, 32,116,104,101,110, 10, 32, 32,115,\n    101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,109,\n    101, 93, 32, 61, 32, 48, 10, 32,101,108,115,101, 10, 32, 32,\n    115,101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,\n    109,101, 93, 32, 61, 32,115,101,108,102, 46,108,110, 97,109,\n    101,115, 91,108,110, 97,109,101, 93, 32, 43, 32, 49, 10, 32,\n    101,110,100, 10, 32,114,101,116,117,114,110, 32,102,111,114,\n    109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,115,101,108,102,\n     46,108,110, 97,109,101,115, 91,108,110, 97,109,101, 93, 41,\n     10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,108,105,101,\n    115, 32,116,121,112,101,100,101,102, 58, 32,114,101,116,117,\n    114,110,115, 32,116,104,101, 32, 39,116,104,101, 32,102, 97,\n     99,116,111, 39, 32,109,111,100,105,102,105,101,114, 32, 97,\n    110,100, 32,116,121,112,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 58, 97,112,112,108,121,116,121,112,101,100,101,102, 32,\n     40,109,111,100, 44,116,121,112,101, 41, 10,  9,105,102, 32,\n    103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115,\n     91,116,121,112,101, 93, 32,116,104,101,110, 10,  9,  9, 45,\n     45,112,114,105,110,116, 40, 34,102,111,117,110,100, 32,116,\n    121,112,101,100,101,102, 32, 34, 46, 46,103,108,111, 98, 97,\n    108, 95,116,121,112,101,100,101,102,115, 91,116,121,112,101,\n     93, 46,116,121,112,101, 41, 10,  9,  9,108,111, 99, 97,108,\n     32,109,111,100, 49, 44, 32,116,121,112,101, 49, 32, 61, 32,\n    103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115,\n     91,116,121,112,101, 93, 46,109,111,100, 44, 32,103,108,111,\n     98, 97,108, 95,116,121,112,101,100,101,102,115, 91,116,121,\n    112,101, 93, 46,102,116,121,112,101, 10,  9,  9,108,111, 99,\n     97,108, 32,109,111,100, 50, 44, 32,116,121,112,101, 50, 32,\n     61, 32, 97,112,112,108,121,116,121,112,101,100,101,102, 40,\n    109,111,100, 46, 46, 34, 32, 34, 46, 46,109,111,100, 49, 44,\n     32,116,121,112,101, 49, 41, 10,  9,  9, 45, 45,114,101,116,\n    117,114,110, 32,109,111,100, 50, 32, 46, 46, 32, 39, 32, 39,\n     32, 46, 46, 32,109,111,100, 49, 44, 32,116,121,112,101, 50,\n     10,  9,  9,114,101,116,117,114,110, 32,109,111,100, 50, 44,\n     32,116,121,112,101, 50, 10,  9,101,110,100, 10,  9,100,111,\n     32,114,101,116,117,114,110, 32,109,111,100, 44,116,121,112,\n    101, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n    104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97,\n     32,116,121,112,101,100,101,102, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,\n    101,114, 58,105,115,116,121,112,101,100,101,102, 32, 40,116,\n    121,112,101, 41, 10, 32,108,111, 99, 97,108, 32,101,110,118,\n     32, 61, 32,115,101,108,102, 10, 32,119,104,105,108,101, 32,\n    101,110,118, 32,100,111, 10, 32, 32,105,102, 32,101,110,118,\n     46,116,121,112,101,100,101,102,115, 32,116,104,101,110, 10,\n     32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,\n     32,119,104,105,108,101, 32,101,110,118, 46,116,121,112,101,\n    100,101,102,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,\n    105,102, 32,101,110,118, 46,116,121,112,101,100,101,102,115,\n     91,105, 93, 46,117,116,121,112,101, 32, 61, 61, 32,116,121,\n    112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,114,101,116,117,114,110, 32,116,121,112,101, 10, 32,\n     32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,\n     32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118,\n     32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32,\n    101,110,100, 10, 32,114,101,116,117,114,110, 32,110,105,108,\n     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,\n    102,105,110,100, 95,101,110,117,109, 95,118, 97,114, 40,118,\n     97,114, 41, 10, 10,  9,105,102, 32,116,111,110,117,109, 98,\n    101,114, 40,118, 97,114, 41, 32,116,104,101,110, 32,114,101,\n    116,117,114,110, 32,118, 97,114, 32,101,110,100, 10, 10,  9,\n    108,111, 99, 97,108, 32, 99, 32, 61, 32, 99,108, 97,115,115,\n     67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,\n      9,119,104,105,108,101, 32, 99, 32,100,111, 10,  9,  9,108,\n    111, 99, 97,108, 32,110,115, 32, 61, 32,103,101,116,110, 97,\n    109,101,115,112, 97, 99,101, 40, 99, 41, 10,  9,  9,102,111,\n    114, 32,107, 44,118, 32,105,110, 32,112, 97,105,114,115, 40,\n     95,103,108,111, 98, 97,108, 95,101,110,117,109,115, 41, 32,\n    100,111, 10,  9,  9,  9,105,102, 32,109, 97,116, 99,104, 95,\n    116,121,112,101, 40,118, 97,114, 44, 32,118, 44, 32,110,115,\n     41, 32,116,104,101,110, 10,  9,  9,  9,  9,114,101,116,117,\n    114,110, 32,118, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,\n    110,100, 10,  9,  9,105,102, 32, 99, 46, 98, 97,115,101, 32,\n     97,110,100, 32, 99, 46, 98, 97,115,101, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10,  9,  9,  9, 99, 32, 61, 32, 95,\n    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,\n     99, 58,102,105,110,100,116,121,112,101, 40, 99, 46, 98, 97,\n    115,101, 41, 93, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,\n     99, 32, 61, 32,110,105,108, 10,  9,  9,101,110,100, 10,  9,\n    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,118, 97,\n    114, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107,\n     32,105,102, 32,105,115, 32, 97, 32,114,101,103,105,115,116,\n    101,114,101,100, 32,116,121,112,101, 58, 32,114,101,116,117,\n    114,110, 32,102,117,108,108, 32,116,121,112,101, 32,111,114,\n     32,110,105,108, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,102,\n    105,110,100,116,121,112,101, 32, 40,116, 41, 10, 10,  9,116,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    116, 44, 32, 34, 61, 46, 42, 34, 44, 32, 34, 34, 41, 10,  9,\n    105,102, 32, 95, 98, 97,115,105, 99, 91,116, 93, 32,116,104,\n    101,110, 10,  9, 32,114,101,116,117,114,110, 32,116, 10,  9,\n    101,110,100, 10, 10,  9,108,111, 99, 97,108, 32, 95, 44, 95,\n     44,101,109, 32, 61, 32,115,116,114,105,110,103, 46,102,105,\n    110,100, 40,116, 44, 32, 34, 40, 91, 38, 37, 42, 93, 41, 37,\n    115, 42, 36, 34, 41, 10,  9,116, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, 37,115, 42,\n     40, 91, 38, 37, 42, 93, 41, 37,115, 42, 36, 34, 44, 32, 34,\n     34, 41, 10,  9,112, 32, 61, 32,115,101,108,102, 10,  9,119,\n    104,105,108,101, 32,112, 32, 97,110,100, 32,116,121,112,101,\n     40,112, 41, 61, 61, 39,116, 97, 98,108,101, 39, 32,100,111,\n     10,  9,  9,108,111, 99, 97,108, 32,115,116, 32, 61, 32,103,\n    101,116,110, 97,109,101,115,112, 97, 99,101, 40,112, 41, 10,\n     10,  9,  9,102,111,114, 32,105, 61, 95,103,108,111, 98, 97,\n    108, 95,116,121,112,101,115, 46,110, 44, 49, 44, 45, 49, 32,\n    100,111, 32, 45, 45, 32,105,110, 32,114,101,118,101,114,115,\n    101, 32,111,114,100,101,114, 10, 10,  9,  9,  9,105,102, 32,\n    109, 97,116, 99,104, 95,116,121,112,101, 40,116, 44, 32, 95,\n    103,108,111, 98, 97,108, 95,116,121,112,101,115, 91,105, 93,\n     44, 32,115,116, 41, 32,116,104,101,110, 10,  9,  9,  9,  9,\n    114,101,116,117,114,110, 32, 95,103,108,111, 98, 97,108, 95,\n    116,121,112,101,115, 91,105, 93, 46, 46, 40,101,109, 32,111,\n    114, 32, 34, 34, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,\n    101,110,100, 10,  9,  9,105,102, 32,112, 46, 98, 97,115,101,\n     32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126, 61, 32,\n     39, 39, 32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126,\n     61, 32,116, 32,116,104,101,110, 10,  9,  9,  9, 45, 45,112,\n    114,105,110,116, 40, 34,116,121,112,101, 32,105,115, 32, 34,\n     46, 46,116, 46, 46, 34, 44, 32,112, 32,105,115, 32, 34, 46,\n     46,112, 46, 98, 97,115,101, 46, 46, 34, 32,115,101,108,102,\n     46,116,121,112,101, 32,105,115, 32, 34, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 34, 32,115,101,108,102, 46,\n    110, 97,109,101, 32,105,115, 32, 34, 46, 46,115,101,108,102,\n     46,110, 97,109,101, 41, 10,  9,  9,  9,112, 32, 61, 32, 95,\n    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,\n    112, 58,102,105,110,100,116,121,112,101, 40,112, 46, 98, 97,\n    115,101, 41, 93, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,\n    112, 32, 61, 32,110,105,108, 10,  9,  9,101,110,100, 10,  9,\n    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,110,105,\n    108, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32, 97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,\n    116,121,112,101, 40,116, 44, 32, 99,108, 97,115,115, 41, 10,\n      9, 95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 46,\n    110, 32, 61, 32, 95,103,108,111, 98, 97,108, 95,116,121,112,\n    101,115, 46,110, 32, 43, 49, 10,  9, 95,103,108,111, 98, 97,\n    108, 95,116,121,112,101,115, 91, 95,103,108,111, 98, 97,108,\n     95,116,121,112,101,115, 46,110, 93, 32, 61, 32,116, 10,  9,\n     95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 95,104,\n     97,115,104, 91,116, 93, 32, 61, 32, 49, 10,  9,105,102, 32,\n     99,108, 97,115,115, 32,116,104,101,110, 32, 97,112,112,101,\n    110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,116,\n     44, 32, 99,108, 97,115,115, 41, 32,101,110,100, 10,101,110,\n    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,\n    101,110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,\n    116, 44, 99,108, 97,115,115, 41, 10,  9,105,102, 32, 95,103,\n    108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116,\n     93, 32,116,104,101,110, 10,  9,  9, 99,108, 97,115,115, 46,\n    102,108, 97,103,115, 32, 61, 32, 95,103,108,111, 98, 97,108,\n     95, 99,108, 97,115,115,101,115, 91,116, 93, 46,102,108, 97,\n    103,115, 10,  9,  9, 99,108, 97,115,115, 46,108,110, 97,109,\n    101,115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108,\n     97,115,115,101,115, 91,116, 93, 46,108,110, 97,109,101,115,\n     10,  9,  9,105,102, 32, 95,103,108,111, 98, 97,108, 95, 99,\n    108, 97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,\n     97,110,100, 32, 40, 95,103,108,111, 98, 97,108, 95, 99,108,\n     97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,126,\n     61, 32, 39, 39, 41, 32,116,104,101,110, 10,  9,  9,  9, 99,\n    108, 97,115,115, 46, 98, 97,115,101, 32, 61, 32, 95,103,108,\n    111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116, 93,\n     46, 98, 97,115,101, 32,111,114, 32, 99,108, 97,115,115, 46,\n     98, 97,115,101, 10,  9,  9,101,110,100, 10,  9,101,110,100,\n     10,  9, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115,\n    101,115, 91,116, 93, 32, 61, 32, 99,108, 97,115,115, 10,  9,\n     99,108, 97,115,115, 46,102,108, 97,103,115, 32, 61, 32, 99,\n    108, 97,115,115, 46,102,108, 97,103,115, 32,111,114, 32,123,\n    125, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32,109, 97,116, 99,104, 95,116,121,112,101, 40, 99,104,105,\n    108,100,116,121,112,101, 44, 32,114,101,103,116,121,112,101,\n     44, 32,115,116, 41, 10, 45, 45,112,114,105,110,116, 40, 34,\n    102,105,110,100,116,121,112,101, 32, 34, 46, 46, 99,104,105,\n    108,100,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,114,\n    101,103,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,115,\n    116, 41, 10,  9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,114,101,\n    103,116,121,112,101, 44, 32, 99,104,105,108,100,116,121,112,\n    101, 44, 32, 45,115,116,114,105,110,103, 46,108,101,110, 40,\n     99,104,105,108,100,116,121,112,101, 41, 44, 32,116,114,117,\n    101, 41, 10,  9,105,102, 32, 98, 32,116,104,101,110, 10, 10,\n      9,  9,105,102, 32,101, 32, 61, 61, 32,115,116,114,105,110,\n    103, 46,108,101,110, 40,114,101,103,116,121,112,101, 41, 32,\n     97,110,100, 10,  9,  9,  9,  9, 40, 98, 32, 61, 61, 32, 49,\n     32,111,114, 32, 40,115,116,114,105,110,103, 46,115,117, 98,\n     40,114,101,103,116,121,112,101, 44, 32, 98, 45, 49, 44, 32,\n     98, 45, 49, 41, 32, 61, 61, 32, 39, 58, 39, 32, 97,110,100,\n     10,  9,  9,  9,  9,115,116,114,105,110,103, 46,115,117, 98,\n     40,114,101,103,116,121,112,101, 44, 32, 49, 44, 32, 98, 45,\n     49, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,115,117,\n     98, 40,115,116, 44, 32, 49, 44, 32, 98, 45, 49, 41, 41, 41,\n     32,116,104,101,110, 10,  9,  9,  9,114,101,116,117,114,110,\n     32,116,114,117,101, 10,  9,  9,101,110,100, 10,  9,101,110,\n    100, 10, 10,  9,114,101,116,117,114,110, 32,102, 97,108,115,\n    101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,\n     32,102,105,110,100,116,121,112,101, 95,111,110, 95, 99,104,\n    105,108,100,115, 40,115,101,108,102, 44, 32,116, 41, 10, 10,\n      9,108,111, 99, 97,108, 32,116, 99,104,105,108,100, 10,  9,\n    105,102, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,\n    112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,\n    114, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,112,\n    101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101,\n     39, 32,116,104,101,110, 10,  9,  9,102,111,114, 32,107, 44,\n    118, 32,105,110, 32,105,112, 97,105,114,115, 40,115,101,108,\n    102, 41, 32,100,111, 10,  9,  9,  9,105,102, 32,118, 46, 99,\n    108, 97,115,115,116,121,112,101, 32, 61, 61, 32, 39, 99,108,\n     97,115,115, 39, 32,111,114, 32,118, 46, 99,108, 97,115,115,\n    116,121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112,\n     97, 99,101, 39, 32,116,104,101,110, 10,  9,  9,  9,  9,105,\n    102, 32,118, 46,116,121,112,101,100,101,102,115, 32, 97,110,\n    100, 32,118, 46,116,121,112,101,100,101,102,115, 91,116, 93,\n     32,116,104,101,110, 10,  9,  9,  9,  9, 32,114,101,116,117,\n    114,110, 32,118, 46,116,121,112,101,100,101,102,115, 91,116,\n     93, 10,  9,  9,  9,  9,101,108,115,101,105,102, 32,118, 46,\n    117,115,101,114,116,121,112,101,115, 32, 97,110,100, 32,118,\n     46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116,\n    104,101,110, 10,  9,  9,  9,  9, 32,114,101,116,117,114,110,\n     32,118, 46,117,115,101,114,116,121,112,101,115, 91,116, 93,\n     10,  9,  9,  9,  9,101,110,100, 10,  9,  9,  9,  9,116, 99,\n    104,105,108,100, 32, 61, 32,102,105,110,100,116,121,112,101,\n     95,111,110, 95, 99,104,105,108,100,115, 40,118, 44, 32,116,\n     41, 10,  9,  9,  9,  9,105,102, 32,116, 99,104,105,108,100,\n     32,116,104,101,110, 32,114,101,116,117,114,110, 32,116, 99,\n    104,105,108,100, 32,101,110,100, 10,  9,  9,  9,101,110,100,\n     10,  9,  9,101,110,100, 10,  9,101,110,100, 10,  9,114,101,\n    116,117,114,110, 32,110,105,108, 10, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 58,105,115,101,110,117,109,\n     32, 40,116,121,112,101, 41, 10, 32,105,102, 32,103,108,111,\n     98, 97,108, 95,101,110,117,109,115, 91,116,121,112,101, 93,\n     32,116,104,101,110, 10,  9,114,101,116,117,114,110, 32,116,\n    121,112,101, 10, 32,101,108,115,101, 10, 32,  9,114,101,116,\n    117,114,110, 32,102, 97,108,115,101, 10, 32,101,110,100, 10,\n     10, 32,108,111, 99, 97,108, 32, 98, 97,115,101,116,121,112,\n    101, 32, 61, 32,103,115,117, 98, 40,116,121,112,101, 44, 34,\n     94, 46, 42, 58, 58, 34, 44, 34, 34, 41, 10, 32,108,111, 99,\n     97,108, 32,101,110,118, 32, 61, 32,115,101,108,102, 10, 32,\n    119,104,105,108,101, 32,101,110,118, 32,100,111, 10, 32, 32,\n    105,102, 32,101,110,118, 46,101,110,117,109,115, 32,116,104,\n    101,110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49,\n     10, 32, 32, 32,119,104,105,108,101, 32,101,110,118, 46,101,\n    110,117,109,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,\n    105,102, 32,101,110,118, 46,101,110,117,109,115, 91,105, 93,\n     46,110, 97,109,101, 32, 61, 61, 32, 98, 97,115,101,116,121,\n    112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,114,101,116,117,114,110, 32,116,114,117,101, 10, 32,\n     32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,\n     32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118,\n     32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32,\n    101,110,100, 10, 32,114,101,116,117,114,110, 32,102, 97,108,\n    115,101, 10,101,110,100, 10, 10,109,101,116,104,111,100,105,\n    115,118,105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115,\n    101, 32, 45, 45, 32, 97, 32,103,108,111, 98, 97,108, 10, 10,\n     45, 45, 32,112, 97,114,115,101, 32, 99,104,117,110,107, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 58,100,111,112, 97,114,115,\n    101, 32, 40,115, 41, 10, 45, 45,112,114,105,110,116, 32, 40,\n     34,112, 97,114,115,101, 32, 34, 46, 46,115, 41, 10, 10, 32,\n     45, 45, 32,116,114,121, 32,116,104,101, 32,112, 97,114,115,\n    101,114, 32,104,111,111,107, 10, 32,100,111, 10, 32,  9,108,\n    111, 99, 97,108, 32,115,117, 98, 32, 61, 32,112, 97,114,115,\n    101,114, 95,104,111,111,107, 40,115, 41, 10, 32,  9,105,102,\n     32,115,117, 98, 32,116,104,101,110, 10, 32,  9,  9,114,101,\n    116,117,114,110, 32,115,117, 98, 10, 32,  9,101,110,100, 10,\n     32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,116,\n    104,101, 32,110,117,108,108, 32,115,116, 97,116,101,109,101,\n    110,116, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115,\n     42, 59, 34, 41, 10, 32,  9,105,102, 32, 98, 32,116,104,101,\n    110, 10, 32,  9,  9,114,101,116,117,114,110, 32,115,116,114,\n    115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,  9,101,110,\n    100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121,\n     32,101,109,112,116,121, 32,118,101,114, 98, 97,116,105,109,\n     32,108,105,110,101, 10, 32,100,111, 10, 32,  9,108,111, 99,\n     97,108, 32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34,\n     94, 37,115, 42, 36, 92,110, 34, 41, 10, 32,  9,105,102, 32,\n     98, 32,116,104,101,110, 10, 32,  9,  9,114,101,116,117,114,\n    110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41,\n     10, 32,  9,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45,\n     45, 32,116,114,121, 32, 76,117, 97, 32, 99,111,100,101, 10,\n     32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101,\n     44, 99,111,100,101, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44, 34, 94, 37,115, 42, 40, 37, 98, 92, 49, 92, 50,\n     41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,\n     10, 32, 32, 32, 67,111,100,101, 40,115,116,114,115,117, 98,\n     40, 99,111,100,101, 44, 50, 44, 45, 50, 41, 41, 10, 32, 32,\n     32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,\n    115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,\n    110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 67, 32, 99,\n    111,100,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108,\n     32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,\n    102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 37, 98,\n     92, 51, 92, 52, 41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10,  9, 99,111,100,101, 32, 61, 32, 39,123,\n     39, 46, 46,115,116,114,115,117, 98, 40, 99,111,100,101, 44,\n     50, 44, 45, 50, 41, 46, 46, 39, 92,110,125, 92,110, 39, 10,\n      9, 86,101,114, 98, 97,116,105,109, 40, 99,111,100,101, 44,\n     39,114, 39, 41, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,\n    118,101,114, 98, 97,116,105,109, 32, 99,111,100,101, 32,102,\n    111,114, 32, 39,114, 39,101,103,105,115,116,101,114, 32,102,\n    114, 97,103,109,101,110,116, 10,  9,114,101,116,117,114,110,\n     32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10,\n     32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45,\n     32,116,114,121, 32, 67, 32, 99,111,100,101, 32,102,111,114,\n     32,112,114,101, 97,109, 98,108,101, 32,115,101, 99,116,105,\n    111,110, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115,\n     42, 40, 37, 98, 92, 53, 92, 54, 41, 34, 41, 10, 32,  9,105,\n    102, 32, 98, 32,116,104,101,110, 10, 32,  9,  9, 99,111,100,\n    101, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,\n     99,111,100,101, 44, 32, 50, 44, 32, 45, 50, 41, 46, 46, 34,\n     92,110, 34, 10,  9,  9, 86,101,114, 98, 97,116,105,109, 40,\n     99,111,100,101, 44, 32, 39, 39, 41, 10,  9,  9,114,101,116,\n    117,114,110, 32,115,116,114,105,110,103, 46,115,117, 98, 40,\n    115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,100,101,\n    102, 97,117,108,116, 95,112,114,111,112,101,114,116,121, 32,\n    100,105,114,101, 99,116,105,118,101, 10, 32,100,111, 10, 32,\n      9,108,111, 99, 97,108, 32, 98, 44,101, 44,112,116,121,112,\n    101, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32,\n     34, 94, 37,115, 42, 84, 79, 76, 85, 65, 95, 80, 82, 79, 80,\n     69, 82, 84, 89, 95, 84, 89, 80, 69, 37,115, 42, 37, 40, 43,\n     37,115, 42, 40, 91, 94, 37, 41, 37,115, 93, 42, 41, 37,115,\n     42, 37, 41, 43, 37,115, 42, 59, 63, 34, 41, 10, 32,  9,105,\n    102, 32, 98, 32,116,104,101,110, 10, 32,  9,  9,105,102, 32,\n    110,111,116, 32,112,116,121,112,101, 32,111,114, 32,112,116,\n    121,112,101, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 10,\n     32,  9,  9,  9,112,116,121,112,101, 32, 61, 32, 34,100,101,\n    102, 97,117,108,116, 34, 10, 32,  9,  9,101,110,100, 10, 32,\n      9,  9,115,101,108,102, 58,115,101,116, 95,112,114,111,112,\n    101,114,116,121, 95,116,121,112,101, 40,112,116,121,112,101,\n     41, 10,  9, 32,  9,114,101,116,117,114,110, 32,115,116,114,\n    115,117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,\n    110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,\n    121, 32,112,114,111,116,101, 99,116,101,100, 95,100,101,115,\n    116,114,117, 99,116,111,114, 32,100,105,114,101, 99,116,105,\n    118,101, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,\n    110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 84, 79, 76, 85,\n     65, 95, 80, 82, 79, 84, 69, 67, 84, 69, 68, 95, 68, 69, 83,\n     84, 82, 85, 67, 84, 79, 82, 37,115, 42, 59, 63, 34, 41, 10,\n      9,105,102, 32, 98, 32,116,104,101,110, 10,  9,  9,105,102,\n     32,115,101,108,102, 46,115,101,116, 95,112,114,111,116,101,\n     99,116,101,100, 95,100,101,115,116,114,117, 99,116,111,114,\n     32,116,104,101,110, 10,  9, 32,  9,  9,115,101,108,102, 58,\n    115,101,116, 95,112,114,111,116,101, 99,116,101,100, 95,100,\n    101,115,116,114,117, 99,116,111,114, 40,116,114,117,101, 41,\n     10,  9, 32,  9,101,110,100, 10, 32,  9,  9,114,101,116,117,\n    114,110, 32,115,116,114,115,117, 98, 40,115, 44, 32,101, 43,\n     49, 41, 10, 32,  9,101,110,100, 10, 32,101,110,100, 10, 10,\n     32, 45, 45, 32,116,114,121, 32, 39,101,120,116,101,114,110,\n     39, 32,107,101,121,119,111,114,100, 10, 32,100,111, 10, 32,\n      9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94,\n     37,115, 42,101,120,116,101,114,110, 37,115, 43, 34, 41, 10,\n     32,  9,105,102, 32, 98, 32,116,104,101,110, 10,  9,  9, 45,\n     45, 32,100,111, 32,110,111,116,104,105,110,103, 10, 32,  9,\n      9,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,\n    115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 39,118,\n    105,114,116,117, 97,108, 39, 32,107,101,121,119,111,114,107,\n    100, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32, 98,\n     44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,\n    100, 40,115, 44, 32, 34, 94, 37,115, 42,118,105,114,116,117,\n     97,108, 37,115, 43, 34, 41, 10, 32,  9,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32,  9,  9,109,101,116,104,111,100,105,\n    115,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101,\n     10, 32,  9,  9,114,101,116,117,114,110, 32,115,116,114,115,\n    117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,\n    100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121,\n     32,108, 97, 98,101,108,115, 32, 40,112,117, 98,108,105, 99,\n     44, 32,112,114,105,118, 97,116,101, 44, 32,101,116, 99, 41,\n     10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32, 98, 44,\n    101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100,\n     40,115, 44, 32, 34, 94, 37,115, 42, 37,119, 42, 37,115, 42,\n     58, 91, 94, 58, 93, 34, 41, 10, 32,  9,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32,  9,  9,114,101,116,117,114,110, 32,\n    115,116,114,115,117, 98, 40,115, 44, 32,101, 41, 32, 45, 45,\n     32,112,114,101,115,101,114,118,101, 32,116,104,101, 32, 91,\n     94, 58, 93, 10, 32,  9,101,110,100, 10, 32,101,110,100, 10,\n     10, 32, 45, 45, 32,116,114,121, 32,109,111,100,117,108,101,\n     10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,\n    101, 44,110, 97,109,101, 44, 98,111,100,121, 32, 61, 32,115,\n    116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,109,\n    111,100,117,108,101, 37,115, 37,115, 42, 40, 91, 95, 37,119,\n     93, 91, 95, 37,119, 93, 42, 41, 37,115, 42, 40, 37, 98,123,\n    125, 41, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,\n    111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,\n     98, 44,101, 41, 10, 32, 32, 32, 77,111,100,117,108,101, 40,\n    110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114,\n    101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,\n    101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32,116,114,121, 32,110, 97,109,101,115,\n     97,112, 99,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,\n    108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94,\n     37,115, 42,110, 97,109,101,115,112, 97, 99,101, 37,115, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 93, 42, 41,\n     37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 59, 63, 34,\n     41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32,\n     32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,\n    115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32,\n     32, 32, 78, 97,109,101,115,112, 97, 99,101, 40,110, 97,109,\n    101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114,101,116,117,\n    114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49,\n     41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32,\n     45, 45, 32,116,114,121, 32,100,101,102,105,110,101, 10, 32,\n    100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100, 40,\n    115, 44, 34, 94, 37,115, 42, 35,100,101,102,105,110,101, 37,\n    115, 37,115, 42, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92,\n    110, 93, 42, 92,110, 37,115, 42, 34, 41, 10, 32, 32,105,102,\n     32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,\n    114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98,\n     40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 68,101,102,105,\n    110,101, 40,110, 97,109,101, 41, 10, 32, 32, 32,114,101,116,\n    117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43,\n     49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10,\n     32, 45, 45, 32,116,114,121, 32,101,110,117,109,101,114, 97,\n    116,101,115, 10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,\n    108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,121,\n     44,118, 97,114,110, 97,109,101, 32, 61, 32,115,116,114,102,\n    105,110,100, 40,115, 44, 34, 94, 37,115, 42,101,110,117,109,\n     37,115, 43, 40, 37, 83, 42, 41, 37,115, 42, 40, 37, 98,123,\n    125, 41, 37,115, 42, 40, 91, 94, 37,115, 59, 93, 42, 41, 37,\n    115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32,\n     98, 32,116,104,101,110, 10, 32, 32, 32, 45, 45,101,114,114,\n    111,114, 40, 34, 35, 83,111,114,114,121, 44, 32,100,101, 99,\n    108, 97,114, 97,116,105,111,110, 32,111,102, 32,101,110,117,\n    109,115, 32, 97,110,100, 32,118, 97,114,105, 97, 98,108,101,\n    115, 32,111,110, 32,116,104,101, 32,115, 97,109,101, 32,115,\n    116, 97,116,101,109,101,110,116, 32,105,115, 32,110,111,116,\n     32,115,117,112,112,111,114,116,101,100, 46, 92,110, 68,101,\n     99,108, 97,114,101, 32,121,111,117,114, 32,118, 97,114,105,\n     97, 98,108,101, 32,115,101,112, 97,114, 97,116,101,108,121,\n     32, 40,101,120, 97,109,112,108,101, 58, 32, 39, 34, 46, 46,\n    110, 97,109,101, 46, 46, 34, 32, 34, 46, 46,118, 97,114,110,\n     97,109,101, 46, 46, 34, 59, 39, 41, 34, 41, 10, 32, 32, 32,\n     95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,\n    114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32,\n     69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44,\n     98,111,100,121, 44,118, 97,114,110, 97,109,101, 41, 10, 32,\n     32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98,\n     40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 10, 45, 45, 32,100,111, 10, 45, 45, 32, 32,\n    108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101, 44,\n     98,111,100,121, 32, 61, 32,115,116,114,102,105,110,100, 40,\n    115, 44, 34, 94, 37,115, 42,101,110,117,109, 37,115, 43, 40,\n     37, 83, 42, 41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115,\n     42, 59, 63, 37,115, 42, 34, 41, 10, 45, 45, 32, 32,105,102,\n     32, 98, 32,116,104,101,110, 10, 45, 45, 32, 32, 32, 95, 99,\n    117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,\n    117, 98, 40,115, 44, 98, 44,101, 41, 10, 45, 45, 32, 32, 32,\n     69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101, 44,\n     98,111,100,121, 41, 10, 45, 45, 32, 32,114,101,116,117,114,\n    110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41,\n     10, 45, 45, 32, 32,101,110,100, 10, 45, 45, 32,101,110,100,\n     10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98,\n     44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,\n    116,121,112,101,100,101,102, 37,115, 43,101,110,117,109, 91,\n     94,123, 93, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91,\n     37,119, 95, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42, 59,\n     37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,\n    101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,\n    101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,\n    101, 41, 10, 32, 32, 32, 69,110,117,109,101,114, 97,116,101,\n     40,110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,\n    114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115,\n     44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,\n    100, 10, 10, 32, 45, 45, 32,116,114,121, 32,111,112,101,114,\n     97,116,111,114, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,\n    108, 32, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100,\n     44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,\n     95, 37,119, 93, 91, 95, 37,119, 37,115, 37, 42, 38, 58, 60,\n     62, 44, 93, 45, 37,115, 43,111,112,101,114, 97,116,111,114,\n     41, 37,115, 42, 40, 91, 94, 37,115, 93, 91, 94, 37,115, 93,\n     42, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40,\n     99, 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59,\n     37,115, 42, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32,\n     98, 32,116,104,101,110, 10,  9,  9, 32, 45, 45, 32,116,114,\n    121, 32,105,110,108,105,110,101, 10, 32, 32, 32, 98, 44,101,\n     44,100,101, 99,108, 44,107,105,110,100, 44, 97,114,103, 44,\n     99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91,\n     95, 37,119, 37,115, 37, 42, 38, 58, 60, 62, 44, 93, 45, 37,\n    115, 43,111,112,101,114, 97,116,111,114, 41, 37,115, 42, 40,\n     91, 94, 37,115, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42,\n     40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110,\n     63,115, 63,116, 63, 41, 91, 37,115, 92,110, 93, 42, 37, 98,\n    123,125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32,\n    116,104,101,110, 10, 32, 32,  9, 45, 45, 32,116,114,121, 32,\n     99, 97,115,116, 32,111,112,101,114, 97,116,111,114, 10, 32,\n     32,  9, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,100,\n     44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40,\n    111,112,101,114, 97,116,111,114, 41, 37,115, 43, 40, 91, 37,\n    119, 95, 58, 37,100, 60, 62, 37, 42, 37, 38, 37,115, 93, 43,\n     41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99,\n     63,111, 63,110, 63,115, 63,116, 63, 41, 34, 41, 59, 10, 32,\n     32,  9,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32,  9,\n      9,108,111, 99, 97,108, 32, 95, 44,105,101, 32, 61, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34,\n     94, 37,115, 42, 37, 98,123,125, 34, 44, 32,101, 43, 49, 41,\n     10, 32, 32,  9,  9,105,102, 32,105,101, 32,116,104,101,110,\n     10, 32, 32,  9,  9,  9,101, 32, 61, 32,105,101, 10, 32, 32,\n      9,  9,101,110,100, 10, 32, 32,  9,101,110,100, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,\n     10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32,\n     61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41,\n     10, 32, 32, 32, 79,112,101,114, 97,116,111,114, 40,100,101,\n     99,108, 44,107,105,110,100, 44, 97,114,103, 44, 99,111,110,\n    115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,\n    116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,\n    114,121, 32,102,117,110, 99,116,105,111,110, 10, 32,100,111,\n     10, 32, 32, 45, 45,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,\n    115, 42, 40, 91,126, 95, 37,119, 93, 91, 95, 64, 37,119, 37,\n    115, 37, 42, 38, 58, 60, 62, 93, 42, 91, 95, 37,119, 93, 41,\n     37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,\n    111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37,\n    115, 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32,\n     32,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108,\n     44, 97,114,103, 44, 99,111,110,115,116, 44,118,105,114,116,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94,\n     37,115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115,\n     42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,\n    110, 63,115, 63,116, 63, 41, 37,115, 42, 40, 61, 63, 37,115,\n     42, 48, 63, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32,\n     32,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,\n     32, 32,  9, 45, 45, 32,116,114,121, 32,102,117,110, 99,116,\n    105,111,110, 32,119,105,116,104, 32,116,101,109,112,108, 97,\n    116,101, 10, 32, 32,  9, 98, 44,101, 44,100,101, 99,108, 44,\n     97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,114,\n    102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,126,\n     95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38, 58,\n     60, 62, 93, 42, 91, 95, 37,119, 93, 37, 98, 60, 62, 41, 37,\n    115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111,\n     63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37,115,\n     42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32,\n    116,104,101,110, 10, 32, 32, 32, 45, 45, 32,116,114,121, 32,\n     97, 32,115,105,110,103,108,101, 32,108,101,116,116,101,114,\n     32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 10,\n     32, 32, 32, 98, 44,101, 44,100,101, 99,108, 44, 97,114,103,\n     44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93,\n     41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99,\n     63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59, 37,\n    115, 42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102,\n     32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32,\n     45, 45, 32,116,114,121, 32,102,117,110, 99,116,105,111,110,\n     32,112,111,105,110,116,101,114, 10, 32, 32, 32, 98, 44,101,\n     44,100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94,\n     37,115, 42, 40, 91, 94, 37, 40, 59, 92,110, 93, 43, 37, 98,\n     40, 41, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42,\n     59, 37,115, 42, 34, 41, 10, 32, 32, 32,105,102, 32, 98, 32,\n    116,104,101,110, 10, 32, 32, 32, 32,100,101, 99,108, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,100,101,\n     99,108, 44, 32, 34, 37, 40, 37,115, 42, 37, 42, 40, 91, 94,\n     37, 41, 93, 42, 41, 37,115, 42, 37, 41, 34, 44, 32, 34, 32,\n     37, 49, 32, 34, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,\n    101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,\n     10, 32, 32,  9,105,102, 32,118,105,114,116, 32, 97,110,100,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,118,105,\n    114,116, 44, 32, 34, 91, 61, 48, 93, 34, 41, 32,116,104,101,\n    110, 10, 32, 32,  9,  9,105,102, 32,115,101,108,102, 46,102,\n    108, 97,103,115, 32,116,104,101,110, 10, 32, 32,  9,  9,  9,\n    115,101,108,102, 46,102,108, 97,103,115, 46,112,117,114,101,\n     95,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,101,\n     10, 32, 32,  9,  9,101,110,100, 10, 32, 32,  9,101,110,100,\n     10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32,\n     61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41,\n     10, 32, 32, 32, 70,117,110, 99,116,105,111,110, 40,100,101,\n     99,108, 44, 97,114,103, 44, 99,111,110,115,116, 41, 10, 32,\n     32, 32,114,101,116,117,114,110, 32,115,116,114,115,117, 98,\n     40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,105,110,\n    108,105,110,101, 32,102,117,110, 99,116,105,111,110, 10, 32,\n    100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,\n    100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,\n    115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,115, 42,\n     40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110,\n     63,115, 63,116, 63, 41, 91, 94, 59,123, 93, 42, 37, 98,123,\n    125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32, 45,\n     45,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108,\n     44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,\n    126, 95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38,\n     58, 60, 62, 93, 42, 91, 95, 37,119, 62, 93, 41, 37,115, 42,\n     40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,110,\n     63,115, 63,116, 63, 41, 91, 94, 59, 93, 42, 37, 98,123,125,\n     37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102,\n     32,110,111,116, 32, 98, 32,116,104,101,110, 10, 32, 32, 32,\n     45, 45, 32,116,114,121, 32, 97, 32,115,105,110,103,108,101,\n     32,108,101,116,116,101,114, 32,102,117,110, 99,116,105,111,\n    110, 32,110, 97,109,101, 10, 32, 32, 32, 98, 44,101, 44,100,\n    101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,\n     42, 40, 91, 95, 37,119, 93, 41, 37,115, 42, 40, 37, 98, 40,\n     41, 41, 37,115, 42, 40, 99, 63,111, 63,110, 63,115, 63,116,\n     63, 41, 46, 45, 37, 98,123,125, 37,115, 42, 59, 63, 37,115,\n     42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,102, 32,\n     98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114,\n     95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,\n    115, 44, 98, 44,101, 41, 10, 32, 32, 32, 70,117,110, 99,116,\n    105,111,110, 40,100,101, 99,108, 44, 97,114,103, 44, 99,111,\n    110,115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,\n    115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,\n     32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,\n    116,114,121, 32, 99,108, 97,115,115, 10, 32,100,111, 10,  9,\n     32,108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101,\n     44, 98, 97,115,101, 44, 98,111,100,121, 10,  9,  9, 98, 97,\n    115,101, 32, 61, 32, 39, 39, 32, 98,111,100,121, 32, 61, 32,\n     39, 39, 10,  9,  9, 98, 44,101, 44,110, 97,109,101, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,\n     42, 99,108, 97,115,115, 37,115, 42, 40, 91, 95, 37,119, 93,\n     91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59, 34, 41, 32,\n     32, 45, 45, 32,100,117,109,109,121, 32, 99,108, 97,115,115,\n     10,  9,  9,108,111, 99, 97,108, 32,100,117,109,109,121, 32,\n     61, 32,102, 97,108,115,101, 10,  9,  9,105,102, 32,110,111,\n    116, 32, 98, 32,116,104,101,110, 10,  9,  9,  9, 98, 44,101,\n     44,110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99,116, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42,\n     41, 37,115, 42, 59, 34, 41, 32, 32, 32, 32, 45, 45, 32,100,\n    117,109,109,121, 32,115,116,114,117, 99,116, 10,  9,  9,  9,\n    105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,  9,\n      9,  9,  9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97,115,\n    101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,115, 44, 34, 94, 37,115, 42, 99,108, 97,115,115, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42,\n     41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115, 42, 40,\n     37, 98,123,125, 41, 37,115, 42, 34, 41, 10,  9,  9,  9,  9,\n    105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,  9,\n      9,  9,  9,  9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97,\n    115,101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,\n    110,100, 40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99,\n    116, 37,115, 43, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64,\n     93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45, 41, 37,115,\n     42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41, 10,  9,  9,\n      9,  9,  9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,\n    110, 10,  9,  9,  9,  9,  9,  9, 98, 44,101, 44,110, 97,109,\n    101, 44, 98, 97,115,101, 44, 98,111,100,121, 32, 61, 32,115,\n    116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,117,\n    110,105,111,110, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95,\n     37,119, 64, 93, 42, 41, 37,115, 42, 40, 91, 94,123, 93, 45,\n     41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 34, 41,\n     10,  9,  9,  9,  9,  9,  9,105,102, 32,110,111,116, 32, 98,\n     32,116,104,101,110, 10,  9,  9,  9,  9,  9,  9,  9, 98, 97,\n    115,101, 32, 61, 32, 39, 39, 10,  9,  9,  9,  9,  9,  9,  9,\n     98, 44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,\n     42,116,121,112,101,100,101,102, 37,115, 37,115, 42,115,116,\n    114,117, 99,116, 37,115, 37,115, 42, 91, 95, 37,119, 93, 42,\n     37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40, 91, 95,\n     37,119, 93, 91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 59,\n     34, 41, 10,  9,  9,  9,  9,  9,  9,101,110,100, 10,  9,  9,\n      9,  9,  9,101,110,100, 10,  9,  9,  9,  9,101,110,100, 10,\n      9,  9,  9,101,108,115,101, 32,100,117,109,109,121, 32, 61,\n     32, 49, 32,101,110,100, 10,  9,  9,101,108,115,101, 32,100,\n    117,109,109,121, 32, 61, 32, 49, 32,101,110,100, 10,  9,  9,\n    105,102, 32, 98, 32,116,104,101,110, 10,  9,  9,  9,105,102,\n     32, 98, 97,115,101, 32,126, 61, 32, 39, 39, 32,116,104,101,\n    110, 10,  9,  9,  9,  9, 98, 97,115,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44,\n     32, 34, 94, 37,115, 42, 58, 37,115, 42, 34, 44, 32, 34, 34,\n     41, 10,  9,  9,  9,  9, 98, 97,115,101, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40, 98, 97,115,101, 44,\n     32, 34, 37,115, 42,112,117, 98,108,105, 99, 37,115, 42, 34,\n     44, 32, 34, 34, 41, 10,  9,  9,  9,  9, 98, 97,115,101, 32,\n     61, 32,115,112,108,105,116, 40, 98, 97,115,101, 44, 32, 34,\n     44, 34, 41, 10,  9,  9,  9,  9, 45, 45,108,111, 99, 97,108,\n     32, 98, 44,101, 10,  9,  9,  9,  9, 45, 45, 98, 44,101, 44,\n     98, 97,115,101, 32, 61, 32,115,116,114,102,105,110,100, 40,\n     98, 97,115,101, 44, 34, 46, 45, 40, 91, 95, 37,119, 93, 91,\n     95, 37,119, 60, 62, 44, 58, 93, 42, 41, 36, 34, 41, 10,  9,\n      9,  9,101,108,115,101, 10,  9,  9,  9,  9, 98, 97,115,101,\n     32, 61, 32,123,125, 10,  9,  9,  9,101,110,100, 10,  9,  9,\n      9, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,\n    116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10,  9,  9,\n      9, 67,108, 97,115,115, 40,110, 97,109,101, 44, 98, 97,115,\n    101, 44, 98,111,100,121, 41, 10,  9,  9,  9,105,102, 32,110,\n    111,116, 32,100,117,109,109,121, 32,116,104,101,110, 10,  9,\n      9,  9,  9,118, 97,114, 98, 44,118, 97,114,101, 44,118, 97,\n    114,110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46,\n    102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 40, 91,\n     95, 37,119, 93, 43, 41, 37,115, 42, 59, 34, 44, 32,101, 43,\n     49, 41, 10,  9,  9,  9,  9,105,102, 32,118, 97,114, 98, 32,\n    116,104,101,110, 10,  9,  9,  9,  9,  9, 86, 97,114,105, 97,\n     98,108,101, 40,110, 97,109,101, 46, 46, 34, 32, 34, 46, 46,\n    118, 97,114,110, 97,109,101, 41, 10,  9,  9,  9,  9,  9,101,\n     32, 61, 32,118, 97,114,101, 10,  9,  9,  9,  9,101,110,100,\n     10,  9,  9,  9,101,110,100, 10,  9,  9,  9,114,101,116,117,\n    114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49,\n     41, 10,  9,  9,101,110,100, 10,  9,101,110,100, 10, 10, 32,\n     45, 45, 32,116,114,121, 32,116,121,112,101,100,101,102, 10,\n     32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101,\n     44,116,121,112,101,115, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,115, 44, 34, 94, 37,115, 42,116,121,112,101,100,101,\n    102, 37,115, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 59, 37,\n    115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,\n    110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101,\n     32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101,\n     41, 10, 32, 32, 32, 84,121,112,101,100,101,102, 40,116,121,\n    112,101,115, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,\n    115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,\n     32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,\n    116,114,121, 32,118, 97,114,105, 97, 98,108,101, 10, 32,100,\n    111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100,\n    101, 99,108, 32, 61, 32,115,116,114,102,105,110,100, 40,115,\n     44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 64,\n     37,115, 37,119, 37,100, 37, 42, 38, 58, 60, 62, 44, 93, 42,\n     91, 95, 37,119, 37,100, 93, 41, 37,115, 42, 59, 37,115, 42,\n     34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10,\n     32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61,\n     32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10,\n     10,  9,108,111, 99, 97,108, 32,108,105,115,116, 32, 61, 32,\n    115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,\n    100,101, 99,108, 44, 32, 34, 44, 34, 41, 10,  9, 86, 97,114,\n    105, 97, 98,108,101, 40,108,105,115,116, 91, 49, 93, 41, 10,\n      9,105,102, 32,108,105,115,116, 46,110, 32, 62, 32, 49, 32,\n    116,104,101,110, 10,  9,  9,108,111, 99, 97,108, 32, 95, 44,\n     95, 44,116,121,112,101, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,108,105,115,116, 91, 49, 93, 44, 32, 34, 40, 46, 45,\n     41, 37,115, 43, 40, 91, 94, 37,115, 93, 42, 41, 36, 34, 41,\n     59, 10, 10,  9,  9,108,111, 99, 97,108, 32,105, 32, 61, 50,\n     59, 10,  9,  9,119,104,105,108,101, 32,108,105,115,116, 91,\n    105, 93, 32,100,111, 10,  9,  9,  9, 86, 97,114,105, 97, 98,\n    108,101, 40,116,121,112,101, 46, 46, 34, 32, 34, 46, 46,108,\n    105,115,116, 91,105, 93, 41, 10,  9,  9,  9,105, 61,105, 43,\n     49, 10,  9,  9,101,110,100, 10,  9,101,110,100, 10, 32, 32,\n     32, 45, 45, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99,\n    108, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116,\n    114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,\n    110,100, 10, 32,101,110,100, 10, 10,  9, 45, 45, 32,116,114,\n    121, 32,115,116,114,105,110,103, 10, 32,100,111, 10, 32, 32,\n    108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,\n    115, 42, 40, 91, 95, 37,119, 93, 63, 91, 95, 37,115, 37,119,\n     37,100, 93, 45, 99,104, 97,114, 37,115, 43, 91, 95, 64, 37,\n    119, 37,100, 93, 42, 37,115, 42, 37, 91, 37,115, 42, 37, 83,\n     43, 37,115, 42, 37, 93, 41, 37,115, 42, 59, 37,115, 42, 34,\n     41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32,\n     32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,\n    115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32,\n     32, 32, 86, 97,114,105, 97, 98,108,101, 40,100,101, 99,108,\n     41, 10, 32, 32, 32,114,101,116,117,114,110, 32,115,116,114,\n    115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,\n    100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121,\n     32, 97,114,114, 97,121, 10, 32,100,111, 10, 32, 32,108,111,\n     99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,\n     40, 91, 95, 37,119, 93, 91, 93, 91, 95, 64, 37,115, 37,119,\n     37,100, 37, 42, 38, 58, 93, 42, 91, 93, 95, 37,119, 37,100,\n     93, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32,105,\n    102, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,\n    114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117,\n     98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 65,114,114,\n     97,121, 40,100,101, 99,108, 41, 10, 32, 32, 32,114,101,116,\n    117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43,\n     49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10,\n     32, 45, 45, 32,110,111, 32,109, 97,116, 99,104,105,110,103,\n     10, 32,105,102, 32,103,115,117, 98, 40,115, 44, 34, 37,115,\n     37,115, 42, 34, 44, 34, 34, 41, 32,126, 61, 32, 34, 34, 32,\n    116,104,101,110, 10, 32, 32, 95, 99,117,114,114, 95, 99,111,\n    100,101, 32, 61, 32,115, 10, 32, 32,101,114,114,111,114, 40,\n     34, 35,112, 97,114,115,101, 32,101,114,114,111,114, 34, 41,\n     10, 32,101,108,115,101, 10, 32, 32,114,101,116,117,114,110,\n     32, 34, 34, 10, 32,101,110,100, 10, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 58,112, 97,114,115,101, 32,\n     40,115, 41, 10, 10,  9, 45, 45,115,101,108,102, 46, 99,117,\n    114,114, 95,109,101,109, 98,101,114, 95, 97, 99, 99,101,115,\n    115, 32, 61, 32,110,105,108, 10, 10, 32,119,104,105,108,101,\n     32,115, 32,126, 61, 32, 39, 39, 32,100,111, 10, 32, 32,115,\n     32, 61, 32,115,101,108,102, 58,100,111,112, 97,114,115,101,\n     40,115, 41, 10, 32, 32,109,101,116,104,111,100,105,115,118,\n    105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115,101, 10,\n     32,101,110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32,112,\n    114,111,112,101,114,116,121, 32,116,121,112,101,115, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,103,101,116, 95,112,114,\n    111,112,101,114,116,121, 95,116,121,112,101, 40, 41, 10, 10,\n      9,114,101,116,117,114,110, 32, 99,108, 97,115,115, 67,111,\n    110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,103,101,\n    116, 95,112,114,111,112,101,114,116,121, 95,116,121,112,101,\n     40, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 58,115,101,116, 95,112,114,111,112,101,114,116,121, 95,\n    116,121,112,101, 40,112,116,121,112,101, 41, 10,  9,112,116,\n    121,112,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 40,112,116,121,112,101, 44, 32, 34, 94, 37,115, 42,\n     34, 44, 32, 34, 34, 41, 10,  9,112,116,121,112,101, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,112,116,\n    121,112,101, 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34,\n     41, 10, 10,  9,115,101,108,102, 46,112,114,111,112,101,114,\n    116,121, 95,116,121,112,101, 32, 61, 32,112,116,121,112,101,\n     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,\n    103,101,116, 95,112,114,111,112,101,114,116,121, 95,116,121,\n    112,101, 40, 41, 10,  9,114,101,116,117,114,110, 32,115,101,\n    108,102, 46,112,114,111,112,101,114,116,121, 95,116,121,112,\n    101, 32,111,114, 32, 40,115,101,108,102, 46,112, 97,114,101,\n    110,116, 32, 97,110,100, 32,115,101,108,102, 46,112, 97,114,\n    101,110,116, 58,103,101,116, 95,112,114,111,112,101,114,116,\n    121, 95,116,121,112,101, 40, 41, 41, 32,111,114, 32, 34,100,\n    101,102, 97,117,108,116, 34, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/container.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,112, 97, 99,107, 97,\n    103,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,\n    116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,\n    114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,\n    114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32,\n     74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100,\n     58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,\n    100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,\n    119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,\n    101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32,\n     97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,\n    116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119,\n     97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,\n    114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,\n    110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115,\n     44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,\n    116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,\n    105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,\n    105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101,\n     44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,\n    116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,\n    109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,\n    105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45,\n     32, 80, 97, 99,107, 97,103,101, 32, 99,108, 97,115,115, 10,\n     45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,116,\n    104,101, 32,119,104,111,108,101, 32,112, 97, 99,107, 97,103,\n    101, 32, 98,101,105,110,103, 32, 98,111,117,110,100, 46, 10,\n     45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,110,\n    103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,116,\n    111,114,101,100, 58, 10, 45, 45, 32, 32, 32, 32,123,105,125,\n     32, 61, 32,108,105,115,116, 32,111,102, 32,111, 98,106,101,\n     99,116,115, 32,105,110, 32,116,104,101, 32,112, 97, 99,107,\n     97,103,101, 46, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,\n    103,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,\n    112,101, 32, 61, 32, 39,112, 97, 99,107, 97,103,101, 39, 10,\n    125, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 46,\n     95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115,\n     80, 97, 99,107, 97,103,101, 10,115,101,116,109,101,116, 97,\n    116, 97, 98,108,101, 40, 99,108, 97,115,115, 80, 97, 99,107,\n     97,103,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,\n    110,101,114, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,\n    109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110,\n     32, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,\n    114,105,110,116, 32, 40, 41, 10, 32,112,114,105,110,116, 40,\n     34, 80, 97, 99,107, 97,103,101, 58, 32, 34, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 41, 10, 32,108,111, 99, 97,108,\n     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,\n    102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,\n    105, 93, 58,112,114,105,110,116, 40, 34, 34, 44, 34, 34, 41,\n     10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100,\n     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114,\n    101,112,114,111, 99,101,115,115, 32, 40, 41, 10, 10, 32, 45,\n     45, 32, 97,118,111,105,100, 32,112,114,101,112,114,111, 99,\n    101,115,115,105,110,103, 32,101,109, 98,101,100,100,101,100,\n     32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99, 97,\n    108, 32, 76, 32, 61, 32,123,125, 10, 32,115,101,108,102, 46,\n     99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,\n    102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 37, 36,\n     37, 91, 34, 44, 34, 92, 49, 34, 41, 32, 45, 45, 32,100,101,\n     97,108, 32,119,105,116,104, 32,101,109, 98,101,100,100,101,\n    100, 32,108,117, 97, 32, 99,111,100,101, 10, 32,115,101,108,\n    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,\n    101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42,\n     37, 36, 37, 93, 34, 44, 34, 92, 50, 34, 41, 10, 32,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98, 92,\n     49, 92, 50, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,117,\n    110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,105,\n    110,115,101,114,116, 40, 76, 44, 99, 41, 10, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,\n    116,117,114,110, 32, 34, 92,110, 35, 91, 34, 46, 46,103,101,\n    116,110, 40, 76, 41, 46, 46, 34, 93, 35, 34, 10, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,\n    100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,\n    101,112,114,111, 99,101,115,115,105,110,103, 32,101,109, 98,\n    101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,108,\n    111, 99, 97,108, 32, 67, 32, 61, 32,123,125, 10, 32,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115,\n     42, 37, 36, 37, 60, 34, 44, 34, 92, 51, 34, 41, 32, 45, 45,\n     32,100,101, 97,108, 32,119,105,116,104, 32,101,109, 98,101,\n    100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115,\n     42, 37, 36, 37, 62, 34, 44, 34, 92, 52, 34, 41, 10, 32,115,\n    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,\n     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98,\n     92, 51, 92, 52, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,\n    117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,\n    105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,\n    101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46, 46,103,\n    101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,\n    110,100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,\n    114,101,112,114,111, 99,101,115,115,105,110,103, 32,101,109,\n     98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,\n    115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117,\n     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110,\n     37,115, 42, 37, 36, 37,123, 34, 44, 34, 92, 53, 34, 41, 32,\n     45, 45, 32,100,101, 97,108, 32,119,105,116,104, 32,101,109,\n     98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,\n    115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117,\n     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110,\n     37,115, 42, 37, 36, 37,125, 34, 44, 34, 92, 54, 34, 41, 10,\n     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,\n    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40,\n     37, 98, 92, 53, 92, 54, 41, 34, 44, 32, 32, 32, 32, 32, 32,\n     32,102,117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,116,105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,114,101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46,\n     46,103,101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,101,110,100, 41, 10, 10, 32, 45, 45,115,101,108,102, 46,\n     99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,\n    102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 35, 91,\n     94,100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34,\n     92,110, 92,110, 34, 41, 32, 45, 45, 32,101,108,105,109,105,\n    110, 97,116,101, 32,112,114,101,112,114,111, 99,101,115,115,\n    111,114, 32,100,105,114,101, 99,116,105,118,101,115, 32,116,\n    104, 97,116, 32,100,111,110, 39,116, 32,115,116, 97,114,116,\n     32,119,105,116,104, 32, 39,100, 39, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 92,110, 91, 32, 92,116,\n     93, 42, 35, 91, 32, 92,116, 93, 42, 91, 94,100, 37, 60, 37,\n     91, 93, 34, 44, 32, 34, 92,110, 47, 47, 34, 41, 32, 45, 45,\n     32,101,108,105,109,105,110, 97,116,101, 32,112,114,101,112,\n    114,111, 99,101,115,115,111,114, 32,100,105,114,101, 99,116,\n    105,118,101,115, 32,116,104, 97,116, 32,100,111,110, 39,116,\n     32,115,116, 97,114,116, 32,119,105,116,104, 32, 39,100, 39,\n     10, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,101,\n    112,114,111, 99,101,115,115,105,110,103, 32,118,101,114, 98,\n     97,116,105,109, 32,108,105,110,101,115, 10, 32,108,111, 99,\n     97,108, 32, 86, 32, 61, 32,123,125, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 92,110, 40, 37,115, 42,\n     37, 36, 91, 94, 37, 91, 37, 93, 93, 91, 94, 92,110, 93, 42,\n     41, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,118, 41,\n     10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32,116,105,110,115,101,114,116, 40, 86, 44,118, 41,\n     10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32,114,101,116,117,114,110, 32, 34, 92,110, 35, 34,\n     46, 46,103,101,116,110, 40, 86, 41, 46, 46, 34, 35, 34, 10,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,101,110,100, 41, 10, 10, 32, 45, 45, 32,112,101,114,102,\n    111,114,109, 32,103,108,111, 98, 97,108, 32,115,117, 98,115,\n    116,105,116,117,116,105,111,110, 10, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 40, 47, 47, 91, 94, 92,\n    110, 93, 42, 41, 34, 44, 34, 34, 41, 32, 32, 32, 32, 32, 45,\n     45, 32,101,108,105,109,105,110, 97,116,101, 32, 67, 43, 43,\n     32, 99,111,109,109,101,110,116,115, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 47, 37, 42, 34, 44, 34,\n     92, 49, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,101,\n     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,\n    100,101, 44, 34, 37, 42, 47, 34, 44, 34, 92, 50, 34, 41, 10,\n     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,\n    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,\n     98, 92, 49, 92, 50, 34, 44, 34, 34, 41, 10, 32,115,101,108,\n    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,\n    101,108,102, 46, 99,111,100,101, 44, 34, 92, 49, 34, 44, 34,\n     47, 37, 42, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,\n    101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,\n    111,100,101, 44, 34, 92, 50, 34, 44, 34, 37, 42, 47, 34, 41,\n     10, 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,\n    115,117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34,\n     37,115, 42, 64, 37,115, 42, 34, 44, 34, 64, 34, 41, 32, 45,\n     45, 32,101,108,105,109,105,110, 97,116,101, 32,115,112, 97,\n     99,101,115, 32, 98,101,115,105,100,101, 32, 64, 10, 32,115,\n    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,\n     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,\n    105,110,108,105,110,101, 40, 37,115, 41, 34, 44, 34, 37, 49,\n     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 39,105,110,108,105,110,101, 39, 32,107,101,121,119,111,\n    114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,101,\n     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,\n    100,101, 44, 34, 37,115, 63,101,120,116,101,114,110, 40, 37,\n    115, 41, 34, 44, 34, 37, 49, 34, 41, 32, 45, 45, 32,101,108,\n    105,109,105,110, 97,116,101, 32, 39,101,120,116,101,114,110,\n     39, 32,107,101,121,119,111,114,100, 10, 32, 45, 45,115,101,\n    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,\n    115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,118,\n    105,114,116,117, 97,108, 40, 37,115, 41, 34, 44, 34, 37, 49,\n     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 39,118,105,114,116,117, 97,108, 39, 32,107,101,121,119,\n    111,114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,\n    101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,\n    111,100,101, 44, 34,112,117, 98,108,105, 99, 58, 34, 44, 34,\n     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 39,112,117, 98,108,105, 99, 58, 39, 32,107,101,121,119,\n    111,114,100, 10, 32,115,101,108,102, 46, 99,111,100,101, 32,\n     61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,100,\n    101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,118,111,105,100,\n     37,115, 42, 37, 42, 34, 44, 34, 37, 49, 95,117,115,101,114,\n    100, 97,116, 97, 32, 34, 41, 32, 45, 45, 32,115,117, 98,115,\n    116,105,116,117,116,101, 32, 39,118,111,105,100, 42, 39, 10,\n     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,\n    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40,\n     91, 94, 37,119, 95, 93, 41,118,111,105,100, 37,115, 42, 37,\n     42, 34, 44, 34, 37, 49, 95,117,115,101,114,100, 97,116, 97,\n     32, 34, 41, 32, 45, 45, 32,115,117, 98,115,116,105,116,117,\n    116,101, 32, 39,118,111,105,100, 42, 39, 10, 32,115,101,108,\n    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,\n    101,108,102, 46, 99,111,100,101, 44, 34, 40, 91, 94, 37,119,\n     95, 93, 41, 99,104, 97,114, 37,115, 42, 37, 42, 34, 44, 34,\n     37, 49, 95, 99,115,116,114,105,110,103, 32, 34, 41, 32, 32,\n     45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39,\n     99,104, 97,114, 42, 39, 10, 32,115,101,108,102, 46, 99,111,\n    100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46,\n     99,111,100,101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,108,\n    117, 97, 95, 83,116, 97,116,101, 37,115, 42, 37, 42, 34, 44,\n     34, 37, 49, 95,108,115,116, 97,116,101, 32, 34, 41, 32, 32,\n     45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39,\n    108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10, 10, 32, 45,\n     45, 32,114,101,115,116,111,114,101, 32,101,109, 98,101,100,\n    100,101,100, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,115,\n    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,\n     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37, 35, 37,\n     91, 40, 37,100, 43, 41, 37, 93, 37, 35, 34, 44,102,117,110,\n     99,116,105,111,110, 32, 40,110, 41, 10, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,\n    114,110, 32, 76, 91,116,111,110,117,109, 98,101,114, 40,110,\n     41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,101,110,100, 41, 10, 32, 45, 45, 32,114,101,115,116,\n    111,114,101, 32,101,109, 98,101,100,100,101,100, 32, 67, 32,\n     99,111,100,101, 10, 32,115,101,108,102, 46, 99,111,100,101,\n     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,\n    100,101, 44, 34, 37, 35, 37, 60, 40, 37,100, 43, 41, 37, 62,\n     37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,110,\n     41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32,114,101,116,117,114,110, 32, 67, 91,116,111,110,117,\n    109, 98,101,114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 41, 10, 32, 45,\n     45, 32,114,101,115,116,111,114,101, 32,118,101,114, 98, 97,\n    116,105,109, 32,108,105,110,101,115, 10, 32,115,101,108,102,\n     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,\n    108,102, 46, 99,111,100,101, 44, 34, 37, 35, 40, 37,100, 43,\n     41, 37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,\n    110, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,\n    101,116,117,114,110, 32, 86, 91,116,111,110,117,109, 98,101,\n    114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,101,110,100, 41, 10, 10, 32,115,101,108,102, 46, 99,111,\n    100,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 32, 34, 92,\n    110, 37,115, 42, 37, 36, 40, 91, 94, 92,110, 93, 43, 41, 34,\n     44, 32,102,117,110, 99,116,105,111,110, 32, 40,108, 41, 10,\n      9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 86,101,114, 98,\n     97,116,105,109, 40,108, 46, 46, 34, 92,110, 34, 41, 10,  9,\n      9,  9,  9,  9,  9,  9,  9,  9,  9,  9,114,101,116,117,114,\n    110, 32, 34, 92,110, 34, 10,  9,  9,  9,  9,  9,  9,  9,  9,\n      9,  9, 32, 32,101,110,100, 41, 10,101,110,100, 10, 10, 45,\n     45, 32,116,114, 97,110,115,108, 97,116,101, 32,118,101,114,\n     98, 97,116,105,109, 10,102,117,110, 99,116,105,111,110, 32,\n     99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114,\n    101, 97,109, 98,108,101, 32, 40, 41, 10, 32,111,117,116,112,\n    117,116, 40, 39, 47, 42, 92,110, 39, 41, 10, 32,111,117,116,\n    112,117,116, 40, 39, 42, 42, 32, 76,117, 97, 32, 98,105,110,\n    100,105,110,103, 58, 32, 39, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 39, 92,110, 39, 41, 10, 32,111,117,116,\n    112,117,116, 40, 39, 42, 42, 32, 71,101,110,101,114, 97,116,\n    101,100, 32, 97,117,116,111,109, 97,116,105, 99, 97,108,108,\n    121, 32, 98,121, 32, 39, 46, 46, 84, 79, 76, 85, 65, 95, 86,\n     69, 82, 83, 73, 79, 78, 46, 46, 39, 32,111,110, 32, 39, 46,\n     46,100, 97,116,101, 40, 41, 46, 46, 39, 46, 92,110, 39, 41,\n     10, 32,111,117,116,112,117,116, 40, 39, 42, 47, 92,110, 92,\n    110, 39, 41, 10, 10,  9,111,117,116,112,117,116, 40, 39, 35,\n    105,102,110,100,101,102, 32, 95, 95, 99,112,108,117,115,112,\n    108,117,115, 92,110, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 35,105,110, 99,108,117,100,101, 32, 34,115,116,100,\n    108,105, 98, 46,104, 34, 92,110, 39, 41, 10,  9,111,117,116,\n    112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41,\n     10,  9,111,117,116,112,117,116, 40, 39, 35,105,110, 99,108,\n    117,100,101, 32, 34,115,116,114,105,110,103, 46,104, 34, 92,\n    110, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,\n     35,105,110, 99,108,117,100,101, 32, 34,116,111,108,117, 97,\n     43, 43, 46,104, 34, 92,110, 92,110, 39, 41, 10, 10, 32,105,\n    102, 32,110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,\n    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47,\n     42, 32, 69,120,112,111,114,116,101,100, 32,102,117,110, 99,\n    116,105,111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,\n    112,117,116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,\n    105,110,116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,\n    101,108,102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,\n    110, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,\n    111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100,\n     10, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,\n    104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111,\n     10, 32, 32,115,101,108,102, 91,105, 93, 58,112,114,101, 97,\n    109, 98,108,101, 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43,\n     49, 10, 32,101,110,100, 10, 10,  9,105,102, 32,115,101,108,\n    102, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99,\n    116,105,111,110, 40, 95, 99,111,108,108,101, 99,116, 41, 32,\n    116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40, 39,\n     92,110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39,\n     47, 42, 32,102,117,110, 99,116,105,111,110, 32,116,111, 32,\n    114,101,108,101, 97,115,101, 32, 99,111,108,108,101, 99,116,\n    101,100, 32,111, 98,106,101, 99,116, 32,118,105, 97, 32,100,\n    101,115,116,114,117, 99,116,111,114, 32, 42, 47, 39, 41, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101,\n    102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110,\n     39, 41, 10,  9,  9,102,111,114, 32,105, 44,118, 32,105,110,\n     32,112, 97,105,114,115, 40, 95, 99,111,108,108,101, 99,116,\n     41, 32,100,111, 10,  9,  9, 32,111,117,116,112,117,116, 40,\n     39, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 32, 39,\n     46, 46,118, 46, 46, 39, 32, 40,108,117, 97, 95, 83,116, 97,\n    116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39,123, 39, 41, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 39, 46, 46,\n    105, 46, 46, 39, 42, 32,115,101,108,102, 32, 61, 32, 40, 39,\n     46, 46,105, 46, 46, 39, 42, 41, 32,116,111,108,117, 97, 95,\n    116,111,117,115,101,114,116,121,112,101, 40,116,111,108,117,\n     97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39,  9, 77,116,111,108,117, 97,\n     95,100,101,108,101,116,101, 40,115,101,108,102, 41, 59, 39,\n     41, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39,  9,114,\n    101,116,117,114,110, 32, 48, 59, 39, 41, 10,  9,  9,  9,111,\n    117,116,112,117,116, 40, 39,125, 39, 41, 10,  9,  9,101,110,\n    100, 10,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,\n    100,105,102, 92,110, 92,110, 39, 41, 10,  9,101,110,100, 10,\n     10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10,\n     32,111,117,116,112,117,116, 40, 39, 47, 42, 32,102,117,110,\n     99,116,105,111,110, 32,116,111, 32,114,101,103,105,115,116,\n    101,114, 32,116,121,112,101, 32, 42, 47, 39, 41, 10, 32,111,\n    117,116,112,117,116, 40, 39,115,116, 97,116,105, 99, 32,118,\n    111,105,100, 32,116,111,108,117, 97, 95,114,101,103, 95,116,\n    121,112,101,115, 32, 40,108,117, 97, 95, 83,116, 97,116,101,\n     42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10, 32,111,\n    117,116,112,117,116, 40, 39,123, 39, 41, 10, 10,  9,105,102,\n     32,102,108, 97,103,115, 46,116, 32,116,104,101,110, 10,  9,\n      9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,\n    102, 32, 77,116,111,108,117, 97, 95,116,121,112,101,105,100,\n     92,110, 35,100,101,102,105,110,101, 32, 77,116,111,108,117,\n     97, 95,116,121,112,101,105,100, 40, 76, 44, 84, 73, 44, 84,\n     41, 92,110, 35,101,110,100,105,102, 92,110, 34, 41, 10,  9,\n    101,110,100, 10,  9,102,111,114,101, 97, 99,104, 40, 95,117,\n    115,101,114,116,121,112,101, 44,102,117,110, 99,116,105,111,\n    110, 40,110, 44,118, 41, 10,  9,  9,105,102, 32, 40,110,111,\n    116, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115,\n    101,115, 91,118, 93, 41, 32,111,114, 32, 95,103,108,111, 98,\n     97,108, 95, 99,108, 97,115,115,101,115, 91,118, 93, 58, 99,\n    104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,\n    101,115,115, 40, 41, 32,116,104,101,110, 10,  9,  9,  9,111,\n    117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,117,\n    115,101,114,116,121,112,101, 40,116,111,108,117, 97, 95, 83,\n     44, 34, 39, 44,118, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,\n      9,105,102, 32,102,108, 97,103,115, 46,116, 32,116,104,101,\n    110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32,\n     77,116,111,108,117, 97, 95,116,121,112,101,105,100, 40,116,\n    111,108,117, 97, 95, 83, 44,116,121,112,101,105,100, 40, 39,\n     44,118, 44, 39, 41, 44, 32, 34, 39, 44,118, 44, 39, 34, 41,\n     59, 39, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,110,\n    100, 10,  9, 32,101,110,100, 41, 10, 32,111,117,116,112,117,\n    116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n     39, 92,110, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,114,\n    101,103,105,115,116,101,114, 32,112, 97, 99,107, 97,103,101,\n     10, 45, 45, 32,119,114,105,116,101, 32,112, 97, 99,107, 97,\n    103,101, 32,111,112,101,110, 32,102,117,110, 99,116,105,111,\n    110, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 80, 97, 99,107, 97,103,101, 58,114,101,103,105,115,116,\n    101,114, 32, 40,112,114,101, 41, 10, 32,112,114,101, 32, 61,\n     32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,112,117,115,\n    104, 40,115,101,108,102, 41, 10, 32,111,117,116,112,117,116,\n     40,112,114,101, 46, 46, 34, 47, 42, 32, 79,112,101,110, 32,\n    102,117,110, 99,116,105,111,110, 32, 42, 47, 34, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79,\n     76, 85, 65, 95, 65, 80, 73, 32,105,110,116, 32,116,111,108,\n    117, 97, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 34, 95,111,112,101,110, 32, 40,108,117, 97, 95, 83,\n    116, 97,116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34,\n     41, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,\n     34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40,112,114,\n    101, 46, 46, 34, 32,116,111,108,117, 97, 95,111,112,101,110,\n     40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,\n    117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,\n    108,117, 97, 95,114,101,103, 95,116,121,112,101,115, 40,116,\n    111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,117,116,\n    112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,108,117,\n     97, 95,109,111,100,117,108,101, 40,116,111,108,117, 97, 95,\n     83, 44, 78, 85, 76, 76, 44, 34, 44,115,101,108,102, 58,104,\n     97,115,118, 97,114, 40, 41, 44, 34, 41, 59, 34, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,\n    111,108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,\n    101, 40,116,111,108,117, 97, 95, 83, 44, 78, 85, 76, 76, 41,\n     59, 34, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10,\n     32,119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,\n    100,111, 10, 32, 32,115,101,108,102, 91,105, 93, 58,114,101,\n    103,105,115,116,101,114, 40,112,114,101, 46, 46, 34, 32, 32,\n     34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,\n    110,100, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46,\n     46, 34, 32,116,111,108,117, 97, 95,101,110,100,109,111,100,\n    117,108,101, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41,\n     10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,\n     32,114,101,116,117,114,110, 32, 49, 59, 34, 41, 10, 32,111,\n    117,116,112,117,116, 40,112,114,101, 46, 46, 34,125, 34, 41,\n     10, 10, 32,111,117,116,112,117,116, 40, 34, 92,110, 92,110,\n     34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102,\n     32,100,101,102,105,110,101,100, 40, 76, 85, 65, 95, 86, 69,\n     82, 83, 73, 79, 78, 95, 78, 85, 77, 41, 32, 38, 38, 32, 76,\n     85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 95, 78, 85, 77, 32,\n     62, 61, 32, 53, 48, 49, 92,110, 34, 41, 59, 10, 32,111,117,\n    116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79, 76, 85,\n     65, 95, 65, 80, 73, 32,105,110,116, 32,108,117, 97,111,112,\n    101,110, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 34, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42,\n     32,116,111,108,117, 97, 95, 83, 41, 32,123, 34, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,114,\n    101,116,117,114,110, 32,116,111,108,117, 97, 95, 34, 46, 46,\n    115,101,108,102, 46,110, 97,109,101, 46, 46, 34, 95,111,112,\n    101,110, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10,\n     32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,125,\n     59, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,101,\n    110,100,105,102, 92,110, 92,110, 34, 41, 10, 10,  9,112,111,\n    112, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,119,114,105,\n    116,101, 32,104,101, 97,100,101,114, 32,102,105,108,101, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 80,\n     97, 99,107, 97,103,101, 58,104,101, 97,100,101,114, 32, 40,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 47, 42, 92,110,\n     39, 41, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 76,\n    117, 97, 32, 98,105,110,100,105,110,103, 58, 32, 39, 46, 46,\n    115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 92,110, 39,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 71,\n    101,110,101,114, 97,116,101,100, 32, 97,117,116,111,109, 97,\n    116,105, 99, 97,108,108,121, 32, 98,121, 32, 39, 46, 46, 84,\n     79, 76, 85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 46, 46, 39,\n     32,111,110, 32, 39, 46, 46,100, 97,116,101, 40, 41, 46, 46,\n     39, 46, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n     39, 42, 47, 92,110, 92,110, 39, 41, 10, 10, 32,105,102, 32,\n    110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,104,101,\n    110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47, 42, 32,\n     69,120,112,111,114,116,101,100, 32,102,117,110, 99,116,105,\n    111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,105,110,\n    116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,110, 32,\n     40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,\n    117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101,\n    110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108,\n     32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117,\n    110, 99,116,105,111,110, 32, 95, 80, 97, 99,107, 97,103,101,\n     32, 40,115,101,108,102, 41, 10, 32,115,101,116,109,101,116,\n     97,116, 97, 98,108,101, 40,115,101,108,102, 44, 99,108, 97,\n    115,115, 80, 97, 99,107, 97,103,101, 41, 10, 32,114,101,116,\n    117,114,110, 32,115,101,108,102, 10,101,110,100, 10, 10, 45,\n     45, 32, 80, 97,114,115,101, 32, 67, 32,104,101, 97,100,101,\n    114, 32,102,105,108,101, 32,119,105,116,104, 32,116,111,108,\n    117, 97, 32,100,105,114,101, 99,116,105,118,101,115, 10, 45,\n     45, 32, 42, 42, 42, 32, 84,104, 97,110,107,115, 32,116,111,\n     32, 65,114,105,101,108, 32, 77, 97,110,122,117,114, 32,102,\n    111,114, 32,102,105,120,105,110,103, 32, 98,117,103,115, 32,\n    105,110, 32,110,101,115,116,101,100, 32,100,105,114,101, 99,\n    116,105,118,101,115, 32, 42, 42, 42, 10,102,117,110, 99,116,\n    105,111,110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,\n    101, 40,102,110, 44,115, 41, 10,  9,108,111, 99, 97,108, 32,\n     99,111,100,101, 32, 61, 32, 39, 92,110, 36, 35,105,110, 99,\n    108,117,100,101, 32, 34, 39, 46, 46,102,110, 46, 46, 39, 34,\n     92,110, 39, 10,  9,115, 61, 32, 34, 92,110, 34, 32, 46, 46,\n     32,115, 32, 46, 46, 32, 34, 92,110, 34, 32, 45, 45, 32, 97,\n    100,100, 32, 98,108, 97,110,107, 32,108,105,110,101,115, 32,\n     97,115, 32,115,101,110,116,105,110,101,108,115, 10,  9,108,\n    111, 99, 97,108, 32, 95, 44,101, 44, 99, 44,116, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115, 44, 32, 34, 92,110, 40,\n     91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91, 79,111, 93,\n     91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93, 95, 40, 91,\n     94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42, 92,110, 34,\n     41, 10,  9,119,104,105,108,101, 32,101, 32,100,111, 10,  9,\n      9,116, 32, 61, 32,115,116,114,108,111,119,101,114, 40,116,\n     41, 10,  9,  9,105,102, 32,116, 32, 61, 61, 32, 34, 98,101,\n    103,105,110, 34, 32,116,104,101,110, 10,  9,  9,  9, 95, 44,\n    101, 44, 99, 32, 61, 32,115,116,114,102,105,110,100, 40,115,\n     44, 34, 40, 46, 45, 41, 92,110, 91, 94, 92,110, 93, 42, 91,\n     84,116, 93, 91, 79,111, 93, 91, 76,108, 93, 91, 85,117, 93,\n     91, 65, 97, 93, 95, 91, 69,101, 93, 91, 78,110, 93, 91, 68,\n    100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44,101, 41, 10,\n      9,  9,  9,105,102, 32,110,111,116, 32,101, 32,116,104,101,\n    110, 10,  9,  9,  9, 32,116,111,108,117, 97, 95,101,114,114,\n    111,114, 40, 34, 85,110, 98, 97,108, 97,110, 99,101,100, 32,\n     39,116,111,108,117, 97, 95, 98,101,103,105,110, 39, 32,100,\n    105,114,101, 99,116,105,118,101, 32,105,110, 32,104,101, 97,\n    100,101,114, 32,102,105,108,101, 34, 41, 10,  9,  9,  9,101,\n    110,100, 10,  9,  9,101,110,100, 10,  9,  9, 99,111,100,101,\n     32, 61, 32, 99,111,100,101, 32, 46, 46, 32, 99, 32, 46, 46,\n     32, 34, 92,110, 34, 10,  9, 32, 95, 44,101, 44, 99, 44,116,\n     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32, 34,\n     92,110, 40, 91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91,\n     79,111, 93, 91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93,\n     95, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42,\n     92,110, 34, 44,101, 41, 10,  9,101,110,100, 10,  9,114,101,\n    116,117,114,110, 32, 99,111,100,101, 10,101,110,100, 10, 10,\n     45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10,\n     45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,101, 32,\n    112, 97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,116,\n    104,101, 32,102,105,108,101, 32,101,120,116,101,110,115,105,\n    111,110, 44, 32, 97,110,100, 32,116,104,101, 32,102,105,108,\n    101, 32,116,101,120,116, 46, 10,102,117,110, 99,116,105,111,\n    110, 32, 80, 97, 99,107, 97,103,101, 32, 40,110, 97,109,101,\n     44,102,110, 41, 10, 32,108,111, 99, 97,108, 32,101,120,116,\n     32, 61, 32, 34,112,107,103, 34, 10, 10, 32, 45, 45, 32,111,\n    112,101,110, 32,105,110,112,117,116, 32,102,105,108,101, 44,\n     32,105,102, 32, 97,110,121, 10, 32,108,111, 99, 97,108, 32,\n    115,116, 44,109,115,103, 10, 32,105,102, 32,102,110, 32,116,\n    104,101,110, 10, 32, 32,115,116, 44, 32,109,115,103, 32, 61,\n     32,114,101, 97,100,102,114,111,109, 40,102,108, 97,103,115,\n     46,102, 41, 10, 32, 32,105,102, 32,110,111,116, 32,115,116,\n     32,116,104,101,110, 10, 32, 32, 32,101,114,114,111,114, 40,\n     39, 35, 39, 46, 46,109,115,103, 41, 10, 32, 32,101,110,100,\n     10, 32, 32,108,111, 99, 97,108, 32, 95, 59, 32, 95, 44, 32,\n     95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102,105,110,\n    100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42, 41, 36,\n     34, 41, 10, 32,101,110,100, 10, 32,108,111, 99, 97,108, 32,\n     99,111,100,101, 10, 32,105,102, 32,101,120,116, 32, 61, 61,\n     32, 39,112,107,103, 39, 32,116,104,101,110, 10, 32, 32, 99,\n    111,100,101, 32, 61, 32,112,114,101,112, 40,115,116, 41, 10,\n     32,101,108,115,101, 10, 32, 32, 99,111,100,101, 32, 61, 32,\n     34, 92,110, 34, 32, 46, 46, 32,114,101, 97,100, 40, 39, 42,\n     97, 39, 41, 10, 32, 32,105,102, 32,101,120,116, 32, 61, 61,\n     32, 39,104, 39, 32,111,114, 32,101,120,116, 32, 61, 61, 32,\n     39,104,112,112, 39, 32,116,104,101,110, 10, 32, 32, 32, 99,\n    111,100,101, 32, 61, 32,101,120,116,114, 97, 99,116, 95, 99,\n    111,100,101, 40,102,110, 44, 99,111,100,101, 41, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,\n    108,111,115,101, 32,102,105,108,101, 10, 32,105,102, 32,102,\n    110, 32,116,104,101,110, 10, 32, 32,114,101, 97,100,102,114,\n    111,109, 40, 41, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,\n    100,101, 97,108, 32,119,105,116,104, 32,105,110, 99,108,117,\n    100,101, 32,100,105,114,101, 99,116,105,118,101, 10, 32,108,\n    111, 99, 97,108, 32,110,115,117, 98,115,116, 10, 32,114,101,\n    112,101, 97,116, 10, 32, 32, 99,111,100,101, 44,110,115,117,\n     98,115,116, 32, 61, 32,103,115,117, 98, 40, 99,111,100,101,\n     44, 39, 92,110, 37,115, 42, 37, 36, 40, 46, 41,102,105,108,\n    101, 37,115, 42, 34, 40, 46, 45, 41, 34, 40, 91, 94, 92,110,\n     93, 42, 41, 92,110, 39, 44, 10,  9,  9,102,117,110, 99,116,\n    105,111,110, 32, 40,107,105,110,100, 44,102,110, 44,101,120,\n    116,114, 97, 41, 10,  9,  9,  9,108,111, 99, 97,108, 32, 95,\n     44, 32, 95, 44, 32,101,120,116, 32, 61, 32,115,116,114,102,\n    105,110,100, 40,102,110, 44, 34, 46, 42, 37, 46, 40, 46, 42,\n     41, 36, 34, 41, 10,  9,  9,  9,108,111, 99, 97,108, 32,102,\n    112, 44,109,115,103, 32, 61, 32,111,112,101,110,102,105,108,\n    101, 40,102,110, 44, 39,114, 39, 41, 10,  9,  9,  9,105,102,\n     32,110,111,116, 32,102,112, 32,116,104,101,110, 10,  9,  9,\n      9,  9,101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115,\n    103, 46, 46, 39, 58, 32, 39, 46, 46,102,110, 41, 10,  9,  9,\n      9,101,110,100, 10,  9,  9,  9,105,102, 32,107,105,110,100,\n     32, 61, 61, 32, 39,112, 39, 32,116,104,101,110, 10,  9,  9,\n      9,  9,108,111, 99, 97,108, 32,115, 32, 61, 32,112,114,101,\n    112, 40,102,112, 41, 10,  9,  9,  9,  9, 99,108,111,115,101,\n    102,105,108,101, 40,102,112, 41, 10,  9,  9,  9,  9,114,101,\n    116,117,114,110, 32,115, 10,  9,  9,  9,101,110,100, 10,  9,\n      9,  9,108,111, 99, 97,108, 32,115, 32, 61, 32,114,101, 97,\n    100, 40,102,112, 44, 39, 42, 97, 39, 41, 10,  9,  9,  9, 99,\n    108,111,115,101,102,105,108,101, 40,102,112, 41, 10,  9,  9,\n      9,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39, 99, 39,\n     32,111,114, 32,107,105,110,100, 32, 61, 61, 32, 39,104, 39,\n     32,116,104,101,110, 10,  9,  9,  9,  9,114,101,116,117,114,\n    110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,101, 40,\n    102,110, 44,115, 41, 10,  9,  9,  9,101,108,115,101,105,102,\n     32,107,105,110,100, 32, 61, 61, 32, 39,108, 39, 32,116,104,\n    101,110, 10,  9,  9,  9,  9,114,101,116,117,114,110, 32, 34,\n     92,110, 36, 91, 45, 45, 35, 35, 34, 46, 46,102,110, 46, 46,\n     34, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34, 92,\n    110, 36, 93, 92,110, 34, 10,  9,  9,  9,101,108,115,101,105,\n    102, 32,107,105,110,100, 32, 61, 61, 32, 39,105, 39, 32,116,\n    104,101,110, 10,  9,  9,  9,  9,108,111, 99, 97,108, 32,116,\n     32, 61, 32,123, 99,111,100,101, 61,115,125, 10,  9,  9,  9,\n      9,101,120,116,114, 97, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,101,120,116,114, 97, 44, 32, 34, 94,\n     37,115, 42, 44, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,\n      9,  9,  9,108,111, 99, 97,108, 32,112, 97,114,115, 32, 61,\n     32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115,\n     40,101,120,116,114, 97, 44, 32, 34, 44, 34, 41, 10,  9,  9,\n      9,  9,105,110, 99,108,117,100,101, 95,102,105,108,101, 95,\n    104,111,111,107, 40,116, 44, 32,102,110, 44, 32,117,110,112,\n     97, 99,107, 40,112, 97,114,115, 41, 41, 10,  9,  9,  9,  9,\n    114,101,116,117,114,110, 32, 34, 92,110, 92,110, 34, 32, 46,\n     46, 32,116, 46, 99,111,100,101, 10,  9,  9,  9,101,108,115,\n    101, 10,  9,  9,  9,  9,101,114,114,111,114, 40, 39, 35, 73,\n    110,118, 97,108,105,100, 32,105,110, 99,108,117,100,101, 32,\n    100,105,114,101, 99,116,105,118,101, 32, 40,117,115,101, 32,\n     36, 99,102,105,108,101, 44, 32, 36,112,102,105,108,101, 44,\n     32, 36,108,102,105,108,101, 32,111,114, 32, 36,105,102,105,\n    108,101, 41, 39, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,\n    101,110,100, 41, 10, 32,117,110,116,105,108, 32,110,115,117,\n     98,115,116, 61, 61, 48, 10, 10, 32, 45, 45, 32,100,101, 97,\n    108, 32,119,105,116,104, 32,114,101,110, 97,109,105,110,103,\n     32,100,105,114,101, 99,116,105,118,101, 10, 32,114,101,112,\n    101, 97,116, 32, 45, 45, 32, 73, 32,100,111,110, 39,116, 32,\n    107,110,111,119, 32,119,104,121, 32,116,104,105,115, 32,105,\n    115, 32,110,101, 99,101,115, 97,114,121, 10,  9, 99,111,100,\n    101, 44,110,115,117, 98,115,116, 32, 61, 32,103,115,117, 98,\n     40, 99,111,100,101, 44, 39, 92,110, 37,115, 42, 37, 36,114,\n    101,110, 97,109,105,110,103, 37,115, 42, 40, 46, 45, 41, 37,\n    115, 42, 92,110, 39, 44, 32,102,117,110, 99,116,105,111,110,\n     32, 40,114, 41, 32, 97,112,112,101,110,100,114,101,110, 97,\n    109,105,110,103, 40,114, 41, 32,114,101,116,117,114,110, 32,\n     34, 92,110, 34, 32,101,110,100, 41, 10, 32,117,110,116,105,\n    108, 32,110,115,117, 98,115,116, 32, 61, 61, 32, 48, 10, 10,\n     32,108,111, 99, 97,108, 32,116, 32, 61, 32, 95, 80, 97, 99,\n    107, 97,103,101, 40, 95, 67,111,110,116, 97,105,110,101,114,\n    123,110, 97,109,101, 61,110, 97,109,101, 44, 32, 99,111,100,\n    101, 61, 99,111,100,101,125, 41, 10, 32,112,117,115,104, 40,\n    116, 41, 10, 32,112,114,101,112,114,111, 99,101,115,115, 95,\n    104,111,111,107, 40,116, 41, 10, 32,116, 58,112,114,101,112,\n    114,111, 99,101,115,115, 40, 41, 10, 32,112,114,101,112, 97,\n    114,115,101, 95,104,111,111,107, 40,116, 41, 10, 32,116, 58,\n    112, 97,114,115,101, 40,116, 46, 99,111,100,101, 41, 10, 32,\n    112,111,112, 40, 41, 10, 32,114,101,116,117,114,110, 32,116,\n     10,101,110,100, 10, 10, 10,115,101,116,109,101,116, 97,116,\n     97, 98,108,101, 40, 95,101,120,116,114, 97, 95,112, 97,114,\n     97,109,101,116,101,114,115, 44, 32,123, 32, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 95, 71, 32,125, 41, 10, 10,102,117,\n    110, 99,116,105,111,110, 32,112,114,101,112, 40,102,105,108,\n    101, 41, 10, 10, 32, 32,108,111, 99, 97,108, 32, 99,104,117,\n    110,107, 32, 61, 32,123, 39,108,111, 99, 97,108, 32, 95, 95,\n    114,101,116, 32, 61, 32,123, 34, 92, 92,110, 34,125, 92,110,\n     39,125, 10, 32, 32,102,111,114, 32,108,105,110,101, 32,105,\n    110, 32,102,105,108,101, 58,108,105,110,101,115, 40, 41, 32,\n    100,111, 10, 32, 32, 32, 32, 32,105,102, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,108,105,110,101, 44, 32, 34,\n     94, 35, 35, 34, 41, 32,116,104,101,110, 10, 32, 32, 32, 32,\n     32, 32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40,\n     99,104,117,110,107, 44, 32,115,116,114,105,110,103, 46,115,\n    117, 98, 40,108,105,110,101, 44, 32, 51, 41, 32, 46, 46, 32,\n     34, 92,110, 34, 41, 10, 32, 32, 32, 32, 32,101,108,115,101,\n     10, 32, 32, 32, 32, 32, 32,108,111, 99, 97,108, 32,108, 97,\n    115,116, 32, 61, 32, 49, 10, 32, 32, 32, 32, 32, 32,102,111,\n    114, 32,116,101,120,116, 44, 32,101,120,112,114, 44, 32,105,\n    110,100,101,120, 32,105,110, 32,115,116,114,105,110,103, 46,\n    103,102,105,110,100, 40,108,105,110,101, 44, 32, 34, 40, 46,\n     45, 41, 36, 40, 37, 98, 40, 41, 41, 40, 41, 34, 41, 32,100,\n    111, 32, 10, 32, 32, 32, 32, 32, 32, 32, 32,108, 97,115,116,\n     32, 61, 32,105,110,100,101,120, 10, 32, 32, 32, 32, 32, 32,\n     32, 32,105,102, 32,116,101,120,116, 32,126, 61, 32, 34, 34,\n     32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32,116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99,\n    104,117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111,\n    114,109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115,\n    101,114,116, 40, 95, 95,114,101,116, 44, 32, 37,113, 32, 41,\n     39, 44, 32,116,101,120,116, 41, 41, 10, 32, 32, 32, 32, 32,\n     32, 32, 32,101,110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32,\n    116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 99,104,\n    117,110,107, 44, 32,115,116,114,105,110,103, 46,102,111,114,\n    109, 97,116, 40, 39,116, 97, 98,108,101, 46,105,110,115,101,\n    114,116, 40, 95, 95,114,101,116, 44, 32, 37,115, 32, 41, 39,\n     44, 32,101,120,112,114, 41, 41, 10, 32, 32, 32, 32, 32, 32,\n    101,110,100, 10, 32, 32, 32, 32, 32, 32,116, 97, 98,108,101,\n     46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44, 32,\n    115,116,114,105,110,103, 46,102,111,114,109, 97,116, 40, 39,\n    116, 97, 98,108,101, 46,105,110,115,101,114,116, 40, 95, 95,\n    114,101,116, 44, 32, 37,113, 41, 92,110, 39, 44, 10, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,\n     32, 32, 32, 32, 32, 32, 32, 32, 32,115,116,114,105,110,103,\n     46,115,117, 98, 40,108,105,110,101, 44, 32,108, 97,115,116,\n     41, 46, 46, 34, 92,110, 34, 41, 41, 10, 32, 32, 32, 32,101,\n    110,100, 10, 32, 32,101,110,100, 10, 32, 32,116, 97, 98,108,\n    101, 46,105,110,115,101,114,116, 40, 99,104,117,110,107, 44,\n     32, 39, 92,110,114,101,116,117,114,110, 32,116, 97, 98,108,\n    101, 46, 99,111,110, 99, 97,116, 40, 95, 95,114,101,116, 41,\n     92,110, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44,\n    101, 32, 61, 32,108,111, 97,100,115,116,114,105,110,103, 40,\n    116, 97, 98,108,101, 46, 99,111,110, 99, 97,116, 40, 99,104,\n    117,110,107, 41, 41, 10, 32, 32,105,102, 32,101, 32,116,104,\n    101,110, 10, 32, 32,  9,101,114,114,111,114, 40, 34, 35, 34,\n     46, 46,101, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,101,\n    116,102,101,110,118, 40,102, 44, 32, 95,101,120,116,114, 97,\n     95,112, 97,114, 97,109,101,116,101,114,115, 41, 10, 32, 32,\n    114,101,116,117,114,110, 32,102, 40, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/package.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,109,111,100,117,108,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,\n    116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114,\n     32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114,\n     97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,\n    117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58,\n     32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,\n    101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119,\n     97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,\n    100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,\n    110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116,\n     46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,\n    114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,\n    101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110,\n     32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44,\n     32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,\n    104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,\n    103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,\n    100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44,\n     32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,\n    101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,\n    101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105,\n     99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, 32,\n     77,111,100,117,108,101, 32, 99,108, 97,115,115, 10, 45, 45,\n     32, 82,101,112,114,101,115,101,110,116,115, 32,109,111,100,\n    117,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,102,111,108,\n    108,111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,\n    114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32,\n     32, 32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102,\n     32,111, 98,106,101, 99,116,115, 32,105,110, 32,116,104,101,\n     32,109,111,100,117,108,101, 46, 10, 99,108, 97,115,115, 77,\n    111,100,117,108,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,\n    115,116,121,112,101, 32, 61, 32, 39,109,111,100,117,108,101,\n     39, 10,125, 10, 99,108, 97,115,115, 77,111,100,117,108,101,\n     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,\n    115, 77,111,100,117,108,101, 10,115,101,116,109,101,116, 97,\n    116, 97, 98,108,101, 40, 99,108, 97,115,115, 77,111,100,117,\n    108,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,110,\n    101,114, 41, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,\n    114, 32,109,111,100,117,108,101, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58,\n    114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, 10,\n     32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39,\n     39, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95,109,111,100,117,108,101, 40,116,111,108,117,\n     97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,110, 97,\n    109,101, 46, 46, 39, 34, 44, 39, 44,115,101,108,102, 58,104,\n     97,115,118, 97,114, 40, 41, 44, 39, 41, 59, 39, 41, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,101,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41,\n     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,\n     32, 32,115,101,108,102, 91,105, 93, 58,114,101,103,105,115,\n    116,101,114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32,\n     32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95,101,110,100,109,111,100,117,108,101, 40,116,\n    111,108,117, 97, 95, 83, 41, 59, 39, 41, 10,  9,112,111,112,\n     40, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110,\n    116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 77,111,100,117,108,101,123, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 34, 39, 59, 34, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,\n    101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,\n    115,101,108,102, 91,105, 93, 58,112,114,105,110,116, 40,105,\n    100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34, 41, 10,\n     32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,\n     10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,\n    110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,\n    105,111,110, 32, 95, 77,111,100,117,108,101, 32, 40,116, 41,\n     10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,\n    116, 44, 99,108, 97,115,115, 77,111,100,117,108,101, 41, 10,\n     32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,\n    117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,\n    111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,\n    120,112,101, 99,116,115, 32,116,119,111, 32,115,116,114,105,\n    110,103, 32,114,101,112,114,101,115,101,110,116,105,110,103,\n     32,116,104,101, 32,109,111,100,117,108,101, 32,110, 97,109,\n    101, 32, 97,110,100, 32, 98,111,100,121, 46, 10,102,117,110,\n     99,116,105,111,110, 32, 77,111,100,117,108,101, 32, 40,110,\n     44, 98, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n     95, 77,111,100,117,108,101, 40, 95, 67,111,110,116, 97,105,\n    110,101,114,123,110, 97,109,101, 61,110,125, 41, 10, 32,112,\n    117,115,104, 40,116, 41, 10, 32,116, 58,112, 97,114,115,101,\n     40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,\n    108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,\n    108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,101,115,\n     10, 32,112,111,112, 40, 41, 10, 32,114,101,116,117,114,110,\n     32,116, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/module.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,110, 97,109,101,115,\n    112, 97, 99,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,\n    114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,\n    109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101,\n     67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45,\n     45, 32, 74,117,108, 32, 50, 48, 48, 51, 10, 45, 45, 32, 36,\n     73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32,\n     99,111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,\n    102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110,\n     32,114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,\n    116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121,\n     32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,\n    116,119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,\n    104,101,114,101,117,110,100,101,114, 32,105,115, 32,111,110,\n     32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,\n    105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32,\n     97,117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111,\n     98,108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,\n    111,118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110,\n     99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,\n    100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110,\n     99,101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,\n    105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45,\n     45, 32, 78, 97,109,101,115,112, 97, 99,101, 32, 99,108, 97,\n    115,115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,\n    115, 32, 97, 32,110, 97,109,101,115, 97,112, 99,101, 32,100,\n    101,102,105,110,105,116,105,111,110, 46, 10, 45, 45, 32, 83,\n    116,111,114,101,115, 32,116,104,101, 32,102,111,108,108,111,\n    119,105,110,103, 32,102,105,101,108,100,115, 58, 10, 45, 45,\n     32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,108, 97,115,\n    115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32, 32,123,105,\n    125, 32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,\n    109, 98,101,114,115, 10, 99,108, 97,115,115, 78, 97,109,101,\n    115,112, 97, 99,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,\n    115,116,121,112,101, 32, 61, 32, 39,110, 97,109,101,115,112,\n     97, 99,101, 39, 44, 10, 32,110, 97,109,101, 32, 61, 32, 39,\n     39, 44, 10,125, 10, 99,108, 97,115,115, 78, 97,109,101,115,\n    112, 97, 99,101, 46, 95, 95,105,110,100,101,120, 32, 61, 32,\n     99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 10,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108,\n     97,115,115, 78, 97,109,101,115,112, 97, 99,101, 44, 99,108,\n     97,115,115, 77,111,100,117,108,101, 41, 10, 10, 45, 45, 32,\n     80,114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,\n    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 78, 97,109,\n    101,115,112, 97, 99,101, 58,112,114,105,110,116, 32, 40,105,\n    100,101,110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 78, 97,109,\n    101,115,112, 97, 99,101,123, 34, 41, 10, 32,112,114,105,110,\n    116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101,\n     32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,\n    101, 46, 46, 34, 39, 44, 34, 41, 10, 32,108,111, 99, 97,108,\n     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,\n    102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,\n    105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, 61,\n     32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,110,\n    116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,\n    108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 73,\n    110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117,\n     99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95,\n     78, 97,109,101,115,112, 97, 99,101, 32, 40,116, 41, 10, 32,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44,\n     99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 41,\n     10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,\n    116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,\n     67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32,\n     69,120,112,101, 99,116,115, 32,116,104,101, 32,110, 97,109,\n    101, 32, 97,110,100, 32,116,104,101, 32, 98,111,100,121, 32,\n    111,102, 32,116,104,101, 32,110, 97,109,101,115,112, 97, 99,\n    101, 46, 10,102,117,110, 99,116,105,111,110, 32, 78, 97,109,\n    101,115,112, 97, 99,101, 32, 40,110, 44, 98, 41, 10, 32,108,\n    111, 99, 97,108, 32, 99, 32, 61, 32, 95, 78, 97,109,101,115,\n    112, 97, 99,101, 40, 95, 67,111,110,116, 97,105,110,101,114,\n    123,110, 97,109,101, 61,110,125, 41, 10, 32,112,117,115,104,\n     40, 99, 41, 10, 32, 99, 58,112, 97,114,115,101, 40,115,116,\n    114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,108,101,110,\n     40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,108,105,109,\n    105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10, 32,112,\n    111,112, 40, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/namespace.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,100,101,102,105,110,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,\n    116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114,\n     32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114,\n     97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,\n    117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58,\n     32,100,101,102,105,110,101, 46,108,117, 97, 44,118, 32, 49,\n     46, 50, 32, 49, 57, 57, 57, 47, 48, 55, 47, 50, 56, 32, 50,\n     50, 58, 50, 49, 58, 48, 56, 32, 99,101,108,101,115, 32, 69,\n    120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,\n     32, 68,101,102,105,110,101, 32, 99,108, 97,115,115, 10, 45,\n     45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97, 32,\n    110,117,109,101,114,105, 99, 32, 99,111,110,115,116, 32,100,\n    101,102,105,110,105,116,105,111,110, 10, 45, 45, 32, 84,104,\n    101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,108,\n    100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10,\n     45, 45, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,111,110,\n    115,116, 97,110,116, 32,110, 97,109,101, 10, 99,108, 97,115,\n    115, 68,101,102,105,110,101, 32, 61, 32,123, 10, 32,110, 97,\n    109,101, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,115,\n    115, 68,101,102,105,110,101, 46, 95, 95,105,110,100,101,120,\n     32, 61, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 10,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108,\n     97,115,115, 68,101,102,105,110,101, 44, 99,108, 97,115,115,\n     70,101, 97,116,117,114,101, 41, 10, 10, 45, 45, 32,114,101,\n    103,105,115,116,101,114, 32,100,101,102,105,110,101, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101,\n    102,105,110,101, 58,114,101,103,105,115,116,101,114, 32, 40,\n    112,114,101, 41, 10,  9,105,102, 32,110,111,116, 32,115,101,\n    108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99,\n     95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,\n      9,  9,114,101,116,117,114,110, 10,  9,101,110,100, 10, 10,\n     32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39,\n     39, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,\n     39,116,111,108,117, 97, 95, 99,111,110,115,116, 97,110,116,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,\n    108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46,\n     46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 41, 59,\n     39, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110,\n    116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 68,101,102,105,110,101,123, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,\n     10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,\n    111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,\n    116,105,111,110, 32, 95, 68,101,102,105,110,101, 32, 40,116,\n     41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101,\n     40,116, 44, 99,108, 97,115,115, 68,101,102,105,110,101, 41,\n     10, 32,116, 58, 98,117,105,108,100,110, 97,109,101,115, 40,\n     41, 10, 10, 32,105,102, 32,116, 46,110, 97,109,101, 32, 61,\n     61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,101,114,114,\n    111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,100,101,\n    102,105,110,101, 34, 41, 10, 32,101,110,100, 10, 10, 32, 97,\n    112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,\n    110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,\n    115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,\n    101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,\n    101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101,\n     32, 99,111,110,115,116, 97,110,116, 32,110, 97,109,101, 10,\n    102,117,110, 99,116,105,111,110, 32, 68,101,102,105,110,101,\n     32, 40,110, 41, 10, 32,114,101,116,117,114,110, 32, 95, 68,\n    101,102,105,110,101,123, 10, 32, 32,110, 97,109,101, 32, 61,\n     32,110, 10, 32,125, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/define.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,101,110,117,109,101,\n    114, 97,116,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,\n    114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,\n    109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101,\n     67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45,\n     45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36,\n     73,100, 58, 32,101,110,117,109,101,114, 97,116,101, 46,108,\n    117, 97, 44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48,\n     49, 47, 50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 53, 32, 99,\n    101,108,101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32,\n     84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,\n    101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,121,111,\n    117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,105, 98,\n    117,116,101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,\n    111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,\n    101, 32,115,111,102,116,119, 97,114,101, 32,112,114,111,118,\n    105,100,101,100, 32,104,101,114,101,117,110,100,101,114, 32,\n    105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115,\n     34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45,\n     32,116,104,101, 32, 97,117,116,104,111,114, 32,104, 97,115,\n     32,110,111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,\n    116,111, 32,112,114,111,118,105,100,101, 32,109, 97,105,110,\n    116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,\n    116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,\n    101,110,104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,\n    114, 32,109,111,100,105,102,105, 99, 97,116,105,111,110,115,\n     46, 10, 10, 10, 45, 45, 32, 69,110,117,109,101,114, 97,116,\n    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,\n    101,115,101,110,116,115, 32,101,110,117,109,101,114, 97,116,\n    105,111,110, 10, 45, 45, 32, 84,104,101, 32,102,111,108,108,\n    111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,114,\n    101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32, 32,\n     32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102, 32,\n     99,111,110,115,116, 97,110,116, 32,110, 97,109,101,115, 10,\n     99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 32,\n     61, 32,123, 10,125, 10, 99,108, 97,115,115, 69,110,117,109,\n    101,114, 97,116,101, 46, 95, 95,105,110,100,101,120, 32, 61,\n     32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101,\n     10,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,\n    108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 44, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,\n     45, 32,114,101,103,105,115,116,101,114, 32,101,110,117,109,\n    101,114, 97,116,105,111,110, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,\n    101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114,101,\n     41, 10,  9,105,102, 32,110,111,116, 32,115,101,108,102, 58,\n     99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99,\n     99,101,115,115, 40, 41, 32,116,104,101,110, 10,  9,  9,114,\n    101,116,117,114,110, 10,  9,101,110,100, 10, 32,112,114,101,\n     32, 61, 32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,108,\n    111, 99, 97,108, 32,110,115,112, 97, 99,101, 32, 61, 32,103,\n    101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,\n    114, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,\n    119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,\n    111, 10, 32,  9,105,102, 32,115,101,108,102, 46,108,110, 97,\n    109,101,115, 91,105, 93, 32, 97,110,100, 32,115,101,108,102,\n     46,108,110, 97,109,101,115, 91,105, 93, 32,126, 61, 32, 34,\n     34, 32,116,104,101,110, 10,  9, 10,  9,  9,111,117,116,112,\n    117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,\n     99,111,110,115,116, 97,110,116, 40,116,111,108,117, 97, 95,\n     83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,\n    101,115, 91,105, 93, 46, 46, 39, 34, 44, 39, 46, 46,110,115,\n    112, 97, 99,101, 46, 46,115,101,108,102, 91,105, 93, 46, 46,\n     39, 41, 59, 39, 41, 10,  9,101,110,100, 10, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32,101,110,100, 10,101,110,100, 10,\n     10, 45, 45, 32, 80,114,105,110,116, 32,109,101,116,104,111,\n    100, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 69,110,117,109,101,114, 97,116,101, 58,112,114,105,110,\n    116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 69,110,117,109,101,114, 97,116,101,123, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    110, 97,109,101, 32, 61, 32, 34, 46, 46,115,101,108,102, 46,\n    110, 97,109,101, 41, 10, 32,108,111, 99, 97,108, 32,105, 61,\n     49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,105,\n     93, 32,100,111, 10, 32, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 32, 39, 34, 46, 46,115,101,108,102,\n     91,105, 93, 46, 46, 34, 39, 40, 34, 46, 46,115,101,108,102,\n     46,108,110, 97,109,101,115, 91,105, 93, 46, 46, 34, 41, 44,\n     34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,\n    110,100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108,\n     32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117,\n    110, 99,116,105,111,110, 32, 95, 69,110,117,109,101,114, 97,\n    116,101, 32, 40,116, 44,118, 97,114,110, 97,109,101, 41, 10,\n     32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116,\n     44, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101,\n     41, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32, 97,\n    112,112,101,110,100,101,110,117,109, 40,116, 41, 10,  9, 32,\n    105,102, 32,118, 97,114,110, 97,109,101, 32, 97,110,100, 32,\n    118, 97,114,110, 97,109,101, 32,126, 61, 32, 34, 34, 32,116,\n    104,101,110, 10,  9,  9,105,102, 32,116, 46,110, 97,109,101,\n     32,126, 61, 32, 34, 34, 32,116,104,101,110, 10,  9,  9,  9,\n     86, 97,114,105, 97, 98,108,101, 40,116, 46,110, 97,109,101,\n     46, 46, 34, 32, 34, 46, 46,118, 97,114,110, 97,109,101, 41,\n     10,  9,  9,101,108,115,101, 10,  9,  9,  9,108,111, 99, 97,\n    108, 32,110,115, 32, 61, 32,103,101,116, 99,117,114,114,110,\n     97,109,101,115,112, 97, 99,101, 40, 41, 10,  9,  9,  9,119,\n     97,114,110,105,110,103, 40, 34, 86, 97,114,105, 97, 98,108,\n    101, 32, 34, 46, 46,110,115, 46, 46,118, 97,114,110, 97,109,\n    101, 46, 46, 34, 32,111,102, 32,116,121,112,101, 32, 60, 97,\n    110,111,110,121,109,111,117,115, 32,101,110,117,109, 62, 32,\n    105,115, 32,100,101, 99,108, 97,114,101,100, 32, 97,115, 32,\n    114,101, 97,100, 45,111,110,108,121, 34, 41, 10,  9,  9,  9,\n     86, 97,114,105, 97, 98,108,101, 40, 34,116,111,108,117, 97,\n     95,114,101, 97,100,111,110,108,121, 32,105,110,116, 32, 34,\n     46, 46,118, 97,114,110, 97,109,101, 41, 10,  9,  9,101,110,\n    100, 10,  9,101,110,100, 10,  9, 32,108,111, 99, 97,108, 32,\n    112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,\n    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,  9,\n     32,105,102, 32,112, 97,114,101,110,116, 32,116,104,101,110,\n     10,  9,  9,116, 46, 97, 99, 99,101,115,115, 32, 61, 32,112,\n     97,114,101,110,116, 46, 99,117,114,114, 95,109,101,109, 98,\n    101,114, 95, 97, 99, 99,101,115,115, 10,  9,  9,116, 46,103,\n    108,111, 98, 97,108, 95, 97, 99, 99,101,115,115, 32, 61, 32,\n    116, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95,\n     97, 99, 99,101,115,115, 40, 41, 10,  9, 32,101,110,100, 10,\n    114,101,116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45,\n     45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10, 45,\n     45, 32, 69,120,112,101, 99,116,115, 32, 97, 32,115,116,114,\n    105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110,\n    103, 32,116,104,101, 32,101,110,117,109,101,114, 97,116,101,\n     32, 98,111,100,121, 10,102,117,110, 99,116,105,111,110, 32,\n     69,110,117,109,101,114, 97,116,101, 32, 40,110, 44, 98, 44,\n    118, 97,114,110, 97,109,101, 41, 10,  9, 98, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40, 98, 44, 32, 34,\n     44, 91, 37,115, 92,110, 93, 42,125, 34, 44, 32, 34, 92,110,\n    125, 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,\n    101, 32,108, 97,115,116, 32, 39, 44, 39, 10, 32,108,111, 99,\n     97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116,\n    114,115,117, 98, 40, 98, 44, 50, 44, 45, 50, 41, 44, 39, 44,\n     39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 98,114, 97, 99,101,115, 10, 32,108,111, 99, 97,108, 32,\n    105, 32, 61, 32, 49, 10, 32,108,111, 99, 97,108, 32,101, 32,\n     61, 32,123,110, 61, 48,125, 10, 32,119,104,105,108,101, 32,\n    116, 91,105, 93, 32,100,111, 10, 32, 32,108,111, 99, 97,108,\n     32,116,116, 32, 61, 32,115,112,108,105,116, 40,116, 91,105,\n     93, 44, 39, 61, 39, 41, 32, 32, 45, 45, 32,100,105,115, 99,\n     97,114,100, 32,105,110,105,116,105, 97,108, 32,118, 97,108,\n    117,101, 10, 32, 32,101, 46,110, 32, 61, 32,101, 46,110, 32,\n     43, 32, 49, 10, 32, 32,101, 91,101, 46,110, 93, 32, 61, 32,\n    116,116, 91, 49, 93, 10, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32,101,110,100, 10, 32, 45, 45, 32,115,101,116, 32,108,\n    117, 97, 32,110, 97,109,101,115, 10, 32,105, 32, 32, 61, 32,\n     49, 10, 32,101, 46,108,110, 97,109,101,115, 32, 61, 32,123,\n    125, 10, 32,108,111, 99, 97,108, 32,110,115, 32, 61, 32,103,\n    101,116, 99,117,114,114,110, 97,109,101,115,112, 97, 99,101,\n     40, 41, 10, 32,119,104,105,108,101, 32,101, 91,105, 93, 32,\n    100,111, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,\n    115,112,108,105,116, 40,101, 91,105, 93, 44, 39, 64, 39, 41,\n     10, 32, 32,101, 91,105, 93, 32, 61, 32,116, 91, 49, 93, 10,\n      9,  9,105,102, 32,110,111,116, 32,116, 91, 50, 93, 32,116,\n    104,101,110, 10,  9,  9, 32,116, 91, 50, 93, 32, 61, 32, 97,\n    112,112,108,121,114,101,110, 97,109,105,110,103, 40,116, 91,\n     49, 93, 41, 10,  9,  9,101,110,100, 10, 32, 32,101, 46,108,\n    110, 97,109,101,115, 91,105, 93, 32, 61, 32,116, 91, 50, 93,\n     32,111,114, 32,116, 91, 49, 93, 10, 32, 32, 95,103,108,111,\n     98, 97,108, 95,101,110,117,109,115, 91, 32,110,115, 46, 46,\n    101, 91,105, 93, 32, 93, 32, 61, 32, 40,110,115, 46, 46,101,\n     91,105, 93, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10,\n     32,101,110,100, 10,  9,101, 46,110, 97,109,101, 32, 61, 32,\n    110, 10,  9,105,102, 32,110, 32,126, 61, 32, 34, 34, 32,116,\n    104,101,110, 10,  9,  9, 84,121,112,101,100,101,102, 40, 34,\n    105,110,116, 32, 34, 46, 46,110, 41, 10,  9,101,110,100, 10,\n     32,114,101,116,117,114,110, 32, 95, 69,110,117,109,101,114,\n     97,116,101, 40,101, 44, 32,118, 97,114,110, 97,109,101, 41,\n     10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/enumerate.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,100,101, 99,108, 97,\n    114, 97,116,105,111,110, 32, 99,108, 97,115,115, 10, 45, 45,\n     32, 87,114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,\n    100,101,109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32,\n     84,101, 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111,\n     10, 45, 45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45,\n     32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,\n    115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, 32,\n    115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99,\n     97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,101,\n     32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,\n    102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,\n    111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,101,\n    100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, 32,\n    111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98,\n     97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,\n    101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,111,\n     32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, 32,\n    112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,110,\n     97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,\n    117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104,\n     97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,109,\n    111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10,\n     10, 45, 45, 32, 68,101, 99,108, 97,114, 97,116,105,111,110,\n     32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,\n    115,101,110,116,115, 32,118, 97,114,105, 97, 98,108,101, 44,\n     32,102,117,110, 99,116,105,111,110, 44, 32,111,114, 32, 97,\n    114,103,117,109,101,110,116, 32,100,101, 99,108, 97,114, 97,\n    116,105,111,110, 46, 10, 45, 45, 32, 83,116,111,114,101,115,\n     32,116,104,101, 32,102,111,108,108,111,119,105,110,103, 32,\n    102,105,101,108,100,115, 58, 10, 45, 45, 32, 32,109,111,100,\n     32, 32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,\n    101,114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,\n    116,121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61,\n     32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102,\n     32,114,101,112,114,101,115,101,110,116,105,110,103, 32, 97,\n     32,112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,\n    101,102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,\n    109,101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,100,\n    105,109, 32, 32, 61, 32,100,105,109,101,110,115,105,111,110,\n     44, 32,105,102, 32, 97, 32,118,101, 99,116,111,114, 10, 45,\n     45, 32, 32,100,101,102, 32, 32, 61, 32,100,101,102, 97,117,\n    108,116, 32,118, 97,108,117,101, 44, 32,105,102, 32, 97,110,\n    121, 32, 40,111,110,108,121, 32,102,111,114, 32, 97,114,103,\n    117,109,101,110,116,115, 41, 10, 45, 45, 32, 32,114,101,116,\n     32, 32, 61, 32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44,\n     32,105,102, 32,118, 97,108,117,101, 32,105,115, 32,116,111,\n     32, 98,101, 32,114,101,116,117,114,110,101,100, 32, 40,111,\n    110,108,121, 32,102,111,114, 32, 97,114,103,117,109,101,110,\n    116,115, 41, 10, 99,108, 97,115,115, 68,101, 99,108, 97,114,\n     97,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100, 32,\n     61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39,\n     39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10, 32,\n    110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32,100,105,109,\n     32, 61, 32, 39, 39, 44, 10, 32,114,101,116, 32, 61, 32, 39,\n     39, 44, 10, 32,100,101,102, 32, 61, 32, 39, 39, 10,125, 10,\n     99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,\n    110, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,\n    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 10,115,\n    101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,\n    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 44, 99,\n    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,\n     45, 32, 67,114,101, 97,116,101, 32, 97,110, 32,117,110,105,\n    113,117,101, 32,118, 97,114,105, 97, 98,108,101, 32,110, 97,\n    109,101, 10,102,117,110, 99,116,105,111,110, 32, 99,114,101,\n     97,116,101, 95,118, 97,114,110, 97,109,101, 32, 40, 41, 10,\n     32,105,102, 32,110,111,116, 32, 95,118, 97,114,110,117,109,\n     98,101,114, 32,116,104,101,110, 32, 95,118, 97,114,110,117,\n    109, 98,101,114, 32, 61, 32, 48, 32,101,110,100, 10, 32, 95,\n    118, 97,114,110,117,109, 98,101,114, 32, 61, 32, 95,118, 97,\n    114,110,117,109, 98,101,114, 32, 43, 32, 49, 10, 32,114,101,\n    116,117,114,110, 32, 34,116,111,108,117, 97, 95,118, 97,114,\n     95, 34, 46, 46, 95,118, 97,114,110,117,109, 98,101,114, 10,\n    101,110,100, 10, 10, 45, 45, 32, 67,104,101, 99,107, 32,100,\n    101, 99,108, 97,114, 97,116,105,111,110, 32,110, 97,109,101,\n     10, 45, 45, 32, 73,116, 32, 97,108,115,111, 32,105,100,101,\n    110,116,105,102,105,101,115, 32,100,101,102, 97,117,108,116,\n     32,118, 97,108,117,101,115, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 58, 99,104,101, 99,107,110, 97,109,101, 32, 40,\n     41, 10, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,115,\n    101,108,102, 46,110, 97,109,101, 44, 49, 44, 49, 41, 32, 61,\n     61, 32, 39, 91, 39, 32, 97,110,100, 32,110,111,116, 32,102,\n    105,110,100,116,121,112,101, 40,115,101,108,102, 46,116,121,\n    112,101, 41, 32,116,104,101,110, 10, 32, 32,115,101,108,102,\n     46,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,116,121,\n    112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10, 32,\n     32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,\n    116, 40,115,101,108,102, 46,109,111,100, 44, 39, 37,115, 37,\n    115, 42, 39, 41, 10, 32, 32,115,101,108,102, 46,116,121,112,\n    101, 32, 61, 32,109, 91,109, 46,110, 93, 10, 32, 32,115,101,\n    108,102, 46,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116,\n     40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 10, 32,101,110,\n    100, 10, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,115,\n    112,108,105,116, 40,115,101,108,102, 46,110, 97,109,101, 44,\n     39, 61, 39, 41, 10, 32,105,102, 32,116, 46,110, 61, 61, 50,\n     32,116,104,101,110, 10, 32, 32,115,101,108,102, 46,110, 97,\n    109,101, 32, 61, 32,116, 91, 49, 93, 10, 32, 32,115,101,108,\n    102, 46,100,101,102, 32, 61, 32,102,105,110,100, 95,101,110,\n    117,109, 95,118, 97,114, 40,116, 91,116, 46,110, 93, 41, 10,\n     32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32, 98, 44,\n    101, 44,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,\n    101,108,102, 46,110, 97,109,101, 44, 34, 37, 91, 40, 46, 45,\n     41, 37, 93, 34, 41, 10, 32,105,102, 32, 98, 32,116,104,101,\n    110, 10, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61,\n     32,115,116,114,115,117, 98, 40,115,101,108,102, 46,110, 97,\n    109,101, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32,115,101,108,\n    102, 46,100,105,109, 32, 61, 32,102,105,110,100, 95,101,110,\n    117,109, 95,118, 97,114, 40,100, 41, 10, 32,101,110,100, 10,\n     10, 10, 32,105,102, 32,115,101,108,102, 46,116,121,112,101,\n     32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102,\n     46,116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39,\n     32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 32,\n     61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,115,101,\n    108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,101, 97,116,\n    101, 95,118, 97,114,110, 97,109,101, 40, 41, 10, 32,101,108,\n    115,101,105,102, 32,115,101,108,102, 46,107,105,110,100, 61,\n     61, 39,118, 97,114, 39, 32,116,104,101,110, 10, 32, 32,105,\n    102, 32,115,101,108,102, 46,116,121,112,101, 61, 61, 39, 39,\n     32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101,126,\n     61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 32,115,101,108,102, 46,116,\n    121,112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10,\n     32, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,\n     99,114,101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40,\n     41, 10, 32, 32,101,108,115,101,105,102, 32,102,105,110,100,\n    116,121,112,101, 40,115,101,108,102, 46,110, 97,109,101, 41,\n     32,116,104,101,110, 10, 32, 32, 32,105,102, 32,115,101,108,\n    102, 46,116,121,112,101, 61, 61, 39, 39, 32,116,104,101,110,\n     32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101,\n    108,102, 46,110, 97,109,101, 10, 32, 32, 32,101,108,115,101,\n     32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101,\n    108,102, 46,116,121,112,101, 46, 46, 39, 32, 39, 46, 46,115,\n    101,108,102, 46,110, 97,109,101, 32,101,110,100, 10, 32, 32,\n     32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,\n    101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, 41, 10,\n     32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45,\n     32, 97,100,106,117,115,116, 32,116,121,112,101, 32,111,102,\n     32,115,116,114,105,110,103, 10, 32,105,102, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 61, 32, 39, 99,104, 97,114,\n     39, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32,\n    126, 61, 32, 39, 39, 32,116,104,101,110, 10,  9, 32,115,101,\n    108,102, 46,116,121,112,101, 32, 61, 32, 39, 99,104, 97,114,\n     42, 39, 10, 32,101,110,100, 10, 10,  9,105,102, 32,115,101,\n    108,102, 46,107,105,110,100, 32, 97,110,100, 32,115,101,108,\n    102, 46,107,105,110,100, 32, 61, 61, 32, 39,118, 97,114, 39,\n     32,116,104,101,110, 10,  9,  9,115,101,108,102, 46,110, 97,\n    109,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40,115,101,108,102, 46,110, 97,109,101, 44, 32, 34, 58,\n     46, 42, 36, 34, 44, 32, 34, 34, 41, 32, 45, 45, 32, 63, 63,\n     63, 10,  9,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n     67,104,101, 99,107, 32,100,101, 99,108, 97,114, 97,116,105,\n    111,110, 32,116,121,112,101, 10, 45, 45, 32, 83,117, 98,115,\n    116,105,116,117,116,101,115, 32,116,121,112,101,100,101,102,\n     39,115, 46, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,\n     99,104,101, 99,107,116,121,112,101, 32, 40, 41, 10, 10, 32,\n     45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,116,104,101,\n    114,101, 32,105,115, 32, 97, 32,112,111,105,110,116,101,114,\n     32,116,111, 32, 98, 97,115,105, 99, 32,116,121,112,101, 10,\n     32,108,111, 99, 97,108, 32, 98, 97,115,105, 99, 32, 61, 32,\n    105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,\n    112,101, 41, 10, 32,105,102, 32,115,101,108,102, 46,107,105,\n    110,100, 32, 61, 61, 32, 39,102,117,110, 99, 39, 32, 97,110,\n    100, 32, 98, 97,115,105, 99, 61, 61, 39,110,117,109, 98,101,\n    114, 39, 32, 97,110,100, 32,115,116,114,105,110,103, 46,102,\n    105,110,100, 40,115,101,108,102, 46,112,116,114, 44, 32, 34,\n     37, 42, 34, 41, 32,116,104,101,110, 10, 32,  9,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 32, 39, 95,117,115,101,114,\n    100, 97,116, 97, 39, 10, 32,  9,115,101,108,102, 46,112,116,\n    114, 32, 61, 32, 34, 34, 10, 32,101,110,100, 10, 32,105,102,\n     32, 98, 97,115,105, 99, 32, 97,110,100, 32,115,101,108,102,\n     46,112,116,114,126, 61, 39, 39, 32,116,104,101,110, 10, 32,\n     32,115,101,108,102, 46,114,101,116, 32, 61, 32,115,101,108,\n    102, 46,112,116,114, 10, 32, 32,115,101,108,102, 46,112,116,\n    114, 32, 61, 32,110,105,108, 10, 32, 32,105,102, 32,105,115,\n     98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101,\n     41, 32, 61, 61, 32, 39,110,117,109, 98,101,114, 39, 32,116,\n    104,101,110, 10, 32, 32,  9,115,101,108,102, 46,114,101,116,\n    117,114,110, 95,117,115,101,114,100, 97,116, 97, 32, 61, 32,\n    116,114,117,101, 10, 32, 32,101,110,100, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,\n    116,104,101,114,101, 32,105,115, 32, 97,114,114, 97,121, 32,\n    116,111, 32, 98,101, 32,114,101,116,117,114,110,101,100, 10,\n     32,105,102, 32,115,101,108,102, 46,100,105,109,126, 61, 39,\n     39, 32, 97,110,100, 32,115,101,108,102, 46,114,101,116,126,\n     61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114,114,\n    111,114, 40, 39, 35,105,110,118, 97,108,105,100, 32,112, 97,\n    114, 97,109,101,116,101,114, 58, 32, 99, 97,110,110,111,116,\n     32,114,101,116,117,114,110, 32, 97,110, 32, 97,114,114, 97,\n    121, 32,111,102, 32,118, 97,108,117,101,115, 39, 41, 10, 32,\n    101,110,100, 10, 32, 45, 45, 32,114,101,115,116,111,114,101,\n     32, 39,118,111,105,100, 42, 39, 32, 97,110,100, 32, 39,115,\n    116,114,105,110,103, 42, 39, 10, 32,105,102, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 61, 32, 39, 95,117,115,101,\n    114,100, 97,116, 97, 39, 32,116,104,101,110, 32,115,101,108,\n    102, 46,116,121,112,101, 32, 61, 32, 39,118,111,105,100, 42,\n     39, 10, 32,101,108,115,101,105,102, 32,115,101,108,102, 46,\n    116,121,112,101, 32, 61, 61, 32, 39, 95, 99,115,116,114,105,\n    110,103, 39, 32,116,104,101,110, 32,115,101,108,102, 46,116,\n    121,112,101, 32, 61, 32, 39, 99,104, 97,114, 42, 39, 10, 32,\n    101,108,115,101,105,102, 32,115,101,108,102, 46,116,121,112,\n    101, 32, 61, 61, 32, 39, 95,108,115,116, 97,116,101, 39, 32,\n    116,104,101,110, 32,115,101,108,102, 46,116,121,112,101, 32,\n     61, 32, 39,108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10,\n     32,101,110,100, 10, 10, 32, 45, 45, 32,114,101,115,111,108,\n    118,101, 32,116,121,112,101,115, 32,105,110,115,105,100,101,\n     32,116,104,101, 32,116,101,109,112,108, 97,116,101,115, 10,\n     32,105,102, 32,115,101,108,102, 46,116,121,112,101, 32,116,\n    104,101,110, 10,  9, 32,115,101,108,102, 46,116,121,112,101,\n     32, 61, 32,114,101,115,111,108,118,101, 95,116,101,109,112,\n    108, 97,116,101, 95,116,121,112,101,115, 40,115,101,108,102,\n     46,116,121,112,101, 41, 10, 32,101,110,100, 10, 10, 45, 45,\n     10, 45, 45, 32, 45, 45, 32,105,102, 32,114,101,116,117,114,\n    110,105,110,103, 32,118, 97,108,117,101, 44, 32, 97,117,116,\n    111,109, 97,116,105, 99, 97,108,108,121, 32,115,101,116, 32,\n    100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 10, 45,\n     45, 32,105,102, 32,115,101,108,102, 46,114,101,116, 32,126,\n     61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, 46,100,\n    101,102, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 45,\n     45, 32, 32,115,101,108,102, 46,100,101,102, 32, 61, 32, 39,\n     48, 39, 10, 45, 45, 32,101,110,100, 10, 45, 45, 10, 10,101,\n    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,101,\n    115,111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,\n    116,121,112,101,115, 40,116,121,112,101, 41, 10, 10,  9,105,\n    102, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, 41,\n     32,116,104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,\n    116,121,112,101, 10,  9,101,110,100, 10,  9,108,111, 99, 97,\n    108, 32, 98, 44, 95, 44,109, 32, 61, 32,115,116,114,105,110,\n    103, 46,102,105,110,100, 40,116,121,112,101, 44, 32, 34, 40,\n     37, 98, 60, 62, 41, 34, 41, 10,  9,105,102, 32, 98, 32,116,\n    104,101,110, 10, 10,  9,  9,109, 32, 61, 32,115,112,108,105,\n    116, 95, 99, 95,116,111,107,101,110,115, 40,115,116,114,105,\n    110,103, 46,115,117, 98, 40,109, 44, 32, 50, 44, 32, 45, 50,\n     41, 44, 32, 34, 44, 34, 41, 10,  9,  9,102,111,114, 32,105,\n     61, 49, 44, 32,116, 97, 98,108,101, 46,103,101,116,110, 40,\n    109, 41, 32,100,111, 10,  9,  9,  9,109, 91,105, 93, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109, 91,\n    105, 93, 44, 34, 37,115, 42, 40, 91, 37, 42, 38, 93, 41, 34,\n     44, 32, 34, 37, 49, 34, 41, 10,  9,  9,  9,105,102, 32,110,\n    111,116, 32,105,115,101,110,117,109, 40,109, 91,105, 93, 41,\n     32,116,104,101,110, 32, 95, 44, 32,109, 91,105, 93, 32, 61,\n     32, 97,112,112,108,121,116,121,112,101,100,101,102, 40, 34,\n     34, 44, 32,109, 91,105, 93, 41, 32,101,110,100, 10,  9,  9,\n      9,109, 91,105, 93, 32, 61, 32,102,105,110,100,116,121,112,\n    101, 40,109, 91,105, 93, 41, 32,111,114, 32,109, 91,105, 93,\n     10,  9,  9,  9,109, 91,105, 93, 32, 61, 32,114,101,115,111,\n    108,118,101, 95,116,101,109,112,108, 97,116,101, 95,116,121,\n    112,101,115, 40,109, 91,105, 93, 41, 10,  9,  9,101,110,100,\n     10, 10,  9,  9,108,111, 99, 97,108, 32, 98, 44,105, 10,  9,\n      9,116,121,112,101, 44, 98, 44,105, 32, 61, 32, 98,114,101,\n     97,107, 95,116,101,109,112,108, 97,116,101, 40,116,121,112,\n    101, 41, 10, 45, 45,112,114,105,110,116, 40, 34, 99,111,110,\n     99, 97,116, 32,105,115, 32, 34, 44, 99,111,110, 99, 97,116,\n     40,109, 44, 32, 49, 44, 32,109, 46,110, 41, 41, 10,  9,  9,\n    108,111, 99, 97,108, 32,116,101,109,112,108, 97,116,101, 95,\n    112, 97,114,116, 32, 61, 32, 34, 60, 34, 46, 46, 99,111,110,\n     99, 97,116, 40,109, 44, 32, 49, 44, 32,109, 46,110, 44, 32,\n     34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,  9,116,121,112,\n    101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101,109,\n    112,108, 97,116,101, 40,116,121,112,101, 44, 32, 98, 44, 32,\n    116,101,109,112,108, 97,116,101, 95,112, 97,114,116, 41, 10,\n      9,  9,116,121,112,101, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,116,121,112,101, 44, 32, 34, 62, 62,\n     34, 44, 32, 34, 62, 32, 62, 34, 41, 10,  9,101,110,100, 10,\n      9,114,101,116,117,114,110, 32,116,121,112,101, 10,101,110,\n    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 98,114,101,\n     97,107, 95,116,101,109,112,108, 97,116,101, 40,115, 41, 10,\n      9,108,111, 99, 97,108, 32, 98, 44,101, 44,116,105,109,112,\n    108, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100,\n     40,115, 44, 32, 34, 40, 37, 98, 60, 62, 41, 34, 41, 10,  9,\n    105,102, 32,116,105,109,112,108, 32,116,104,101,110, 10,  9,\n      9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40,115, 44, 32, 34, 37, 98, 60, 62, 34, 44, 32, 34, 34,\n     41, 10,  9,  9,114,101,116,117,114,110, 32,115, 44, 32, 98,\n     44, 32,116,105,109,112,108, 10,  9,101,108,115,101, 10,  9,\n      9,114,101,116,117,114,110, 32,115, 44, 32, 48, 44, 32,110,\n    105,108, 10,  9,101,110,100, 10,101,110,100, 10, 10,102,117,\n    110, 99,116,105,111,110, 32,114,101, 98,117,105,108,100, 95,\n    116,101,109,112,108, 97,116,101, 40,115, 44, 32, 98, 44, 32,\n    116,105,109,112,108, 41, 10, 10,  9,105,102, 32, 98, 32, 61,\n     61, 32, 48, 32,116,104,101,110, 10,  9,  9,114,101,116,117,\n    114,110, 32,115, 10,  9,101,110,100, 10, 10,  9,114,101,116,\n    117,114,110, 32,115,116,114,105,110,103, 46,115,117, 98, 40,\n    115, 44, 32, 49, 44, 32, 98, 45, 49, 41, 46, 46,116,105,109,\n    112,108, 46, 46,115,116,114,105,110,103, 46,115,117, 98, 40,\n    115, 44, 32, 98, 44, 32, 45, 49, 41, 10,101,110,100, 10, 10,\n     45, 45, 32, 80,114,105,110,116, 32,109,101,116,104,111,100,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     68,101, 99,108, 97,114, 97,116,105,111,110, 58,112,114,105,\n    110,116, 32, 40,105,100,101,110,116, 44, 99,108,111,115,101,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 68,101, 99,108, 97,114, 97,116,105,111,110,123, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,\n     46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,\n    109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100,105,109,\n     32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,105,\n    109, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 32,100,101,102, 32, 32,\n     61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,101,102, 46,\n     46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,\n    100,101,110,116, 46, 46, 34, 32,114,101,116, 32, 32, 61, 32,\n     39, 34, 46, 46,115,101,108,102, 46,114,101,116, 46, 46, 34,\n     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41,\n     10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,\n    105,102, 32, 97,114,114, 97,121, 32,111,102, 32,118, 97,108,\n    117,101,115, 32, 97,114,101, 32,114,101,116,117,114,110,101,\n    100, 32,116,111, 32, 76,117, 97, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,\n    116,105,111,110, 58,114,101,113,117,105,114,101, 99,111,108,\n    108,101, 99,116,105,111,110, 32, 40,116, 41, 10, 32,105,102,\n     32,115,101,108,102, 46,109,111,100, 32,126, 61, 32, 39, 99,\n    111,110,115,116, 39, 32, 97,110,100, 10,  9, 32, 32, 32, 32,\n    115,101,108,102, 46,100,105,109, 32, 97,110,100, 32,115,101,\n    108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32, 97,110,\n    100, 10,  9,  9,  9,  9, 32,110,111,116, 32,105,115, 98, 97,\n    115,105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 32,\n     97,110,100, 10,  9,  9,  9,  9, 32,115,101,108,102, 46,112,\n    116,114, 32, 61, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,\n    108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99,\n     95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,\n      9,  9,108,111, 99, 97,108, 32,116,121,112,101, 32, 61, 32,\n    103,115,117, 98, 40,115,101,108,102, 46,116,121,112,101, 44,\n     34, 37,115, 42, 99,111,110,115,116, 37,115, 43, 34, 44, 34,\n     34, 41, 10,  9,  9,116, 91,116,121,112,101, 93, 32, 61, 32,\n     34,116,111,108,117, 97, 95, 99,111,108,108,101, 99,116, 95,\n     34, 32, 46, 46, 32, 99,108,101, 97,110, 95,116,101,109,112,\n    108, 97,116,101, 40,116,121,112,101, 41, 10,  9,  9,114,101,\n    116,117,114,110, 32,116,114,117,101, 10,  9,101,110,100, 10,\n      9,114,101,116,117,114,110, 32,102, 97,108,115,101, 10,101,\n    110,100, 10, 10, 45, 45, 32,100,101, 99,108, 97,114,101, 32,\n    116, 97,103, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,\n    100,101, 99,108,116,121,112,101, 32, 40, 41, 10, 10,  9,115,\n    101,108,102, 46,116,121,112,101, 32, 61, 32,116,121,112,101,\n    118, 97,114, 40,115,101,108,102, 46,116,121,112,101, 41, 10,\n      9,105,102, 32,115,116,114,102,105,110,100, 40,115,101,108,\n    102, 46,109,111,100, 44, 39, 99,111,110,115,116, 39, 41, 32,\n    116,104,101,110, 10,  9,  9,115,101,108,102, 46,116,121,112,\n    101, 32, 61, 32, 39, 99,111,110,115,116, 32, 39, 46, 46,115,\n    101,108,102, 46,116,121,112,101, 10,  9,  9,115,101,108,102,\n     46,109,111,100, 32, 61, 32,103,115,117, 98, 40,115,101,108,\n    102, 46,109,111,100, 44, 39, 99,111,110,115,116, 37,115, 42,\n     39, 44, 39, 39, 41, 10,  9,101,110,100, 10,101,110,100, 10,\n     10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116,121,112,\n    101, 32, 99,104,101, 99,107,105,110,103, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,\n    114, 97,116,105,111,110, 58,111,117,116, 99,104,101, 99,107,\n    116,121,112,101, 32, 40,110, 97,114,103, 41, 10, 32,108,111,\n     99, 97,108, 32,100,101,102, 10, 32,108,111, 99, 97,108, 32,\n    116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,\n    102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115,101,108,\n    102, 46,100,101,102,126, 61, 39, 39, 32,116,104,101,110, 10,\n     32, 32,100,101,102, 32, 61, 32, 49, 10, 32,101,108,115,101,\n     10, 32, 32,100,101,102, 32, 61, 32, 48, 10, 32,101,110,100,\n     10, 32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126,\n     61, 32, 39, 39, 32,116,104,101,110, 10,  9, 45, 45,105,102,\n     32,116, 61, 61, 39,115,116,114,105,110,103, 39, 32,116,104,\n    101,110, 10,  9, 45, 45,  9,114,101,116,117,114,110, 32, 39,\n    116,111,108,117, 97, 95,105,115,115,116,114,105,110,103, 97,\n    114,114, 97,121, 40,116,111,108,117, 97, 95, 83, 44, 39, 46,\n     46,110, 97,114,103, 46, 46, 39, 44, 39, 46, 46,100,101,102,\n     46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41,\n     39, 10,  9, 45, 45,101,108,115,101, 10,  9,114,101,116,117,\n    114,110, 32, 39, 33,116,111,108,117, 97, 95,105,115,116, 97,\n     98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 39, 46, 46,\n    110, 97,114,103, 46, 46, 39, 44, 48, 44, 38,116,111,108,117,\n     97, 95,101,114,114, 41, 39, 10, 32,  9, 45, 45,101,110,100,\n     10, 32,101,108,115,101,105,102, 32,116, 32,116,104,101,110,\n     10,  9,114,101,116,117,114,110, 32, 39, 33,116,111,108,117,\n     97, 95,105,115, 39, 46, 46,116, 46, 46, 39, 40,116,111,108,\n    117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39,\n     44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,116,111,108,\n    117, 97, 95,101,114,114, 41, 39, 10, 32,101,108,115,101, 10,\n     32, 32,108,111, 99, 97,108, 32,105,115, 95,102,117,110, 99,\n     32, 61, 32,103,101,116, 95,105,115, 95,102,117,110, 99,116,\n    105,111,110, 40,115,101,108,102, 46,116,121,112,101, 41, 10,\n     32, 32,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61,\n     61, 32, 39, 38, 39, 32,111,114, 32,115,101,108,102, 46,112,\n    116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32,\n     32,  9,114,101,116,117,114,110, 32, 39, 40,116,111,108,117,\n     97, 95,105,115,118, 97,108,117,101,110,105,108, 40,116,111,\n    108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46,\n     39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41, 32,124,\n    124, 32, 33, 39, 46, 46,105,115, 95,102,117,110, 99, 46, 46,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 39, 46, 46,110, 97,\n    114,103, 46, 46, 39, 44, 34, 39, 46, 46,115,101,108,102, 46,\n    116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46,100,101,102,\n     46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,114, 41,\n     41, 39, 10, 32, 32,101,108,115,101, 10,  9,114,101,116,117,\n    114,110, 32, 39, 33, 39, 46, 46,105,115, 95,102,117,110, 99,\n     46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 39, 46, 46,\n    110, 97,114,103, 46, 46, 39, 44, 34, 39, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46,100,\n    101,102, 46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,\n    114, 41, 39, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10,\n    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,\n    108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110,\n     58, 98,117,105,108,100,100,101, 99,108, 97,114, 97,116,105,\n    111,110, 32, 40,110, 97,114,103, 44, 32, 99,112,108,117,115,\n    112,108,117,115, 41, 10, 32,108,111, 99, 97,108, 32, 97,114,\n    114, 97,121, 32, 61, 32,115,101,108,102, 46,100,105,109, 32,\n    126, 61, 32, 39, 39, 32, 97,110,100, 32,116,111,110,117,109,\n     98,101,114, 40,115,101,108,102, 46,100,105,109, 41, 61, 61,\n    110,105,108, 10,  9,108,111, 99, 97,108, 32,108,105,110,101,\n     32, 61, 32, 34, 34, 10, 32,108,111, 99, 97,108, 32,112,116,\n    114, 32, 61, 32, 39, 39, 10, 32,108,111, 99, 97,108, 32,109,\n    111,100, 10, 32,108,111, 99, 97,108, 32,116,121,112,101, 32,\n     61, 32,115,101,108,102, 46,116,121,112,101, 10, 32,108,111,\n     99, 97,108, 32,110, 99,116,121,112,101, 32, 61, 32,103,115,\n    117, 98, 40,115,101,108,102, 46,116,121,112,101, 44, 39, 99,\n    111,110,115,116, 37,115, 43, 39, 44, 39, 39, 41, 10, 32,105,\n    102, 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10,  9, 32,116,121,112,101, 32, 61,\n     32,103,115,117, 98, 40,115,101,108,102, 46,116,121,112,101,\n     44, 39, 99,111,110,115,116, 37,115, 43, 39, 44, 39, 39, 41,\n     32, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,115,\n     32, 99,111,110,115,116, 32,109,111,100,105,102,105,101,114,\n     32,102,111,114, 32, 97,114,114, 97,121,115, 10, 32,101,110,\n    100, 10, 32,105,102, 32,115,101,108,102, 46,112,116,114,126,\n     61, 39, 39, 32, 97,110,100, 32,110,111,116, 32,105,115, 98,\n     97,115,105, 99, 40,116,121,112,101, 41, 32,116,104,101,110,\n     32,112,116,114, 32, 61, 32, 39, 42, 39, 32,101,110,100, 10,\n     32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112,\n     97,114, 97,109, 40,108,105,110,101, 44, 34, 32, 34, 44,115,\n    101,108,102, 46,109,111,100, 44,116,121,112,101, 44,112,116,\n    114, 41, 10, 32,105,102, 32, 97,114,114, 97,121, 32,116,104,\n    101,110, 10, 32, 32,108,105,110,101, 32, 61, 32, 99,111,110,\n     99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39,\n     42, 39, 41, 10, 32,101,110,100, 10, 32,108,105,110,101, 32,\n     61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,\n    105,110,101, 44,115,101,108,102, 46,110, 97,109,101, 41, 10,\n     32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126, 61,\n     32, 39, 39, 32,116,104,101,110, 10, 32, 32,105,102, 32,116,\n    111,110,117,109, 98,101,114, 40,115,101,108,102, 46,100,105,\n    109, 41,126, 61,110,105,108, 32,116,104,101,110, 10, 32, 32,\n     32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112,\n     97,114, 97,109, 40,108,105,110,101, 44, 39, 91, 39, 44,115,\n    101,108,102, 46,100,105,109, 44, 39, 93, 59, 39, 41, 10, 32,\n     32,101,108,115,101, 10,  9,105,102, 32, 99,112,108,117,115,\n    112,108,117,115, 32,116,104,101,110, 10,  9,  9,108,105,110,\n    101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109,\n     40,108,105,110,101, 44, 39, 32, 61, 32, 77,116,111,108,117,\n     97, 95,110,101,119, 40, 40, 39, 44,116,121,112,101, 44,112,\n    116,114, 44, 39, 41, 91, 39, 46, 46,115,101,108,102, 46,100,\n    105,109, 46, 46, 39, 93, 41, 59, 39, 41, 10,  9,101,108,115,\n    101, 10,  9,  9,108,105,110,101, 32, 61, 32, 99,111,110, 99,\n     97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 32,\n     61, 32, 40, 39, 44,116,121,112,101, 44,112,116,114, 44, 39,\n     42, 41, 39, 44, 10,  9,  9, 39,109, 97,108,108,111, 99, 40,\n     40, 39, 44,115,101,108,102, 46,100,105,109, 44, 39, 41, 42,\n    115,105,122,101,111,102, 40, 39, 44,116,121,112,101, 44,112,\n    116,114, 44, 39, 41, 41, 59, 39, 41, 10,  9,101,110,100, 10,\n     32, 32,101,110,100, 10, 32,101,108,115,101, 10, 32, 32,108,\n    111, 99, 97,108, 32,116, 32, 61, 32,105,115, 98, 97,115,105,\n     99, 40,116,121,112,101, 41, 10, 32, 32,108,105,110,101, 32,\n     61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,\n    105,110,101, 44, 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102,\n     32,116, 32, 61, 61, 32, 39,115,116, 97,116,101, 39, 32,116,\n    104,101,110, 10, 32, 32,  9,108,105,110,101, 32, 61, 32, 99,\n    111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101,\n     44, 32, 39,116,111,108,117, 97, 95, 83, 59, 39, 41, 10, 32,\n     32,101,108,115,101, 10, 32, 32,  9, 45, 45,112,114,105,110,\n    116, 40, 34,116, 32,105,115, 32, 34, 46, 46,116,111,115,116,\n    114,105,110,103, 40,116, 41, 46, 46, 34, 44, 32,112,116,114,\n     32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103,\n     40,115,101,108,102, 46,112,116,114, 41, 41, 10, 32, 32,  9,\n    105,102, 32,116, 32, 61, 61, 32, 39,110,117,109, 98,101,114,\n     39, 32, 97,110,100, 32,115,116,114,105,110,103, 46,102,105,\n    110,100, 40,115,101,108,102, 46,112,116,114, 44, 32, 34, 37,\n     42, 34, 41, 32,116,104,101,110, 10, 32, 32,  9,  9,116, 32,\n     61, 32, 39,117,115,101,114,100, 97,116, 97, 39, 10, 32, 32,\n      9,101,110,100, 10,  9,105,102, 32,110,111,116, 32,116, 32,\n     97,110,100, 32,112,116,114, 61, 61, 39, 39, 32,116,104,101,\n    110, 32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,\n    112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 42, 39, 41,\n     32,101,110,100, 10,  9,108,105,110,101, 32, 61, 32, 99,111,\n    110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,\n     39, 40, 40, 39, 44,115,101,108,102, 46,109,111,100, 44,116,\n    121,112,101, 41, 10,  9,105,102, 32,110,111,116, 32,116, 32,\n    116,104,101,110, 10,  9,  9,108,105,110,101, 32, 61, 32, 99,\n    111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101,\n     44, 39, 42, 39, 41, 10,  9,101,110,100, 10,  9,108,105,110,\n    101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109,\n     40,108,105,110,101, 44, 39, 41, 32, 39, 41, 10,  9,105,102,\n     32,105,115,101,110,117,109, 40,110, 99,116,121,112,101, 41,\n     32,116,104,101,110, 10,  9,  9,108,105,110,101, 32, 61, 32,\n     99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,\n    101, 44, 39, 40,105,110,116, 41, 32, 39, 41, 10,  9,101,110,\n    100, 10,  9,108,111, 99, 97,108, 32,100,101,102, 32, 61, 32,\n     48, 10,  9,105,102, 32,115,101,108,102, 46,100,101,102, 32,\n    126, 61, 32, 39, 39, 32,116,104,101,110, 10,  9,  9,100,101,\n    102, 32, 61, 32,115,101,108,102, 46,100,101,102, 10,  9,  9,\n    105,102, 32, 40,112,116,114, 32, 61, 61, 32, 39, 39, 32,111,\n    114, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39,\n     38, 39, 41, 32, 97,110,100, 32,110,111,116, 32,116, 32,116,\n    104,101,110, 10,  9,  9,  9,100,101,102, 32, 61, 32, 34, 40,\n    118,111,105,100, 42, 41, 38, 40, 99,111,110,115,116, 32, 34,\n     46, 46,116,121,112,101, 46, 46, 34, 41, 34, 46, 46,100,101,\n    102, 10,  9,  9,101,110,100, 10,  9,101,110,100, 10,  9,105,\n    102, 32,116, 32,116,104,101,110, 10,  9,  9,108,105,110,101,\n     32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,\n    108,105,110,101, 44, 39,116,111,108,117, 97, 95,116,111, 39,\n     46, 46,116, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 39,\n     44,110, 97,114,103, 44, 39, 44, 39, 44,100,101,102, 44, 39,\n     41, 41, 59, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,108,\n    111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,\n    103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110,\n     40,116,121,112,101, 41, 10,  9,  9,108,105,110,101, 32, 61,\n     32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,\n    110,101, 44,116,111, 95,102,117,110, 99, 46, 46, 39, 40,116,\n    111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39,\n     44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10,  9,\n    101,110,100, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10,\n      9,114,101,116,117,114,110, 32,108,105,110,101, 10,101,110,\n    100, 10, 10, 45, 45, 32, 68,101, 99,108, 97,114,101, 32,118,\n     97,114,105, 97, 98,108,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 58,100,101, 99,108, 97,114,101, 32, 40,110, 97,\n    114,103, 41, 10, 32,105,102, 32,115,101,108,102, 46,100,105,\n    109, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,116,111,110,\n    117,109, 98,101,114, 40,115,101,108,102, 46,100,105,109, 41,\n     61, 61,110,105,108, 32,116,104,101,110, 10,  9, 32,111,117,\n    116,112,117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95,\n     99,112,108,117,115,112,108,117,115, 92,110, 39, 41, 10,  9,\n      9,111,117,116,112,117,116, 40,115,101,108,102, 58, 98,117,\n    105,108,100,100,101, 99,108, 97,114, 97,116,105,111,110, 40,\n    110, 97,114,103, 44,116,114,117,101, 41, 41, 10,  9,  9,111,\n    117,116,112,117,116, 40, 39, 35,101,108,115,101, 92,110, 39,\n     41, 10,  9,  9,111,117,116,112,117,116, 40,115,101,108,102,\n     58, 98,117,105,108,100,100,101, 99,108, 97,114, 97,116,105,\n    111,110, 40,110, 97,114,103, 44,102, 97,108,115,101, 41, 41,\n     10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,\n    111,117,116,112,117,116, 40,115,101,108,102, 58, 98,117,105,\n    108,100,100,101, 99,108, 97,114, 97,116,105,111,110, 40,110,\n     97,114,103, 44,102, 97,108,115,101, 41, 41, 10,  9,101,110,\n    100, 10,101,110,100, 10, 10, 45, 45, 32, 71,101,116, 32,112,\n     97,114, 97,109,101,116,101,114, 32,118, 97,108,117,101, 10,\n    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,\n    101, 99,108, 97,114, 97,116,105,111,110, 58,103,101,116, 97,\n    114,114, 97,121, 32, 40,110, 97,114,103, 41, 10, 32,105,102,\n     32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39,\n     32,116,104,101,110, 10,  9, 32,108,111, 99, 97,108, 32,116,\n    121,112,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102,\n     46,116,121,112,101, 44, 39, 99,111,110,115,116, 32, 39, 44,\n     39, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32,123, 39, 41, 10,  9, 32,111,117,116,112,117,116, 40, 39,\n     35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82,\n     69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 32, 32,108,111,\n     99, 97,108, 32,100,101,102, 59, 32,105,102, 32,115,101,108,\n    102, 46,100,101,102,126, 61, 39, 39, 32,116,104,101,110, 32,\n    100,101,102, 61, 49, 32,101,108,115,101, 32,100,101,102, 61,\n     48, 32,101,110,100, 10,  9,  9,108,111, 99, 97,108, 32,116,\n     32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101,\n     41, 10,  9,  9,105,102, 32, 40,116, 41, 32,116,104,101,110,\n     10,  9,  9, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95,105,115,\n     39, 46, 46,116, 46, 46, 39, 97,114,114, 97,121, 40,116,111,\n    108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,\n     39, 44,115,101,108,102, 46,100,105,109, 44, 39, 44, 39, 44,\n    100,101,102, 44, 39, 44, 38,116,111,108,117, 97, 95,101,114,\n    114, 41, 41, 39, 41, 10,  9,  9,101,108,115,101, 10,  9,  9,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,105,\n    102, 32, 40, 33,116,111,108,117, 97, 95,105,115,117,115,101,\n    114,116,121,112,101, 97,114,114, 97,121, 40,116,111,108,117,\n     97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44, 34, 39,\n     44,116,121,112,101, 44, 39, 34, 44, 39, 44,115,101,108,102,\n     46,100,105,109, 44, 39, 44, 39, 44,100,101,102, 44, 39, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10,\n      9,  9,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40,\n     39, 32, 32, 32, 32,103,111,116,111, 32,116,111,108,117, 97,\n     95,108,101,114,114,111,114, 59, 39, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32,101,108,115,101, 92,110,\n     39, 41, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,\n    110,100,105,102, 92,110, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 32, 32,123, 39, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32, 32,105,110,116, 32,105,\n     59, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32, 32, 32,102,111,114, 40,105, 61, 48, 59, 32,105, 60, 39,\n     46, 46,115,101,108,102, 46,100,105,109, 46, 46, 39, 59,105,\n     43, 43, 41, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,116,\n     32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101,\n     41, 10, 32, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61,\n     32, 39, 39, 10, 32, 32,105,102, 32,115,101,108,102, 46,112,\n    116,114,126, 61, 39, 39, 32,116,104,101,110, 32,112,116,114,\n     32, 61, 32, 39, 42, 39, 32,101,110,100, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32, 39, 44,115,101,108,102,\n     46,110, 97,109,101, 46, 46, 39, 91,105, 93, 32, 61, 32, 39,\n     41, 10, 32, 32,105,102, 32,110,111,116, 32,116, 32, 97,110,\n    100, 32,112,116,114, 61, 61, 39, 39, 32,116,104,101,110, 32,\n    111,117,116,112,117,116, 40, 39, 42, 39, 41, 32,101,110,100,\n     10, 32, 32,111,117,116,112,117,116, 40, 39, 40, 40, 39, 44,\n    116,121,112,101, 41, 10, 32, 32,105,102, 32,110,111,116, 32,\n    116, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 42, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32,\n    111,117,116,112,117,116, 40, 39, 41, 32, 39, 41, 10, 32, 32,\n    108,111, 99, 97,108, 32,100,101,102, 32, 61, 32, 48, 10, 32,\n     32,105,102, 32,115,101,108,102, 46,100,101,102, 32,126, 61,\n     32, 39, 39, 32,116,104,101,110, 32,100,101,102, 32, 61, 32,\n    115,101,108,102, 46,100,101,102, 32,101,110,100, 10, 32, 32,\n    105,102, 32,116, 32,116,104,101,110, 10, 32, 32, 32,111,117,\n    116,112,117,116, 40, 39,116,111,108,117, 97, 95,116,111,102,\n    105,101,108,100, 39, 46, 46,116, 46, 46, 39, 40,116,111,108,\n    117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105,\n     43, 49, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41,\n     10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40, 39,116,111,108,117, 97, 95,116,111,102,105,101,\n    108,100,117,115,101,114,116,121,112,101, 40,116,111,108,117,\n     97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43,\n     49, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10,\n     32, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40,\n     39, 32, 32, 32,125, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32,125, 39, 41, 10, 32,101,110,100, 10,101,\n    110,100, 10, 10, 45, 45, 32, 71,101,116, 32,112, 97,114, 97,\n    109,101,116,101,114, 32,118, 97,108,117,101, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108,\n     97,114, 97,116,105,111,110, 58,115,101,116, 97,114,114, 97,\n    121, 32, 40,110, 97,114,103, 41, 10, 32,105,102, 32,110,111,\n    116, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46,\n    116,121,112,101, 44, 39, 99,111,110,115,116, 37,115, 43, 39,\n     41, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32,\n    126, 61, 32, 39, 39, 32,116,104,101,110, 10,  9, 32,108,111,\n     99, 97,108, 32,116,121,112,101, 32, 61, 32,103,115,117, 98,\n     40,115,101,108,102, 46,116,121,112,101, 44, 39, 99,111,110,\n    115,116, 32, 39, 44, 39, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 32,123, 39, 41, 10, 32, 32,111,117,116,\n    112,117,116, 40, 39, 32, 32, 32,105,110,116, 32,105, 59, 39,\n     41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n    102,111,114, 40,105, 61, 48, 59, 32,105, 60, 39, 46, 46,115,\n    101,108,102, 46,100,105,109, 46, 46, 39, 59,105, 43, 43, 41,\n     39, 41, 10, 32, 32,108,111, 99, 97,108, 32,116, 44, 99,116,\n     32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101,\n     41, 10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10, 32,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,\n    111,108,117, 97, 95,112,117,115,104,102,105,101,108,100, 39,\n     46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44,\n     39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49, 44, 40, 39,\n     44, 99,116, 44, 39, 41, 39, 44,115,101,108,102, 46,110, 97,\n    109,101, 44, 39, 91,105, 93, 41, 59, 39, 41, 10, 32, 32,101,\n    108,115,101, 10, 32, 32, 32,105,102, 32,115,101,108,102, 46,\n    112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10,\n     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,\n     32,123, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,\n    117,115,112,108,117,115, 92,110, 39, 41, 10, 32, 32, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,\n    105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61,\n     32, 77,116,111,108,117, 97, 95,110,101,119, 40, 40, 39, 44,\n    116,121,112,101, 44, 39, 41, 40, 39, 44,115,101,108,102, 46,\n    110, 97,109,101, 44, 39, 91,105, 93, 41, 41, 59, 39, 41, 10,\n     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,\n     32, 32,116,111,108,117, 97, 95,112,117,115,104,102,105,101,\n    108,100,117,115,101,114,116,121,112,101, 95, 97,110,100, 95,\n    116, 97,107,101,111,119,110,101,114,115,104,105,112, 40,116,\n    111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39,\n     44,105, 43, 49, 44,116,111,108,117, 97, 95,111, 98,106, 44,\n     34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10,\n     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 35,101,\n    108,115,101, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,100, 42,\n     32,116,111,108,117, 97, 95,111, 98,106, 32, 61, 32,116,111,\n    108,117, 97, 95, 99,111,112,121, 40,116,111,108,117, 97, 95,\n     83, 44, 40,118,111,105,100, 42, 41, 38, 39, 44,115,101,108,\n    102, 46,110, 97,109,101, 44, 39, 91,105, 93, 44,115,105,122,\n    101,111,102, 40, 39, 44,116,121,112,101, 44, 39, 41, 41, 59,\n     39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40,\n     39, 32, 32, 32, 32,116,111,108,117, 97, 95,112,117,115,104,\n    102,105,101,108,100,117,115,101,114,116,121,112,101, 40,116,\n    111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39,\n     44,105, 43, 49, 44,116,111,108,117, 97, 95,111, 98,106, 44,\n     34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10,\n     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 35,101,\n    110,100,105,102, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32,125, 39, 41, 10, 32,\n     32, 32,101,108,115,101, 10, 32, 32, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,117,\n    115,104,102,105,101,108,100,117,115,101,114,116,121,112,101,\n     40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103,\n     44, 39, 44,105, 43, 49, 44, 40,118,111,105,100, 42, 41, 39,\n     44,115,101,108,102, 46,110, 97,109,101, 44, 39, 91,105, 93,\n     44, 34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59, 39, 41,\n     10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32,125, 39, 41, 10,\n     32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 70,114,\n    101,101, 32,100,121,110, 97,109,105, 99, 97,108,108,121, 32,\n     97,108,108,111, 99, 97,116,101,100, 32, 97,114,114, 97,121,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     68,101, 99,108, 97,114, 97,116,105,111,110, 58,102,114,101,\n    101, 97,114,114, 97,121, 32, 40, 41, 10, 32,105,102, 32,115,\n    101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32, 97,\n    110,100, 32,116,111,110,117,109, 98,101,114, 40,115,101,108,\n    102, 46,100,105,109, 41, 61, 61,110,105,108, 32,116,104,101,\n    110, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,105,102,\n    100,101,102, 32, 95, 95, 99,112,108,117,115,112,108,117,115,\n     92,110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39,\n     32, 32, 77,116,111,108,117, 97, 95,100,101,108,101,116,101,\n     95,100,105,109, 40, 39, 44,115,101,108,102, 46,110, 97,109,\n    101, 44, 39, 41, 59, 39, 41, 10,  9, 32,111,117,116,112,117,\n    116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 39, 32, 32,102,114,101,101, 40,\n     39, 44,115,101,108,102, 46,110, 97,109,101, 44, 39, 41, 59,\n     39, 41, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,\n    110,100,105,102, 92,110, 39, 41, 10, 32,101,110,100, 10,101,\n    110,100, 10, 10, 45, 45, 32, 80, 97,115,115, 32,112, 97,114,\n     97,109,101,116,101,114, 10,102,117,110, 99,116,105,111,110,\n     32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,\n    111,110, 58,112, 97,115,115,112, 97,114, 32, 40, 41, 10, 32,\n    105,102, 32,115,101,108,102, 46,112,116,114, 61, 61, 39, 38,\n     39, 32, 97,110,100, 32,110,111,116, 32,105,115, 98, 97,115,\n    105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 32,116,\n    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 42,\n     39, 46, 46,115,101,108,102, 46,110, 97,109,101, 41, 10, 32,\n    101,108,115,101,105,102, 32,115,101,108,102, 46,114,101,116,\n     61, 61, 39, 42, 39, 32,116,104,101,110, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 38, 39, 46, 46,115,101,108,102, 46,\n    110, 97,109,101, 41, 10, 32,101,108,115,101, 10, 32, 32,111,\n    117,116,112,117,116, 40,115,101,108,102, 46,110, 97,109,101,\n     41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n     82,101,116,117,114,110, 32,112, 97,114, 97,109,101,116,101,\n    114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 58,114,101,116,118, 97,108,117,101, 32, 40, 41,\n     10, 32,105,102, 32,115,101,108,102, 46,114,101,116, 32,126,\n     61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,108,111, 99,\n     97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,\n    105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32,\n     32,105,102, 32,116, 32, 97,110,100, 32,116,126, 61, 39, 39,\n     32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,117,115,104,\n     39, 46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83,\n     44, 40, 39, 44, 99,116, 44, 39, 41, 39, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 39, 41, 59, 39, 41, 10, 32,\n     32,101,108,115,101, 10, 32, 32, 32,108,111, 99, 97,108, 32,\n    112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103,101,116,\n     95,112,117,115,104, 95,102,117,110, 99,116,105,111,110, 40,\n    115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,\n    104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95,\n     83, 44, 40,118,111,105,100, 42, 41, 39, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 39, 44, 34, 39, 44,115,101,\n    108,102, 46,116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10,\n     32, 32,101,110,100, 10, 32, 32,114,101,116,117,114,110, 32,\n     49, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110, 32,\n     48, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,\n    110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114,\n     10,102,117,110, 99,116,105,111,110, 32, 95, 68,101, 99,108,\n     97,114, 97,116,105,111,110, 32, 40,116, 41, 10, 10, 32,115,\n    101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,\n    108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110,\n     41, 10, 32,116, 58, 98,117,105,108,100,110, 97,109,101,115,\n     40, 41, 10, 32,116, 58, 99,104,101, 99,107,110, 97,109,101,\n     40, 41, 10, 32,116, 58, 99,104,101, 99,107,116,121,112,101,\n     40, 41, 10, 32,108,111, 99, 97,108, 32,102,116, 32, 61, 32,\n    102,105,110,100,116,121,112,101, 40,116, 46,116,121,112,101,\n     41, 32,111,114, 32,116, 46,116,121,112,101, 10, 32,105,102,\n     32,110,111,116, 32,105,115,101,110,117,109, 40,102,116, 41,\n     32,116,104,101,110, 10,  9,116, 46,109,111,100, 44, 32,116,\n     46,116,121,112,101, 32, 61, 32, 97,112,112,108,121,116,121,\n    112,101,100,101,102, 40,116, 46,109,111,100, 44, 32,102,116,\n     41, 10, 32,101,110,100, 10, 10, 32,105,102, 32,116, 46,107,\n    105,110,100, 61, 61, 34,118, 97,114, 34, 32, 97,110,100, 32,\n     40,115,116,114,105,110,103, 46,102,105,110,100, 40,116, 46,\n    109,111,100, 44, 32, 34,116,111,108,117, 97, 95,112,114,111,\n    112,101,114,116,121, 37,115, 34, 41, 32,111,114, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,116, 46,109,111,100,\n     44, 32, 34,116,111,108,117, 97, 95,112,114,111,112,101,114,\n    116,121, 36, 34, 41, 41, 32,116,104,101,110, 10, 32,  9,116,\n     46,109,111,100, 32, 61, 32,115,116,114,105,110,103, 46,103,\n    115,117, 98, 40,116, 46,109,111,100, 44, 32, 34,116,111,108,\n    117, 97, 95,112,114,111,112,101,114,116,121, 34, 44, 32, 34,\n    116,111,108,117, 97, 95,112,114,111,112,101,114,116,121, 95,\n     95, 34, 46, 46,103,101,116, 95,112,114,111,112,101,114,116,\n    121, 95,116,121,112,101, 40, 41, 41, 10, 32,101,110,100, 10,\n     10, 32,114,101,116,117,114,110, 32,116, 10,101,110,100, 10,\n     10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114,\n     10, 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,101,\n     32,115,116,114,105,110,103, 32,100,101, 99,108, 97,114, 97,\n    116,105,111,110, 46, 10, 45, 45, 32, 84,104,101, 32,107,105,\n    110,100, 32,111,102, 32,100,101, 99,108, 97,114, 97,116,105,\n    111,110, 32, 99, 97,110, 32, 98,101, 32, 34,118, 97,114, 34,\n     32,111,114, 32, 34,102,117,110, 99, 34, 46, 10,102,117,110,\n     99,116,105,111,110, 32, 68,101, 99,108, 97,114, 97,116,105,\n    111,110, 32, 40,115, 44,107,105,110,100, 44,105,115, 95,112,\n     97,114, 97,109,101,116,101,114, 41, 10, 10, 32, 45, 45, 32,\n    101,108,105,109,105,110, 97,116,101, 32,115,112, 97, 99,101,\n    115, 32,105,102, 32,100,101,102, 97,117,108,116, 32,118, 97,\n    108,117,101, 32,105,115, 32,112,114,111,118,105,100,101,100,\n     10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 37,\n    115, 42, 61, 37,115, 42, 34, 44, 34, 61, 34, 41, 10, 32,115,\n     32, 61, 32,103,115,117, 98, 40,115, 44, 32, 34, 37,115, 42,\n     60, 34, 44, 32, 34, 60, 34, 41, 10, 10, 32,108,111, 99, 97,\n    108, 32,100,101,102, 98, 44,116,109,112,100,101,102, 10, 32,\n    100,101,102, 98, 44, 95, 44,116,109,112,100,101,102, 32, 61,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,115, 44,\n     32, 34, 40, 61, 46, 42, 41, 36, 34, 41, 10, 32,105,102, 32,\n    100,101,102, 98, 32,116,104,101,110, 10, 32,  9,115, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44,\n     32, 34, 61, 46, 42, 36, 34, 44, 32, 34, 34, 41, 10, 32,101,\n    108,115,101, 10, 32,  9,116,109,112,100,101,102, 32, 61, 32,\n     39, 39, 10, 32,101,110,100, 10, 32,105,102, 32,107,105,110,\n    100, 32, 61, 61, 32, 34,118, 97,114, 34, 32,116,104,101,110,\n     10, 32, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101,\n     32,102,111,114,109, 58, 32,118,111,105,100, 10, 32, 32,105,\n    102, 32,115, 32, 61, 61, 32, 39, 39, 32,111,114, 32,115, 32,\n     61, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10,\n     32, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108,\n     97,114, 97,116,105,111,110,123,116,121,112,101, 32, 61, 32,\n     39,118,111,105,100, 39, 44, 32,107,105,110,100, 32, 61, 32,\n    107,105,110,100, 44, 32,105,115, 95,112, 97,114, 97,109,101,\n    116,101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101,\n    116,101,114,125, 10, 32, 32,101,110,100, 10, 32,101,110,100,\n     10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101,\n     32,102,111,114,109, 58, 32,109,111,100, 32,116,121,112,101,\n     42, 38, 32,110, 97,109,101, 10, 32,108,111, 99, 97,108, 32,\n    116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,\n    101,110,115, 40,115, 44, 39, 37, 42, 37,115, 42, 38, 39, 41,\n     10, 32,105,102, 32,116, 46,110, 32, 61, 61, 32, 50, 32,116,\n    104,101,110, 10, 32, 32,105,102, 32,107,105,110,100, 32, 61,\n     61, 32, 39,102,117,110, 99, 39, 32,116,104,101,110, 10, 32,\n     32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,\n    105,100, 32,102,117,110, 99,116,105,111,110, 32,114,101,116,\n    117,114,110, 32,116,121,112,101, 58, 32, 34, 46, 46,115, 41,\n     10, 32, 32,101,110,100, 10, 32, 32, 45, 45,108,111, 99, 97,\n    108, 32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91, 49,\n     93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,111,\n     99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95, 99,\n     95,116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, 37,\n    115, 43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32, 95,\n     68,101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32,\n     32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,\n    109,112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, 61,\n     32, 39, 42, 39, 44, 10, 32, 32, 32,114,101,116, 32, 61, 32,\n     39, 38, 39, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32,\n     61, 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108,\n     97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,116, 98, 44,\n     32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116,121,112,\n    101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,\n    109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44,\n     49, 44,109, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,105,115,\n     95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,115,\n     95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,\n    107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125,\n     10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,\n    107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,111,100,\n     32,116,121,112,101, 42, 42, 32,110, 97,109,101, 10, 32,116,\n     32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,\n    110,115, 40,115, 44, 39, 37, 42, 37,115, 42, 37, 42, 39, 41,\n     10, 32,105,102, 32,116, 46,110, 32, 61, 61, 32, 50, 32,116,\n    104,101,110, 10, 32, 32,105,102, 32,107,105,110,100, 32, 61,\n     61, 32, 39,102,117,110, 99, 39, 32,116,104,101,110, 10, 32,\n     32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,\n    105,100, 32,102,117,110, 99,116,105,111,110, 32,114,101,116,\n    117,114,110, 32,116,121,112,101, 58, 32, 34, 46, 46,115, 41,\n     10, 32, 32,101,110,100, 10, 32, 32, 45, 45,108,111, 99, 97,\n    108, 32,109, 32, 61, 32,115,112,108,105,116, 40,116, 91, 49,\n     93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,111,\n     99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 95, 99,\n     95,116,111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, 37,\n    115, 43, 39, 41, 10, 32, 32,114,101,116,117,114,110, 32, 95,\n     68,101, 99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32,\n     32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,\n    109,112,100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, 61,\n     32, 39, 42, 39, 44, 10, 32, 32, 32,114,101,116, 32, 61, 32,\n     39, 42, 39, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32,\n     61, 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108,\n     97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,116, 98, 44,\n     32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116,121,112,\n    101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,\n    109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44,\n     49, 44,109, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,105,115,\n     95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,115,\n     95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,\n    107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125,\n     10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,\n    107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,111,100,\n     32,116,121,112,101, 38, 32,110, 97,109,101, 10, 32,116, 32,\n     61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,\n    115, 40,115, 44, 39, 38, 39, 41, 10, 32,105,102, 32,116, 46,\n    110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, 32, 32, 45,\n     45,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,\n    116, 40,116, 91, 49, 93, 44, 39, 37,115, 37,115, 42, 39, 41,\n     10, 32, 32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,\n    108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,116, 91,\n     49, 93, 44, 39, 37,115, 43, 39, 41, 10, 32, 32,114,101,116,\n    117,114,110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,\n    110,123, 10, 32, 32, 32,110, 97,109,101, 32, 61, 32,116, 91,\n     50, 93, 46, 46,116,109,112,100,101,102, 44, 10, 32, 32, 32,\n    112,116,114, 32, 61, 32, 39, 38, 39, 44, 10, 32, 32, 32, 45,\n     45,116,121,112,101, 32, 61, 32,114,101, 98,117,105,108,100,\n     95,116,101,109,112,108, 97,116,101, 40,109, 91,109, 46,110,\n     93, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41, 44, 10,\n     32, 32, 32,116,121,112,101, 32, 61, 32,109, 91,109, 46,110,\n     93, 44, 10, 32, 32, 32,109,111,100, 32, 61, 32, 99,111,110,\n     99, 97,116, 40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 44,\n     10, 32, 32, 32,105,115, 95,112, 97,114, 97,109,101,116,101,\n    114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101,116,101,\n    114, 44, 10, 32, 32, 32,107,105,110,100, 32, 61, 32,107,105,\n    110,100, 10, 32, 32,125, 10, 32,101,110,100, 10, 10, 32, 45,\n     45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,111,114,\n    109, 58, 32,109,111,100, 32,116,121,112,101, 42, 32,110, 97,\n    109,101, 10, 32,108,111, 99, 97,108, 32,115, 49, 32, 61, 32,\n    103,115,117, 98, 40,115, 44, 34, 40, 37, 98, 92, 91, 92, 93,\n     41, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,110, 41,\n     32,114,101,116,117,114,110, 32,103,115,117, 98, 40,110, 44,\n     39, 37, 42, 39, 44, 39, 92, 49, 39, 41, 32,101,110,100, 41,\n     10, 32,116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,\n    111,107,101,110,115, 40,115, 49, 44, 39, 37, 42, 39, 41, 10,\n     32,105,102, 32,116, 46,110, 32, 61, 61, 32, 50, 32,116,104,\n    101,110, 10, 32, 32,116, 91, 50, 93, 32, 61, 32,103,115,117,\n     98, 40,116, 91, 50, 93, 44, 39, 92, 49, 39, 44, 39, 37, 42,\n     39, 41, 32, 45, 45, 32,114,101,115,116,111,114,101, 32, 42,\n     32,105,110, 32,100,105,109,101,110,115,105,111,110, 32,101,\n    120,112,114,101,115,115,105,111,110, 10, 32, 32, 45, 45,108,\n    111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,116, 40,\n    116, 91, 49, 93, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32,\n     32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,\n    116, 95, 99, 95,116,111,107,101,110,115, 40,116, 91, 49, 93,\n     44, 39, 37,115, 43, 39, 41, 10, 32, 32,114,101,116,117,114,\n    110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,123,\n     10, 32, 32, 32,110, 97,109,101, 32, 61, 32,116, 91, 50, 93,\n     46, 46,116,109,112,100,101,102, 44, 10, 32, 32, 32,112,116,\n    114, 32, 61, 32, 39, 42, 39, 44, 10, 32, 32, 32,116,121,112,\n    101, 32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,\n     45, 45,116,121,112,101, 32, 61, 32,114,101, 98,117,105,108,\n    100, 95,116,101,109,112,108, 97,116,101, 40,109, 91,109, 46,\n    110, 93, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41, 44,\n     10, 32, 32, 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,\n    116, 40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 32, 32, 32,\n     44, 10, 32, 32, 32,105,115, 95,112, 97,114, 97,109,101,116,\n    101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101,116,\n    101,114, 44, 10, 32, 32, 32,107,105,110,100, 32, 61, 32,107,\n    105,110,100, 10, 32, 32,125, 10, 32,101,110,100, 10, 10, 32,\n    105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,118, 97,114,\n     39, 32,116,104,101,110, 10, 32, 32, 45, 45, 32, 99,104,101,\n     99,107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,111,\n    100, 32,116,121,112,101, 32,110, 97,109,101, 10, 32, 32, 45,\n     45,116, 32, 61, 32,115,112,108,105,116, 40,115, 44, 39, 37,\n    115, 37,115, 42, 39, 41, 10, 32, 32,116, 32, 61, 32,115,112,\n    108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44,\n     39, 37,115, 43, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,\n    118, 10, 32, 32,105,102, 32,102,105,110,100,116,121,112,101,\n     40,116, 91,116, 46,110, 93, 41, 32,116,104,101,110, 32,118,\n     32, 61, 32, 99,114,101, 97,116,101, 95,118, 97,114,110, 97,\n    109,101, 40, 41, 32,101,108,115,101, 32,118, 32, 61, 32,116,\n     91,116, 46,110, 93, 59, 32,116, 46,110, 32, 61, 32,116, 46,\n    110, 45, 49, 32,101,110,100, 10, 32, 32,114,101,116,117,114,\n    110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,123,\n     10, 32, 32, 32,110, 97,109,101, 32, 61, 32,118, 46, 46,116,\n    109,112,100,101,102, 44, 10, 32, 32, 32, 45, 45,116,121,112,\n    101, 32, 61, 32,114,101, 98,117,105,108,100, 95,116,101,109,\n    112,108, 97,116,101, 40,116, 91,116, 46,110, 93, 44, 32,116,\n     98, 44, 32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,116,\n    121,112,101, 32, 61, 32,116, 91,116, 46,110, 93, 44, 10, 32,\n     32, 32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,\n    116, 44, 49, 44,116, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,\n    105,115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,\n    105,115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32,\n     32, 32,107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32,\n     32,125, 10, 10, 32,101,108,115,101, 32, 45, 45, 32,107,105,\n    110,100, 32, 61, 61, 32, 34,102,117,110, 99, 34, 10, 10, 32,\n     32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,\n    111,114,109, 58, 32,109,111,100, 32,116,121,112,101, 32,110,\n     97,109,101, 10, 32, 32, 45, 45,116, 32, 61, 32,115,112,108,\n    105,116, 40,115, 44, 39, 37,115, 37,115, 42, 39, 41, 10, 32,\n     32,116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,\n    107,101,110,115, 40,115, 44, 39, 37,115, 43, 39, 41, 10, 32,\n     32,108,111, 99, 97,108, 32,118, 32, 61, 32,116, 91,116, 46,\n    110, 93, 32, 32, 45, 45, 32,108, 97,115,116, 32,119,111,114,\n    100, 32,105,115, 32,116,104,101, 32,102,117,110, 99,116,105,\n    111,110, 32,110, 97,109,101, 10, 32, 32,108,111, 99, 97,108,\n     32,116,112, 44,109,100, 10, 32, 32,105,102, 32,116, 46,110,\n     62, 49, 32,116,104,101,110, 10, 32, 32, 32,116,112, 32, 61,\n     32,116, 91,116, 46,110, 45, 49, 93, 10, 32, 32, 32,109,100,\n     32, 61, 32, 99,111,110, 99, 97,116, 40,116, 44, 49, 44,116,\n     46,110, 45, 50, 41, 10, 32, 32,101,110,100, 10, 32, 32, 45,\n     45,105,102, 32,116,112, 32,116,104,101,110, 32,116,112, 32,\n     61, 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108,\n     97,116,101, 40,116,112, 44, 32,116, 98, 44, 32,116,105,109,\n    112,108, 41, 32,101,110,100, 10, 32, 32,114,101,116,117,114,\n    110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,123,\n     10, 32, 32, 32,110, 97,109,101, 32, 61, 32,118, 44, 10, 32,\n     32, 32,116,121,112,101, 32, 61, 32,116,112, 44, 10, 32, 32,\n     32,109,111,100, 32, 61, 32,109,100, 44, 10, 32, 32, 32,105,\n    115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,\n    115, 95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32,\n     32,107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,\n    125, 10, 32,101,110,100, 10, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/declaration.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,118, 97,114,105, 97,\n     98,108,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,\n     32, 86, 97,114,105, 97, 98,108,101, 32, 99,108, 97,115,115,\n     10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,\n     97, 32,101,120,116,101,114,110, 32,118, 97,114,105, 97, 98,\n    108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99, 32,\n    109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108, 97,\n    115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32, 97,\n    108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,101,\n    110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114, 97,\n    116,105,111,110, 46, 10, 99,108, 97,115,115, 86, 97,114,105,\n     97, 98,108,101, 32, 61, 32,123, 10, 32, 95,103,101,116, 32,\n     61, 32,123,125, 44, 32, 32, 32, 45, 45, 32,109, 97,112,112,\n    101,100, 32,103,101,116, 32,102,117,110, 99,116,105,111,110,\n    115, 10, 32, 95,115,101,116, 32, 61, 32,123,125, 44, 32, 32,\n     32, 45, 45, 32,109, 97,112,112,101,100, 32,115,101,116, 32,\n    102,117,110, 99,116,105,111,110,115, 10,125, 10, 99,108, 97,\n    115,115, 86, 97,114,105, 97, 98,108,101, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 86, 97,114,105,\n     97, 98,108,101, 10,115,101,116,109,101,116, 97,116, 97, 98,\n    108,101, 40, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,\n    101, 44, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,\n    109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110,\n     32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 86, 97,114,105, 97, 98,108,101,123, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,\n     46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,\n    109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,105,102, 32,\n    115,101,108,102, 46,100,105,109, 32,116,104,101,110, 32,112,\n    114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100,\n    105,109, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,\n    105,109, 46, 46, 34, 39, 44, 34, 41, 32,101,110,100, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    100,101,102, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,\n     46,100,101,102, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,114,101,\n    116, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,114,\n    101,116, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,\n    116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,\n    108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 71,\n    101,110,101,114, 97,116,101,115, 32, 67, 32,102,117,110, 99,\n    116,105,111,110, 32,110, 97,109,101, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,\n    108,101, 58, 99,102,117,110, 99,110, 97,109,101, 32, 40,112,\n    114,101,102,105,120, 41, 10, 32,108,111, 99, 97,108, 32,112,\n     97,114,101,110,116, 32, 61, 32, 34, 34, 10, 32,108,111, 99,\n     97,108, 32,117,110,115,105,103,110,101,100, 32, 61, 32, 34,\n     34, 10, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32,\n     34, 34, 10, 10, 32,108,111, 99, 97,108, 32,112, 32, 61, 32,\n    115,101,108,102, 58,105,110,109,111,100,117,108,101, 40, 41,\n     32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109,101,\n    115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108,102,\n     58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32,105,102,\n     32,112, 32,116,104,101,110, 10, 32,  9,105,102, 32,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46, 99,108, 97,115,115,\n    116,121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39,\n     32,116,104,101,110, 10,  9,  9,112, 97,114,101,110,116, 32,\n     61, 32, 34, 95, 34, 32, 46, 46, 32,115,101,108,102, 46,112,\n     97,114,101,110,116, 46,116,121,112,101, 10,  9,101,108,115,\n    101, 10,  9, 32, 32,112, 97,114,101,110,116, 32, 61, 32, 34,\n     95, 34, 32, 46, 46, 32,112, 10,  9,101,110,100, 10, 32,101,\n    110,100, 10, 10, 32,105,102, 32,115,116,114,102,105,110,100,\n     40,115,101,108,102, 46,109,111,100, 44, 34, 40,117,110,115,\n    105,103,110,101,100, 41, 34, 41, 32,116,104,101,110, 10, 32,\n     32,117,110,115,105,103,110,101,100, 32, 61, 32, 34, 95,117,\n    110,115,105,103,110,101,100, 34, 10, 32,101,110,100, 10, 10,\n     32,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61,\n     32, 34, 42, 34, 32,116,104,101,110, 32,112,116,114, 32, 61,\n     32, 34, 95,112,116,114, 34, 10, 32,101,108,115,101,105,102,\n     32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 34, 38,\n     34, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 34, 95,\n    114,101,102, 34, 10, 32,101,110,100, 10, 10, 32,108,111, 99,\n     97,108, 32,110, 97,109,101, 32, 61, 32, 32,112,114,101,102,\n    105,120, 32, 46, 46, 32,112, 97,114,101,110,116, 32, 46, 46,\n     32,117,110,115,105,103,110,101,100, 32, 46, 46, 32, 34, 95,\n     34, 32, 46, 46, 32,103,115,117, 98, 40,115,101,108,102, 46,\n    108,110, 97,109,101, 32,111,114, 32,115,101,108,102, 46,110,\n     97,109,101, 44, 34, 46, 42, 58, 58, 34, 44, 34, 34, 41, 32,\n     46, 46, 32,112,116,114, 10, 10,  9,110, 97,109,101, 32, 61,\n     32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116,101,\n     40,110, 97,109,101, 41, 10, 32,114,101,116,117,114,110, 32,\n    110, 97,109,101, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,\n    104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97,\n     32,118, 97,114,105, 97, 98,108,101, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,\n    108,101, 58,105,115,118, 97,114,105, 97, 98,108,101, 32, 40,\n     41, 10, 32,114,101,116,117,114,110, 32,116,114,117,101, 10,\n    101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,118, 97,114,\n    105, 97, 98,108,101, 32,118, 97,108,117,101, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105,\n     97, 98,108,101, 58,103,101,116,118, 97,108,117,101, 32, 40,\n     99,108, 97,115,115, 44,115,116, 97,116,105, 99, 44, 32,112,\n    114,111,112, 95,103,101,116, 41, 10, 10,  9,108,111, 99, 97,\n    108, 32,110, 97,109,101, 10,  9,105,102, 32,112,114,111,112,\n     95,103,101,116, 32,116,104,101,110, 10, 10,  9,  9,110, 97,\n    109,101, 32, 61, 32,112,114,111,112, 95,103,101,116, 46, 46,\n     34, 40, 41, 34, 10,  9,101,108,115,101, 10,  9,  9,110, 97,\n    109,101, 32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10,\n      9,101,110,100, 10, 10,  9,105,102, 32, 99,108, 97,115,115,\n     32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,\n    110, 10,  9, 32,114,101,116,117,114,110, 32,115,101,108,102,\n     46,112, 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39,\n     58, 58, 39, 46, 46,110, 97,109,101, 10,  9,101,108,115,101,\n    105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10,  9,\n     32,114,101,116,117,114,110, 32, 39,115,101,108,102, 45, 62,\n     39, 46, 46,110, 97,109,101, 10,  9,101,108,115,101, 10,  9,\n     32,114,101,116,117,114,110, 32,110, 97,109,101, 10,  9,101,\n    110,100, 10,101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,\n    118, 97,114,105, 97, 98,108,101, 32,112,111,105,110,116,101,\n    114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101,\n     58,103,101,116,112,111,105,110,116,101,114,118, 97,108,117,\n    101, 32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99,\n     41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,\n     32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,\n    114,101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39,\n     58, 58,112, 39, 10, 32,101,108,115,101,105,102, 32, 99,108,\n     97,115,115, 32,116,104,101,110, 10, 32, 32,114,101,116,117,\n    114,110, 32, 39,115,101,108,102, 45, 62,112, 39, 10, 32,101,\n    108,115,101, 10, 32, 32,114,101,116,117,114,110, 32, 39,112,\n     39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n     87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,102,\n    117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,\n    101, 58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 10, 32,\n    108,111, 99, 97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,\n    101,108,102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10,\n      9,108,111, 99, 97,108, 32,112,114,111,112, 95,103,101,116,\n     44,112,114,111,112, 95,115,101,116, 10,  9,105,102, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,102,\n     46,109,111,100, 44, 32, 39,116,111,108,117, 97, 95,112,114,\n    111,112,101,114,116,121, 39, 41, 32,116,104,101,110, 10, 10,\n      9,  9,108,111, 99, 97,108, 32, 95, 44, 95, 44,116,121,112,\n    101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100,\n     40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108,\n    117, 97, 95,112,114,111,112,101,114,116,121, 95, 95, 40, 91,\n     94, 37,115, 93, 42, 41, 34, 41, 10,  9,  9,116,121,112,101,\n     32, 61, 32,116,121,112,101, 32,111,114, 32, 34,100,101,102,\n     97,117,108,116, 34, 10,  9,  9,112,114,111,112, 95,103,101,\n    116, 44,112,114,111,112, 95,115,101,116, 32, 61, 32,103,101,\n    116, 95,112,114,111,112,101,114,116,121, 95,109,101,116,104,\n    111,100,115, 40,116,121,112,101, 44, 32,115,101,108,102, 46,\n    110, 97,109,101, 41, 10,  9,  9,115,101,108,102, 46,109,111,\n    100, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98,\n     40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108,\n    117, 97, 95,112,114,111,112,101,114,116,121, 91, 94, 37,115,\n     93, 42, 34, 44, 32, 34, 34, 41, 10,  9,101,110,100, 10, 10,\n     32, 45, 45, 32,103,101,116, 32,102,117,110, 99,116,105,111,\n    110, 32, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 10, 32,105,102, 32, 99,108, 97,115,115,\n     32,116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40,\n     34, 47, 42, 32,103,101,116, 32,102,117,110, 99,116,105,111,\n    110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34,\n     32,111,102, 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,\n    115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101,\n     10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,103,\n    101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,115,\n    101,108,102, 46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41,\n     10, 32,101,110,100, 10, 32,115,101,108,102, 46, 99,103,101,\n    116,110, 97,109,101, 32, 61, 32,115,101,108,102, 58, 99,102,\n    117,110, 99,110, 97,109,101, 40, 34,116,111,108,117, 97, 95,\n    103,101,116, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34,\n     35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68,\n     73, 83, 65, 66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46,\n     99,103,101,116,110, 97,109,101, 41, 10, 32,111,117,116,112,\n    117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,105,110,\n    116, 34, 44,115,101,108,102, 46, 99,103,101,116,110, 97,109,\n    101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,\n    116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116,\n    112,117,116, 40, 34,123, 34, 41, 10, 10, 32, 45, 45, 32,100,\n    101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,102,\n     32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111, 99, 97,\n    108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,\n    100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41,\n     39, 41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,\n    100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,\n    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,\n    121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32, 61,\n     32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 40,\n     39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,\n    121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111,\n     99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,103,\n    101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110, 40,\n    115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,\n    101, 41, 10, 32, 32,111,117,116,112,117,116, 40,116,111, 95,\n    102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44,\n     49, 44, 48, 41, 59, 39, 41, 10, 32,101,108,115,101,105,102,\n     32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,\n     95, 44, 95, 44,115,101,108,102, 46,109,111,100, 32, 61, 32,\n    115,116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,\n    100, 44, 39, 94, 37,115, 42,115,116, 97,116,105, 99, 37,115,\n     37,115, 42, 40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10,\n     10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,\n    102, 32,118, 97,108,117,101, 10, 32,105,102, 32, 99,108, 97,\n    115,115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,\n    110,105,108, 32,116,104,101,110, 10,  9, 32,111,117,116,112,\n    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32,\n     40, 33,115,101,108,102, 41, 32,116,111,108,117, 97, 95,101,\n    114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34,105,\n    110,118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92, 39,\n     32,105,110, 32, 97, 99, 99,101,115,115,105,110,103, 32,118,\n     97,114,105, 97, 98,108,101, 32, 92, 39, 39, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44, 78,\n     85, 76, 76, 41, 59, 39, 41, 59, 10,  9,  9,111,117,116,112,\n    117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10,\n     32,101,110,100, 10, 10, 32, 45, 45, 32,114,101,116,117,114,\n    110, 32,118, 97,108,117,101, 10, 32,105,102, 32,115,116,114,\n    105,110,103, 46,102,105,110,100, 40,115,101,108,102, 46,109,\n    111,100, 44, 32, 39,116,111,108,117, 97, 95,105,110,104,101,\n    114,105,116,115, 39, 41, 32,116,104,101,110, 10,  9,108,111,\n     99, 97,108, 32,112,117,115,104, 95,102,117,110, 99, 32, 61,\n     32,103,101,116, 95,112,117,115,104, 95,102,117,110, 99,116,\n    105,111,110, 40,115,101,108,102, 46,116,121,112,101, 41, 10,\n     32,  9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101,\n    102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110,\n     39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32, 39,\n     44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,\n    108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41,115,116,\n     97,116,105, 99, 95, 99, 97,115,116, 60, 39, 46, 46,115,101,\n    108,102, 46,116,121,112,101, 46, 46, 39, 42, 62, 40,115,101,\n    108,102, 41, 44, 32, 34, 39, 44,115,101,108,102, 46,116,121,\n    112,101, 44, 39, 34, 41, 59, 39, 41, 10,  9,111,117,116,112,\n    117,116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10,  9,\n    111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,112,117,115,\n    104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95,\n     83, 44, 40,118,111,105,100, 42, 41, 40, 40, 39, 46, 46,115,\n    101,108,102, 46,116,121,112,101, 46, 46, 39, 42, 41,115,101,\n    108,102, 41, 44, 32, 34, 39, 44,115,101,108,102, 46,116,121,\n    112,101, 44, 39, 34, 41, 59, 39, 41, 10,  9,111,117,116,112,\n    117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10,\n     32,101,108,115,101, 10,  9,108,111, 99, 97,108, 32,116, 44,\n     99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 10,  9,105,102, 32,116, 32,\n    116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40, 39,\n     32, 32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,\n    116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39,\n     44, 99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 58,103,\n    101,116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,\n    116, 97,116,105, 99, 44,112,114,111,112, 95,103,101,116, 41,\n     46, 46, 39, 41, 59, 39, 41, 10,  9,101,108,115,101, 10,  9,\n      9,108,111, 99, 97,108, 32,112,117,115,104, 95,102,117,110,\n     99, 32, 61, 32,103,101,116, 95,112,117,115,104, 95,102,117,\n    110, 99,116,105,111,110, 40,115,101,108,102, 46,116,121,112,\n    101, 41, 10,  9,  9,116, 32, 61, 32,115,101,108,102, 46,116,\n    121,112,101, 10,  9,  9,105,102, 32,115,101,108,102, 46,112,\n    116,114, 32, 61, 61, 32, 39, 38, 39, 32,111,114, 32,115,101,\n    108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104,\n    101,110, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32,\n     32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,\n    116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41,\n     38, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108,\n    117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99,\n     44,112,114,111,112, 95,103,101,116, 41, 46, 46, 39, 44, 34,\n     39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,101,108,\n    115,101, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32,\n     32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,\n    116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41,\n     39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108,117,\n    101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 44,\n    112,114,111,112, 95,103,101,116, 41, 46, 46, 39, 44, 34, 39,\n     44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,101,110,100,\n     10,  9,101,110,100, 10, 32,101,110,100, 10, 32,111,117,116,\n    112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 49, 59,\n     39, 41, 10, 32,111,117,116,112,117,116, 40, 39,125, 39, 41,\n     10, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,\n    102, 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10,\n     32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, 10,\n     32, 45, 45, 32,115,101,116, 32,102,117,110, 99,116,105,111,\n    110, 32, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 10, 32,105,102, 32,110,111,116, 32, 40,\n    115,116,114,102,105,110,100, 40,115,101,108,102, 46,116,121,\n    112,101, 44, 39, 99,111,110,115,116, 37,115, 43, 39, 41, 32,\n    111,114, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    115,101,108,102, 46,109,111,100, 44, 32, 39,116,111,108,117,\n     97, 95,114,101, 97,100,111,110,108,121, 39, 41, 32,111,114,\n     32,115,116,114,105,110,103, 46,102,105,110,100, 40,115,101,\n    108,102, 46,109,111,100, 44, 32, 39,116,111,108,117, 97, 95,\n    105,110,104,101,114,105,116,115, 39, 41, 41, 32, 32,116,104,\n    101,110, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,116,\n    104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 34,\n     47, 42, 32,115,101,116, 32,102,117,110, 99,116,105,111,110,\n     58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34, 32,\n    111,102, 32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,115,\n    115, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,101,108,115,101,\n     10, 32, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,\n    115,101,116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,\n    115,101,108,102, 46,110, 97,109,101, 44, 34, 32, 42, 47, 34,\n     41, 10, 32, 32,101,110,100, 10, 32, 32,115,101,108,102, 46,\n     99,115,101,116,110, 97,109,101, 32, 61, 32,115,101,108,102,\n     58, 99,102,117,110, 99,110, 97,109,101, 40, 34,116,111,108,\n    117, 97, 95,115,101,116, 34, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 34, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, 34, 46, 46,115,\n    101,108,102, 46, 99,115,101,116,110, 97,109,101, 41, 10, 32,\n     32,111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,116,\n    105, 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,115,\n    101,116,110, 97,109,101, 44, 34, 40,108,117, 97, 95, 83,116,\n     97,116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, 41,\n     10, 32, 32,111,117,116,112,117,116, 40, 34,123, 34, 41, 10,\n     10, 32, 32, 45, 45, 32,100,101, 99,108, 97,114,101, 32,115,\n    101,108,102, 44, 32,105,102, 32,116,104,101, 32, 99, 97,115,\n    101, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,\n    100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,\n    104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 39, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,\n    116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32,\n     61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116, 40,\n     39, 40, 39, 44,115,101,108,102, 46,112, 97,114,101,110,116,\n     46,116,121,112,101, 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,\n     32,108,111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32,\n     61, 32,103,101,116, 95,116,111, 95,102,117,110, 99,116,105,\n    111,110, 40,115,101,108,102, 46,112, 97,114,101,110,116, 46,\n    116,121,112,101, 41, 10, 32, 32, 32,111,117,116,112,117,116,\n     40,116,111, 95,102,117,110, 99, 44, 39, 40,116,111,108,117,\n     97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 32, 32, 32,\n     45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 32,118,\n     97,108,117,101, 10,  9,  9,101,110,100, 10, 32, 32, 45, 45,\n     32, 99,104,101, 99,107, 32,116,121,112,101,115, 10,  9,  9,\n    111,117,116,112,117,116, 40, 39, 35,105,102,110,100,101,102,\n     32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,\n    110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39, 32,\n     32,116,111,108,117, 97, 95, 69,114,114,111,114, 32,116,111,\n    108,117, 97, 95,101,114,114, 59, 39, 41, 10, 32, 32,105,102,\n     32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116, 97,116,\n    105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32, 40,\n     33,115,101,108,102, 41, 32,116,111,108,117, 97, 95,101,114,\n    114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34,105,110,\n    118, 97,108,105,100, 32, 92, 39,115,101,108,102, 92, 39, 32,\n    105,110, 32, 97, 99, 99,101,115,115,105,110,103, 32,118, 97,\n    114,105, 97, 98,108,101, 32, 92, 39, 39, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44, 78, 85,\n     76, 76, 41, 59, 39, 41, 59, 10, 32, 32,101,108,115,101,105,\n    102, 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32,\n     32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,111,100, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46,\n    109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,116,105, 99,\n     37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10, 32, 32,101,\n    110,100, 10, 10, 32, 32, 45, 45, 32, 99,104,101, 99,107, 32,\n    118, 97,114,105, 97, 98,108,101, 32,116,121,112,101, 10, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32,105,102, 32, 40,\n     39, 46, 46,115,101,108,102, 58,111,117,116, 99,104,101, 99,\n    107,116,121,112,101, 40, 50, 41, 46, 46, 39, 41, 39, 41, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,\n    108,117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97,\n     95, 83, 44, 34, 35,118,105,110,118, 97,108,105,100, 32,116,\n    121,112,101, 32,105,110, 32,118, 97,114,105, 97, 98,108,101,\n     32, 97,115,115,105,103,110,109,101,110,116, 46, 34, 44, 38,\n    116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10,  9,\n      9,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102,\n     92,110, 39, 41, 10, 10, 32, 32, 45, 45, 32, 97,115,115,105,\n    103,110, 32,118, 97,108,117,101, 10,  9,  9,108,111, 99, 97,\n    108, 32,100,101,102, 32, 61, 32, 48, 10,  9,  9,105,102, 32,\n    115,101,108,102, 46,100,101,102, 32,126, 61, 32, 39, 39, 32,\n    116,104,101,110, 32,100,101,102, 32, 61, 32,115,101,108,102,\n     46,100,101,102, 32,101,110,100, 10,  9,  9,105,102, 32,115,\n    101,108,102, 46,116,121,112,101, 32, 61, 61, 32, 39, 99,104,\n     97,114, 42, 39, 32, 97,110,100, 32,115,101,108,102, 46,100,\n    105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32, 45,\n     45, 32,105,115, 32,115,116,114,105,110,103, 10,  9,  9, 32,\n    111,117,116,112,117,116, 40, 39, 32,115,116,114,110, 99,112,\n    121, 40, 39, 41, 10,  9,  9,  9,105,102, 32, 99,108, 97,115,\n    115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,\n    101,110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40,115,\n    101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101,\n     46, 46, 39, 58, 58, 39, 46, 46,115,101,108,102, 46,110, 97,\n    109,101, 41, 10,  9,  9,  9,101,108,115,101,105,102, 32, 99,\n    108, 97,115,115, 32,116,104,101,110, 10,  9,  9,  9,  9,111,\n    117,116,112,117,116, 40, 39,115,101,108,102, 45, 62, 39, 46,\n     46,115,101,108,102, 46,110, 97,109,101, 41, 10,  9,  9,  9,\n    101,108,115,101, 10,  9,  9,  9,  9,111,117,116,112,117,116,\n     40,115,101,108,102, 46,110, 97,109,101, 41, 10,  9,  9,  9,\n    101,110,100, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39,\n     44,116,111,108,117, 97, 95,116,111,115,116,114,105,110,103,\n     40,116,111,108,117, 97, 95, 83, 44, 50, 44, 39, 44,100,101,\n    102, 44, 39, 41, 44, 39, 44,115,101,108,102, 46,100,105,109,\n     44, 39, 45, 49, 41, 59, 39, 41, 10,  9,  9,101,108,115,101,\n     10,  9,  9,  9,108,111, 99, 97,108, 32,112,116,114, 32, 61,\n     32, 39, 39, 10,  9,  9,  9,105,102, 32,115,101,108,102, 46,\n    112,116,114,126, 61, 39, 39, 32,116,104,101,110, 32,112,116,\n    114, 32, 61, 32, 39, 42, 39, 32,101,110,100, 10,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39, 32, 39, 41, 10,  9,  9,  9,\n    108,111, 99, 97,108, 32,110, 97,109,101, 32, 61, 32,112,114,\n    111,112, 95,115,101,116, 32,111,114, 32,115,101,108,102, 46,\n    110, 97,109,101, 10,  9,  9,  9,105,102, 32, 99,108, 97,115,\n    115, 32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,\n    101,110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40,115,\n    101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101,\n     46, 46, 39, 58, 58, 39, 46, 46,110, 97,109,101, 41, 10,  9,\n      9,  9,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32,\n    116,104,101,110, 10,  9,  9,  9,  9,111,117,116,112,117,116,\n     40, 39,115,101,108,102, 45, 62, 39, 46, 46,110, 97,109,101,\n     41, 10,  9,  9,  9,101,108,115,101, 10,  9,  9,  9,  9,111,\n    117,116,112,117,116, 40,110, 97,109,101, 41, 10,  9,  9,  9,\n    101,110,100, 10,  9,  9,  9,108,111, 99, 97,108, 32,116, 32,\n     61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,\n    116,121,112,101, 41, 10,  9,  9,  9,105,102, 32,112,114,111,\n    112, 95,115,101,116, 32,116,104,101,110, 10,  9,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39, 40, 39, 41, 10,  9,  9,  9,\n    101,108,115,101, 10,  9,  9,  9,  9,111,117,116,112,117,116,\n     40, 39, 32, 61, 32, 39, 41, 10,  9,  9,  9,101,110,100, 10,\n      9,  9,  9,105,102, 32,110,111,116, 32,116, 32, 97,110,100,\n     32,112,116,114, 61, 61, 39, 39, 32,116,104,101,110, 32,111,\n    117,116,112,117,116, 40, 39, 42, 39, 41, 32,101,110,100, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39, 40, 40, 39, 44,\n    115,101,108,102, 46,109,111,100, 44,115,101,108,102, 46,116,\n    121,112,101, 41, 10,  9,  9,  9,105,102, 32,110,111,116, 32,\n    116, 32,116,104,101,110, 10,  9,  9,  9,  9,111,117,116,112,\n    117,116, 40, 39, 42, 39, 41, 10,  9,  9,  9,101,110,100, 10,\n      9,  9,  9,111,117,116,112,117,116, 40, 39, 41, 32, 39, 41,\n     10,  9,  9,  9,105,102, 32,116, 32,116,104,101,110, 10,  9,\n      9,  9,  9,105,102, 32,105,115,101,110,117,109, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 32,116,104,101,110, 10,  9,\n      9,  9,  9,  9,111,117,116,112,117,116, 40, 39, 40,105,110,\n    116, 41, 32, 39, 41, 10,  9,  9,  9,  9,101,110,100, 10,  9,\n      9,  9,  9,111,117,116,112,117,116, 40, 39,116,111,108,117,\n     97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,108,117,\n     97, 95, 83, 44, 50, 44, 39, 44,100,101,102, 44, 39, 41, 41,\n     39, 41, 10,  9,  9,  9,101,108,115,101, 10,  9,  9,  9,  9,\n    108,111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61,\n     32,103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111,\n    110, 40,115,101,108,102, 46,116,121,112,101, 41, 10,  9,  9,\n      9,  9,111,117,116,112,117,116, 40,116,111, 95,102,117,110,\n     99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 39,\n     44,100,101,102, 44, 39, 41, 41, 39, 41, 10,  9,  9,  9,101,\n    110,100, 10,  9,  9,  9,105,102, 32,112,114,111,112, 95,115,\n    101,116, 32,116,104,101,110, 10,  9,  9,  9,  9,111,117,116,\n    112,117,116, 40, 34, 41, 34, 41, 10,  9,  9,  9,101,110,100,\n     10,  9,  9,  9,111,117,116,112,117,116, 40, 34, 59, 34, 41,\n     10,  9,  9,101,110,100, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41, 10,\n     32, 32,111,117,116,112,117,116, 40, 39,125, 39, 41, 10, 32,\n     32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102,\n     32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85,\n     65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10, 32,\n     32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32,\n    101,110,100, 10, 10,101,110,100, 10, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,\n    108,101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114,\n    101, 41, 10, 10,  9,105,102, 32,110,111,116, 32,115,101,108,\n    102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95,\n     97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,  9,\n      9,114,101,116,117,114,110, 10,  9,101,110,100, 10, 32,112,\n    114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39, 39, 10,\n     32,108,111, 99, 97,108, 32,112, 97,114,101,110,116, 32, 61,\n     32,115,101,108,102, 58,105,110,109,111,100,117,108,101, 40,\n     41, 32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109,\n    101,115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108,\n    102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 32,105,102,\n     32,110,111,116, 32,112, 97,114,101,110,116, 32,116,104,101,\n    110, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 86, 97,114,\n    105, 97, 98,108,101, 46, 95,119, 97,114,110,105,110,103, 61,\n     61,110,105,108, 32,116,104,101,110, 10, 32, 32, 32,119, 97,\n    114,110,105,110,103, 40, 34, 77, 97,112,112,105,110,103, 32,\n    118, 97,114,105, 97, 98,108,101, 32,116,111, 32,103,108,111,\n     98, 97,108, 32,109, 97,121, 32,100,101,103,114, 97,100,101,\n     32,112,101,114,102,111,114,109, 97,110, 99,101, 34, 41, 10,\n     32, 32, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,\n    101, 46, 95,119, 97,114,110,105,110,103, 32, 61, 32, 49, 10,\n     32, 32,101,110,100, 10, 32,101,110,100, 10, 32,105,102, 32,\n    115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 32,116,\n    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40,112,114,\n    101, 46, 46, 39,116,111,108,117, 97, 95,118, 97,114,105, 97,\n     98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46,\n     46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34,\n     44, 39, 46, 46,115,101,108,102, 46, 99,103,101,116,110, 97,\n    109,101, 46, 46, 39, 44, 39, 46, 46,115,101,108,102, 46, 99,\n    115,101,116,110, 97,109,101, 46, 46, 39, 41, 59, 39, 41, 10,\n     32,101,108,115,101, 10, 32, 32,111,117,116,112,117,116, 40,\n    112,114,101, 46, 46, 39,116,111,108,117, 97, 95,118, 97,114,\n    105, 97, 98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 34,\n     39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46,\n     39, 34, 44, 39, 46, 46,115,101,108,102, 46, 99,103,101,116,\n    110, 97,109,101, 46, 46, 39, 44, 78, 85, 76, 76, 41, 59, 39,\n     41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,\n     73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,\n    117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32,\n     95, 86, 97,114,105, 97, 98,108,101, 32, 40,116, 41, 10, 32,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44,\n     99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 41, 10,\n     32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,\n    117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,\n    111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,\n    120,112,101, 99,116,115, 32, 97, 32,115,116,114,105,110,103,\n     32,114,101,112,114,101,115,101,110,116,105,110,103, 32,116,\n    104,101, 32,118, 97,114,105, 97, 98,108,101, 32,100,101, 99,\n    108, 97,114, 97,116,105,111,110, 46, 10,102,117,110, 99,116,\n    105,111,110, 32, 86, 97,114,105, 97, 98,108,101, 32, 40,115,\n     41, 10, 32,114,101,116,117,114,110, 32, 95, 86, 97,114,105,\n     97, 98,108,101, 32, 40, 68,101, 99,108, 97,114, 97,116,105,\n    111,110, 40,115, 44, 39,118, 97,114, 39, 41, 41, 10,101,110,\n    100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/variable.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 97,114,114, 97,121,\n     32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,\n    101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32,\n     67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,\n    102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,\n    108, 32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32,\n     97,114,114, 97,121, 46,108,117, 97, 44,118, 32, 49, 46, 49,\n     32, 50, 48, 48, 48, 47, 49, 49, 47, 48, 54, 32, 50, 50, 58,\n     48, 51, 58, 53, 55, 32, 99,101,108,101,115, 32, 69,120,112,\n     32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,\n    101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119,\n     97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,\n    100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,\n    110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116,\n     46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,\n    114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,\n    101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110,\n     32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44,\n     32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,\n    104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,\n    103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,\n    100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44,\n     32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,\n    101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,\n    101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105,\n     99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 65,\n    114,114, 97,121, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,\n    101,112,114,101,115,101,110,116,115, 32, 97, 32,101,120,116,\n    101,114,110, 32, 97,114,114, 97,121, 32,118, 97,114,105, 97,\n     98,108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99,\n     32,109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108,\n     97,115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32,\n     97,108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,\n    101,110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114,\n     97,116,105,111,110, 46, 10, 99,108, 97,115,115, 65,114,114,\n     97,121, 32, 61, 32,123, 10,125, 10, 99,108, 97,115,115, 65,\n    114,114, 97,121, 46, 95, 95,105,110,100,101,120, 32, 61, 32,\n     99,108, 97,115,115, 65,114,114, 97,121, 10,115,101,116,109,\n    101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 65,\n    114,114, 97,121, 44, 99,108, 97,115,115, 68,101, 99,108, 97,\n    114, 97,116,105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,\n    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58,\n    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,\n    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 65,114,114, 97,121,123, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,\n     46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,\n    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,116,121,\n    112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,116,\n    121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,112,116,114,\n     32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,112,116,\n    114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, 32,\n     61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 32,100,101,102, 32, 32, 61,\n     32, 39, 34, 46, 46,115,101,108,102, 46,100,101,102, 46, 46,\n     34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 32,100,105,109, 32, 32, 61, 32, 39,\n     34, 46, 46,115,101,108,102, 46,100,105,109, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32,114,101,116, 32, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,114,101,116, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,\n    100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,\n    105,116, 32,105,115, 32, 97, 32,118, 97,114,105, 97, 98,108,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 65,114,114, 97,121, 58,105,115,118, 97,114,105, 97, 98,\n    108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,116,\n    114,117,101, 10,101,110,100, 10, 10, 10, 45, 45, 32,103,101,\n    116, 32,118, 97,114,105, 97, 98,108,101, 32,118, 97,108,117,\n    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 65,114,114, 97,121, 58,103,101,116,118, 97,108,117,101,\n     32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 41,\n     10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,\n    115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,114,\n    101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39, 58,\n     58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46,\n     39, 91,116,111,108,117, 97, 95,105,110,100,101,120, 93, 39,\n     10, 32,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32,\n    116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 39,\n    115,101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,\n    100,101,120, 93, 39, 10, 32,101,108,115,101, 10, 32, 32,114,\n    101,116,117,114,110, 32,115,101,108,102, 46,110, 97,109,101,\n     46, 46, 39, 91,116,111,108,117, 97, 95,105,110,100,101,120,\n     93, 39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45,\n     32, 87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,\n    102,117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58,\n    115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,108,111, 99,\n     97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,101,108,102,\n     58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32, 45, 45,\n     32,103,101,116, 32,102,117,110, 99,116,105,111,110, 32, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,\n    101,110, 10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42,\n     32,103,101,116, 32,102,117,110, 99,116,105,111,110, 58, 34,\n     44,115,101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102,\n     32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44,\n     34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,\n    111,117,116,112,117,116, 40, 34, 47, 42, 32,103,101,116, 32,\n    102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102,\n     46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,\n    110,100, 10, 32,115,101,108,102, 46, 99,103,101,116,110, 97,\n    109,101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110, 99,\n    110, 97,109,101, 40, 34,116,111,108,117, 97, 95,103,101,116,\n     34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102,\n    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,\n     66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99,103,101,\n    116,110, 97,109,101, 41, 10, 32,111,117,116,112,117,116, 40,\n     34, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 34, 44,\n    115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 44, 34,\n     40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,\n    117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116,112,117,116,\n     40, 34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34,\n     32,105,110,116, 32,116,111,108,117, 97, 95,105,110,100,101,\n    120, 59, 34, 41, 10, 10, 32, 45, 45, 32,100,101, 99,108, 97,\n    114,101, 32,115,101,108,102, 44, 32,105,102, 32,116,104,101,\n     32, 99, 97,115,101, 10, 32,108,111, 99, 97,108, 32, 95, 44,\n     95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,114,102,\n    105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94,\n     37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41, 10, 32,\n    105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116,\n     97,116,105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44,\n     39, 42, 39, 44, 39,115,101,108,102, 59, 39, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,112,117,\n    115,104,115,116,114,105,110,103, 40,116,111,108,117, 97, 95,\n     83, 44, 34, 46,115,101,108,102, 34, 41, 59, 39, 41, 10, 32,\n     32,111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,114,\n     97,119,103,101,116, 40,116,111,108,117, 97, 95, 83, 44, 49,\n     41, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32,115,101,108,102, 32, 61, 32, 39, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,112,\n     97,114,101,110,116, 46,116,121,112,101, 44, 39, 42, 41, 32,\n     39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,108,117,\n     97, 95,116,111,117,115,101,114,100, 97,116, 97, 40,116,111,\n    108,117, 97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32,101,\n    108,115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,\n    101,110, 10, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,\n    111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101,\n    108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,\n    116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10,\n     32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107,\n     32,105,110,100,101,120, 10,  9,111,117,116,112,117,116, 40,\n     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,\n     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,111,117,\n    116,112,117,116, 40, 39, 32,123, 39, 41, 10,  9,111,117,116,\n    112,117,116, 40, 39, 32, 32,116,111,108,117, 97, 95, 69,114,\n    114,111,114, 32,116,111,108,117, 97, 95,101,114,114, 59, 39,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102,\n     32, 40, 33,116,111,108,117, 97, 95,105,115,110,117,109, 98,\n    101,114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10,\n     32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108,\n    117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95,\n     83, 44, 34, 35,118,105,110,118, 97,108,105,100, 32,116,121,\n    112,101, 32,105,110, 32, 97,114,114, 97,121, 32,105,110,100,\n    101,120,105,110,103, 46, 34, 44, 38,116,111,108,117, 97, 95,\n    101,114,114, 41, 59, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 32,125, 39, 41, 10,  9,111,117,116,112,117,116, 40,\n     39, 35,101,110,100,105,102, 92,110, 39, 41, 10,  9,105,102,\n     32,102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,101,\n    110, 32, 45, 45, 32,102,111,114, 32, 99,111,109,112, 97,116,\n    105, 98,105,108,105,116,121, 32,119,105,116,104, 32,116,111,\n    108,117, 97, 53, 32, 63, 10,  9,  9,111,117,116,112,117,116,\n     40, 39, 32,116,111,108,117, 97, 95,105,110,100,101,120, 32,\n     61, 32, 40,105,110,116, 41,116,111,108,117, 97, 95,116,111,\n    110,117,109, 98,101,114, 40,116,111,108,117, 97, 95, 83, 44,\n     50, 44, 48, 41, 45, 49, 59, 39, 41, 10,  9,101,108,115,101,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 32,116,111,108,\n    117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,116,\n     41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,114,\n     40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 59, 39,\n     41, 10,  9,101,110,100, 10,  9,111,117,116,112,117,116, 40,\n     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,\n     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,105,102,\n     32,115,101,108,102, 46,100,105,109, 32, 97,110,100, 32,115,\n    101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,\n    104,101,110, 10,  9, 32, 32,111,117,116,112,117,116, 40, 39,\n     32,105,102, 32, 40,116,111,108,117, 97, 95,105,110,100,101,\n    120, 60, 48, 32,124,124, 32,116,111,108,117, 97, 95,105,110,\n    100,101,120, 62, 61, 39, 46, 46,115,101,108,102, 46,100,105,\n    109, 46, 46, 39, 41, 39, 41, 10,  9,101,108,115,101, 10,  9,\n     32, 32,111,117,116,112,117,116, 40, 39, 32,105,102, 32, 40,\n    116,111,108,117, 97, 95,105,110,100,101,120, 60, 48, 41, 39,\n     41, 10,  9,101,110,100, 10, 32,111,117,116,112,117,116, 40,\n     39, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,\n    116,111,108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,\n    105,110,100,101,120,105,110,103, 32,111,117,116, 32,111,102,\n     32,114, 97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59,\n     39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,110,\n    100,105,102, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,114,101,\n    116,117,114,110, 32,118, 97,108,117,101, 10, 32,108,111, 99,\n     97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,\n    105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32,\n    108,111, 99, 97,108, 32,112,117,115,104, 95,102,117,110, 99,\n     32, 61, 32,103,101,116, 95,112,117,115,104, 95,102,117,110,\n     99,116,105,111,110, 40,116, 41, 10, 32,105,102, 32,116, 32,\n    116,104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,116,\n     46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44,\n     99,116, 44, 39, 41, 39, 46, 46,115,101,108,102, 58,103,101,\n    116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116,\n     97,116,105, 99, 41, 46, 46, 39, 41, 59, 39, 41, 10, 32,101,\n    108,115,101, 10,  9,  9,116, 32, 61, 32,115,101,108,102, 46,\n    116,121,112,101, 10, 32, 32,105,102, 32,115,101,108,102, 46,\n    112,116,114, 32, 61, 61, 32, 39, 38, 39, 32,111,114, 32,115,\n    101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,\n    104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,\n    116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41,\n     38, 39, 46, 46,115,101,108,102, 58,103,101,116,118, 97,108,\n    117,101, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99,\n     41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39,\n     41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,\n    112,117,116, 40, 39, 32, 39, 44,112,117,115,104, 95,102,117,\n    110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,\n    111,105,100, 42, 41, 39, 46, 46,115,101,108,102, 58,103,101,\n    116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116,\n     97,116,105, 99, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39,\n     34, 41, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,101,110,\n    100, 10, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116,\n    117,114,110, 32, 49, 59, 39, 41, 10, 32,111,117,116,112,117,\n    116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n     39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,110,100,\n    101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76,\n     69, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,\n     92,110, 39, 41, 10, 10, 32, 45, 45, 32,115,101,116, 32,102,\n    117,110, 99,116,105,111,110, 32, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,\n     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32,105,102,\n     32,110,111,116, 32,115,116,114,102,105,110,100, 40,115,101,\n    108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 39,\n     41, 32,116,104,101,110, 10, 32, 32,105,102, 32, 99,108, 97,\n    115,115, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40, 34, 47, 42, 32,115,101,116, 32,102,117,110, 99,\n    116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, 97,109,\n    101, 44, 34, 32,111,102, 32, 99,108, 97,115,115, 32, 34, 44,\n     99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,\n    101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40,\n     34, 47, 42, 32,115,101,116, 32,102,117,110, 99,116,105,111,\n    110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34,\n     32, 42, 47, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,\n    101,108,102, 46, 99,115,101,116,110, 97,109,101, 32, 61, 32,\n    115,101,108,102, 58, 99,102,117,110, 99,110, 97,109,101, 40,\n     34,116,111,108,117, 97, 95,115,101,116, 34, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,102,\n     32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95,\n     34, 46, 46,115,101,108,102, 46, 99,115,101,116,110, 97,109,\n    101, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 92,110,\n    115,116, 97,116,105, 99, 32,105,110,116, 34, 44,115,101,108,\n    102, 46, 99,115,101,116,110, 97,109,101, 44, 34, 40,108,117,\n     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,\n     83, 41, 34, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34,\n    123, 34, 41, 10, 10, 32, 32, 45, 45, 32,100,101, 99,108, 97,\n    114,101, 32,105,110,100,101,120, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32,105,110,116, 32,116,111,108,117, 97, 95,\n    105,110,100,101,120, 59, 39, 41, 10, 10, 32, 32, 45, 45, 32,\n    100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,\n    102, 32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,108,111,\n     99, 97,108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32,\n     61, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46,\n    109,111,100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105,\n     99, 41, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115,\n     32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110,105,\n    108, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 39, 44,115,101,108,102, 46,112, 97,114,101,\n    110,116, 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,\n    108,102, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116,\n     40, 39, 32,108,117, 97, 95,112,117,115,104,115,116,114,105,\n    110,103, 40,116,111,108,117, 97, 95, 83, 44, 34, 46,115,101,\n    108,102, 34, 41, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32,108,117, 97, 95,114, 97,119,103,101,116,\n     40,116,111,108,117, 97, 95, 83, 44, 49, 41, 59, 39, 41, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 32,115,101,108,\n    102, 32, 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 40, 39, 44,115,101,108,102, 46,112, 97,114,101,\n    110,116, 46,116,121,112,101, 44, 39, 42, 41, 32, 39, 41, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39,108,117, 97, 95,\n    116,111,117,115,101,114,100, 97,116, 97, 40,116,111,108,117,\n     97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32, 32,101,108,\n    115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,101,\n    110, 10, 32, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,\n    111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101,\n    108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,\n    116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10,\n     32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, 99,104,101,\n     99,107, 32,105,110,100,101,120, 10,  9, 32,111,117,116,112,\n    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,\n      9, 32,111,117,116,112,117,116, 40, 39, 32,123, 39, 41, 10,\n      9, 32,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108,\n    117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, 95,\n    101,114,114, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95,\n    105,115,110,117,109, 98,101,114, 40,116,111,108,117, 97, 95,\n     83, 44, 50, 44, 48, 44, 38,116,111,108,117, 97, 95,101,114,\n    114, 41, 41, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,\n     39, 32, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 35,118,105,110,118,\n     97,108,105,100, 32,116,121,112,101, 32,105,110, 32, 97,114,\n    114, 97,121, 32,105,110,100,101,120,105,110,103, 46, 34, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 32,125, 39, 41, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,\n    102, 92,110, 39, 41, 10, 10,  9,105,102, 32,102,108, 97,103,\n    115, 91, 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, 32,\n    102,111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,\n    116,121, 32,119,105,116,104, 32,116,111,108,117, 97, 53, 32,\n     63, 10,  9,  9,111,117,116,112,117,116, 40, 39, 32,116,111,\n    108,117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,\n    116, 41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,\n    114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 45,\n     49, 59, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,111,117,\n    116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,105,110,\n    100,101,120, 32, 61, 32, 40,105,110,116, 41,116,111,108,117,\n     97, 95,116,111,110,117,109, 98,101,114, 40,116,111,108,117,\n     97, 95, 83, 44, 50, 44, 48, 41, 59, 39, 41, 10,  9,101,110,\n    100, 10, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,105,\n    102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76,\n     69, 65, 83, 69, 92,110, 39, 41, 10,  9,105,102, 32,115,101,\n    108,102, 46,100,105,109, 32, 97,110,100, 32,115,101,108,102,\n     46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110,\n     10,  9, 32, 32,111,117,116,112,117,116, 40, 39, 32,105,102,\n     32, 40,116,111,108,117, 97, 95,105,110,100,101,120, 60, 48,\n     32,124,124, 32,116,111,108,117, 97, 95,105,110,100,101,120,\n     62, 61, 39, 46, 46,115,101,108,102, 46,100,105,109, 46, 46,\n     39, 41, 39, 41, 10,  9,101,108,115,101, 10,  9, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32,105,102, 32, 40,116,111,108,\n    117, 97, 95,105,110,100,101,120, 60, 48, 41, 39, 41, 10,  9,\n    101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111,\n    108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,105,110,\n    100,101,120,105,110,103, 32,111,117,116, 32,111,102, 32,114,\n     97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 10, 10, 32, 32, 45, 45, 32, 97,115,\n    115,105,103,110, 32,118, 97,108,117,101, 10, 32, 32,108,111,\n     99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10, 32, 32,\n    105,102, 32,115,101,108,102, 46,112,116,114,126, 61, 39, 39,\n     32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, 42, 39,\n     32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,\n     97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,110,\n     10, 32, 32, 32,111,117,116,112,117,116, 40, 99,108, 97,115,\n    115, 46, 46, 39, 58, 58, 39, 46, 46,115,101,108,102, 46,110,\n     97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,\n    100,101,120, 93, 39, 41, 10, 32, 32,101,108,115,101,105,102,\n     32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32, 32, 32,\n    111,117,116,112,117,116, 40, 39,115,101,108,102, 45, 62, 39,\n     46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91,\n    116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10,\n     32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,\n    116, 40,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91,\n    116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10,\n     32, 32,101,110,100, 10, 32, 32,108,111, 99, 97,108, 32,116,\n     32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102,\n     46,116,121,112,101, 41, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, 32,110,111,\n    116, 32,116, 32, 97,110,100, 32,112,116,114, 61, 61, 39, 39,\n     32,116,104,101,110, 32,111,117,116,112,117,116, 40, 39, 42,\n     39, 41, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116,\n     40, 39, 40, 40, 39, 44,115,101,108,102, 46,109,111,100, 44,\n    115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102,\n     32,110,111,116, 32,116, 32,116,104,101,110, 10, 32, 32, 32,\n    111,117,116,112,117,116, 40, 39, 42, 39, 41, 10, 32, 32,101,\n    110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 41, 32,\n     39, 41, 10, 32, 32,108,111, 99, 97,108, 32,100,101,102, 32,\n     61, 32, 48, 10, 32, 32,105,102, 32,115,101,108,102, 46,100,\n    101,102, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32,100,\n    101,102, 32, 61, 32,115,101,108,102, 46,100,101,102, 32,101,\n    110,100, 10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39,116,111,108,117,\n     97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,108,117,\n     97, 95, 83, 44, 51, 44, 39, 44,100,101,102, 44, 39, 41, 41,\n     59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,108,\n    111, 99, 97,108, 32,116,111, 95,102,117,110, 99, 32, 61, 32,\n    103,101,116, 95,116,111, 95,102,117,110, 99,116,105,111,110,\n     40,115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32, 32,\n    111,117,116,112,117,116, 40,116,111, 95,102,117,110, 99, 44,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 51, 44, 39, 44,100,\n    101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32,101,110,100,\n     10, 32, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116,\n    117,114,110, 32, 48, 59, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39,125, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,\n    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,\n     66, 76, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10, 10,101,\n    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108,\n     97,115,115, 65,114,114, 97,121, 58,114,101,103,105,115,116,\n    101,114, 32, 40,112,114,101, 41, 10,  9,105,102, 32,110,111,\n    116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117,\n     98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,\n    104,101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,\n    110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32,\n    111,114, 32, 39, 39, 10, 32,105,102, 32,115,101,108,102, 46,\n     99,115,101,116,110, 97,109,101, 32,116,104,101,110, 10, 32,\n     32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,\n    111,108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117,\n     97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110,\n     97,109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102,\n     46, 99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 39, 46,\n     46,115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 46,\n     46, 39, 41, 59, 39, 41, 10, 32,101,108,115,101, 10, 32, 32,\n    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,\n    108,117, 97, 95, 97,114,114, 97,121, 40,116,111,108,117, 97,\n     95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,\n    109,101, 46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102, 46,\n     99,103,101,116,110, 97,109,101, 46, 46, 39, 44, 78, 85, 76,\n     76, 41, 59, 39, 41, 10, 32,101,110,100, 10,101,110,100, 10,\n     10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,\n    110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,\n    105,111,110, 32, 95, 65,114,114, 97,121, 32, 40,116, 41, 10,\n     32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116,\n     44, 99,108, 97,115,115, 65,114,114, 97,121, 41, 10, 32, 97,\n    112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,\n    110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,\n    115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,\n    101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,\n    101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101,\n     32,118, 97,114,105, 97, 98,108,101, 32,100,101, 99,108, 97,\n    114, 97,116,105,111,110, 46, 10,102,117,110, 99,116,105,111,\n    110, 32, 65,114,114, 97,121, 32, 40,115, 41, 10, 32,114,101,\n    116,117,114,110, 32, 95, 65,114,114, 97,121, 32, 40, 68,101,\n     99,108, 97,114, 97,116,105,111,110, 40,115, 44, 39,118, 97,\n    114, 39, 41, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/array.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45,\n     45, 32, 70,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115,\n     32, 97, 32,102,117,110, 99,116,105,111,110, 32,111,114, 32,\n     97, 32, 99,108, 97,115,115, 32,109,101,116,104,111,100, 46,\n     10, 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,\n    110,103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,\n    116,111,114,101,100, 58, 10, 45, 45, 32, 32,109,111,100, 32,\n     32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,101,\n    114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,116,\n    121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61, 32,\n     34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102, 32,\n    114,101,112,114,101,115,101,110,116,105,110,103, 32, 97, 32,\n    112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,101,\n    102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,109,\n    101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,108,110,\n     97,109,101, 32, 61, 32,108,117, 97, 32,110, 97,109,101, 10,\n     45, 45, 32, 32, 97,114,103,115, 32, 32, 61, 32,108,105,115,\n    116, 32,111,102, 32, 97,114,103,117,109,101,110,116, 32,100,\n    101, 99,108, 97,114, 97,116,105,111,110,115, 10, 45, 45, 32,\n     32, 99,111,110,115,116, 32, 61, 32,105,102, 32,105,116, 32,\n    105,115, 32, 97, 32,109,101,116,104,111,100, 32,114,101, 99,\n    101,105,118,105,110,103, 32, 97, 32, 99,111,110,115,116, 32,\n     34,116,104,105,115, 34, 46, 10, 99,108, 97,115,115, 70,117,\n    110, 99,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100,\n     32, 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32,\n     39, 39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10,\n     32,110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32, 97,114,\n    103,115, 32, 61, 32,123,110, 61, 48,125, 44, 10, 32, 99,111,\n    110,115,116, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,\n    115,115, 70,117,110, 99,116,105,111,110, 46, 95, 95,105,110,\n    100,101,120, 32, 61, 32, 99,108, 97,115,115, 70,117,110, 99,\n    116,105,111,110, 10,115,101,116,109,101,116, 97,116, 97, 98,\n    108,101, 40, 99,108, 97,115,115, 70,117,110, 99,116,105,111,\n    110, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41,\n     10, 10, 45, 45, 32,100,101, 99,108, 97,114,101, 32,116, 97,\n    103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 70,117,110, 99,116,105,111,110, 58,100,101, 99,108,\n    116,121,112,101, 32, 40, 41, 10, 32,115,101,108,102, 46,116,\n    121,112,101, 32, 61, 32,116,121,112,101,118, 97,114, 40,115,\n    101,108,102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115,\n    116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,100,\n     44, 39, 99,111,110,115,116, 39, 41, 32,116,104,101,110, 10,\n      9, 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32, 39,\n     99,111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116,\n    121,112,101, 10,  9,  9,115,101,108,102, 46,109,111,100, 32,\n     61, 32,103,115,117, 98, 40,115,101,108,102, 46,109,111,100,\n     44, 39, 99,111,110,115,116, 39, 44, 39, 39, 41, 10,  9,101,\n    110,100, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,\n    119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115,\n     91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97,\n    114,103,115, 91,105, 93, 58,100,101, 99,108,116,121,112,101,\n     40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,\n    110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 87,114,105,\n    116,101, 32, 98,105,110,100,105,110,103, 32,102,117,110, 99,\n    116,105,111,110, 10, 45, 45, 32, 79,117,116,112,117,116,115,\n     32, 67, 47, 67, 43, 43, 32, 98,105,110,100,105,110,103, 32,\n    102,117,110, 99,116,105,111,110, 46, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,\n    111,110, 58,115,117,112, 99,111,100,101, 32, 40,108,111, 99,\n     97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 41,\n     10, 10, 32,108,111, 99, 97,108, 32,111,118,101,114,108,111,\n     97,100, 32, 61, 32,115,116,114,115,117, 98, 40,115,101,108,\n    102, 46, 99,110, 97,109,101, 44, 45, 50, 44, 45, 49, 41, 32,\n     45, 32, 49, 32, 32, 45, 45, 32,105,110,100,105, 99, 97,116,\n    101, 32,111,118,101,114,108,111, 97,100,101,100, 32,102,117,\n    110, 99, 10, 32,108,111, 99, 97,108, 32,110,114,101,116, 32,\n     61, 32, 48, 32, 32, 32, 32, 32, 32, 45, 45, 32,110,117,109,\n     98,101,114, 32,111,102, 32,114,101,116,117,114,110,101,100,\n     32,118, 97,108,117,101,115, 10, 32,108,111, 99, 97,108, 32,\n     99,108, 97,115,115, 32, 61, 32,115,101,108,102, 58,105,110,\n     99,108, 97,115,115, 40, 41, 10, 32,108,111, 99, 97,108, 32,\n     95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44,\n     39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41,\n     10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110,\n     10, 10, 32,  9,105,102, 32,115,101,108,102, 46,110, 97,109,\n    101, 32, 61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32,\n    115,101,108,102, 46,112, 97,114,101,110,116, 46,102,108, 97,\n    103,115, 46,112,117,114,101, 95,118,105,114,116,117, 97,108,\n     32,116,104,101,110, 10, 32,  9,  9, 45, 45, 32,110,111, 32,\n     99,111,110,115,116,114,117, 99,116,111,114, 32,102,111,114,\n     32, 99,108, 97,115,115,101,115, 32,119,105,116,104, 32,112,\n    117,114,101, 32,118,105,114,116,117, 97,108, 32,109,101,116,\n    104,111,100,115, 10, 32,  9,  9,114,101,116,117,114,110, 10,\n     32,  9,101,110,100, 10, 10, 32,  9,105,102, 32,108,111, 99,\n     97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,\n    116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40, 34,\n     47, 42, 32,109,101,116,104,111,100, 58, 32,110,101,119, 95,\n    108,111, 99, 97,108, 32,111,102, 32, 99,108, 97,115,115, 32,\n     34, 44, 99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10,\n      9,101,108,115,101, 10,  9,  9,111,117,116,112,117,116, 40,\n     34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,101,\n    108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108,\n     97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42,\n     47, 34, 41, 10,  9,101,110,100, 10, 32,101,108,115,101, 10,\n     32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,102,117,\n    110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,110,\n     97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,110,100,\n     10, 10, 32,105,102, 32,108,111, 99, 97,108, 95, 99,111,110,\n    115,116,114,117, 99,116,111,114, 32,116,104,101,110, 10, 32,\n     32,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,\n    102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69,\n     95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46,\n     46, 34, 95,108,111, 99, 97,108, 34, 41, 10, 32, 32,111,117,\n    116,112,117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,\n    105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,109,101,\n     46, 46, 34, 95,108,111, 99, 97,108, 34, 44, 34, 40,108,117,\n     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,\n     83, 41, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,111,117,\n    116,112,117,116, 40, 34, 35,105,102,110,100,101,102, 32, 84,\n     79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, 34, 46,\n     46,115,101,108,102, 46, 99,110, 97,109,101, 41, 10, 32, 32,\n    111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,116,105,\n     99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,\n    109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42,\n     32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,101,110,\n    100, 10, 32,111,117,116,112,117,116, 40, 34,123, 34, 41, 10,\n     10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,121,112,101,\n    115, 10,  9,105,102, 32,111,118,101,114,108,111, 97,100, 32,\n     60, 32, 48, 32,116,104,101,110, 10,  9, 32,111,117,116,112,\n    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,\n     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,\n      9,101,110,100, 10,  9,111,117,116,112,117,116, 40, 39, 32,\n    116,111,108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,\n    117, 97, 95,101,114,114, 59, 39, 41, 10, 32,111,117,116,112,\n    117,116, 40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10, 32,\n     45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10, 32,\n    108,111, 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32,\n     99,108, 97,115,115, 32,116,104,101,110, 32,110, 97,114,103,\n     61, 50, 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,\n    101,110,100, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,\n    104,101,110, 10,  9,  9,108,111, 99, 97,108, 32,102,117,110,\n     99, 32, 61, 32,103,101,116, 95,105,115, 95,102,117,110, 99,\n    116,105,111,110, 40,115,101,108,102, 46,112, 97,114,101,110,\n    116, 46,116,121,112,101, 41, 10,  9,  9,108,111, 99, 97,108,\n     32,116,121,112,101, 32, 61, 32,115,101,108,102, 46,112, 97,\n    114,101,110,116, 46,116,121,112,101, 10,  9,  9,105,102, 32,\n    115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,119,\n     39, 32,111,114, 32,115,116, 97,116,105, 99,126, 61,110,105,\n    108, 32,116,104,101,110, 10,  9,  9,  9,102,117,110, 99, 32,\n     61, 32, 39,116,111,108,117, 97, 95,105,115,117,115,101,114,\n    116, 97, 98,108,101, 39, 10,  9,  9,  9,116,121,112,101, 32,\n     61, 32,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,\n    121,112,101, 10,  9,  9,101,110,100, 10,  9,  9,105,102, 32,\n    115,101,108,102, 46, 99,111,110,115,116, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10,  9,  9,  9,116,121,112,101, 32,\n     61, 32, 34, 99,111,110,115,116, 32, 34, 46, 46,116,121,112,\n    101, 10,  9,  9,101,110,100, 10,  9,  9,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32, 32, 32, 33, 39, 46, 46,102,117,110,\n     99, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44,\n     34, 39, 46, 46,116,121,112,101, 46, 46, 39, 34, 44, 48, 44,\n     38,116,111,108,117, 97, 95,101,114,114, 41, 32,124,124, 92,\n    110, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45, 32, 99,104,\n    101, 99,107, 32, 97,114,103,115, 10, 32,105,102, 32,115,101,\n    108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101,\n     32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110,\n     10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,\n    119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115,\n     91,105, 93, 32,100,111, 10, 32, 32, 32,108,111, 99, 97,108,\n     32, 98,116,121,112,101, 32, 61, 32,105,115, 98, 97,115,105,\n     99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46,\n    116,121,112,101, 41, 10, 32, 32, 32,105,102, 32, 98,116,121,\n    112,101, 32,126, 61, 32, 39,118, 97,108,117,101, 39, 32, 97,\n    110,100, 32, 98,116,121,112,101, 32,126, 61, 32, 39,115,116,\n     97,116,101, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 39, 46, 46,\n    115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,111,117,\n    116, 99,104,101, 99,107,116,121,112,101, 40,110, 97,114,103,\n     41, 46, 46, 39, 32,124,124, 92,110, 39, 41, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32, 32,105,102, 32, 98,116,121,112,101,\n     32,126, 61, 32, 39,115,116, 97,116,101, 39, 32,116,104,101,\n    110, 10,  9, 32, 32, 32,110, 97,114,103, 32, 61, 32,110, 97,\n    114,103, 43, 49, 10, 32, 32, 32,101,110,100, 10, 32, 32, 32,\n    105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,101,\n    110,100, 32,111,102, 32,108,105,115,116, 10, 32,111,117,116,\n    112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111,108,117,\n     97, 95,105,115,110,111,111, 98,106, 40,116,111,108,117, 97,\n     95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, 44, 38,\n    116,111,108,117, 97, 95,101,114,114, 41, 92,110, 32, 41, 39,\n     41, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32,103,111,\n    116,111, 32,116,111,108,117, 97, 95,108,101,114,114,111,114,\n     59, 39, 41, 10, 10, 32,111,117,116,112,117,116, 40, 39, 32,\n    101,108,115,101, 92,110, 39, 41, 10,  9,105,102, 32,111,118,\n    101,114,108,111, 97,100, 32, 60, 32, 48, 32,116,104,101,110,\n     10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 10,  9,101,110,100, 10,  9,111,117,\n    116,112,117,116, 40, 39, 32,123, 39, 41, 10, 10, 32, 45, 45,\n     32,100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,\n    105,102, 32,116,104,101, 32, 99, 97,115,101, 10, 32,108,111,\n     99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32, 99,108,\n     97,115,115, 32,116,104,101,110, 32,110, 97,114,103, 61, 50,\n     32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,101,110,\n    100, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,\n     32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,110,101,\n    119, 39, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,\n    110,105,108, 32,116,104,101,110, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111,110,\n    115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116, 46,\n    116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102, 32,\n     61, 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,\n     40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115,\n    101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101,\n     44, 39, 42, 41, 32, 39, 41, 10, 32, 32,108,111, 99, 97,108,\n     32,116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,\n    116,111, 95,102,117,110, 99,116,105,111,110, 40,115,101,108,\n    102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 41, 10,\n     32, 32,111,117,116,112,117,116, 40,116,111, 95,102,117,110,\n     99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 48,\n     41, 59, 39, 41, 10, 32,101,108,115,101,105,102, 32,115,116,\n     97,116,105, 99, 32,116,104,101,110, 10, 32, 32, 95, 44, 95,\n     44,115,101,108,102, 46,109,111,100, 32, 61, 32,115,116,114,\n    102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39,\n     94, 37,115, 42,115,116, 97,116,105, 99, 37,115, 37,115, 42,\n     40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45,\n     32,100,101, 99,108, 97,114,101, 32,112, 97,114, 97,109,101,\n    116,101,114,115, 10, 32,105,102, 32,115,101,108,102, 46, 97,\n    114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126, 61, 32,\n     39,118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32,108,\n    111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,105,108,\n    101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,\n    100,111, 10, 32, 32, 32,115,101,108,102, 46, 97,114,103,115,\n     91,105, 93, 58,100,101, 99,108, 97,114,101, 40,110, 97,114,\n    103, 41, 10, 32, 32, 32,105,102, 32,105,115, 98, 97,115,105,\n     99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46,\n    116,121,112,101, 41, 32,126, 61, 32, 34,115,116, 97,116,101,\n     34, 32,116,104,101,110, 10,  9, 32, 32, 32,110, 97,114,103,\n     32, 61, 32,110, 97,114,103, 43, 49, 10, 32, 32, 32,101,110,\n    100, 10, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32,\n    101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,\n    104,101, 99,107, 32,115,101,108,102, 10, 32,105,102, 32, 99,\n    108, 97,115,115, 32, 97,110,100, 32,115,101,108,102, 46,110,\n     97,109,101,126, 61, 39,110,101,119, 39, 32, 97,110,100, 32,\n    115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,104,101,\n    110, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,105,102,\n    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69,\n     65, 83, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,102, 41,\n     32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111,\n    108,117, 97, 95, 83, 44, 34,105,110,118, 97,108,105,100, 32,\n     92, 39,115,101,108,102, 92, 39, 32,105,110, 32,102,117,110,\n     99,116,105,111,110, 32, 92, 39, 39, 46, 46,115,101,108,102,\n     46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44, 78, 85, 76,\n     76, 41, 59, 39, 41, 59, 10,  9, 32,111,117,116,112,117,116,\n     40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 32,101,\n    110,100, 10, 10, 32, 45, 45, 32,103,101,116, 32, 97,114,114,\n     97,121, 32,101,108,101,109,101,110,116, 32,118, 97,108,117,\n    101,115, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,\n    101,110, 32,110, 97,114,103, 61, 50, 32,101,108,115,101, 32,\n    110, 97,114,103, 61, 49, 32,101,110,100, 10, 32,105,102, 32,\n    115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,\n    112,101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,\n    101,110, 10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10,\n     32, 32,119,104,105,108,101, 32,115,101,108,102, 46, 97,114,\n    103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32,115,101,108,\n    102, 46, 97,114,103,115, 91,105, 93, 58,103,101,116, 97,114,\n    114, 97,121, 40,110, 97,114,103, 41, 10, 32, 32, 32,110, 97,\n    114,103, 32, 61, 32,110, 97,114,103, 43, 49, 10, 32, 32, 32,\n    105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,111,117,116,\n     32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,108,117,\n     97, 95,111,117,116,115,105,100,101, 34, 41, 10, 32, 45, 45,\n     32, 99, 97,108,108, 32,102,117,110, 99,116,105,111,110, 10,\n     32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,\n    101,108,102, 46,110, 97,109,101, 61, 61, 39,100,101,108,101,\n    116,101, 39, 32,116,104,101,110, 10, 32, 32,111,117,116,112,\n    117,116, 40, 39, 32, 32, 77,116,111,108,117, 97, 95,100,101,\n    108,101,116,101, 40,115,101,108,102, 41, 59, 39, 41, 10, 32,\n    101,108,115,101,105,102, 32, 99,108, 97,115,115, 32, 97,110,\n    100, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 61, 32,\n     39,111,112,101,114, 97,116,111,114, 38, 91, 93, 39, 32,116,\n    104,101,110, 10, 32, 32,105,102, 32,102,108, 97,103,115, 91,\n     39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, 32,102,111,\n    114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,116,121,\n     32,119,105,116,104, 32,116,111,108,117, 97, 53, 32, 63, 10,\n      9,111,117,116,112,117,116, 40, 39, 32, 32,115,101,108,102,\n     45, 62,111,112,101,114, 97,116,111,114, 91, 93, 40, 39, 44,\n    115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,110, 97,\n    109,101, 44, 39, 45, 49, 41, 32, 61, 32, 39, 44,115,101,108,\n    102, 46, 97,114,103,115, 91, 50, 93, 46,110, 97,109,101, 44,\n     39, 59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,\n     32,111,117,116,112,117,116, 40, 39, 32, 32,115,101,108,102,\n     45, 62,111,112,101,114, 97,116,111,114, 91, 93, 40, 39, 44,\n    115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,110, 97,\n    109,101, 44, 39, 41, 32, 61, 32, 39, 44,115,101,108,102, 46,\n     97,114,103,115, 91, 50, 93, 46,110, 97,109,101, 44, 39, 59,\n     39, 41, 10, 32, 32,101,110,100, 10, 32,101,108,115,101, 10,\n     32, 32,111,117,116,112,117,116, 40, 39, 32, 32,123, 39, 41,\n     10, 32, 32,105,102, 32,115,101,108,102, 46,116,121,112,101,\n     32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102,\n     46,116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39,\n     32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116,\n     40, 39, 32, 32, 39, 44,115,101,108,102, 46,109,111,100, 44,\n    115,101,108,102, 46,116,121,112,101, 44,115,101,108,102, 46,\n    112,116,114, 44, 39,116,111,108,117, 97, 95,114,101,116, 32,\n     61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116, 40,\n     39, 40, 39, 44,115,101,108,102, 46,109,111,100, 44,115,101,\n    108,102, 46,116,121,112,101, 44,115,101,108,102, 46,112,116,\n    114, 44, 39, 41, 32, 39, 41, 10, 32, 32,101,108,115,101, 10,\n     32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 39, 41,\n     10, 32, 32,101,110,100, 10, 32, 32,105,102, 32, 99,108, 97,\n    115,115, 32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,\n    101, 61, 61, 39,110,101,119, 39, 32,116,104,101,110, 10, 32,\n     32, 32,111,117,116,112,117,116, 40, 39, 77,116,111,108,117,\n     97, 95,110,101,119, 40, 40, 39, 44,115,101,108,102, 46,116,\n    121,112,101, 44, 39, 41, 40, 39, 41, 10, 32, 32,101,108,115,\n    101,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,\n    116, 97,116,105, 99, 32,116,104,101,110, 10,  9,105,102, 32,\n    111,117,116, 32,116,104,101,110, 10,  9,  9,111,117,116,112,\n    117,116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40,\n     39, 41, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,112,\n    117,116, 40, 99,108, 97,115,115, 46, 46, 39, 58, 58, 39, 46,\n     46,115,101,108,102, 46,110, 97,109,101, 44, 39, 40, 39, 41,\n     10,  9,101,110,100, 10, 32, 32,101,108,115,101,105,102, 32,\n     99,108, 97,115,115, 32,116,104,101,110, 10,  9,105,102, 32,\n    111,117,116, 32,116,104,101,110, 10,  9,  9,111,117,116,112,\n    117,116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40,\n     39, 41, 10,  9,101,108,115,101, 10,  9, 32, 32,105,102, 32,\n    115,101,108,102, 46, 99, 97,115,116, 95,111,112,101,114, 97,\n    116,111,114, 32,116,104,101,110, 10,  9, 32, 32,  9, 45, 45,\n    111,117,116,112,117,116, 40, 39,115,116, 97,116,105, 99, 95,\n     99, 97,115,116, 60, 39, 44,115,101,108,102, 46,109,111,100,\n     44,115,101,108,102, 46,116,121,112,101, 44,115,101,108,102,\n     46,112,116,114, 44, 39, 62, 40, 42,115,101,108,102, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40, 39,115,101,108,102,\n     45, 62,111,112,101,114, 97,116,111,114, 32, 39, 44,115,101,\n    108,102, 46,109,111,100, 44,115,101,108,102, 46,116,121,112,\n    101, 44, 39, 40, 39, 41, 10,  9, 32, 32,101,108,115,101, 10,\n      9,  9,111,117,116,112,117,116, 40, 39,115,101,108,102, 45,\n     62, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 44, 39,\n     40, 39, 41, 10,  9, 32, 32,101,110,100, 10,  9,101,110,100,\n     10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,\n    117,116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40,\n     39, 41, 10, 32, 32,101,110,100, 10, 10, 32, 32,105,102, 32,\n    111,117,116, 32, 97,110,100, 32,110,111,116, 32,115,116, 97,\n    116,105, 99, 32,116,104,101,110, 10, 32, 32,  9,111,117,116,\n    112,117,116, 40, 39,115,101,108,102, 39, 41, 10,  9,105,102,\n     32,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 32, 97,\n    110,100, 32,115,101,108,102, 46, 97,114,103,115, 91, 49, 93,\n     46,110, 97,109,101, 32,126, 61, 32, 39, 39, 32,116,104,101,\n    110, 10,  9,  9,111,117,116,112,117,116, 40, 39, 44, 39, 41,\n     10,  9,101,110,100, 10, 32, 32,101,110,100, 10, 32, 32, 45,\n     45, 32,119,114,105,116,101, 32,112, 97,114, 97,109,101,116,\n    101,114,115, 10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49,\n     10, 32, 32,119,104,105,108,101, 32,115,101,108,102, 46, 97,\n    114,103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32,115,101,\n    108,102, 46, 97,114,103,115, 91,105, 93, 58,112, 97,115,115,\n    112, 97,114, 40, 41, 10, 32, 32, 32,105, 32, 61, 32,105, 43,\n     49, 10, 32, 32, 32,105,102, 32,115,101,108,102, 46, 97,114,\n    103,115, 91,105, 93, 32,116,104,101,110, 10, 32, 32, 32, 32,\n    111,117,116,112,117,116, 40, 39, 44, 39, 41, 10, 32, 32, 32,\n    101,110,100, 10, 32, 32,101,110,100, 10, 10, 32, 32,105,102,\n     32, 99,108, 97,115,115, 32, 97,110,100, 32,115,101,108,102,\n     46,110, 97,109,101, 32, 61, 61, 32, 39,111,112,101,114, 97,\n    116,111,114, 91, 93, 39, 32, 97,110,100, 32,102,108, 97,103,\n    115, 91, 39, 49, 39, 93, 32,116,104,101,110, 10,  9,111,117,\n    116,112,117,116, 40, 39, 45, 49, 41, 59, 39, 41, 10, 32, 32,\n    101,108,115,101, 10,  9,105,102, 32, 99,108, 97,115,115, 32,\n     97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 61, 61,\n     39,110,101,119, 39, 32,116,104,101,110, 10,  9,  9,111,117,\n    116,112,117,116, 40, 39, 41, 41, 59, 39, 41, 32, 45, 45, 32,\n     99,108,111,115,101, 32, 77,116,111,108,117, 97, 95,110,101,\n    119, 40, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,112,\n    117,116, 40, 39, 41, 59, 39, 41, 10,  9,101,110,100, 10, 32,\n     32,101,110,100, 10, 10, 32, 32, 45, 45, 32,114,101,116,117,\n    114,110, 32,118, 97,108,117,101,115, 10, 32, 32,105,102, 32,\n    115,101,108,102, 46,116,121,112,101, 32,126, 61, 32, 39, 39,\n     32, 97,110,100, 32,115,101,108,102, 46,116,121,112,101, 32,\n    126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10,\n     32, 32, 32,110,114,101,116, 32, 61, 32,110,114,101,116, 32,\n     43, 32, 49, 10, 32, 32, 32,108,111, 99, 97,108, 32,116, 44,\n     99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 10, 32, 32, 32,105,102, 32,\n    116, 32,116,104,101,110, 10, 32, 32, 32,  9,105,102, 32,115,\n    101,108,102, 46, 99, 97,115,116, 95,111,112,101,114, 97,116,\n    111,114, 32, 97,110,100, 32, 95, 98, 97,115,105, 99, 95,114,\n     97,119, 95,112,117,115,104, 91,116, 93, 32,116,104,101,110,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 39,\n     44, 95, 98, 97,115,105, 99, 95,114, 97,119, 95,112,117,115,\n    104, 91,116, 93, 44, 39, 40,116,111,108,117, 97, 95, 83, 44,\n     40, 39, 44, 99,116, 44, 39, 41,116,111,108,117, 97, 95,114,\n    101,116, 41, 59, 39, 41, 10, 32, 32, 32,  9,101,108,115,101,\n     10,  9, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32, 32,116,111,108,117, 97, 95,112,117,115,104, 39, 46, 46,\n    116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39,\n     44, 99,116, 44, 39, 41,116,111,108,117, 97, 95,114,101,116,\n     41, 59, 39, 41, 10,  9,101,110,100, 10, 32, 32, 32,101,108,\n    115,101, 10,  9,116, 32, 61, 32,115,101,108,102, 46,116,121,\n    112,101, 10,  9,110,101,119, 95,116, 32, 61, 32,115,116,114,\n    105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, 99,111,\n    110,115,116, 37,115, 43, 34, 44, 32, 34, 34, 41, 10,  9,108,\n    111, 99, 97,108, 32,111,119,110,101,100, 32, 61, 32,102, 97,\n    108,115,101, 10,  9,105,102, 32,115,116,114,105,110,103, 46,\n    102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 32,\n     34,116,111,108,117, 97, 95,111,119,110,101,100, 34, 41, 32,\n    116,104,101,110, 10,  9,  9,111,119,110,101,100, 32, 61, 32,\n    116,114,117,101, 10,  9,101,110,100, 10, 32, 32, 32, 32,108,\n    111, 99, 97,108, 32,112,117,115,104, 95,102,117,110, 99, 32,\n     61, 32,103,101,116, 95,112,117,115,104, 95,102,117,110, 99,\n    116,105,111,110, 40,116, 41, 10, 32, 32, 32, 32,105,102, 32,\n    115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,\n    116,104,101,110, 10, 32, 32, 32, 32, 32,111,117,116,112,117,\n    116, 40, 39, 32, 32, 32,123, 39, 41, 10, 32, 32, 32, 32, 32,\n    111,117,116,112,117,116, 40, 39, 35,105,102,100,101,102, 32,\n     95, 95, 99,112,108,117,115,112,108,117,115, 92,110, 39, 41,\n     10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32, 32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95,\n    111, 98,106, 32, 61, 32, 77,116,111,108,117, 97, 95,110,101,\n    119, 40, 40, 39, 44,110,101,119, 95,116, 44, 39, 41, 40,116,\n    111,108,117, 97, 95,114,101,116, 41, 41, 59, 39, 41, 10, 32,\n     32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n     32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39, 40,\n    116,111,108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,111,\n     98,106, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,\n     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,\n     32, 32,116,111,108,117, 97, 95,114,101,103,105,115,116,101,\n    114, 95,103, 99, 40,116,111,108,117, 97, 95, 83, 44,108,117,\n     97, 95,103,101,116,116,111,112, 40,116,111,108,117, 97, 95,\n     83, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,\n    112,117,116, 40, 39, 35,101,108,115,101, 92,110, 39, 41, 10,\n     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,\n     32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95,111,\n     98,106, 32, 61, 32,116,111,108,117, 97, 95, 99,111,112,121,\n     40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42,\n     41, 38,116,111,108,117, 97, 95,114,101,116, 44,115,105,122,\n    101,111,102, 40, 39, 44,116, 44, 39, 41, 41, 59, 39, 41, 10,\n     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,\n     32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39,\n     40,116,111,108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,\n    111, 98,106, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41,\n     10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32,\n     32, 32, 32,116,111,108,117, 97, 95,114,101,103,105,115,116,\n    101,114, 95,103, 99, 40,116,111,108,117, 97, 95, 83, 44,108,\n    117, 97, 95,103,101,116,116,111,112, 40,116,111,108,117, 97,\n     95, 83, 41, 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,\n    116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39,\n     41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39,\n     32, 32, 32,125, 39, 41, 10, 32, 32, 32, 32,101,108,115,101,\n    105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32,\n     39, 38, 39, 32,116,104,101,110, 10, 32, 32, 32, 32, 32,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,\n    104, 95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95,\n     83, 44, 40,118,111,105,100, 42, 41, 38,116,111,108,117, 97,\n     95,114,101,116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39,\n     41, 10, 32, 32, 32, 32,101,108,115,101, 10,  9, 32,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104,\n     95,102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83,\n     44, 40,118,111,105,100, 42, 41,116,111,108,117, 97, 95,114,\n    101,116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,\n      9, 32,105,102, 32,111,119,110,101,100, 32,111,114, 32,108,\n    111, 99, 97,108, 95, 99,111,110,115,116,114,117, 99,116,111,\n    114, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97,\n     95,114,101,103,105,115,116,101,114, 95,103, 99, 40,116,111,\n    108,117, 97, 95, 83, 44,108,117, 97, 95,103,101,116,116,111,\n    112, 40,116,111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10,\n      9, 32,101,110,100, 10, 32, 32, 32, 32,101,110,100, 10, 32,\n     32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,108,\n    111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,105,108,\n    101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,\n    100,111, 10, 32, 32, 32,110,114,101,116, 32, 61, 32,110,114,\n    101,116, 32, 43, 32,115,101,108,102, 46, 97,114,103,115, 91,\n    105, 93, 58,114,101,116,118, 97,108,117,101, 40, 41, 10, 32,\n     32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100,\n     10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,125, 39,\n     41, 10, 10, 32, 32, 45, 45, 32,115,101,116, 32, 97,114,114,\n     97,121, 32,101,108,101,109,101,110,116, 32,118, 97,108,117,\n    101,115, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,116,\n    104,101,110, 32,110, 97,114,103, 61, 50, 32,101,108,115,101,\n     32,110, 97,114,103, 61, 49, 32,101,110,100, 10, 32, 32,105,\n    102, 32,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,\n    116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,\n    116,104,101,110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105,\n     61, 49, 10, 32, 32, 32,119,104,105,108,101, 32,115,101,108,\n    102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, 32, 32,\n     32, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,\n    115,101,116, 97,114,114, 97,121, 40,110, 97,114,103, 41, 10,\n     32, 32, 32, 32,110, 97,114,103, 32, 61, 32,110, 97,114,103,\n     43, 49, 10, 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10,\n     32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 10, 32,\n     32, 45, 45, 32,102,114,101,101, 32,100,121,110, 97,109,105,\n     99, 97,108,108,121, 32, 97,108,108,111, 99, 97,116,101,100,\n     32, 97,114,114, 97,121, 10, 32, 32,105,102, 32,115,101,108,\n    102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101, 32,\n    126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10,\n     32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,\n     32,119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,\n    115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,115,101,108,\n    102, 46, 97,114,103,115, 91,105, 93, 58,102,114,101,101, 97,\n    114,114, 97,121, 40, 41, 10, 32, 32, 32, 32,105, 32, 61, 32,\n    105, 43, 49, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,\n    100, 10, 32,101,110,100, 10, 10, 32,111,117,116,112,117,116,\n     40, 39, 32,125, 39, 41, 10, 32,111,117,116,112,117,116, 40,\n     39, 32,114,101,116,117,114,110, 32, 39, 46, 46,110,114,101,\n    116, 46, 46, 39, 59, 39, 41, 10, 10, 32, 45, 45, 32, 99, 97,\n    108,108, 32,111,118,101,114,108,111, 97,100,101,100, 32,102,\n    117,110, 99,116,105,111,110, 32,111,114, 32,103,101,110,101,\n    114, 97,116,101, 32,101,114,114,111,114, 10,  9,105,102, 32,\n    111,118,101,114,108,111, 97,100, 32, 60, 32, 48, 32,116,104,\n    101,110, 10, 10,  9,  9,111,117,116,112,117,116, 40, 39, 35,\n    105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69,\n     76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,  9,111,117,116,\n    112,117,116, 40, 39,116,111,108,117, 97, 95,108,101,114,114,\n    111,114, 58, 92,110, 39, 41, 10,  9,  9,111,117,116,112,117,\n    116, 40, 39, 32,116,111,108,117, 97, 95,101,114,114,111,114,\n     40,116,111,108,117, 97, 95, 83, 44, 34, 35,102,101,114,114,\n    111,114, 32,105,110, 32,102,117,110, 99,116,105,111,110, 32,\n     92, 39, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101,\n     46, 46, 39, 92, 39, 46, 34, 44, 38,116,111,108,117, 97, 95,\n    101,114,114, 41, 59, 39, 41, 10,  9,  9,111,117,116,112,117,\n    116, 40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,\n    108,111, 99, 97,108, 32, 95,108,111, 99, 97,108, 32, 61, 32,\n     34, 34, 10,  9,  9,105,102, 32,108,111, 99, 97,108, 95, 99,\n    111,110,115,116,114,117, 99,116,111,114, 32,116,104,101,110,\n     10,  9,  9,  9, 95,108,111, 99, 97,108, 32, 61, 32, 34, 95,\n    108,111, 99, 97,108, 34, 10,  9,  9,101,110,100, 10,  9,  9,\n    111,117,116,112,117,116, 40, 39,116,111,108,117, 97, 95,108,\n    101,114,114,111,114, 58, 92,110, 39, 41, 10,  9,  9,111,117,\n    116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 39,\n     46, 46,115,116,114,115,117, 98, 40,115,101,108,102, 46, 99,\n    110, 97,109,101, 44, 49, 44, 45, 51, 41, 46, 46,102,111,114,\n    109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,111,118,101,114,\n    108,111, 97,100, 41, 46, 46, 95,108,111, 99, 97,108, 46, 46,\n     39, 40,116,111,108,117, 97, 95, 83, 41, 59, 39, 41, 10,  9,\n    101,110,100, 10, 32,111,117,116,112,117,116, 40, 39,125, 39,\n     41, 10, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79,\n     76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41,\n     10, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10,\n     10,  9, 45, 45, 32,114,101, 99,117,114,115,105,118,101, 32,\n     99, 97,108,108, 32,116,111, 32,119,114,105,116,101, 32,108,\n    111, 99, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,\n    114, 10,  9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,\n     32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,\n    119, 39, 32, 97,110,100, 32,110,111,116, 32,108,111, 99, 97,\n    108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,116,\n    104,101,110, 10, 10,  9,  9,115,101,108,102, 58,115,117,112,\n     99,111,100,101, 40, 49, 41, 10,  9,101,110,100, 10, 10,101,\n    110,100, 10, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,\n    114, 32,102,117,110, 99,116,105,111,110, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,\n    105,111,110, 58,114,101,103,105,115,116,101,114, 32, 40,112,\n    114,101, 41, 10, 10,  9,105,102, 32,110,111,116, 32,115,101,\n    108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99,\n     95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,\n      9,  9,114,101,116,117,114,110, 10,  9,101,110,100, 10, 10,\n     32,  9,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32,\n     61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32,115,101,\n    108,102, 46,112, 97,114,101,110,116, 46,102,108, 97,103,115,\n     46,112,117,114,101, 95,118,105,114,116,117, 97,108, 32,116,\n    104,101,110, 10, 32,  9,  9, 45, 45, 32,110,111, 32, 99,111,\n    110,115,116,114,117, 99,116,111,114, 32,102,111,114, 32, 99,\n    108, 97,115,115,101,115, 32,119,105,116,104, 32,112,117,114,\n    101, 32,118,105,114,116,117, 97,108, 32,109,101,116,104,111,\n    100,115, 10, 32,  9,  9,114,101,116,117,114,110, 10, 32,  9,\n    101,110,100, 10, 10, 32,111,117,116,112,117,116, 40,112,114,\n    101, 46, 46, 39,116,111,108,117, 97, 95,102,117,110, 99,116,\n    105,111,110, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46,\n     46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34,\n     44, 39, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46,\n     46, 39, 41, 59, 39, 41, 10, 32, 32,105,102, 32,115,101,108,\n    102, 46,110, 97,109,101, 32, 61, 61, 32, 39,110,101,119, 39,\n     32,116,104,101,110, 10,  9, 32, 32,111,117,116,112,117,116,\n     40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,102,117,\n    110, 99,116,105,111,110, 40,116,111,108,117, 97, 95, 83, 44,\n     34,110,101,119, 95,108,111, 99, 97,108, 34, 44, 39, 46, 46,\n    115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108,\n    111, 99, 97,108, 41, 59, 39, 41, 10,  9, 32, 32,111,117,116,\n    112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97,\n     95,102,117,110, 99,116,105,111,110, 40,116,111,108,117, 97,\n     95, 83, 44, 34, 46, 99, 97,108,108, 34, 44, 39, 46, 46,115,\n    101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 95,108,111,\n     99, 97,108, 41, 59, 39, 41, 10,  9, 32, 32, 45, 45,111,117,\n    116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,115,101,\n    116, 95, 99, 97,108,108, 95,101,118,101,110,116, 40,116,111,\n    108,117, 97, 95, 83, 44, 39, 46, 46,115,101,108,102, 46, 99,\n    110, 97,109,101, 46, 46, 39, 95,108,111, 99, 97,108, 44, 32,\n     34, 39, 46, 46,115,101,108,102, 46,112, 97,114,101,110,116,\n     46,116,121,112,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32,\n     32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,\n    105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,\n    116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,\n    105,111,110, 58,112,114,105,110,116, 32, 40,105,100,101,110,\n    116, 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 70,117,110, 99,116,105,\n    111,110,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,\n    101,110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39,\n     34, 46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,\n    115,101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32, 99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,\n    115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46,\n     46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39,\n     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41,\n     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105,\n     93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103,\n    115, 91,105, 93, 58,112,114,105,110,116, 40,105,100,101,110,\n    116, 46, 46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,\n    105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,\n    114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,\n    110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102,\n     32,105,116, 32,114,101,116,117,114,110,115, 32, 97,110, 32,\n    111, 98,106,101, 99,116, 32, 98,121, 32,118, 97,108,117,101,\n     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,\n     70,117,110, 99,116,105,111,110, 58,114,101,113,117,105,114,\n    101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116, 41,\n     10,  9,108,111, 99, 97,108, 32,114, 32, 61, 32,102, 97,108,\n    115,101, 10,  9,105,102, 32,115,101,108,102, 46,116,121,112,\n    101, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,110,111,116,\n     32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,\n    121,112,101, 41, 32, 97,110,100, 32,115,101,108,102, 46,112,\n    116,114, 61, 61, 39, 39, 32,116,104,101,110, 10,  9,  9,108,\n    111, 99, 97,108, 32,116,121,112,101, 32, 61, 32,103,115,117,\n     98, 40,115,101,108,102, 46,116,121,112,101, 44, 34, 37,115,\n     42, 99,111,110,115,116, 37,115, 43, 34, 44, 34, 34, 41, 10,\n      9, 32,116, 91,116,121,112,101, 93, 32, 61, 32, 34,116,111,\n    108,117, 97, 95, 99,111,108,108,101, 99,116, 95, 34, 32, 46,\n     46, 32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116,\n    101, 40,116,121,112,101, 41, 10,  9, 32,114, 32, 61, 32,116,\n    114,117,101, 10,  9,101,110,100, 10,  9,108,111, 99, 97,108,\n     32,105, 61, 49, 10,  9,119,104,105,108,101, 32,115,101,108,\n    102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10,  9,  9,\n    114, 32, 61, 32,115,101,108,102, 46, 97,114,103,115, 91,105,\n     93, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99,\n    116,105,111,110, 40,116, 41, 32,111,114, 32,114, 10,  9,  9,\n    105, 32, 61, 32,105, 43, 49, 10,  9,101,110,100, 10,  9,114,\n    101,116,117,114,110, 32,114, 10,101,110,100, 10, 10, 45, 45,\n     32,100,101,116,101,114,109,105,110,101, 32,108,117, 97, 32,\n    102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 32,111,\n    118,101,114,108,111, 97,100, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110,\n     58,111,118,101,114,108,111, 97,100, 32, 40, 41, 10, 32,114,\n    101,116,117,114,110, 32,115,101,108,102, 46,112, 97,114,101,\n    110,116, 58,111,118,101,114,108,111, 97,100, 40,115,101,108,\n    102, 46,108,110, 97,109,101, 41, 10,101,110,100, 10, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,112, 97,114, 97,109, 95,\n    111, 98,106,101, 99,116, 40,112, 97,114, 41, 32, 45, 45, 32,\n    114,101,116,117,114,110,115, 32,116,114,117,101, 32,105,102,\n     32,116,104,101, 32,112, 97,114, 97,109,101,116,101,114, 32,\n    104, 97,115, 32, 97,110, 32,111, 98,106,101, 99,116, 32, 97,\n    115, 32,105,116,115, 32,100,101,102, 97,117,108,116, 32,118,\n     97,108,117,101, 10, 10,  9,105,102, 32,110,111,116, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44,\n     32, 39, 61, 39, 41, 32,116,104,101,110, 32,114,101,116,117,\n    114,110, 32,102, 97,108,115,101, 32,101,110,100, 32, 45, 45,\n     32,105,116, 32,104, 97,115, 32,110,111, 32,100,101,102, 97,\n    117,108,116, 32,118, 97,108,117,101, 10, 10,  9,108,111, 99,\n     97,108, 32, 95, 44, 95, 44,100,101,102, 32, 61, 32,115,116,\n    114,105,110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32,\n     34, 61, 40, 46, 42, 41, 36, 34, 41, 10, 10,  9,105,102, 32,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114,\n     44, 32, 34,124, 34, 41, 32,116,104,101,110, 32, 45, 45, 32,\n     97, 32,108,105,115,116, 32,111,102, 32,102,108, 97,103,115,\n     10, 10,  9,  9,114,101,116,117,114,110, 32,116,114,117,101,\n     10,  9,101,110,100, 10, 10,  9,105,102, 32,115,116,114,105,\n    110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37,\n     42, 34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39,\n    115, 32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116,\n    104, 32, 97, 32,100,101,102, 97,117,108,116, 32,118, 97,108,\n    117,101, 10, 10,  9,  9,105,102, 32,115,116,114,105,110,103,\n     46,102,105,110,100, 40,112, 97,114, 44, 32, 39, 61, 37,115,\n     42,110,101,119, 39, 41, 32,111,114, 32,115,116,114,105,110,\n    103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 37, 40,\n     34, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39,115,\n     32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116,104,\n     32, 97,110, 32,105,110,115,116, 97,110, 99,101, 32, 97,115,\n     32,100,101,102, 97,117,108,116, 32,112, 97,114, 97,109,101,\n    116,101,114, 46, 46, 32,105,115, 32,116,104, 97,116, 32,118,\n     97,108,105,100, 63, 10,  9,  9,  9,114,101,116,117,114,110,\n     32,116,114,117,101, 10,  9,  9,101,110,100, 10,  9,  9,114,\n    101,116,117,114,110, 32,102, 97,108,115,101, 32, 45, 45, 32,\n    100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 32,105,\n    115, 32, 39, 78, 85, 76, 76, 39, 32,111,114, 32,115,111,109,\n    101,116,104,105,110,103, 10,  9,101,110,100, 10, 10, 10,  9,\n    105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    112, 97,114, 44, 32, 34, 91, 37, 40, 38, 93, 34, 41, 32,116,\n    104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,116,114,\n    117,101, 10,  9,101,110,100, 32, 45, 45, 32,100,101,102, 97,\n    117,108,116, 32,118, 97,108,117,101, 32,105,115, 32, 97, 32,\n     99,111,110,115,116,114,117, 99,116,111,114, 32, 99, 97,108,\n    108, 32, 40,109,111,115,116, 32,108,105,107,101,108,121, 32,\n    102,111,114, 32, 97, 32, 99,111,110,115,116, 32,114,101,102,\n    101,114,101,110, 99,101, 41, 10, 10,  9, 45, 45,105,102, 32,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114,\n     44, 32, 34, 38, 34, 41, 32,116,104,101,110, 10, 10,  9, 45,\n     45,  9,105,102, 32,115,116,114,105,110,103, 46,102,105,110,\n    100, 40,100,101,102, 44, 32, 34, 58, 34, 41, 32,111,114, 32,\n    115,116,114,105,110,103, 46,102,105,110,100, 40,100,101,102,\n     44, 32, 34, 94, 37,115, 42,110,101,119, 37,115, 43, 34, 41,\n     32,116,104,101,110, 10, 10,  9, 45, 45,  9,  9, 45, 45, 32,\n    105,116, 39,115, 32, 97, 32,114,101,102,101,114,101,110, 99,\n    101, 32,119,105,116,104, 32,100,101,102, 97,117,108,116, 32,\n    116,111, 32,115,111,109,101,116,104,105,110,103, 32,108,105,\n    107,101, 32, 67,108, 97,115,115, 58, 58,109,101,109, 98,101,\n    114, 44, 32,111,114, 32, 39,110,101,119, 32, 67,108, 97,115,\n    115, 39, 10,  9, 45, 45,  9,  9,114,101,116,117,114,110, 32,\n    116,114,117,101, 10,  9, 45, 45,  9,101,110,100, 10,  9, 45,\n     45,101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,102,\n     97,108,115,101, 32, 45, 45, 32, 63, 10,101,110,100, 10, 10,\n    102,117,110, 99,116,105,111,110, 32,115,116,114,105,112, 95,\n    108, 97,115,116, 95, 97,114,103, 40, 97,108,108, 95, 97,114,\n    103,115, 44, 32,108, 97,115,116, 95, 97,114,103, 41, 32, 45,\n     45, 32,115,116,114,105,112,115, 32,116,104,101, 32,100,101,\n    102, 97,117,108,116, 32,118, 97,108,117,101, 32,102,114,111,\n    109, 32,116,104,101, 32,108, 97,115,116, 32, 97,114,103,117,\n    109,101,110,116, 10, 10,  9,108,111, 99, 97,108, 32, 95, 44,\n     95, 44,115, 95, 97,114,103, 32, 61, 32,115,116,114,105,110,\n    103, 46,102,105,110,100, 40,108, 97,115,116, 95, 97,114,103,\n     44, 32, 34, 94, 40, 91, 94, 61, 93, 43, 41, 34, 41, 10,  9,\n    108, 97,115,116, 95, 97,114,103, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,108, 97,115,116, 95, 97,114,\n    103, 44, 32, 34, 40, 91, 37, 37, 37, 40, 37, 41, 93, 41, 34,\n     44, 32, 34, 37, 37, 37, 49, 34, 41, 59, 10,  9, 97,108,108,\n     95, 97,114,103,115, 32, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40, 97,108,108, 95, 97,114,103,115, 44, 32,\n     34, 37,115, 42, 44, 37,115, 42, 34, 46, 46,108, 97,115,116,\n     95, 97,114,103, 46, 46, 34, 37,115, 42, 37, 41, 37,115, 42,\n     36, 34, 44, 32, 34, 41, 34, 41, 10,  9,114,101,116,117,114,\n    110, 32, 97,108,108, 95, 97,114,103,115, 44, 32,115, 95, 97,\n    114,103, 10,101,110,100, 10, 10, 10, 10, 45, 45, 32, 73,110,\n    116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117, 99,\n    116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95, 70,\n    117,110, 99,116,105,111,110, 32, 40,116, 41, 10, 32,115,101,\n    116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108,\n     97,115,115, 70,117,110, 99,116,105,111,110, 41, 10, 10, 32,\n    105,102, 32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39,\n     99,111,110,115,116, 39, 32, 97,110,100, 32,116, 46, 99,111,\n    110,115,116, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 10,\n     32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,\n    105,100, 32, 39, 99,111,110,115,116, 39, 32,115,112,101, 99,\n    105,102,105, 99, 97,116,105,111,110, 34, 41, 10, 32,101,110,\n    100, 10, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,\n    105,102, 32,116, 58,105,110, 99,108, 97,115,115, 40, 41, 32,\n    116,104,101,110, 10, 32, 45, 45,112,114,105,110,116, 32, 40,\n     39,116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116,\n     46,110, 97,109,101, 46, 46, 39, 44, 32,112, 97,114,101,110,\n    116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116, 46,\n    112, 97,114,101,110,116, 46,110, 97,109,101, 41, 10, 32, 32,\n    105,102, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    116, 46,110, 97,109,101, 44, 32, 34, 37, 98, 60, 62, 34, 44,\n     32, 34, 34, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40,116, 46,112, 97,114,101,110,116, 46,111,\n    114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,114,\n     32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 44,\n     32, 34, 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,\n    101,110, 10, 32, 32, 32,116, 46,110, 97,109,101, 32, 61, 32,\n     39,110,101,119, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,\n    101, 32, 61, 32, 39,110,101,119, 39, 10, 32, 32, 32,116, 46,\n    112, 97,114,101,110,116, 46, 95,110,101,119, 32, 61, 32,116,\n    114,117,101, 10, 32, 32, 32,116, 46,116,121,112,101, 32, 61,\n     32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 10,\n     32, 32, 32,116, 46,112,116,114, 32, 61, 32, 39, 42, 39, 10,\n     32, 32,101,108,115,101,105,102, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,116, 46,110, 97,109,101, 44, 32, 34,\n     37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32, 61, 61, 32, 39,\n    126, 39, 46, 46,115,116,114,105,110,103, 46,103,115,117, 98,\n     40,116, 46,112, 97,114,101,110,116, 46,111,114,105,103,105,\n    110, 97,108, 95,110, 97,109,101, 32,111,114, 32,116, 46,112,\n     97,114,101,110,116, 46,110, 97,109,101, 44, 32, 34, 37, 98,\n     60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,101,110, 10, 32,\n     32, 32,116, 46,110, 97,109,101, 32, 61, 32, 39,100,101,108,\n    101,116,101, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,101,\n     32, 61, 32, 39,100,101,108,101,116,101, 39, 10, 32, 32, 32,\n    116, 46,112, 97,114,101,110,116, 46, 95,100,101,108,101,116,\n    101, 32, 61, 32,116,114,117,101, 10, 32, 32,101,110,100, 10,\n     32,101,110,100, 10, 32,116, 46, 99,110, 97,109,101, 32, 61,\n     32,116, 58, 99,102,117,110, 99,110, 97,109,101, 40, 34,116,\n    111,108,117, 97, 34, 41, 46, 46,116, 58,111,118,101,114,108,\n    111, 97,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,\n    116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,\n    114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,\n    116,115, 32,116,104,114,101,101, 32,115,116,114,105,110,103,\n    115, 58, 32,111,110,101, 32,114,101,112,114,101,115,101,110,\n    116,105,110,103, 32,116,104,101, 32,102,117,110, 99,116,105,\n    111,110, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 44,\n     10, 45, 45, 32, 97,110,111,116,104,101,114, 32,114,101,112,\n    114,101,115,101,110,116,105,110,103, 32,116,104,101, 32, 97,\n    114,103,117,109,101,110,116, 32,108,105,115,116, 44, 32, 97,\n    110,100, 32,116,104,101, 32,116,104,105,114,100, 32,114,101,\n    112,114,101,115,101,110,116,105,110,103, 10, 45, 45, 32,116,\n    104,101, 32, 34, 99,111,110,115,116, 34, 32,111,114, 32,101,\n    109,112,116,121, 32,115,116,114,105,110,103, 46, 10,102,117,\n    110, 99,116,105,111,110, 32, 70,117,110, 99,116,105,111,110,\n     32, 40,100, 44, 97, 44, 99, 41, 10, 32, 45, 45,108,111, 99,\n     97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116,\n    114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 44, 39, 44,\n     39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,\n     32, 98,114, 97, 99,101,115, 10, 32, 45, 45,108,111, 99, 97,\n    108, 32,116, 32, 61, 32,115,112,108,105,116, 95,112, 97,114,\n     97,109,115, 40,115,116,114,115,117, 98, 40, 97, 44, 50, 44,\n     45, 50, 41, 41, 10, 10,  9,105,102, 32,110,111,116, 32,102,\n    108, 97,103,115, 91, 39, 87, 39, 93, 32, 97,110,100, 32,115,\n    116,114,105,110,103, 46,102,105,110,100, 40, 97, 44, 32, 34,\n     37, 46, 37, 46, 37, 46, 37,115, 42, 37, 41, 34, 41, 32,116,\n    104,101,110, 10, 10,  9,  9,119, 97,114,110,105,110,103, 40,\n     34, 70,117,110, 99,116,105,111,110,115, 32,119,105,116,104,\n     32,118, 97,114,105, 97, 98,108,101, 32, 97,114,103,117,109,\n    101,110,116,115, 32, 40, 96, 46, 46, 46, 39, 41, 32, 97,114,\n    101, 32,110,111,116, 32,115,117,112,112,111,114,116,101,100,\n     46, 32, 73,103,110,111,114,105,110,103, 32, 34, 46, 46,100,\n     46, 46, 97, 46, 46, 99, 41, 10,  9,  9,114,101,116,117,114,\n    110, 32,110,105,108, 10,  9,101,110,100, 10, 10, 10, 32,108,\n    111, 99, 97,108, 32,105, 61, 49, 10, 32,108,111, 99, 97,108,\n     32,108, 32, 61, 32,123,110, 61, 48,125, 10, 10, 32,  9, 97,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n     97, 44, 32, 34, 37,115, 42, 40, 91, 37, 40, 37, 41, 93, 41,\n     37,115, 42, 34, 44, 32, 34, 37, 49, 34, 41, 10,  9,108,111,\n     99, 97,108, 32,116, 44,115,116,114,105,112, 44,108, 97,115,\n    116, 32, 61, 32,115,116,114,105,112, 95,112, 97,114,115, 40,\n    115,116,114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 41,\n     59, 10,  9,105,102, 32,115,116,114,105,112, 32,116,104,101,\n    110, 10,  9,  9, 45, 45,108,111, 99, 97,108, 32,110,115, 32,\n     61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115,116,\n    114,115,117, 98, 40, 97, 44, 49, 44, 45, 50, 41, 44, 32, 49,\n     44, 32, 45, 40,115,116,114,105,110,103, 46,108,101,110, 40,\n    108, 97,115,116, 41, 43, 49, 41, 41, 10,  9,  9,108,111, 99,\n     97,108, 32,110,115, 32, 61, 32,106,111,105,110, 40,116, 44,\n     32, 34, 44, 34, 44, 32, 49, 44, 32,108, 97,115,116, 45, 49,\n     41, 10, 10,  9,  9,110,115, 32, 61, 32, 34, 40, 34, 46, 46,\n    115,116,114,105,110,103, 46,103,115,117, 98, 40,110,115, 44,\n     32, 34, 37,115, 42, 44, 37,115, 42, 36, 34, 44, 32, 34, 34,\n     41, 46, 46, 39, 41, 39, 10,  9,  9, 45, 45,110,115, 32, 61,\n     32,115,116,114,105,112, 95,100,101,102, 97,117,108,116,115,\n     40,110,115, 41, 10, 10,  9,  9, 70,117,110, 99,116,105,111,\n    110, 40,100, 44, 32,110,115, 44, 32, 99, 41, 10,  9,  9,102,\n    111,114, 32,105, 61, 49, 44,108, 97,115,116, 32,100,111, 10,\n      9,  9,  9,116, 91,105, 93, 32, 61, 32,115,116,114,105,110,\n    103, 46,103,115,117, 98, 40,116, 91,105, 93, 44, 32, 34, 61,\n     46, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,  9,101,110,100,\n     10,  9,101,110,100, 10, 10, 32,119,104,105,108,101, 32,116,\n     91,105, 93, 32,100,111, 10, 32, 32,108, 46,110, 32, 61, 32,\n    108, 46,110, 43, 49, 10, 32, 32,108, 91,108, 46,110, 93, 32,\n     61, 32, 68,101, 99,108, 97,114, 97,116,105,111,110, 40,116,\n     91,105, 93, 44, 39,118, 97,114, 39, 44,116,114,117,101, 41,\n     10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100,\n     10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32, 68,101, 99,\n    108, 97,114, 97,116,105,111,110, 40,100, 44, 39,102,117,110,\n     99, 39, 41, 10, 32,102, 46, 97,114,103,115, 32, 61, 32,108,\n     10, 32,102, 46, 99,111,110,115,116, 32, 61, 32, 99, 10, 32,\n    114,101,116,117,114,110, 32, 95, 70,117,110, 99,116,105,111,\n    110, 40,102, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,\n    105,111,110, 32,106,111,105,110, 40,116, 44, 32,115,101,112,\n     44, 32,102,105,114,115,116, 44, 32,108, 97,115,116, 41, 10,\n     10,  9,102,105,114,115,116, 32, 61, 32,102,105,114,115,116,\n     32,111,114, 32, 49, 10,  9,108, 97,115,116, 32, 61, 32,108,\n     97,115,116, 32,111,114, 32,116, 97, 98,108,101, 46,103,101,\n    116,110, 40,116, 41, 10,  9,108,111, 99, 97,108, 32,108,115,\n    101,112, 32, 61, 32, 34, 34, 10,  9,108,111, 99, 97,108, 32,\n    114,101,116, 32, 61, 32, 34, 34, 10,  9,108,111, 99, 97,108,\n     32,108,111,111,112, 32, 61, 32,102, 97,108,115,101, 10,  9,\n    102,111,114, 32,105, 32, 61, 32,102,105,114,115,116, 44,108,\n     97,115,116, 32,100,111, 10, 10,  9,  9,114,101,116, 32, 61,\n     32,114,101,116, 46, 46,108,115,101,112, 46, 46,116, 91,105,\n     93, 10,  9,  9,108,115,101,112, 32, 61, 32,115,101,112, 10,\n      9,  9,108,111,111,112, 32, 61, 32,116,114,117,101, 10,  9,\n    101,110,100, 10,  9,105,102, 32,110,111,116, 32,108,111,111,\n    112, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,110,\n     32, 34, 34, 10,  9,101,110,100, 10, 10,  9,114,101,116,117,\n    114,110, 32,114,101,116, 10,101,110,100, 10, 10,102,117,110,\n     99,116,105,111,110, 32,115,116,114,105,112, 95,112, 97,114,\n    115, 40,115, 41, 10, 10,  9,108,111, 99, 97,108, 32,116, 32,\n     61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,\n    115, 40,115, 44, 32, 39, 44, 39, 41, 10,  9,108,111, 99, 97,\n    108, 32,115,116,114,105,112, 32, 61, 32,102, 97,108,115,101,\n     10,  9,108,111, 99, 97,108, 32,108, 97,115,116, 10, 10,  9,\n    102,111,114, 32,105, 61,116, 46,110, 44, 49, 44, 45, 49, 32,\n    100,111, 10, 10,  9,  9,105,102, 32,110,111,116, 32,115,116,\n    114,105,112, 32, 97,110,100, 32,112, 97,114, 97,109, 95,111,\n     98,106,101, 99,116, 40,116, 91,105, 93, 41, 32,116,104,101,\n    110, 10,  9,  9,  9,108, 97,115,116, 32, 61, 32,105, 10,  9,\n      9,  9,115,116,114,105,112, 32, 61, 32,116,114,117,101, 10,\n      9,  9,101,110,100, 10,  9,  9, 45, 45,105,102, 32,115,116,\n    114,105,112, 32,116,104,101,110, 10,  9,  9, 45, 45,  9,116,\n     91,105, 93, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 40,116, 91,105, 93, 44, 32, 34, 61, 46, 42, 36, 34,\n     44, 32, 34, 34, 41, 10,  9,  9, 45, 45,101,110,100, 10,  9,\n    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,116, 44,\n    115,116,114,105,112, 44,108, 97,115,116, 10, 10,101,110,100,\n     10, 10,102,117,110, 99,116,105,111,110, 32,115,116,114,105,\n    112, 95,100,101,102, 97,117,108,116,115, 40,115, 41, 10, 10,\n      9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40,115, 44, 32, 34, 94, 37, 40, 34, 44, 32, 34, 34, 41,\n     10,  9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 40,115, 44, 32, 34, 37, 41, 36, 34, 44, 32, 34, 34,\n     41, 10, 10,  9,108,111, 99, 97,108, 32,116, 32, 61, 32,115,\n    112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115,\n     44, 32, 34, 44, 34, 41, 10,  9,108,111, 99, 97,108, 32,115,\n    101,112, 44, 32,114,101,116, 32, 61, 32, 34, 34, 44, 34, 34,\n     10,  9,102,111,114, 32,105, 61, 49, 44,116, 46,110, 32,100,\n    111, 10,  9,  9,116, 91,105, 93, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,116, 91,105, 93, 44, 32, 34,\n     61, 46, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,  9,114,101,\n    116, 32, 61, 32,114,101,116, 46, 46,115,101,112, 46, 46,116,\n     91,105, 93, 10,  9,  9,115,101,112, 32, 61, 32, 34, 44, 34,\n     10,  9,101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,\n     34, 40, 34, 46, 46,114,101,116, 46, 46, 34, 41, 34, 10,101,\n    110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/function.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32,111,112,101,114, 97,\n    116,111,114, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,\n    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,\n    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,\n    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,\n    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,\n     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,\n    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,\n    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,\n    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,\n     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,\n    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,\n    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,\n    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,\n    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,\n    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,\n     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,\n    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,\n    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,\n     32, 79,112,101,114, 97,116,111,114, 32, 99,108, 97,115,115,\n     10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,\n     97,110, 32,111,112,101,114, 97,116,111,114, 32,102,117,110,\n     99,116,105,111,110, 32,111,114, 32, 97, 32, 99,108, 97,115,\n    115, 32,111,112,101,114, 97,116,111,114, 32,109,101,116,104,\n    111,100, 46, 10, 45, 45, 32, 73,116, 32,115,116,111,114,101,\n    115, 32,116,104,101, 32,115, 97,109,101, 32,102,105,101,108,\n    100,115, 32, 97,115, 32,102,117,110, 99,116,105,111,110,115,\n     32,100,111, 32,112,108,117,115, 58, 10, 45, 45, 32, 32,107,\n    105,110,100, 32, 61, 32,115,101,116, 32,111,102, 32, 99,104,\n     97,114, 97, 99,116,101,114, 32,114,101,112,114,101,115,101,\n    110,116,105,110,103, 32,116,104,101, 32,111,112,101,114, 97,\n    116,111,114, 32, 40, 97,115, 32,105,116, 32, 97,112,112,101,\n    114,115, 32,105,110, 32, 67, 43, 43, 32, 99,111,100,101, 41,\n     10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,114, 32,\n     61, 32,123, 10, 32,107,105,110,100, 32, 61, 32, 39, 39, 44,\n     10,125, 10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,\n    114, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,\n    115,115, 79,112,101,114, 97,116,111,114, 10,115,101,116,109,\n    101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 79,\n    112,101,114, 97,116,111,114, 44, 99,108, 97,115,115, 70,117,\n    110, 99,116,105,111,110, 41, 10, 10, 45, 45, 32,116, 97, 98,\n    108,101, 32,116,111, 32,116,114, 97,110,115,102,111,114,109,\n     32,111,112,101,114, 97,116,111,114, 32,107,105,110,100, 32,\n    105,110,116,111, 32,116,104,101, 32, 97,112,112,114,111,112,\n    114,105, 97,116,101, 32,116, 97,103, 32,109,101,116,104,111,\n    100, 32,110, 97,109,101, 10, 95, 84, 77, 32, 61, 32,123, 91,\n     39, 43, 39, 93, 32, 61, 32, 39, 97,100,100, 39, 44, 10, 32,\n     32, 32, 32, 32, 32, 32, 91, 39, 45, 39, 93, 32, 61, 32, 39,\n    115,117, 98, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39,\n     42, 39, 93, 32, 61, 32, 39,109,117,108, 39, 44, 10, 32, 32,\n     32, 32, 32, 32, 32, 91, 39, 47, 39, 93, 32, 61, 32, 39,100,\n    105,118, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 60,\n     39, 93, 32, 61, 32, 39,108,116, 39, 44, 10, 32, 32, 32, 32,\n     32, 32, 32, 91, 39, 60, 61, 39, 93, 32, 61, 32, 39,108,101,\n     39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 61, 61, 39,\n     93, 32, 61, 32, 39,101,113, 39, 44, 10, 32, 32, 32, 32, 32,\n     32, 32, 91, 39, 91, 93, 39, 93, 32, 61, 32, 39,103,101,116,\n    105, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 38, 91,\n     93, 39, 93, 32, 61, 32, 39,115,101,116,105, 39, 44, 10, 32,\n     32, 32, 32, 32, 32, 32, 45, 45, 91, 39, 45, 62, 39, 93, 32,\n     61, 32, 39,102,108,101, 99,104,105,116, 97, 39, 44, 10, 32,\n     32, 32, 32, 32, 32,125, 10, 10, 10, 45, 45, 32, 80,114,105,\n    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 79,112,101,114, 97,116,\n    111,114, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,\n     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,\n    105,100,101,110,116, 46, 46, 34, 79,112,101,114, 97,116,111,\n    114,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,107,105,110,100, 32, 32, 61, 32, 39,\n     34, 46, 46,115,101,108,102, 46,107,105,110,100, 46, 46, 34,\n     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,\n    110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34,\n     46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44,\n     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,\n     46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,\n    115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n     99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,\n    101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34,\n     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,\n    101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,\n    100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103,115, 91,\n    105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32,\n     61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,\n    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100,\n     10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,\n    115, 79,112,101,114, 97,116,111,114, 58,115,117,112, 99,111,\n    100,101, 95,116,109,112, 40, 41, 10, 10,  9,105,102, 32,110,\n    111,116, 32, 95, 84, 77, 91,115,101,108,102, 46,107,105,110,\n    100, 93, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,\n    110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110,\n     46,115,117,112, 99,111,100,101, 40,115,101,108,102, 41, 10,\n      9,101,110,100, 10, 10,  9, 45, 45, 32,110,111, 32,111,118,\n    101,114,108,111, 97,100, 44, 32,110,111, 32,112, 97,114, 97,\n    109,101,116,101,114,115, 44, 32, 97,108,119, 97,121,115, 32,\n    105,110, 99,108, 97,115,115, 10,  9,111,117,116,112,117,116,\n     40, 34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,\n    101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,\n    108, 97,115,115, 32, 34, 44,115,101,108,102, 58,105,110, 99,\n    108, 97,115,115, 40, 41, 44, 34, 32, 42, 47, 34, 41, 10, 10,\n      9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,\n    102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69,\n     95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 41,\n     10,  9,111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,\n    116,105, 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,\n    110, 97,109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,\n    101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 10,\n      9,105,102, 32,111,118,101,114,108,111, 97,100, 32, 60, 32,\n     48, 32,116,104,101,110, 10,  9, 32,111,117,116,112,117,116,\n     40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65,\n     95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,101,\n    110,100, 10,  9,111,117,116,112,117,116, 40, 39, 32,116,111,\n    108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97,\n     95,101,114,114, 59, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10,  9, 45, 45,\n     32, 99,104,101, 99,107, 32,115,101,108,102, 10,  9,108,111,\n     99, 97,108, 32,105,115, 95,102,117,110, 99, 32, 61, 32,103,\n    101,116, 95,105,115, 95,102,117,110, 99,116,105,111,110, 40,\n    115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,\n    101, 41, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32,\n     32, 32, 33, 39, 46, 46,105,115, 95,102,117,110, 99, 46, 46,\n     39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 34, 39, 46,\n     46,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,\n    112,101, 46, 46, 39, 34, 44, 48, 44, 38,116,111,108,117, 97,\n     95,101,114,114, 41, 32,124,124, 92,110, 39, 41, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111,\n    108,117, 97, 95,105,115,110,111,111, 98,106, 40,116,111,108,\n    117, 97, 95, 83, 44, 50, 44, 38,116,111,108,117, 97, 95,101,\n    114,114, 41, 92,110, 32, 41, 39, 41, 10,  9,111,117,116,112,\n    117,116, 40, 39, 32, 32,103,111,116,111, 32,116,111,108,117,\n     97, 95,108,101,114,114,111,114, 59, 39, 41, 10, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32,101,108,115,101, 92,110, 39,\n     41, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,\n    105,102, 92,110, 39, 41, 32, 45, 45, 32,116,111,108,117, 97,\n     95,114,101,108,101, 97,115,101, 10,  9,111,117,116,112,117,\n    116, 40, 39, 32,123, 39, 41, 10, 10,  9, 45, 45, 32,100,101,\n     99,108, 97,114,101, 32,115,101,108,102, 10,  9,111,117,116,\n    112,117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111,\n    110,115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116,\n     46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102,\n     32, 61, 32, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39,\n     40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,115,\n    101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101,\n     44, 39, 42, 41, 32, 39, 41, 10,  9,108,111, 99, 97,108, 32,\n    116,111, 95,102,117,110, 99, 32, 61, 32,103,101,116, 95,116,\n    111, 95,102,117,110, 99, 40,115,101,108,102, 46,112, 97,114,\n    101,110,116, 46,116,121,112,101, 41, 10,  9,111,117,116,112,\n    117,116, 40,116,111, 95,102,117,110, 99, 44, 39, 40,116,111,\n    108,117, 97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10, 10,\n      9, 45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10,\n      9,111,117,116,112,117,116, 40, 39, 35,105,102,110,100,101,\n    102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69,\n     92,110, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 32,\n     32,105,102, 32, 40, 33,115,101,108,102, 41, 32,116,111,108,\n    117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95,\n     83, 44, 34,105,110,118, 97,108,105,100, 32, 92, 39,115,101,\n    108,102, 92, 39, 32,105,110, 32,102,117,110, 99,116,105,111,\n    110, 32, 92, 39, 39, 46, 46,115,101,108,102, 46,110, 97,109,\n    101, 46, 46, 39, 92, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39,\n     41, 59, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,110,\n    100,105,102, 92,110, 39, 41, 10, 10,  9, 45, 45, 32, 99, 97,\n    115,116, 32,115,101,108,102, 10,  9,111,117,116,112,117,116,\n     40, 39, 32, 32, 39, 44,115,101,108,102, 46,109,111,100, 44,\n    115,101,108,102, 46,116,121,112,101, 44,115,101,108,102, 46,\n    112,116,114, 44, 39,116,111,108,117, 97, 95,114,101,116, 32,\n     61, 32, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 40,\n     39, 44,115,101,108,102, 46,109,111,100, 44,115,101,108,102,\n     46,116,121,112,101, 44,115,101,108,102, 46,112,116,114, 44,\n     39, 41, 40, 42,115,101,108,102, 41, 59, 39, 41, 10, 10,  9,\n     45, 45, 32,114,101,116,117,114,110, 32,118, 97,108,117,101,\n     10,  9,108,111, 99, 97,108, 32,116, 44, 99,116, 32, 61, 32,\n    105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,\n    112,101, 41, 10,  9,105,102, 32,116, 32,116,104,101,110, 10,\n      9,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,\n    108,117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46, 39,\n     40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116, 44,\n     39, 41,116,111,108,117, 97, 95,114,101,116, 41, 59, 39, 41,\n     10,  9,101,108,115,101, 10,  9,  9,116, 32, 61, 32,115,101,\n    108,102, 46,116,121,112,101, 10,  9,  9,108,111, 99, 97,108,\n     32,112,117,115,104, 95,102,117,110, 99, 32, 61, 32,103,101,\n    116, 95,112,117,115,104, 95,102,117,110, 99,116,105,111,110,\n     40,116, 41, 10,  9,  9,110,101,119, 95,116, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34,\n     99,111,110,115,116, 37,115, 43, 34, 44, 32, 34, 34, 41, 10,\n      9,  9,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61,\n     61, 32, 39, 39, 32,116,104,101,110, 10,  9,  9,  9,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32,123, 39, 41, 10,  9,  9,\n      9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101,102,\n     32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, 39,\n     41, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32,\n     32, 32,118,111,105,100, 42, 32,116,111,108,117, 97, 95,111,\n     98,106, 32, 61, 32, 77,116,111,108,117, 97, 95,110,101,119,\n     40, 40, 39, 44,110,101,119, 95,116, 44, 39, 41, 40,116,111,\n    108,117, 97, 95,114,101,116, 41, 41, 59, 39, 41, 10,  9,  9,\n      9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, 39, 44,\n    112,117,115,104, 95,102,117,110, 99, 44, 39, 40,116,111,108,\n    117, 97, 95, 83, 44,116,111,108,117, 97, 95,111, 98,106, 44,\n     34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,  9,\n    111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,\n    117, 97, 95,114,101,103,105,115,116,101,114, 95,103, 99, 40,\n    116,111,108,117, 97, 95, 83, 44,108,117, 97, 95,103,101,116,\n    116,111,112, 40,116,111,108,117, 97, 95, 83, 41, 41, 59, 39,\n     41, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,\n    108,115,101, 92,110, 39, 41, 10,  9,  9,  9,111,117,116,112,\n    117,116, 40, 39, 32, 32, 32, 32,118,111,105,100, 42, 32,116,\n    111,108,117, 97, 95,111, 98,106, 32, 61, 32,116,111,108,117,\n     97, 95, 99,111,112,121, 40,116,111,108,117, 97, 95, 83, 44,\n     40,118,111,105,100, 42, 41, 38,116,111,108,117, 97, 95,114,\n    101,116, 44,115,105,122,101,111,102, 40, 39, 44,116, 44, 39,\n     41, 41, 59, 39, 41, 10,  9,  9,  9,111,117,116,112,117,116,\n     40, 39, 32, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117,\n    110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44,116,111,\n    108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, 44, 39, 34,\n     41, 59, 39, 41, 10,  9,  9,  9,111,117,116,112,117,116, 40,\n     39, 32, 32, 32, 32,116,111,108,117, 97, 95,114,101,103,105,\n    115,116,101,114, 95,103, 99, 40,116,111,108,117, 97, 95, 83,\n     44,108,117, 97, 95,103,101,116,116,111,112, 40,116,111,108,\n    117, 97, 95, 83, 41, 41, 59, 39, 41, 10,  9,  9,  9,111,117,\n    116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39,\n     41, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32,\n     32,125, 39, 41, 10,  9,  9,101,108,115,101,105,102, 32,115,\n    101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39, 32,\n    116,104,101,110, 10,  9,  9,  9,111,117,116,112,117,116, 40,\n     39, 32, 32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99,\n     44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,\n    100, 42, 41, 38,116,111,108,117, 97, 95,114,101,116, 44, 34,\n     39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,101,108,\n    115,101, 10,  9,  9,  9,105,102, 32,108,111, 99, 97,108, 95,\n     99,111,110,115,116,114,117, 99,116,111,114, 32,116,104,101,\n    110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32,\n     32, 32, 39, 44,112,117,115,104, 95,102,117,110, 99, 44, 39,\n     40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 32,\n     42, 41,116,111,108,117, 97, 95,114,101,116, 44, 34, 39, 44,\n    116, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,  9,  9,111,117,\n    116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97,\n     95,114,101,103,105,115,116,101,114, 95,103, 99, 40,116,111,\n    108,117, 97, 95, 83, 44,108,117, 97, 95,103,101,116,116,111,\n    112, 40,116,111,108,117, 97, 95, 83, 41, 41, 59, 39, 41, 10,\n      9,  9,  9,101,108,115,101, 10,  9,  9,  9,  9,111,117,116,\n    112,117,116, 40, 39, 32, 32, 32, 39, 44,112,117,115,104, 95,\n    102,117,110, 99, 44, 39, 40,116,111,108,117, 97, 95, 83, 44,\n     40,118,111,105,100, 42, 41,116,111,108,117, 97, 95,114,101,\n    116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9,\n      9,  9,101,110,100, 10,  9,  9,101,110,100, 10,  9,101,110,\n    100, 10, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32,125,\n     39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 32,114,101,\n    116,117,114,110, 32, 49, 59, 39, 41, 10, 10,  9,111,117,116,\n    112,117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79,\n     76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41,\n     10,  9,111,117,116,112,117,116, 40, 39,116,111,108,117, 97,\n     95,108,101,114,114,111,114, 58, 92,110, 39, 41, 10,  9,111,\n    117,116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,101,\n    114,114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34, 35,\n    102,101,114,114,111,114, 32,105,110, 32,102,117,110, 99,116,\n    105,111,110, 32, 92, 39, 39, 46, 46,115,101,108,102, 46,108,\n    110, 97,109,101, 46, 46, 39, 92, 39, 46, 34, 44, 38,116,111,\n    108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10,  9,111,117,\n    116,112,117,116, 40, 39, 32,114,101,116,117,114,110, 32, 48,\n     59, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,\n    110,100,105,102, 92,110, 39, 41, 10, 10, 10,  9,111,117,116,\n    112,117,116, 40, 39,125, 39, 41, 10,  9,111,117,116,112,117,\n    116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,\n    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,\n     66, 76, 69, 92,110, 39, 41, 10,  9,111,117,116,112,117,116,\n     40, 39, 92,110, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,\n     73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,\n    117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32,\n     95, 79,112,101,114, 97,116,111,114, 32, 40,116, 41, 10, 32,\n    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44,\n     99,108, 97,115,115, 79,112,101,114, 97,116,111,114, 41, 10,\n     10, 32,105,102, 32,116, 46, 99,111,110,115,116, 32,126, 61,\n     32, 39, 99,111,110,115,116, 39, 32, 97,110,100, 32,116, 46,\n     99,111,110,115,116, 32,126, 61, 32, 39, 39, 32,116,104,101,\n    110, 10, 32, 32,101,114,114,111,114, 40, 34, 35,105,110,118,\n     97,108,105,100, 32, 39, 99,111,110,115,116, 39, 32,115,112,\n    101, 99,105,102,105, 99, 97,116,105,111,110, 34, 41, 10, 32,\n    101,110,100, 10, 10, 32, 97,112,112,101,110,100, 40,116, 41,\n     10, 32,105,102, 32,110,111,116, 32,116, 58,105,110, 99,108,\n     97,115,115, 40, 41, 32,116,104,101,110, 10, 32, 32,101,114,\n    114,111,114, 40, 34, 35,111,112,101,114, 97,116,111,114, 32,\n     99, 97,110, 32,111,110,108,121, 32, 98,101, 32,100,101,102,\n    105,110,101,100, 32, 97,115, 32, 99,108, 97,115,115, 32,109,\n    101,109, 98,101,114, 34, 41, 10, 32,101,110,100, 10, 10, 32,\n     45, 45,116, 46,110, 97,109,101, 32, 61, 32,116, 46,110, 97,\n    109,101, 32, 46, 46, 32, 34, 95, 34, 32, 46, 46, 32, 40, 95,\n     84, 77, 91,116, 46,107,105,110,100, 93, 32,111,114, 32,116,\n     46,107,105,110,100, 41, 10, 32,116, 46, 99,110, 97,109,101,\n     32, 61, 32,116, 58, 99,102,117,110, 99,110, 97,109,101, 40,\n     34,116,111,108,117, 97, 34, 41, 46, 46,116, 58,111,118,101,\n    114,108,111, 97,100, 40,116, 41, 10, 32,116, 46,110, 97,109,\n    101, 32, 61, 32, 34,111,112,101,114, 97,116,111,114, 34, 32,\n     46, 46, 32,116, 46,107,105,110,100, 32, 32, 45, 45, 32,115,\n    101,116, 32, 97,112,112,114,111,112,114,105, 97,116,101, 32,\n     99, 97,108,108,105,110,103, 32,110, 97,109,101, 10, 32,114,\n    101,116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45,\n     32, 67,111,110,115,116,114,117, 99,116,111,114, 10,102,117,\n    110, 99,116,105,111,110, 32, 79,112,101,114, 97,116,111,114,\n     32, 40,100, 44,107, 44, 97, 44, 99, 41, 10, 10,  9,108,111,\n     99, 97,108, 32,111,112, 95,107, 32, 61, 32,115,116,114,105,\n    110,103, 46,103,115,117, 98, 40,107, 44, 32, 34, 94, 37,115,\n     42, 34, 44, 32, 34, 34, 41, 10,  9,111,112, 95,107, 32, 61,\n     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,107, 44,\n     32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9, 45,\n     45,105,102, 32,115,116,114,105,110,103, 46,102,105,110,100,\n     40,107, 44, 32, 34, 94, 91, 37,119, 95, 58, 37,100, 60, 62,\n     37, 42, 37, 38, 93, 43, 36, 34, 41, 32,116,104,101,110, 10,\n      9,105,102, 32,100, 32, 61, 61, 32, 34,111,112,101,114, 97,\n    116,111,114, 34, 32, 97,110,100, 32,107, 32,126, 61, 32, 39,\n     39, 32,116,104,101,110, 10, 10,  9,  9,100, 32, 61, 32,107,\n     46, 46, 34, 32,111,112,101,114, 97,116,111,114, 34, 10,  9,\n    101,108,115,101,105,102, 32,110,111,116, 32, 95, 84, 77, 91,\n    111,112, 95,107, 93, 32,116,104,101,110, 10, 10,  9,  9,105,\n    102, 32,102,108, 97,103,115, 91, 39, 87, 39, 93, 32,116,104,\n    101,110, 10,  9,  9,  9,101,114,114,111,114, 40, 34,116,111,\n    108,117, 97, 58, 32,110,111, 32,115,117,112,112,111,114,116,\n     32,102,111,114, 32,111,112,101,114, 97,116,111,114, 34, 32,\n     46, 46, 32,102, 46,107,105,110,100, 41, 10,  9,  9,101,108,\n    115,101, 10,  9,  9,  9,119, 97,114,110,105,110,103, 40, 34,\n     78,111, 32,115,117,112,112,111,114,116, 32,102,111,114, 32,\n    111,112,101,114, 97,116,111,114, 32, 34, 46, 46,111,112, 95,\n    107, 46, 46, 34, 44, 32,105,103,110,111,114,105,110,103, 34,\n     41, 10,  9,  9,  9,114,101,116,117,114,110, 32,110,105,108,\n     10,  9,  9,101,110,100, 10,  9,101,110,100, 10, 10,  9,108,\n    111, 99, 97,108, 32,114,101,102, 32, 61, 32, 39, 39, 10, 32,\n    108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116,\n     95, 99, 95,116,111,107,101,110,115, 40,115,116,114,115,117,\n     98, 40, 97, 44, 50, 44,115,116,114,108,101,110, 40, 97, 41,\n     45, 49, 41, 44, 39, 44, 39, 41, 32, 45, 45, 32,101,108,105,\n    109,105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,108,111, 99, 97,\n    108, 32,108, 32, 61, 32,123,110, 61, 48,125, 10, 32,119,104,\n    105,108,101, 32,116, 91,105, 93, 32,100,111, 10, 32, 32,108,\n     46,110, 32, 61, 32,108, 46,110, 43, 49, 10, 32, 32,108, 91,\n    108, 46,110, 93, 32, 61, 32, 68,101, 99,108, 97,114, 97,116,\n    105,111,110, 40,116, 91,105, 93, 44, 39,118, 97,114, 39, 41,\n     10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100,\n     10, 32,105,102, 32,107, 32, 61, 61, 32, 39, 91, 93, 39, 32,\n    116,104,101,110, 10,  9, 32,108,111, 99, 97,108, 32, 95, 10,\n      9, 32, 95, 44, 32, 95, 44, 32,114,101,102, 32, 61, 32,115,\n    116,114,102,105,110,100, 40,100, 44, 39, 40, 38, 41, 39, 41,\n     10, 32, 32,100, 32, 61, 32,103,115,117, 98, 40,100, 44, 39,\n     38, 39, 44, 39, 39, 41, 10, 32,101,108,115,101,105,102, 32,\n    107, 61, 61, 39, 38, 91, 93, 39, 32,116,104,101,110, 10, 32,\n     32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49, 10, 32, 32,\n    108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99,108, 97,114,\n     97,116,105,111,110, 40,100, 44, 39,118, 97,114, 39, 41, 10,\n     32, 32,108, 91,108, 46,110, 93, 46,110, 97,109,101, 32, 61,\n     32, 39,116,111,108,117, 97, 95,118, 97,108,117,101, 39, 10,\n     32,101,110,100, 10, 32,108,111, 99, 97,108, 32,102, 32, 61,\n     32, 68,101, 99,108, 97,114, 97,116,105,111,110, 40,100, 44,\n     39,102,117,110, 99, 39, 41, 10, 32,105,102, 32,107, 32, 61,\n     61, 32, 39, 91, 93, 39, 32, 97,110,100, 32, 40,108, 91, 49,\n     93, 61, 61,110,105,108, 32,111,114, 32,105,115, 98, 97,115,\n    105, 99, 40,108, 91, 49, 93, 46,116,121,112,101, 41,126, 61,\n     39,110,117,109, 98,101,114, 39, 41, 32,116,104,101,110, 10,\n     32, 32,101,114,114,111,114, 40, 39,111,112,101,114, 97,116,\n    111,114, 91, 93, 32, 99, 97,110, 32,111,110,108,121, 32, 98,\n    101, 32,100,101,102,105,110,101,100, 32,102,111,114, 32,110,\n    117,109,101,114,105, 99, 32,105,110,100,101,120, 46, 39, 41,\n     10, 32,101,110,100, 10, 32,102, 46, 97,114,103,115, 32, 61,\n     32,108, 10, 32,102, 46, 99,111,110,115,116, 32, 61, 32, 99,\n     10, 32,102, 46,107,105,110,100, 32, 61, 32,111,112, 95,107,\n     10, 32,102, 46,108,110, 97,109,101, 32, 61, 32, 34, 46, 34,\n     46, 46, 40, 95, 84, 77, 91,102, 46,107,105,110,100, 93, 32,\n    111,114, 32,102, 46,107,105,110,100, 41, 10, 32,105,102, 32,\n    110,111,116, 32, 95, 84, 77, 91,102, 46,107,105,110,100, 93,\n     32,116,104,101,110, 10, 32,  9,102, 46, 99, 97,115,116, 95,\n    111,112,101,114, 97,116,111,114, 32, 61, 32,116,114,117,101,\n     10, 32,101,110,100, 10, 32,105,102, 32,102, 46,107,105,110,\n    100, 32, 61, 61, 32, 39, 91, 93, 39, 32, 97,110,100, 32,114,\n    101,102, 61, 61, 39, 38, 39, 32, 97,110,100, 32,102, 46, 99,\n    111,110,115,116,126, 61, 39, 99,111,110,115,116, 39, 32,116,\n    104,101,110, 10, 32, 32, 79,112,101,114, 97,116,111,114, 40,\n    100, 44, 39, 38, 39, 46, 46,107, 44, 97, 44, 99, 41, 32,  9,\n     45, 45, 32, 99,114,101, 97,116,101, 32, 99,111,114,114,101,\n    115,112,111,100,105,110,103, 32,115,101,116, 32,111,112,101,\n    114, 97,116,111,114, 10, 32,101,110,100, 10, 32,114,101,116,\n    117,114,110, 32, 95, 79,112,101,114, 97,116,111,114, 40,102,\n     41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/operator.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    10, 95,103,108,111, 98, 97,108, 95,116,101,109,112,108, 97,\n    116,101,115, 32, 61, 32,123,125, 10, 10, 99,108, 97,115,115,\n     84,101,109,112,108, 97,116,101, 67,108, 97,115,115, 32, 61,\n     32,123, 10, 10,  9,110, 97,109,101, 32, 61, 32, 39, 39, 44,\n     10,  9, 98,111,100,121, 32, 61, 32, 39, 39, 44, 10,  9,112,\n     97,114,101,110,116,115, 32, 61, 32,123,125, 44, 10,  9, 97,\n    114,103,115, 32, 61, 32,123,125, 44, 32, 45, 45, 32,116,104,\n    101, 32,116,101,109,112,108, 97,116,101, 32, 97,114,103,117,\n    109,101,110,116,115, 10,125, 10, 10, 99,108, 97,115,115, 84,\n    101,109,112,108, 97,116,101, 67,108, 97,115,115, 46, 95, 95,\n    105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 84,101,\n    109,112,108, 97,116,101, 67,108, 97,115,115, 10, 10, 10,102,\n    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 84,101,\n    109,112,108, 97,116,101, 67,108, 97,115,115, 58,116,104,114,\n    111,119, 40,116,121,112,101,115, 44, 32,108,111, 99, 97,108,\n     95,115, 99,111,112,101, 41, 10, 10,  9, 45, 45,105,102, 32,\n    116, 97, 98,108,101, 46,103,101,116,110, 40,116,121,112,101,\n    115, 41, 32,126, 61, 32,116, 97, 98,108,101, 46,103,101,116,\n    110, 40,115,101,108,102, 46, 97,114,103,115, 41, 32,116,104,\n    101,110, 10,  9, 45, 45,  9,101,114,114,111,114, 40, 34, 35,\n    105,110,118, 97,108,105,100, 32,112, 97,114, 97,109,101,116,\n    101,114, 32, 99,111,117,110,116, 34, 41, 10,  9, 45, 45,101,\n    110,100, 10, 10,  9, 45, 45, 32,114,101,112,108, 97, 99,101,\n     10,  9,102,111,114, 32,105, 32, 61, 49, 32, 44, 32,116,121,\n    112,101,115, 46,110, 32,100,111, 10, 10,  9,  9,108,111, 99,\n     97,108, 32, 73,108, 32, 61, 32,115,112,108,105,116, 95, 99,\n     95,116,111,107,101,110,115, 40,116,121,112,101,115, 91,105,\n     93, 44, 32, 34, 32, 34, 41, 10,  9,  9,105,102, 32,116, 97,\n     98,108,101, 46,103,101,116,110, 40, 73,108, 41, 32,126, 61,\n     32,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108,\n    102, 46, 97,114,103,115, 41, 32,116,104,101,110, 10,  9,  9,\n      9,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105,\n    100, 32,112, 97,114, 97,109,101,116,101,114, 32, 99,111,117,\n    110,116, 32,102,111,114, 32, 34, 46, 46,116,121,112,101,115,\n     91,105, 93, 41, 10,  9,  9,101,110,100, 10,  9,  9,108,111,\n     99, 97,108, 32, 98, 73, 32, 61, 32,115,101,108,102, 46, 98,\n    111,100,121, 10,  9,  9,108,111, 99, 97,108, 32,112, 73, 32,\n     61, 32,123,125, 10,  9,  9,102,111,114, 32,106, 32, 61, 32,\n     49, 44,115,101,108,102, 46, 97,114,103,115, 46,110, 32,100,\n    111, 10,  9,  9,  9, 45, 45, 84,108, 91,106, 93, 32, 61, 32,\n    102,105,110,100,116,121,112,101, 40, 84,108, 91,106, 93, 41,\n     32,111,114, 32, 84,108, 91,106, 93, 10,  9,  9,  9, 98, 73,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n     98, 73, 44, 32, 34, 40, 91, 94, 95, 37,119, 93, 41, 34, 46,\n     46,115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46,\n     34, 40, 91, 94, 95, 37,119, 93, 41, 34, 44, 32, 34, 37, 49,\n     34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41,\n     10,  9,  9,  9,105,102, 32,115,101,108,102, 46,112, 97,114,\n    101,110,116,115, 32,116,104,101,110, 10,  9,  9,  9,  9,102,\n    111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103,101,\n    116,110, 40,115,101,108,102, 46,112, 97,114,101,110,116,115,\n     41, 32,100,111, 10,  9,  9,  9,  9,  9,112, 73, 91,105, 93,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n    115,101,108,102, 46,112, 97,114,101,110,116,115, 91,105, 93,\n     44, 32, 34, 40, 91, 94, 95, 37,119, 93, 63, 41, 34, 46, 46,\n    115,101,108,102, 46, 97,114,103,115, 91,106, 93, 46, 46, 34,\n     40, 91, 94, 95, 37,119, 93, 63, 41, 34, 44, 32, 34, 37, 49,\n     34, 46, 46, 73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41,\n     10,  9,  9,  9,  9,101,110,100, 10,  9,  9,  9,101,110,100,\n     10,  9,  9,101,110,100, 10,  9,  9, 45, 45,108,111, 99, 97,\n    108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34, 46,\n     46,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,121,\n    112,101,115, 91,105, 93, 44, 32, 34, 37,115, 43, 34, 44, 32,\n     34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,  9,108,111, 99,\n     97,108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34,\n     46, 46, 99,111,110, 99, 97,116, 40, 73,108, 44, 32, 49, 44,\n     32,116, 97, 98,108,101, 46,103,101,116,110, 40, 73,108, 41,\n     44, 32, 34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,  9, 97,\n    112,112,101,110,100, 32, 61, 32,115,116,114,105,110,103, 46,\n    103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32, 34, 37,\n    115, 42, 44, 37,115, 42, 34, 44, 32, 34, 44, 34, 41, 10,  9,\n      9, 97,112,112,101,110,100, 32, 61, 32,115,116,114,105,110,\n    103, 46,103,115,117, 98, 40, 97,112,112,101,110,100, 44, 32,\n     34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10,  9,  9,\n    102,111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,103,\n    101,116,110, 40,112, 73, 41, 32,100,111, 10,  9,  9,  9, 45,\n     45,112, 73, 91,105, 93, 32, 61, 32,115,116,114,105,110,103,\n     46,103,115,117, 98, 40,112, 73, 91,105, 93, 44, 32, 34, 62,\n     62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10,  9,  9,  9,112,\n     73, 91,105, 93, 32, 61, 32,114,101,115,111,108,118,101, 95,\n    116,101,109,112,108, 97,116,101, 95,116,121,112,101,115, 40,\n    112, 73, 91,105, 93, 41, 10,  9,  9,101,110,100, 10,  9,  9,\n     98, 73, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,\n     98, 40, 98, 73, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32,\n     62, 34, 41, 10,  9,  9,108,111, 99, 97,108, 32,110, 32, 61,\n     32,115,101,108,102, 46,110, 97,109,101, 10,  9,  9,105,102,\n     32,108,111, 99, 97,108, 95,115, 99,111,112,101, 32,116,104,\n    101,110, 10,  9,  9,  9,110, 32, 61, 32,115,101,108,102, 46,\n    108,111, 99, 97,108, 95,110, 97,109,101, 10,  9,  9,101,110,\n    100, 10, 10,  9,  9, 67,108, 97,115,115, 40,110, 46, 46, 97,\n    112,112,101,110,100, 44, 32,112, 73, 44, 32, 98, 73, 41, 10,\n      9,101,110,100, 10,101,110,100, 10, 10, 10,102,117,110, 99,\n    116,105,111,110, 32, 84,101,109,112,108, 97,116,101, 67,108,\n     97,115,115, 40,110, 97,109,101, 44, 32,112, 97,114,101,110,\n    116,115, 44, 32, 98,111,100,121, 44, 32,112, 97,114, 97,109,\n    101,116,101,114,115, 41, 10, 10,  9,108,111, 99, 97,108, 32,\n    111, 32, 61, 32,123, 10,  9, 10,  9,  9,112, 97,114,101,110,\n    116,115, 32, 61, 32,112, 97,114,101,110,116,115, 44, 10,  9,\n      9, 98,111,100,121, 32, 61, 32, 98,111,100,121, 44, 10,  9,\n      9, 97,114,103,115, 32, 61, 32,112, 97,114, 97,109,101,116,\n    101,114,115, 44, 10,  9,125, 10,  9, 10,  9,108,111, 99, 97,\n    108, 32,111,110, 97,109,101, 32, 61, 32,115,116,114,105,110,\n    103, 46,103,115,117, 98, 40,110, 97,109,101, 44, 32, 34, 64,\n     46, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,111,110, 97,109,\n    101, 32, 61, 32,103,101,116,110, 97,109,101,115,112, 97, 99,\n    101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,\n    114, 46, 99,117,114,114, 41, 46, 46,111,110, 97,109,101, 10,\n      9,111, 46,110, 97,109,101, 32, 61, 32,111,110, 97,109,101,\n     10, 10,  9,111, 46,108,111, 99, 97,108, 95,110, 97,109,101,\n     32, 61, 32,110, 97,109,101, 10,  9, 10,  9,115,101,116,109,\n    101,116, 97,116, 97, 98,108,101, 40,111, 44, 32, 99,108, 97,\n    115,115, 84,101,109,112,108, 97,116,101, 67,108, 97,115,115,\n     41, 10, 10,  9,105,102, 32, 95,103,108,111, 98, 97,108, 95,\n    116,101,109,112,108, 97,116,101,115, 91,111,110, 97,109,101,\n     93, 32,116,104,101,110, 10,  9,  9,119, 97,114,110,105,110,\n    103, 40, 34, 68,117,112,108,105, 99, 97,116,101, 32,100,101,\n     99,108, 97,114, 97,116,105,111,110, 32,111,102, 32,116,101,\n    109,112,108, 97,116,101, 32, 34, 46, 46,111,110, 97,109,101,\n     41, 10,  9,101,108,115,101, 10,  9,  9, 95,103,108,111, 98,\n     97,108, 95,116,101,109,112,108, 97,116,101,115, 91,111,110,\n     97,109,101, 93, 32, 61, 32,111, 10,  9,101,110,100, 10, 10,\n      9,114,101,116,117,114,110, 32,111, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/template_class.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,116,111,108,117, 97, 58, 32, 99,108, 97,115,115,\n     32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,\n    101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32,\n     67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,\n    102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,\n    108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32,\n     36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101,\n     32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,\n    114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,\n    105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,\n    100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46,\n     10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,\n    101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,101,\n    117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32,\n     34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32,\n     97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,\n    111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103,\n     97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,\n    101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,\n    115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,\n    115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,\n    110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99,\n     97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 67,108,\n     97,115,115, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,\n    112,114,101,115,101,110,116,115, 32, 97, 32, 99,108, 97,115,\n    115, 32,100,101,102,105,110,105,116,105,111,110, 46, 10, 45,\n     45, 32, 83,116,111,114,101,115, 32,116,104,101, 32,102,111,\n    108,108,111,119,105,110,103, 32,102,105,101,108,100,115, 58,\n     10, 45, 45, 32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,\n    108, 97,115,115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32,\n     32, 98, 97,115,101, 32, 61, 32, 99,108, 97,115,115, 32, 98,\n     97,115,101, 44, 32,105,102, 32, 97,110,121, 32, 40,111,110,\n    108,121, 32,115,105,110,103,108,101, 32,105,110,104,101,114,\n    105,116, 97,110, 99,101, 32,105,115, 32,115,117,112,112,111,\n    114,116,101,100, 41, 10, 45, 45, 32, 32, 32, 32,123,105,125,\n     32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,109,\n     98,101,114,115, 10, 99,108, 97,115,115, 67,108, 97,115,115,\n     32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,112,101,\n     32, 61, 32, 39, 99,108, 97,115,115, 39, 44, 10, 32,110, 97,\n    109,101, 32, 61, 32, 39, 39, 44, 10, 32, 98, 97,115,101, 32,\n     61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39,\n     39, 44, 10, 32, 98,116,121,112,101, 32, 61, 32, 39, 39, 44,\n     10, 32, 99,116,121,112,101, 32, 61, 32, 39, 39, 44, 10,125,\n     10, 99,108, 97,115,115, 67,108, 97,115,115, 46, 95, 95,105,\n    110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,108, 97,\n    115,115, 10,115,101,116,109,101,116, 97,116, 97, 98,108,101,\n     40, 99,108, 97,115,115, 67,108, 97,115,115, 44, 99,108, 97,\n    115,115, 67,111,110,116, 97,105,110,101,114, 41, 10, 10, 10,\n     45, 45, 32,114,101,103,105,115,116,101,114, 32, 99,108, 97,\n    115,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,108, 97,115,115, 58,114,101,103,105,115,116,101,\n    114, 32, 40,112,114,101, 41, 10, 10,  9,105,102, 32,110,111,\n    116, 32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117,\n     98,108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,\n    104,101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,\n    110,100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32,\n    111,114, 32, 39, 39, 10, 32,112,117,115,104, 40,115,101,108,\n    102, 41, 10,  9,105,102, 32, 95, 99,111,108,108,101, 99,116,\n     91,115,101,108,102, 46,116,121,112,101, 93, 32,116,104,101,\n    110, 10,  9,  9,111,117,116,112,117,116, 40,112,114,101, 44,\n     39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,115,\n    112,108,117,115, 92,110, 39, 41, 10, 32, 32,111,117,116,112,\n    117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,\n     99, 99,108, 97,115,115, 40,116,111,108,117, 97, 95, 83, 44,\n     34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46,\n     46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46,116,121,\n    112,101, 46, 46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102,\n     46, 98,116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46, 95,\n     99,111,108,108,101, 99,116, 91,115,101,108,102, 46,116,121,\n    112,101, 93, 46, 46, 39, 41, 59, 39, 41, 10,  9,  9,111,117,\n    116,112,117,116, 40,112,114,101, 44, 39, 35,101,108,115,101,\n     92,110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,112,\n    114,101, 46, 46, 39,116,111,108,117, 97, 95, 99, 99,108, 97,\n    115,115, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,\n    115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44,\n     34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, 46, 46,\n     39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46, 98,116,121,\n    112,101, 46, 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41,\n     10,  9,  9,111,117,116,112,117,116, 40,112,114,101, 44, 39,\n     35,101,110,100,105,102, 92,110, 39, 41, 10,  9,101,108,115,\n    101, 10, 32, 32,111,117,116,112,117,116, 40,112,114,101, 46,\n     46, 39,116,111,108,117, 97, 95, 99, 99,108, 97,115,115, 40,\n    116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,\n    102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 34, 39, 46,\n     46,115,101,108,102, 46,116,121,112,101, 46, 46, 39, 34, 44,\n     34, 39, 46, 46,115,101,108,102, 46, 98,116,121,112,101, 46,\n     46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10,  9,101,\n    110,100, 10,  9,105,102, 32,115,101,108,102, 46,101,120,116,\n    114, 97, 95, 98, 97,115,101,115, 32,116,104,101,110, 10,  9,\n      9,102,111,114, 32,107, 44, 98, 97,115,101, 32,105,110, 32,\n    105,112, 97,105,114,115, 40,115,101,108,102, 46,101,120,116,\n    114, 97, 95, 98, 97,115,101,115, 41, 32,100,111, 10,  9,  9,\n      9, 45, 45, 32,110,111,116, 32,110,111,119, 10, 32, 32, 32,\n     45, 45,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,\n     32,116,111,108,117, 97, 95, 97,100,100, 98, 97,115,101, 40,\n    116,111,108,117, 97, 95, 83, 44, 32, 34, 39, 46, 46,115,101,\n    108,102, 46,116,121,112,101, 46, 46, 39, 34, 44, 32, 34, 39,\n     46, 46, 98, 97,115,101, 46, 46, 39, 34, 41, 59, 39, 41, 10,\n      9,  9,101,110,100, 10,  9,101,110,100, 10, 32,111,117,116,\n    112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97,\n     95, 98,101,103,105,110,109,111,100,117,108,101, 40,116,111,\n    108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,\n    108,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32,\n    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,\n    101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,\n    115,101,108,102, 91,105, 93, 58,114,101,103,105,115,116,101,\n    114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32, 32,105,\n     32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,111,117,\n    116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117,\n     97, 95,101,110,100,109,111,100,117,108,101, 40,116,111,108,\n    117, 97, 95, 83, 41, 59, 39, 41, 10,  9,112,111,112, 40, 41,\n     10,101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110,\n     32, 99,111,108,108,101, 99,116,105,111,110, 32,114,101,113,\n    117,105,114,101,109,101,110,116, 10,102,117,110, 99,116,105,\n    111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58,114,\n    101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,\n    110, 32, 40,116, 41, 10,  9,105,102, 32,115,101,108,102, 46,\n    102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101,100,\n     95,100,101,115,116,114,117, 99,116,111,114, 32,111,114, 32,\n     40,110,111,116, 32,115,101,108,102, 58, 99,104,101, 99,107,\n     95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,115, 40,\n     41, 41, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,\n    110, 32,102, 97,108,115,101, 10,  9,101,110,100, 10, 32,112,\n    117,115,104, 40,115,101,108,102, 41, 10,  9,108,111, 99, 97,\n    108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,108,111,\n     99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,\n    115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,114, 32,\n     61, 32,115,101,108,102, 91,105, 93, 58,114,101,113,117,105,\n    114,101, 99,111,108,108,101, 99,116,105,111,110, 40,116, 41,\n     32,111,114, 32,114, 10, 32, 32,105, 32, 61, 32,105, 43, 49,\n     10, 32,101,110,100, 10,  9,112,111,112, 40, 41, 10,  9, 45,\n     45, 32,111,110,108,121, 32, 99,108, 97,115,115, 32,116,104,\n     97,116, 32,101,120,112,111,114,116,115, 32,100,101,115,116,\n    114,117, 99,116,111,114, 32, 99, 97,110, 32, 98,101, 32, 97,\n    112,112,114,111,112,114,105, 97,116,101,108,121, 32, 99,111,\n    108,108,101, 99,116,101,100, 10,  9, 45, 45, 32, 99,108, 97,\n    115,115,101,115, 32,116,104, 97,116, 32,101,120,112,111,114,\n    116, 32, 99,111,110,115,116,114,117, 99,116,111,114,115, 32,\n    110,101,101,100, 32,116,111, 32,104, 97,118,101, 32, 97, 32,\n     99,111,108,108,101, 99,116,111,114, 32, 40,111,118,101,114,\n    114,105,100,101,100, 32, 98,121, 32, 45, 68, 32,102,108, 97,\n    103, 32,111,110, 32, 99,111,109,109, 97,110,100, 32,108,105,\n    110,101, 41, 10,  9,105,102, 32,115,101,108,102, 46, 95,100,\n    101,108,101,116,101, 32,111,114, 32, 40, 40,110,111,116, 32,\n    102,108, 97,103,115, 91, 39, 68, 39, 93, 41, 32, 97,110,100,\n     32,115,101,108,102, 46, 95,110,101,119, 41, 32,116,104,101,\n    110, 10,  9,  9, 45, 45,116, 91,115,101,108,102, 46,116,121,\n    112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95, 99,111,\n    108,108,101, 99,116, 95, 34, 32, 46, 46, 32,103,115,117, 98,\n     40,115,101,108,102, 46,116,121,112,101, 44, 34, 58, 58, 34,\n     44, 34, 95, 34, 41, 10,  9,  9,116, 91,115,101,108,102, 46,\n    116,121,112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95,\n     99,111,108,108,101, 99,116, 95, 34, 32, 46, 46, 32, 99,108,\n    101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,115,101,\n    108,102, 46,116,121,112,101, 41, 10,  9,  9,114, 32, 61, 32,\n    116,114,117,101, 10,  9,101,110,100, 10, 32,114,101,116,117,\n    114,110, 32,114, 10,101,110,100, 10, 10, 45, 45, 32,111,117,\n    116,112,117,116, 32,116, 97,103,115, 10,102,117,110, 99,116,\n    105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58,\n    100,101, 99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117,\n    115,104, 40,115,101,108,102, 41, 10,  9,115,101,108,102, 46,\n    116,121,112,101, 32, 61, 32,114,101,103,116,121,112,101, 40,\n    115,101,108,102, 46,111,114,105,103,105,110, 97,108, 95,110,\n     97,109,101, 32,111,114, 32,115,101,108,102, 46,110, 97,109,\n    101, 41, 10,  9,115,101,108,102, 46, 98,116,121,112,101, 32,\n     61, 32,116,121,112,101,118, 97,114, 40,115,101,108,102, 46,\n     98, 97,115,101, 41, 10,  9,115,101,108,102, 46, 99,116,121,\n    112,101, 32, 61, 32, 39, 99,111,110,115,116, 32, 39, 46, 46,\n    115,101,108,102, 46,116,121,112,101, 10,  9,105,102, 32,115,\n    101,108,102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115,\n     32,116,104,101,110, 10,  9,  9,102,111,114, 32,105, 61, 49,\n     44,116, 97, 98,108,101, 46,103,101,116,110, 40,115,101,108,\n    102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115, 41, 32,\n    100,111, 10,  9,  9,  9,115,101,108,102, 46,101,120,116,114,\n     97, 95, 98, 97,115,101,115, 91,105, 93, 32, 61, 32,116,121,\n    112,101,118, 97,114, 40,115,101,108,102, 46,101,120,116,114,\n     97, 95, 98, 97,115,101,115, 91,105, 93, 41, 10,  9,  9,101,\n    110,100, 10,  9,101,110,100, 10, 32,108,111, 99, 97,108, 32,\n    105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102,\n     91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105,\n     93, 58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32,\n    105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,  9,112,\n    111,112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,\n    114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,110,\n     99,116,105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115,\n    115, 58,112,114,105,110,116, 32, 40,105,100,101,110,116, 44,\n     99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,\n    100,101,110,116, 46, 46, 34, 67,108, 97,115,115,123, 34, 41,\n     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,\n     34, 32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32, 98, 97,115,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46, 98, 97,115,101, 46, 46, 34, 39, 59, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n    108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,\n    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,\n     98,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,\n    102, 46, 98,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10,\n     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,\n     32, 99,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,\n    108,102, 46, 99,116,121,112,101, 46, 46, 34, 39, 44, 34, 41,\n     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,\n    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,\n     32, 32,115,101,108,102, 91,105, 93, 58,112,114,105,110,116,\n     40,105,100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34,\n     41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,\n    100, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,\n     46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,\n    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,\n    115,115, 67,108, 97,115,115, 58,115,101,116, 95,112,114,111,\n    116,101, 99,116,101,100, 95,100,101,115,116,114,117, 99,116,\n    111,114, 40,112, 41, 10,  9,115,101,108,102, 46,102,108, 97,\n    103,115, 46,112,114,111,116,101, 99,116,101,100, 95,100,101,\n    115,116,114,117, 99,116,111,114, 32, 61, 32,115,101,108,102,\n     46,102,108, 97,103,115, 46,112,114,111,116,101, 99,116,101,\n    100, 95,100,101,115,116,114,117, 99,116,111,114, 32,111,114,\n     32,112, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,116,101,\n    114,110, 97,108, 32, 99,111,110,115,116,114,117, 99,116,111,\n    114, 10,102,117,110, 99,116,105,111,110, 32, 95, 67,108, 97,\n    115,115, 32, 40,116, 41, 10, 32,115,101,116,109,101,116, 97,\n    116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 67,108,\n     97,115,115, 41, 10, 32,116, 58, 98,117,105,108,100,110, 97,\n    109,101,115, 40, 41, 10, 32, 97,112,112,101,110,100, 40,116,\n     41, 10, 32,114,101,116,117,114,110, 32,116, 10,101,110,100,\n     10, 10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,\n    114, 10, 45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,\n    101, 32,110, 97,109,101, 44, 32,116,104,101, 32, 98, 97,115,\n    101, 32, 40, 97,114,114, 97,121, 41, 32, 97,110,100, 32,116,\n    104,101, 32, 98,111,100,121, 32,111,102, 32,116,104,101, 32,\n     99,108, 97,115,115, 46, 10,102,117,110, 99,116,105,111,110,\n     32, 67,108, 97,115,115, 32, 40,110, 44,112, 44, 98, 41, 10,\n     10,  9,105,102, 32,116, 97, 98,108,101, 46,103,101,116,110,\n     40,112, 41, 32, 62, 32, 49, 32,116,104,101,110, 10,  9,  9,\n     98, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,\n     98, 44, 32, 49, 44, 32, 45, 50, 41, 10,  9,  9,102,111,114,\n     32,105, 61, 50, 44,116, 97, 98,108,101, 46,103,101,116,110,\n     40,112, 41, 44, 49, 32,100,111, 10,  9,  9,  9, 98, 32, 61,\n     32, 98, 46, 46, 34, 92,110, 32,116,111,108,117, 97, 95,105,\n    110,104,101,114,105,116,115, 32, 34, 46, 46,112, 91,105, 93,\n     46, 46, 34, 32, 95, 95, 34, 46, 46,112, 91,105, 93, 46, 46,\n     34, 95, 95, 59, 92,110, 34, 10,  9,  9,101,110,100, 10,  9,\n      9, 98, 32, 61, 32, 98, 46, 46, 34, 92,110,125, 34, 10,  9,\n    101,110,100, 10, 10,  9, 45, 45, 32, 99,104,101, 99,107, 32,\n    102,111,114, 32,116,101,109,112,108, 97,116,101, 10,  9, 98,\n     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,\n     98, 44, 32, 34, 94,123, 37,115, 42, 84, 69, 77, 80, 76, 65,\n     84, 69, 95, 66, 73, 78, 68, 34, 44, 32, 34,123, 92,110, 84,\n     79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66,\n     73, 78, 68, 34, 41, 10,  9,108,111, 99, 97,108, 32,116, 44,\n     95, 44, 84, 44, 73, 32, 61, 32,115,116,114,105,110,103, 46,\n    102,105,110,100, 40, 98, 44, 32, 39, 94,123, 37,115, 42, 84,\n     79, 76, 85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66,\n     73, 78, 68, 37,115, 42, 37, 40, 43, 37,115, 42, 92, 34, 63,\n     40, 91, 94, 92, 34, 44, 93, 42, 41, 92, 34, 63, 37,115, 42,\n     44, 37,115, 42, 40, 91, 94, 37, 41, 93, 42, 41, 37,115, 42,\n     37, 41, 43, 39, 41, 10,  9,105,102, 32,116, 32,116,104,101,\n    110, 10, 10,  9,  9, 45, 45, 32,114,101,109,111,118,101, 32,\n    113,117,111,116,101,115, 10,  9,  9, 73, 32, 61, 32,115,116,\n    114,105,110,103, 46,103,115,117, 98, 40, 73, 44, 32, 34, 92,\n     34, 34, 44, 32, 34, 34, 41, 10,  9,  9, 84, 32, 61, 32,115,\n    116,114,105,110,103, 46,103,115,117, 98, 40, 84, 44, 32, 34,\n     92, 34, 34, 44, 32, 34, 34, 41, 10,  9,  9, 45, 45, 32,103,\n    101,116, 32,116,121,112,101, 32,108,105,115,116, 10,  9,  9,\n    108,111, 99, 97,108, 32,116,121,112,101,115, 32, 61, 32,115,\n    112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40, 73,\n     44, 32, 34, 44, 34, 41, 10,  9,  9, 45, 45, 32,114,101,109,\n    111,118,101, 32, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73,\n     78, 68, 32,108,105,110,101, 10,  9,  9,108,111, 99, 97,108,\n     32, 98,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,\n    117, 98, 40, 98, 44, 32, 34, 94,123, 37,115, 42, 84, 79, 76,\n     85, 65, 95, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73, 78,\n     68, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34,123, 92,\n    110, 34, 41, 10,  9,  9,  9, 10,  9,  9,108,111, 99, 97,108,\n     32, 84,108, 32, 61, 32,115,112,108,105,116, 40, 84, 44, 32,\n     34, 32, 34, 41, 10,  9,  9,108,111, 99, 97,108, 32,116, 99,\n     32, 61, 32, 84,101,109,112,108, 97,116,101, 67,108, 97,115,\n    115, 40,110, 44, 32,112, 44, 32, 98,115, 44, 32, 84,108, 41,\n     10, 10,  9,  9, 10,  9,  9,116, 99, 58,116,104,114,111,119,\n     40,116,121,112,101,115, 44, 32,116,114,117,101, 41, 10,  9,\n      9, 45, 45,102,111,114, 32,105, 61, 49, 44,116,121,112,101,\n    115, 46,110, 32,100,111, 10,  9,  9, 45, 45,  9,116, 99, 58,\n    116,104,114,111,119, 40,115,112,108,105,116, 95, 99, 95,116,\n    111,107,101,110,115, 40,116,121,112,101,115, 91,105, 93, 44,\n     32, 34, 32, 34, 41, 44, 32,116,114,117,101, 41, 10,  9,  9,\n     45, 45,101,110,100, 10,  9,  9,114,101,116,117,114,110, 10,\n      9,101,110,100, 10,  9, 10,  9,108,111, 99, 97,108, 32,109,\n     98, 97,115,101, 10, 10,  9,105,102, 32,112, 32,116,104,101,\n    110, 10,  9,  9,109, 98, 97,115,101, 32, 61, 32,116, 97, 98,\n    108,101, 46,114,101,109,111,118,101, 40,112, 44, 32, 49, 41,\n     10,  9,  9,105,102, 32,110,111,116, 32,112, 91, 49, 93, 32,\n    116,104,101,110, 32,112, 32, 61, 32,110,105,108, 32,101,110,\n    100, 10,  9,101,110,100, 10, 10,  9,109, 98, 97,115,101, 32,\n     61, 32,109, 98, 97,115,101, 32, 97,110,100, 32,114,101,115,\n    111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,116,\n    121,112,101,115, 40,109, 98, 97,115,101, 41, 10, 10,  9,108,\n    111, 99, 97,108, 32, 99, 10,  9,108,111, 99, 97,108, 32,111,\n    110, 97,109,101, 32, 61, 32,115,116,114,105,110,103, 46,103,\n    115,117, 98, 40,110, 44, 32, 34, 64, 46, 42, 36, 34, 44, 32,\n     34, 34, 41, 10,  9,111,110, 97,109,101, 32, 61, 32,103,101,\n    116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,\n    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,\n     41, 46, 46,111,110, 97,109,101, 10, 10,  9,105,102, 32, 95,\n    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,\n    111,110, 97,109,101, 93, 32,116,104,101,110, 10,  9,  9, 99,\n     32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,\n    115,101,115, 91,111,110, 97,109,101, 93, 10,  9,  9,105,102,\n     32,109, 98, 97,115,101, 32, 97,110,100, 32, 40, 40,110,111,\n    116, 32, 99, 46, 98, 97,115,101, 41, 32,111,114, 32, 99, 46,\n     98, 97,115,101, 32, 61, 61, 32, 34, 34, 41, 32,116,104,101,\n    110, 10,  9,  9,  9, 99, 46, 98, 97,115,101, 32, 61, 32,109,\n     98, 97,115,101, 10,  9,  9,101,110,100, 10,  9,101,108,115,\n    101, 10,  9,  9, 99, 32, 61, 32, 95, 67,108, 97,115,115, 40,\n     95, 67,111,110,116, 97,105,110,101,114,123,110, 97,109,101,\n     61,110, 44, 32, 98, 97,115,101, 61,109, 98, 97,115,101, 44,\n     32,101,120,116,114, 97, 95, 98, 97,115,101,115, 61,112,125,\n     41, 10, 10,  9,  9,108,111, 99, 97,108, 32,102,116, 32, 61,\n     32,103,101,116,110, 97,109,101,115,112, 97, 99,101, 40, 99,\n     46,112, 97,114,101,110,116, 41, 46, 46, 99, 46,111,114,105,\n    103,105,110, 97,108, 95,110, 97,109,101, 10,  9,  9, 97,112,\n    112,101,110,100, 95,103,108,111, 98, 97,108, 95,116,121,112,\n    101, 40,102,116, 44, 32, 99, 41, 10,  9,101,110,100, 10, 10,\n      9,112,117,115,104, 40, 99, 41, 10,  9, 99, 58,112, 97,114,\n    115,101, 40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115,\n    116,114,108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45,\n     32,101,108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,\n    101,115, 10,  9,112,111,112, 40, 41, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/class.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32,109, 97,114,107, 32,117,112, 32, 99,111,109,109,\n    101,110,116,115, 32, 97,110,100, 32,115,116,114,105,110,103,\n    115, 10, 83, 84, 82, 49, 32, 61, 32, 34, 92, 48, 48, 49, 34,\n     10, 83, 84, 82, 50, 32, 61, 32, 34, 92, 48, 48, 50, 34, 10,\n     83, 84, 82, 51, 32, 61, 32, 34, 92, 48, 48, 51, 34, 10, 83,\n     84, 82, 52, 32, 61, 32, 34, 92, 48, 48, 52, 34, 10, 82, 69,\n     77, 32, 32, 61, 32, 34, 92, 48, 48, 53, 34, 10, 65, 78, 89,\n     32, 32, 61, 32, 34, 40, 91, 92, 48, 48, 49, 45, 92, 48, 48,\n     53, 93, 41, 34, 10, 69, 83, 67, 49, 32, 61, 32, 34, 92, 48,\n     48, 54, 34, 10, 69, 83, 67, 50, 32, 61, 32, 34, 92, 48, 48,\n     55, 34, 10, 10, 77, 65, 83, 75, 32, 61, 32,123, 32, 45, 45,\n     32,116,104,101, 32,115,117, 98,115,116,105,116,117,116,105,\n    111,110, 32,111,114,100,101,114, 32,105,115, 32,105,109,112,\n    111,114,116, 97,110,116, 10, 32,123, 69, 83, 67, 49, 44, 32,\n     34, 92, 92, 39, 34,125, 44, 10, 32,123, 69, 83, 67, 50, 44,\n     32, 39, 92, 92, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 49,\n     44, 32, 34, 39, 34,125, 44, 10, 32,123, 83, 84, 82, 50, 44,\n     32, 39, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 51, 44, 32,\n     34, 37, 91, 37, 91, 34,125, 44, 10, 32,123, 83, 84, 82, 52,\n     44, 32, 34, 37, 93, 37, 93, 34,125, 44, 10, 32,123, 82, 69,\n     77, 32, 44, 32, 34, 37, 45, 37, 45, 34,125, 44, 10,125, 10,\n     10,102,117,110, 99,116,105,111,110, 32,109, 97,115,107, 32,\n     40,115, 41, 10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,\n    103,101,116,110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10,\n     32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65,\n     83, 75, 91,105, 93, 91, 50, 93, 44, 77, 65, 83, 75, 91,105,\n     93, 91, 49, 93, 41, 10, 32,101,110,100, 10, 32,114,101,116,\n    117,114,110, 32,115, 10,101,110,100, 10, 10,102,117,110, 99,\n    116,105,111,110, 32,117,110,109, 97,115,107, 32, 40,115, 41,\n     10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,103,101,116,\n    110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10, 32, 32,115,\n     32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65, 83, 75, 91,\n    105, 93, 91, 49, 93, 44, 77, 65, 83, 75, 91,105, 93, 91, 50,\n     93, 41, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110,\n     32,115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,\n    110, 32, 99,108,101, 97,110, 32, 40,115, 41, 10, 32, 45, 45,\n     32, 99,104,101, 99,107, 32,102,111,114, 32, 99,111,109,112,\n    105,108, 97,116,105,111,110, 32,101,114,114,111,114, 10, 32,\n    108,111, 99, 97,108, 32, 99,111,100,101, 32, 61, 32, 34,114,\n    101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 32,\n     40, 41, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34,\n     92,110, 32,101,110,100, 34, 10, 32,105,102, 32,110,111,116,\n     32,100,111,115,116,114,105,110,103, 40, 99,111,100,101, 41,\n     32,116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32,\n    110,105,108, 10, 32,101,110,100, 10, 10, 32,105,102, 32,102,\n    108, 97,103,115, 91, 39, 67, 39, 93, 32,116,104,101,110, 10,\n     32,  9,114,101,116,117,114,110, 32,115, 10, 32,101,110,100,\n     10, 10, 32,108,111, 99, 97,108, 32, 83, 32, 61, 32, 34, 34,\n     32, 45, 45, 32,115, 97,118,101,100, 32,115,116,114,105,110,\n    103, 10, 10, 32,115, 32, 61, 32,109, 97,115,107, 40,115, 41,\n     10, 10, 32, 45, 45, 32,114,101,109,111,118,101, 32, 98,108,\n     97,110,107,115, 32, 97,110,100, 32, 99,111,109,109,101,110,\n    116,115, 10, 32,119,104,105,108,101, 32, 49, 32,100,111, 10,\n     32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100, 32, 61,\n     32,115,116,114,102,105,110,100, 40,115, 44, 65, 78, 89, 41,\n     10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32,\n     32, 83, 32, 61, 32, 83, 46, 46,115,116,114,115,117, 98, 40,\n    115, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32, 32,115, 32, 61,\n     32,115,116,114,115,117, 98, 40,115, 44, 98, 43, 49, 41, 10,\n     32, 32, 32,105,102, 32,100, 61, 61, 83, 84, 82, 49, 32,111,\n    114, 32,100, 61, 61, 83, 84, 82, 50, 32,116,104,101,110, 10,\n     32, 32, 32, 32,101, 32, 61, 32,115,116,114,102,105,110,100,\n     40,115, 44,100, 41, 10, 32, 32, 32, 32, 83, 32, 61, 32, 83,\n     32, 46, 46,100, 46, 46,115,116,114,115,117, 98, 40,115, 44,\n     49, 44,101, 41, 10, 32, 32, 32, 32,115, 32, 61, 32,115,116,\n    114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32, 32,\n    101,108,115,101,105,102, 32,100, 61, 61, 83, 84, 82, 51, 32,\n    116,104,101,110, 10, 32, 32, 32, 32,101, 32, 61, 32,115,116,\n    114,102,105,110,100, 40,115, 44, 83, 84, 82, 52, 41, 10, 32,\n     32, 32, 32, 83, 32, 61, 32, 83, 46, 46,100, 46, 46,115,116,\n    114,115,117, 98, 40,115, 44, 49, 44,101, 41, 10, 32, 32, 32,\n     32,115, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,101,\n     43, 49, 41, 10, 32, 32, 32,101,108,115,101,105,102, 32,100,\n     61, 61, 82, 69, 77, 32,116,104,101,110, 10, 32, 32, 32, 32,\n    115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 91, 94, 92,\n    110, 93, 42, 40, 92,110, 63, 41, 34, 44, 34, 37, 49, 34, 44,\n     49, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,108,115,\n    101, 10, 32, 32, 32, 83, 32, 61, 32, 83, 46, 46,115, 10, 32,\n     32, 32, 98,114,101, 97,107, 10, 32, 32,101,110,100, 10, 32,\n    101,110,100, 10, 32, 45, 45, 32,101,108,105,109,105,110, 97,\n    116,101, 32,117,110,101, 99,101,115,115, 97,114,121, 32,115,\n    112, 97, 99,101,115, 10, 32, 83, 32, 61, 32,103,115,117, 98,\n     40, 83, 44, 34, 91, 32, 92,116, 93, 43, 34, 44, 34, 32, 34,\n     41, 10, 32, 83, 32, 61, 32,103,115,117, 98, 40, 83, 44, 34,\n     91, 32, 92,116, 93, 42, 92,110, 91, 32, 92,116, 93, 42, 34,\n     44, 34, 92,110, 34, 41, 10,  9, 83, 32, 61, 32,103,115,117,\n     98, 40, 83, 44, 34, 92,110, 43, 34, 44, 34, 92,110, 34, 41,\n     10, 32, 83, 32, 61, 32,117,110,109, 97,115,107, 40, 83, 41,\n     10, 32,114,101,116,117,114,110, 32, 83, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/clean.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    45, 45, 32, 71,101,110,101,114, 97,116,101, 32, 98,105,110,\n    100,105,110,103, 32, 99,111,100,101, 10, 45, 45, 32, 87,114,\n    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,\n     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,\n     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,\n     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 76, 97,\n    115,116, 32,117,112,100, 97,116,101, 58, 32, 65,112,114, 32,\n     50, 48, 48, 51, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10,\n     10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,\n    105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,\n    101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,\n    115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100,\n     47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10,\n     45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101,\n     32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117,\n    110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34,\n     97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,\n    110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,\n    114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,\n    116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101,\n     32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,\n    117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115,\n     44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,\n    116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,\n    116,105,111,110,115, 46, 10, 10,102,117,110, 99,116,105,111,\n    110, 32,112, 97,114,115,101, 95,101,120,116,114, 97, 40, 41,\n     10, 10,  9,102,111,114, 32,107, 44,118, 32,105,110, 32,105,\n    112, 97,105,114,115, 40, 95,101,120,116,114, 97, 95,112, 97,\n    114, 97,109,101,116,101,114,115, 32,111,114, 32,123,125, 41,\n     32,100,111, 10,  9,  9, 10,  9,  9,108,111, 99, 97,108, 32,\n     98, 44,101, 44,110, 97,109,101, 44,118, 97,108,117,101, 32,\n     61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,118,\n     44, 32, 34, 94, 40, 91, 94, 61, 93, 42, 41, 61, 40, 46, 42,\n     41, 36, 34, 41, 10,  9,  9,105,102, 32, 98, 32,116,104,101,\n    110, 10,  9,  9,  9, 95,101,120,116,114, 97, 95,112, 97,114,\n     97,109,101,116,101,114,115, 91,110, 97,109,101, 93, 32, 61,\n     32,118, 97,108,117,101, 10,  9,  9,101,108,115,101, 10,  9,\n      9,  9, 95,101,120,116,114, 97, 95,112, 97,114, 97,109,101,\n    116,101,114,115, 91,118, 93, 32, 61, 32,116,114,117,101, 10,\n      9,  9,101,110,100, 10,  9,101,110,100, 10,101,110,100, 10,\n     10,102,117,110, 99,116,105,111,110, 32,100,111,105,116, 32,\n     40, 41, 10,  9, 45, 45, 32,100,101,102,105,110,101, 32,112,\n     97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,105,102,\n     32,110,111,116, 32,112,114,111,118,105,100,101,100, 10,  9,\n    105,102, 32,110,111,116, 32,102,108, 97,103,115, 46,110, 32,\n    116,104,101,110, 10,  9,  9,105,102, 32,102,108, 97,103,115,\n     46,102, 32,116,104,101,110, 10,  9,  9,  9,102,108, 97,103,\n    115, 46,110, 32, 61, 32,103,115,117, 98, 40,102,108, 97,103,\n    115, 46,102, 44, 34, 37, 46, 46, 42, 36, 34, 44, 34, 34, 41,\n     10,  9,  9,  9, 95, 44, 95, 44,102,108, 97,103,115, 46,110,\n     32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,\n    102,108, 97,103,115, 46,110, 44, 32, 34, 40, 91, 94, 47, 92,\n     92, 93, 42, 41, 36, 34, 41, 10,  9,  9,101,108,115,101, 10,\n      9,  9,  9,101,114,114,111,114, 40, 34, 35,110,111, 32,112,\n     97, 99,107, 97,103,101, 32,110, 97,109,101, 32,110,111,114,\n     32,105,110,112,117,116, 32,102,105,108,101, 32,112,114,111,\n    118,105,100,101,100, 34, 41, 10,  9,  9,101,110,100, 10,  9,\n    101,110,100, 10, 10,  9, 45, 45, 32,112, 97,114,115,101, 32,\n    116, 97, 98,108,101, 32,119,105,116,104, 32,101,120,116,114,\n     97, 32,112, 97,114, 97,109,116,101,114,115, 10,  9,112, 97,\n    114,115,101, 95,101,120,116,114, 97, 40, 41, 10, 10,  9, 45,\n     45, 32,100,111, 32,116,104,105,115, 32, 97,102,116,101,114,\n     32,115,101,116,116,105,110,103, 32,116,104,101, 32,112, 97,\n     99,107, 97,103,101, 32,110, 97,109,101, 10,  9,105,102, 32,\n    102,108, 97,103,115, 91, 39, 76, 39, 93, 32,116,104,101,110,\n     10,  9,  9,100,111,102,105,108,101, 40,102,108, 97,103,115,\n     91, 39, 76, 39, 93, 41, 10,  9,101,110,100, 10, 10,  9, 45,\n     45, 32, 97,100,100, 32, 99,112,112,115,116,114,105,110,103,\n     10,  9,105,102, 32,110,111,116, 32,102,108, 97,103,115, 91,\n     39, 83, 39, 93, 32,116,104,101,110, 10,  9,  9, 95, 98, 97,\n    115,105, 99, 91, 39,115,116,114,105,110,103, 39, 93, 32, 61,\n     32, 39, 99,112,112,115,116,114,105,110,103, 39, 10,  9,  9,\n     95, 98, 97,115,105, 99, 91, 39,115,116,100, 58, 58,115,116,\n    114,105,110,103, 39, 93, 32, 61, 32, 39, 99,112,112,115,116,\n    114,105,110,103, 39, 10,  9,  9, 95, 98, 97,115,105, 99, 95,\n     99,116,121,112,101, 46, 99,112,112,115,116,114,105,110,103,\n     32, 61, 32, 39, 99,111,110,115,116, 32, 99,104, 97,114, 42,\n     39, 10,  9,101,110,100, 10, 10,  9, 45, 45, 32,112,114,111,\n     99, 99,101,115,115, 32,112, 97, 99,107, 97,103,101, 10,  9,\n    108,111, 99, 97,108, 32,112, 32, 32, 61, 32, 80, 97, 99,107,\n     97,103,101, 40,102,108, 97,103,115, 46,110, 44,102,108, 97,\n    103,115, 46,102, 41, 10, 10,  9,105,102, 32,102,108, 97,103,\n    115, 46,112, 32,116,104,101,110, 10,  9,  9,114,101,116,117,\n    114,110, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,111,110,\n    108,121, 32,112, 97,114,115,101, 10,  9,101,110,100, 10, 10,\n      9,105,102, 32,102,108, 97,103,115, 46,111, 32,116,104,101,\n    110, 10,  9,  9,108,111, 99, 97,108, 32,115,116, 44,109,115,\n    103, 32, 61, 32,119,114,105,116,101,116,111, 40,102,108, 97,\n    103,115, 46,111, 41, 10,  9,  9,105,102, 32,110,111,116, 32,\n    115,116, 32,116,104,101,110, 10,  9,  9,  9,101,114,114,111,\n    114, 40, 39, 35, 39, 46, 46,109,115,103, 41, 10,  9,  9,101,\n    110,100, 10,  9,101,110,100, 10, 10,  9,112, 58,100,101, 99,\n    108,116,121,112,101, 40, 41, 10,  9,105,102, 32,102,108, 97,\n    103,115, 46, 80, 32,116,104,101,110, 10,  9,  9,112, 58,112,\n    114,105,110,116, 40, 41, 10,  9,101,108,115,101, 10,  9,  9,\n    112, 58,112,114,101, 97,109, 98,108,101, 40, 41, 10,  9,  9,\n    112, 58,115,117,112, 99,111,100,101, 40, 41, 10,  9,  9,112,\n     58,114,101,103,105,115,116,101,114, 40, 41, 10,  9,  9,112,\n    117,115,104, 40,112, 41, 10,  9,  9,112,111,115,116, 95,111,\n    117,116,112,117,116, 95,104,111,111,107, 40,112, 41, 10,  9,\n      9,112,111,112, 40, 41, 10,  9,101,110,100, 10, 10,  9,105,\n    102, 32,102,108, 97,103,115, 46,111, 32,116,104,101,110, 10,\n      9,  9,119,114,105,116,101,116,111, 40, 41, 10,  9,101,110,\n    100, 10, 10,  9, 45, 45, 32,119,114,105,116,101, 32,104,101,\n     97,100,101,114, 32,102,105,108,101, 10,  9,105,102, 32,110,\n    111,116, 32,102,108, 97,103,115, 46, 80, 32,116,104,101,110,\n     10,  9,  9,105,102, 32,102,108, 97,103,115, 46, 72, 32,116,\n    104,101,110, 10,  9,  9,  9,108,111, 99, 97,108, 32,115,116,\n     44,109,115,103, 32, 61, 32,119,114,105,116,101,116,111, 40,\n    102,108, 97,103,115, 46, 72, 41, 10,  9,  9,  9,105,102, 32,\n    110,111,116, 32,115,116, 32,116,104,101,110, 10,  9,  9,  9,\n      9,101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115,103,\n     41, 10,  9,  9,  9,101,110,100, 10,  9,  9,  9,112, 58,104,\n    101, 97,100,101,114, 40, 41, 10,  9,  9,  9,119,114,105,116,\n    101,116,111, 40, 41, 10,  9,  9,101,110,100, 10,  9,101,110,\n    100, 10,101,110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua embedded: lua/tolua++/src/bin/lua/doit.lua\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n\n  { /* begin embedded lua code */\n   int top = lua_gettop(tolua_S);\n   static unsigned char B[] = {\n    10,108,111, 99, 97,108, 32,101,114,114, 44,109,115,103, 32,\n     61, 32,112, 99, 97,108,108, 40,100,111,105,116, 41, 10,105,\n    102, 32,110,111,116, 32,101,114,114, 32,116,104,101,110, 10,\n     32,108,111, 99, 97,108, 32, 95, 44, 95, 44,108, 97, 98,101,\n    108, 44,109,115,103, 32, 61, 32,115,116,114,102,105,110,100,\n     40,109,115,103, 44, 34, 40, 46, 45, 58, 46, 45, 58, 37,115,\n     42, 41, 40, 46, 42, 41, 34, 41, 10, 32,116,111,108,117, 97,\n     95,101,114,114,111,114, 40,109,115,103, 44,108, 97, 98,101,\n    108, 41, 10, 32,112,114,105,110,116, 40,100,101, 98,117,103,\n     46,116,114, 97, 99,101, 98, 97, 99,107, 40, 41, 41, 10,101,\n    110,100,32\n   };\n   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua: embedded Lua code 23\");\n   lua_settop(tolua_S, top);\n  } /* end of embedded lua code */\n\n tolua_endmodule(tolua_S);\n return 1;\n}\n\n\n#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501\n TOLUA_API int luaopen_tolua (lua_State* tolua_S) {\n return tolua_tolua_open(tolua_S);\n};\n#endif\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/bin/toluabind_default.h",
    "content": "/*\n** Lua binding: tolua\n** Generated automatically by tolua++-1.0.8pre2 on Tue Dec 13 01:43:55 2005.\n*/\n\n/* Exported function */\nTOLUA_API int  tolua_tolua_open (lua_State* tolua_S);\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/lib/SCsub",
    "content": "Import('env')\n\n\nsources = [\n\t'tolua_event.c',\n\t'tolua_is.c',\n\t'tolua_map.c',\n\t'tolua_push.c',\n\t'tolua_to.c',\n\t]\n\nenv.lib_target_static = env.Library('#/lib/'+env['tolua_lib']+'_static', sources)\n\nif env['shared']:\n\tenv.lib_target = env.SharedLibrary('#lib/'+env['tolua_lib'], sources)\nelse:\n\tenv.lib_target = env.Library('#/lib/'+env['tolua_lib'], sources)\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/lib/tolua_event.c",
    "content": "/* tolua: event functions\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Apr 2003\n** $Id: $\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#include <stdio.h>\n\n#include \"tolua++.h\"\n\n/* Store at ubox\n\t* It stores, creating the corresponding table if needed,\n\t* the pair key/value in the corresponding ubox table\n*/\nstatic void storeatubox (lua_State* L, int lo)\n{\n\t#ifdef LUA_VERSION_NUM\n#if LUA_VERSION_NUM > 501\n\t\tlua_getuservalue(L, lo);\n#else\n\t\tlua_getfenv(L, lo);\n#endif\n\t\tif (lua_rawequal(L, -1, TOLUA_NOPEER)) {\n\t\t\tlua_pop(L, 1);\n\t\t\tlua_newtable(L);\n\t\t\tlua_pushvalue(L, -1);\n#if LUA_VERSION_NUM > 501\n\t\t\tlua_setuservalue(L, lo);\t/* stack: k,v,table  */\n#else\n\t\t\tlua_setfenv(L, lo);\t/* stack: k,v,table  */\n#endif\n\t\t};\n\t\tlua_insert(L, -3);\n\t\tlua_settable(L, -3); /* on lua 5.1, we trade the \"tolua_peers\" lookup for a settable call */\n\t\tlua_pop(L, 1);\n\t#else\n\t /* stack: key value (to be stored) */\n\t\tlua_pushstring(L,\"tolua_peers\");\n\t\tlua_rawget(L,LUA_REGISTRYINDEX);        /* stack: k v ubox */\n\t\tlua_pushvalue(L,lo);\n\t\tlua_rawget(L,-2);                       /* stack: k v ubox ubox[u] */\n\t\tif (!lua_istable(L,-1))\n\t\t{\n\t\t\tlua_pop(L,1);                          /* stack: k v ubox */\n\t\t\tlua_newtable(L);                       /* stack: k v ubox table */\n\t\t\tlua_pushvalue(L,1);\n\t\t\tlua_pushvalue(L,-2);                   /* stack: k v ubox table u table */\n\t\t\tlua_rawset(L,-4);                      /* stack: k v ubox ubox[u]=table */\n\t\t}\n\t\tlua_insert(L,-4);                       /* put table before k */\n\t\tlua_pop(L,1);                           /* pop ubox */\n\t\tlua_rawset(L,-3);                       /* store at table */\n\t\tlua_pop(L,1);                           /* pop ubox[u] */\n\t#endif\n}\n\n/* Module index function\n*/\nstatic int module_index_event (lua_State* L)\n{\n\tlua_pushstring(L,\".get\");\n\tlua_rawget(L,-3);\n\tif (lua_istable(L,-1))\n\t{\n\t\tlua_pushvalue(L,2);  /* key */\n\t\tlua_rawget(L,-2);\n\t\tif (lua_iscfunction(L,-1))\n\t\t{\n\t\t\tlua_call(L,0,1);\n\t\t\treturn 1;\n\t\t}\n\t\telse if (lua_istable(L,-1))\n\t\t\treturn 1;\n\t}\n\t/* call old index meta event */\n\tif (lua_getmetatable(L,1))\n\t{\n\t\tlua_pushstring(L,\"__index\");\n\t\tlua_rawget(L,-2);\n\t\tlua_pushvalue(L,1);\n\t\tlua_pushvalue(L,2);\n\t\tif (lua_isfunction(L,-1))\n\t\t{\n\t\t\tlua_call(L,2,1);\n\t\t\treturn 1;\n\t\t}\n\t\telse if (lua_istable(L,-1))\n\t\t{\n\t\t\tlua_gettable(L,-3);\n\t\t\treturn 1;\n\t\t}\n\t}\n\tlua_pushnil(L);\n\treturn 1;\n}\n\n/* Module newindex function\n*/\nstatic int module_newindex_event (lua_State* L)\n{\n\tlua_pushstring(L,\".set\");\n\tlua_rawget(L,-4);\n\tif (lua_istable(L,-1))\n\t{\n\t\tlua_pushvalue(L,2);  /* key */\n\t\tlua_rawget(L,-2);\n\t\tif (lua_iscfunction(L,-1))\n\t\t{\n\t\t\tlua_pushvalue(L,1); /* only to be compatible with non-static vars */\n\t\t\tlua_pushvalue(L,3); /* value */\n\t\t\tlua_call(L,2,0);\n\t\t\treturn 0;\n\t\t}\n\t}\n\t/* call old newindex meta event */\n\tif (lua_getmetatable(L,1) && lua_getmetatable(L,-1))\n\t{\n\t\tlua_pushstring(L,\"__newindex\");\n\t\tlua_rawget(L,-2);\n\t\tif (lua_isfunction(L,-1))\n\t\t{\n\t\t lua_pushvalue(L,1);\n\t\t lua_pushvalue(L,2);\n\t\t lua_pushvalue(L,3);\n\t\t\tlua_call(L,3,0);\n\t\t}\n\t}\n\tlua_settop(L,3);\n\tlua_rawset(L,-3);\n\treturn 0;\n}\n\n/* Class index function\n\t* If the object is a userdata (ie, an object), it searches the field in\n\t* the alternative table stored in the corresponding \"ubox\" table.\n*/\nstatic int class_index_event (lua_State* L)\n{\n int t = lua_type(L,1);\n\tif (t == LUA_TUSERDATA)\n\t{\n\t\t/* Access alternative table */\n\t\t#ifdef LUA_VERSION_NUM /* new macro on version 5.1 */\n#if LUA_VERSION_NUM > 501\n\t\tlua_getuservalue(L, 1);\n#else\n\t\tlua_getfenv(L,1);\n#endif\n\t\tif (!lua_rawequal(L, -1, TOLUA_NOPEER)) {\n\t\t\tlua_pushvalue(L, 2); /* key */\n\t\t\tlua_gettable(L, -2); /* on lua 5.1, we trade the \"tolua_peers\" lookup for a gettable call */\n\t\t\tif (!lua_isnil(L, -1))\n\t\t\t\treturn 1;\n\t\t};\n\t\t#else\n\t\tlua_pushstring(L,\"tolua_peers\");\n\t\tlua_rawget(L,LUA_REGISTRYINDEX);        /* stack: obj key ubox */\n\t\tlua_pushvalue(L,1);\n\t\tlua_rawget(L,-2);                       /* stack: obj key ubox ubox[u] */\n\t\tif (lua_istable(L,-1))\n\t\t{\n\t\t\tlua_pushvalue(L,2);  /* key */\n\t\t\tlua_rawget(L,-2);                      /* stack: obj key ubox ubox[u] value */\n\t\t\tif (!lua_isnil(L,-1))\n\t\t\t\treturn 1;\n\t\t}\n\t\t#endif\n\t\tlua_settop(L,2);                        /* stack: obj key */\n\t\t/* Try metatables */\n\t\tlua_pushvalue(L,1);                     /* stack: obj key obj */\n\t\twhile (lua_getmetatable(L,-1))\n\t\t{                                       /* stack: obj key obj mt */\n\t\t\tlua_remove(L,-2);                      /* stack: obj key mt */\n\t\t\tif (lua_isnumber(L,2))                 /* check if key is a numeric value */\n\t\t\t{\n\t\t\t\t/* try operator[] */\n\t\t\t\tlua_pushstring(L,\".geti\");\n\t\t\t\tlua_rawget(L,-2);                      /* stack: obj key mt func */\n\t\t\t\tif (lua_isfunction(L,-1))\n\t\t\t\t{\n\t\t\t\t\tlua_pushvalue(L,1);\n\t\t\t\t\tlua_pushvalue(L,2);\n\t\t\t\t\tlua_call(L,2,1);\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t lua_pushvalue(L,2);                    /* stack: obj key mt key */\n\t\t\t\tlua_rawget(L,-2);                      /* stack: obj key mt value */\n\t\t\t\tif (!lua_isnil(L,-1))\n\t\t\t\t\treturn 1;\n\t\t\t\telse\n\t\t\t\t\tlua_pop(L,1);\n\t\t\t\t/* try C/C++ variable */\n\t\t\t\tlua_pushstring(L,\".get\");\n\t\t\t\tlua_rawget(L,-2);                      /* stack: obj key mt tget */\n\t\t\t\tif (lua_istable(L,-1))\n\t\t\t\t{\n\t\t\t\t\tlua_pushvalue(L,2);\n\t\t\t\t\tlua_rawget(L,-2);                      /* stack: obj key mt value */\n\t\t\t\t\tif (lua_iscfunction(L,-1))\n\t\t\t\t\t{\n\t\t\t\t\t\tlua_pushvalue(L,1);\n\t\t\t\t\t\tlua_pushvalue(L,2);\n\t\t\t\t\t\tlua_call(L,2,1);\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\telse if (lua_istable(L,-1))\n\t\t\t\t\t{\n\t\t\t\t\t\t/* deal with array: create table to be returned and cache it in ubox */\n\t\t\t\t\t\tvoid* u = *((void**)lua_touserdata(L,1));\n\t\t\t\t\t\tlua_newtable(L);                /* stack: obj key mt value table */\n\t\t\t\t\t\tlua_pushstring(L,\".self\");\n\t\t\t\t\t\tlua_pushlightuserdata(L,u);\n\t\t\t\t\t\tlua_rawset(L,-3);               /* store usertype in \".self\" */\n\t\t\t\t\t\tlua_insert(L,-2);               /* stack: obj key mt table value */\n\t\t\t\t\t\tlua_setmetatable(L,-2);         /* set stored value as metatable */\n\t\t\t\t\t\tlua_pushvalue(L,-1);            /* stack: obj key met table table */\n\t\t\t\t\t\tlua_pushvalue(L,2);             /* stack: obj key mt table table key */\n\t\t\t\t\t\tlua_insert(L,-2);               /*  stack: obj key mt table key table */\n\t\t\t\t\t\tstoreatubox(L,1);               /* stack: obj key mt table */\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlua_settop(L,3);\n\t\t}\n\t\tlua_pushnil(L);\n\t\treturn 1;\n\t}\n\telse if (t== LUA_TTABLE)\n\t{\n\t\tmodule_index_event(L);\n\t\treturn 1;\n\t}\n\tlua_pushnil(L);\n\treturn 1;\n}\n\n/* Newindex function\n\t* It first searches for a C/C++ varaible to be set.\n\t* Then, it either stores it in the alternative ubox table (in the case it is\n\t* an object) or in the own table (that represents the class or module).\n*/\nstatic int class_newindex_event (lua_State* L)\n{\n int t = lua_type(L,1);\n\tif (t == LUA_TUSERDATA)\n\t{\n\t /* Try accessing a C/C++ variable to be set */\n\t\tlua_getmetatable(L,1);\n\t\twhile (lua_istable(L,-1))                /* stack: t k v mt */\n\t\t{\n\t\t\tif (lua_isnumber(L,2))                 /* check if key is a numeric value */\n\t\t\t{\n\t\t\t\t/* try operator[] */\n\t\t\t\tlua_pushstring(L,\".seti\");\n\t\t\t\tlua_rawget(L,-2);                      /* stack: obj key mt func */\n\t\t\t\tif (lua_isfunction(L,-1))\n\t\t\t\t{\n\t\t\t\t\tlua_pushvalue(L,1);\n\t\t\t\t\tlua_pushvalue(L,2);\n\t\t\t\t\tlua_pushvalue(L,3);\n\t\t\t\t\tlua_call(L,3,0);\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tlua_pushstring(L,\".set\");\n\t\t\t\tlua_rawget(L,-2);                      /* stack: t k v mt tset */\n\t\t\t\tif (lua_istable(L,-1))\n\t\t\t\t{\n\t\t\t\t\tlua_pushvalue(L,2);\n\t\t\t\t\tlua_rawget(L,-2);                     /* stack: t k v mt tset func */\n\t\t\t\t\tif (lua_iscfunction(L,-1))\n\t\t\t\t\t{\n\t\t\t\t\t\tlua_pushvalue(L,1);\n\t\t\t\t\t\tlua_pushvalue(L,3);\n\t\t\t\t\t\tlua_call(L,2,0);\n\t\t\t\t\t\treturn 0;\n\t\t\t\t\t}\n\t\t\t\t\tlua_pop(L,1);                          /* stack: t k v mt tset */\n\t\t\t\t}\n\t\t\t\tlua_pop(L,1);                           /* stack: t k v mt */\n\t\t\t\tif (!lua_getmetatable(L,-1))            /* stack: t k v mt mt */\n\t\t\t\t\tlua_pushnil(L);\n\t\t\t\tlua_remove(L,-2);                       /* stack: t k v mt */\n\t\t\t}\n\t\t}\n\t lua_settop(L,3);                          /* stack: t k v */\n\n\t\t/* then, store as a new field */\n\t\tstoreatubox(L,1);\n\t}\n\telse if (t== LUA_TTABLE)\n\t{\n\t\tmodule_newindex_event(L);\n\t}\n\treturn 0;\n}\n\nstatic int class_call_event(lua_State* L) {\n\n\tif (lua_istable(L, 1)) {\n\t\tlua_pushstring(L, \".call\");\n\t\tlua_rawget(L, 1);\n\t\tif (lua_isfunction(L, -1)) {\n\n\t\t\tlua_insert(L, 1);\n\t\t\tlua_call(L, lua_gettop(L)-1, 1);\n\n\t\t\treturn 1;\n\t\t};\n\t};\n\ttolua_error(L,\"Attempt to call a non-callable object.\",NULL);\n\treturn 0;\n}\n\nstatic int do_operator (lua_State* L, const char* op)\n{\n\tif (lua_isuserdata(L,1))\n\t{\n\t\t/* Try metatables */\n\t\tlua_pushvalue(L,1);                     /* stack: op1 op2 */\n\t\twhile (lua_getmetatable(L,-1))\n\t\t{                                       /* stack: op1 op2 op1 mt */\n\t\t\tlua_remove(L,-2);                      /* stack: op1 op2 mt */\n\t\t\tlua_pushstring(L,op);                  /* stack: op1 op2 mt key */\n\t\t\tlua_rawget(L,-2);                      /* stack: obj key mt func */\n\t\t\tif (lua_isfunction(L,-1))\n\t\t\t{\n\t\t\t\tlua_pushvalue(L,1);\n\t\t\t\tlua_pushvalue(L,2);\n\t\t\t\tlua_call(L,2,1);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tlua_settop(L,3);\n\t\t}\n\t}\n\ttolua_error(L,\"Attempt to perform operation on an invalid operand\",NULL);\n\treturn 0;\n}\n\nstatic int class_add_event (lua_State* L)\n{\n\treturn do_operator(L,\".add\");\n}\n\nstatic int class_sub_event (lua_State* L)\n{\n\treturn do_operator(L,\".sub\");\n}\n\nstatic int class_mul_event (lua_State* L)\n{\n\treturn do_operator(L,\".mul\");\n}\n\nstatic int class_div_event (lua_State* L)\n{\n\treturn do_operator(L,\".div\");\n}\n\nstatic int class_lt_event (lua_State* L)\n{\n\treturn do_operator(L,\".lt\");\n}\n\nstatic int class_le_event (lua_State* L)\n{\n\treturn do_operator(L,\".le\");\n}\n\nstatic int class_eq_event (lua_State* L)\n{\n\t/* copying code from do_operator here to return false when no operator is found */\n\tif (lua_isuserdata(L,1))\n\t{\n\t\t/* Try metatables */\n\t\tlua_pushvalue(L,1);                     /* stack: op1 op2 */\n\t\twhile (lua_getmetatable(L,-1))\n\t\t{                                       /* stack: op1 op2 op1 mt */\n\t\t\tlua_remove(L,-2);                      /* stack: op1 op2 mt */\n\t\t\tlua_pushstring(L,\".eq\");                  /* stack: op1 op2 mt key */\n\t\t\tlua_rawget(L,-2);                      /* stack: obj key mt func */\n\t\t\tif (lua_isfunction(L,-1))\n\t\t\t{\n\t\t\t\tlua_pushvalue(L,1);\n\t\t\t\tlua_pushvalue(L,2);\n\t\t\t\tlua_call(L,2,1);\n\t\t\t\treturn 1;\n\t\t\t}\n\t\t\tlua_settop(L,3);\n\t\t}\n\t}\n\n\tlua_settop(L, 3);\n\tlua_pushboolean(L, 0);\n\treturn 1;\n}\n\n/*\nstatic int class_gc_event (lua_State* L)\n{\n\tvoid* u = *((void**)lua_touserdata(L,1));\n\tfprintf(stderr, \"collecting: looking at %p\\n\", u);\n\tlua_pushstring(L,\"tolua_gc\");\n\tlua_rawget(L,LUA_REGISTRYINDEX);\n\tlua_pushlightuserdata(L,u);\n\tlua_rawget(L,-2);\n\tif (lua_isfunction(L,-1))\n\t{\n\t\tlua_pushvalue(L,1);\n\t\tlua_call(L,1,0);\n \t\tlua_pushlightuserdata(L,u);\n\t\tlua_pushnil(L);\n\t\tlua_rawset(L,-3);\n\t}\n\tlua_pop(L,2);\n\treturn 0;\n}\n*/\nTOLUA_API int class_gc_event (lua_State* L)\n{\n  if (lua_type(L,1) == LUA_TUSERDATA)\n  {\n\tvoid* u = *((void**)lua_touserdata(L,1));\n\tint top;\n\t/*fprintf(stderr, \"collecting: looking at %p\\n\", u);*/\n\t/*\n\tlua_pushstring(L,\"tolua_gc\");\n\tlua_rawget(L,LUA_REGISTRYINDEX);\n\t*/\n\tlua_pushstring(L,\"tolua_gc\");\n\tlua_rawget(L,LUA_REGISTRYINDEX);   /* gc */\n\tlua_pushlightuserdata(L,u);\n\tlua_rawget(L,-2);            /* stack: gc umt    */\n\tlua_getmetatable(L,1);       /* stack: gc umt mt */\n\t/*fprintf(stderr, \"checking type\\n\");*/\n\ttop = lua_gettop(L);\n\tif (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */\n\t{\n\t\t/*fprintf(stderr, \"Found type!\\n\");*/\n\t\t/* get gc function */\n\t\tlua_pushliteral(L,\".collector\");\n\t\tlua_rawget(L,-2);           /* stack: gc umt mt collector */\n\t\tif (lua_isfunction(L,-1)) {\n\t\t\t/*fprintf(stderr, \"Found .collector!\\n\");*/\n\t\t}\n\t\telse {\n\t\t\tlua_pop(L,1);\n\t\t\t/*fprintf(stderr, \"Using default cleanup\\n\");*/\n\t\t\tlua_pushcfunction(L,tolua_default_collect);\n\t\t}\n\n\t\tlua_pushvalue(L,1);         /* stack: gc umt mt collector u */\n\t\tlua_call(L,1,0);\n\n\t\tlua_pushlightuserdata(L,u); /* stack: gc umt mt u */\n\t\tlua_pushnil(L);             /* stack: gc umt mt u nil */\n\t\tlua_rawset(L,-5);           /* stack: gc umt mt */\n\t}\n\tlua_pop(L,3);\n  }\n\treturn 0;\n}\n\n\n/* Register module events\n\t* It expects the metatable on the top of the stack\n*/\nTOLUA_API void tolua_moduleevents (lua_State* L)\n{\n\tlua_pushstring(L,\"__index\");\n\tlua_pushcfunction(L,module_index_event);\n\tlua_rawset(L,-3);\n\tlua_pushstring(L,\"__newindex\");\n\tlua_pushcfunction(L,module_newindex_event);\n\tlua_rawset(L,-3);\n}\n\n/* Check if the object on the top has a module metatable\n*/\nTOLUA_API int tolua_ismodulemetatable (lua_State* L)\n{\n\tint r = 0;\n\tif (lua_getmetatable(L,-1))\n\t{\n\t\tlua_pushstring(L,\"__index\");\n\t\tlua_rawget(L,-2);\n\t\tr = (lua_tocfunction(L,-1) == module_index_event);\n\t\tlua_pop(L,2);\n\t}\n\treturn r;\n}\n\n/* Register class events\n\t* It expects the metatable on the top of the stack\n*/\nTOLUA_API void tolua_classevents (lua_State* L)\n{\n\tlua_pushstring(L,\"__index\");\n\tlua_pushcfunction(L,class_index_event);\n\tlua_rawset(L,-3);\n\tlua_pushstring(L,\"__newindex\");\n\tlua_pushcfunction(L,class_newindex_event);\n\tlua_rawset(L,-3);\n\n\tlua_pushstring(L,\"__add\");\n\tlua_pushcfunction(L,class_add_event);\n\tlua_rawset(L,-3);\n\tlua_pushstring(L,\"__sub\");\n\tlua_pushcfunction(L,class_sub_event);\n\tlua_rawset(L,-3);\n\tlua_pushstring(L,\"__mul\");\n\tlua_pushcfunction(L,class_mul_event);\n\tlua_rawset(L,-3);\n\tlua_pushstring(L,\"__div\");\n\tlua_pushcfunction(L,class_div_event);\n\tlua_rawset(L,-3);\n\n\tlua_pushstring(L,\"__lt\");\n\tlua_pushcfunction(L,class_lt_event);\n\tlua_rawset(L,-3);\n\tlua_pushstring(L,\"__le\");\n\tlua_pushcfunction(L,class_le_event);\n\tlua_rawset(L,-3);\n\tlua_pushstring(L,\"__eq\");\n\tlua_pushcfunction(L,class_eq_event);\n\tlua_rawset(L,-3);\n\n\tlua_pushstring(L,\"__call\");\n\tlua_pushcfunction(L,class_call_event);\n\tlua_rawset(L,-3);\n\n\tlua_pushstring(L,\"__gc\");\n\tlua_pushstring(L, \"tolua_gc_event\");\n\tlua_rawget(L, LUA_REGISTRYINDEX);\n\t/*lua_pushcfunction(L,class_gc_event);*/\n\tlua_rawset(L,-3);\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/lib/tolua_event.h",
    "content": "/* tolua: event functions\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Apr 2003\n** $Id: $\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#ifndef TOLUA_EVENT_H\n#define TOLUA_EVENT_H\n\n#include \"tolua++.h\"\n\nTOLUA_API void tolua_moduleevents (lua_State* L);\nTOLUA_API int tolua_ismodulemetatable (lua_State* L);\nTOLUA_API void tolua_classevents (lua_State* L);\n\n#endif\n"
  },
  {
    "path": "3rdparty/toluapp/src/lib/tolua_is.c",
    "content": "/* tolua: functions to check types.\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Apr 2003\n** $Id: $\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#include \"tolua++.h\"\n#include \"lauxlib.h\"\n\n#include <stdlib.h>\n#include <string.h>\n\n/* a fast check if a is b, without parameter validation\n i.e. if b is equal to a or a superclass of a. */\nTOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index)\n{\n\tint result;\n\tif (lua_rawequal(L, mt_indexa, mt_indexb))\n\t\tresult = 1;\n\telse\n\t{\n\t\tif (super_index)\n\t\t{\n\t\t\tlua_pushvalue(L, super_index);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlua_pushliteral(L, \"tolua_super\");\n\t\t\tlua_rawget(L, LUA_REGISTRYINDEX); /* stack: super */\n\t\t}\n\t\tlua_pushvalue(L, mt_indexa);\t  /* stack: super mta */\n\t\tlua_rawget(L, -2);\t\t\t\t  /* stack: super super[mta] */\n\t\tlua_pushvalue(L, mt_indexb);\t  /* stack: super super[mta] mtb */\n\t\tlua_rawget(L, LUA_REGISTRYINDEX); /* stack: super super[mta] typenameB */\n\t\tlua_rawget(L, -2);\t\t\t\t  /* stack: super super[mta] bool */\n\t\tresult = lua_toboolean(L, -1);\n\t\tlua_pop(L, 3);\n\t}\n\treturn result;\n}\n\n/* Push and returns the corresponding object typename */\nTOLUA_API const char *tolua_typename(lua_State *L, int lo)\n{\n\tint tag = lua_type(L, lo);\n\tif (tag == LUA_TNONE)\n\t\tlua_pushstring(L, \"[no object]\");\n\telse if (tag != LUA_TUSERDATA && tag != LUA_TTABLE)\n\t\tlua_pushstring(L, lua_typename(L, tag));\n\telse if (tag == LUA_TUSERDATA)\n\t{\n\t\tif (!lua_getmetatable(L, lo))\n\t\t\tlua_pushstring(L, lua_typename(L, tag));\n\t\telse\n\t\t{\n\t\t\tlua_rawget(L, LUA_REGISTRYINDEX);\n\t\t\tif (!lua_isstring(L, -1))\n\t\t\t{\n\t\t\t\tlua_pop(L, 1);\n\t\t\t\tlua_pushstring(L, \"[undefined]\");\n\t\t\t}\n\t\t}\n\t}\n\telse /* is table */\n\t{\n\t\tlua_pushvalue(L, lo);\n\t\tlua_rawget(L, LUA_REGISTRYINDEX);\n\t\tif (!lua_isstring(L, -1))\n\t\t{\n\t\t\tlua_pop(L, 1);\n\t\t\tlua_pushstring(L, \"table\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tlua_pushstring(L, \"class \");\n\t\t\tlua_insert(L, -2);\n\t\t\tlua_concat(L, 2);\n\t\t}\n\t}\n\treturn lua_tostring(L, -1);\n}\n\nTOLUA_API void tolua_error(lua_State *L, const char *msg, tolua_Error *err)\n{\n\tif (msg[0] == '#')\n\t{\n\t\tconst char *expected = err->type;\n\t\tconst char *provided = tolua_typename(L, err->index);\n\t\tif (msg[1] == 'f')\n\t\t{\n\t\t\tint narg = err->index;\n\t\t\tif (err->array)\n\t\t\t\tluaL_error(L, \"%s\\n     argument #%d is array of '%s'; array of '%s' expected.\\n\",\n\t\t\t\t\t\t   msg + 2, narg, provided, expected);\n\t\t\telse\n\t\t\t\tluaL_error(L, \"%s\\n     argument #%d is '%s'; '%s' expected.\\n\",\n\t\t\t\t\t\t   msg + 2, narg, provided, expected);\n\t\t}\n\t\telse if (msg[1] == 'v')\n\t\t{\n\t\t\tif (err->array)\n\t\t\t\tluaL_error(L, \"%s\\n     value is array of '%s'; array of '%s' expected.\\n\",\n\t\t\t\t\t\t   msg + 2, provided, expected);\n\t\t\telse\n\t\t\t\tluaL_error(L, \"%s\\n     value is '%s'; '%s' expected.\\n\",\n\t\t\t\t\t\t   msg + 2, provided, expected);\n\t\t}\n\t}\n\telse\n\t\tluaL_error(L, msg);\n}\n\n/* the equivalent of lua_is* for usertable */\nstatic int lua_isusertable(lua_State *L, int lo, const char *type)\n{\n\tint r = 0;\n\tif (lo < 0)\n\t\tlo = lua_gettop(L) + lo + 1;\n\tlua_pushvalue(L, lo);\n\tlua_rawget(L, LUA_REGISTRYINDEX); /* get registry[t] */\n\tif (lua_isstring(L, -1))\n\t{\n\t\tr = strcmp(lua_tostring(L, -1), type) == 0;\n\t\tif (!r)\n\t\t{\n\t\t\t/* try const */\n\t\t\tlua_pushstring(L, \"const \");\n\t\t\tlua_insert(L, -2);\n\t\t\tlua_concat(L, 2);\n\t\t\tr = lua_isstring(L, -1) && strcmp(lua_tostring(L, -1), type) == 0;\n\t\t}\n\t}\n\tlua_pop(L, 1);\n\treturn r;\n}\n\nint push_table_instance(lua_State *L, int lo)\n{\n\n\tif (lua_istable(L, lo))\n\t{\n\n\t\tlua_pushstring(L, \".c_instance\");\n\t\tlua_gettable(L, lo);\n\t\tif (lua_isuserdata(L, -1))\n\t\t{\n\n\t\t\tlua_replace(L, lo);\n\t\t\treturn 1;\n\t\t}\n\t\telse\n\t\t{\n\n\t\t\tlua_pop(L, 1);\n\t\t\treturn 0;\n\t\t}\n\t}\n\telse\n\t{\n\t\treturn 0;\n\t}\n\n\treturn 0;\n}\n\n/* the equivalent of lua_is* for usertype */\nstatic int lua_isusertype(lua_State *L, int lo, const char *type)\n{\n\tif (!lua_isuserdata(L, lo))\n\t{\n\t\tif (!push_table_instance(L, lo))\n\t\t{\n\t\t\treturn 0;\n\t\t}\n\t}\n\t{\n\t\t/* check if it is of the same type */\n\t\tint r;\n\t\tconst char *tn;\n\t\tif (lua_getmetatable(L, lo)) /* if metatable? */\n\t\t{\n\t\t\tlua_rawget(L, LUA_REGISTRYINDEX); /* get registry[mt] */\n\t\t\ttn = lua_tostring(L, -1);\n\t\t\tr = tn && (strcmp(tn, type) == 0);\n\t\t\tlua_pop(L, 1);\n\t\t\tif (r)\n\t\t\t\treturn 1;\n\t\t\telse\n\t\t\t{\n\t\t\t\t/* check if it is a specialized class */\n\t\t\t\tlua_pushstring(L, \"tolua_super\");\n\t\t\t\tlua_rawget(L, LUA_REGISTRYINDEX); /* get super */\n\t\t\t\tlua_getmetatable(L, lo);\n\t\t\t\tlua_rawget(L, -2); /* get super[mt] */\n\t\t\t\tif (lua_istable(L, -1))\n\t\t\t\t{\n\t\t\t\t\tint b;\n\t\t\t\t\tlua_pushstring(L, type);\n\t\t\t\t\tlua_rawget(L, -2); /* get super[mt][type] */\n\t\t\t\t\tb = lua_toboolean(L, -1);\n\t\t\t\t\tlua_pop(L, 3);\n\t\t\t\t\tif (b)\n\t\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn 0;\n}\n\nTOLUA_API int tolua_isnoobj(lua_State *L, int lo, tolua_Error *err)\n{\n\tif (lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"[no object]\";\n\treturn 0;\n}\n\nTOLUA_API int tolua_isboolean(lua_State *L, int lo, int def, tolua_Error *err)\n{\n\tif (def && lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\tif (lua_isnil(L, lo) || lua_isboolean(L, lo))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"boolean\";\n\treturn 0;\n}\n\nTOLUA_API int tolua_isnumber(lua_State *L, int lo, int def, tolua_Error *err)\n{\n\tif (def && lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\tif (lua_isnumber(L, lo))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"number\";\n\treturn 0;\n}\n\nTOLUA_API int tolua_isstring(lua_State *L, int lo, int def, tolua_Error *err)\n{\n\tif (def && lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\tif (lua_isnil(L, lo) || lua_isstring(L, lo))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"string\";\n\treturn 0;\n}\n\nTOLUA_API int tolua_istable(lua_State *L, int lo, int def, tolua_Error *err)\n{\n\tif (def && lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\tif (lua_istable(L, lo))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"table\";\n\treturn 0;\n}\n\nTOLUA_API int tolua_isusertable(lua_State *L, int lo, const char *type, int def, tolua_Error *err)\n{\n\tif (def && lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\tif (lua_isusertable(L, lo, type))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = type;\n\treturn 0;\n}\n\nTOLUA_API int tolua_isuserdata(lua_State *L, int lo, int def, tolua_Error *err)\n{\n\tif (def && lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\tif (lua_isnil(L, lo) || lua_isuserdata(L, lo))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"userdata\";\n\treturn 0;\n}\n\nTOLUA_API int tolua_isvaluenil(lua_State *L, int lo, tolua_Error *err)\n{\n\n\tif (lua_gettop(L) < abs(lo))\n\t\treturn 0; /* somebody else should chack this */\n\tif (!lua_isnil(L, lo))\n\t\treturn 0;\n\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"value\";\n\treturn 1;\n}\n\nTOLUA_API int tolua_isvalue(lua_State *L, int lo, int def, tolua_Error *err)\n{\n\tif (def || abs(lo) <= lua_gettop(L)) /* any valid index */\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = \"value\";\n\treturn 0;\n}\n\nTOLUA_API int tolua_isusertype(lua_State *L, int lo, const char *type, int def, tolua_Error *err)\n{\n\tif (def && lua_gettop(L) < abs(lo))\n\t\treturn 1;\n\tif (lua_isnil(L, lo) || lua_isusertype(L, lo, type))\n\t\treturn 1;\n\terr->index = lo;\n\terr->array = 0;\n\terr->type = type;\n\treturn 0;\n}\n\nTOLUA_API int tolua_isvaluearray(lua_State *L, int lo, int dim, int def, tolua_Error *err)\n{\n\t(void)dim;\n\tif (!tolua_istable(L, lo, def, err))\n\t\treturn 0;\n\telse\n\t\treturn 1;\n}\n\nTOLUA_API int tolua_isbooleanarray(lua_State *L, int lo, int dim, int def, tolua_Error *err)\n{\n\tif (!tolua_istable(L, lo, def, err))\n\t\treturn 0;\n\telse\n\t{\n\t\tint i;\n\t\tfor (i = 1; i <= dim; ++i)\n\t\t{\n\t\t\tlua_pushnumber(L, i);\n\t\t\tlua_gettable(L, lo);\n\t\t\tif (!(lua_isnil(L, -1) || lua_isboolean(L, -1)) &&\n\t\t\t\t!(def && lua_isnil(L, -1)))\n\t\t\t{\n\t\t\t\terr->index = lo;\n\t\t\t\terr->array = 1;\n\t\t\t\terr->type = \"boolean\";\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tlua_pop(L, 1);\n\t\t}\n\t}\n\treturn 1;\n}\n\nTOLUA_API int tolua_isnumberarray(lua_State *L, int lo, int dim, int def, tolua_Error *err)\n{\n\tif (!tolua_istable(L, lo, def, err))\n\t\treturn 0;\n\telse\n\t{\n\t\tint i;\n\t\tfor (i = 1; i <= dim; ++i)\n\t\t{\n\t\t\tlua_pushnumber(L, i);\n\t\t\tlua_gettable(L, lo);\n\t\t\tif (!lua_isnumber(L, -1) &&\n\t\t\t\t!(def && lua_isnil(L, -1)))\n\t\t\t{\n\t\t\t\terr->index = lo;\n\t\t\t\terr->array = 1;\n\t\t\t\terr->type = \"number\";\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tlua_pop(L, 1);\n\t\t}\n\t}\n\treturn 1;\n}\n\nTOLUA_API int tolua_isstringarray(lua_State *L, int lo, int dim, int def, tolua_Error *err)\n{\n\tif (!tolua_istable(L, lo, def, err))\n\t\treturn 0;\n\telse\n\t{\n\t\tint i;\n\t\tfor (i = 1; i <= dim; ++i)\n\t\t{\n\t\t\tlua_pushnumber(L, i);\n\t\t\tlua_gettable(L, lo);\n\t\t\tif (!(lua_isnil(L, -1) || lua_isstring(L, -1)) &&\n\t\t\t\t!(def && lua_isnil(L, -1)))\n\t\t\t{\n\t\t\t\terr->index = lo;\n\t\t\t\terr->array = 1;\n\t\t\t\terr->type = \"string\";\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tlua_pop(L, 1);\n\t\t}\n\t}\n\treturn 1;\n}\n\nTOLUA_API int tolua_istablearray(lua_State *L, int lo, int dim, int def, tolua_Error *err)\n{\n\tif (!tolua_istable(L, lo, def, err))\n\t\treturn 0;\n\telse\n\t{\n\t\tint i;\n\t\tfor (i = 1; i <= dim; ++i)\n\t\t{\n\t\t\tlua_pushnumber(L, i);\n\t\t\tlua_gettable(L, lo);\n\t\t\tif (!lua_istable(L, -1) &&\n\t\t\t\t!(def && lua_isnil(L, -1)))\n\t\t\t{\n\t\t\t\terr->index = lo;\n\t\t\t\terr->array = 1;\n\t\t\t\terr->type = \"table\";\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tlua_pop(L, 1);\n\t\t}\n\t}\n\treturn 1;\n}\n\nTOLUA_API int tolua_isuserdataarray(lua_State *L, int lo, int dim, int def, tolua_Error *err)\n{\n\tif (!tolua_istable(L, lo, def, err))\n\t\treturn 0;\n\telse\n\t{\n\t\tint i;\n\t\tfor (i = 1; i <= dim; ++i)\n\t\t{\n\t\t\tlua_pushnumber(L, i);\n\t\t\tlua_gettable(L, lo);\n\t\t\tif (!(lua_isnil(L, -1) || lua_isuserdata(L, -1)) &&\n\t\t\t\t!(def && lua_isnil(L, -1)))\n\t\t\t{\n\t\t\t\terr->index = lo;\n\t\t\t\terr->array = 1;\n\t\t\t\terr->type = \"userdata\";\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tlua_pop(L, 1);\n\t\t}\n\t}\n\treturn 1;\n}\n\nTOLUA_API int tolua_isusertypearray(lua_State *L, int lo, const char *type, int dim, int def, tolua_Error *err)\n{\n\tif (!tolua_istable(L, lo, def, err))\n\t\treturn 0;\n\telse\n\t{\n\t\tint i;\n\t\tfor (i = 1; i <= dim; ++i)\n\t\t{\n\t\t\tlua_pushnumber(L, i);\n\t\t\tlua_gettable(L, lo);\n\t\t\tif (!(lua_isnil(L, -1) || lua_isuserdata(L, -1)) &&\n\t\t\t\t!(def && lua_isnil(L, -1)))\n\t\t\t{\n\t\t\t\terr->index = lo;\n\t\t\t\terr->type = type;\n\t\t\t\terr->array = 1;\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\tlua_pop(L, 1);\n\t\t}\n\t}\n\treturn 1;\n}\n\n#if 0\nint tolua_isbooleanfield\n (lua_State* L, int lo, int i, int def, tolua_Error* err)\n{\n\tlua_pushnumber(L,i);\n\tlua_gettable(L,lo);\n\tif (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) &&\n\t\t\t  !(def && lua_isnil(L,-1))\n\t\t\t\t)\n\t{\n\t\terr->index = lo;\n\t\terr->array = 1;\n\t\terr->type = \"boolean\";\n\t\treturn 0;\n\t}\n\tlua_pop(L,1);\n return 1;\n}\n\nint tolua_isnumberfield\n (lua_State* L, int lo, int i, int def, tolua_Error* err)\n{\n\tlua_pushnumber(L,i);\n\tlua_gettable(L,lo);\n\tif (!lua_isnumber(L,-1) &&\n\t\t\t  !(def && lua_isnil(L,-1))\n\t\t\t\t)\n\t{\n\t\terr->index = lo;\n\t\terr->array = 1;\n\t\terr->type = \"number\";\n\t\treturn 0;\n\t}\n\tlua_pop(L,1);\n return 1;\n}\n\nint tolua_isstringfield\n (lua_State* L, int lo, int i, int def, tolua_Error* err)\n{\n\tlua_pushnumber(L,i);\n\tlua_gettable(L,lo);\n if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) &&\n\t    !(def && lua_isnil(L,-1))\n\t\t\t\t)\n\t{\n\t\terr->index = lo;\n\t\terr->array = 1;\n\t\terr->type = \"string\";\n\t\treturn 0;\n\t}\n\tlua_pop(L,1);\n return 1;\n}\n\nint tolua_istablefield\n (lua_State* L, int lo, int i, int def, tolua_Error* err)\n{\n\tlua_pushnumber(L,i+1);\n\tlua_gettable(L,lo);\n\tif (! lua_istable(L,-1) &&\n\t    !(def && lua_isnil(L,-1))\n\t\t\t\t)\n\t{\n\t\terr->index = lo;\n\t\terr->array = 1;\n\t\terr->type = \"table\";\n\t\treturn 0;\n\t}\n\tlua_pop(L,1);\n}\n\nint tolua_isusertablefield\n (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err)\n{\n\tlua_pushnumber(L,i);\n\tlua_gettable(L,lo);\n\tif (! lua_isusertable(L,-1,type) &&\n\t    !(def && lua_isnil(L,-1))\n\t\t\t\t)\n\t{\n\t\terr->index = lo;\n\t\terr->array = 1;\n\t\terr->type = type;\n\t\treturn 0;\n\t}\n\tlua_pop(L,1);\n return 1;\n}\n\nint tolua_isuserdatafield\n (lua_State* L, int lo, int i, int def, tolua_Error* err)\n{\n\tlua_pushnumber(L,i);\n\tlua_gettable(L,lo);\n\tif (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) &&\n\t    !(def && lua_isnil(L,-1))\n\t\t\t\t)\n\t{\n\t\terr->index = lo;\n\t\terr->array = 1;\n\t\terr->type = \"userdata\";\n\t\treturn 0;\n\t}\n\tlua_pop(L,1);\n return 1;\n}\n\nint tolua_isusertypefield\n (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err)\n{\n\tlua_pushnumber(L,i);\n\tlua_gettable(L,lo);\n\tif (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) &&\n\t    !(def && lua_isnil(L,-1))\n\t\t\t\t)\n\t{\n\t\terr->index = lo;\n\t\terr->type = type;\n\t\terr->array = 1;\n\t\treturn 0;\n\t}\n\tlua_pop(L,1);\n return 1;\n}\n\n#endif\n"
  },
  {
    "path": "3rdparty/toluapp/src/lib/tolua_map.c",
    "content": "/* tolua: functions to map features\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Apr 2003\n** $Id: $\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#include \"tolua++.h\"\n#include \"tolua_event.h\"\n#include \"lauxlib.h\"\n\n#include <string.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <math.h>\n\n/* Create metatable\n\t* Create and register new metatable\n*/\nstatic int tolua_newmetatable(lua_State *L, const char *name)\n{\n\tint r = luaL_newmetatable(L, name);\n\n#ifdef LUA_VERSION_NUM /* only lua 5.1 */\n\tif (r)\n\t{\n\t\tlua_pushvalue(L, -1);\n\t\tlua_pushstring(L, name);\n\t\tlua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */\n\t}\n#endif\n\n\tif (r)\n\t\ttolua_classevents(L); /* set meta events */\n\tlua_pop(L, 1);\n\treturn r;\n}\n\n/* Map super classes\n\t* It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name'\n*/\nstatic void mapsuper(lua_State *L, const char *name, const char *base)\n{\n\t/* push registry.super */\n\tlua_pushstring(L, \"tolua_super\");\n\tlua_rawget(L, LUA_REGISTRYINDEX); /* stack: super */\n\tluaL_getmetatable(L, name);\t\t\t\t/* stack: super mt */\n\tlua_rawget(L, -2);\t\t\t\t\t\t\t\t/* stack: super table */\n\tif (lua_isnil(L, -1))\n\t{\n\t\t/* create table */\n\t\tlua_pop(L, 1);\n\t\tlua_newtable(L);\t\t\t\t\t\t/* stack: super table */\n\t\tluaL_getmetatable(L, name); /* stack: super table mt */\n\t\tlua_pushvalue(L, -2);\t\t\t\t/* stack: super table mt table */\n\t\tlua_rawset(L, -4);\t\t\t\t\t/* stack: super table */\n\t}\n\n\t/* set base as super class */\n\tlua_pushstring(L, base);\n\tlua_pushboolean(L, 1);\n\tlua_rawset(L, -3); /* stack: super table */\n\n\t/* set all super class of base as super class of name */\n\tluaL_getmetatable(L, base); /* stack: super table base_mt */\n\tlua_rawget(L, -3);\t\t\t\t\t/* stack: super table base_table */\n\tif (lua_istable(L, -1))\n\t{\n\t\t/* traverse base table */\n\t\tlua_pushnil(L); /* first key */\n\t\twhile (lua_next(L, -2) != 0)\n\t\t{\n\t\t\t/* stack: ... base_table key value */\n\t\t\tlua_pushvalue(L, -2); /* stack: ... base_table key value key */\n\t\t\tlua_insert(L, -2);\t\t/* stack: ... base_table key key value */\n\t\t\tlua_rawset(L, -5);\t\t/* stack: ... base_table key */\n\t\t}\n\t}\n\tlua_pop(L, 3); /* stack: <empty> */\n}\n\n/* creates a 'tolua_ubox' table for base clases, and\n// expects the metatable and base metatable on the stack */\nstatic void set_ubox(lua_State *L)\n{\n\n\t/* mt basemt */\n\tif (!lua_isnil(L, -1))\n\t{\n\t\tlua_pushstring(L, \"tolua_ubox\");\n\t\tlua_rawget(L, -2);\n\t}\n\telse\n\t{\n\t\tlua_pushnil(L);\n\t}\n\t/* mt basemt base_ubox */\n\tif (!lua_isnil(L, -1))\n\t{\n\t\tlua_pushstring(L, \"tolua_ubox\");\n\t\tlua_insert(L, -2);\n\t\t/* mt basemt key ubox */\n\t\tlua_rawset(L, -4);\n\t\t/* (mt with ubox) basemt */\n\t}\n\telse\n\t{\n\t\t/* mt basemt nil */\n\t\tlua_pop(L, 1);\n\t\tlua_pushstring(L, \"tolua_ubox\");\n\t\tlua_newtable(L);\n\t\t/* make weak value metatable for ubox table to allow userdata to be\n\t\tgarbage-collected */\n\t\tlua_newtable(L);\n\t\tlua_pushliteral(L, \"__mode\");\n\t\tlua_pushliteral(L, \"v\");\n\t\tlua_rawset(L, -3);\t\t\t /* stack: string ubox mt */\n\t\tlua_setmetatable(L, -2); /* stack:mt basemt string ubox */\n\t\tlua_rawset(L, -4);\n\t}\n}\n\n/* Map inheritance\n\t* It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name'\n*/\nstatic void mapinheritance(lua_State *L, const char *name, const char *base)\n{\n\t/* set metatable inheritance */\n\tluaL_getmetatable(L, name);\n\n\tif (base && *base)\n\t\tluaL_getmetatable(L, base);\n\telse\n\t{\n\n\t\tif (lua_getmetatable(L, -1))\n\t\t{ /* already has a mt, we don't overwrite it */\n\t\t\tlua_pop(L, 2);\n\t\t\treturn;\n\t\t}\n\t\tluaL_getmetatable(L, \"tolua_commonclass\");\n\t}\n\n\tset_ubox(L);\n\n\tlua_setmetatable(L, -2);\n\tlua_pop(L, 1);\n}\n\n/* Object type\n*/\nstatic int tolua_bnd_type(lua_State *L)\n{\n\ttolua_typename(L, lua_gettop(L));\n\treturn 1;\n}\n\n/* Take ownership\n*/\nstatic int tolua_bnd_takeownership(lua_State *L)\n{\n\tint success = 0;\n\tif (lua_isuserdata(L, 1))\n\t{\n\t\tif (lua_getmetatable(L, 1)) /* if metatable? */\n\t\t{\n\t\t\tlua_pop(L, 1); /* clear metatable off stack */\n/* force garbage collection to avoid C to reuse a to-be-collected address */\n#ifdef LUA_VERSION_NUM\n\t\t\tlua_gc(L, LUA_GCCOLLECT, 0);\n#else\n\t\t\tlua_setgcthreshold(L, 0);\n#endif\n\n\t\t\tsuccess = tolua_register_gc(L, 1);\n\t\t}\n\t}\n\tlua_pushboolean(L, success != 0);\n\treturn 1;\n}\n\n/* Release ownership\n*/\nstatic int tolua_bnd_releaseownership(lua_State *L)\n{\n\tint done = 0;\n\tif (lua_isuserdata(L, 1))\n\t{\n\t\tvoid *u = *((void **)lua_touserdata(L, 1));\n/* force garbage collection to avoid releasing a to-be-collected address */\n#ifdef LUA_VERSION_NUM\n\t\tlua_gc(L, LUA_GCCOLLECT, 0);\n#else\n\t\tlua_setgcthreshold(L, 0);\n#endif\n\t\tlua_pushstring(L, \"tolua_gc\");\n\t\tlua_rawget(L, LUA_REGISTRYINDEX);\n\t\tlua_pushlightuserdata(L, u);\n\t\tlua_rawget(L, -2);\n\t\tlua_getmetatable(L, 1);\n\t\tif (lua_rawequal(L, -1, -2)) /* check that we are releasing the correct type */\n\t\t{\n\t\t\tlua_pushlightuserdata(L, u);\n\t\t\tlua_pushnil(L);\n\t\t\tlua_rawset(L, -5);\n\t\t\tdone = 1;\n\t\t}\n\t}\n\tlua_pushboolean(L, done != 0);\n\treturn 1;\n}\n\n/* Type casting\n*/\nstatic int tolua_bnd_cast(lua_State *L)\n{\n\n\t/* // old code\n        void* v = tolua_tousertype(L,1,NULL);\n        const char* s = tolua_tostring(L,2,NULL);\n        if (v && s)\n         tolua_pushusertype(L,v,s);\n        else\n         lua_pushnil(L);\n        return 1;\n*/\n\n\tvoid *v;\n\tconst char *s;\n\tif (lua_islightuserdata(L, 1))\n\t{\n\t\tv = tolua_touserdata(L, 1, NULL);\n\t}\n\telse\n\t{\n\t\tv = tolua_tousertype(L, 1, 0);\n\t}\n\n\ts = tolua_tostring(L, 2, NULL);\n\tif (v && s)\n\t\ttolua_pushusertype(L, v, s);\n\telse\n\t\tlua_pushnil(L);\n\treturn 1;\n}\n\n/* Inheritance\n*/\nstatic int tolua_bnd_inherit(lua_State *L)\n{\n\n\t/* stack: lua object, c object */\n\tlua_pushstring(L, \".c_instance\");\n\tlua_pushvalue(L, -2);\n\tlua_rawset(L, -4);\n\t/* l_obj[\".c_instance\"] = c_obj */\n\n\treturn 0;\n}\n\n#ifdef LUA_VERSION_NUM /* lua 5.1 */\nstatic int tolua_bnd_setpeer(lua_State *L)\n{\n\n\t/* stack: userdata, table */\n\tif (!lua_isuserdata(L, -2))\n\t{\n\t\tlua_pushstring(L, \"Invalid argument #1 to setpeer: userdata expected.\");\n\t\tlua_error(L);\n\t}\n\n\tif (lua_isnil(L, -1))\n\t{\n\n\t\tlua_pop(L, 1);\n\t\tlua_pushvalue(L, TOLUA_NOPEER);\n\t}\n#if LUA_VERSION_NUM > 501\n\tlua_setuservalue(L, -2);\n#else\n\tlua_setfenv(L, -2);\n#endif\n\n\treturn 0;\n}\n\nstatic int tolua_bnd_getpeer(lua_State *L)\n{\n\n\t/* stack: userdata */\n#if LUA_VERSION_NUM > 501\n\tlua_getuservalue(L, -1);\n#else\n\tlua_getfenv(L, -1);\n#endif\n\tif (lua_rawequal(L, -1, TOLUA_NOPEER))\n\t{\n\t\tlua_pop(L, 1);\n\t\tlua_pushnil(L);\n\t}\n\treturn 1;\n}\n#endif\n\n/* static int class_gc_event (lua_State* L); */\n\nTOLUA_API void tolua_open(lua_State *L)\n{\n\tint top = lua_gettop(L);\n\tlua_pushstring(L, \"tolua_opened\");\n\tlua_rawget(L, LUA_REGISTRYINDEX);\n\tif (!lua_isboolean(L, -1))\n\t{\n\t\tlua_pushstring(L, \"tolua_opened\");\n\t\tlua_pushboolean(L, 1);\n\t\tlua_rawset(L, LUA_REGISTRYINDEX);\n\n#ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */\n\t\t/* create peer object table */\n\t\tlua_pushstring(L, \"tolua_peers\");\n\t\tlua_newtable(L);\n\t\t/* make weak key metatable for peers indexed by userdata object */\n\t\tlua_newtable(L);\n\t\tlua_pushliteral(L, \"__mode\");\n\t\tlua_pushliteral(L, \"k\");\n\t\tlua_rawset(L, -3);\t\t\t /* stack: string peers mt */\n\t\tlua_setmetatable(L, -2); /* stack: string peers */\n\t\tlua_rawset(L, LUA_REGISTRYINDEX);\n#endif\n\n\t\t/* create object ptr -> udata mapping table */\n\t\tlua_pushstring(L, \"tolua_ubox\");\n\t\tlua_newtable(L);\n\t\t/* make weak value metatable for ubox table to allow userdata to be\n     garbage-collected */\n\t\tlua_newtable(L);\n\t\tlua_pushliteral(L, \"__mode\");\n\t\tlua_pushliteral(L, \"v\");\n\t\tlua_rawset(L, -3);\t\t\t /* stack: string ubox mt */\n\t\tlua_setmetatable(L, -2); /* stack: string ubox */\n\t\tlua_rawset(L, LUA_REGISTRYINDEX);\n\n\t\tlua_pushstring(L, \"tolua_super\");\n\t\tlua_newtable(L);\n\t\tlua_rawset(L, LUA_REGISTRYINDEX);\n\t\tlua_pushstring(L, \"tolua_gc\");\n\t\tlua_newtable(L);\n\t\tlua_rawset(L, LUA_REGISTRYINDEX);\n\n\t\t/* create gc_event closure */\n\t\tlua_pushstring(L, \"tolua_gc_event\");\n\t\tlua_pushstring(L, \"tolua_gc\");\n\t\tlua_rawget(L, LUA_REGISTRYINDEX);\n\t\tlua_pushstring(L, \"tolua_super\");\n\t\tlua_rawget(L, LUA_REGISTRYINDEX);\n\t\tlua_pushcclosure(L, class_gc_event, 2);\n\t\tlua_rawset(L, LUA_REGISTRYINDEX);\n\n\t\ttolua_newmetatable(L, \"tolua_commonclass\");\n\n\t\ttolua_module(L, NULL, 0);\n\t\ttolua_beginmodule(L, NULL);\n\t\ttolua_module(L, \"tolua\", 0);\n\t\ttolua_beginmodule(L, \"tolua\");\n\t\ttolua_function(L, \"type\", tolua_bnd_type);\n\t\ttolua_function(L, \"takeownership\", tolua_bnd_takeownership);\n\t\ttolua_function(L, \"releaseownership\", tolua_bnd_releaseownership);\n\t\ttolua_function(L, \"cast\", tolua_bnd_cast);\n\t\ttolua_function(L, \"inherit\", tolua_bnd_inherit);\n#ifdef LUA_VERSION_NUM /* lua 5.1 */\n\t\ttolua_function(L, \"setpeer\", tolua_bnd_setpeer);\n\t\ttolua_function(L, \"getpeer\", tolua_bnd_getpeer);\n#endif\n\n\t\ttolua_endmodule(L);\n\t\ttolua_endmodule(L);\n\t}\n\tlua_settop(L, top);\n}\n\n/* Copy a C object\n*/\nTOLUA_API void *tolua_copy(lua_State *L, void *value, unsigned int size)\n{\n\tvoid *clone = (void *)malloc(size);\n\tif (clone)\n\t\tmemcpy(clone, value, size);\n\telse\n\t\ttolua_error(L, \"insuficient memory\", NULL);\n\treturn clone;\n}\n\n/* Default collect function\n*/\nTOLUA_API int tolua_default_collect(lua_State *tolua_S)\n{\n\tvoid *self = tolua_tousertype(tolua_S, 1, 0);\n\tfree(self);\n\treturn 0;\n}\n\n/* Do clone\n*/\nTOLUA_API int tolua_register_gc(lua_State *L, int lo)\n{\n\tint success = 1;\n\tvoid *value = *(void **)lua_touserdata(L, lo);\n\tlua_pushstring(L, \"tolua_gc\");\n\tlua_rawget(L, LUA_REGISTRYINDEX);\n\tlua_pushlightuserdata(L, value);\n\tlua_rawget(L, -2);\n\tif (!lua_isnil(L, -1)) /* make sure that object is not already owned */\n\t\tsuccess = 0;\n\telse\n\t{\n\t\tlua_pushlightuserdata(L, value);\n\t\tlua_getmetatable(L, lo);\n\t\tlua_rawset(L, -4);\n\t}\n\tlua_pop(L, 2);\n\treturn success;\n}\n\n/* Register a usertype\n\t* It creates the correspoding metatable in the registry, for both 'type' and 'const type'.\n\t* It maps 'const type' as being also a 'type'\n*/\nTOLUA_API void tolua_usertype(lua_State *L, const char *type)\n{\n\tchar ctype[128] = \"const \";\n\tstrncat(ctype, type, 120);\n\n\t/* create both metatables */\n\tif (tolua_newmetatable(L, ctype) && tolua_newmetatable(L, type))\n\t\tmapsuper(L, type, ctype); /* 'type' is also a 'const type' */\n}\n\n/* Begin module\n\t* It pushes the module (or class) table on the stack\n*/\nTOLUA_API void tolua_beginmodule(lua_State *L, const char *name)\n{\n\tif (name)\n\t{\n\t\tlua_pushstring(L, name);\n\t\tlua_rawget(L, -2);\n\t}\n\telse\n#if LUA_VERSION_NUM > 501\n\t\tlua_pushglobaltable(L);\n#else\n\t\tlua_pushvalue(L, LUA_GLOBALSINDEX);\n#endif\n}\n\n/* End module\n\t* It pops the module (or class) from the stack\n*/\nTOLUA_API void tolua_endmodule(lua_State *L)\n{\n\tlua_pop(L, 1);\n}\n\n/* Map module\n\t* It creates a new module\n*/\n#if 1\nTOLUA_API void tolua_module(lua_State *L, const char *name, int hasvar)\n{\n\tif (name)\n\t{\n\t\t/* tolua module */\n\t\tlua_pushstring(L, name);\n\t\tlua_rawget(L, -2);\n\t\tif (!lua_istable(L, -1)) /* check if module already exists */\n\t\t{\n\t\t\tlua_pop(L, 1);\n\t\t\tlua_newtable(L);\n\t\t\tlua_pushstring(L, name);\n\t\t\tlua_pushvalue(L, -2);\n\t\t\tlua_rawset(L, -4); /* assing module into module */\n\t\t}\n\t}\n\telse\n\t{\n\t\t/* global table */\n#if LUA_VERSION_NUM > 501\n\t\tlua_pushglobaltable(L);\n#else\n\t\tlua_pushvalue(L, LUA_GLOBALSINDEX);\n#endif\n\t}\n\tif (hasvar)\n\t{\n\t\tif (!tolua_ismodulemetatable(L)) /* check if it already has a module metatable */\n\t\t{\n\t\t\t/* create metatable to get/set C/C++ variable */\n\t\t\tlua_newtable(L);\n\t\t\ttolua_moduleevents(L);\n\t\t\tif (lua_getmetatable(L, -2))\n\t\t\t\tlua_setmetatable(L, -2); /* set old metatable as metatable of metatable */\n\t\t\tlua_setmetatable(L, -2);\n\t\t}\n\t}\n\tlua_pop(L, 1); /* pop module */\n}\n#else\nTOLUA_API void tolua_module(lua_State *L, const char *name, int hasvar)\n{\n\tif (name)\n\t{\n\t\t/* tolua module */\n\t\tlua_pushstring(L, name);\n\t\tlua_newtable(L);\n\t}\n\telse\n\t{\n\t\t/* global table */\n#if LUA_VERSION_NUM > 501\n\t\tlua_pushglobaltable(L);\n#else\n\t\tlua_pushvalue(L, LUA_GLOBALSINDEX);\n#endif\n\t}\n\tif (hasvar)\n\t{\n\t\t/* create metatable to get/set C/C++ variable */\n\t\tlua_newtable(L);\n\t\ttolua_moduleevents(L);\n\t\tif (lua_getmetatable(L, -2))\n\t\t\tlua_setmetatable(L, -2); /* set old metatable as metatable of metatable */\n\t\tlua_setmetatable(L, -2);\n\t}\n\tif (name)\n\t\tlua_rawset(L, -3); /* assing module into module */\n\telse\n\t\tlua_pop(L, 1); /* pop global table */\n}\n#endif\n\nstatic void push_collector(lua_State *L, const char *type, lua_CFunction col)\n{\n\n\t/* push collector function, but only if it's not NULL, or if there's no\n\t   collector already */\n\tif (!col)\n\t\treturn;\n\tluaL_getmetatable(L, type);\n\tlua_pushstring(L, \".collector\");\n\t/*\n\tif (!col) {\n\t\tlua_pushvalue(L, -1);\n\t\tlua_rawget(L, -3);\n\t\tif (!lua_isnil(L, -1)) {\n\t\t\tlua_pop(L, 3);\n\t\t\treturn;\n\t\t}\n\t\tlua_pop(L, 1);\n\t}\n\t//\t*/\n\tlua_pushcfunction(L, col);\n\n\tlua_rawset(L, -3);\n\tlua_pop(L, 1);\n}\n\n/* Map C class\n\t* It maps a C class, setting the appropriate inheritance and super classes.\n*/\nTOLUA_API void tolua_cclass(lua_State *L, const char *lname, const char *name, const char *base, lua_CFunction col)\n{\n\tchar cname[128] = \"const \";\n\tchar cbase[128] = \"const \";\n\tstrncat(cname, name, 120);\n\tstrncat(cbase, base, 120);\n\n\tmapinheritance(L, name, base);\n\tmapinheritance(L, cname, name);\n\n\tmapsuper(L, cname, cbase);\n\tmapsuper(L, name, base);\n\n\tlua_pushstring(L, lname);\n\n\tpush_collector(L, name, col);\n\t/*\n\tluaL_getmetatable(L,name);\n\tlua_pushstring(L,\".collector\");\n\tlua_pushcfunction(L,col);\n\n\tlua_rawset(L,-3);\n\t*/\n\n\tluaL_getmetatable(L, name);\n\tlua_rawset(L, -3); /* assign class metatable to module */\n\n\t/* now we also need to store the collector table for the const\n\t   instances of the class */\n\tpush_collector(L, cname, col);\n\t/*\n\tluaL_getmetatable(L,cname);\n\tlua_pushstring(L,\".collector\");\n\tlua_pushcfunction(L,col);\n\tlua_rawset(L,-3);\n\tlua_pop(L,1);\n\t*/\n}\n\n/* Add base\n\t* It adds additional base classes to a class (for multiple inheritance)\n\t* (not for now)\nTOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) {\n\n\tchar cname[128] = \"const \";\n\tchar cbase[128] = \"const \";\n\tstrncat(cname,name,120);\n\tstrncat(cbase,base,120);\n\n\tmapsuper(L,cname,cbase);\n\tmapsuper(L,name,base);\n}\n*/\n\n/* Map function\n\t* It assigns a function into the current module (or class)\n*/\nTOLUA_API void tolua_function(lua_State *L, const char *name, lua_CFunction func)\n{\n\tlua_pushstring(L, name);\n\tlua_pushcfunction(L, func);\n\tlua_rawset(L, -3);\n}\n\n/* sets the __call event for the class (expects the class' main table on top) */\n/*\tnever really worked :(\nTOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) {\n\n\tlua_getmetatable(L, -1);\n\t//luaL_getmetatable(L, type);\n\tlua_pushstring(L,\"__call\");\n\tlua_pushcfunction(L,func);\n\tlua_rawset(L,-3);\n\tlua_pop(L, 1);\n}\n*/\n\n/* Map constant number\n\t* It assigns a constant number into the current module (or class)\n*/\nTOLUA_API void tolua_constant(lua_State *L, const char *name, lua_Number value)\n{\n\tlua_pushstring(L, name);\n\ttolua_pushnumber(L, value);\n\tlua_rawset(L, -3);\n}\n\n/* Map variable\n\t* It assigns a variable into the current module (or class)\n*/\nTOLUA_API void tolua_variable(lua_State *L, const char *name, lua_CFunction get, lua_CFunction set)\n{\n\t/* get func */\n\tlua_pushstring(L, \".get\");\n\tlua_rawget(L, -2);\n\tif (!lua_istable(L, -1))\n\t{\n\t\t/* create .get table, leaving it at the top */\n\t\tlua_pop(L, 1);\n\t\tlua_newtable(L);\n\t\tlua_pushstring(L, \".get\");\n\t\tlua_pushvalue(L, -2);\n\t\tlua_rawset(L, -4);\n\t}\n\tlua_pushstring(L, name);\n\tlua_pushcfunction(L, get);\n\tlua_rawset(L, -3); /* store variable */\n\tlua_pop(L, 1);\t\t /* pop .get table */\n\n\t/* set func */\n\tif (set)\n\t{\n\t\tlua_pushstring(L, \".set\");\n\t\tlua_rawget(L, -2);\n\t\tif (!lua_istable(L, -1))\n\t\t{\n\t\t\t/* create .set table, leaving it at the top */\n\t\t\tlua_pop(L, 1);\n\t\t\tlua_newtable(L);\n\t\t\tlua_pushstring(L, \".set\");\n\t\t\tlua_pushvalue(L, -2);\n\t\t\tlua_rawset(L, -4);\n\t\t}\n\t\tlua_pushstring(L, name);\n\t\tlua_pushcfunction(L, set);\n\t\tlua_rawset(L, -3); /* store variable */\n\t\tlua_pop(L, 1);\t\t /* pop .set table */\n\t}\n}\n\n/* Access const array\n\t* It reports an error when trying to write into a const array\n*/\nstatic int const_array(lua_State *L)\n{\n\tluaL_error(L, \"value of const array cannot be changed\");\n\treturn 0;\n}\n\n/* Map an array\n\t* It assigns an array into the current module (or class)\n*/\nTOLUA_API void tolua_array(lua_State *L, const char *name, lua_CFunction get, lua_CFunction set)\n{\n\tlua_pushstring(L, \".get\");\n\tlua_rawget(L, -2);\n\tif (!lua_istable(L, -1))\n\t{\n\t\t/* create .get table, leaving it at the top */\n\t\tlua_pop(L, 1);\n\t\tlua_newtable(L);\n\t\tlua_pushstring(L, \".get\");\n\t\tlua_pushvalue(L, -2);\n\t\tlua_rawset(L, -4);\n\t}\n\tlua_pushstring(L, name);\n\n\tlua_newtable(L); /* create array metatable */\n\tlua_pushvalue(L, -1);\n\tlua_setmetatable(L, -2); /* set the own table as metatable (for modules) */\n\tlua_pushstring(L, \"__index\");\n\tlua_pushcfunction(L, get);\n\tlua_rawset(L, -3);\n\tlua_pushstring(L, \"__newindex\");\n\tlua_pushcfunction(L, set ? set : const_array);\n\tlua_rawset(L, -3);\n\n\tlua_rawset(L, -3); /* store variable */\n\tlua_pop(L, 1);\t\t /* pop .get table */\n}\n\nTOLUA_API void tolua_dobuffer(lua_State *L, char *B, unsigned int size, const char *name)\n{\n\n#ifdef LUA_VERSION_NUM /* lua 5.1 */\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wunused-value\"\n\tluaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0);\n#pragma GCC diagnostic pop\n#else\n\tlua_dobuffer(L, B, size, name);\n#endif\n}\n"
  },
  {
    "path": "3rdparty/toluapp/src/lib/tolua_push.c",
    "content": "/* tolua: functions to push C values.\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Apr 2003\n** $Id: $\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#include \"tolua++.h\"\n#include \"lauxlib.h\"\n\n#include <stdlib.h>\n\nTOLUA_API void tolua_pushvalue (lua_State* L, int lo)\n{\n lua_pushvalue(L,lo);\n}\n\nTOLUA_API void tolua_pushboolean (lua_State* L, int value)\n{\n lua_pushboolean(L,value);\n}\n\nTOLUA_API void tolua_pushnumber (lua_State* L, lua_Number value)\n{\n lua_pushnumber(L,value);\n}\n\nTOLUA_API void tolua_pushstring (lua_State* L, const char* value)\n{\n if (value == NULL)\n  lua_pushnil(L);\n else\n  lua_pushstring(L,value);\n}\n\nTOLUA_API void tolua_pushuserdata (lua_State* L, void* value)\n{\n if (value == NULL)\n  lua_pushnil(L);\n else\n  lua_pushlightuserdata(L,value);\n}\n\nTOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type)\n{\n if (value == NULL)\n  lua_pushnil(L);\n else\n {\n  luaL_getmetatable(L, type);\n  lua_pushstring(L,\"tolua_ubox\");\n  lua_rawget(L,-2);        /* stack: mt ubox */\n  if (lua_isnil(L, -1)) {\n\t  lua_pop(L, 1);\n\t  lua_pushstring(L, \"tolua_ubox\");\n\t  lua_rawget(L, LUA_REGISTRYINDEX);\n  };\n  lua_pushlightuserdata(L,value);\n  lua_rawget(L,-2);                       /* stack: mt ubox ubox[u] */\n  if (lua_isnil(L,-1))\n  {\n   lua_pop(L,1);                          /* stack: mt ubox */\n   lua_pushlightuserdata(L,value);\n   *(void**)lua_newuserdata(L,sizeof(void *)) = value;   /* stack: mt ubox u newud */\n   lua_pushvalue(L,-1);                   /* stack: mt ubox u newud newud */\n   lua_insert(L,-4);                      /* stack: mt newud ubox u newud */\n   lua_rawset(L,-3);                      /* stack: mt newud ubox */\n   lua_pop(L,1);                          /* stack: mt newud */\n   /*luaL_getmetatable(L,type);*/\n   lua_pushvalue(L, -2);\t\t\t/* stack: mt newud mt */\n   lua_setmetatable(L,-2);\t\t\t/* stack: mt newud */\n\n   #ifdef LUA_VERSION_NUM\n   lua_pushvalue(L, TOLUA_NOPEER);\n#if LUA_VERSION_NUM > 501\n   lua_setuservalue(L, -2);\n#else\n   lua_setfenv(L, -2);\n#endif\n   #endif\n  }\n  else\n  {\n   /* check the need of updating the metatable to a more specialized class */\n   lua_insert(L,-2);                       /* stack: mt ubox[u] ubox */\n   lua_pop(L,1);                           /* stack: mt ubox[u] */\n   lua_pushstring(L,\"tolua_super\");\n   lua_rawget(L,LUA_REGISTRYINDEX);        /* stack: mt ubox[u] super */\n   lua_getmetatable(L,-2);                 /* stack: mt ubox[u] super mt */\n   lua_rawget(L,-2);                       /* stack: mt ubox[u] super super[mt] */\n\t\t\tif (lua_istable(L,-1))\n\t\t\t{\n\t\t\t\tlua_pushstring(L,type);                 /* stack: mt ubox[u] super super[mt] type */\n\t\t\t\tlua_rawget(L,-2);                       /* stack: mt ubox[u] super super[mt] flag */\n\t\t\t\tif (lua_toboolean(L,-1) == 1)   /* if true */\n\t\t\t\t{\n\t\t\t\t\tlua_pop(L,3);\t/* mt ubox[u]*/\n\t\t\t\t\tlua_remove(L, -2);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t/* type represents a more specilized type */\n\t\t\t/*luaL_getmetatable(L,type);             // stack: mt ubox[u] super super[mt] flag mt */\n\t\t\tlua_pushvalue(L, -5);\t\t\t\t\t/* stack: mt ubox[u] super super[mt] flag mt */\n\t\t\tlua_setmetatable(L,-5);                /* stack: mt ubox[u] super super[mt] flag */\n\t\t\tlua_pop(L,3);                          /* stack: mt ubox[u] */\n  }\n  lua_remove(L, -2);\t/* stack: ubox[u]*/\n }\n}\n\nTOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type)\n{\n\ttolua_pushusertype(L,value,type);\n\ttolua_register_gc(L,lua_gettop(L));\n}\n\nTOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v)\n{\n lua_pushnumber(L,index);\n lua_pushvalue(L,v);\n lua_settable(L,lo);\n}\n\nTOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v)\n{\n lua_pushnumber(L,index);\n lua_pushboolean(L,v);\n lua_settable(L,lo);\n}\n\n\nTOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, lua_Number v)\n{\n lua_pushnumber(L,index);\n tolua_pushnumber(L,v);\n lua_settable(L,lo);\n}\n\nTOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v)\n{\n lua_pushnumber(L,index);\n tolua_pushstring(L,v);\n lua_settable(L,lo);\n}\n\nTOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v)\n{\n lua_pushnumber(L,index);\n tolua_pushuserdata(L,v);\n lua_settable(L,lo);\n}\n\nTOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type)\n{\n lua_pushnumber(L,index);\n tolua_pushusertype(L,v,type);\n lua_settable(L,lo);\n}\n\nTOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type)\n{\n lua_pushnumber(L,index);\n tolua_pushusertype(L,v,type);\n\ttolua_register_gc(L,lua_gettop(L));\n lua_settable(L,lo);\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/lib/tolua_to.c",
    "content": "/* tolua: funcitons to convert to C types\n** Support code for Lua bindings.\n** Written by Waldemar Celes\n** TeCGraf/PUC-Rio\n** Apr 2003\n** $Id: $\n*/\n\n/* This code is free software; you can redistribute it and/or modify it.\n** The software provided hereunder is on an \"as is\" basis, and\n** the author has no obligation to provide maintenance, support, updates,\n** enhancements, or modifications.\n*/\n\n#include \"tolua++.h\"\n\n#include <string.h>\n#include <stdlib.h>\n\nTOLUA_API lua_Number tolua_tonumber(lua_State *L, int narg, lua_Number def)\n{\n\treturn lua_gettop(L) < abs(narg) ? def : lua_tonumber(L, narg);\n}\n\nTOLUA_API const char *tolua_tostring(lua_State *L, int narg, const char *def)\n{\n\treturn lua_gettop(L) < abs(narg) ? def : lua_tostring(L, narg);\n}\n\nTOLUA_API void *tolua_touserdata(lua_State *L, int narg, void *def)\n{\n\n\t/* return lua_gettop(L)<abs(narg) ? def : lua_touserdata(L,narg); */\n\n\tif (lua_gettop(L) < abs(narg))\n\t{\n\t\treturn def;\n\t};\n\n\tif (lua_islightuserdata(L, narg))\n\t{\n\n\t\treturn lua_touserdata(L, narg);\n\t};\n\n\treturn tolua_tousertype(L, narg, def);\n}\n\nextern int push_table_instance(lua_State *L, int lo);\n\nTOLUA_API void *tolua_tousertype(lua_State *L, int narg, void *def)\n{\n\tif (lua_gettop(L) < abs(narg))\n\t\treturn def;\n\telse\n\t{\n\t\tvoid *u;\n\t\tif (!lua_isuserdata(L, narg))\n\t\t{\n\t\t\tif (!push_table_instance(L, narg))\n\t\t\t\treturn NULL;\n\t\t};\n\t\tu = lua_touserdata(L, narg);\n\t\treturn (u == NULL) ? NULL : *((void **)u); /* nil represents NULL */\n\t}\n}\n\nTOLUA_API int tolua_tovalue(lua_State *L, int narg, int def)\n{\n\treturn lua_gettop(L) < abs(narg) ? def : narg;\n}\n\nTOLUA_API int tolua_toboolean(lua_State *L, int narg, int def)\n{\n\treturn lua_gettop(L) < abs(narg) ? def : lua_toboolean(L, narg);\n}\n\nTOLUA_API lua_Number tolua_tofieldnumber(lua_State *L, int lo, int index, lua_Number def)\n{\n\tdouble v;\n\tlua_pushnumber(L, index);\n\tlua_gettable(L, lo);\n\tv = lua_isnil(L, -1) ? def : lua_tonumber(L, -1);\n\tlua_pop(L, 1);\n\treturn v;\n}\n\nTOLUA_API const char *tolua_tofieldstring(lua_State *L, int lo, int index, const char *def)\n{\n\tconst char *v;\n\tlua_pushnumber(L, index);\n\tlua_gettable(L, lo);\n\tv = lua_isnil(L, -1) ? def : lua_tostring(L, -1);\n\tlua_pop(L, 1);\n\treturn v;\n}\n\nTOLUA_API void *tolua_tofielduserdata(lua_State *L, int lo, int index, void *def)\n{\n\tvoid *v;\n\tlua_pushnumber(L, index);\n\tlua_gettable(L, lo);\n\tv = lua_isnil(L, -1) ? def : lua_touserdata(L, -1);\n\tlua_pop(L, 1);\n\treturn v;\n}\n\nTOLUA_API void *tolua_tofieldusertype(lua_State *L, int lo, int index, void *def)\n{\n\tvoid *v;\n\tlua_pushnumber(L, index);\n\tlua_gettable(L, lo);\n\tv = lua_isnil(L, -1) ? def : (*(void **)(lua_touserdata(L, -1))); /* lua_unboxpointer(L,-1); */\n\tlua_pop(L, 1);\n\treturn v;\n}\n\nTOLUA_API int tolua_tofieldvalue(lua_State *L, int lo, int index, int def)\n{\n\tint v;\n\tlua_pushnumber(L, index);\n\tlua_gettable(L, lo);\n\tv = lua_isnil(L, -1) ? def : lo;\n\tlua_pop(L, 1);\n\treturn v;\n}\n\nTOLUA_API int tolua_getfieldboolean(lua_State *L, int lo, int index, int def)\n{\n\tint v;\n\t(void)def;\n\tlua_pushnumber(L, index);\n\tlua_gettable(L, lo);\n\tv = lua_isnil(L, -1) ? 0 : lua_toboolean(L, -1);\n\tlua_pop(L, 1);\n\treturn v;\n}\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/SCsub",
    "content": "Import('env')\nenv_tests = env.Copy()\n\nenv_tests.LuaBinding('tclassbind.cpp', 'tclass.pkg', 'tclass', use_own=1, use_typeid=1)\n\nenv_tests.Append(CXXFLAGS='-DTOLUA_API=\"extern \\\\\\\"C\\\\\\\"\"')\n\ntest_class_so = env_tests.SharedLibrary('tclass', ['tclassbind.cpp'],\n\t\t\tLIBS=['$tolua_lib']+env['LIBS'], )\n\nenv_tests.Append(LIBPATH=\".\")\n\ntest_class = env_tests.Program('tclass', ['tclass.cpp'],\n\t\t\tLIBS=env['LIBS']+['tclass']+['$tolua_lib'], )\n\n\n\nenv.test_targets = [test_class]\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tarray.c",
    "content": "#include \"lualib.h\"\n#include \"lauxlib.h\"\n\n#include \"tarray.h\"\n\n\nint a[10] = {1,2,3,4,5,6,7,8,9,10};\nPoint p[10] = {{0,1},{1,2},{2,3},{3,4},{4,5},{5,6},{6,7},{7,8},{8,9},{9,10}};\nPoint* pp[10];\n\nint ma[10];\nPoint mp[10];\nPoint* mpp[10];\n\nArray array;\nArray* parray = &array;\n\nint main (void)\n{\n\tint  tolua_tarray_open (lua_State*);\n\tlua_State* L = lua_open();\n\tint i;\n\n\tfor (i=0; i<10; ++i)\n\t{\n\t\tpp[i] = &p[i];\n\n\t\tma[i] = a[i];\n\t\tmp[i] = p[i];\n\t\tmpp[i] = pp[i];\n\n\t\tarray.a[i] = a[i];\n\t\tarray.p[i] = p[i];\n\t\tarray.pp[i] = pp[i];\n\t}\n\n\tluaopen_base(L);\n\ttolua_tarray_open(L);\n\n\tlua_dofile(L,\"tarray.lua\");\n\n\tlua_close(L);\n\treturn 0;\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tarray.h",
    "content": "\ntypedef struct Point Point;\nstruct Point\n{\n\tfloat x;\n\tfloat y;\n};\n\n\nextern int a[10];\nextern Point p[10]; \nextern Point* pp[10];\n\n\nextern int ma[10];\nextern Point mp[10]; \nextern Point* mpp[10];\n\ntypedef struct Array Array;\nstruct Array\n{\n int a[10];\n Point p[10]; \n Point* pp[10];\n};\n\nextern Array array;\nextern Array* parray;\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tarray.lua",
    "content": "for i=1,10 do\n assert(a[i]==i)\nend\n\nfor i=2,10 do\n assert(p[i-1].y==p[i].x)\nend\n \nfor i=1,10 do\n assert(M.a[i]==i)\nend\n\nfor i=2,10 do\n assert(M.p[i-1].y==M.p[i].x)\nend\n\nfor i=1,10 do\n assert(pp[i].x==M.p[i].x and p[i].y == M.pp[i].y)\nend\n\nfor i=1,10 do\n assert(array.a[i] == parray.a[i])\n assert(array.p[i].x == parray.pp[i].x and array.p[i].y == parray.pp[i].y)\nend\n\nfor i=1,10 do\n array.a[i] = a[10-i+1]\n\tM.a[i] = 10-i+1\n\tassert(array.a[i]==M.a[i])\nend\n\nfor i=2,10 do\n array.p[i] = array.pp[1]\n\tassert(array.p[i].x==0 and array.p[i].y==1)\nend\n\nprint(\"Array test OK\")\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tarray.pkg",
    "content": "$#include \"tarray.h\"\n\nstruct Point\n{\n\tfloat x;\n\tfloat y;\n};\n\n\nextern int a[10];\nextern const Point p[10]; \nextern Point* pp[10];\n\n\nmodule M {\nextern int ma[10]@a;\nextern const Point mp[10]@p; \nextern Point* mpp[10]@pp;\n}\n\nstruct Array\n{\n int a[10];\n Point p[10]; \n Point* pp[10];\n};\n\nextern Array array;\nextern Array* parray;\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tarraybind.c",
    "content": "/*\r\n** Lua binding: tarray\r\n** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:22.\r\n*/\r\n\r\n#ifndef __cplusplus\r\n#include \"stdlib.h\"\r\n#endif\r\n#include \"string.h\"\r\n\r\n#include \"tolua.h\"\r\n\r\n/* Exported function */\r\nTOLUA_API int tolua_tarray_open (lua_State* tolua_S);\r\n\r\n#include \"tarray.h\"\r\n\r\n/* function to release collected object via destructor */\r\n#ifdef __cplusplus\r\n\r\nstatic int tolua_collect_Point (lua_State* tolua_S)\r\n{\r\n Point* self = (Point*) tolua_tousertype(tolua_S,1,0);\r\n delete self;\r\n return 0;\r\n}\r\n#endif\r\n\r\n\r\n/* function to register type */\r\nstatic void tolua_reg_types (lua_State* tolua_S)\r\n{\r\n tolua_usertype(tolua_S,\"Array\");\r\n tolua_usertype(tolua_S,\"Point\");\r\n}\r\n\r\n/* get function: x of class  Point */\r\nstatic int tolua_get_Point_x(lua_State* tolua_S)\r\n{\r\n  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'x'\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->x);\r\n return 1;\r\n}\r\n\r\n/* set function: x of class  Point */\r\nstatic int tolua_set_Point_x(lua_State* tolua_S)\r\n{\r\n  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'x'\",NULL);\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->x = ((float)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: y of class  Point */\r\nstatic int tolua_get_Point_y(lua_State* tolua_S)\r\n{\r\n  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'y'\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->y);\r\n return 1;\r\n}\r\n\r\n/* set function: y of class  Point */\r\nstatic int tolua_set_Point_y(lua_State* tolua_S)\r\n{\r\n  Point* self = (Point*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'y'\",NULL);\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->y = ((float)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: a */\r\nstatic int tolua_get_tarray_a(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)a[tolua_index]);\r\n return 1;\r\n}\r\n\r\n/* set function: a */\r\nstatic int tolua_set_tarray_a(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n  a[tolua_index] = ((int)  tolua_tonumber(tolua_S,3,0));\r\n return 0;\r\n}\r\n\r\n/* get function: p */\r\nstatic int tolua_get_tarray_p(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)&p[tolua_index],\"const Point\");\r\n return 1;\r\n}\r\n\r\n/* get function: pp */\r\nstatic int tolua_get_tarray_pp(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)pp[tolua_index],\"Point\");\r\n return 1;\r\n}\r\n\r\n/* set function: pp */\r\nstatic int tolua_set_tarray_pp(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n  pp[tolua_index] = ((Point*)  tolua_tousertype(tolua_S,3,0));\r\n return 0;\r\n}\r\n\r\n/* get function: ma */\r\nstatic int tolua_get_tarray_M_ma(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)ma[tolua_index]);\r\n return 1;\r\n}\r\n\r\n/* set function: ma */\r\nstatic int tolua_set_tarray_M_ma(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n  ma[tolua_index] = ((int)  tolua_tonumber(tolua_S,3,0));\r\n return 0;\r\n}\r\n\r\n/* get function: mp */\r\nstatic int tolua_get_tarray_M_mp(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)&mp[tolua_index],\"const Point\");\r\n return 1;\r\n}\r\n\r\n/* get function: mpp */\r\nstatic int tolua_get_tarray_M_mpp(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)mpp[tolua_index],\"Point\");\r\n return 1;\r\n}\r\n\r\n/* set function: mpp */\r\nstatic int tolua_set_tarray_M_mpp(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n  mpp[tolua_index] = ((Point*)  tolua_tousertype(tolua_S,3,0));\r\n return 0;\r\n}\r\n\r\n/* get function: a of class  Array */\r\nstatic int tolua_get_tarray_Array_a(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n  Array* self;\r\n lua_pushstring(tolua_S,\".self\");\r\n lua_rawget(tolua_S,1);\r\n self = (Array*)  lua_touserdata(tolua_S,-1);\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->a[tolua_index]);\r\n return 1;\r\n}\r\n\r\n/* set function: a of class  Array */\r\nstatic int tolua_set_tarray_Array_a(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n  Array* self;\r\n lua_pushstring(tolua_S,\".self\");\r\n lua_rawget(tolua_S,1);\r\n self = (Array*)  lua_touserdata(tolua_S,-1);\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n  self->a[tolua_index] = ((int)  tolua_tonumber(tolua_S,3,0));\r\n return 0;\r\n}\r\n\r\n/* get function: p of class  Array */\r\nstatic int tolua_get_tarray_Array_p(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n  Array* self;\r\n lua_pushstring(tolua_S,\".self\");\r\n lua_rawget(tolua_S,1);\r\n self = (Array*)  lua_touserdata(tolua_S,-1);\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)&self->p[tolua_index],\"Point\");\r\n return 1;\r\n}\r\n\r\n/* set function: p of class  Array */\r\nstatic int tolua_set_tarray_Array_p(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n  Array* self;\r\n lua_pushstring(tolua_S,\".self\");\r\n lua_rawget(tolua_S,1);\r\n self = (Array*)  lua_touserdata(tolua_S,-1);\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n  self->p[tolua_index] = *((Point*)  tolua_tousertype(tolua_S,3,0));\r\n return 0;\r\n}\r\n\r\n/* get function: pp of class  Array */\r\nstatic int tolua_get_tarray_Array_pp(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n  Array* self;\r\n lua_pushstring(tolua_S,\".self\");\r\n lua_rawget(tolua_S,1);\r\n self = (Array*)  lua_touserdata(tolua_S,-1);\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)self->pp[tolua_index],\"Point\");\r\n return 1;\r\n}\r\n\r\n/* set function: pp of class  Array */\r\nstatic int tolua_set_tarray_Array_pp(lua_State* tolua_S)\r\n{\r\n int tolua_index;\r\n  Array* self;\r\n lua_pushstring(tolua_S,\".self\");\r\n lua_rawget(tolua_S,1);\r\n self = (Array*)  lua_touserdata(tolua_S,-1);\r\n#ifndef TOLUA_RELEASE\r\n {\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in array indexing.\",&tolua_err);\r\n }\r\n#endif\r\n tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;\r\n#ifndef TOLUA_RELEASE\r\n if (tolua_index<0 || tolua_index>=10)\r\n tolua_error(tolua_S,\"array indexing out of range.\",NULL);\r\n#endif\r\n  self->pp[tolua_index] = ((Point*)  tolua_tousertype(tolua_S,3,0));\r\n return 0;\r\n}\r\n\r\n/* get function: array */\r\nstatic int tolua_get_array(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)&array,\"Array\");\r\n return 1;\r\n}\r\n\r\n/* set function: array */\r\nstatic int tolua_set_array(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"Array\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  array = *((Array*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: parray */\r\nstatic int tolua_get_parray_ptr(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)parray,\"Array\");\r\n return 1;\r\n}\r\n\r\n/* set function: parray */\r\nstatic int tolua_set_parray_ptr(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"Array\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  parray = ((Array*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* Open function */\r\nTOLUA_API int tolua_tarray_open (lua_State* tolua_S)\r\n{\r\n tolua_open(tolua_S);\r\n tolua_reg_types(tolua_S);\r\n tolua_module(tolua_S,NULL,1);\r\n tolua_beginmodule(tolua_S,NULL);\r\n#ifdef __cplusplus\r\n tolua_cclass(tolua_S,\"Point\",\"Point\",\"\",tolua_collect_Point);\r\n#else\r\n tolua_cclass(tolua_S,\"Point\",\"Point\",\"\",NULL);\r\n#endif\r\n tolua_beginmodule(tolua_S,\"Point\");\r\n tolua_variable(tolua_S,\"x\",tolua_get_Point_x,tolua_set_Point_x);\r\n tolua_variable(tolua_S,\"y\",tolua_get_Point_y,tolua_set_Point_y);\r\n tolua_endmodule(tolua_S);\r\n tolua_array(tolua_S,\"a\",tolua_get_tarray_a,tolua_set_tarray_a);\r\n tolua_array(tolua_S,\"p\",tolua_get_tarray_p,NULL);\r\n tolua_array(tolua_S,\"pp\",tolua_get_tarray_pp,tolua_set_tarray_pp);\r\n tolua_module(tolua_S,\"M\",1);\r\n tolua_beginmodule(tolua_S,\"M\");\r\n tolua_array(tolua_S,\"a\",tolua_get_tarray_M_ma,tolua_set_tarray_M_ma);\r\n tolua_array(tolua_S,\"p\",tolua_get_tarray_M_mp,NULL);\r\n tolua_array(tolua_S,\"pp\",tolua_get_tarray_M_mpp,tolua_set_tarray_M_mpp);\r\n tolua_endmodule(tolua_S);\r\n tolua_cclass(tolua_S,\"Array\",\"Array\",\"\",NULL);\r\n tolua_beginmodule(tolua_S,\"Array\");\r\n tolua_array(tolua_S,\"a\",tolua_get_tarray_Array_a,tolua_set_tarray_Array_a);\r\n tolua_array(tolua_S,\"p\",tolua_get_tarray_Array_p,tolua_set_tarray_Array_p);\r\n tolua_array(tolua_S,\"pp\",tolua_get_tarray_Array_pp,tolua_set_tarray_Array_pp);\r\n tolua_endmodule(tolua_S);\r\n tolua_variable(tolua_S,\"array\",tolua_get_array,tolua_set_array);\r\n tolua_variable(tolua_S,\"parray\",tolua_get_parray_ptr,tolua_set_parray_ptr);\r\n tolua_endmodule(tolua_S);\r\n return 1;\r\n}\r\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tclass.cpp",
    "content": "extern \"C\" {\n#include \"lua.h\"\n#include \"lualib.h\"\n#include \"lauxlib.h\"\n}\n\n#include \"tclass.h\"\n\n//Test::Tst_A* Test::Tst_A::last;\n//Test::Tst_B* Test::Tst_B::last;\n//Test::Tst_C* Test::Tst_C::last;\n\nextern \"C\" {\n\tint  tolua_tclass_open (lua_State*);\n}\n\nint main ()\n{\n\tTest::Tst_B* b = new Test::Tst_B;         // instance used in Lua code\n\n\tlua_State* L = lua_open();\n\tluaL_openlibs(L);\n\ttolua_tclass_open(L);\n\n\tluaL_dofile(L,\"tclass.lua\");\n\n\tlua_close(L);\n\n\tdelete b;\n\treturn 0;\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tclass.h",
    "content": "#ifndef TCLASS_H\n#define TCLASS_H\n\n#include <stdio.h>\n\nnamespace Test {\n\nclass Tst_Dummy\n{\n};\n\nclass Tst_A\n{\n\n\tint number;\npublic:\n\tstatic Tst_A* last;\n\tTst_A () {last = this;}\n\tvirtual char* a () { return \"A\"; }\n\tclass Tst_AA\n\t{\n public:\n\t\tTst_AA () {}\n\t\t~Tst_AA () { }\n\t\tchar* aa () { return \"AA\"; }\n\t};\n\tclass Tst_BB : public Tst_AA\n\t{\n public:\n\t\tTst_BB () {}\n\t\t~Tst_BB () {}\n\t\tTst_AA* Base () { return this; }\n\t};\n\n\tvoid set_number(int p_number) { number = p_number;};\n\tint get_number() {return number*2;};\n\t\n\tvirtual ~Tst_A() {};\n};\n\nclass Tst_B : public Tst_A\n{\npublic:\n\tstatic Tst_B* last;\n\tTst_B () {last = this;}\n\tvirtual char* b () { return \"B\"; }\n\n\tstatic Tst_A* create() {return new Tst_B;};\n\tstatic void* create_void() {return new Tst_B;};\n\t\n\tvirtual ~Tst_B() {};\n};\n\nclass Tst_C : public Tst_B\n{\n\tint i;\npublic:\n\tstatic Tst_C* last;\n\tTst_C (int n) : i(n) {last = this;}\n virtual ~Tst_C () { printf(\"deleting C: %d\\n\",i); }\n\tvirtual char* c () { return \"C\"; }\n};\n\ninline Tst_A::Tst_AA* Tst_create_aa ()\n{\n\treturn new Tst_A::Tst_AA();\n}\n\ninline bool Tst_is_aa (Tst_A::Tst_AA* obj)\n{\n\treturn true;\n}\n\nclass Tst_E {\n\tvoid* ptr;\n\npublic:\n\tenum Pete {\n\t\tONE,\n\t\tTWO,\n\t} pete;\n\n\tvoid get_pete(Pete p) {};\n\n\ttemplate <class T>\n\tT get_t() {T a=0; return a;};\n\n\tTst_E& operator+(const Tst_E& rvalue) {return *this;};\n\n\tvoid pars(int a=0, int b=0) {};\n\tvoid get_pointer(void* a) {};\n\n\tTst_A a;\n\n\tvoid set_ptr(void* p_ptr) {\n\t\tprintf(\"this is %p, ptr is %p\\n\", this, p_ptr);\n\t\tptr = p_ptr;\n\t};\n\tvoid* get_ptr() {return ptr;};\n\n\tTst_E(int) {};\n};\n\nclass Tst_Outside {\n\npublic:\n\n\tTst_Outside() {};\n};\n\n}; // end of namespace\n\n\nstatic void outside_func(Test::Tst_Outside* p_out, lua_State* ls) {\n\n\tif (p_out) printf(\"method!\\n\");\n\telse printf(\"static!\\n\");\n\t//printf(\"luastate: %i\\n\", ls);\n};\n\n#endif\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tclass.lua",
    "content": "if not Test then\n\tlocal loadlib\n\tif not package then\n\t\tloadlib = _G['loadlib']\n\telse\n\t\tloadlib = package.loadlib\n\tend\n\tf, e, eo = loadlib(\"./libtclass.so\", \"luaopen_tclass\")\n\tif f then\n\t\tf()\n\telse\n\t\tprint(eo, e)\n\t\tos.exit()\n\tend\nend\n\na = {}\nrawset(a, \".c_instance\", \"something\")\n\nfunction hello()\n\n\tprint(\"hello world\")\nend\n\nrawset(Test.B, \"hello\", hello)\n\n-- type convertion tests\n--print(Test.A)\n--print(tolua.type(Test.A.last))\n--assert(tolua.type(Test.A.last) == 'Test::Tst_A') -- first time the object is mapped\n--assert(tolua.type(Test.B.last) == 'Test::Tst_B') -- type convertion to specialized type\n--assert(tolua.type(Test.A.last) == 'Test::Tst_B') -- no convertion: obj already mapped as B\n\n\nlocal a = Test.A:new()\nassert(tolua.type(Test.A.last) == 'Test::Tst_A') -- no type convertion: same type\nlocal b = Test.B:new()\nassert(tolua.type(Test.A.last) == 'Test::Tst_B') -- no convertion: obj already mapped as B\nlocal c = Test.luaC:new(0)\nassert(tolua.type(Test.A.last) == 'Test::Tst_C') -- no convertion: obj already mapped as C\nassert(tolua.type(Test.luaC.last) == 'Test::Tst_C')\n\nlocal aa = Test.A.AA:new()\nlocal bb = Test.A.BB:new()\nlocal xx = Test.create_aa()\n\n-- method calling tests\nassert(a:a() == 'A')\nassert(b:a() == 'A')\nassert(b:b() == 'B')\nassert(c:a() == 'A')\nassert(c:b() == 'B')\nassert(c:c() == 'C')\nassert(aa:aa() == 'AA')\nassert(bb:aa() == bb:Base():aa())\nassert(xx:aa() == 'AA')\nassert(Test.is_aa(bb) == true)\n\n-- test ownershipping handling\n-- should delete objects: 6 7 8 9 10 (it may vary!)\nlocal set = {}\nfor i=1,10 do\n local c = Test.luaC:new(i)\n\tif i>5 then\n\t\ttolua.takeownership(c)\n\tend\n\t--set[i] = c\nend\n\n\n\ne = Test.B:new_local()\n\nprint(\"e is type \"..tolua.type(e))\nprint(\"ae is type \"..tolua.type(ae))\n\n--e:delete()\n\nb:hello()\n\n----------\nlocal out = Test.Outside:new_local()\nout:outside()\nTest.Outside:outside_static(nil)\n\n\nprint \"***** cast\"\nlocal acast = Test.B:create_void()\nprint(\"type is \"..tolua.type(acast))\nlocal bcast = tolua.cast(acast, \"Test::Tst_B\")\nprint(\"bcast is \"..tostring(bcast))\nprint(\"type is \"..tolua.type(bcast))\nprint(bcast:b())\n\n-- test properies\nlocal n = 7\na.number = n\nassert(a.number == n*2)\n\n-- constructors\nprint(getmetatable(Test.A))\nprint(getmetatable(Test.B))\nprint(getmetatable(Test.E))\n\nlocal a = Test.A()\nlocal b = Test.B()\nlocal e = Test.E(5)\n--print(e+5)\nprint(tostring(getmetatable(Test.B).__call))\nprint(tostring(Test.B.__call))\nprint(tostring(Test.B.__call(Test.B)))\nprint(tolua.type(b))\n\ne:set_ptr(e)\nlocal ve = tolua.cast(e:get_ptr(), \"Test::Tst_E\")\nve:set_ptr(ve)\n\nprint\"1\"\nTest.A.pete = {}\nprint\"2\"\ntable.insert(Test.A.pete, a)\nprint\"3\"\n\n\nfor i=1,100000 do\n\tla = {}\n\ttolua.inherit(la, a)\nend\n\nprint(\"Class test OK\")\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tclass.pkg",
    "content": "$#include \"tclass.h\"\n\n$Test::Tst_A* Test::Tst_A::last;\n$Test::Tst_B* Test::Tst_B::last;\n$Test::Tst_C* Test::Tst_C::last;\n\n\n$renaming ^Tst_ @\n\nnamespace Test {\n\nclass Tst_Dummy;\n\nclass Tst_A\n{\n\tstatic Tst_A* last;\n\tTst_A ();\n\tvirtual char* a ();\n\tclass Tst_AA\n\t{\n\t\tTst_AA () {}\n\t\t~Tst_AA () {}\n\t\tchar* aa () { return \"AA\"; }\n\t};\n\tclass Tst_BB : public Tst_AA\n\t{\n\t\tTst_BB () {}\n\t\t~Tst_BB () {}\n\t\tTst_AA* Base () { return this; }\n\t};\n\t\n\ttolua_property int number;\n};\n\nclass Tst_E {\npublic:\n\ttypedef enum{\n\t\tONE,\n\t\tTWO,\n\t} Pete;\n\tPete pete;\n\n\tfloat get_t<float>();\n\n\tvoid get_pete(Pete p);\n\n\tTst_E& operator+(const Tst_E& rvalue);\n\n\tvoid pars(int a=0xa, int b=GetNumber(GetNumber(1,2)));\n\tvoid get_pointer(void* a=NULL);\n\n\tvoid set_ptr(void* p_ptr) {\n\t\tprintf(\"this is %p, ptr is %p\\n\", this, p_ptr);\n\t\tptr = p_ptr;\n\t};\n\tvoid* get_ptr() {return ptr;};\n\n\tTst_A a;\n\tTst_E(int);\n\t//~Tst_E();\n};\n\n\nclass Tst_B : public Tst_A\n{\n\tstatic Tst_B* last;\n\tTst_B ();\n\tvirtual char* b ();\n\tstatic Tst_A* create();\n\tstatic void* create_void() {return new Tst_B;};\n};\n\nclass Tst_C@luaC : public Tst_B\n{\n\tstatic Tst_C* last;\n\tTst_C (int n);\n\t~Tst_C ();\n\tvirtual char* c ();\n};\n\nTst_A::Tst_AA* Tst_create_aa ();\nbool Tst_is_aa (Tst_A::Tst_AA* obj);\n\nclass Tst_Outside {\n\n\n\ttolua_outside void outside_func@outside(lua_State* ls);\n\n\tstatic tolua_outside void outside_func@outside_static(Tst_Outside* instance, lua_State* ls);\n\n\tTst_Outside() {};\n};\n\n\n}; // end of namespace\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tconstant.h",
    "content": "#define FIRST 1\n#define SECOND 2\n\nenum {\n\tONE = 1,\n\tTWO = 2\n};\n\n#define M_FIRST 1\n#define M_SECOND 2\n\nenum {\n\tM_ONE = 1,\n\tM_TWO = 2\n};\n\nclass A {\npublic:\n\n #define FIRST 1\n #define SECOND 2\n\n enum {\n\t ONE = 1,\n\t TWO = 2\n };\n};\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tconstant.lua",
    "content": "assert(FIRST==M.FIRST)\nassert(FIRST==A.FIRST)\nassert(SECOND==M.SECOND)\nassert(SECOND==A.SECOND)\n\nassert(ONE==M.ONE)\nassert(ONE==A.ONE)\nassert(TWO==M.TWO)\nassert(TWO==A.TWO)\n\nprint(\"Constant test OK\")\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tconstant.pkg",
    "content": "$#include \"tconstant.h\"\n\n#define FIRST 1\n#define SECOND 2\n\nenum {\n\tONE = 1,\n\tTWO = 2\n};\n\nmodule M {\n\n#define M_FIRST@FIRST 1\n#define M_SECOND@SECOND 2\n\nenum {\n\tM_ONE@ONE = 1,\n\tM_TWO@TWO = 2\n};\n}\n\nclass A {\npublic:\n\n #define FIRST 1\n #define SECOND 2\n\n enum {\n\t ONE = 1,\n\t TWO = 2\n };\n};\n\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tdirective.lua",
    "content": "assert(a==3)\nassert(A==4)\nassert(func()==5)\n\nprint(\"Directive test OK\")\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tdirective.pkg",
    "content": "$#include \"lualib.h\"\n$#include \"lauxlib.h\"\n\n$int a;\n$extern int a;\n\n$int main (void)\n${\n$ lua_State* L = lua_open();\n$\tluaopen_base(L);\n$ tolua_tdirective_open(L);\n$\tlua_dofile(L,\"tdirective.lua\");\n$\tlua_close(L);\n$ return 0;\n$}\n\n$pfile \"tdirectivepkg.pkg\"\n\n$<\n a = 3;\n$>\n\n$[\nA = 4\n$]\n\n$lfile \"tdirectivelua.lua\"\n \n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tdirectivebind.c",
    "content": "/*\r\n** Lua binding: tdirective\r\n** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:24.\r\n*/\r\n\r\n#ifndef __cplusplus\r\n#include \"stdlib.h\"\r\n#endif\r\n#include \"string.h\"\r\n\r\n#include \"tolua.h\"\r\n\r\n/* Exported function */\r\nTOLUA_API int tolua_tdirective_open (lua_State* tolua_S);\r\n\r\n#include \"lualib.h\"\r\n#include \"lauxlib.h\"\r\nint a;\r\nextern int a;\r\nint main (void)\r\n{\r\n lua_State* L = lua_open();\r\n\tluaopen_base(L);\r\n tolua_tdirective_open(L);\r\n\tlua_dofile(L,\"tdirective.lua\");\r\n\tlua_close(L);\r\n return 0;\r\n}\r\n\r\n/* function to register type */\r\nstatic void tolua_reg_types (lua_State* tolua_S)\r\n{\r\n}\r\n\r\n/* get function: a */\r\nstatic int tolua_get_a(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)a);\r\n return 1;\r\n}\r\n\r\n/* set function: a */\r\nstatic int tolua_set_a(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  a = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* Open function */\r\nTOLUA_API int tolua_tdirective_open (lua_State* tolua_S)\r\n{\r\n tolua_open(tolua_S);\r\n tolua_reg_types(tolua_S);\r\n tolua_module(tolua_S,NULL,1);\r\n tolua_beginmodule(tolua_S,NULL);\r\n tolua_variable(tolua_S,\"a\",tolua_get_a,tolua_set_a);\r\n{\r\n a = 3;\r\n}\r\n\r\n { /* begin embedded lua code */\r\n static unsigned char B[] = {\r\n  10, 65, 32, 61, 32, 52,32\r\n };\r\n lua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua: embedded Lua code\");\r\n } /* end of embedded lua code */\r\n\r\n\r\n { /* begin embedded lua code */\r\n static unsigned char B[] = {\r\n  10,102,117,110, 99,116,105,111,110, 32,102,117,110, 99, 32,\r\n  40, 41, 10,114,101,116,117,114,110, 32, 53, 10,101,110,100,\r\n 32\r\n };\r\n lua_dobuffer(tolua_S,(char*)B,sizeof(B),\"tolua: embedded Lua code\");\r\n } /* end of embedded lua code */\r\n\r\n tolua_endmodule(tolua_S);\r\n return 1;\r\n}\r\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tdirectivelua.lua",
    "content": "function func ()\n return 5\nend\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tdirectivepkg.pkg",
    "content": "extern int a;\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tfunction.h",
    "content": "#ifndef tfunction_h\n#define tfunction_h\n\n#include <stdio.h>\n#include <string.h>\n\ntypedef enum {\n FIRST = 1,\n\tSECOND = 2\n} Order;\n\nclass Point\n{          \n\tchar m_s[64];\n float m_x;\n\tfloat m_y;\n\npublic:\n\n\tenum Error {\n\t\tSUCCESS = 0,\n\t\tERROR = 1\n\t};\n\n\tPoint (float x=0, float y=0)\n\t: m_x(x), m_y(y)\n\t{\n\t}\n\tvirtual ~Point ()\n\t{\n\t}\n\n\tvoid set (float x, float y)\n\t{\n\t\tm_x = x, m_y = y;\n\t}\n\tvoid set (float v[2]=0)\n\t{\n\t\tm_x = v[0], m_y=v[1];\n\t}\n\tvoid setpointer (Point* p)\n\t{\n\t\t*this = *p;\n\t}\n\tvoid setref (Point& p)\n\t{\n\t\t*this = p;\n\t}\n\tvoid setvalue (Point p)\n\t{\n\t\t*this = p;\n\t}\n\tvoid setconst (const Point* p)\n\t{\n\t\t*this = *p;\n\t}\n\tvoid setname (const char* s)\n\t{\n\t\tstrncpy(m_s,s,63);\n\t}\n\n\tvoid get (float* x, float* y) const\n\t{\n\t\t*x = m_x, *y = m_y;\n\t}\n\tvoid get (float v[2]) const\n\t{\n\t\tv[0] = m_x, v[1] = m_y;\n\t}\n\tPoint* getpointer ()\n\t{\n\t\treturn this;\n\t}\n\tPoint& getref ()\n\t{\n\t\treturn *this;\n\t}\n\tPoint getvalue ()\n\t{\n\t\treturn *this;\n\t}\n\tconst Point* getconst () const\n\t{\n\t\treturn this;\n\t}\n\tconst char* getname () const\n\t{\n\t\treturn m_s;\n\t}\n\n\tPoint operator+ (const Point& p) const\n\t{\n\t\treturn Point(m_x+p.m_x,m_y+p.m_y);\n\t}\n\tPoint operator- (const Point& p) const\n\t{\n\t\treturn Point(m_x-p.m_x,m_y-p.m_y);\n\t}\n\tPoint operator* (const Point& p) const\n\t{\n\t\treturn Point(m_x*p.m_x,m_y*p.m_y);\n\t}\n\tPoint operator/ (float n) const\n\t{\n\t\treturn Point(m_x/n,m_y/n);\n\t}\n\tbool operator< (const Point& p) const\n\t{\n\t\tif (m_x < p.m_x) return true;\n\t\telse if (m_x > p.m_x) return false;\n\t\telse return m_y < p.m_y;\n\t}\n\tbool operator<= (const Point& p) const\n\t{\n\t\treturn operator<(p) || operator==(p);\n\t}\n\tbool operator== (const Point& p) const\n\t{\n\t\treturn m_x==p.m_x && m_y==p.m_y;\n\t}\n\n float operator[] (int i) const\n\t{\n\t\treturn (i==0) ? m_x : m_y;\n\t}\n\tfloat& operator[] (int i)\n\t{\n\t\treturn (i==0) ? m_x : m_y;\n\t}\n\n\tstatic Error echo (Error e)\n\t{\n\t\treturn e;\n\t}\n\n};\n\n\ninline Point add (const Point& p1, const Point& p2)\n{\n\treturn p1+p2;\n}\ninline Point sub (const Point& p1, const Point& p2)\n{\n\treturn p1-p2;\n}\ninline Point mult (const Point& p1, const Point& p2)\n{\n\treturn p1*p2;\n}\ninline Point div (const Point& p1, float n)\n{\n\treturn p1/n;\n}\n\ninline void getpoint (const Point* p, float* x, float* y)\n{\n\tp->get(x,y);\n}\ninline void setpoint (Point* p, float x=0, float y=0)\n{\n\tp->set(x,y);\n}\n\ninline\tPoint average (int n, Point v[])\n{\n\tPoint p(0,0);\n\tfor (int i=0; i<n; ++i)\n\t\tp = p+v[i];\n\treturn p/n;\n}\n\ninline\tPoint averagepointer (int n, Point* v[])\n{\n\tPoint p(0,0);\n\tfor (int i=0; i<n; ++i)\n\t\tp = p+(*v[i]);\n\treturn p/n;\n}\n\ninline\tvoid copyvector (int n, const Point v[], Point u[])\n{\n\tfor (int i=0; i<n; ++i)\n\t\tu[i] = v[i];\n}\n\ninline Order invert (Order o)\n{\n\tif (o==FIRST)\n\t\treturn SECOND;\n\telse\n\t\treturn FIRST;\n}\n\n\nclass ColorPoint : public Point   //tolua_export\n{                                 //tolua_export\n float r, g, b;\npublic:\n\n//tolua_begin\n ColorPoint (float px, float py, float cr=0.0f, float cg=0.0f, float cb=0.0f)\n : Point(px,py), r(cr), g(cg), b(cb)\n {\n }\n virtual ~ColorPoint () { }\n\n virtual void getcolor (float* red, float *green, float *blue) const\n\t{\n\t\t*red = r;\n\t\t*green = g;\n\t\t*blue = b;\n\t}\n static ColorPoint* MakeRed (float x, float y)\n {\n  return new ColorPoint(x,y,1,0,0);\n }\n};\n//tolua_end\n#endif\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tfunction.lua",
    "content": "local p = Point:new(1,2)\nlocal q = Point:new()\n\nlocal x, y = p:get()\nlocal c = {}; q:get(c)\n\nassert(x==1 and y==2)\nassert(c[1]==0 and c[2]==0)\n\nq:set(4,5)\nq:setname(\"mypoint\")\np:setconst(q)\nlocal r = p:getpointer();\nx,y = r:get()\nassert(x==4 and y==5)\nassert(r:getname()==\"mypoint\")\n\nlocal s = Point:new()\ns:setref(r)\nlocal t = s:getref()\nt:set(5,6)              -- t is s\nx,y = s:get()\nassert(x==5 and y==6)\n\nlocal u = s:getvalue()\nu:set(4,1)              -- u represents a copy of s\nx,y = s:get()\nassert(x~=4 and y~=1)\n\nlocal x1,y1 = getpoint(u)\nlocal x2,y2 = getpoint(s)\n\nlocal p1 = alg.add(u,s)\nx,y = p1:get()\nassert(x==x1+x2 and y==y1+y2)\n\nlocal p2 = alg.sub(u,s)\nx,y = p2:get()\nassert(x==x1-x2 and y==y1-y2)\n\nlocal p3 = alg.mult(u,s)\nx,y = p3:get()\nassert(x==x1*x2 and y==y1*y2)\n\nlocal p4 = alg.div(s,2)\nx,y = p4:get()\nassert(x==x2/2 and y==y2/2)\n\nsetpoint(p4)\nx,y = p4:get()\nassert(x==0 and y==0)\n\nlocal cp = ColorPoint:MakeRed(3,4)\nlocal p = cp+cp\nx,y = p:get()\nassert(x==6 and y==8)\nlocal q = p-cp\nx,y = q:get()\nassert(x==3 and y==4)\nlocal r = p/2\nx,y = r:get()\nassert(x==3 and y==4)\nlocal t = r*cp\nx,y = t:get()\nassert(x==9 and y==16)\nassert(t==r*r)\n-- assert(q==cp)      -- the eq does not deal with different metatables\nassert(t~=q)\nassert(q<t)\nassert(q<=t)\nassert(t>q)\nassert(t>=q)\n\nlocal p = Point:new(1,2)\nassert(p[1]==1 and p[2]==2)\np[1]=3; p[2] = p[2]+2\nlocal x, y = p:get()\nassert(x==3 and y==4)\n\n\nlocal n = 3\nlocal v = {Point:new(0,1), Point:new(2,3), Point:new(4,5)}\n\nlocal m = average(n,v)\nlocal c = averagepointer(n,v)\nlocal t = {}\ncopyvector(n,v,t)\n\nlocal l = Point:new()\nfor i=1,n do\n assert(v[i]==t[i])\n l[1] = l[1] + v[i][1] \n l[2] = l[2] + v[i][2] \nend\nl = l/n\nassert(m==l)\nassert(c==l)\n\nassert(Point.SUCCESS==Point:echo(Point.SUCCESS))\nassert(Point.ERROR==Point:echo(Point.ERROR))\nassert(FIRST==invert(SECOND))\nassert(SECOND==invert(FIRST))\n\nprint(\"Function test OK\")\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tfunction.pkg",
    "content": "$#include \"tfunction.h\"\n\ntypedef enum {\n FIRST = 1,\n\tSECOND = 2\n} Order;\n\nclass Point\n{\n\tenum Error {\n\t\tSUCCESS = 0,\n\t\tERROR = 1\n\t};\n\n\tPoint (float x=0, float y=0);\n\tvirtual ~Point ();\n\n\tvoid set (float x, float y);\n\tvoid set (float v[2]=0);\n\tvoid setpointer (Point* p);\n\tvoid setref (Point& p);\n\tvoid setvalue (Point p);\n\tvoid setconst (const Point* p);\n\tvoid setname (const char* s);\n\n\tvoid get (float* x=0, float* y=0) const;\n\tvoid get (float v[2]=0) const;\n\tPoint* getpointer ();\n\tPoint& getref ();\n\tPoint getvalue ();\n\tconst Point* getconst () const;\n\tconst char* getname () const;\n\n\tPoint operator+ (const Point& p) const;\n\tPoint operator- (const Point& p) const;\n\tPoint operator* (const Point& p) const;\n\tPoint operator/ (float n) const;\n\tbool operator< (const Point& p) const;\n\tbool operator<= (const Point& p) const;\n\tbool operator== (const Point& p) const;\n\n float operator[] (int i) const;\n\tfloat& operator[] (int i);\n\n\tstatic Error echo (Error e);\n};\n\nmodule alg\n{\n Point add (const Point& p1, const Point& p2);\n Point sub (const Point& p1, const Point& p2);\n Point mult (const Point& p1, const Point& p2);\n Point div (const Point& p1, float n);\n}\n\nvoid getpoint (const Point* p, float* x=0, float* y=0);\nvoid setpoint (Point* p, float x=0, float y=0);\ninline Point average (int n, Point v[n]);\ninline\tPoint averagepointer (int n, Point* v[n]);\ninline\tvoid copyvector (int n, const Point v[n], Point u[n]=(u+i));\n\ninline Order invert (Order o);\n\n$cfile \"tfunction.h\"\n\n/*\nclass ColorPoint : public Point\n{\n ColorPoint (float px, float py, float cr=0.0f, float cg=0.0f, float cb=0.0f);\n virtual ~ColorPoint ();\n\tvirtual void getcolor (float* red, float *green, float *blue) const;\n static const Point* MakeRed (float x, float y);\n};\n*/\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tmodule.c",
    "content": "#include \"lualib.h\"\n#include \"lauxlib.h\"\n\n#include \"tmodule.h\"\n\nint a = 1;\nint b = 2;\nint c = 3;\nint d = 4;\n\nint main ()\n{\n\tint  tolua_tmodule_open (lua_State*);\n\n\tlua_State* L = lua_open();\n\tluaopen_base(L);\n\ttolua_tmodule_open(L);\n\n\tlua_dofile(L,\"tmodule.lua\");\n\n\tlua_close(L);\n\treturn 0;\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tmodule.h",
    "content": "#include <stdio.h>\n\nextern int a;\nextern int b;\nextern int c;\nextern int d;\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tmodule.lua",
    "content": "-- test valid access\nassert(A.a==1)\nassert(A.B.b==2)\nassert(A.B.C.c==3)\n\n-- test invalid access\nassert(A.B.a==nil)      -- no inheritance\nassert(A.B.C.a==nil)\n\nassert(A.b==nil)        -- no access the inner module\nassert(A.c==nil)\nassert(A.B.c==nil)\n\n-- test variables appended to existing modules\nassert(A.d==4)\n\nprint(\"Module test OK\")\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tmodule.pkg",
    "content": "\n$#include \"tmodule.h\"\n\nmodule A {\n extern int a;\n\tmodule B {\n  extern int b;\n  module C {\n   extern int c;\n\t\t}\n\t}\n}\n\nmodule A {\n extern int d;\n}\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tmodulebind.c",
    "content": "/*\r\n** Lua binding: tmodule\r\n** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:13.\r\n*/\r\n\r\n#ifndef __cplusplus\r\n#include \"stdlib.h\"\r\n#endif\r\n#include \"string.h\"\r\n\r\n#include \"tolua.h\"\r\n\r\n/* Exported function */\r\nTOLUA_API int tolua_tmodule_open (lua_State* tolua_S);\r\n\r\n#include \"tmodule.h\"\r\n\r\n/* function to register type */\r\nstatic void tolua_reg_types (lua_State* tolua_S)\r\n{\r\n}\r\n\r\n/* get function: a */\r\nstatic int tolua_get_A_a(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)a);\r\n return 1;\r\n}\r\n\r\n/* set function: a */\r\nstatic int tolua_set_A_a(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  a = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: b */\r\nstatic int tolua_get_B_b(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)b);\r\n return 1;\r\n}\r\n\r\n/* set function: b */\r\nstatic int tolua_set_B_b(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  b = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: c */\r\nstatic int tolua_get_C_c(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)c);\r\n return 1;\r\n}\r\n\r\n/* set function: c */\r\nstatic int tolua_set_C_c(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  c = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: d */\r\nstatic int tolua_get_A_d(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)d);\r\n return 1;\r\n}\r\n\r\n/* set function: d */\r\nstatic int tolua_set_A_d(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  d = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* Open function */\r\nTOLUA_API int tolua_tmodule_open (lua_State* tolua_S)\r\n{\r\n tolua_open(tolua_S);\r\n tolua_reg_types(tolua_S);\r\n tolua_module(tolua_S,NULL,0);\r\n tolua_beginmodule(tolua_S,NULL);\r\n tolua_module(tolua_S,\"A\",1);\r\n tolua_beginmodule(tolua_S,\"A\");\r\n tolua_variable(tolua_S,\"a\",tolua_get_A_a,tolua_set_A_a);\r\n tolua_module(tolua_S,\"B\",1);\r\n tolua_beginmodule(tolua_S,\"B\");\r\n tolua_variable(tolua_S,\"b\",tolua_get_B_b,tolua_set_B_b);\r\n tolua_module(tolua_S,\"C\",1);\r\n tolua_beginmodule(tolua_S,\"C\");\r\n tolua_variable(tolua_S,\"c\",tolua_get_C_c,tolua_set_C_c);\r\n tolua_endmodule(tolua_S);\r\n tolua_endmodule(tolua_S);\r\n tolua_endmodule(tolua_S);\r\n tolua_module(tolua_S,\"A\",1);\r\n tolua_beginmodule(tolua_S,\"A\");\r\n tolua_variable(tolua_S,\"d\",tolua_get_A_d,tolua_set_A_d);\r\n tolua_endmodule(tolua_S);\r\n tolua_endmodule(tolua_S);\r\n return 1;\r\n}\r\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tnamespace.h",
    "content": "namespace A {\n\tenum {FIRST=1};\n extern int a;\n\tnamespace B {\n  extern int b;\n  namespace C {\n   extern int c;\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tnamespace.lua",
    "content": "-- test valid access\nassert(A.a==1)\nassert(A.B.b==2)\nassert(A.B.C.c==3)\n\n-- test invalid access\nassert(A.B.a==nil)      -- no inheritance\nassert(A.B.C.a==nil)\n\nassert(A.b==nil)        -- no access the inner module\nassert(A.c==nil)\nassert(A.B.c==nil)\n\nprint(\"Namespace test OK\")\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tnamespace.pkg",
    "content": "\n$#include \"tnamespace.h\"\n\nnamespace A {\n int a;\n\tnamespace B {\n  int b;\n  namespace C {\n   int c;\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tvariable.c",
    "content": "#include \"lualib.h\"\n#include \"lauxlib.h\"\n\n#include \"tvariable.h\"\n\nint i = 1;\nfloat f = 2.0f;;\ndouble d = 3.0;\nchar* s = \"Hello world\";\nvoid* v = (void*)1;\nchar n[64] = \"Hi there\";\n\nA a = {11,12.0f,13.0,\"Hello world from class\",(void*)1,\"Hi there from class\"};\nB* b;\nU u;\n\nint mi = 21;\nfloat mf = 22.0f;\ndouble md = 23.0;\nchar* ms = \"Hello world in module\";\nvoid* mv = NULL;\nchar mn[64] = \"Hi there in module\";\nA ma = {31,32.0f,33.0,\"Hello world from class in module\",\n\t       NULL,\"Hi there from class in module\"};\nB* mb;\n\nint main (void)\n{\n\tint  tolua_tvariable_open (lua_State*);\n\tlua_State* L = lua_open();\n\n\tB bb = {a,NULL};\n\tB bbb = {ma,&bb};\n\tb = &bb;\n\tmb = &bbb;\n\n\n\tluaopen_base(L);\n\ttolua_tvariable_open(L);\n\n\tlua_dofile(L,\"tvariable.lua\");\n\n\tlua_close(L);\n\treturn 0;\n}\n\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tvariable.h",
    "content": "typedef struct A A;\ntypedef struct B B;\ntypedef union U U;\n\nstruct A\n{\n\tint i;\n\tfloat f;\n\tdouble d;\n\tchar* s;\n\tvoid* v;\n\tchar n[64];\n};\n\nunion U\n{\n\tint i;\n\tfloat f;\n};\n\nstruct B\n{\n\tA a;\n B*\tb;\n};\n\nextern int i;\nextern float f;\nextern double d;\nextern char* s;\nextern void* v;\nextern char n[64];\nextern A a;\nextern B* b;\nextern U u;\n\nextern int mi;\nextern float mf;\nextern double md;\nextern char* ms;\nextern void* mv;\nextern char mn[64];\nextern A ma;\nextern B* mb;\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tvariable.lua",
    "content": "assert(i==1)\nassert(f==2)\nassert(d==3)\nassert(s==\"Hello world\")\nassert(n==\"Hi there\")\nn = \"Hello\"\nassert(n==\"Hello\")\n\nassert(a.i==11)\nassert(a.f==12)\nassert(a.d==13)\nassert(a.s==\"Hello world from class\")\nassert(a.n==\"Hi there from class\")\na.n = \"Hello from class\"\nassert(a.n==\"Hello from class\")\n\nassert(v==a.v)\n\nu.i = 2\nassert(u.i==2)\nu.f = 2\nassert(u.f==2)\nassert(u.i~=2)\n\nassert(M.mi==21)\nassert(M.mf==22)\nassert(M.md==23)\nassert(M.ms==\"Hello world in module\")\nassert(M.mn==\"Hi there in module\")\nM.mn = \"Hello in module\"\nassert(M.mn==\"Hello in module\")\nassert(M.mv==nil)\n\nassert(M.ma.i==31)\nassert(M.ma.f==32)\nassert(M.ma.d==33)\nassert(M.ma.s==\"Hello world from class in module\")\nassert(M.ma.n==\"Hi there from class in module\")\nM.ma.n = \"Hello from class in module\"\nassert(M.ma.n==\"Hello from class in module\")\nassert(M.ma.v==nil)\n\nassert(a.i==b.a.i)\nassert(a.f==b.a.f)\nassert(a.d==b.a.d)\nassert(a.s==b.a.s)\nassert(a.v==b.a.v)\nassert(b.b==nil)\n\nassert(M.ma.i==M.mb.a.i)\nassert(M.ma.f==M.mb.a.f)\nassert(M.ma.d==M.mb.a.d)\nassert(M.ma.s==M.mb.a.s)\nassert(M.ma.v==M.mb.a.v)\n\nassert(a.i==M.mb.b.a.i)\nassert(a.f==M.mb.b.a.f)\nassert(a.d==M.mb.b.a.d)\nassert(a.s==M.mb.b.a.s)\nassert(a.v==M.mb.b.a.v)\nassert(M.mb.b.b==nil)\n\nassert(s~=rawget(_G,\"s\"))  -- because s represents a C variable\ns = \"Hello\"\nassert(s==rawget(_G,\"s\"))  -- because s is mapped as const\n\nf = 25.0\nassert(f~=rawget(_G,\"f\"))  -- because f represents a C variable\n\nb.a.i = 5\nassert(b.a.i==M.mb.b.a.i)\n\nprint(\"Variable test OK\")\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tvariable.pkg",
    "content": "$#include \"tvariable.h\"\n\nstruct A\n{\n\tint i;\n\tfloat f;\n\tdouble d;\n\tchar* s;\n\tvoid* v;\n\tchar n[64];\n};\n\nstruct B\n{\n\tA a;\n B*\tb;\n};\n\nunion U\n{\n\tint i;\n\tfloat f;\n};\n\nextern int i;\nextern float f;\nextern double d;\nextern const char* s;\nextern void* v;\nextern\tchar n[64];\nextern A a;\nextern B* b;\nextern U u;\n\nmodule M {\nextern int mi;\nextern float mf;\nextern double md;\nextern const char* ms;\nextern void* mv;\nextern\tconst char mn[64];\nextern A a;\nextern A ma;\nextern B* mb;\n}\n"
  },
  {
    "path": "3rdparty/toluapp/src/tests/tvariablebind.c",
    "content": "/*\r\n** Lua binding: tvariable\r\n** Generated automatically by tolua 5.0a-CDLVS2 on 08/08/03 17:06:18.\r\n*/\r\n\r\n#ifndef __cplusplus\r\n#include \"stdlib.h\"\r\n#endif\r\n#include \"string.h\"\r\n\r\n#include \"tolua.h\"\r\n\r\n/* Exported function */\r\nTOLUA_API int tolua_tvariable_open (lua_State* tolua_S);\r\n\r\n#include \"tvariable.h\"\r\n\r\n/* function to register type */\r\nstatic void tolua_reg_types (lua_State* tolua_S)\r\n{\r\n tolua_usertype(tolua_S,\"A\");\r\n tolua_usertype(tolua_S,\"U\");\r\n tolua_usertype(tolua_S,\"B\");\r\n}\r\n\r\n/* get function: i of class  A */\r\nstatic int tolua_get_A_i(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'i'\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->i);\r\n return 1;\r\n}\r\n\r\n/* set function: i of class  A */\r\nstatic int tolua_set_A_i(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'i'\",NULL);\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->i = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: f of class  A */\r\nstatic int tolua_get_A_f(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'f'\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->f);\r\n return 1;\r\n}\r\n\r\n/* set function: f of class  A */\r\nstatic int tolua_set_A_f(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'f'\",NULL);\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->f = ((float)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: d of class  A */\r\nstatic int tolua_get_A_d(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'd'\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->d);\r\n return 1;\r\n}\r\n\r\n/* set function: d of class  A */\r\nstatic int tolua_set_A_d(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'd'\",NULL);\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->d = ((double)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: s of class  A */\r\nstatic int tolua_get_A_s(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 's'\",NULL);\r\n#endif\r\n tolua_pushstring(tolua_S,(const char*)self->s);\r\n return 1;\r\n}\r\n\r\n/* set function: s of class  A */\r\nstatic int tolua_set_A_s(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 's'\",NULL);\r\n if (!tolua_isstring(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->s = ((char*)  tolua_tostring(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: v of class  A */\r\nstatic int tolua_get_A_v(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'v'\",NULL);\r\n#endif\r\n tolua_pushuserdata(tolua_S,(void*)self->v);\r\n return 1;\r\n}\r\n\r\n/* set function: v of class  A */\r\nstatic int tolua_set_A_v(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'v'\",NULL);\r\n if (!tolua_isuserdata(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->v = ((void*)  tolua_touserdata(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: n of class  A */\r\nstatic int tolua_get_A_n(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'n'\",NULL);\r\n#endif\r\n tolua_pushstring(tolua_S,(const char*)self->n);\r\n return 1;\r\n}\r\n\r\n/* set function: n of class  A */\r\nstatic int tolua_set_A_n(lua_State* tolua_S)\r\n{\r\n  A* self = (A*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'n'\",NULL);\r\n if (!tolua_isstring(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n strncpy(self->n,tolua_tostring(tolua_S,2,0),64-1);\r\n return 0;\r\n}\r\n\r\n/* get function: a of class  B */\r\nstatic int tolua_get_B_a(lua_State* tolua_S)\r\n{\r\n  B* self = (B*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'a'\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)&self->a,\"A\");\r\n return 1;\r\n}\r\n\r\n/* set function: a of class  B */\r\nstatic int tolua_set_B_a(lua_State* tolua_S)\r\n{\r\n  B* self = (B*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'a'\",NULL);\r\n if (!tolua_isusertype(tolua_S,2,\"A\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->a = *((A*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: b of class  B */\r\nstatic int tolua_get_B_b_ptr(lua_State* tolua_S)\r\n{\r\n  B* self = (B*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'b'\",NULL);\r\n#endif\r\n tolua_pushusertype(tolua_S,(void*)self->b,\"B\");\r\n return 1;\r\n}\r\n\r\n/* set function: b of class  B */\r\nstatic int tolua_set_B_b_ptr(lua_State* tolua_S)\r\n{\r\n  B* self = (B*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'b'\",NULL);\r\n if (!tolua_isusertype(tolua_S,2,\"B\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->b = ((B*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: i of class  U */\r\nstatic int tolua_get_U_i(lua_State* tolua_S)\r\n{\r\n  U* self = (U*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'i'\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->i);\r\n return 1;\r\n}\r\n\r\n/* set function: i of class  U */\r\nstatic int tolua_set_U_i(lua_State* tolua_S)\r\n{\r\n  U* self = (U*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'i'\",NULL);\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->i = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: f of class  U */\r\nstatic int tolua_get_U_f(lua_State* tolua_S)\r\n{\r\n  U* self = (U*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'f'\",NULL);\r\n#endif\r\n tolua_pushnumber(tolua_S,(double)self->f);\r\n return 1;\r\n}\r\n\r\n/* set function: f of class  U */\r\nstatic int tolua_set_U_f(lua_State* tolua_S)\r\n{\r\n  U* self = (U*)  tolua_tousertype(tolua_S,1,0);\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!self) tolua_error(tolua_S,\"invalid 'self' in accessing variable 'f'\",NULL);\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  self->f = ((float)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: i */\r\nstatic int tolua_get_i(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)i);\r\n return 1;\r\n}\r\n\r\n/* set function: i */\r\nstatic int tolua_set_i(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  i = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: f */\r\nstatic int tolua_get_f(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)f);\r\n return 1;\r\n}\r\n\r\n/* set function: f */\r\nstatic int tolua_set_f(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  f = ((float)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: d */\r\nstatic int tolua_get_d(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)d);\r\n return 1;\r\n}\r\n\r\n/* set function: d */\r\nstatic int tolua_set_d(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  d = ((double)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: s */\r\nstatic int tolua_get_s(lua_State* tolua_S)\r\n{\r\n tolua_pushstring(tolua_S,(const char*)s);\r\n return 1;\r\n}\r\n\r\n/* get function: v */\r\nstatic int tolua_get_v(lua_State* tolua_S)\r\n{\r\n tolua_pushuserdata(tolua_S,(void*)v);\r\n return 1;\r\n}\r\n\r\n/* set function: v */\r\nstatic int tolua_set_v(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isuserdata(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  v = ((void*)  tolua_touserdata(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: n */\r\nstatic int tolua_get_n(lua_State* tolua_S)\r\n{\r\n tolua_pushstring(tolua_S,(const char*)n);\r\n return 1;\r\n}\r\n\r\n/* set function: n */\r\nstatic int tolua_set_n(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isstring(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n strncpy(n,tolua_tostring(tolua_S,2,0),64-1);\r\n return 0;\r\n}\r\n\r\n/* get function: a */\r\nstatic int tolua_get_a(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)&a,\"A\");\r\n return 1;\r\n}\r\n\r\n/* set function: a */\r\nstatic int tolua_set_a(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"A\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  a = *((A*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: b */\r\nstatic int tolua_get_b_ptr(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)b,\"B\");\r\n return 1;\r\n}\r\n\r\n/* set function: b */\r\nstatic int tolua_set_b_ptr(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"B\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  b = ((B*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: u */\r\nstatic int tolua_get_u(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)&u,\"U\");\r\n return 1;\r\n}\r\n\r\n/* set function: u */\r\nstatic int tolua_set_u(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"U\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  u = *((U*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: mi */\r\nstatic int tolua_get_M_mi(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)mi);\r\n return 1;\r\n}\r\n\r\n/* set function: mi */\r\nstatic int tolua_set_M_mi(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  mi = ((int)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: mf */\r\nstatic int tolua_get_M_mf(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)mf);\r\n return 1;\r\n}\r\n\r\n/* set function: mf */\r\nstatic int tolua_set_M_mf(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  mf = ((float)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: md */\r\nstatic int tolua_get_M_md(lua_State* tolua_S)\r\n{\r\n tolua_pushnumber(tolua_S,(double)md);\r\n return 1;\r\n}\r\n\r\n/* set function: md */\r\nstatic int tolua_set_M_md(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isnumber(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  md = ((double)  tolua_tonumber(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: ms */\r\nstatic int tolua_get_M_ms(lua_State* tolua_S)\r\n{\r\n tolua_pushstring(tolua_S,(const char*)ms);\r\n return 1;\r\n}\r\n\r\n/* get function: mv */\r\nstatic int tolua_get_M_mv(lua_State* tolua_S)\r\n{\r\n tolua_pushuserdata(tolua_S,(void*)mv);\r\n return 1;\r\n}\r\n\r\n/* set function: mv */\r\nstatic int tolua_set_M_mv(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isuserdata(tolua_S,2,0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  mv = ((void*)  tolua_touserdata(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: mn */\r\nstatic int tolua_get_M_mn(lua_State* tolua_S)\r\n{\r\n tolua_pushstring(tolua_S,(const char*)mn);\r\n return 1;\r\n}\r\n\r\n/* get function: a */\r\nstatic int tolua_get_M_a(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)&a,\"A\");\r\n return 1;\r\n}\r\n\r\n/* set function: a */\r\nstatic int tolua_set_M_a(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"A\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  a = *((A*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: ma */\r\nstatic int tolua_get_M_ma(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)&ma,\"A\");\r\n return 1;\r\n}\r\n\r\n/* set function: ma */\r\nstatic int tolua_set_M_ma(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"A\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  ma = *((A*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* get function: mb */\r\nstatic int tolua_get_M_mb_ptr(lua_State* tolua_S)\r\n{\r\n tolua_pushusertype(tolua_S,(void*)mb,\"B\");\r\n return 1;\r\n}\r\n\r\n/* set function: mb */\r\nstatic int tolua_set_M_mb_ptr(lua_State* tolua_S)\r\n{\r\n#ifndef TOLUA_RELEASE\r\n tolua_Error tolua_err;\r\n if (!tolua_isusertype(tolua_S,2,\"B\",0,&tolua_err))\r\n tolua_error(tolua_S,\"#vinvalid type in variable assignment.\",&tolua_err);\r\n#endif\r\n  mb = ((B*)  tolua_tousertype(tolua_S,2,0));\r\n return 0;\r\n}\r\n\r\n/* Open function */\r\nTOLUA_API int tolua_tvariable_open (lua_State* tolua_S)\r\n{\r\n tolua_open(tolua_S);\r\n tolua_reg_types(tolua_S);\r\n tolua_module(tolua_S,NULL,1);\r\n tolua_beginmodule(tolua_S,NULL);\r\n tolua_cclass(tolua_S,\"A\",\"A\",\"\",NULL);\r\n tolua_beginmodule(tolua_S,\"A\");\r\n tolua_variable(tolua_S,\"i\",tolua_get_A_i,tolua_set_A_i);\r\n tolua_variable(tolua_S,\"f\",tolua_get_A_f,tolua_set_A_f);\r\n tolua_variable(tolua_S,\"d\",tolua_get_A_d,tolua_set_A_d);\r\n tolua_variable(tolua_S,\"s\",tolua_get_A_s,tolua_set_A_s);\r\n tolua_variable(tolua_S,\"v\",tolua_get_A_v,tolua_set_A_v);\r\n tolua_variable(tolua_S,\"n\",tolua_get_A_n,tolua_set_A_n);\r\n tolua_endmodule(tolua_S);\r\n tolua_cclass(tolua_S,\"B\",\"B\",\"\",NULL);\r\n tolua_beginmodule(tolua_S,\"B\");\r\n tolua_variable(tolua_S,\"a\",tolua_get_B_a,tolua_set_B_a);\r\n tolua_variable(tolua_S,\"b\",tolua_get_B_b_ptr,tolua_set_B_b_ptr);\r\n tolua_endmodule(tolua_S);\r\n tolua_cclass(tolua_S,\"U\",\"U\",\"\",NULL);\r\n tolua_beginmodule(tolua_S,\"U\");\r\n tolua_variable(tolua_S,\"i\",tolua_get_U_i,tolua_set_U_i);\r\n tolua_variable(tolua_S,\"f\",tolua_get_U_f,tolua_set_U_f);\r\n tolua_endmodule(tolua_S);\r\n tolua_variable(tolua_S,\"i\",tolua_get_i,tolua_set_i);\r\n tolua_variable(tolua_S,\"f\",tolua_get_f,tolua_set_f);\r\n tolua_variable(tolua_S,\"d\",tolua_get_d,tolua_set_d);\r\n tolua_variable(tolua_S,\"s\",tolua_get_s,NULL);\r\n tolua_variable(tolua_S,\"v\",tolua_get_v,tolua_set_v);\r\n tolua_variable(tolua_S,\"n\",tolua_get_n,tolua_set_n);\r\n tolua_variable(tolua_S,\"a\",tolua_get_a,tolua_set_a);\r\n tolua_variable(tolua_S,\"b\",tolua_get_b_ptr,tolua_set_b_ptr);\r\n tolua_variable(tolua_S,\"u\",tolua_get_u,tolua_set_u);\r\n tolua_module(tolua_S,\"M\",1);\r\n tolua_beginmodule(tolua_S,\"M\");\r\n tolua_variable(tolua_S,\"mi\",tolua_get_M_mi,tolua_set_M_mi);\r\n tolua_variable(tolua_S,\"mf\",tolua_get_M_mf,tolua_set_M_mf);\r\n tolua_variable(tolua_S,\"md\",tolua_get_M_md,tolua_set_M_md);\r\n tolua_variable(tolua_S,\"ms\",tolua_get_M_ms,NULL);\r\n tolua_variable(tolua_S,\"mv\",tolua_get_M_mv,tolua_set_M_mv);\r\n tolua_variable(tolua_S,\"mn\",tolua_get_M_mn,NULL);\r\n tolua_variable(tolua_S,\"a\",tolua_get_M_a,tolua_set_M_a);\r\n tolua_variable(tolua_S,\"ma\",tolua_get_M_ma,tolua_set_M_ma);\r\n tolua_variable(tolua_S,\"mb\",tolua_get_M_mb_ptr,tolua_set_M_mb_ptr);\r\n tolua_endmodule(tolua_S);\r\n tolua_endmodule(tolua_S);\r\n return 1;\r\n}\r\n"
  },
  {
    "path": "3rdparty/toluapp/win32/vc7/toluapp.sln",
    "content": "Microsoft Visual Studio Solution File, Format Version 8.00\r\nProject(\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\") = \"toluapp\", \"toluapp.vcproj\", \"{71891C1A-E328-4258-AC3F-6F9698C6D8B4}\"\r\n\tProjectSection(ProjectDependencies) = postProject\r\n\tEndProjectSection\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfiguration) = preSolution\r\n\t\twithLua50_Debug = withLua50_Debug\r\n\t\twithLua50_Release = withLua50_Release\r\n\t\twithLua51_Debug = withLua51_Debug\r\n\t\twithLua51_Release = withLua51_Release\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfiguration) = postSolution\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Debug.ActiveCfg = withLua51_Release|Win32\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Debug.Build.0 = withLua51_Release|Win32\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Release.ActiveCfg = withLua50_Release|Win32\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua50_Release.Build.0 = withLua50_Release|Win32\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Debug.ActiveCfg = withLua51_Debug|Win32\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Debug.Build.0 = withLua51_Debug|Win32\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Release.ActiveCfg = withLua51_Release|Win32\r\n\t\t{71891C1A-E328-4258-AC3F-6F9698C6D8B4}.withLua51_Release.Build.0 = withLua51_Release|Win32\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityAddIns) = postSolution\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "3rdparty/toluapp/win32/vc7/toluapp.vcproj",
    "content": "<?xml version=\"1.0\" encoding=\"shift_jis\"?>\r\n<VisualStudioProject\r\n\tProjectType=\"Visual C++\"\r\n\tVersion=\"7.10\"\r\n\tName=\"toluapp\"\r\n\tProjectGUID=\"{71891C1A-E328-4258-AC3F-6F9698C6D8B4}\"\r\n\tKeyword=\"Win32Proj\">\r\n\t<Platforms>\r\n\t\t<Platform\r\n\t\t\tName=\"Win32\"/>\r\n\t</Platforms>\r\n\t<Configurations>\r\n\t\t<Configuration\r\n\t\t\tName=\"withLua50_Debug|Win32\"\r\n\t\t\tOutputDirectory=\"Debug\"\r\n\t\t\tIntermediateDirectory=\"Debug\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tAdditionalIncludeDirectories=\"&quot;..\\..\\include&quot;\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"5\"\r\n\t\t\t\tUsePrecompiledHeader=\"2\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tAdditionalDependencies=\"lua50.lib\"\r\n\t\t\t\tOutputFile=\"..\\..\\bin\\tolua++_d.exe\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tAdditionalLibraryDirectories=\"..\\..\\lib\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tProgramDatabaseFile=\"$(OutDir)/tolua++.pdb\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"withLua50_Release|Win32\"\r\n\t\t\tOutputDirectory=\"Release\"\r\n\t\t\tIntermediateDirectory=\"Release\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tAdditionalIncludeDirectories=\"&quot;..\\..\\include&quot;\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE\"\r\n\t\t\t\tRuntimeLibrary=\"4\"\r\n\t\t\t\tUsePrecompiledHeader=\"2\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tAdditionalDependencies=\"lua50.lib\"\r\n\t\t\t\tOutputFile=\"..\\..\\bin\\tolua++.exe\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tAdditionalLibraryDirectories=\"..\\..\\lib\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"withLua51_Debug|Win32\"\r\n\t\t\tOutputDirectory=\"$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(ConfigurationName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tOptimization=\"0\"\r\n\t\t\t\tAdditionalIncludeDirectories=\"&quot;..\\..\\include&quot;\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;_DEBUG;_CONSOLE\"\r\n\t\t\t\tMinimalRebuild=\"TRUE\"\r\n\t\t\t\tBasicRuntimeChecks=\"3\"\r\n\t\t\t\tRuntimeLibrary=\"5\"\r\n\t\t\t\tUsePrecompiledHeader=\"2\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\r\n\t\t\t\tDebugInformationFormat=\"4\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tAdditionalDependencies=\"Lua5.1.lib\"\r\n\t\t\t\tOutputFile=\"..\\..\\bin\\tolua++_d.exe\"\r\n\t\t\t\tLinkIncremental=\"2\"\r\n\t\t\t\tAdditionalLibraryDirectories=\"..\\..\\lib\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tProgramDatabaseFile=\"$(OutDir)/tolua++.pdb\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t\t<Configuration\r\n\t\t\tName=\"withLua51_Release|Win32\"\r\n\t\t\tOutputDirectory=\"$(ConfigurationName)\"\r\n\t\t\tIntermediateDirectory=\"$(ConfigurationName)\"\r\n\t\t\tConfigurationType=\"1\"\r\n\t\t\tCharacterSet=\"2\">\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCLCompilerTool\"\r\n\t\t\t\tAdditionalIncludeDirectories=\"&quot;..\\..\\include&quot;\"\r\n\t\t\t\tPreprocessorDefinitions=\"WIN32;NDEBUG;_CONSOLE\"\r\n\t\t\t\tRuntimeLibrary=\"4\"\r\n\t\t\t\tUsePrecompiledHeader=\"2\"\r\n\t\t\t\tWarningLevel=\"3\"\r\n\t\t\t\tDetect64BitPortabilityProblems=\"TRUE\"\r\n\t\t\t\tDebugInformationFormat=\"3\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCCustomBuildTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCLinkerTool\"\r\n\t\t\t\tAdditionalDependencies=\"lua5.1.lib\"\r\n\t\t\t\tOutputFile=\"..\\..\\bin\\tolua++.exe\"\r\n\t\t\t\tLinkIncremental=\"1\"\r\n\t\t\t\tAdditionalLibraryDirectories=\"..\\..\\lib\"\r\n\t\t\t\tGenerateDebugInformation=\"TRUE\"\r\n\t\t\t\tSubSystem=\"1\"\r\n\t\t\t\tOptimizeReferences=\"2\"\r\n\t\t\t\tEnableCOMDATFolding=\"2\"\r\n\t\t\t\tTargetMachine=\"1\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCMIDLTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPostBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreBuildEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCPreLinkEventTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCResourceCompilerTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCXMLDataGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCWebDeploymentTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCManagedWrapperGeneratorTool\"/>\r\n\t\t\t<Tool\r\n\t\t\t\tName=\"VCAuxiliaryManagedWrapperGeneratorTool\"/>\r\n\t\t</Configuration>\r\n\t</Configurations>\r\n\t<References>\r\n\t</References>\r\n\t<Files>\r\n\t\t<Filter\r\n\t\t\tName=\"\\[X t@C\"\r\n\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\r\n\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\bin\\tolua.c\">\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\lib\\tolua_event.c\">\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\lib\\tolua_event.h\">\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\lib\\tolua_is.c\">\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\lib\\tolua_map.c\">\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\lib\\tolua_push.c\">\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\lib\\tolua_to.c\">\r\n\t\t\t</File>\r\n\t\t\t<File\r\n\t\t\t\tRelativePath=\"..\\..\\src\\bin\\toluabind.c\">\r\n\t\t\t</File>\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"wb_[ t@C\"\r\n\t\t\tFilter=\"h;hpp;hxx;hm;inl;inc;xsd\"\r\n\t\t\tUniqueIdentifier=\"{93995380-89BD-4b04-88EB-625FBE52EBFB}\">\r\n\t\t</Filter>\r\n\t\t<Filter\r\n\t\t\tName=\"\\[X t@C\"\r\n\t\t\tFilter=\"rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx\"\r\n\t\t\tUniqueIdentifier=\"{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}\">\r\n\t\t</Filter>\r\n\t</Files>\r\n\t<Globals>\r\n\t</Globals>\r\n</VisualStudioProject>\r\n"
  },
  {
    "path": "AGENTS.md",
    "content": "# Repository Guidelines\n\n## Project Structure & Module Organization\n\n- `src/` hosts the core engine, text objects, and display backends; platform shims live under `src/data/os/`.\n- `tests/` contains Catch2 suites (`test-*.cc`) plus fixtures; example assets reside in `data/`, `extras/`, and `web/`.\n- `cmake/` holds build helpers; `3rdparty/` pins vendored libraries; `lua/` exposes scripting hooks reused in configuration samples.\n- Build outputs stay in `build/`; clean it between toolchain switches to avoid stale configuration issues.\n\n## Build, Test, and Development Commands\n\n- Configure: `cmake -S . -B build -G Ninja -DMAINTAINER_MODE=ON` sets up a debug-friendly out-of-tree build aligned with CI.\n- Compile: `cmake --build build` or `ninja -C build` builds all binaries and modules.\n- Test: `ctest --test-dir build --output-on-failure` runs the suite; narrow focus with `./build/tests/test-conky \"<test-or-tag>\"` (for example `\"[linux]\"`) or `./build/tests/test-conky --section \"<section>\"`.\n- Format: `cmake --build build --target clang-format` or `ninja -C build clang-format` rewrites sources; pair with `cmake --build build --target check-clang-format` in CI. If the target is missing, reconfigure with `-DCHECK_CODE_QUALITY=ON`.\n- Coverage: `cmake -S . -B build -G Ninja -DMAINTAINER_MODE=ON -DCODE_COVERAGE=ON` then `cmake --build build --target test-conky-coverage-html`; HTML results are generated in the build tree under `test-conky-coverage-html/` (for example `build/tests/test-conky-coverage-html/index.html`).\n\n## Coding Style & Naming Conventions\n\n- Adopt Google C++ style: 2-space indent, 80-column target, left-aligned pointers (`char* ptr`), and braced initialization.\n- Keep include blocks ordered: system, third-party, project. Run clang-format before committing, and avoid manual tabs.\n- Mirror existing naming patterns such as `display_output_x11`, `text_object_xyz`, and the callback pattern from `update-cb.hh` (`callback<Result, Keys...>` plus `register_cb<YourCallback>`) for new components.\n\n## Testing Guidelines\n\n- Add tests beside peers in `tests/`, naming files `test-feature.cc` and Catch2 sections with snake_case tags.\n- Wrap OS- or backend-specific assertions in the same `#ifdef` guards used by the implementation.\n- Regenerate coverage after behavioral changes to confirm critical modules remain exercised.\n\n## Commit & Pull Request Guidelines\n\n- Prefer Conventional Commits (e.g., `fix: correct .dockerignore` or `build(deps): bump libfoo`), keeping imperative, present-tense subjects.\n- Reference related issues or PRs with `(#1234)`, and keep each commit focused on one logical change.\n- PRs should outline intent, note validation commands, and attach screenshots when user-visible output changes.\n- Confirm `ctest`, formatting, and key runtime checks succeed before requesting review; reviewers expect merge-ready branches.\n\n## Architecture Overview\n\n- Register text objects via the `OBJ`, `OBJ_ARG`, `OBJ_IF`, and `OBJ_IF_ARG` macros in `src/core.cc` (`construct_text_object`) and reuse existing caching/update helpers instead of ad-hoc loops.\n- Backends derive from `display_output_base`; ensure new drawing code degrades gracefully for ncurses and HTTP outputs.\n- Long-running stats should use the shared `update_cb` + `conky::callback_handle` pattern to keep the UI responsive.\n"
  },
  {
    "path": "AUTHORS",
    "content": "NOTE: Since moving to Git, I am no longer going to continue to update this file\n(in favour of Git's log stuff).  If you want to add yourself here when you\nsubmit a patch, feel free.\n\nAuthors of conky in alphapetical order (please, send mail if I forgot\nsomebody or email address / name is wrong):\n\nadi <razorbladeworks at yahoo dot com>\n  Outline stuff\n  ACPI fan & adapter\n\nAdi Zaimi\n  original top code\n\nAlex <godexsoft at bk dot ru>\n  Iconv patch\n\nAlexey Bondarenko <alexey.bond.94.55@gmail.com>\n  $scroll fix\n\naffinity <affy at users dot sourceforge dot net>\n  X-Mozilla-Status support\n\nakash <akash at users dot sourceforge dot net>\n  battery_percent and battery_bar\n\nAsbjrn Zweidorff Kjr <bunjiboys at users dot sourceforge dot net>\n  support for EVE-Online skill monitoring\n\nAseem Mohanty <amohanty at myrealbox dot com>\n  if_up patch\n\nBen Kibbey <benkibbey at users dot sourceforge dot net>\n  $tail fifo patch\n  multiple mailbox patch\n\nBlondak <blondak_nesercz at users dot sourceforge dot net>\n  diskio read & write patch\n\nBobby Beckmann <bbeckmann at users dot sourceforge dot net>\n  Interface IP and Wireless Quality patch\n\nByron Clark <byron_clark at users dot sourceforge dot net>\n  sysfs AC adapter support patch\n\nDavid Carter <boojit at pundo dot com>\n  CPU usage being reported incorrectly by top\n\nBrenden Matthews <brenden at brndn dot io>\n  project maintainer for https://github.com/brndnmtthws/conky\n\nBruce Merry <bmerry at cs dot uct dot ac dot za>\n  Xdbe (double buffering)\n\nbtlee\n  linkstatus patch (http://forums.gentoo.org/viewtopic-p-2765647.html#2765647)\n\ncalmar <mac at calmar dot ws>\n  mboxscan\n\ncromka <cromka at users dot sourceforge dot net>\n  if_existing patch for string matching\n\ndan-h <dan-h at users dot sourceforge dot net>\n  adt746x fix\n\nDan Piponi <dan at tanelorn dot demon dot co dot uk>\n  original top code\n\nDave Clark <clarkd at skynet dot ca>\n  original top code\n\nDavid McCabe\n  utime\n\ngaro <nikolas at garofil dot be>\n  developer\n\nRam Yalamanchili\n  tztime\n\nDaniel Thiele <dthiele at gmx dot net>\n  APM support for FreeBSD\n\nDenis <d-st at users dot sourceforge dot net>\n  WM_CLASS patch\n  statfs patch\n\nDennis Frommknecht\n  NVCtrl, temperature monitoring for nvdia-based graphics cards\n\nDennis Kaandorp <addict at quicknet dot nl>\n  adt746x stuff\n\nElisey O. Savateev <bio3k at softboard dot ru>\n  Fixed if_mounted on FreeBSD\n\nEgor(knick_)\n  Iconv patch\n\nErik Scharwaechter <erik at diozaka dot org>\n  $if_empty patch\n\nFalk Feuersenger <lumberjack at users dot sourceforge dot net>\n  I2C divisor from a file\n\nFanat1k\n  Iconv patch\n\nflitsch <flitsch at users dot sourceforge dot net>\n  hwmon support\n\nfow <facadedewalls at yahoo dot com>\n  mpd_title max length\n\nGoogle LLC\n\nGwenhael LE MOINE <cycojesus at yahoo dot fr>\n  Manual setting of the position\n  WM_CLASS for window when drawing to own window\n\nHannu Saransaari <hipo at users dot sourceforge dot net>\n  Main code\n\nHenri Hkkinen <henux at users dot sourceforge dot net>\n  MOC support\n\nhinokind <hinokind at users dot sourceforge dot net>\n  support negative values in human_readable()\n\nJaromir Smrcek <jaromir dot smrcek at zoner dot com>\n  APC UPS daemon support\n\nJason Mitchell <jason.mitchell03 at saintleo dot edu>\n  developer\n  UTF8 fix\n  Source clean up\n\nJason Tan <jtan325 at users dot sourceforge dot net>\n  developer\n  debian package maintainer\n\nJoe Myre - <joemyre at users dot sourceforge dot net>\n  developer\n\njack_mort - gentoo forums\n  $tab patch\n\nJarmo Hekkanen\n  SETI stuff\n\nJeremy Burch <ascii021 at yahoo dot com>\n  $cached and $buffers\n\nJL Farinacci\n  pad_percents\n\nJohannes Winkelmann <jw at tks6 dot net>\n  disk I/O on linux\n  more consistent cpu freq handling on linux\n  capitalize Hertz in cpu frequeny\n\njolapache <jolapache at free dot fr>\n  maildir format\n\nJonas Koelker <jonaskoelker at users dot sourceforge dot net>\n  reload on SIGHUP patch\n  pad percantages fix patch\n\nJoshua Gerrish <jgerrish at users dot sourceforge dot net>\n  mpd password patch\n\nJrgen P. Tjern <daxxar at mental dot mine dot nu>\n  Restores default settings before loading new config file in SIGHUP\n  Some cleaning and commenting apparently :)\n  SIGHUP config file reload\n\nK. Eugene Carlson <kvngncrlsn at gmail dot com>\n  Additional Linux memory reporting variables\n  Linux CPU frequency governor reporting\n  Additional FreeBSD memory reporting variables\n  fs_stat patch\n\nKapil Hari Paranjape <kapil@imsc.res.in>\n  ibm_volume patch\n  kFreeBSD support patch\n  realtime clock patch\n  sysfs battery patch\n  mail_spool patch\n\nKevin Lyles <kevinlyles at gmail dot com>\n  add long options patch\n  add cpu separate option patch\n  add time to top patch\n  simplify round_to_int patch\n  goto width fix patch\n  offset width fix patch\n  individual diskio patch\n  short_units & human_readable patch\n\nkillfire\n  fs_used_perc and fs_bar_free patch\n\nLars Kotthoff <larsko at users dot sourceforge dot net>\n  $loadgraph, show_graph_scale patch\n\nLassi Selander <sleipner at users dot sourceforge dot net>\n  XMMS2 patch\n  XMMS2 fixes\n\nLauri Hakkarainen <b10nik at users dot sourceforge dot net>\n  Some translating, web and other stuff\n\nLeszek Krupiski <leszek at wafel dot com>\n  Battery number for ACPI battery\n  Load average bug fix\n\nLucas Brutschy <lbrutschy at users dot sourceforge dot net>\n  MLDonkey patch\n  if constructs patch\n\nMarcus Huesgen <marcus dot huesgen at googlemail dot com>\n  battery_bar fix\n\nMarkus Meissner <meissna at users dot sourceforge dot net>\n  NVIDIA Graficcard support with libXNVCtrl patch\n\nMichal Januszewski <spock at gentoo dot org>\n  hddtemp support\n\nMichal Ziabkowski <mziab at o2 dot pl>\n  $if_up memleak fix\n\nMiroslav Lichvar <lichvarm at gmail dot com>\n  move audacious thread init to update_audacious() patch\n  x86_64 freq_dyn patch\n  buffer overflow in update_net_stats() patch\n\nMoncelier Camille <pixdamix at users dot sourceforge dot net>\n  METAR patch\n\nMorgan Veyret <patzy at appart dot kicks-ass dot net>\n  own_window_type dock patch\n\nNattfodd <Nattfodd@gmail.com>\n  Fixed top_mem dupes\n\nnathanj439 <nathanj439 at users dot sourceforge dot net>\n  MPD time fix\n\nNikos Ntarmos <ntarmos at users dot sourceforge dot net>\n  FreeBSD total memory patch\n\nNikos Pylarinos <n dot pylarinos at hotmail dot com>\n  macOS support\n\nnorsetto <norsetto at ubuntu dot com>\n  fix SIGUSR1/SIGHUP segfault\n\nPascal Eberhard <pascal dor eberhard at gmail dot com>\n  graph and bar fix for right alignment\n\nPeter Tarjan <ptarjan at citromail dot hu>\n  IBM acpi support patch\n  SMP support for freq stuff\n  CPU voltage patch\n\nPetr Holub <hopet@users.sourceforge.net>\n  fix autotools on FreeBSD in autogen.sh\n  Improved battery readout on FreeBSD\n\nPhilip Kovacs <pkovacs at users dot sourceforge dot net>\n  tcp port monitor with hashing functionality\n\n  Audacious, Xmms, BMP, Infopipe stuff\n  Various Xlib changes, e.g. own_window hints, etc.\n\nPhil <n0-1 at users dot sourceforge dot net>\n  multiple batteries support\n  tp_smapi support\n  if_up patch\n  fix sysfs crashing patch\n\nPsychon <psychon at users dot sourceforge dot net>\n  a bunch of code cleanups\n\nRogier Reerink <me at rogier dot io>\n  Intel backlight support\n\nroiban adi <adiroiban at users dot sourceforge dot net>\n  hex colour patch\n\nRyan Tandy <tarpman at users dot sourceforge dot net>\n  fs_type patch\n  if_mpd_playing patch\n\nRui Paulo <rpaulo at netbsd-pt dot org>\n  NetBSD support\n\nRoland Shoemaker <rolandshoemaker at users dot sourceforge dot net>\n  user info patch\n  conky version info patch\n\nRoman Bogorodskiy <novel at clublife dot ru>\n  FreeBSD support\n  BMPx support\n\nRyan Twitchell <tryan2 at rochester dot rr dot com>\n  head/tail rewrite patch\n\nMikko Sysikaski <sisu at users dot sourceforge dot net>\n  prss.c and prss.h\n\nSceptik <sceptik at users dot sourceforge dot net>\n  --quiet patch\n\nSimon Lees <sflees at suse dot de>\n  lua text\n  \nStepan Zastupov <redchrom at gmail dot com>\n  WiFi signal level detection support on FreeBSD\n\nSzymon Boniecki\n  Reads current LC_TIME\n\nThomas Cort\n  CPU frequency patch for alpha\n\nToke Hiland-Jrgensen <toke at toke dot dk>\n  systemd journal support\n\nToni <bleach at users dot sourceforge dot net>\n  exec*/tail/head output evalution\n\nToni Spets hifi <toni.spets at iki dot fi>\n  OpenBSD support\n  Linux wifi code\n  RSS code (created together with Mikko Sysikaski)\n  Lua scripting\n\nTris <asto at users dot sourceforge dot net>\n  Scroll step patch\n\ntyir <tyir at users dot sourceforge dot net>\n  MPD features patch 1319461\n\nVivenzio Pagliari <vivenzio@web.de>\n  Some useful patches for port monitoring\n  PowerBook battery patch\n\nWalt Nelson <wnelsonjr at comcast dot net>\n  $freq fix\n\nWarren Dukes <warren dot dukes at gmail dot com>\n  libmpdclient\n\nwarudemaru <warudemaru at users dot sourceforge dot net>\n  rss and vsize for top\n\nwedge <wedgeant at users dot sourceforge dot net>\n  battery time fix for 2.6.24\n\nWilliam DiPlacido <bimbasaari at yahoo dot com>\n  Frequency from /proc/cpuinfo\n  Some other SETI stuff\n\nzimba-tm <zimba-tm at users dot sourceforge dot net>\n  alignment none patch\n\nzotrix <zotrix at users dot sourceforge dot net>\n  FreeBSD patch for <10 procs\n\nDaniel Beler <daniel@orgizm.net>\n  argb visual patch\n"
  },
  {
    "path": "CMakeLists.txt",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\ncmake_minimum_required(VERSION 3.17)\n\nproject(conky)\n\n# This is the directory for our custom CMake modules.\nset(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)\n\n# 'core' CMake stuff\ninclude(Conky)\n\n# Set project version, languages\nproject(conky VERSION ${RELEASE_VERSION} LANGUAGES C CXX)\n\n# Handle build options\ninclude(ConkyBuildOptions)\n\n# Do platform checks\ninclude(ConkyPlatformChecks)\n\n# CPack module for installation tasks\ninclude(ConkyCPackSetup)\n\n# Use compilation cache (if enabled)\ninclude(CCache)\n\n# setup our configuration headers\nconfigure_file(${CMAKE_MODULE_PATH}/config.h.in ${CMAKE_BINARY_DIR}/config.h)\nconfigure_file(${CMAKE_MODULE_PATH}/build.h.in ${CMAKE_BINARY_DIR}/build.h)\n\nset(conky_sources ${CMAKE_BINARY_DIR}/config.h ${CMAKE_BINARY_DIR}/build.h)\n\n# Include 3rdparty code\nadd_subdirectory(3rdparty)\nset(conky_libs ${conky_libs} toluapp_lib_static)\nset(conky_libs ${conky_libs} Vc)\nset(conky_includes ${conky_includes} \"${CMAKE_SOURCE_DIR}/3rdparty/Vc\")\n\n# Finally, add some code\nadd_subdirectory(lua)\nadd_subdirectory(data)\nadd_subdirectory(doc)\n\nif(BUILD_EXTRAS)\n  add_subdirectory(extras)\nendif(BUILD_EXTRAS)\n\nif(BUILD_TESTING)\n  if(CODE_COVERAGE)\n    # Enable coverage checks\n    include(CodeCoverage)\n    append_coverage_compiler_flags()\n  endif()\n\n  include(Catch)\nendif()\n\nadd_subdirectory(src)\n\nif(BUILD_TESTING)\n  add_subdirectory(tests)\n  enable_testing()\nendif()\n\nif(NOT DEFINED DOC_PATH)\n  set(DOC_PATH \"share/doc/${CPACK_PACKAGE_NAME}-${RELEASE_VERSION}\")\nendif(NOT DEFINED DOC_PATH)\n\nset(DOC_FILES extras/convert.lua data/conky_no_x11.conf data/conky.conf)\n\ninstall(FILES ${DOC_FILES} DESTINATION ${DOC_PATH})\n\nif(CHECK_CODE_QUALITY)\n  find_package(ClangTidy)\n  find_package(ClangFormat)\nendif(CHECK_CODE_QUALITY)\n\n# uninstall target\nif(NOT TARGET uninstall)\n  configure_file(\n    \"${CMAKE_MODULE_PATH}/UninstallConky.cmake.in\"\n    \"${CMAKE_BINARY_DIR}/cmake_uninstall.cmake\"\n    IMMEDIATE @ONLY)\n\n  add_custom_target(uninstall\n    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_BINARY_DIR}/cmake_uninstall.cmake)\nendif()\n"
  },
  {
    "path": "COPYING",
    "content": "Any original torsmo code is licensed under the BSD license (see LICENSE.BSD\nfor a copy)\n\nAll code written since the fork of torsmo is licensed under the GPL (see\nLICENSE for a copy), except where noted differently (such as in portmon and\naudacious code which are LGPL, and prss which is an MIT-style license).\n\nCopyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\nCopyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)\nAll rights reserved.\n"
  },
  {
    "path": "Dockerfile",
    "content": "FROM ubuntu:noble AS builder\n\nRUN apt-get update \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  audacious-dev \\\n  ca-certificates \\\n  clang \\\n  cmake \\\n  curl \\\n  gfortran \\\n  git \\\n  gperf \\\n  libarchive-dev \\\n  libaudclient-dev \\\n  libc++-dev \\\n  libc++abi-dev \\\n  libcairo2-dev \\\n  libcurl4-openssl-dev \\\n  libdbus-glib-1-dev \\\n  libfontconfig-dev \\\n  libfreetype-dev \\\n  libharfbuzz-dev \\\n  libical-dev \\\n  libimlib2-dev \\\n  libircclient-dev \\\n  libiw-dev \\\n  libjsoncpp-dev \\\n  liblua5.3-dev \\\n  libmicrohttpd-dev \\\n  libmysqlclient-dev \\\n  libncurses-dev \\\n  libpulse-dev \\\n  librhash-dev \\\n  librsvg2-dev \\\n  libssl-dev \\\n  libsystemd-dev \\\n  libuv1-dev \\\n  libxdamage-dev \\\n  libxext-dev \\\n  libxft-dev \\\n  libxinerama-dev \\\n  libxml2-dev \\\n  libxmmsclient-dev \\\n  libxnvctrl-dev \\\n  make \\\n  ninja-build \\\n  patch \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n\nCOPY . /conky\nWORKDIR /conky/build\n\nARG X11=yes\n\nRUN sh -c 'if [ \"$X11\" = \"yes\" ] ; then \\\n  cmake -G Ninja \\\n  -DCMAKE_C_COMPILER=clang \\\n  -DCMAKE_CXX_COMPILER=clang++ \\\n  -DCMAKE_INSTALL_PREFIX=/opt/conky \\\n  -DBUILD_AUDACIOUS=ON \\\n  -DBUILD_HTTP=ON \\\n  -DBUILD_ICAL=ON \\\n  -DBUILD_ICONV=ON \\\n  -DBUILD_IRC=ON \\\n  -DBUILD_JOURNAL=ON \\\n  -DBUILD_LUA_CAIRO=ON \\\n  -DBUILD_LUA_CAIRO_XLIB=ON \\\n  -DBUILD_LUA_IMLIB2=ON \\\n  -DBUILD_LUA_RSVG=ON \\\n  -DBUILD_LUA_TEXT=ON \\\n  -DBUILD_MYSQL=ON \\\n  -DBUILD_NVIDIA=ON \\\n  -DBUILD_PULSEAUDIO=ON \\\n  -DBUILD_RSS=ON \\\n  -DBUILD_WAYLAND=OFF \\\n  -DBUILD_WLAN=ON \\\n  -DBUILD_XMMS2=ON \\\n  ../ \\\n  ; else \\\n  cmake -G Ninja \\\n  -DCMAKE_C_COMPILER=clang \\\n  -DCMAKE_CXX_COMPILER=clang++ \\\n  -DCMAKE_INSTALL_PREFIX=/opt/conky \\\n  -DBUILD_AUDACIOUS=ON \\\n  -DBUILD_HTTP=ON \\\n  -DBUILD_ICAL=ON \\\n  -DBUILD_ICONV=ON \\\n  -DBUILD_IRC=ON \\\n  -DBUILD_JOURNAL=ON \\\n  -DBUILD_LUA_CAIRO=ON \\\n  -DBUILD_LUA_IMLIB2=ON \\\n  -DBUILD_LUA_RSVG=ON \\\n  -DBUILD_LUA_TEXT=ON \\\n  -DBUILD_MYSQL=ON \\\n  -DBUILD_PULSEAUDIO=ON \\\n  -DBUILD_RSS=ON \\\n  -DBUILD_WAYLAND=OFF \\\n  -DBUILD_WLAN=ON \\\n  -DBUILD_X11=OFF \\\n  -DBUILD_XMMS2=ON \\\n  ../ \\\n  ; fi' \\\n  && cmake --build . \\\n  && cmake --install .\n\nFROM ubuntu:noble\n\nRUN apt-get update \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  libaudclient2 \\\n  libc++1 \\\n  libc++abi1 \\\n  libcairo2 \\\n  libcurl4t64 \\\n  libdbus-glib-1-2 \\\n  libfontconfig1 \\\n  libfreetype6 \\\n  libharfbuzz-gobject0 \\\n  libical3t64 \\\n  libimlib2t64 \\\n  libircclient1 \\\n  libiw30t64 \\\n  liblua5.3-0 \\\n  libmicrohttpd12t64 \\\n  libmysqlclient21 \\\n  libncurses6 \\\n  libpulse0 \\\n  librsvg2-2 \\\n  libsm6 \\\n  libsystemd0 \\\n  libxcb-xfixes0 \\\n  libxdamage1 \\\n  libxext6 \\\n  libxfixes3 \\\n  libxft2 \\\n  libxi6 \\\n  libxinerama1 \\\n  libxml2 \\\n  libxmmsclient6 \\\n  libxnvctrl0 \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n\nCOPY --from=builder /opt/conky /opt/conky\n\nENV PATH=\"/opt/conky/bin:${PATH}\"\nENV LD_LIBRARY_PATH=\"/opt/conky/lib:${LD_LIBRARY_PATH}\"\n\nENTRYPOINT [ \"/opt/conky/bin/conky\" ]\n"
  },
  {
    "path": "LICENSE.BSD",
    "content": "*NOTICE*: This file exists for historical reasons because the original\nTorsmo and early Conky code was licensed under the BSD license. Conky\nis now licensed under GPLv3.\n\n\nCopyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\nCopyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al. (see AUTHORS)\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n    * Redistributions of source code must retain the above copyright notice,\n    * this list of conditions and the following disclaimer.\n    * Redistributions in binary form must reproduce the above copyright\n    * notice, this list of conditions and the following disclaimer in the\n    * documentation and/or other materials provided with the distribution.\n    * Neither the name of the <ORGANIZATION> nor the names of its\n    * contributors may be used to endorse or promote products derived from\n    * this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\nLIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\nCONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\nSUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\nINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\nCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\nARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\nPOSSIBILITY OF SUCH DAMAGE.\n"
  },
  {
    "path": "LICENSE.md",
    "content": "### GNU GENERAL PUBLIC LICENSE\n\nVersion 3, 29 June 2007\n\nCopyright (C) 2007 Free Software Foundation, Inc.\n<https://fsf.org/>\n\nEveryone is permitted to copy and distribute verbatim copies of this\nlicense document, but changing it is not allowed.\n\n### Preamble\n\nThe GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\nThe licenses for most software and other practical works are designed\nto take away your freedom to share and change the works. By contrast,\nthe GNU General Public License is intended to guarantee your freedom\nto share and change all versions of a program--to make sure it remains\nfree software for all its users. We, the Free Software Foundation, use\nthe GNU General Public License for most of our software; it applies\nalso to any other work released this way by its authors. You can apply\nit to your programs, too.\n\nWhen we speak of free software, we are referring to freedom, not\nprice. Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\nTo protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights. Therefore, you\nhave certain responsibilities if you distribute copies of the\nsoftware, or if you modify it: responsibilities to respect the freedom\nof others.\n\nFor example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received. You must make sure that they, too, receive\nor can get the source code. And you must show them these terms so they\nknow their rights.\n\nDevelopers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\nFor the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software. For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\nSome devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the\nmanufacturer can do so. This is fundamentally incompatible with the\naim of protecting users' freedom to change the software. The\nsystematic pattern of such abuse occurs in the area of products for\nindividuals to use, which is precisely where it is most unacceptable.\nTherefore, we have designed this version of the GPL to prohibit the\npractice for those products. If such problems arise substantially in\nother domains, we stand ready to extend this provision to those\ndomains in future versions of the GPL, as needed to protect the\nfreedom of users.\n\nFinally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish\nto avoid the special danger that patents applied to a free program\ncould make it effectively proprietary. To prevent this, the GPL\nassures that patents cannot be used to render the program non-free.\n\nThe precise terms and conditions for copying, distribution and\nmodification follow.\n\n### TERMS AND CONDITIONS\n\n#### 0. Definitions.\n\n\"This License\" refers to version 3 of the GNU General Public License.\n\n\"Copyright\" also means copyright-like laws that apply to other kinds\nof works, such as semiconductor masks.\n\n\"The Program\" refers to any copyrightable work licensed under this\nLicense. Each licensee is addressed as \"you\". \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\nTo \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of\nan exact copy. The resulting work is called a \"modified version\" of\nthe earlier work or a work \"based on\" the earlier work.\n\nA \"covered work\" means either the unmodified Program or a work based\non the Program.\n\nTo \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy. Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\nTo \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies. Mere interaction with a user\nthrough a computer network, with no transfer of a copy, is not\nconveying.\n\nAn interactive user interface displays \"Appropriate Legal Notices\" to\nthe extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License. If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n#### 1. Source Code.\n\nThe \"source code\" for a work means the preferred form of the work for\nmaking modifications to it. \"Object code\" means any non-source form of\na work.\n\nA \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\nThe \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form. A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\nThe \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities. However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work. For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\nThe Corresponding Source need not include anything that users can\nregenerate automatically from other parts of the Corresponding Source.\n\nThe Corresponding Source for a work in source code form is that same\nwork.\n\n#### 2. Basic Permissions.\n\nAll rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met. This License explicitly affirms your unlimited\npermission to run the unmodified Program. The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work. This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\nYou may make, run and propagate covered works that you do not convey,\nwithout conditions so long as your license otherwise remains in force.\nYou may convey covered works to others for the sole purpose of having\nthem make modifications exclusively for you, or provide you with\nfacilities for running those works, provided that you comply with the\nterms of this License in conveying all material for which you do not\ncontrol copyright. Those thus making or running the covered works for\nyou must do so exclusively on your behalf, under your direction and\ncontrol, on terms that prohibit them from making any copies of your\ncopyrighted material outside their relationship with you.\n\nConveying under any other circumstances is permitted solely under the\nconditions stated below. Sublicensing is not allowed; section 10 makes\nit unnecessary.\n\n#### 3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\nNo covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\nWhen you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such\ncircumvention is effected by exercising rights under this License with\nrespect to the covered work, and you disclaim any intention to limit\noperation or modification of the work as a means of enforcing, against\nthe work's users, your or third parties' legal rights to forbid\ncircumvention of technological measures.\n\n#### 4. Conveying Verbatim Copies.\n\nYou may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\nYou may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n#### 5. Conveying Modified Source Versions.\n\nYou may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these\nconditions:\n\n- a) The work must carry prominent notices stating that you modified\n  it, and giving a relevant date.\n- b) The work must carry prominent notices stating that it is\n  released under this License and any conditions added under\n  section 7. This requirement modifies the requirement in section 4\n  to \"keep intact all notices\".\n- c) You must license the entire work, as a whole, under this\n  License to anyone who comes into possession of a copy. This\n  License will therefore apply, along with any applicable section 7\n  additional terms, to the whole of the work, and all its parts,\n  regardless of how they are packaged. This License gives no\n  permission to license the work in any other way, but it does not\n  invalidate such permission if you have separately received it.\n- d) If the work has interactive user interfaces, each must display\n  Appropriate Legal Notices; however, if the Program has interactive\n  interfaces that do not display Appropriate Legal Notices, your\n  work need not make them do so.\n\nA compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit. Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n#### 6. Conveying Non-Source Forms.\n\nYou may convey a covered work in object code form under the terms of\nsections 4 and 5, provided that you also convey the machine-readable\nCorresponding Source under the terms of this License, in one of these\nways:\n\n- a) Convey the object code in, or embodied in, a physical product\n  (including a physical distribution medium), accompanied by the\n  Corresponding Source fixed on a durable physical medium\n  customarily used for software interchange.\n- b) Convey the object code in, or embodied in, a physical product\n  (including a physical distribution medium), accompanied by a\n  written offer, valid for at least three years and valid for as\n  long as you offer spare parts or customer support for that product\n  model, to give anyone who possesses the object code either (1) a\n  copy of the Corresponding Source for all the software in the\n  product that is covered by this License, on a durable physical\n  medium customarily used for software interchange, for a price no\n  more than your reasonable cost of physically performing this\n  conveying of source, or (2) access to copy the Corresponding\n  Source from a network server at no charge.\n- c) Convey individual copies of the object code with a copy of the\n  written offer to provide the Corresponding Source. This\n  alternative is allowed only occasionally and noncommercially, and\n  only if you received the object code with such an offer, in accord\n  with subsection 6b.\n- d) Convey the object code by offering access from a designated\n  place (gratis or for a charge), and offer equivalent access to the\n  Corresponding Source in the same way through the same place at no\n  further charge. You need not require recipients to copy the\n  Corresponding Source along with the object code. If the place to\n  copy the object code is a network server, the Corresponding Source\n  may be on a different server (operated by you or a third party)\n  that supports equivalent copying facilities, provided you maintain\n  clear directions next to the object code saying where to find the\n  Corresponding Source. Regardless of what server hosts the\n  Corresponding Source, you remain obligated to ensure that it is\n  available for as long as needed to satisfy these requirements.\n- e) Convey the object code using peer-to-peer transmission,\n  provided you inform other peers where the object code and\n  Corresponding Source of the work are being offered to the general\n  public at no charge under subsection 6d.\n\nA separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\nA \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal,\nfamily, or household purposes, or (2) anything designed or sold for\nincorporation into a dwelling. In determining whether a product is a\nconsumer product, doubtful cases shall be resolved in favor of\ncoverage. For a particular product received by a particular user,\n\"normally used\" refers to a typical or common use of that class of\nproduct, regardless of the status of the particular user or of the way\nin which the particular user actually uses, or expects or is expected\nto use, the product. A product is a consumer product regardless of\nwhether the product has substantial commercial, industrial or\nnon-consumer uses, unless such uses represent the only significant\nmode of use of the product.\n\n\"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to\ninstall and execute modified versions of a covered work in that User\nProduct from a modified version of its Corresponding Source. The\ninformation must suffice to ensure that the continued functioning of\nthe modified object code is in no case prevented or interfered with\nsolely because modification has been made.\n\nIf you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information. But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\nThe requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or\nupdates for a work that has been modified or installed by the\nrecipient, or for the User Product in which it has been modified or\ninstalled. Access to a network may be denied when the modification\nitself materially and adversely affects the operation of the network\nor violates the rules and protocols for communication across the\nnetwork.\n\nCorresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n#### 7. Additional Terms.\n\n\"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law. If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\nWhen you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit. (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.) You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\nNotwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders\nof that material) supplement the terms of this License with terms:\n\n- a) Disclaiming warranty or limiting liability differently from the\n  terms of sections 15 and 16 of this License; or\n- b) Requiring preservation of specified reasonable legal notices or\n  author attributions in that material or in the Appropriate Legal\n  Notices displayed by works containing it; or\n- c) Prohibiting misrepresentation of the origin of that material,\n  or requiring that modified versions of such material be marked in\n  reasonable ways as different from the original version; or\n- d) Limiting the use for publicity purposes of names of licensors\n  or authors of the material; or\n- e) Declining to grant rights under trademark law for use of some\n  trade names, trademarks, or service marks; or\n- f) Requiring indemnification of licensors and authors of that\n  material by anyone who conveys the material (or modified versions\n  of it) with contractual assumptions of liability to the recipient,\n  for any liability that these contractual assumptions directly\n  impose on those licensors and authors.\n\nAll other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10. If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term. If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\nIf you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\nAdditional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions; the\nabove requirements apply either way.\n\n#### 8. Termination.\n\nYou may not propagate or modify a covered work except as expressly\nprovided under this License. Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\nHowever, if you cease all violation of this License, then your license\nfrom a particular copyright holder is reinstated (a) provisionally,\nunless and until the copyright holder explicitly and finally\nterminates your license, and (b) permanently, if the copyright holder\nfails to notify you of the violation by some reasonable means prior to\n60 days after the cessation.\n\nMoreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\nTermination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License. If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n#### 9. Acceptance Not Required for Having Copies.\n\nYou are not required to accept this License in order to receive or run\na copy of the Program. Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance. However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work. These actions infringe copyright if you do\nnot accept this License. Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n#### 10. Automatic Licensing of Downstream Recipients.\n\nEach time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License. You are not responsible\nfor enforcing compliance by third parties with this License.\n\nAn \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations. If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\nYou may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License. For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n#### 11. Patents.\n\nA \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based. The\nwork thus licensed is called the contributor's \"contributor version\".\n\nA contributor's \"essential patent claims\" are all patent claims owned\nor controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version. For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\nEach contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\nIn the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement). To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\nIf you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients. \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\nIf, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\nA patent license is \"discriminatory\" if it does not include within the\nscope of its coverage, prohibits the exercise of, or is conditioned on\nthe non-exercise of one or more of the rights that are specifically\ngranted under this License. You may not convey a covered work if you\nare a party to an arrangement with a third party that is in the\nbusiness of distributing software, under which you make payment to the\nthird party based on the extent of your activity of conveying the\nwork, and under which the third party grants, to any of the parties\nwho would receive the covered work from you, a discriminatory patent\nlicense (a) in connection with copies of the covered work conveyed by\nyou (or copies made from those copies), or (b) primarily for and in\nconnection with specific products or compilations that contain the\ncovered work, unless you entered into that arrangement, or that patent\nlicense was granted, prior to 28 March 2007.\n\nNothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n#### 12. No Surrender of Others' Freedom.\n\nIf conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License. If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under\nthis License and any other pertinent obligations, then as a\nconsequence you may not convey it at all. For example, if you agree to\nterms that obligate you to collect a royalty for further conveying\nfrom those to whom you convey the Program, the only way you could\nsatisfy both those terms and this License would be to refrain entirely\nfrom conveying the Program.\n\n#### 13. Use with the GNU Affero General Public License.\n\nNotwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work. The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n#### 14. Revised Versions of this License.\n\nThe Free Software Foundation may publish revised and/or new versions\nof the GNU General Public License from time to time. Such new versions\nwill be similar in spirit to the present version, but may differ in\ndetail to address new problems or concerns.\n\nEach version is given a distinguishing version number. If the Program\nspecifies that a certain numbered version of the GNU General Public\nLicense \"or any later version\" applies to it, you have the option of\nfollowing the terms and conditions either of that numbered version or\nof any later version published by the Free Software Foundation. If the\nProgram does not specify a version number of the GNU General Public\nLicense, you may choose any version ever published by the Free\nSoftware Foundation.\n\nIf the Program specifies that a proxy can decide which future versions\nof the GNU General Public License can be used, that proxy's public\nstatement of acceptance of a version permanently authorizes you to\nchoose that version for the Program.\n\nLater license versions may give you additional or different\npermissions. However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n#### 15. Disclaimer of Warranty.\n\nTHERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT\nWARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\nA PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND\nPERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE\nDEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR\nCORRECTION.\n\n#### 16. Limitation of Liability.\n\nIN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR\nCONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\nINCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES\nARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT\nNOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR\nLOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM\nTO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER\nPARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\n\n#### 17. Interpretation of Sections 15 and 16.\n\nIf the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\nEND OF TERMS AND CONDITIONS\n\n### How to Apply These Terms to Your New Programs\n\nIf you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these\nterms.\n\nTo do so, attach the following notices to the program. It is safest to\nattach them to the start of each source file to most effectively state\nthe exclusion of warranty; and each file should have at least the\n\"copyright\" line and a pointer to where the full notice is found.\n\n        <one line to give the program's name and a brief idea of what it does.>\n        Copyright (C) <year>  <name of author>\n\n        This program is free software: you can redistribute it and/or modify\n        it under the terms of the GNU General Public License as published by\n        the Free Software Foundation, either version 3 of the License, or\n        (at your option) any later version.\n\n        This program is distributed in the hope that it will be useful,\n        but WITHOUT ANY WARRANTY; without even the implied warranty of\n        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n        GNU General Public License for more details.\n\n        You should have received a copy of the GNU General Public License\n        along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper\nmail.\n\nIf the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n        <program>  Copyright (C) <year>  <name of author>\n        This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n        This is free software, and you are welcome to redistribute it\n        under certain conditions; type `show c' for details.\n\nThe hypothetical commands \\`show w' and \\`show c' should show the\nappropriate parts of the General Public License. Of course, your\nprogram's commands might be different; for a GUI interface, you would\nuse an \"about box\".\n\nYou should also get your employer (if you work as a programmer) or\nschool, if any, to sign a \"copyright disclaimer\" for the program, if\nnecessary. For more information on this, and how to apply and follow\nthe GNU GPL, see <https://www.gnu.org/licenses/>.\n\nThe GNU General Public License does not permit incorporating your\nprogram into proprietary programs. If your program is a subroutine\nlibrary, you may consider it more useful to permit linking proprietary\napplications with the library. If this is what you want to do, use the\nGNU Lesser General Public License instead of this License. But first,\nplease read <https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.cmake",
    "content": "Hello, there.\n\nUsing CMake to build Conky is pretty easy, and here is how I do it:\n\n1. From the top level source dir, create a build working dir, and cd into it\n  $ mkdir build\n  $ cd build\n2. Run the cmake configuration process\n  $ cmake ../ # pass the path to the sources to cmake\n  OR\n  $ ccmake ../ # you can also use the fance curses interface, or try cmake-gui\n3. Compile as usual, and enjoy the out-of-source goodness\n  $ make\n  # make install # if you want\n\nThere are a number of build options for Conky, and the best way to discover\nthem is to use the ccmake (or cmake-gui) CMake tool for browsing them.\n\nCertain Conky build time features (such as doc generation) require third-party\napplications, which you should be notified of via CMake.  In the case of doc\ngeneration, you'll need the docbook2X package (available on most\ndistributions).\n"
  },
  {
    "path": "README.md",
    "content": "[![Linux build](https://github.com/brndnmtthws/conky/actions/workflows/build-and-test-linux.yaml/badge.svg)](https://github.com/brndnmtthws/conky/actions/workflows/build-and-test-linux.yaml) [![macOS build](https://github.com/brndnmtthws/conky/actions/workflows/build-and-test-macos.yaml/badge.svg)](https://github.com/brndnmtthws/conky/actions/workflows/build-and-test-macos.yaml) [![Docker build](https://github.com/brndnmtthws/conky/actions/workflows/docker.yaml/badge.svg)](https://github.com/brndnmtthws/conky/actions/workflows/docker.yaml) [![AppImage build](https://github.com/brndnmtthws/conky/actions/workflows/publish-appimage.yml/badge.svg)](https://github.com/brndnmtthws/conky/actions/workflows/publish-appimage.yml)\n\n[📕 Documentaton](https://conky.cc/)\n\n[💬 Join the Matrix chat](https://matrix.to/#/#conky:frens.io)\n\n<p align=\"center\"><img width=\"300\" src=\"data/logo/conky-logotype-horizontal-violet.png\"></p>\n\n**Conky** is a free, light-weight system monitor for X, that displays\nany kind of information on your desktop. It can also run on Wayland (with caveats), macOS, output\nto your console, a file, or even HTTP (oh my!).\n\n👉 Grab the [latest release from GitHub](https://github.com/brndnmtthws/conky/releases/latest).\n\n[📹 An introduction to Conky (YouTube)](https://www.youtube.com/watch?v=bHtpLEoRKmg&t=19s).\n\n## Features\n\nConky can display more than 300 built-in objects, including support for:\n\n- A plethora of OS stats (uname, uptime, **CPU usage**, **mem\n  usage**, disk usage, **\"top\"** like process stats, and **network\n  monitoring**, just to name a few).\n- Built-in **IMAP** and **POP3** support.\n- Built-in support for many popular music players ([MPD][],\n  [XMMS2][], [Audacious][]).\n- Can be extended using built-in [**Lua**][luawiki] support, or any of your\n  own scripts and programs ([more](https://github.com/brndnmtthws/conky/wiki#tutorial)).\n- Built-in [**Imlib2**][imlib2] and [**Cairo**][cairo] bindings for arbitrary drawing\n  with Lua ([more](https://github.com/brndnmtthws/conky/wiki/Lua)).\n- Runs on Linux, FreeBSD, OpenBSD, DragonFlyBSD, NetBSD, Solaris, Haiku, and macOS!\n- [Docker image](https://hub.docker.com/r/brndnmtthws/conky/) available for amd64, armv7, and aarch64 (aka armv8)\n\n... and much much more.\n\nConky can display information either as text, or using simple progress bars and\ngraph widgets, with different fonts and colours, as well as handle [mouse events](https://github.com/brndnmtthws/conky/wiki/Mouse-Events).\n\n## Screenshots\n\n[![screenshot](https://github.com/brndnmtthws/conky/wiki/configs/brenden/screenshot-thumb.png)](https://raw.github.com/wiki/brndnmtthws/conky/configs/brenden/screenshot.png)\n[![screenshot](https://github.com/brndnmtthws/conky/wiki/configs/ke49/screenshot-thumb.png)](https://raw.github.com/wiki/brndnmtthws/conky/configs/ke49/screenshot.png)\n[![screenshot](https://github.com/brndnmtthws/conky/wiki/configs/jc/screenshot-thumb.png)](https://raw.github.com/wiki/brndnmtthws/conky/configs/jc/screenshot.png)\n\nSee the User Configs below for more screenshots and associated config files.\n\n## Installing Conky\n\nMany package managers already include Conky. However, if you'd like to try the\nlatest version of Conky, you can use the AppImage or the Nix flake.\n\n### AppImage\n\nTo try the AppImage, head to\n<https://github.com/brndnmtthws/conky/releases/latest> and fetch the latest\nAppImage. You'll need to set the executable bit, then you can create a conkyrc,\nand run it as follows:\n\n```ShellSession\nchmod +x ./conky-*.AppImage        # make it executable\n./conky-*.AppImage -C > ~/.conkyrc # create a default config\n./conky-*.AppImage                 # run\n```\n\nAnd that's it! [Check out the Wiki](https://github.com/brndnmtthws/conky/wiki) for more details on configuring Conky.\n\n_NOTE_: To use the AppImage, you may need to install additional runtime libraries.\n\n### Nix flake\n\nAs of Conky v1.17.0, there's a Nix flake available in addition to the upstream\nNix package. You can include it as an input as follows:\n\n```nix\n{\n  inputs = {\n    conky.url = \"github:brndnmtthws/conky\";\n  };\n}\n```\n\nAnd use `inputs.conky.packages.${system}.default` (or\n`inputs.conky.packages.${system}.conky` for versions <=v1.19.8) to include the\npackage. To use a specific version, add the git tag to the URL, such as\n`github:brndnmtthws/conky?ref=refs/tags/v1.19.8`.\n\nNote that a Nix package [exists in\nnixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/os-specific/linux/conky/default.nix), and\nalthough it's not always up-to-date with the bleeding edge, it does offer more configuration options.\n\n## Documentation\n\n&rarr; [**Reference documentation**](https://conky.cc/) &larr;\n\nThe [Conky Wiki](https://github.com/brndnmtthws/conky/wiki) also serves as a central hub for\nConky. Some resources from the Wiki include:\n\n- [Installation](https://github.com/brndnmtthws/conky/wiki/Installation)\n- [Configuration Settings](https://github.com/brndnmtthws/conky/wiki/Configurations)\n- [Community Configs](https://github.com/brndnmtthws/conky/wiki/Community-Configurations)\n- [Frequently Asked Questions](https://github.com/brndnmtthws/conky/wiki/FAQ)\n\n## License\n\nConky is licensed under the terms of the [GPLv3](LICENSE) license.\n\n## Contributing\n\nContributions are welcome from anyone.\n\nPlease read [Contributing](https://github.com/brndnmtthws/conky/wiki/Contributing) page on wiki for guidelines on contributing to Conky.\n\n[mpd]: https://musicpd.org/\n[xmms2]: https://github.com/xmms2/wiki/wiki\n[audacious]: https://audacious-media-player.org/\n[luawiki]: https://en.wikipedia.org/wiki/Lua_%28programming_language%29\n[imlib2]: https://docs.enlightenment.org/api/imlib2/html/\n[cairo]: https://www.cairographics.org/\n\n## Supporting this project\n\nConky exists only through the hard work of a collection of volunteers. Please\nconsider sponsoring the project's developers if you get value out of Conky.\n\n## Stargazers over time\n\n[![Stargazers over time](https://starchart.cc/brndnmtthws/conky.svg)](https://starchart.cc/brndnmtthws/conky)\n"
  },
  {
    "path": "appimage/build.sh",
    "content": "#!/bin/bash\n\nset -e\nset -x\n\nMODE=Release\nif [ \"$1\" == \"--debug\" ]; then\n    MODE=Debug\n    export NO_STRIP=1 # disable strip in linuxdeploy\nfi\n\n# building in temporary directory to keep system clean\n# use RAM disk if possible (as in: not building on CI system like Travis, and RAM disk is available)\nif [ \"$CI\" == \"\" ] && [ -d /dev/shm ]; then\n    TEMP_BASE=/dev/shm\nelse\n    TEMP_BASE=/tmp\nfi\n\nBUILD_DIR=$(mktemp -d -p \"$TEMP_BASE\" AppImageLauncher-build-XXXXXX)\n\n# make sure to clean up build dir, even if errors occur\ncleanup () {\n    if [ -d \"$BUILD_DIR\" ]; then\n        rm -rf \"$BUILD_DIR\"\n    fi\n}\ntrap cleanup EXIT\n\n# store repo root as variable\nREPO_ROOT=$(readlink -f $(dirname $(dirname $0)))\nOLD_CWD=$(readlink -f .)\n\n# check if we have a recent enough version of librsvg\nif pkg-config --atleast-version 2.60 librsvg-2.0; then\n  ENABLE_RSVG=ON\nelse\n  ENABLE_RSVG=OFF\nfi\n\n# switch to build dir\npushd \"$BUILD_DIR\"\n\n# configure build files with cmake\n# we need to explicitly set the install prefix, as CMake's default is /usr/local for some reason...\ncmake -G Ninja                         \\\n  -DCMAKE_BUILD_TYPE=$MODE             \\\n  -DRELEASE=$RELEASE                   \\\n  -DBUILD_AUDACIOUS=ON                 \\\n  -DBUILD_DOCS=ON                      \\\n  -DBUILD_HTTP=ON                      \\\n  -DBUILD_ICAL=ON                      \\\n  -DBUILD_ICONV=ON                     \\\n  -DBUILD_IRC=ON                       \\\n  -DBUILD_JOURNAL=ON                   \\\n  -DBUILD_LUA_CAIRO=ON                 \\\n  -DBUILD_LUA_IMLIB2=ON                \\\n  -DBUILD_LUA_RSVG=${ENABLE_RSVG}      \\\n  -DBUILD_LUA_TEXT=ON                  \\\n  -DBUILD_MYSQL=ON                     \\\n  -DBUILD_NVIDIA=ON                    \\\n  -DBUILD_PULSEAUDIO=ON                \\\n  -DBUILD_RSS=ON                       \\\n  -DBUILD_CURL=ON                      \\\n  -DBUILD_WAYLAND=ON                   \\\n  -DBUILD_WLAN=ON                      \\\n  -DBUILD_X11=ON                       \\\n  -DBUILD_XMMS2=ON                     \\\n  -DCMAKE_INSTALL_PREFIX=./AppDir/usr  \\\n  \"$REPO_ROOT\"\n\n# build project and install files into AppDir\ncmake --build .\ncmake --install .\n\nwget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage\n\n# make them executable\nchmod +x linuxdeploy-x86_64.AppImage\n\n./linuxdeploy-x86_64.AppImage \\\n  --appdir AppDir \\\n  -e AppDir/usr/bin/conky \\\n  -i AppDir/usr/share/icons/hicolor/scalable/apps/conky-logomark-violet.svg \\\n  -d AppDir/usr/share/applications/conky.desktop\n\nwget https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage\n\nchmod +x appimagetool-x86_64.AppImage\n\nGPG_KEY=C793F1BA\nif gpg --list-keys ${GPG_KEY}; then\n  ./appimagetool-x86_64.AppImage AppDir --sign --sign-key ${GPG_KEY}\nelse\n  ./appimagetool-x86_64.AppImage AppDir\nfi\n\nfor f in conky*.AppImage\ndo\n  sha256sum $f > $f.sha256\ndone\n\nmv conky*.AppImage* \"$OLD_CWD\"\n\n# gzip & copy the man page, which will be attached to releases\ngzip doc/conky.1\nmv doc/conky.1.gz \"$OLD_CWD\"\n"
  },
  {
    "path": "appimage/pubkey.asc",
    "content": "-----BEGIN PGP PUBLIC KEY BLOCK-----\n\nmQINBGXgj44BEACXMoNE9rLCORCNgVCfVp7gdI8e+LFVdXwR/SgOH+Kr1IZDWmP+\nG0ILJlfk0NsW4dmIhcbsa9sSFLiOLRuFeMNWuFMyLqk2rhD4ij9tbWofPH1kNykj\nit7DoaEIhvBhbwWxXmMgyZ5is07IpixQxKfhB9kxIGIAk5/fV00IeNQda1uobhOR\nJCw0yI62GJDAQzUl2P2n4jHIODPdgsP6oFSOnUB7b2mikkS6ZwSUcYlk+ZXq+jyc\na1t2STvML+5SMeL9a8XLgIJAR6WmyiA7PHdqJIc7Haa0rVYhb4z1Wsxh8/SU+jIe\nRLuI4i7Al1sBuNLtN9wWLY4rs/gjB1/+hmjXqnrzSvX2eclihbwiFjBYL2OLKfwe\njjNi/prytiZ8KhJ0HXNFXOZxdrVZycaxTKnOTh4kronf0FTjF2ggI0/bzMpVYlKq\nZJMyKIGe/sOfqhhGob846tx2GWil64dGjohrUMFhOjhsI+7fhrldKbNgGPFikKWb\n9FRlW11+fz3ToP8JPj6StjnUs+GBXIKhKsLO1okSE+q3lTOedlbdHPxHR0aeBigl\ndEKgUgiLlxC4b5VfGLPvCPzEHLgOH/lh+tXcE+ttMnHcrMYuPdwIJDhnXgwAK1hB\nKh8QEumrCVZFCqxfwi49L4fHTbLPIFVXMoJATj1JeR6lQzVkAnVxSCJOcwARAQAB\ntCljb25reS1kZXBsb3kta2V5IDxicmVuZGVuK2Nvbmt5QGJybmRuLmlvPokCVAQT\nAQoAPhYhBIybd+IdXHfl9cnw963SmZDHk/G6BQJl4I+OAhsDBQkHhh9qBQsJCAcD\nBRUKCQgLBRYCAwEAAh4BAheAAAoJEK3SmZDHk/G6knkP/3a6R9ti0CYyVNCrQpb9\nQsaVD77y57ORuUOP3lQhiqkbnnin8oYMt1ZEoRhTlIOjbNJZjFJU53G34cXKccaO\nG0w/iBCQE4YRQ7B0FfhnjTEeV6iHYjoWdvg4v3Wy+YLk1GC78S68x8rURcdKXZdC\npTt6/Z2Q9jPyc45LksTPvVu20HPY0RfAjpSYf6sPd6QzP8OBuYFFSMFmUNyGfUnn\n6iBT2WOGTRYh3NPHnFvUuYTMcbm/Asr/nqGmQNzcYMPFPgXzAttvg55xwn0iZHM7\nfBTslWvv8VRFq4l96YWudg6BUC4rYMh2g/AGiUCXNeYD1UmCbU9hRfXIKz0elI6P\nV6V7wRhjgOm5RNXJC8phhjV7pDwin087L6eaauiqkGR7uFoGfDcNJ10mp+hbh3EI\nEETubeUvtSzoKHw+vbjMQDXyybME3LZoJy4RMOF0gy/NQdDVgEal8by1Wl1pJ4h2\nBlDX0kvs4MeDbkSPDez1RUbdnMP3q6e6/2SWq6BKUY3H2nKeYa6wtEY3c/HtXkW2\nHiwc0+WefC1xKoA7+SS8Ds77CojVoPHBMEmT2mKDuXRgvPrHs9l3oIuY3dp8rndD\nswMeMlgeHNLywijZ0iUWc34y0v+X+klh/r4Bs96AGm49Puq1CHmYH5gAfJcpeYwY\nABn3u9cbhltAo1vvc13hag46uQINBGXgj44BEADTsJ+rtCi08ie3EcsfZq7AHXdf\nO/mPZE8L/1gOkc+8DhdxyKzUM3MM6kapgaoWzS5Vt4DuNIMSZdr+u5Qynf1TaNI0\naq5g7KqGKwNGi491dnsXV10YrglEvCOzmEO8Lb3XAqao8zWBoSNXYIke4r6jmLUI\n2UU0n6v4hrhMcJaf/3VI+fmAzdek7VOg0uHrce/JM6REn5cpwrY3PLfIddpYJ8qt\nWyRUfdgPxerlzyFKyfpv6FO8qDWsSHi9PsEwgWgbuN+L7mrgma5NpQjsZ4ydOhst\nxIobQ7Lm6x9T1Tk0ACljAlePzywIXC1n0Mrj25YetxHTaA9Dh53jiTTi5ZiW8Wi5\nORHOSjVukMP9qfpEEEJEXlQErwzRdWIGYjKDPH7D2c0p1W5X1C5uf03+BlsRZb4z\nomGna+HfnYyduAmY33BlIOnI5xKVAHdYMYYguLqXPhVTRCbk+aQsgWkXSzVf6nEX\nLGlsNDgI7EjPJ1wl6ZG5IM0nxOE2SatTfBG/rJfpDfoxAbjTzeDjZ8iYXItOozLe\n2ivsVSJ+CN5DsIxGrxO1SQH6Sd9T109AClOqgNqJz2CLG9Tuq/VQCFmuQbYw0Ui5\n2R3pQXnsAvsuo260CULyq3AfIvmylcyfq5M4xYP6iyQEs1EuuJQB6yNocBjqNNPv\n5zrtVJsIuczYTZItaQARAQABiQI8BBgBCgAmFiEEjJt34h1cd+X1yfD3rdKZkMeT\n8boFAmXgj44CGwwFCQeGH2oACgkQrdKZkMeT8bo84xAAkfSZSyx2z0jOE9iRf407\nqazf9eeD5rBQgfv24xyfEW+b2mJ46qTta5J3RiZy+5VOKCp/rp8yR2vvctnp/hKT\nARoP+/4Pr9Zgi58l11JE5xi2lm5qRW51wGnXv6ZU+XAfuslfNx5GuoN2FpayS4eu\nAMdVOsxF3n/LHABEvmmbahgY4uFhr7FzoZZtPkkeT4tgYbaxwhogXcujSRQ99E6w\ny9qxnlPc4cg698eY3rAfXBzPOZ1zkmANTp0pdTjNMGClexI1YjyVZscNI0IJQ9ys\n+O7HSmjSYS36RN+ZAsuS8CZXjLtWaFkecJLq8M5ms7ApsKVH2IcWFGaY9z5d7Lbl\ni2sFmZnRw5UTvgzRDsfFDjkIP6EA1qUy41q5VC8Km9VINUQDIRCgCsAtRl88S98S\nW1vI/v740dchFbkZOpEOfEPEMO2hc4K4cZ6Sw/JrUp2fNFXOiH6KPlsXnMkD+MOH\nT8tqmxJhPao9Gi1meKkZTPgjpIelIR5LIcMjM+5MGhufdb57EW/w49uqnN082aBx\nWCnX/KNC+x1pUjrQtEiBs7kwDmFMxnfpJdLFoSZfyAlbQmnkuI+y8d4TDPnA2mEj\nAJhJgucqgsXEGKnf4pP2/mPr824hyJwcvtBFlI1BM8++/jsTxtQnh5Lfy6Iy+QZI\nwx+HXxpgEVCG2W1Ljb31o5E=\n=w9c/\n-----END PGP PUBLIC KEY BLOCK-----\n"
  },
  {
    "path": "bin/changelog2html.py",
    "content": "#!/usr/bin/env python\n\nimport sys\n\nif len(sys.argv) <= 1:\n  print >> sys.stderr, \"Usage: ./changelog2html.py [changelog file]\"\n  sys.exit(1)\n\nf = sys.argv[1]\n\nblah = 0\n\nprint '<html><head><meta http-equiv=\"content-type\" content=\"text/html;charset=utf-8\" /></head><body>'\n\nfor i in open(f).read().splitlines():\n  # ignore empty lines\n\n  if i and i[0].isspace():\n    if not '*' in i:\n      print '      ' + i.strip()\n    else:\n      s = i.split('*', 1)[1].strip()\n      print '  <li>' + s.replace('<', '&lt;').replace('>', '&gt;')\n  else:\n    if blah:\n      print '</ul>'\n    print '<h3>%s</h3>' % i.strip()\n    print '<ul>'\n    blah = 1\n\nif blah:\n  print '</ul>'\n\nprint '</html></body>'\n"
  },
  {
    "path": "bin/check-style.sh",
    "content": "#!/bin/bash\nset -euxo pipefail\n\nDIR=\"$( dirname \"${BASH_SOURCE[0]}\" )\"\n# Run clang-tidy only for the lines of code which have changed.\ngit diff -U0 $TRAVIS_COMMIT_RANGE | \\\n  $DIR/clang-tidy-diff.py -p1 \\\n    -checks=*,-clang-analyzer-alpha.* \\\n    -quiet \\\n    -- \\\n    -warnings-as-errors=*,-clang-analyzer-alpha.* \\\n    -format-style='{BasedOnStyle: google, IndentWidth: 2}'\n"
  },
  {
    "path": "bin/check_docs.py",
    "content": "#!/usr/bin/python\n#\n# This script will check the documentation consistency against the code.  It\n# doesn't check the actual accuracy of the documentation, it just ensures that\n# everything is documented and that nothing which doesn't exist in Conky\n# appears in the documentation.\n#\n# This script also updates the vim and nano syntax files so it doesn't have to\n# be done manually.\n#\n# Requires the ElementTree Python module for the sorting stuff, see:\n# http://effbot.org/zone/element-index.htm\n#\n# You should also install htmltidy, but it's not necessary.\n#\n\nimport os.path\nimport re\nimport sys\nimport mmap\nfrom datetime import *\n\nfile_names = dict()\nfile_names[\"text_objects\"]    = \"src/text_object.h\"\nfile_names[\"conky\"]           = \"src/conky.c\"\nfile_names[\"vim_syntax\"]      = \"extras/vim/syntax/conkyrc.vim\"\nfile_names[\"nano_syntax\"]     = \"extras/nano/conky.nanorc\"\nfile_names[\"variables\"]       = \"doc/variables.xml\"\nfile_names[\"config_settings\"] = \"doc/config_settings.xml\"\nfile_names[\"lua\"]             = \"doc/lua.xml\"\nfile_names[\"docs\"]            = \"doc/docs.xml\"\nfile_names[\"command_options\"] = \"doc/command_options.xml\"\n\nfor fn in file_names.values():\n\tif not os.path.exists(fn) or not os.path.isfile(fn):\n\t\tprint \"'%s' doesn't exist, or isn't a file\" % (fn)\n\t\texit(1)\n\nprint 'sorting/tidying docs...'\n\n# sort the docs by variable/config setting\nimport string\nimport xml.etree.ElementTree as ET\n\nvars_xml = ET.parse(file_names['variables'])\nconfig_xml = ET.parse(file_names['config_settings'])\n\ngetkey = lambda x: x.findtext('term/command/option')\n\nvars = vars_xml.getroot()\nvars[:] = sorted(vars, key=getkey)\n\nconfigs = config_xml.getroot()\nconfigs[:] = sorted(configs, key=getkey)\n\nvars_xml.write(file_names['variables'])\nconfig_xml.write(file_names['config_settings'])\n\ndef tidy(file):\n\tcommand = ['tidy', '-qim', '-xml', '-utf8', '--indent-spaces', '4']\n\tos.system('%s %s 2>/dev/null' % (string.join(command), file))\n\ntidy(file_names['variables'])\ntidy(file_names['config_settings'])\ntidy(file_names['lua'])\ntidy(file_names['command_options'])\n\n#\n# Do all the objects first\n#\n\nobjects = []\n\nfile = open(file_names[\"text_objects\"], \"r\")\nexp = re.compile(\"\\s*OBJ_(\\w*).*\")\nwhile file:\n\tline = file.readline()\n\tif len(line) == 0:\n\t\tbreak\n\tres = exp.match(line)\n\tif res:\n\t\tobj = res.group(1)\n\t\tif not re.match(\"color\\d\", obj) and obj != \"text\":\n\t\t\t# ignore colourN stuff\n\t\t\tobjects.append(res.group(1))\nfile.close()\nprint 'counted %i text objects' % len(objects)\n\ndoc_objects = []\nexp = re.compile(\"\\s*<command><option>(\\w*)</option></command>.*\")\nprint \"checking docs -> objs consistency (in %s)\" % (file_names[\"text_objects\"])\nfor var in vars:\n\tterm = getkey(var)\n\tdoc_objects.append(term)\n\tif ['templaten', 'colorn'].count(doc_objects[len(doc_objects) - 1].lower()):\n\t\t# ignore these\n\t\tcontinue\n\tif doc_objects[len(doc_objects) - 1] not in objects:\n\t\tprint \"   '%s' is documented, but doesn't seem to be an object\" % (doc_objects[len(doc_objects) - 1])\nprint \"done\\n\"\n\nprint \"checking objs -> docs consistency (in %s)\" % (file_names[\"variables\"])\nfor obj in objects:\n\tif obj not in doc_objects:\n\t\tprint \"   '%s' seems to be undocumented\" % (obj)\nprint \"done\\n\"\n\n#\n# Now we'll do config settings\n#\n\nconfig_entries = []\n\nfile = open(file_names[\"conky\"], \"r\")\nexp1 = re.compile('\\s*CONF\\(\"(\\w*)\".*')\nexp2 = re.compile('\\s*CONF2\\(\"(\\w*)\".*')\nexp3 = re.compile('\\s*CONF3\\(\"(\\w*)\".*')\nwhile file:\n\tline = file.readline()\n\tif len(line) == 0:\n\t\tbreak\n\tres = exp1.match(line)\n\tif not res:\n\t\tres = exp2.match(line)\n\tif not res:\n\t\tres = exp3.match(line)\n\tif res:\n\t\tconf = res.group(1)\n\t\tif re.match(\"color\\d\", conf):\n\t\t\tconf = \"colorN\"\n\t\tif config_entries.count(conf) == 0:\n\t\t\tconfig_entries.append(conf)\nfile.close()\nprint 'counted %i config settings' % len(config_entries)\n\ndoc_configs = []\nprint \"checking docs -> configs consistency (in %s)\" % (file_names[\"conky\"])\nfor config in configs:\n\tterm = getkey(config)\n\tdoc_configs.append(term)\n\tif ['text', 'templaten'].count(doc_configs[len(doc_configs) - 1].lower()):\n\t\t# ignore these\n\t\tcontinue\n\tif doc_configs[len(doc_configs) - 1] not in config_entries:\n\t\tprint \"   '%s' is documented, but doesn't seem to be a config setting\" % (doc_configs[len(doc_configs) - 1])\nprint \"done\\n\"\n\nprint \"checking configs -> docs consistency (in %s)\" % (file_names[\"config_settings\"])\nfor obj in config_entries:\n\tif obj != \"text\" and obj != \"template\" and obj not in doc_configs:\n\t\tprint \"   '%s' seems to be undocumented\" % (obj)\nprint \"done\\n\"\n\n\n\n# Cheat and add the colour/template stuff.\n\nfor i in range(0, 10):\n\tobjects.append(\"color\" + str(i))\n\tconfig_entries.append(\"color\" + str(i))\n\tobjects.append(\"template\" + str(i))\n\tconfig_entries.append(\"template\" + str(i))\n\n# Finally, sort everything.\nobjects.sort()\nconfig_entries.sort()\n\n#\n# Update nano syntax stuff\n#\n\nprint \"updating nano syntax...\",\nsys.stdout.flush()\nfile = open(file_names[\"nano_syntax\"], \"rw+\")\nlines = []\nwhile file:\n\tline = file.readline()\n\tif len(line) == 0:\n\t\tbreak\n\tlines.append(line)\n\n# find the line we want to update\nfor line in lines:\n\tif re.match(\"color green \", line):\n\t\tidx = lines.index(line)\n\t\tlines.pop(idx) # remove old line\n\t\tline = 'color green \"\\<('\n\t\tfor obj in config_entries:\n\t\t\tline += \"%s|\" % (obj)\n\t\tline = line[:len(line) - 1]\n\t\tline += ')\\>\"\\n'\n\t\tlines.insert(idx, line)\n\tif re.match(\"color brightblue \", line):\n\t\tidx = lines.index(line)\n\t\tlines.pop(idx) # remove old line\n\t\tline = 'color brightblue \"\\<('\n\t\tfor obj in objects:\n\t\t\tline += \"%s|\" % (obj)\n\t\tline = line[:len(line) - 1]\n\t\tline += ')\\>\"\\n'\n\t\tlines.insert(idx, line)\n\t\tbreak # want to ignore everything after this line\nfile.truncate(0)\nfile.seek(0)\nfile.writelines(lines)\nfile.close()\nprint \"done.\"\n\n#\n# Update vim syntax stuff\n#\n\nprint \"updating vim syntax...\",\nsys.stdout.flush()\nfile = open(file_names[\"vim_syntax\"], \"rw+\")\nlines = []\nwhile file:\n\tline = file.readline()\n\tif len(line) == 0:\n\t\tbreak\n\tlines.append(line)\n\n# find the line we want to update\nfor line in lines:\n\tif re.match(\"syn keyword ConkyrcSetting \", line):\n\t\tidx = lines.index(line)\n\t\tlines.pop(idx) # remove old line\n\t\tline = 'syn keyword ConkyrcSetting '\n\t\tfor obj in config_entries:\n\t\t\tline += \"%s \" % (obj)\n\t\tline = line[:len(line) - 1]\n\t\tline += '\\n'\n\t\tlines.insert(idx, line)\n\tif re.match(\"syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite \", line):\n\t\tidx = lines.index(line)\n\t\tlines.pop(idx) # remove old line\n\t\tline = 'syn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite '\n\t\tfor obj in objects:\n\t\t\tline += \"%s \" % (obj)\n\t\tline = line[:len(line) - 1]\n\t\tline += '\\n'\n\t\tlines.insert(idx, line)\n\t\tbreak # want to ignore everything after this line\nfile.truncate(0)\nfile.seek(0)\nfile.writelines(lines)\nfile.close()\n\n# lastly, update the date in docs.xml\nfile = open(file_names[\"docs\"], 'r+')\nmap = mmap.mmap(file.fileno(), os.path.getsize(file_names[\"docs\"]))\nd = map.find(\"<date>\")\nd += 6 # skip over first date stuff\nmap[d:d+10] = datetime.now().strftime(\"%F\")\nmap.close()\nfile.close()\n\nprint \"done.\"\n"
  },
  {
    "path": "bin/clang-tidy-diff.py",
    "content": "#!/usr/bin/env python3\n#\n#===- clang-tidy-diff.py - ClangTidy Diff Checker ------------*- python -*--===#\n#\n#                     The LLVM Compiler Infrastructure\n#\n# This file is distributed under the University of Illinois Open Source\n# License. See LICENSE.TXT for details.\n#\n#===------------------------------------------------------------------------===#\n\nr\"\"\"\nClangTidy Diff Checker\n======================\n\nThis script reads input from a unified diff, runs clang-tidy on all changed\nfiles and outputs clang-tidy warnings in changed lines only. This is useful to\ndetect clang-tidy regressions in the lines touched by a specific patch.\nExample usage for git/svn users:\n\n  git diff -U0 HEAD^ | clang-tidy-diff.py -p1\n  svn diff --diff-cmd=diff -x-U0 | \\\n      clang-tidy-diff.py -fix -checks=-*,modernize-use-override\n\n\"\"\"\n\nimport argparse\nimport json\nimport re\nimport subprocess\nimport sys\n\n\ndef main():\n  parser = argparse.ArgumentParser(description=\n                                   'Run clang-tidy against changed files, and '\n                                   'output diagnostics only for modified '\n                                   'lines.')\n  parser.add_argument('-clang-tidy-binary', metavar='PATH',\n                      default='clang-tidy',\n                      help='path to clang-tidy binary')\n  parser.add_argument('-p', metavar='NUM', default=0,\n                      help='strip the smallest prefix containing P slashes')\n  parser.add_argument('-regex', metavar='PATTERN', default=None,\n                      help='custom pattern selecting file paths to check '\n                      '(case sensitive, overrides -iregex)')\n  parser.add_argument('-iregex', metavar='PATTERN', default=\n                      r'.*\\.(cpp|cc|c\\+\\+|cxx|c|cl|h|hpp|m|mm|inc)',\n                      help='custom pattern selecting file paths to check '\n                      '(case insensitive, overridden by -regex)')\n\n  parser.add_argument('-fix', action='store_true', default=False,\n                      help='apply suggested fixes')\n  parser.add_argument('-checks',\n                      help='checks filter, when not specified, use clang-tidy '\n                      'default',\n                      default='')\n  parser.add_argument('-format-style',\n                      help='style format',\n                      default='')\n  parser.add_argument('-path', dest='build_path',\n                      help='Path used to read a compile command database.')\n  parser.add_argument('-extra-arg', dest='extra_arg',\n                      action='append', default=[],\n                      help='Additional argument to append to the compiler '\n                      'command line.')\n  parser.add_argument('-extra-arg-before', dest='extra_arg_before',\n                      action='append', default=[],\n                      help='Additional argument to prepend to the compiler '\n                      'command line.')\n  parser.add_argument('-quiet', action='store_true', default=False,\n                      help='Run clang-tidy in quiet mode')\n  clang_tidy_args = []\n  argv = sys.argv[1:]\n  if '--' in argv:\n    clang_tidy_args.extend(argv[argv.index('--'):])\n    argv = argv[:argv.index('--')]\n\n  args = parser.parse_args(argv)\n\n  # Extract changed lines for each file.\n  filename = None\n  lines_by_file = {}\n  for line in sys.stdin:\n    match = re.search('^\\+\\+\\+\\ \\\"?(.*?/){%s}([^ \\t\\n\\\"]*)' % args.p, line)\n    if match:\n      filename = match.group(2)\n    if filename == None:\n      continue\n\n    if args.regex is not None:\n      if not re.match('^%s$' % args.regex, filename):\n        continue\n    else:\n      if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):\n        continue\n\n    match = re.search('^@@.*\\+(\\d+)(,(\\d+))?', line)\n    if match:\n      start_line = int(match.group(1))\n      line_count = 1\n      if match.group(3):\n        line_count = int(match.group(3))\n      if line_count == 0:\n        continue\n      end_line = start_line + line_count - 1;\n      lines_by_file.setdefault(filename, []).append([start_line, end_line])\n\n  if len(lines_by_file) == 0:\n    print(\"No relevant changes found.\")\n    sys.exit(0)\n\n  line_filter_json = json.dumps(\n    [{\"name\" : name, \"lines\" : lines_by_file[name]} for name in lines_by_file],\n    separators = (',', ':'))\n\n  quote = \"\";\n  if sys.platform == 'win32':\n    line_filter_json=re.sub(r'\"', r'\"\"\"', line_filter_json)\n  else:\n    quote = \"'\";\n\n  # Run clang-tidy on files containing changes.\n  command = [args.clang_tidy_binary]\n  command.append('-line-filter=' + quote + line_filter_json + quote)\n  if args.fix:\n    command.append('-fix')\n  if args.checks != '':\n    command.append('-checks=' + quote + args.checks + quote)\n  if args.format_style != '':\n    command.append('-format-style=' + quote + args.format_style + quote)\n  if args.quiet:\n    command.append('-quiet')\n  if args.build_path is not None:\n    command.append('-p=%s' % args.build_path)\n  command.extend(lines_by_file.keys())\n  for arg in args.extra_arg:\n      command.append('-extra-arg=%s' % arg)\n  for arg in args.extra_arg_before:\n      command.append('-extra-arg-before=%s' % arg)\n  command.extend(clang_tidy_args)\n\n  sys.exit(subprocess.call(' '.join(command), shell=True))\n\nif __name__ == '__main__':\n  main()\n"
  },
  {
    "path": "bin/format-colors.sh",
    "content": "#!/bin/sh\n\n# Prepares stdin input YAML for gperf consumption\n\necho \"struct rgb { const char *name; uint8_t red; uint8_t green; uint8_t blue; };\"\necho \"%%\"\ntr -d '[]\"' | tr \":\" \",\"\n"
  },
  {
    "path": "bin/run-clang-format.py",
    "content": "#!/usr/bin/env python3\n\"\"\"A wrapper script around clang-format, suitable for linting multiple files\nand to use for continuous integration.\n\nThis is an alternative API for the clang-format command line.\nIt runs over multiple files and directories in parallel.\nA diff output is produced and a sensible exit code is returned.\n\nSource: https://raw.githubusercontent.com/Sarcasm/run-clang-format/master/run-clang-format.py\n\"\"\"\n\nfrom __future__ import print_function, unicode_literals\n\nimport argparse\nimport codecs\nimport difflib\nimport fnmatch\nimport io\nimport multiprocessing\nimport os\nimport signal\nimport subprocess\nimport sys\nimport traceback\n\nfrom functools import partial\n\nDEFAULT_EXTENSIONS = 'c,h,C,H,cpp,hpp,cc,hh,c++,h++,cxx,hxx'\n\n\nclass ExitStatus:\n    SUCCESS = 0\n    DIFF = 1\n    TROUBLE = 2\n\n\ndef list_files(files, recursive=False, extensions=None, exclude=None):\n    if extensions is None:\n        extensions = []\n    if exclude is None:\n        exclude = []\n\n    out = []\n    for file in files:\n        if recursive and os.path.isdir(file):\n            for dirpath, dnames, fnames in os.walk(file):\n                fpaths = [os.path.join(dirpath, fname) for fname in fnames]\n                for pattern in exclude:\n                    # os.walk() supports trimming down the dnames list\n                    # by modifying it in-place,\n                    # to avoid unnecessary directory listings.\n                    dnames[:] = [\n                        x for x in dnames\n                        if\n                        not fnmatch.fnmatch(os.path.join(dirpath, x), pattern)\n                    ]\n                    fpaths = [\n                        x for x in fpaths if not fnmatch.fnmatch(x, pattern)\n                    ]\n                for f in fpaths:\n                    ext = os.path.splitext(f)[1][1:]\n                    if ext in extensions:\n                        out.append(f)\n        else:\n            out.append(file)\n    return out\n\n\ndef make_diff(file, original, reformatted):\n    return list(\n        difflib.unified_diff(\n            original,\n            reformatted,\n            fromfile='{}\\t(original)'.format(file),\n            tofile='{}\\t(reformatted)'.format(file),\n            n=3))\n\n\nclass DiffError(Exception):\n    def __init__(self, message, errs=None):\n        super(DiffError, self).__init__(message)\n        self.errs = errs or []\n\n\nclass UnexpectedError(Exception):\n    def __init__(self, message, exc=None):\n        super(UnexpectedError, self).__init__(message)\n        self.formatted_traceback = traceback.format_exc()\n        self.exc = exc\n\n\ndef run_clang_format_diff_wrapper(args, file):\n    try:\n        ret = run_clang_format_diff(args, file)\n        return ret\n    except DiffError:\n        raise\n    except Exception as e:\n        raise UnexpectedError('{}: {}: {}'.format(file, e.__class__.__name__,\n                                                  e), e)\n\n\ndef run_clang_format_diff(args, file):\n    try:\n        with io.open(file, 'r', encoding='utf-8') as f:\n            original = f.readlines()\n    except IOError as exc:\n        raise DiffError(str(exc))\n    invocation = [args.clang_format_executable, file]\n\n    # Use of utf-8 to decode the process output.\n    #\n    # Hopefully, this is the correct thing to do.\n    #\n    # It's done due to the following assumptions (which may be incorrect):\n    # - clang-format will returns the bytes read from the files as-is,\n    #   without conversion, and it is already assumed that the files use utf-8.\n    # - if the diagnostics were internationalized, they would use utf-8:\n    #   > Adding Translations to Clang\n    #   >\n    #   > Not possible yet!\n    #   > Diagnostic strings should be written in UTF-8,\n    #   > the client can translate to the relevant code page if needed.\n    #   > Each translation completely replaces the format string\n    #   > for the diagnostic.\n    #   > -- http://clang.llvm.org/docs/InternalsManual.html#internals-diag-translation\n    #\n    # It's not pretty, due to Python 2 & 3 compatibility.\n    encoding_py3 = {}\n    if sys.version_info[0] >= 3:\n        encoding_py3['encoding'] = 'utf-8'\n\n    try:\n        proc = subprocess.Popen(\n            invocation,\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n            universal_newlines=True,\n            **encoding_py3)\n    except OSError as exc:\n        raise DiffError(str(exc))\n    proc_stdout = proc.stdout\n    proc_stderr = proc.stderr\n    if sys.version_info[0] < 3:\n        # make the pipes compatible with Python 3,\n        # reading lines should output unicode\n        encoding = 'utf-8'\n        proc_stdout = codecs.getreader(encoding)(proc_stdout)\n        proc_stderr = codecs.getreader(encoding)(proc_stderr)\n    # hopefully the stderr pipe won't get full and block the process\n    outs = list(proc_stdout.readlines())\n    errs = list(proc_stderr.readlines())\n    proc.wait()\n    if proc.returncode:\n        raise DiffError(\"clang-format exited with status {}: '{}'\".format(\n            proc.returncode, file), errs)\n    return make_diff(file, original, outs), errs\n\n\ndef bold_red(s):\n    return '\\x1b[1m\\x1b[31m' + s + '\\x1b[0m'\n\n\ndef colorize(diff_lines):\n    def bold(s):\n        return '\\x1b[1m' + s + '\\x1b[0m'\n\n    def cyan(s):\n        return '\\x1b[36m' + s + '\\x1b[0m'\n\n    def green(s):\n        return '\\x1b[32m' + s + '\\x1b[0m'\n\n    def red(s):\n        return '\\x1b[31m' + s + '\\x1b[0m'\n\n    for line in diff_lines:\n        if line[:4] in ['--- ', '+++ ']:\n            yield bold(line)\n        elif line.startswith('@@ '):\n            yield cyan(line)\n        elif line.startswith('+'):\n            yield green(line)\n        elif line.startswith('-'):\n            yield red(line)\n        else:\n            yield line\n\n\ndef print_diff(diff_lines, use_color):\n    if use_color:\n        diff_lines = colorize(diff_lines)\n    if sys.version_info[0] < 3:\n        sys.stdout.writelines((l.encode('utf-8') for l in diff_lines))\n    else:\n        sys.stdout.writelines(diff_lines)\n\n\ndef print_trouble(prog, message, use_colors):\n    error_text = 'error:'\n    if use_colors:\n        error_text = bold_red(error_text)\n    print(\"{}: {} {}\".format(prog, error_text, message), file=sys.stderr)\n\n\ndef main():\n    parser = argparse.ArgumentParser(description=__doc__)\n    parser.add_argument(\n        '--clang-format-executable',\n        metavar='EXECUTABLE',\n        help='path to the clang-format executable',\n        default='clang-format')\n    parser.add_argument(\n        '--extensions',\n        help='comma separated list of file extensions (default: {})'.format(\n            DEFAULT_EXTENSIONS),\n        default=DEFAULT_EXTENSIONS)\n    parser.add_argument(\n        '-r',\n        '--recursive',\n        action='store_true',\n        help='run recursively over directories')\n    parser.add_argument('files', metavar='file', nargs='+')\n    parser.add_argument(\n        '-q',\n        '--quiet',\n        action='store_true')\n    parser.add_argument(\n        '-j',\n        metavar='N',\n        type=int,\n        default=0,\n        help='run N clang-format jobs in parallel'\n        ' (default number of cpus + 1)')\n    parser.add_argument(\n        '--color',\n        default='auto',\n        choices=['auto', 'always', 'never'],\n        help='show colored diff (default: auto)')\n    parser.add_argument(\n        '-e',\n        '--exclude',\n        metavar='PATTERN',\n        action='append',\n        default=[],\n        help='exclude paths matching the given glob-like pattern(s)'\n        ' from recursive search')\n\n    args = parser.parse_args()\n\n    # use default signal handling, like diff return SIGINT value on ^C\n    # https://bugs.python.org/issue14229#msg156446\n    signal.signal(signal.SIGINT, signal.SIG_DFL)\n    try:\n        signal.SIGPIPE\n    except AttributeError:\n        # compatibility, SIGPIPE does not exist on Windows\n        pass\n    else:\n        signal.signal(signal.SIGPIPE, signal.SIG_DFL)\n\n    colored_stdout = False\n    colored_stderr = False\n    if args.color == 'always':\n        colored_stdout = True\n        colored_stderr = True\n    elif args.color == 'auto':\n        colored_stdout = sys.stdout.isatty()\n        colored_stderr = sys.stderr.isatty()\n\n    retcode = ExitStatus.SUCCESS\n    files = list_files(\n        args.files,\n        recursive=args.recursive,\n        exclude=args.exclude,\n        extensions=args.extensions.split(','))\n\n    if not files:\n        return\n\n    njobs = args.j\n    if njobs == 0:\n        njobs = multiprocessing.cpu_count() + 1\n    njobs = min(len(files), njobs)\n\n    if njobs == 1:\n        # execute directly instead of in a pool,\n        # less overhead, simpler stacktraces\n        it = (run_clang_format_diff_wrapper(args, file) for file in files)\n        pool = None\n    else:\n        pool = multiprocessing.Pool(njobs)\n        it = pool.imap_unordered(\n            partial(run_clang_format_diff_wrapper, args), files)\n    while True:\n        try:\n            outs, errs = next(it)\n        except StopIteration:\n            break\n        except DiffError as e:\n            print_trouble(parser.prog, str(e), use_colors=colored_stderr)\n            retcode = ExitStatus.TROUBLE\n            sys.stderr.writelines(e.errs)\n        except UnexpectedError as e:\n            print_trouble(parser.prog, str(e), use_colors=colored_stderr)\n            sys.stderr.write(e.formatted_traceback)\n            retcode = ExitStatus.TROUBLE\n            # stop at the first unexpected error,\n            # something could be very wrong,\n            # don't process all files unnecessarily\n            if pool:\n                pool.terminate()\n            break\n        else:\n            sys.stderr.writelines(errs)\n            if outs == []:\n                continue\n            if not args.quiet:\n                print_diff(outs, use_color=colored_stdout)\n            if retcode == ExitStatus.SUCCESS:\n                retcode = ExitStatus.DIFF\n    return retcode\n\n\nif __name__ == '__main__':\n    sys.exit(main())\n"
  },
  {
    "path": "bin/text2c.sh",
    "content": "#!/bin/sh\n#\n# text2c.sh - convert a text file to C code\n#\n# Copyright (C) 2008  Phil Sutter <phil@nwl.cc>\n# \n# This program is free software: you can redistribute it and/or modify it\n# under the terms of the GNU General Public License as published by the Free\n# Software Foundation, either version 3 of the License, or (at your option)\n# any later version.\n# \n# This program is distributed in the hope that it will be useful, but\n# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License\n# for more details.\n# \n# You should have received a copy of the GNU General Public License along\n# with this program.  If not, see <http://www.gnu.org/licenses/>.\n\n\n# Invocation is as follows:\n# $1: text file\n# $2: output file\n# $3: name of variable\n#\n# The output will be a char **, with each field containing a single line of $1.\n# Additionally, a macro with the name print_$3 will be defined, with acts as\n# a parameter-less function, printing the text to stdout.\n\n[ $# -eq 3 ] || {\n\techo \"Usage: `basename $0` <inputfile> <outputfile> <variablename>\"\n\texit 1\n}\n\noutupper=\"`basename \"$2\" | tr '[a-z-.]' '[A-Z__]'`\"\n\n(\n\tprintf \"const char %s[] = \\n\" \"$3\"\n\tsed -e 's/[\"\\]/\\\\&/g' -e 's/^/    \"/' -e 's/$/\\\\n\"/' -e '$s/$/;/' \"$1\"\n) > \"$2\"\n"
  },
  {
    "path": "cmake/CCache.cmake",
    "content": "if(NOT USE_CCACHE)\n    return()\nendif()\n\nfind_program(CCACHE_COMMAND sccache)\nif(CCACHE_COMMAND)\n    mark_as_advanced(CCACHE_COMMAND)\n    message(STATUS \"Using sccache; disable with '-DUSE_CCACHE=OFF'\")\nelse()\n    find_program(CCACHE_COMMAND ccache)\n    if(CCACHE_COMMAND)\n        mark_as_advanced(CCACHE_COMMAND)\n        message(STATUS \"Using ccache; disable with '-DUSE_CCACHE=OFF'\")\n    else()\n        message(WARNING \"Neither sccache nor ccache found\")\n        return()\n    endif()\nendif()\n\nset(CMAKE_C_COMPILER_LAUNCHER \"${CCACHE_COMMAND}\")\nset(CMAKE_CXX_COMPILER_LAUNCHER \"${CCACHE_COMMAND}\")\nset(CMAKE_CUDA_COMPILER_LAUNCHER \"${CCACHE_COMMAND}\")\n"
  },
  {
    "path": "cmake/Catch.cmake",
    "content": "# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying\n# file Copyright.txt or https://cmake.org/licensing for details.\n\n#[=======================================================================[.rst:\nCatch\n-----\n\nThis module defines a function to help use the Catch test framework.\n\nThe :command:`catch_discover_tests` discovers tests by asking the compiled test\nexecutable to enumerate its tests.  This does not require CMake to be re-run\nwhen tests change.  However, it may not work in a cross-compiling environment,\nand setting test properties is less convenient.\n\nThis command is intended to replace use of :command:`add_test` to register\ntests, and will create a separate CTest test for each Catch test case.  Note\nthat this is in some cases less efficient, as common set-up and tear-down logic\ncannot be shared by multiple test cases executing in the same instance.\nHowever, it provides more fine-grained pass/fail information to CTest, which is\nusually considered as more beneficial.  By default, the CTest test name is the\nsame as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.\n\n.. command:: catch_discover_tests\n\n  Automatically add tests with CTest by querying the compiled test executable\n  for available tests::\n\n    catch_discover_tests(target\n                         [TEST_SPEC arg1...]\n                         [EXTRA_ARGS arg1...]\n                         [WORKING_DIRECTORY dir]\n                         [TEST_PREFIX prefix]\n                         [TEST_SUFFIX suffix]\n                         [PROPERTIES name1 value1...]\n                         [TEST_LIST var]\n                         [REPORTER reporter]\n                         [OUTPUT_DIR dir]\n                         [OUTPUT_PREFIX prefix]\n                         [OUTPUT_SUFFIX suffix]\n                         [DISCOVERY_MODE <POST_BUILD|PRE_TEST>]\n                         [SKIP_IS_FAILURE]\n    )\n\n  ``catch_discover_tests`` sets up a post-build command on the test executable\n  that generates the list of tests by parsing the output from running the test\n  with the ``--list-test-names-only`` argument.  This ensures that the full\n  list of tests is obtained.  Since test discovery occurs at build time, it is\n  not necessary to re-run CMake when the list of tests changes.\n  However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set\n  in order to function in a cross-compiling environment.\n\n  Additionally, setting properties on tests is somewhat less convenient, since\n  the tests are not available at CMake time.  Additional test properties may be\n  assigned to the set of tests as a whole using the ``PROPERTIES`` option.  If\n  more fine-grained test control is needed, custom content may be provided\n  through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`\n  directory property.  The set of discovered tests is made accessible to such a\n  script via the ``<target>_TESTS`` variable.\n\n  The options are:\n\n  ``target``\n    Specifies the Catch executable, which must be a known CMake executable\n    target.  CMake will substitute the location of the built executable when\n    running the test.\n\n  ``TEST_SPEC arg1...``\n    Specifies test cases, wildcarded test cases, tags and tag expressions to\n    pass to the Catch executable with the ``--list-test-names-only`` argument.\n\n  ``EXTRA_ARGS arg1...``\n    Any extra arguments to pass on the command line to each test case.\n\n  ``WORKING_DIRECTORY dir``\n    Specifies the directory in which to run the discovered test cases.  If this\n    option is not provided, the current binary directory is used.\n\n  ``TEST_PREFIX prefix``\n    Specifies a ``prefix`` to be prepended to the name of each discovered test\n    case.  This can be useful when the same test executable is being used in\n    multiple calls to ``catch_discover_tests()`` but with different\n    ``TEST_SPEC`` or ``EXTRA_ARGS``.\n\n  ``TEST_SUFFIX suffix``\n    Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of\n    every discovered test case.  Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may\n    be specified.\n\n  ``PROPERTIES name1 value1...``\n    Specifies additional properties to be set on all tests discovered by this\n    invocation of ``catch_discover_tests``.\n\n  ``TEST_LIST var``\n    Make the list of tests available in the variable ``var``, rather than the\n    default ``<target>_TESTS``.  This can be useful when the same test\n    executable is being used in multiple calls to ``catch_discover_tests()``.\n    Note that this variable is only available in CTest.\n\n  ``REPORTER reporter``\n    Use the specified reporter when running the test case. The reporter will\n    be passed to the Catch executable as ``--reporter reporter``.\n\n  ``OUTPUT_DIR dir``\n    If specified, the parameter is passed along as\n    ``--out dir/<test_name>`` to Catch executable. The actual file name is the\n    same as the test name. This should be used instead of\n    ``EXTRA_ARGS --out foo`` to avoid race conditions writing the result output\n    when using parallel test execution.\n\n  ``OUTPUT_PREFIX prefix``\n    May be used in conjunction with ``OUTPUT_DIR``.\n    If specified, ``prefix`` is added to each output file name, like so\n    ``--out dir/prefix<test_name>``.\n\n  ``OUTPUT_SUFFIX suffix``\n    May be used in conjunction with ``OUTPUT_DIR``.\n    If specified, ``suffix`` is added to each output file name, like so\n    ``--out dir/<test_name>suffix``. This can be used to add a file extension to\n    the output e.g. \".xml\".\n\n  ``DL_PATHS path...``\n    Specifies paths that need to be set for the dynamic linker to find shared\n    libraries/DLLs when running the test executable (PATH/LD_LIBRARY_PATH respectively).\n    These paths will both be set when retrieving the list of test cases from the\n    test executable and when the tests are executed themselves. This requires\n    cmake/ctest >= 3.22.\n\n  ``DL_FRAMEWORK_PATHS path...``\n    Specifies paths that need to be set for the dynamic linker to find libraries\n    packaged as frameworks on Apple platforms when running the test executable\n    (DYLD_FRAMEWORK_PATH). These paths will both be set when retrieving the list\n    of test cases from the test executable and when the tests are executed themselves.\n    This requires cmake/ctest >= 3.22.\n\n  ``DISCOVERY_MODE mode``\n    Provides control over when ``catch_discover_tests`` performs test discovery.\n    By default, ``POST_BUILD`` sets up a post-build command to perform test discovery\n    at build time. In certain scenarios, like cross-compiling, this ``POST_BUILD``\n    behavior is not desirable. By contrast, ``PRE_TEST`` delays test discovery until\n    just prior to test execution. This way test discovery occurs in the target environment\n    where the test has a better chance at finding appropriate runtime dependencies.\n\n    ``DISCOVERY_MODE`` defaults to the value of the\n    ``CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE`` variable if it is not passed when\n    calling ``catch_discover_tests``. This provides a mechanism for globally selecting\n    a preferred test discovery behavior without having to modify each call site.\n\n  ``SKIP_IS_FAILURE``\n    Disables skipped test detection.\n\n#]=======================================================================]\n\n#------------------------------------------------------------------------------\nfunction(catch_discover_tests TARGET)\n\n  cmake_parse_arguments(\n    \"\"\n    \"SKIP_IS_FAILURE\"\n    \"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST;REPORTER;OUTPUT_DIR;OUTPUT_PREFIX;OUTPUT_SUFFIX;DISCOVERY_MODE\"\n    \"TEST_SPEC;EXTRA_ARGS;PROPERTIES;DL_PATHS;DL_FRAMEWORK_PATHS\"\n    ${ARGN}\n  )\n\n  if(NOT _WORKING_DIRECTORY)\n    set(_WORKING_DIRECTORY \"${CMAKE_CURRENT_BINARY_DIR}\")\n  endif()\n  if(NOT _TEST_LIST)\n    set(_TEST_LIST ${TARGET}_TESTS)\n  endif()\n  if(_DL_PATHS AND ${CMAKE_VERSION} VERSION_LESS \"3.22.0\")\n    message(FATAL_ERROR \"The DL_PATHS option requires at least cmake 3.22\")\n  endif()\n  if(_DL_FRAMEWORK_PATHS AND ${CMAKE_VERSION} VERSION_LESS \"3.22.0\")\n    message(FATAL_ERROR \"The DL_FRAMEWORK_PATHS option requires at least cmake 3.22\")\n  endif()\n  if(NOT _DISCOVERY_MODE)\n    if(NOT CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE)\n      set(CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE \"POST_BUILD\")\n    endif()\n    set(_DISCOVERY_MODE ${CMAKE_CATCH_DISCOVER_TESTS_DISCOVERY_MODE})\n  endif()\n  if (NOT _DISCOVERY_MODE MATCHES \"^(POST_BUILD|PRE_TEST)$\")\n    message(FATAL_ERROR \"Unknown DISCOVERY_MODE: ${_DISCOVERY_MODE}\")\n  endif()\n\n  ## Generate a unique name based on the extra arguments\n  string(SHA1 args_hash \"${_TEST_SPEC} ${_EXTRA_ARGS} ${_REPORTER} ${_OUTPUT_DIR} ${_OUTPUT_PREFIX} ${_OUTPUT_SUFFIX}\")\n  string(SUBSTRING ${args_hash} 0 7 args_hash)\n\n  # Define rule to generate test list for aforementioned test executable\n  set(ctest_file_base \"${CMAKE_CURRENT_BINARY_DIR}/${TARGET}-${args_hash}\")\n  set(ctest_include_file \"${ctest_file_base}_include.cmake\")\n  set(ctest_tests_file \"${ctest_file_base}_tests.cmake\")\n\n  get_property(crosscompiling_emulator\n    TARGET ${TARGET}\n    PROPERTY CROSSCOMPILING_EMULATOR\n  )\n  if (NOT _SKIP_IS_FAILURE)\n    set(_PROPERTIES ${_PROPERTIES} SKIP_RETURN_CODE 4)\n  endif()\n\n  if(_DISCOVERY_MODE STREQUAL \"POST_BUILD\")\n    add_custom_command(\n      TARGET ${TARGET} POST_BUILD\n      BYPRODUCTS \"${ctest_tests_file}\"\n      COMMAND \"${CMAKE_COMMAND}\"\n              -D \"TEST_TARGET=${TARGET}\"\n              -D \"TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>\"\n              -D \"TEST_EXECUTOR=${crosscompiling_emulator}\"\n              -D \"TEST_WORKING_DIR=${_WORKING_DIRECTORY}\"\n              -D \"TEST_SPEC=${_TEST_SPEC}\"\n              -D \"TEST_EXTRA_ARGS=${_EXTRA_ARGS}\"\n              -D \"TEST_PROPERTIES=${_PROPERTIES}\"\n              -D \"TEST_PREFIX=${_TEST_PREFIX}\"\n              -D \"TEST_SUFFIX=${_TEST_SUFFIX}\"\n              -D \"TEST_LIST=${_TEST_LIST}\"\n              -D \"TEST_REPORTER=${_REPORTER}\"\n              -D \"TEST_OUTPUT_DIR=${_OUTPUT_DIR}\"\n              -D \"TEST_OUTPUT_PREFIX=${_OUTPUT_PREFIX}\"\n              -D \"TEST_OUTPUT_SUFFIX=${_OUTPUT_SUFFIX}\"\n              -D \"TEST_DL_PATHS=${_DL_PATHS}\"\n              -D \"TEST_DL_FRAMEWORK_PATHS=${_DL_FRAMEWORK_PATHS}\"\n              -D \"CTEST_FILE=${ctest_tests_file}\"\n              -P \"${_CATCH_DISCOVER_TESTS_SCRIPT}\"\n      VERBATIM\n    )\n\n    file(WRITE \"${ctest_include_file}\"\n      \"if(EXISTS \\\"${ctest_tests_file}\\\")\\n\"\n      \"  include(\\\"${ctest_tests_file}\\\")\\n\"\n      \"else()\\n\"\n      \"  add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\\n\"\n      \"endif()\\n\"\n    )\n\n  elseif(_DISCOVERY_MODE STREQUAL \"PRE_TEST\")\n\n    get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL\n        PROPERTY GENERATOR_IS_MULTI_CONFIG\n    )\n\n    if(GENERATOR_IS_MULTI_CONFIG)\n      set(ctest_tests_file \"${ctest_file_base}_tests-$<CONFIG>.cmake\")\n    endif()\n\n    string(CONCAT ctest_include_content\n      \"if(EXISTS \\\"$<TARGET_FILE:${TARGET}>\\\")\"                                    \"\\n\"\n      \"  if(NOT EXISTS \\\"${ctest_tests_file}\\\" OR\"                                 \"\\n\"\n      \"     NOT \\\"${ctest_tests_file}\\\" IS_NEWER_THAN \\\"$<TARGET_FILE:${TARGET}>\\\" OR\\n\"\n      \"     NOT \\\"${ctest_tests_file}\\\" IS_NEWER_THAN \\\"\\${CMAKE_CURRENT_LIST_FILE}\\\")\\n\"\n      \"    include(\\\"${_CATCH_DISCOVER_TESTS_SCRIPT}\\\")\"                           \"\\n\"\n      \"    catch_discover_tests_impl(\"                                             \"\\n\"\n      \"      TEST_EXECUTABLE\"        \" [==[\" \"$<TARGET_FILE:${TARGET}>\"   \"]==]\"   \"\\n\"\n      \"      TEST_EXECUTOR\"          \" [==[\" \"${crosscompiling_emulator}\" \"]==]\"   \"\\n\"\n      \"      TEST_WORKING_DIR\"       \" [==[\" \"${_WORKING_DIRECTORY}\"      \"]==]\"   \"\\n\"\n      \"      TEST_SPEC\"              \" [==[\" \"${_TEST_SPEC}\"              \"]==]\"   \"\\n\"\n      \"      TEST_EXTRA_ARGS\"        \" [==[\" \"${_EXTRA_ARGS}\"             \"]==]\"   \"\\n\"\n      \"      TEST_PROPERTIES\"        \" [==[\" \"${_PROPERTIES}\"             \"]==]\"   \"\\n\"\n      \"      TEST_PREFIX\"            \" [==[\" \"${_TEST_PREFIX}\"            \"]==]\"   \"\\n\"\n      \"      TEST_SUFFIX\"            \" [==[\" \"${_TEST_SUFFIX}\"            \"]==]\"   \"\\n\"\n      \"      TEST_LIST\"              \" [==[\" \"${_TEST_LIST}\"              \"]==]\"   \"\\n\"\n      \"      TEST_REPORTER\"          \" [==[\" \"${_REPORTER}\"               \"]==]\"   \"\\n\"\n      \"      TEST_OUTPUT_DIR\"        \" [==[\" \"${_OUTPUT_DIR}\"             \"]==]\"   \"\\n\"\n      \"      TEST_OUTPUT_PREFIX\"     \" [==[\" \"${_OUTPUT_PREFIX}\"          \"]==]\"   \"\\n\"\n      \"      TEST_OUTPUT_SUFFIX\"     \" [==[\" \"${_OUTPUT_SUFFIX}\"          \"]==]\"   \"\\n\"\n      \"      CTEST_FILE\"             \" [==[\" \"${ctest_tests_file}\"        \"]==]\"   \"\\n\"\n      \"      TEST_DL_PATHS\"          \" [==[\" \"${_DL_PATHS}\"               \"]==]\"   \"\\n\"\n      \"      TEST_DL_FRAMEWORK_PATHS\" \" [==[\" \"${_DL_FRAMEWORK_PATHS}\"     \"]==]\"   \"\\n\"\n      \"    )\"                                                                      \"\\n\"\n      \"  endif()\"                                                                  \"\\n\"\n      \"  include(\\\"${ctest_tests_file}\\\")\"                                         \"\\n\"\n      \"else()\"                                                                     \"\\n\"\n      \"  add_test(${TARGET}_NOT_BUILT ${TARGET}_NOT_BUILT)\"                        \"\\n\"\n      \"endif()\"                                                                    \"\\n\"\n    )\n\n    if(GENERATOR_IS_MULTI_CONFIG)\n      foreach(_config ${CMAKE_CONFIGURATION_TYPES})\n        file(GENERATE OUTPUT \"${ctest_file_base}_include-${_config}.cmake\" CONTENT \"${ctest_include_content}\" CONDITION $<CONFIG:${_config}>)\n      endforeach()\n      string(CONCAT ctest_include_multi_content\n        \"if(NOT CTEST_CONFIGURATION_TYPE)\"                                              \"\\n\"\n        \"  message(\\\"No configuration for testing specified, use '-C <cfg>'.\\\")\"        \"\\n\"\n        \"else()\"                                                                        \"\\n\"\n        \"  include(\\\"${ctest_file_base}_include-\\${CTEST_CONFIGURATION_TYPE}.cmake\\\")\"  \"\\n\"\n        \"endif()\"                                                                       \"\\n\"\n      )\n      file(GENERATE OUTPUT \"${ctest_include_file}\" CONTENT \"${ctest_include_multi_content}\")\n    else()\n      file(GENERATE OUTPUT \"${ctest_file_base}_include.cmake\" CONTENT \"${ctest_include_content}\")\n      file(WRITE \"${ctest_include_file}\" \"include(\\\"${ctest_file_base}_include.cmake\\\")\")\n    endif()\n  endif()\n\n  if(NOT ${CMAKE_VERSION} VERSION_LESS \"3.10.0\")\n    # Add discovered tests to directory TEST_INCLUDE_FILES\n    set_property(DIRECTORY\n      APPEND PROPERTY TEST_INCLUDE_FILES \"${ctest_include_file}\"\n    )\n  else()\n    # Add discovered tests as directory TEST_INCLUDE_FILE if possible\n    get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)\n    if (NOT ${test_include_file_set})\n      set_property(DIRECTORY\n        PROPERTY TEST_INCLUDE_FILE \"${ctest_include_file}\"\n      )\n    else()\n      message(FATAL_ERROR \"Cannot set more than one TEST_INCLUDE_FILE\")\n    endif()\n  endif()\n\nendfunction()\n\n###############################################################################\n\nset(_CATCH_DISCOVER_TESTS_SCRIPT\n  ${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake\n  CACHE INTERNAL \"Catch2 full path to CatchAddTests.cmake helper file\"\n)\n"
  },
  {
    "path": "cmake/CatchAddTests.cmake",
    "content": "# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying\n# file Copyright.txt or https://cmake.org/licensing for details.\n\nfunction(add_command NAME)\n  set(_args \"\")\n  # use ARGV* instead of ARGN, because ARGN splits arrays into multiple\n  # arguments\n  math(EXPR _last_arg ${ARGC}-1)\n  foreach(_n RANGE 1 ${_last_arg})\n    set(_arg \"${ARGV${_n}}\")\n    if(_arg MATCHES \"[^-./:a-zA-Z0-9_]\")\n      set(_args \"${_args} [==[${_arg}]==]\") # form a bracket_argument\n    else()\n      set(_args \"${_args} ${_arg}\")\n    endif()\n  endforeach()\n  set(script\n      \"${script}${NAME}(${_args})\\n\"\n      PARENT_SCOPE)\nendfunction()\n\nfunction(catch_discover_tests_impl)\n\n  cmake_parse_arguments(\n    \"\"\n    \"\"\n    \"TEST_EXECUTABLE;TEST_WORKING_DIR;TEST_OUTPUT_DIR;TEST_OUTPUT_PREFIX;TEST_OUTPUT_SUFFIX;TEST_PREFIX;TEST_REPORTER;TEST_SPEC;TEST_SUFFIX;TEST_LIST;CTEST_FILE\"\n    \"TEST_EXTRA_ARGS;TEST_PROPERTIES;TEST_EXECUTOR;TEST_DL_PATHS;TEST_DL_FRAMEWORK_PATHS\"\n    ${ARGN})\n\n  set(prefix \"${_TEST_PREFIX}\")\n  set(suffix \"${_TEST_SUFFIX}\")\n  set(spec ${_TEST_SPEC})\n  set(extra_args ${_TEST_EXTRA_ARGS})\n  set(properties ${_TEST_PROPERTIES})\n  set(reporter ${_TEST_REPORTER})\n  set(output_dir ${_TEST_OUTPUT_DIR})\n  set(output_prefix ${_TEST_OUTPUT_PREFIX})\n  set(output_suffix ${_TEST_OUTPUT_SUFFIX})\n  set(dl_paths ${_TEST_DL_PATHS})\n  set(dl_framework_paths ${_TEST_DL_FRAMEWORK_PATHS})\n  set(environment_modifications \"\")\n  set(script)\n  set(suite)\n  set(tests)\n\n  if(WIN32)\n    set(dl_paths_variable_name PATH)\n  elseif(APPLE)\n    set(dl_paths_variable_name DYLD_LIBRARY_PATH)\n  else()\n    set(dl_paths_variable_name LD_LIBRARY_PATH)\n  endif()\n\n  # Run test executable to get list of available tests\n  if(NOT EXISTS \"${_TEST_EXECUTABLE}\")\n    message(\n      FATAL_ERROR\n        \"Specified test executable '${_TEST_EXECUTABLE}' does not exist\")\n  endif()\n\n  if(dl_paths)\n    cmake_path(CONVERT \"$ENV{${dl_paths_variable_name}}\" TO_NATIVE_PATH_LIST\n               env_dl_paths)\n    list(PREPEND env_dl_paths \"${dl_paths}\")\n    cmake_path(CONVERT \"${env_dl_paths}\" TO_NATIVE_PATH_LIST paths)\n    set(ENV{${dl_paths_variable_name}} \"${paths}\")\n  endif()\n\n  if(APPLE AND dl_framework_paths)\n    cmake_path(CONVERT \"$ENV{DYLD_FRAMEWORK_PATH}\" TO_NATIVE_PATH_LIST\n               env_dl_framework_paths)\n    list(PREPEND env_dl_framework_paths \"${dl_framework_paths}\")\n    cmake_path(CONVERT \"${env_dl_framework_paths}\" TO_NATIVE_PATH_LIST paths)\n    set(ENV{DYLD_FRAMEWORK_PATH} \"${paths}\")\n  endif()\n\n  execute_process(\n    COMMAND ${_TEST_EXECUTOR} \"${_TEST_EXECUTABLE}\" ${spec} --list-tests\n            --verbosity quiet\n    OUTPUT_VARIABLE output\n    RESULT_VARIABLE result\n    WORKING_DIRECTORY \"${_TEST_WORKING_DIR}\")\n  if(NOT ${result} EQUAL 0)\n    message(FATAL_ERROR \"Error running test executable '${_TEST_EXECUTABLE}':\\n\"\n                        \"  Result: ${result}\\n\" \"  Output: ${output}\\n\")\n  endif()\n\n  # Make sure to escape ; (semicolons) in test names first, because that'd break\n  # the foreach loop for \"Parse output\" later and create wrongly splitted and\n  # thus failing test cases (false positives)\n  string(REPLACE \";\" \"\\;\" output \"${output}\")\n  string(REPLACE \"\\n\" \";\" output \"${output}\")\n\n  # Prepare reporter\n  if(reporter)\n    set(reporter_arg \"--reporter ${reporter}\")\n\n    # Run test executable to check whether reporter is available note that the\n    # use of --list-reporters is not the important part, we only want to check\n    # whether the execution succeeds with ${reporter_arg}\n    execute_process(\n      COMMAND ${_TEST_EXECUTOR} \"${_TEST_EXECUTABLE}\" ${spec} ${reporter_arg}\n              --list-reporters\n      OUTPUT_VARIABLE reporter_check_output\n      RESULT_VARIABLE reporter_check_result\n      WORKING_DIRECTORY \"${_TEST_WORKING_DIR}\")\n    if(${reporter_check_result} EQUAL 255)\n      message(FATAL_ERROR \"\\\"${reporter}\\\" is not a valid reporter!\\n\")\n    elseif(NOT ${reporter_check_result} EQUAL 0)\n      message(\n        FATAL_ERROR\n          \"Error running test executable '${_TEST_EXECUTABLE}':\\n\"\n          \"  Result: ${reporter_check_result}\\n\"\n          \"  Output: ${reporter_check_output}\\n\")\n    endif()\n  endif()\n\n  # Prepare output dir\n  if(output_dir AND NOT IS_ABSOLUTE ${output_dir})\n    set(output_dir \"${_TEST_WORKING_DIR}/${output_dir}\")\n    if(NOT EXISTS ${output_dir})\n      file(MAKE_DIRECTORY ${output_dir})\n    endif()\n  endif()\n\n  if(dl_paths)\n    foreach(path ${dl_paths})\n      cmake_path(NATIVE_PATH path native_path)\n      list(PREPEND environment_modifications\n           \"${dl_paths_variable_name}=path_list_prepend:${native_path}\")\n    endforeach()\n  endif()\n\n  if(APPLE AND dl_framework_paths)\n    foreach(path ${dl_framework_paths})\n      cmake_path(NATIVE_PATH path native_path)\n      list(PREPEND environment_modifications\n           \"DYLD_FRAMEWORK_PATH=path_list_prepend:${native_path}\")\n    endforeach()\n  endif()\n\n  # Parse output\n  foreach(line ${output})\n    set(test \"${line}\")\n    # Escape characters in test case names that would be parsed by Catch2 Note\n    # that the \\ escaping must happen FIRST! Do not change the order.\n    set(test_name \"${test}\")\n    foreach(char \\\\ , [ ])\n      string(REPLACE ${char} \"\\\\${char}\" test_name \"${test_name}\")\n    endforeach(char)\n    # ...add output dir\n    if(output_dir)\n      string(REGEX REPLACE \"[^A-Za-z0-9_]\" \"_\" test_name_clean \"${test_name}\")\n      set(output_dir_arg\n          \"--out ${output_dir}/${output_prefix}${test_name_clean}${output_suffix}\"\n      )\n    endif()\n\n    # ...and add to script\n    add_command(\n      add_test\n      \"${prefix}${test}${suffix}\"\n      ${_TEST_EXECUTOR}\n      \"${_TEST_EXECUTABLE}\"\n      \"${test_name}\"\n      ${extra_args}\n      \"${reporter_arg}\"\n      \"${output_dir_arg}\")\n    add_command(set_tests_properties \"${prefix}${test}${suffix}\" PROPERTIES\n                WORKING_DIRECTORY \"${_TEST_WORKING_DIR}\" ${properties})\n\n    if(environment_modifications)\n      add_command(set_tests_properties \"${prefix}${test}${suffix}\" PROPERTIES\n                  ENVIRONMENT_MODIFICATION \"${environment_modifications}\")\n    endif()\n\n    list(APPEND tests \"${prefix}${test}${suffix}\")\n  endforeach()\n\n  # Create a list of all discovered tests, which users may use to e.g. set\n  # properties on the tests\n  add_command(set ${_TEST_LIST} ${tests})\n\n  # Write CTest script\n  file(WRITE \"${_CTEST_FILE}\" \"${script}\")\nendfunction()\n\nif(CMAKE_SCRIPT_MODE_FILE)\n  catch_discover_tests_impl(\n    TEST_EXECUTABLE\n    ${TEST_EXECUTABLE}\n    TEST_EXECUTOR\n    ${TEST_EXECUTOR}\n    TEST_WORKING_DIR\n    ${TEST_WORKING_DIR}\n    TEST_SPEC\n    ${TEST_SPEC}\n    TEST_EXTRA_ARGS\n    ${TEST_EXTRA_ARGS}\n    TEST_PROPERTIES\n    ${TEST_PROPERTIES}\n    TEST_PREFIX\n    ${TEST_PREFIX}\n    TEST_SUFFIX\n    ${TEST_SUFFIX}\n    TEST_LIST\n    ${TEST_LIST}\n    TEST_REPORTER\n    ${TEST_REPORTER}\n    TEST_OUTPUT_DIR\n    ${TEST_OUTPUT_DIR}\n    TEST_OUTPUT_PREFIX\n    ${TEST_OUTPUT_PREFIX}\n    TEST_OUTPUT_SUFFIX\n    ${TEST_OUTPUT_SUFFIX}\n    TEST_DL_PATHS\n    ${TEST_DL_PATHS}\n    TEST_DL_FRAMEWORK_PATHS\n    ${TEST_DL_FRAMEWORK_PATHS}\n    CTEST_FILE\n    ${CTEST_FILE})\nendif()\n"
  },
  {
    "path": "cmake/CodeCoverage.cmake",
    "content": "# Copyright (c) 2012 - 2017, Lars Bilke All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# 1. Redistributions of source code must retain the above copyright notice, this\n#   list of conditions and the following disclaimer.\n#\n# 1. Redistributions in binary form must reproduce the above copyright notice,\n#   this list of conditions and the following disclaimer in the documentation\n#   and/or other materials provided with the distribution.\n#\n# 1. Neither the name of the copyright holder nor the names of its contributors\n#   may be used to endorse or promote products derived from this software\n#   without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n# CHANGES:\n#\n# 2012-01-31, Lars Bilke - Enable Code Coverage\n#\n# 2013-09-17, Joakim Söderberg - Added support for Clang. - Some additional\n# usage instructions.\n#\n# 2016-02-03, Lars Bilke - Refactored functions to use named parameters\n#\n# 2017-06-02, Lars Bilke - Merged with modified version from github.com/ufz/ogs\n#\n# USAGE:\n#\n# 1. Copy this file into your cmake modules path.\n#\n# 1. Add the following line to your CMakeLists.txt: include(CodeCoverage)\n#\n# 1. Append necessary compiler flags: APPEND_COVERAGE_COMPILER_FLAGS()\n#\n# 1. If you need to exclude additional directories from the report, specify them\n#   using the COVERAGE_LCOV_EXCLUDES variable before calling\n#   SETUP_TARGET_FOR_COVERAGE_LCOV. Example: set(COVERAGE_LCOV_EXCLUDES 'dir1/*'\n#   'dir2/*')\n#\n# 1. Use the functions described below to create a custom make target which runs\n#   your test executable and produces a code coverage report.\n#\n# 1. Build a Debug build: cmake -DCMAKE_BUILD_TYPE=Debug .. make make\n#   my_coverage_target\n#\n\ninclude(CMakeParseArguments)\n\n# Check prereqs\nfind_program(GCOV_PATH\n             NAMES ${CMAKE_SOURCE_DIR}/tests/llvm-gcov.sh gcov\n             PATHS ENV PATH)\nfind_program(LCOV_PATH\n             NAMES lcov\n                   lcov.bat\n                   lcov.exe\n                   lcov.perl\n             PATHS ENV PATH)\nfind_program(LLVM_COV_PATH\n             NAMES\n                   llvm-cov110\n                   llvm-cov-11\n                   llvm-cov100\n                   llvm-cov-10\n                   llvm-cov90\n                   llvm-cov-9\n                   llvm-cov80\n                   llvm-cov-8\n                   llvm-cov70\n                   llvm-cov-7\n                   llvm-cov\n             PATHS ENV PATH)\nfind_program(LLVM_PROFDATA_PATH\n             NAMES\n                   llvm-profdata110\n                   llvm-profdata-11\n                   llvm-profdata100\n                   llvm-profdata-10\n                   llvm-profdata90\n                   llvm-profdata-9\n                   llvm-profdata80\n                   llvm-profdata-8\n                   llvm-profdata70\n                   llvm-profdata-7\n                   llvm-profdata\n             PATHS ENV PATH)\nfind_program(GENHTML_PATH NAMES genhtml genhtml.perl genhtml.bat)\nfind_program(GCOVR_PATH gcovr PATHS ${CMAKE_SOURCE_DIR}/scripts/test)\nfind_program(SIMPLE_PYTHON_EXECUTABLE python)\n\nif(NOT GCOV_PATH)\n  message(FATAL_ERROR \"gcov not found! Aborting...\")\nendif() # NOT GCOV_PATH\n\nif(\"${CMAKE_CXX_COMPILER_ID}\" MATCHES \"(Apple)?[Cc]lang\")\n  if(\"${CMAKE_CXX_COMPILER_VERSION}\" VERSION_LESS 3)\n    message(FATAL_ERROR \"Clang version must be 3.0.0 or greater! Aborting...\")\n  endif()\nelseif(NOT CMAKE_COMPILER_IS_GNUCXX)\n  message(FATAL_ERROR \"Compiler is not GNU gcc! Aborting...\")\nendif()\n\nset(\n  COVERAGE_COMPILER_FLAGS\n  -g -O0 -fprofile-arcs -ftest-coverage -fprofile-instr-generate -fcoverage-mapping\n  CACHE INTERNAL \"\")\n\nset(CMAKE_CXX_FLAGS_COVERAGE ${COVERAGE_COMPILER_FLAGS}\n    CACHE STRING \"Flags used by the C++ compiler during coverage builds.\"\n    FORCE)\nset(CMAKE_C_FLAGS_COVERAGE ${COVERAGE_COMPILER_FLAGS}\n    CACHE STRING \"Flags used by the C compiler during coverage builds.\"\n    FORCE)\nset(CMAKE_EXE_LINKER_FLAGS_COVERAGE \"\"\n    CACHE STRING \"Flags used for linking binaries during coverage builds.\"\n    FORCE)\nset(CMAKE_SHARED_LINKER_FLAGS_COVERAGE \"\"\n    CACHE STRING\n          \"Flags used by the shared libraries linker during coverage builds.\"\n    FORCE)\nmark_as_advanced(CMAKE_CXX_FLAGS_COVERAGE\n                 CMAKE_C_FLAGS_COVERAGE\n                 CMAKE_EXE_LINKER_FLAGS_COVERAGE\n                 CMAKE_SHARED_LINKER_FLAGS_COVERAGE)\n\nif(NOT CMAKE_BUILD_TYPE STREQUAL \"Debug\")\n  message(\n    WARNING\n      \"Code coverage results with an optimised (non-Debug) build may be misleading\"\n    )\nendif() # NOT CMAKE_BUILD_TYPE STREQUAL \"Debug\"\n\nif(CMAKE_C_COMPILER_ID STREQUAL \"GNU\")\n  link_libraries(gcov)\nelse()\n  add_link_options($<$<NOT:$<COMPILE_LANG_AND_ID:C,GNU>>:-fprofile-instr-generate>)\nendif()\n\n# Defines a target for running and collection code coverage information Builds\n# dependencies, runs the given executable and outputs reports. NOTE! The\n# executable should always have a ZERO as exit code otherwise the coverage\n# generation will not complete.\n#\n# SETUP_TARGET_FOR_COVERAGE_LCOV_HTML( NAME testrunner_coverage # New target\n# name EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in\n# PROJECT_BINARY_DIR DEPENDENCIES testrunner                     # Dependencies\n# to build first )\nfunction(SETUP_TARGET_FOR_COVERAGE_LCOV_HTML)\n\n  set(options NONE)\n  set(oneValueArgs NAME)\n  set(multiValueArgs\n      EXECUTABLE\n      EXECUTABLE_ARGS\n      DEPENDENCIES\n      LCOV_ARGS\n      GENHTML_ARGS)\n  cmake_parse_arguments(Coverage\n                        \"${options}\"\n                        \"${oneValueArgs}\"\n                        \"${multiValueArgs}\"\n                        ${ARGN})\n\n  if(NOT LCOV_PATH)\n    message(FATAL_ERROR \"lcov not found! Aborting...\")\n  endif() # NOT LCOV_PATH\n\n  if(NOT GENHTML_PATH)\n    message(FATAL_ERROR \"genhtml not found! Aborting...\")\n  endif() # NOT GENHTML_PATH\n\n  # Setup target\n  add_custom_target(\n    ${Coverage_NAME}\n    # Cleanup lcov\n    COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS}\n            --gcov-tool ${GCOV_PATH} -directory .\n            --zerocounters # Create baseline to make sure untouched files show\n                           # up in the report\n    COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS}\n            --gcov-tool ${GCOV_PATH} -c -i -d . -o ${Coverage_NAME}.base\n                        # Run tests\n    COMMAND ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}\n            # Capturing lcov counters and generating report\n    COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS}\n            --gcov-tool ${GCOV_PATH}\n            --directory .\n            --capture\n            --output-file ${Coverage_NAME}.info\n                          # add baseline counters\n    COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS}\n            --gcov-tool ${GCOV_PATH} -a ${Coverage_NAME}.base -a\n                        ${Coverage_NAME}.info\n            --output-file ${Coverage_NAME}.total\n    COMMAND ${LCOV_PATH} ${Coverage_LCOV_ARGS}\n            --gcov-tool ${GCOV_PATH}\n            --remove ${Coverage_NAME}.total ${COVERAGE_LCOV_EXCLUDES}\n            --output-file ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned\n                          # Generate HTML\n    COMMAND ${GENHTML_PATH} ${Coverage_GENHTML_ARGS} -o ${Coverage_NAME}\n            ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info.cleaned\n            # Clean up\n    COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.base\n            ${Coverage_NAME}.total ${PROJECT_BINARY_DIR}/${Coverage_NAME}.info\n    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}\n    DEPENDS ${Coverage_DEPENDENCIES}\n    COMMENT\n      \"Resetting code coverage counters to zero.\\nProcessing code coverage counters and generating report.\"\n    )\n\n  # Show where to find the lcov info report\n  add_custom_command(\n    TARGET ${Coverage_NAME} POST_BUILD\n    COMMAND ${CMAKE_COMMAND} -E echo\n    COMMENT\n      \"Lcov code coverage info report saved in ${Coverage_NAME}.info.cleaned\")\n\n  # Show info where to find the report\n  add_custom_command(\n    TARGET ${Coverage_NAME} POST_BUILD\n    COMMAND ${CMAKE_COMMAND} -E echo\n    COMMENT\n      \"Open ./${Coverage_NAME}/index.html in your browser to view the coverage report.\"\n    )\n\nendfunction() # SETUP_TARGET_FOR_COVERAGE_LCOV_HTML\n\n# Defines a target for running and collection code coverage information Builds\n# dependencies, runs the given executable and outputs reports. NOTE! The\n# executable should always have a ZERO as exit code otherwise the coverage\n# generation will not complete.\n#\n# SETUP_TARGET_FOR_COVERAGE_LCOV_TXT( NAME testrunner_coverage # New target name\n# EXECUTABLE testrunner -j ${PROCESSOR_COUNT} # Executable in PROJECT_BINARY_DIR\n# DEPENDENCIES testrunner                     # Dependencies to build first )\nfunction(SETUP_TARGET_FOR_COVERAGE_LCOV_TXT)\n\n  set(options NONE)\n  set(oneValueArgs NAME)\n  set(multiValueArgs\n      EXECUTABLE\n      EXECUTABLE_ARGS\n      DEPENDENCIES\n      LCOV_ARGS\n      GENHTML_ARGS)\n  cmake_parse_arguments(Coverage\n                        \"${options}\"\n                        \"${oneValueArgs}\"\n                        \"${multiValueArgs}\"\n                        ${ARGN})\n\n  if(NOT LCOV_PATH)\n    message(FATAL_ERROR \"lcov not found! Aborting...\")\n  endif() # NOT LCOV_PATH\n\n  # Setup target\n  add_custom_target(\n    ${Coverage_NAME}\n    # Run tests\n    COMMAND ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}\n            # Generate coverage.txt for sonar\n    COMMAND ${LLVM_PROFDATA_PATH} merge default.profraw -output\n            ${Coverage_NAME}.profdata\n    COMMAND ${LLVM_COV_PATH} show -instr-profile=${Coverage_NAME}.profdata\n            ${CMAKE_CURRENT_BINARY_DIR}/${Coverage_EXECUTABLE} >\n            ${Coverage_NAME}.txt\n            # Generate HTML\n            # Clean up\n    COMMAND ${CMAKE_COMMAND} -E remove ${Coverage_NAME}.profdata default.profraw\n    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}\n    DEPENDS ${Coverage_DEPENDENCIES}\n    COMMENT\n      \"Resetting code coverage counters to zero.\\nProcessing code coverage counters and generating report.\"\n    )\n\n  # Show where to find the lcov info report\n  add_custom_command(\n    TARGET ${Coverage_NAME} POST_BUILD\n    COMMAND ;\n    COMMENT \"Lcov code coverage info report saved in ${Coverage_NAME}.txt.\")\n\nendfunction() # SETUP_TARGET_FOR_COVERAGE_LCOV_TXT\n\n# Defines a target for running and collection code coverage information Builds\n# dependencies, runs the given executable and outputs reports. NOTE! The\n# executable should always have a ZERO as exit code otherwise the coverage\n# generation will not complete.\n#\n# SETUP_TARGET_FOR_COVERAGE_GCOVR_XML( NAME ctest_coverage                    #\n# New target name EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in\n# PROJECT_BINARY_DIR DEPENDENCIES executable_target         # Dependencies to\n# build first )\nfunction(SETUP_TARGET_FOR_COVERAGE_GCOVR_XML)\n\n  set(options NONE)\n  set(oneValueArgs NAME)\n  set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)\n  cmake_parse_arguments(Coverage\n                        \"${options}\"\n                        \"${oneValueArgs}\"\n                        \"${multiValueArgs}\"\n                        ${ARGN})\n\n  if(NOT SIMPLE_PYTHON_EXECUTABLE)\n    message(FATAL_ERROR \"python not found! Aborting...\")\n  endif() # NOT SIMPLE_PYTHON_EXECUTABLE\n\n  if(NOT GCOVR_PATH)\n    message(FATAL_ERROR \"gcovr not found! Aborting...\")\n  endif() # NOT GCOVR_PATH\n\n  # Combine excludes to several -e arguments\n  set(GCOVR_EXCLUDES \"\")\n  foreach(EXCLUDE ${COVERAGE_GCOVR_EXCLUDES})\n    list(APPEND GCOVR_EXCLUDES \"-e\")\n    list(APPEND GCOVR_EXCLUDES \"${EXCLUDE}\")\n  endforeach()\n\n  add_custom_target(\n    ${Coverage_NAME}\n    # Run tests\n    ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}\n    # Running gcovr\n    COMMAND ${GCOVR_PATH}\n            --xml -r ${PROJECT_SOURCE_DIR} ${GCOVR_EXCLUDES}\n            --object-directory=${PROJECT_BINARY_DIR} -o ${Coverage_NAME}.xml\n    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}\n    DEPENDS ${Coverage_DEPENDENCIES}\n    COMMENT \"Running gcovr to produce Cobertura code coverage report.\")\n\n  # Show info where to find the report\n  add_custom_command(\n    TARGET ${Coverage_NAME} POST_BUILD\n    COMMAND ;\n    COMMENT \"Cobertura code coverage report saved in ${Coverage_NAME}.xml.\")\n\nendfunction() # SETUP_TARGET_FOR_COVERAGE_GCOVR_XML\n\n# Defines a target for running and collection code coverage information Builds\n# dependencies, runs the given executable and outputs reports. NOTE! The\n# executable should always have a ZERO as exit code otherwise the coverage\n# generation will not complete.\n#\n# SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML( NAME ctest_coverage                    #\n# New target name EXECUTABLE ctest -j ${PROCESSOR_COUNT} # Executable in\n# PROJECT_BINARY_DIR DEPENDENCIES executable_target         # Dependencies to\n# build first )\nfunction(SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML)\n\n  set(options NONE)\n  set(oneValueArgs NAME)\n  set(multiValueArgs EXECUTABLE EXECUTABLE_ARGS DEPENDENCIES)\n  cmake_parse_arguments(Coverage\n                        \"${options}\"\n                        \"${oneValueArgs}\"\n                        \"${multiValueArgs}\"\n                        ${ARGN})\n\n  if(NOT SIMPLE_PYTHON_EXECUTABLE)\n    message(FATAL_ERROR \"python not found! Aborting...\")\n  endif() # NOT SIMPLE_PYTHON_EXECUTABLE\n\n  if(NOT GCOVR_PATH)\n    message(FATAL_ERROR \"gcovr not found! Aborting...\")\n  endif() # NOT GCOVR_PATH\n\n  # Combine excludes to several -e arguments\n  set(GCOVR_EXCLUDES \"\")\n  foreach(EXCLUDE ${COVERAGE_GCOVR_EXCLUDES})\n    list(APPEND GCOVR_EXCLUDES \"-e\")\n    list(APPEND GCOVR_EXCLUDES \"${EXCLUDE}\")\n  endforeach()\n\n  add_custom_target(\n    ${Coverage_NAME}\n    # Run tests\n    ${Coverage_EXECUTABLE} ${Coverage_EXECUTABLE_ARGS}\n    # Create folder\n    COMMAND ${CMAKE_COMMAND} -E make_directory\n            ${PROJECT_BINARY_DIR}/${Coverage_NAME}\n            # Running gcovr\n    COMMAND ${GCOVR_PATH}\n            --html\n            --html-details -r ${PROJECT_SOURCE_DIR} ${GCOVR_EXCLUDES}\n            --object-directory=${PROJECT_BINARY_DIR} -o\n                                                     ${Coverage_NAME}/index.html\n    WORKING_DIRECTORY ${PROJECT_BINARY_DIR}\n    DEPENDS ${Coverage_DEPENDENCIES}\n    COMMENT \"Running gcovr to produce HTML code coverage report.\")\n\n  # Show info where to find the report\n  add_custom_command(\n    TARGET ${Coverage_NAME} POST_BUILD\n    COMMAND ;\n    COMMENT\n      \"Open ${CMAKE_CURRENT_BINARY_DIR}/${Coverage_NAME}/index.html in your browser to view the coverage report.\"\n    )\n\nendfunction() # SETUP_TARGET_FOR_COVERAGE_GCOVR_HTML\n\nfunction(APPEND_COVERAGE_COMPILER_FLAGS)\n  foreach(_opt ${COVERAGE_COMPILER_FLAGS})\n    add_compile_options($<$<COMPILE_LANGUAGE:C>:${_opt}>)\n    add_compile_options($<$<COMPILE_LANGUAGE:CXX>:${_opt}>)\n  endforeach()\n  message(\n    STATUS \"Appending code coverage compiler flags: ${COVERAGE_COMPILER_FLAGS}\")\nendfunction() # APPEND_COVERAGE_COMPILER_FLAGS\n"
  },
  {
    "path": "cmake/Conky.cmake",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\n# set(RELEASE true)\n\n# Set system vars\nif(CMAKE_SYSTEM_NAME MATCHES \"Linux\")\n  set(OS_LINUX true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"Linux\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"FreeBSD\")\n  set(OS_FREEBSD true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"FreeBSD\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"DragonFly\")\n  set(OS_DRAGONFLY true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"DragonFly\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"OpenBSD\")\n  set(OS_OPENBSD true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"OpenBSD\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"SunOS\")\n  set(OS_SOLARIS true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"SunOS\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"NetBSD\")\n  set(OS_NETBSD true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"NetBSD\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"Haiku\")\n  set(OS_HAIKU true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"Haiku\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n  set(OS_DARWIN true)\nendif(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n\nif(NOT OS_LINUX\n  AND NOT OS_FREEBSD\n  AND NOT OS_OPENBSD\n  AND NOT OS_NETBSD\n  AND NOT OS_DRAGONFLY\n  AND NOT OS_SOLARIS\n  AND NOT OS_HAIKU\n  AND NOT OS_DARWIN)\n  message(\n    FATAL_ERROR\n    \"Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported.  Patches are welcome.\"\n  )\nendif(NOT\n  OS_LINUX\n  AND\n  NOT\n  OS_FREEBSD\n  AND\n  NOT\n  OS_OPENBSD\n  AND\n  NOT\n  OS_NETBSD\n  AND\n  NOT\n  OS_DRAGONFLY\n  AND\n  NOT\n  OS_SOLARIS\n  AND\n  NOT\n  OS_HAIKU\n  AND\n  NOT\n  OS_DARWIN)\n\ninclude(FindThreads)\nfind_package(Threads)\n\nset(conky_libs ${CMAKE_THREAD_LIBS_INIT})\nset(conky_includes ${CMAKE_BINARY_DIR})\n\n#\n# On Darwin _POSIX_C_SOURCE must be >= __DARWIN_C_FULL for asprintf to be\n# enabled! Thus disable this and _LARGEFILE64_SOURCE isnt needed, it is already\n# used on macOS.\n#\nif(NOT OS_DARWIN AND NOT OS_OPENBSD)\n  add_definitions(-D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L) # Standard definitions\n  set(\n    CMAKE_REQUIRED_DEFINITIONS\n    \"${CMAKE_REQUIRED_DEFINITIONS} -D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L\"\n  )\nendif(NOT OS_DARWIN AND NOT OS_OPENBSD)\n\nif(OS_FREEBSD)\n  add_definitions(-D__BSD_VISIBLE=1 -D_XOPEN_SOURCE=700)\n  set(\n    CMAKE_REQUIRED_DEFINITIONS\n    \"${CMAKE_REQUIRED_DEFINITIONS} -D_LARGEFILE64_SOURCE -D_POSIX_C_SOURCE=200809L -D__BSD_VISIBLE=1 -D_XOPEN_SOURCE=700\"\n  )\nendif(OS_FREEBSD)\n\nif(OS_DRAGONFLY)\n  set(conky_libs ${conky_libs} -L/usr/pkg/lib)\n  set(conky_includes ${conky_includes} -I/usr/pkg/include)\nendif(OS_DRAGONFLY)\n\nif(OS_OPENBSD)\n  # For asprintf\n  add_definitions(-D_GNU_SOURCE) # Standard definitions\n  set(\n    CMAKE_REQUIRED_DEFINITIONS\n    \"${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE\"\n  )\nendif(OS_OPENBSD)\nif(OS_NETBSD)\n  set(conky_libs ${conky_libs} -L/usr/pkg/lib)\n\n  add_definitions(-D_NETBSD_SOURCE -D_XOPEN_SOURCE=700)\n  set(\n    CMAKE_REQUIRED_DEFINITIONS\n    \"${CMAKE_REQUIRED_DEFINITIONS} -D_NETBSD_SOURCE -D_POSIX_C_SOURCE=200809L -D_XOPEN_SOURCE=700\"\n  )\nendif(OS_NETBSD)\n\nif(OS_SOLARIS)\n  set(conky_libs ${conky_libs} -L/usr/local/lib)\nendif(OS_SOLARIS)\n\nif(OS_HAIKU)\n  # For asprintf\n  add_definitions(-D_GNU_SOURCE) # Standard definitions\n  set(\n    CMAKE_REQUIRED_DEFINITIONS\n    \"${CMAKE_REQUIRED_DEFINITIONS} -D_GNU_SOURCE\"\n  )\nendif(OS_HAIKU)\n\n# Do version stuff\nset(VERSION_MAJOR \"1\")\nset(VERSION_MINOR \"22\")\nset(VERSION_PATCH \"4\")\n\nfind_program(APP_AWK awk)\n\nif(NOT APP_AWK)\n  message(FATAL_ERROR \"Unable to find program 'awk'\")\nendif(NOT APP_AWK)\n\nfind_program(APP_WC wc)\n\nif(NOT APP_WC)\n  message(FATAL_ERROR \"Unable to find program 'wc'\")\nendif(NOT APP_WC)\n\nfind_program(APP_UNAME uname)\n\nif(NOT APP_UNAME)\n  message(FATAL_ERROR \"Unable to find program 'uname'\")\nendif(NOT APP_UNAME)\n\nif(NOT RELEASE)\n  find_program(APP_GIT git)\n\n  if(NOT APP_GIT)\n    message(FATAL_ERROR \"Unable to find program 'git'\")\n  endif(NOT APP_GIT)\n\n  mark_as_advanced(APP_GIT)\nendif(NOT RELEASE)\n\nmark_as_advanced(APP_AWK APP_WC APP_UNAME)\n\nexecute_process(COMMAND ${APP_UNAME} -sm\n  RESULT_VARIABLE RETVAL\n  OUTPUT_VARIABLE BUILD_ARCH\n  OUTPUT_STRIP_TRAILING_WHITESPACE)\n\nexecute_process(COMMAND ${APP_GIT} rev-parse --short HEAD\n  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}\n  RESULT_VARIABLE RETVAL\n  OUTPUT_VARIABLE GIT_SHORT_SHA\n  OUTPUT_STRIP_TRAILING_WHITESPACE)\n\nset(RELEASE_VERSION \"${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}\")\n\nif(RELEASE)\n  set(VERSION ${RELEASE_VERSION})\nelse(RELEASE)\n  set(VERSION\n    \"${RELEASE_VERSION}-pre-${GIT_SHORT_SHA}\")\nendif(RELEASE)\n\nset(COPYRIGHT \"Copyright Brenden Matthews, et al, 2005-2024\")\n\nmacro(AC_SEARCH_LIBS FUNCTION_NAME INCLUDES TARGET_VAR)\n  if(\"${TARGET_VAR}\" MATCHES \"^${TARGET_VAR}$\")\n    unset(AC_SEARCH_LIBS_TMP CACHE)\n    check_symbol_exists(${FUNCTION_NAME} ${INCLUDES} AC_SEARCH_LIBS_TMP)\n\n    if(${AC_SEARCH_LIBS_TMP})\n      set(${TARGET_VAR} \"\" CACHE INTERNAL \"Library containing ${FUNCTION_NAME}\")\n    else(${AC_SEARCH_LIBS_TMP})\n      foreach(LIB ${ARGN})\n        unset(AC_SEARCH_LIBS_TMP CACHE)\n        unset(AC_SEARCH_LIBS_FOUND CACHE)\n        find_library(AC_SEARCH_LIBS_TMP ${LIB})\n        check_library_exists(${LIB}\n          ${FUNCTION_NAME}\n          ${AC_SEARCH_LIBS_TMP}\n          AC_SEARCH_LIBS_FOUND)\n\n        if(${AC_SEARCH_LIBS_FOUND})\n          set(${TARGET_VAR} ${AC_SEARCH_LIBS_TMP}\n            CACHE INTERNAL \"Library containing ${FUNCTION_NAME}\")\n          break()\n        endif(${AC_SEARCH_LIBS_FOUND})\n      endforeach(LIB)\n    endif(${AC_SEARCH_LIBS_TMP})\n  endif(\"${TARGET_VAR}\" MATCHES \"^${TARGET_VAR}$\")\nendmacro(AC_SEARCH_LIBS)\n\n# A function to print the target build properties\nfunction(print_target_properties tgt)\n  if(NOT TARGET ${tgt})\n    message(\"There is no target named '${tgt}'\")\n    return()\n  endif()\n\n  # this list of properties can be extended as needed\n  set(CMAKE_PROPERTY_LIST\n    SOURCE_DIR\n    BINARY_DIR\n    COMPILE_DEFINITIONS\n    COMPILE_OPTIONS\n    INCLUDE_DIRECTORIES\n    LINK_LIBRARIES)\n\n  message(\"Configuration for target ${tgt}\")\n\n  foreach(prop ${CMAKE_PROPERTY_LIST})\n    get_property(propval TARGET ${tgt} PROPERTY ${prop} SET)\n\n    if(propval)\n      get_target_property(propval ${tgt} ${prop})\n      message(STATUS \"${prop} = ${propval}\")\n    endif()\n  endforeach(prop)\nendfunction(print_target_properties)\n"
  },
  {
    "path": "cmake/ConkyBuildOptions.cmake",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\ninclude(CMakeDependentOption)\ninclude(DependentOption)\n\n# This flag is for developers of conky and automated tests in conky repository.\n# It should not be enabled by package maintainers as produced binary is -O0.\noption(MAINTAINER_MODE \"Use defaults for development environment (debug, testing, etc.)\" false)\noption(BUILD_TESTING \"Build test binary\" ${MAINTAINER_MODE})\ncmake_dependent_option(RUN_TESTS \"Run tests once the build is complete\" false\n  \"BUILD_TESTING\" false)\n# Use gcov (requires LLVM compiler) to generate code coverage\noption(CODE_COVERAGE \"Enable code coverage report generation\" false)\n\nif(NOT CMAKE_BUILD_TYPE)\n  if(MAINTAINER_MODE)\n    message(WARNING \"Default build type: Debug (because MAINTAINER_MODE is set)\")\n    set(\n      CMAKE_BUILD_TYPE Debug\n      CACHE\n      STRING\n      \"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel.\"\n      FORCE)\n  else(MAINTAINER_MODE)\n    message(STATUS \"Default build type: RelWithDebInfo\")\n    set(\n      CMAKE_BUILD_TYPE RelWithDebInfo\n      CACHE\n      STRING\n      \"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel.\"\n      FORCE)\n  endif(MAINTAINER_MODE)\nendif(NOT CMAKE_BUILD_TYPE)\n\n# -std options for all build types\nset(CMAKE_C_STANDARD 99)\nset(CMAKE_CXX_STANDARD 17)\nset(CMAKE_CXX_STANDARD_REQUIRED ON)\nset(CMAKE_CXX_EXTENSIONS OFF)\nset(CMAKE_COMPILE_WARNING_AS_ERROR ${MAINTAINER_MODE})\n\nif(NOT OS_OPENBSD)\n  # Always use libc++ when compiling w/ clang\n  # Not on OpenBSD because that's the default for its vendored Clang\n  add_compile_options(\n    $<$<COMPILE_LANG_AND_ID:CXX,Clang>:-stdlib=libc++>)\n  add_link_options($<$<COMPILE_LANG_AND_ID:CXX,Clang>:-stdlib=libc++>)\nendif(NOT OS_OPENBSD)\n\nadd_compile_options(\n  $<$<COMPILE_LANG_AND_ID:CXX,Clang>:-Wno-unknown-warning-option>\n  $<$<COMPILE_LANG_AND_ID:CXX,GCC>:-Wno-unknown-warning>)\n\n# Makes builds fully reproducible for environments (such as NixOS) that prefer\n# building the binary from a clean slate. This makes build defaults and process\n# avoid optimizations like compiler caching and reusing already built files.\noption(REPRODUCIBLE_BUILD \"Makes builds fully reproducible\" OFF)\n\nif(REPRODUCIBLE_BUILD)\n  set(USE_CCACHE_DEFAULT OFF)\nelse()\n  set(USE_CCACHE_DEFAULT ON)\nendif()\nmark_as_advanced(USE_CCACHE_DEFAULT)\n# Instead of rebuilding objects from scratch, the compiler will reuse cached\n# parts of compilation in order to speed up compilation.\noption(USE_CCACHE \"Sccache/ccache will be used (if installed) to speed up compilation\" ${USE_CCACHE_DEFAULT})\n\noption(CHECK_CODE_QUALITY \"Check code formatting/quality with clang\" ${MAINTAINER_MODE})\n\noption(RELEASE \"Build release package\" false)\nmark_as_advanced(RELEASE)\n\noption(BUILD_DOCS \"Build documentation\" false)\noption(BUILD_EXTRAS \"Build extras (includes syntax files for editors)\" false)\n\noption(BUILD_I18N \"Enable if you want internationalization support\" true)\n\nif(BUILD_I18N)\n  set(LOCALE_DIR \"${CMAKE_INSTALL_PREFIX}/share/locale\"\n    CACHE STRING \"Directory containing the locales\")\nendif(BUILD_I18N)\n\noption(BUILD_COLOUR_NAME_MAP \"Include mappings of colour name -> RGB (e.g. red -> ff0000)\" true)\n\n# Some standard options\nset(SYSTEM_CONFIG_FILE \"/etc/conky/conky.conf\"\n  CACHE STRING \"Default system-wide Conky configuration file\")\n\n# use FORCE below to make sure this changes when CMAKE_INSTALL_PREFIX is\n# modified\nif(NOT LIB_INSTALL_DIR)\n  set(LIB_INSTALL_DIR \"${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}\")\nendif(NOT LIB_INSTALL_DIR)\n\nset(PACKAGE_LIBRARY_DIR \"${LIB_INSTALL_DIR}/conky\"\n  CACHE STRING \"Package library path (where Lua bindings are installed\"\n  FORCE)\nset(DEFAULTNETDEV \"eno1\" CACHE STRING \"Default networkdevice\")\n\n# Mac only override\nif(OS_DARWIN)\n  set(DEFAULTNETDEV \"en0\" CACHE STRING \"Default networkdevice\" FORCE)\nendif(OS_DARWIN)\n\nset(XDG_CONFIG_FILE \"$HOME/.config/conky/conky.conf\"\n  CACHE STRING \"Configfile of the user (XDG)\")\nset(CONFIG_FILE \"$HOME/.conkyrc\" CACHE STRING \"Configfile of the user\")\nset(MAX_USER_TEXT_DEFAULT \"16384\"\n  CACHE STRING\n  \"Default maximum size of config TEXT buffer, i.e. below TEXT line.\")\nset(DEFAULT_TEXT_BUFFER_SIZE \"256\"\n  CACHE STRING \"Default size used for temporary, static text buffers\")\nset(MAX_NET_INTERFACES \"256\" CACHE STRING \"Maximum number of network devices\")\n\n# Platform specific options Linux only\ncmake_dependent_option(BUILD_PORT_MONITORS \"Build TCP portmon support\" true\n  \"OS_LINUX\" false)\ncmake_dependent_option(BUILD_IBM \"Support for IBM/Lenovo notebooks\" true\n  \"OS_LINUX\" false)\ncmake_dependent_option(BUILD_HDDTEMP \"Support for hddtemp\" true\n  \"OS_LINUX\" false)\ncmake_dependent_option(BUILD_IPV6 \"Enable if you want IPv6 support\" true\n  \"OS_LINUX\" false)\n\nif(OS_LINUX)\n  # nvidia may also work on FreeBSD, not sure\n  # NvCtrl requires X11. Should be modified to use NVML directly.\n  dependent_option(BUILD_NVIDIA \"Enable Nvidia NvCtrl variables\" false\n    \"BUILD_X11\" false\n    \"Nvidia NvCtrl variables require X11\")\nelse()\n  set(BUILD_NVIDIA false CACHE BOOL \"Enable Nvidia NvCtrl variables\" FORCE)\nendif(OS_LINUX)\n\n# macOS Only\ncmake_dependent_option(\n  BUILD_IPGFREQ\n  \"Enable cpu freq calculation based on Intel® Power Gadget; otherwise use constant factory value\"\n  false\n  \"OS_DARWIN\" false)\n\noption(ENABLE_RUNTIME_TWEAKS \"Enable runtime environment checks for better system integration\" true)\n\n# Optional features etc\noption(BUILD_WLAN \"Enable wireless support\" false)\n\noption(BUILD_BUILTIN_CONFIG \"Enable builtin default configuration\" true)\n\noption(BUILD_IOSTATS \"Enable disk I/O stats\" true)\n\noption(BUILD_OLD_CONFIG \"Enable support for the old syntax of configurations\"\n  true)\n\noption(BUILD_MATH \"Enable math support\" true)\n\noption(BUILD_NCURSES \"Enable ncurses support\" true)\n\ndependent_option(LEAKFREE_NCURSES\n  \"Enable to hide false ncurses-memleaks in valgrind (works only when ncurses is compiled with --disable-leaks)\"\n  false\n  \"BUILD_NCURSES\" false\n  \"LEAKFREE_NCURSES requires ncurses\")\n\noption(BUILD_WAYLAND \"Build Wayland support\" false)\n\noption(BUILD_X11 \"Build X11 support\" true)\n\ndependent_option(OWN_WINDOW \"Enable running conky in a dedicated window\" true\n  \"BUILD_X11\" false\n  \"Dedicated window mode only works on X11\")\n\n# On MacOS these cause issues so they're disabled by default\nif(OS_DARWIN)\n  dependent_option(BUILD_XDAMAGE \"Build Xdamage support\" false\n    \"BUILD_X11\" false\n    \"Xdamage support requires X11\")\n  dependent_option(BUILD_XFIXES \"Build Xfixes support\" false\n    \"BUILD_X11\" false\n    \"Xfixes support requires X11\")\nelse()\n  dependent_option(BUILD_XDAMAGE \"Build Xdamage support\" true\n    \"BUILD_X11\" false\n    \"Xdamage support requires X11\")\n  dependent_option(BUILD_XFIXES \"Build Xfixes support\" true\n    \"BUILD_X11\" false\n    \"Xfixes support requires X11\")\nendif(OS_DARWIN)\n\ndependent_option(BUILD_ARGB \"Build ARGB (real transparency) support\" true\n  \"BUILD_X11;OWN_WINDOW\" false\n  \"ARGB support requires X11 and OWN_WINDOW enabled, not needed on Wayland\")\ndependent_option(BUILD_XINERAMA \"Build Xinerama support\" true\n  \"BUILD_X11\" false\n  \"Xinerama support requires X11\")\ndependent_option(BUILD_XDBE \"Build Xdbe (double-buffer) support\" true\n  \"BUILD_X11\" false\n  \"Xdbe based double-buffering requires X11\")\ndependent_option(BUILD_XFT \"Build Xft (freetype fonts) support\" true\n  \"BUILD_X11\" false\n  \"Xft (freetype font) support requires X11\")\ndependent_option(BUILD_IMLIB2 \"Enable Imlib2 support\" true\n  \"BUILD_X11\" false\n  \"Imlib2 support requires X11\")\ndependent_option(BUILD_XSHAPE \"Enable Xshape support\" true\n  \"BUILD_X11\" false\n  \"Xshape support requires X11\")\ndependent_option(BUILD_XINPUT \"Build Xinput 2 support (slow)\" false\n  \"BUILD_X11\" false\n  \"Xinput 2 support requires X11\")\n\n# if we build with any GUI support\nif(BUILD_X11)\n  set(BUILD_GUI true)\nendif(BUILD_X11)\n\nif(BUILD_WAYLAND)\n  set(BUILD_GUI true)\nendif(BUILD_WAYLAND)\n\ndependent_option(BUILD_MOUSE_EVENTS \"Enable mouse event support\" true\n  \"BUILD_WAYLAND OR BUILD_X11\" false\n  \"Mouse event support requires Wayland or X11 enabled\")\n\n# Lua library options\ndependent_option(BUILD_LUA_CAIRO \"Build Cairo bindings for Lua\" false\n  \"BUILD_GUI\" false\n  \"Cairo Lua bindings depend on BUILD_GUI\")\ndependent_option(BUILD_LUA_CAIRO_XLIB \"Build Cairo & Xlib interoperability for Lua\" true\n  \"BUILD_X11;BUILD_LUA_CAIRO\" false\n  \"Cairo Xlib Lua bindings require Cairo and X11\")\ndependent_option(BUILD_LUA_IMLIB2 \"Build Imlib2 bindings for Lua\" false\n  \"BUILD_X11;BUILD_IMLIB2\" false\n  \"Imlib2 Lua bindings require X11 and Imlib2\")\ndependent_option(BUILD_LUA_RSVG \"Build rsvg bindings for Lua\" false\n  \"BUILD_GUI\" false\n  \"RSVG Lua bindings depend on BUILD_GUI\")\ndependent_option(BUILD_LUA_TEXT \"Build Fontconfig Freetype and Harfbuzz for Lua\" false\n  \"BUILD_GUI\" false\n  \"Text Lua bindings depend on BUILD_GUI\")\n\noption(BUILD_OPENSOUNDSYS \"Build with Open Sound System support\" true)\n\noption(BUILD_AUDACIOUS \"Build audacious (music player) support\" false)\n\noption(BUILD_MPD \"Enable if you want MPD (music player) support\" true)\n\noption(BUILD_MYSQL \"Enable if you want MySQL support\" false)\n\noption(BUILD_MOC \"Enable if you want MOC (music player) support\" true)\n\noption(BUILD_XMMS2 \"Enable if you want XMMS2 (music player) support\" false)\n\noption(BUILD_CURL \"Enable if you want Curl support\" false)\n\ndependent_option(BUILD_RSS \"Enable if you want RSS support\" false\n  \"BUILD_CURL\" false\n  \"RSS depends on Curl support\")\n\noption(BUILD_APCUPSD \"Enable APCUPSD support\" true)\n\noption(BUILD_ICAL \"Enable if you want iCalendar (RFC 5545) support\" false)\n\noption(BUILD_IRC \"Enable if you want IRC support\" false)\n\noption(BUILD_HTTP \"Enable if you want HTTP support\" false)\n\nif(NOT BUILD_HTTP)\n  set(HTTPPORT \"10080\" CACHE STRING \"Port to use for out_to_http\")\nelse(NOT BUILD_HTTP)\n  set(HTTPPORT \"10080\")\nendif(NOT BUILD_HTTP)\n\noption(BUILD_ICONV \"Enable iconv support\" false)\n\noption(BUILD_CMUS \"Enable support for cmus music player\" true)\n\noption(BUILD_JOURNAL \"Enable support for reading from the systemd journal\"\n  false)\n\noption(BUILD_PULSEAUDIO\n  \"Enable support for Pulseaudio's default sink and source\" false)\n\noption(BUILD_INTEL_BACKLIGHT\n  \"Enable support for Intel backlight\" false)\n\nrun_dependency_checks()\n\nmessage(STATUS \"CMAKE_C_FLAGS: \" ${CMAKE_C_FLAGS})\nmessage(STATUS \"CMAKE_CXX_FLAGS: \" ${CMAKE_CXX_FLAGS})\n\nmessage(STATUS \"CMAKE_C_FLAGS_DEBUG: \" ${CMAKE_C_FLAGS_DEBUG})\nmessage(STATUS \"CMAKE_CXX_FLAGS_DEBUG: \" ${CMAKE_CXX_FLAGS_DEBUG})\n\nmessage(STATUS \"CMAKE_C_FLAGS_MINSIZEREL: \" ${CMAKE_C_FLAGS_MINSIZEREL})\nmessage(STATUS \"CMAKE_CXX_FLAGS_MINSIZEREL: \" ${CMAKE_CXX_FLAGS_MINSIZEREL})\n\nmessage(STATUS \"CMAKE_C_FLAGS_RELEASE: \" ${CMAKE_C_FLAGS_RELEASE})\nmessage(STATUS \"CMAKE_CXX_FLAGS_RELEASE: \" ${CMAKE_CXX_FLAGS_RELEASE})\n\nmessage(STATUS \"CMAKE_C_FLAGS_RELWITHDEBINFO: \" ${CMAKE_C_FLAGS_RELWITHDEBINFO})\nmessage(STATUS \"CMAKE_CXX_FLAGS_RELWITHDEBINFO: \"\n  ${CMAKE_CXX_FLAGS_RELWITHDEBINFO})\n\nmessage(STATUS \"CMAKE_BUILD_TYPE: \" ${CMAKE_BUILD_TYPE})\n"
  },
  {
    "path": "cmake/ConkyCPackSetup.cmake",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\nset(CPACK_GENERATOR \"TGZ;STGZ;DEB\")\nset(CPACK_DEBIAN_PACKAGE_DEPENDS \"libc6 (>=2.10-1), libgcc1 (>= 1:4.4.0)\")\nset(CPACK_PACKAGE_CONTACT \"brenden@diddyinc.com\")\nset(CPACK_DEBIAN_PACKAGE_MAINTAINER \"Brenden Matthews\")\nset(CPACK_PACKAGE_FILE_NAME\n  \"${PROJECT_NAME}-${VERSION}-${CMAKE_SYSTEM_NAME}-${CPU_ARCH}\")\n\nset(CPACK_PACKAGE_INSTALL_DIRECTORY ${PROJECT_NAME})\n\nset(CPACK_STRIP_FILES true)\n\n# Version numbering, copyright notice, etc. are taken from the variables defined\n# in ../CMakeLists.txt.\nset(CPACK_PACKAGE_VERSION_MAJOR \"${VERSION_MAJOR}\")\nset(CPACK_PACKAGE_VERSION_MINOR \"${VERSION_MINOR}\")\nset(CPACK_PACKAGE_VERSION_PATCH \"${VERSION_PATCH}\")\n\nif(CPACK_GENERATOR MATCHES \"NSIS\")\n  set(CPACK_NSIS_COMPRESSOR \"/FINAL /SOLID lzma\")\n  set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} ${PROJECT_NAME})\nendif(CPACK_GENERATOR MATCHES \"NSIS\")\n\n# Source package setup. Compile with \"make package_source\".\nset(CPACK_SOURCE_PACKAGE_FILE_NAME \"${PROJECT_NAME}-${VERSION}-src\")\nset(CPACK_SOURCE_GENERATOR \"TBZ2\")\nexecute_process(COMMAND ${APP_UNAME}\n  COMMAND ${APP_AWK} \"{print $1}\"\n  RESULT_VARIABLE RETVAL\n  OUTPUT_VARIABLE CPU_ARCH\n  OUTPUT_STRIP_TRAILING_WHITESPACE)\n\nset(CPACK_SOURCE_IGNORE_FILES\n\n  # Exclude backup files generated by text editors.\n  \"~$\"\n\n  # Git dir/files.\n  \"\\\\\\\\.git.*$\"\n\n  # vim swap files\n  \"\\\\\\\\..*\\\\\\\\.swp$\"\n\n  # Build dir.\n  \"build.*$\")\n\n# Enable CPack\ninclude(CPack)\n"
  },
  {
    "path": "cmake/ConkyPlatformChecks.cmake",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2025 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\ninclude(FindPkgConfig)\ninclude(CheckFunctionExists)\ninclude(CheckIncludeFiles)\ninclude(CheckSymbolExists)\n\n# Check for some headers\ncheck_include_files(sys/statfs.h HAVE_SYS_STATFS_H)\ncheck_include_files(sys/param.h HAVE_SYS_PARAM_H)\ncheck_include_files(sys/inotify.h HAVE_SYS_INOTIFY_H)\ncheck_include_files(dirent.h HAVE_DIRENT_H)\n\n# Check for some functions\ncheck_function_exists(strndup HAVE_STRNDUP)\n\ncheck_symbol_exists(pipe2 \"unistd.h\" HAVE_PIPE2)\ncheck_symbol_exists(O_CLOEXEC \"fcntl.h\" HAVE_O_CLOEXEC)\n\nif(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n  check_symbol_exists(statfs64 \"sys/mount.h\" HAVE_STATFS64)\nelse(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n  check_symbol_exists(statfs64 \"sys/statfs.h\" HAVE_STATFS64)\nendif(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n\nac_search_libs(clock_gettime \"time.h\" CLOCK_GETTIME_LIB \"rt\")\n\nif(NOT DEFINED CLOCK_GETTIME_LIB)\n  if(NOT CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n    message(FATAL_ERROR \"clock_gettime not found.\")\n  endif(NOT CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\nelse(NOT DEFINED CLOCK_GETTIME_LIB)\n  set(HAVE_CLOCK_GETTIME 1)\nendif(NOT DEFINED CLOCK_GETTIME_LIB)\n\nset(conky_libs ${conky_libs} ${CLOCK_GETTIME_LIB})\n\n# standard path to search for includes\nset(INCLUDE_SEARCH_PATH /usr/include /usr/local/include)\n\nfunction(conky_append_include_dirs dest_var)\n  foreach(_dir IN LISTS ARGN)\n    if(NOT _dir)\n      continue()\n    endif()\n\n    if(OS_DARWIN)\n      if(_dir MATCHES \"/usr/include/?$\")\n        continue()\n      endif()\n      if(_dir MATCHES \"MacOSX[^/]*/usr/include/?$\")\n        continue()\n      endif()\n    endif()\n\n    list(APPEND ${dest_var} ${_dir})\n  endforeach()\n\n  list(REMOVE_DUPLICATES ${dest_var})\n  set(${dest_var} \"${${dest_var}}\" PARENT_SCOPE)\nendfunction()\n\nfunction(conky_filter_implicit_include_dirs var_name)\n  set(_filtered)\n  foreach(_dir IN LISTS ${var_name})\n    if(OS_DARWIN AND _dir MATCHES \"^/nix/store/\")\n      if(_dir MATCHES \"libcxx\"\n        OR _dir MATCHES \"compiler-rt\"\n        OR _dir MATCHES \"clang-wrapper\"\n        OR _dir MATCHES \"clang-[0-9]\"\n        OR _dir MATCHES \"libobjc\"\n        OR _dir MATCHES \"resource-root\"\n        OR _dir MATCHES \"libSystem\"\n        OR _dir MATCHES \"sdkroot\")\n        list(APPEND _filtered \"${_dir}\")\n      endif()\n    else()\n      list(APPEND _filtered \"${_dir}\")\n    endif()\n  endforeach()\n\n  set(${var_name} \"${_filtered}\" PARENT_SCOPE)\nendfunction()\n\n# Detect CI\nif(DEFINED ENV{CI})\n  # For GitHub actions CI=true is set\n  set(ENV_IS_CI true)\n  mark_as_advanced(ENV_IS_CI)\nendif()\n\n# Set system vars\nif(CMAKE_SYSTEM_NAME MATCHES \"Linux\")\n  set(OS_LINUX true)\nelse(CMAKE_SYSTEM_NAME MATCHES \"Linux\")\n  set(OS_LINUX false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"Linux\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"FreeBSD\")\n  set(OS_FREEBSD true)\n  set(conky_libs ${conky_libs} -lkvm -ldevstat -linotify)\n\n  if(BUILD_IRC)\n    set(conky_libs ${conky_libs} -lssl -lcrypto)\n  endif(BUILD_IRC)\nelse(CMAKE_SYSTEM_NAME MATCHES \"FreeBSD\")\n  set(OS_FREEBSD false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"FreeBSD\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"DragonFly\")\n  set(OS_DRAGONFLY true)\n  set(conky_libs ${conky_libs} -ldevstat)\nelse(CMAKE_SYSTEM_NAME MATCHES \"DragonFly\")\n  set(OS_DRAGONFLY false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"DragonFly\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"OpenBSD\")\n  set(OS_OPENBSD true)\n  set(conky_libs ${conky_libs} -lkvm)\nelse(CMAKE_SYSTEM_NAME MATCHES \"OpenBSD\")\n  set(OS_OPENBSD false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"OpenBSD\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"SunOS\")\n  set(OS_SOLARIS true)\n  set(conky_libs ${conky_libs} -lkstat)\nelse(CMAKE_SYSTEM_NAME MATCHES \"SunOS\")\n  set(OS_SOLARIS false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"SunOS\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"NetBSD\")\n  set(OS_NETBSD true)\n  set(conky_libs ${conky_libs} -lkvm)\nelse(CMAKE_SYSTEM_NAME MATCHES \"NetBSD\")\n  set(OS_NETBSD false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"NetBSD\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"Haiku\")\n  set(OS_HAIKU true)\n  set(conky_libs ${conky_libs} -lnetwork)\nelse(CMAKE_SYSTEM_NAME MATCHES \"Haiku\")\n  set(OS_HAIKU false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"Haiku\")\n\nif(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n  set(OS_DARWIN true)\nelse(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n  set(OS_DARWIN false)\nendif(CMAKE_SYSTEM_NAME MATCHES \"Darwin\")\n\nif(OS_DARWIN)\n  set(CONKY_C_IMPLICIT_INCLUDE_DIRECTORIES_RAW\n    ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES})\n  set(CONKY_CXX_IMPLICIT_INCLUDE_DIRECTORIES_RAW\n    ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES})\n  set(CONKY_PLATFORM_EXTRA_INCLUDE_DIRS\n    ${CONKY_C_IMPLICIT_INCLUDE_DIRECTORIES_RAW}\n    ${CONKY_CXX_IMPLICIT_INCLUDE_DIRECTORIES_RAW})\n  list(REMOVE_DUPLICATES CONKY_PLATFORM_EXTRA_INCLUDE_DIRS)\n\n  # Nix clang wrappers can report third-party package headers as implicit\n  # includes. CMake then drops those directories from generated compile\n  # commands, so feature-enabled builds lose X11/Lua/curl headers unless we\n  # keep only the true toolchain/runtime implicit paths here.\n  conky_filter_implicit_include_dirs(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES)\n  conky_filter_implicit_include_dirs(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES)\nendif()\n\nif(NOT OS_LINUX\n  AND NOT OS_FREEBSD\n  AND NOT OS_OPENBSD\n  AND NOT OS_NETBSD\n  AND NOT OS_DRAGONFLY\n  AND NOT OS_SOLARIS\n  AND NOT OS_HAIKU\n  AND NOT OS_DARWIN)\n  message(\n    FATAL_ERROR\n    \"Your platform, '${CMAKE_SYSTEM_NAME}', is not currently supported.  Patches are welcome.\"\n  )\nendif(NOT\n  OS_LINUX\n  AND\n  NOT\n  OS_FREEBSD\n  AND\n  NOT\n  OS_OPENBSD\n  AND\n  NOT\n  OS_NETBSD\n  AND\n  NOT\n  OS_DRAGONFLY\n  AND\n  NOT\n  OS_SOLARIS\n  AND\n  NOT\n  OS_HAIKU\n  AND\n  NOT\n  OS_DARWIN)\n\nif(OS_LINUX)\n  check_include_files(\"linux/sockios.h\" HAVE_LINUX_SOCKIOS_H)\nendif(OS_LINUX)\n\n# Handle Open Sound System\nif(BUILD_OPENSOUNDSYS)\n  if(OS_LINUX)\n    check_include_files(\"linux/soundcard.h\" HAVE_SOUNDCARD_H)\n  elseif(OS_OPENBSD OR OS_NETBSD)\n    check_include_files(\"soundcard.h\" HAVE_SOUNDCARD_H)\n    # OpenBSD (and FreeBSD?) provide emulation layer on top of sndio.\n    if(HAVE_SOUNDCARD_H)\n      find_library(OSS_AUDIO_LIB\n        NAMES ossaudio\n        PATHS /usr/lib\n        /usr/local/lib)\n      set(conky_libs ${conky_libs} ${OSS_AUDIO_LIB})\n    endif(HAVE_SOUNDCARD_H)\n  else(OS_LINUX)\n    check_include_files(\"sys/soundcard.h\" HAVE_SOUNDCARD_H)\n  endif(OS_LINUX)\nendif(BUILD_OPENSOUNDSYS)\n\nif(BUILD_I18N)\n  include(FindIntl)\n  find_package(Intl)\n\n  if(OS_DARWIN AND NOT Intl_FOUND)\n    set(CONKY_DARWIN_GETTEXT_PREFIXES\n      /opt/homebrew/opt/gettext\n      /usr/local/opt/gettext)\n\n    find_path(CONKY_DARWIN_GETTEXT_INCLUDE_DIR\n      NAMES libintl.h\n      PATHS ${CONKY_DARWIN_GETTEXT_PREFIXES}\n      PATH_SUFFIXES include\n      NO_DEFAULT_PATH)\n    find_library(CONKY_DARWIN_GETTEXT_LIBRARY\n      NAMES intl libintl\n      PATHS ${CONKY_DARWIN_GETTEXT_PREFIXES}\n      PATH_SUFFIXES lib\n      NO_DEFAULT_PATH)\n\n    if(CONKY_DARWIN_GETTEXT_INCLUDE_DIR AND CONKY_DARWIN_GETTEXT_LIBRARY)\n      set(Intl_FOUND TRUE)\n      set(Intl_IS_BUILT_IN FALSE)\n      set(Intl_INCLUDE_DIR \"${CONKY_DARWIN_GETTEXT_INCLUDE_DIR}\")\n      set(Intl_LIBRARY \"${CONKY_DARWIN_GETTEXT_LIBRARY}\")\n      set(Intl_INCLUDE_DIRS \"${CONKY_DARWIN_GETTEXT_INCLUDE_DIR}\")\n      set(Intl_LIBRARIES \"${CONKY_DARWIN_GETTEXT_LIBRARY}\")\n      set(Intl_INCLUDE_DIR \"${CONKY_DARWIN_GETTEXT_INCLUDE_DIR}\" CACHE PATH\n        \"Directory containing libintl headers\" FORCE)\n      set(Intl_LIBRARY \"${CONKY_DARWIN_GETTEXT_LIBRARY}\" CACHE FILEPATH\n        \"Path to libintl library\" FORCE)\n    endif()\n  endif()\n\n  if(NOT Intl_FOUND)\n    if(OS_DARWIN)\n      message(FATAL_ERROR\n        \"Unable to find libintl.\\n\"\n        \"Checked CMake's default search and Homebrew prefixes:\\n\"\n        \"  /opt/homebrew/opt/gettext\\n\"\n        \"  /usr/local/opt/gettext\\n\"\n        \"If gettext is installed via Homebrew, re-run CMake after ensuring\\n\"\n        \"the prefix exists or pass -DIntl_INCLUDE_DIR and -DIntl_LIBRARY explicitly.\")\n    else()\n      message(FATAL_ERROR \"Unable to find libintl\")\n    endif(OS_DARWIN)\n  endif(NOT Intl_FOUND)\n\n  if(OS_DARWIN AND Intl_IS_BUILT_IN)\n    set(CONKY_DARWIN_INTL_IMPLICIT_LIBS)\n    foreach(_lib ${CMAKE_C_IMPLICIT_LINK_LIBRARIES}\n                 ${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES})\n      if(_lib STREQUAL \"intl\" OR _lib STREQUAL \"iconv\")\n        unset(CONKY_IMPLICIT_LIB_PATH CACHE)\n        find_library(CONKY_IMPLICIT_LIB_PATH\n          NAMES ${_lib}\n          PATHS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}\n                ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}\n          NO_DEFAULT_PATH)\n        if(CONKY_IMPLICIT_LIB_PATH)\n          list(APPEND CONKY_DARWIN_INTL_IMPLICIT_LIBS\n            ${CONKY_IMPLICIT_LIB_PATH})\n        else()\n          list(APPEND CONKY_DARWIN_INTL_IMPLICIT_LIBS ${_lib})\n        endif()\n      endif()\n    endforeach()\n    list(REMOVE_DUPLICATES CONKY_DARWIN_INTL_IMPLICIT_LIBS)\n    set(conky_libs ${conky_libs} ${CONKY_DARWIN_INTL_IMPLICIT_LIBS})\n  endif()\n\n  conky_append_include_dirs(conky_includes ${Intl_INCLUDE_DIRS})\n  set(conky_libs ${conky_libs} ${Intl_LIBRARIES})\nendif(BUILD_I18N)\n\nif(BUILD_NCURSES AND OS_DARWIN)\n  set(conky_libs ${conky_libs} -lncurses)\nendif(BUILD_NCURSES AND OS_DARWIN)\n\nif(BUILD_WLAN AND OS_DARWIN)\n  find_library(CW CoreWLAN)\n  find_library(NS Foundation)\n  set(conky_libs ${conky_libs} ${CW})\n  set(conky_libs ${conky_libs} ${NS})\nendif(BUILD_WLAN AND OS_DARWIN)\n\nif(OS_DARWIN AND BUILD_IPGFREQ)\n  find_library(IPG IntelPowerGadget)\n  set(conky_libs ${conky_libs} ${IPG})\nendif(OS_DARWIN AND BUILD_IPGFREQ)\n\nif(BUILD_MATH)\n  set(conky_libs ${conky_libs} -lm)\nendif(BUILD_MATH)\n\nif(BUILD_ICAL)\n  check_include_files(libical/ical.h ICAL_H_)\n\n  if(NOT ICAL_H_)\n    message(FATAL_ERROR \"Unable to find libical\")\n  endif(NOT ICAL_H_)\n\n  set(conky_libs ${conky_libs} -lical)\nendif(BUILD_ICAL)\n\nif(BUILD_IRC)\n  find_path(IRC_H_N libircclient.h PATHS /usr/include/libircclient)\n  find_path(IRC_H_S libircclient.h PATHS /usr/include)\n\n  if(IRC_H_N)\n    include_directories(${IRC_H_N})\n  endif(IRC_H_N)\n\n  if(IRC_H_N OR IRC_H_S)\n    set(IRC_H_ true)\n  else()\n    message(FATAL_ERROR \"Unable to find libircclient\")\n  endif(IRC_H_N OR IRC_H_S)\n\n  set(conky_libs ${conky_libs} -lircclient)\nendif(BUILD_IRC)\n\nif(BUILD_IPV6)\n  find_file(IF_INET6 if_inet6 PATHS /proc/net)\n\n  if(NOT IF_INET6)\n    message(WARNING \"/proc/net/if_inet6 unavailable\")\n  endif(NOT IF_INET6)\nendif(BUILD_IPV6)\n\nif(BUILD_HTTP)\n  pkg_check_modules(MICROHTTPD libmicrohttpd>=0.9.25)\n\n  if(MICROHTTPD_FOUND)\n    set(conky_libs ${conky_libs} ${MICROHTTPD_LINK_LIBRARIES})\n    conky_append_include_dirs(conky_includes ${MICROHTTPD_INCLUDE_DIRS})\n  else()\n    if(OS_DARWIN)\n      set(CONKY_DARWIN_MICROHTTPD_PREFIXES\n        /opt/homebrew/opt/libmicrohttpd\n        /usr/local/opt/libmicrohttpd)\n\n      find_path(MICROHTTPD_INCLUDE_DIR\n        NAMES microhttpd.h\n        PATHS ${CONKY_DARWIN_MICROHTTPD_PREFIXES}\n        PATH_SUFFIXES include\n        NO_DEFAULT_PATH)\n      find_library(MICROHTTPD_LIBRARY\n        NAMES microhttpd libmicrohttpd\n        PATHS ${CONKY_DARWIN_MICROHTTPD_PREFIXES}\n        PATH_SUFFIXES lib\n        NO_DEFAULT_PATH)\n    else()\n      find_path(MICROHTTPD_INCLUDE_DIR NAMES microhttpd.h)\n      find_library(MICROHTTPD_LIBRARY NAMES microhttpd libmicrohttpd)\n    endif()\n\n    if(MICROHTTPD_INCLUDE_DIR AND MICROHTTPD_LIBRARY)\n      file(STRINGS \"${MICROHTTPD_INCLUDE_DIR}/microhttpd.h\"\n        MICROHTTPD_VERSION_LINE\n        REGEX \"^#define MHD_VERSION 0x[0-9A-Fa-f]+\")\n      if(NOT MICROHTTPD_VERSION_LINE)\n        message(FATAL_ERROR\n          \"Unable to determine libmicrohttpd version from \"\n          \"${MICROHTTPD_INCLUDE_DIR}/microhttpd.h\")\n      endif()\n\n      string(REGEX REPLACE \".*0x([0-9A-Fa-f]+).*\" \"\\\\1\"\n        MICROHTTPD_VERSION_HEX \"${MICROHTTPD_VERSION_LINE}\")\n      math(EXPR MICROHTTPD_VERSION_NUM \"0x${MICROHTTPD_VERSION_HEX}\")\n      math(EXPR MICROHTTPD_MIN_VERSION_NUM \"0x00092500\")\n\n      if(MICROHTTPD_VERSION_NUM LESS MICROHTTPD_MIN_VERSION_NUM)\n        message(FATAL_ERROR\n          \"Found libmicrohttpd version 0x${MICROHTTPD_VERSION_HEX}, but \"\n          \"Conky requires at least 0x00092500 (0.9.25).\")\n      endif()\n\n      set(MICROHTTPD_INCLUDE_DIRS \"${MICROHTTPD_INCLUDE_DIR}\")\n      set(MICROHTTPD_LINK_LIBRARIES \"${MICROHTTPD_LIBRARY}\")\n      set(conky_libs ${conky_libs} ${MICROHTTPD_LINK_LIBRARIES})\n      conky_append_include_dirs(conky_includes ${MICROHTTPD_INCLUDE_DIRS})\n    elseif(OS_DARWIN)\n      message(FATAL_ERROR\n        \"Unable to find libmicrohttpd.\\n\"\n        \"Checked pkg-config and Homebrew prefixes:\\n\"\n        \"  /opt/homebrew/opt/libmicrohttpd\\n\"\n        \"  /usr/local/opt/libmicrohttpd\\n\"\n        \"If installed via Homebrew, ensure PKG_CONFIG_PATH includes\\n\"\n        \"libmicrohttpd/lib/pkgconfig or pass MICROHTTPD_INCLUDE_DIR and\\n\"\n        \"MICROHTTPD_LIBRARY explicitly.\")\n    else()\n      message(FATAL_ERROR \"Unable to find libmicrohttpd\")\n    endif()\n  endif()\nendif(BUILD_HTTP)\n\nif(BUILD_NCURSES)\n  set(CURSES_NEED_NCURSES TRUE)\n\n  find_path(CURSES_INCLUDE_PATH\n    NAMES curses.h\n    PATH_SUFFIXES ncurses\n    PATHS /usr/include /usr/local/include /usr/pkg/include\n  )\n\n  find_library(CURSES_LIBRARY\n    NAMES curses\n    PATHS /lib /usr/lib /usr/local/lib /usr/pkg/lib\n  )\n\n  find_package(PkgConfig QUIET)\n  if(PKG_CONFIG_FOUND)\n    pkg_search_module(NCURSES ncurses)\n    set(CURSES_LIBRARY ${NCURSES_LDFLAGS})\n  endif()\n\n  if(NOT CURSES_LIBRARY OR NOT CURSES_INCLUDE_PATH)\n    message(FATAL_ERROR \"Unable to find curses library\")\n  else(NOT CURSES_LIBRARY OR NOT CURSES_INCLUDE_PATH)\n    message(STATUS \"curses found.\")\n    message(STATUS \"  include: ${CURSES_INCLUDE_PATH}\")\n    message(STATUS \"  lib: ${CURSES_LIBRARY}\")\n  endif(NOT CURSES_LIBRARY OR NOT CURSES_INCLUDE_PATH)\n\n  set(conky_libs ${conky_libs} ${CURSES_LIBRARY})\n  set(conky_includes ${conky_includes} ${CURSES_INCLUDE_PATH})\n\n  if(OS_NETBSD)\n    cmake_path(GET CURSES_INCLUDE_PATH PARENT_PATH CURSES_PARENT)\n    set(conky_includes ${conky_includes} ${CURSES_PARENT})\n  endif(OS_NETBSD)\nendif(BUILD_NCURSES)\n\nif(BUILD_MYSQL)\n  find_path(mysql_INCLUDE_PATH\n    mysql.h\n    ${INCLUDE_SEARCH_PATH}\n    /usr/include/mysql\n    /usr/local/include/mysql)\n\n  if(NOT mysql_INCLUDE_PATH)\n    message(FATAL_ERROR \"Unable to find mysql.h\")\n  endif(NOT mysql_INCLUDE_PATH)\n\n  set(conky_includes ${conky_includes} ${mysql_INCLUDE_PATH})\n  find_library(MYSQLCLIENT_LIB\n    NAMES mysqlclient\n    PATHS /usr/lib\n    /usr/lib64\n    /usr/lib/mysql\n    /usr/lib64/mysql\n    /usr/local/lib\n    /usr/local/lib64\n    /usr/local/lib/mysql\n    /usr/local/lib64/mysql)\n\n  if(NOT MYSQLCLIENT_LIB)\n    message(FATAL_ERROR \"Unable to find mysqlclient library\")\n  endif(NOT MYSQLCLIENT_LIB)\n\n  set(conky_libs ${conky_libs} ${MYSQLCLIENT_LIB})\nendif(BUILD_MYSQL)\n\nif(BUILD_WLAN AND OS_LINUX)\n  set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)\n  check_include_files(iwlib.h IWLIB_H)\n\n  if(NOT IWLIB_H)\n    message(FATAL_ERROR \"Unable to find iwlib.h\")\n  endif(NOT IWLIB_H)\n\n  find_library(IWLIB_LIB NAMES iw)\n\n  if(NOT IWLIB_LIB)\n    message(FATAL_ERROR \"Unable to find libiw.so\")\n  endif(NOT IWLIB_LIB)\n\n  set(conky_libs ${conky_libs} ${IWLIB_LIB})\n  check_function_exists(iw_sockets_open IWLIB_SOCKETS_OPEN_FUNC)\nendif(BUILD_WLAN AND OS_LINUX)\n\nif(BUILD_PORT_MONITORS)\n  check_function_exists(getnameinfo HAVE_GETNAMEINFO)\n\n  if(NOT HAVE_GETNAMEINFO)\n    message(FATAL_ERROR \"could not find getnameinfo()\")\n  endif(NOT HAVE_GETNAMEINFO)\n\n  check_include_files(\n    \"netdb.h;netinet/in.h;netinet/tcp.h;sys/socket.h;arpa/inet.h\"\n    HAVE_PORTMON_HEADERS)\n\n  if(NOT HAVE_PORTMON_HEADERS)\n    message(FATAL_ERROR \"missing needed network header(s) for port monitoring\")\n  endif(NOT HAVE_PORTMON_HEADERS)\nendif(BUILD_PORT_MONITORS)\n\n# Check for iconv\nif(BUILD_ICONV)\n  check_include_files(iconv.h HAVE_ICONV_H)\n  find_library(ICONV_LIBRARY NAMES iconv)\n\n  if(NOT ICONV_LIBRARY)\n    # maybe iconv() is provided by libc\n    set(ICONV_LIBRARY \"\"\n      CACHE FILEPATH\n      \"Path to the iconv library, if iconv is not provided by libc\"\n      FORCE)\n  endif(NOT ICONV_LIBRARY)\n\n  set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARY})\n  check_function_exists(iconv ICONV_FUNC)\n\n  if(HAVE_ICONV_H AND ICONV_FUNC)\n    set(conky_includes ${conky_includes} ${ICONV_INCLUDE_DIR})\n    set(conky_libs ${conky_libs} ${ICONV_LIBRARY})\n  else(HAVE_ICONV_H AND ICONV_FUNC)\n    message(FATAL_ERROR \"Unable to find iconv library\")\n  endif(HAVE_ICONV_H AND ICONV_FUNC)\nendif(BUILD_ICONV)\n\n# check for Xlib\nif(BUILD_X11)\n  include(FindX11)\n  find_package(X11)\n\n  if(X11_FOUND)\n    set(conky_includes ${conky_includes} ${X11_INCLUDE_DIR})\n    set(conky_libs ${conky_libs} ${X11_LIBRARIES})\n\n    # check for Xdamage\n    if(BUILD_XDAMAGE)\n      if(NOT X11_Xdamage_FOUND)\n        message(FATAL_ERROR \"Unable to find Xdamage library\")\n      endif(NOT X11_Xdamage_FOUND)\n\n      if(NOT X11_Xfixes_FOUND)\n        message(FATAL_ERROR \"Unable to find Xfixes library\")\n      endif(NOT X11_Xfixes_FOUND)\n\n      set(conky_libs ${conky_libs} ${X11_Xdamage_LIB} ${X11_Xfixes_LIB})\n    endif(BUILD_XDAMAGE)\n\n    if(BUILD_XSHAPE)\n      if(NOT X11_Xshape_FOUND)\n        message(FATAL_ERROR \"Unable to find Xshape library\")\n      endif(NOT X11_Xshape_FOUND)\n\n      set(conky_libs ${conky_libs} ${X11_Xshape_LIB})\n    endif(BUILD_XSHAPE)\n\n    # check for Xft\n    if(BUILD_XFT)\n      if(FREETYPE_INCLUDE_DIR_freetype2)\n        set(FREETYPE_FOUND true)\n        set(conky_includes ${conky_includes} ${FREETYPE_INCLUDE_DIR_freetype2})\n      else(FREETYPE_INCLUDE_DIR_freetype2)\n        message(FATAL_ERROR \"Unable to find freetype library\")\n      endif(FREETYPE_INCLUDE_DIR_freetype2)\n\n      if(NOT X11_Xft_FOUND)\n        message(FATAL_ERROR \"Unable to find Xft library\")\n      endif(NOT X11_Xft_FOUND)\n\n      find_package(Fontconfig REQUIRED)\n\n      set(conky_libs ${conky_libs} ${X11_Xft_LIB} ${Fontconfig_LIBRARIES})\n      set(conky_includes ${conky_includes} ${FREETYPE_INCLUDE_DIR_freetype2} ${Fontconfig_INCLUDE_DIRS})\n    endif(BUILD_XFT)\n\n    # check for Xdbe\n    if(BUILD_XDBE)\n      if(NOT X11_Xext_FOUND)\n        message(FATAL_ERROR \"Unable to find Xext library (needed for Xdbe)\")\n      endif(NOT X11_Xext_FOUND)\n\n      set(conky_libs ${conky_libs} ${X11_Xext_LIB})\n    endif(BUILD_XDBE)\n\n    # check for Xinerama\n    if(BUILD_XINERAMA)\n      if(NOT X11_Xinerama_FOUND)\n        message(FATAL_ERROR \"Unable to find Xinerama library\")\n      endif(NOT X11_Xinerama_FOUND)\n\n      set(conky_libs ${conky_libs} ${X11_Xinerama_LIB})\n    endif(BUILD_XINERAMA)\n\n    # check for Xfixes\n    if(BUILD_XFIXES)\n      if(NOT X11_Xfixes_FOUND)\n        message(FATAL_ERROR \"Unable to find Xfixes library\")\n      endif(NOT X11_Xfixes_FOUND)\n\n      set(conky_libs ${conky_libs} ${X11_Xfixes_LIB})\n    endif(BUILD_XFIXES)\n\n    # check for Xinput\n    if(BUILD_XINPUT)\n      if(NOT X11_Xinput_FOUND)\n        message(FATAL_ERROR \"Unable to find Xinput library\")\n      endif(NOT X11_Xinput_FOUND)\n\n      set(conky_libs ${conky_libs} ${X11_Xinput_LIB})\n    endif(BUILD_XINPUT)\n\n    if(X11_xcb_FOUND)\n      set(HAVE_XCB true)\n      set(conky_libs ${conky_libs} ${X11_xcb_LIB})\n      set(conky_includes ${conky_includes} ${X11_xcb_INCLUDE_PATH})\n\n      if(X11_xcb_errors_FOUND)\n        set(HAVE_XCB_ERRORS true)\n        set(conky_includes ${conky_includes} ${X11_xcb_errors_INCLUDE_PATH})\n        set(conky_libs ${conky_libs} ${X11_xcb_LIB} ${X11_xcb_errors_LIB})\n      else(X11_xcb_errors_FOUND)\n        set(HAVE_XCB_ERRORS false)\n      endif(X11_xcb_errors_FOUND)\n    else(X11_xcb_FOUND)\n      set(HAVE_XCB false)\n    endif(X11_xcb_FOUND)\n  else(X11_FOUND)\n    message(FATAL_ERROR \"Unable to find X11 library\")\n  endif(X11_FOUND)\nendif(BUILD_X11)\n\nif(BUILD_WAYLAND)\n  find_package(Wayland REQUIRED)\n  set(conky_libs ${conky_libs} ${Wayland_CLIENT_LIBRARY})\n  set(conky_includes ${conky_includes} ${Wayland_CLIENT_INCLUDE_DIR})\n\n  find_package(PkgConfig)\n\n  pkg_check_modules(wayland-protocols QUIET wayland-protocols>=1.13)\n\n  if(Wayland_FOUND AND wayland-protocols_FOUND)\n    # find Wayland protocols\n    pkg_get_variable(Wayland_PROTOCOLS_DIR wayland-protocols pkgdatadir)\n\n    # find 'wayland-scanner' executable\n    pkg_get_variable(Wayland_SCANNER wayland-scanner wayland_scanner)\n    if(NOT Wayland_SCANNER)\n      message(FATAL_ERROR \"Unable to find wayland-scanner\")\n    endif(NOT Wayland_SCANNER)\n  else(Wayland_FOUND AND wayland-protocols_FOUND)\n    message(FATAL_ERROR \"Unable to find wayland or wayland protocols\")\n  endif(Wayland_FOUND AND wayland-protocols_FOUND)\n\n  if(OS_DARWIN OR OS_DRAGONFLY OR OS_FREEBSD OR OS_NETBSD OR OS_OPENBSD)\n    pkg_check_modules(EPOLL REQUIRED epoll-shim)\n    set(conky_libs ${conky_libs} ${EPOLL_LINK_LIBRARIES})\n    set(conky_includes ${conky_includes} ${EPOLL_INCLUDE_DIRS})\n  endif(OS_DARWIN OR OS_DRAGONFLY OR OS_FREEBSD OR OS_NETBSD OR OS_OPENBSD)\n\n  pkg_check_modules(CAIRO REQUIRED cairo)\n  set(conky_libs ${conky_libs} ${CAIRO_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${CAIRO_INCLUDE_DIR})\n\n  pkg_check_modules(PANGO REQUIRED pango)\n  set(conky_libs ${conky_libs} ${PANGO_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${PANGO_INCLUDE_DIRS})\n\n  pkg_check_modules(PANGOCAIRO pangocairo)\n  set(conky_libs ${conky_libs} ${PANGOCAIRO_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${PANGOCAIRO_INCLUDE_DIRS})\n\n  pkg_check_modules(PANGOFC pangofc)\n  set(conky_libs ${conky_libs} ${PANGOFC_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${PANGOFC_INCLUDE_DIRS})\n\n  pkg_check_modules(PANGOFT2 pangoft2)\n  set(conky_libs ${conky_libs} ${PANGOFT2_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${PANGOFT2_INCLUDE_DIRS})\nendif(BUILD_WAYLAND)\n\nfind_package(Lua \"5.3\" REQUIRED)\n\nset(conky_libs ${conky_libs} ${LUA_LIBRARIES})\nset(conky_includes ${conky_includes} ${LUA_INCLUDE_DIR})\ninclude_directories(3rdparty/toluapp/include)\n\n# Check for libraries used by Lua bindings\nif(BUILD_LUA_CAIRO)\n  pkg_check_modules(CAIRO REQUIRED cairo>=1.14)\n  set(luacairo_libs ${CAIRO_LINK_LIBRARIES} ${LUA_LIBRARIES})\n  set(luacairo_includes ${CAIRO_INCLUDE_DIRS} ${LUA_INCLUDE_DIR})\n\n  if(BUILD_LUA_CAIRO_XLIB)\n    pkg_check_modules(CAIROXLIB REQUIRED cairo-xlib)\n    set(luacairo_libs ${CAIROXLIB_LINK_LIBRARIES} ${luacairo_libs})\n    set(luacairo_includes ${CAIROXLIB_INCLUDE_DIRS} ${luacairo_includes})\n  endif(BUILD_LUA_CAIRO_XLIB)\n\n  find_program(APP_PATCH patch)\n\n  if(NOT APP_PATCH)\n    message(FATAL_ERROR \"Unable to find program 'patch'\")\n  endif(NOT APP_PATCH)\nendif(BUILD_LUA_CAIRO)\n\nif(BUILD_LUA_IMLIB2)\n  pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2)\n  set(luaimlib2_libs ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS} ${LUA_LIBRARIES})\n  set(luaimlib2_includes\n    ${IMLIB2_INCLUDE_DIRS}\n    ${LUA_INCLUDE_DIR}\n    ${X11_INCLUDE_DIR})\nendif(BUILD_LUA_IMLIB2)\n\nif(BUILD_LUA_RSVG)\n  pkg_check_modules(RSVG REQUIRED librsvg-2.0>=2.52)\n  set(luarsvg_libs ${RSVG_LINK_LIBRARIES} ${LUA_LIBRARIES})\n  set(luarsvg_includes ${RSVG_INCLUDE_DIRS} ${LUA_INCLUDE_DIR})\nendif(BUILD_LUA_RSVG)\n\nif(BUILD_LUA_TEXT)\n  find_package(Freetype REQUIRED)\n  PKG_CHECK_MODULES(FONTCONFIG REQUIRED fontconfig)\n  PKG_CHECK_MODULES(HARFBUZZ REQUIRED harfbuzz)\n  set(luatext_libs ${FONTCONFIG_LIBRARIES} ${HARFBUZZ_LIBRARIES} ${LUA_LIBRARIES})\n  set(luatext_includes ${FREETYPE_INCLUDE_DIR_freetype2} ${FONTCONFIG_INCLUDE_DIRS} ${HARFBUZZ_INCLUDE_DIRS} ${LUA_INCLUDE_DIRS})\nendif(BUILD_LUA_TEXT)\n\nif(BUILD_AUDACIOUS)\n  set(WANT_GLIB true)\n  pkg_check_modules(NEW_AUDACIOUS audacious>=1.4.0)\n\n  if(NEW_AUDACIOUS_FOUND)\n    pkg_check_modules(AUDACIOUS REQUIRED audclient>=1.4.0)\n    pkg_check_modules(DBUS_GLIB REQUIRED dbus-glib-1)\n  else(NEW_AUDACIOUS_FOUND)\n    pkg_check_modules(AUDACIOUS REQUIRED audacious<1.4.0)\n  endif(NEW_AUDACIOUS_FOUND)\n\n  set(conky_libs ${conky_libs} ${AUDACIOUS_LINK_LIBRARIES} ${DBUS_GLIB_LIBRARIES})\n  set(conky_includes\n    ${conky_includes}\n    ${AUDACIOUS_INCLUDE_DIRS}\n    ${DBUS_GLIB_INCLUDE_DIRS})\nendif(BUILD_AUDACIOUS)\n\nif(BUILD_XMMS2)\n  pkg_check_modules(XMMS2 REQUIRED xmms2-client>=0.6)\n  set(conky_libs ${conky_libs} ${XMMS2_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${XMMS2_INCLUDE_DIRS})\nendif(BUILD_XMMS2)\n\nif(BUILD_CURL)\n  set(WANT_CURL true)\nendif(BUILD_CURL)\n\nif(BUILD_RSS)\n  set(WANT_CURL true)\n  set(WANT_LIBXML2 true)\nendif(BUILD_RSS)\n\nif(BUILD_NVIDIA)\n  find_path(XNVCtrl_INCLUDE_PATH NVCtrl/NVCtrl.h ${INCLUDE_SEARCH_PATH})\n  find_library(XNVCtrl_LIB NAMES XNVCtrl)\n\n  if(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)\n    set(XNVCtrl_FOUND true)\n    set(conky_libs ${conky_libs} ${XNVCtrl_LIB})\n    set(conky_includes ${conky_includes} ${XNVCtrl_INCLUDE_PATH})\n  else(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)\n    message(FATAL_ERROR \"Unable to find XNVCtrl library\")\n  endif(XNVCtrl_INCLUDE_PATH AND XNVCtrl_LIB)\nendif(BUILD_NVIDIA)\n\nif(BUILD_IMLIB2)\n  pkg_search_module(IMLIB2 REQUIRED imlib2 Imlib2)\n  set(conky_libs ${conky_libs} ${IMLIB2_LIBS} ${IMLIB2_LDFLAGS})\n  set(conky_includes ${conky_includes} ${IMLIB2_INCLUDE_DIRS})\nendif(BUILD_IMLIB2)\n\nif(BUILD_JOURNAL)\n  pkg_search_module(SYSTEMD REQUIRED libsystemd>=205 libsystemd-journal>=205)\n  set(conky_libs ${conky_libs} ${SYSTEMD_LIB} ${SYSTEMD_LDFLAGS})\n  set(conky_includes ${conky_includes} ${SYSTEMD_INCLUDE_DIRS})\nendif(BUILD_JOURNAL)\n\nif(BUILD_PULSEAUDIO)\n  pkg_check_modules(PULSEAUDIO REQUIRED libpulse)\n  set(conky_libs ${conky_libs} ${PULSEAUDIO_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${PULSEAUDIO_INCLUDE_DIRS})\nendif(BUILD_PULSEAUDIO)\n\nif(WANT_CURL)\n  pkg_check_modules(CURL libcurl)\n  if(CURL_FOUND)\n    set(conky_libs ${conky_libs} ${CURL_LINK_LIBRARIES})\n    conky_append_include_dirs(conky_includes ${CURL_INCLUDE_DIRS})\n  else()\n    find_package(CURL REQUIRED)\n    set(CONKY_CURL_INCLUDE_CANDIDATE \"${CURL_INCLUDE_DIRS}\")\n    if(NOT CONKY_CURL_INCLUDE_CANDIDATE)\n      set(CONKY_CURL_INCLUDE_CANDIDATE \"${CURL_INCLUDE_DIR}\")\n    endif()\n\n    set(CONKY_CURL_LIBRARY_CANDIDATE \"${CURL_LIBRARIES}\")\n    if(NOT CONKY_CURL_LIBRARY_CANDIDATE)\n      if(CURL_LIBRARY_RELEASE)\n        set(CONKY_CURL_LIBRARY_CANDIDATE \"${CURL_LIBRARY_RELEASE}\")\n      elseif(CURL_LIBRARY)\n        set(CONKY_CURL_LIBRARY_CANDIDATE \"${CURL_LIBRARY}\")\n      endif()\n    endif()\n\n    if(OS_DARWIN AND\n        (NOT CONKY_CURL_INCLUDE_CANDIDATE OR\n         CONKY_CURL_INCLUDE_CANDIDATE MATCHES \"MacOSX[^/]*/usr/include/?$\"))\n      set(CONKY_DARWIN_CURL_PREFIXES\n        /opt/homebrew/opt/curl\n        /usr/local/opt/curl)\n\n      find_path(CONKY_DARWIN_CURL_INCLUDE_DIR\n        NAMES curl/curl.h\n        PATHS ${CONKY_DARWIN_CURL_PREFIXES}\n        PATH_SUFFIXES include\n        NO_DEFAULT_PATH)\n      find_library(CONKY_DARWIN_CURL_LIBRARY\n        NAMES curl libcurl\n        PATHS ${CONKY_DARWIN_CURL_PREFIXES}\n        PATH_SUFFIXES lib\n        NO_DEFAULT_PATH)\n\n      if(CONKY_DARWIN_CURL_INCLUDE_DIR AND CONKY_DARWIN_CURL_LIBRARY)\n        set(CONKY_CURL_INCLUDE_CANDIDATE \"${CONKY_DARWIN_CURL_INCLUDE_DIR}\")\n        set(CONKY_CURL_LIBRARY_CANDIDATE \"${CONKY_DARWIN_CURL_LIBRARY}\")\n      endif()\n    endif()\n\n    if(NOT CONKY_CURL_INCLUDE_CANDIDATE OR\n        NOT EXISTS \"${CONKY_CURL_INCLUDE_CANDIDATE}/curl/curl.h\" OR\n        NOT CONKY_CURL_LIBRARY_CANDIDATE)\n      message(FATAL_ERROR\n        \"Unable to find a consistent libcurl installation.\\n\"\n        \"If libcurl is installed in a non-standard prefix, set PKG_CONFIG_PATH\\n\"\n        \"or pass -DCURL_INCLUDE_DIR and -DCURL_LIBRARY explicitly.\")\n    endif()\n\n    get_filename_component(CONKY_CURL_LIBRARY_DIR\n      \"${CONKY_CURL_LIBRARY_CANDIDATE}\" DIRECTORY)\n    get_filename_component(CONKY_CURL_PREFIX\n      \"${CONKY_CURL_INCLUDE_CANDIDATE}\" DIRECTORY)\n    get_filename_component(CONKY_CURL_PREFIX\n      \"${CONKY_CURL_PREFIX}\" DIRECTORY)\n\n    if(NOT CONKY_CURL_LIBRARY_DIR MATCHES \"^${CONKY_CURL_PREFIX}(/|$)\")\n      message(FATAL_ERROR\n        \"Detected libcurl headers in '${CONKY_CURL_INCLUDE_CANDIDATE}' but \"\n        \"library in '${CONKY_CURL_LIBRARY_CANDIDATE}'.\\n\"\n        \"Refusing to mix libcurl installations; set PKG_CONFIG_PATH or pass \"\n        \"-DCURL_INCLUDE_DIR and -DCURL_LIBRARY explicitly.\")\n    endif()\n\n    set(CURL_INCLUDE_DIRS \"${CONKY_CURL_INCLUDE_CANDIDATE}\")\n    set(CURL_LIBRARIES \"${CONKY_CURL_LIBRARY_CANDIDATE}\")\n    set(conky_libs ${conky_libs} ${CURL_LIBRARIES})\n    conky_append_include_dirs(conky_includes ${CURL_INCLUDE_DIRS})\n  endif()\nendif(WANT_CURL)\n\n# Common libraries\nif(WANT_GLIB)\n  pkg_check_modules(GLIB REQUIRED glib-2.0>=2.36)\n  set(conky_libs ${conky_libs} ${GLIB_LINK_LIBRARIES})\n  set(conky_includes ${conky_includes} ${GLIB_INCLUDE_DIRS})\nendif(WANT_GLIB)\n\nif(WANT_LIBXML2)\n  include(FindLibXml2)\n\n  if(NOT LIBXML2_FOUND)\n    message(FATAL_ERROR \"Unable to find libxml2 library\")\n  endif(NOT LIBXML2_FOUND)\n\n  set(conky_libs ${conky_libs} ${LIBXML2_LIBRARIES})\n  conky_append_include_dirs(conky_includes ${LIBXML2_INCLUDE_DIR})\nendif(WANT_LIBXML2)\n\n# Look for doc generation programs\nif(BUILD_DOCS)\n  # Used for doc generation\n  find_program(APP_PANDOC pandoc)\n\n  if(NOT APP_PANDOC)\n    message(FATAL_ERROR \"Unable to find program 'pandoc'\")\n  endif(NOT APP_PANDOC)\n\n  mark_as_advanced(APP_PANDOC)\nendif(BUILD_DOCS)\n\nif(BUILD_DOCS OR BUILD_EXTRAS)\n  # Python3 with Jinja2 and PyYaml required for manpage generation.\n  find_package(Python3 REQUIRED COMPONENTS Interpreter)\n  execute_process(\n    COMMAND ${Python3_EXECUTABLE} -c \"import yaml\"\n    RESULT_VARIABLE EXIT_CODE\n    OUTPUT_QUIET\n  )\n\n  if(NOT ${EXIT_CODE} EQUAL 0)\n    message(\n      FATAL_ERROR\n      \"The \\\"PyYAML\\\" Python3 package is not installed. Please install it using the following command: \\\"pip3 install pyyaml\\\".\"\n    )\n  endif()\n\n  execute_process(\n    COMMAND ${Python3_EXECUTABLE} -c \"import jinja2\"\n    RESULT_VARIABLE EXIT_CODE\n    OUTPUT_QUIET\n  )\n\n  if(NOT ${EXIT_CODE} EQUAL 0)\n    message(\n      FATAL_ERROR\n      \"The \\\"Jinja2\\\" Python3 package is not installed. Please install it using the following command: \\\"pip3 install Jinja2\\\".\"\n    )\n  endif()\nendif(BUILD_DOCS OR BUILD_EXTRAS)\n\nif(BUILD_COLOUR_NAME_MAP)\n  find_program(APP_GPERF gperf)\n\n  if(NOT APP_GPERF)\n    message(FATAL_ERROR \"Unable to find program 'gperf' (required at build-time as of Conky v1.20.2)\")\n  endif(NOT APP_GPERF)\n\n  mark_as_advanced(APP_GPERF)\nendif(BUILD_COLOUR_NAME_MAP)\n\nif(CMAKE_BUILD_TYPE MATCHES \"Debug\")\n  set(DEBUG true)\nendif(CMAKE_BUILD_TYPE MATCHES \"Debug\")\n\n# The version numbers are simply derived from the date and number of commits\n# since start of month\nif(DEBUG)\n  execute_process(COMMAND ${APP_GIT} --git-dir=${CMAKE_CURRENT_SOURCE_DIR}/.git\n    log --since=${VERSION_MAJOR}-${VERSION_MINOR}-01\n    --pretty=oneline\n    COMMAND ${APP_WC} -l\n    COMMAND ${APP_AWK} \"{print $1}\"\n    RESULT_VARIABLE RETVAL\n    OUTPUT_VARIABLE COMMIT_COUNT\n    OUTPUT_STRIP_TRAILING_WHITESPACE)\nendif(DEBUG)\n"
  },
  {
    "path": "cmake/DependentOption.cmake",
    "content": "# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying\n# file Copyright.txt or https://cmake.org/licensing for details.\n\n#[=======================================================================[.rst:\nDependentOption\n--------------------\nRoughly based on CMakeDependentOption:\nhttps://github.com/Kitware/CMake/blob/master/Modules/CMakeDependentOption.cmake\n\nModified to so it produces warnings instead of hiding an option completely and\nsets a default value.\nDifference is that `depends` argument is ALWAYS a semicolon separated list of\n<expr> tokens.\n\nArgument meaning and order are the same, and there's an additional (warn)\nargument which is the message printed if the end-user enabled a feature which\nisn't \"possible\".\n\nActual checks are deferred until RUN_DEPENDENCY_CHECKS() is called in order to\nallow out of order declaration of dependencies and dependecy graph cycles.\nAs the checks can affect each other they're run in a loop until the graph settles.\n#]=======================================================================]\n\nset(__DEPENDENT_OPTIONS_CHANGE_HAPPENED true)\nset(__DEPENDENT_OPTIONS_LATER_INVOKED_CODE \"\")\n\nmacro(DEPENDENT_OPTION option doc default depends else warn)\n  option(${option} \"${doc}\" \"${default}\")\n\n  string(APPEND __DEPENDENT_OPTIONS_LATER_INVOKED_CODE \"\n    set(${option}_POSSIBLE 1)\n    string(REGEX MATCHALL \\\"[^;]+\\\" __${option}_TOKENS \\\"${depends}\\\")\n    foreach(it \\${__${option}_TOKENS})\n      cmake_language(EVAL CODE \\\"\n        if (\\${it})\n        else()\n          set(${option}_POSSIBLE 0)\n        endif()\\\")\n    endforeach()\n    unset(__${option}_TOKENS)\n    if(NOT ${option}_POSSIBLE)\n      if(NOT \\\"\\${${option}}\\\" STREQUAL \\\"${else}\\\")\n        message(NOTICE \\\"${warn}; setting to '${else}'.\\\")\n        set(${option} ${else} CACHE BOOL \\\"${doc}\\\" FORCE)\n        set(__DEPENDENT_OPTIONS_CHANGE_HAPPENED true)\n      endif()\n    endif()\n    unset(${option}_POSSIBLE)\")\nendmacro()\n\nmacro(RUN_DEPENDENCY_CHECKS)\n  # controls max allowed dependency chain to avoid infinite loops during\n  # configure phase\n  set(__DEPENDENT_OPTIONS_LOOP_COUNTER 10)\n\n  while(__DEPENDENT_OPTIONS_CHANGE_HAPPENED)\n    MATH(EXPR __DEPENDENT_OPTIONS_LOOP_COUNTER \"${__DEPENDENT_OPTIONS_LOOP_COUNTER}-1\")\n    set(__DEPENDENT_OPTIONS_CHANGE_HAPPENED false)\n    cmake_language(EVAL CODE \"${__DEPENDENT_OPTIONS_LATER_INVOKED_CODE}\")\n    if(__DEPENDENT_OPTIONS_LOOP_COUNTER LESS_EQUAL \"0\")\n      break()\n    endif()\n  endwhile()\n  unset(__DEPENDENT_OPTIONS_LOOP_COUNTER)\n  set(__DEPENDENT_OPTIONS_CHANGE_HAPPENED true)\n  set(__DEPENDENT_OPTIONS_LATER_INVOKED_CODE \"\")\nendmacro()\n"
  },
  {
    "path": "cmake/FindClangFormat.cmake",
    "content": "# Find Clang format\n#\n\nset(ClangFormat_BIN_NAME\n    clang-format\n    clang-format-5.0\n    clang-format-6.0\n    clang-format-7\n    clang-format-8\n    clang-format-9\n    clang-format-10\n    clang-format-11)\n\nfind_program(ClangFormat_BIN NAMES ${ClangFormat_BIN_NAME})\n\ninclude(FindPackageHandleStandardArgs)\nfind_package_handle_standard_args(ClangFormat DEFAULT_MSG ClangFormat_BIN)\n\nmark_as_advanced(ClangFormat_BIN)\n\nif(ClangFormat_FOUND)\n  # A CMake script to find all source files and setup clang-format targets for\n  # them\n  include(clang-format)\nelse()\n  message(\"clang-format not found. Not setting up format targets\")\nendif()\n"
  },
  {
    "path": "cmake/FindClangTidy.cmake",
    "content": "# Find Clang tidy\n#\n\nset(ClangTidy_BIN_NAME\n    clang-tidy\n    clang-tidy-5.0\n    clang-tidy-6.0\n    clang-tidy-7\n    clang-tidy-8\n    clang-tidy-9\n    clang-tidy-10\n    clang-tidy-11)\n\nfind_program(ClangTidy_BIN NAMES ${ClangTidy_BIN_NAME})\n\ninclude(FindPackageHandleStandardArgs)\nfind_package_handle_standard_args(ClangTidy DEFAULT_MSG ClangTidy_BIN)\n\nmark_as_advanced(ClangTidy_BIN)\n\nif(ClangTidy_FOUND)\n  # A CMake script to find all source files and setup clang-tidy targets for\n  # them\n  include(clang-tidy)\nelse()\n  message(\"clang-tidy not found. Not setting up tidy targets\")\nendif()\n"
  },
  {
    "path": "cmake/FindWayland.cmake",
    "content": "find_path(\n  Wayland_CLIENT_INCLUDE_DIR\n  NAMES wayland-client.h\n)\n\nfind_library(\n  Wayland_CLIENT_LIBRARY\n  NAMES wayland-client libwayland-client\n)\n\nif(Wayland_CLIENT_INCLUDE_DIR AND Wayland_CLIENT_LIBRARY)\n  add_library(wayland::client UNKNOWN IMPORTED)\n\n  set_target_properties(\n    wayland::client PROPERTIES\n    INTERFACE_INCLUDE_DIRECTORIES \"${Wayland_CLIENT_INCLUDE_DIR}\"\n    IMPORTED_LINK_INTERFACE_LANGUAGES \"C\"\n    IMPORTED_LOCATION \"${Wayland_CLIENT_LIBRARY}\"\n  )\nendif()\n\nfind_path(\n  Wayland_SERVER_INCLUDE_DIR\n  NAMES wayland-server.h\n)\n\nfind_library(\n  Wayland_SERVER_LIBRARY\n  NAMES wayland-server libwayland-server\n)\n\nif(Wayland_SERVER_INCLUDE_DIR AND Wayland_SERVER_LIBRARY)\n  add_library(wayland::server UNKNOWN IMPORTED)\n\n  set_target_properties(\n    wayland::server PROPERTIES\n    INTERFACE_INCLUDE_DIRECTORIES \"${Wayland_SERVER_INCLUDE_DIR}\"\n    IMPORTED_LINK_INTERFACE_LANGUAGES \"C\"\n    IMPORTED_LOCATION \"${Wayland_SERVER_LIBRARY}\"\n  )\nendif()\n\ninclude(FindPackageHandleStandardArgs)\nfind_package_handle_standard_args(\n  Wayland\n  REQUIRED_VARS Wayland_CLIENT_LIBRARY Wayland_CLIENT_INCLUDE_DIR Wayland_SERVER_LIBRARY Wayland_SERVER_INCLUDE_DIR\n)\n\nmark_as_advanced(\n  Wayland_CLIENT_INCLUDE_DIR\n  Wayland_CLIENT_LIBRARY\n  Wayland_SERVER_INCLUDE_DIR\n  Wayland_SERVER_LIBRARY\n)\n"
  },
  {
    "path": "cmake/ToLua.cmake",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\nfunction(wrap_tolua VAR FIL)\n  set(INCL)\n  set(${VAR})\n\n  get_filename_component(ABS_FIL ${FIL} ABSOLUTE)\n  get_filename_component(FIL_WE ${FIL} NAME_WE)\n  list(APPEND ${VAR} \"${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc\")\n\n  if(DEFINED ARGV2)\n    get_filename_component(PATCH ${ARGV2} ABSOLUTE)\n    set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}-orig.cc)\n    add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc\n      COMMAND ${APP_PATCH} -s ${TOLUA_OUT} ${PATCH} -o\n      ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc\n      DEPENDS ${TOLUA_OUT} ${PATCH}\n      COMMENT \"Patching lib${FIL_WE}-orig.cc\"\n      VERBATIM)\n    set_source_files_properties(${TOLUA_OUT} PROPERTIES GENERATED TRUE)\n  else()\n    set(TOLUA_OUT ${CMAKE_CURRENT_BINARY_DIR}/lib${FIL_WE}.cc)\n  endif(DEFINED ARGV2)\n\n  # Call toluapp from 3rdparty/ path directly. The last argument to toluapp is\n  # the path to the tolua Lua sources.\n  add_custom_command(OUTPUT ${TOLUA_OUT} ${INCL}\n    COMMAND toluapp -n ${FIL_WE} -o ${TOLUA_OUT} ${ABS_FIL}\n    ${CMAKE_SOURCE_DIR}/3rdparty/toluapp/src/bin/lua/\n    DEPENDS ${ABS_FIL}\n    COMMENT \"Running tolua++ on ${FIL}\"\n    VERBATIM)\n\n  set_source_files_properties(${${VAR}} ${INCL} PROPERTIES GENERATED TRUE)\n  set_source_files_properties(\n    ${${VAR}}\n    PROPERTIES\n    COMPILE_FLAGS\n    \"-Wno-unused-parameter -Wno-cast-qual -Wno-error=pedantic\"\n  )\n\n  set(${VAR} ${${VAR}} PARENT_SCOPE)\nendfunction(wrap_tolua)\n"
  },
  {
    "path": "cmake/UninstallConky.cmake.in",
    "content": "#\n#Conky, a system monitor, based on torsmo\n#\n#Please see COPYING for details\n#\n#Copyright(c) 2005 - 2024 Brenden Matthews, et.al.(see AUTHORS)All rights\n#reserved.\n#\n#This program is free software : you can redistribute it and / or \\\n#    modify it under\n#the terms of the GNU General Public License as published by the Free Software\n#Foundation, either version 3 of the License, or (at your option) any later\n#version.\n#\n#This program is distributed in the hope that it will be useful, but WITHOUT\n#ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n#FOR A PARTICULAR PURPOSE.See the GNU General Public License for more\n#details.You should have received a copy of the GNU General Public License\n#along with this program.If not, see < http:  // www.gnu.org/licenses/>.\n#\n\nif (NOT EXISTS \"${CMAKE_BINARY_DIR}/install_manifest.txt\")\n    message(FATAL_ERROR \"Cannot find install manifest: ${CMAKE_BINARY_DIR}/install_manifest.txt\")\nendif()\n\nfile(READ \"${CMAKE_BINARY_DIR}/install_manifest.txt\" files)\nstring(REGEX REPLACE \"\\n\" \";\" files \"${files}\")\n\nforeach (file ${files})\n    message(STATUS \"Uninstalling $ENV{DESTDIR}${file}\")\n    if (IS_SYMLINK \"$ENV{DESTDIR}${file}\" OR EXISTS \"$ENV{DESTDIR}${file}\")\n        execute_process(COMMAND ${CMAKE_COMMAND} -E remove \"$ENV{DESTDIR}${file}\"\n            OUTPUT_VARIABLE rm_out\n            RESULT_VARIABLE rm_retval)\n        if (NOT \"${rm_retval}\" STREQUAL 0)\n            message(FATAL_ERROR \"Problem when removing $ENV{DESTDIR}${file}\")\n        endif()\n    else()\n        message(STATUS \"File $ENV{DESTDIR}${file} does not exist.\")\n    endif()\nendforeach()\n"
  },
  {
    "path": "cmake/build.h.in",
    "content": "#ifndef __BUILD_H\n#define __BUILD_H\n\n/* Conky build info */\n\n#define BUILD_ARCH \"@BUILD_ARCH@\"\n\n#endif /* __BUILD_H */\n"
  },
  {
    "path": "cmake/clang-format.cmake",
    "content": "set(ClangFormat_CXX_FILE_EXTENSIONS\n    ${ClangFormat_CXX_FILE_EXTENSIONS}\n    *.cpp\n    *.h\n    *.cxx\n    *.hxx\n    *.hpp\n    *.cc\n    *.hh\n    *.ipp)\n\nforeach(PATTERN ${ClangFormat_CXX_FILE_EXTENSIONS})\n  list(APPEND ClangFormat_CXX_PATTERN ${CMAKE_SOURCE_DIR}/src/${PATTERN})\n  list(APPEND ClangFormat_CXX_PATTERN ${CMAKE_SOURCE_DIR}/tests/${PATTERN})\n  list(APPEND ClangFormat_CXX_PATTERN ${CMAKE_SOURCE_DIR}/lua/${PATTERN})\nendforeach()\n\nfile(GLOB_RECURSE ClangFormat_SRCS ${ClangFormat_CXX_PATTERN})\n\n# Remove catch2 from format sources\nlist(REMOVE_ITEM ClangFormat_SRCS ${CMAKE_SOURCE_DIR}/tests/catch2/catch.hpp)\n\nadd_custom_target(clang-format\n                  COMMAND ${ClangFormat_BIN} -style=file -i\n                          ${ClangFormat_SRCS})\nadd_custom_target(check-clang-format\n                  COMMAND ${CMAKE_SOURCE_DIR}/bin/run-clang-format.py\n                          --color always\n                          --clang-format-executable ${ClangFormat_BIN}\n                                                    ${ClangFormat_SRCS})\n"
  },
  {
    "path": "cmake/clang-tidy.cmake",
    "content": "get_target_property(ClangTidy_SRCS_TMP conky SOURCES)\nget_target_property(conky_SRC_DIR conky SOURCE_DIR)\n\nif(BUILD_TESTING)\n  get_target_property(ClangTidy_SRCS_TMP_CORE conky_core SOURCES)\n  list(APPEND ClangTidy_SRCS_TMP ${ClangTidy_SRCS_TMP_CORE})\nendif()\n\nforeach(TMP_SRC ${ClangTidy_SRCS_TMP})\n  if(\"${TMP_SRC}\" MATCHES \".*\\.cc|.*\\.hh|.*\\.[chi]pp|.*\\.[chi]xx|.*\\.ii\")\n    list(APPEND ClangTidy_SRCS ${conky_SRC_DIR}/${TMP_SRC})\n  endif()\nendforeach(TMP_SRC)\n\nget_target_property(CLANG_INCLUDES_tmp conky INCLUDE_DIRECTORIES)\nforeach(TMP_INCLUDE ${CLANG_INCLUDES_tmp})\n  list(APPEND CLANG_INCLUDES -I${TMP_INCLUDE})\nendforeach(TMP_INCLUDE)\n\nadd_custom_target(clang-tidy\n                  COMMAND ${ClangTidy_BIN} -config='' -fix -format-style=file\n                          ${ClangTidy_SRCS}\n                          -- -std=c++17 -I${CMAKE_BINARY_DIR} ${CLANG_INCLUDES})\nadd_custom_target(check-clang-tidy\n                  COMMAND ${ClangTidy_BIN} -config='' -format-style=file\n                          ${ClangTidy_SRCS}\n                          -- -std=c++17 -I${CMAKE_BINARY_DIR} ${CLANG_INCLUDES})\n"
  },
  {
    "path": "cmake/config.h.in",
    "content": "/*\n * Auto-generated header for CMake.  See config.h.in if you need to modify the\n * original.\n */\n\n#ifndef _conky_config_h_\n#define _conky_config_h_\n\n#cmakedefine DEBUG\n\n#define SYSTEM_NAME \"@CMAKE_SYSTEM_NAME@\"\n#define PACKAGE_NAME \"@PROJECT_NAME@\"\n#define VERSION \"@VERSION@\"\n#define SYSTEM_CONFIG_FILE \"@SYSTEM_CONFIG_FILE@\"\n#define PACKAGE_LIBDIR \"@PACKAGE_LIBRARY_DIR@\"\n#define DEFAULTNETDEV \"@DEFAULTNETDEV@\"\n#define XDG_CONFIG_FILE \"@XDG_CONFIG_FILE@\"\n#define CONFIG_FILE \"@CONFIG_FILE@\"\n#define LOCALE_DIR \"@LOCALE_DIR@\"\n#define MAX_USER_TEXT_DEFAULT @MAX_USER_TEXT_DEFAULT@\n#define DEFAULT_TEXT_BUFFER_SIZE @DEFAULT_TEXT_BUFFER_SIZE@\n#define MAX_NET_INTERFACES @MAX_NET_INTERFACES@\n#define HTTPPORT @HTTPPORT@\n\n#cmakedefine BUILD_I18N 1\n\n#cmakedefine HAVE_SYS_STATFS_H 1\n#cmakedefine HAVE_SYS_PARAM_H 1\n#cmakedefine HAVE_SYS_INOTIFY_H 1\n#cmakedefine HAVE_DIRENT_H 1\n\n#cmakedefine HAVE_SOUNDCARD_H 1\n\n#cmakedefine HAVE_STRNDUP 1\n\n#cmakedefine HAVE_FOPENCOOKIE 1\n#cmakedefine HAVE_FUNOPEN 1\n\n#cmakedefine HAVE_PIPE2 1\n#cmakedefine HAVE_O_CLOEXEC 1\n\n#cmakedefine HAVE_CLOCK_GETTIME 1\n\n#cmakedefine HAVE_XCB 1\n#cmakedefine HAVE_XCB_ERRORS 1\n\n#cmakedefine BUILD_WAYLAND 1\n\n#cmakedefine BUILD_X11 1\n\n#cmakedefine OWN_WINDOW 1\n\n#cmakedefine ENABLE_RUNTIME_TWEAKS 1\n\n#cmakedefine BUILD_MOUSE_EVENTS 1\n\n#cmakedefine BUILD_XDAMAGE 1\n\n#cmakedefine BUILD_XINERAMA 1\n\n#cmakedefine BUILD_XFT 1\n\n#cmakedefine BUILD_XSHAPE 1\n\n#cmakedefine BUILD_XFIXES 1\n\n#cmakedefine BUILD_XINPUT 1\n\n#cmakedefine BUILD_ARGB 1\n\n#cmakedefine BUILD_XDBE 1\n\n#cmakedefine BUILD_PORT_MONITORS 1\n\n#cmakedefine BUILD_AUDACIOUS 1\n\n#cmakedefine NEW_AUDACIOUS_FOUND 1\n\n#cmakedefine BUILD_MPD 1\n\n#cmakedefine BUILD_MYSQL 1\n\n#cmakedefine BUILD_MOC 1\n\n#cmakedefine BUILD_NVIDIA 0\n\n#cmakedefine BUILD_XMMS2 1\n\n#cmakedefine BUILD_HDDTEMP 1\n\n#cmakedefine BUILD_LIBXML2 1\n\n#cmakedefine BUILD_CURL 1\n\n#cmakedefine BUILD_IMLIB2 1\n\n#cmakedefine BUILD_MATH 1\n\n#cmakedefine BUILD_BUILTIN_CONFIG 1\n\n#cmakedefine BUILD_OLD_CONFIG 1\n\n#cmakedefine BUILD_NCURSES 1\n#cmakedefine LEAKFREE_NCURSES 1\n\n#cmakedefine BUILD_APCUPSD 1\n\n#cmakedefine BUILD_IOSTATS 1\n\n#cmakedefine BUILD_IPGFREQ 0\n\n#cmakedefine BUILD_WLAN 1\n\n#cmakedefine BUILD_ICAL 1\n\n#cmakedefine BUILD_IRC 1\n\n#cmakedefine BUILD_PULSEAUDIO 1\n\n#cmakedefine BUILD_INTEL_BACKLIGHT 0\n\n#cmakedefine BUILD_IPV6 1\n\n#cmakedefine BUILD_HTTP 1\n\n#cmakedefine BUILD_GUI 1\n\n#cmakedefine BUILD_ICONV 1\n\n#cmakedefine BUILD_LUA_CAIRO 1\n\n#cmakedefine BUILD_LUA_IMLIB2 1\n\n#cmakedefine BUILD_LUA_RSVG 1\n\n#cmakedefine BUILD_LUA_TEXT 1\n\n#cmakedefine BUILD_IBM 1\n\n#cmakedefine BUILD_RSS 1\n\n#cmakedefine BUILD_CMUS 1\n\n#cmakedefine BUILD_JOURNAL 1\n\n#cmakedefine BUILD_HSV_GRADIENT 1\n\n#cmakedefine BUILD_COLOUR_NAME_MAP 1\n\n#cmakedefine HAVE_STATFS64 1\n#ifndef HAVE_STATFS64\n#define statfs64 statfs\n#endif\n\n#endif /* _conky_config_h_ */\n"
  },
  {
    "path": "cmake/scripts/clang-format-check-changed",
    "content": "#!/bin/bash\n\n# Required because cmake root isn't git root in this example\nCLANG_FORMAT_BIN=$1\nGIT_ROOT=`git rev-parse --show-toplevel`\n\npushd ${GIT_ROOT} > /dev/null\n\ngit status --porcelain \\\n\t| egrep '*\\.cpp|*\\.h|*\\.cxx|*\\.hxx|*\\.hpp|*\\.cc' \\\n\t| awk -F \" \" '{print $NF}' \\\n\t| xargs -r ${CLANG_FORMAT_BIN} -style=file -output-replacements-xml \\\n\t| grep \"replacement offset\" 2>&1 > /dev/null\n\nRET=$?\npopd > /dev/null\n\nexit ${RET}\n"
  },
  {
    "path": "cmake/scripts/clang-format-check-changed.py",
    "content": "#!/usr/bin/env python3\n\nimport argparse\nimport os\nimport sys\nimport subprocess\n\n\ndef check_file(filename, excludes, extensions):\n    \"\"\"\n    Check if a file should be included in our check\n    \"\"\"\n    name, ext = os.path.splitext(filename)\n\n    if len(ext) > 0 and ext in extensions:\n        if len(excludes) == 0:\n            return True\n\n        for exclude in excludes:\n            if exclude in filename:\n                return False\n\n        return True\n\n    return False\n\n\ndef check_directory(directory, excludes, extensions):\n    output = []\n\n    if len(excludes) > 0:\n        for exclude in excludes:\n            if exclude in directory:\n                directory_excluded = False\n                return output\n\n    for root, _, files in os.walk(directory):\n        for file in files:\n            filename = os.path.join(root, file)\n            if check_file(filename, excludes, extensions):\n                print(\"Will check file [{}]\".format(filename))\n                output.append(filename)\n    return output\n\ndef get_git_root(git_bin):\n    cmd = [git_bin, \"rev-parse\", \"--show-toplevel\"]\n    try:\n        return subprocess.check_output(cmd).strip()\n    except subprocess.CalledProcessError, e:\n        print(\"Error calling git [{}]\".format(e))\n        raise\n\ndef clean_git_filename(line):\n    \"\"\"\n    Takes a line from git status --porcelain and returns the filename\n    \"\"\"\n    file = None\n    git_status = line[:2]\n    # Not an exhaustive list of git status output but should\n    # be enough for this case\n    # check if this is a delete\n    if 'D' in git_status:\n        return None\n    # ignored file\n    if '!' in git_status:\n        return None\n    # Covers renamed files\n    if '->' in line:\n        file = line[3:].split('->')[-1].strip()\n    else:\n        file = line[3:].strip()\n\n    return file\n\n\ndef get_changed_files(git_bin, excludes, file_extensions):\n    \"\"\"\n    Run git status and return the list of changed files\n    \"\"\"\n    extensions = file_extensions.split(\",\")\n    # arguments coming from cmake will be *.xx. We want to remove the *\n    for i, extension in enumerate(extensions):\n        if extension[0] == '*':\n            extensions[i] = extension[1:]\n\n    git_root = get_git_root(git_bin)\n\n    cmd = [git_bin, \"status\", \"--porcelain\", \"--ignore-submodules\"]\n    print(\"git cmd = {}\".format(cmd))\n    output = []\n    returncode = 0\n    try:\n        cmd_output = subprocess.check_output(cmd)\n        for line in cmd_output.split('\\n'):\n            if len(line) > 0:\n                file = clean_git_filename(line)\n                if not file:\n                    continue\n                file = os.path.join(git_root, file)\n\n                if file[-1] == \"/\":\n                    directory_files = check_directory(\n                        file, excludes, file_extensions)\n                    output = output + directory_files\n                else:\n                    if check_file(file, excludes, file_extensions):\n                        print(\"Will check file [{}]\".format(file))\n                        output.append(file)\n\n    except subprocess.CalledProcessError, e:\n        print(\"Error calling git [{}]\".format(e))\n        returncode = e.returncode\n\n    return output, returncode\n\n\ndef run_clang_format(clang_format_bin, changed_files):\n    \"\"\"\n    Run clang format on a list of files\n    @return 0 if formatted correctly.\n    \"\"\"\n    if len(changed_files) == 0:\n        return 0\n    cmd = [clang_format_bin, \"-style=file\",\n           \"-output-replacements-xml\"] + changed_files\n    print(\"clang-format cmd = {}\".format(cmd))\n    try:\n        cmd_output = subprocess.check_output(cmd)\n        if \"replacement offset\" in cmd_output:\n            print(\"ERROR: Changed files don't match format\")\n            return 1\n    except subprocess.CalledProcessError, e:\n        print(\"Error calling clang-format [{}]\".format(e))\n        return e.returncode\n\n    return 0\n\n\ndef cli():\n    # global params\n    parser = argparse.ArgumentParser(prog='clang-format-check-changed',\n                                     description='Checks if files changed in git match the .clang-format specification')\n    parser.add_argument(\"--file-extensions\", type=str,\n                        default=\".cpp,.h,.cxx,.hxx,.hpp,.cc,.ipp\",\n                        help=\"Comma separated list of file extensions to check\")\n    parser.add_argument('--exclude', action='append', default=[],\n                        help='Will not match the files / directories with these in the name')\n    parser.add_argument('--clang-format-bin', type=str, default=\"clang-format\",\n                        help=\"The clang format binary\")\n    parser.add_argument('--git-bin', type=str, default=\"git\",\n                        help=\"The git binary\")\n    args = parser.parse_args()\n\n    # Run gcovr to get the .gcda files form .gcno\n    changed_files, returncode = get_changed_files(\n        args.git_bin, args.exclude, args.file_extensions)\n    if returncode != 0:\n        return returncode\n\n    return run_clang_format(args.clang_format_bin, changed_files)\n\nif __name__ == '__main__':\n    sys.exit(cli())\n"
  },
  {
    "path": "data/CMakeLists.txt",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\nif(BUILD_BUILTIN_CONFIG)\n  # generate defconfig\n  if(BUILD_X11)\n    set(builtin_config conky.conf)\n  else(BUILD_X11)\n    set(builtin_config conky_no_x11.conf)\n  endif(BUILD_X11)\n\n  add_custom_command(OUTPUT defconfig.h\n    COMMAND ${CMAKE_SOURCE_DIR}/bin/text2c.sh\n    ${CMAKE_CURRENT_SOURCE_DIR}/${builtin_config}\n    defconfig.h defconfig\n    DEPENDS ${builtin_config})\n  set(generated_hdr_files ${generated_hdr_files} defconfig.h)\nendif(BUILD_BUILTIN_CONFIG)\n\nif(BUILD_OLD_CONFIG)\n  add_custom_command(OUTPUT convertconf.h\n    COMMAND ${CMAKE_SOURCE_DIR}/bin/text2c.sh\n    ${CMAKE_SOURCE_DIR}/extras/convert.lua\n    convertconf.h convertconf\n    DEPENDS ${CMAKE_SOURCE_DIR}/extras/convert.lua)\n  set(generated_hdr_files ${generated_hdr_files} convertconf.h)\nendif(BUILD_OLD_CONFIG)\n\nadd_custom_target(generated_hdr_files DEPENDS ${generated_hdr_files})\n\nif(${CMAKE_SYSTEM_NAME} MATCHES \"Linux\")\n  install(FILES conky.desktop DESTINATION share/applications)\n  install(FILES logo/conky-logomark-violet.svg\n    DESTINATION share/icons/hicolor/scalable/apps)\nendif(${CMAKE_SYSTEM_NAME} MATCHES \"Linux\")\n"
  },
  {
    "path": "data/color-names.yml",
    "content": "\"alice blue\": [240, 248, 255]\n\"AliceBlue\": [240, 248, 255]\n\"antique white\": [250, 235, 215]\n\"AntiqueWhite\": [250, 235, 215]\n\"AntiqueWhite1\": [255, 239, 219]\n\"AntiqueWhite2\": [238, 223, 204]\n\"AntiqueWhite3\": [205, 192, 176]\n\"AntiqueWhite4\": [139, 131, 120]\n\"aquamarine\": [127, 255, 212]\n\"aquamarine1\": [127, 255, 212]\n\"aquamarine2\": [118, 238, 198]\n\"aquamarine3\": [102, 205, 170]\n\"aquamarine4\": [69, 139, 116]\n\"azure\": [240, 255, 255]\n\"azure1\": [240, 255, 255]\n\"azure2\": [224, 238, 238]\n\"azure3\": [193, 205, 205]\n\"azure4\": [131, 139, 139]\n\"beige\": [245, 245, 220]\n\"bisque\": [255, 228, 196]\n\"bisque1\": [255, 228, 196]\n\"bisque2\": [238, 213, 183]\n\"bisque3\": [205, 183, 158]\n\"bisque4\": [139, 125, 107]\n\"black\": [0, 0, 0]\n\"blanched almond\": [255, 235, 205]\n\"BlanchedAlmond\": [255, 235, 205]\n\"blue\": [0, 0, 255]\n\"blue violet\": [138, 43, 226]\n\"blue1\": [0, 0, 255]\n\"blue2\": [0, 0, 238]\n\"blue3\": [0, 0, 205]\n\"blue4\": [0, 0, 139]\n\"BlueViolet\": [138, 43, 226]\n\"brown\": [165, 42, 42]\n\"brown1\": [255, 64, 64]\n\"brown2\": [238, 59, 59]\n\"brown3\": [205, 51, 51]\n\"brown4\": [139, 35, 35]\n\"burlywood\": [222, 184, 135]\n\"burlywood1\": [255, 211, 155]\n\"burlywood2\": [238, 197, 145]\n\"burlywood3\": [205, 170, 125]\n\"burlywood4\": [139, 115, 85]\n\"cadet blue\": [95, 158, 160]\n\"CadetBlue\": [95, 158, 160]\n\"CadetBlue1\": [152, 245, 255]\n\"CadetBlue2\": [142, 229, 238]\n\"CadetBlue3\": [122, 197, 205]\n\"CadetBlue4\": [83, 134, 139]\n\"chartreuse\": [127, 255, 0]\n\"chartreuse1\": [127, 255, 0]\n\"chartreuse2\": [118, 238, 0]\n\"chartreuse3\": [102, 205, 0]\n\"chartreuse4\": [69, 139, 0]\n\"chocolate\": [210, 105, 30]\n\"chocolate1\": [255, 127, 36]\n\"chocolate2\": [238, 118, 33]\n\"chocolate3\": [205, 102, 29]\n\"chocolate4\": [139, 69, 19]\n\"coral\": [255, 127, 80]\n\"coral1\": [255, 114, 86]\n\"coral2\": [238, 106, 80]\n\"coral3\": [205, 91, 69]\n\"coral4\": [139, 62, 47]\n\"cornflower blue\": [100, 149, 237]\n\"CornflowerBlue\": [100, 149, 237]\n\"cornsilk\": [255, 248, 220]\n\"cornsilk1\": [255, 248, 220]\n\"cornsilk2\": [238, 232, 205]\n\"cornsilk3\": [205, 200, 177]\n\"cornsilk4\": [139, 136, 120]\n\"cyan\": [0, 255, 255]\n\"cyan1\": [0, 255, 255]\n\"cyan2\": [0, 238, 238]\n\"cyan3\": [0, 205, 205]\n\"cyan4\": [0, 139, 139]\n\"dark blue\": [0, 0, 139]\n\"dark cyan\": [0, 139, 139]\n\"dark goldenrod\": [184, 134, 11]\n\"dark gray\": [169, 169, 169]\n\"dark green\": [0, 100, 0]\n\"dark grey\": [169, 169, 169]\n\"dark khaki\": [189, 183, 107]\n\"dark magenta\": [139, 0, 139]\n\"dark olive green\": [85, 107, 47]\n\"dark orange\": [255, 140, 0]\n\"dark orchid\": [153, 50, 204]\n\"dark red\": [139, 0, 0]\n\"dark salmon\": [233, 150, 122]\n\"dark sea green\": [143, 188, 143]\n\"dark slate blue\": [72, 61, 139]\n\"dark slate gray\": [47, 79, 79]\n\"dark slate grey\": [47, 79, 79]\n\"dark turquoise\": [0, 206, 209]\n\"dark violet\": [148, 0, 211]\n\"DarkBlue\": [0, 0, 139]\n\"DarkCyan\": [0, 139, 139]\n\"DarkGoldenrod\": [184, 134, 11]\n\"DarkGoldenrod1\": [255, 185, 15]\n\"DarkGoldenrod2\": [238, 173, 14]\n\"DarkGoldenrod3\": [205, 149, 12]\n\"DarkGoldenrod4\": [139, 101, 8]\n\"DarkGray\": [169, 169, 169]\n\"DarkGreen\": [0, 100, 0]\n\"DarkGrey\": [169, 169, 169]\n\"DarkKhaki\": [189, 183, 107]\n\"DarkMagenta\": [139, 0, 139]\n\"DarkOliveGreen\": [85, 107, 47]\n\"DarkOliveGreen1\": [202, 255, 112]\n\"DarkOliveGreen2\": [188, 238, 104]\n\"DarkOliveGreen3\": [162, 205, 90]\n\"DarkOliveGreen4\": [110, 139, 61]\n\"DarkOrange\": [255, 140, 0]\n\"DarkOrange1\": [255, 127, 0]\n\"DarkOrange2\": [238, 118, 0]\n\"DarkOrange3\": [205, 102, 0]\n\"DarkOrange4\": [139, 69, 0]\n\"DarkOrchid\": [153, 50, 204]\n\"DarkOrchid1\": [191, 62, 255]\n\"DarkOrchid2\": [178, 58, 238]\n\"DarkOrchid3\": [154, 50, 205]\n\"DarkOrchid4\": [104, 34, 139]\n\"DarkRed\": [139, 0, 0]\n\"DarkSalmon\": [233, 150, 122]\n\"DarkSeaGreen\": [143, 188, 143]\n\"DarkSeaGreen1\": [193, 255, 193]\n\"DarkSeaGreen2\": [180, 238, 180]\n\"DarkSeaGreen3\": [155, 205, 155]\n\"DarkSeaGreen4\": [105, 139, 105]\n\"DarkSlateBlue\": [72, 61, 139]\n\"DarkSlateGray\": [47, 79, 79]\n\"DarkSlateGray1\": [151, 255, 255]\n\"DarkSlateGray2\": [141, 238, 238]\n\"DarkSlateGray3\": [121, 205, 205]\n\"DarkSlateGray4\": [82, 139, 139]\n\"DarkSlateGrey\": [47, 79, 79]\n\"DarkTurquoise\": [0, 206, 209]\n\"DarkViolet\": [148, 0, 211]\n\"deep pink\": [255, 20, 147]\n\"deep sky blue\": [0, 191, 255]\n\"DeepPink\": [255, 20, 147]\n\"DeepPink1\": [255, 20, 147]\n\"DeepPink2\": [238, 18, 137]\n\"DeepPink3\": [205, 16, 118]\n\"DeepPink4\": [139, 10, 80]\n\"DeepSkyBlue\": [0, 191, 255]\n\"DeepSkyBlue1\": [0, 191, 255]\n\"DeepSkyBlue2\": [0, 178, 238]\n\"DeepSkyBlue3\": [0, 154, 205]\n\"DeepSkyBlue4\": [0, 104, 139]\n\"dim gray\": [105, 105, 105]\n\"dim grey\": [105, 105, 105]\n\"DimGray\": [105, 105, 105]\n\"DimGrey\": [105, 105, 105]\n\"dodger blue\": [30, 144, 255]\n\"DodgerBlue\": [30, 144, 255]\n\"DodgerBlue1\": [30, 144, 255]\n\"DodgerBlue2\": [28, 134, 238]\n\"DodgerBlue3\": [24, 116, 205]\n\"DodgerBlue4\": [16, 78, 139]\n\"firebrick\": [178, 34, 34]\n\"firebrick1\": [255, 48, 48]\n\"firebrick2\": [238, 44, 44]\n\"firebrick3\": [205, 38, 38]\n\"firebrick4\": [139, 26, 26]\n\"floral white\": [255, 250, 240]\n\"FloralWhite\": [255, 250, 240]\n\"forest green\": [34, 139, 34]\n\"ForestGreen\": [34, 139, 34]\n\"gainsboro\": [220, 220, 220]\n\"ghost white\": [248, 248, 255]\n\"GhostWhite\": [248, 248, 255]\n\"gold\": [255, 215, 0]\n\"gold1\": [255, 215, 0]\n\"gold2\": [238, 201, 0]\n\"gold3\": [205, 173, 0]\n\"gold4\": [139, 117, 0]\n\"goldenrod\": [218, 165, 32]\n\"goldenrod1\": [255, 193, 37]\n\"goldenrod2\": [238, 180, 34]\n\"goldenrod3\": [205, 155, 29]\n\"goldenrod4\": [139, 105, 20]\n\"gray\": [190, 190, 190]\n\"gray0\": [0, 0, 0]\n\"gray1\": [3, 3, 3]\n\"gray10\": [26, 26, 26]\n\"gray100\": [255, 255, 255]\n\"gray11\": [28, 28, 28]\n\"gray12\": [31, 31, 31]\n\"gray13\": [33, 33, 33]\n\"gray14\": [36, 36, 36]\n\"gray15\": [38, 38, 38]\n\"gray16\": [41, 41, 41]\n\"gray17\": [43, 43, 43]\n\"gray18\": [46, 46, 46]\n\"gray19\": [48, 48, 48]\n\"gray2\": [5, 5, 5]\n\"gray20\": [51, 51, 51]\n\"gray21\": [54, 54, 54]\n\"gray22\": [56, 56, 56]\n\"gray23\": [59, 59, 59]\n\"gray24\": [61, 61, 61]\n\"gray25\": [64, 64, 64]\n\"gray26\": [66, 66, 66]\n\"gray27\": [69, 69, 69]\n\"gray28\": [71, 71, 71]\n\"gray29\": [74, 74, 74]\n\"gray3\": [8, 8, 8]\n\"gray30\": [77, 77, 77]\n\"gray31\": [79, 79, 79]\n\"gray32\": [82, 82, 82]\n\"gray33\": [84, 84, 84]\n\"gray34\": [87, 87, 87]\n\"gray35\": [89, 89, 89]\n\"gray36\": [92, 92, 92]\n\"gray37\": [94, 94, 94]\n\"gray38\": [97, 97, 97]\n\"gray39\": [99, 99, 99]\n\"gray4\": [10, 10, 10]\n\"gray40\": [102, 102, 102]\n\"gray41\": [105, 105, 105]\n\"gray42\": [107, 107, 107]\n\"gray43\": [110, 110, 110]\n\"gray44\": [112, 112, 112]\n\"gray45\": [115, 115, 115]\n\"gray46\": [117, 117, 117]\n\"gray47\": [120, 120, 120]\n\"gray48\": [122, 122, 122]\n\"gray49\": [125, 125, 125]\n\"gray5\": [13, 13, 13]\n\"gray50\": [127, 127, 127]\n\"gray51\": [130, 130, 130]\n\"gray52\": [133, 133, 133]\n\"gray53\": [135, 135, 135]\n\"gray54\": [138, 138, 138]\n\"gray55\": [140, 140, 140]\n\"gray56\": [143, 143, 143]\n\"gray57\": [145, 145, 145]\n\"gray58\": [148, 148, 148]\n\"gray59\": [150, 150, 150]\n\"gray6\": [15, 15, 15]\n\"gray60\": [153, 153, 153]\n\"gray61\": [156, 156, 156]\n\"gray62\": [158, 158, 158]\n\"gray63\": [161, 161, 161]\n\"gray64\": [163, 163, 163]\n\"gray65\": [166, 166, 166]\n\"gray66\": [168, 168, 168]\n\"gray67\": [171, 171, 171]\n\"gray68\": [173, 173, 173]\n\"gray69\": [176, 176, 176]\n\"gray7\": [18, 18, 18]\n\"gray70\": [179, 179, 179]\n\"gray71\": [181, 181, 181]\n\"gray72\": [184, 184, 184]\n\"gray73\": [186, 186, 186]\n\"gray74\": [189, 189, 189]\n\"gray75\": [191, 191, 191]\n\"gray76\": [194, 194, 194]\n\"gray77\": [196, 196, 196]\n\"gray78\": [199, 199, 199]\n\"gray79\": [201, 201, 201]\n\"gray8\": [20, 20, 20]\n\"gray80\": [204, 204, 204]\n\"gray81\": [207, 207, 207]\n\"gray82\": [209, 209, 209]\n\"gray83\": [212, 212, 212]\n\"gray84\": [214, 214, 214]\n\"gray85\": [217, 217, 217]\n\"gray86\": [219, 219, 219]\n\"gray87\": [222, 222, 222]\n\"gray88\": [224, 224, 224]\n\"gray89\": [227, 227, 227]\n\"gray9\": [23, 23, 23]\n\"gray90\": [229, 229, 229]\n\"gray91\": [232, 232, 232]\n\"gray92\": [235, 235, 235]\n\"gray93\": [237, 237, 237]\n\"gray94\": [240, 240, 240]\n\"gray95\": [242, 242, 242]\n\"gray96\": [245, 245, 245]\n\"gray97\": [247, 247, 247]\n\"gray98\": [250, 250, 250]\n\"gray99\": [252, 252, 252]\n\"green\": [0, 255, 0]\n\"green yellow\": [173, 255, 47]\n\"green1\": [0, 255, 0]\n\"green2\": [0, 238, 0]\n\"green3\": [0, 205, 0]\n\"green4\": [0, 139, 0]\n\"GreenYellow\": [173, 255, 47]\n\"grey\": [190, 190, 190]\n\"grey0\": [0, 0, 0]\n\"grey1\": [3, 3, 3]\n\"grey10\": [26, 26, 26]\n\"grey100\": [255, 255, 255]\n\"grey11\": [28, 28, 28]\n\"grey12\": [31, 31, 31]\n\"grey13\": [33, 33, 33]\n\"grey14\": [36, 36, 36]\n\"grey15\": [38, 38, 38]\n\"grey16\": [41, 41, 41]\n\"grey17\": [43, 43, 43]\n\"grey18\": [46, 46, 46]\n\"grey19\": [48, 48, 48]\n\"grey2\": [5, 5, 5]\n\"grey20\": [51, 51, 51]\n\"grey21\": [54, 54, 54]\n\"grey22\": [56, 56, 56]\n\"grey23\": [59, 59, 59]\n\"grey24\": [61, 61, 61]\n\"grey25\": [64, 64, 64]\n\"grey26\": [66, 66, 66]\n\"grey27\": [69, 69, 69]\n\"grey28\": [71, 71, 71]\n\"grey29\": [74, 74, 74]\n\"grey3\": [8, 8, 8]\n\"grey30\": [77, 77, 77]\n\"grey31\": [79, 79, 79]\n\"grey32\": [82, 82, 82]\n\"grey33\": [84, 84, 84]\n\"grey34\": [87, 87, 87]\n\"grey35\": [89, 89, 89]\n\"grey36\": [92, 92, 92]\n\"grey37\": [94, 94, 94]\n\"grey38\": [97, 97, 97]\n\"grey39\": [99, 99, 99]\n\"grey4\": [10, 10, 10]\n\"grey40\": [102, 102, 102]\n\"grey41\": [105, 105, 105]\n\"grey42\": [107, 107, 107]\n\"grey43\": [110, 110, 110]\n\"grey44\": [112, 112, 112]\n\"grey45\": [115, 115, 115]\n\"grey46\": [117, 117, 117]\n\"grey47\": [120, 120, 120]\n\"grey48\": [122, 122, 122]\n\"grey49\": [125, 125, 125]\n\"grey5\": [13, 13, 13]\n\"grey50\": [127, 127, 127]\n\"grey51\": [130, 130, 130]\n\"grey52\": [133, 133, 133]\n\"grey53\": [135, 135, 135]\n\"grey54\": [138, 138, 138]\n\"grey55\": [140, 140, 140]\n\"grey56\": [143, 143, 143]\n\"grey57\": [145, 145, 145]\n\"grey58\": [148, 148, 148]\n\"grey59\": [150, 150, 150]\n\"grey6\": [15, 15, 15]\n\"grey60\": [153, 153, 153]\n\"grey61\": [156, 156, 156]\n\"grey62\": [158, 158, 158]\n\"grey63\": [161, 161, 161]\n\"grey64\": [163, 163, 163]\n\"grey65\": [166, 166, 166]\n\"grey66\": [168, 168, 168]\n\"grey67\": [171, 171, 171]\n\"grey68\": [173, 173, 173]\n\"grey69\": [176, 176, 176]\n\"grey7\": [18, 18, 18]\n\"grey70\": [179, 179, 179]\n\"grey71\": [181, 181, 181]\n\"grey72\": [184, 184, 184]\n\"grey73\": [186, 186, 186]\n\"grey74\": [189, 189, 189]\n\"grey75\": [191, 191, 191]\n\"grey76\": [194, 194, 194]\n\"grey77\": [196, 196, 196]\n\"grey78\": [199, 199, 199]\n\"grey79\": [201, 201, 201]\n\"grey8\": [20, 20, 20]\n\"grey80\": [204, 204, 204]\n\"grey81\": [207, 207, 207]\n\"grey82\": [209, 209, 209]\n\"grey83\": [212, 212, 212]\n\"grey84\": [214, 214, 214]\n\"grey85\": [217, 217, 217]\n\"grey86\": [219, 219, 219]\n\"grey87\": [222, 222, 222]\n\"grey88\": [224, 224, 224]\n\"grey89\": [227, 227, 227]\n\"grey9\": [23, 23, 23]\n\"grey90\": [229, 229, 229]\n\"grey91\": [232, 232, 232]\n\"grey92\": [235, 235, 235]\n\"grey93\": [237, 237, 237]\n\"grey94\": [240, 240, 240]\n\"grey95\": [242, 242, 242]\n\"grey96\": [245, 245, 245]\n\"grey97\": [247, 247, 247]\n\"grey98\": [250, 250, 250]\n\"grey99\": [252, 252, 252]\n\"honeydew\": [240, 255, 240]\n\"honeydew1\": [240, 255, 240]\n\"honeydew2\": [224, 238, 224]\n\"honeydew3\": [193, 205, 193]\n\"honeydew4\": [131, 139, 131]\n\"hot pink\": [255, 105, 180]\n\"HotPink\": [255, 105, 180]\n\"HotPink1\": [255, 110, 180]\n\"HotPink2\": [238, 106, 167]\n\"HotPink3\": [205, 96, 144]\n\"HotPink4\": [139, 58, 98]\n\"indian red\": [205, 92, 92]\n\"IndianRed\": [205, 92, 92]\n\"IndianRed1\": [255, 106, 106]\n\"IndianRed2\": [238, 99, 99]\n\"IndianRed3\": [205, 85, 85]\n\"IndianRed4\": [139, 58, 58]\n\"ivory\": [255, 255, 240]\n\"ivory1\": [255, 255, 240]\n\"ivory2\": [238, 238, 224]\n\"ivory3\": [205, 205, 193]\n\"ivory4\": [139, 139, 131]\n\"khaki\": [240, 230, 140]\n\"khaki1\": [255, 246, 143]\n\"khaki2\": [238, 230, 133]\n\"khaki3\": [205, 198, 115]\n\"khaki4\": [139, 134, 78]\n\"lavender\": [230, 230, 250]\n\"lavender blush\": [255, 240, 245]\n\"LavenderBlush\": [255, 240, 245]\n\"LavenderBlush1\": [255, 240, 245]\n\"LavenderBlush2\": [238, 224, 229]\n\"LavenderBlush3\": [205, 193, 197]\n\"LavenderBlush4\": [139, 131, 134]\n\"lawn green\": [124, 252, 0]\n\"LawnGreen\": [124, 252, 0]\n\"lemon chiffon\": [255, 250, 205]\n\"LemonChiffon\": [255, 250, 205]\n\"LemonChiffon1\": [255, 250, 205]\n\"LemonChiffon2\": [238, 233, 191]\n\"LemonChiffon3\": [205, 201, 165]\n\"LemonChiffon4\": [139, 137, 112]\n\"light blue\": [173, 216, 230]\n\"light coral\": [240, 128, 128]\n\"light cyan\": [224, 255, 255]\n\"light goldenrod\": [238, 221, 130]\n\"light goldenrod yellow\": [250, 250, 210]\n\"light gray\": [211, 211, 211]\n\"light green\": [144, 238, 144]\n\"light grey\": [211, 211, 211]\n\"light pink\": [255, 182, 193]\n\"light salmon\": [255, 160, 122]\n\"light sea green\": [32, 178, 170]\n\"light sky blue\": [135, 206, 250]\n\"light slate blue\": [132, 112, 255]\n\"light slate gray\": [119, 136, 153]\n\"light slate grey\": [119, 136, 153]\n\"light steel blue\": [176, 196, 222]\n\"light yellow\": [255, 255, 224]\n\"LightBlue\": [173, 216, 230]\n\"LightBlue1\": [191, 239, 255]\n\"LightBlue2\": [178, 223, 238]\n\"LightBlue3\": [154, 192, 205]\n\"LightBlue4\": [104, 131, 139]\n\"LightCoral\": [240, 128, 128]\n\"LightCyan\": [224, 255, 255]\n\"LightCyan1\": [224, 255, 255]\n\"LightCyan2\": [209, 238, 238]\n\"LightCyan3\": [180, 205, 205]\n\"LightCyan4\": [122, 139, 139]\n\"LightGoldenrod\": [238, 221, 130]\n\"LightGoldenrod1\": [255, 236, 139]\n\"LightGoldenrod2\": [238, 220, 130]\n\"LightGoldenrod3\": [205, 190, 112]\n\"LightGoldenrod4\": [139, 129, 76]\n\"LightGoldenrodYellow\": [250, 250, 210]\n\"LightGray\": [211, 211, 211]\n\"LightGreen\": [144, 238, 144]\n\"LightGrey\": [211, 211, 211]\n\"LightPink\": [255, 182, 193]\n\"LightPink1\": [255, 174, 185]\n\"LightPink2\": [238, 162, 173]\n\"LightPink3\": [205, 140, 149]\n\"LightPink4\": [139, 95, 101]\n\"LightSalmon\": [255, 160, 122]\n\"LightSalmon1\": [255, 160, 122]\n\"LightSalmon2\": [238, 149, 114]\n\"LightSalmon3\": [205, 129, 98]\n\"LightSalmon4\": [139, 87, 66]\n\"LightSeaGreen\": [32, 178, 170]\n\"LightSkyBlue\": [135, 206, 250]\n\"LightSkyBlue1\": [176, 226, 255]\n\"LightSkyBlue2\": [164, 211, 238]\n\"LightSkyBlue3\": [141, 182, 205]\n\"LightSkyBlue4\": [96, 123, 139]\n\"LightSlateBlue\": [132, 112, 255]\n\"LightSlateGray\": [119, 136, 153]\n\"LightSlateGrey\": [119, 136, 153]\n\"LightSteelBlue\": [176, 196, 222]\n\"LightSteelBlue1\": [202, 225, 255]\n\"LightSteelBlue2\": [188, 210, 238]\n\"LightSteelBlue3\": [162, 181, 205]\n\"LightSteelBlue4\": [110, 123, 139]\n\"LightYellow\": [255, 255, 224]\n\"LightYellow1\": [255, 255, 224]\n\"LightYellow2\": [238, 238, 209]\n\"LightYellow3\": [205, 205, 180]\n\"LightYellow4\": [139, 139, 122]\n\"lime green\": [50, 205, 50]\n\"LimeGreen\": [50, 205, 50]\n\"linen\": [250, 240, 230]\n\"magenta\": [255, 0, 255]\n\"magenta1\": [255, 0, 255]\n\"magenta2\": [238, 0, 238]\n\"magenta3\": [205, 0, 205]\n\"magenta4\": [139, 0, 139]\n\"maroon\": [176, 48, 96]\n\"maroon1\": [255, 52, 179]\n\"maroon2\": [238, 48, 167]\n\"maroon3\": [205, 41, 144]\n\"maroon4\": [139, 28, 98]\n\"medium aquamarine\": [102, 205, 170]\n\"medium blue\": [0, 0, 205]\n\"medium orchid\": [186, 85, 211]\n\"medium purple\": [147, 112, 219]\n\"medium sea green\": [60, 179, 113]\n\"medium slate blue\": [123, 104, 238]\n\"medium spring green\": [0, 250, 154]\n\"medium turquoise\": [72, 209, 204]\n\"medium violet red\": [199, 21, 133]\n\"MediumAquamarine\": [102, 205, 170]\n\"MediumBlue\": [0, 0, 205]\n\"MediumOrchid\": [186, 85, 211]\n\"MediumOrchid1\": [224, 102, 255]\n\"MediumOrchid2\": [209, 95, 238]\n\"MediumOrchid3\": [180, 82, 205]\n\"MediumOrchid4\": [122, 55, 139]\n\"MediumPurple\": [147, 112, 219]\n\"MediumPurple1\": [171, 130, 255]\n\"MediumPurple2\": [159, 121, 238]\n\"MediumPurple3\": [137, 104, 205]\n\"MediumPurple4\": [93, 71, 139]\n\"MediumSeaGreen\": [60, 179, 113]\n\"MediumSlateBlue\": [123, 104, 238]\n\"MediumSpringGreen\": [0, 250, 154]\n\"MediumTurquoise\": [72, 209, 204]\n\"MediumVioletRed\": [199, 21, 133]\n\"midnight blue\": [25, 25, 112]\n\"MidnightBlue\": [25, 25, 112]\n\"mint cream\": [245, 255, 250]\n\"MintCream\": [245, 255, 250]\n\"misty rose\": [255, 228, 225]\n\"MistyRose\": [255, 228, 225]\n\"MistyRose1\": [255, 228, 225]\n\"MistyRose2\": [238, 213, 210]\n\"MistyRose3\": [205, 183, 181]\n\"MistyRose4\": [139, 125, 123]\n\"moccasin\": [255, 228, 181]\n\"navajo white\": [255, 222, 173]\n\"NavajoWhite\": [255, 222, 173]\n\"NavajoWhite1\": [255, 222, 173]\n\"NavajoWhite2\": [238, 207, 161]\n\"NavajoWhite3\": [205, 179, 139]\n\"NavajoWhite4\": [139, 121, 94]\n\"navy\": [0, 0, 128]\n\"navy blue\": [0, 0, 128]\n\"NavyBlue\": [0, 0, 128]\n\"old lace\": [253, 245, 230]\n\"OldLace\": [253, 245, 230]\n\"olive drab\": [107, 142, 35]\n\"OliveDrab\": [107, 142, 35]\n\"OliveDrab1\": [192, 255, 62]\n\"OliveDrab2\": [179, 238, 58]\n\"OliveDrab3\": [154, 205, 50]\n\"OliveDrab4\": [105, 139, 34]\n\"orange\": [255, 165, 0]\n\"orange red\": [255, 69, 0]\n\"orange1\": [255, 165, 0]\n\"orange2\": [238, 154, 0]\n\"orange3\": [205, 133, 0]\n\"orange4\": [139, 90, 0]\n\"OrangeRed\": [255, 69, 0]\n\"OrangeRed1\": [255, 69, 0]\n\"OrangeRed2\": [238, 64, 0]\n\"OrangeRed3\": [205, 55, 0]\n\"OrangeRed4\": [139, 37, 0]\n\"orchid\": [218, 112, 214]\n\"orchid1\": [255, 131, 250]\n\"orchid2\": [238, 122, 233]\n\"orchid3\": [205, 105, 201]\n\"orchid4\": [139, 71, 137]\n\"pale goldenrod\": [238, 232, 170]\n\"pale green\": [152, 251, 152]\n\"pale turquoise\": [175, 238, 238]\n\"pale violet red\": [219, 112, 147]\n\"PaleGoldenrod\": [238, 232, 170]\n\"PaleGreen\": [152, 251, 152]\n\"PaleGreen1\": [154, 255, 154]\n\"PaleGreen2\": [144, 238, 144]\n\"PaleGreen3\": [124, 205, 124]\n\"PaleGreen4\": [84, 139, 84]\n\"PaleTurquoise\": [175, 238, 238]\n\"PaleTurquoise1\": [187, 255, 255]\n\"PaleTurquoise2\": [174, 238, 238]\n\"PaleTurquoise3\": [150, 205, 205]\n\"PaleTurquoise4\": [102, 139, 139]\n\"PaleVioletRed\": [219, 112, 147]\n\"PaleVioletRed1\": [255, 130, 171]\n\"PaleVioletRed2\": [238, 121, 159]\n\"PaleVioletRed3\": [205, 104, 137]\n\"PaleVioletRed4\": [139, 71, 93]\n\"papaya whip\": [255, 239, 213]\n\"PapayaWhip\": [255, 239, 213]\n\"peach puff\": [255, 218, 185]\n\"PeachPuff\": [255, 218, 185]\n\"PeachPuff1\": [255, 218, 185]\n\"PeachPuff2\": [238, 203, 173]\n\"PeachPuff3\": [205, 175, 149]\n\"PeachPuff4\": [139, 119, 101]\n\"peru\": [205, 133, 63]\n\"pink\": [255, 192, 203]\n\"pink1\": [255, 181, 197]\n\"pink2\": [238, 169, 184]\n\"pink3\": [205, 145, 158]\n\"pink4\": [139, 99, 108]\n\"plum\": [221, 160, 221]\n\"plum1\": [255, 187, 255]\n\"plum2\": [238, 174, 238]\n\"plum3\": [205, 150, 205]\n\"plum4\": [139, 102, 139]\n\"powder blue\": [176, 224, 230]\n\"PowderBlue\": [176, 224, 230]\n\"purple\": [160, 32, 240]\n\"purple1\": [155, 48, 255]\n\"purple2\": [145, 44, 238]\n\"purple3\": [125, 38, 205]\n\"purple4\": [85, 26, 139]\n\"red\": [255, 0, 0]\n\"red1\": [255, 0, 0]\n\"red2\": [238, 0, 0]\n\"red3\": [205, 0, 0]\n\"red4\": [139, 0, 0]\n\"rosy brown\": [188, 143, 143]\n\"RosyBrown\": [188, 143, 143]\n\"RosyBrown1\": [255, 193, 193]\n\"RosyBrown2\": [238, 180, 180]\n\"RosyBrown3\": [205, 155, 155]\n\"RosyBrown4\": [139, 105, 105]\n\"royal blue\": [65, 105, 225]\n\"RoyalBlue\": [65, 105, 225]\n\"RoyalBlue1\": [72, 118, 255]\n\"RoyalBlue2\": [67, 110, 238]\n\"RoyalBlue3\": [58, 95, 205]\n\"RoyalBlue4\": [39, 64, 139]\n\"saddle brown\": [139, 69, 19]\n\"SaddleBrown\": [139, 69, 19]\n\"salmon\": [250, 128, 114]\n\"salmon1\": [255, 140, 105]\n\"salmon2\": [238, 130, 98]\n\"salmon3\": [205, 112, 84]\n\"salmon4\": [139, 76, 57]\n\"sandy brown\": [244, 164, 96]\n\"SandyBrown\": [244, 164, 96]\n\"sea green\": [46, 139, 87]\n\"SeaGreen\": [46, 139, 87]\n\"SeaGreen1\": [84, 255, 159]\n\"SeaGreen2\": [78, 238, 148]\n\"SeaGreen3\": [67, 205, 128]\n\"SeaGreen4\": [46, 139, 87]\n\"seashell\": [255, 245, 238]\n\"seashell1\": [255, 245, 238]\n\"seashell2\": [238, 229, 222]\n\"seashell3\": [205, 197, 191]\n\"seashell4\": [139, 134, 130]\n\"sienna\": [160, 82, 45]\n\"sienna1\": [255, 130, 71]\n\"sienna2\": [238, 121, 66]\n\"sienna3\": [205, 104, 57]\n\"sienna4\": [139, 71, 38]\n\"sky blue\": [135, 206, 235]\n\"SkyBlue\": [135, 206, 235]\n\"SkyBlue1\": [135, 206, 255]\n\"SkyBlue2\": [126, 192, 238]\n\"SkyBlue3\": [108, 166, 205]\n\"SkyBlue4\": [74, 112, 139]\n\"slate blue\": [106, 90, 205]\n\"slate gray\": [112, 128, 144]\n\"slate grey\": [112, 128, 144]\n\"SlateBlue\": [106, 90, 205]\n\"SlateBlue1\": [131, 111, 255]\n\"SlateBlue2\": [122, 103, 238]\n\"SlateBlue3\": [105, 89, 205]\n\"SlateBlue4\": [71, 60, 139]\n\"SlateGray\": [112, 128, 144]\n\"SlateGray1\": [198, 226, 255]\n\"SlateGray2\": [185, 211, 238]\n\"SlateGray3\": [159, 182, 205]\n\"SlateGray4\": [108, 123, 139]\n\"SlateGrey\": [112, 128, 144]\n\"snow\": [255, 250, 250]\n\"snow1\": [255, 250, 250]\n\"snow2\": [238, 233, 233]\n\"snow3\": [205, 201, 201]\n\"snow4\": [139, 137, 137]\n\"spring green\": [0, 255, 127]\n\"SpringGreen\": [0, 255, 127]\n\"SpringGreen1\": [0, 255, 127]\n\"SpringGreen2\": [0, 238, 118]\n\"SpringGreen3\": [0, 205, 102]\n\"SpringGreen4\": [0, 139, 69]\n\"steel blue\": [70, 130, 180]\n\"SteelBlue\": [70, 130, 180]\n\"SteelBlue1\": [99, 184, 255]\n\"SteelBlue2\": [92, 172, 238]\n\"SteelBlue3\": [79, 148, 205]\n\"SteelBlue4\": [54, 100, 139]\n\"tan\": [210, 180, 140]\n\"tan1\": [255, 165, 79]\n\"tan2\": [238, 154, 73]\n\"tan3\": [205, 133, 63]\n\"tan4\": [139, 90, 43]\n\"thistle\": [216, 191, 216]\n\"thistle1\": [255, 225, 255]\n\"thistle2\": [238, 210, 238]\n\"thistle3\": [205, 181, 205]\n\"thistle4\": [139, 123, 139]\n\"tomato\": [255, 99, 71]\n\"tomato1\": [255, 99, 71]\n\"tomato2\": [238, 92, 66]\n\"tomato3\": [205, 79, 57]\n\"tomato4\": [139, 54, 38]\n\"turquoise\": [64, 224, 208]\n\"turquoise1\": [0, 245, 255]\n\"turquoise2\": [0, 229, 238]\n\"turquoise3\": [0, 197, 205]\n\"turquoise4\": [0, 134, 139]\n\"violet\": [238, 130, 238]\n\"violet red\": [208, 32, 144]\n\"VioletRed\": [208, 32, 144]\n\"VioletRed1\": [255, 62, 150]\n\"VioletRed2\": [238, 58, 140]\n\"VioletRed3\": [205, 50, 120]\n\"VioletRed4\": [139, 34, 82]\n\"wheat\": [245, 222, 179]\n\"wheat1\": [255, 231, 186]\n\"wheat2\": [238, 216, 174]\n\"wheat3\": [205, 186, 150]\n\"wheat4\": [139, 126, 102]\n\"white\": [255, 255, 255]\n\"white smoke\": [245, 245, 245]\n\"WhiteSmoke\": [245, 245, 245]\n\"yellow\": [255, 255, 0]\n\"yellow green\": [154, 205, 50]\n\"yellow1\": [255, 255, 0]\n\"yellow2\": [238, 238, 0]\n\"yellow3\": [205, 205, 0]\n\"yellow4\": [139, 139, 0]\n\"YellowGreen\": [154, 205, 50]\n"
  },
  {
    "path": "data/conky-dfly-smp.conf",
    "content": "-- Conky, a system monitor https://github.com/brndnmtthws/conky\n--\n-- This configuration file is Lua code. You can write code in here, and it will\n-- execute when Conky loads. You can use it to generate your own advanced\n-- configurations.\n--\n-- Try this (remove the `--`):\n--\n--   print(\"Loading Conky config\")\n--\n-- For more on Lua, see:\n-- https://www.lua.org/pil/contents.html\n--\n-- Conky Lua API: https://conky.cc/lua\n\n-- Configuration settings: https://conky.cc/config_settings\nconky.config = {\n    alignment = 'bottom_left',\n    background = false,\n    border_width = 1,\n    cpu_avg_samples = 2,\n\tdefault_color = 'white',\n    default_outline_color = 'white',\n    default_shade_color = 'white',\n    draw_borders = false,\n    draw_graph_borders = true,\n    draw_outline = false,\n    draw_shades = false,\n    use_xft = false,\n    --font = 'DejaVu Sans Mono:size=12',\n    gap_x = 5,\n    gap_y = 30,\n    minimum_height = 5,\n\tminimum_width = 5,\n    net_avg_samples = 2,\n    no_buffers = true,\n    out_to_console = false,\n    out_to_stderr = false,\n    extra_newline = false,\n    own_window = false,\n    own_window_class = 'Conky',\n    own_window_type = 'normal',\n    own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',\n    stippled_borders = 0,\n    update_interval = 3.0,\n    uppercase = false,\n    use_spacer = 'none',\n    show_graph_scale = false,\n    show_graph_range = false\n}\n\n-- Variables: https://conky.cc/variables\nconky.text = [[\n$sysname $version on $machine\n$hr\n${color grey}Uptime:$color $uptime\n#${color grey}Temp:$color $acpitemp\n#${color grey}Frequency (in MHz):$color $freq\n#${color grey}Frequency (in GHz):$color $freq_g\n${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}\n${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}\n${color grey}CPU Usage:$color $cpu% ${cpubar 4}\n${color grey}CPU 0: ${cpu cpu1}% ${cpubar cpu1 4}\nCPU 1: ${cpu cpu2}% ${cpubar cpu2 4}\nCPU 2: ${cpu cpu3}% ${cpubar cpu3 4}\nCPU 3: ${cpu cpu4}% ${cpubar cpu4 4}$color\n${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes\n$hr\n${color grey}File systems:\n / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}\n${color grey}Networking:\nUp:$color ${upspeed re0} ${color grey} - Down:$color ${downspeed re0}\n$hr\n${color grey}Name              PID   CPU%   MEM%\n${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}\n${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}\n${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}\n${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}\n${color lightgrey} ${top name 5} ${top pid 5} ${top cpu 5} ${top mem 5}\n${color lightgrey} ${top name 6} ${top pid 6} ${top cpu 6} ${top mem 6}\n${color lightgrey} ${top name 7} ${top pid 7} ${top cpu 7} ${top mem 7}\n${color lightgrey} ${top name 8} ${top pid 8} ${top cpu 8} ${top mem 8}\n]]\n"
  },
  {
    "path": "data/conky.conf",
    "content": "-- Conky, a system monitor https://github.com/brndnmtthws/conky\n--\n-- This configuration file is Lua code. You can write code in here, and it will\n-- execute when Conky loads. You can use it to generate your own advanced\n-- configurations.\n--\n-- Try this (remove the `--`):\n--\n--   print(\"Loading Conky config\")\n--\n-- For more on Lua, see:\n-- https://www.lua.org/pil/contents.html\n--\n-- Conky Lua API: https://conky.cc/lua\n\n-- Configuration settings: https://conky.cc/config_settings\nconky.config = {\n    alignment = 'top_left',\n    background = false,\n    border_width = 1,\n    cpu_avg_samples = 2,\n    default_color = 'white',\n    default_outline_color = 'white',\n    default_shade_color = 'white',\n    double_buffer = true,\n    draw_borders = false,\n    draw_graph_borders = true,\n    draw_outline = false,\n    draw_shades = false,\n    extra_newline = false,\n    font = 'DejaVu Sans Mono:size=12',\n    gap_x = 60,\n    gap_y = 60,\n    minimum_height = 5,\n    minimum_width = 5,\n    net_avg_samples = 2,\n    no_buffers = true,\n    out_to_console = false,\n    out_to_ncurses = false,\n    out_to_stderr = false,\n    out_to_wayland = false,\n    out_to_x = true,\n    own_window = true,\n    own_window_class = 'Conky',\n    own_window_type = 'normal',\n    own_window_hints = 'undecorated,sticky,below,skip_taskbar,skip_pager',\n    show_graph_range = false,\n    show_graph_scale = false,\n    stippled_borders = 0,\n    update_interval = 1.0,\n    uppercase = false,\n    use_spacer = 'none',\n    use_xft = true,\n}\n\n-- Variables: https://conky.cc/variables\nconky.text = [[\n${color grey}Info:$color ${scroll 32 Conky $conky_version - $sysname $nodename $kernel $machine}\n$hr\n${color grey}Uptime:$color $uptime\n${color grey}Frequency (in MHz):$color $freq\n${color grey}Frequency (in GHz):$color $freq_g\n${color grey}RAM Usage:$color $mem/$memmax - $memperc% ${membar 4}\n${color grey}Swap Usage:$color $swap/$swapmax - $swapperc% ${swapbar 4}\n${color grey}CPU Usage:$color $cpu% ${cpubar 4}\n${color grey}Processes:$color $processes  ${color grey}Running:$color $running_processes\n$hr\n${color grey}File systems:\n / $color${fs_used /}/${fs_size /} ${fs_bar 6 /}\n${color grey}Networking:\nUp:$color ${upspeed} ${color grey} - Down:$color ${downspeed}\n$hr\n${color grey}Name              PID     CPU%   MEM%\n${color lightgrey} ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}\n${color lightgrey} ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}\n${color lightgrey} ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}\n${color lightgrey} ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}\n]]\n"
  },
  {
    "path": "data/conky.desktop",
    "content": "[Desktop Entry]\nType=Application\nName=conky\nExec=conky --daemonize --pause=1\nStartupNotify=false\nTerminal=false\nIcon=conky-logomark-violet\nCategories=System;Monitor;\n"
  },
  {
    "path": "data/conky_no_x11.conf",
    "content": "-- Conky, a system monitor https://github.com/brndnmtthws/conky\n--\n-- This configuration file is Lua code. You can write code in here, and it will\n-- execute when Conky loads. You can use it to generate your own advanced\n-- configurations.\n--\n-- Try this (remove the `--`):\n--\n--   print(\"Loading Conky config\")\n--\n-- For more on Lua, see:\n-- https://www.lua.org/pil/contents.html\n--\n-- Conky Lua API: https://conky.cc/lua\n\n-- Configuration settings: https://conky.cc/config_settings\nconky.config = {\n\tbackground = false,\n\tcpu_avg_samples = 2,\n\tnet_avg_samples = 2,\n\tno_buffers = true,\n\tout_to_stderr = false,\n\tupdate_interval = 1.0,\n\tuppercase = false,\n\tuse_spacer = 'none',\n};\n\n-- Variables: https://conky.cc/variables\nconky.text = \n[[${scroll 16 $nodename - $sysname $kernel on $machine | }\nUptime: $uptime\nFrequency (in MHz): $freq\nFrequency (in GHz): $freq_g\nRAM Usage: $mem/$memmax - $memperc% ${membar 4}\nSwap Usage: $swap/$swapmax - $swapperc% ${swapbar 4}\nCPU Usage: $cpu% ${cpubar 4}\nProcesses: $processes  Running: $running_processes\nFile systems:\n / ${fs_used /}/${fs_size /} ${fs_bar 6 /}\nNetworking:\nUp: ${upspeed}  - Down: ${downspeed}\nName              PID   CPU%   MEM%\n ${top name 1} ${top pid 1} ${top cpu 1} ${top mem 1}\n ${top name 2} ${top pid 2} ${top cpu 2} ${top mem 2}\n ${top name 3} ${top pid 3} ${top cpu 3} ${top mem 3}\n ${top name 4} ${top pid 4} ${top cpu 4} ${top mem 4}\n]];\n"
  },
  {
    "path": "doc/.gitignore",
    "content": "__pycache__/\nman.md\n"
  },
  {
    "path": "doc/CMakeLists.txt",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\nif(BUILD_DOCS)\n    add_custom_target(man.md\n        ALL\n        COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/render.py man.md.j2 > ${CMAKE_CURRENT_BINARY_DIR}/man.md\n        WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}\n        SOURCES config_settings.yaml variables.yaml lua.yaml man.md.j2\n    )\n    set(pandoc_mode markdown-markdown_in_html_blocks+raw_html)\n    add_custom_target(conky.1\n        ALL\n        COMMAND ${APP_PANDOC} --standalone -f ${pandoc_mode} -t man ${CMAKE_CURRENT_BINARY_DIR}/man.md > ${CMAKE_CURRENT_BINARY_DIR}/conky.1\n        SOURCES config_settings.yaml variables.yaml lua.yaml man.md.j2\n    )\n    add_dependencies(conky.1 man.md)\n\n    set(MAN_PATH \"share/man/man1\")\n    set(MAN_FILES ${CMAKE_CURRENT_BINARY_DIR}/conky.1)\n\n    install(FILES ${DOC_FILES} DESTINATION ${DOC_PATH})\n\n    install(FILES ${MAN_FILES} DESTINATION ${MAN_PATH})\nendif(BUILD_DOCS)\n"
  },
  {
    "path": "doc/README.md",
    "content": "# Conky docs\n\nThere are three YAML files that contain the documentation:\n\n- [`variables.yaml`](variables.yaml): Documents each object or variable\n- [`config_settings.yaml`](config_settings.yaml): Documents global configuration settings\n- [`lua.yaml`](lua.yaml): Documents Conky's Lua API\n\nThe `desc` field within the docs can be formatted with Markdown; however, _do\nnot_ include headings within `desc` fields, as that will break the man page\noutput. In Markdown, headings begin with `#`.\n\nThe supported documentation fields are:\n\n- `name`: the name of the thing\n- `desc`: a markdown-formatted description of the thing\n- `args`: optional list of arguments\n- `default`: an optional default value, if applicable\n\n## Updating docs\n\nThe man page is based on [`man.md.j2`](man.md.j2), which is a Jinja2 template.\nThe generated markdown is used to generate a final man page using\n[`pandoc`](https://pandoc.org/). Generating the final man page is a two-step\nprocess:\n\n1. Run `render.py` to process `man.md.j2`:\n   ```console\n   $ ./render.py man.md.j2 > man.md\n   ```\n2. Run `pandoc` to convert the markdown into a man page:\n   ```console\n   $ pandoc --standalone -f markdown -t man man.md > conky.1\n   ```\n\nThese steps are also part of the CMake build, and can be executed by configuring\nthe build with `-DBUILD_DOCS=ON`. When building the docs with CMake, target\nfiles are written to the CMake build directory, and not necessarily the same\npath as the source files.\n"
  },
  {
    "path": "doc/config_settings.yaml",
    "content": "# See README.md for details on doc processing.\n#\n# The `desc` field can be formatted with markdown, but please do not include\n# headings (lines beginning with `#`) in the `desc` field.\n#\n# The supported fields are:\n#\n#  * `name`: the name of the thing\n#  * `desc`: a markdown-formatted description of the thing\n#  * `args`: optional list of arguments\n#  * `default`: an optional default value, if applicable\n---\ndesc: |-\n  This is a list of Conky's global configuration options. These belong in the\n  `conky.config` section of your configuration file, before `conky.text`.\n\n  The default configuration file location is `~/.config/conky/conky.conf` or\n  `${sysconfdir}/conky/conky.conf`. On most systems, `$sysconfdir` is `/etc`,\n  and you can find the sample config file there in\n  `/etc/conky/conky.conf`.\n\n  You may want to copy the default config to `~/.config/conky/conky.conf` and\n  modify it there. User configs can be found at\n  https://github.com/brndnmtthws/conky/wiki/Configs.\n\n  Optional arguments are generally denoted with parentheses, for example\n  `(optional)`.\nvalues:\n  - name: alignment\n    desc: |-\n      Screen alignment. May be `none` or one of:\n\n      |                       |                         |                        |\n      |:----------------------|:-----------------------:|-----------------------:|\n      |`top_left` (or `tl`)   | `top_middle` (or `tm`)  |   `top_right` (or `tr`)|\n      |`middle_left` (or `ml`)|`middle_middle` (or `mm`)|`middle_right` (or `mr`)|\n      |`bottom_left` (or `bl`)|`bottom_middle` (or `bm`)|`bottom_right` (or `br`)|\n\n      For `panel` and `dock` [windows](#own_window_type), it may be more useful\n      to use one of the following aliases:\n\n      | Alias  |     Value     |\n      |:------:|:-------------:|\n      | `top`  | `top_middle`  |\n      | `left` | `middle_left` |\n      |`right` |`middle_right` |\n      |`bottom`|`bottom_middle`|\n      |`center`|`middle_middle`|\n\n      See also [`gap_x`](#gap_x) and [`gap_y`](#gap_y) settings.\n  - name: append_file\n    desc: Append the file given as an argument.\n  - name: background\n    desc: |-\n      Boolean value. If true, Conky will fork into the background\n      when started.\n  - name: border_inner_margin\n    desc: |-\n      Inner border margin in pixels (the margin between the border\n      and text).\n  - name: border_outer_margin\n    desc: |-\n      Outer border margin in pixels (the margin between the border\n      and the edge of the window).\n  - name: border_width\n    desc: Border width in pixels.\n  - name: colorN\n    desc: |-\n      Predefine a color for use inside `conky.text` segments.\n      Replace `N` with a digit between 0 and 9, inclusive. When specifying\n      the color value in hex, omit the leading `#`.\n  - name: console_bar_fill\n    desc: 'A character to fill the console bars.'\n    default: '#'\n  - name: console_bar_unfill\n    desc: 'A character to unfill the console bars.'\n    default: '.'\n  - name: console_graph_ticks\n    desc: |-\n      A comma-separated list of strings to use as the bars in a graph rendered\n      to the console or shell. The first list item is used for the minimum bar\n      height and the last item is used for the maximum, for example\n      `\",_,=,#\"`.\n  - name: cpu_avg_samples\n    desc: The number of samples to average for CPU monitoring.\n  - name: default_bar_height\n    desc: |-\n      Specify a default height for bars.\n    default: 6\n  - name: default_bar_width\n    desc: |-\n      Specify a default width for bars. If not specified, the\n      default value is 0, which causes the bar to expand to fit the width of\n      your Conky window. If you set [out_to_console](#out_to_console) = true, the default value\n      will be 10 for the text version of the bar.\n    default: 0\n  - name: default_color\n    desc: Default text color and border color.\n  - name: default_gauge_height\n    desc: |-\n      Specify a default height for gauges.\n    default: 25\n  - name: default_gauge_width\n    desc: |-\n      Specify a default width for gauges.\n    default: 40\n  - name: default_graph_height\n    desc: |-\n      Specify a default height for graphs.\n    default: 25\n  - name: default_graph_width\n    desc: |-\n      Specify a default width for graphs. If not specified, the\n      default value is 0, which causes the graph to expand to fit the width\n      of your Conky window. If you set out_to_console = true, the text\n      version of the graph will actually have no width and you will need to\n      set a sensible default or set the height and width of each graph\n      individually.\n    default: 0\n  - name: default_outline_color\n    desc: Default outline color.\n  - name: default_shade_color\n    desc: Default shading color and border's shading color.\n  - name: detect_battery\n    desc: |-\n      One or more batteries to check in order to use\n      [update_interval_on_battery](#update_interval_on_battery) (comma separated).\n    default: BAT0\n  - name: disable_auto_reload\n    desc: |-\n      Enable to disable the inotify-based auto config reload\n      feature.\n  - name: diskio_avg_samples\n    desc: The number of samples to average for disk I/O monitoring.\n  - name: display\n    desc: Specify an X display to connect to.\n  - name: double_buffer\n    desc: |-\n      Use the Xdbe extension? (eliminates flicker) It is highly\n      recommended to use own window with this one so double buffer won't be\n      so big.\n  - name: draw_blended\n    desc: |-\n      Boolean, blend when rendering drawn image? Some images blend\n      incorrectly breaking alpha with ARBG visuals. This provides a possible\n      work around by disabling blending.\n    default: yes\n  - name: draw_borders\n    desc: Draw borders around text.\n  - name: draw_graph_borders\n    desc: Draw borders around graphs.\n  - name: draw_outline\n    desc: Draw outlines.\n  - name: draw_shades\n    desc: Draw shades.\n  - name: extra_newline\n    desc: |-\n      Put an extra newline at the end when writing to [stdout](#out_to_console),\n      useful for writing to awesome's wiboxes.\n  - name: font\n    desc: Font name in X, xfontsel can be used to get a nice font.\n  - name: fontN\n    desc: |-\n      Predefine a font to be used in conky.text segments.\n      Substitute N by a number between 0 and 9 inclusive. Use the same\n      format as a font variable.\n  - name: forced_redraw\n    desc: |-\n      Boolean value, if true, Conky will redraw everything when you switch the\n      workspace. This may cause delays/flickering on some WMs.\n  - name: format_human_readable\n    desc: |-\n      If enabled, values which are in bytes will be printed in\n      human readable format (i.e., KiB, MiB, etc). If disabled, the number\n      of bytes is printed instead.\n  - name: gap_x\n    desc: |-\n      Gap, in pixels, between right or left border of screen, same\n      as passing -x at command line, e.g. gap_x 10. For other position\n      related stuff, see [`alignment`](#alignment).\n  - name: gap_y\n    desc: |-\n      Gap, in pixels, between top or bottom border of screen, same\n      as passing -y at command line, e.g. gap_y 10. For other position\n      related stuff, see [`alignment`](#alignment).\n  - name: github_token\n    desc: |-\n      Specify API token for GitHub notifications.\n\n      Create an API token at\n      https://github.com/settings/tokens/new?scopes=notifications&description=conky.\n  - name: graph_gradient_mode\n    desc: |-\n      Changes the color space used for interpolation. Arguments are hcl, hsv,\n      and rgb (default).\n    args:\n      - (rgb|hcl|hsv)\n    default: rgb\n  - name: hddtemp_host\n    desc: |-\n      Hostname to connect to for hddtemp objects.\n    default: '127.0.0.1'\n  - name: hddtemp_port\n    desc: Port to use for hddtemp connections.\n    default: 7634\n  - name: http_port\n    desc: |-\n      Port to listen to for HTTP connections. Default value is\n      10080, but is blocked by Firefox and Chrome, so you really want to\n      change it.\n    default: 10080\n  - name: http_refresh\n    desc: |-\n      When this is set the page generated with [out_to_http](#out_to_http) will\n      automatically refresh each interval.\n    default: no\n  - name: if_up_strictness\n    desc: |-\n      How strict should if_up be when testing an interface for\n      being up? The value is one of `up` (default), `link` or `address`, to check for the\n      interface being solely up, being up and having link or being up,\n      having link and an assigned IP address.\n    default: up\n  - name: imap\n    desc: |-\n      Default global IMAP server. Default port is 143, default folder is 'INBOX',\n      default interval is 5 minutes, and default number of retries before giving\n      up is 5. If the password is supplied as '*', you will be prompted to enter\n      the password when Conky starts.\n    args:\n      - host\n      - user\n      - pass\n      - [-i interval (in seconds)]\n      - [-f 'folder']\n      - [-p port]\n      - [-e 'command']\n      - [-r retries]\n  - name: imlib_cache_flush_interval\n    desc: Interval (in seconds) to flush Imlib2 cache.\n  - name: imlib_cache_size\n    desc: |-\n      Imlib2 image cache size, in bytes.  Increase this value if you use $image\n      lots. Set to 0 to disable the image cache.\n    default: 4194304\n  - name: lowercase\n    desc: Boolean value, if true, text is rendered in lower case.\n  - name: lua_draw_hook_post\n    desc: |-\n      This function, if defined, will be called by Conky through\n      each iteration after drawing to the window. Requires X support. Takes\n      any number of optional arguments. Use this hook for drawing things on\n      top of what Conky draws. Conky puts 'conky_' in front of function_name\n      to prevent accidental calls to the wrong function unless you place\n      'conky_' in front of it yourself.\n    args:\n      - function_name\n      - [function arguments]\n  - name: lua_draw_hook_pre\n    desc: |-\n      This function, if defined, will be called by Conky through\n      each iteration before drawing to the window. Requires X support. Takes\n      any number of optional arguments. Use this hook for drawing things on\n      top of what Conky draws. Conky puts 'conky_' in front of function_name\n      to prevent accidental calls to the wrong function unless you place\n      'conky_' in front of it yourself.\n    args:\n      - function_name\n      - [function arguments]\n  - name: lua_load\n    desc: |-\n      List of Lua script paths to load at startup in order to provide Lua\n      functions for other hooks. Listed files are loaded (executed) before\n      'lua_startup_hook' and can (but shouldn't) run code in global scope.\n\n      Paths are ';' (semicolon) separated, and can be relative to the config\n      file path, or absolute.\n\n      The paths were previously ' ' (space) separated, this functionality is\n      still supported if ';' isn't found, but is deprecated and will be removed\n      in future versions. Empty paths are skipped so './example file.lua;' is\n      valid.\n  - name: lua_mouse_hook\n    desc: |-\n      This function, if defined, will be called by Conky upon receiving mouse\n      events from X or Wayland. A table containing event information will be\n      passed to this function as the first argument. Use this hook for detecting\n      mouse input and acting on it. Conky requires that the function declaration\n      has a 'conky_' prefix to prevent accidental calls to the wrong function.\n    args:\n      - function_name\n  - name: lua_shutdown_hook\n    desc: |-\n      This function, if defined, will be called by Conky at\n      shutdown or when the configuration is reloaded. Use this hook to clean\n      up after yourself, such as freeing memory which has been allocated by\n      external libraries via Lua. Conky puts 'conky_' in front of\n      function_name to prevent accidental calls to the wrong function unless\n      you place 'conky_' in front of it yourself.\n    args:\n      - function_name\n      - [function arguments]\n  - name: lua_startup_hook\n    desc: |-\n      This function, if defined, will be called by Conky at\n      startup or when the configuration is reloaded. Use this hook to\n      initialize values, or for any run-once applications. Conky puts\n      'conky_' in front of function_name to prevent accidental calls to the\n      wrong function unless you place 'conky_' in front of it yourself.\n    args:\n      - function_name\n      - [function arguments]\n  - name: mail_spool\n    desc: Mail spool for mail checking.\n  - name: max_port_monitor_connections\n    desc: |-\n      Allow each port monitor to track at most this many\n      connections.\n    default: 256\n  - name: max_text_width\n    desc: |-\n      When a line in the output contains 'width' chars and the end\n      isn't reached, the next char will start on a new line. If you want to\n      make sure that lines don't get broken, set 'width' to 0.\n    args:\n      - integer_number\n  - name: max_user_text\n    desc: |-\n      Maximum size of user text buffer in bytes, i.e. text inside\n      conky.text section in config file.\n    default: 16384\n    args:\n      - integer_number\n  - name: maximum_width\n    desc: Maximum width of window.\n    args:\n      - integer_number\n  - name: minimum_height\n    desc: Minimum height of the window.\n    args:\n      - integer_number\n  - name: minimum_width\n    desc: Minimum width of window.\n    args:\n      - integer_number\n  - name: mpd_host\n    desc: Host of MPD server.\n  - name: mpd_password\n    desc: MPD server password.\n  - name: mpd_port\n    desc: Port of MPD server.\n  - name: music_player_interval\n    desc: |-\n      Music player thread update interval.\n    default: update interval\n  - name: mysql_db\n    desc: MySQL database to use.\n    default: mysql\n  - name: mysql_host\n    desc: Host of MySQL server\n    default: localhost\n  - name: mysql_password\n    desc: |-\n      Password of the MySQL user. Place it between \\\"-chars. When\n      this is not set there is no password used.\n  - name: mysql_port\n    desc: Port of MySQL server.\n    default: 0\n  - name: mysql_user\n    desc: |-\n      MySQL user name to use when connecting to the server.\n      Defaults to your username.\n  - name: net_avg_samples\n    desc: The number of samples to average for net data.\n  - name: no_buffers\n    desc: Subtract (file system) buffers from used memory.\n  - name: nvidia_display\n    desc: |-\n      The display that the nvidia variable will used.\n    default: $DISPLAY\n  - name: out_to_console\n    desc: Print text to stdout.\n  - name: out_to_http\n    desc: Let conky act as a small http-server serving its text.\n  - name: out_to_ncurses\n    desc: |-\n      Print text in the console, but use ncurses so that conky can\n      print the text of a new update over the old text. (In the future this\n      will provide more useful things).\n  - name: out_to_stderr\n    desc: Print text to stderr.\n  - name: out_to_wayland\n    desc: |-\n      Open a Wayland window to display output.\n    default: no\n  - name: out_to_x\n    desc: |-\n      When set to no, there will be no output in X (useful when\n      you also use things like [out_to_console](#out_to_console)). If you set it to no, make\n      sure that it's placed before all other X-related setting (take the\n      first line of your configfile to be sure).\n    default: yes\n  - name: override_utf8_locale\n    desc: Force UTF8. Requires [XFT](#use_xft).\n  - name: overwrite_file\n    desc: Overwrite the file given as argument.\n  - name: own_window\n    desc: Boolean, draw conky in own window instead of drawing on root window.\n  - name: own_window_argb_value\n    desc: |-\n      When ARGB visuals are enabled, this use this to modify the\n      alpha value used. Valid range is 0-255, where 0 is 0% opacity, and 255\n      is 100% opacity.\n    default: 255\n    args:\n      - integer_number\n  - name: own_window_argb_visual\n    desc: |-\n      Boolean, use ARGB visual? ARGB can be used for real transparency, note\n      that a composite manager is required on X11.\n      This option will not work as desired (in most cases) in conjunction with\n      ['own_window_type override'](#own_window_type).\n  - name: own_window_class\n    desc: Manually set the WM_CLASS name.\n    default: Conky\n  - name: own_window_colour\n    desc: |-\n      If [own_window_transparent](#own_window_transparent) no, set a specified background\n      colour. Takes either a hex value (e.g. '#ffffff'),\n      a shorthand hex value (e.g. '#fff'), or a valid RGB name\n      (see `/usr/lib/X11/rgb.txt`).\n    default: black\n    args:\n      - color\n  - name: own_window_hints\n    desc: |-\n      If [`own_window`](#own_window) is set, on X11 you may specify comma separated window\n      manager hints to affect the way Conky displays.\n\n      Following hints are some of the standard WM specification ones:\n      - `above` indicates that conky should be on top of most windows.\n      - `below` indicates that conky should be below most windows.\n      - `skip_pager` indicates that conky should not be included on a\n        Pager. **Implied if** [`own_window_type`](#own_window_type) is 'dock' or 'panel'.\n      - `skip_taskbar` indicates that conky should not be included on a\n        taskbar. **Implied if** [`own_window_type`](#own_window_type) is 'dock' or 'panel'.\n      - `sticky` indicates that the Window Manager SHOULD keep conky's\n        position fixed on the screen, even when the virtual desktop scrolls.\n      - `undecorated` indicates that conky shouldn't have any window\n        decorations (e.g. title bar). **Implied if** [`own_window_type`](#own_window_type) is\n        'dock' or 'panel'.\n\n      Notes:\n      - Use `own_window_type='desktop'` setting as another way to implement many of these hints implicitly.\n      - If you use `own_window_type='override'`, window manager hints have no meaning and are ignored.\n    args:\n      - hint(,hint)*\n  - name: own_window_title\n    desc: |-\n      Allows overriding conky window name.\n    default: 'conky (<hostname>)'\n  - name: own_window_transparent\n    desc: |-\n      Make conky window transparent. If [`own_window_argb_visual`](#own_window_argb_visual) is enabled,\n      sets background opacity to 0%.\n    default: 'false'\n  - name: own_window_type\n    desc: |-\n      If `own_window` is set, under X11 you can specify type of window conky\n      displayed as:\n\n      - `normal` mode makes conky show as normal window. This mode can be\n        configured with use of [`own_window_hints`](#own_window_hints) setting.\n      - `desktop` windows are special windows that have no window decorations,\n        are always visible on the desktop, do not appear in pager or taskbar,\n        and are sticky across all workspaces. Many DEs include `desktop` windows\n        for background, icons and desktop menu, in those cases it might be\n        better to use `normal` or one of the below options, as those will cover\n        conky when they're clicked on.\n      - `dock` windows are placed on screen edges. They're the same as `desktop`\n        in most respects, but render on top of `desktop` windows and below\n        `normal` ones. Conky doesn't define struts for this window type, but\n        some WMs might still implicitly avoid placing windows on top of it.\n      - `panel` windows are similar to `dock` windows, but they also reserve\n        space _along a workarea edge_ (like taskbars), preventing maximized\n        windows from overlapping them. The edge is chosen based on final conky\n        position and size, and workarea dimensions, to ensure normal windows\n        have most free space available. For WMs that \"cut out\" entirely covered\n        screens from reserved area, the edge will be chosen based on `alignment`\n        setting.\n      - `utility` windows are persistent utility windows (e.g. a palette or\n        toolbox). They appear on top of other windows (in the same group), but\n        otherwise behave much like `normal` windows.\n      - `override` windows are drawn directly on root window (desktop\n        background) and are not under the control of the window manager. These\n        will not work with DEs which draw desktop icons via custom\n        panels/windows as those will cover conky.\n        [`own_window_hints`](#own_window_hints) are ignored for `override` windows.\n\n      To make conky mount on root window, set [`own_window`](#own_window) to `false`.\n    default: normal\n    args:\n      - (normal|desktop|dock|panel|utility|override)\n  - name: pad_percents\n    desc: Pad percentages to this many decimals (0 = no padding).\n  - name: pop3\n    desc: |-\n      Default global POP3 server. Arguments are: `host user pass\n      [-i interval (in seconds)] [-p port] [-e 'command'] [-r retries]`.\n      Default port is 110, default interval is 5 minutes, and default number\n      of retries before giving up is 5. If the password is supplied as '*',\n      you will be prompted to enter the password when Conky starts.\n    args:\n      - host\n      - user\n      - pass\n      - [-i interval (in seconds)]\n      - [-p port]\n      - [-e 'command']\n      - [-r retries]\n  - name: short_units\n    desc: |-\n      Shortens units to a single character (kiB->k, GiB->G,\n      etc.).\n    default: no\n  - name: show_graph_range\n    desc: Shows the time range covered by a graph.\n  - name: show_graph_scale\n    desc: Shows the maximum value in scaled graphs.\n  - name: stippled_borders\n    desc: Border stippling (dashing) in pixels.\n  - name: store_graph_data_explicitly\n    desc: |-\n      Enable storing graph data explicitly by ID. This avoids resets while\n      using conditional colors. This option should be disabled while using\n      graphs indirectly e.g. via execpi or lua_parse. Otherwise the graph\n      stays emtpy.\n    default: 'true'\n  - name: temperature_unit\n    desc: |-\n      Desired output unit of all objects displaying a temperature.\n      Parameters are either `fahrenheit` or `celsius`.\n    default: celsius\n  - name: templateN\n    desc: |-\n      Define a template for later use inside conky.text segments.\n      Substitute N by a digit between 0 and 9, inclusively. The value of the\n      variable is being inserted into the stuff inside conky.text at the\n      corresponding position, but before some substitutions are applied:\n\n      * `\\\\n` -> newline\n      * `\\\\` -> backslash\n      * `\\\\ ` -> space\n      * `\\\\N` -> template argument N (starting from 1)\n  - name: text_buffer_size\n    desc: |-\n      Size of the standard text buffer in bytes.\n      This buffer is used for intermediary text, such as individual lines,\n      output from $exec vars, and various other variables. Increasing the\n      size of this buffer can drastically reduce Conky's performance, but\n      will allow for more text display per variable. The size of this buffer\n      cannot be smaller than the default value of 256 bytes.\n    args:\n      - integer_number\n    default: 256\n  - name: times_in_seconds\n    desc: |-\n      If true, variables that output times output a number that\n      represents seconds. This doesn't affect $time, $tztime and $utime.\n  - name: top_cpu_separate\n    desc: |-\n      If true, cpu in top will show usage of one processor's\n      power. If false, cpu in top will show the usage of all processors'\n      power combined.\n  - name: top_name_verbose\n    desc: |-\n      If true, top name shows the full command line of each\n      process, including arguments (whenever possible). Otherwise, only the\n      basename is displayed.\n    default: 'false'\n  - name: top_name_width\n    desc: Width for $top name value in characters.\n    default: 15\n  - name: total_run_times\n    desc: |-\n      Total number of times for Conky to update before quitting.\n      Zero makes Conky run forever.\n  - name: units_spacer\n    desc: String to place between values and units.\n    default: \"'' (empty string)\"\n  - name: update_interval\n    desc: Update interval.\n    args:\n      - seconds\n  - name: update_interval_on_battery\n    desc: Update interval when running on battery power.\n    args:\n      - seconds\n  - name: uppercase\n    desc: Boolean value, if true, text is rendered in upper case.\n  - name: use_spacer\n    desc: |-\n      Adds spaces around certain objects to stop them from moving\n      other things around. May be `none` (default) or `left` or `right`.\n      The old true/false values are deprecated and default to right/none\n      respectively. Note that this only helps if you are using a mono font,\n      such as Bitstream Vera Sans Mono.\n    default: none\n  - name: use_xft\n    desc: Use Xft (anti-aliased font and stuff).\n  - name: xftalpha\n    desc: Alpha of Xft font. Must be a value at or between 1 and 0.\n  - name: xinerama_head\n    desc: Specify a Xinerama head.\n"
  },
  {
    "path": "doc/lua.yaml",
    "content": "# See README.md for details on doc processing.\n#\n# The `desc` field can be formatted with markdown, but please do not include\n# headings (lines beginning with `#`) in the `desc` field.\n#\n# The supported fields are:\n#\n#  * `name`: the name of the thing\n#  * `desc`: a markdown-formatted description of the thing\n#  * `args`: optional list of arguments\n#  * `default`: an optional default value, if applicable\n---\ndesc: |-\n  Conky features a Lua programming API and also ships with Lua bindings\n  for some useful libraries. Note that the bindings require tolua++.\n\n  To use Lua with Conky, first make sure you have a version of\n  Conky with Lua support enabled (`conky -v` will report this).\n  Conky defines certain global functions and variables that can be\n  accessed from Lua code running inside Conky. Scripts must first be loaded\n  using the `lua_load` configuration option. You can then call Lua functions\n  through Conky's `$lua`, `$lua_read`, and Lua hooks.\n\n  Be careful when creating threaded objects through the Lua API. You could end\n  up with a large number of threads running if a thread is created\n  with each iteration.\n\n  Note: to accommodate certain features in the Cairo library's\n  API, Conky will export a few additional functions for the creation of\n  certain structures. These are documented below.\nvalues:\n  - name: RsvgDimensionData:create()\n    desc: |-\n      Call this method to return a new RsvgDimensionData\n      structure. A creation function for this structure is not provided\n      by the Rsvg API.\n\n      After calling this, you should use `tolua.takeownership(rect)` on the return\n      value to ensure ownership is passed properly.\n  - name: RsvgDimensionData:destroy()\n    desc: |-\n      Call this method to free memory allocated by\n      `RsvgDimensionData:create`.\n\n      You should call `tolua.releaseownership(dd)` before calling this function to\n      avoid double-frees, but only if you previously called\n      `tolua.takeownership(dd)`\n  - name: RsvgDimensionData:get()\n    desc: |-\n      Gets the values of an existing RsvgDimensionData.\n  - name: RsvgDimensionData:set(x, y, width, height)\n    desc: |-\n      Sets the values of an existing RsvgDimensionData.\n  - name: RsvgRectangle:create()\n    desc: |-\n      Call this method to return a new RsvgRectangle\n      structure. A creation function for this structure is not provided\n      by the Rsvg API.\n\n      After calling this, you should use `tolua.takeownership(rect)` on the return\n      value to ensure ownership is passed properly.\n  - name: RsvgRectangle:destroy()\n    desc: |-\n      Call this method to free memory allocated by\n      `RsvgRectangle:create`.\n\n      You should call `tolua.releaseownership(rect)` before calling this function to\n      avoid double-frees, but only if you previously called\n      `tolua.takeownership(rect)`\n  - name: RsvgRectangle:get()\n    desc: |-\n      Gets the values of an existing RsvgRectangle.\n  - name: RsvgRectangle:set(x, y, width, height)\n    desc: |-\n      Sets the values of an existing RsvgRectangle.\n  - name: cairo_font_extents_t:create()\n    desc: |-\n      Call this function to return a new cairo_font_extents_t\n      structure. A creation function for this structure is not provided\n      by the cairo API.\n\n      After calling this, you should use\n      `tolua.takeownership(cfe)` on the return value to ensure ownership is\n      passed properly.\n  - name: cairo_font_extents_t:destroy(structure)\n    desc: |-\n      Call this function to free memory allocated by\n      cairo_font_extents_t:create.\n\n      You should call `tolua.releaseownership(cfe)` before calling this function to\n      avoid double-frees, but only if you previously called\n      `tolua.takeownership(cfe)`\n  - name: cairo_matrix_t:create()\n    desc: |-\n      Call this function to return a new cairo_matrix_t structure.\n      A creation function for this structure is not provided by the\n      cairo API.\n\n      After calling this, you should use\n      `tolua.takeownership(cm)` on the return value to ensure ownership is\n      passed properly.\n  - name: cairo_matrix_t:destroy(structure)\n    desc: |-\n      Call this function to free memory allocated by\n      cairo_matrix_t:create.\n\n      You should call `tolua.releaseownership(cm)` before calling this function to\n      avoid double-frees, but only if you previously called\n      `tolua.takeownership(cm)`\n  - name: cairo_place_image(file, cr, x, y, width, height, alpha)\n    desc: |-\n      Renders an image onto a cairo_t, using imlib2. In some cases using a cairo_t and exact coordinates is more\n      useful.\n\n      | Argument            | Description                                                                          |\n      |---------------------|--------------------------------------------------------------------------------------|\n      | file                | Path to the image to render.                                                         |\n      | cr                  | The `cairo_t` to render to.                                                          |\n      | x,y                 | Position to render the image.                                                        |\n      | width, height       | The width and height to draw the image                                               |\n      | alpha               | The transparency of the image 1.0 is solid 0.0 is fully translucent.                 |\n\n      require('cairo_imlib2_helper') in your lua file.\n  - name: cairo_text_extents_t:create()\n    desc: |-\n      Call this function to return a new cairo_text_extents_t\n      structure. A creation function for this structure is not provided\n      by the cairo API.\n\n      After calling this, you should use\n      `tolua.takeownership(cte)` on the return value to ensure ownership is\n      passed properly.\n  - name: cairo_text_extents_t:destroy(structure)\n    desc: |-\n      Call this function to free memory allocated by\n      cairo_text_extents_t:create.\n\n      You should call `tolua.releaseownership(cte)` before calling this function to\n      avoid double-frees, but only if you previously called\n      `tolua.takeownership(cte)`\n  - name: conky_build_arch\n    desc: |-\n      A string containing the build architecture for this Conky instance.\n  - name: conky_build_info\n    desc: |-\n      A string containing build information for this Conky instance, including\n      the version, build date, and\n      architecture.\n  - name: conky_config\n    desc: |-\n      A string containing the path of the current Conky\n      configuration file.\n  - name: conky_info\n    desc: |-\n      This table contains some information about Conky's internal\n      data. The following table describes the values contained:\n\n      | Key             | Value                                 |\n      |-----------------|---------------------------------------|\n      | update_interval | Conky's update interval (in seconds). |\n  - name: conky_parse(string)\n    desc: |-\n      This function takes a string that is evaluated as per\n      Conky's TEXT section, and then returns a string with the\n      result.\n  - name: conky_set_update_interval(number)\n    desc: |-\n      Sets Conky's update interval (in seconds) to\n      'number'.\n  - name: conky_version\n    desc: |-\n      A string containing the version of the current Conky instance.\n  - name: conky_window\n    desc: |-\n      This table contains some information about Conky's window.\n      The following table describes the values contained:\n\n      | Key                 | Value                                                                           |\n      |---------------------|---------------------------------------------------------------------------------|\n      | drawable            | Window's drawable (Xlib Drawable), requires Lua extras enabled at compile time. |\n      | visual              | Window's visual (Xlib Visual), requires Lua extras enabled at compile time.     |\n      | display             | Window's display (Xlib Display), requires Lua extras enabled at compile time.   |\n      | width               | Window width (in pixels).                                                       |\n      | height              | Window height (in pixels).                                                      |\n      | border_inner_margin | Window's inner border margin (in pixels).                                       |\n      | border_outer_margin | Window's outer border margin (in pixels).                                       |\n      | border_width        | Window's border width (in pixels).                                              |\n      | text_start_x        | The x component of the starting coordinate of text drawing.                     |\n      | text_start_y        | The y component of the starting coordinate of text drawing.                     |\n      | text_width          | The width of the text drawing region.                                           |\n      | text_height         | The height of the text drawing region.                                          |\n\n      NOTE: This table is only defined when X support is\n      enabled.\n  - name: ret_scale_x,ret_scale_y:cairo_draw_image(file, cs, x, y, scale_x, scale_y)\n    desc: |-\n      Renders an image onto a cairo_surface_t, using imlib2. Returns the amount the image was scaled by\n\n      | Argument            | Description                                                                          |\n      |---------------------|--------------------------------------------------------------------------------------|\n      | file                | Path to the image to render.                                                         |\n      | cs                  | The `cairo_surface_t` to render to.                                                  |\n      | x,y                 | Position to render the image.                                                        |\n      | scale_x, scale_y    | The amount to scale the image, 1.0 provides no scaling, 2.0 for twice the size and   |\n      |                     | 0.5 for half size etc. <br/>Default value: No Scaling (1.0,1.0)                      |\n\n      require('cairo_imlib2_helper') in your lua file.\n\n  - name: cairo_text_hp_show(cr, x, y, text, font, font_size, alignment, language, script, direction)\n    desc: |-\n      Renders text to a `cairo_t` using HarfBuzz and FreeType. This provides\n      significantly better text rendering than Cairo's built-in functions.\n\n      | Argument            | Description                                                                          |\n      |---------------------|--------------------------------------------------------------------------------------|\n      | cr                  | The `cairo_t` to render to.                                                          |\n      | x,y                 | Position to render the text.                                                         |\n      | text                | The text to render.                                                                  |\n      | font                | The name of the font to be used, `Fontconfig` is used to search for the font.        |\n      | font_size           | The font size.                                                                       |\n      | alignment           | One of `CAIRO_TEXT_ALIGN_LEFT`, `CAIRO_TEXT_ALIGN_RIGHT`, `CAIRO_TEXT_ALIGN_CENTER`.<br/>Default value: `CAIRO_TEXT_ALIGN_LEFT` |\n      | language            | A string containing a BCP 47 language tag.<br/>Default value: `en`                   |\n      | script              | A string containing a ISO 15924 script tag.<br/>Default value: auto-detect from text |\n      | direction           | A string representing text direction eg `LTR`, `RTL` or `TTB`<br/>Default value: auto-detect from text otherwise `LTR` |\n  - name: width,height:cairo_text_hp_text_size(text, font, font_size, language, script, direction)\n    desc: |-\n      Used to calculate how many pixels will be required to render a string with\n      `cairo_text_hp_show` returns a pair of int's with `width` and `height`.\n\n      | Argument            | Description                                                                          |\n      |---------------------|--------------------------------------------------------------------------------------|\n      | cr                  | The `cairo_t` to render to.                                                          |\n      | text                | The text to render.                                                                  |\n      | font                | The name of the font to be used, `Fontconfig` is used to search for the font.        |\n      | font_size           | The font size.                                                                       |\n      | language            | A string containing a BCP 47 language tag.<br/>Default value: `en`                   |\n      | script              | A string containing a ISO 15924 script tag.<br/>Default value: auto-detect from text |\n      | direction           | A string representing text direction eg `LTR`, `RTL` or `TTB`<br/> Default value: auto-detect from text otherwise `LTR` |\n  - name: cairo_text_hp_delete_fonts()\n    desc: |-\n      `cairo_text_hp_show` and `cairo_text_hp_text_size` both cache internal font details,\n      this function clears those caches.\n"
  },
  {
    "path": "doc/man.md.j2",
    "content": "% conky(1)\n%\n% {{ date }}\n\n# NAME\n\nconky - A system monitor for X\n\n# SYNOPSIS\n\n**conky** \\[ *options* \\]\n\n# DESCRIPTION\n\nConky is a system monitor for X originally based on torsmo. Since its\ninception, Conky has changed significantly from its predecessor, while\nmaintaining simplicity and configurability. Conky can display just about\nanything, either on your root desktop or in its own window. Not only\ndoes Conky have many built-in objects, it can also display just about\nany piece of information by using scripts and other external programs.\n\nConky has more than 250 built in objects, including support for a\nplethora of OS stats (uname, uptime, CPU usage, mem usage, disk usage,\n\\\"top\\\" like process stats, and network monitoring, just to name a few),\nbuilt in IMAP and POP3 support, built in support for many popular music\nplayers (MPD, XMMS2, Audacious), and much much more. Conky can display\nthis info either as text, or using simple progress bars and graph\nwidgets, with different fonts and colours.\n\nWe are always looking for help, whether its reporting bugs, writing\npatches, or writing docs. Please use the facilities on GitHub to\nmake bug reports, feature requests, and submit patches.\n\nThanks for your interest in Conky.\n\n# COMPILING\n\nFor users compiling from source on a binary distro, make sure you have\nthe X development libraries installed (Unless you configure your build\nwithout X11). This should be a package along the lines of \\\"libx11-dev\\\"\nor \\\"xorg-x11-dev\\\" for X11 libs, and similar \\\"-dev\\\" format for the\nother libs required (depending on your build options). You should be\nable to see which extra packages you need to install by reading errors\nthat you get from running \\`cmake\\'. The easiest way to view the\navailable build options is to run \\`ccmake\\' or \\`cmake-gui\\' from the\nsource tree, but be careful when disabling certain features as you may\nlose desired functionality. E.g., with BUILD_MATH disabled you won\\'t\nget errors but logarithmic graphs will be normal graphs and gauges will\nmiss their line.\n\nConky has (for some time) been available in the repositories of most\npopular distributions. Here are some installation instructions for a\nfew:\n\nGentoo users \\-- Conky is in Gentoo\\'s Portage\\... simply use \\\"emerge\napp-admin/conky\\\" for installation.\n\nDebian, etc. users \\-- Conky should be in your repositories, and can be\ninstalled by doing \\\"aptitude install conky\\\".\n\nExample to compile and run Conky with default components (note that some\nbuild options may differ for your system):\n\n**cmake** **-D CMAKE_INSTALL_PREFIX:string=/usr .** \n\n:   \n\n**make** \n\n:   \n\n**make install** **\\# Optional** \n\n:   \n\n**src/conky** \n\n:   \n\nConky has been tested to be compatible with C99 C and C++0x C++, however\nit has not been tested with anything other than gcc, and is not\nguaranteed to work with other compilers.\n\nTIP: Try configuring Conky with \\`ccmake\\' or \\`cmake-gui\\' instead of\njust \\`cmake\\'.\n\n# YOU SHOULD KNOW\n\nConky is generally very good on resources. That said, the more you try\nto make Conky do, the more resources it is going to consume.\n\nAn easy way to force Conky to reload your *\\~/.config/conky/conky.conf*:\n\\\"killall -SIGUSR1 conky\\\". Saves you the trouble of having to kill and\nthen restart.\n\n# OPTIONS\n\nCommand line options override configurations defined in configuration\nfile.\n\n**-a \\| \\--alignment=** **ALIGNMENT** \n\n:   Text alignment on screen, {top,bottom,middle}\\_{left,right,middle}\n    or none. Can also be abbreviated with first chars of position, ie.\n    tr for top_right. Only available with build flag BUILD_X11 enabled.\n\n**-b \\| \\--double-buffer** \n\n:   Use double buffering (eliminates \\\"flicker\\\"). Only available with\n    build flag BUILD_X11 enabled.\n\n**-c \\| \\--config=** **FILE** \n\n:   Config file to load instead of *\\~/.config/conky/conky.conf*.\n\n**-C \\| \\--print-config** \n\n:   Print builtin default config to stdout. See also the section\n    EXAMPLES for more information. Only available with build flag\n    BUILD_BUILTIN_CONFIG enabled.\n\n**-d \\| \\--daemonize** \n\n:   Daemonize Conky, aka fork to background.\n\n**-D \\| \\--debug** \n\n:   Increase debugging output, ie. -DD for more debugging.\n\n**-f \\| \\--font=** **FONT** \n\n:   Font to use. Only available with build flag BUILD_X11 enabled.\n\n**-h \\| \\--help** \n\n:   Prints command line help and exits.\n\n**-i** **COUNT** \n\n:   Number of times to update Conky (and quit).\n\n**-o \\| \\--own-window** \n\n:   Create own window to draw. Only available with build flag BUILD_X11\n    enabled.\n\n**-p \\| \\--pause=** **SECONDS** \n\n:   Time to pause/wait before actually starting Conky.\n\n**-q \\| \\--quiet** \n\n:   Run Conky in \\'quiet mode\\' (ie. no output).\n\n**-t \\| \\--text=** **TEXT** \n\n:   Text to render, remember single quotes, like -t \\' \\$uptime \\'.\n\n**-u \\| \\--interval=** **SECONDS** \n\n:   Update interval.\n\n**-U \\| \\--unique**\n\n:   Conky won't start if another Conky process is already running. Implemented\n    only for Linux, FreeBSD, NetBSD, OpenBSD and Haiku.\n\n**-v \\| -V \\| \\--version** \n\n:   Prints version, build information and general info. Exits after\n    printing.\n\n**-w \\| \\--window-id=** **WIN_ID** \n\n:   Window id to draw. Only available with build flag BUILD_X11 enabled.\n\n**-x** **X_COORDINATE** \n\n:   X position.\n\n**-X \\| \\--display=** **DISPLAY** \n\n:   X11 display to use. Only available with build flag BUILD_X11\n    enabled.\n\n**-y** **Y_COORDINATE** \n\n:   Y position.\n\n# CONFIGURATION SETTINGS\n\n{{ config_settings['desc'] }}\n\n{% for item in config_settings['values'] %}\n**{{ item.name }}** {% if item.args %}**{{ item.args | join(\" \") }}**{% endif %}\n\n:   {{ item.desc | indent(width=4) }}\n{%- if item.default %}\n\n    Default: {{ item.default }}\n{%- endif %}\n{% endfor %}\n\n# OBJECTS/VARIABLES\n\n{{ variables['desc'] }}\n\n{% for item in variables['values'] %}\n**{{ item.name }}** {% if item.args %}**{{ item.args | join(\" \") }}**{% endif %}\n\n:   {{ item.desc | indent(width=4) }}\n{%- if item.default %}\n\n    Default: {{ item.default }}\n{%- endif %}\n{% endfor %}\n\n# LUA API\n\n{{ lua['desc'] }}\n\n{% for item in lua['values'] %}\n**{{ item.name }}** {% if item.args %}**{{ item.args | join(\" \") }}**{% endif %}\n\n:   {{ item.desc | indent(width=4) }}\n{%- if item.default %}\n\n    Default: {{ item.default }}\n{%- endif %}\n{% endfor %}\n\n# EXAMPLES\n\n**conky -t \\'\\${time %D %H:%M}\\' -o -u 30** \n\n:   Start Conky in its own window with date and clock as text and 30 sec\n    update interval.\n\n**conky -a top_left -x 5 -y 500 -d** \n\n:   Start Conky to background at coordinates (5, 500).\n\n**conky -C \\> \\~/.config/conky/conky.conf** \n\n:   Do not start Conky, but have it output the builtin default config\n    file to *\\~/.config/conky/conky.conf* for later customising.\n\n# FILES\n\n*\\${sysconfdir}/conky/conky.conf* \n\n:   Default system-wide configuration file. The value of \\${sysconfdir}\n    depends on the compile-time options (most likely /etc).\n\n*\\~/.config/conky/conky.conf* \n\n:   Default personal configuration file.\n\n# BUGS\n\nDrawing to root or some other desktop window directly doesn\\'t work with\nall window managers. Especially doesn\\'t work well with Gnome and it has\nbeen reported that it doesn\\'t work with KDE either. Nautilus can be\ndisabled from drawing to desktop with program gconf-editor. Uncheck\nshow_desktop in /apps/nautilus/preferences/. There is -w switch in Conky\nto set some specific window id. You might find xwininfo -tree useful to\nfind the window to draw to. You can also use -o argument which makes\nConky to create its own window. If you do try running Conky in its own\nwindow, be sure to read up on the own_window_type settings and\nexperiment.\n\n# SEE ALSO\n\n*https://github.com/brndnmtthws/conky*\n\n# COPYING\n\nCopyright (c) 2005-{{ copyright_year }} Brenden Matthews, Philip Kovacs, et. al. Any\noriginal torsmo code is licensed under the BSD license (see LICENSE.BSD\nfor a copy). All code written since the fork of torsmo is licensed under\nthe GPL (see LICENSE.GPL for a copy), except where noted differently\n(such as in portmon and audacious code which are LGPL, and prss which is\nan MIT-style license).\n\n# AUTHORS\n\nThe Conky dev team (see AUTHORS for a full list of contributors).\n"
  },
  {
    "path": "doc/render.py",
    "content": "#!/usr/bin/env python3\n\nimport sys\nimport os\nimport time\nimport yaml\nimport datetime\n\nbase_path = os.path.dirname(os.path.realpath(__file__))\n\nwith open(os.path.join(base_path, \"config_settings.yaml\")) as file:\n    config_settings = yaml.safe_load(file)\n\nwith open(os.path.join(base_path, \"variables.yaml\")) as file:\n    variables = yaml.safe_load(file)\n\nwith open(os.path.join(base_path, \"lua.yaml\")) as file:\n    lua = yaml.safe_load(file)\n\nbuild_date = datetime.datetime.fromtimestamp(\n    int(os.environ.get('SOURCE_DATE_EPOCH', time.time())),\n    tz=datetime.timezone.utc,\n)\ndata = {\n    \"config_settings\": config_settings,\n    \"variables\": variables,\n    \"lua\": lua,\n    \"date\": build_date.date().isoformat(),\n    \"copyright_year\": build_date.year,\n}\n\nfrom jinja2 import Environment, FileSystemLoader, select_autoescape\n\n\ndef reverse_format(param_list, format_string):\n    return format_string.format(param_list)\n\n\nenv = Environment(\n    loader=FileSystemLoader(\".\"),\n    autoescape=select_autoescape(),\n)\nenv.filters[\"reverse_format\"] = reverse_format\n\ntemplate = env.get_template(sys.argv[1])\nprint(template.render(data))\n"
  },
  {
    "path": "doc/variables.yaml",
    "content": "# See README.md for details on doc processing.\n#\n# The `desc` field can be formatted with markdown, but please do not include\n# headings (lines beginning with `#`) in the `desc` field.\n#\n# The supported fields are:\n#\n#  * `name`: the name of the thing\n#  * `desc`: a markdown-formatted description of the thing\n#  * `args`: optional list of arguments\n#  * `default`: an optional default value, if applicable\n---\ndesc: |-\n  To configure what Conky displays, you must supply some variables in the\n  `conky.text` section of your configuration. In this section you will find a\n  listing of the available variables. Some of them may require build options to\n  be enabled at compile time for them to work.\n\n  Colors are parsed using `XParseColor()`. A list of named colors may be\n  available in `/usr/share/X11/rgb.txt`. Colors may also be specified in\n  `#rrggbb` hexadecimal format.\n\n  Some objects may create threads, and sometimes these threads will not be\n  destroyed until Conky terminates. There is no way to destroy or clean up\n  threads while Conky is running. For example, if you use an MPD variable,\n  the MPD thread will keep running until Conky exits. Some threaded objects\n  will use one of the parameters as a `key`, so that you only have one\n  relevant thread running (for example, the $curl, and $rss\n  objects launch one thread per URI).\n\n  Optional arguments are generally denoted with parentheses, for example\n  `(optional)`.\nvalues:\n  - name: acpiacadapter\n    desc: |-\n      ACPI AC adapter state. On Linux, the adapter option\n      specifies the subfolder of `/sys/class/power_supply` containing the state\n      information. Tries `AC` and `ADP1` if no argument is given.\n      Non-linux systems ignore it.\n    args:\n      - (adapter)\n  - name: acpifan\n    desc: ACPI fan state.\n  - name: acpitemp\n    desc: ACPI temperature in C.\n  - name: addr\n    desc: |-\n      IP address for an interface, or \"No Address\" if no address\n      is assigned.\n    args:\n      - (interface)\n  - name: addrs\n    desc: |-\n      IP addresses for an interface (if one - works like addr).\n      Linux only.\n    args:\n      - (interface)\n  - name: adt746xcpu\n    desc: CPU temperature from therm_adt746x.\n  - name: adt746xfan\n    desc: Fan speed from therm_adt746x.\n  - name: alignc\n    desc: Align text to the center.\n    args:\n      - (num)\n  - name: alignr\n    desc: Right-justify text, with space of N.\n    args:\n      - (num)\n  - name: apcupsd\n    desc: |-\n      Sets up the connection to apcupsd daemon. Prints nothing.\n    default: localhost:3551\n    args:\n      - host\n      - port\n  - name: apcupsd_cable\n    desc: Prints the UPS connection type.\n  - name: apcupsd_charge\n    desc: Current battery capacity in percent.\n  - name: apcupsd_lastxfer\n    desc: Reason for last transfer from line to battery.\n  - name: apcupsd_linev\n    desc: Nominal input voltage.\n  - name: apcupsd_load\n    desc: Current load in percent.\n  - name: apcupsd_loadbar\n    desc: Bar showing current load.\n  - name: apcupsd_loadgauge\n    desc: Gauge that shows current load.\n    args:\n      - (height),(width)\n  - name: apcupsd_loadgraph\n    desc: History graph of current load.\n    args:\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: apcupsd_model\n    desc: Prints the model of the UPS.\n  - name: apcupsd_name\n    desc: Prints the UPS user-defined name.\n  - name: apcupsd_status\n    desc: Prints current status (on-line, on-battery).\n  - name: apcupsd_temp\n    desc: Current internal temperature.\n  - name: apcupsd_timeleft\n    desc: Time left to run on battery.\n  - name: apcupsd_upsmode\n    desc: Prints the UPS mode (e.g. standalone).\n  - name: apm_adapter\n    desc: Display APM AC adapter status. FreeBSD, OpenBSD only.\n  - name: apm_battery_life\n    desc: Display APM battery life in percent. FreeBSD, OpenBSD only.\n  - name: apm_battery_time\n    desc: |-\n      Display remaining APM battery life in hh:mm:ss or \"unknown\"\n      if AC adapter status is online or charging. FreeBSD and OpenBSD only.\n  - name: audacious_bar\n    desc: Progress bar.\n    args:\n      - (height),(width)\n  - name: audacious_bitrate\n    desc: Bitrate of current tune.\n  - name: audacious_channels\n    desc: Number of audio channels of current tune.\n  - name: audacious_filename\n    desc: Full path and filename of current tune.\n  - name: audacious_frequency\n    desc: Sampling frequency of current tune.\n  - name: audacious_length\n    desc: Total length of current tune as MM:SS.\n  - name: audacious_length_seconds\n    desc: Total length of current tune in seconds.\n  - name: audacious_main_volume\n    desc: The current volume reported by Audacious.\n  - name: audacious_playlist_length\n    desc: Number of tunes in playlist.\n  - name: audacious_playlist_position\n    desc: Playlist position of current tune.\n  - name: audacious_position\n    desc: Position of current tune (MM:SS).\n  - name: audacious_position_seconds\n    desc: Position of current tune in seconds.\n  - name: audacious_status\n    desc: Player status (Playing/Paused/Stopped/Not running).\n  - name: audacious_title\n    desc: |-\n      Title of current tune with optional maximum length\n      specifier.\n    args:\n      - (max length)\n  - name: battery\n    desc: |-\n      Battery status and remaining percentage capacity of ACPI or\n      APM battery. An ACPI battery number may be given as an argument.\n    default: BAT0\n    args:\n      - (num)\n  - name: battery_bar\n    desc: |-\n      Battery percentage remaining of ACPI battery in a bar. ACPI battery number\n      can be given as argument (use `all` to get the mean percentage remaining for\n      all batteries).\n    default: BAT0\n    args:\n      - (height),(width)\n      - (num)\n  - name: battery_percent\n    desc: |-\n      Battery percentage remaining for ACPI battery. ACPI battery\n      number can be given as argument (use `all` to get the\n      mean percentage remaining for all batteries).\n    default: BAT0\n    args:\n      - (num)\n  - name: battery_power_draw\n    desc: |-\n      Battery power draw in watts\n    default: BAT0\n    args:\n      - (num)\n  - name: battery_short\n    desc: |-\n      Battery status and remaining percentage capacity of ACPI or APM battery.\n      An ACPI battery number may be given as an argument. This mode displays a\n      short status: `C` for charging, `D` for discharging, `F` for full, `N`\n      for not present, `E` for empty, and `U` for unknown.\n    default: BAT0\n    args:\n      - (num)\n  - name: battery_status\n    desc: |-\n      Battery status for an ACPI battery. An ACPI battery number may be given\n      as an argument.\n    default: BAT0\n    args:\n      - (num)\n  - name: battery_time\n    desc: |-\n      Battery charge/discharge time remaining of ACPI battery.\n      An ACPI battery number may be given as an argument.\n    default: BAT0\n    args:\n      - (num)\n  - name: blink\n    desc: Let 'text_and_other_conky_vars' blink on and off.\n    args:\n      - text_and_other_conky_vars\n  - name: buffers\n    desc: Amount of memory buffered.\n  - name: cached\n    desc: Amount of memory cached.\n  - name: cat\n    desc: |-\n      Reads a file and displays its contents in Conky. This is\n      useful if you have an independent process generating output that you\n      want to include in Conky.\n    args:\n      - file\n  - name: catp\n    desc: |-\n      Reads a file and displays its contents in Conky. This is\n      useful if you have an independent process generating output that you\n      want to include in Conky. This differs from `$cat` in that it parses the\n      contents of the file, so you can insert things like\n      `${color red}hi!${color}` in your file and have it correctly parsed by\n      Conky.\n    args:\n      - file\n  - name: cmdline_to_pid\n    desc: PID of the first process whose command line contains the given string.\n    args:\n      - string\n  - name: cmus_aaa\n    desc: Print aaa status of cmus (all/artist/album).\n  - name: cmus_album\n    desc: Prints the album of the current cmus song.\n  - name: cmus_artist\n    desc: Prints the artist of the current cmus song.\n  - name: cmus_curtime\n    desc: Current time of the current cmus song.\n  - name: cmus_date\n    desc: Print the date of the current cmus song.\n  - name: cmus_file\n    desc: Print the file name of the current cmus song.\n  - name: cmus_genre\n    desc: Print the genre name of the current cmus song.\n  - name: cmus_percent\n    desc: Percent of song's progress.\n  - name: cmus_progress\n    desc: cmus' progress bar.\n    args:\n      - (height),(width)\n  - name: cmus_random\n    desc: Random status of cmus (on/off).\n  - name: cmus_repeat\n    desc: Repeat status of cmus (song/all/off).\n  - name: cmus_state\n    desc: Current state of cmus (playing, paused, stopped etc).\n  - name: cmus_timeleft\n    desc: Time left of the current cmus song.\n  - name: cmus_title\n    desc: Prints the title of the current cmus song.\n  - name: cmus_totaltime\n    desc: Total length of the current cmus song.\n  - name: cmus_track\n    desc: Print track number of current cmus song.\n  - name: color\n    desc: |-\n      Change drawing color to _color_ which is a name of a color\n      or a hexcode preceded with #, e.g. `#0A1B2C`. If you use ncurses only\n      the following colors are supported: red, green, yellow, blue, magenta,\n      cyan, black, and white.\n    args:\n      - (color)\n  - name: colorN\n    desc: |-\n      Change drawing color to colorN configuration option, where N\n      is a digit between 0 and 9, inclusively.\n  - name: combine\n    desc: |-\n      Places the lines of var2 to the right of the lines of var1\n      separated by the chars that are put between var1 and var2. For\n      example: `${combine ${head /proc/cpuinfo 2} - ${head /proc/meminfo 1}}`\n      gives as output `cpuinfo_line1 - meminfo_line1` on line 1 and\n      `cpuinfo_line2 -` on line 2. $combine vars can also be nested to place\n      more vars next to each other.\n    args:\n      - var1\n      - var2\n  - name: conky_build_arch\n    desc: CPU architecture Conky was built for.\n  - name: conky_version\n    desc: Conky version.\n  - name: cpu\n    desc: |-\n      CPU usage in percents. For SMP machines, the CPU number can\n      be provided as an argument. ${cpu cpu0} is the total usage, and ${cpu\n      cpuX} (X >= 1) are individual CPUs.\n    args:\n      - (cpuN)\n  - name: cpubar\n    desc: |-\n      Bar that shows CPU usage, height is bar's height in pixels.\n      See $cpu for more info on SMP.\n    args:\n      - (cpuN)\n      - (height),(width)\n  - name: cpugauge\n    desc: |-\n      Elliptical gauge that shows CPU usage, height and width are\n      gauge's vertical and horizontal axis respectively. See $cpu for more\n      info on SMP.\n    args:\n      - (cpuN)\n      - (height),(width)\n  - name: cpugovernor\n    desc: |-\n      The active CPU scaling governor, defaulting to the first core.\n      See $cpu for more info on SMP. Linux only.\n    args:\n      - (cpuN)\n  - name: cpugraph\n    desc: |-\n      CPU usage graph, with optional colours in hex, minus the #.\n      See $cpu for more info on SMP. Uses a logarithmic scale (to see small\n      numbers) when you use the -l switch. Takes the switch '-t' to use a\n      temperature gradient, which makes the gradient values change depending\n      on the amplitude of a particular graph value (try it and see). The flag\n      '-x' inverts the x axis and '-y' inverts the y axis of the graph. The flag\n      '-m' sets a nonzero minimum/lowerbound, ensuring that all values are at \n      least the specified minimum (excluding zero).\n    args:\n      - (cpuN)\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: curl\n    desc: |-\n      Download data from URI using Curl at the specified interval.\n      The interval may be a positive floating point value (0 is allowed),\n      otherwise defaults to 15 minutes. Most useful when used in conjunction\n      with Lua and the Lua API. This object is threaded, and once a thread\n      is created it can't be explicitly destroyed. One thread will run for\n      each URI specified. You can use any protocol that Curl supports.\n    args:\n      - url\n      - (interval_in_minutes)\n  - name: desktop\n    desc: |-\n      Number of the desktop on which conky is running or the\n      message \"Not running in X\" if this is the case.\n  - name: desktop_name\n    desc: |-\n      Name of the desktop on which conky is running or the message\n      \"Not running in X\" if this is the case.\n  - name: desktop_number\n    desc: |-\n      Number of desktops or the message \"Not running in X\" if this\n      is the case.\n  - name: disk_protect\n    desc: |-\n      Disk protection status, if supported (needs kernel-patch).\n      Prints either \"frozen\" or \"free \" (note the padding).\n    args:\n      - device\n  - name: diskio\n    desc: |-\n      Displays current disk IO. Device is optional, and takes the\n      form of sda for /dev/sda. A block device label can be specified with\n      label:foo and a block device partuuid can be specified with\n      partuuid:40000000-01.\n    args:\n      - (device)\n  - name: diskio_read\n    desc: Displays current disk IO for reads. Device as in diskio.\n    args:\n      - (device)\n  - name: diskio_write\n    desc: Displays current disk IO for writes. Device as in diskio.\n    args:\n      - (device)\n  - name: diskiograph\n    desc: |-\n      Disk IO graph, colours defined in hex, minus the #. If scale\n      is non-zero, it becomes the scale for the graph. Uses a logarithmic\n      scale (to see small numbers) when you use -l switch. Takes the switch\n      '-t' to use a temperature gradient, which makes the gradient values\n      change depending on the amplitude of a particular graph value (try it\n      and see). The flag '-x' inverts the x axis and '-y' inverts the y axis \n      of the graph. The flag '-m' sets a nonzero minimum/lowerbound, ensuring \n      that all values are at least the specified minimum (excluding zero).\n    args:\n      - (device)\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: diskiograph_read\n    desc: |-\n      Disk IO graph for reads, colours defined in hex, minus the\n      #. If scale is non-zero, it becomes the scale for the graph. Device as\n      in diskio. Uses a logarithmic scale (to see small numbers) when you\n      use -l switch. Takes the switch '-t' to use a temperature gradient,\n      which makes the gradient values change depending on the amplitude of a\n      particular graph value (try it and see). The flag '-x' inverts the x \n      axis and '-y' inverts the y axis of the graph. The flag '-m' sets a nonzero \n      minimum/lowerbound, ensuring that all values are at least the specified \n      minimum (excluding zero).\n    args:\n      - (device)\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: diskiograph_write\n    desc: |-\n      Disk IO graph for writes, colours defined in hex, minus the\n      #. If scale is non-zero, it becomes the scale for the graph. Device as\n      in diskio. Uses a logarithmic scale (to see small numbers) when you\n      use -l switch. Takes the switch '-t' to use a temperature gradient,\n      which makes the gradient values change depending on the amplitude of a\n      particular graph value (try it and see). The flag '-x' inverts the x \n      axis and '-y' inverts the y axis of the graph. The flag '-m' sets a \n      nonzero minimum/lowerbound, ensuring that all values are at \n      least the specified minimum (excluding zero).\n    args:\n      - (device)\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: distribution\n    desc: |-\n      Name of the Linux distribution. `NAME` is read from the `/etc/os-release`\n      file with fallback on `/proc/version` content. Create an issue if reported\n      information is wrong.\n    other:\n      filename: /proc/version\n  - name: downspeed\n    desc: Download speed in suitable IEC units.\n    args:\n      - (net)\n  - name: downspeedf\n    desc: Download speed in KiB with one decimal.\n    args:\n      - (net)\n  - name: downspeedgraph\n    desc: |-\n      Download speed graph, colours defined in hex, minus the #.\n      If scale is non-zero, it defines the maximum value of the graph (in bytes\n      per second). Uses a logarithmic scale (to see small numbers) when you use\n      -l switch. Takes the switch '-t' to use a temperature gradient, which makes\n      the gradient values change depending on the amplitude of a particular\n      graph value (try it and see). The flag '-x' inverts the x axis and '-y' \n      inverts the y axis of the graph. The flag '-m' sets a nonzero \n      minimum/lowerbound, ensuring that all values are at least the specified \n      minimum (excluding zero).\n    args:\n      - (netdev)\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m)\n  - name: draft_mails\n    desc: |-\n      Number of mails marked as draft in the specified mailbox or\n      mail spool if not. Only maildir type mailboxes are supported, mbox\n      type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: else\n    desc: Text to show if any of the above are not true.\n  - name: endif\n    desc: Ends an $if block.\n  - name: entropy_avail\n    desc: Current entropy available for crypto freaks.\n  - name: entropy_bar\n    desc: Normalized bar of available entropy for crypto freaks.\n    args:\n      - (height),(width)\n  - name: entropy_perc\n    desc: |-\n      Percentage of entropy available in comparison to the\n      poolsize.\n  - name: entropy_poolsize\n    desc: Total size of system entropy pool for crypto freaks.\n  - name: eval\n    desc: |-\n      Evaluates given string according to the rules of conky.text\n      interpretation, i.e. parsing any contained text object specifications\n      into their output, any occurring '$$' into a single '$' and so on. The\n      output is then being parsed again.\n    args:\n      - string\n  - name: exec\n    desc: |-\n      Executes a shell command and displays the output in conky.\n      Warning: this takes a lot more resources than other variables. I'd\n      recommend coding wanted behaviour in C/C++ and posting a patch.\n    args:\n      - command\n  - name: execbar\n    desc: |-\n      Same as exec, except if the first value returned is a value\n      between 0-100, it will use that number to draw a horizontal bar. The\n      height and width parameters are optional, and default to the\n      default_bar_height and default_bar_width config settings,\n      respectively.\n    args:\n      - (height),(width)\n      - command\n  - name: execgauge\n    desc: |-\n      Same as exec, except if the first value returned is a value\n      between 0-100, it will use that number to draw a round gauge (much\n      like a vehicle speedometer). The height and width parameters are\n      optional, and default to the default_gauge_height and\n      default_gauge_width config settings, respectively.\n    args:\n      - (height),(width)\n      - command\n  - name: execgraph\n    desc: |-\n      Draws a horizontally scrolling graph with values from 0-100 plotted on the\n      vertical axis. All parameters following the command are optional. Gradient\n      colors can be specified as hexadecimal values with no 0x or # prefix. Use\n      the -t switch to enable a temperature gradient, so that small values are\n      \"cold\" with color 1 and large values are \"hot\" with color 2. Without the -t\n      switch, the colors produce a horizontal gradient spanning the width of the\n      graph. The scale parameter defines the maximum value of the graph.  Use the\n      -l switch to enable a logarithmic scale, which helps to see small values.\n      The default size for graphs can be controlled via the default_graph_height\n      and default_graph_width config settings. The flag '-x' inverts the x axis \n      and '-y' inverts the y axis of the graph. The flag '-m' sets a nonzero \n      minimum/lowerbound, ensuring that all values are at least the specified \n      minimum (excluding zero).\n\n      If you need to execute a command with spaces, you have a\n      couple options:\n\n      1. wrap your command in double-quotes, or\n      2. put your command into a separate file, such as ~/bin/myscript.sh, and use\n      that as your execgraph command.\n\n      Remember to make your script executable!\n\n      In the following example, we set up execgraph to display seconds (0-59) on a\n      graph that is 50px high and 200px wide, using a temperature gradient with\n      colors ranging from red for small values (FF0000) to yellow for large values\n      (FFFF00). We set the scale to 60.\n\n      ```\n      ${execgraph ~/seconds.sh 50,200 FF0000 FFFF00 60 -t}\n      ```\n    args:\n      - command\n      - (height),(width)\n      - (gradient color 1)\n      - (gradient color 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: execi\n    desc: |-\n      Same as exec, but with a specific interval in seconds. The\n      interval can't be less than the update_interval in your configuration.\n      See also $texeci.\n    args:\n      - interval\n      - command\n  - name: execibar\n    desc: Same as execbar, but with an interval.\n    args:\n      - interval\n      - (height),(width)\n      - command\n  - name: execigauge\n    desc: Same as execgauge, but with an interval.\n    args:\n      - interval\n      - (height),(width)\n      - command\n  - name: execigraph\n    desc: Same as execgraph, but with an interval.\n    args:\n      - interval\n      - command\n      - (height),(width)\n      - (gradient color 1)\n      - (gradient color 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: execp\n    desc: |-\n      Executes a shell command and displays the output in conky.\n      Warning: this takes a lot more resources than other variables. I'd\n      recommend coding wanted behaviour in C/C++ and posting a patch. This\n      differs from $exec in that it parses the output of the command, so you\n      can insert things like `${color red}hi!${color}` in your script and have\n      it correctly parsed by Conky. Caveats: Conky parses and evaluates the\n      output of $execp every time Conky loops, and then destroys all the\n      objects. If you try to use anything like $execi within an $execp\n      statement, it will functionally run at the same interval that the\n      $execp statement runs, as it is created and destroyed at every\n      interval.\n    args:\n      - command\n  - name: execpi\n    desc: |-\n      Same as execp, but with an interval. Note that the output\n      from the $execpi command is still parsed and evaluated at every\n      interval.\n    args:\n      - interval\n      - command\n  - name: flagged_mails\n    desc: |-\n      Number of mails marked as flagged in the specified mailbox\n      or mail spool if not. Only maildir type mailboxes are supported, mbox\n      type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: font\n    desc: |-\n      Specify a different font. This new font will apply to the\n      current line and everything following. You can use a $font with no\n      arguments to change back to the default font (much like with $color).\n    args:\n      - (font)\n  - name: fontN\n    desc: |-\n      Change font to fontN configuration option, where N is a\n      digit between 0 and 9, inclusively.\n  - name: format_time\n    desc: |-\n      Format time given in seconds. This var only works when the\n      times_in_seconds configuration setting is on. Format is a string that\n      should start and end with a double quote `\"` character. The quote\n      characters are not part of the output, \\w,\\d,\\h,\\m,\\s,\\(,\\) and \\\\ are\n      replaced by weeks,days,hours,minutes,seconds,(,) and \\. If you leave out a\n      unit, it's value will be expressed in the highest unit lower than the one\n      left out. Text between ()-chars will not be visible if a replaced unit in\n      this text is 0. If seconds is a decimal number then you can see the\n      numbers behind the point by using \\S followed by a number that specifies\n      the amount of digits behind the point that you want to see (maximum 9).\n      You can also place a 'x' behind \\S so you have all digits behind the point\n      and no trailing zero's. (also maximum 9).\n    args:\n      - seconds\n      - format\n  - name: forwarded_mails\n    desc: |-\n      Number of mails marked as forwarded in the specified mailbox\n      or mail spool if not. Only maildir type mailboxes are supported, mbox\n      type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: free_bufcache\n    desc: Amount of memory cached or buffered, as reported by free. Linux only.\n  - name: free_cached\n    desc: Amount of memory cached, as reported by free. Linux only.\n  - name: freq\n    desc: |-\n      Returns CPU #n's frequency in MHz. CPUs are counted from 1.\n    default: 1\n    args:\n      - (n)\n  - name: freq2\n    desc: |-\n      Returns CPU #n's clock speed from assembly in MHz. CPUs are\n      counted from 1.\n    default: 1\n    args:\n      - (n)\n  - name: freq_g\n    desc: |-\n      Returns CPU #n's frequency in GHz. CPUs are counted from 1.\n    default: 1\n    args:\n      - (n)\n  - name: fs_bar\n    desc: |-\n      Bar that shows how much space is used on a file system.\n      height is the height in pixels. fs is any file on that file system.\n    args:\n      - (height),(width)\n      - fs\n  - name: fs_bar_free\n    desc: |-\n      Bar that shows how much space is free on a file system.\n      height is the height in pixels. fs is any file on that file system.\n    args:\n      - (height),(width)\n      - fs\n  - name: fs_free\n    desc: Free space on a file system available for users.\n    args:\n      - (fs)\n  - name: fs_free_perc\n    desc: |-\n      Free percentage of space on a file system available for\n      users.\n    args:\n      - (fs)\n  - name: fs_size\n    desc: File system size.\n    args:\n      - (fs)\n  - name: fs_type\n    desc: File system type.\n    args:\n      - (fs)\n  - name: fs_used\n    desc: File system used space.\n    args:\n      - (fs)\n  - name: fs_used_perc\n    desc: Percent of file system used space.\n    args:\n      - (fs)\n  - name: gid_name\n    desc: Name of group with this gid.\n    args:\n      - gid\n  - name: github_notifications\n    desc: Number of GitHub notifications.\n  - name: goto\n    desc: The next element will be printed at position 'x'.\n    args:\n      - x\n  - name: gw_iface\n    desc: |-\n      Displays the default route's interface or \"multiple\"/\"none\"\n      accordingly.\n  - name: gw_ip\n    desc: |-\n      Displays the default gateway's IP or \"multiple\"/\"none\"\n      accordingly.\n  - name: hddtemp\n    desc: |-\n      Displays temperature of a selected hard disk drive as\n      reported by the hddtemp daemon. Use hddtemp_host and hddtemp_port to\n      specify a host and port for all hddtemp objects. If no dev parameter\n      is given, the first disk returned by the hddtemp daemon is used.\n    args:\n      - (dev)\n  - name: head\n    desc: |-\n      Displays first N lines of supplied text file. The file is\n      checked every 'next_check' update. If next_check is not supplied,\n      Conky defaults to 2. Max of 30 lines can be displayed, or until the\n      text buffer is filled.\n    args:\n      - logfile\n      - lines\n      - (next_check)\n  - name: hr\n    desc: Horizontal line, height is the height in pixels.\n    args:\n      - (height)\n  - name: hwmon\n    desc: |-\n      Hwmon sensor from sysfs (Linux 2.6). Parameter dev can be:\n      1. Number. e.g `1` means hwmon1.\n      2. Module name. e.g. `k10temp` means the first hwmon device whose module\n      name is `k10temp`.\n      3. Omitted. Then the first hwmon device (hwmon0) will be used.\n\n      Parameter type is either `in` or `vol` meaning voltage; `fan` meaning fan;\n      `temp` meaning temperature. Parameter n is number of the sensor. See\n      `/sys/class/hwmon/` on your local computer.  The optional arguments `factor`\n      and `offset` allow precalculation of the raw input, which is being modified\n      as follows: `input = input * factor + offset`. Note that they have to be\n      given as decimal values (i.e. contain at least one decimal place).\n    args:\n      - (dev)\n      - type\n      - n\n      - (factor offset)\n    other:\n      filename: null\n  - name: i2c\n    desc: |-\n      I2C sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you have\n      only one I2C device. Parameter type is either `in` or `vol` meaning voltage;\n      `fan` meaning fan; `temp` meaning temperature. Parameter n is number of the\n      sensor. See `/sys/bus/i2c/devices/` on your local computer. The optional\n      arguments `factor` and `offset` allow precalculation of the raw input, which\n      is being modified as follows: `input = input * factor + offset`. Note that\n      they have to be given as decimal values (i.e. contain at least one decimal\n      place).\n    args:\n      - (dev)\n      - type\n      - n\n      - (factor offset)\n    other:\n      filename: null\n  - name: i8k_ac_status\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops, displays whether ac\n      power is on, as listed in `/proc/i8k` (translated to human-readable). Beware\n      that this is by default not enabled by i8k itself.\n  - name: i8k_bios\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the bios version as listed in /proc/i8k.\n  - name: i8k_buttons_status\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the volume buttons status as listed in /proc/i8k.\n  - name: i8k_cpu_temp\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the cpu temperature in Celsius, as reported by /proc/i8k.\n  - name: i8k_left_fan_rpm\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the left fan's rate of rotation, in revolutions per minute as\n      listed in /proc/i8k. Beware, some laptops i8k reports these fans in\n      reverse order.\n  - name: i8k_left_fan_status\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the left fan status as listed in /proc/i8k (translated to\n      human-readable). Beware, some laptops i8k reports these fans in\n      reverse order.\n  - name: i8k_right_fan_rpm\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the right fan's rate of rotation, in revolutions per minute\n      as listed in /proc/i8k. Beware, some laptops i8k reports these fans in\n      reverse order.\n  - name: i8k_right_fan_status\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the right fan status as listed in /proc/i8k (translated to\n      human-readable). Beware, some laptops i8k reports these fans in\n      reverse order.\n  - name: i8k_serial\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays your laptop serial number as listed in /proc/i8k.\n  - name: i8k_version\n    desc: |-\n      If running the i8k kernel driver for Inspiron laptops,\n      displays the version formatting of /proc/i8k.\n  - name: ibm_brightness\n    desc: |-\n      If running the IBM ACPI, displays the brigtness of the\n      laptops's LCD (0-7).\n  - name: ibm_fan\n    desc: If running the IBM ACPI, displays the fan speed.\n  - name: ibm_temps\n    desc: |-\n      If running the IBM ACPI, displays the temperatures from the\n      IBM temperature sensors (N=0..7) Sensor 0 is on the CPU, 3 is on the\n      GPU.\n    args:\n      - N\n  - name: ibm_thinklight\n    desc: |-\n      If running the IBM ACPI, displays the status of your\n      ThinkLight™. Value is either 'on', 'off' or 'unknown'.\n  - name: ibm_volume\n    desc: |-\n      If running the IBM ACPI, displays the \"master\" volume,\n      controlled by the volume keys (0-14).\n  - name: ical\n    desc: |-\n      Shows title of event number 'number' in the ical (RFC 5545)\n      file 'file'. The events are first ordered by starting time, events\n      that started in the past are ignored. The events that are shown are\n      the VEVENTS, the title that is shown is the SUMMARY and the starting\n      time used for sorting is DTSTART.\n    args:\n      - number\n      - file\n  - name: iconv_start\n    desc: |-\n      Convert text from one codeset to another using GNU iconv.\n      Needs to be stopped with iconv_stop.\n    args:\n      - codeset_from\n      - codeset_to\n  - name: iconv_stop\n    desc: Stop iconv codeset conversion.\n  - name: if_empty\n    desc: |-\n      if conky variable VAR is empty, display everything between\n      $if_empty and the matching $endif.\n    args:\n      - (var)\n  - name: if_existing\n    desc: |-\n      if FILE exists, display everything between if_existing and\n      the matching $endif. The optional second parameter checks for FILE\n      containing the specified string and prints everything between\n      $if_existing and the matching $endif.\n    args:\n      - file\n      - (string)\n  - name: if_gw\n    desc: |-\n      if there is at least one default gateway, display everything\n      between $if_gw and the matching $endif.\n  - name: if_match\n    desc: |-\n      Evaluates the given boolean expression, printing everything\n      between $if_match and the matching $endif depending on whether the\n      evaluation returns true or not. Valid expressions consist of a left\n      side, an operator and a right side. Left and right sides are being\n      parsed for contained text objects before evaluation.\n\n      Recognised left and right side types are:\n\n      * **double**: Argument consists of only digits and a single dot.\n      * **long**: Argument consists of only digits.\n      * **string**: Argument is enclosed in quotation marks (`\"`).\n\n      Valid operands are:\n\n      * `<` or `>`\n      * `<=` or `>=`\n      * `==` or `!=`\n    args:\n      - expression\n  - name: if_mixer_mute\n    desc: |-\n      If mixer exists, display everything between $if_mixer_mute\n      and the matching $endif. If no mixer is specified, \"Vol\" is used.\n    args:\n      - (mixer)\n  - name: if_mounted\n    desc: |-\n      if MOUNTPOINT is mounted, display everything between\n      $if_mounted and the matching $endif.\n    args:\n      - (mountpoint)\n  - name: if_mpd_playing\n    desc: |-\n      if mpd is playing or paused, display everything between\n      $if_mpd_playing and the matching $endif.\n  - name: if_pa_sink_muted\n    desc: |-\n      If Pulseaudio's default sink is muted, display everything\n      between $if_pa_sink_muted and the corresponding $else or $endif.\n  - name: if_pa_source_muted\n    desc: |-\n      If Pulseaudio's default source (e.g. your microphone) is muted, display\n      everything between $if_pa_source_muted and the corresponding $else or $endif.\n  - name: if_pa_source_running\n    desc: |-\n      If Pulseaudio's default source is running (e.g. a program is accessing\n      your microphone), display everything between $if_pa_source_running and\n      the corresponding $else or $endif.\n  - name: if_running\n    desc: |-\n      If PROCESS is running, display everything between `$if_running` and the\n      corresponding `$else` or `$endif`. Note that PROCESS may be either a full\n      command line with arguments (without the directory prefix), or simply the\n      name of an executable. For example, either of the following will be true\n      if there is a running process with the command line `/usr/bin/conky -u\n      5`:\n      * `${if_running conky -u 5}` or\n      * `${if_running conky}`\n\n      It is important not to include trailing spaces. For example,\n      `${if_running conky }` will be false.\n    args:\n      - (process)\n  - name: if_smapi_bat_installed\n    desc: |-\n      when using smapi, if the battery with index INDEX is\n      installed, display everything between $if_smapi_bat_installed and the\n      matching $endif.\n    args:\n      - (INDEX)\n  - name: if_up\n    desc: |-\n      if INTERFACE exists and is up, display everything between\n      $if_up and the matching $endif.\n    args:\n      - (interface)\n  - name: if_updatenr\n    desc: |-\n      If it's the UPDATENR-th time that conky updates, display\n      everything between $if_updatenr and the matching $endif. The counter\n      resets when the highest UPDATENR is reached.\n\n      Example: `{$if_updatenr 1}foo$endif{$if_updatenr 2}bar$endif{$if_updatenr\n      4}$endif` shows foo 25% of the time followed by bar 25% of the time followed\n      by nothing the other half of the time.\n    args:\n      - (updatenr)\n  - name: if_xmms2_connected\n    desc: |-\n      Display everything between $if_xmms2_connected and the\n      matching $endif if xmms2 is running.\n  - name: iface\n    desc: Display interface names starting from 1, eg ${iface 1}.\n    args:\n      - (number)\n  - name: image\n    desc: |-\n      Renders an image from the path specified using Imlib2. Takes\n      4 optional arguments: a position, a size, a no-cache switch, and a\n      cache flush interval. Changing the x,y position will move the position\n      of the image, and changing the WxH will scale the image. If you\n      specify the no-cache flag (-n), the image will not be cached.\n      Alternately, you can specify the -f int switch to specify a cache\n      flush interval for a particular image. Example: ${image\n      /home/brenden/cheeseburger.jpg -p 20,20 -s 200x200} will render\n      'cheeseburger.jpg' at (20,20) scaled to 200x200 pixels. Conky does not\n      make any attempt to adjust the position (or any other formatting) of\n      images, they are just rendered as per the arguments passed. The only\n      reason $image is part of the conky.text section, is to allow for\n      runtime modifications, through $execp $lua_parse, or some other\n      method.\n    args:\n      - <path to image>\n      - (-p x,y)\n      - (-s WxH)\n      - (-n)\n      - (-f interval)\n  - name: imap_messages\n    desc: |-\n      Displays the number of messages in your global IMAP inbox by\n      default. You can define individual IMAP inboxes separately by passing\n      arguments to this object. Arguments are: \"host user pass [-i interval\n      (in seconds)] [-f 'folder'] [-p port] [-e 'command'] [-r retries]\".\n      Default port is 143, default folder is 'INBOX', default interval is 5\n      minutes, and default number of retries before giving up is 5. If the\n      password is supplied as '*', you will be prompted to enter the\n      password when Conky starts.\n    args:\n      - (args)\n  - name: imap_unseen\n    desc: |-\n      Displays the number of unseen messages in your global IMAP\n      inbox by default. You can define individual IMAP inboxes separately by\n      passing arguments to this object. Arguments are: \"host user pass [-i\n      interval (in seconds)] [-f 'folder'] [-p port] [-e 'command'] [-r\n      retries]\". Default port is 143, default folder is 'INBOX', default\n      interval is 5 minutes, and default number of retries before giving up\n      is 5. If the password is supplied as '*', you will be prompted to\n      enter the password when Conky starts.\n    args:\n      - (args)\n  - name: intel_backlight\n    desc: Display the brightness of your Intel backlight in percent.\n  - name: ioscheduler\n    desc: |-\n      Prints the current ioscheduler used for the given disk name\n      (i.e. e.g. \"hda\" or \"sdb\").\n    args:\n      - disk\n  - name: irc\n    desc: |-\n      Shows everything that's being told in #channel on IRCserver\n      'server'. TCP-port 6667 is used for the connection unless 'port' is\n      specified. Shows everything since the last time or the last\n      'max_msg_lines' entries if specified.\n    args:\n      - server(:port)\n      - '#channel'\n      - (max_msg_lines)\n  - name: journal\n    desc: |-\n      Displays last N lines of the systemd journal. The optional\n      type can be 'user' or 'system' which will show only the user or system\n      journal respectively. By default, all journal lines visible to the\n      user are shown. A maximum of 200 lines can be displayed, or until the\n      text buffer is filled.\n    args:\n      - lines\n      - (type)\n  - name: kernel\n    desc: Kernel version.\n  - name: key_caps_lock\n    desc: An indicator for Capital Lock key.\n  - name: key_num_lock\n    desc: An indicator for Number Lock key.\n  - name: key_scroll_lock\n    desc: An indicator for Scrolling Lock key.\n  - name: keyboard_layout\n    desc: Display keyboard layout.\n  - name: laptop_mode\n    desc: The value of `/proc/sys/vm/laptop_mode`.\n  - name: legacymem\n    desc: Amount of memory used, calculated the same way as in the `free` program.\n  - name: lines\n    desc: Displays the number of lines in the given file.\n    args:\n      - textfile\n  - name: loadavg\n    desc: |-\n      System load average, 1 is for past 1 minute, 2 for past 5\n      minutes and 3 for past 15 minutes. Without argument, prints all three\n      values separated by whitespace.\n    args:\n      - (1|2|3)\n  - name: loadgraph\n    desc: |-\n      Load1 average graph, similar to xload, with optional colours\n      in hex, minus the #. Uses a logarithmic scale (to see small numbers)\n      when you use the -l switch. Takes the switch '-t' to use a temperature\n      gradient, which makes the gradient values change depending on the\n      amplitude of a particular graph value (try it and see). The flag\n      '-x' inverts the x axis and '-y' inverts the y axis of the graph.\n      The flag '-m' sets a nonzero minimum/lowerbound, ensuring that all \n      values are at least the specified minimum (excluding zero).\n    args:\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: lowercase\n    desc: Converts all letters into lowercase.\n    args:\n      - text\n  - name: lua\n    desc: |-\n      Executes a Lua function with given parameters, then prints\n      the returned string. See also 'lua_load' on how to load scripts. Conky\n      puts 'conky_' in front of function_name to prevent accidental calls to\n      the wrong function unless you place 'conky_' in front of it\n      yourself.\n    args:\n      - function_name\n      - (function parameters)\n  - name: lua_bar\n    desc: |-\n      Executes a Lua function with given parameters and draws a\n      bar. Expects result value to be an integer between 0 and 100. See also\n      'lua_load' on how to load scripts. Conky puts 'conky_' in front of\n      function_name to prevent accidental calls to the wrong function unless\n      you place 'conky_' in front of it yourself.\n    args:\n      - (height,width)\n      - function_name\n      - (function parameters)\n  - name: lua_gauge\n    desc: |-\n      Executes a Lua function with given parameters and draws a\n      gauge. Expects result value to be an integer between 0 and 100. See\n      also 'lua_load' on how to load scripts. Conky puts 'conky_' in front\n      of function_name to prevent accidental calls to the wrong function\n      unless you place 'conky_' in front of it yourself.\n    args:\n      - (height,width)\n      - function_name\n      - (function parameters)\n  - name: lua_graph\n    desc: |-\n      Executes a Lua function with and draws a graph. Expects\n      result value to be any number, and by default will scale to show the\n      full range. See also 'lua_load' on how to load scripts. Takes the\n      switch '-t' to use a temperature gradient, which makes the gradient\n      values change depending on the amplitude of a particular graph value\n      (try it and see). Conky puts 'conky_' in front of function_name to\n      prevent accidental calls to the wrong function unless you put you\n      place 'conky_' in front of it yourself.  The flag '-x' inverts the \n      x axis and '-y' inverts the y axis of the graph. The flag '-m' sets \n      a nonzero minimum/lowerbound, ensuring that all values are at least \n      the specified minimum (excluding zero).\n    args:\n      - function_name\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: lua_parse\n    desc: |-\n      Executes a Lua function with given parameters as per $lua,\n      then parses and prints the result value as per the syntax for the\n      conky.text section. See also 'lua_load' on how to load scripts. Conky\n      puts 'conky_' in front of function_name to prevent accidental calls to\n      the wrong function unless you place 'conky_' in front of it\n      yourself.\n    args:\n      - function_name\n      - (function parameters)\n  - name: machine\n    desc: Machine, e.g. i686, x86_64.\n  - name: mails\n    desc: |-\n      Mail count in the specified mailbox or your mail spool if\n      not. Both mbox and maildir type mailboxes are supported. You can use a\n      program like fetchmail to get mails from some server using your\n      favourite protocol. See also new_mails.\n    args:\n      - (mailbox)\n      - (interval)\n  - name: mboxscan\n    desc: |-\n      Print a summary of recent messages in an mbox format\n      mailbox. mbox parameter is the filename of the mailbox (can be\n      encapsulated using '\"', ie. ${mboxscan -n 10 \"/home/brenden/some box\"}\n    args:\n      - (-n number of messages to print)\n      - (-fw from width)\n      - (-sw subject width)\n      - mbox\n  - name: mem\n    desc: Amount of memory in use.\n  - name: memactive\n    desc: Amount of active memory. FreeBSD only.\n  - name: memavail\n    desc: Amount of available memory as recorded in /proc/meminfo. Linux 3.14+ only.\n  - name: membar\n    desc: Bar that shows amount of memory in use.\n    args:\n      - (height),(width)\n  - name: memdirty\n    desc: Amount of \"dirty\" memory. Linux only.\n  - name: memeasyfree\n    desc: |-\n      Amount of free memory including the memory that is very\n      easily freed (buffers/cache).\n  - name: memfree\n    desc: Amount of free memory.\n  - name: memgauge\n    desc: Gauge that shows amount of memory in use (see cpugauge).\n    args:\n      - (height),(width)\n  - name: memgraph\n    desc: |-\n      Memory usage graph. Uses a logarithmic scale (to see small\n      numbers) when you use the -l switch. Takes the switch '-t' to use a\n      temperature gradient, which makes the gradient values change depending\n      on the amplitude of a particular graph value (try it and see). The flag\n      '-x' inverts the x axis and '-y' inverts the y axis of the graph. The flag \n      '-m' sets a nonzero minimum/lowerbound, ensuring that all values are at \n      least the specified minimum (excluding zero).\n    args:\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: meminactive\n    desc: Amount of inactive memory. FreeBSD only.\n  - name: memlaundry\n    desc: Amount of memory in the laundry queue. FreeBSD only.\n  - name: memmax\n    desc: Total amount of memory.\n  - name: memperc\n    desc: Percentage of memory in use.\n  - name: memwired\n    desc: Amount of wired memory. FreeBSD only.\n  - name: memwithbuffers\n    desc: |-\n      Amount of memory in use, including that used by system\n      buffers and caches.\n  - name: memwithbuffersbar\n    desc: |-\n      Bar that shows amount of memory in use (including memory\n      used by system buffers and caches).\n    args:\n      - (height),(width)\n  - name: memwithbuffersgraph\n    desc: |-\n      Memory usage graph including memory used by system buffers\n      and cache. Uses a logarithmic scale (to see small numbers) when you\n      use the -l switch. Takes the switch '-t' to use a temperature\n      gradient, which makes the gradient values change depending on the\n      amplitude of a particular graph value (try it and see). The flag\n      '-x' inverts the x axis and '-y' inverts the y axis of the graph.\n      The flag '-m' sets a nonzero minimum/lowerbound, ensuring that all \n      values are at least the specified minimum (excluding zero).\n    args:\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m value)\n  - name: mixer\n    desc: |-\n      Prints the mixer value as reported by the OS. On Linux, this\n      variable uses the OSS emulation, so you need the proper kernel module\n      loaded. Default mixer is \"Vol\", but you can specify one of the\n      available OSS controls: \"Vol\", \"Bass\", \"Trebl\", \"Synth\", \"Pcm\",\n      \"Spkr\", \"Line\", \"Mic\", \"CD\", \"Mix\", \"Pcm2 \", \"Rec\", \"IGain\", \"OGain\",\n      \"Line1\", \"Line2\", \"Line3\", \"Digital1\", \"Digital2\", \"Digital3\",\n      \"PhoneIn\", \"PhoneOut\", \"Video\", \"Radio\" and \"Monitor\".\n    default: Vol\n    args:\n      - (device)\n  - name: mixerbar\n    desc: |-\n      Displays mixer value in a bar as reported by the OS. See\n      docs for $mixer for details on arguments.\n    args:\n      - (device)\n  - name: mixerl\n    desc: |-\n      Prints the left channel mixer value as reported by the OS.\n      See docs for $mixer for details on arguments.\n    args:\n      - (device)\n  - name: mixerlbar\n    desc: |-\n      Displays the left channel mixer value in a bar as reported\n      by the OS. See docs for $mixer for details on arguments.\n    args:\n      - (device)\n  - name: mixerr\n    desc: |-\n      Prints the right channel mixer value as reported by the OS.\n      See docs for $mixer for details on arguments.\n    args:\n      - (device)\n  - name: mixerrbar\n    desc: |-\n      Displays the right channel mixer value in a bar as reported\n      by the OS. See docs for $mixer for details on arguments.\n    args:\n      - (device)\n  - name: moc_album\n    desc: Album of the current MOC song.\n  - name: moc_artist\n    desc: Artist of the current MOC song.\n  - name: moc_bar\n    desc: Bar of the current MOC song's progress.\n    args:\n      - (height),(width)\n  - name: moc_bitrate\n    desc: Bitrate in the current MOC song.\n  - name: moc_avgbitrate\n    desc: Average bitrate in the current MOC song.\n  - name: moc_curtime\n    desc: Current time of the current MOC song.\n  - name: moc_cursec\n    desc: Current time of the current MOC song in seconds.\n  - name: moc_file\n    desc: File name of the current MOC song.\n  - name: moc_percent\n    desc: Percent of current MOC song's progress.\n  - name: moc_rate\n    desc: Rate of the current MOC song.\n  - name: moc_song\n    desc: The current song name being played in MOC.\n  - name: moc_state\n    desc: Current state of MOC; playing, stopped etc.\n  - name: moc_timeleft\n    desc: Time left in the current MOC song.\n  - name: moc_title\n    desc: Title of the current MOC song.\n  - name: moc_totaltime\n    desc: Total length of the current MOC song.\n  - name: moc_totalsec\n    desc: Total length of the current MOC song in seconds.\n  - name: monitor\n    desc: |-\n      Number of the monitor on which conky is running or the\n      message \"Not running in X\" if this is the case.\n  - name: monitor_number\n    desc: |-\n      Number of monitors or the message \"Not running in X\" if this\n      is the case.\n  - name: mouse_speed\n    desc: Display mouse speed.\n  - name: mpd_album\n    desc: Album in current MPD song.\n  - name: mpd_albumartist\n    desc: Artist of the album of the current MPD song.\n  - name: mpd_artist\n    desc: Artist in current MPD song must be enabled at compile.\n  - name: mpd_bar\n    desc: Bar of mpd's progress.\n    args:\n      - (height),(width)\n  - name: mpd_bitrate\n    desc: Bitrate of current song.\n  - name: mpd_comment\n    desc: Comment of current MPD song.\n    args:\n      - (max-length)\n  - name: mpd_date\n    desc: Date of current song.\n  - name: mpd_elapsed\n    desc: Song's elapsed time.\n  - name: mpd_file\n    desc: Prints the file name of the current MPD song.\n  - name: mpd_length\n    desc: Song's length.\n  - name: mpd_name\n    desc: Prints the MPD name field.\n  - name: mpd_percent\n    desc: Percent of song's progress.\n  - name: mpd_random\n    desc: Random status (On/Off).\n  - name: mpd_repeat\n    desc: Repeat status (On/Off).\n  - name: mpd_smart\n    desc: |-\n      Prints the song name in either the form \"artist - title\" or\n      file name, depending on whats available.\n    args:\n      - (max\n      - length)\n  - name: mpd_status\n    desc: Playing, stopped, et cetera.\n  - name: mpd_title\n    desc: Title of current MPD song.\n    args:\n      - (max\n      - length)\n  - name: mpd_track\n    desc: Prints the MPD track field.\n  - name: mpd_vol\n    desc: MPD's volume.\n  - name: mysql\n    desc: |-\n      Shows the first field of the first row of the result of the\n      query.\n    args:\n      - query\n  - name: nameserver\n    desc: |-\n      Print a nameserver from /etc/resolv.conf.\n    default: 0\n    args:\n      - (index)\n  - name: new_mails\n    desc: |-\n      Unread mail count in the specified mailbox or mail spool if\n      not. Both mbox and maildir type mailboxes are supported.\n    args:\n      - (mailbox)\n      - (interval)\n  - name: no_update\n    desc: |-\n      Shows text and parses the vars in it, but doesn't update\n      them. Use this for things that do not change while conky is running,\n      like $machine, $conky_version,... By not updating this you can save\n      some resources.\n    args:\n      - text\n  - name: nodename\n    desc: Hostname.\n  - name: nodename_short\n    desc: Short hostname (same as 'hostname -s' shell command).\n  - name: nvidia\n    desc: |-\n      Nvidia graphics card information via the XNVCtrl library.\n\n      Temperatures are printed as float, all other values as integers.\n\n      **GPU_ID:** Optional parameter to choose the GPU to be used as 0,1,2,3,..\n      Default parameter is 0\n\n      **Possible arguments:**\n\n      | Argument           | Alias       | Description                                                     |\n      |--------------------|-------------|-----------------------------------------------------------------|\n      | `gputemp`          | `temp`      | GPU temperature                                                 |\n      | `gputempthreshold` | `threshold` | Temperature threshold where the GPU will reduce its clock speed |\n      | `ambienttemp`      | `ambient`   | Ambient temperature outside the graphics card                   |\n      | `gpufreqcur`       | `gpufreq`   | Current GPU clock speed                                         |\n      | `gpufreqmin`       |             | Minimum GPU clock speed                                         |\n      | `gpufreqmax`       |             | Maximum GPU clock speed                                         |\n      | `memfreqcur`       | `memfreq`   | Current memory clock speed                                      |\n      | `memfreqmin`       |             | Minimum memory clock speed                                      |\n      | `memfreqmax`       |             | Maximum memory clock speed                                      |\n      | `mtrfreqcur`       | `mtrfreq`   | Current memory transfer rate clock speed                        |\n      | `mtrfreqmin`       |             | Minimum memory transfer rate clock speed                        |\n      | `mtrfreqmax`       |             | Maximum memory transfer rate clock speed                        |\n      | `perflevelcur`     | `perflevel` | Current performance level                                       |\n      | `perflevelmin`     |             | Lowest performance level                                        |\n      | `perflevelmax`     |             | Highest performance level                                       |\n      | `perfmode`         |             | Performance mode                                                |\n      | `gpuutil`          |             | GPU utilization %                                               |\n      | `membwutil`        |             | Memory bandwidth utilization %                                  |\n      | `videoutil`        |             | Video engine utilization %                                      |\n      | `pcieutil`         |             | PCIe bandwidth utilization %                                    |\n      | `memused`          | `mem`       | Amount of used memory                                           |\n      | `memfree`          | `memavail`  | Amount of free memory                                           |\n      | `memmax`           | `memtotal`  | Total amount of memory                                          |\n      | `memutil`          | `memperc`   | Memory utilization %                                            |\n      | `fanspeed`         |             | Fan speed                                                       |\n      | `fanlevel`         |             | Fan level %                                                     |\n      | `imagequality`     |             | Image quality                                                   |\n      | `modelname`        |             | Model name of the GPU card                                      |\n      | `driverversion`    |             | Driver version                                                  |\n    args:\n      - argument\n      - (GPU_ID)\n  - name: nvidiabar\n    desc: |-\n      Same as nvidia, except it draws its output in a horizontal bar. The\n      height and width parameters are optional, and default to the\n      default_bar_height and default_bar_width config settings,\n      respectively.\n\n      **GPU_ID:** Optional parameter to choose the GPU to be used as 0,1,2,3,..\n      Default parameter is 0\n\n      **Note the following arguments are** incompatible:\n\n      * `gputempthreshold` (`threshold`)\n      * `gpufreqmin`\n      * `gpufreqmax`\n      * `memfreqmin`\n      * `memfreqmax`\n      * `mtrfreqmin`\n      * `mtrfreqmax`\n      * `perflevelmin`\n      * `perflevelmax`\n      * `perfmode`\n      * `memtotal` (`memmax`)\n      * `fanspeed`\n    args:\n      - (height),(width)\n      - argument\n      - (GPU_ID)\n  - name: nvidiagauge\n    desc: |-\n      Same as nvidiabar, except a round gauge (much like a vehicle\n      speedometer). The height and width parameters are optional, and\n      default to the default_gauge_height and default_gauge_width config\n      settings, respectively.\n\n      **GPU_ID:** Optional parameter to choose the GPU to be used as 0,1,2,3,..\n      Default parameter is 0\n\n      For possible arguments see nvidia and nvidiabar.\n    args:\n      - (height),(width)\n      - argument\n      - (GPU_ID)\n  - name: nvidiagraph\n    desc: |-\n      Same as nvidiabar, except a horizontally scrolling graph with values\n      from 0-100 plotted on the vertical axis. The height and width\n      parameters are optional, and default to the default_graph_height and\n      default_graph_width config settings, respectively.\n\n      **GPU_ID:** NOT optional. This parameter allows to choose the GPU to be\n      used as 0,1,2,3,..\n\n      For possible arguments see nvidia and nvidiabar. To learn more about the\n      -t -l -x -y and gradient color options, see execgraph.\n    args:\n      - argument\n      - (height),(width)\n      - (gradient color 1)\n      - (gradient color 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m)\n      - GPU_ID\n  - name: offset\n    desc: Move text over by N pixels. See also $voffset.\n    args:\n      - (pixels)\n  - name: outlinecolor\n    desc: Change outline color.\n    args:\n      - (color)\n  - name: pa_card_active_profile\n    desc: Pulseaudio's default card active profile.\n  - name: pa_card_name\n    desc: Pulseaudio's default card name.\n  - name: pa_sink_active_port_description\n    desc: Pulseaudio's default sink active port description.\n  - name: pa_sink_active_port_name\n    desc: Pulseaudio's default sink active port name.\n  - name: pa_sink_description\n    desc: Pulseaudio's default sink description.\n  - name: pa_sink_volume\n    desc: Pulseaudio's default sink volume percentage.\n  - name: pa_sink_volumebar\n    desc: Pulseaudio's default sink volume bar.\n  - name: password\n    desc: Generate random passwords.\n    args:\n      - (length)\n  - name: pb_battery\n    desc: |-\n      If running on Apple powerbook/ibook, display information on battery\n      status. The item parameter specifies, what information to display.\n      Exactly one item must be specified. Valid items are:\n\n      | Item      | Description                                                                                                                                                                                            |\n      |-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n      | `status`  | Display if battery is fully charged, charging, discharging or absent (running on AC)                                                                                                                   |\n      | `percent` | Display charge of battery in percent, if charging or discharging. Nothing will be displayed, if battery is fully charged or absent.                                                                    |\n      | `time`    | Display the time remaining until the battery will be fully charged or discharged at current rate. Nothing is displayed, if battery is absent or if it's present but fully charged and not discharging. |\n    args:\n      - item\n  - name: pid_chroot\n    desc: |-\n      Directory used as rootdirectory by the process (this will be\n      \"/\" unless the process did a chroot syscall).\n    args:\n      - pid\n  - name: pid_cmdline\n    desc: Command line this process was invoked with.\n    args:\n      - pid\n  - name: pid_cwd\n    desc: Current working directory of the process.\n    args:\n      - pid\n  - name: pid_egid\n    desc: The effective gid of the process.\n    args:\n      - pid\n  - name: pid_environ\n    desc: Contents of a environment-var of the process.\n    args:\n      - pid\n      - varname\n  - name: pid_environ_list\n    desc: List of environment-vars that the process can see.\n    args:\n      - pid\n  - name: pid_euid\n    desc: The effective uid of the process.\n    args:\n      - pid\n  - name: pid_exe\n    desc: Path to executed command that started the process.\n    args:\n      - pid\n  - name: pid_fsgid\n    desc: The file system gid of the process.\n    args:\n      - pid\n  - name: pid_fsuid\n    desc: The file system uid of the process.\n    args:\n      - pid\n  - name: pid_gid\n    desc: The real gid of the process.\n    args:\n      - pid\n  - name: pid_nice\n    desc: The nice value of the process.\n    args:\n      - pid\n  - name: pid_openfiles\n    desc: List of files that the process has open.\n    args:\n      - pid\n  - name: pid_parent\n    desc: The pid of the parent of the process.\n    args:\n      - pid\n  - name: pid_priority\n    desc: |-\n      The priority of the process (see 'priority' in \"man 5\n      proc\").\n    args:\n      - pid\n  - name: pid_read\n    desc: Total number of bytes read by the process.\n    args:\n      - pid\n  - name: pid_sgid\n    desc: The saved set gid of the process.\n    args:\n      - pid\n  - name: pid_state\n    desc: State of the process.\n    args:\n      - pid\n  - name: pid_state_short\n    desc: |-\n      One of the chars in \"RSDZTW\" representing the state of the\n      process where R is running, S is sleeping in an interruptible wait, D\n      is waiting in uninterruptible disk sleep, Z is zombie, T is traced or\n      stopped (on a signal), and W is paging.\n    args:\n      - pid\n  - name: pid_stderr\n    desc: Filedescriptor binded to the STDERR of the process.\n    args:\n      - pid\n  - name: pid_stdin\n    desc: Filedescriptor binded to the STDIN of the process.\n    args:\n      - pid\n  - name: pid_stdout\n    desc: Filedescriptor binded to the STDOUT of the process.\n    args:\n      - pid\n  - name: pid_suid\n    desc: The saved set uid of the process.\n    args:\n      - pid\n  - name: pid_thread_list\n    desc: List with pid's from threads from this process.\n    args:\n      - pid\n  - name: pid_threads\n    desc: Number of threads in process containing this thread.\n    args:\n      - pid\n  - name: pid_time\n    desc: Sum of $pid_time_kernelmode and $pid_time_usermode.\n    args:\n      - pid\n  - name: pid_time_kernelmode\n    desc: |-\n      Amount of time that the process has been scheduled in kernel\n      mode in seconds.\n    args:\n      - pid\n  - name: pid_time_usermode\n    desc: |-\n      Amount of time that the process has been scheduled in user\n      mode in seconds.\n    args:\n      - pid\n  - name: pid_uid\n    desc: The real uid of the process.\n    args:\n      - pid\n  - name: pid_vmdata\n    desc: Data segment size of the process.\n    args:\n      - pid\n  - name: pid_vmexe\n    desc: Text segment size of the process.\n    args:\n      - pid\n  - name: pid_vmhwm\n    desc: Peak resident set size (\"high water mark\") of the process.\n    args:\n      - pid\n  - name: pid_vmlck\n    desc: Locked memory size of the process.\n    args:\n      - pid\n  - name: pid_vmlib\n    desc: Shared library code size of the process.\n    args:\n      - pid\n  - name: pid_vmpeak\n    desc: Peak virtual memory size of the process.\n    args:\n      - pid\n  - name: pid_vmpte\n    desc: Page table entries size of the process.\n    args:\n      - pid\n  - name: pid_vmrss\n    desc: Resident set size of the process.\n    args:\n      - pid\n  - name: pid_vmsize\n    desc: Virtual memory size of the process.\n    args:\n      - pid\n  - name: pid_vmstk\n    desc: Stack segment size of the process.\n    args:\n      - pid\n  - name: pid_write\n    desc: Total number of bytes written by the process.\n    args:\n      - pid\n  - name: platform\n    desc: |-\n      Platform sensor from sysfs (Linux 2.6). Parameter dev may be omitted if you\n      have only one platform device. Platform type is either `in` or `vol` meaning\n      voltage; `fan` meaning fan; `temp` meaning temperature. Parameter n is\n      number of the sensor. See `/sys/bus/platform/devices/` on your local\n      computer. The optional arguments `factor` and `offset` allow precalculation\n      of the raw input, which is being modified as follows: `input = input *\n      factor + offset`. Note that they have to be given as decimal values (i.e.\n      contain at least one decimal place).\n    args:\n      - (dev)\n      - type\n      - n\n      - (factor offset)\n  - name: pop3_unseen\n    desc: |-\n      Displays the number of unseen messages in your global POP3\n      inbox by default. You can define individual POP3 inboxes separately by\n      passing arguments to this object. Arguments are: \"host user pass [-i\n      interval (in seconds)] [-p port] [-e 'command'] [-r retries]\". Default\n      port is 110, default interval is 5 minutes, and default number of\n      retries before giving up is 5. If the password is supplied as '*', you\n      will be prompted to enter the password when Conky starts.\n    args:\n      - (args)\n  - name: pop3_used\n    desc: |-\n      Displays the amount of space (in MiB, 2^20) used in your\n      global POP3 inbox by default. You can define individual POP3 inboxes\n      separately by passing arguments to this object. Arguments are: \"host\n      user pass [-i interval (in seconds)] [-p port] [-e 'command'] [-r\n      retries]\". Default port is 110, default interval is 5 minutes, and\n      default number of retries before giving up is 5. If the password is\n      supplied as '*', you will be prompted to enter the password when Conky\n      starts.\n    args:\n      - (args)\n  - name: processes\n    desc: Total processes (sleeping and running).\n  - name: read_tcp\n    desc: |-\n      Connects to a tcp port on a host (default is localhost),\n      reads every char available at the moment and shows them.\n    args:\n      - (host)\n      - port\n  - name: read_udp\n    desc: |-\n      Connects to a udp port on a host (default is localhost),\n      reads every char available at the moment and shows them.\n    args:\n      - (host)\n      - port\n  - name: replied_mails\n    desc: |-\n      Number of mails marked as replied in the specified mailbox\n      or mail spool if not. Only maildir type mailboxes are supported, mbox\n      type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: rss\n    desc: |-\n      Download and parse RSS feeds. The interval may be a\n      (floating point) value greater than 0. Action may be one of the\n      following: feed_title, item_title (with num par), item_desc (with num\n      par) and item_titles (when using this action and spaces_in_front is\n      given conky places that many spaces in front of each item). This\n      object is threaded, and once a thread is created it can't be\n      explicitly destroyed. One thread will run for each URI specified. You\n      can use any protocol that Curl supports.\n    args:\n      - uri\n      - interval_in_seconds\n      - action\n      - (num_par (spaces_in_front))\n  - name: rstrip\n    desc: Strips all trailing whitespace from input.\n    args:\n      - text\n  - name: running_processes\n    desc: Running processes (not sleeping). Requires Linux 2.6.\n  - name: running_threads\n    desc: Number of running (runnable) threads. Linux only.\n  - name: scroll\n    desc: |-\n      Scroll 'text' by 'step' characters to the left or right (set\n      'direction' to 'left' or 'right' or 'wait') showing 'length' number of\n      characters at the same time. The text may also contain variables.\n      'step' is optional and defaults to 1 if not set. 'direction' is\n      optional and defaults to left if not set. When direction is 'wait'\n      then text will scroll left and wait for 'interval' itertations at the\n      beginning and end of the text. If a var creates output on multiple\n      lines then the lines are placed behind each other separated with a\n      '|'-sign. If you change the textcolor inside $scroll it will\n      automatically have it's old value back at the end of $scroll. The end\n      and the start of text will be separated by 'length' number of spaces\n      unless direction is 'wait'.\n    args:\n      - (direction)\n      - length\n      - (step)\n      - (interval)\n      - text\n  - name: seen_mails\n    desc: |-\n      Number of mails marked as seen in the specified mailbox or\n      mail spool if not. Only maildir type mailboxes are supported, mbox\n      type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: shadecolor\n    desc: Change shading color.\n    args:\n      - (color)\n  - name: shmem\n    desc: Amount of shared memory. Linux only.\n  - name: sip_status\n    desc: |-\n      Prints info regarding System Integrity Protection (SIP) on\n      macOS. If no switch is provided, prints SIP status (enabled /\n      disabled), else, status of the specific SIP feature corresponding to\n      the switch provided.\n\n      Below are shown the available switches:\n\n      | SWITCH | RESULT                      | STATUS |\n      |--------|-----------------------------|--------|\n      | 0      | apple internal              | YES/NO |\n      | 1      | forbid untrusted kexts      | YES/NO |\n      | 2      | forbid task-for-pid         | YES/NO |\n      | 3      | restrict filesystem         | YES/NO |\n      | 4      | forbid kernel-debugger      | YES/NO |\n      | 5      | restrict dtrace             | YES/NO |\n      | 6      | restrict nvram              | YES/NO |\n      | 7      | forbid device-configuration | YES/NO |\n      | 8      | forbid any-recovery-os      | YES/NO |\n      | 9      | forbid user-approved-kexts  | YES/NO |\n\n      uses unsupported configuration?: If yes, prints \"unsupported\n      configuration, beware!\" Else, prints \"configuration is ok\".\n\n      USAGE:\n      ```\n      $ conky -t '${sip_status}'\n      # print SIP status\n      $ conky -t '${sip_status 0}'\n      # print allows apple-internal? Yes or No?\n      ```\n\n      NOTES:\n\n      * Available for all macOS versions (even the ones prior El Capitan where\n      SIP was first introduced)\n      * If run on versions prior El Capitan SIP is unavailable, so all you will\n      get is \"unsupported\".\n    args:\n      - (switch)\n  - name: smapi\n    desc: |-\n      When using smapi, display contents of the `/sys/devices/platform/smapi`\n      directory. ARGS are either `(FILENAME)` or `bat (INDEX) (FILENAME)` to\n      display the corresponding files' content. This is a very raw method of\n      accessing the smapi values. When available, better use one of the smapi_*\n      variables instead.\n    args:\n      - (ARGS)\n  - name: smapi_bat_bar\n    desc: |-\n      when using smapi, display the remaining capacity of the\n      battery with index INDEX as a bar.\n    args:\n      - (INDEX),(height),(width)\n  - name: smapi_bat_perc\n    desc: |-\n      when using smapi, display the remaining capacity in percent\n      of the battery with index INDEX. This is a separate variable because\n      it supports the 'use_spacer' configuration option.\n    args:\n      - (INDEX)\n  - name: smapi_bat_power\n    desc: |-\n      when using smapi, display the current power of the battery\n      with index INDEX in watt. This is a separate variable because the\n      original read out value is being converted from mW. The sign of the\n      output reflects charging (positive) or discharging (negative) state.\n    args:\n      - INDEX\n  - name: smapi_bat_temp\n    desc: |-\n      when using smapi, display the current temperature of the\n      battery with index INDEX in degree Celsius. This is a separate\n      variable because the original read out value is being converted from\n      milli degree Celsius.\n    args:\n      - INDEX\n  - name: sony_fanspeed\n    desc: |-\n      Displays the Sony VAIO fanspeed information if sony-laptop\n      kernel support is enabled. Linux only.\n  - name: startcase\n    desc: Capitalises the start of each word.\n    args:\n      - text\n  - name: stippled_hr\n    desc: Stippled (dashed) horizontal line.\n    args:\n      - (space)\n  - name: stock\n    desc: |-\n      Displays the data of a stock symbol. The following data is\n      supported:\n\n      | Name        | Description                                |\n      |-------------|--------------------------------------------|\n      | 1ytp        | 1 yr Target Price                          |\n      | 200ma       | 200-day Moving Average                     |\n      | 50ma        | 50-day Moving Average                      |\n      | 52weekhigh  |                                            |\n      | 52weeklow   |                                            |\n      | 52weekrange |                                            |\n      | adv         | Average Daily Volume                       |\n      | ag          | Annualized Gain                            |\n      | ahcrt       | After Hours Change realtime                |\n      | ask         |                                            |\n      | askrt       | ask realtime                               |\n      | asksize     |                                            |\n      | bid         |                                            |\n      | bidrt       | bid realtime                               |\n      | bidsize     |                                            |\n      | bookvalue   |                                            |\n      | c200ma      | Change From 200-day Moving Average         |\n      | c50ma       | Change From 50-day Moving Average          |\n      | c52whigh    | Change from 52-week high                   |\n      | c52wlow     | Change From 52-week Low                    |\n      | change      |                                            |\n      | changert    | change realtime                            |\n      | cip         | change in percent                          |\n      | commission  |                                            |\n      | cprt        | change percent realtime                    |\n      | dayshigh    |                                            |\n      | dayslow     |                                            |\n      | dpd         | Dividend Pay Date                          |\n      | dr          | day's range                                |\n      | drrt        | day's range realtime                       |\n      | ds          | dividend/share                             |\n      | dvc         | Day's Value Change                         |\n      | dvcrt       | Day's Value Change realtime                |\n      | dy          | Dividend Yield                             |\n      | ebitda      |                                            |\n      | edv         | Ex-Dividend Date                           |\n      | ei          | error indication                           |\n      | epsecy      | EPS Estimate Current Year                  |\n      | epsenq      | EPS Estimate Next Quarter                  |\n      | epseny      | EPS Estimate Next Year                     |\n      | es          | earnings/share                             |\n      | floatshares |                                            |\n      | hg          | Holdings Gain                              |\n      | hgp         | Holdings Gain Percent                      |\n      | hgprt       | Holdings Gain Percent realtime             |\n      | hgrt        | Holdings Gain realtime                     |\n      | hl          | high limit                                 |\n      | hv          | Holdings Value                             |\n      | hvrt        | Holdings Value realtime                    |\n      | ll          | low limit                                  |\n      | ltd         | Last Trade Date                            |\n      | ltp         | last trade price                           |\n      | lts         | Last Trade Size                            |\n      | ltt         | Last Trade Time                            |\n      | mc          | Market Capitalization                      |\n      | mcrt        | Market Cap realtime                        |\n      | moreinfo    |                                            |\n      | name        |                                            |\n      | notes       |                                            |\n      | obrt        | Order Book realtime                        |\n      | open        |                                            |\n      | pb          | price/book                                 |\n      | pc          | previous close                             |\n      | pc200ma     | Percent Change From 200-day Moving Average |\n      | pc50ma      | Percent Change From 50-day Moving Average  |\n      | pc52whigh   | percent change from 52-week high           |\n      | pc52wlow    | Percent Change From 52-week Low            |\n      | pegr        | PEG Ratio                                  |\n      | pepsecy     | Price/EPS Estimate Current Year            |\n      | pepseny     | Price/EPS Estimate Next Year               |\n      | per         | P/E Ratio                                  |\n      | perrt       | P/E Ratio realtime                         |\n      | pricepaid   |                                            |\n      | ps          | price/sales                                |\n      | se          | Stock Exchange                             |\n      | sharesowned |                                            |\n      | shortratio  |                                            |\n      | symbol      |                                            |\n      | tradedate   |                                            |\n      | tradelinks  |                                            |\n      | tt          | Ticker Trend                               |\n      | volume      |                                            |\n    args:\n      - symbol\n      - data\n  - name: swap\n    desc: Amount of swap in use.\n  - name: swapbar\n    desc: Bar that shows amount of swap in use.\n    args:\n      - (height),(width)\n  - name: swapfree\n    desc: Amount of free swap.\n  - name: swapmax\n    desc: Total amount of swap.\n  - name: swapperc\n    desc: Percentage of swap in use.\n  - name: sysctlbyname\n    desc: Print sysctl value by name. FreeBSD only.\n    args:\n      - (name)\n  - name: sysname\n    desc: System name, e.g. Linux.\n  - name: tab\n    desc: |-\n      Puts a tab of the specified width, starting from column\n      'start'. The unit is pixels for both arguments.\n    args:\n      - (width, (start))\n  - name: tail\n    desc: |-\n      Displays last N lines of supplied text file. The file is\n      checked every 'next_check' update. If next_check is not supplied,\n      Conky defaults to 2. Max of 30 lines can be displayed, or until the\n      text buffer is filled.\n    args:\n      - logfile\n      - lines\n      - (next_check)\n  - name: tcp_ping\n    desc: |-\n      Displays the number of microseconds it takes to get a reply\n      on a ping to to tcp 'port' on 'host'. 'port' is optional and has 80 as\n      default. This works on both open and closed ports, just make sure that\n      the port is not behind a firewall or you will get 'down' as answer.\n      It's best to test a closed port instead of an open port, you will get\n      a quicker response.\n    args:\n      - host\n      - (port)\n  - name: tcp_portmon\n    desc: |-\n      TCP port (both IPv6 and IPv4) monitor for specified local ports.\n      Port numbers must be in the range 1 to 65535. Valid items are:\n\n      | Item       | Description                              |\n      |------------|------------------------------------------|\n      | `count`    | Total number of connections in the range |\n      | `rip`      | Remote ip address                        |\n      | `rhost`    | Remote host name                         |\n      | `rport`    | Remote port number                       |\n      | `rservice` | Remote service name from `/etc/services` |\n      | `lip`      | Local ip address                         |\n      | `lhost`    | Local host name                          |\n      | `lport`    | Local port number                        |\n      | `lservice` | Local service name from `/etc/services`  |\n\n      The connection index provides you with access to each connection in the\n      port monitor. The monitor will return information for index values from\n      0 to n-1 connections. Values higher than n-1 are simply ignored. For the\n      `count` item, the connection index must be omitted. It is required for\n      all other items.\n\n      Examples:\n\n      | Example                              | Description                                                                           |\n      |--------------------------------------|---------------------------------------------------------------------------------------|\n      | `${tcp_portmon 6881 6999 count}`     | Displays the number of connections in the bittorrent port range                       |\n      | `${tcp_portmon 22 22 rip 0}`         | Displays the remote host ip of the first sshd connection                              |\n      | `${tcp_portmon 22 22 rip 9}`         | Displays the remote host ip of the tenth sshd connection                              |\n      | `${tcp_portmon 1 1024 rhost 0}`      | Displays the remote host name of the first connection on a privileged port            |\n      | `${tcp_portmon 1 1024 rport 4}`      | Displays the remote host port of the fifth connection on a privileged port            |\n      | `${tcp_portmon 1 65535 lservice 14}` | Displays the local service name of the fifteenth connection in the range of all ports |\n\n      Note that port monitor variables which share the same port range\n      actually refer to the same monitor, so many references to a single port\n      range for different items and different indexes all use the same monitor\n      internally. In other words, the program avoids creating redundant\n      monitors.\n    args:\n      - port_begin\n      - port_end\n      - item\n      - (index)\n  - name: templateN\n    desc: |-\n      Evaluate the content of the templateN configuration variable (where\n      N is a value between 0 and 9, inclusively), applying substitutions\n      as described in the documentation of the corresponding configuration\n      variable. The number of arguments is optional, but must match the\n      highest referred index in the template. You can use the same special\n      sequences in each argument as the ones valid for a template\n      definition, e.g. to allow an argument to contain a whitespace. Also\n      simple nesting of templates is possible this way.\n\n      Here are some examples of template definitions, note they are placed\n      between `[[ ... ]]` instead of ` ... `:\n\n      ```lua\n      template0 = [[$12]]\n      template1 = [[1: ${fs_used 2} / ${fs_size 2}]]\n      template2 = [[1 2]]\n      ```\n\n      The following list shows sample usage of the templates defined above,\n      with the equivalent syntax when not using any template at all:\n\n      | Using template                                | Same without template                      |\n      |-----------------------------------------------|--------------------------------------------|\n      | `${template0 node name}`                      | `$nodename`                                |\n      | `${template1 root /}`                         | `root: ${fs_free /} / ${fs_size /}`        |\n      | `${template1 ${template2 disk root} /}`       | `disk root: ${fs_free /} / ${fs_size /}`   |\n      | --------------------------------------------- | ------------------------------------------ |\n    args:\n      - (arg1)\n      - (arg2)\n      - (arg3 ...)\n  - name: texeci\n    desc: |-\n      Runs a command at an interval inside a thread and displays\n      the output. Same as $execi, except the command is run inside a thread.\n      Use this if you have a slow script to keep Conky updating. You should\n      make the interval slightly longer than the time it takes your script\n      to execute. For example, if you have a script that take 5 seconds to\n      execute, you should make the interval at least 6 seconds. See also\n      $execi. This object will clean up the thread when it is destroyed, so\n      it can safely be used in a nested fashion, though it may not produce\n      the desired behaviour if used this way.\n    args:\n      - interval\n      - command\n  - name: texecpi\n    desc: Same as execpi, except the command is run inside a thread.\n    args:\n      - interval\n      - command\n  - name: threads\n    desc: Total threads.\n  - name: time\n    desc: |-\n      Local time, see \"man strftime\" to get more information about\n      format.\n    args:\n      - (format)\n  - name: to_bytes\n    desc: |-\n      If 'size' is a number followed by a size-unit\n      (kilobyte,mb,GiB,...) then it converts the size to bytes and shows it\n      without unit, otherwise it just shows 'size'.\n    args:\n      - size\n  - name: top\n    desc: |-\n      This takes arguments in the form:top (name) (number)\n      Basically, processes are ranked from highest to lowest in terms of cpu\n      usage, which is what (num) represents. The types are: \"name\", \"pid\",\n      \"cpu\", \"mem\", \"mem_res\", \"mem_vsize\", \"time\", \"uid\", \"user\",\n      \"io_perc\", \"io_read\" and \"io_write\". There can be a max of 10\n      processes listed.\n    args:\n      - type\n      - num\n  - name: top_io\n    desc: |-\n      Same as top, except sorted by the amount of I/O the process\n      has done during the update interval.\n    args:\n      - type\n      - num\n  - name: top_mem\n    desc: Same as top, except sorted by mem usage instead of cpu.\n    args:\n      - type\n      - num\n  - name: top_time\n    desc: |-\n      Same as top, except sorted by total CPU time instead of\n      current CPU usage.\n    args:\n      - type\n      - num\n  - name: totaldown\n    desc: |-\n      Total download, overflows at 4 GB on Linux with 32-bit arch\n      and there doesn't seem to be a way to know how many times it has\n      already done that before conky has started.\n    args:\n      - (net)\n  - name: totalup\n    desc: Total upload, this one too, may overflow.\n    args:\n      - (net)\n  - name: trashed_mails\n    desc: |-\n      Number of mails marked as trashed in the specified mailbox\n      or mail spool if not. Only maildir type mailboxes are supported, mbox\n      type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: tztime\n    desc: |-\n      Local time for specified timezone, see man strftime to get\n      more information about format. The timezone argument is specified in\n      similar fashion as TZ environment variable. For hints, look in\n      /usr/share/zoneinfo. e.g. US/Pacific, Europe/Zurich, etc.\n    args:\n      - (timezone (format))\n  - name: uid_name\n    desc: Username of user with this uid.\n    args:\n      - uid\n  - name: unflagged_mails\n    desc: |-\n      Number of mails not marked as flagged in the specified\n      mailbox or mail spool if not. Only maildir type mailboxes are\n      supported, mbox type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: unforwarded_mails\n    desc: |-\n      Number of mails not marked as forwarded in the specified\n      mailbox or mail spool if not. Only maildir type mailboxes are\n      supported, mbox type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: unreplied_mails\n    desc: |-\n      Number of mails not marked as replied in the specified\n      mailbox or mail spool if not. Only maildir type mailboxes are\n      supported, mbox type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: unseen_mails\n    desc: |-\n      Number of new or unseen mails in the specified mailbox or\n      mail spool if not. Only maildir type mailboxes are supported, mbox\n      type will return -1.\n    args:\n      - (maildir)\n      - (interval)\n  - name: updates\n    desc: for debugging.\n    args:\n      - Number\n      - of\n      - updates\n  - name: uppercase\n    desc: Converts all letters into uppercase.\n    args:\n      - text\n  - name: upspeed\n    desc: Upload speed in suitable IEC units.\n    args:\n      - (net)\n  - name: upspeedf\n    desc: Upload speed in KiB with one decimal.\n    args:\n      - (net)\n  - name: upspeedgraph\n    desc: |-\n      Upload speed graph, colours defined in hex, minus the #. If\n      scale is non-zero, it defines the maximum value of the graph\n      (in bytes per second). Uses a logarithmic scale (to see small\n      numbers) when you use the -l switch. Takes the switch '-t' to\n      use a temperature gradient, which makes the gradient values\n      change depending on the amplitude of a particular graph value\n      (try it and see). The flag '-x' inverts the x axis and '-y' \n      inverts the y axis of the graph. The flag '-m' sets a nonzero \n      minimum/lowerbound, ensuring that all values are at least the \n      specified minimum (excluding zero).\n    args:\n      - (netdev)\n      - (height),(width)\n      - (gradient colour 1)\n      - (gradient colour 2)\n      - (scale)\n      - (-t)\n      - (-l)\n      - (-x)\n      - (-y)\n      - (-m)\n  - name: uptime\n    desc: Uptime.\n  - name: uptime_short\n    desc: Uptime in a shorter format.\n  - name: user_names\n    desc: Lists the names of the users logged in.\n  - name: user_number\n    desc: Number of users logged in.\n  - name: user_terms\n    desc: Lists the consoles in use.\n  - name: user_time\n    desc: |-\n      Lists how long the user for the given console has been\n      logged in for.\n    args:\n      - console\n  - name: user_times\n    desc: Lists how long users have been logged in for.\n  - name: utime\n    desc: Display time in UTC (universal coordinate time).\n    args:\n      - (format)\n  - name: v6addrs\n    desc: |-\n      IPv6 addresses for an interface, followed by netmask if -n\n      is specified and scope with -s. Scopes are Global(G), Host-local(H),\n      Link-local(L), Site-local(S), Compat(C) and Unspecified(/). Linux\n      only.\n    args:\n      - (-n)\n      - (-s)\n      - (interface)\n  - name: version\n    desc: Git version number. DragonFly only.\n  - name: voffset\n    desc: |-\n      Change vertical offset by N pixels. Negative values will\n      cause text to overlap. See also $offset.\n    args:\n      - (pixels)\n  - name: voltage_mv\n    desc: |-\n      Returns CPU #n's voltage in mV. CPUs are counted from 1.\n    default: 1\n    args:\n      - (n)\n  - name: voltage_v\n    desc: |-\n      Returns CPU #n's voltage in V. CPUs are counted from 1.\n    default: 1\n    args:\n      - (n)\n  - name: wireless_ap\n    desc: Wireless access point MAC address. Linux only.\n    args:\n      - (net)\n  - name: wireless_bitrate\n    desc: Wireless bitrate (ie 11 Mb/s). Linux only.\n    args:\n      - (net)\n  - name: wireless_channel\n    desc: WLAN channel on which device 'net' is listening.\n    args:\n      - (net)\n  - name: wireless_essid\n    desc: Wireless access point ESSID. Linux only.\n    args:\n      - (net)\n  - name: wireless_freq\n    desc: Frequency on which device 'net' is listening.\n    args:\n      - (net)\n  - name: wireless_link_bar\n    desc: Wireless link quality bar. Linux only.\n    args:\n      - (height),(width)\n      - (net)\n  - name: wireless_link_qual\n    desc: Wireless link quality. Linux only.\n    args:\n      - (net)\n  - name: wireless_link_qual_max\n    desc: Wireless link quality maximum value. Linux only.\n    args:\n      - (net)\n  - name: wireless_link_qual_perc\n    desc: Wireless link quality in percents. Linux only.\n    args:\n      - (net)\n  - name: wireless_mode\n    desc: Wireless mode (Managed/Ad-Hoc/Master). Linux only.\n    args:\n      - (net)\n  - name: words\n    desc: Displays the number of words in the given file.\n    args:\n      - textfile\n  - name: xmms2_album\n    desc: Album in current XMMS2 song.\n  - name: xmms2_artist\n    desc: Artist in current XMMS2 song.\n  - name: xmms2_bar\n    desc: Bar of XMMS2's progress.\n    args:\n      - (height),(width)\n  - name: xmms2_bitrate\n    desc: Bitrate of current song.\n  - name: xmms2_comment\n    desc: Comment in current XMMS2 song.\n  - name: xmms2_date\n    desc: Returns song's date.\n  - name: xmms2_duration\n    desc: Duration of current song.\n  - name: xmms2_elapsed\n    desc: Song's elapsed time.\n  - name: xmms2_genre\n    desc: Genre in current XMMS2 song.\n  - name: xmms2_id\n    desc: XMMS2 id of current song.\n  - name: xmms2_percent\n    desc: Percent of song's progress.\n  - name: xmms2_playlist\n    desc: Returns the XMMS2 playlist.\n  - name: xmms2_size\n    desc: Size of current song.\n  - name: xmms2_smart\n    desc: |-\n      Prints the song name in either the form \"artist - title\" or\n      file name, depending on whats available.\n  - name: xmms2_status\n    desc: XMMS2 status (Playing, Paused, Stopped, or Disconnected).\n  - name: xmms2_timesplayed\n    desc: Number of times a song was played (presumably).\n  - name: xmms2_title\n    desc: Title in current XMMS2 song.\n  - name: xmms2_tracknr\n    desc: Track number in current XMMS2 song.\n  - name: xmms2_url\n    desc: Full path to current song.\n"
  },
  {
    "path": "extras/CMakeLists.txt",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\nfile(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/nano)\nadd_custom_target(conky.nanorc\n    ALL\n    COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/render.py nano/conky.nanorc.j2 > ${CMAKE_CURRENT_BINARY_DIR}/nano/conky.nanorc\n    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}\n    SOURCES\n    ${CMAKE_SOURCE_DIR}/doc/variables.yaml\n    ${CMAKE_SOURCE_DIR}/doc/config_settings.yaml\n    ${CMAKE_SOURCE_DIR}/doc/lua.yaml\n    ${CMAKE_CURRENT_SOURCE_DIR}/nano/conky.nanorc.j2\n)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/nano/conky.nanorc DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nano)\nfile(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/vim/syntax)\nadd_custom_target(conkyrc.vim\n    ALL\n    COMMAND ${Python3_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doc/render.py vim/syntax/conkyrc.vim.j2 > ${CMAKE_CURRENT_BINARY_DIR}/vim/syntax/conkyrc.vim\n    WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}\n    SOURCES\n    ${CMAKE_SOURCE_DIR}/doc/variables.yaml\n    ${CMAKE_SOURCE_DIR}/doc/config_settings.yaml\n    ${CMAKE_SOURCE_DIR}/doc/lua.yaml\n    ${CMAKE_CURRENT_SOURCE_DIR}/vim/syntax/conkyrc.vim.j2\n)\ninstall(FILES ${CMAKE_CURRENT_BINARY_DIR}/vim/syntax/conkyrc.vim DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/vim/syntax)\n"
  },
  {
    "path": "extras/convert.lua",
    "content": "#! /usr/bin/lua\n\nlocal usage = [[\nUsage: convert.lua old_conkyrc [new_conkyrc]\n\nTries to convert conkyrc from the old v1.x format to the new, lua-based format.\n\nKeep in mind that there is no guarantee that the output will work correctly\nwith conky, or that it will be able to convert every conkyrc. However, it\nshould provide a good starting point.\n\nAlthough you can use this script with only 1 arg and let it overwrite the old\nconfig, it's suggested to use 2 args so that the new config is written in a new\nfile (so that you have backup if something went wrong).\n\nOptional: Install dos2unix. We will attempt to use this if it is available\nbecause Conky configs downloaded from Internet sometimes are created on DOS/Windows\nmachines with different line endings than Conky configs created on Unix/Linux.\n\nFor more information about the new format, read the wiki page\n<https://github.com/brndnmtthws/conky/wiki>\n]];\n\nlocal function quote(s)\n    if not s:find(\"[\\n'\\\\]\") then\n        return \"'\" .. s .. \"'\";\n    end;\n    local q = '';\n    while s:find(']' .. q .. ']', 1, true) do\n        q = q .. '=';\n    end;\n    return string.format('[%s[\\n%s]%s]', q, s, q);\nend;\n\nlocal bool_setting = {\n    background = true, disable_auto_reload = true, double_buffer = true, draw_borders = true,\n    draw_graph_borders = true, draw_outline = true, draw_shades = true, extra_newline = true,\n    format_human_readable = true, no_buffers = true, out_to_console = true,\n    out_to_wayland = true,\n    out_to_ncurses = true, out_to_stderr = true, out_to_x = true, override_utf8_locale = true,\n    own_window = true, own_window_argb_visual = true, own_window_transparent = true,\n    short_units = true, show_graph_range = true, show_graph_scale = true,\n    times_in_seconds = true, top_cpu_separate = true, uppercase = true, use_xft = true,\n    draw_blended = true, forced_redraw = true\n};\n\nlocal num_setting = {\n    border_inner_margin = true, border_outer_margin = true, border_width = true,\n    cpu_avg_samples = true, diskio_avg_samples = true, gap_x = true, gap_y = true,\n    imlib_cache_flush_interval = true, imlib_cache_size = true,\n    max_port_monitor_connections = true, max_text_width = true, max_user_text = true,\n    maximum_width = true, mpd_port = true, music_player_interval = true, net_avg_samples = true,\n    own_window_argb_value = true, pad_percents = true, stippled_borders = true,\n    text_buffer_size = true, top_name_width = true, total_run_times = true,\n    update_interval = true, update_interval_on_battery = true, xftalpha = true,\n    xinerama_head = true,\n};\n\nlocal split_setting = {\n    default_bar_size = true, default_gauge_size = true, default_graph_size = true,\n    minimum_size = true\n};\n\nlocal colour_setting = {\n    color0 = true, color1 = true, color2 = true, color3 = true, color4 = true, color5 = true,\n    color6 = true, color7 = true, color8 = true, color9 = true, default_color = true,\n    default_outline_color = true, default_shade_color = true, own_window_colour = true\n};\n\nlocal function alignment_map(value)\n    local map = { m = 'middle', t = 'top', b = 'bottom', r = 'right', l = 'left' };\n    if map[value] == nil then\n        return value;\n    else\n        return map[value];\n    end;\nend;\n\nlocal function handle(setting, value)\n    setting = setting:lower();\n    if setting == '' then\n        return '';\n    end;\n    if split_setting[setting] then\n        local x, y = value:match('^(%S+)%s*(%S*)$');\n        local ret = setting:gsub('_size', '_width = ') .. x .. ',';\n        if y ~= '' then\n            ret = ret .. ' ' .. setting:gsub('_size', '_height = ') .. y .. ',';\n        end;\n        return '\\t' .. ret;\n    end;\n    if bool_setting[setting] then\n        value = value:lower();\n        if value == 'yes' or value == 'true' or value == '1' or value == '' then\n            value = 'true';\n        else\n            value = 'false';\n        end;\n    elseif not num_setting[setting] then\n        if setting == 'alignment' and value:len() == 2 then\n            value = alignment_map(value:sub(1,1)) .. '_' .. alignment_map(value:sub(2,2));\n        elseif colour_setting[setting] and value:match('^[0-9a-fA-F]+$') then\n            value = '#' .. value;\n        elseif setting == 'xftfont' then\n            setting = 'font';\n        end;\n        value = quote(value);\n    end;\n    return '\\t' .. setting .. ' = ' .. value .. ',';\nend;\n\nlocal function convert(s)\n    local setting, comment = s:match('^([^#]*)#?(.*)\\n$');\n    if comment ~= '' then\n        comment = '--' .. comment;\n    end;\n    comment = comment .. '\\n';\n    return handle(setting:match('^%s*(%S*)%s*(.-)%s*$')) ..  comment;\nend;\n\nlocal input;\nlocal output;\n\nif conky == nil then --> standalone program\n    -- 1 arg: arg is input and outputfile\n    -- 2 args: 1st is inputfile, 2nd is outputfile\n    -- 0, 3 or more args: print usage to STDERR and quit\n    if #arg == 1 or #arg == 2 then\n        if os.execute('command -v dos2unix 2>&1 >/dev/null') == 0 then\n            os.execute('dos2unix ' .. arg[1]);\n        end\n        input = io.input(arg[1]);\n    else\n        io.stderr:write(usage);\n        return;\n    end;\nelse\n    -- we are called from conky, the filename is the first argument\n    input = io.open(..., 'r');\nend;\n\n\nlocal config = input:read('*a');\ninput:close();\n\nlocal settings, text = config:match('^(.-)TEXT\\n(.*)$');\n\nlocal converted = 'conky.config = {\\n' .. settings:gsub('.-\\n', convert) .. '};\\n\\nconky.text = ' ..\n                quote(text) .. ';\\n';\n\nif conky == nil then\n    if #arg == 2 then\n        output = io.output(arg[2]);\n    else\n        output = io.output(arg[1]);\n    end\n    output:write(converted);\n    output:close();\nelse\n    return assert(load(converted, 'converted config'));\nend;\n"
  },
  {
    "path": "extras/gedit/conky.lang",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<language id=\"conkyrc\" _name=\"Conky\" version=\"2.0\" _section=\"Others\">\n <metadata>\n    <!-- This syntax highlighting will apply for any file with the sequence \"conky\"\n         in the file name (or extension), I recommend to use you_config_name.conky\n         for config files or alternatively conky_your_config_name\n         Unfortunately this will also trigger the syntax highlighting for this document,\n         you can always manually set this one back to XML.\n         If you have a favourite custom format you can change the globs property to your\n         personal preference. -->\n    <property name=\"globs\">*conky*</property>\n    <property name=\"block-comment-start\">--[[</property>\n    <property name=\"block-comment-end\">]]</property>\n  </metadata>\n\n  <styles>\n    <style id=\"config-keyword\" _name=\"Config keywords\"     map-to=\"def:keyword\"/>\n    <style id=\"text-keyword\"   _name=\"Text keywords\"       map-to=\"def:type\"/>\n    <style id=\"comment\" _name=\"Comment\"         map-to=\"def:comment\"/>\n    <style id=\"escaped-char\" _name=\"Escaped Character\" map-to=\"def:special-char\"/>\n    <style id=\"path\"    _name=\"Paths and URLs\"      map-to=\"def:string\"/>\n    <style id=\"boolean\" _name=\"Boolean\"         map-to=\"def:boolean\"/>\n    <style id=\"argument\"    _name=\"Arguments\"       map-to=\"def:preprocessor\"/>\n    <style id=\"brackets\"    _name=\"Text Variable Brackets ${ ... }\"   map-to=\"def:identifier\"/>\n    <style id=\"decimal\" _name=\"Decimal\"         map-to=\"def:decimal\"/>\n  </styles>\n\n  <definitions>\n\n<!-- ======================================================================================= -->\n<!-- Keep in mind gedit does not like < and >, use &lt; and &gt; instead! -->\n<!-- Use `ref=\"id:*\"` to include all children of `id` instead of `id` itself -->\n\n\n<!-- ========================== Container contexts and structure =========================== -->\n   <!-- \"root structure\" this is where it all begins -->\n   <context id=\"conkyrc\" class=\"no-spell-check\">\n      <include>\n        <!-- Generic global stuff -->\n        <!-- Comments -->\n        <context ref=\"config-block-comment\"/>\n        <context ref=\"config-line-comment\"/>\n        <!-- end: Comments -->\n        \n        <!-- The settings block -->\n        <context>\n          <start>(?:(conky)\\.(config)(?:\\s|\\n)*(=)(?:\\s|\\n)*(\\{))</start>\n          <end>\\}</end>\n          <include>\n            <!-- Keyword mark highlighter -->\n            <context sub-pattern=\"1\" where=\"start\" style-ref=\"config-keyword\"/>\n            <context sub-pattern=\"2\" where=\"start\" style-ref=\"text-keyword\"/>\n            <!-- end: Keyword mark highlighter -->\n            <!-- Equals highlighter -->\n            <context sub-pattern=\"3\" where=\"start\" style-ref=\"brackets\"/>\n            <!-- end: Equals highlighter -->\n            <!-- Brackets highlighter -->\n            <context sub-pattern=\"4\" where=\"start\" style-ref=\"brackets\"/>\n            <context sub-pattern=\"0\" where=\"end\" style-ref=\"brackets\"/>\n            <!-- end: Brackets highlighter -->\n            \n            <!-- Comments -->\n            <context ref=\"config-block-comment\"/>\n            <context ref=\"config-line-comment\"/>\n            <!-- end: Comments -->\n            \n            <!-- key=val pair -->\n            <context ref=\"config-option\"/>\n            <!-- end: key=val -->\n          </include>\n        </context>\n        <!-- end: settings block -->\n\n        <!-- The text block -->\n        <context id=\"conky-text\">\n          <start>(?:(conky)\\.(text)(?:\\s|\\n)*(=)(?:\\s|\\n)*)</start>\n          <end>(?=.|$)</end><!-- End at anything as we only have one child -->\n          <include>\n              <!-- Keyword mark highlighter -->\n              <context sub-pattern=\"1\" where=\"start\" style-ref=\"config-keyword\"/>\n              <context sub-pattern=\"2\" where=\"start\" style-ref=\"text-keyword\"/>\n              <!-- end: Keyword mark highlighter -->\n              <!-- Equals highlighter -->\n              <context sub-pattern=\"3\" where=\"start\" style-ref=\"brackets\"/>\n              <!-- end: Equals highlighter -->\n            \n            <!-- Literal Sub-String -->\n            \n            <!-- This is just a literal string, really -->\n            <context ref=\"lua-lit-string\"/>\n          </include>\n        </context>\n        <!-- end: Text block -->\n      </include>\n    </context>\n    <!-- end: root context -->\n\n\n    <!-- ================================== Import groups ================================== -->\n    <!-- Container for generic includes -->\n    <!--<context id=\"generic-container\">\n      <include>\n      </include>\n    </context>-->\n    <!-- end: Generic container -->\n\n\n    <!-- ======================== Component contexts and structure ========================= -->\n    <!-- Block comment, lua syntax -->\n    <!-- Note: this will only highlight block comments outside the conky.text section -->\n    <context id=\"config-block-comment\" style-ref=\"comment\" class=\"comment\" class-disabled=\"no-spell-check\">\n      <start>--\\[(=*)\\[</start><end>]\\%{1@start}]</end>\n      <include>\n    <context ref=\"def:in-comment\"/>\n      </include>\n    </context>\n    <!-- end: Block comment, lua syntax -->\n\n    <!-- Line comment, lua syntax -->\n    <!-- Note: this will only highlight line comments outside the conky.text section -->\n    <context id=\"config-line-comment\" style-ref=\"comment\" class-disabled=\"no-spell-check\">\n      <start>\\-\\-</start><end>$</end>\n    </context>\n    <!-- end: Line comment, lua syntax -->\n    \n    <!-- Line comment, conky text syntax -->\n    <!-- Note: this will only highlight line comments **inside** the conky.text section -->\n    <context id=\"text-comment\" style-ref=\"comment\" class-disabled=\"no-spell-check\">\n      <start>#</start><end>$</end>\n    </context>\n    <!-- end: Line comment, conky syntax-->\n\n    <!-- String -->\n    <context id=\"lua-string\"  style-ref=\"argument\" style-inside=\"true\"\n             end-at-line-end=\"true\" class=\"string\">\n      <start>('|\")</start><end>\\%{0@start}</end>\n      <include>\n        <!-- Quote mark highlighter -->\n        <context sub-pattern=\"0\" where=\"start\" style-ref=\"brackets\"/>\n        <context sub-pattern=\"0\" where=\"end\" style-ref=\"brackets\"/>\n        <!-- end: Quote mark highlighter -->\n        \n        <!-- Known patterns -->\n        <!-- Escaped Char (also prevents the context ending prematurely) -->\n        <context ref=\"lua-escape\"/>\n        <context ref=\"path\"/>\n        <context ref=\"hex-colors\"/>\n        <context ref=\"predefined-colors\"/>\n        <!-- end: Known patterns -->\n        \n      </include>\n    </context>\n    <!-- end: String value -->\n    \n    <!-- Literal string -->\n    <context id=\"lua-lit-string\" once-only=\"true\">\n      <start>\\[\\[</start><end>\\]\\]</end>\n      <include>\n        <!-- Quote mark highlighter -->\n        <context sub-pattern=\"0\" where=\"start\" style-ref=\"brackets\"/>\n        <context sub-pattern=\"0\" where=\"end\" style-ref=\"brackets\"/>\n        <!-- end: Quote mark highlighter -->\n        \n        <!-- Literal Sub-String -->\n        <!-- We use this to stop premature end of parent -->\n        <context>\n          <start>\\[\\[</start><end>\\]\\]</end>\n          <!-- Recursive -->\n          <include><context ref=\"lua-lit-string:*\"/></include>\n        </context>\n        <!-- end: Literal Sub-String -->\n        \n        <!-- Stuff specific to literal strings (e.g. templates and conky.text) -->\n        <!-- TODO: Find a clean way to separate template and text lit-strings -->\n        <context ref=\"text-escape\"/>\n        <context ref=\"template-escape\"/>\n        <context ref=\"text-comment\"/>\n        <context ref=\"bracket-var\"/>\n        <context ref=\"text-var\"/>\n      </include>\n    </context>\n    <!-- end: Literal string -->\n    \n    <!-- Escaped char -->\n    \n    <!-- conky.text escapes -->\n    <context id=\"text-escape\" style-ref=\"escaped-char\">\n        <!-- NOTE: Conky doesn't currently escape double backslash -->\n        <match>\\\\(?:#|$)</match>\n    </context>\n    \n    <!-- template definition escapes -->\n    <context id=\"template-escape\" style-ref=\"escaped-char\">\n        <match>\\\\[n\\\\ 0-9]</match>\n    </context>\n    \n    <!-- lua string escapes -->\n    <context id=\"lua-escape\" style-ref=\"escaped-char\">\n        <match>\\\\[abfnrtv\\\\\"'\\[\\]]</match>\n    </context>\n    <!-- end: Escaped char -->\n    \n    <!-- File paths and URLs, starting with https://, http://, ~/ or / -->\n    <context id=\"path\" style-ref=\"path\" class=\"string\">\n      <match>(?&lt;=\\'|\\ )(?:\\~\\/|\\/|htt(?:p|ps)\\:\\/\\/){1}[^\\s\\}\\']*</match>\n    </context>\n    <!-- end: File paths and URLs -->\n    \n    <!-- Custom colors (hex) -->\n    <context id=\"hex-colors\" style-ref=\"decimal\">\n      <match>(?:[\\da-fA-F]{6})</match>\n    </context>\n    <!-- end: Custom colors -->\n\n    <!-- Predefined colors -->\n    <!-- Colors parsed by `XParsecolor()` (see /usr/share/X11/rgb.txt (or possibly /usr/lib)) -->\n    <context id=\"predefined-colors\" style-ref=\"decimal\">\n       <keyword>red</keyword>\n       <keyword>green</keyword>\n       <keyword>yellow</keyword>\n       <keyword>blue</keyword>\n       <keyword>magenta</keyword>\n       <keyword>cyan</keyword>\n       <keyword>black</keyword>\n       <keyword>white</keyword>\n    </context>\n    <!-- end: Predefined colors -->\n\n    <!-- Numbers -->\n    <context id=\"number\" style-ref=\"decimal\">\n      <match>(?&lt;=[\\ \\=]|\\dx)([\\+\\-]{0,1}\\d+)([\\.\\,]{1}\\d+)?</match>\n    </context>\n    <!-- end: Numbers -->\n    \n    <!-- Boolean values -->\n    <context id=\"boolean\" style-ref=\"boolean\">\n       <keyword>false</keyword>\n       <keyword>true</keyword>\n       <keyword>yes</keyword>\n       <keyword>no</keyword>\n    </context>\n    <!-- end: Boolean values -->\n        \n    <!-- ======================================================================================= -->\n\n    <!-- key=val pair -->\n    <context id=\"config-option\">\n      <start>[A-Za-z0-9_]+</start>\n      <!-- ended by value -->\n      <include>\n        <!-- Keyword highlight -->\n        <context sub-pattern=\"0\" where=\"start\" style-ref=\"config-keyword\"/>\n        <!-- end: Keyword highlight -->\n        \n        <!-- value -->\n        <context end-parent=\"true\">\n          <start>=</start><end>(?:,|(?=\\}))</end>\n          <include>\n            <!-- Equals highlight -->\n            <context sub-pattern=\"0\" where=\"start\" style-ref=\"brackets\"/>\n            <!-- end: Equals highlight -->\n            \n            <!-- Value types -->\n            <context ref=\"lua-string\"/>\n            <context ref=\"lua-lit-string\"/>\n            <context ref=\"number\"/>\n            <context ref=\"boolean\"/>\n            <!-- end: Value types -->\n            \n            <!-- Comments -->\n            <context ref=\"config-block-comment\"/>\n            <context ref=\"config-line-comment\"/>\n            <!-- end: Comments -->\n          </include>\n        </context>\n        <!-- end: value -->\n        \n        <!-- Comments -->\n        <context ref=\"config-block-comment\"/>\n        <context ref=\"config-line-comment\"/>\n        <!-- end: Comments -->\n      </include>\n    </context>\n    <!-- end: key=val -->\n\n    <!-- TextVariables -->\n    <!-- Bracket style -->\n    <context id=\"bracket-var\" style-ref=\"argument\" style-inside=\"true\">\n      <start>(?:(\\$\\{)(?:\\s|\\n|$)*([a-z][a-z0-9_]*))</start>\n      <end>\\}</end>\n      <include>\n          <!-- Brackets highlighter -->\n          <context sub-pattern=\"1\" where=\"start\" style-ref=\"brackets\"/>\n          <context sub-pattern=\"0\" where=\"end\" style-ref=\"brackets\"/>\n          <!-- end: Brackets highlighter -->\n          \n          <!-- Variable/keyword highlighter -->\n          <context sub-pattern=\"2\" where=\"start\" style-ref=\"text-keyword\"/>\n          \n          <!-- Special patterns -->\n          <context ref=\"number\"/>\n          <context ref=\"boolean\"/>\n          <context ref=\"path\"/>\n          <context ref=\"hex-colors\"/>\n          <context ref=\"predefined-colors\"/>\n          <!-- end: Special patterns -->\n          \n          <!-- Inherit from lit-String -->\n          <context ref=\"lua-lit-string:*\"/>\n      </include>\n    </context>\n\n    <!-- non-bracket style -->\n    <context id=\"text-var\" style-ref=\"text-keyword\" style-inside=\"true\">\n      <start>(?:(\\$)(?!\\{))</start>\n      <end>(?:(?=[^A-Za-z0-9_])|$)</end>\n      <include>\n          <!-- Dollar highlighter -->\n          <context sub-pattern=\"1\" where=\"start\" style-ref=\"brackets\"/>\n          <!-- end: Dollar highlighter -->\n      </include>\n    </context>\n    <!-- end: TextVariables -->\n\n    </definitions>\n</language>\n"
  },
  {
    "path": "extras/git_ranked.py",
    "content": "#!/usr/bin/env python3\n\nimport subprocess\n\ndef get_first_number(s):\n    number = \"\"\n    found_digit = False\n\n    for char in s:\n        if char.isdigit():\n            number += char\n            found_digit = True\n        elif found_digit:\n            break\n\n    return int(number) if number else None\n\n\ndef git_log():\n    entries = []\n    try:\n        result = subprocess.run(\n            [\"git\", \"log\", \"--no-merges\", \"--shortstat\", \"--pretty=format:%H %n %s\"],\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n            text=True,\n            check=True,\n        )\n        entries = result.stdout.split(\"\\n\\n\")\n    except subprocess.CalledProcessError as e:\n        print(f\"Error running git command: {e.stderr}\")\n        return []\n\n    commits = []\n    for line in entries:\n        info = line.split(\"\\n\")\n        changes = info[2].split(\",\")\n        files_changed = get_first_number(changes[0])\n        insertions = 0\n        deletions = 0\n        if len(changes) > 1:\n            if \"insertions\" in changes[1]:\n                insertions = get_first_number(changes[1])\n            elif \"deletions\" in changes[1]:\n                deletions = get_first_number(changes[1])\n        if len(changes) > 2:\n            if \"insertions\" in changes[2]:\n                insertions = get_first_number(changes[2])\n            elif \"deletions\" in changes[2]:\n                deletions = get_first_number(changes[2])\n        commit = {\n            \"hash\": info[0].strip(),\n            \"message\": info[1].strip(),\n            \"changes\": {\n                \"files\": files_changed,\n                \"insertions\": insertions,\n                \"deletions\": deletions,\n            },\n        }\n        commits.append(commit)\n\n    return commits\n\ndef main():\n    log = git_log()\n    if len(log) == 0:\n        return\n\n    large_changes = sorted(log, key=lambda it: it[\"changes\"][\"insertions\"] + it[\"changes\"][\"deletions\"], reverse=True)\n\n    print(f\"{'Hash':41} {'Insertions':11} {'Deletions':11} {'Message'}\")\n    print(\"-\" * 90)\n    for commit in large_changes:\n        print(\n            f\"{commit['hash']:41} {commit[\"changes\"]['insertions']:11} {commit[\"changes\"]['deletions']:11} {commit['message']}\"\n        )\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "extras/nano/conky.nanorc.j2",
    "content": "##\n## Syntax highlighting for conkyrc files.\n##\n##\nsyntax \"conky\" \"(\\.*conkyrc.*$|conky.conf)\"\n\n## Configuration items\ncolor green \"\\<({{ config_settings['values']|map(attribute=\"name\")|join('|') }})\\>\"\n\n## Configuration item constants\ncolor yellow \"\\<(above|below|bottom_left|bottom_right|bottom_middle|desktop|dock|no|none|normal|override|skip_pager|skip_taskbar|sticky|top_left|top_right|top_middle|middle_left|middle_right|middle_middle|undecorated|yes)\\>\"\n\n## Variables\ncolor brightblue \"\\<({{ variables['values']|map(attribute=\"name\")|join('|') }})\\>\"\n\ncolor brightblue \"\\$\\{?[0-9A-Z_!@#$*?-]+\\}?\"\ncolor cyan \"(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)\"\ncolor brightred \"^TEXT$\"\n"
  },
  {
    "path": "extras/vim/ftdetect/conkyrc.vim",
    "content": "\" Vim filetype detection file for Conky config files\n\nau BufNewFile,BufRead *conkyrc,conky.conf set filetype=conkyrc\n"
  },
  {
    "path": "extras/vim/syntax/conkyrc.vim.j2",
    "content": "\" Vim syntax file\n\" Language:   conkyrc\n\" Author:     Ciaran McCreesh <ciaranm@gentoo.org>\n\" Version:    20060307\n\" Copyright:  Copyright (c) 2005 Ciaran McCreesh\n\" Licence:    You may redistribute this under the same terms as Vim itself\n\"\n\nif exists(\"b:current_syntax\")\n\tfinish\nendif\n\nsyn region ConkyrcComment start=/^\\s*#/ end=/$/\n\nsyn keyword ConkyrcSetting {{ config_settings['values']|map(attribute=\"name\")|join(' ') }}\n\nsyn keyword ConkyrcConstant\n\t\t\t\\ above\n\t\t\t\\ below\n\t\t\t\\ bottom_left\n\t\t\t\\ bottom_right\n\t\t\t\\ bottom_middle\n\t\t\t\\ desktop\n\t\t\t\\ dock\n\t\t\t\\ no\n\t\t\t\\ none\n\t\t\t\\ normal\n\t\t\t\\ override\n\t\t\t\\ skip_pager\n\t\t\t\\ skip_taskbar\n\t\t\t\\ sticky\n\t\t\t\\ top_left\n\t\t\t\\ top_right\n\t\t\t\\ top_middle\n\t\t\t\\ middle_left\n\t\t\t\\ middle_right\n\t\t\t\\ middle_middle\n\t\t\t\\ undecorated\n\t\t\t\\ yes\n\nsyn match ConkyrcNumber /\\S\\@<!\\d\\+\\(\\.\\d\\+\\)\\?\\(\\S\\@!\\|}\\@=\\)/\n\t\t\t\\ nextgroup=ConkyrcNumber,ConkyrcColour skipwhite\nsyn match ConkyrcColour /\\S\\@<!#[a-fA-F0-9]\\{6\\}\\(\\S\\@!\\|}\\@=\\)/\n\t\t\t\\ nextgroup=ConkyrcNumber,ConkyrcColour skipwhite\n\nsyn region ConkyrcText start=/^TEXT$/ end=/\\%$/ contains=ConkyrcVar\n\nsyn region ConkyrcVar start=/\\${/ end=/}/ contained contains=ConkyrcVarStuff\nsyn region ConkyrcVar start=/\\$\\w\\@=/ end=/\\W\\@=\\|$/ contained contains=ConkyrcVarName\n\nsyn match ConkyrcVarStuff /{\\@<=/ms=s contained nextgroup=ConkyrcVarName\n\nsyn keyword ConkyrcVarName contained nextgroup=ConkyrcNumber,ConkyrcColour skipwhite {{ variables['values']|map(attribute=\"name\")|join(' ') }}\n\nhi def link ConkyrcComment   Comment\nhi def link ConkyrcSetting   Keyword\nhi def link ConkyrcConstant  Constant\nhi def link ConkyrcNumber    Number\nhi def link ConkyrcColour    Special\n\nhi def link ConkyrcText      String\nhi def link ConkyrcVar       Identifier\nhi def link ConkyrcVarName   Keyword\n\nlet b:current_syntax = \"conkyrc\"\n"
  },
  {
    "path": "flake.nix",
    "content": "{\n  description = \"A Nix flake for Conky, including a dev shell\";\n  inputs = {\n    nixpkgs = {\n      url = \"github:nixos/nixpkgs/nixos-unstable\";\n    };\n    flake-utils = {\n      url = \"github:numtide/flake-utils\";\n    };\n  };\n\n  outputs = {\n    self,\n    nixpkgs,\n    flake-utils,\n    ...\n  }:\n    flake-utils.lib.eachDefaultSystem\n    (\n      system: let\n        pkgs = import nixpkgs {\n          inherit system;\n          overlays = [self.overlays.default];\n        };\n      in\n        with pkgs; rec\n        {\n          packages = flake-utils.lib.flattenTree {\n            conky = conky;\n            default = conky;\n          };\n\n          apps.conky = flake-utils.lib.mkApp {\n            drv = packages.conky;\n          };\n          apps.default = apps.conky;\n          devShells.default =\n            mkShell.override {\n              stdenv = llvmPackages_18.libcxxStdenv;\n            } rec {\n              buildInputs =\n                packages.conky.buildInputs\n                ++ packages.conky.nativeBuildInputs\n                ++ [\n                  alejandra # for beautifying flake\n                  lefthook # for git hooks\n                  nodejs # for web/ stuff\n                  # for docs\n                  (python3.withPackages (ps: with ps; [jinja2]))\n                ];\n            };\n        }\n    )\n    // {\n      overlays.default = final: prev: {\n        conky = with final;\n          stdenv.mkDerivation rec {\n            name = \"conky\";\n            src = ./.;\n            cmakeFlags = [\n              \"-DBUILD_CURL=ON\"\n              \"-DBUILD_LUA_CAIRO_XLIB=ON\"\n              \"-DBUILD_LUA_CAIRO=ON\"\n              \"-DBUILD_LUA_IMLIB2=ON\"\n              \"-DBUILD_LUA_RSVG=ON\"\n              \"-DBUILD_RSS=ON\"\n              \"-DREPRODUCIBLE_BUILD=ON\"\n            ];\n            nativeBuildInputs = [\n              clang_18\n              cmake\n              git\n              gperf\n              llvmPackages_18.clang-unwrapped\n              ninja\n              pkg-config\n            ];\n            buildInputs =\n              [\n                cairo\n                curl\n                freetype\n                gettext\n                imlib2\n                librsvg\n                libxml2\n                llvmPackages_18.libcxx\n                lua5_4\n                ncurses\n                xorg.libICE\n                xorg.libSM\n                xorg.libX11\n                xorg.libxcb\n                xorg.libXdamage\n                xorg.libXext\n                xorg.libXfixes\n                xorg.libXft\n                xorg.libXi\n                xorg.libXinerama\n                xorg.xcbutilerrors\n              ]\n              ++ lib.optional stdenv.isDarwin darwin.libobjc;\n          };\n      };\n    };\n}\n"
  },
  {
    "path": "lefthook.yml",
    "content": "pre-commit:\n  parallel: true\n  commands:\n    web-linter:\n      run: |\n        npx -y eslint --fix {staged_files} \\\n          && git add {staged_files}\n      root: web/\n      glob: '*.{ts,tsx,js,jsx}'\n    cpp-linter:\n      run: |\n        clang-format -i {staged_files} \\\n          && git add {staged_files}\n      glob: '*.{c,cc,cxx,h,hh,cpp}'\n    misc-linter:\n      run: |\n        npx -y prettier --write {staged_files} \\\n          && git add {staged_files}\n      glob: '*.{md,json,yml,yaml}'\n    nix-linter:\n      run: |\n        alejandra -q {staged_files} \\\n          && git add {staged_files}\n      glob: '*.{nix}'\n"
  },
  {
    "path": "lua/.gitignore",
    "content": "*.cc\ncmake_install.cmake"
  },
  {
    "path": "lua/CMakeLists.txt",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2025 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\ninclude(ToLua)\n\nadd_definitions(-DTOLUA_RELEASE)\n\n# NOTE: Don't chain options in IFs here, their dependency is already handled by\n# ConkyBuildOptions.cmake\nif(BUILD_LUA_CAIRO)\n  include_directories(${luacairo_includes} ${CMAKE_CURRENT_SOURCE_DIR})\n\n  # cairo_set_dash() needs this special hack to work properly if you have a\n  # better solution, please let me know\n  wrap_tolua(luacairo_src cairo.pkg libcairo.patch)\n\n  add_library(conky-cairo MODULE ${luacairo_src})\n  set_target_properties(conky-cairo PROPERTIES OUTPUT_NAME \"cairo\")\n\n  target_link_libraries(conky-cairo ${luacairo_libs} toluapp_lib_static)\n  set(lua_libs ${lua_libs} conky-cairo)\n\n  print_target_properties(conky-cairo)\nendif(BUILD_LUA_CAIRO)\n\nif(BUILD_LUA_CAIRO_XLIB)\n  include_directories(${luacairoxlib_includes} ${CMAKE_CURRENT_SOURCE_DIR})\n\n  # Need the directory for -lSM\n  get_filename_component(X11_SM_LIB_PATH ${X11_SM_LIB} DIRECTORY)\n  link_directories(${X11_SM_LIB_PATH})\n  wrap_tolua(luacairoxlib_src cairo_xlib.pkg)\n\n  add_library(conky-cairo_xlib MODULE ${luacairoxlib_src})\n  set_target_properties(conky-cairo_xlib PROPERTIES OUTPUT_NAME \"cairo_xlib\")\n\n  target_link_libraries(conky-cairo_xlib\n    ${luacairoxlib_libs}\n    ${luacairo_libs}\n    toluapp_lib_static)\n  set(lua_libs ${lua_libs} conky-cairo_xlib)\n\n  print_target_properties(conky-cairo_xlib)\nendif(BUILD_LUA_CAIRO_XLIB)\n\nif(BUILD_LUA_IMLIB2)\n  include_directories(${luaimlib2_includes} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src)\n\n  if(IMLIB2_VERSION VERSION_GREATER_EQUAL \"1.10.0\")\n    wrap_tolua(luaimlib2_src imlib2.pkg)\n  else(IMLIB2_VERSION VERSION_GREATER_EQUAL \"1.10.0\")\n    wrap_tolua(luaimlib2_src imlib2_old.pkg)\n  endif(IMLIB2_VERSION VERSION_GREATER_EQUAL \"1.10.0\")\n\n  add_library(conky-imlib2 MODULE ${luaimlib2_src})\n  set_target_properties(conky-imlib2 PROPERTIES OUTPUT_NAME \"imlib2\")\n\n  target_link_libraries(conky-imlib2 ${luaimlib2_libs} toluapp_lib_static)\n  set(lua_libs ${lua_libs} conky-imlib2)\n\n  print_target_properties(conky-imlib2)\nendif(BUILD_LUA_IMLIB2)\n\nif(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2)\n  include_directories(${luacairo_includes} ${luaimlib2_includes}\n    ${CMAKE_CURRENT_SOURCE_DIR})\n  wrap_tolua(luacairo_imlib2_helper_src cairo_imlib2_helper.pkg)\n\n  add_library(conky-cairo_imlib2_helper MODULE ${luacairo_imlib2_helper_src})\n  set_target_properties(conky-cairo_imlib2_helper\n    PROPERTIES OUTPUT_NAME \"cairo_imlib2_helper\")\n\n  target_link_libraries(conky-cairo_imlib2_helper\n    ${luacairo_libs}\n    ${luaimlib2_libs}\n    toluapp_lib_static)\n  set(lua_libs ${lua_libs} conky-cairo_imlib2_helper)\nendif(BUILD_LUA_CAIRO AND BUILD_LUA_IMLIB2)\n\nif(BUILD_LUA_RSVG)\n  include_directories(${luarsvg_includes} ${CMAKE_CURRENT_SOURCE_DIR})\n  wrap_tolua(luarsvg_src rsvg.pkg)\n\n  add_library(conky-rsvg MODULE ${luarsvg_src})\n  set_target_properties(conky-rsvg PROPERTIES OUTPUT_NAME \"rsvg\")\n\n  target_link_libraries(conky-rsvg ${luarsvg_libs} toluapp_lib_static)\n  set(lua_libs ${lua_libs} conky-rsvg)\n\n  print_target_properties(conky-rsvg)\nendif(BUILD_LUA_RSVG)\n\nif(BUILD_LUA_CAIRO AND BUILD_LUA_TEXT)\n  include_directories(${luacairo_includes} ${luatext_includes}\n    ${CMAKE_CURRENT_SOURCE_DIR})\n  wrap_tolua(luacairo_text_helper_src cairo_text_helper.pkg)\n\n  add_library(conky-cairo_text_helper MODULE ${luacairo_text_helper_src})\n  set_target_properties(conky-cairo_text_helper\n    PROPERTIES OUTPUT_NAME \"cairo_text_helper\")\n\n  target_link_libraries(conky-cairo_text_helper\n    ${luacairo_libs}\n    ${luatext_libs}\n    toluapp_lib_static)\n  set(lua_libs ${lua_libs} conky-cairo_text_helper)\nendif(BUILD_LUA_CAIRO AND BUILD_LUA_TEXT)\n\ninstall(TARGETS ${lua_libs}\n  LIBRARY DESTINATION ${LIB_INSTALL_DIR}/conky\n  ARCHIVE DESTINATION ${LIB_INSTALL_DIR}/conky)\n"
  },
  {
    "path": "lua/cairo.pkg",
    "content": "$#include <cairo-features.h>\n$#include <cairo-deprecated.h>\n$#include <cairo.h>\n$#include <libcairo-helper.h>\n/*\n * This code was mostly copied from cairo.h with comments removed.  The\n * license notice below is present for the sake of clarity.\n */\n\n/* cairo - a vector graphics library with display and print output\n *\n * Copyright © 2002 University of Southern California\n * Copyright © 2005 Red Hat, Inc.\n *\n * This library is free software; you can redistribute it and/or\n * modify it either under the terms of the GNU Lesser General Public\n * License version 2.1 as published by the Free Software Foundation\n * (the \"LGPL\") or, at your option, under the terms of the Mozilla\n * Public License Version 1.1 (the \"MPL\"). If you do not alter this\n * notice, a recipient may use your version of this file under either\n * the MPL or the LGPL.\n *\n * You should have received a copy of the LGPL along with this library\n * in the file COPYING-LGPL-2.1; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n * You should have received a copy of the MPL along with this library\n * in the file COPYING-MPL-1.1\n *\n * The contents of this file are subject to the Mozilla Public License\n * Version 1.1 (the \"License\"); you may not use this file except in\n * compliance with the License. You may obtain a copy of the License at\n * http://www.mozilla.org/MPL/\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY\n * OF ANY KIND, either express or implied. See the LGPL or the MPL for\n * the specific language governing rights and limitations.\n *\n * The Original Code is the cairo graphics library.\n *\n * The Initial Developer of the Original Code is University of Southern\n * California.\n *\n * Contributor(s):\n *\tCarl D. Worth <cworth@cworth.org>\n */\n\ntypedef enum _cairo_antialias {\n\tCAIRO_ANTIALIAS_DEFAULT,\n\tCAIRO_ANTIALIAS_NONE,\n\tCAIRO_ANTIALIAS_GRAY,\n\tCAIRO_ANTIALIAS_SUBPIXEL\n} cairo_antialias_t;\n\ntypedef struct _cairo_matrix {\n\tdouble xx;\n\tdouble yx;\n\tdouble xy;\n\tdouble yy;\n\tdouble x0;\n\tdouble y0;\n\tstatic tolua_outside cairo_matrix_t* create_cairo_matrix_t @ create();\n\tstatic tolua_outside void destroy_cairo_matrix_t @ destroy(cairo_matrix_t *pointer);\n} cairo_matrix_t;\ntypedef int cairo_bool_t;\n\ntypedef struct _cairo cairo_t;\n\ntypedef struct _cairo_surface cairo_surface_t;\n\ntypedef struct _cairo_pattern cairo_pattern_t;\n\n\ntypedef struct _cairo_user_data_key {\n\tint unused;\n} cairo_user_data_key_t;\n\ntypedef enum _cairo_status {\n\tCAIRO_STATUS_SUCCESS = 0,\n\tCAIRO_STATUS_NO_MEMORY,\n\tCAIRO_STATUS_INVALID_RESTORE,\n\tCAIRO_STATUS_INVALID_POP_GROUP,\n\tCAIRO_STATUS_NO_CURRENT_POINT,\n\tCAIRO_STATUS_INVALID_MATRIX,\n\tCAIRO_STATUS_INVALID_STATUS,\n\tCAIRO_STATUS_NULL_POINTER,\n\tCAIRO_STATUS_INVALID_STRING,\n\tCAIRO_STATUS_INVALID_PATH_DATA,\n\tCAIRO_STATUS_READ_ERROR,\n\tCAIRO_STATUS_WRITE_ERROR,\n\tCAIRO_STATUS_SURFACE_FINISHED,\n\tCAIRO_STATUS_SURFACE_TYPE_MISMATCH,\n\tCAIRO_STATUS_PATTERN_TYPE_MISMATCH,\n\tCAIRO_STATUS_INVALID_CONTENT,\n\tCAIRO_STATUS_INVALID_FORMAT,\n\tCAIRO_STATUS_INVALID_VISUAL,\n\tCAIRO_STATUS_FILE_NOT_FOUND,\n\tCAIRO_STATUS_INVALID_DASH,\n\tCAIRO_STATUS_INVALID_DSC_COMMENT,\n\tCAIRO_STATUS_INVALID_INDEX,\n\tCAIRO_STATUS_CLIP_NOT_REPRESENTABLE,\n\tCAIRO_STATUS_TEMP_FILE_ERROR,\n\tCAIRO_STATUS_INVALID_STRIDE,\n\tCAIRO_STATUS_FONT_TYPE_MISMATCH,\n\tCAIRO_STATUS_USER_FONT_IMMUTABLE,\n\tCAIRO_STATUS_USER_FONT_ERROR,\n\tCAIRO_STATUS_NEGATIVE_COUNT,\n\tCAIRO_STATUS_INVALID_CLUSTERS,\n\tCAIRO_STATUS_INVALID_SLANT,\n\tCAIRO_STATUS_INVALID_WEIGHT,\n\tCAIRO_STATUS_INVALID_SIZE,\n\tCAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED,\n\tCAIRO_STATUS_DEVICE_TYPE_MISMATCH,\n\tCAIRO_STATUS_DEVICE_ERROR,\n\tCAIRO_STATUS_INVALID_MESH_CONSTRUCTION,\n\tCAIRO_STATUS_DEVICE_FINISHED,\n\tCAIRO_STATUS_JBIG2_GLOBAL_MISSING,\n\tCAIRO_STATUS_PNG_ERROR,\n\tCAIRO_STATUS_FREETYPE_ERROR,\n\tCAIRO_STATUS_WIN32_GDI_ERROR,\n\tCAIRO_STATUS_TAG_ERROR,\n\n\tCAIRO_STATUS_LAST_STATUS\n} cairo_status_t;\n\ntypedef enum _cairo_content {\n\tCAIRO_CONTENT_COLOR = 0x1000,\n\tCAIRO_CONTENT_ALPHA = 0x2000,\n\tCAIRO_CONTENT_COLOR_ALPHA = 0x3000\n} cairo_content_t;\n\ntypedef enum _cairo_operator {\n\tCAIRO_OPERATOR_CLEAR,\n\n\tCAIRO_OPERATOR_SOURCE,\n\tCAIRO_OPERATOR_OVER,\n\tCAIRO_OPERATOR_IN,\n\tCAIRO_OPERATOR_OUT,\n\tCAIRO_OPERATOR_ATOP,\n\n\tCAIRO_OPERATOR_DEST,\n\tCAIRO_OPERATOR_DEST_OVER,\n\tCAIRO_OPERATOR_DEST_IN,\n\tCAIRO_OPERATOR_DEST_OUT,\n\tCAIRO_OPERATOR_DEST_ATOP,\n\n\tCAIRO_OPERATOR_XOR,\n\tCAIRO_OPERATOR_ADD,\n\tCAIRO_OPERATOR_SATURATE,\n\n\t/* blending modes */\n\t/* source and destination layers are multiplied. This causes the result to be at least as dark as the darker inputs. (Since 1.10) */\n\tCAIRO_OPERATOR_MULTIPLY,\n\t/* source and destination are complemented and multiplied. This causes the result to be at least as light as the lighter inputs. (Since 1.10) */\n\tCAIRO_OPERATOR_SCREEN,\n\t/* multiplies or screens, depending on the lightness of the destination color. (Since 1.10) */\n\tCAIRO_OPERATOR_OVERLAY,\n\t/* replaces the destination with the source if it is darker, otherwise keeps the source. (Since 1.10) */\n\tCAIRO_OPERATOR_DARKEN,\n\t/* replaces the destination with the source if it is lighter, otherwise keeps the source. (Since 1.10) */\n\tCAIRO_OPERATOR_LIGHTEN,\n\t/* brightens the destination color to reflect the source color. (Since 1.10) */\n\tCAIRO_OPERATOR_COLOR_DODGE,\n\t/* darkens the destination color to reflect the source color. (Since 1.10) */\n\tCAIRO_OPERATOR_COLOR_BURN,\n\t/* Multiplies or screens, dependent on source color. (Since 1.10) */\n\tCAIRO_OPERATOR_HARD_LIGHT,\n\t/* Darkens or lightens, dependent on source color. (Since 1.10) */\n\tCAIRO_OPERATOR_SOFT_LIGHT,\n\t/* Takes the difference of the source and destination color. (Since 1.10) */\n\tCAIRO_OPERATOR_DIFFERENCE,\n\t/* Produces an effect similar to difference, but with lower contrast. (Since 1.10) */\n\tCAIRO_OPERATOR_EXCLUSION,\n\t/* Creates a color with the hue of the source and the saturation and luminosity of the target. (Since 1.10) */\n\tCAIRO_OPERATOR_HSL_HUE,\n\t/* Creates a color with the saturation of the source and the hue and luminosity of the target. Painting with this mode onto a gray area produces no change. (Since 1.10) */\n\tCAIRO_OPERATOR_HSL_SATURATION,\n\t/* Creates a color with the hue and saturation of the source and the luminosity of the target. This preserves the gray levels of the target and is useful for coloring monochrome images or tinting color images. (Since 1.10) */\n\tCAIRO_OPERATOR_HSL_COLOR,\n\t/* Creates a color with the luminosity of the source and the hue and saturation of the target. This produces an inverse effect to CAIRO_OPERATOR_HSL_COLOR. (Since 1.10) */\n\tCAIRO_OPERATOR_HSL_LUMINOSITY\n} cairo_operator_t;\n\ntypedef enum _cairo_filter {\n\tCAIRO_FILTER_FAST,\n\tCAIRO_FILTER_GOOD,\n\tCAIRO_FILTER_BEST,\n\tCAIRO_FILTER_NEAREST,\n\tCAIRO_FILTER_BILINEAR,\n\tCAIRO_FILTER_GAUSSIAN\n} cairo_filter_t;\n\nint cairo_version(void);\n\nconst char *cairo_version_string(void);\n\ncairo_t *cairo_create(cairo_surface_t * target);\n\ncairo_t *cairo_reference(cairo_t * cr);\n\nvoid cairo_destroy(cairo_t * cr);\n\nunsigned int cairo_get_reference_count(cairo_t * cr);\n\nvoid *cairo_get_user_data(cairo_t * cr, const cairo_user_data_key_t * key);\n\ncairo_status_t cairo_set_user_data(cairo_t * cr, const cairo_user_data_key_t *\n\t\tkey, void *user_data, cairo_destroy_func_t destroy);\n\nvoid cairo_save(cairo_t * cr);\n\nvoid cairo_restore(cairo_t * cr);\n\nvoid cairo_push_group(cairo_t * cr);\n\nvoid cairo_push_group_with_content(cairo_t * cr, cairo_content_t content);\n\ncairo_pattern_t *cairo_pop_group(cairo_t * cr);\n\nvoid cairo_pop_group_to_source(cairo_t * cr);\n\nvoid cairo_set_operator(cairo_t * cr, cairo_operator_t op);\n\nvoid cairo_set_source(cairo_t * cr, cairo_pattern_t * source);\n\nvoid cairo_set_source_rgb(cairo_t * cr, double red, double green, double blue);\n\nvoid cairo_set_source_rgba(cairo_t * cr, double red, double green, double blue, double alpha);\n\nvoid cairo_set_source_surface(cairo_t * cr, cairo_surface_t * surface, double x, double y);\n\nvoid cairo_set_tolerance(cairo_t * cr, double tolerance);\n\nvoid cairo_set_antialias(cairo_t * cr, cairo_antialias_t antialias);\n\ntypedef enum _cairo_fill_rule {\n\tCAIRO_FILL_RULE_WINDING,\n\tCAIRO_FILL_RULE_EVEN_ODD\n} cairo_fill_rule_t;\n\nvoid cairo_set_fill_rule(cairo_t * cr, cairo_fill_rule_t fill_rule);\n\nvoid cairo_set_line_width(cairo_t * cr, double width);\n\ntypedef enum _cairo_line_cap {\n\tCAIRO_LINE_CAP_BUTT,\n\tCAIRO_LINE_CAP_ROUND,\n\tCAIRO_LINE_CAP_SQUARE\n} cairo_line_cap_t;\n\nvoid cairo_set_line_cap(cairo_t * cr, cairo_line_cap_t line_cap);\n\ntypedef enum _cairo_line_join {\n\tCAIRO_LINE_JOIN_MITER,\n\tCAIRO_LINE_JOIN_ROUND,\n\tCAIRO_LINE_JOIN_BEVEL\n} cairo_line_join_t;\n\nvoid cairo_set_line_join(cairo_t * cr, cairo_line_join_t line_join);\n\nvoid cairo_set_dash(cairo_t * cr, const double dashes[num_dashes], int num_dashes, double offset);\n\nvoid cairo_set_miter_limit(cairo_t * cr, double limit);\n\nvoid cairo_translate(cairo_t * cr, double tx, double ty);\n\nvoid cairo_scale(cairo_t * cr, double sx, double sy);\n\nvoid cairo_rotate(cairo_t * cr, double angle);\n\nvoid cairo_transform(cairo_t * cr, cairo_matrix_t * matrix);\n\nvoid cairo_set_matrix(cairo_t * cr, cairo_matrix_t * matrix);\n\nvoid cairo_identity_matrix(cairo_t * cr);\n\nvoid cairo_user_to_device(cairo_t * cr, double *x, double *y);\n\nvoid cairo_user_to_device_distance(cairo_t * cr, double *dx, double *dy);\n\nvoid cairo_device_to_user(cairo_t * cr, double *x, double *y);\n\nvoid cairo_device_to_user_distance(cairo_t * cr, double *dx, double *dy);\n\nvoid cairo_new_path(cairo_t * cr);\n\nvoid cairo_move_to(cairo_t * cr, double x, double y);\n\nvoid cairo_new_sub_path(cairo_t * cr);\n\nvoid cairo_line_to(cairo_t * cr, double x, double y);\n\nvoid cairo_curve_to(cairo_t * cr, double x1, double y1, double x2, double y2, double x3, double y3);\n\nvoid cairo_arc(cairo_t * cr, double xc, double yc, double radius, double angle1, double angle2);\n\nvoid cairo_arc_negative(cairo_t * cr, double xc, double yc, double radius,\n\t\tdouble angle1, double angle2);\n\nvoid cairo_rel_move_to(cairo_t * cr, double dx, double dy);\n\nvoid cairo_rel_line_to(cairo_t * cr, double dx, double dy);\n\nvoid cairo_rel_curve_to(cairo_t * cr, double dx1, double dy1, double dx2,\n\t\tdouble dy2, double dx3, double dy3);\n\nvoid cairo_rectangle(cairo_t * cr, double x, double y, double width, double height);\n\nvoid cairo_close_path(cairo_t * cr);\n\nvoid cairo_path_extents(cairo_t * cr, double *x1, double *y1, double *x2, double *y2);\n\nvoid cairo_paint(cairo_t * cr);\n\nvoid cairo_paint_with_alpha(cairo_t * cr, double alpha);\n\nvoid cairo_mask(cairo_t * cr, cairo_pattern_t * pattern);\n\nvoid cairo_mask_surface(cairo_t * cr, cairo_surface_t * surface, double\n\t\tsurface_x, double surface_y);\n\nvoid cairo_stroke(cairo_t * cr);\n\nvoid cairo_stroke_preserve(cairo_t * cr);\n\nvoid cairo_fill(cairo_t * cr);\n\nvoid cairo_fill_preserve(cairo_t * cr);\n\nvoid cairo_copy_page(cairo_t * cr);\n\nvoid cairo_show_page(cairo_t * cr);\n\ncairo_bool_t cairo_in_stroke(cairo_t * cr, double x, double y);\n\ncairo_bool_t cairo_in_fill(cairo_t * cr, double x, double y);\n\nvoid cairo_stroke_extents(cairo_t * cr, double *x1, double *y1, double *x2, double *y2);\n\nvoid cairo_fill_extents(cairo_t * cr, double *x1, double *y1, double *x2, double *y2);\n\nvoid cairo_reset_clip(cairo_t * cr);\n\nvoid cairo_clip(cairo_t * cr);\n\nvoid cairo_clip_preserve(cairo_t * cr);\n\nvoid cairo_clip_extents(cairo_t * cr, double *x1, double *y1, double *x2, double *y2);\n\ntypedef struct _cairo_rectangle {\n\tdouble x, y, width, height;\n} cairo_rectangle_t;\n\ntypedef struct _cairo_rectangle_list {\n\tcairo_status_t status;\n\tcairo_rectangle_t *rectangles;\n\tint num_rectangles;\n} cairo_rectangle_list_t;\n\ncairo_rectangle_list_t *cairo_copy_clip_rectangle_list(cairo_t * cr);\n\nvoid cairo_rectangle_list_destroy(cairo_rectangle_list_t * rectangle_list);\n\ntypedef struct _cairo_scaled_font cairo_scaled_font_t;\n\ntypedef struct _cairo_font_face cairo_font_face_t;\n\ntypedef struct {\n\tunsigned long index;\n\tdouble x;\n\tdouble y;\n} cairo_glyph_t;\n\ncairo_glyph_t *cairo_glyph_allocate(int num_glyphs);\n\nvoid cairo_glyph_free(cairo_glyph_t * glyphs);\n\ntypedef struct {\n\tint num_bytes;\n\tint num_glyphs;\n} cairo_text_cluster_t;\n\ncairo_text_cluster_t *cairo_text_cluster_allocate(int num_clusters);\n\nvoid cairo_text_cluster_free(cairo_text_cluster_t * clusters);\n\ntypedef enum _cairo_text_cluster_flags {\n\tCAIRO_TEXT_CLUSTER_FLAG_BACKWARD = 0x00000001\n} cairo_text_cluster_flags_t;\n\ntypedef struct {\n\tdouble x_bearing;\n\tdouble y_bearing;\n\tdouble width;\n\tdouble height;\n\tdouble x_advance;\n\tdouble y_advance;\n\tstatic tolua_outside cairo_text_extents_t* create_cairo_text_extents_t @ create();\n\tstatic tolua_outside void destroy_cairo_text_extents_t @ destroy(cairo_text_extents_t *pointer);\n} cairo_text_extents_t;\n\ntypedef struct {\n\tdouble ascent;\n\tdouble descent;\n\tdouble height;\n\tdouble max_x_advance;\n\tdouble max_y_advance;\n\tstatic tolua_outside cairo_font_extents_t* create_cairo_font_extents_t @ create();\n\tstatic tolua_outside void destroy_cairo_font_extents_t @ destroy(cairo_font_extents_t *pointer);\n} cairo_font_extents_t;\n\ntypedef enum _cairo_font_slant {\n\tCAIRO_FONT_SLANT_NORMAL,\n\tCAIRO_FONT_SLANT_ITALIC,\n\tCAIRO_FONT_SLANT_OBLIQUE\n} cairo_font_slant_t;\n\ntypedef enum _cairo_font_weight {\n\tCAIRO_FONT_WEIGHT_NORMAL,\n\tCAIRO_FONT_WEIGHT_BOLD\n} cairo_font_weight_t;\n\ntypedef enum _cairo_subpixel_order {\n\tCAIRO_SUBPIXEL_ORDER_DEFAULT,\n\tCAIRO_SUBPIXEL_ORDER_RGB,\n\tCAIRO_SUBPIXEL_ORDER_BGR,\n\tCAIRO_SUBPIXEL_ORDER_VRGB,\n\tCAIRO_SUBPIXEL_ORDER_VBGR\n} cairo_subpixel_order_t;\n\ntypedef enum _cairo_hint_style {\n\tCAIRO_HINT_STYLE_DEFAULT,\n\tCAIRO_HINT_STYLE_NONE,\n\tCAIRO_HINT_STYLE_SLIGHT,\n\tCAIRO_HINT_STYLE_MEDIUM,\n\tCAIRO_HINT_STYLE_FULL\n} cairo_hint_style_t;\n\ntypedef enum _cairo_hint_metrics {\n\tCAIRO_HINT_METRICS_DEFAULT,\n\tCAIRO_HINT_METRICS_OFF,\n\tCAIRO_HINT_METRICS_ON\n} cairo_hint_metrics_t;\n\ntypedef struct _cairo_font_options cairo_font_options_t;\n\ncairo_font_options_t *cairo_font_options_create(void);\n\ncairo_font_options_t *cairo_font_options_copy(cairo_font_options_t * original);\n\nvoid cairo_font_options_destroy(cairo_font_options_t * options);\n\ncairo_status_t cairo_font_options_status(cairo_font_options_t * options);\n\nvoid cairo_font_options_merge(cairo_font_options_t * options, cairo_font_options_t * other);\n\ncairo_bool_t cairo_font_options_equal(cairo_font_options_t * options,\n\t\tcairo_font_options_t * other);\n\nunsigned long cairo_font_options_hash(cairo_font_options_t * options);\n\nvoid cairo_font_options_set_antialias(cairo_font_options_t * options, cairo_antialias_t antialias);\ncairo_antialias_t cairo_font_options_get_antialias(cairo_font_options_t * options);\n\nvoid cairo_font_options_set_subpixel_order(cairo_font_options_t * options,\n\t\tcairo_subpixel_order_t subpixel_order);\ncairo_subpixel_order_t cairo_font_options_get_subpixel_order(cairo_font_options_t * options);\n\nvoid cairo_font_options_set_hint_style(cairo_font_options_t * options, cairo_hint_style_t hint_style);\ncairo_hint_style_t cairo_font_options_get_hint_style(cairo_font_options_t * options);\n\nvoid cairo_font_options_set_hint_metrics(cairo_font_options_t * options,\n\t\tcairo_hint_metrics_t hint_metrics);\ncairo_hint_metrics_t cairo_font_options_get_hint_metrics(cairo_font_options_t * options);\n\nvoid cairo_select_font_face(cairo_t * cr,\n\t\tconst char *family, cairo_font_slant_t slant, cairo_font_weight_t weight);\n\nvoid cairo_set_font_size(cairo_t * cr, double size);\n\nvoid cairo_set_font_matrix(cairo_t * cr, cairo_matrix_t * matrix);\n\nvoid cairo_get_font_matrix(cairo_t * cr, cairo_matrix_t * matrix);\n\nvoid cairo_set_font_options(cairo_t * cr, cairo_font_options_t * options);\n\nvoid cairo_get_font_options(cairo_t * cr, cairo_font_options_t * options);\n\nvoid cairo_set_font_face(cairo_t * cr, cairo_font_face_t * font_face);\n\ncairo_font_face_t *cairo_get_font_face(cairo_t * cr);\n\nvoid cairo_set_scaled_font(cairo_t * cr, cairo_scaled_font_t * scaled_font);\n\ncairo_scaled_font_t *cairo_get_scaled_font(cairo_t * cr);\n\nvoid cairo_show_text(cairo_t * cr, const char *utf8);\n\nvoid cairo_show_glyphs(cairo_t * cr, const cairo_glyph_t * glyphs, int num_glyphs);\n\nvoid cairo_show_text_glyphs(cairo_t * cr,\n\t\tconst char *utf8,\n\t\tint utf8_len,\n\t\tconst cairo_glyph_t * glyphs,\n\t\tint num_glyphs,\n\t\tconst cairo_text_cluster_t * clusters,\n\t\tint num_clusters, cairo_text_cluster_flags_t cluster_flags);\n\nvoid cairo_text_path(cairo_t * cr, const char *utf8);\n\nvoid cairo_glyph_path(cairo_t * cr, const cairo_glyph_t * glyphs, int num_glyphs);\n\nvoid cairo_text_extents(cairo_t * cr, const char *utf8, cairo_text_extents_t * extents);\n\nvoid cairo_glyph_extents(cairo_t * cr,\n\t\tconst cairo_glyph_t * glyphs, int num_glyphs, cairo_text_extents_t * extents);\n\nvoid cairo_font_extents(cairo_t * cr, cairo_font_extents_t * extents);\n\ncairo_font_face_t *cairo_font_face_reference(cairo_font_face_t * font_face);\n\nvoid cairo_font_face_destroy(cairo_font_face_t * font_face);\n\nunsigned int cairo_font_face_get_reference_count(cairo_font_face_t * font_face);\n\ncairo_status_t cairo_font_face_status(cairo_font_face_t * font_face);\n\ntypedef enum _cairo_font_type {\n\tCAIRO_FONT_TYPE_TOY,\n\tCAIRO_FONT_TYPE_FT,\n\tCAIRO_FONT_TYPE_WIN32,\n\tCAIRO_FONT_TYPE_QUARTZ,\n\tCAIRO_FONT_TYPE_USER\n} cairo_font_type_t;\n\ncairo_font_type_t cairo_font_face_get_type(cairo_font_face_t * font_face);\n\nvoid *cairo_font_face_get_user_data(cairo_font_face_t * font_face,\n\t\tconst cairo_user_data_key_t * key);\n\ncairo_status_t cairo_font_face_set_user_data(cairo_font_face_t * font_face,\n\t\tconst cairo_user_data_key_t * key,\n\t\tvoid *user_data, cairo_destroy_func_t destroy);\n\ncairo_scaled_font_t *cairo_scaled_font_create(cairo_font_face_t * font_face,\n\t\tcairo_matrix_t * font_matrix,\n\t\tcairo_matrix_t * ctm,\n\t\tcairo_font_options_t * options);\n\ncairo_scaled_font_t *cairo_scaled_font_reference(cairo_scaled_font_t * scaled_font);\n\nvoid cairo_scaled_font_destroy(cairo_scaled_font_t * scaled_font);\n\nunsigned int cairo_scaled_font_get_reference_count(cairo_scaled_font_t * scaled_font);\n\ncairo_status_t cairo_scaled_font_status(cairo_scaled_font_t * scaled_font);\n\ncairo_font_type_t cairo_scaled_font_get_type(cairo_scaled_font_t * scaled_font);\n\nvoid *cairo_scaled_font_get_user_data(cairo_scaled_font_t * scaled_font,\n\t\tconst cairo_user_data_key_t * key);\n\ncairo_status_t cairo_scaled_font_set_user_data(cairo_scaled_font_t * scaled_font,\n\t\tconst cairo_user_data_key_t * key,\n\t\tvoid *user_data, cairo_destroy_func_t destroy);\n\nvoid cairo_scaled_font_extents(cairo_scaled_font_t * scaled_font, cairo_font_extents_t * extents);\n\nvoid cairo_scaled_font_text_extents(cairo_scaled_font_t * scaled_font,\n\t\tconst char *utf8, cairo_text_extents_t * extents);\n\nvoid cairo_scaled_font_glyph_extents(cairo_scaled_font_t * scaled_font,\n\t\tconst cairo_glyph_t * glyphs,\n\t\tint num_glyphs, cairo_text_extents_t * extents);\n\ncairo_status_t cairo_scaled_font_text_to_glyphs(cairo_scaled_font_t * scaled_font,\n\t\tdouble x,\n\t\tdouble y,\n\t\tconst char *utf8,\n\t\tint utf8_len,\n\t\tcairo_glyph_t ** glyphs,\n\t\tint *num_glyphs,\n\t\tcairo_text_cluster_t ** clusters,\n\t\tint *num_clusters, cairo_text_cluster_flags_t * cluster_flags);\n\ncairo_font_face_t *cairo_scaled_font_get_font_face(cairo_scaled_font_t * scaled_font);\n\nvoid cairo_scaled_font_get_font_matrix(cairo_scaled_font_t * scaled_font, cairo_matrix_t * font_matrix);\n\nvoid cairo_scaled_font_get_ctm(cairo_scaled_font_t * scaled_font, cairo_matrix_t * ctm);\n\nvoid cairo_scaled_font_get_scale_matrix(cairo_scaled_font_t * scaled_font,\n\t\tcairo_matrix_t * scale_matrix);\n\nvoid cairo_scaled_font_get_font_options(cairo_scaled_font_t * scaled_font,\n\t\tcairo_font_options_t * options);\n\ncairo_font_face_t *cairo_toy_font_face_create(const char *family,\n\t\tcairo_font_slant_t slant, cairo_font_weight_t weight);\n\nconst char *cairo_toy_font_face_get_family(cairo_font_face_t * font_face);\n\ncairo_font_slant_t cairo_toy_font_face_get_slant(cairo_font_face_t * font_face);\n\ncairo_font_weight_t cairo_toy_font_face_get_weight(cairo_font_face_t * font_face);\n\ncairo_font_face_t *cairo_user_font_face_create(void);\n\nvoid cairo_user_font_face_set_init_func(cairo_font_face_t * font_face,\n\t\tcairo_user_scaled_font_init_func_t init_func);\n\nvoid cairo_user_font_face_set_render_glyph_func(cairo_font_face_t * font_face,\n\t\tcairo_user_scaled_font_render_glyph_func_t\n\t\trender_glyph_func);\n\nvoid cairo_user_font_face_set_text_to_glyphs_func(cairo_font_face_t * font_face,\n\t\tcairo_user_scaled_font_text_to_glyphs_func_t\n\t\ttext_to_glyphs_func);\n\nvoid cairo_user_font_face_set_unicode_to_glyph_func(cairo_font_face_t * font_face,\n\t\tcairo_user_scaled_font_unicode_to_glyph_func_t\n\t\tunicode_to_glyph_func);\n\ncairo_user_scaled_font_init_func_t cairo_user_font_face_get_init_func(cairo_font_face_t * font_face);\n\ncairo_user_scaled_font_render_glyph_func_t cairo_user_font_face_get_render_glyph_func(cairo_font_face_t * font_face);\n\ncairo_user_scaled_font_text_to_glyphs_func_t cairo_user_font_face_get_text_to_glyphs_func(cairo_font_face_t * font_face);\n\ncairo_user_scaled_font_unicode_to_glyph_func_t cairo_user_font_face_get_unicode_to_glyph_func(cairo_font_face_t * font_face);\n\ncairo_operator_t cairo_get_operator(cairo_t * cr);\n\ncairo_pattern_t *cairo_get_source(cairo_t * cr);\n\ndouble cairo_get_tolerance(cairo_t * cr);\n\ncairo_antialias_t cairo_get_antialias(cairo_t * cr);\n\ncairo_bool_t cairo_has_current_point(cairo_t * cr);\n\nvoid cairo_get_current_point(cairo_t * cr, double *x, double *y);\n\ncairo_fill_rule_t cairo_get_fill_rule(cairo_t * cr);\n\ndouble cairo_get_line_width(cairo_t * cr);\n\ncairo_line_cap_t cairo_get_line_cap(cairo_t * cr);\n\ncairo_line_join_t cairo_get_line_join(cairo_t * cr);\n\ndouble cairo_get_miter_limit(cairo_t * cr);\n\nint cairo_get_dash_count(cairo_t * cr);\n\nvoid cairo_get_dash(cairo_t * cr, double *dashes, double *offset);\n\nvoid cairo_get_matrix(cairo_t * cr, cairo_matrix_t * matrix);\n\ncairo_surface_t *cairo_get_target(cairo_t * cr);\n\ncairo_surface_t *cairo_get_group_target(cairo_t * cr);\n\ntypedef enum _cairo_path_data_type {\n\tCAIRO_PATH_MOVE_TO,\n\tCAIRO_PATH_LINE_TO,\n\tCAIRO_PATH_CURVE_TO,\n\tCAIRO_PATH_CLOSE_PATH\n} cairo_path_data_type_t;\n\ntypedef union _cairo_path_data_t cairo_path_data_t;\n\ntypedef struct cairo_path {\n\tcairo_status_t status;\n\tcairo_path_data_t *data;\n\tint num_data;\n} cairo_path_t;\n\ncairo_path_t *cairo_copy_path(cairo_t * cr);\n\ncairo_path_t *cairo_copy_path_flat(cairo_t * cr);\n\nvoid cairo_append_path(cairo_t * cr, const cairo_path_t * path);\n\nvoid cairo_path_destroy(cairo_path_t * path);\n\ncairo_status_t cairo_status(cairo_t * cr);\n\nconst char *cairo_status_to_string(cairo_status_t status);\n\ncairo_surface_t *cairo_surface_create_similar(cairo_surface_t * other,\n\t\tcairo_content_t content, int width, int height);\n\ncairo_surface_t *cairo_surface_create_for_rectangle (cairo_surface_t\t*target,\n\t\tdouble x,\n\t\tdouble y,\n\t\tdouble width,\n\t\tdouble height);\n\ncairo_surface_t *cairo_surface_reference(cairo_surface_t * surface);\n\nvoid cairo_surface_finish(cairo_surface_t * surface);\n\nvoid cairo_surface_destroy(cairo_surface_t * surface);\n\nunsigned int cairo_surface_get_reference_count(cairo_surface_t * surface);\n\ncairo_status_t cairo_surface_status(cairo_surface_t * surface);\n\ntypedef enum _cairo_surface_type {\n\tCAIRO_SURFACE_TYPE_IMAGE,\n\tCAIRO_SURFACE_TYPE_PDF,\n\tCAIRO_SURFACE_TYPE_PS,\n\tCAIRO_SURFACE_TYPE_XLIB,\n\tCAIRO_SURFACE_TYPE_XCB,\n\tCAIRO_SURFACE_TYPE_GLITZ,\n\tCAIRO_SURFACE_TYPE_QUARTZ,\n\tCAIRO_SURFACE_TYPE_WIN32,\n\tCAIRO_SURFACE_TYPE_BEOS,\n\tCAIRO_SURFACE_TYPE_DIRECTFB,\n\tCAIRO_SURFACE_TYPE_SVG,\n\tCAIRO_SURFACE_TYPE_OS2,\n\tCAIRO_SURFACE_TYPE_WIN32_PRINTING,\n\tCAIRO_SURFACE_TYPE_QUARTZ_IMAGE\n} cairo_surface_type_t;\n\ncairo_surface_type_t cairo_surface_get_type(cairo_surface_t * surface);\n\ncairo_content_t cairo_surface_get_content(cairo_surface_t * surface);\n\n\ncairo_status_t cairo_surface_write_to_png(cairo_surface_t * surface, const char *filename);\n\ncairo_status_t cairo_surface_write_to_png_stream(cairo_surface_t * surface,\n\t\tcairo_write_func_t write_func, void *closure);\n\nvoid *cairo_surface_get_user_data(cairo_surface_t * surface, const cairo_user_data_key_t * key);\n\ncairo_status_t cairo_surface_set_user_data(cairo_surface_t * surface,\n\t\tconst cairo_user_data_key_t * key,\n\t\tvoid *user_data, cairo_destroy_func_t destroy);\n\nvoid cairo_surface_get_font_options(cairo_surface_t * surface, cairo_font_options_t * options);\n\nvoid cairo_surface_flush(cairo_surface_t * surface);\n\nvoid cairo_surface_mark_dirty(cairo_surface_t * surface);\n\nvoid cairo_surface_mark_dirty_rectangle(cairo_surface_t * surface, int x, int y, int width, int height);\n\nvoid cairo_surface_set_device_offset(cairo_surface_t * surface, double x_offset, double y_offset);\n\nvoid cairo_surface_get_device_offset(cairo_surface_t * surface, double *x_offset, double *y_offset);\n\nvoid cairo_surface_set_fallback_resolution(cairo_surface_t * surface,\n\t\tdouble x_pixels_per_inch, double y_pixels_per_inch);\n\nvoid cairo_surface_get_fallback_resolution(cairo_surface_t * surface,\n\t\tdouble *x_pixels_per_inch, double *y_pixels_per_inch);\n\nvoid cairo_surface_copy_page(cairo_surface_t * surface);\n\nvoid cairo_surface_show_page(cairo_surface_t * surface);\n\ncairo_bool_t cairo_surface_has_show_text_glyphs(cairo_surface_t * surface);\n\ntypedef enum _cairo_format {\n\tCAIRO_FORMAT_ARGB32,\n\tCAIRO_FORMAT_RGB24,\n\tCAIRO_FORMAT_A8,\n\tCAIRO_FORMAT_A1\n} cairo_format_t;\n\ncairo_surface_t *cairo_image_surface_create(cairo_format_t format, int width, int height);\n\nint cairo_format_stride_for_width(cairo_format_t format, int width);\n\ncairo_surface_t *cairo_image_surface_create_for_data(unsigned char *data,\n\t\tcairo_format_t format,\n\t\tint width, int height, int stride);\n\nunsigned char *cairo_image_surface_get_data(cairo_surface_t * surface);\n\ncairo_format_t cairo_image_surface_get_format(cairo_surface_t * surface);\n\nint cairo_image_surface_get_width(cairo_surface_t * surface);\n\nint cairo_image_surface_get_height(cairo_surface_t * surface);\n\nint cairo_image_surface_get_stride(cairo_surface_t * surface);\n\n\ncairo_surface_t *cairo_image_surface_create_from_png(const char *filename);\n\ncairo_surface_t *cairo_image_surface_create_from_png_stream(cairo_read_func_t read_func,\n\t\tvoid *closure);\n\ncairo_pattern_t *cairo_pattern_create_rgb(double red, double green, double blue);\n\ncairo_pattern_t *cairo_pattern_create_rgba(double red, double green, double blue, double alpha);\n\ncairo_pattern_t *cairo_pattern_create_for_surface(cairo_surface_t * surface);\n\ncairo_pattern_t *cairo_pattern_create_linear(double x0, double y0, double x1, double y1);\n\ncairo_pattern_t *cairo_pattern_create_radial(double cx0, double cy0, double radius0,\n\t\tdouble cx1, double cy1, double radius1);\n\ncairo_pattern_t *cairo_pattern_reference(cairo_pattern_t * pattern);\n\nvoid cairo_pattern_destroy(cairo_pattern_t * pattern);\n\nunsigned int cairo_pattern_get_reference_count(cairo_pattern_t * pattern);\n\ncairo_status_t cairo_pattern_status(cairo_pattern_t * pattern);\n\nvoid *cairo_pattern_get_user_data(cairo_pattern_t * pattern, const cairo_user_data_key_t * key);\n\ncairo_status_t cairo_pattern_set_user_data(cairo_pattern_t * pattern,\n\t\tconst cairo_user_data_key_t * key,\n\t\tvoid *user_data, cairo_destroy_func_t destroy);\n\ntypedef enum _cairo_pattern_type {\n\tCAIRO_PATTERN_TYPE_SOLID,\n\tCAIRO_PATTERN_TYPE_SURFACE,\n\tCAIRO_PATTERN_TYPE_LINEAR,\n\tCAIRO_PATTERN_TYPE_RADIAL,\n\tCAIRO_PATTERN_TYPE_MESH,\n    CAIRO_PATTERN_TYPE_RASTER_SOURCE\n} cairo_pattern_type_t;\n\ncairo_pattern_type_t cairo_pattern_get_type(cairo_pattern_t * pattern);\n\nvoid cairo_pattern_add_color_stop_rgb(cairo_pattern_t * pattern, double offset,\n\t\tdouble red, double green, double blue);\n\nvoid cairo_pattern_add_color_stop_rgba(cairo_pattern_t * pattern, double\n\t\toffset, double red, double green, double blue, double alpha);\n\nvoid cairo_pattern_set_matrix(cairo_pattern_t * pattern, cairo_matrix_t * matrix);\n\nvoid cairo_pattern_get_matrix(cairo_pattern_t * pattern, cairo_matrix_t * matrix);\n\ntypedef enum _cairo_extend {\n\tCAIRO_EXTEND_NONE,\n\tCAIRO_EXTEND_REPEAT,\n\tCAIRO_EXTEND_REFLECT,\n\tCAIRO_EXTEND_PAD\n} cairo_extend_t;\n\nvoid cairo_pattern_set_extend(cairo_pattern_t * pattern, cairo_extend_t extend);\n\ncairo_extend_t cairo_pattern_get_extend(cairo_pattern_t * pattern);\n\nvoid cairo_pattern_set_filter(cairo_pattern_t * pattern, cairo_filter_t filter);\n\ncairo_filter_t cairo_pattern_get_filter(cairo_pattern_t * pattern);\n\ncairo_status_t cairo_pattern_get_rgba(cairo_pattern_t * pattern,\n\t\tdouble *red, double *green, double *blue, double *alpha);\n\ncairo_status_t cairo_pattern_get_surface(cairo_pattern_t * pattern, cairo_surface_t ** surface);\n\ncairo_status_t cairo_pattern_get_color_stop_rgba(cairo_pattern_t * pattern,\n\t\tint index, double *offset,\n\t\tdouble *red, double *green, double *blue, double *alpha);\n\ncairo_status_t cairo_pattern_get_color_stop_count(cairo_pattern_t * pattern, int *count);\n\ncairo_status_t cairo_pattern_get_linear_points(cairo_pattern_t * pattern,\n\t\tdouble *x0, double *y0, double *x1, double *y1);\n\ncairo_status_t cairo_pattern_get_radial_circles(cairo_pattern_t * pattern,\n\t\tdouble *x0, double *y0, double *r0,\n\t\tdouble *x1, double *y1, double *r1);\n\ncairo_pattern_t *cairo_pattern_create_mesh (void);\n\nvoid cairo_mesh_pattern_begin_patch (cairo_pattern_t *pattern);\n\nvoid cairo_mesh_pattern_end_patch (cairo_pattern_t *pattern);\n\nvoid cairo_mesh_pattern_curve_to (cairo_pattern_t *pattern,\n\t\tdouble x1, double y1,\n\t\tdouble x2, double y2,\n\t\tdouble x3, double y3);\n\nvoid cairo_mesh_pattern_line_to (cairo_pattern_t *pattern,\n\t\tdouble x, double y);\n\nvoid cairo_mesh_pattern_move_to (cairo_pattern_t *pattern,\n\t\tdouble x, double y);\n\nvoid cairo_mesh_pattern_set_control_point (cairo_pattern_t *pattern,\n\t\tunsigned int point_num, double x, double y);\n\nvoid cairo_mesh_pattern_set_corner_color_rgb (cairo_pattern_t *pattern,\n\t\tunsigned int corner_num, double red, double green, double blue);\n\nvoid cairo_mesh_pattern_set_corner_color_rgba (cairo_pattern_t *pattern,\n\t\tunsigned int corner_num, double red, double green, double blue,\n\t\tdouble alpha);\n\ncairo_status_t cairo_mesh_pattern_get_patch_count (cairo_pattern_t *pattern,\n\t\tunsigned int *count);\n\ncairo_path_t *cairo_mesh_pattern_get_path (cairo_pattern_t *pattern,\n\t\tunsigned int patch_num);\n\ncairo_status_t cairo_mesh_pattern_get_corner_color_rgba (cairo_pattern_t *pattern,\n\t\tunsigned int patch_num, unsigned int corner_num,\n\t\tdouble *red, double *green, double *blue, double *alpha);\n\ncairo_status_t cairo_mesh_pattern_get_control_point (cairo_pattern_t *pattern,\n\t\tunsigned int patch_num, unsigned int point_num, double *x, double *y);\n\nvoid cairo_matrix_init(cairo_matrix_t * matrix, double xx, double yx, double\n\t\txy, double yy, double x0, double y0);\n\nvoid cairo_matrix_init_identity(cairo_matrix_t * matrix);\n\nvoid cairo_matrix_init_translate(cairo_matrix_t * matrix, double tx, double ty);\n\nvoid cairo_matrix_init_scale(cairo_matrix_t * matrix, double sx, double sy);\n\nvoid cairo_matrix_init_rotate(cairo_matrix_t * matrix, double radians);\n\nvoid cairo_matrix_translate(cairo_matrix_t * matrix, double tx, double ty);\n\nvoid cairo_matrix_scale(cairo_matrix_t * matrix, double sx, double sy);\n\nvoid cairo_matrix_rotate(cairo_matrix_t * matrix, double radians);\n\ncairo_status_t cairo_matrix_invert(cairo_matrix_t * matrix);\n\nvoid cairo_matrix_multiply(cairo_matrix_t * result, cairo_matrix_t * a,\n\t\tcairo_matrix_t * b);\n\nvoid cairo_matrix_transform_distance(cairo_matrix_t * matrix, double *dx, double *dy);\n\nvoid cairo_matrix_transform_point(cairo_matrix_t * matrix, double *x, double *y);\n\nvoid cairo_debug_reset_static_data(void);\n\nvoid cairo_surface_set_device_scale (cairo_surface_t *surface,\n                                double x_scale,\n                                double y_scale);\nvoid cairo_surface_get_device_scale (cairo_surface_t *surface,\n                                double *x_scale,\n                                double *y_scale);\n"
  },
  {
    "path": "lua/cairo_imlib2_helper.pkg",
    "content": "$#include <cairo.h>\n$#include <libcairo_imlib2_helper.h>\n\n/* Paints the image onto the cairo_surface_t */\nvoid cairo_draw_image(const char *, cairo_surface_t *, int, int,\n                      double scale_x=1.0, double scale_y=1.0,\n                      double * return_scale_w, double * return_scale_h);\n\n/* Places an image onto a cairo_t but doesn't call cairo_paint */\nvoid cairo_place_image(const char *file, cairo_t *cr, int x, int y,\n                       int width, int height, double alpha=1.0);\n"
  },
  {
    "path": "lua/cairo_text_helper.pkg",
    "content": "$#include <cairo.h>\n$#include <libcairo_text_helper.h>\n\ntypedef enum _cairo_text_alignment {\n  CAIRO_TEXT_ALIGN_LEFT = 0,\n  CAIRO_TEXT_ALIGN_RIGHT,\n  CAIRO_TEXT_ALIGN_CENTER\n} cairo_text_alignment_t;\n\nvoid cairo_text_hp_show(cairo_t *cr, int x, int y, const char *text, const char *font, int font_size, \n                        cairo_text_alignment_t alignment = CAIRO_TEXT_ALIGN_LEFT, const char *language = \"en\",\n                        const char *script = NULL, const char *direction = NULL);\n\n/* This function allows you to get sizing so you can layout multiple sets of text next to each other */\nvoid cairo_text_hp_text_size(const char *text, const char *font, int font_size, \n                             const char *language = \"en\", const char *script = NULL, const char *direction, int *width, int *height);\n\n/* This will clear all currently loaded / cached fonts */\nvoid cairo_text_hp_delete_fonts();\n"
  },
  {
    "path": "lua/cairo_xlib.pkg",
    "content": "$#include <cairo.h>\n$#include <cairo-xlib.h>\n$#include <X11/Xlib.h>\n/*\n * This code was mostly copied from cairo-xlib.h with comments removed.  The\n * license notice below is present for the sake of clarity.\n */\n\n/* cairo - a vector graphics library with display and print output\n *\n * Copyright © 2002 University of Southern California\n * Copyright © 2005 Red Hat, Inc.\n *\n * This library is free software; you can redistribute it and/or\n * modify it either under the terms of the GNU Lesser General Public\n * License version 2.1 as published by the Free Software Foundation\n * (the \"LGPL\") or, at your option, under the terms of the Mozilla\n * Public License Version 1.1 (the \"MPL\"). If you do not alter this\n * notice, a recipient may use your version of this file under either\n * the MPL or the LGPL.\n *\n * You should have received a copy of the LGPL along with this library\n * in the file COPYING-LGPL-2.1; if not, write to the Free Software\n * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n * You should have received a copy of the MPL along with this library\n * in the file COPYING-MPL-1.1\n *\n * The contents of this file are subject to the Mozilla Public License\n * Version 1.1 (the \"License\"); you may not use this file except in\n * compliance with the License. You may obtain a copy of the License at\n * http://www.mozilla.org/MPL/\n *\n * This software is distributed on an \"AS IS\" basis, WITHOUT WARRANTY\n * OF ANY KIND, either express or implied. See the LGPL or the MPL for\n * the specific language governing rights and limitations.\n *\n * The Original Code is the cairo graphics library.\n *\n * The Initial Developer of the Original Code is University of Southern\n * California.\n *\n * Contributor(s):\n *\tCarl D. Worth <cworth@cworth.org>\n */\n\ncairo_surface_t *cairo_xlib_surface_create(Display * dpy,\n\t\tDrawable drawable,\n\t\tVisual * visual, int width, int height);\n\ncairo_surface_t *cairo_xlib_surface_create_for_bitmap(Display * dpy,\n\t\tPixmap bitmap,\n\t\tScreen * screen, int width, int height);\n\nvoid cairo_xlib_surface_set_size(cairo_surface_t * surface, int width, int height);\n\nvoid cairo_xlib_surface_set_drawable(cairo_surface_t * surface, Drawable\n\t\tdrawable, int width, int height);\n\nDisplay *cairo_xlib_surface_get_display(cairo_surface_t * surface);\n\nDrawable cairo_xlib_surface_get_drawable(cairo_surface_t * surface);\n\nScreen *cairo_xlib_surface_get_screen(cairo_surface_t * surface);\n\nVisual *cairo_xlib_surface_get_visual(cairo_surface_t * surface);\n\nint cairo_xlib_surface_get_depth(cairo_surface_t * surface);\n\nint cairo_xlib_surface_get_width(cairo_surface_t * surface);\n\nint cairo_xlib_surface_get_height(cairo_surface_t * surface);\n"
  },
  {
    "path": "lua/imlib2.pkg",
    "content": "$#define BUILD_X11 1\n$#include <Imlib2.h>\n$#include <X11/Xlib.h>\n\n$#define _userdata void*\n$#include <stddef.h>\n$#include <stdint.h>\n\ntypedef void *Imlib_Context;\ntypedef void *Imlib_Image;\ntypedef void *Imlib_Color_Modifier;\ntypedef void *Imlib_Updates;\ntypedef void *Imlib_Font;\ntypedef void *Imlib_Color_Range;\ntypedef void *Imlib_Filter;\ntypedef void *ImlibPolygon;\n\ntypedef enum {\n  IMLIB_OP_COPY,\n  IMLIB_OP_ADD,\n  IMLIB_OP_SUBTRACT,\n  IMLIB_OP_RESHADE\n} Imlib_Operation;\n\ntypedef enum {\n  IMLIB_TEXT_TO_RIGHT = 0,\n  IMLIB_TEXT_TO_LEFT = 1,\n  IMLIB_TEXT_TO_DOWN = 2,\n  IMLIB_TEXT_TO_UP = 3,\n  IMLIB_TEXT_TO_ANGLE = 4\n} Imlib_Text_Direction;\n\ntypedef struct {\n  int left, right, top, bottom;\n} Imlib_Border;\n\ntypedef struct {\n  int alpha, red, green, blue;\n} Imlib_Color;\n\nint imlib_version(void);\n\nImlib_Context imlib_context_new(void);\n\nvoid imlib_context_free(Imlib_Context context);\n\nvoid imlib_context_push(Imlib_Context context);\n\nvoid imlib_context_pop(void);\n\nImlib_Context imlib_context_get(void);\n\nvoid imlib_context_set_display(Display *display);\n\nDisplay *imlib_context_get_display(void);\n\nvoid imlib_context_disconnect_display(void);\nvoid imlib_context_set_visual(Visual *visual);\n\nVisual *imlib_context_get_visual(void);\nvoid imlib_context_set_colormap(Colormap colormap);\n\nColormap imlib_context_get_colormap(void);\n\nvoid imlib_context_set_drawable(Drawable drawable);\n\nDrawable imlib_context_get_drawable(void);\n\nvoid imlib_context_set_mask(Pixmap mask);\n\nPixmap imlib_context_get_mask(void);\n\nvoid imlib_context_set_dither_mask(char dither_mask);\n\nchar imlib_context_get_dither_mask(void);\n\nvoid imlib_context_set_mask_alpha_threshold(int mask_alpha_threshold);\n\nint imlib_context_get_mask_alpha_threshold(void);\n\nvoid imlib_context_set_anti_alias(char anti_alias);\n\nchar imlib_context_get_anti_alias(void);\n\nvoid imlib_context_set_dither(char dither);\n\nchar imlib_context_get_dither(void);\n\nvoid imlib_context_set_blend(char blend);\n\nchar imlib_context_get_blend(void);\n\nvoid imlib_context_set_color_modifier(Imlib_Color_Modifier color_modifier);\n\nImlib_Color_Modifier imlib_context_get_color_modifier(void);\n\nvoid imlib_context_set_operation(Imlib_Operation operation);\n\nImlib_Operation imlib_context_get_operation(void);\n\nvoid imlib_context_set_font(Imlib_Font font);\n\nImlib_Font imlib_context_get_font(void);\n\nvoid imlib_context_set_direction(Imlib_Text_Direction direction);\n\nImlib_Text_Direction imlib_context_get_direction(void);\n\nvoid imlib_context_set_angle(double angle);\n\ndouble imlib_context_get_angle(void);\n\nvoid imlib_context_set_color(int red, int green, int blue, int alpha);\n\nvoid imlib_context_get_color(int *red, int *green, int *blue, int *alpha);\n\nvoid imlib_context_set_color_hsva(float hue, float saturation, float value,\n                                  int alpha);\n\nvoid imlib_context_get_color_hsva(float *hue, float *saturation, float *value,\n                                  int *alpha);\n\nvoid imlib_context_set_color_hlsa(float hue, float lightness, float saturation,\n                                  int alpha);\n\nvoid imlib_context_get_color_hlsa(float *hue, float *lightness,\n                                  float *saturation, int *alpha);\n\nvoid imlib_context_set_color_cmya(int cyan, int magenta, int yellow, int alpha);\n\nvoid imlib_context_get_color_cmya(int *cyan, int *magenta, int *yellow,\n                                  int *alpha);\n\nImlib_Color *imlib_context_get_imlib_color(void);\n\nvoid imlib_context_set_color_range(Imlib_Color_Range color_range);\n\nImlib_Color_Range imlib_context_get_color_range(void);\n\nvoid imlib_context_set_image_data_memory_function(\n    Imlib_Image_Data_Memory_Function memory_function);\n\nImlib_Image_Data_Memory_Function imlib_context_get_image_data_memory_function(\n    void);\n\nvoid imlib_context_set_progress_function(\n    Imlib_Progress_Function progress_function);\n\nImlib_Progress_Function imlib_context_get_progress_function(void);\n\nvoid imlib_context_set_progress_granularity(char progress_granularity);\n\nchar imlib_context_get_progress_granularity(void);\n\nvoid imlib_context_set_image(Imlib_Image image);\n\nImlib_Image imlib_context_get_image(void);\n\nvoid imlib_context_set_cliprect(int x, int y, int w, int h);\n\nvoid imlib_context_get_cliprect(int *x, int *y, int *w, int *h);\n\nint imlib_get_cache_used(void);\n\nint imlib_get_cache_size(void);\n\nvoid imlib_set_cache_size(int bytes);\n\n#ifndef X_DISPLAY_MISSING\n\nint imlib_get_color_usage(void);\n\nvoid imlib_set_color_usage(int max);\n\nint imlib_get_visual_depth(Display *display, Visual *visual);\n\nVisual *imlib_get_best_visual(Display *display, int screen, int *depth_return);\n#endif\n\nvoid imlib_flush_loaders(void);\n\nint imlib_get_error(void);\n\nImlib_Image imlib_load_image(const char *file);\n\nImlib_Image imlib_load_image_immediately(const char *file);\n\nImlib_Image imlib_load_image_without_cache(const char *file);\n\nImlib_Image imlib_load_image_immediately_without_cache(const char *file);\n\nImlib_Image imlib_load_image_with_errno_return(const char *file,\n                                               int *error_return);\n\nImlib_Image imlib_load_image_fd(int fd, const char *file);\n\nImlib_Image imlib_load_image_mem(const char *file, const void *data,\n                                 size_t size);\n\nvoid imlib_free_image(void);\n\nvoid imlib_free_image_and_decache(void);\n\nint imlib_image_get_width(void);\n\nint imlib_image_get_height(void);\n\nconst char *imlib_image_get_filename(void);\n\nuint32_t *imlib_image_get_data(void);\n\nuint32_t *imlib_image_get_data_for_reading_only(void);\n\nvoid imlib_image_put_back_data(uint32_t *data);\n\nchar imlib_image_has_alpha(void);\n\nvoid imlib_image_set_changes_on_disk(void);\n\nvoid imlib_image_get_border(Imlib_Border *border);\n\nvoid imlib_image_set_border(Imlib_Border *border);\n\nvoid imlib_image_set_format(const char *format);\n\nvoid imlib_image_set_irrelevant_format(char irrelevant);\n\nchar *imlib_image_format(void);\n\nvoid imlib_image_set_has_alpha(char has_alpha);\n\nvoid imlib_image_query_pixel(int x, int y, Imlib_Color *color_return);\n\nvoid imlib_image_query_pixel_hsva(int x, int y, float *hue, float *saturation,\n                                  float *value, int *alpha);\n\nvoid imlib_image_query_pixel_hlsa(int x, int y, float *hue, float *lightness,\n                                  float *saturation, int *alpha);\n\nvoid imlib_image_query_pixel_cmya(int x, int y, int *cyan, int *magenta,\n                                  int *yellow, int *alpha);\n\n#ifndef X_DISPLAY_MISSING\n\nvoid imlib_render_pixmaps_for_whole_image(Pixmap *pixmap_return,\n                                          Pixmap *mask_return);\n\nvoid imlib_render_pixmaps_for_whole_image_at_size(Pixmap *pixmap_return,\n                                                  Pixmap *mask_return,\n                                                  int width, int height);\n\nvoid imlib_free_pixmap_and_mask(Pixmap pixmap);\n\nvoid imlib_render_image_on_drawable(int x, int y);\n\nvoid imlib_render_image_on_drawable_at_size(int x, int y, int width,\n                                            int height);\n\nvoid imlib_render_image_part_on_drawable_at_size(int source_x, int source_y,\n                                                 int source_width,\n                                                 int source_height, int x,\n                                                 int y, int width, int height);\n\nuint32_t imlib_render_get_pixel_color(void);\n\n#endif\n\nvoid imlib_blend_image_onto_image(Imlib_Image source_image, char merge_alpha,\n                                  int source_x, int source_y, int source_width,\n                                  int source_height, int destination_x,\n                                  int destination_y, int destination_width,\n                                  int destination_height);\n\nImlib_Image imlib_create_image(int width, int height);\n\nImlib_Image imlib_clone_image(void);\n\nImlib_Image imlib_create_cropped_image(int x, int y, int width, int height);\n\nImlib_Image imlib_create_cropped_scaled_image(int source_x, int source_y,\n                                              int source_width,\n                                              int source_height,\n                                              int destination_width,\n                                              int destination_height);\n\nImlib_Image imlib_create_image_using_data(int width, int height,\n                                          uint32_t *data);\n\nImlib_Image imlib_create_image_using_data_and_memory_function(\n    int width, int height, uint32_t *data,\n    Imlib_Image_Data_Memory_Function func);\n\nImlib_Image imlib_create_image_using_copied_data(int width, int height,\n                                                 uint32_t *data);\n\n#ifndef X_DISPLAY_MISSING\n\nImlib_Image imlib_create_image_from_drawable(Pixmap mask, int x, int y,\n                                             int width, int height,\n                                             char need_to_grab_x);\n\nImlib_Image imlib_create_image_from_ximage(XImage *image, XImage *mask, int x,\n                                           int y, int width, int height,\n                                           char need_to_grab_x);\n\nImlib_Image imlib_create_scaled_image_from_drawable(\n    Pixmap mask, int source_x, int source_y, int source_width,\n    int source_height, int destination_width, int destination_height,\n    char need_to_grab_x, char get_mask_from_shape);\n\nchar imlib_copy_drawable_to_image(Pixmap mask, int x, int y, int width,\n                                  int height, int destination_x,\n                                  int destination_y, char need_to_grab_x);\n\nint imlib_get_ximage_cache_count_used(void);\n\nint imlib_get_ximage_cache_count_max(void);\n\nvoid imlib_set_ximage_cache_count_max(int count);\n\nint imlib_get_ximage_cache_size_used(void);\n\nint imlib_get_ximage_cache_size_max(void);\n\nvoid imlib_set_ximage_cache_size_max(int bytes);\n\n#endif\n\nImlib_Updates imlib_updates_clone(Imlib_Updates updates);\n\nImlib_Updates imlib_update_append_rect(Imlib_Updates updates, int x, int y,\n                                       int w, int h);\n\nImlib_Updates imlib_updates_merge(Imlib_Updates updates, int w, int h);\n\nImlib_Updates imlib_updates_merge_for_rendering(Imlib_Updates updates, int w,\n                                                int h);\n\nvoid imlib_updates_free(Imlib_Updates updates);\n\nImlib_Updates imlib_updates_get_next(Imlib_Updates updates);\n\nvoid imlib_updates_get_coordinates(Imlib_Updates updates, int *x_return,\n                                   int *y_return, int *width_return,\n                                   int *height_return);\n\nvoid imlib_updates_set_coordinates(Imlib_Updates updates, int x, int y,\n                                   int width, int height);\n\nvoid imlib_render_image_updates_on_drawable(Imlib_Updates updates, int x,\n                                            int y);\n\nImlib_Updates imlib_updates_init(void);\n\nImlib_Updates imlib_updates_append_updates(Imlib_Updates updates,\n                                           Imlib_Updates appended_updates);\n\nvoid imlib_image_flip_horizontal(void);\n\nvoid imlib_image_flip_vertical(void);\n\nvoid imlib_image_flip_diagonal(void);\n\nvoid imlib_image_orientate(int orientation);\n\nvoid imlib_image_blur(int radius);\n\nvoid imlib_image_sharpen(int radius);\n\nvoid imlib_image_tile_horizontal(void);\n\nvoid imlib_image_tile_vertical(void);\n\nvoid imlib_image_tile(void);\n\nvoid imlib_image_copy_alpha_to_image(Imlib_Image image_source, int x, int y);\n\nvoid imlib_image_copy_alpha_rectangle_to_image(Imlib_Image image_source, int x,\n                                               int y, int width, int height,\n                                               int destination_x,\n                                               int destination_y);\n\nvoid imlib_image_scroll_rect(int x, int y, int width, int height, int delta_x,\n                             int delta_y);\n\nvoid imlib_image_copy_rect(int x, int y, int width, int height, int new_x,\n                           int new_y);\n\nImlib_Font imlib_load_font(const char *font_name);\n\nvoid imlib_free_font(void);\n\nint imlib_insert_font_into_fallback_chain(Imlib_Font font,\n                                          Imlib_Font fallback_font);\n\nvoid imlib_remove_font_from_fallback_chain(Imlib_Font fallback_font);\n\nImlib_Font imlib_get_prev_font_in_fallback_chain(Imlib_Font fn);\n\nImlib_Font imlib_get_next_font_in_fallback_chain(Imlib_Font fn);\n\nvoid imlib_text_draw(int x, int y, const char *text);\n\nvoid imlib_text_draw_with_return_metrics(int x, int y, const char *text,\n                                         int *width_return, int *height_return,\n                                         int *horizontal_advance_return,\n                                         int *vertical_advance_return);\n\nvoid imlib_get_text_size(const char *text, int *width_return,\n                         int *height_return);\n\nvoid imlib_get_text_advance(const char *text, int *horizontal_advance_return,\n                            int *vertical_advance_return);\n\nint imlib_get_text_inset(const char *text);\n\nvoid imlib_add_path_to_font_path(const char *path);\n\nvoid imlib_remove_path_from_font_path(const char *path);\n\nchar **imlib_list_font_path(int *number_return);\n\nint imlib_text_get_index_and_location(const char *text, int x, int y,\n                                      int *char_x_return, int *char_y_return,\n                                      int *char_width_return,\n                                      int *char_height_return);\n\nvoid imlib_text_get_location_at_index(const char *text, int index,\n                                      int *char_x_return, int *char_y_return,\n                                      int *char_width_return,\n                                      int *char_height_return);\n\nchar **imlib_list_fonts(int *number_return);\n\nvoid imlib_free_font_list(char **font_list, int number);\n\nint imlib_get_font_cache_size(void);\n\nvoid imlib_set_font_cache_size(int bytes);\n\nvoid imlib_flush_font_cache(void);\n\nint imlib_get_font_ascent(void);\n\nint imlib_get_font_descent(void);\n\nint imlib_get_maximum_font_ascent(void);\n\nint imlib_get_maximum_font_descent(void);\n\nImlib_Color_Modifier imlib_create_color_modifier(void);\n\nvoid imlib_free_color_modifier(void);\n\nvoid imlib_modify_color_modifier_gamma(double gamma_value);\n\nvoid imlib_modify_color_modifier_brightness(double brightness_value);\n\nvoid imlib_modify_color_modifier_contrast(double contrast_value);\n\nvoid imlib_set_color_modifier_tables(uint8_t *red_table, uint8_t *green_table,\n                                     uint8_t *blue_table, uint8_t *alpha_table);\n\nvoid imlib_get_color_modifier_tables(uint8_t *red_table, uint8_t *green_table,\n                                     uint8_t *blue_table, uint8_t *alpha_table);\n\nvoid imlib_reset_color_modifier(void);\n\nvoid imlib_apply_color_modifier(void);\n\nvoid imlib_apply_color_modifier_to_rectangle(int x, int y, int width,\n                                             int height);\n\nImlib_Updates imlib_image_draw_pixel(int x, int y, char make_updates);\n\nImlib_Updates imlib_image_draw_line(int x1, int y1, int x2, int y2,\n                                    char make_updates);\n\nvoid imlib_image_draw_rectangle(int x, int y, int width, int height);\n\nvoid imlib_image_fill_rectangle(int x, int y, int width, int height);\n\nImlibPolygon imlib_polygon_new(void);\n\nvoid imlib_polygon_free(ImlibPolygon poly);\n\nvoid imlib_polygon_add_point(ImlibPolygon poly, int x, int y);\n\nvoid imlib_image_draw_polygon(ImlibPolygon poly, unsigned char closed);\n\nvoid imlib_image_fill_polygon(ImlibPolygon poly);\n\nvoid imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, int *px2,\n                              int *py2);\n\nunsigned char imlib_polygon_contains_point(ImlibPolygon poly, int x, int y);\n\nvoid imlib_image_draw_ellipse(int xc, int yc, int a, int b);\n\nvoid imlib_image_fill_ellipse(int xc, int yc, int a, int b);\n\nImlib_Color_Range imlib_create_color_range(void);\n\nvoid imlib_free_color_range(void);\n\nvoid imlib_add_color_to_color_range(int distance_away);\n\nvoid imlib_image_fill_color_range_rectangle(int x, int y, int width, int height,\n                                            double angle);\n\nvoid imlib_image_fill_hsva_color_range_rectangle(int x, int y, int width,\n                                                 int height, double angle);\n\nvoid imlib_image_attach_data_value(\n    const char *key, void *data, int value,\n    Imlib_Data_Destructor_Function destructor_function);\n\nvoid *imlib_image_get_attached_data(const char *key);\n\nint imlib_image_get_attached_value(const char *key);\n\nvoid imlib_image_remove_attached_data_value(const char *key);\n\nvoid imlib_image_remove_and_free_attached_data_value(const char *key);\n\nvoid imlib_save_image(const char *filename);\n\nvoid imlib_save_image_with_errno_return(const char *filename,\n                                        int *error_return);\n\nImlib_Image imlib_create_rotated_image(double angle);\n\nvoid imlib_rotate_image_from_buffer(double angle, Imlib_Image source_image);\n\nvoid imlib_blend_image_onto_image_at_angle(Imlib_Image source_image,\n                                           char merge_alpha, int source_x,\n                                           int source_y, int source_width,\n                                           int source_height, int destination_x,\n                                           int destination_y, int angle_x,\n                                           int angle_y);\n\nvoid imlib_blend_image_onto_image_skewed(\n    Imlib_Image source_image, char merge_alpha, int source_x, int source_y,\n    int source_width, int source_height, int destination_x, int destination_y,\n    int h_angle_x, int h_angle_y, int v_angle_x, int v_angle_y);\n\n#ifndef X_DISPLAY_MISSING\n\nvoid imlib_render_image_on_drawable_skewed(int source_x, int source_y,\n                                           int source_width, int source_height,\n                                           int destination_x, int destination_y,\n                                           int h_angle_x, int h_angle_y,\n                                           int v_angle_x, int v_angle_y);\n\nvoid imlib_render_image_on_drawable_at_angle(\n    int source_x, int source_y, int source_width, int source_height,\n    int destination_x, int destination_y, int angle_x, int angle_y);\n\n#endif\n\nvoid imlib_image_filter(void);\n\nImlib_Filter imlib_create_filter(int initsize);\n\nvoid imlib_context_set_filter(Imlib_Filter filter);\n\nImlib_Filter imlib_context_get_filter(void);\n\nvoid imlib_free_filter(void);\n\nvoid imlib_filter_set(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_alpha(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_red(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_green(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_blue(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_constants(int a, int r, int g, int b);\nvoid imlib_filter_divisors(int a, int r, int g, int b);\n\nvoid imlib_image_clear(void);\n\nvoid imlib_image_clear_color(int r, int g, int b, int a);\n\ntypedef struct {\n  int frame_count;\n  int frame_num;\n  int canvas_w, canvas_h;\n  int frame_x, frame_y;\n  int frame_w, frame_h;\n  int frame_flags;\n  int frame_delay;\n  int loop_count;\n} Imlib_Frame_Info;\n\nImlib_Image imlib_load_image_frame(const char *file, int frame);\n\nImlib_Image imlib_load_image_frame_mem(const char *file, int frame,\n                                       const void *data, size_t size);\n\nvoid imlib_image_get_frame_info(Imlib_Frame_Info *info);\n\nconst char *imlib_strerror(int err);\n\ntypedef enum {\n  IMLIB_LOAD_ERROR_NONE,\n  IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST,\n  IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY,\n  IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ,\n  IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT,\n  IMLIB_LOAD_ERROR_PATH_TOO_LONG,\n  IMLIB_LOAD_ERROR_PATH_COMPONENT_NON_EXISTANT,\n  IMLIB_LOAD_ERROR_PATH_COMPONENT_NOT_DIRECTORY,\n  IMLIB_LOAD_ERROR_PATH_POINTS_OUTSIDE_ADDRESS_SPACE,\n  IMLIB_LOAD_ERROR_TOO_MANY_SYMBOLIC_LINKS,\n  IMLIB_LOAD_ERROR_OUT_OF_MEMORY,\n  IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS,\n  IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_WRITE,\n  IMLIB_LOAD_ERROR_OUT_OF_DISK_SPACE,\n  IMLIB_LOAD_ERROR_UNKNOWN,\n  IMLIB_LOAD_ERROR_IMAGE_READ,\n  IMLIB_LOAD_ERROR_IMAGE_FRAME\n} Imlib_Load_Error;\n\nImlib_Image imlib_load_image_with_error_return(const char *file,\n                                               Imlib_Load_Error *error_return);\n\nvoid imlib_save_image_with_error_return(const char *filename,\n                                        Imlib_Load_Error *error_return);\n\ntypedef enum {\n  IMLIB_TTF_ENCODING_ISO_8859_1,\n  IMLIB_TTF_ENCODING_ISO_8859_2,\n  IMLIB_TTF_ENCODING_ISO_8859_3,\n  IMLIB_TTF_ENCODING_ISO_8859_4,\n  IMLIB_TTF_ENCODING_ISO_8859_5\n} Imlib_TTF_Encoding;\n"
  },
  {
    "path": "lua/imlib2_old.pkg",
    "content": "$#define BUILD_X11 1\n$#include<Imlib2.h>\n$#include<X11/Xlib.h>\n$#define _userdata void *\n\ntypedef void *Imlib_Context;\ntypedef void *Imlib_Image;\ntypedef void *Imlib_Color_Modifier;\ntypedef void *Imlib_Updates;\ntypedef void *Imlib_Font;\ntypedef void *Imlib_Color_Range;\ntypedef void *Imlib_Filter;\ntypedef void *ImlibPolygon;\n\nenum _imlib_operation {\n  IMLIB_OP_COPY,\n  IMLIB_OP_ADD,\n  IMLIB_OP_SUBTRACT,\n  IMLIB_OP_RESHADE\n};\n\nenum _imlib_text_direction {\n  IMLIB_TEXT_TO_RIGHT = 0,\n  IMLIB_TEXT_TO_LEFT = 1,\n  IMLIB_TEXT_TO_DOWN = 2,\n  IMLIB_TEXT_TO_UP = 3,\n  IMLIB_TEXT_TO_ANGLE = 4\n};\n\nenum _imlib_load_error {\n  IMLIB_LOAD_ERROR_NONE,\n  IMLIB_LOAD_ERROR_FILE_DOES_NOT_EXIST,\n  IMLIB_LOAD_ERROR_FILE_IS_DIRECTORY,\n  IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_READ,\n  IMLIB_LOAD_ERROR_NO_LOADER_FOR_FILE_FORMAT,\n  IMLIB_LOAD_ERROR_PATH_TOO_LONG,\n  IMLIB_LOAD_ERROR_PATH_COMPONENT_NON_EXISTANT,\n  IMLIB_LOAD_ERROR_PATH_COMPONENT_NOT_DIRECTORY,\n  IMLIB_LOAD_ERROR_PATH_POINTS_OUTSIDE_ADDRESS_SPACE,\n  IMLIB_LOAD_ERROR_TOO_MANY_SYMBOLIC_LINKS,\n  IMLIB_LOAD_ERROR_OUT_OF_MEMORY,\n  IMLIB_LOAD_ERROR_OUT_OF_FILE_DESCRIPTORS,\n  IMLIB_LOAD_ERROR_PERMISSION_DENIED_TO_WRITE,\n  IMLIB_LOAD_ERROR_OUT_OF_DISK_SPACE,\n  IMLIB_LOAD_ERROR_UNKNOWN\n};\n\nenum _imlib_TTF_encoding {\n  IMLIB_TTF_ENCODING_ISO_8859_1,\n  IMLIB_TTF_ENCODING_ISO_8859_2,\n  IMLIB_TTF_ENCODING_ISO_8859_3,\n  IMLIB_TTF_ENCODING_ISO_8859_4,\n  IMLIB_TTF_ENCODING_ISO_8859_5\n};\n\ntypedef enum _imlib_operation Imlib_Operation;\ntypedef enum _imlib_load_error Imlib_Load_Error;\ntypedef enum _imlib_load_error ImlibLoadError;\ntypedef enum _imlib_text_direction Imlib_Text_Direction;\ntypedef enum _imlib_TTF_encoding Imlib_TTF_Encoding;\n\nstruct _imlib_border {\n  int left, right, top, bottom;\n};\ntypedef struct _imlib_border Imlib_Border;\n\nstruct _imlib_color {\n  int alpha, red, green, blue;\n};\ntypedef struct _imlib_color Imlib_Color;\n\nImlib_Context imlib_context_new(void);\nvoid imlib_context_free(Imlib_Context context);\n\nvoid imlib_context_push(Imlib_Context context);\nvoid imlib_context_pop(void);\nImlib_Context imlib_context_get(void);\n\nvoid imlib_context_set_display(Display *display);\nvoid imlib_context_disconnect_display(void);\nvoid imlib_context_set_visual(Visual *visual);\nvoid imlib_context_set_colormap(Colormap colormap);\nvoid imlib_context_set_drawable(Drawable drawable);\nvoid imlib_context_set_mask(Pixmap mask);\nvoid imlib_context_set_dither_mask(char dither_mask);\nvoid imlib_context_set_mask_alpha_threshold(int mask_alpha_threshold);\nvoid imlib_context_set_anti_alias(char anti_alias);\nvoid imlib_context_set_dither(char dither);\nvoid imlib_context_set_blend(char blend);\nvoid imlib_context_set_color_modifier(Imlib_Color_Modifier color_modifier);\nvoid imlib_context_set_operation(Imlib_Operation operation);\nvoid imlib_context_set_font(Imlib_Font font);\nvoid imlib_context_set_direction(Imlib_Text_Direction direction);\nvoid imlib_context_set_angle(double angle);\nvoid imlib_context_set_color(int red, int green, int blue, int alpha);\nvoid imlib_context_set_color_hsva(float hue, float saturation, float value,\n                                  int alpha);\nvoid imlib_context_set_color_hlsa(float hue, float lightness, float saturation,\n                                  int alpha);\nvoid imlib_context_set_color_cmya(int cyan, int magenta, int yellow, int alpha);\nvoid imlib_context_set_color_range(Imlib_Color_Range color_range);\nvoid imlib_context_set_progress_function(\n    Imlib_Progress_Function progress_function);\nvoid imlib_context_set_progress_granularity(char progress_granularity);\nvoid imlib_context_set_image(Imlib_Image image);\nvoid imlib_context_set_cliprect(int x, int y, int w, int h);\nvoid imlib_context_set_TTF_encoding(Imlib_TTF_Encoding encoding);\n\nDisplay *imlib_context_get_display(void);\nVisual *imlib_context_get_visual(void);\nColormap imlib_context_get_colormap(void);\nDrawable imlib_context_get_drawable(void);\nPixmap imlib_context_get_mask(void);\nchar imlib_context_get_dither_mask(void);\nchar imlib_context_get_anti_alias(void);\nint imlib_context_get_mask_alpha_threshold(void);\nchar imlib_context_get_dither(void);\nchar imlib_context_get_blend(void);\nImlib_Color_Modifier imlib_context_get_color_modifier(void);\nImlib_Operation imlib_context_get_operation(void);\nImlib_Font imlib_context_get_font(void);\ndouble imlib_context_get_angle(void);\nImlib_Text_Direction imlib_context_get_direction(void);\nvoid imlib_context_get_color(int *red, int *green, int *blue, int *alpha);\nvoid imlib_context_get_color_hsva(float *hue, float *saturation, float *value,\n                                  int *alpha);\nvoid imlib_context_get_color_hlsa(float *hue, float *lightness,\n                                  float *saturation, int *alpha);\nvoid imlib_context_get_color_cmya(int *cyan, int *magenta, int *yellow,\n                                  int *alpha);\nImlib_Color *imlib_context_get_imlib_color(void);\nImlib_Color_Range imlib_context_get_color_range(void);\nImlib_Progress_Function imlib_context_get_progress_function(void);\nchar imlib_context_get_progress_granularity(void);\nImlib_Image imlib_context_get_image(void);\nvoid imlib_context_get_cliprect(int *x, int *y, int *w, int *h);\nImlib_TTF_Encoding imlib_context_get_TTF_encoding(void);\n\nint imlib_get_cache_size(void);\nvoid imlib_set_cache_size(int bytes);\nint imlib_get_color_usage(void);\nvoid imlib_set_color_usage(int max);\nvoid imlib_flush_loaders(void);\nint imlib_get_visual_depth(Display *display, Visual *visual);\nVisual *imlib_get_best_visual(Display *display, int screen, int *depth_return);\n\nImlib_Image imlib_load_image(const char *file);\nImlib_Image imlib_load_image_immediately(const char *file);\nImlib_Image imlib_load_image_without_cache(const char *file);\nImlib_Image imlib_load_image_immediately_without_cache(const char *file);\nImlib_Image imlib_load_image_with_error_return(const char *file,\n                                               Imlib_Load_Error *error_return);\nvoid imlib_free_image(void);\nvoid imlib_free_image_and_decache(void);\n\nint imlib_image_get_width(void);\nint imlib_image_get_height(void);\nconst char *imlib_image_get_filename(void);\nint *imlib_image_get_data(void);\nint *imlib_image_get_data_for_reading_only(void);\nvoid imlib_image_put_back_data(unsigned int *data);\nchar imlib_image_has_alpha(void);\nvoid imlib_image_set_changes_on_disk(void);\nvoid imlib_image_get_border(Imlib_Border *border);\nvoid imlib_image_set_border(Imlib_Border *border);\nvoid imlib_image_set_format(const char *format);\nvoid imlib_image_set_irrelevant_format(char irrelevant);\nvoid imlib_image_set_irrelevant_border(char irrelevant);\nvoid imlib_image_set_irrelevant_alpha(char irrelevant);\nchar *imlib_image_format(void);\nvoid imlib_image_set_has_alpha(char has_alpha);\nvoid imlib_image_query_pixel(int x, int y, Imlib_Color *color_return);\nvoid imlib_image_query_pixel_hsva(int x, int y, float *hue, float *saturation,\n                                  float *value, int *alpha);\nvoid imlib_image_query_pixel_hlsa(int x, int y, float *hue, float *lightness,\n                                  float *saturation, int *alpha);\nvoid imlib_image_query_pixel_cmya(int x, int y, int *cyan, int *magenta,\n                                  int *yellow, int *alpha);\n\nvoid imlib_render_pixmaps_for_whole_image(Pixmap *pixmap_return,\n                                          Pixmap *mask_return);\nvoid imlib_render_pixmaps_for_whole_image_at_size(Pixmap *pixmap_return,\n                                                  Pixmap *mask_return,\n                                                  int width, int height);\nvoid imlib_free_pixmap_and_mask(Pixmap pixmap);\nvoid imlib_render_image_on_drawable(int x, int y);\nvoid imlib_render_image_on_drawable_at_size(int x, int y, int width,\n                                            int height);\nvoid imlib_render_image_part_on_drawable_at_size(int source_x, int source_y,\n                                                 int source_width,\n                                                 int source_height, int x,\n                                                 int y, int width, int height);\nunsigned int imlib_render_get_pixel_color(void);\nvoid imlib_blend_image_onto_image(Imlib_Image source_image, char merge_alpha,\n                                  int source_x, int source_y, int source_width,\n                                  int source_height, int destination_x,\n                                  int destination_y, int destination_width,\n                                  int destination_height);\n\nImlib_Image imlib_create_image(int width, int height);\nImlib_Image imlib_create_image_using_data(int width, int height,\n                                          unsigned int *data);\nImlib_Image imlib_create_image_using_copied_data(int width, int height,\n                                                 unsigned int *data);\nImlib_Image imlib_create_image_from_drawable(Pixmap mask, int x, int y,\n                                             int width, int height,\n                                             char need_to_grab_x);\nImlib_Image imlib_create_image_from_ximage(XImage *image, XImage *mask, int x,\n                                           int y, int width, int height,\n                                           char need_to_grab_x);\nImlib_Image imlib_create_scaled_image_from_drawable(\n    Pixmap mask, int source_x, int source_y, int source_width,\n    int source_height, int destination_width, int destination_height,\n    char need_to_grab_x, char get_mask_from_shape);\nchar imlib_copy_drawable_to_image(Pixmap mask, int x, int y, int width,\n                                  int height, int destination_x,\n                                  int destination_y, char need_to_grab_x);\nImlib_Image imlib_clone_image(void);\nImlib_Image imlib_create_cropped_image(int x, int y, int width, int height);\nImlib_Image imlib_create_cropped_scaled_image(int source_x, int source_y,\n                                              int source_width,\n                                              int source_height,\n                                              int destination_width,\n                                              int destination_height);\n\nImlib_Updates imlib_updates_clone(Imlib_Updates updates);\nImlib_Updates imlib_update_append_rect(Imlib_Updates updates, int x, int y,\n                                       int w, int h);\nImlib_Updates imlib_updates_merge(Imlib_Updates updates, int w, int h);\nImlib_Updates imlib_updates_merge_for_rendering(Imlib_Updates updates, int w,\n                                                int h);\nvoid imlib_updates_free(Imlib_Updates updates);\nImlib_Updates imlib_updates_get_next(Imlib_Updates updates);\nvoid imlib_updates_get_coordinates(Imlib_Updates updates, int *x_return,\n                                   int *y_return, int *width_return,\n                                   int *height_return);\nvoid imlib_updates_set_coordinates(Imlib_Updates updates, int x, int y,\n                                   int width, int height);\nvoid imlib_render_image_updates_on_drawable(Imlib_Updates updates, int x,\n                                            int y);\nImlib_Updates imlib_updates_init(void);\nImlib_Updates imlib_updates_append_updates(Imlib_Updates updates,\n                                           Imlib_Updates appended_updates);\n\nvoid imlib_image_flip_horizontal(void);\nvoid imlib_image_flip_vertical(void);\nvoid imlib_image_flip_diagonal(void);\nvoid imlib_image_orientate(int orientation);\nvoid imlib_image_blur(int radius);\nvoid imlib_image_sharpen(int radius);\nvoid imlib_image_tile_horizontal(void);\nvoid imlib_image_tile_vertical(void);\nvoid imlib_image_tile(void);\n\nImlib_Font imlib_load_font(const char *font_name);\nvoid imlib_free_font(void);\nint imlib_insert_font_into_fallback_chain(Imlib_Font font,\n                                          Imlib_Font fallback_font);\nvoid imlib_remove_font_from_fallback_chain(Imlib_Font fallback_font);\nImlib_Font imlib_get_prev_font_in_fallback_chain(Imlib_Font fn);\nImlib_Font imlib_get_next_font_in_fallback_chain(Imlib_Font fn);\nvoid imlib_text_draw(int x, int y, const char *text);\nvoid imlib_text_draw_with_return_metrics(int x, int y, const char *text,\n                                         int *width_return, int *height_return,\n                                         int *horizontal_advance_return,\n                                         int *vertical_advance_return);\nvoid imlib_get_text_size(const char *text, int *width_return,\n                         int *height_return);\nvoid imlib_get_text_advance(const char *text, int *horizontal_advance_return,\n                            int *vertical_advance_return);\nint imlib_get_text_inset(const char *text);\nvoid imlib_add_path_to_font_path(const char *path);\nvoid imlib_remove_path_from_font_path(const char *path);\nchar **imlib_list_font_path(int *number_return);\nint imlib_text_get_index_and_location(const char *text, int x, int y,\n                                      int *char_x_return, int *char_y_return,\n                                      int *char_width_return,\n                                      int *char_height_return);\nvoid imlib_text_get_location_at_index(const char *text, int index,\n                                      int *char_x_return, int *char_y_return,\n                                      int *char_width_return,\n                                      int *char_height_return);\nchar **imlib_list_fonts(int *number_return);\nvoid imlib_free_font_list(char **font_list, int number);\nint imlib_get_font_cache_size(void);\nvoid imlib_set_font_cache_size(int bytes);\nvoid imlib_flush_font_cache(void);\nint imlib_get_font_ascent(void);\nint imlib_get_font_descent(void);\nint imlib_get_maximum_font_ascent(void);\nint imlib_get_maximum_font_descent(void);\n\nImlib_Color_Modifier imlib_create_color_modifier(void);\nvoid imlib_free_color_modifier(void);\nvoid imlib_modify_color_modifier_gamma(double gamma_value);\nvoid imlib_modify_color_modifier_brightness(double brightness_value);\nvoid imlib_modify_color_modifier_contrast(double contrast_value);\nvoid imlib_set_color_modifier_tables(unsigned char *red_table,\n                                     unsigned char *green_table,\n                                     unsigned char *blue_table,\n                                     unsigned char *alpha_table);\nvoid imlib_get_color_modifier_tables(unsigned char *red_table,\n                                     unsigned char *green_table,\n                                     unsigned char *blue_table,\n                                     unsigned char *alpha_table);\nvoid imlib_reset_color_modifier(void);\nvoid imlib_apply_color_modifier(void);\nvoid imlib_apply_color_modifier_to_rectangle(int x, int y, int width,\n                                             int height);\n\nImlib_Updates imlib_image_draw_pixel(int x, int y, char make_updates);\nImlib_Updates imlib_image_draw_line(int x1, int y1, int x2, int y2,\n                                    char make_updates);\nvoid imlib_image_draw_rectangle(int x, int y, int width, int height);\nvoid imlib_image_fill_rectangle(int x, int y, int width, int height);\nvoid imlib_image_copy_alpha_to_image(Imlib_Image image_source, int x, int y);\nvoid imlib_image_copy_alpha_rectangle_to_image(Imlib_Image image_source, int x,\n                                               int y, int width, int height,\n                                               int destination_x,\n                                               int destination_y);\nvoid imlib_image_scroll_rect(int x, int y, int width, int height, int delta_x,\n                             int delta_y);\nvoid imlib_image_copy_rect(int x, int y, int width, int height, int new_x,\n                           int new_y);\n\nImlibPolygon imlib_polygon_new(void);\nvoid imlib_polygon_free(ImlibPolygon poly);\nvoid imlib_polygon_add_point(ImlibPolygon poly, int x, int y);\nvoid imlib_image_draw_polygon(ImlibPolygon poly, unsigned char closed);\nvoid imlib_image_fill_polygon(ImlibPolygon poly);\nvoid imlib_polygon_get_bounds(ImlibPolygon poly, int *px1, int *py1, int *px2,\n                              int *py2);\nunsigned char imlib_polygon_contains_point(ImlibPolygon poly, int x, int y);\n\nvoid imlib_image_draw_ellipse(int xc, int yc, int a, int b);\nvoid imlib_image_fill_ellipse(int xc, int yc, int a, int b);\n\nImlib_Color_Range imlib_create_color_range(void);\nvoid imlib_free_color_range(void);\nvoid imlib_add_color_to_color_range(int distance_away);\nvoid imlib_image_fill_color_range_rectangle(int x, int y, int width, int height,\n                                            double angle);\nvoid imlib_image_fill_hsva_color_range_rectangle(int x, int y, int width,\n                                                 int height, double angle);\n\nvoid imlib_image_attach_data_value(\n    const char *key, void *data, int value,\n    Imlib_Data_Destructor_Function destructor_function);\nvoid *imlib_image_get_attached_data(const char *key);\nint imlib_image_get_attached_value(const char *key);\nvoid imlib_image_remove_attached_data_value(const char *key);\nvoid imlib_image_remove_and_free_attached_data_value(const char *key);\n\nvoid imlib_save_image(const char *filename);\nvoid imlib_save_image_with_error_return(const char *filename,\n                                        Imlib_Load_Error *error_return);\n\nImlib_Image imlib_create_rotated_image(double angle);\n\nvoid imlib_rotate_image_from_buffer(double angle, Imlib_Image source_image);\n\nvoid imlib_blend_image_onto_image_at_angle(Imlib_Image source_image,\n                                           char merge_alpha, int source_x,\n                                           int source_y, int source_width,\n                                           int source_height, int destination_x,\n                                           int destination_y, int angle_x,\n                                           int angle_y);\nvoid imlib_blend_image_onto_image_skewed(\n    Imlib_Image source_image, char merge_alpha, int source_x, int source_y,\n    int source_width, int source_height, int destination_x, int destination_y,\n    int h_angle_x, int h_angle_y, int v_angle_x, int v_angle_y);\nvoid imlib_render_image_on_drawable_skewed(int source_x, int source_y,\n                                           int source_width, int source_height,\n                                           int destination_x, int destination_y,\n                                           int h_angle_x, int h_angle_y,\n                                           int v_angle_x, int v_angle_y);\nvoid imlib_render_image_on_drawable_at_angle(\n    int source_x, int source_y, int source_width, int source_height,\n    int destination_x, int destination_y, int angle_x, int angle_y);\n\nvoid imlib_image_filter(void);\nImlib_Filter imlib_create_filter(int initsize);\nvoid imlib_context_set_filter(Imlib_Filter filter);\nImlib_Filter imlib_context_get_filter(void);\nvoid imlib_free_filter(void);\nvoid imlib_filter_set(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_alpha(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_red(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_green(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_set_blue(int xoff, int yoff, int a, int r, int g, int b);\nvoid imlib_filter_constants(int a, int r, int g, int b);\nvoid imlib_filter_divisors(int a, int r, int g, int b);\n\nvoid imlib_image_clear(void);\nvoid imlib_image_clear_color(int r, int g, int b, int a);\n"
  },
  {
    "path": "lua/libcairo-helper.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _LIBCAIRO_HELPER_H_\n#define _LIBCAIRO_HELPER_H_\n\n#include <cairo.h>\n#include <cstdlib>\n\ncairo_text_extents_t *create_cairo_text_extents_t(void) {\n  return (cairo_text_extents_t *)calloc(1, sizeof(cairo_text_extents_t));\n}\n\ncairo_font_extents_t *create_cairo_font_extents_t(void) {\n  return (cairo_font_extents_t *)calloc(1, sizeof(cairo_font_extents_t));\n}\n\ncairo_matrix_t *create_cairo_matrix_t(void) {\n  return (cairo_matrix_t *)calloc(1, sizeof(cairo_matrix_t));\n}\n\nvoid destroy_cairo_text_extents_t(cairo_text_extents_t *pointer) {\n  free(pointer);\n}\n\nvoid destroy_cairo_font_extents_t(cairo_font_extents_t *pointer) {\n  free(pointer);\n}\n\nvoid destroy_cairo_matrix_t(cairo_matrix_t *pointer) { free(pointer); }\n\n#endif /* _LIBCAIRO_HELPER_H_ */\n"
  },
  {
    "path": "lua/libcairo.patch",
    "content": "--- lua/libcairo.c~\t2010-06-11 23:14:43.000000000 +0200\n+++ lua/libcairo.c\t2010-06-12 10:47:51.000000000 +0200\n@@ -1452,12 +1452,12 @@\n #endif\n  {\n   struct _cairo* cr = (( struct _cairo*)  tolua_tousertype(tolua_S,1,0));\n+  int num_dashes = ((int)  tolua_tonumber(tolua_S,3,0));\n #ifdef __cplusplus\n   double* dashes = Mtolua_new_dim(double, num_dashes);\n #else\n   double* dashes = (double*) malloc((num_dashes)*sizeof(double));\n #endif\n-  int num_dashes = ((int)  tolua_tonumber(tolua_S,3,0));\n   double offset = ((double)  tolua_tonumber(tolua_S,4,0));\n   {\n #ifndef TOLUA_RELEASE\n"
  },
  {
    "path": "lua/libcairo_imlib2_helper.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *  (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _LIBCAIRO_IMAGE_HELPER_H_\n#define _LIBCAIRO_IMAGE_HELPER_H_\n\n#include <Imlib2.h>\n#include <cairo.h>\n\n#include \"logging.h\"\n\nvoid cairo_place_image(const char *file, cairo_t *cr, int x, int y,\n                       int width, int height, double alpha) {\n  int w, h, stride;\n  Imlib_Image alpha_image, image, premul;\n  cairo_surface_t *result;\n\n  if (!file) {\n    NORM_ERR(\"cairoimagehelper: File is NULL\\n\");\n    return;\n  }\n\n  if (!cr) {\n    NORM_ERR(\"cairoimagehelper: cairo_t is NULL\\n\");\n    return;\n  }\n\n  image = (Imlib_Image *)imlib_load_image(file);\n  if (!image) {\n    NORM_ERR(\"cairoimagehelper: Couldn't load %s\\n\", file);\n    return;\n  }\n\n  imlib_context_set_image(image);\n  w = imlib_image_get_width();\n  h = imlib_image_get_height();\n\n  if ((w <= 0) && (h <= 0)) {\n    NORM_ERR(\"cairoimagehelper: %s has 0 size\\n\", file);\n    return;\n  }\n\n  alpha_image = imlib_create_cropped_scaled_image(0, 0, w, h, width, height);\n\n  /* create temporary image */\n  premul = imlib_create_image(width, height);\n  if (!premul) {\n    NORM_ERR(\"cairoimagehelper: Couldn't create premul image for %s\\n\", file);\n    return;\n  }\n\n  /* fill with opaque black */\n  imlib_context_set_image(premul);\n  imlib_context_set_color(0, 0, 0, 255);\n  imlib_image_fill_rectangle(0, 0, width, height);\n\n  /* blend source image on top -\n   * in effect this multiplies the rgb values by alpha */\n  imlib_blend_image_onto_image(image, 0, 0, 0, w, h, 0, 0, width, height);\n\n  /* and use the alpha channel of the source image */\n  imlib_image_copy_alpha_to_image(alpha_image, 0, 0);\n\n  stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, width);\n\n  /* now pass the result to cairo */\n  result = cairo_image_surface_create_for_data(\n      (unsigned char  *)imlib_image_get_data_for_reading_only(), CAIRO_FORMAT_ARGB32,\n      width, height, stride);\n\n  cairo_set_source_surface(cr, result, x, y);\n  cairo_paint_with_alpha(cr, alpha);\n\n  imlib_context_set_image(alpha_image);\n  imlib_free_image();\n  imlib_context_set_image(image);\n  imlib_free_image();\n  imlib_context_set_image(premul);\n  imlib_free_image();\n\n  cairo_surface_destroy(result);\n\n}\n\nvoid cairo_draw_image(const char *file, cairo_surface_t *cs, int x, int y,\n                      double scale_x, double scale_y, double *return_scale_w,\n                      double *return_scale_h) {\n  cairo_t *cr;\n  int w, h;\n  double scaled_w, scaled_h;\n\n  if (!file) {\n    NORM_ERR(\"cairoimagehelper: File is NULL\\n\");\n    return;\n  }\n\n  if (!cs) {\n    NORM_ERR(\"cairoimagehelper: Surface is NULL\\n\");\n    return;\n  }\n\n  if ((scale_x <= 0.0) && (scale_y <= 0.0)) {\n    NORM_ERR(\"cairoimagehelper: Image Scale is 0, %s\\n\", file);\n    return;\n  }\n\n  Imlib_Image *image = (Imlib_Image *)imlib_load_image(file);\n  if (!image) {\n    NORM_ERR(\"cairoimagehelper: Couldn't load %s\\n\", file);\n    return;\n  }\n\n  imlib_context_set_image(image);\n  w = imlib_image_get_width();\n  h = imlib_image_get_height();\n\n  if ((w <= 0) && (h <= 0)) {\n    NORM_ERR(\"cairoimagehelper: %s has 0 size\\n\", file);\n    return;\n  }\n\n  scaled_w = *return_scale_w = scale_x * (double)w;\n  scaled_h = *return_scale_h = scale_y * (double)h;\n\n  if ((scaled_w <= 0.0) && (scaled_h <= 0.0)) {\n    NORM_ERR(\"cairoimagehelper: %s scaled image has 0 size\\n\", file);\n    return;\n  }\n\n  cr = cairo_create(cs);\n  cairo_place_image(file, cr, x, y, scaled_w, scaled_h, 1.0);\n  imlib_context_set_image(image);\n  imlib_free_image_and_decache();\n\n  cairo_destroy(cr);\n}\n\n#endif /* _LIBCAIRO_IMAGE_HELPER_H_ */\n"
  },
  {
    "path": "lua/libcairo_text_helper.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2025 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _LIBCAIRO_TEXT_HELPER_H_\n#define _LIBCAIRO_TEXT_HELPER_H_\n\n#include <cairo/cairo-ft.h>\n#include <cairo/cairo.h>\n\n#include <fontconfig/fontconfig.h>\n\n#include <ft2build.h>\n#include FT_FREETYPE_H\n#include <freetype/ftadvanc.h>\n#include <freetype/ftlcdfil.h>\n#include <freetype/ftsnames.h>\n#include <freetype/tttables.h>\n\n#include <harfbuzz/hb-ft.h>\n#include <harfbuzz/hb-glib.h>\n#include <harfbuzz/hb.h>\n\n#define max_fonts 4096\n#define max_font_name_len 4096\n\ntypedef struct _FontData {\n  char name[max_font_name_len];\n  cairo_font_face_t *cairo_ft_face;\n  hb_font_t *hb_ft_font;\n  hb_face_t *hb_ft_face;\n  int font_size;\n  /* Internally the following two are pointers */\n  /* Stored here so they can be freed later */\n  FT_Library ft_library;\n  FT_Face ft_face;\n} FontData;\n\nFontData *font_cache[max_fonts] = {NULL};\n\ntypedef enum _cairo_text_alignment {\n  CAIRO_TEXT_ALIGN_LEFT = 0,\n  CAIRO_TEXT_ALIGN_RIGHT,\n  CAIRO_TEXT_ALIGN_CENTER\n} cairo_text_alignment_t;\n\n/* Imports a font from a file */\nFontData *cairo_text_hp_import_font(const char *font, int font_size) {\n  /* Fontconfig will take a font name and return the file with */\n  /* the best match as Freetype only works directly with font files */\n\n  FcInit();\n  FcConfig *config = FcInitLoadConfigAndFonts();\n\n  // crash here\n  if (!font) {\n    printf(\"Error: cairo_text font not set.\\n\");\n    return NULL;\n  }\n  FcPattern *pat = FcNameParse((const FcChar8 *)font);\n  FcConfigSubstitute(config, pat, FcMatchPattern);\n  FcDefaultSubstitute(pat);\n\n  FcResult result;\n  FcPattern *font_pat = FcFontMatch(config, pat, &result);\n\n  /* Will be freed with font */\n  FcChar8 *file = NULL;\n  FcPatternGetString(font_pat, FC_FILE, 0, &file);\n\n  if (!file) {\n    /* FIXME: add error handling */\n    printf(\"Error: cairo_text couldn't find font.\\n\");\n    return NULL;\n  }\n\n  FontData *font_data = (FontData *)malloc(sizeof(struct _FontData));\n\n  strncpy(font_data->name, font, max_font_name_len);\n\n  /* Load the font */\n  FT_Init_FreeType(&font_data->ft_library);\n  FT_Library_SetLcdFilter(font_data->ft_library, FT_LCD_FILTER_DEFAULT);\n  FT_New_Face(font_data->ft_library, (char *)file, 0, &font_data->ft_face);\n  FT_Set_Char_Size(font_data->ft_face, font_size * 64, font_size * 64, 0, 0);\n\n  /* Store font data for use later */\n  font_data->cairo_ft_face = cairo_font_face_reference(\n      cairo_ft_font_face_create_for_ft_face(font_data->ft_face, 0));\n  font_data->hb_ft_font = hb_ft_font_create(font_data->ft_face, NULL);\n  font_data->hb_ft_face = hb_ft_face_create(font_data->ft_face, NULL);\n  font_data->font_size = font_size;\n\n  /* Cleanup font config */\n  FcPatternDestroy(font_pat);\n  FcPatternDestroy(pat);\n  FcConfigDestroy(config);\n  /* FIXME: Crashes */\n  /*FcFini(); */\n\n  return font_data;\n}\n\n/* Either loads font from cache or imports from a file */\nFontData *cairo_text_hp_load_font(const char *font, int font_size) {\n  FontData *font_data = NULL;\n\n  /* Search for font in cache */\n  for (int i = 0; i < max_fonts; i++) {\n    if (font_cache[i] == NULL) {\n      /* Haven't used this font yet so load and cache it */\n      font_data = cairo_text_hp_import_font(font, font_size);\n      font_cache[i] = font_data;\n      return font_data;\n    }\n    if ((strncmp(font_cache[i]->name, font, max_font_name_len) == 0) &&\n        (font_size == font_cache[i]->font_size)) {\n      font_data = font_cache[i];\n      return font_data;\n    }\n  }\n\n  return font_data;\n}\n\nvoid cairo_text_hp_destroy_font(FontData *font) {\n  cairo_font_face_destroy(font->cairo_ft_face);\n  cairo_font_face_destroy(font->cairo_ft_face);\n  hb_font_destroy(font->hb_ft_font);\n  hb_face_destroy(font->hb_ft_face);\n\n  FT_Done_Face(font->ft_face);\n  FT_Done_FreeType(font->ft_library);\n\n  free(font);\n}\n\nvoid cairo_text_hp_delete_fonts() {\n  for (int i = 0; (i < max_fonts) && (font_cache[i] != NULL); i++) {\n    cairo_text_hp_destroy_font(font_cache[i]);\n  }\n}\n\n/*\n * Direction calls hb_direction_from_string example values are LTR and RTL\n *   https://harfbuzz.github.io/harfbuzz-hb-common.html#hb-direction-from-string\n * Script is an ISO 15924 4 character string, \"Zyyy\" can be used for \"Common\"\n * and \"Zinh\" for \"Inherited\".\n *  https://harfbuzz.github.io/harfbuzz-hb-common.html#hb-script-from-string\n * Language is a BCP 47 language tag. eg \"en\" or \"en-US\"\n */\nvoid cairo_text_hp_show(cairo_t *cr, int x, int y, const char *text,\n                        const char *font, int font_size,\n                        cairo_text_alignment_t alignment, const char *language,\n                        const char *script, const char *direction) {\n  /* It seems that lua may just pass NULL for an empty string */\n  if (text == NULL) {\n    printf(\"Error: CairoTextHelper: TextShow: Null string\\n\");\n    return;\n  }\n  if (font == NULL) {\n    printf(\"Error: CairoTextHelper: TextShow: Null Font\\n\");\n    return;\n  }\n  if (font_size <= 1) {\n    printf(\"Error: CairoTextHelper: TextShow: Font Size less then 1\\n\");\n    return;\n  }\n\n  FontData *font_data = cairo_text_hp_load_font(font, font_size);\n\n  /* If we reach here without font data then we have cached too many fonts */\n  if (font_data == NULL) {\n    printf(\"Error: CairoTextHelper: TextShow: Used too many fonts\\n\");\n    return;\n  }\n\n  double x1, x2, y1, y2;\n\n  cairo_clip_extents(cr, &x1, &y1, &x2, &y2);\n\n  int width = x2 - x1;\n  int height = y2 - y1;\n\n  hb_language_t text_language;\n  hb_direction_t text_direction;\n  if (language != NULL) {\n    text_language = hb_language_from_string(language, -1);\n  } else {\n    /* Use en as the default as if you are sharing configs with other */\n    /* people, you don't want them to break if they use a different lang */\n    text_language = hb_language_from_string(\"en\", -1);\n  }\n\n  hb_script_t text_script = hb_script_from_string(script, -1);\n  if (text_script == HB_SCRIPT_UNKNOWN) { text_script = HB_SCRIPT_COMMON; }\n\n  if (direction != NULL) {\n    text_direction = hb_direction_from_string(direction, -1);\n  } else {\n    text_direction = hb_script_get_horizontal_direction(text_script);\n  }\n  /* Note Direction can be invalid if user passes something invalid */\n  /* or if the script can be Vertical or Horizontal */\n  if (text_direction == HB_DIRECTION_INVALID) {\n    text_direction = HB_DIRECTION_LTR;\n  }\n\n  /* Draw text */\n  /* Create a buffer for harfbuzz to use */\n  hb_buffer_t *buf = hb_buffer_create();\n\n  // alternatively you can use hb_buffer_set_unicode_funcs(buf,\n  // hb_glib_get_unicode_funcs());\n  hb_buffer_set_unicode_funcs(buf, hb_glib_get_unicode_funcs());\n  hb_buffer_set_language(buf, text_language);\n  if (script != NULL) {\n    hb_buffer_set_script(buf, text_script); /* see hb-common.h */\n  } else {\n    hb_buffer_guess_segment_properties(buf);\n  }\n  hb_buffer_set_direction(buf, text_direction); /* or LTR */\n\n  /* Layout the text */\n  hb_buffer_add_utf8(buf, text, strlen(text), 0, strlen(text));\n  hb_shape(font_data->hb_ft_font, buf, NULL, 0);\n\n  /* Need to calculate the Baseline for drawing on the y axis */\n  hb_font_extents_t font_extents;\n  hb_font_get_extents_for_direction(font_data->hb_ft_font, text_direction,\n                                    &font_extents);\n\n  /* Note Line Gap was always 0 in my testing */\n  int baseline_offset =\n      font_extents.ascender / 64 + 0.5 * font_extents.line_gap / 64 + 1;\n\n  /* Hand the layout to cairo to render */\n  unsigned int glyph_count;\n  hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);\n  hb_glyph_position_t *glyph_pos =\n      hb_buffer_get_glyph_positions(buf, &glyph_count);\n  cairo_glyph_t *cairo_glyphs =\n      (cairo_glyph_t *)malloc(sizeof(cairo_glyph_t) * glyph_count);\n\n  /* RTL positioning seems to be slightly off and characters don't link as they\n   * should */\n  /* This hack gets it significantly closer to correct but is not 100% for all\n   * fonts and sizes */\n  int rtl_fix = font_data->font_size / 10;\n\n  unsigned int string_width_in_pixels = 0;\n  for (int i = 0; i < glyph_count; ++i) {\n    if (HB_DIRECTION_IS_VERTICAL(text_direction)) {\n      int glyph_width = glyph_pos[i].x_offset / 64 * -1;\n      if (glyph_width > string_width_in_pixels) {\n        string_width_in_pixels = glyph_width;\n      }\n    } else {\n      string_width_in_pixels += glyph_pos[i].x_advance / 64;\n      if (text_direction == HB_DIRECTION_RTL) {\n        string_width_in_pixels -= rtl_fix;\n      }\n    }\n  }\n  /* More RTL Hacks */\n  if (text_direction == HB_DIRECTION_RTL) { string_width_in_pixels += 2; }\n  int draw_x = x;\n  int draw_y = y;\n\n  if (HB_DIRECTION_IS_VERTICAL(text_direction)) {\n    if (alignment == CAIRO_TEXT_ALIGN_LEFT) {\n      draw_x = x + string_width_in_pixels;\n    } else if (alignment == CAIRO_TEXT_ALIGN_RIGHT) {\n      draw_x = width - string_width_in_pixels + x;\n    } else {\n      draw_x = width / 2 - string_width_in_pixels + x;\n    }\n  } else {\n    draw_y = baseline_offset + y;\n    if (alignment == CAIRO_TEXT_ALIGN_LEFT) {\n      if (text_direction == HB_DIRECTION_RTL) {\n        draw_x = width - x - string_width_in_pixels;\n      }\n      // LTR handled as default.\n    } else if (alignment == CAIRO_TEXT_ALIGN_RIGHT) {\n      if (text_direction == HB_DIRECTION_RTL) {\n        draw_x = x;\n      } else {\n        draw_x = width - x - string_width_in_pixels;\n      }\n    } else if (alignment == CAIRO_TEXT_ALIGN_CENTER) {\n      draw_x = width / 2 - string_width_in_pixels / 2 + x;\n    }\n  }\n\n  // Reset x/y now that draw_x is set\n  x = 0;\n  y = 0;\n\n  for (int i = 0; i < glyph_count; ++i) {\n    cairo_glyphs[i].index = glyph_info[i].codepoint;\n    cairo_glyphs[i].x = x + draw_x + (glyph_pos[i].x_offset / 64.0);\n    cairo_glyphs[i].y = y + draw_y - (glyph_pos[i].y_offset / 64.0);\n    x += glyph_pos[i].x_advance / 64.0;\n    if (text_direction == HB_DIRECTION_RTL) { x -= rtl_fix; }\n    y -= glyph_pos[i].y_advance / 64.0;\n  }\n\n  cairo_set_font_face(cr, font_data->cairo_ft_face);\n  cairo_set_font_size(cr, font_data->font_size);\n  // Use glyph path and fill_preserve so its possible to add borders etc from\n  // lua after\n  cairo_glyph_path(cr, cairo_glyphs, glyph_count);\n  cairo_fill_preserve(cr);\n\n  free(cairo_glyphs);\n  hb_buffer_destroy(buf);\n}\n\nvoid cairo_text_hp_text_size(const char *text, const char *font, int font_size,\n                             const char *language, const char *script,\n                             const char *direction, int *width, int *height) {\n  /* It seems that lua may just pass NULL for an empty string */\n  if (text == NULL) {\n    printf(\"Error: CairoTextHelper: TextSize: Null string\\n\");\n    return;\n  }\n  if (font == NULL) {\n    printf(\"Error: CairoTextHelper: TextSize: Null Font\\n\");\n    return;\n  }\n  if (font_size <= 1) {\n    printf(\"Error: CairoTextHelper: TextSize: Font Size less then 1\\n\");\n    return;\n  }\n\n  FontData *font_data = cairo_text_hp_load_font(font, font_size);\n\n  /* If we reach here without font data then we have cached too many fonts */\n  if (font_data == NULL) {\n    printf(\"Error: CairoTextHelper: TextSize: Used too many fonts\\n\");\n    return;\n  }\n\n  hb_language_t text_language;\n  hb_direction_t text_direction;\n  if (language != NULL) {\n    text_language = hb_language_from_string(language, -1);\n  } else {\n    /* Use en as the default as if you are sharing configs with other */\n    /* people, you don't want them to break if they use a different lang */\n    text_language = hb_language_from_string(\"en\", -1);\n  }\n\n  hb_script_t text_script = hb_script_from_string(script, -1);\n  if (text_script == HB_SCRIPT_UNKNOWN) { text_script = HB_SCRIPT_COMMON; }\n\n  if (direction != NULL) {\n    text_direction = hb_direction_from_string(direction, -1);\n  } else {\n    text_direction = hb_script_get_horizontal_direction(text_script);\n  }\n  /* Note Direction can be invalid if user passes something invalid */\n  /* or if the script can be Vertical or Horizontal */\n  if (text_direction == HB_DIRECTION_INVALID) {\n    text_direction = HB_DIRECTION_LTR;\n  }\n\n  /* Draw text */\n  /* Create a buffer for harfbuzz to use */\n  hb_buffer_t *buf = hb_buffer_create();\n\n  // alternatively you can use hb_buffer_set_unicode_funcs(buf,\n  // hb_glib_get_unicode_funcs());\n  hb_buffer_set_unicode_funcs(buf, hb_glib_get_unicode_funcs());\n  hb_buffer_set_direction(buf, text_direction); /* or LTR */\n  if (script != NULL) {\n    hb_buffer_set_script(buf, text_script); /* see hb-unicode.h */\n  } else {\n    hb_buffer_guess_segment_properties(buf);\n  }\n  hb_buffer_set_language(buf, text_language);\n\n  /* Layout the text */\n  hb_buffer_add_utf8(buf, text, strlen(text), 0, strlen(text));\n  hb_shape(font_data->hb_ft_font, buf, NULL, 0);\n\n  hb_font_extents_t font_extents;\n  hb_font_get_extents_for_direction(font_data->hb_ft_font, text_direction,\n                                    &font_extents);\n\n  /* Hand the layout to cairo to render */\n  unsigned int glyph_count;\n  hb_glyph_info_t *glyph_info = hb_buffer_get_glyph_infos(buf, &glyph_count);\n  hb_glyph_position_t *glyph_pos =\n      hb_buffer_get_glyph_positions(buf, &glyph_count);\n  cairo_glyph_t *cairo_glyphs =\n      (cairo_glyph_t *)malloc(sizeof(cairo_glyph_t) * glyph_count);\n\n  unsigned int string_width_in_pixels = 0;\n  unsigned int string_height_in_pixels = 0;\n\n  /* Temp variable used for each glyph */\n  hb_glyph_extents_t glyph_extents;\n  if (text_direction == HB_DIRECTION_LTR ||\n      text_direction == HB_DIRECTION_RTL) {\n    /* Width */\n    for (int i = 0; i < glyph_count; ++i) {\n      string_width_in_pixels +=\n          glyph_pos[i].x_advance / 64 + glyph_pos[i].x_offset / 64;\n      hb_font_get_glyph_extents(font_data->hb_ft_font, glyph_info[i].codepoint,\n                                &glyph_extents);\n      int h =\n          ((glyph_extents.height / 64) * -1) + (glyph_extents.y_bearing / 64);\n      if (h > string_height_in_pixels) { string_height_in_pixels = h; }\n    }\n    /* Height */\n    // string_height_in_pixels = font_extents.ascender/64 -\n    // font_extents.descender/64;\n  } else {\n    /* Width */\n    string_width_in_pixels =\n        font_extents.ascender / 64 - font_extents.descender / 64;\n    /* Height */\n    for (int i = 0; i < glyph_count; ++i) {\n      string_height_in_pixels +=\n          glyph_pos[i].y_advance / 64 + glyph_pos[i].y_offset / 64;\n    }\n  }\n\n  *width = string_width_in_pixels;\n  *height = string_height_in_pixels;\n\n  free(cairo_glyphs);\n  hb_buffer_destroy(buf);\n}\n#endif\n"
  },
  {
    "path": "lua/librsvg-helper.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _LIBRSVG_HELPER_H_\n#define _LIBRSVG_HELPER_H_\n\n#include <glib.h>\n#include <librsvg/rsvg.h>\n#include <stdlib.h>\n\nRsvgDimensionData *rsvg_dimension_data_create(void) {\n  return (RsvgDimensionData *)calloc(1, sizeof(RsvgDimensionData));\n}\n\nvoid rsvg_dimension_data_destroy(RsvgDimensionData *pointer) {\n  if (pointer) { free(pointer); }\n}\n\nvoid rsvg_dimension_data_get(RsvgDimensionData *dd, int *width, int *height,\n                             double *em, double *ex) {\n  if (dd) {\n    *width = dd->width;\n    *height = dd->height;\n    *em = dd->em;\n    *ex = dd->ex;\n  }\n}\n\nvoid rsvg_dimension_data_set(RsvgDimensionData *dd, int width, int height,\n                             double em, double ex) {\n  if (dd) {\n    dd->width = width;\n    dd->height = height;\n    dd->em = em;\n    dd->ex = ex;\n  }\n}\n\nRsvgPositionData *rsvgPositionDataCreate(void) {\n  return (RsvgPositionData *)calloc(1, sizeof(RsvgPositionData));\n}\n\nvoid rsvgPositionDataGet(RsvgPositionData *pd, int *x, int *y) {\n  if (pd) {\n    *x = pd->x;\n    *y = pd->y;\n  }\n}\n\nRsvgHandle *rsvg_create_handle_from_file(const char *filename) {\n  GFile *gfile = g_file_new_for_path(filename);\n\n  GError *error = NULL;\n  RsvgHandle *handle = rsvg_handle_new_from_gfile_sync(\n      gfile, RSVG_HANDLE_FLAGS_NONE, NULL, &error);\n\n  if (error) {\n    g_object_unref(error);\n    if (handle) g_object_unref(handle);\n    handle = NULL;\n  }\n\n  g_object_unref(gfile);\n\n  return handle;\n}\n\nint rsvg_destroy_handle(RsvgHandle *handle) {\n  if (handle) { g_object_unref(handle); }\n\n  return 0;\n}\n\nRsvgRectangle *rsvg_rectangle_create(void) {\n  return (RsvgRectangle *)calloc(1, sizeof(RsvgRectangle));\n}\n\nvoid rsvg_rectangle_destroy(RsvgRectangle *rect) { free(rect); }\n\nvoid rsvg_rectangle_set(RsvgRectangle *rect, double x, double y, double width,\n                        double height) {\n  if (rect) {\n    rect->x = x;\n    rect->y = y;\n    rect->width = width;\n    rect->height = height;\n  }\n}\n\nvoid rsvg_rectangle_get(RsvgRectangle *rect, double *x, double *y,\n                        double *width, double *height) {\n  if (rect) {\n    *x = rect->x;\n    *y = rect->y;\n    *width = rect->width;\n    *height = rect->height;\n  }\n}\n\n#endif /* _LIBRSVG_HELPER_H_ */\n"
  },
  {
    "path": "lua/rsvg.pkg",
    "content": "/* \n   rsvg.h: SAX-based renderer for SVG files into a GdkPixbuf.\n \n   Copyright (C) 2000 Eazel, Inc.\n  \n   This program is free software; you can redistribute it and/or\n   modify it under the terms of the GNU Library General Public License as\n   published by the Free Software Foundation; either version 2 of the\n   License, or (at your option) any later version.\n  \n   This program is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   Library General Public License for more details.\n  \n   You should have received a copy of the GNU Library General Public\n   License along with this program; if not, write to the\n   Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n   Boston, MA 02111-1307, USA.\n  \n   Author: Raph Levien <raph@artofcode.com>\n\n   rsvg-cairo.h: SAX-based renderer for SVG files using cairo\n \n   Copyright (C) 2005 Red Hat, Inc.\n  \n   This program is free software; you can redistribute it and/or\n   modify it under the terms of the GNU Library General Public License as\n   published by the Free Software Foundation; either version 2 of the\n   License, or (at your option) any later version.\n  \n   This program is distributed in the hope that it will be useful,\n   but WITHOUT ANY WARRANTY; without even the implied warranty of\n   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n   Library General Public License for more details.\n  \n   You should have received a copy of the GNU Library General Public\n   License along with this program; if not, write to the\n   Free Software Foundation, Inc., 59 Temple Place - Suite 330,\n   Boston, MA 02111-1307, USA.\n  \n   Author: Carl Worth <cworth@cworth.org>\n*/\n\n$#include <glib.h>\n$#include <librsvg/rsvg.h>\n$#include \"librsvg-helper.h\"\n\ntypedef struct _RsvgHandle RsvgHandle;\ntypedef struct _RsvgHandleClass RsvgHandleClass;\n\n/**\n * RsvgDimensionData:\n * @width: SVG's width, in pixels\n * @height: SVG's height, in pixels\n * @em: em\n * @ex: ex\n */\ntypedef struct _RsvgDimensionData {\n    int width;\n    int height;\n    double em;\n    double ex;\n    static tolua_outside RsvgDimensionData* rsvg_dimension_data_create @ create();\n    static tolua_outside void rsvg_dimension_data_destroy @ destroy(RsvgDimensionData *);\n    tolua_outside void rsvg_dimension_data_get @ get(int * width, int * height,\n                                                  double * em, double * ex);\n    tolua_outside void rsvg_dimension_data_set @ get(int width, int height,\n                                                  double em, double ex);\n} RsvgDimensionData;\n\n/**\n * RsvgRectangle:\n * @x: X coordinate of the left side of the rectangle\n * @y: Y coordinate of the the top side of the rectangle\n * @width: width of the rectangle\n * @height: height of the rectangle\n *\n * A data structure for holding a rectangle.\n *\n * Since: 2.46\n */\ntypedef struct _RsvgRectangle {\n    double x;\n    double y;\n    double width;\n    double height;\n\n\tstatic tolua_outside RsvgRectangle* rsvg_rectangle_create @ create();\n\tstatic tolua_outside void rsvg_rectangle_destroy @ destroy(RsvgRectangle *pointer);\n\ttolua_outside void rsvg_rectangle_set @ set(double x, double y, double width, double height);\n\ttolua_outside void rsvg_rectangle_get @ get(double *x, double *y, double *width, double *height);\n} RsvgRectangle;\n\nconst char  *rsvg_handle_get_base_uri (RsvgHandle * handle);\nvoid         rsvg_handle_set_base_uri (RsvgHandle * handle, const char *base_uri);\n\ngboolean     rsvg_handle_get_intrinsic_size_in_pixels  (RsvgHandle *handle,\n                                                        gdouble *out_width,\n                                                        gdouble *out_height);\n\ngboolean rsvg_handle_get_geometry_for_layer(RsvgHandle *handle,\n                                            const char *id,\n                                            const RsvgRectangle *viewport,\n                                            RsvgRectangle *out_ink_rect,\n                                            RsvgRectangle *out_logical_rect,\n                                            GError **error);\n\nint      rsvg_handle_has_sub (RsvgHandle * handle, const char *id);\n\nRsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags);\n\nRsvgHandle *rsvg_handle_new_from_data (const unsigned char * data, unsigned long data_len, GError ** error);\nRsvgHandle *rsvg_handle_new_from_file (const char * file_name, GError ** error);\n\ngboolean    rsvg_handle_render_document(RsvgHandle *handle,\n                                        cairo_t *cr,\n                                        const RsvgRectangle *viewport,\n                                        GError **error);\ngboolean    rsvg_handle_render_layer   (RsvgHandle *handle,\n                                        cairo_t *cr,\n                                        const char *id,\n                                        const RsvgRectangle *viewport,\n                                        GError **error);\n\nvoid g_object_unref(gpointer object);\n\nRsvgHandle * rsvg_create_handle_from_file(const char *);\nint rsvg_destroy_handle(RsvgHandle *);\n\nRsvgHandle *rsvg_handle_new_with_flags (RsvgHandleFlags flags);\n\nvoid        rsvg_handle_set_base_gfile (RsvgHandle *handle,\n                                        GFile      *base_file);\n\ngboolean    rsvg_handle_read_stream_sync (RsvgHandle   *handle,\n                                          GInputStream *stream,\n                                          GCancellable *cancellable,\n                                          GError      **error);\n\nRsvgHandle *rsvg_handle_new_from_gfile_sync (GFile          *file,\n                                             RsvgHandleFlags flags,\n                                             GCancellable   *cancellable,\n                                             GError        **error);\n\nRsvgHandle *rsvg_handle_new_from_stream_sync (GInputStream   *input_stream,\n                                              GFile          *base_file,\n                                              RsvgHandleFlags flags,\n                                              GCancellable   *cancellable,\n                                              GError        **error);\n\nRsvgHandle *rsvg_handle_new_from_data (const guint8 *data, gsize data_len, GError **error);\nRsvgHandle *rsvg_handle_new_from_file (const gchar *filename, GError **error);\n"
  },
  {
    "path": "lua/text.pkg",
    "content": ""
  },
  {
    "path": "requirements-dev.txt",
    "content": "pyyaml\njinja2\n"
  },
  {
    "path": "src/CMakeLists.txt",
    "content": "#\n# Conky, a system monitor, based on torsmo\n#\n# Please see COPYING for details\n#\n# Copyright (c) 2005-2024 Brenden Matthews, et. al. (see AUTHORS) All rights\n# reserved.\n#\n# This program is free software: you can redistribute it and/or modify it under\n# the terms of the GNU General Public License as published by the Free Software\n# Foundation, either version 3 of the License, or (at your option) any later\n# version.\n#\n# This program is distributed in the hope that it will be useful, but WITHOUT\n# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS\n# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more\n# details. You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http://www.gnu.org/licenses/>.\n#\n\ninclude_directories(${conky_includes})\n\n# always include the binary dir\ninclude_directories(${CMAKE_CURRENT_BINARY_DIR})\n\nif(BUILD_BUILTIN_CONFIG OR BUILD_OLD_CONFIG)\n  # include config output dir\n  include_directories(${CMAKE_BINARY_DIR}/data)\nendif(BUILD_BUILTIN_CONFIG OR BUILD_OLD_CONFIG)\n\nset(conky_target_includes\n  ${conky_includes}\n  ${CMAKE_CURRENT_BINARY_DIR})\n\nif(BUILD_BUILTIN_CONFIG OR BUILD_OLD_CONFIG)\n  list(APPEND conky_target_includes ${CMAKE_BINARY_DIR}/data)\nendif(BUILD_BUILTIN_CONFIG OR BUILD_OLD_CONFIG)\n\n# Some package probes do not consistently flow through conky_includes on\n# Darwin/Nix, so assemble the compile include set from the resolved package\n# variables as well.\nconky_append_include_dirs(conky_target_includes\n  ${CONKY_PLATFORM_EXTRA_INCLUDE_DIRS}\n  ${Intl_INCLUDE_DIRS}\n  ${MICROHTTPD_INCLUDE_DIRS}\n  ${CURSES_INCLUDE_PATH}\n  ${CURSES_PARENT}\n  ${ICONV_INCLUDE_DIR}\n  ${X11_INCLUDE_DIR}\n  ${FREETYPE_INCLUDE_DIR_freetype2}\n  ${Fontconfig_INCLUDE_DIRS}\n  ${X11_xcb_INCLUDE_PATH}\n  ${Wayland_CLIENT_INCLUDE_DIR}\n  ${EPOLL_INCLUDE_DIRS}\n  ${CAIRO_INCLUDE_DIRS}\n  ${PANGO_INCLUDE_DIRS}\n  ${PANGOCAIRO_INCLUDE_DIRS}\n  ${PANGOFC_INCLUDE_DIRS}\n  ${PANGOFT2_INCLUDE_DIRS}\n  ${LUA_INCLUDE_DIR}\n  ${AUDACIOUS_INCLUDE_DIRS}\n  ${DBUS_GLIB_INCLUDE_DIRS}\n  ${XMMS2_INCLUDE_DIRS}\n  ${XNVCtrl_INCLUDE_PATH}\n  ${IMLIB2_INCLUDE_DIRS}\n  ${SYSTEMD_INCLUDE_DIRS}\n  ${PULSEAUDIO_INCLUDE_DIRS}\n  ${CURL_INCLUDE_DIRS}\n  ${GLIB_INCLUDE_DIRS}\n  ${LIBXML2_INCLUDE_DIR})\n\n# ensure build.h and config.h aren't in the way\nif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.h)\n  message(\n    FATAL_ERROR\n    \"You must remove the autotools generated file '${CMAKE_CURRENT_SOURCE_DIR}/config.h' in order to build with CMake.\"\n  )\nendif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/config.h)\n\nif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build.h)\n  message(\n    FATAL_ERROR\n    \"You must remove the autotools generated file '${CMAKE_CURRENT_SOURCE_DIR}/build.h' in order to build with CMake.\"\n  )\nendif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/build.h)\n\nif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h)\n  message(\n    FATAL_ERROR\n    \"You must remove the autotools generated file '${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h' in order to build with CMake.\"\n  )\nendif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/defconfig.h)\n\n# Generate colour-names.hh with gperf\nexecute_process(\n  INPUT_FILE \"${CMAKE_SOURCE_DIR}/data/color-names.yml\"\n  OUTPUT_FILE \"${CMAKE_BINARY_DIR}/data/color-names.gperf\"\n  COMMAND sh \"${CMAKE_SOURCE_DIR}/bin/format-colors.sh\"\n)\nexecute_process(\n  INPUT_FILE \"${CMAKE_BINARY_DIR}/data/color-names.gperf\"\n  OUTPUT_FILE \"${CMAKE_CURRENT_BINARY_DIR}/colour-names.hh\"\n  COMMAND ${APP_GPERF} --ignore-case -LC++ -Zcolor_name_hash -t -7 -m1 -C -E\n)\n\nset(conky_sources\n  ${conky_sources}\n  c++wrap.cc\n  c++wrap.hh\n  lua/colour-settings.cc\n  lua/colour-settings.hh\n  content/colours.cc\n  content/colours.hh\n  content/combine.cc\n  content/combine.h\n  common.cc\n  common.h\n  conky.cc\n  conky.h\n  core.cc\n  core.h\n  data/hardware/cpu.cc\n  data/hardware/cpu.h\n  data/hardware/diskio.cc\n  data/hardware/diskio.h\n  data/entropy.cc\n  data/entropy.h\n  data/exec.cc\n  data/exec.h\n  data/fs.cc\n  data/fs.h\n  content/gradient.cc\n  content/gradient.hh\n  data/network/mail.cc\n  data/network/mail.h\n  data/misc.cc\n  data/misc.h\n  data/network/net_stat.cc\n  data/network/net_stat.h\n  content/template.cc\n  content/template.h\n  data/network/mboxscan.cc\n  data/network/mboxscan.h\n  data/network/read_tcpip.cc\n  data/network/read_tcpip.h\n  content/scroll.cc\n  content/scroll.h\n  content/specials.cc\n  content/specials.h\n  data/tailhead.cc\n  data/tailhead.h\n  content/temphelper.cc\n  content/temphelper.h\n  content/text_object.cc\n  content/text_object.h\n  data/timeinfo.cc\n  data/timeinfo.h\n  data/top.cc\n  data/top.h\n  content/algebra.cc\n  content/algebra.h\n  prioqueue.cc\n  prioqueue.h\n  data/proc.cc\n  data/proc.h\n  data/user.cc\n  data/user.h\n  lua/luamm.cc\n  lua/luamm.hh\n  data/data-source.cc\n  data/data-source.hh\n  output/display-output.cc\n  output/display-output.hh\n  output/display-console.cc\n  output/display-console.hh\n  output/display-file.cc\n  output/display-file.hh\n  lua/lua-config.cc\n  lua/lua-config.hh\n  lua/setting.cc\n  lua/setting.hh\n  lua/llua.cc\n  lua/llua.h\n  update-cb.cc\n  update-cb.hh\n  logging.h\n  semaphore.hh\n)\n\n# Platform specific sources\nif(OS_LINUX)\n  set(linux_sources\n    data/os/linux.cc\n    data/os/linux.h\n    data/users.cc\n    data/users.h\n    data/hardware/sony.cc\n    data/hardware/sony.h\n    data/hardware/i8k.cc\n    data/hardware/i8k.h\n  )\n  set(optional_sources ${optional_sources} ${linux_sources})\nendif(OS_LINUX)\n\nif(OS_FREEBSD)\n  set(freebsd_sources\n    data/os/freebsd.cc\n    data/os/freebsd.h\n    data/hardware/bsdapm.cc\n    data/hardware/bsdapm.h\n  )\n  set(optional_sources ${optional_sources} ${freebsd_sources})\nendif(OS_FREEBSD)\n\nif(OS_DRAGONFLY)\n  set(dragonfly_sources\n    data/os/dragonfly.cc\n    data/os/dragonfly.h\n    data/hardware/bsdapm.cc\n    data/hardware/bsdapm.h\n  )\n  set(optional_sources ${optional_sources} ${dragonfly_sources})\nendif(OS_DRAGONFLY)\n\nif(OS_OPENBSD)\n  set(openbsd_sources\n    data/os/openbsd.cc\n    data/os/openbsd.h\n    data/hardware/bsdapm.cc\n    data/hardware/bsdapm.h\n    data/os/bsdcommon.cc\n    data/os/bsdcommon.h\n  )\n  set(optional_sources ${optional_sources} ${openbsd_sources})\nendif(OS_OPENBSD)\n\n# These below are not actually supported.  No idea what their status is.\nif(OS_SOLARIS)\n  set(solaris_sources data/os/solaris.cc data/os/solaris.h)\n  set(optional_sources ${optional_sources} ${solaris_sources})\nendif(OS_SOLARIS)\n\nif(OS_NETBSD)\n  set(netbsd_sources data/os/netbsd.cc data/os/netbsd.h data/os/bsdcommon.cc data/os/bsdcommon.h)\n  set(optional_sources ${optional_sources} ${netbsd_sources})\nendif(OS_NETBSD)\n\nif(OS_HAIKU)\n  set(haiku_sources data/os/haiku.cc data/os/haiku.h)\n  set(optional_sources ${optional_sources} ${haiku_sources})\nendif(OS_HAIKU)\n\nif(OS_DARWIN)\n  set(darwin_sources\n    data/os/darwin.mm\n    data/os/darwin.h\n    data/os/darwin_sip.h\n    data/os/darwin_top_helpers.cc\n    data/os/darwin_top_helpers.h\n    i18n.h)\n  set(optional_sources ${optional_sources} ${darwin_sources})\n\n  if(CMAKE_OSX_SYSROOT\n    AND EXISTS \"${CMAKE_OSX_SYSROOT}/usr/include\")\n    # Nix clang wrappers can skip SDK ObjC headers for Objective-C++ sources\n    # even with -isysroot; add them after the normal search order.\n    set_property(\n      SOURCE data/os/darwin.mm\n      APPEND PROPERTY COMPILE_OPTIONS\n      -idirafter\n      ${CMAKE_OSX_SYSROOT}/usr/include)\n  endif()\nendif(OS_DARWIN)\n\n# Optional sources\nif(HAVE_SOUNDCARD_H)\n  set(mixer data/audio/mixer.cc data/audio/mixer.h)\n  set(optional_sources ${optional_sources} ${mixer})\nendif(HAVE_SOUNDCARD_H)\n\nif(BUILD_AUDACIOUS)\n  set(audacious data/audio/audacious.cc data/audio/audacious.h)\n  set(optional_sources ${optional_sources} ${audacious})\nendif(BUILD_AUDACIOUS)\n\nif(BUILD_IBM)\n  set(ibm data/hardware/ibm.cc data/hardware/ibm.h data/hardware/smapi.cc data/hardware/smapi.h)\n  set(optional_sources ${optional_sources} ${ibm})\nendif(BUILD_IBM)\n\nif(BUILD_MPD)\n  set(mpd data/audio/mpd.cc data/audio/mpd.h data/audio/libmpdclient.cc data/audio/libmpdclient.h)\n  set(optional_sources ${optional_sources} ${mpd})\nendif(BUILD_MPD)\n\nif(BUILD_MYSQL)\n  set(mysql data/mysql.cc data/mysql.h)\n  set(optional_sources ${optional_sources} ${mysql})\nendif(BUILD_MYSQL)\n\nif(BUILD_MOC)\n  set(moc data/audio/moc.cc data/audio/moc.h)\n  set(optional_sources ${optional_sources} ${moc})\nendif(BUILD_MOC)\n\nif(BUILD_CMUS)\n  set(cmus data/audio/cmus.cc data/audio/cmus.h)\n  set(optional_sources ${optional_sources} ${cmus})\nendif(BUILD_CMUS)\n\nif(BUILD_JOURNAL)\n  set(journal data/os/journal.cc data/os/journal.h)\n  set(optional_sources ${optional_sources} ${journal})\nendif(BUILD_JOURNAL)\n\nif(BUILD_XMMS2)\n  set(xmms2 data/audio/xmms2.cc data/audio/xmms2.h)\n  set(optional_sources ${optional_sources} ${xmms2})\nendif(BUILD_XMMS2)\n\nif(BUILD_PORT_MONITORS)\n  add_library(tcp-portmon \n    data/network/libtcp-portmon.cc\n    data/network/libtcp-portmon.h\n  )\n  set(conky_libs ${conky_libs} tcp-portmon)\n  set(port_monitors\n    data/network/tcp-portmon.cc\n    data/network/tcp-portmon.h\n  )\n  set(optional_sources ${optional_sources} ${port_monitors})\nendif(BUILD_PORT_MONITORS)\n\nif(BUILD_HTTP)\n  set(http\n    output/display-http.cc\n    output/display-http.hh\n  )\n  set(optional_sources ${optional_sources} ${http})\nendif(BUILD_HTTP)\n\nif(BUILD_X11)\n  set(x11\n    output/display-x11.cc\n    output/display-x11.hh\n    lua/x11-settings.cc\n    lua/x11-settings.h\n    output/x11-color.cc\n    output/x11.cc\n    output/x11.h\n  )\n  set(optional_sources ${optional_sources} ${x11})\nendif(BUILD_X11)\n\nif(BUILD_GUI)\n  set(gui lua/fonts.cc lua/fonts.h output/gui.cc output/gui.h)\n  set(optional_sources ${optional_sources} ${gui})\n\n  if(BUILD_MOUSE_EVENTS OR BUILD_XINPUT)\n    set(mouse_events mouse-events.cc mouse-events.h)\n    set(optional_sources ${optional_sources} ${mouse_events})\n  endif(BUILD_MOUSE_EVENTS OR BUILD_XINPUT)\nendif(BUILD_GUI)\n\nif(BUILD_WAYLAND)\n  set(wl_sources\n    output/wl.cc\n    output/wl.h\n    output/display-wayland.cc\n    output/display-wayland.hh\n    xdg-shell-protocol.c\n    wlr-layer-shell-protocol.c\n  )\n\n  # Looks up wayland protocol files, build respective headers/sources, and adds\n  # them to the build.\n  #\n  # Use: add_protocol(name [v<version>])\n  macro(ADD_PROTOCOL name)\n    set(WL_PROTOCOL_PATHS\n      \"${CMAKE_CURRENT_SOURCE_DIR}/wl_protocols\" # first for reproducibility\n      \"${Wayland_PROTOCOLS_DIR}/stable/${name}\"\n      \"${Wayland_PROTOCOLS_DIR}/stable\"\n      \"${Wayland_PROTOCOLS_DIR}/unstable/${name}\"\n      \"${Wayland_PROTOCOLS_DIR}/unstable\"\n    )\n    if(${ARGC} GREATER 1)\n      set(VERSION ${ARGV1})\n      find_file(PROTOCOL_FILE\n        NAMES\n          \"${name}-${VERSION}.xml\"\n          \"${name}-unstable-${VERSION}.xml\"\n        PATHS ${WL_PROTOCOL_PATHS}\n        NO_CACHE\n        REQUIRED\n        NO_DEFAULT_PATH\n        NO_CMAKE_FIND_ROOT_PATH\n      )\n      message(STATUS \"PROTOCOL '${name}' ${VERSION} file: ${PROTOCOL_FILE}\")\n      unset(VERSION)\n    else()\n      find_file(PROTOCOL_FILE\n        NAMES\n          \"${name}.xml\"\n          \"${name}-unstable.xml\"\n        PATHS ${WL_PROTOCOL_PATHS}\n        NO_CACHE\n        REQUIRED\n        NO_DEFAULT_PATH\n        NO_CMAKE_FIND_ROOT_PATH\n      )\n      message(STATUS \"PROTOCOL '${name}' file: ${PROTOCOL_FILE}\")\n    endif()\n    \n    \n    add_custom_command(\n      OUTPUT \"${CMAKE_CURRENT_BINARY_DIR}/${name}-client-protocol.h\"\n      COMMAND ${Wayland_SCANNER} client-header \"${PROTOCOL_FILE}\" \"${name}-client-protocol.h\")\n    add_custom_command(\n      OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${name}-protocol.c\n      COMMAND ${Wayland_SCANNER} private-code \"${PROTOCOL_FILE}\" \"${name}-protocol.c\"\n      DEPENDS \"${name}-client-protocol.h\")\n    list(APPEND wl_sources \"${name}-protocol.c\")\n    unset(PROTOCOL_FILE)\n    unset(WL_PROTOCOL_PATHS)\n  endmacro()\n  \n  add_protocol(xdg-shell)\n  add_protocol(wlr-layer-shell v1)\n\n  set(optional_sources ${optional_sources} ${wl_sources})\nendif(BUILD_WAYLAND)\n\nif(BUILD_HDDTEMP)\n  set(hddtemp data/hardware/hddtemp.cc data/hardware/hddtemp.h)\n  set(optional_sources ${optional_sources} ${hddtemp})\nendif(BUILD_HDDTEMP)\n\nif(BUILD_CURL)\n  set(ccurl_thread\n    data/network/ccurl_thread.cc\n    data/network/ccurl_thread.h\n  )\n  set(optional_sources ${optional_sources} ${ccurl_thread})\nendif(BUILD_CURL)\n\nif(BUILD_RSS)\n  set(rss\n    data/network/rss.cc\n    data/network/rss.h\n    data/network/prss.cc\n    data/network/prss.h\n  )\n  set(optional_sources ${optional_sources} ${rss})\nendif(BUILD_RSS)\n\nif(BUILD_NVIDIA)\n  set(nvidia data/hardware/nvidia.cc data/hardware/nvidia.h)\n  set(optional_sources ${optional_sources} ${nvidia})\nendif(BUILD_NVIDIA)\n\nif(BUILD_IMLIB2)\n  set(imlib2 conky-imlib2.cc conky-imlib2.h)\n  set(optional_sources ${optional_sources} ${imlib2})\nendif(BUILD_IMLIB2)\n\nif(BUILD_APCUPSD)\n  set(apcupsd data/hardware/apcupsd.cc data/hardware/apcupsd.h)\n  set(optional_sources ${optional_sources} ${apcupsd})\nendif(BUILD_APCUPSD)\n\nif(BUILD_ICAL)\n  set(ical data/ical.cc data/ical.h)\n  set(optional_sources ${optional_sources} ${ical})\nendif(BUILD_ICAL)\n\nif(BUILD_IRC)\n  set(irc data/network/irc.cc data/network/irc.h)\n  set(optional_sources ${optional_sources} ${irc})\nendif(BUILD_IRC)\n\nif(BUILD_ICONV)\n  set(iconv data/iconv_tools.cc data/iconv_tools.h)\n  set(optional_sources ${optional_sources} ${iconv})\nendif(BUILD_ICONV)\n\nif(BUILD_NCURSES)\n  set(ncurses_srcs\n    output/nc.cc\n    output/nc.h\n    output/display-ncurses.cc\n    output/display-ncurses.hh\n  )\n  set(optional_sources ${optional_sources} ${ncurses_srcs})\nendif(BUILD_NCURSES)\n\nif(BUILD_PULSEAUDIO)\n  set(pulseaudio data/audio/pulseaudio.cc data/audio/pulseaudio.h)\n  set(optional_sources ${optional_sources} ${pulseaudio})\nendif(BUILD_PULSEAUDIO)\n\nif(BUILD_INTEL_BACKLIGHT)\n  set(intel_backlight data/hardware/intel_backlight.cc data/hardware/intel_backlight.h)\n  set(optional_sources ${optional_sources} ${intel_backlight})\nendif(BUILD_INTEL_BACKLIGHT)\n\nif(BUILD_TESTING)\n  # Create a library strictly for testing\n  add_library(conky_core ${conky_sources} ${optional_sources})\n  add_dependencies(conky_core generated_hdr_files)\n  target_include_directories(conky_core PUBLIC ${conky_target_includes})\n  target_link_libraries(conky_core ${conky_libs})\n  add_executable(conky main.cc)\n  add_dependencies(conky generated_hdr_files)\n  target_include_directories(conky PRIVATE ${conky_target_includes})\n  target_link_libraries(conky conky_core ${conky_libs})\n  install(TARGETS conky_core\n    RUNTIME DESTINATION bin\n    LIBRARY DESTINATION ${LIB_INSTALL_DIR}\n    ARCHIVE DESTINATION ${LIB_INSTALL_DIR})\nelse()\n  add_executable(conky main.cc ${conky_sources} ${optional_sources})\n  add_dependencies(conky generated_hdr_files)\n  target_include_directories(conky PRIVATE ${conky_target_includes})\n  target_link_libraries(conky ${conky_libs})\nendif()\n\ninstall(TARGETS conky\n  RUNTIME DESTINATION bin\n  LIBRARY DESTINATION ${LIB_INSTALL_DIR}\n  ARCHIVE DESTINATION ${LIB_INSTALL_DIR})\n\nif(BUILD_PORT_MONITORS)\n  install(TARGETS tcp-portmon\n    RUNTIME DESTINATION bin\n    LIBRARY DESTINATION ${LIB_INSTALL_DIR}\n    ARCHIVE DESTINATION ${LIB_INSTALL_DIR})\nendif(BUILD_PORT_MONITORS)\n\nprint_target_properties(conky)\n"
  },
  {
    "path": "src/build.h.in",
    "content": "#ifndef __BUILD_H\n#define __BUILD_H\n\n/* Conky build info */\n\n#define BUILD_ARCH \"@BUILD_ARCH@\"\n\n#endif /* __BUILD_H */\n"
  },
  {
    "path": "src/c++wrap.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n\n#include \"c++wrap.hh\"\n\n#include <unistd.h>\n#include <cstdio>\n\n/* force use of  POSIX strerror_r instead of non-portable GNU specific */\n#ifdef _GNU_SOURCE\n#undef _GNU_SOURCE\n#endif\n#include <cstring>\n\n#if __cplusplus <= 199711L\n#define thread_local __thread\n#endif\n\n#if !defined(HAVE_PIPE2) || !defined(HAVE_O_CLOEXEC)\n#include <fcntl.h>\n\nnamespace {\nint pipe2_emulate(int pipefd[2], int flags) {\n  if (pipe(pipefd) == -1) { return -1; }\n\n  if ((flags & O_CLOEXEC) != 0) {\n    // we emulate O_CLOEXEC if the system does not have it\n    // not very thread-safe, but at least it works\n\n    for (int i = 0; i < 2; ++i) {\n      int r = fcntl(pipefd[i], F_GETFD);\n      if (r == -1) { return -1; }\n\n      if (fcntl(pipefd[i], F_SETFD, r | FD_CLOEXEC) == -1) { return -1; }\n    }\n  }\n\n  return 0;\n}\n\nint (*const pipe2_ptr)(int[2], int) = &pipe2_emulate;\n}  // namespace\n#else\nint (*const pipe2_ptr)(int[2], int) = &pipe2;\n#endif\n\nstd::string strerror_r(int errnum) {\n  static thread_local char buf[100];\n  if (strerror_r(errnum, buf, sizeof buf) != 0) {\n    snprintf(buf, sizeof buf, \"Unknown error %i\", errnum);\n  }\n  return buf;\n}\n\nstd::pair<int, int> pipe2(int flags) {\n  int fd[2];\n  if (pipe2_ptr(fd, flags) == -1) { throw errno_error(\"pipe2\"); }\n  { return std::pair<int, int>(fd[0], fd[1]); }\n}\n"
  },
  {
    "path": "src/c++wrap.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef CPPWRAP_HH\n#define CPPWRAP_HH\n\n#ifdef HAVE_O_CLOEXEC\n#include <fcntl.h>\n#else\nenum { O_CLOEXEC = 02000000 };\n#endif\n\n#include <cerrno>\n#include <stdexcept>\n#include <string>\n#include <utility>\n\nstd::string strerror_r(int errnum);\nstd::pair<int, int> pipe2(int flags);\n\nclass errno_error : public std::runtime_error {\n  typedef std::runtime_error Base;\n\n public:\n  explicit errno_error(const std::string &prefix, int err_ = errno)\n      : Base(prefix + \": \" + strerror_r(err_)), err(err_) {}\n\n  const int err;\n};\n\n#endif /* CPPWRAP_HH */\n"
  },
  {
    "path": "src/common.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"common.h\"\n\n#include <fcntl.h>\n#include <net/if.h>\n#include <netinet/in.h>\n#include <pthread.h>\n#include <pwd.h>\n#include <semaphore.h>\n#include <sys/ioctl.h>\n#include <unistd.h>\n#include <cctype>\n#include <cerrno>\n#include <cstdio>\n#include <cstdlib>\n#include <ctime>\n#include <vector>\n\n#include \"config.h\"\n#include \"conky.h\"\n#include \"content/specials.h\"\n#include \"content/temphelper.h\"\n#include \"core.h\"\n#include \"data/fs.h\"\n#include \"data/misc.h\"\n#include \"data/network/net_stat.h\"\n#include \"data/timeinfo.h\"\n#include \"data/top.h\"\n#include \"logging.h\"\n\n#if defined(_POSIX_C_SOURCE) && !defined(__OpenBSD__) && !defined(__HAIKU__)\n#include <wordexp.h>\n#endif\n\n/* check for OS and include appropriate headers */\n#if defined(__linux__)\n#include \"data/os/linux.h\"\n#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\n#include \"data/os/freebsd.h\"\n#elif defined(__DragonFly__)\n#include \"data/os/dragonfly.h\"\n#elif defined(__OpenBSD__)\n#include \"data/os/openbsd.h\"\n#elif defined(__NetBSD__)\n#include \"data/os/netbsd.h\"\n#elif defined(__APPLE__) && defined(__MACH__)\n#include \"data/os/darwin.h\"  // strings.h\n#endif\n\n#include \"update-cb.hh\"\n\n#ifdef BUILD_CURL\n#include \"data/network/ccurl_thread.h\"\n#endif /* BUILD_CURL */\n\n/* folds a string over top of itself, like so:\n *\n * if start is \"blah\", and you call it with count = 1, the result will be \"lah\"\n */\nvoid strfold(char *start, int count) {\n  char *curplace;\n  for (curplace = start + count; *curplace != 0; curplace++) {\n    *(curplace - count) = *curplace;\n  }\n  *(curplace - count) = 0;\n}\n\n#ifndef HAVE_STRNDUP\n// use our own strndup() if it's not available\nchar *strndup(const char *s, size_t n) {\n  if (strlen(s) > n) {\n    char *ret = malloc(n + 1);\n    strncpy(ret, s, n);\n    ret[n] = 0;\n    return ret;\n  } else {\n    return strdup(s);\n  }\n}\n#endif /* HAVE_STRNDUP */\n\nint update_uname() {\n  uname(&info.uname_s);\n\n#if defined(__DragonFly__)\n  {\n    size_t desc_n;\n    char desc[256];\n\n    if (sysctlbyname(\"kern.version\", nullptr, &desc_n, NULL, 0) == -1 ||\n        sysctlbyname(\"kern.version\", desc, &desc_n, nullptr, 0) == -1)\n      perror(\"kern.version\");\n    else {\n      char *start = desc;\n      strsep(&start, \" \");\n      strcpy(info.uname_v, strsep(&start, \" \"));\n    }\n\n    if (errno == ENOMEM) printf(\"desc_n %zu\\n\", desc_n);\n  }\n#endif\n\n  return 0;\n}\n\ndouble get_time() {\n  struct timespec tv {};\n#ifdef _POSIX_MONOTONIC_CLOCK\n  clock_gettime(CLOCK_MONOTONIC, &tv);\n#else\n  clock_gettime(CLOCK_REALTIME, &tv);\n#endif\n  return tv.tv_sec + (tv.tv_nsec * 1e-9);\n}\n\n#if defined(_POSIX_C_SOURCE) && !defined(__OpenBSD__) && !defined(__HAIKU__)\nstd::filesystem::path to_real_path(const std::string &source) {\n  wordexp_t p;\n  char **w;\n  int i;\n  std::string checked = std::string(source);\n  std::string::size_type n = 0;\n  while ((n = checked.find(\" \", n)) != std::string::npos) {\n    checked.replace(n, 1, \"\\\\ \");\n    n += 2;\n  }\n  const char *csource = source.c_str();\n  if (wordexp(checked.c_str(), &p, 0) != 0) { return std::string(); }\n  w = p.we_wordv;\n  const char *resolved_path = strdup(w[0]);\n  wordfree(&p);\n  return std::filesystem::weakly_canonical(resolved_path);\n}\n#else\n// TODO: Use this implementation once it's finished.\n// `wordexp` calls shell which is inconsistent across different environments.\nstd::filesystem::path to_real_path(const std::string &source) {\n  /*\n  Wordexp (via default shell) does:\n  - [x] tilde substitution `~`\n  - [x] variable substitution (via `variable_substitute`)\n  - [ ] command substitution `$(command)`\n    - exec.cc does execution already; missing recursive descent parser for\n      $(...) because they can be nested and mixed with self & other expressions\n      from this list\n  - [ ] [arithmetic\n    expansion](https://www.gnu.org/software/bash/manual/html_node/Arithmetic-Expansion.html)\n    `$((10 + 2))`\n    - would be nice to have for other things as well, could possibly use lua and\n      replace stuff like $VAR and $(...) with equivalent functions.\n  - [ ] [field\n    splitting](https://www.gnu.org/software/bash/manual/html_node/Word-Splitting.html)\n  - [ ] wildcard expansion\n  - [ ] quote removal Extra:\n  - canonicalization added\n  */\n  try {\n    std::string input = tilde_expand(source);\n    std::string expanded = variable_substitute(input);\n    std::filesystem::path absolute = std::filesystem::absolute(expanded);\n    return std::filesystem::weakly_canonical(absolute);\n  } catch (const std::filesystem::filesystem_error &e) {\n    // file not found or permission issues\n    NORM_ERR(\"can't canonicalize path: %s\", source.c_str());\n    return source;\n  }\n}\n#endif\n\nint open_fifo(const char *file, int *reported) {\n  int fd = 0;\n\n  fd = open(file, O_RDONLY | O_NONBLOCK | O_CLOEXEC);\n\n  if (fd == -1) {\n    if ((reported == nullptr) || *reported == 0) {\n      NORM_ERR(\"can't open %s: %s\", file, strerror(errno));\n      if (reported != nullptr) { *reported = 1; }\n    }\n    return -1;\n  }\n\n  return fd;\n}\n\nFILE *open_file(const char *file, int *reported) {\n  FILE *fp = nullptr;\n\n  fp = fopen(file, \"re\");\n\n  if (fp == nullptr) {\n    if ((reported == nullptr) || *reported == 0) {\n      NORM_ERR(\"can't open %s: %s\", file, strerror(errno));\n      if (reported != nullptr) { *reported = 1; }\n    }\n    return nullptr;\n  }\n\n  return fp;\n}\n\nstd::filesystem::path get_cwd() {\n  char *cwd;\n  char buffer[1024];\n\n  // Attempt to get the current working directory\n  cwd = getcwd(buffer, sizeof(buffer));\n  if (cwd == NULL) {\n    const char *error;\n    perror(error);\n    NORM_ERR(\"can't get conky current working directory: %s\", error);\n    DBGP(\"returning '.' as PWD\");  // hope things work out well\n    return std::string(\".\");\n  }\n\n  return std::string(buffer);\n}\n\nstd::string current_username() {\n  const char *user = std::getenv(\"USER\");\n\n  if (!user) {\n    NORM_ERR(\n        \"can't determine current user (USER environment variable not set)\");\n    return std::string();\n  }\n\n  return std::string(user);\n}\n\nstd::optional<std::filesystem::path> user_home(const std::string &username) {\n  if (username == current_username()) {\n    const char *home = std::getenv(\"HOME\");\n    if (home) { return std::filesystem::path(home); }\n  }\n\n  struct passwd *pw = getpwnam(username.c_str());\n  if (!pw) {\n    DBGP(\n        \"can't determine HOME directory for user %s (neither w/ HOME nor \"\n        \"getpwnam)\",\n        username.c_str());\n    return std::nullopt;\n  }\n  return std::filesystem::path(pw->pw_dir);\n}\nstd::optional<std::filesystem::path> user_home() {\n  return user_home(current_username());\n}\n\nstd::string tilde_expand(const std::string &unexpanded) {\n  if (unexpanded.compare(0, 1, \"~\") != 0) { return unexpanded; }\n  if (unexpanded.length() == 1) {\n    auto home = user_home();\n    if (home->empty()) {\n      NORM_ERR(\n          \"can't expand '~' path because user_home couldn't locate home \"\n          \"directory\");\n      return unexpanded;\n    }\n    return home.value();\n  }\n  char next = unexpanded.at(1);\n  if (next == '/') {\n    auto home = user_home();\n    if (home->empty()) {\n      NORM_ERR(\n          \"can't expand '~' path because user_home couldn't locate home \"\n          \"directory\");\n      return unexpanded;\n    }\n    return home.value().string() + unexpanded.substr(1);\n  }\n  if (next == '+') { return get_cwd().string() + unexpanded.substr(2); }\n  // if (next == '-') {\n  //   auto oldpwd = std::getenv(\"OLDPWD\");\n  //   if (oldpwd == nullptr) {\n  //     return unexpanded;\n  //   }\n  //   return std::string(oldpwd) + unexpanded.substr(2);\n  // }\n  // ~+/-N is tied to bash functionality\n  if (std::isalpha(next)) {  // handles ~USERNAME\n    auto name_end = unexpanded.find_first_of('/', 1);\n    std::string name;\n    if (name_end == std::string::npos) {\n      name = unexpanded.substr(1);\n      name_end = unexpanded.length();\n    } else {\n      name = unexpanded.substr(1, name_end - 1);\n    }\n    auto home = user_home(name);\n    if (home->empty()) { return unexpanded; }\n    return home.value().string() + unexpanded.substr(name_end);\n  }\n  return unexpanded;\n}\n\nstd::string variable_substitute(std::string s) {\n  std::string::size_type pos = 0;\n  while ((pos = s.find('$', pos)) != std::string::npos) {\n    if (pos + 1 >= s.size()) { break; }\n\n    if (s[pos + 1] == '$') {\n      s.erase(pos, 1);\n      ++pos;\n    } else {\n      std::string var;\n      std::string::size_type l = 0;\n\n      if (isalpha(static_cast<unsigned char>(s[pos + 1])) != 0) {\n        l = 1;\n        while (pos + l < s.size() &&\n               (isalnum(static_cast<unsigned char>(s[pos + l])) != 0)) {\n          ++l;\n        }\n        var = s.substr(pos + 1, l - 1);\n      } else if (s[pos + 1] == '{') {\n        l = s.find('}', pos);\n        if (l == std::string::npos) { break; }\n        l -= pos - 1;\n        var = s.substr(pos + 2, l - 3);\n      } else {\n        ++pos;\n      }\n\n      if (l != 0u) {\n        s.erase(pos, l);\n        const char *val = getenv(var.c_str());\n        if (val != nullptr) {\n          s.insert(pos, val);\n          pos += strlen(val);\n        }\n      }\n    }\n  }\n\n  return s;\n}\n\nvoid format_seconds(char *buf, unsigned int n, long seconds) {\n  long days;\n  int hours, minutes;\n\n  if (times_in_seconds.get(*state)) {\n    snprintf(buf, n, \"%ld\", seconds);\n    return;\n  }\n\n  days = seconds / 86400;\n  seconds %= 86400;\n  hours = seconds / 3600;\n  seconds %= 3600;\n  minutes = seconds / 60;\n  seconds %= 60;\n\n  if (days > 0) {\n    snprintf(buf, n, \"%ldd %dh %dm\", days, hours, minutes);\n  } else {\n    snprintf(buf, n, \"%dh %dm %lds\", hours, minutes, seconds);\n  }\n}\n\nvoid format_seconds_short(char *buf, unsigned int n, long seconds) {\n  long days;\n  int hours, minutes;\n\n  if (times_in_seconds.get(*state)) {\n    snprintf(buf, n, \"%ld\", seconds);\n    return;\n  }\n\n  days = seconds / 86400;\n  seconds %= 86400;\n  hours = seconds / 3600;\n  seconds %= 3600;\n  minutes = seconds / 60;\n  seconds %= 60;\n\n  if (days > 0) {\n    snprintf(buf, n, \"%ldd %dh\", days, hours);\n  } else if (hours > 0) {\n    snprintf(buf, n, \"%dh %dm\", hours, minutes);\n  } else {\n    snprintf(buf, n, \"%dm %lds\", minutes, seconds);\n  }\n}\n\nconky::simple_config_setting<bool> no_buffers(\"no_buffers\", true, true);\nconky::simple_config_setting<std::string> bar_fill(\"console_bar_fill\", \"#\",\n                                                   false);\nconky::simple_config_setting<std::string> bar_unfill(\"console_bar_unfill\", \".\",\n                                                     false);\nconky::simple_config_setting<std::string> github_token(\"github_token\", \"\",\n                                                       false);\n\nvoid update_stuff() {\n  /* clear speeds, addresses and up status in case device was removed and\n   *  doesn't get updated */\n\n#ifdef HAVE_OPENMP\n#pragma omp parallel for schedule(dynamic, 10)\n#endif /* HAVE_OPENMP */\n  for (int i = 0; i < MAX_NET_INTERFACES; ++i) {\n    if (netstats[i].dev != nullptr) {\n      netstats[i].up = 0;\n      netstats[i].recv_speed = 0.0;\n      netstats[i].trans_speed = 0.0;\n      netstats[i].addr.sa_data[2] = 0;\n      netstats[i].addr.sa_data[3] = 0;\n      netstats[i].addr.sa_data[4] = 0;\n      netstats[i].addr.sa_data[5] = 0;\n    }\n  }\n\n  /* this is a stub on all platforms except solaris */\n  prepare_update();\n\n  /* if you registered a callback with conky::register_cb, this will run it */\n  conky::run_all_callbacks();\n\n#if !defined(__linux__)\n  /* XXX: move the following into the update_meminfo() functions? */\n  if (no_buffers.get(*state)) {\n    info.mem -= info.bufmem;\n    info.memeasyfree += info.bufmem;\n  }\n#endif\n}\n\n/* Ohkie to return negative values for temperatures */\nint round_to_int_temp(float f) { return static_cast<int>(f); }\n/* Don't return negative values for cpugraph, bar, gauge, percentage.\n * Causes unreasonable numbers to show */\nunsigned int round_to_positive_int(float f) {\n  if (f >= 0.0) { return static_cast<int>(f + 0.5); }\n  return 0;\n}\n\nvoid scan_loadavg_arg(struct text_object *obj, const char *arg) {\n  obj->data.i = 0;\n  if ((arg != nullptr) && (arg[1] == 0) &&\n      (isdigit(static_cast<unsigned char>(arg[0])) != 0)) {\n    obj->data.i = strtol(arg, nullptr, 10);\n    if (obj->data.i > 3 || obj->data.i < 1) {\n      NORM_ERR(\"loadavg arg needs to be in range (1,3)\");\n      obj->data.i = 0;\n    }\n  }\n  /* convert to array index (or the default (-1)) */\n  obj->data.i--;\n}\n\nvoid print_loadavg(struct text_object *obj, char *p, unsigned int p_max_size) {\n  float *v = info.loadavg;\n\n  if (obj->data.i < 0) {\n    snprintf(p, p_max_size, \"%.2f %.2f %.2f\", v[0], v[1], v[2]);\n  } else {\n    snprintf(p, p_max_size, \"%.2f\", v[obj->data.i]);\n  }\n}\n\nvoid scan_no_update(struct text_object *obj, const char *arg) {\n  obj->data.s = static_cast<char *>(malloc(text_buffer_size.get(*state)));\n  evaluate(arg, obj->data.s, text_buffer_size.get(*state));\n  obj->data.s =\n      static_cast<char *>(realloc(obj->data.s, strlen(obj->data.s) + 1));\n}\n\nvoid free_no_update(struct text_object *obj) { free(obj->data.s); }\n\nvoid print_no_update(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%s\", obj->data.s);\n}\n\n#ifdef BUILD_GUI\nvoid scan_loadgraph_arg(struct text_object *obj, const char *arg) {\n  scan_graph(obj, arg, 0, FALSE);\n}\n\ndouble loadgraphval(struct text_object *obj) {\n  (void)obj;\n\n  return info.loadavg[0];\n}\n#endif /* BUILD_GUI */\n\nuint8_t cpu_percentage(struct text_object *obj) {\n  if (static_cast<unsigned int>(obj->data.i) > info.cpu_count) {\n    NORM_ERR(\"obj->data.i %i info.cpu_count %i\", obj->data.i, info.cpu_count);\n    CRIT_ERR(\"attempting to use more CPUs than you have!\");\n  }\n  if (info.cpu_usage != nullptr) {\n    return round_to_positive_int(info.cpu_usage[obj->data.i] * 100.0);\n  }\n  return 0;\n}\n\ndouble cpu_barval(struct text_object *obj) {\n  if (static_cast<unsigned int>(obj->data.i) > info.cpu_count) {\n    NORM_ERR(\"obj->data.i %i info.cpu_count %i\", obj->data.i, info.cpu_count);\n    CRIT_ERR(\"attempting to use more CPUs than you have!\");\n  }\n  if (info.cpu_usage != nullptr) { return info.cpu_usage[obj->data.i]; }\n  return 0.;\n}\n\n#define PRINT_HR_GENERATOR(name)                                     \\\n  void print_##name(struct text_object *obj, char *p,                \\\n                    unsigned int p_max_size) {                       \\\n    human_readable(apply_base_multiplier(obj->data.s, info.name), p, \\\n                   p_max_size);                                      \\\n  }\n\nPRINT_HR_GENERATOR(mem)\nPRINT_HR_GENERATOR(memwithbuffers)\nPRINT_HR_GENERATOR(memeasyfree)\nPRINT_HR_GENERATOR(legacymem)\nPRINT_HR_GENERATOR(memactive)\nPRINT_HR_GENERATOR(meminactive)\nPRINT_HR_GENERATOR(memfree)\nPRINT_HR_GENERATOR(memmax)\nPRINT_HR_GENERATOR(memdirty)\nPRINT_HR_GENERATOR(shmem)\nPRINT_HR_GENERATOR(memavail)\nPRINT_HR_GENERATOR(memwired)\nPRINT_HR_GENERATOR(memlaundry)\nPRINT_HR_GENERATOR(swap)\nPRINT_HR_GENERATOR(swapfree)\nPRINT_HR_GENERATOR(swapmax)\n\nuint8_t mem_percentage(struct text_object *obj) {\n  (void)obj;\n\n  return (info.memmax != 0u\n              ? round_to_positive_int(info.mem * 100 / info.memmax)\n              : 0);\n}\n\ndouble mem_barval(struct text_object *obj) {\n  (void)obj;\n\n  return info.memmax != 0u ? (static_cast<double>(info.mem) / info.memmax) : 0;\n}\n\ndouble mem_with_buffers_barval(struct text_object *obj) {\n  (void)obj;\n\n  return info.memmax != 0u\n             ? (static_cast<double>(info.memwithbuffers) / info.memmax)\n             : 0;\n}\n\nuint8_t swap_percentage(struct text_object *obj) {\n  (void)obj;\n\n  return (info.swapmax != 0u\n              ? round_to_positive_int(info.swap * 100 / info.swapmax)\n              : 0);\n}\n\ndouble swap_barval(struct text_object *obj) {\n  (void)obj;\n\n  return info.swapmax != 0u ? (static_cast<double>(info.swap) / info.swapmax)\n                            : 0;\n}\n\nvoid print_kernel(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.uname_s.release);\n}\n\nvoid print_machine(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.uname_s.machine);\n}\n\nvoid print_nodename(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.uname_s.nodename);\n}\n\nvoid print_nodename_short(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.uname_s.nodename);\n  for (int i = 0; p[i] != 0; i++) {\n    if (p[i] == '.') {\n      p[i] = 0;\n      break;\n    }\n  }\n}\n\nvoid print_sysname(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.uname_s.sysname);\n}\n\n#if defined(__DragonFly__)\nvoid print_version(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.uname_v);\n}\n#endif\n\nvoid print_uptime(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  format_seconds(p, p_max_size, static_cast<int>(info.uptime));\n}\n\nvoid print_uptime_short(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  (void)obj;\n  format_seconds_short(p, p_max_size, static_cast<int>(info.uptime));\n}\n\nvoid print_processes(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  (void)obj;\n  spaced_print(p, p_max_size, \"%hu\", 4, info.procs);\n}\n\nvoid print_running_processes(struct text_object *obj, char *p,\n                             unsigned int p_max_size) {\n  (void)obj;\n  spaced_print(p, p_max_size, \"%hu\", 4, info.run_procs);\n}\n\nvoid print_running_threads(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  (void)obj;\n  spaced_print(p, p_max_size, \"%hu\", 4, info.run_threads);\n}\n\nvoid print_threads(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  spaced_print(p, p_max_size, \"%hu\", 4, info.threads);\n}\n\nvoid print_buffers(struct text_object *obj, char *p, unsigned int p_max_size) {\n  human_readable(apply_base_multiplier(obj->data.s, info.buffers), p,\n                 p_max_size);\n}\n\nvoid print_cached(struct text_object *obj, char *p, unsigned int p_max_size) {\n  human_readable(apply_base_multiplier(obj->data.s, info.cached), p,\n                 p_max_size);\n}\n\nvoid print_free_bufcache(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  human_readable(apply_base_multiplier(obj->data.s, info.free_bufcache), p,\n                 p_max_size);\n}\n\nvoid print_free_cached(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  human_readable(apply_base_multiplier(obj->data.s, info.free_cached), p,\n                 p_max_size);\n}\n\nvoid print_evaluate(struct text_object *obj, char *p, unsigned int p_max_size) {\n  std::vector<char> buf(text_buffer_size.get(*state));\n  evaluate(obj->data.s, &buf[0], buf.size());\n  evaluate(&buf[0], p, p_max_size);\n}\n\nint if_empty_iftest(struct text_object *obj) {\n  std::vector<char> buf(max_user_text.get(*state));\n  int result = 1;\n\n  generate_text_internal(&(buf[0]), max_user_text.get(*state), *obj->sub);\n\n  if (strlen(&(buf[0])) != 0) { result = 0; }\n  return result;\n}\n\nstatic int check_contains(char *f, char *s) {\n  int ret = 0;\n  FILE *where = open_file(f, nullptr);\n\n  if (where != nullptr) {\n    char buf1[256];\n\n    while (fgets(buf1, 256, where) != nullptr) {\n      if (strstr(buf1, s) != nullptr) {\n        ret = 1;\n        break;\n      }\n    }\n    fclose(where);\n  } else {\n    NORM_ERR(\"Could not open the file\");\n  }\n  return ret;\n}\n\nint if_existing_iftest(struct text_object *obj) {\n  char *spc;\n  int result = 0;\n\n  spc = strchr(obj->data.s, ' ');\n  if (spc != nullptr) { *spc = 0; }\n  if (access(obj->data.s, F_OK) == 0) {\n    if (spc == nullptr || (check_contains(obj->data.s, spc + 1) != 0)) {\n      result = 1;\n    }\n  }\n  if (spc != nullptr) { *spc = ' '; }\n  return result;\n}\n\nint if_running_iftest(struct text_object *obj) {\n  if (!is_process_running(obj->data.s)) { return 0; }\n  return 1;\n}\n\n#ifndef __OpenBSD__\nvoid print_acpitemp(struct text_object *obj, char *p, unsigned int p_max_size) {\n  temp_print(p, p_max_size, get_acpi_temperature(obj->data.i), TEMP_CELSIUS, 1);\n}\n\nvoid free_acpitemp(struct text_object *obj) { close(obj->data.i); }\n#endif /* !__OpenBSD__ */\n\nvoid print_freq(struct text_object *obj, char *p, unsigned int p_max_size) {\n  static int ok = 1;\n  if (ok != 0) { ok = get_freq(p, p_max_size, \"%.0f\", 1, obj->data.i); }\n}\n\nvoid print_freq_g(struct text_object *obj, char *p, unsigned int p_max_size) {\n  static int ok = 1;\n  if (ok != 0) {\n#ifndef __OpenBSD__\n    ok = get_freq(p, p_max_size, \"%'.2f\", 1000, obj->data.i);\n#else\n    /* OpenBSD has no such flag (SUSv2) */\n    ok = get_freq(p, p_max_size, \"%.2f\", 1000, obj->data.i);\n#endif /* __OpenBSD */\n  }\n}\n\n#ifndef __OpenBSD__\nvoid print_acpifan(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  get_acpi_fan(p, p_max_size);\n}\n\nvoid print_acpiacadapter(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  get_acpi_ac_adapter(p, p_max_size,\n                      static_cast<const char *>(obj->data.opaque));\n}\n\nvoid print_battery(struct text_object *obj, char *p, unsigned int p_max_size) {\n  get_battery_stuff(p, p_max_size, obj->data.s, BATTERY_STATUS);\n}\n\nvoid print_battery_time(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  get_battery_stuff(p, p_max_size, obj->data.s, BATTERY_TIME);\n}\n\nvoid battery_power_draw(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  get_battery_power_draw(p, p_max_size, obj->data.s);\n}\n\nuint8_t battery_percentage(struct text_object *obj) {\n  return get_battery_perct(obj->data.s);\n}\n\nvoid print_battery_short(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  get_battery_short_status(p, p_max_size, obj->data.s);\n}\n\nvoid print_battery_status(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  get_battery_stuff(p, p_max_size, obj->data.s, BATTERY_STATUS);\n  if (0 == strncmp(\"charging\", p, 8)) {\n    snprintf(p, p_max_size, \"%s\", \"charging\");\n  } else if (0 == strncmp(\"discharging\", p, 11) ||\n             0 == strncmp(\"remaining\", p, 9)) {\n    snprintf(p, p_max_size, \"%s\", \"discharging\");\n  } else if (0 == strncmp(\"charged\", p, 7)) {\n    snprintf(p, p_max_size, \"%s\", \"charged\");\n  } else if (0 == strncmp(\"not present\", p, 11) ||\n             0 == strncmp(\"absent/on AC\", p, 12)) {\n    snprintf(p, p_max_size, \"%s\", \"not present\");\n  } else if (0 == strncmp(\"empty\", p, 5)) {\n    snprintf(p, p_max_size, \"%s\", \"empty\");\n  } else if (0 == strncmp(\"unknown\", p, 7)) {\n    snprintf(p, p_max_size, \"%s\", \"unknown\");\n  }\n}\n#endif /* !__OpenBSD__ */\n\nvoid print_blink(struct text_object *obj, char *p, unsigned int p_max_size) {\n  // blinking like this can look a bit ugly if the chars in the font don't have\n  // the same width\n  std::vector<char> buf(max_user_text.get(*state));\n  static int visible = 1;\n  static int last_len = 0;\n  int i;\n\n  if (visible != 0) {\n    generate_text_internal(&(buf[0]), max_user_text.get(*state), *obj->sub);\n    last_len = strlen(&(buf[0]));\n  } else {\n    for (i = 0; i < last_len; i++) { buf[i] = ' '; }\n  }\n\n  snprintf(p, p_max_size, \"%s\", &(buf[0]));\n  visible = static_cast<int>(static_cast<int>(visible) == 0);\n}\n\nvoid print_include(struct text_object *obj, char *p, unsigned int p_max_size) {\n  std::vector<char> buf(max_user_text.get(*state));\n\n  if (obj->sub == nullptr) { return; }\n\n  generate_text_internal(&(buf[0]), max_user_text.get(*state), *obj->sub);\n  snprintf(p, p_max_size, \"%s\", &(buf[0]));\n}\n\n#ifdef BUILD_CURL\nnamespace {\nconstexpr char kGithubNotificationsUrl[] =\n    \"https://api.github.com/notifications\";\n}\n\nstd::string github_notifications_url() { return kGithubNotificationsUrl; }\n\nstd::string github_authorization_header(const std::string &token) {\n  return \"Authorization: Bearer \" + token;\n}\n\n#define NEW_TOKEN                       \\\n  \"https://github.com/settings/tokens/\" \\\n  \"new?scopes=notifications&description=conky-query-github\\n\"\nstatic size_t read_github_data_cb(char *, size_t, size_t, char *);\nstatic size_t read_github_data_cb(char *data, size_t size, size_t nmemb,\n                                  char *p) {\n  char *ptr = data;\n  size_t sz = nmemb * size;\n  size_t z = 0;\n  static size_t x = 0;\n  static unsigned int skip = 0U;\n\n  for (; *ptr; ptr++, z++) {\n    if (z + 4 < sz) { /* Verifying up to *(ptr+4) */\n      if ('u' == *ptr && 'n' == *(ptr + 1) && 'r' == *(ptr + 2) &&\n          'e' == *(ptr + 3)) { /* \"unread\" */\n        ++x;\n        skip = 0U;\n      }\n      if ('m' == *ptr && 'e' == *(ptr + 1) && 's' == *(ptr + 2) &&\n          's' == *(ptr + 3) && z + 13 < sz) { /* \"message\": */\n        if ('B' == *(ptr + 10) && 'a' == *(ptr + 11) &&\n            'd' == *(ptr + 12)) { /* \"Bad credentials\" */\n          NORM_ERR(\"Bad credentials: generate a new token:\\n\" NEW_TOKEN);\n          snprintf(p, 80, \"%s\",\n                   \"GitHub: Bad credentials, generate a new token.\");\n          skip = 1U;\n          break;\n        }\n        if ('M' == *(ptr + 10) && 'i' == *(ptr + 11) &&\n            's' == *(ptr + 12)) { /* Missing the 'notifications' scope. */\n          NORM_ERR(\n              \"Missing 'notifications' scope. Generate a new \"\n              \"token\\n\" NEW_TOKEN);\n          snprintf(\n              p, 80, \"%s\",\n              \"GitHub: Missing the notifications scope. Generate a new token.\");\n          skip = 1U;\n          break;\n        }\n      }\n    }\n  }\n  if (0U == skip) { snprintf(p, 49, \"%zu\", x); }\n  return sz;\n}\n\nvoid print_github(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  static char cached_result[256] = {\"\"};\n  static unsigned int last_update = 1U;\n  CURL *curl = nullptr;\n  CURLcode res;\n  struct curl_slist *headers = nullptr;\n  std::string token = github_token.get(*state);\n\n  if (token.empty()) {\n    NORM_ERR(\n        \"${github_notifications} requires token. \"\n        \"Go ahead and generate one \" NEW_TOKEN\n        \"Insert it in conky.config = { github_token='TOKEN_SHA' }\\n\");\n    snprintf(p, p_max_size, \"%s\",\n             \"GitHub notifications requires token, generate a new one.\");\n    return;\n  }\n\n  if (1U != last_update) {\n    --last_update;\n    snprintf(p, p_max_size, \"%s\", cached_result);\n    return;\n  }\n\n  curl_global_init(CURL_GLOBAL_ALL);\n  if (nullptr == (curl = curl_easy_init())) { goto error; }\n  headers =\n      curl_slist_append(headers, github_authorization_header(token).c_str());\n  if (headers == nullptr) { goto error; }\n  curl_easy_setopt(curl, CURLOPT_URL, github_notifications_url().c_str());\n  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);\n#if defined(CURLOPT_ACCEPT_ENCODING)\n  curl_easy_setopt(curl, CURLOPT_ACCEPT_ENCODING, \"gzip\");\n#else  /* defined(CURLOPT_ACCEPT_ENCODING) */\n  curl_easy_setopt(curl, CURLOPT_ENCODING, \"gzip\");\n#endif /* defined(CURLOPT_ACCEPT_ENCODING) */\n  curl_easy_setopt(curl, CURLOPT_USERAGENT, \"conky-github/1.0\");\n  curl_easy_setopt(curl, CURLOPT_USE_SSL, (long)CURLUSESSL_ALL);\n  curl_easy_setopt(curl, CURLOPT_TIMEOUT, 20L);\n  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, read_github_data_cb);\n  curl_easy_setopt(curl, CURLOPT_WRITEDATA, p);\n\n  res = curl_easy_perform(curl);\n  if (CURLE_OK != res) { goto error; }\n  snprintf(cached_result, 255, \"%s\", p);\n  last_update = 60U;\n\nerror:\n  if (headers != nullptr) { curl_slist_free_all(headers); }\n  if (nullptr != curl) { curl_easy_cleanup(curl); }\n  curl_global_cleanup();\n\n  if (!isdigit(static_cast<unsigned char>(*p))) { last_update = 1U; }\n}\n\nvoid print_stock(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (!obj->data.s) {\n    p[0] = 0;\n    return;\n  }\n  ccurl_process_info(p, p_max_size, obj->data.s, 1);\n}\n\nvoid free_stock(struct text_object *obj) { free(obj->data.s); }\n#endif /* BUILD_CURL */\n\nvoid print_to_bytes(struct text_object *obj, char *p, unsigned int p_max_size) {\n  std::vector<char> buf(max_user_text.get(*state));\n  long double bytes;\n  char unit[16];  // 16 because we can also have long names (like mega-bytes)\n\n  generate_text_internal(&(buf[0]), max_user_text.get(*state), *obj->sub);\n  if (sscanf(&(buf[0]), \"%Lf%s\", &bytes, unit) == 2 && strlen(unit) < 16) {\n    if (strncasecmp(\"b\", unit, 1) == 0) {\n      snprintf(&(buf[0]), max_user_text.get(*state), \"%Lf\", bytes);\n    } else if (strncasecmp(\"k\", unit, 1) == 0) {\n      snprintf(&(buf[0]), max_user_text.get(*state), \"%Lf\", bytes * 1024);\n    } else if (strncasecmp(\"m\", unit, 1) == 0) {\n      snprintf(&(buf[0]), max_user_text.get(*state), \"%Lf\",\n               bytes * 1024 * 1024);\n    } else if (strncasecmp(\"g\", unit, 1) == 0) {\n      snprintf(&(buf[0]), max_user_text.get(*state), \"%Lf\",\n               bytes * 1024 * 1024 * 1024);\n    } else if (strncasecmp(\"t\", unit, 1) == 0) {\n      snprintf(&(buf[0]), max_user_text.get(*state), \"%Lf\",\n               bytes * 1024 * 1024 * 1024 * 1024);\n    }\n  }\n  snprintf(p, p_max_size, \"%s\", &(buf[0]));\n}\n\nvoid print_updates(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%d\", get_total_updates());\n}\n\nint updatenr_iftest(struct text_object *obj) {\n  if (get_total_updates() % get_updatereset() != obj->data.i - 1) { return 0; }\n  return 1;\n}\n"
  },
  {
    "path": "src/common.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _COMMON_H\n#define _COMMON_H\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <sys/socket.h>\n#include <filesystem>\n#include <optional>\n#include <string>\n\n#include \"content/text_object.h\"\n#include \"lua/setting.hh\"\n\nchar *readfile(const char *filename, int *total_read, char showerror);\n\nvoid print_to_bytes(struct text_object *, char *, unsigned int);\n\nvoid strfold(char *start, int count);\nint check_mount(struct text_object *);\nvoid prepare_update(void);\nint update_uptime(void);\nint update_meminfo(void);\nint update_net_stats(void);\nint update_cpu_usage(void);\nint update_total_processes(void);\nint update_uname(void);\nint update_threads(void);\nint update_running_processes(void);\nvoid update_stuff(void);\nchar get_freq(char *, size_t, const char *, int, unsigned int);\nvoid print_voltage_mv(struct text_object *, char *, unsigned int);\nvoid print_voltage_v(struct text_object *, char *, unsigned int);\nint update_load_average(void);\nvoid free_all_processes(void);\nstruct process *get_first_process(void);\nvoid get_cpu_count(void);\ndouble get_time(void);\n\n/// @brief Handles environment variable expansion in paths and canonicalization.\n///\n/// Examples:\n/// - `~/conky` -> `/home/conky_user/conky`\n/// - `$HOME/conky` -> `/home/conky_user/conky`\n/// - `$HOME/a/b/../c/../../conky` -> `/home/conky_user/conky`\nstd::filesystem::path to_real_path(const std::string &source);\nFILE *open_file(const char *file, int *reported);\nint open_fifo(const char *file, int *reported);\n\n/// Returns current working directory of conky.\nstd::filesystem::path get_cwd();\n/// Returns the username of user/account that started conky.\nstd::string current_username();\n/// Returns home directory of user with `username`.\nstd::optional<std::filesystem::path> user_home(const std::string &username);\n/// Returns home directory of user with `current_username`.\nstd::optional<std::filesystem::path> user_home();\n/// Performs tilde expansion on a path-like string and returns the result.\nstd::string tilde_expand(const std::string &unexpanded);\n/// Performs variable substitution on a string and returns the result.\nstd::string variable_substitute(std::string s);\n\nvoid format_seconds(char *buf, unsigned int n, long seconds);\nvoid format_seconds_short(char *buf, unsigned int n, long seconds);\n\nint round_to_int_temp(float);\n\nunsigned int round_to_positive_int(float);\n\nextern conky::simple_config_setting<bool> no_buffers;\nextern conky::simple_config_setting<std::string> bar_fill;\nextern conky::simple_config_setting<std::string> bar_unfill;\nextern conky::simple_config_setting<std::string> github_token;\n\nint open_acpi_temperature(const char *name);\ndouble get_acpi_temperature(int fd);\nvoid get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,\n                         const char *adapter);\nvoid get_acpi_fan(char *, size_t);\nvoid get_battery_stuff(char *buf, unsigned int n, const char *bat, int item);\nint get_battery_perct(const char *bat);\nvoid get_battery_power_draw(char *buffer, unsigned int n, const char *bat);\ndouble get_battery_perct_bar(struct text_object *);\nvoid get_battery_short_status(char *buf, unsigned int n, const char *bat);\n\nvoid scan_no_update(struct text_object *, const char *);\nvoid print_no_update(struct text_object *, char *, unsigned int);\nvoid free_no_update(struct text_object *);\n\nvoid scan_loadavg_arg(struct text_object *, const char *);\nvoid print_loadavg(struct text_object *, char *, unsigned int);\n#ifdef BUILD_GUI\nvoid scan_loadgraph_arg(struct text_object *, const char *);\ndouble loadgraphval(struct text_object *);\n#endif /* BUILD_GUI */\n\nuint8_t cpu_percentage(struct text_object *);\ndouble cpu_barval(struct text_object *);\n\nvoid print_mem(struct text_object *, char *, unsigned int);\nvoid print_memwithbuffers(struct text_object *, char *, unsigned int);\nvoid print_memeasyfree(struct text_object *, char *, unsigned int);\nvoid print_legacymem(struct text_object *, char *, unsigned int);\nvoid print_memfree(struct text_object *, char *, unsigned int);\nvoid print_memmax(struct text_object *, char *, unsigned int);\nvoid print_memactive(struct text_object *, char *, unsigned int);\nvoid print_meminactive(struct text_object *, char *, unsigned int);\nvoid print_memwired(struct text_object *, char *, unsigned int);\nvoid print_memlaundry(struct text_object *, char *, unsigned int);\nvoid print_memdirty(struct text_object *, char *, unsigned int);\nvoid print_shmem(struct text_object *, char *, unsigned int);\nvoid print_memavail(struct text_object *, char *, unsigned int);\nvoid print_swap(struct text_object *, char *, unsigned int);\nvoid print_swapfree(struct text_object *, char *, unsigned int);\nvoid print_swapmax(struct text_object *, char *, unsigned int);\nuint8_t mem_percentage(struct text_object *);\ndouble mem_barval(struct text_object *);\ndouble mem_with_buffers_barval(struct text_object *);\nuint8_t swap_percentage(struct text_object *);\ndouble swap_barval(struct text_object *);\n\nvoid print_kernel(struct text_object *, char *, unsigned int);\nvoid print_machine(struct text_object *, char *, unsigned int);\nvoid print_nodename(struct text_object *, char *, unsigned int);\nvoid print_nodename_short(struct text_object *, char *, unsigned int);\nvoid print_sysname(struct text_object *, char *, unsigned int);\n\n#if defined(__DragonFly__)\nvoid print_version(struct text_object *obj, char *p, unsigned int p_max_size);\n#endif\n\nvoid print_uptime(struct text_object *, char *, unsigned int);\nvoid print_uptime_short(struct text_object *, char *, unsigned int);\n\nvoid print_processes(struct text_object *, char *, unsigned int);\nvoid print_running_processes(struct text_object *, char *, unsigned int);\nvoid print_running_threads(struct text_object *, char *, unsigned int);\nvoid print_threads(struct text_object *, char *, unsigned int);\n\nvoid print_buffers(struct text_object *, char *, unsigned int);\nvoid print_cached(struct text_object *, char *, unsigned int);\nvoid print_free_bufcache(struct text_object *, char *, unsigned int);\nvoid print_free_cached(struct text_object *, char *, unsigned int);\n\nvoid print_evaluate(struct text_object *, char *, unsigned int);\n\nint if_empty_iftest(struct text_object *);\nint if_existing_iftest(struct text_object *);\nint if_running_iftest(struct text_object *);\n\n#ifndef __OpenBSD__\nvoid print_acpitemp(struct text_object *, char *, unsigned int);\nvoid free_acpitemp(struct text_object *);\n#endif /* !__OpenBSD__ */\n\nvoid print_freq(struct text_object *, char *, unsigned int);\nvoid print_freq_g(struct text_object *, char *, unsigned int);\n\n#ifndef __OpenBSD__\nvoid print_acpifan(struct text_object *, char *, unsigned int);\nvoid print_acpiacadapter(struct text_object *, char *, unsigned int);\nvoid print_battery(struct text_object *, char *, unsigned int);\nvoid print_battery_time(struct text_object *, char *, unsigned int);\nuint8_t battery_percentage(struct text_object *);\nvoid battery_power_draw(struct text_object *, char *, unsigned int);\nvoid print_battery_short(struct text_object *, char *, unsigned int);\nvoid print_battery_status(struct text_object *, char *, unsigned int);\n#endif /* !__OpenBSD__ */\n\nvoid free_cpu(struct text_object *);\n\nvoid print_blink(struct text_object *, char *, unsigned int);\nvoid print_include(struct text_object *, char *, unsigned int);\n\nvoid print_updates(struct text_object *, char *, unsigned int);\nint updatenr_iftest(struct text_object *);\n\n#ifdef BUILD_CURL\nvoid print_github(struct text_object *, char *, unsigned int);\nvoid print_stock(struct text_object *, char *, unsigned int);\nvoid free_stock(struct text_object *);\nstd::string github_notifications_url();\nstd::string github_authorization_header(const std::string &token);\n#endif /* BUILD_CURL */\n\n#endif /* _COMMON_H */\n"
  },
  {
    "path": "src/conky-imlib2.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, et. al.\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"conky-imlib2.h\"\n\n#include \"common.h\"\n#include \"output/display-output.hh\"\n#include \"logging.h\"\n#include \"content/text_object.h\"\n\n#include <Imlib2.h>\n#include <climits>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <ctime>\n\n#include \"lua/x11-settings.h\"\n#include \"output/x11.h\"\n\nstruct image_list_s {\n  char name[1024];\n  Imlib_Image image;\n  int x, y, w, h;\n  int wh_set;\n  char no_cache;\n  int flush_interval;\n  struct image_list_s *next;\n};\n\nstruct image_list_s *image_list_start, *image_list_end;\nstd::array<std::array<int, 2>, 100> saved_coordinates;\n\n/* areas to update */\nImlib_Updates updates, current_update;\n/* our virtual framebuffer image we draw into */\nImlib_Image buffer, image;\n\nconky::range_config_setting<unsigned int> imlib_cache_flush_interval(\n    \"imlib_cache_flush_interval\", 0, std::numeric_limits<unsigned int>::max(),\n    0, true);\n\nconky::simple_config_setting<bool> imlib_draw_blended(\"draw_blended\", true,\n                                                      true);\n\nnamespace {\nImlib_Context context;\n\nunsigned int cimlib_cache_flush_last = 0;\n}  // namespace\n\nvoid imlib_cache_size_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (display == nullptr || window.visual == nullptr) {\n    ++s;\n    return;\n  }\n\n  if (init && out_to_x.get(l)) {\n    image_list_start = image_list_end = nullptr;\n    context = imlib_context_new();\n    imlib_context_push(context);\n    imlib_set_cache_size(do_convert(l, -1).first);\n    /* set the maximum number of colors to allocate for 8bpp and less to 256 */\n    imlib_set_color_usage(256);\n    /* dither for depths < 24bpp */\n    imlib_context_set_dither(1);\n    /* set the display , visual, colormap and drawable we are using */\n    imlib_context_set_display(display);\n    imlib_context_set_visual(window.visual);\n    imlib_context_set_colormap(window.colourmap);\n    imlib_context_set_drawable(window.drawable);\n  }\n\n  ++s;\n}\n\nvoid imlib_cache_size_setting::cleanup(lua::state &l) {\n  lua::stack_sentry s(l, -1);\n\n  if (out_to_x.get(l)) {\n    cimlib_cleanup();\n    imlib_context_disconnect_display();\n    imlib_context_pop();\n    imlib_context_free(context);\n  }\n}\n\nvoid cimlib_cleanup() {\n  struct image_list_s *cur = image_list_start, *last = nullptr;\n  while (cur != nullptr) {\n    last = cur;\n    cur = last->next;\n    delete last;\n  }\n  image_list_start = image_list_end = nullptr;\n}\n\nvoid cimlib_add_image(const char *args) {\n  struct image_list_s *cur = nullptr;\n  const char *tmp;\n\n  cur = new struct image_list_s[sizeof(struct image_list_s)];\n  memset(cur, 0, sizeof(struct image_list_s));\n\n  if (sscanf(args, \"%1023s\", cur->name) == 0) {\n    NORM_ERR(\n        \"Invalid args for $image.  Format is: '<path to image> (-p\"\n        \"x,y) (-s WxH) (-n) (-f interval)' (got '%s')\",\n        args);\n    delete[] cur;\n    return;\n  }\n  strncpy(cur->name, to_real_path(cur->name).c_str(), 1024);\n  cur->name[1023] = 0;\n  //\n  // now we check for optional args\n  tmp = strstr(args, \"-p \");\n  if (tmp != nullptr) {\n    tmp += 3;\n    sscanf(tmp, \"%i,%i\", &cur->x, &cur->y);\n    cur->x = dpi_scale(cur->x);\n    cur->y = dpi_scale(cur->y);\n  }\n  tmp = strstr(args, \"-s \");\n  if (tmp != nullptr) {\n    tmp += 3;\n    if (sscanf(tmp, \"%ix%i\", &cur->w, &cur->h) != 0) { cur->wh_set = 1; }\n    cur->w = dpi_scale(cur->w);\n    cur->h = dpi_scale(cur->h);\n  }\n\n  tmp = strstr(args, \"-n\");\n  if (tmp != nullptr) { cur->no_cache = 1; }\n\n  tmp = strstr(args, \"-f \");\n  if (tmp != nullptr) {\n    tmp += 3;\n    if (sscanf(tmp, \"%d\", &cur->flush_interval) != 0) { cur->no_cache = 0; }\n  }\n  tmp = strstr(args, \"-i \");\n  if (tmp != nullptr) {\n    tmp += 3;\n    int i;\n    if (sscanf(tmp, \"%d\", &i) == 1) {\n      const auto &coordinates = saved_coordinates.at(static_cast<size_t>(i));\n      cur->x = coordinates[0];\n      cur->y = coordinates[1];\n    }\n  }\n  if (cur->flush_interval < 0) {\n    NORM_ERR(\"Imlib2: flush interval should be >= 0\");\n    cur->flush_interval = 0;\n  }\n\n  if (image_list_end != nullptr) {\n    image_list_end->next = cur;\n    image_list_end = cur;\n  } else {\n    image_list_start = image_list_end = cur;\n  }\n}\n\nstatic void cimlib_draw_image(struct image_list_s *cur, int *clip_x,\n                              int *clip_y, int *clip_x2, int *clip_y2) {\n  int w, h;\n  time_t now = time(nullptr);\n  static int rep = 0;\n\n  if (imlib_context_get_drawable() != window.drawable) {\n    imlib_context_set_drawable(window.drawable);\n  }\n\n  image = imlib_load_image(cur->name);\n  if (image == nullptr) {\n    if (rep == 0) { NORM_ERR(\"Unable to load image '%s'\", cur->name); }\n    rep = 1;\n    return;\n  }\n  rep = 0; /* reset so disappearing images are reported */\n\n  DBGP(\n      \"Drawing image '%s' at (%i,%i) scaled to %ix%i, \"\n      \"caching interval set to %i (with -n opt %i)\",\n      cur->name, cur->x, cur->y, cur->w, cur->h, cur->flush_interval,\n      cur->no_cache);\n\n  imlib_context_set_image(image);\n  /* turn alpha channel on */\n  imlib_image_set_has_alpha(1);\n  w = imlib_image_get_width();\n  h = imlib_image_get_height();\n  if (cur->wh_set == 0) {\n    cur->w = dpi_scale(w);\n    cur->h = dpi_scale(h);\n  }\n  imlib_context_set_image(buffer);\n  imlib_blend_image_onto_image(image, 1, 0, 0, w, h, cur->x, cur->y, cur->w,\n                               cur->h);\n  imlib_context_set_image(image);\n  if ((cur->no_cache != 0) ||\n      ((cur->flush_interval != 0) && now % cur->flush_interval == 0)) {\n    imlib_free_image_and_decache();\n  } else {\n    imlib_free_image();\n  }\n  if (cur->x < *clip_x) { *clip_x = cur->x; }\n  if (cur->y < *clip_y) { *clip_y = cur->y; }\n  if (cur->x + cur->w > *clip_x2) { *clip_x2 = cur->x + cur->w; }\n  if (cur->y + cur->h > *clip_y2) { *clip_y2 = cur->y + cur->h; }\n}\n\nstatic void cimlib_draw_all(int *clip_x, int *clip_y, int *clip_x2,\n                            int *clip_y2) {\n  struct image_list_s *cur = image_list_start;\n  while (cur != nullptr) {\n    cimlib_draw_image(cur, clip_x, clip_y, clip_x2, clip_y2);\n    cur = cur->next;\n  }\n}\n\nvoid cimlib_render(int x, int y, int width, int height, uint32_t flush_interval,\n                   bool draw_blended) {\n  int clip_x = INT_MAX, clip_y = INT_MAX;\n  int clip_x2 = 0, clip_y2 = 0;\n  time_t now;\n\n  if (image_list_start == nullptr) {\n    return; /* are we actually drawing anything? */\n  }\n\n  /* cheque if it's time to flush our cache */\n  now = time(nullptr);\n  if ((flush_interval != 0u) &&\n      now - flush_interval > cimlib_cache_flush_last) {\n    int size = imlib_get_cache_size();\n    imlib_set_cache_size(0);\n    imlib_set_cache_size(size);\n    cimlib_cache_flush_last = now;\n    DBGP(\"Flushing Imlib2 cache (%li)\\n\", now);\n  }\n\n  /* take all the little rectangles to redraw and merge them into\n   * something sane for rendering */\n  buffer = imlib_create_image(width, height);\n  /* clear our buffer */\n  imlib_context_set_image(buffer);\n  imlib_image_clear();\n\n  /* check if we should blend when rendering */\n  if (draw_blended) {\n    /* we can blend stuff now */\n    imlib_context_set_blend(1);\n  } else {\n    imlib_context_set_blend(0);\n  }\n\n  /* turn alpha channel on */\n  imlib_image_set_has_alpha(1);\n\n  cimlib_draw_all(&clip_x, &clip_y, &clip_x2, &clip_y2);\n\n  /* set the buffer image as our current image */\n  imlib_context_set_image(buffer);\n\n  /* setup our clip rect */\n  if (clip_x == INT_MAX) { clip_x = 0; }\n  if (clip_y == INT_MAX) { clip_y = 0; }\n\n  /* render the image at 0, 0 */\n  imlib_render_image_part_on_drawable_at_size(\n      clip_x, clip_y, clip_x2 - clip_x, clip_y2 - clip_y, x + clip_x,\n      y + clip_y, clip_x2 - clip_x, clip_y2 - clip_y);\n  /* don't need that temporary buffer image anymore */\n  imlib_free_image();\n}\n\nvoid print_image_callback(struct text_object *obj, char *, unsigned int) {\n  cimlib_add_image(obj->data.s);\n}\n\nimlib_cache_size_setting imlib_cache_size;\n"
  },
  {
    "path": "src/conky-imlib2.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, et. al.\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _CONKY_IMBLI2_H_\n#define _CONKY_IMBLI2_H_\n\n#include \"lua/setting.hh\"\n#include \"content/text_object.h\"\n\n#include <array>\n\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wvariadic-macros\"\n#include <X11/Xlib.h>\n#pragma GCC diagnostic pop\n\nusing saved_coordinates_t = std::array<std::array<int, 2>, 100>;\nextern saved_coordinates_t saved_coordinates;\n\nvoid cimlib_add_image(const char *args);\nvoid cimlib_set_cache_size(long size);\nvoid cimlib_set_cache_flush_interval(long interval);\nvoid cimlib_render(int x, int y, int width, int height, uint32_t flush_interval,\n                   bool draw_blended);\nvoid cimlib_cleanup(void);\n\nvoid print_image_callback(struct text_object *, char *, unsigned int);\n\nclass imlib_cache_size_setting\n    : public conky::range_config_setting<unsigned long> {\n  typedef conky::range_config_setting<unsigned long> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n  virtual void cleanup(lua::state &l);\n\n public:\n  imlib_cache_size_setting()\n      : Base(\"imlib_cache_size\", 0, std::numeric_limits<unsigned long>::max(),\n             4096 * 1024, true) {}\n};\n\nextern conky::range_config_setting<unsigned int> imlib_cache_flush_interval;\nextern conky::simple_config_setting<bool> imlib_draw_blended;\n\n#endif /* _CONKY_IMBLI2_H_ */\n"
  },
  {
    "path": "src/conky.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"conky.h\"\n\n#include \"config.h\"\n\n#include <algorithm>\n#include <cerrno>\n#include <climits>\n#include <clocale>\n#include <cmath>\n#include <cstdarg>\n#include <cstring>\n#include <ctime>\n#include <filesystem>\n#include <iostream>\n#include <memory>\n#include <sstream>\n#include <string>\n#include <vector>\n\n#include <fcntl.h>\n#include <getopt.h>\n#include <netdb.h>\n#include <netinet/in.h>\n#include <sys/param.h>\n#include <sys/stat.h>\n#include <sys/time.h>\n#include <sys/types.h>\n\n#ifdef HAVE_SYS_INOTIFY_H\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wc99-extensions\"\n#include <sys/inotify.h>\n#pragma clang diagnostic pop\n#endif /* HAVE_SYS_INOTIFY_H */\n\n#ifdef HAVE_DIRENT_H\n#include <dirent.h>\n#endif /* HAVE_DIRENT_H */\n\n#include \"common.h\"\n#include \"content/text_object.h\"\n\n#ifdef BUILD_WAYLAND\n#include \"output/wl.h\"\n#endif /* BUILD_WAYLAND */\n\n#ifdef BUILD_X11\n#include \"lua/x11-settings.h\"\n#include \"output/x11.h\"\n\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wvariadic-macros\"\n#include <X11/Xutil.h>\n#pragma GCC diagnostic pop\n#ifdef BUILD_XDAMAGE\n#include <X11/extensions/Xdamage.h>\n#endif\n#ifdef BUILD_IMLIB2\n#include \"conky-imlib2.h\"\n#endif /* BUILD_IMLIB2 */\n#endif /* BUILD_X11 */\n\n#ifdef BUILD_NCURSES\n#include <ncurses.h>\n#endif /* BUILD_NCURSES */\n\n#ifdef BUILD_CURL\n#include <curl/curl.h>\n#endif /* BUILD_CURL */\n\n#ifdef BUILD_RSS\n#include <libxml/parser.h>\n#endif /* BUILD_RSS */\n\n/* local headers */\n#include \"content/colours.hh\"\n#include \"core.h\"\n#include \"data/exec.h\"\n#include \"data/hardware/diskio.h\"\n#ifdef BUILD_GUI\n#include \"lua/fonts.h\"\n#include \"output/gui.h\"\n#endif /* BUILD_GUI */\n#include \"data/fs.h\"\n#ifdef BUILD_ICONV\n#include \"data/iconv_tools.h\"\n#endif /* BUILD_ICONV */\n#include \"content/specials.h\"\n#include \"content/temphelper.h\"\n#include \"content/template.h\"\n#include \"data/network/mail.h\"\n#include \"data/network/net_stat.h\"\n#include \"data/timeinfo.h\"\n#include \"data/top.h\"\n#include \"logging.h\"\n#include \"output/nc.h\"\n\n#ifdef BUILD_MYSQL\n#include \"data/mysql.h\"\n#endif /* BUILD_MYSQL */\n#ifdef BUILD_NVIDIA\n#include \"data/hardware/nvidia.h\"\n#endif /* BUILD_NVIDIA */\n#ifdef BUILD_CURL\n#include \"data/network/ccurl_thread.h\"\n#endif /* BUILD_CURL */\n\n#include \"lua/llua.h\"\n#include \"lua/lua-config.hh\"\n#include \"lua/setting.hh\"\n#include \"output/display-output.hh\"\n\n/* check for OS and include appropriate headers */\n#if defined(__linux__)\n#include \"data/os/linux.h\"\n#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\n#include \"data/os/freebsd.h\"\n#elif defined(__DragonFly__)\n#include \"data/os/dragonfly.h\"\n#elif defined(__OpenBSD__)\n#include \"data/os/openbsd.h\"\n#elif defined(__NetBSD__)\n#include \"data/os/netbsd.h\"\n#endif\n\n#include \"content/gradient.hh\"\n\n#ifdef BUILD_OLD_CONFIG\n#include \"convertconf.h\"\n#endif /* BUILD_OLD_CONFIG */\n\n#ifdef BUILD_BUILTIN_CONFIG\n#include \"defconfig.h\"\n\nnamespace {\nconst char builtin_config_magic[] = \"==builtin==\";\n}  // namespace\n#endif /* BUILD_BUILTIN_CONFIG */\n\n#ifndef S_ISSOCK\n#define S_ISSOCK(x) ((x & S_IFMT) == S_IFSOCK)\n#endif\n\n#define MAX_IF_BLOCK_DEPTH 5\n\n// #define SIGNAL_BLOCKING\n#undef SIGNAL_BLOCKING\n\n/* debugging level, used by logging.h */\nint global_debug_level = 0;\n\n/* disable inotify auto reload feature if desired */\nstatic conky::simple_config_setting<bool> disable_auto_reload(\n    \"disable_auto_reload\", false, false);\n\n/* two strings for internal use */\nstatic char *tmpstring1, *tmpstring2;\n\nenum spacer_state { NO_SPACER = 0, LEFT_SPACER, RIGHT_SPACER };\ntemplate <>\nconky::lua_traits<spacer_state>::Map conky::lua_traits<spacer_state>::map = {\n    {\"none\", NO_SPACER}, {\"left\", LEFT_SPACER}, {\"right\", RIGHT_SPACER}};\nstatic conky::simple_config_setting<spacer_state> use_spacer(\"use_spacer\",\n                                                             NO_SPACER, false);\n\n/* variables holding various config settings */\nstatic conky::simple_config_setting<bool> short_units(\"short_units\", false,\n                                                      true);\nstatic conky::simple_config_setting<bool> format_human_readable(\n    \"format_human_readable\", true, true);\nconky::simple_config_setting<std::string> units_spacer(\"units_spacer\", \"\",\n                                                       false);\n\nconky::simple_config_setting<bool> out_to_stdout(\"out_to_console\",\n// Default value is false, unless we are building without X\n#ifdef BUILD_GUI\n                                                 false,\n#else\n                                                 true,\n#endif\n                                                 false);\nconky::simple_config_setting<bool> out_to_stderr(\"out_to_stderr\", false, false);\n\nint top_cpu, top_mem, top_time;\n#ifdef BUILD_IOSTATS\nint top_io;\n#endif\nint top_running;\n\n/* Update interval */\nconky::range_config_setting<double> update_interval(\n    \"update_interval\", 0.0, std::numeric_limits<double>::infinity(), 3.0, true);\nconky::range_config_setting<double> update_interval_on_battery(\n    \"update_interval_on_battery\", 0.0, std::numeric_limits<double>::infinity(),\n    NOBATTERY, true);\nconky::simple_config_setting<std::string> detect_battery(\"detect_battery\",\n                                                         std::string(\"BAT0\"),\n                                                         false);\nstatic bool on_battery = false;\n\ndouble active_update_interval() {\n  return (on_battery ? update_interval_on_battery : update_interval)\n      .get(*state);\n}\n\nvoid music_player_interval_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  if (l.isnil(-2)) {\n    l.checkstack(1);\n    l.pushnumber(update_interval.get(l));\n    l.replace(-3);\n  }\n\n  Base::lua_setter(l, init);\n\n  ++s;\n}\n\nmusic_player_interval_setting music_player_interval;\n\nvoid *global_cpu = nullptr;\nstatic conky::range_config_setting<unsigned int> max_text_width(\n    \"max_text_width\", 0, std::numeric_limits<unsigned int>::max(), 0, true);\n\n#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\nextern kvm_t *kd;\n#endif\n\n/* prototypes for internally used functions */\nstatic void signal_handler(int /*sig*/);\nstatic void reload_config();\n\nstatic const char *suffixes[] = {_nop(\"B\"),   _nop(\"KiB\"), _nop(\"MiB\"),\n                                 _nop(\"GiB\"), _nop(\"TiB\"), _nop(\"PiB\"),\n                                 \"\"};\n\n#ifdef BUILD_GUI\n\n/* text size */\n\nconky::vec2i text_start;  /* text start position in window */\nconky::vec2i text_offset; /* offset for start position */\nconky::vec2i text_size =\n    conky::vec2i::One(); /* initially 1 so no zero-sized window is created */\n\n#endif /* BUILD_GUI */\n\n/* struct that has all info to be shared between\n * instances of the same text object */\nstruct information info;\n\n/* path to config file */\nstd::filesystem::path current_config;\n\n/* set to 1 if you want all text to be in uppercase */\nstatic conky::simple_config_setting<bool> stuff_in_uppercase(\"uppercase\", false,\n                                                             true);\n\nstatic conky::simple_config_setting<bool> stuff_in_lowercase(\"lowercase\", false,\n                                                             true);\n\n/* Run how many times? */\nstatic conky::range_config_setting<unsigned long> total_run_times(\n    \"total_run_times\", 0, std::numeric_limits<unsigned long>::max(), 0, true);\n\n/* fork? */\nstatic conky::simple_config_setting<bool> fork_to_background(\"background\",\n                                                             false, false);\n\n/* set to 0 after the first time conky is run, so we don't fork again after the\n * first forking */\nint first_pass = 1;\nint argc_copy;\nchar **argv_copy;\n\nconky::range_config_setting<int> cpu_avg_samples(\"cpu_avg_samples\", 1, 14, 2,\n                                                 true);\nconky::range_config_setting<int> net_avg_samples(\"net_avg_samples\", 1, 14, 2,\n                                                 true);\nconky::range_config_setting<int> diskio_avg_samples(\"diskio_avg_samples\", 1, 14,\n                                                    2, true);\n\n#ifdef BUILD_GUI\n/* graph */\nconky::simple_config_setting<bool> show_graph_scale(\"show_graph_scale\", false,\n                                                    false);\nconky::simple_config_setting<bool> show_graph_range(\"show_graph_range\", false,\n                                                    false);\n\nenum gradient_state { RGB_GRADIENT = 0, HSV_GRADIENT, HCL_GRADIENT };\ntemplate <>\nconky::lua_traits<gradient_state>::Map conky::lua_traits<gradient_state>::map =\n    {{\"rgb\", RGB_GRADIENT}, {\"hsv\", HSV_GRADIENT}, {\"hcl\", HCL_GRADIENT}};\nstatic conky::simple_config_setting<gradient_state> graph_gradient_mode(\n    \"graph_gradient_mode\", RGB_GRADIENT, false);\n\n/* Position on the screen */\nconky::simple_config_setting<int> gap_x(\"gap_x\", 5, true);\nconky::simple_config_setting<int> gap_y(\"gap_y\", 60, true);\n\n/* border */\nconky::simple_config_setting<bool> draw_borders(\"draw_borders\", false, false);\nconky::simple_config_setting<bool> draw_graph_borders(\"draw_graph_borders\",\n                                                      true, false);\n\nconky::range_config_setting<char> stippled_borders(\n    \"stippled_borders\", 0, std::numeric_limits<char>::max(), 0, true);\n\nconky::simple_config_setting<bool> draw_shades(\"draw_shades\", true, false);\nconky::simple_config_setting<bool> draw_outline(\"draw_outline\", false, false);\n\n#ifdef OWN_WINDOW\n/* fixed size/pos is set if wm/user changes them */\nint fixed_size = 0, fixed_pos = 0;\n#endif\n\nconky::range_config_setting<int> minimum_height(\"minimum_height\", 0,\n                                                std::numeric_limits<int>::max(),\n                                                5, true);\nconky::range_config_setting<int> minimum_width(\"minimum_width\", 0,\n                                               std::numeric_limits<int>::max(),\n                                               5, true);\nconky::range_config_setting<int> maximum_width(\"maximum_width\", 0,\n                                               std::numeric_limits<int>::max(),\n                                               0, true);\n\nstatic bool isutf8(const char *envvar) {\n  char *s = getenv(envvar);\n  if (s != nullptr) {\n    std::string temp = s;\n    std::transform(temp.begin(), temp.end(), temp.begin(), ::tolower);\n    if ((temp.find(\"utf-8\") != std::string::npos) ||\n        (temp.find(\"utf8\") != std::string::npos)) {\n      return true;\n    }\n  }\n  return false;\n}\n\n/* UTF-8 */\nconky::simple_config_setting<bool> utf8_mode(\"override_utf8_locale\",\n                                             isutf8(\"LC_ALL\") ||\n                                                 isutf8(\"LC_CTYPE\") ||\n                                                 isutf8(\"LANG\"),\n                                             false);\n\n#endif /* BUILD_GUI */\n\n/* maximum size of config TEXT buffer, i.e. below TEXT line. */\nconky::range_config_setting<unsigned int> max_user_text(\n    \"max_user_text\", 47, std::numeric_limits<unsigned int>::max(),\n    MAX_USER_TEXT_DEFAULT, false);\n\n/* maximum size of individual text buffers, ie $exec buffer size */\nconky::range_config_setting<unsigned int> text_buffer_size(\n    \"text_buffer_size\", DEFAULT_TEXT_BUFFER_SIZE,\n    std::numeric_limits<unsigned int>::max(), DEFAULT_TEXT_BUFFER_SIZE, false);\n\n/* pad percentages to decimals? */\nstatic conky::simple_config_setting<int> pad_percents(\"pad_percents\", 0, false);\n\nstatic char *global_text = nullptr;\n\nchar *get_global_text() { return global_text; }\n\nlong global_text_lines;\n\nstatic int total_updates;\nstatic int updatereset;\n\nstd::unique_ptr<lua::state> state;\n\nvoid set_updatereset(int i) { updatereset = i; }\n\nint get_updatereset() { return updatereset; }\n\nint get_total_updates() { return total_updates; }\n\nint calc_text_width(const char *s) {\n  if (display_output()) return display_output()->calc_text_width(s);\n\n  size_t slen = strlen(s);\n  return slen;\n}\n\n#ifdef BUILD_GUI\nconky::gradient_factory *create_gradient_factory(int width, Colour first_colour,\n                                                 Colour last_colour) {\n  switch (graph_gradient_mode.get(*state)) {\n    case RGB_GRADIENT:\n      return new conky::rgb_gradient_factory(width, first_colour, last_colour);\n    case HSV_GRADIENT:\n      return new conky::hsv_gradient_factory(width, first_colour, last_colour);\n    case HCL_GRADIENT:\n      return new conky::hcl_gradient_factory(width, first_colour, last_colour);\n  }\n  return nullptr;\n}\n#endif /* BUILD_GUI */\n\n/* formatted text to render on screen, generated in generate_text(),\n * drawn in draw_stuff() */\n\nstatic char *text_buffer;\n\n/* quite boring functions */\n\nstatic inline void for_each_line(char *b, int f(char *, int)) {\n  char *ps, *pe;\n  int special_index = 0; /* specials index */\n\n  if (b == nullptr) { return; }\n  for (ps = b, pe = b; *pe != 0; pe++) {\n    if (*pe == '\\n') {\n      *pe = '\\0';\n      special_index = f(ps, special_index);\n      *pe = '\\n';\n      ps = pe + 1;\n    }\n  }\n\n  if (ps < pe) { f(ps, special_index); }\n}\n\nstatic void convert_escapes(char *buf) {\n  char *p = buf, *s = buf;\n\n  while (*s != 0) {\n    if (*s == '\\\\') {\n      s++;\n      if (*s == 'n') {\n        *p++ = '\\n';\n      } else if (*s == '\\\\') {\n        *p++ = '\\\\';\n      }\n      s++;\n    } else {\n      *p++ = *s++;\n    }\n  }\n  *p = '\\0';\n}\n\n/* Prints anything normally printed with snprintf according to the current value\n * of use_spacer.  Actually slightly more flexible than snprintf, as you can\n * safely specify the destination buffer as one of your inputs.  */\nint spaced_print(char *buf, int size, const char *format, int width, ...) {\n  int len = 0;\n  va_list argp;\n  char *tempbuf;\n\n  if (size < 1) { return 0; }\n  tempbuf = new char[size];\n\n  // Passes the varargs along to vsnprintf\n  va_start(argp, width);\n  vsnprintf(tempbuf, size, format, argp);\n  va_end(argp);\n\n  switch (use_spacer.get(*state)) {\n    case NO_SPACER:\n      len = snprintf(buf, size, \"%s\", tempbuf);\n      break;\n    case LEFT_SPACER:\n      len = snprintf(buf, size, \"%*s\", width, tempbuf);\n      break;\n    case RIGHT_SPACER:\n      len = snprintf(buf, size, \"%-*s\", width, tempbuf);\n      break;\n  }\n  delete[] tempbuf;\n  return len;\n}\n\n/* print percentage values\n *\n * - i.e., unsigned values between 0 and 100\n * - respect the value of pad_percents */\nint percent_print(char *buf, int size, unsigned value) {\n  return spaced_print(buf, size, \"%u\", pad_percents.get(*state), value);\n}\n\n/* converts from bytes to human readable format (K, M, G, T)\n *\n * The algorithm always divides by 1024, as unit-conversion of byte\n * counts suggests. But for output length determination we need to\n * compare with 1000 here, as we print in decimal form. */\nvoid human_readable(long long num, char *buf, int size) {\n  const char **suffix = suffixes;\n  float fnum;\n  int precision;\n  int width;\n  const char *format;\n\n  /* Possibly just output as usual, for example for stdout usage */\n  if (!format_human_readable.get(*state)) {\n    spaced_print(buf, size, \"%lld\", 6, num);\n    return;\n  }\n  if (short_units.get(*state)) {\n    width = 5;\n    format = \"%.*f%s%.1s\";\n  } else {\n    width = 7;\n    format = \"%.*f%s%-.3s\";\n  }\n  width += strlen(units_spacer.get(*state).c_str());\n\n  if (llabs(num) < 1000LL) {\n    spaced_print(buf, size, format, width, 0, static_cast<float>(num),\n                 units_spacer.get(*state).c_str(), _(*suffix));\n    return;\n  }\n\n  while (llabs(num / 1024) >= 1000LL && (**(suffix + 2) != 0)) {\n    num /= 1024;\n    suffix++;\n  }\n\n  suffix++;\n  fnum = num / 1024.0;\n\n  /* fnum should now be < 1000, so looks like 'AAA.BBBBB'\n   *\n   * The goal is to always have a significance of 3, by\n   * adjusting the decimal part of the number. Sample output:\n   *  123MiB\n   * 23.4GiB\n   * 5.12B\n   * so the point of alignment resides between number and unit. The\n   * upside of this is that there is minimal padding necessary, though\n   * there should be a way to make alignment take place at the decimal\n   * dot (then with fixed width decimal part).\n   *\n   * Note the repdigits below: when given a precision value, printf()\n   * rounds the float to it, not just cuts off the remaining digits. So\n   * e.g. 99.95 with a precision of 1 gets 100.0, which again should be\n   * printed with a precision of 0. Yay. */\n\n  precision = 0; /* print 100-999 without decimal part */\n  if (fnum < 99.95) { precision = 1; /* print 10-99 with one decimal place */ }\n  if (fnum < 9.995) { precision = 2; /* print 0-9 with two decimal places */ }\n\n  spaced_print(buf, size, format, width, precision, fnum,\n               units_spacer.get(*state).c_str(), _(*suffix));\n}\n\n/* global object list root element */\nstatic struct text_object global_root_object;\n\nstatic Colour current_text_color;\n\nvoid set_current_text_color(Colour colour) { current_text_color = colour; }\n\nColour get_current_text_color() { return current_text_color; }\n\nstatic void extract_variable_text(const char *p) {\n  free_text_objects(&global_root_object);\n  delete_block_and_zero(tmpstring1);\n  delete_block_and_zero(tmpstring2);\n  delete_block_and_zero(text_buffer);\n\n  extract_variable_text_internal(&global_root_object, p);\n}\n\nvoid parse_conky_vars(struct text_object *root, const char *txt, char *p,\n                      int p_max_size) {\n  extract_variable_text_internal(root, txt);\n  generate_text_internal(p, p_max_size, *root);\n}\n\n/* IFBLOCK jumping algorithm\n *\n * This is easier as it looks like:\n * - each IF checks it's condition\n *   - on FALSE: jump\n *   - on TRUE: don't care\n * - each ELSE jumps unconditionally\n * - each ENDIF is silently being ignored\n *\n * Why this works (or: how jumping works):\n * Jumping means to overwrite the \"obj\" variable of the loop and set it to the\n * target (i.e. the corresponding ELSE or ENDIF). After that, the for-loop does\n * the rest: as regularly, \"obj\" is being updated to point to obj->next, so\n * object parsing continues right after the corresponding ELSE or ENDIF. This\n * means that if we find an ELSE, it's corresponding IF must not have jumped,\n * so we need to jump always. If we encounter an ENDIF, it's corresponding IF\n * or ELSE has not jumped, and there is nothing to do.\n */\nvoid generate_text_internal(char *p, int p_max_size, struct text_object root) {\n  struct text_object *obj;\n  size_t a;\n\n  if (p == nullptr) { return; }\n\n#ifdef BUILD_ICONV\n  char *buff_in;\n\n  buff_in = new char[p_max_size];\n  memset(buff_in, 0, p_max_size);\n#endif /* BUILD_ICONV */\n\n  p[0] = 0;\n  obj = root.next;\n  while ((obj != nullptr) && p_max_size > 0) {\n    /* check callbacks for existence and act accordingly */\n    if (obj->callbacks.print != nullptr) {\n      (*obj->callbacks.print)(obj, p, p_max_size);\n    } else if (obj->callbacks.iftest != nullptr) {\n      if ((*obj->callbacks.iftest)(obj) == 0) {\n        DBGP2(\"jumping\");\n        if (obj->ifblock_next != nullptr) { obj = obj->ifblock_next; }\n      }\n    } else if (obj->callbacks.barval != nullptr) {\n      new_bar(obj, p, p_max_size, (*obj->callbacks.barval)(obj));\n    } else if (obj->callbacks.gaugeval != nullptr) {\n      new_gauge(obj, p, p_max_size, (*obj->callbacks.gaugeval)(obj));\n#ifdef BUILD_GUI\n    } else if (obj->callbacks.graphval != nullptr) {\n      new_graph(obj, p, p_max_size, (*obj->callbacks.graphval)(obj));\n#endif /* BUILD_GUI */\n    } else if (obj->callbacks.percentage != nullptr) {\n      percent_print(p, p_max_size, (*obj->callbacks.percentage)(obj));\n    }\n\n    a = strlen(p);\n#ifdef BUILD_ICONV\n    iconv_convert(&a, buff_in, p, p_max_size);\n#endif /* BUILD_ICONV */\n    p += a;\n    p_max_size -= a;\n    (*p) = 0;\n\n    obj = obj->next;\n  }\n#ifdef BUILD_GUI\n  /* load any new fonts we may have had */\n  load_fonts(utf8_mode.get(*state));\n#endif /* BUILD_GUI */\n#ifdef BUILD_ICONV\n  delete[] buff_in;\n#endif /* BUILD_ICONV */\n}\n\nvoid evaluate(const char *text, char *p, int p_max_size) {\n  struct text_object subroot {};\n\n  /**\n   * Consider expressions like: ${execp echo '${execp echo hi}'}\n   * These would require run extract_variable_text_internal() before\n   * callbacks and generate_text_internal() after callbacks.\n   */\n  extract_variable_text_internal(&subroot, text);\n  generate_text_internal(p, p_max_size, subroot);\n  DBGP2(\"evaluated '%s' to '%s'\", text, p);\n\n  free_text_objects(&subroot);\n}\n\ndouble current_update_time, next_update_time, last_update_time;\n\nstatic void generate_text() {\n  char *p;\n  unsigned int i, j, k;\n  special_count = 0;\n\n  current_update_time = get_time();\n\n  /* clears netstats info, calls conky::run_all_callbacks(), and changes\n   * some info.mem entries */\n  update_stuff();\n\n  /* populate the text buffer; generate_text_internal() iterates through\n   * global_root_object (an instance of the text_object struct) and calls\n   * any callbacks that were set on startup by construct_text_object(). */\n  p = text_buffer;\n\n  generate_text_internal(p, max_user_text.get(*state), global_root_object);\n  unsigned int mw = max_text_width.get(*state);\n  unsigned int tbs = text_buffer_size.get(*state);\n  if (mw > 0) {\n    for (i = 0, j = 0; p[i] != 0; i++) {\n      if (p[i] == '\\n') {\n        j = 0;\n      } else if (j == mw) {\n        k = i + strlen(p + i) + 1;\n        if (k < tbs) {\n          while (k != i) {\n            p[k] = p[k - 1];\n            k--;\n          }\n          p[k] = '\\n';\n          j = 0;\n        } else {\n          NORM_ERR(\n              \"The end of the text_buffer is reached, increase \"\n              \"\\\"text_buffer_size\\\"\");\n        }\n      } else {\n        j++;\n      }\n    }\n  }\n\n  if (stuff_in_uppercase.get(*state)) {\n    char *tmp_p;\n\n    tmp_p = text_buffer;\n    while (*tmp_p != 0) {\n      *tmp_p = toupper(static_cast<unsigned char>(*tmp_p));\n      tmp_p++;\n    }\n  } else if (stuff_in_lowercase.get(*state)) {\n    char *tmp_p;\n\n    tmp_p = text_buffer;\n    while (*tmp_p != 0) {\n      *tmp_p = tolower(static_cast<unsigned char>(*tmp_p));\n      tmp_p++;\n    }\n  }\n\n  double ui = active_update_interval();\n  double time = get_time();\n  next_update_time += ui;\n  if (next_update_time < time || next_update_time > time + ui) {\n    next_update_time = time - fmod(time, ui) + ui;\n  }\n  last_update_time = current_update_time;\n  total_updates++;\n}\n\nint get_string_width(const char *s) { return *s != 0 ? calc_text_width(s) : 0; }\n\n#ifdef BUILD_GUI\nint get_border_total() {\n  return dpi_scale(border_inner_margin.get(*state)) +\n         dpi_scale(border_outer_margin.get(*state)) +\n         dpi_scale(border_width.get(*state));\n}\n\nvoid remove_first_char(char *s) { memmove(s, s + 1, strlen(s)); }\n\nstatic int get_string_width_special(char *s, int special_index) {\n  char *p, *final;\n  special_node *current = specials;\n  int width = 0;\n  long i;\n\n  if (s == nullptr) { return 0; }\n\n  if (display_output() == nullptr || !display_output()->graphical()) {\n    return strlen(s);\n  }\n\n  p = strndup(s, text_buffer_size.get(*state));\n  final = p;\n\n  for (i = 0; i <= special_index; i++) { current = current->next; }\n\n  while (*p != 0) {\n    if (*p == SPECIAL_CHAR) {\n      /* shift everything over by 1 so that the special char\n       * doesn't mess up the size calculation */\n      remove_first_char(p);\n      /*for (i = 0; i < static_cast<long>(strlen(p)); i++) {\n        *(p + i) = *(p + i + 1);\n      }*/\n      if (current->type == text_node_t::GRAPH ||\n          current->type == text_node_t::GAUGE ||\n          current->type == text_node_t::BAR) {\n        width += current->width;\n      }\n      if (current->type == text_node_t::FONT) {\n        // put all following text until the next fontchange/stringend in\n        // influenced_by_font but do not include specials\n        char *influenced_by_font = strdup(p);\n        special_node *current_after_font = current;\n        // influenced_by_font gets special chars removed, so after this loop i\n        // counts the number of letters (not special chars) influenced by font\n        for (i = 0; influenced_by_font[i] != 0; i++) {\n          if (influenced_by_font[i] == SPECIAL_CHAR) {\n            // remove specials and stop at fontchange\n            current_after_font = current_after_font->next;\n            if (current_after_font->type == text_node_t::FONT) {\n              influenced_by_font[i] = 0;\n              break;\n            }\n            remove_first_char(&influenced_by_font[i]);\n          }\n        }\n        // add the length of influenced_by_font in the new font to width\n        int orig_font = selected_font;\n        selected_font = current->font_added;\n        width += calc_text_width(influenced_by_font);\n        selected_font = orig_font;\n        free(influenced_by_font);\n        // make sure the chars counted in the new font are not again counted\n        // in the old font\n        int specials_skipped = 0;\n        while (i > 0) {\n          if (p[specials_skipped] != SPECIAL_CHAR) {\n            remove_first_char(&p[specials_skipped]);\n            // i only counts non-special chars, so only decrement it for those\n            i--;\n          } else {\n            specials_skipped++;\n          }\n        }\n      }\n      current = current->next;\n    } else {\n      p++;\n    }\n  }\n  if (strlen(final) > 1) { width += calc_text_width(final); }\n  free(final);\n  return width;\n}\n\nstatic int text_size_updater(char *s, int special_index);\n\nint last_font_height;\nvoid update_text_area() {\n  conky::vec2i xy;\n\n  if (display_output() == nullptr || !display_output()->graphical()) { return; }\n\n  /* update text size if it isn't fixed */\n#ifdef OWN_WINDOW\n  if (fixed_size == 0)\n#endif\n  {\n    text_size = conky::vec2i(dpi_scale(minimum_width.get(*state)), 0);\n    last_font_height = font_height();\n    for_each_line(text_buffer, text_size_updater);\n\n    text_size = text_size.max(conky::vec2i(text_size.x() + 1, dpi_scale(minimum_height.get(*state))));\n    int mw = dpi_scale(maximum_width.get(*state));\n    if (mw > 0) text_size = text_size.min(conky::vec2i(mw, text_size.y()));\n  }\n\n  alignment align = text_alignment.get(*state);\n  /* get text position on workarea */\n  switch (vertical_alignment(align)) {\n    case axis_align::START:\n      xy.set_y(workarea.y() + dpi_scale(gap_y.get(*state)));\n      break;\n    case axis_align::END:\n    default:\n      xy.set_y(workarea.end_y() - text_size.y() - dpi_scale(gap_y.get(*state)));\n      break;\n    case axis_align::MIDDLE:\n      xy.set_y(workarea.y() + workarea.height() / 2 - text_size.y() / 2 -\n               dpi_scale(gap_y.get(*state)));\n      break;\n  }\n  switch (horizontal_alignment(align)) {\n    case axis_align::START:\n    default:\n      xy.set_x(workarea.x() + dpi_scale(gap_x.get(*state)));\n      break;\n    case axis_align::END:\n      xy.set_x(workarea.end_x() - text_size.x() - dpi_scale(gap_x.get(*state)));\n      break;\n    case axis_align::MIDDLE:\n      xy.set_x(workarea.x() + workarea.width() / 2 - text_size.x() / 2 -\n               dpi_scale(gap_x.get(*state)));\n      break;\n  }\n#ifdef OWN_WINDOW\n  if (align == alignment::NONE) {  // Let the WM manage the window\n    xy = window.geometry.pos();\n    fixed_pos = 1;\n    fixed_size = 1;\n  }\n#endif /* OWN_WINDOW */\n#ifdef OWN_WINDOW\n\n  if (own_window.get(*state) && (fixed_pos == 0)) {\n    int border_total = get_border_total();\n    text_start = conky::vec2i::uniform(border_total);\n    window.geometry.set_pos(xy - text_start);\n  } else\n#endif\n  {\n    text_start = xy;\n  }\n  /* update lua window globals */\n  llua_update_window_table(conky::rect<int>(text_start, text_size));\n}\n\n/* drawing stuff */\n\nstatic int cur_x, cur_y; /* current x and y for drawing */\n#endif\n// draw_mode also without BUILD_GUI because we only need to print to stdout with\n// FG\nstatic draw_mode_t draw_mode; /* FG, BG or OUTLINE */\n#ifdef BUILD_GUI\n/*static*/ Colour current_color;\n\nstatic int text_size_updater(char *s, int special_index) {\n  int w = 0;\n  char *p;\n  special_node *current = specials;\n\n  for (int i = 0; i < special_index; i++) { current = current->next; }\n\n  if (display_output() == nullptr || !display_output()->graphical()) {\n    return 0;\n  }\n  /* get string widths and skip specials */\n  p = s;\n  while (*p != 0) {\n    if (*p == SPECIAL_CHAR) {\n      *p = '\\0';\n      w += get_string_width(s);\n      *p = SPECIAL_CHAR;\n\n      if (current->type == text_node_t::BAR ||\n          current->type == text_node_t::GAUGE ||\n          current->type == text_node_t::GRAPH) {\n        w += current->width;\n        if (current->height > last_font_height) {\n          last_font_height = current->height;\n          last_font_height += font_height();\n        }\n      } else if (current->type == text_node_t::OFFSET) {\n        if (current->arg > 0) { w += current->arg; }\n      } else if (current->type == text_node_t::VOFFSET) {\n        last_font_height += current->arg;\n      } else if (current->type == text_node_t::GOTO) {\n        if (current->arg > cur_x) { w = static_cast<int>(current->arg); }\n      } else if (current->type == text_node_t::TAB) {\n        int start = current->arg;\n        int step = current->width;\n\n        if ((step == 0) || step < 0) { step = 10; }\n        w += step - (cur_x - text_start.x() - start) % step;\n      } else if (current->type == text_node_t::FONT) {\n        selected_font = current->font_added;\n        if (font_height() > last_font_height) {\n          last_font_height = font_height();\n        }\n      }\n\n      special_index++;\n      current = current->next;\n      s = p + 1;\n    }\n    p++;\n  }\n\n  w += get_string_width(s);\n\n  if (w > text_size.x()) { text_size.set_x(w); }\n  int mw = dpi_scale(maximum_width.get(*state));\n  if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); }\n\n  text_size += conky::vec2i(0, last_font_height);\n  last_font_height = font_height();\n  return special_index;\n}\n#endif /* BUILD_GUI */\n\nstatic inline void set_foreground_color(Colour c) {\n  for (auto output : display_outputs()) output->set_foreground_color(c);\n}\n\nstatic inline void draw_graph_bars(special_node *current, std::unique_ptr<Colour[]>& tmpcolour, \n                            conky::vec2i& text_offset, int i, int &j, int w, \n                            int colour_idx, int cur_x, int by, int h) {\n  double graphheight = current->graph[j] * (h - 1) / current->scale;\n  /* Check if graphheight is less than the minheight threshold, if so we must change it to the threshold */\n  if(graphheight > 0 && current->minheight - graphheight > 0) {\n    current->graph[j] = current->minheight * current->scale / (h - 1);\n  }\n  if (current->colours_set) {\n    if (current->tempgrad != 0) {\n      set_foreground_color(tmpcolour[static_cast<int>(\n          static_cast<float>(w - 2) -\n          current->graph[j] * (w - 2) /\n              std::max(static_cast<float>(current->scale),\n                        1.0F))]);\n    } else {\n      set_foreground_color(tmpcolour[colour_idx++]);\n    }\n  }\n  /* Handle the case where y axis is to be inverted */\n  int offsety1 = current->inverty ? by : by + h;\n  int offsety2 = current->inverty ? by +  current->graph[j] * (h - 1) / current->scale\n                          : round_to_positive_int(static_cast<double>(by) + h -\n                          current->graph[j] * (h - 1) /\n                          current->scale);\n  /* this is mugfugly, but it works */\n  if (display_output()) {\n    display_output()->draw_line(\n        text_offset.x() + cur_x + i + 1, text_offset.y() + offsety1,\n        text_offset.x() + cur_x + i + 1, text_offset.y() + offsety2);\n  }\n  ++j;\n}\n\nstatic void draw_string(const char *s) {\n  int i;\n  int i2;\n  int pos;\n#ifdef BUILD_GUI\n  int width_of_s;\n#endif /* BUILD_GUI */\n  int max = 0;\n  int added;\n\n  if (s[0] == '\\0') { return; }\n\n#ifdef BUILD_GUI\n  width_of_s = get_string_width(s);\n#endif /* BUILD_GUI */\n  if (draw_mode == draw_mode_t::FG) {\n    for (auto output : display_outputs())\n      if (!output->graphical()) output->draw_string(s, 0);\n  }\n  int tbs = text_buffer_size.get(*state);\n  memset(tmpstring1, 0, tbs);\n  memset(tmpstring2, 0, tbs);\n  strncpy(tmpstring1, s, tbs - 1);\n  pos = 0;\n  added = 0;\n\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    max = ((text_size.x() - width_of_s) / std::max(1, get_string_width(\" \")));\n  }\n#endif /* BUILD_GUI */\n  /* This code looks for tabs in the text and coverts them to spaces.\n   * The trick is getting the correct number of spaces, and not going\n   * over the window's size without forcing the window larger. */\n  for (i = 0; i < tbs; i++) {\n    if (tmpstring1[i] == '\\t') {\n      i2 = 0;\n      for (i2 = 0; i2 < (8 - (1 + pos) % 8) && added <= max; i2++) {\n        /* guard against overrun */\n        tmpstring2[std::min(pos + i2, tbs - 1)] = ' ';\n        added++;\n      }\n      pos += i2;\n    } else {\n      /* guard against overrun */\n      tmpstring2[std::min(pos, tbs - 1)] = tmpstring1[i];\n      pos++;\n    }\n  }\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    int mw = dpi_scale(maximum_width.get(*state));\n    if (text_size.x() == mw) {\n      /* this means the text is probably pushing the limit,\n       * so we'll chop it */\n    }\n  }\n#endif /* BUILD_GUI */\n  s = tmpstring2;\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    display_output()->draw_string_at(text_offset.x() + cur_x,\n                                     text_offset.y() + cur_y, s, strlen(s));\n\n    cur_x += width_of_s;\n  }\n#endif /* BUILD_GUI */\n  memcpy(tmpstring1, s, tbs);\n}\n\n#if defined(BUILD_MATH) && defined(BUILD_GUI)\n/// Format \\a size as a real followed by closest SI unit, with \\a prec\n/// number of digits after the decimal point.\nstatic std::string formatSizeWithUnits(double size, int prec = 1) {\n  int div = 0;\n  double rem = 0;\n\n  while (size >= 1024.0 &&\n         static_cast<size_t>(div) < (sizeof suffixes / sizeof *suffixes)) {\n    rem = fmod(size, 1024.0);\n    div++;\n    size /= 1024.0;\n  }\n\n  double size_d = size + rem / 1024.0;\n\n  std::ostringstream result;\n  result.setf(std::ios::fixed, std::ios::floatfield);\n  result.precision(prec);\n  result << size_d;\n  result << \" \";\n\n  if (short_units.get(*state)) {\n    result << suffixes[div][0];\n  } else {\n    result << suffixes[div];\n  }\n\n  return result.str();\n}\n#endif /* BUILD_MATH && BUILD_GUI */\n\nint draw_each_line_inner(char *s, int special_index, int last_special_applied) {\n#ifndef BUILD_GUI\n  static int cur_x, cur_y; /* current x and y for drawing */\n  (void)cur_y;\n#endif\n#ifdef BUILD_GUI\n  int font_h = 0;\n  int cur_y_add = 0;\n  int mw = dpi_scale(maximum_width.get(*state));\n#endif /* BUILD_GUI */\n  char *p = s;\n  int orig_special_index = special_index;\n\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    font_h = font_height();\n    cur_y += font_ascent();\n  }\n  cur_x = text_start.x();\n#endif /* BUILD_GUI */\n\n  while (*p != 0) {\n    if (*p == SPECIAL_CHAR || last_special_applied > -1) {\n#ifdef BUILD_GUI\n      int w = 0;\n#endif /* BUILD_GUI */\n\n      /* draw string before special, unless we're dealing multiline\n       * specials */\n      if (last_special_applied > -1) {\n        special_index = last_special_applied;\n      } else {\n        *p = '\\0';\n        draw_string(s);\n        *p = SPECIAL_CHAR;\n        s = p + 1;\n      }\n      /* draw special */\n      special_node *current = specials;\n      for (int i = 0; i < special_index; i++) { current = current->next; }\n      switch (current->type) {\n#ifdef BUILD_GUI\n        case text_node_t::HORIZONTAL_LINE:\n          if (display_output() && display_output()->graphical()) {\n            int h = current->height;\n            int mid = font_ascent() / 2;\n\n            w = text_start.x() + text_size.x() - cur_x;\n\n            if (display_output()) {\n              display_output()->set_line_style(h, true);\n              display_output()->draw_line(text_offset.x() + cur_x,\n                                          text_offset.y() + cur_y - mid / 2,\n                                          text_offset.x() + cur_x + w,\n                                          text_offset.y() + cur_y - mid / 2);\n            }\n          }\n          break;\n\n        case text_node_t::STIPPLED_HR:\n          if (display_output() && display_output()->graphical()) {\n            int h = current->height;\n            char tmp_s = current->arg;\n            int mid = font_ascent() / 2;\n            char ss[2] = {tmp_s, tmp_s};\n\n            w = text_start.x() + text_size.x() - cur_x - 1;\n            if (display_output()) {\n              display_output()->set_line_style(h, false);\n              display_output()->set_dashes(ss);\n              display_output()->draw_line(text_offset.x() + cur_x,\n                                          text_offset.y() + cur_y - mid / 2,\n                                          text_offset.x() + cur_x + w,\n                                          text_offset.x() + cur_y - mid / 2);\n            }\n          }\n          break;\n\n        case text_node_t::BAR:\n          if (display_output() && display_output()->graphical()) {\n            int h, by;\n            double bar_usage, scale;\n            if (cur_x - text_start.x() > mw && mw > 0) { break; }\n            h = current->height;\n            bar_usage = current->arg;\n            scale = current->scale;\n            by = cur_y - (font_ascent() / 2) - 1;\n\n            if (h < font_h) { by -= h / 2 - 1; }\n            w = current->width;\n            if (w == 0) { w = text_start.x() + text_size.x() - cur_x - 1; }\n            if (w < 0) { w = 0; }\n\n            if (display_output()) {\n              display_output()->set_line_style(dpi_scale(1), true);\n\n              display_output()->draw_rect(text_offset.x() + cur_x,\n                                          text_offset.y() + by, w, h);\n              display_output()->fill_rect(text_offset.x() + cur_x,\n                                          text_offset.y() + by,\n                                          w * bar_usage / scale, h);\n            }\n            if (h > cur_y_add && h > font_h) { cur_y_add = h; }\n          }\n          break;\n\n        case text_node_t::GAUGE: /* new GAUGE  */\n          if (display_output() && display_output()->graphical()) {\n            int h, by = 0;\n            Colour last_colour = current_color;\n#ifdef BUILD_MATH\n            float angle, px, py;\n            double usage, scale;\n#endif /* BUILD_MATH */\n\n            if (cur_x - text_start.x() > mw && mw > 0) { break; }\n\n            h = current->height;\n            by = cur_y - (font_ascent() / 2) - 1;\n\n            if (h < font_h) { by -= h / 2 - 1; }\n            w = current->width;\n            if (w == 0) { w = text_start.x() + text_size.x() - cur_x - 1; }\n            if (w < 0) { w = 0; }\n\n            if (display_output()) {\n              display_output()->set_line_style(1, true);\n              display_output()->draw_arc(text_offset.x() + cur_x,\n                                         text_offset.y() + by, w, h * 2, 0,\n                                         180 * 64);\n            }\n\n#ifdef BUILD_MATH\n            usage = current->arg;\n            scale = current->scale;\n            angle = M_PI * usage / scale;\n            px = static_cast<float>(cur_x + (w / 2.)) -\n                 static_cast<float>(w / 2.) * cos(angle);\n            py = static_cast<float>(by + (h)) -\n                 static_cast<float>(h) * sin(angle);\n\n            if (display_output()) {\n              display_output()->draw_line(\n                  text_offset.x() + cur_x + (w / 2.),\n                  text_offset.y() + by + (h),\n                  text_offset.x() + static_cast<int>(px),\n                  text_offset.y() + static_cast<int>(py));\n            }\n\n#endif /* BUILD_MATH */\n\n            if (h > cur_y_add && h > font_h) { cur_y_add = h; }\n\n            set_foreground_color(last_colour);\n          }\n          break;\n\n        case text_node_t::GRAPH:\n          if (display_output() && display_output()->graphical()) {\n            int h, by, i = 0, j = 0;\n            int colour_idx = 0;\n            Colour last_colour = current_color;\n            if (cur_x - text_start.x() > mw && mw > 0) { break; }\n            h = current->height;\n            by = cur_y - (font_ascent() / 2) - 1;\n\n            if (h < font_h) { by -= h / 2 - 1; }\n            w = current->width;\n            if (w == 0) {\n              w = text_start.x() + text_size.x() - cur_x - 1;\n              current->graph_width = std::max(w - 1, 0);\n              if (current->graph_width != current->graph_allocated) {\n                w = current->graph_allocated + 1;\n              }\n            }\n            if (w < 0) { w = 0; }\n            if (draw_graph_borders.get(*state)) {\n              if (display_output()) {\n                display_output()->set_line_style(dpi_scale(1), true);\n                display_output()->draw_rect(text_offset.x() + cur_x,\n                                            text_offset.y() + by, w, h);\n              }\n            }\n            if (display_output()) display_output()->set_line_style(1, true);\n\n            /* in case we don't have a graph yet */\n            if (current->graph != nullptr) {\n              std::unique_ptr<Colour[]> tmpcolour;\n\n              if (current->colours_set) {\n                auto factory = create_gradient_factory(w, current->last_colour,\n                                                       current->first_colour);\n                tmpcolour = factory->create_gradient();\n                delete factory;\n              }\n              colour_idx = 0;\n              if(current->invertx){\n                for (i = 0; i <= w - 2; i++) {\n                  draw_graph_bars(current, tmpcolour, text_offset, \n                  i, j, w, colour_idx, cur_x, by, h);\n                }\n              }\n              else{\n                for (i = w - 2; i > -1; i--) {\n                  draw_graph_bars(current, tmpcolour, text_offset, \n                  i, j, w, colour_idx, cur_x, by, h);\n                }\n              }\n            }\n            if (h > cur_y_add && h > font_h) { cur_y_add = h; }\n            if (show_graph_range.get(*state)) {\n              int tmp_x = cur_x;\n              int tmp_y = cur_y;\n              unsigned short int seconds = active_update_interval() * w;\n              char *tmp_day_str;\n              char *tmp_hour_str;\n              char *tmp_min_str;\n              char *tmp_sec_str;\n              char *tmp_str;\n              unsigned short int timeunits;\n              if (seconds != 0) {\n                timeunits = seconds / 86400;\n                seconds %= 86400;\n                if (timeunits <= 0 ||\n                    asprintf(&tmp_day_str, _(\"%dd\"), timeunits) == -1) {\n                  tmp_day_str = strdup(\"\");\n                }\n                timeunits = seconds / 3600;\n                seconds %= 3600;\n                if (timeunits <= 0 ||\n                    asprintf(&tmp_hour_str, _(\"%dh\"), timeunits) == -1) {\n                  tmp_hour_str = strdup(\"\");\n                }\n                timeunits = seconds / 60;\n                seconds %= 60;\n                if (timeunits <= 0 ||\n                    asprintf(&tmp_min_str, _(\"%dm\"), timeunits) == -1) {\n                  tmp_min_str = strdup(\"\");\n                }\n                if (seconds <= 0 ||\n                    asprintf(&tmp_sec_str, _(\"%ds\"), seconds) == -1) {\n                  tmp_sec_str = strdup(\"\");\n                }\n                if (asprintf(&tmp_str, \"%s%s%s%s\", tmp_day_str, tmp_hour_str,\n                             tmp_min_str, tmp_sec_str) == -1) {\n                  tmp_str = strdup(\"\");\n                }\n                free(tmp_day_str);\n                free(tmp_hour_str);\n                free(tmp_min_str);\n                free(tmp_sec_str);\n              } else {\n                tmp_str = strdup(\n                    _(\"Range not possible\"));  // should never happen, but\n                                               // better safe then sorry\n              }\n              cur_x += (w / 2) - (font_ascent() * (strlen(tmp_str) / 2));\n              cur_y += font_h / 2;\n              draw_string(tmp_str);\n              free(tmp_str);\n              cur_x = tmp_x;\n              cur_y = tmp_y;\n            }\n#ifdef BUILD_MATH\n            if (show_graph_scale.get(*state) && (current->show_scale == 1)) {\n              if (current->colours_set) {\n                  // Set the foreground colour to the first colour, ensures the scale text is always drawn in the same colour\n                  set_foreground_color(current->first_colour);\n              }\n              int tmp_x = cur_x;\n              int tmp_y = cur_y;\n              cur_x += font_ascent() / 2;\n              cur_y += font_h / 2;\n              std::string tmp_str = formatSizeWithUnits(\n                  current->scale_log != 0 ? std::pow(10.0, current->scale)\n                                          : current->scale);\n              draw_string(tmp_str.c_str());\n              cur_x = tmp_x;\n              cur_y = tmp_y;\n            }\n#endif\n            set_foreground_color(last_colour);\n          }\n          break;\n\n        case text_node_t::FONT:\n          if (display_output() && display_output()->graphical()) {\n            int old = font_ascent();\n\n            cur_y -= font_ascent();\n            selected_font = current->font_added;\n            set_font();\n            if (cur_y + font_ascent() < cur_y + old) {\n              cur_y += old;\n            } else {\n              cur_y += font_ascent();\n            }\n            font_h = font_height();\n          }\n          break;\n#endif /* BUILD_GUI */\n        case text_node_t::FG:\n          if (draw_mode == draw_mode_t::FG) {\n            set_foreground_color(Colour::from_argb32(current->arg));\n          }\n          break;\n\n#ifdef BUILD_GUI\n        case text_node_t::BG:\n          if (draw_mode == draw_mode_t::BG) {\n            set_foreground_color(Colour::from_argb32(current->arg));\n          }\n          break;\n\n        case text_node_t::OUTLINE:\n          if (draw_mode == draw_mode_t::OUTLINE) {\n            set_foreground_color(Colour::from_argb32(current->arg));\n          }\n          break;\n\n        case text_node_t::OFFSET:\n          w += current->arg;\n          break;\n\n        case text_node_t::VOFFSET:\n          cur_y += current->arg;\n          break;\n\n        case text_node_t::SAVE_COORDINATES:\n#ifdef BUILD_IMLIB2\n          saved_coordinates[static_cast<int>(current->arg)] =\n              std::array<int, 2>{cur_x - text_start.x(),\n                                 cur_y - text_start.y() - last_font_height};\n#endif /* BUILD_IMLIB2 */\n          break;\n\n        case text_node_t::TAB: {\n          int start = current->arg;\n          int step = current->width;\n\n          if ((step == 0) || step < 0) { step = 10; }\n          w = step - (cur_x - text_start.x() - start) % step;\n          break;\n        }\n\n        case text_node_t::ALIGNR: {\n          /* TODO: add back in \"+ window.border_inner_margin\" to the end of\n           * this line? */\n          int pos_x = text_start.x() + text_size.x() -\n                      get_string_width_special(s, special_index);\n\n          /* printf(\"pos_x %i text_start.x %i text_size.x %i cur_x %i \"\n            \"get_string_width(p) %i gap_x %i \"\n            \"current->arg %i window.border_inner_margin %i \"\n            \"window.border_width %i\\n\", pos_x, text_start.x, text_size.x,\n            cur_x, get_string_width_special(s), gap_x,\n            current->arg, window.border_inner_margin,\n            window.border_width); */\n          cur_x = pos_x - current->arg;\n          break;\n        }\n\n        case text_node_t::ALIGNC: {\n          int pos_x = text_size.x() / 2 -\n                      get_string_width_special(s, special_index) / 2 -\n                      (cur_x - text_start.x());\n          /* int pos_x = text_start_x + text_size.x / 2 -\n            get_string_width_special(s) / 2; */\n\n          /* printf(\"pos_x %i text_start.x %i text_size.x %i cur_x %i \"\n            \"get_string_width(p) %i gap_x %i \"\n            \"current->arg %i\\n\", pos_x, text_start.x,\n            text_size.x, cur_x, get_string_width(s), gap_x,\n            current->arg); */\n          if (pos_x > current->arg) { w = pos_x - current->arg; }\n          break;\n        }\n#endif /* BUILD_GUI */\n        case text_node_t::GOTO:\n          if (current->arg >= 0) {\n#ifdef BUILD_GUI\n            cur_x = static_cast<int>(current->arg);\n            // make sure shades are 1 pixel to the right of the text\n            if (draw_mode == draw_mode_t::BG) { cur_x++; }\n#endif /* BUILD_GUI */\n            cur_x = static_cast<int>(current->arg);\n            for (auto output : display_outputs()) output->gotox(cur_x);\n          }\n          break;\n        default:\n          // do nothing; not a special node or support not enabled\n          break;\n      }\n\n#ifdef BUILD_GUI\n      cur_x += w;\n#endif /* BUILD_GUI */\n\n      if (special_index != last_special_applied) {\n        special_index++;\n      } else {\n        special_index = orig_special_index;\n        last_special_applied = -1;\n      }\n    }\n    p++;\n  }\n\n#ifdef BUILD_GUI\n  cur_y += cur_y_add;\n#endif /* BUILD_GUI */\n  draw_string(s);\n  for (auto output : display_outputs()) output->line_inner_done();\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    cur_y += font_descent();\n  }\n#endif /* BUILD_GUI */\n  return special_index;\n}\n\nstatic int draw_line(char *s, int special_index) {\n  if (display_output() && display_output()->draw_line_inner_required()) {\n    return draw_each_line_inner(s, special_index, -1);\n  }\n  draw_string(s);\n  UNUSED(special_index);\n  return 0;\n}\n\nstatic void draw_text() {\n  for (auto output : display_outputs()) output->begin_draw_text();\n#ifdef BUILD_GUI\n  // XXX:only works if inside set_display_output()\n  for (auto output : display_outputs()) {\n    if (output && output->graphical()) {\n      cur_y = text_start.y();\n      int bw = dpi_scale(border_width.get(*state));\n\n      /* draw borders */\n      if (draw_borders.get(*state) && bw > 0) {\n        if (stippled_borders.get(*state) != 0) {\n          char ss[2] = {(char)dpi_scale(stippled_borders.get(*state)),\n                        (char)dpi_scale(stippled_borders.get(*state))};\n          output->set_line_style(bw, false);\n          output->set_dashes(ss);\n        } else {\n          output->set_line_style(bw, true);\n        }\n\n        int offset = dpi_scale(border_inner_margin.get(*state)) + bw;\n        output->draw_rect(text_offset.x() + text_start.x() - offset,\n                          text_offset.y() + text_start.y() - offset,\n                          text_size.x() + 2 * offset,\n                          text_size.y() + 2 * offset);\n      }\n\n      /* draw text */\n    }\n  }\n  setup_fonts();\n#endif /* BUILD_GUI */\n  for_each_line(text_buffer, draw_line);\n  for (auto output : display_outputs()) output->end_draw_text();\n}\n\nvoid draw_stuff() {\n  for (auto output : display_outputs()) output->begin_draw_stuff();\n\n#ifdef BUILD_GUI\n  llua_draw_pre_hook();\n\n#ifdef BUILD_IMLIB2\n  text_offset = conky::vec2i::Zero();\n  cimlib_render(text_start.x(), text_start.y(), window.geometry.width(),\n                window.geometry.height(),\n                imlib_cache_flush_interval.get(*state),\n                imlib_draw_blended.get(*state));\n#endif /* BUILD_IMLIB2 */\n\n  for (auto output : display_outputs()) {\n    if (!output->graphical()) continue;\n    // XXX: we assume a single graphical display\n    set_display_output(output);\n\n    selected_font = 0;\n    if (draw_shades.get(*state) && !draw_outline.get(*state)) {\n      text_offset = conky::vec2i::One();\n      set_foreground_color(default_shade_color.get(*state));\n      draw_mode = draw_mode_t::BG;\n      draw_text();\n      text_offset = conky::vec2i::Zero();\n    }\n\n    if (draw_outline.get(*state)) {\n      selected_font = 0;\n\n      for (int ix = -1; ix < 2; ix++) {\n        for (int iy = -1; iy < 2; iy++) {\n          if (ix == 0 && iy == 0) { continue; }\n          text_offset = conky::vec2i(ix, iy);\n          set_foreground_color(default_outline_color.get(*state));\n          draw_mode = draw_mode_t::OUTLINE;\n          draw_text();\n        }\n      }\n      text_offset = conky::vec2i::Zero();\n    }\n\n    selected_font = 0;\n    set_foreground_color(default_color.get(*state));\n    unset_display_output();\n  }\n\n#endif /* BUILD_GUI */\n  // always draw text\n  draw_mode = draw_mode_t::FG;\n  draw_text();\n#ifdef BUILD_GUI\n\n  llua_draw_post_hook();\n#endif /* BUILD_GUI */\n\n  for (auto output : display_outputs()) output->end_draw_stuff();\n}\n\nint need_to_update;\n\n/* update_text() generates new text and clears old text area */\nvoid update_text() {\n#ifdef BUILD_IMLIB2\n  cimlib_cleanup();\n#endif /* BUILD_IMLIB2 */\n  generate_text();\n#ifdef BUILD_GUI\n  for (auto output : display_outputs()) {\n    if (output->graphical()) output->clear_text(1);\n  }\n#endif /* BUILD_GUI */\n  need_to_update = 1;\n  llua_update_info(&info, active_update_interval());\n}\n\n#ifdef HAVE_SYS_INOTIFY_H\nint inotify_fd = -1;\n#endif\n\ntemplate <typename Out>\nvoid split(const std::string &s, char delim, Out result) {\n  std::stringstream ss(s);\n  std::string item;\n  while (std::getline(ss, item, delim)) { *(result++) = item; }\n}\nstd::vector<std::string> split(const std::string &s, char delim) {\n  std::vector<std::string> elems;\n  split(s, delim, std::back_inserter(elems));\n  return elems;\n}\n\nbool is_on_battery() {  // checks if at least one battery specified in\n                        // \"detect_battery\" is discharging\n  char buf[64];\n  std::vector<std::string> b_items = split(detect_battery.get(*state), ',');\n\n  for (auto const &value : b_items) {\n    get_battery_short_status(buf, 64, value.c_str());\n    if (buf[0] == 'D') { return true; }\n  }\n  return false;\n}\n\nvolatile sig_atomic_t g_sigterm_pending, g_sighup_pending, g_sigusr2_pending;\n\nvoid get_system_details() {\n  char *session_ty = getenv(\"XDG_SESSION_TYPE\");\n  if (session_ty == nullptr) {\n    info.system.session = conky::info::display_session::unknown;\n  } else if (std::strcmp(session_ty, \"x11\") == 0) {\n    info.system.session = conky::info::display_session::x11;\n  } else if (std::strcmp(session_ty, \"wayland\") == 0) {\n    info.system.session = conky::info::display_session::wayland;\n  } else {\n    info.system.session = conky::info::display_session::unknown;\n  }\n\n  info.system.wm_name = getenv(\"XDG_CURRENT_DESKTOP\");\n  // Per spec, XDG_CURRENT_DESKTOP is a semicolon separated list. In practice,\n  // nearly all WM/DEs simply define a single name.\n  // Others below are non-standard:\n  if (info.system.wm_name == nullptr) {\n    info.system.wm_name = getenv(\"XDG_SESSION_DESKTOP\");\n  }\n  if (info.system.wm_name == nullptr) {\n    info.system.wm_name = getenv(\"DESKTOP_SESSION\");\n  }\n  if (info.system.wm_name == nullptr) {\n    info.system.wm_name = getenv(\"GDMSESSION\");\n  }\n\n#ifdef ENABLE_RUNTIME_TWEAKS\n  const auto is_wayland = [&]() {\n#ifndef BUILD_WAYLAND\n    return info.system.session == conky::info::display_session::wayland;\n#else\n    // ignore wayland WMs\n    return false;\n#endif\n  };\n\n  const auto is_session = [&](auto &&...names) {\n    return ((std::strcmp(info.system.wm_name, names) == 0) || ...);\n  };\n\n  // Only add is_wayland guard for WM/DE that will never support another display\n  // session protocol. e.g. Budgie will (or has) switch(ed) to Wayland at some\n  // point, but older versions may use X11, so it needs to be detected for both\n  // X11 and Wayland.\n  if (info.system.wm_name == nullptr) {\n    goto unknown_session;\n  } else if (is_session(\"GNOME\")) {\n    info.system.wm = conky::info::window_manager::mutter;\n  } else if (is_session(\"GNOME Classic\", \"metacity\")) {\n    info.system.wm = conky::info::window_manager::metacity;\n  } else if (is_session(\"MATE\")) {\n    info.system.wm = conky::info::window_manager::marco;\n  } else if (is_session(\"XFCE\", \"XFCE4\")) {\n    info.system.wm = conky::info::window_manager::xfwm;\n  } else if (is_session(\"KDE\", \"Plasma\", \"KDE Plasma\")) {\n    info.system.wm = conky::info::window_manager::kwin;\n  } else if (is_session(\"LXDE\", \"LXQt\")) {\n    info.system.wm = conky::info::window_manager::openbox;\n  } else if (is_session(\"Unity\")) {\n    info.system.wm = conky::info::window_manager::compiz;\n  } else if (is_session(\"Cinnamon\")) {\n    info.system.wm = conky::info::window_manager::mutter;  // Muffin → Mutter\n  } else if (!is_wayland() && is_session(\"Openbox\")) {\n    // Openbox doesn't set any session name env variables; must be set manually\n    info.system.wm = conky::info::window_manager::openbox;\n  } else if (!is_wayland() && is_session(\"Fluxbox\")) {\n    // Fluxbox doesn't set any session name env variables; must be set manually \n    info.system.wm = conky::info::window_manager::fluxbox;\n  } else if (!is_wayland() && (is_session(\"i3\", \"i3wm\"))) {\n    info.system.wm = conky::info::window_manager::i3;\n  } else if (is_wayland() && is_session(\"Hyprland\")) {\n    info.system.wm = conky::info::window_manager::hyprland;\n  } else if (is_wayland() && is_session(\"Sway\")) {\n    info.system.wm = conky::info::window_manager::sway;\n  } else if (!is_wayland() && is_session(\"bspwm\")) {\n    info.system.wm = conky::info::window_manager::bspwm;\n  } else if (is_session(\"awesome\")) {\n    // some talks about adding Wayland support\n    info.system.wm = conky::info::window_manager::awesome;\n  } else if (!is_wayland() && is_session(\"dwm\")) {\n    info.system.wm = conky::info::window_manager::dwm;\n  } else if (!is_wayland() && is_session(\"herbstluftwm\")) {\n    info.system.wm = conky::info::window_manager::herbstluftwm;\n  } else if (!is_wayland() && is_session(\"qtile\")) {\n    info.system.wm = conky::info::window_manager::qtile;\n  } else if (!is_wayland() && is_session(\"windowmaker\")) {\n    info.system.wm = conky::info::window_manager::windowmaker;\n  } else if (is_wayland() && is_session(\"Wayfire\")) {\n    info.system.wm = conky::info::window_manager::wayfire;\n  } else if (is_wayland() && is_session(\"River\")) {\n    info.system.wm = conky::info::window_manager::river;\n  } else if (is_session(\"Budgie\")) {\n    info.system.wm = conky::info::window_manager::mutter;  // Budgie → Mutter\n  } else if (is_session(\"Deepin\")) {\n    info.system.wm = conky::info::window_manager::dde;\n  } else if (is_session(\"Enlightenment\", \"E17\")) {\n    info.system.wm = conky::info::window_manager::enlightenment;\n  } else {\n  unknown_session:\n    info.system.wm_name = \"unknown\";\n    info.system.wm = conky::info::window_manager::unknown;\n\n    // probably a misconfigured system... let's attempt a few more things\n    if (getenv(\"CINNAMON_VERSION\") != nullptr) {\n      info.system.wm_name = \"Cinnamon\";\n      info.system.wm = conky::info::window_manager::mutter;\n    }\n\n    // TODO: Doesn't work yet. Process information is not yet populated.\n    if (is_process_running(\"openbox\")) {\n      info.system.wm_name = \"Openbox\";\n      info.system.wm = conky::info::window_manager::openbox;\n    }\n  }\n#endif\n\n  if (info.system.wm_name != nullptr) {\n    NORM_ERR(\"'%s' %s session running\", info.system.wm_name, session_ty);\n  } else {\n    NORM_ERR(\"unknown %s session running\", session_ty);\n  }\n}\n\nvoid main_loop() {\n  int terminate = 0;\n#ifdef SIGNAL_BLOCKING\n  sigset_t newmask, oldmask;\n#endif\n#ifdef BUILD_GUI\n  double t;\n#endif /* BUILD_GUI */\n#ifdef HAVE_SYS_INOTIFY_H\n  int inotify_config_wd = -1;\n#define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event))\n#define INOTIFY_BUF_LEN (20 * (INOTIFY_EVENT_SIZE + 16)) + 1\n  char inotify_buff[INOTIFY_BUF_LEN];\n#endif /* HAVE_SYS_INOTIFY_H */\n\n#ifdef SIGNAL_BLOCKING\n  sigemptyset(&newmask);\n  sigaddset(&newmask, SIGINT);\n  sigaddset(&newmask, SIGTERM);\n  sigaddset(&newmask, SIGUSR1);\n#endif\n\n  get_system_details();\n\n  last_update_time = 0.0;\n  next_update_time = get_time() - fmod(get_time(), active_update_interval());\n  info.looped = 0;\n  while (terminate == 0 && (total_run_times.get(*state) == 0 ||\n                            info.looped < total_run_times.get(*state))) {\n    if ((update_interval_on_battery.get(*state) != NOBATTERY)) {\n      on_battery = is_on_battery();\n    }\n    info.looped++;\n\n#ifdef SIGNAL_BLOCKING\n    /* block signals.  we will inspect for pending signals later */\n    if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) < 0) {\n      CRIT_ERR(\"unable to sigprocmask()\");\n    }\n#endif\n\n#ifdef BUILD_GUI\n    if (display_output() && display_output()->graphical()) {\n      t = next_update_time - get_time();\n      display_output()->main_loop_wait(t);\n    } else {\n#endif /* BUILD_GUI */\n      struct timespec req, rem;\n      auto time_to_sleep = next_update_time - get_time();\n      auto seconds = static_cast<time_t>(std::floor(time_to_sleep));\n      auto nanos = (time_to_sleep - seconds) * 1000000000L;\n      req.tv_sec = seconds;\n      req.tv_nsec = nanos;\n      nanosleep(&req, &rem);\n      update_text();\n      draw_stuff();\n      for (auto output : display_outputs()) output->flush();\n#ifdef BUILD_GUI\n    }\n#endif /* BUILD_GUI */\n\n#ifdef SIGNAL_BLOCKING\n    /* unblock signals of interest and let handler fly */\n    if (sigprocmask(SIG_SETMASK, &oldmask, nullptr) < 0) {\n      CRIT_ERR(\"unable to sigprocmask()\");\n    }\n#endif\n\n    if (g_sighup_pending != 0) {\n      g_sighup_pending = 0;\n      NORM_ERR(\"received SIGUSR1. reloading the config file.\");\n\n      reload_config();\n    }\n\n    if (g_sigusr2_pending != 0) {\n      g_sigusr2_pending = 0;\n      // refresh view;\n      NORM_ERR(\"received SIGUSR2. refreshing.\");\n      update_text();\n      draw_stuff();\n      for (auto output : display_outputs()) output->flush();\n    }\n\n    if (g_sigterm_pending != 0) {\n      g_sigterm_pending = 0;\n      NORM_ERR(\"received SIGHUP, SIGINT, or SIGTERM to terminate. bye!\");\n      terminate = 1;\n      for (auto output : display_outputs()) output->sigterm_cleanup();\n    }\n#ifdef HAVE_SYS_INOTIFY_H\n    if (!disable_auto_reload.get(*state) && inotify_fd != -1 &&\n        inotify_config_wd == -1 && !current_config.empty()) {\n      inotify_config_wd =\n          inotify_add_watch(inotify_fd, current_config.c_str(), IN_MODIFY);\n    }\n    if (!disable_auto_reload.get(*state) && inotify_fd != -1 &&\n        inotify_config_wd != -1 && !current_config.empty()) {\n      int len = 0, idx = 0;\n      fd_set descriptors;\n      struct timeval time_to_wait;\n\n      FD_ZERO(&descriptors);\n      FD_SET(inotify_fd, &descriptors);\n\n      time_to_wait.tv_sec = time_to_wait.tv_usec = 0;\n\n      select(inotify_fd + 1, &descriptors, nullptr, NULL, &time_to_wait);\n      if (FD_ISSET(inotify_fd, &descriptors)) {\n        /* process inotify events */\n        len = read(inotify_fd, inotify_buff, INOTIFY_BUF_LEN - 1);\n        inotify_buff[len] = 0;\n        while (len > 0 && idx < len) {\n          struct inotify_event *ev = (struct inotify_event *)&inotify_buff[idx];\n          if (ev->wd == inotify_config_wd &&\n              (ev->mask & IN_MODIFY || ev->mask & IN_IGNORED)) {\n            /* current_config should be reloaded */\n            NORM_ERR(\"'%s' modified, reloading...\", current_config.c_str());\n            reload_config();\n            if (ev->mask & IN_IGNORED) {\n              /* for some reason we get IN_IGNORED here\n               * sometimes, so we need to re-add the watch */\n              inotify_config_wd = inotify_add_watch(\n                  inotify_fd, current_config.c_str(), IN_MODIFY);\n            }\n            break;\n          } else {\n            llua_inotify_query(ev->wd, ev->mask);\n          }\n          idx += INOTIFY_EVENT_SIZE + ev->len;\n        }\n      }\n    } else if (disable_auto_reload.get(*state) && inotify_fd != -1) {\n      inotify_rm_watch(inotify_fd, inotify_config_wd);\n      close(inotify_fd);\n      inotify_fd = inotify_config_wd = -1;\n    }\n#endif /* HAVE_SYS_INOTIFY_H */\n\n    llua_update_info(&info, active_update_interval());\n  }\n  clean_up();\n\n#ifdef HAVE_SYS_INOTIFY_H\n  if (inotify_fd != -1) {\n    inotify_rm_watch(inotify_fd, inotify_config_wd);\n    close(inotify_fd);\n    inotify_fd = inotify_config_wd = -1;\n  }\n#endif /* HAVE_SYS_INOTIFY_H */\n}\n\n/* reload the config file */\nstatic void reload_config() {\n  struct stat sb {};\n  if ((stat(current_config.c_str(), &sb) != 0) ||\n      (!S_ISREG(sb.st_mode) && !S_ISLNK(sb.st_mode))) {\n    NORM_ERR(_(\"Config file '%s' is gone, continuing with config from \"\n               \"memory.\\nIf you recreate this file sent me a SIGUSR1 to tell \"\n               \"me about it. ( kill -s USR1 %d )\"),\n             current_config.c_str(), getpid());\n    return;\n  }\n  clean_up();\n  state = std::make_unique<lua::state>();\n  conky::export_symbols(*state);\n  sleep(1); /* slight pause */\n  initialisation(argc_copy, argv_copy);\n}\n\nvoid free_specials(special_node *&current) {\n  if (current != nullptr) {\n    free_specials(current->next);\n    if (current->type == text_node_t::GRAPH) { free(current->graph); }\n    delete current;\n    current = nullptr;\n  }\n\n  clear_stored_graphs();\n}\n\nvoid clean_up(void) {\n  /* free_update_callbacks(); XXX: some new equivalent of this? */\n  free_and_zero(info.cpu_usage);\n  for (auto output : display_outputs()) output->cleanup();\n  conky::shutdown_display_outputs();\n#ifdef BUILD_GUI\n  if (!display_output() || !display_output()->graphical()) {\n    fonts.clear();  // in set_default_configurations a font is set but not\n                    // loaded\n    selected_font = 0;\n  }\n#endif /* BUILD_GUI */\n\n  if (info.first_process != nullptr) {\n    free_all_processes();\n    info.first_process = nullptr;\n  }\n\n  free_text_objects(&global_root_object);\n  delete_block_and_zero(tmpstring1);\n  delete_block_and_zero(tmpstring2);\n  delete_block_and_zero(text_buffer);\n  free_and_zero(global_text);\n\n#ifdef BUILD_PORT_MONITORS\n  tcp_portmon_clear();\n#endif\n  llua_shutdown_hook();\n#if defined BUILD_RSS\n  xmlCleanupParser();\n#endif\n\n  free_specials(specials);\n\n  clear_net_stats();\n  clear_fs_stats();\n  clear_diskio_stats();\n  free_and_zero(global_cpu);\n\n  conky::cleanup_config_settings(*state);\n  state.reset();\n}\n\nstatic void set_default_configurations() {\n  update_uname();\n  info.memmax = 0;\n  top_cpu = 0;\n  top_mem = 0;\n  top_time = 0;\n#ifdef BUILD_IOSTATS\n  top_io = 0;\n#endif\n  top_running = 0;\n#ifdef BUILD_XMMS2\n  info.xmms2.artist = nullptr;\n  info.xmms2.album = nullptr;\n  info.xmms2.title = nullptr;\n  info.xmms2.genre = nullptr;\n  info.xmms2.comment = nullptr;\n  info.xmms2.url = nullptr;\n  info.xmms2.status = nullptr;\n  info.xmms2.playlist = nullptr;\n#endif /* BUILD_XMMS2 */\n\n/* Enable a single output by default based on what was enabled at build-time */\n#ifdef BUILD_WAYLAND\n  state->pushboolean(true);\n  out_to_wayland.lua_set(*state);\n#else\n#ifdef BUILD_X11\n  state->pushboolean(true);\n  out_to_x.lua_set(*state);\n#else\n  state->pushboolean(true);\n  out_to_stdout.lua_set(*state);\n#endif\n#endif\n\n  info.users.number = 1;\n}\n\nvoid load_config_file() {\n  DBGP(_(\"reading contents from config file '%s'\"), current_config.c_str());\n\n  lua::state &l = *state;\n  lua::stack_sentry s(l);\n  l.checkstack(2);\n\n  try {\n#ifdef BUILD_BUILTIN_CONFIG\n    if (current_config == builtin_config_magic) {\n      l.loadstring(defconfig);\n    } else {\n#endif\n      l.loadfile(current_config.c_str());\n#ifdef BUILD_BUILTIN_CONFIG\n    }\n#endif\n  } catch (lua::syntax_error &e) {\n#define SYNTAX_ERR_READ_CONF \"Syntax error (%s) while reading config file. \"\n#ifdef BUILD_OLD_CONFIG\n    NORM_ERR(_(SYNTAX_ERR_READ_CONF), e.what());\n    NORM_ERR(_(\"Assuming it's in old syntax and attempting conversion.\"));\n    // the strchr thingy skips the first line (#! /usr/bin/lua)\n    l.loadstring(strchr(convertconf, '\\n'));\n    l.pushstring(current_config.c_str());\n    l.call(1, 1);\n#else\n    char *syntaxerr;\n    if (asprintf(&syntaxerr, _(SYNTAX_ERR_READ_CONF), e.what())) {\n      std::string syntaxerrobj(syntaxerr);\n      free(syntaxerr);\n      throw conky::error(syntaxerrobj);\n    }\n#endif\n  }\n  l.call(0, 0);\n\n  l.getglobal(\"conky\");\n  l.getfield(-1, \"text\");\n  l.replace(-2);\n  if (l.type(-1) != lua::TSTRING) {\n    throw conky::error(_(\"missing text block in configuration\"));\n  }\n\n  /* Remove \\\\-\\n. */\n  l.gsub(l.tocstring(-1), \"\\\\\\n\", \"\");\n  l.replace(-2);\n  global_text = strdup(l.tocstring(-1));\n  l.pop();\n}\n\ninline void reset_optind() {\n#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n    defined(__OpenBSD__) || defined(__DragonFly__)\n  optind = optreset = 1;\n#else\n  optind = 0;\n#endif\n}\n\nvoid set_current_config() {\n  /* load current_config, CONFIG_FILE or SYSTEM_CONFIG_FILE */\n  struct stat s {};\n\n  if (current_config.empty()) {\n    /* Try to use personal config file first */\n    std::string buf = to_real_path(XDG_CONFIG_FILE);\n    if (stat(buf.c_str(), &s) == 0) { current_config = buf; }\n  }\n\n  if (current_config.empty()) {\n    /* Try to use personal config file first */\n    std::string buf = to_real_path(CONFIG_FILE);\n    if (stat(buf.c_str(), &s) == 0) { current_config = buf; }\n  }\n\n  /* Try to use system config file if personal config does not exist */\n  if (current_config.empty() && (stat(SYSTEM_CONFIG_FILE, &s) == 0)) {\n    current_config = SYSTEM_CONFIG_FILE;\n  }\n\n  /* No readable config found */\n  if (current_config.empty()) {\n#define NOCFGFILEFOUND \"no personal or system-wide config file found\"\n#ifdef BUILD_BUILTIN_CONFIG\n    current_config = builtin_config_magic;\n    NORM_ERR(NOCFGFILEFOUND \", using builtin default\");\n#else\n    throw conky::error(NOCFGFILEFOUND);\n#endif\n  }\n\n  // \"-\" stands for \"read from stdin\"\n  if (current_config == \"-\") { current_config = \"/dev/stdin\"; }\n}\n\n/* : means that character before that takes an argument */\nconst char *getopt_string =\n    \"vVqdDSs:t:u:i:hc:p:\"\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n    defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)\n    \"U\"\n#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */\n#ifdef BUILD_X11\n    \"x:y:w:a:X:m:f:\"\n#ifdef OWN_WINDOW\n    \"o\"\n#endif\n    \"b\"\n#endif /* BUILD_X11 */\n#ifdef BUILD_BUILTIN_CONFIG\n    \"C\"\n#endif\n    ;\n\nconst struct option longopts[] = {\n    {\"help\", 0, nullptr, 'h'},          {\"version\", 0, nullptr, 'v'},\n    {\"short-version\", 0, nullptr, 'V'}, {\"quiet\", 0, nullptr, 'q'},\n    {\"debug\", 0, nullptr, 'D'},         {\"config\", 1, nullptr, 'c'},\n#ifdef BUILD_BUILTIN_CONFIG\n    {\"print-config\", 0, nullptr, 'C'},\n#endif\n    {\"daemonize\", 0, nullptr, 'd'},\n#ifdef BUILD_X11\n    {\"alignment\", 1, nullptr, 'a'},     {\"display\", 1, nullptr, 'X'},\n    {\"xinerama-head\", 1, nullptr, 'm'}, {\"font\", 1, nullptr, 'f'},\n#ifdef OWN_WINDOW\n    {\"own-window\", 0, nullptr, 'o'},\n#endif\n    {\"double-buffer\", 0, nullptr, 'b'}, {\"window-id\", 1, nullptr, 'w'},\n#endif /* BUILD_X11 */\n    {\"text\", 1, nullptr, 't'},          {\"interval\", 1, nullptr, 'u'},\n    {\"pause\", 1, nullptr, 'p'},\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n    defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)\n    {\"unique\", 0, nullptr, 'U'},\n#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */\n    {nullptr, 0, nullptr, 0}\n};\n\nvoid setup_inotify() {\n#ifdef HAVE_SYS_INOTIFY_H\n  // the file descriptor will be automatically closed on exit\n  inotify_fd = inotify_init();\n  if (inotify_fd != -1) {\n    fcntl(inotify_fd, F_SETFL, fcntl(inotify_fd, F_GETFL) | O_NONBLOCK);\n\n    fcntl(inotify_fd, F_SETFD, fcntl(inotify_fd, F_GETFD) | FD_CLOEXEC);\n  }\n#endif /* HAVE_SYS_INOTIFY_H */\n}\nvoid initialisation(int argc, char **argv) {\n  struct sigaction act {\n  }, oact{};\n\n  clear_net_stats();\n  set_default_configurations();\n\n  set_current_config();\n  llua_init();\n  load_config_file();\n\n  /* handle other command line arguments */\n\n  reset_optind();\n\n#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\n  if ((kd = kvm_open(\"/dev/null\", \"/dev/null\", \"/dev/null\", O_RDONLY,\n                     \"kvm_open\")) == nullptr) {\n    CRIT_ERR(\"cannot read kvm\");\n  }\n#endif\n\n  while (1) {\n    int c = getopt_long(argc, argv, getopt_string, longopts, nullptr);\n    int startup_pause;\n    char *conv_end;\n\n    if (c == -1) { break; }\n\n    switch (c) {\n      case 'd':\n        state->pushboolean(true);\n        fork_to_background.lua_set(*state);\n        break;\n#ifdef BUILD_X11\n      case 'f':\n        state->pushstring(optarg);\n        font.lua_set(*state);\n        break;\n      case 'a':\n        state->pushstring(optarg);\n        text_alignment.lua_set(*state);\n        break;\n      case 'm':\n        state->pushinteger(strtol(optarg, &conv_end, 10));\n        if (*conv_end != 0) {\n          CRIT_ERR(\"'%s' is a wrong xinerama-head index\", optarg);\n        }\n        head_index.lua_set(*state);\n        break;\n      case 'X':\n        state->pushstring(optarg);\n        display_name.lua_set(*state);\n        break;\n\n#ifdef OWN_WINDOW\n      case 'o':\n        state->pushboolean(true);\n        own_window.lua_set(*state);\n        break;\n#endif\n#ifdef BUILD_XDBE\n      case 'b':\n        state->pushboolean(true);\n        use_xdbe.lua_set(*state);\n        break;\n#else\n      case 'b':\n        state->pushboolean(true);\n        use_xpmdb.lua_set(*state);\n        break;\n#endif\n#endif /* BUILD_X11 */\n      case 't':\n        free_and_zero(global_text);\n        global_text = strndup(optarg, max_user_text.get(*state));\n        convert_escapes(global_text);\n        break;\n\n      case 'u':\n        state->pushnumber(strtod(optarg, &conv_end));\n        if (*conv_end != 0) {\n          CRIT_ERR(\"'%s' is an invalid update interval\", optarg);\n        }\n        update_interval.lua_set(*state);\n        break;\n\n      case 'i':\n        state->pushinteger(strtol(optarg, &conv_end, 10));\n        if (*conv_end != 0) {\n          CRIT_ERR(\"'%s' is an invalid number of update times\", optarg);\n        }\n        total_run_times.lua_set(*state);\n        break;\n#ifdef BUILD_X11\n      case 'x':\n        state->pushinteger(strtol(optarg, &conv_end, 10));\n        if (*conv_end != 0) {\n          CRIT_ERR(\"'%s' is an invalid value for the X-position\", optarg);\n        }\n        gap_x.lua_set(*state);\n        break;\n\n      case 'y':\n        state->pushinteger(strtol(optarg, &conv_end, 10));\n        if (*conv_end != 0) {\n          CRIT_ERR(\"'%s' is a wrong value for the Y-position\", optarg);\n        }\n        gap_y.lua_set(*state);\n        break;\n#endif /* BUILD_X11 */\n      case 'p':\n        if (first_pass != 0) {\n          startup_pause = strtol(optarg, nullptr, 10);\n          sleep(startup_pause);\n        }\n        break;\n\n      case '?':\n        throw unknown_arg_throw();\n    }\n  }\n\n  conky::set_config_settings(*state);\n\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    current_text_color = default_color.get(*state);\n  }\n#endif\n\n  /* generate text and get initial size */\n  extract_variable_text(global_text);\n  free_and_zero(global_text);\n  /* fork */\n  if (fork_to_background.get(*state) && (first_pass != 0)) {\n    int pid = fork();\n\n    switch (pid) {\n      case -1:\n        NORM_ERR(PACKAGE_NAME \": couldn't fork() to background: %s\",\n                 strerror(errno));\n        break;\n\n      case 0:\n        /* child process */\n        usleep(25000);\n        fprintf(stderr, \"\\n\");\n        fflush(stderr);\n        break;\n\n      default:\n        /* parent process */\n        fprintf(stderr, PACKAGE_NAME \": forked to background, pid is %d\\n\",\n                pid);\n        fflush(stderr);\n        throw fork_throw();\n    }\n  }\n\n  text_buffer = new char[max_user_text.get(*state)];\n  memset(text_buffer, 0, max_user_text.get(*state));\n  tmpstring1 = new char[text_buffer_size.get(*state)];\n  memset(tmpstring1, 0, text_buffer_size.get(*state));\n  tmpstring2 = new char[text_buffer_size.get(*state)];\n  memset(tmpstring2, 0, text_buffer_size.get(*state));\n\n  if (!conky::initialize_display_outputs()) {\n    CRIT_ERR(\"initialize_display_outputs() failed.\");\n  }\n#ifdef BUILD_GUI\n  /* setup lua window globals */\n  llua_setup_window_table(conky::rect<int>(text_start, text_size));\n#endif /* BUILD_GUI */\n\n  llua_setup_info(&info, active_update_interval());\n\n  /* Set signal handlers */\n  act.sa_handler = signal_handler;\n  sigemptyset(&act.sa_mask);\n  act.sa_flags = 0;\n#ifdef SA_RESTART\n  act.sa_flags |= SA_RESTART;\n#endif\n\n  if (sigaction(SIGINT, &act, &oact) < 0 ||\n      sigaction(SIGALRM, &act, &oact) < 0 ||\n      sigaction(SIGUSR1, &act, &oact) < 0 ||\n      sigaction(SIGUSR2, &act, &oact) < 0 ||\n      sigaction(SIGHUP, &act, &oact) < 0 ||\n      sigaction(SIGTERM, &act, &oact) < 0) {\n    NORM_ERR(\"error setting signal handler: %s\", strerror(errno));\n  }\n\n  llua_startup_hook();\n}\n\nstatic void signal_handler(int sig) {\n  /* signal handler is light as a feather, as it should be.\n   * we will poll g_signal_pending with each loop of conky\n   * and do any signal processing there, NOT here */\n\n  switch (sig) {\n    case SIGHUP:\n    case SIGINT:\n    case SIGTERM:\n      g_sigterm_pending = 1;\n      break;\n    case SIGUSR1:\n      g_sighup_pending = 1;\n      break;\n    case SIGUSR2:\n      g_sigusr2_pending = 1;\n    default:\n      /* Reaching here means someone set a signal\n       * (SIGXXXX, signal_handler), but didn't write any code\n       * to deal with it.\n       * If you don't want to handle a signal, don't set a handler on\n       * it in the first place.\n       * We cannot print debug messages from a sighandler, so simply ignore.\n       */\n      break;\n  }\n}\n"
  },
  {
    "path": "src/conky.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _conky_h_\n#define _conky_h_\n\n#include <cstddef>\n#define __STDC_FORMAT_MACROS\n\n#include \"config.h\"\n\n#include <arpa/inet.h>\n#include <config.h>      /* defines */\n#include <sys/utsname.h> /* struct uname_s */\n#include <csignal>\n#include <filesystem>\n#include <memory>\n\n#include \"content/colours.hh\"\n#include \"common.h\" /* at least for struct dns_data */\n#include \"lua/luamm.hh\"\n\n#if defined(HAS_MCHECK_H)\n#include <mcheck.h>\n#endif /* HAS_MCHECK_H */\n\n#undef EQUAL\n#undef FALSE\n#undef TRUE\n#define EQUAL 0  // returnvalue of strcmp-variants when strings are equal\n#define FALSE 0\n#define TRUE 1\n\n#define DEFAULT_BAR_WIDTH_NO_X 10\n\n#if !defined(__GNUC__)\n#define __attribute__(x) /* nothing */\n#endif\n\n#ifndef HAVE_STRNDUP\n// use our own strndup() if it's not available\nchar *strndup(const char *s, size_t n);\n#endif /* HAVE_STRNDUP */\n\n/* headers of optional features\n * include them here, so we don't need to run the check\n * in every code file optionally using the feature\n */\n\n/* forward define to make gcc happy */\nstruct text_object;\n\n#ifdef BUILD_HDDTEMP\n#include \"data/hardware/hddtemp.h\"\n#endif /* BUILD_HDDTEMP */\n\n#ifdef BUILD_MOC\n#include \"data/audio/moc.h\"\n#endif /* BUILD_MOC */\n\n#ifdef BUILD_MPD\n#include \"data/audio/mpd.h\"\n#endif /* BUILD_MPD */\n\n#ifdef BUILD_MYSQL\n#include \"data/mysql.h\"\n#endif /* BUILD_MYSQL */\n\n#ifdef BUILD_PORT_MONITORS\n#include \"data/network/tcp-portmon.h\"\n#endif\n\n#ifdef BUILD_XMMS2\n#include \"data/audio/xmms2.h\"\n#endif /* BUILD_XMMS2 */\n\n#ifdef BUILD_APCUPSD\n#include \"data/hardware/apcupsd.h\"\n#endif /* BUILD_APCUPSD */\n\n/* sony support */\n#include \"data/hardware/sony.h\"\n\n/* A size for temporary, static buffers to use when\n * one doesn't know what to choose. Defaults to 256.  */\nextern conky::range_config_setting<unsigned int> text_buffer_size;\n\nstruct usr_info {\n  char *names;\n  char *times;\n  char *ctime;\n  char *terms;\n  int number;\n};\n\n#ifdef BUILD_X11\nstruct monitor_info {\n  int number;\n  int current;\n};\n\nstruct desktop_info {\n  int current;\n  int number;\n  std::string all_names;\n  std::string name;\n};\n\nstruct x11_info {\n  struct monitor_info monitor;\n  struct desktop_info desktop;\n};\n\n#endif /* BUILD_X11 */\n\nstruct conftree {\n  char *string;\n  struct conftree *horz_next;\n  struct conftree *vert_next;\n  struct conftree *back;\n};\n\nvoid load_config_file();\n\nchar *get_global_text(void);\nextern long global_text_lines;\n\n#define MAX_TEMPLATES 10\nchar **get_templates(void);\n\n/* get_battery_stuff() item selector\n * needed by conky.c, linux.c and freebsd.c */\nenum { BATTERY_STATUS, BATTERY_TIME };\n\nnamespace conky::info {\n\n// Don't guard enum values with #ifdef *_BUILD features; it will only make code\n// harder to maintain - size_t won't change in size.\n\nenum class display_session : std::size_t { unknown, x11, wayland };\nenum class window_manager : std::size_t {\n  unknown,\n\n  // X11\n  awesome,\n  bspwm,\n  compiz,\n  dde,  // Deepin\n  dwm,\n  enlightenment,\n  fluxbox,\n  herbstluftwm,\n  i3,\n  kwin,\n  marco,\n  metacity,\n  mutter,\n  openbox,\n  qtile,\n  xfwm,\n  windowmaker,\n\n  // Wayland (only)\n  hyprland,\n  river,\n  sway,\n  wayfire,\n\n  // Remember to update get_system_details when adding new ones!\n};\n\nstruct system {\n  display_session session;\n\n  window_manager wm;\n  const char *wm_name;\n};\n\n}  // namespace conky::info\n\nstruct information {\n  unsigned int mask;\n\n  struct utsname uname_s;\n#if defined(__DragonFly__)\n  char uname_v[256]; /* with git version */\n#endif\n\n  char freq[10];\n\n  double uptime;\n\n  /* memory information in kilobytes */\n  unsigned long long mem, memwithbuffers, memavail, memeasyfree, memfree,\n      memmax, memdirty, shmem, legacymem, memactive, meminactive, memwired,\n      memlaundry;\n  unsigned long long swap, swapfree, swapmax;\n  unsigned long long bufmem, buffers, cached, free_bufcache, free_cached;\n\n  unsigned short procs;\n  unsigned short run_procs;\n  unsigned short threads;\n  unsigned short run_threads;\n\n  float *cpu_usage;\n  /* struct cpu_stat cpu_summed; what the hell is this? */\n  unsigned int cpu_count;\n\n  float loadavg[3];\n\n#ifdef BUILD_XMMS2\n  struct xmms2_s xmms2;\n#endif /* BUILD_XMMS2 */\n  struct usr_info users;\n  struct process *cpu[10];\n  struct process *memu[10];\n  struct process *time[10];\n#ifdef BUILD_IOSTATS\n  struct process *io[10];\n#endif /* BUILD_IOSTATS */\n  struct process *first_process;\n  unsigned long looped;\n\n#ifdef BUILD_X11\n  struct x11_info x11;\n#endif /* BUILD_X11 */\n\n  short kflags; /* kernel settings, see enum KFLAG */\n\n#if defined(__APPLE__) && defined(__MACH__)\n  /* System Integrity Protection related */\n  struct csr_config_flags {\n    bool csr_allow_untrusted_kexts;\n    bool csr_allow_unrestricted_fs;\n    bool csr_allow_task_for_pid;\n    bool csr_allow_kernel_debugger;\n    bool csr_allow_apple_internal;\n    bool csr_allow_unrestricted_dtrace;\n    bool csr_allow_unrestricted_nvram;\n    bool csr_allow_device_configuration;\n    bool csr_allow_any_recovery_os;\n    bool csr_allow_user_approved_kexts;\n  };\n\n  /* SIP typedefs */\n  typedef csr_config_flags csr_config_flags_t;\n  typedef uint32_t csr_config_t;\n\n  /* SIP variables */\n  csr_config_t csr_config;\n  csr_config_flags_t csr_config_flags;\n#endif /* defined(__APPLE__) && defined(__MACH__) */\n\n  /**\n   * @brief General information about the system currently running conky.\n   */\n  conky::info::system system;\n};\n\nclass music_player_interval_setting\n    : public conky::simple_config_setting<double> {\n  typedef conky::simple_config_setting<double> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n\n public:\n  music_player_interval_setting() : Base(\"music_player_interval\", 0, true) {}\n};\nextern music_player_interval_setting music_player_interval;\n\nextern conky::range_config_setting<int> cpu_avg_samples;\nextern conky::range_config_setting<int> net_avg_samples;\nextern conky::range_config_setting<int> diskio_avg_samples;\n\n/* needed by linux.c and top.c -> outsource somewhere */\nenum {\n  /* set to true if kernel uses \"long\" format for /proc/stats */\n  KFLAG_IS_LONGSTAT = 0x01,\n  /* set to true if kernel shows # of threads for the proc value\n   * in sysinfo() call */\n  KFLAG_PROC_IS_THREADS = 0x02\n  /* bits 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 available for future use */\n  /* KFLAG_NEXT_ONE = 0x04 */\n};\n#define KFLAG_SETON(a) info.kflags |= a\n#define KFLAG_SETOFF(a) info.kflags &= (~a)\n#define KFLAG_FLIP(a) info.kflags ^= a\n#define KFLAG_ISSET(a) info.kflags &a\n\n#if !defined(MAX)\n#define MAX(x, y)           \\\n  ({                        \\\n    __typeof__(x) _x = (x); \\\n    __typeof__(y) _y = (y); \\\n    _x > _y ? _x : _y;      \\\n  })\n#endif\n\n#if !defined(MIN)\n#define MIN(x, y)           \\\n  ({                        \\\n    __typeof__(x) _x = (x); \\\n    __typeof__(y) _y = (y); \\\n    _x < _y ? _x : _y;      \\\n  })\n#endif\n\n/* defined in conky.c, needed by top.c */\nextern int top_cpu, top_mem, top_time;\n#ifdef BUILD_IOSTATS\nextern int top_io;\n#endif /* BUILD_IOSTATS */\nextern int top_running;\n\n/* struct that has all info to be shared between\n * instances of the same text object */\nextern struct information info;\n\n/* defined in conky.c */\nextern double current_update_time, last_update_time;\n\nextern conky::range_config_setting<double> update_interval;\nextern conky::range_config_setting<double> update_interval_on_battery;\ndouble active_update_interval();\n\nextern conky::simple_config_setting<bool> show_graph_scale;\nextern conky::simple_config_setting<bool> show_graph_range;\nextern conky::simple_config_setting<int> gap_x;\nextern conky::simple_config_setting<int> gap_y;\nextern conky::simple_config_setting<bool> draw_borders;\nextern conky::simple_config_setting<bool> draw_graph_borders;\nextern conky::range_config_setting<char> stippled_borders;\nextern conky::simple_config_setting<bool> draw_shades;\nextern conky::simple_config_setting<bool> draw_outline;\n\nvoid set_current_text_color(Colour colour);\nColour get_current_text_color(void);\n\nvoid set_updatereset(int);\nint get_updatereset(void);\nint get_total_updates(void);\n\n/* defined in conky.c */\nint spaced_print(char *, int, const char *, int, ...)\n    __attribute__((format(printf, 3, 5)));\nextern int inotify_fd;\n\ntemplate <\n    typename Iterable = std::initializer_list<conky::info::window_manager>>\ninline bool wm_is(const Iterable &values) {\n  // if constexpr (!ENABLE_RUNTIME_TWEAKS) { return false; }\n  // can't assume unknown isn't in the list...\n  for (const auto &wm : values) {\n    if (info.system.wm == wm) return true;\n  }\n  return false;\n}\ninline bool wm_is(conky::info::window_manager single) {\n  return info.system.wm == single;\n}\n\n/* defined in conky.c\n * evaluates 'text' and places the result in 'p' of max length 'p_max_size'\n */\nvoid evaluate(const char *text, char *p, int p_max_size);\n\nvoid parse_conky_vars(struct text_object *, const char *, char *, int);\n\nvoid extract_object_args_to_sub(struct text_object *, const char *);\n\nvoid generate_text_internal(char *, int, struct text_object);\n\nvoid update_text_area();\nvoid draw_stuff();\n\nint percent_print(char *, int, unsigned);\nvoid human_readable(long long, char *, int);\n\n#ifdef BUILD_GUI\n\n/* UTF-8 */\nextern conky::simple_config_setting<bool> utf8_mode;\n#endif\n\n/* maximum size of config TEXT buffer, i.e. below TEXT line. */\nextern conky::range_config_setting<unsigned int> max_user_text;\n\n/* path to config file */\nextern std::filesystem::path current_config;\n\n#define DEFAULT_TEXT_BUFFER_SIZE_S \"##DEFAULT_TEXT_BUFFER_SIZE\"\n\n#define NOBATTERY 0\n\n/* to get rid of 'unused variable' warnings */\n#define UNUSED(a) (void)a\n#define UNUSED_ATTR __attribute__((unused))\n\ntemplate <class T>\nvoid free_and_zero(T *&ptr) {\n  if (ptr) {\n    free(ptr);\n    ptr = nullptr;\n  }\n}\n\ntemplate <class T>\nvoid delete_block_and_zero(T *&ptr) {\n  if (ptr) {\n    delete[] ptr;\n    ptr = nullptr;\n  }\n}\n\nextern std::unique_ptr<lua::state> state;\n\nextern conky::simple_config_setting<bool> out_to_stdout;\n\nvoid setup_inotify();\nvoid initialisation(int argc, char **argv);\nvoid set_current_config();\nvoid main_loop();\n\nextern volatile sig_atomic_t g_sigterm_pending, g_sighup_pending,\n    g_sigusr2_pending;\n\nextern int first_pass;\nextern int argc_copy;\nextern char **argv_copy;\n\nextern const char *getopt_string;\nextern const struct option longopts[];\n\nextern conky::simple_config_setting<bool> out_to_stdout;\nextern conky::simple_config_setting<bool> out_to_stderr;\n\n#endif /* _conky_h_ */\n"
  },
  {
    "path": "src/content/algebra.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"algebra.h\"\n#include <cctype>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <memory>\n#include \"config.h\"\n#include \"../conky.h\"\n#include \"../logging.h\"\n\n/* find the operand in the given expression\n * returns the index of the first op character or -1 on error\n */\nint find_match_op(const char *expr) {\n  unsigned int idx = 0;\n\n  /* if first operand is a string, skip it */\n  if (expr[idx] == '\"') {\n    for (idx=1; expr[idx] && expr[idx] != '\"'; idx++);\n    idx++;\n  }\n\n  for (; idx < strlen(expr); idx++) {\n    switch (expr[idx]) {\n      case '=':\n      case '!':\n        if (expr[idx + 1] != '=') { return -1; }\n        /* falls through */\n      case '<':\n      case '>':\n        return idx;\n    }\n  }\n  return -1;\n}\n\nint get_match_type(const char *expr) {\n  int idx;\n  const char *str;\n\n  if ((idx = find_match_op(expr)) == -1) { return -1; }\n  str = expr + idx;\n\n  if (*str == '=' && *(str + 1) == '=') { return OP_EQ; }\n  if (*str == '!' && *(str + 1) == '=') { return OP_NEQ; }\n  if (*str == '>') {\n    if (*(str + 1) == '=') { return OP_GEQ; }\n    return OP_GT;\n  }\n  if (*str == '<') {\n    if (*(str + 1) == '=') { return OP_LEQ; }\n    return OP_LT;\n  }\n  return -1;\n}\n\n/* generic compare function\n *\n * v is actually the difference of the compared values. For strings\n * this is equal to the output of str(n)cmp(). Use a macro here, as\n * it's type-independent.\n */\n#define COMPARE(v, t)    \\\n  switch (t) {           \\\n    case OP_GT:          \\\n      return ((v) > 0);  \\\n    case OP_LT:          \\\n      return ((v) < 0);  \\\n    case OP_EQ:          \\\n      return ((v) == 0); \\\n    case OP_GEQ:         \\\n      return ((v) >= 0); \\\n    case OP_LEQ:         \\\n      return ((v) <= 0); \\\n    case OP_NEQ:         \\\n      return ((v) != 0); \\\n  }                      \\\n  return 0\n\nint lcompare(long a, enum match_type mtype, long b) {\n  DBGP2(\"comparing longs '%ld' and '%ld'\", a, b);\n  COMPARE((a - b), mtype);\n}\nint dcompare(double a, enum match_type mtype, double b) {\n  DBGP2(\"comparing doubles '%.lf' and '%.lf'\", a, b);\n  COMPARE((a - b), mtype);\n}\n\nint scompare(const char *a, enum match_type mtype, const char *b) {\n  DBGP2(\"comparing strings '%s' and '%s'\", a, b);\n  COMPARE(strcmp(a, b), mtype);\n}\n\nenum arg_type get_arg_type(const char *arg) {\n  const char *p, *e;\n\n  p = arg;\n  e = arg + strlen(arg) - 1;\n\n  while (p != e && (*e != 0) && *e == ' ') { e--; }\n  while (p != e && *p == ' ') { p++; }\n\n  if (*p == '\"' && *e == '\"') { return ARG_STRING; }\n\n  if (*p == '-') {  // allow negative values\n    p++;\n  }\n  while (p <= e) {\n    if (isdigit(static_cast<unsigned char>(*p)) == 0) { break; }\n    p++;\n  }\n  if (p == e + 1) { return ARG_LONG; }\n  if (*p == '.' || *p == ',') {\n    p++;\n    while (p <= e) {\n      if (isdigit(static_cast<unsigned char>(*p)) == 0) { return ARG_BAD; }\n      p++;\n    }\n    return ARG_DOUBLE;\n  }\n  return ARG_BAD;\n}\n\nchar *arg_to_string(const char *arg) {\n  const char *start;\n  int len;\n\n  start = arg;\n  len = 0;\n  while ((*start != 0) && *start == ' ') { start++; }\n  if (!(*(start++) == '\"')) { return nullptr; }\n  while (start[len] != '\"') { len++; }\n  return strndup(start, len);\n}\ndouble arg_to_double(const char *arg) {\n  double d;\n  if (sscanf(arg, \"%lf\", &d) != 1) {\n    NORM_ERR(\"converting '%s' to double failed\", arg);\n    return 0.0;\n  }\n  return d;\n}\nlong arg_to_long(const char *arg) {\n  long l;\n  if (sscanf(arg, \"%ld\", &l) != 1) {\n    NORM_ERR(\"converting '%s' to long failed\", arg);\n    return 0;\n  }\n  return l;\n}\n\nint compare(const char *expr) {\n  char *expr_dup;\n  int idx, mtype;\n  enum arg_type type1, type2;\n  long lng_a, lng_b;\n  double dbl_a, dbl_b;\n\n  idx = find_match_op(expr);\n  mtype = get_match_type(expr);\n\n  if ((idx <= 0) || mtype == -1) {\n    NORM_ERR(\"failed to parse compare string '%s'\", expr);\n    return -2;\n  }\n\n  expr_dup = strdup(expr);\n  expr_dup[idx] = '\\0';\n  if (expr_dup[idx + 1] == '=') { expr_dup[++idx] = '\\0'; }\n\n  type1 = get_arg_type(expr_dup);\n  type2 = get_arg_type(expr_dup + idx + 1);\n  if (type1 == ARG_BAD || type2 == ARG_BAD) {\n    NORM_ERR(\"Bad arguments: '%s' and '%s'\", expr_dup, (expr_dup + idx + 1));\n    free(expr_dup);\n    return -2;\n  }\n  if (type1 == ARG_LONG && type2 == ARG_DOUBLE) { type1 = ARG_DOUBLE; }\n  if (type1 == ARG_DOUBLE && type2 == ARG_LONG) { type2 = ARG_DOUBLE; }\n  if (type1 != type2) {\n    NORM_ERR(\"trying to compare args '%s' and '%s' of different type\", expr_dup,\n             (expr_dup + idx + 1));\n    free(expr_dup);\n    return -2;\n  }\n  switch (type1) {\n    case ARG_STRING: {\n      char *a, *b;\n      a = arg_to_string(expr_dup);\n      b = arg_to_string(expr_dup + idx + 1);\n      idx = scompare(a, static_cast<enum match_type>(mtype), b);\n      free(a);\n      free(b);\n      free(expr_dup);\n      return idx;\n    }\n    case ARG_LONG:\n      lng_a = arg_to_long(expr_dup);\n      lng_b = arg_to_long(expr_dup + idx + 1);\n      free(expr_dup);\n      return lcompare(lng_a, static_cast<enum match_type>(mtype), lng_b);\n    case ARG_DOUBLE:\n      dbl_a = arg_to_double(expr_dup);\n      dbl_b = arg_to_double(expr_dup + idx + 1);\n      free(expr_dup);\n      return dcompare(dbl_a, static_cast<enum match_type>(mtype), dbl_b);\n    case ARG_BAD: /* make_gcc_happy() */;\n  }\n  /* not reached */\n  free(expr_dup);\n  return -2;\n}\n\nint check_if_match(struct text_object *obj) {\n  std::unique_ptr<char[]> expression(new char[max_user_text.get(*state)]);\n  int val;\n  int result = 1;\n\n  generate_text_internal(expression.get(), max_user_text.get(*state),\n                         *obj->sub);\n  DBGP(\"parsed arg into '%s'\", expression.get());\n\n  val = compare(expression.get());\n  if (val == -2) {\n    NORM_ERR(\"compare failed for expression '%s'\", expression.get());\n  } else if (val == 0) {\n    result = 0;\n  }\n  return result;\n}\n"
  },
  {
    "path": "src/content/algebra.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _ALGEBRA_H\n#define _ALGEBRA_H\n\nenum match_type {\n  OP_LT = 1,  /* < */\n  OP_GT = 2,  /* > */\n  OP_EQ = 3,  /* == */\n  OP_LEQ = 4, /* <= */\n  OP_GEQ = 5, /* >= */\n  OP_NEQ = 6  /* != */\n};\n\nenum arg_type {\n  ARG_BAD = 0,    /* something strange */\n  ARG_STRING = 1, /* \"asdf\" */\n  ARG_LONG = 2,   /* 123456 */\n  ARG_DOUBLE = 3  /* 12.456 */\n};\n\nint compare(const char *);\nint check_if_match(struct text_object *);\nint get_match_type(const char *expr);\nint find_match_op(const char *expr);\n\n#endif /* _ALGEBRA_H */\n"
  },
  {
    "path": "src/content/colour-names-stub.hh",
    "content": "/*\n * To generate colour-names.hh, you must have gperf installed during build.\n * This is a dummy implementation for builds without gperf.\n * Color name matching will always return null (i.e. no match).\n */\n\n#pragma once\n\n#include <cstdint>\n\n#include \"../logging.h\"\n\nstruct rgb {\n  const char *name;\n  uint8_t red;\n  uint8_t green;\n  uint8_t blue;\n};\n\nclass color_name_hash {\n public:\n  static const struct rgb *in_word_set(const char *str, size_t len);\n};\n\nconst struct rgb *color_name_hash::in_word_set(const char *str, size_t len) {\n  DBGP2(\"color parsing not supported\");\n  return nullptr;\n}\n"
  },
  {
    "path": "src/content/colours.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"colours.hh\"\n\n#include \"../logging.h\"\n\n#include <cstdio>\n#include <optional>\n\nColour Colour::from_argb32(uint32_t argb) {\n  Colour out;\n  out.alpha = argb >> 24;\n  out.red = (argb >> 16) % 256;\n  out.green = (argb >> 8) % 256;\n  out.blue = argb % 256;\n  return out;\n}\n\n#ifdef BUILD_COLOUR_NAME_MAP\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wregister\"\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wregister\"\n#include <colour-names.hh>\n#pragma clang diagnostic pop\n#pragma GCC diagnostic pop\n#else /* BUILD_COLOUR_NAME_MAP */\n#include \"colour-names-stub.hh\"\n#endif /* BUILD_COLOUR_NAME_MAP */\n\nstd::optional<Colour> inline no_colour() { return std::nullopt; }\ntemplate <typename... Args>\nstd::optional<Colour> parse_error(const std::string &color_str,\n                                  const char *format, Args... args) {\n  size_t len = snprintf(nullptr, 0, format, args...);\n\n  char *reason = new char[len + 1];\n  snprintf(reason, len + 1, format, args...);\n\n  NORM_ERR(\"can't parse color '%s' (len: %d): %s\", color_str.c_str(),\n           color_str.length(), reason);\n  delete[] reason;\n\n  return ERROR_COLOUR;\n}\nstd::optional<Colour> parse_error(const std::string &color_str,\n                                  const char *reason) {\n  NORM_ERR(\"can't parse color '%s' (len: %d): %s\", color_str.c_str(),\n           color_str.length(), reason);\n  return ERROR_COLOUR;\n}\n\nstd::optional<Colour> parse_color_name(const std::string &name) {\n  const rgb *value = color_name_hash::in_word_set(name.c_str(), name.length());\n  if (value == nullptr) {\n    return no_colour();\n  } else {\n    return Colour{value->red, value->green, value->blue};\n  }\n}\n\nstd::optional<Colour> parse_hex_color(const std::string &color) {\n  const char *name = color.c_str();\n  size_t len = color.length();\n  // Skip a leading '#' if present.\n  if (name[0] == '#') {\n    name++;\n    len--;\n  }\n\n  static auto hex_nibble_value = [](char c) {\n    if (c >= '0' && c <= '9') {\n      return c - '0';\n    } else if (c >= 'a' && c <= 'f') {\n      return c - 'a' + 10;\n    } else if (c >= 'A' && c <= 'F') {\n      return c - 'A' + 10;\n    }\n    return -1;\n  };\n\n  uint8_t argb[4] = {0xff, 0, 0, 0};\n  if (len == 3 || len == 4) {\n    bool skip_alpha = (len == 3);\n    for (size_t i = 0; i < len; i++) {\n      int nib = hex_nibble_value(name[i]);\n      if (nib < 0) return parse_error(color, \"invalid hex value\");\n      // Duplicate the nibble, so \"#abc\" -> 0xaa, 0xbb, 0xcc\n      int val = (nib << 4) + nib;\n\n      argb[skip_alpha + i] = val;\n    }\n  } else if (len == 6 || len == 8) {\n    bool skip_alpha = (len == 6);\n    for (size_t i = 0; i + 1 < len; i += 2) {\n      int nib1 = hex_nibble_value(name[i]);\n      int nib2 = hex_nibble_value(name[i + 1]);\n      if (nib1 < 0 || nib2 < 0) return parse_error(color, \"invalid hex value\");\n      int val = (nib1 << 4) + nib2;\n\n      argb[skip_alpha + i / 2] = val;\n    }\n  } else {\n    return no_colour();\n  }\n\n  return Colour(argb[1], argb[2], argb[3], argb[0]);\n}\n\nColour parse_color(const std::string &color) {\n  std::optional<Colour> result;\n\n#define TRY_PARSER(name)                            \\\n  std::optional<Colour> value_##name = name(color); \\\n  if (value_##name.has_value()) { return value_##name.value(); }\n\n  TRY_PARSER(parse_color_name)\n  TRY_PARSER(parse_hex_color)\n\n#undef TRY_PARSER\n\n  NORM_ERR(\"can't parse color '%s'\", color.c_str());\n  return ERROR_COLOUR;\n}\n\nColour::Colour(const std::string &name) {\n  const auto result = parse_color(name);\n  this->red = result.red;\n  this->green = result.green;\n  this->blue = result.blue;\n  this->alpha = result.alpha;\n}\n"
  },
  {
    "path": "src/content/colours.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _COLOURS_H_\n#define _COLOURS_H_\n\n#include \"config.h\"\n\n#include <cassert>\n#include <climits>\n#include <cstdint>\n#include <memory>\n#include <string>\n#include <unordered_map>\n\n#ifdef BUILD_X11\n#include <X11/Xlib.h>\n#endif /* BUILD_X11 */\n\nstruct Colour {\n  uint8_t red;\n  uint8_t green;\n  uint8_t blue;\n  uint8_t alpha = 0xff;\n\n public:\n  Colour() = default;\n  Colour(uint8_t r, uint8_t g, uint8_t b, uint8_t a = UINT8_MAX)\n      : red(r), green(g), blue(b), alpha(a) {}\n  explicit Colour(const std::string &name);\n  Colour(const Colour &) = default;\n  Colour(Colour &&) = default;\n\n  void operator=(const Colour &c) {\n    red = c.red;\n    green = c.green;\n    blue = c.blue;\n    alpha = c.alpha;\n  }\n\n  // Compare two instances.\n  bool operator==(const Colour &c) const {\n    return c.red == red && c.green == green && c.blue == blue &&\n           c.alpha == alpha;\n  }\n\n  uint8_t *data() { return reinterpret_cast<uint8_t *>(this); }\n\n  // Express the color as a 32-bit ARGB integer (alpha in MSB).\n  uint32_t to_argb32(void) const {\n    uint32_t out;\n    out = alpha << 24 | red << 16 | green << 8 | blue;\n    return out;\n  }\n\n  // Construct from a 32-bit ARGB integer (alpha in MSB).\n  static Colour from_argb32(uint32_t argb);\n\n  class Hash {\n   public:\n    size_t operator()(const Colour &c) const { return c.to_argb32(); }\n  };\n\n#ifdef BUILD_X11\n  unsigned long to_x11_color(Display *display, int screen,\n                             bool transparency = false,\n                             bool premultiply = false);\n#endif /* BUILD_X11 */\n};\n\nconst Colour ERROR_COLOUR = Colour{UINT8_MAX, 0, 0, UINT8_MAX};\n\nColour parse_color(const std::string &color);\n\n#endif /* _COLOURS_H_ */\n"
  },
  {
    "path": "src/content/combine.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <vector>\n\n#include \"../core.h\"\n#include \"../logging.h\"\n#include \"text_object.h\"\n\nstruct combine_data {\n  char *left;\n  char *seperation;\n  char *right;\n};\n\nvoid parse_combine_arg(struct text_object *obj, const char *arg) {\n  struct combine_data *cd;\n  unsigned int i, j;\n  unsigned int indenting = 0;  // vars can be used as args for other vars\n  int startvar[2];\n  int endvar[2];\n  startvar[0] = endvar[0] = startvar[1] = endvar[1] = -1;\n  j = 0;\n  for (i = 0; arg[i] != 0 && j < 2; i++) {\n    if (startvar[j] == -1) {\n      if (arg[i] == '$') { startvar[j] = i; }\n    } else if (endvar[j] == -1) {\n      if (arg[i] == '{') {\n        indenting++;\n      } else if (arg[i] == '}') {\n        indenting--;\n      }\n      if (indenting == 0 &&\n          arg[i + 1] < 48) {  //<48 has 0, $, and the most used chars not used\n                              // in varnames but not { or }\n        endvar[j] = i + 1;\n        j++;\n      }\n    }\n  }\n  if (startvar[0] >= 0 && endvar[0] >= 0 && startvar[1] >= 0 &&\n      endvar[1] >= 0) {\n    cd =\n        static_cast<struct combine_data *>(malloc(sizeof(struct combine_data)));\n    memset(cd, 0, sizeof(struct combine_data));\n\n    cd->left = static_cast<char *>(malloc(endvar[0] - startvar[0] + 1));\n    cd->seperation = static_cast<char *>(malloc(startvar[1] - endvar[0] + 1));\n    cd->right = static_cast<char *>(malloc(endvar[1] - startvar[1] + 1));\n\n    strncpy(cd->left, arg + startvar[0], endvar[0] - startvar[0]);\n    cd->left[endvar[0] - startvar[0]] = 0;\n\n    strncpy(cd->seperation, arg + endvar[0], startvar[1] - endvar[0]);\n    cd->seperation[startvar[1] - endvar[0]] = 0;\n\n    strncpy(cd->right, arg + startvar[1], endvar[1] - startvar[1]);\n    cd->right[endvar[1] - startvar[1]] = 0;\n\n    obj->sub =\n        static_cast<struct text_object *>(malloc(sizeof(struct text_object)));\n    extract_variable_text_internal(obj->sub, cd->left);\n    obj->sub->sub =\n        static_cast<struct text_object *>(malloc(sizeof(struct text_object)));\n    extract_variable_text_internal(obj->sub->sub, cd->right);\n    obj->data.opaque = cd;\n  } else {\n    throw combine_needs_2_args_error();\n  }\n}\n\nvoid print_combine(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *cd = static_cast<struct combine_data *>(obj->data.opaque);\n  std::vector<std::vector<char>> buf;\n  buf.resize(2);\n  buf[0].resize(max_user_text.get(*state));\n  buf[1].resize(max_user_text.get(*state));\n  int i, j;\n  int p_len_remaining = p_max_size - 1;\n  long longest = 0;\n  int nextstart;\n  int nr_rows[2];\n  struct llrows {\n    char *row;\n    struct llrows *next;\n  };\n  struct llrows *ll_rows[2], *current[2];\n  struct text_object *objsub = obj->sub;\n\n  if ((cd == nullptr) || (p_max_size == 0)) { return; }\n\n  p[0] = 0;\n  for (i = 0; i < 2; i++) {\n    nr_rows[i] = 1;\n    nextstart = 0;\n    ll_rows[i] = static_cast<struct llrows *>(malloc(sizeof(struct llrows)));\n    current[i] = ll_rows[i];\n    for (j = 0; j < i; j++) { objsub = objsub->sub; }\n    generate_text_internal(&(buf[i][0]), max_user_text.get(*state), *objsub);\n    for (j = 0; buf[i][j] != 0; j++) {\n      if (buf[i][j] == '\\t') { buf[i][j] = ' '; }\n      if (buf[i][j] == '\\n') {\n        buf[i][j] = 0;  // the vars inside combine may not have a \\n at the end\n      }\n      if (buf[i][j] ==\n          2) {  // \\002 is used instead of \\n to separate lines inside a var\n        buf[i][j] = 0;\n        current[i]->row = strdup(&(buf[i][0]) + nextstart);\n        if (i == 0 && static_cast<long>(strlen(current[i]->row)) > longest) {\n          longest = static_cast<long>(strlen(current[i]->row));\n        }\n        current[i]->next =\n            static_cast<struct llrows *>(malloc(sizeof(struct llrows)));\n        current[i] = current[i]->next;\n        nextstart = j + 1;\n        nr_rows[i]++;\n      }\n    }\n    current[i]->row = strdup(&(buf[i][0]) + nextstart);\n    if (i == 0 && static_cast<long>(strlen(current[i]->row)) > longest) {\n      longest = static_cast<long>(strlen(current[i]->row));\n    }\n    current[i]->next = nullptr;\n    current[i] = ll_rows[i];\n  }\n  for (j = 0; j < (nr_rows[0] > nr_rows[1] ? nr_rows[0] : nr_rows[1]); j++) {\n    if (current[0] != nullptr) {\n      strncat(p, current[0]->row, p_len_remaining);\n      p_len_remaining -= strlen(current[0]->row);\n      i = strlen(current[0]->row);\n    } else {\n      i = 0;\n    }\n    while (i < longest) {\n      strncat(p, \" \", p_len_remaining);\n      p_len_remaining -= 2;\n      i++;\n    }\n    if (current[1] != nullptr) {\n      p_len_remaining -= strlen(cd->seperation);\n      strncat(p, cd->seperation, p_len_remaining);\n      p_len_remaining -= strlen(current[1]->row);\n      strncat(p, current[1]->row, p_len_remaining);\n    }\n    strncat(p, \"\\n\", p_len_remaining);\n    p_len_remaining -= 2;\n#ifdef HAVE_OPENMP\n#pragma omp parallel for schedule(dynamic, 10)\n#endif /* HAVE_OPENMP */\n    for (i = 0; i < 2; i++) {\n      if (current[i] != nullptr) { current[i] = current[i]->next; }\n    }\n  }\n#ifdef HAVE_OPENMP\n#pragma omp parallel for schedule(dynamic, 10)\n#endif /* HAVE_OPENMP */\n  for (i = 0; i < 2; i++) {\n    while (ll_rows[i] != nullptr) {\n      current[i] = ll_rows[i];\n      free(current[i]->row);\n      ll_rows[i] = current[i]->next;\n      free(current[i]);\n    }\n  }\n}\n\nvoid free_combine(struct text_object *obj) {\n  auto *cd = static_cast<struct combine_data *>(obj->data.opaque);\n\n  if (cd == nullptr) { return; }\n  free(cd->left);\n  free(cd->seperation);\n  free(cd->right);\n  free_text_objects(obj->sub->sub);\n  free_and_zero(obj->sub->sub);\n  free_text_objects(obj->sub);\n  free_and_zero(obj->sub);\n  free_and_zero(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/content/combine.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _COMBINE_H\n#define _COMBINE_H\n\nvoid parse_combine_arg(struct text_object *, const char *);\nvoid print_combine(struct text_object *, char *, unsigned int);\nvoid free_combine(struct text_object *);\n\n#endif /* _COMBINE_H */\n"
  },
  {
    "path": "src/content/gradient.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"gradient.hh\"\n#include \"../conky.h\"\n#include \"../logging.h\"\n#include \"colours.hh\"\n\nnamespace conky {\ngradient_factory::gradient_factory(int width, Colour first_colour,\n                                   Colour last_colour) {\n  // Make sure the width is always at least 2\n  this->width = std::max(2, width);\n  this->first_colour = first_colour;\n  this->last_colour = last_colour;\n}\n\nvoid gradient_factory::convert_from_rgb(Colour original, long *array) {\n  long scaled[3];\n\n  scaled[0] = original.red * SCALE;\n  scaled[1] = original.green * SCALE;\n  scaled[2] = original.blue * SCALE;\n  convert_from_scaled_rgb(scaled, array);\n}\n\nColour gradient_factory::convert_to_rgb(long *const array) {\n  long scaled_rgb[3];\n  Colour c;\n\n  convert_to_scaled_rgb(array, scaled_rgb);\n  c.red = scaled_rgb[0] / SCALE;\n  c.green = scaled_rgb[1] / SCALE;\n  c.blue = scaled_rgb[2] / SCALE;\n  c.alpha = 255;\n\n  return c;\n}\n\ngradient_factory::colour_array gradient_factory::create_gradient() {\n  colour_array colours(new Colour[width]);\n\n  long first_converted[3];\n  long last_converted[3];\n  long diff[3], delta[3];\n\n  colours[0] = first_colour;\n  colours[width - 1] = last_colour;\n\n  convert_from_rgb(first_colour, first_converted);\n  convert_from_rgb(last_colour, last_converted);\n\n  for (int i = 0; i < 3; i++) {\n    diff[i] = last_converted[i] - first_converted[i];\n  }\n  fix_diff(diff);\n  for (int i = 0; i < 3; i++) { delta[i] = diff[i] / (width - 1); }\n  for (int i = 1; i < width - 1; i++) {\n    for (int k = 0; k < 3; k++) { first_converted[k] += delta[k]; }\n    colours[i] = convert_to_rgb(first_converted);\n  }\n\n  return colours;\n}\n\nlong gradient_factory::get_hue(long *const rgb, long chroma, long value) {\n  if (chroma == 0) { return 0; }\n\n  long diff, offset;\n\n  if (rgb[0] == value) {\n    diff = rgb[1] - rgb[2];\n    offset = 0;\n  } else if (rgb[1] == value) {\n    diff = rgb[2] - rgb[0];\n    offset = SCALE2;\n  } else {\n    diff = rgb[0] - rgb[1];\n    offset = SCALE4;\n  }\n  long h = (SCALE * diff) / chroma + offset;\n\n  return 60L * ((SCALE6 + h) % SCALE6);\n}\n\nlong gradient_factory::get_intermediate(long hue, long chroma) {\n  long h = hue / 60L;\n  long multiplier = SCALE - std::abs(h % SCALE2 - SCALE);\n\n  return (chroma * multiplier) / SCALE;\n}\n\n/* rgb_gradient_factory  */\nvoid rgb_gradient_factory::convert_from_scaled_rgb(long *const scaled,\n                                                   long *target) {\n  target[0] = scaled[0] * 360L;\n  target[1] = scaled[1] * 360L;\n  target[2] = scaled[2] * 360L;\n}\n\nvoid rgb_gradient_factory::convert_to_scaled_rgb(long *const target,\n                                                 long *scaled) {\n  scaled[0] = target[0] / 360L;\n  scaled[1] = target[1] / 360L;\n  scaled[2] = target[2] / 360L;\n}\n/* rgb_gradient_factory  */\n\nnamespace {\nlong get_value(long *const rgb) {\n  if (rgb[0] > rgb[1]) { return std::max(rgb[0], rgb[2]); }\n  return std::max(rgb[1], rgb[2]);\n}\n\nlong get_minimum(long *const rgb) {\n  if (rgb[0] < rgb[1]) { return std::min(rgb[0], rgb[2]); }\n  return std::min(rgb[1], rgb[2]);\n}\n}  // namespace\n\n/* hsv_gradient_factory */\nvoid hsv_gradient_factory::fix_diff(long *diff) {\n  if (diff[0] > SCALE180) {\n    diff[0] -= SCALE360;\n  } else if (diff[0] < -SCALE180) {\n    diff[0] += SCALE360;\n  }\n}\n\nvoid hsv_gradient_factory::convert_from_scaled_rgb(long *const scaled,\n                                                   long *target) {\n  auto value = get_value(scaled);\n  auto minimum = get_minimum(scaled);\n  auto chroma = value - minimum;\n  long saturation = (SCALE360 * (uint64_t)chroma) / value;\n\n  target[0] = get_hue(scaled, chroma, value);\n  target[1] = saturation;\n  target[2] = value * 360L;\n}\n\nvoid hsv_gradient_factory::convert_to_scaled_rgb(long *const target,\n                                                 long *scaled) {\n  auto hue = target[0] % SCALE360;\n  auto saturation = target[1] / 360L;\n  auto value = target[2] / 360L;\n  auto chroma = (saturation * value) / SCALE;\n  auto x = get_intermediate(hue, chroma);\n\n  scaled[0] = scaled[1] = scaled[2] = (value - chroma);\n\n  if (hue < SCALE60) {\n    scaled[0] += chroma;\n    scaled[1] += x;\n  } else if (hue < SCALE120) {\n    scaled[0] += x;\n    scaled[1] += chroma;\n  } else if (hue < SCALE180) {\n    scaled[1] += chroma;\n    scaled[2] += x;\n  } else if (hue < SCALE240) {\n    scaled[1] += x;\n    scaled[2] += chroma;\n  } else if (hue < SCALE300) {\n    scaled[2] += chroma;\n    scaled[0] += x;\n  } else {\n    scaled[2] += x;\n    scaled[0] += chroma;\n  }\n}\n/* hsv_gradient_factory */\n\nnamespace {\n// Using Rec.2020 color space\n// Y' = 0.2627 x R + 0.6780 x G + 0.0593 x B\nlong get_luma(long *const rgb) {\n  return 360L * (uint64_t)(2627L * rgb[0] + 6780L * rgb[1] + 593L * rgb[2]) /\n         10000L;\n}\n\n// Using Rec.2020 color space\n// m = Y' - (0.2627 x R + 0.6780 x G + 0.0593 x B)\nlong get_minimum_from_luma(long luma, long r, long g, long b) {\n  return luma - (2627L * r + 6780L * g + 593L * b) / 10000L;\n}\n}  // namespace\n\n/* hcl_gradient_factory */\nvoid hcl_gradient_factory::fix_diff(long *diff) {\n  if (diff[0] > SCALE180) {\n    diff[0] -= SCALE360;\n  } else if (diff[0] < -SCALE180) {\n    diff[0] += SCALE360;\n  }\n}\n\nvoid hcl_gradient_factory::convert_from_scaled_rgb(long *const scaled,\n                                                   long *target) {\n  auto value = get_value(scaled);\n  auto minimum = get_minimum(scaled);\n  auto luma = get_luma(scaled);\n  auto chroma = value - minimum;\n\n  target[0] = get_hue(scaled, chroma, value);\n  target[1] = chroma * 360L;\n  target[2] = luma;\n}\n\nvoid hcl_gradient_factory::convert_to_scaled_rgb(long *const target,\n                                                 long *scaled) {\n  auto hue = target[0] % SCALE360;\n  auto chroma = target[1] / 360L;\n  auto luma = target[2] / 360L;\n\n  auto x = get_intermediate(hue, chroma);\n  long m;\n\n  if (hue < SCALE60) {\n    m = get_minimum_from_luma(luma, chroma, x, 0);\n    scaled[0] = scaled[1] = scaled[2] = m;\n    scaled[0] += chroma;\n    scaled[1] += x;\n  } else if (hue < SCALE120) {\n    m = get_minimum_from_luma(luma, x, chroma, 0);\n    scaled[0] = scaled[1] = scaled[2] = m;\n    scaled[0] += x;\n    scaled[1] += chroma;\n  } else if (hue < SCALE180) {\n    m = get_minimum_from_luma(luma, 0, chroma, x);\n    scaled[0] = scaled[1] = scaled[2] = m;\n    scaled[1] += chroma;\n    scaled[2] += x;\n  } else if (hue < SCALE240) {\n    m = get_minimum_from_luma(luma, 0, x, chroma);\n    scaled[0] = scaled[1] = scaled[2] = m;\n    scaled[1] += x;\n    scaled[2] += chroma;\n  } else if (hue < SCALE300) {\n    m = get_minimum_from_luma(luma, x, 0, chroma);\n    scaled[0] = scaled[1] = scaled[2] = m;\n    scaled[2] += chroma;\n    scaled[0] += x;\n  } else {\n    m = get_minimum_from_luma(luma, chroma, 0, x);\n    scaled[0] = scaled[1] = scaled[2] = m;\n    scaled[2] += x;\n    scaled[0] += chroma;\n  }\n}\n/* hcl_gradient_factory */\n}  // namespace conky\n"
  },
  {
    "path": "src/content/gradient.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _GRADIENT_H\n#define _GRADIENT_H\n\n#include <memory>\n#include \"colours.hh\"\n\nnamespace conky {\nclass gradient_factory {\n public:\n  typedef std::unique_ptr<Colour[]> colour_array;\n  static const long SCALE = 512L;\n  static const long SCALE2 = SCALE * 2;\n  static const long SCALE4 = SCALE * 4;\n  static const long SCALE6 = SCALE * 6;\n  static const long SCALE60 = SCALE * 60;\n  static const long SCALE120 = SCALE * 120;\n  static const long SCALE180 = SCALE * 180;\n  static const long SCALE240 = SCALE * 240;\n  static const long SCALE300 = SCALE * 300;\n  static const long SCALE360 = SCALE * 360;\n\n public:\n  gradient_factory(int width, Colour first_colour, Colour last_colour);\n  virtual ~gradient_factory() {}\n\n  colour_array create_gradient();\n\n  virtual void convert_from_scaled_rgb(long *const scaled, long *target) = 0;\n  virtual void convert_to_scaled_rgb(long *const target, long *scaled) = 0;\n\n  void convert_from_rgb(Colour original, long *array);\n  Colour convert_to_rgb(long *const array);\n\n protected:\n  virtual void fix_diff(long *) {}\n\n  static long get_hue(long *const scaled, long chroma, long value);\n  static long get_intermediate(long hue, long chroma);\n\n private:\n  int width;\n  Colour first_colour;\n  Colour last_colour;\n};\n\nclass rgb_gradient_factory : public gradient_factory {\n  using gradient_factory::gradient_factory;\n\n public:\n  void convert_from_scaled_rgb(long *const scaled, long *target);\n  void convert_to_scaled_rgb(long *const target, long *scaled);\n};\n\nclass hsv_gradient_factory : public gradient_factory {\n  using gradient_factory::gradient_factory;\n\n public:\n  void fix_diff(long *diff);\n  void convert_from_scaled_rgb(long *const scaled, long *target);\n  void convert_to_scaled_rgb(long *const target, long *scaled);\n};\n\nclass hcl_gradient_factory : public gradient_factory {\n  using gradient_factory::gradient_factory;\n\n public:\n  void fix_diff(long *diff);\n  void convert_from_scaled_rgb(long *const scaled, long *target);\n  void convert_to_scaled_rgb(long *const target, long *scaled);\n};\n}  // namespace conky\n\n#endif /* _GRADIENT_H */\n"
  },
  {
    "path": "src/content/scroll.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include <vector>\n#include \"../conky.h\"\n#include \"../core.h\"\n#include \"../logging.h\"\n#include \"../output/display-output.hh\"\n#include \"colours.hh\"\n#include \"specials.h\"\n#include \"text_object.h\"\n\n/**\n * Length of a character in bytes.\n * @param c first byte of the character\n */\ninline int scroll_character_length(char c) {\n#ifdef BUILD_GUI\n  if (utf8_mode.get(*state)) {\n    auto uc = static_cast<unsigned char>(c);\n    int len = 0;\n\n    if ((uc & 0x80) == 0) { return 1; }\n\n    while (len < 7 && (uc & (0x80 >> len)) != 0) { ++len; }\n\n    return len;\n  }\n#else  /* BUILD_GUI */\n  (void)c;\n#endif /* BUILD_GUI */\n\n  return 1;\n}\n\n/**\n * Check if a byte should be skipped when counting characters to scroll text to\n * right.\n */\ninline bool scroll_check_skip_byte(char c) {\n#ifdef BUILD_GUI\n  // Check if byte matches UTF-8 continuation byte pattern (0b10xxxxxx)\n  if (utf8_mode.get(*state) && (c & 0xC0) == 0x80) { return true; }\n#endif\n\n  return SPECIAL_CHAR == c;\n}\n\n#define SCROLL_LEFT 1\n#define SCROLL_RIGHT 2\n#define SCROLL_WAIT 3\n\nstruct scroll_data {\n  char *text;\n  unsigned int show;\n  unsigned int step;\n  int wait;\n  unsigned int wait_arg;\n  signed int start;\n  Colour resetcolor;\n  int direction;\n};\n\n/**\n * Get count of characters to right from (sd->start) position.\n */\nstatic unsigned int scroll_count_characters_to_right(\n    struct scroll_data *sd, const std::vector<char> &buf) {\n  unsigned int n = 0;\n  unsigned int offset = sd->start;\n\n  while ('\\0' != buf[offset] && offset < buf.size()) {\n    offset += scroll_character_length(buf[offset]);\n    ++n;\n  }\n\n  return n;\n}\n\nstatic void scroll_scroll_left(struct scroll_data *sd,\n                               const std::vector<char> &buf,\n                               unsigned int amount) {\n  for (unsigned int i = 0; (i < amount) && (buf[sd->start] != '\\0') &&\n                           (static_cast<unsigned int>(sd->start) < buf.size());\n       ++i) {\n    sd->start += scroll_character_length(buf[sd->start]);\n  }\n\n  if (buf[sd->start] == 0 ||\n      static_cast<unsigned int>(sd->start) > strlen(buf.data())) {\n    sd->start = 0;\n  }\n}\n\nstatic void scroll_scroll_right(struct scroll_data *sd,\n                                const std::vector<char> &buf,\n                                unsigned int amount) {\n  for (unsigned int i = 0; i < amount; ++i) {\n    if (sd->start <= 0) { sd->start = static_cast<int>(strlen(&(buf[0]))); }\n\n    while (--(sd->start) >= 0) {\n      if (!scroll_check_skip_byte(buf[sd->start])) { break; }\n    }\n  }\n}\n\nvoid parse_scroll_arg(struct text_object *obj, const char *arg,\n                      void *free_at_crash, char *free_at_crash2) {\n  struct scroll_data *sd;\n  int n1 = 0, n2 = 0;\n  char dirarg[6];\n\n  sd = static_cast<struct scroll_data *>(malloc(sizeof(struct scroll_data)));\n  memset(sd, 0, sizeof(struct scroll_data));\n\n  sd->resetcolor = get_current_text_color();\n  sd->step = 1;\n  sd->direction = SCROLL_LEFT;\n\n  if ((arg != nullptr) && sscanf(arg, \"%5s %n\", dirarg, &n1) == 1) {\n    if (strcasecmp(dirarg, \"right\") == 0 || strcasecmp(dirarg, \"r\") == 0) {\n      sd->direction = SCROLL_RIGHT;\n    } else if (strcasecmp(dirarg, \"wait\") == 0 ||\n               strcasecmp(dirarg, \"w\") == 0) {\n      sd->direction = SCROLL_WAIT;\n    } else if (strcasecmp(dirarg, \"left\") != 0 &&\n               strcasecmp(dirarg, \"l\") != 0) {\n      n1 = 0;\n    }\n  }\n\n  if ((arg == nullptr) || sscanf(arg + n1, \"%u %n\", &sd->show, &n2) <= 0) {\n    free(sd);\n#ifdef BUILD_GUI\n    free(obj->next);\n#endif\n    free(free_at_crash2);\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"scroll needs arguments: [left|right|wait] <length> [<step>] \"\n                  \"[interval] <text>\");\n  }\n  n1 += n2;\n\n  if (sscanf(arg + n1, \"%u %n\", &sd->step, &n2) == 1) {\n    n1 += n2;\n  } else {\n    sd->step = 1;\n  }\n\n  if (sscanf(arg + n1, \"%u %n\", &sd->wait_arg, &n2) == 1) {\n    n1 += n2;\n    sd->wait = sd->wait_arg;\n  } else {\n    sd->wait_arg = sd->wait = 0;\n  }\n\n  sd->text = static_cast<char *>(malloc(strlen(arg + n1) + sd->show + 1));\n\n  if (strlen(arg) > sd->show && sd->direction != SCROLL_WAIT) {\n    for (n2 = 0; static_cast<unsigned int>(n2) < sd->show; n2++) {\n      sd->text[n2] = ' ';\n    }\n    sd->text[n2] = 0;\n  } else {\n    sd->text[0] = 0;\n  }\n\n  strncat(sd->text, arg + n1, max_user_text.get(*state) - n1);\n  sd->start = sd->direction == SCROLL_WAIT ? strlen(sd->text) : 0;\n  obj->sub =\n      static_cast<struct text_object *>(malloc(sizeof(struct text_object)));\n  extract_variable_text_internal(obj->sub, sd->text);\n\n  obj->data.opaque = sd;\n\n#ifdef BUILD_GUI\n  /* add a color object right after scroll to reset any color changes */\n#endif /* BUILD_GUI */\n}\n\nvoid print_scroll(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *sd = static_cast<struct scroll_data *>(obj->data.opaque);\n  unsigned int j, colorchanges = 0, frontcolorchanges = 0,\n                  visibcolorchanges = 0;\n  std::vector<char> buf(max_user_text.get(*state), static_cast<char>(0));\n\n  if (sd == nullptr) { return; }\n\n  generate_text_internal(&(buf[0]), max_user_text.get(*state), *obj->sub);\n  for (j = 0; buf[j] != 0; j++) {\n    if (buf[j] == '\\n') {\n      // place all the lines behind each other with LINESEPARATOR between them\n#define LINESEPARATOR '|'\n      buf[j] = LINESEPARATOR;\n    } else if (buf[j] == SPECIAL_CHAR) {\n      colorchanges++;\n    }\n  }\n\n  // no scrolling necessary if the length of the text to scroll is too short\n  if (strlen(&(buf[0])) - colorchanges <= sd->show) {\n    snprintf(p, p_max_size, \"%s\", &(buf[0]));\n    return;\n  }\n\n  // if length of text changed to shorter so the (sd->start) is already\n  // outside of actual text then reset (sd->start)\n  if (static_cast<unsigned int>(sd->start) >= strlen(&(buf[0]))) {\n    sd->start = 0;\n  }\n\n  // make sure a colorchange at the front is not part of the string we are going\n  // to show\n  while (buf[sd->start] == SPECIAL_CHAR) { sd->start++; }\n\n  // place all chars that should be visible in p, including colorchanges\n  unsigned int visiblechars;\n  for (j = 0, visiblechars = 0; visiblechars < sd->show;) {\n    char c = buf[sd->start + j];\n    p[j] = c;\n    if (0 == c) { break; }\n\n    ++j;\n\n    if (SPECIAL_CHAR == c) {\n      ++visibcolorchanges;\n    } else {\n      int l = scroll_character_length(c);\n\n      while (--l != 0) {\n        p[j] = buf[sd->start + j];\n        ++j;\n      }\n\n      ++visiblechars;\n    }\n  }\n\n  for (; visiblechars < sd->show; j++, visiblechars++) { p[j] = ' '; }\n  p[j] = 0;\n\n  // count colorchanges in front of the visible part and place that many\n  // colorchanges in front of the visible part\n  for (j = 0; j < static_cast<unsigned>(sd->start); j++) {\n    if (buf[j] == SPECIAL_CHAR) { frontcolorchanges++; }\n  }\n\n  int pwithcolors_len = strlen(p) + 4 + colorchanges - visibcolorchanges;\n  char *pwithcolors = new char[pwithcolors_len];\n\n  for (j = 0; j < frontcolorchanges; j++) { pwithcolors[j] = SPECIAL_CHAR; }\n  pwithcolors[j] = 0;\n  strcat(pwithcolors, p);\n  unsigned int strend = strlen(pwithcolors);\n  // and place the colorchanges not in front or in the visible part behind the\n  // visible part\n  for (j = 0; j < colorchanges - frontcolorchanges - visibcolorchanges; j++) {\n    pwithcolors[strend + j] = SPECIAL_CHAR;\n  }\n  pwithcolors[strend + j] = 0;\n  strncpy(p, pwithcolors, p_max_size);\n  delete[] pwithcolors;\n\n  // scroll\n  if (sd->direction == SCROLL_LEFT) {\n    scroll_scroll_left(sd, buf, sd->step);\n  } else if (sd->direction == SCROLL_WAIT) {\n    unsigned int charsleft = scroll_count_characters_to_right(sd, buf);\n\n    if (sd->show >= charsleft) {\n      if (sd->wait_arg == 0) {\n        sd->start = 0;\n      } else {\n        sd->wait--;\n        if (sd->wait <= 0 && sd->wait_arg != 1) {\n          sd->wait = sd->wait_arg;\n        } else {\n          sd->start = 0;\n        }\n      }\n    } else {\n      if (sd->wait_arg == 0 || sd->wait_arg == 1 || sd->wait <= 0) {\n        sd->wait = 0;\n\n        if (sd->step < charsleft) {\n          scroll_scroll_left(sd, buf, sd->step);\n        } else {\n          scroll_scroll_left(sd, buf, charsleft);\n        }\n      } else {\n        sd->wait--;\n      }\n    }\n  } else {\n    scroll_scroll_right(sd, buf, sd->step);\n  }\n\n#ifdef BUILD_GUI\n  // reset color when scroll is finished\n  if (display_output() && display_output()->graphical()) {\n    new_special(p + strlen(p), text_node_t::FG)->arg =\n        sd->resetcolor.to_argb32();\n  }\n#endif\n}\n\nvoid free_scroll(struct text_object *obj) {\n  auto *sd = static_cast<struct scroll_data *>(obj->data.opaque);\n\n  if (sd == nullptr) { return; }\n\n  free_and_zero(sd->text);\n  free_text_objects(obj->sub);\n  free_and_zero(obj->sub);\n  free_and_zero(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/content/scroll.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _SCROLL_H\n#define _SCROLL_H\n\nvoid parse_scroll_arg(struct text_object *, const char *, void *, char *);\nvoid print_scroll(struct text_object *, char *, unsigned int);\nvoid free_scroll(struct text_object *);\n\n#endif /* _SCROLL_H */\n"
  },
  {
    "path": "src/content/specials.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"../conky.h\"\n#ifdef BUILD_GUI\n#include \"../lua/fonts.h\"\n#include \"../output/gui.h\"\n#endif /* BUILD_GUI */\n#include <cmath>\n#include \"../logging.h\"\n#include \"../output/nc.h\"\n#include \"specials.h\"\n#ifdef HAVE_SYS_PARAM_H\n#include <sys/param.h>\n#endif /* HAVE_SYS_PARAM_H */\n#include <algorithm>\n#include <map>\n#include <sstream>\n#include \"../common.h\"\n#include \"../conky.h\"\n#include \"../output/display-output.hh\"\n#include \"colours.hh\"\n\nstruct special_node *specials = nullptr;\n\nint special_count;\nint graph_count = 0;\ndouble maxspeedval = 1e-47; /* The maximum value among the speed graphs */\n\nstd::map<int, double *> graphs;\n\nnamespace {\nconky::range_config_setting<int> default_bar_width(\n    \"default_bar_width\", 0, std::numeric_limits<int>::max(), 0, false);\nconky::range_config_setting<int> default_bar_height(\n    \"default_bar_height\", 0, std::numeric_limits<int>::max(), 6, false);\n\n#ifdef BUILD_GUI\nconky::range_config_setting<int> default_graph_width(\n    \"default_graph_width\", 0, std::numeric_limits<int>::max(), 0, false);\nconky::range_config_setting<int> default_graph_height(\n    \"default_graph_height\", 0, std::numeric_limits<int>::max(), 25, false);\n\nconky::range_config_setting<int> default_gauge_width(\n    \"default_gauge_width\", 0, std::numeric_limits<int>::max(), 40, false);\nconky::range_config_setting<int> default_gauge_height(\n    \"default_gauge_height\", 0, std::numeric_limits<int>::max(), 25, false);\n\nconky::simple_config_setting<bool> store_graph_data_explicitly(\n    \"store_graph_data_explicitly\", true, true);\n#endif /* BUILD_GUI */\n\nconky::simple_config_setting<std::string> console_graph_ticks(\n    \"console_graph_ticks\", \" ,_,=,#\", false);\n}  // namespace\n\n/* special data types flags */\n#define SF_SCALED (1 << 0)\n#define SF_SHOWLOG (1 << 1)\n\n/* special flag for inverting axis */\n#define SF_INVERTX (1 << 0)\n#define SF_INVERTY (1 << 1)\n\n/*\n * Special data typedefs\n */\n\nstruct bar {\n  char flags;\n  int width, height;\n  double scale;\n};\n\nstruct gauge {\n  char flags;\n  int width, height;\n  double scale;\n};\n\nstruct graph {\n  int id;\n  char flags;\n  int width, height;\n  bool colours_set;\n  Colour first_colour, last_colour;\n  double scale;\n  char tempgrad;\n  char speedgraph;  /* If the current graph is a speed graph */\n  char invertflag;  /* If the axis needs to be inverted */\n  int minheight;    /* Clamp values below this threshold to this threshold */\n};\n\nstruct stippled_hr {\n  int height, arg;\n};\n\nstruct tab {\n  int width, arg;\n};\n\n/*\n * Scanning arguments to various special text objects\n */\n\n#ifdef BUILD_GUI\nconst char *scan_gauge(struct text_object *obj, const char *args,\n                       double scale) {\n  struct gauge *g;\n\n  g = static_cast<struct gauge *>(malloc(sizeof(struct gauge)));\n  memset(g, 0, sizeof(struct gauge));\n\n  /*width and height*/\n  g->width = default_gauge_width.get(*state);\n  g->height = default_gauge_height.get(*state);\n\n  if (scale != 0.0) {\n    g->scale = scale;\n  } else {\n    g->flags |= SF_SCALED;\n  }\n\n  /* gauge's argument is either height or height,width */\n  if (args != nullptr) {\n    int n = 0;\n\n    if (sscanf(args, \"%d,%d %n\", &g->height, &g->width, &n) <= 1) {\n      if (sscanf(args, \"%d %n\", &g->height, &n) == 2) {\n        g->width = g->height; /*square gauge*/\n      }\n    }\n    args += n;\n  }\n\n  obj->special_data = g;\n  return args;\n}\n#endif\n\nconst char *scan_bar(struct text_object *obj, const char *args, double scale) {\n  struct bar *b;\n\n  b = static_cast<struct bar *>(malloc(sizeof(struct bar)));\n  memset(b, 0, sizeof(struct bar));\n\n  /* zero width means all space that is available */\n  b->width = default_bar_width.get(*state);\n  b->height = default_bar_height.get(*state);\n\n  if (scale != 0.0) {\n    b->scale = scale;\n  } else {\n    b->flags |= SF_SCALED;\n  }\n\n  /* bar's argument is either height or height,width */\n  if (args != nullptr) {\n    int n = 0;\n\n    if (sscanf(args, \"%d,%d %n\", &b->height, &b->width, &n) <= 1) {\n      sscanf(args, \"%d %n\", &b->height, &n);\n    }\n    args += n;\n  }\n\n  obj->special_data = b;\n  return args;\n}\n\n#ifdef BUILD_GUI\nvoid scan_font(struct text_object *obj, const char *args) {\n  if ((args != nullptr) && (*args != 0)) {\n    obj->data.s = strndup(args, DEFAULT_TEXT_BUFFER_SIZE);\n  }\n}\n\nvoid apply_graph_colours(struct graph *g, const char *first_colour_name,\n                         const char *last_colour_name) {\n  g->first_colour = parse_color(first_colour_name);\n  g->last_colour = parse_color(last_colour_name);\n  g->colours_set = true;\n}\n\n/**\n * parses a possibly-quoted command from the prefix of a string.\n * @param[in] s argument string to parse\n * @return pair of the command and the number of bytes parsed (counting quotes).\n *         The command will be nullptr if the string to parse started with a\n *         digit or an unpaired double-quote.\n **/\nstd::pair<char *, size_t> scan_command(const char *s) {\n  if (s == nullptr) return {nullptr, 0};\n\n  /* unquoted commands are not permitted to begin with digits. This allows\n  distinguishing a commands from a position in execgraph objects */\n  if (isdigit(*s)) { return {nullptr, 0}; }\n\n  /* extract double-quoted command in case of execgraph */\n  if (*s == '\"') {\n    size_t _size;\n    char *_ptr;\n    if (((_ptr = const_cast<char *>(strrchr(s, '\"'))) != nullptr) &&\n        _ptr != s) {\n      _size = _ptr - s - 1;\n    } else {\n      NORM_ERR(\"mismatched double-quote in execgraph object\");\n      return {nullptr, 0};\n    }\n\n    char *quoted_cmd = static_cast<char *>(malloc(_size + 1));\n    quoted_cmd[0] = '\\0';\n    strncpy(quoted_cmd, s + 1, _size);\n    quoted_cmd[_size] = '\\0';\n    return {quoted_cmd, _size + 2};\n  } else {\n    size_t len;\n    for (len = 0; s[len] != '\\0' && !isspace(s[len]); len++)\n      ;\n    return {strndup(s, len), len};\n  }\n}\n\n/**\n * parses for [height,width] [color1 color2] [scale] [-t] [-l] [-m value]\n *\n * -l will set the showlog flag, enabling logarithmic graph scales\n * -t will set the tempgrad member to true, enabling temperature gradient colors\n * -x will set the invertx flag to true, inverting the x axis\n * -y will set the invertx flag to true, inverting the y axis\n * -m will set the minheight to value, this will clamp values below the threshold to the threshold\n *\n * @param[out] obj  struct in which to save width, height and other options\n * @param[in]  args argument string to parse\n * @param[in]  defscale default scale if no scale argument given\n * @param[in]  speedGraph if graph is network speed graph or not\n * @return whether parsing was successful\n **/\nbool scan_graph(struct text_object *obj, const char *argstr, double defscale, char speedGraph) {\n  char first_colour_name[1024] = {'\\0'};\n  char last_colour_name[1024] = {'\\0'};\n\n  auto *g = static_cast<struct graph *>(malloc(sizeof(struct graph)));\n  memset(g, 0, sizeof(struct graph));\n  obj->special_data = g;\n\n  g->id = ++graph_count;\n  /* zero width means all space that is available */\n  g->width = default_graph_width.get(*state);\n  g->height = default_graph_height.get(*state);\n  g->colours_set = false;\n  g->first_colour = Colour();\n  g->last_colour = Colour();\n  g->scale = defscale;\n  g->tempgrad = FALSE;\n  g->invertflag = FALSE;\n  g->minheight = 0;\n  if (speedGraph) {\n    g->speedgraph = TRUE;\n  }\n  if (argstr == nullptr) return false;\n\n  /* set tempgrad to true if '-t' specified.\n   * It doesn't matter where the argument is exactly. */\n  if ((strstr(argstr, \" \" TEMPGRAD) != nullptr) ||\n      strncmp(argstr, TEMPGRAD, strlen(TEMPGRAD)) == 0) {\n    g->tempgrad = TRUE;\n  }\n  /* set showlog flag if '-l' specified.\n   * It doesn't matter where the argument is exactly. */\n  if ((strstr(argstr, \" \" LOGGRAPH) != nullptr) ||\n      strncmp(argstr, LOGGRAPH, strlen(LOGGRAPH)) == 0) {\n    g->flags |= SF_SHOWLOG;\n  }\n  /* set invertx to true if '-x' specified.\n   * It doesn't matter where the argument is exactly. */\n  if ((strstr(argstr, \" \" INVERTX) != nullptr) ||\n      strncmp(argstr, INVERTX, strlen(INVERTX)) == 0) {\n    g->invertflag |= SF_INVERTX;\n  }\n  /* set inverty to true if '-y' specified.\n   * It doesn't matter where the argument is exactly. */\n  if ((strstr(argstr, \" \" INVERTY) != nullptr) ||\n      strncmp(argstr, INVERTY, strlen(INVERTY)) == 0) {\n    g->invertflag |= SF_INVERTY;\n  }\n\n  /* set MINHEIGHT to specified value if '-m' specified.\n   * It doesn't matter where the argument is exactly. \n   * Accepted values are from [0-5] */\n  const char *position = strstr(argstr, \" \" MINHEIGHT);\n  if ((position != nullptr) ||\n      strncmp(argstr, MINHEIGHT, strlen(MINHEIGHT)) == 0) {\n      int minheight = 0;\n      position += strlen(MINHEIGHT) + 1;\n      int size = strlen(argstr);\n      // Avoid whitespaces\n      while(*position == ' ' && position < argstr + size) {\n        position++;\n      }\n      // Get the numeric value start and end position\n      const char* numStart = position;\n      while (isdigit(*position)) {\n          position++;\n      }\n      // Convert the numeric value to an integer\n      std::string numStr(numStart, position);\n      if (!numStr.empty()) {\n          minheight = atoi(numStr.c_str());\n      }\n      // If specified value is greater than the max threshold\n      minheight = minheight > 5 ? 5 : minheight;\n      g->minheight = minheight;\n  }\n\n  /* all the following functions try to interpret the beginning of a\n   * a string with different format strings. If successful, they return from\n   * the function */\n\n  /* interpret the beginning(!) of the argument string as:\n   * '[height],[width] [color1] [color2] [scale]'\n   * This means parameters like -t and -l may not be in the beginning */\n  if (sscanf(argstr, \"%d,%d %s %s %lf\", &g->height, &g->width,\n             first_colour_name, last_colour_name, &g->scale) == 5) {\n    apply_graph_colours(g, first_colour_name, last_colour_name);\n    return true;\n  }\n  g->height = default_graph_height.get(*state);\n  g->width = default_graph_width.get(*state);\n  first_colour_name[0] = '\\0';\n  last_colour_name[0] = '\\0';\n  g->scale = defscale;\n\n  /* [height],[width] [color1] [color2] \n   * This could match as [height],[width] [scale] [-l | -t], \n   * therfore we ensure last_colour_name is not TEMPGRAD or LOGGRAPH */\n  if (sscanf(argstr, \"%d,%d %s %s\", &g->height, &g->width, first_colour_name,\n             last_colour_name) == 4 && \n             strchr(last_colour_name,'-') == NULL) {\n    apply_graph_colours(g, first_colour_name, last_colour_name);\n    return true;\n  }\n  g->height = default_graph_height.get(*state);\n  g->width = default_graph_width.get(*state);\n  first_colour_name[0] = '\\0';\n  last_colour_name[0] = '\\0';\n\n  /* [height],[width] [scale] */\n  if (sscanf(argstr, \"%d,%d %lf\", &g->height, &g->width, &g->scale) == 3) {\n    return true;\n  }\n  g->height = default_graph_height.get(*state);\n  g->width = default_graph_width.get(*state);\n  g->scale = defscale;\n\n  /* [height],[width] */\n  if (sscanf(argstr, \"%d,%d\", &g->height, &g->width) == 2) { return true; }\n  g->height = default_graph_height.get(*state);\n  g->width = default_graph_width.get(*state);\n\n  /* [height], */\n  char comma;\n  if (sscanf(argstr, \"%d%[,]\", &g->height, &comma) == 2) { return true; }\n  g->height = default_graph_height.get(*state);\n\n  /* [color1] [color2] [scale] */\n  if (sscanf(argstr, \"%s %s %lf\", first_colour_name, last_colour_name,\n             &g->scale) == 3) {\n    apply_graph_colours(g, first_colour_name, last_colour_name);\n    return true;\n  }\n  first_colour_name[0] = '\\0';\n  last_colour_name[0] = '\\0';\n  g->scale = defscale;\n\n  /* [color1] [color2] \n   * This could match as [scale] [-l | -t], \n   * therfore we ensure last_colour_name is not TEMPGRAD or LOGGRAPH */\n  if (sscanf(argstr, \"%s %s\", first_colour_name, last_colour_name) == 2 &&\n             strchr(last_colour_name,'-') == NULL) { \n    apply_graph_colours(g, first_colour_name, last_colour_name);\n    return true;\n  }\n  first_colour_name[0] = '\\0';\n  last_colour_name[0] = '\\0';\n\n  /* [scale] */\n  if (sscanf(argstr, \"%lf\", &g->scale) == 1) { return true; }\n\n  return true;\n}\n#endif /* BUILD_GUI */\n\n/*\n * Printing various special text objects\n */\n\nstruct special_node *new_special_t_node() {\n  auto *newnode = new special_node;\n\n  memset(newnode, 0, sizeof *newnode);\n  return newnode;\n}\n\n/**\n * expands the current global linked list specials to special_count elements\n *\n * increases special_count\n * @param[out] buf is set to \"\\x01\\x00\" not sure why ???\n * @param[in]  t   special type enum, e.g. alignc, alignr, fg, bg, ...\n * @return pointer to the newly inserted special of type t\n **/\nstruct special_node *new_special(char *buf, text_node_t t) {\n  special_node *current;\n\n  buf[0] = SPECIAL_CHAR;\n  buf[1] = '\\0';\n  if (specials == nullptr) { specials = new_special_t_node(); }\n  current = specials;\n  /* allocate special_count linked list elements */\n  for (int i = 0; i < special_count; i++) {\n    if (current->next == nullptr) { current->next = new_special_t_node(); }\n    current = current->next;\n  }\n  current->type = t;\n  special_count++;\n  return current;\n}\n\nvoid new_gauge_in_shell(struct text_object *obj, char *p,\n                        unsigned int p_max_size, double usage) {\n  static const char *gaugevals[] = {\"_. \", \"\\\\. \", \" | \", \" ./\", \" ._\"};\n  auto *g = static_cast<struct gauge *>(obj->special_data);\n\n  snprintf(p, p_max_size, \"%s\",\n           gaugevals[round_to_positive_int(usage * 4 / g->scale)]);\n}\n\n#ifdef BUILD_GUI\nvoid new_gauge_in_gui(struct text_object *obj, char *buf, double usage) {\n  struct special_node *s = nullptr;\n  auto *g = static_cast<struct gauge *>(obj->special_data);\n\n  if (display_output() == nullptr || !display_output()->graphical()) { return; }\n\n  if (g == nullptr) { return; }\n\n  s = new_special(buf, text_node_t::GAUGE);\n\n  s->arg = usage;\n  s->width = dpi_scale(g->width);\n  s->height = dpi_scale(g->height);\n  s->scale = g->scale;\n}\n#endif /* BUILD_GUI */\n\nvoid new_gauge(struct text_object *obj, char *p, unsigned int p_max_size,\n               double usage) {\n  auto *g = static_cast<struct gauge *>(obj->special_data);\n\n  if ((p_max_size == 0) || (g == nullptr)) { return; }\n\n  if ((g->flags & SF_SCALED) != 0) {\n    g->scale = std::max(g->scale, usage);\n  } else {\n    usage = std::min(g->scale, usage);\n  }\n\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    new_gauge_in_gui(obj, p, usage);\n  }\n  if (out_to_stdout.get(*state)) {\n    new_gauge_in_shell(obj, p, p_max_size, usage);\n  }\n#else  /* BUILD_GUI */\n  new_gauge_in_shell(obj, p, p_max_size, usage);\n#endif /* BUILD_GUI */\n}\n\n#ifdef BUILD_GUI\nvoid new_font(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct special_node *s;\n  unsigned int tmp = selected_font;\n\n  if (display_output() == nullptr || !display_output()->graphical()) { return; }\n\n  if (p_max_size == 0) { return; }\n\n  s = new_special(p, text_node_t::FONT);\n\n  if (obj->data.s != nullptr) {\n    if (s->font_added >= static_cast<int>(fonts.size()) ||\n        (s->font_added == 0) || obj->data.s != fonts[s->font_added].name) {\n      selected_font = s->font_added = add_font(obj->data.s);\n      selected_font = tmp;\n    }\n  } else {\n    selected_font = s->font_added = 0;\n    selected_font = tmp;\n  }\n}\n\n/**\n * Adds value f to graph possibly truncating and scaling the graph\n **/\nstatic void graph_append(struct special_node *graph, double f, char showaslog) {\n  int i;\n\n  /* do nothing if we don't even have a graph yet */\n  if (graph->graph == nullptr) { return; }\n\n  if (showaslog != 0) {\n#ifdef BUILD_MATH\n    f = log10(f + 1);\n#endif\n  }\n\n  if ((graph->scaled == 0) && f > graph->scale) { f = graph->scale; }\n\n  /* shift all the data by 1 */\n  for (i = graph->graph_allocated - 1; i > 0; i--) {\n    graph->graph[i] = graph->graph[i - 1];\n  }\n  graph->graph[0] = f; /* add new data */\n\n  if (graph->scaled != 0) {\n    /* Get the location of the currentmax in the graph */\n    double* currentmax =\n        std::max_element(graph->graph + 0, graph->graph + graph->graph_width);\n    graph->scale = *currentmax;\n    if (graph->speedgraph) {\n        if(maxspeedval < graph->scale){\n          maxspeedval = graph->scale;\n        }\n        graph->scale = maxspeedval;\n        /* If the currentmax is the maxspeedval and \n         * currentmax location is at the last position\n         * Then we reset our maxspeedval */\n        if(*currentmax == maxspeedval && currentmax == (graph->graph + graph->width - 1)){\n          maxspeedval = 1e-47;\n        }\n    }\n    if (graph->scale < 1e-47) {\n      /* avoid NaN's when the graph is all-zero (e.g. before the first update)\n       * there is nothing magical about 1e-47 here */\n      graph->scale = 1e-47;\n    }\n  }\n}\n\nvoid new_graph_in_shell(struct special_node *s, char *buf, int buf_max_size) {\n  // Split config string on comma to avoid the hassle of dealing with the\n  // idiosyncrasies of multi-byte unicode on different platforms.\n  // TODO(brenden): Parse config string once and cache result.\n  const std::string ticks = console_graph_ticks.get(*state);\n  std::stringstream ss(ticks);\n  std::string tickitem;\n  std::vector<std::string> tickitems;\n  while (std::getline(ss, tickitem, ',')) { tickitems.push_back(tickitem); }\n\n  char *p = buf;\n  char *buf_max = buf + (sizeof(char) * buf_max_size);\n  double scale = (tickitems.size() - 1) / s->scale;\n  for (int i = s->graph_allocated - 1; i >= 0; i--) {\n    const unsigned int v = round_to_positive_int(s->graph[i] * scale);\n    const char *tick = tickitems[v].c_str();\n    size_t itemlen = tickitems[v].size();\n    for (unsigned int j = 0; j < itemlen; j++) {\n      *p++ = tick[j];\n      if (p == buf_max) { goto graph_buf_end; }\n    }\n  }\ngraph_buf_end:\n  *p = '\\0';\n}\n\ndouble *copy_graph(double *original_graph, int graph_width) {\n  double *new_graph =\n      static_cast<double *>(malloc(graph_width * sizeof(double)));\n\n  memcpy(new_graph, original_graph, graph_width * sizeof(double));\n\n  return new_graph;\n}\n\ndouble *retrieve_graph(int graph_id, int graph_width) {\n  if (graphs.find(graph_id) == graphs.end()) {\n    return static_cast<double *>(calloc(1, graph_width * sizeof(double)));\n  } else {\n    return copy_graph(graphs[graph_id], graph_width);\n  }\n}\n\nvoid store_graph(int graph_id, struct special_node *s) {\n  if (s->graph == nullptr) {\n    graphs[graph_id] = nullptr;\n  } else {\n    if (graphs.find(graph_id) != graphs.end()) { free(graphs[graph_id]); }\n    graphs[graph_id] = s->graph;\n  }\n}\n\n/**\n * Creates a visual graph and/or appends val to the graph / plot\n *\n * @param[in] obj struct containing all relevant flags like width, height, ...\n * @param[in] buf buffer for ascii art graph in console\n * @param[in] buf_max_size maximum length of buf\n * @param[in] val value to plot i.e. to add to plot\n **/\nvoid new_graph(struct text_object *obj, char *buf, int buf_max_size,\n               double val) {\n  struct special_node *s = nullptr;\n  auto *g = static_cast<struct graph *>(obj->special_data);\n\n  if ((g == nullptr) || (buf_max_size == 0)) { return; }\n\n  s = new_special(buf, text_node_t::GRAPH);\n\n  /* set graph (special) width to width in obj */\n  s->width = dpi_scale(g->width);\n  if (s->width != 0) { s->graph_width = s->width; }\n\n  if (s->graph_width != s->graph_allocated) {\n    auto *graph = static_cast<double *>(\n        realloc(s->graph, s->graph_width * sizeof(double)));\n    DBGP(\"reallocing graph from %d to %d\", s->graph_allocated, s->graph_width);\n    if (s->graph == nullptr) {\n      /* initialize */\n      std::fill_n(graph, s->graph_width, 0.0);\n      s->scale = 100;\n    } else if (graph != nullptr) {\n      if (s->graph_width > s->graph_allocated) {\n        /* initialize the new region */\n        std::fill(graph + s->graph_allocated, graph + s->graph_width, 0.0);\n      }\n    } else {\n      DBGP(\"reallocing FAILED\");\n      graph = s->graph;\n      s->graph_width = s->graph_allocated;\n    }\n    s->graph = graph;\n    s->graph_allocated = s->graph_width;\n    graphs[g->id] = graph;\n  }\n  s->height = dpi_scale(g->height);\n  s->colours_set = g->colours_set;\n  s->first_colour = g->first_colour;\n  s->last_colour = g->last_colour;\n  if (g->scale != 0) {\n    s->scaled = 0;\n    s->scale = g->scale;\n    s->show_scale = 0;\n  } else {\n    s->scaled = 1;\n    s->scale = 1;\n    s->show_scale = 1;\n  }\n  s->tempgrad = g->tempgrad;\n  s->minheight = g->minheight;\n#ifdef BUILD_MATH\n  if ((g->flags & SF_SHOWLOG) != 0) {\n    s->scale_log = 1;\n    s->scale = log10(s->scale + 1);\n  }\n#endif\n  if ((g->invertflag & SF_INVERTX) != 0){\n    s->invertx = 1;\n  }\n  if ((g->invertflag & SF_INVERTY) != 0){\n    s->inverty = 1;\n  }\n  if (g->speedgraph) {\n    s->speedgraph = TRUE;\n  }\n\n  if (store_graph_data_explicitly.get(*state)) {\n    if (s->graph) { s->graph = retrieve_graph(g->id, s->graph_width); }\n\n    graph_append(s, val, g->flags);\n\n    store_graph(g->id, s);\n  } else {\n    graph_append(s, val, g->flags);\n  }\n\n  if (out_to_stdout.get(*state)) { new_graph_in_shell(s, buf, buf_max_size); }\n}\n\nvoid new_hr(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (display_output() == nullptr || !display_output()->graphical()) { return; }\n\n  if (p_max_size == 0) { return; }\n\n  new_special(p, text_node_t::HORIZONTAL_LINE)->height = dpi_scale(obj->data.l);\n}\n\nvoid scan_stippled_hr(struct text_object *obj, const char *arg) {\n  struct stippled_hr *sh;\n\n  sh = static_cast<struct stippled_hr *>(malloc(sizeof(struct stippled_hr)));\n  memset(sh, 0, sizeof(struct stippled_hr));\n\n  sh->arg = stippled_borders.get(*state);\n  sh->height = 1;\n\n  if (arg != nullptr) {\n    if (sscanf(arg, \"%d %d\", &sh->arg, &sh->height) != 2) {\n      sscanf(arg, \"%d\", &sh->height);\n    }\n  }\n  if (sh->arg <= 0) { sh->arg = 1; }\n  obj->special_data = sh;\n}\n\nvoid new_stippled_hr(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  struct special_node *s = nullptr;\n  auto *sh = static_cast<struct stippled_hr *>(obj->special_data);\n\n  if (display_output() == nullptr || !display_output()->graphical()) { return; }\n\n  if ((sh == nullptr) || (p_max_size == 0)) { return; }\n\n  s = new_special(p, text_node_t::STIPPLED_HR);\n\n  s->height = dpi_scale(sh->height);\n  s->arg = dpi_scale(sh->arg);\n}\n#endif /* BUILD_GUI */\n\nvoid new_fg(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (false\n#ifdef BUILD_GUI\n      || (display_output() && display_output()->graphical())\n#endif /* BUILD_GUI */\n#ifdef BUILD_NCURSES\n      || out_to_ncurses.get(*state)\n#endif /* BUILD_NCURSES */\n  ) {\n    new_special(p, text_node_t::FG)->arg = obj->data.l;\n  }\n  UNUSED(obj);\n  UNUSED(p);\n  UNUSED(p_max_size);\n}\n\n#ifdef BUILD_GUI\nvoid new_bg(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (display_output() == nullptr || !display_output()->graphical()) { return; }\n\n  if (p_max_size == 0) { return; }\n\n  new_special(p, text_node_t::BG)->arg = obj->data.l;\n}\n#endif /* BUILD_GUI */\n\nstatic void new_bar_in_shell(struct text_object *obj, char *buffer,\n                             unsigned int buf_max_size, double usage) {\n  auto *b = static_cast<struct bar *>(obj->special_data);\n  unsigned int width, i, scaledusage;\n\n  if (b == nullptr) { return; }\n\n  width = b->width;\n  if (width == 0) { width = DEFAULT_BAR_WIDTH_NO_X; }\n\n  if (width > buf_max_size) { width = buf_max_size; }\n\n  scaledusage = round_to_positive_int(usage * width / b->scale);\n\n  for (i = 0; i < scaledusage; i++) {\n    buffer[i] = *(bar_fill.get(*state).c_str());\n  }\n\n  for (; i < width; i++) { buffer[i] = *(bar_unfill.get(*state).c_str()); }\n\n  buffer[i] = 0;\n}\n\n#ifdef BUILD_GUI\nstatic void new_bar_in_gui(struct text_object *obj, char *buf, double usage) {\n  struct special_node *s = nullptr;\n  auto *b = static_cast<struct bar *>(obj->special_data);\n\n  if (display_output() == nullptr || !display_output()->graphical()) { return; }\n\n  if (b == nullptr) { return; }\n\n  s = new_special(buf, text_node_t::BAR);\n\n  s->arg = usage;\n  s->width = dpi_scale(b->width);\n  s->height = dpi_scale(b->height);\n  s->scale = b->scale;\n}\n#endif /* BUILD_GUI */\n\n/* usage is in range [0,255] */\nvoid new_bar(struct text_object *obj, char *p, unsigned int p_max_size,\n             double usage) {\n  auto *b = static_cast<struct bar *>(obj->special_data);\n\n  if ((p_max_size == 0) || (b == nullptr)) { return; }\n\n  if ((b->flags & SF_SCALED) != 0) {\n    b->scale = std::max(b->scale, usage);\n  } else {\n    usage = std::min(b->scale, usage);\n  }\n\n#ifdef BUILD_GUI\n  if (display_output() && display_output()->graphical()) {\n    new_bar_in_gui(obj, p, usage);\n  }\n  if (out_to_stdout.get(*state)) {\n    new_bar_in_shell(obj, p, p_max_size, usage);\n  }\n#else  /* BUILD_GUI */\n  new_bar_in_shell(obj, p, p_max_size, usage);\n#endif /* BUILD_GUI */\n}\n\nvoid new_outline(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (p_max_size == 0) { return; }\n  new_special(p, text_node_t::OUTLINE)->arg = obj->data.l;\n}\n\nvoid new_offset(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (p_max_size == 0) { return; }\n  new_special(p, text_node_t::OFFSET)->arg = dpi_scale(obj->data.l);\n}\n\nvoid new_voffset(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (p_max_size == 0) { return; }\n  new_special(p, text_node_t::VOFFSET)->arg = dpi_scale(obj->data.l);\n}\n\nvoid new_save_coordinates(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  if (p_max_size == 0) { return; }\n  new_special(p, text_node_t::SAVE_COORDINATES)->arg = obj->data.l;\n}\n\nvoid new_alignr(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (p_max_size == 0) { return; }\n  new_special(p, text_node_t::ALIGNR)->arg = dpi_scale(obj->data.l);\n}\n\n// A positive offset pushes the text further left\nvoid new_alignc(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (p_max_size == 0) { return; }\n  new_special(p, text_node_t::ALIGNC)->arg = dpi_scale(obj->data.l);\n}\n\nvoid new_goto(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (p_max_size == 0) { return; }\n  new_special(p, text_node_t::GOTO)->arg = dpi_scale(obj->data.l);\n}\n\nvoid scan_tab(struct text_object *obj, const char *arg) {\n  struct tab *t;\n\n  t = static_cast<struct tab *>(malloc(sizeof(struct tab)));\n  memset(t, 0, sizeof(struct tab));\n\n  t->width = 10;\n  t->arg = 0;\n\n  if (arg != nullptr) {\n    if (sscanf(arg, \"%d %d\", &t->width, &t->arg) != 2) {\n      sscanf(arg, \"%d\", &t->arg);\n    }\n  }\n  if (t->width <= 0) { t->width = 1; }\n  obj->special_data = t;\n}\n\nvoid new_tab(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct special_node *s = nullptr;\n  auto *t = static_cast<struct tab *>(obj->special_data);\n\n  if ((t == nullptr) || (p_max_size == 0)) { return; }\n\n  s = new_special(p, text_node_t::TAB);\n  s->width = dpi_scale(t->width);\n  s->arg = dpi_scale(t->arg);\n}\n\nvoid clear_stored_graphs() {\n  graph_count = 0;\n  graphs.clear();\n}\n"
  },
  {
    "path": "src/content/specials.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _SPECIALS_H\n#define _SPECIALS_H\n\n#include <tuple>\n#include \"colours.hh\"\n\n/* special stuff in text_buffer */\n\n#define SPECIAL_CHAR '\\x01'\n\n// don't use spaces in LOGGRAPH or NORMGRAPH if you change them\n#define LOGGRAPH \"-l\"\n#define TEMPGRAD \"-t\"\n#define INVERTX \"-x\"\n#define INVERTY \"-y\"\n#define MINHEIGHT \"-m\"\n\nenum class text_node_t : uint32_t {\n  NONSPECIAL = 0,\n  HORIZONTAL_LINE = 1,\n  STIPPLED_HR,\n  BAR,\n  FG,\n  BG,\n  OUTLINE,\n  ALIGNR,\n  ALIGNC,\n  GAUGE,\n  GRAPH,\n  OFFSET,\n  VOFFSET,\n  SAVE_COORDINATES,\n  FONT,\n  GOTO,\n  TAB\n};\nconstexpr uint32_t operator*(text_node_t index) {\n  return static_cast<uint32_t>(index);\n}\n\nstruct special_node {\n  text_node_t type;\n  short height;\n  short width;\n  double arg;\n  double *graph;\n  double scale; /* maximum value */\n  short show_scale;\n  int graph_width;\n  int graph_allocated;\n  int scaled; /* auto adjust maximum */\n  int scale_log;\n  bool colours_set;\n  Colour first_colour;  // for graph gradient\n  Colour last_colour;\n  short font_added;\n  char tempgrad;\n  char speedgraph;\n  char invertx;\n  char inverty;\n  int minheight;\n  struct special_node *next;\n};\n\n/* direct access to the registered specials (FIXME: bad encapsulation) */\nextern struct special_node *specials;\nextern int special_count;\n\n/* forward declare to avoid mutual inclusion between specials.h and\n * text_object.h */\nstruct text_object;\n\n/* scanning special arguments */\nconst char *scan_bar(struct text_object *, const char *, double);\nconst char *scan_gauge(struct text_object *, const char *, double);\n#ifdef BUILD_GUI\nvoid scan_font(struct text_object *, const char *);\nstd::pair<char *, size_t> scan_command(const char *);\nbool scan_graph(struct text_object *, const char *, double, char);\nvoid scan_tab(struct text_object *, const char *);\nvoid scan_stippled_hr(struct text_object *, const char *);\n\n/* printing specials */\nvoid new_font(struct text_object *, char *, unsigned int);\nvoid new_graph(struct text_object *, char *, int, double);\nvoid new_hr(struct text_object *, char *, unsigned int);\nvoid new_stippled_hr(struct text_object *, char *, unsigned int);\n#endif /* BUILD_GUI */\nvoid new_gauge(struct text_object *, char *, unsigned int, double);\nvoid new_bar(struct text_object *, char *, unsigned int, double);\nvoid new_fg(struct text_object *, char *, unsigned int);\nvoid new_bg(struct text_object *, char *, unsigned int);\nvoid new_outline(struct text_object *, char *, unsigned int);\nvoid new_offset(struct text_object *, char *, unsigned int);\nvoid new_voffset(struct text_object *, char *, unsigned int);\nvoid new_save_coordinates(struct text_object *, char *, unsigned int);\nvoid new_alignr(struct text_object *, char *, unsigned int);\nvoid new_alignc(struct text_object *, char *, unsigned int);\nvoid new_goto(struct text_object *, char *, unsigned int);\nvoid new_tab(struct text_object *, char *, unsigned int);\n\nvoid clear_stored_graphs();\n\nstruct special_node *new_special(char *buf, enum text_node_t t);\n\n#endif /* _SPECIALS_H */\n"
  },
  {
    "path": "src/content/temphelper.cc",
    "content": "/*\n *\n * temphelper.c:  aid in converting temperature units\n *\n * Copyright (C) 2008 Phil Sutter <Phil@nwl.cc>\n *\n * This library is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n#include \"temphelper.h\"\n#include <sys/types.h>\n#include <cctype>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include \"config.h\"\n#include \"../conky.h\"\n\ntemplate <>\nconky::lua_traits<TEMP_UNIT>::Map conky::lua_traits<TEMP_UNIT>::map = {\n    {\"celsius\", TEMP_CELSIUS}, {\"fahrenheit\", TEMP_FAHRENHEIT}};\n\nstatic conky::simple_config_setting<TEMP_UNIT> output_unit(\"temperature_unit\",\n                                                           TEMP_CELSIUS, true);\n\nstatic double fahrenheit_to_celsius(double n) { return ((n - 32) * 5 / 9); }\n\nstatic double celsius_to_fahrenheit(double n) { return ((n * 9 / 5) + 32); }\n\nstatic double convert_temp_output(double n, enum TEMP_UNIT input_unit) {\n  if (input_unit == output_unit.get(*state)) { return n; }\n\n  switch (output_unit.get(*state)) {\n    case TEMP_CELSIUS:\n      return fahrenheit_to_celsius(n);\n    case TEMP_FAHRENHEIT:\n      return celsius_to_fahrenheit(n);\n  }\n  /* NOT REACHED */\n  return 0.0;\n}\n\nint temp_print(char *p, size_t p_max_size, double n, enum TEMP_UNIT input_unit,\n               int to_int) {\n  int i_out = 0;\n  float f_out = 0.0;\n  size_t plen = 0;\n\n  if (1 == to_int) {\n    i_out = round_to_int_temp(convert_temp_output(n, input_unit));\n    plen = spaced_print(p, p_max_size, \"%d\", 3, i_out);\n  } else {\n    f_out = convert_temp_output(n, input_unit);\n    plen = spaced_print(p, p_max_size, \"%.2f\", 3, f_out);\n  }\n  return static_cast<int>(!(plen >= p_max_size));\n}\n"
  },
  {
    "path": "src/content/temphelper.h",
    "content": "/*\n *\n * temphelper.h:  aid in converting temperature units\n *\n * Copyright (C) 2008 Phil Sutter <Phil@nwl.cc>\n *\n * This library is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n\n#ifndef TEMPHELPER_H\n#define TEMPHELPER_H\n\n#include <cstddef>\n\nenum TEMP_UNIT { TEMP_CELSIUS, TEMP_FAHRENHEIT };\n\nint temp_print(char *, std::size_t, double, enum TEMP_UNIT, int);\n\n#endif /* TEMPHELPER_H */\n"
  },
  {
    "path": "src/content/template.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include <cctype>\n#include <cstdlib>\n#include <string>\n#include \"../conky.h\"\n#include \"../logging.h\"\n\nnamespace {\nconky::simple_config_setting<std::string> _template[10] = {\n    {\"template0\", std::string(), true}, {\"template1\", std::string(), true},\n    {\"template2\", std::string(), true}, {\"template3\", std::string(), true},\n    {\"template4\", std::string(), true}, {\"template5\", std::string(), true},\n    {\"template6\", std::string(), true}, {\"template7\", std::string(), true},\n    {\"template8\", std::string(), true}, {\"template9\", std::string(), true}};\n}  // namespace\n\n/* backslash_escape - do the actual substitution task for template objects\n *\n * The field templates is used for substituting the \\N occurrences. Set it to\n * nullptr to leave them as they are.\n */\nstatic char *backslash_escape(const char *src, char **templates,\n                              unsigned int template_count) {\n  char *src_dup;\n  const char *p;\n  unsigned int dup_idx = 0, dup_len;\n\n  dup_len = strlen(src) + 1;\n  src_dup = static_cast<char *>(malloc(dup_len * sizeof(char)));\n\n  p = src;\n  while (*p != 0) {\n    switch (*p) {\n      case '\\\\':\n        if (*(p + 1) == 0) { break; }\n        if (*(p + 1) == '\\\\') {\n          src_dup[dup_idx++] = '\\\\';\n          p++;\n        } else if (*(p + 1) == ' ') {\n          src_dup[dup_idx++] = ' ';\n          p++;\n        } else if (*(p + 1) == 'n') {\n          src_dup[dup_idx++] = '\\n';\n          p++;\n        } else if (templates != nullptr) {\n          unsigned int tmpl_num;\n          int digits;\n          if ((sscanf(p + 1, \"%u%n\", &tmpl_num, &digits) <= 0) ||\n              (tmpl_num > template_count)) {\n            break;\n          }\n          if (tmpl_num == 0) {\n            CRIT_ERR_FREE(\n                nullptr, nullptr,\n                \"invalid template argument \\\\0; arguments must start at \\\\1\");\n          }\n          dup_len += strlen(templates[tmpl_num - 1]);\n          src_dup =\n              static_cast<char *>(realloc(src_dup, dup_len * sizeof(char)));\n          snprintf(src_dup + dup_idx, dup_len - dup_idx, \"%s\",\n                   templates[tmpl_num - 1]);\n          dup_idx += strlen(templates[tmpl_num - 1]);\n          p += digits;\n        }\n        break;\n      default:\n        src_dup[dup_idx++] = *p;\n        break;\n    }\n    p++;\n  }\n  src_dup[dup_idx++] = '\\0';\n  src_dup = static_cast<char *>(realloc(src_dup, dup_idx * sizeof(char)));\n  return src_dup;\n}\n\n/* handle_template_object - core logic of the template object\n *\n * use config variables like this:\n * template1 = \"$\\1\\2\"\n * template2 = \"\\1: ${fs_bar 4,100 \\2} ${fs_used \\2} / ${fs_size \\2}\"\n *\n * and use them like this:\n * ${template1 node name}\n * ${template2 root /}\n * ${template2 cdrom /mnt/cdrom}\n */\nstatic char *handle_template(const char *tmpl, const char *args) {\n  char *args_dup = nullptr;\n  char *p, *p_old;\n  char **argsp = nullptr;\n  unsigned int argcnt = 0, template_idx, i;\n  char *eval_text;\n\n  if ((sscanf(tmpl, \"template%u\", &template_idx) != 1) ||\n      (template_idx >= MAX_TEMPLATES)) {\n    return nullptr;\n  }\n\n  if (args != nullptr) {\n    args_dup = strdup(args);\n    p = args_dup;\n    while (*p != 0) {\n      while ((*p != 0) && (*p == ' ' && (p == args_dup || *(p - 1) != '\\\\'))) {\n        p++;\n      }\n      if (p > args_dup && *(p - 1) == '\\\\') { p--; }\n      p_old = p;\n      while ((*p != 0) && (*p != ' ' || (p > args_dup && *(p - 1) == '\\\\'))) {\n        p++;\n      }\n      if (*p != 0) {\n        (*p) = '\\0';\n        p++;\n      }\n      argsp = static_cast<char **>(realloc(argsp, ++argcnt * sizeof(char *)));\n      argsp[argcnt - 1] = p_old;\n    }\n    for (i = 0; i < argcnt; i++) {\n      char *tmp;\n      tmp = backslash_escape(argsp[i], nullptr, 0);\n      DBGP2(\"%s: substituted arg '%s' to '%s'\", tmpl, argsp[i], tmp);\n      argsp[i] = tmp;\n    }\n  }\n\n  eval_text = backslash_escape(_template[template_idx].get(*state).c_str(),\n                               argsp, argcnt);\n  DBGP(\"substituted %s, output is '%s'\", tmpl, eval_text);\n  free(args_dup);\n  for (i = 0; i < argcnt; i++) { free(argsp[i]); }\n  free(argsp);\n  return eval_text;\n}\n\n/* Search inbuf and replace all found template object references\n * with the substituted value. */\nchar *find_and_replace_templates(const char *inbuf) {\n  char *outbuf, *indup, *p, *o, *templ, *args, *tmpl_out;\n  int stack, outlen;\n\n  outlen = strlen(inbuf) + 1;\n  o = outbuf = static_cast<char *>(calloc(outlen, sizeof(char)));\n  memset(outbuf, 0, outlen * sizeof(char));\n\n  p = indup = strdup(inbuf);\n  while (*p != 0) {\n    while ((*p != 0) && *p != '$') { *(o++) = *(p++); }\n\n    if ((*p) == 0) { break; }\n\n    if ((static_cast<int>(strncmp(p, \"$template\", strlen(\"$template\")) != 0) !=\n         0) &&\n        (strncmp(p, \"${template\", strlen(\"${template\")) != 0)) {\n      *(o++) = *(p++);\n      continue;\n    }\n\n    if (*(p + 1) == '{') {\n      p += 2;\n      templ = p;\n      while ((*p != 0) && (isspace(static_cast<unsigned char>(*p)) == 0) &&\n             *p != '{' && *p != '}') {\n        p++;\n      }\n      if (*p == '}') {\n        args = nullptr;\n      } else {\n        args = p;\n      }\n\n      stack = 1;\n      while ((*p != 0) && stack > 0) {\n        if (*p == '{') {\n          stack++;\n        } else if (*p == '}') {\n          stack--;\n        }\n        p++;\n      }\n      if (stack == 0) {\n        // stack is empty. that means the previous char was }, so we zero it\n        *(p - 1) = '\\0';\n      } else {\n        // we ran into the end of string without finding a closing }, bark\n        CRIT_ERR(\"cannot find a closing '}' in template expansion\");\n      }\n    } else {\n      templ = p + 1;\n      p += strlen(\"$template\");\n      while ((*p != 0) && (isdigit(static_cast<unsigned char>(*p)) != 0)) {\n        p++;\n      }\n      args = nullptr;\n    }\n    tmpl_out = handle_template(templ, args);\n    if (tmpl_out != nullptr) {\n      int len = strlen(tmpl_out);\n      outlen += len;\n      *o = '\\0';\n      outbuf = static_cast<char *>(realloc(outbuf, outlen * sizeof(char)));\n      strcat(outbuf, tmpl_out);\n      free(tmpl_out);\n      o = outbuf + strlen(outbuf);\n    } else {\n      NORM_ERR(\"failed to handle template '%s' with args '%s'\", templ, args);\n    }\n  }\n  *o = '\\0';\n  outbuf =\n      static_cast<char *>(realloc(outbuf, (strlen(outbuf) + 1) * sizeof(char)));\n  free(indup);\n  return outbuf;\n}\n\n/* check text for any template object references */\nint text_contains_templates(const char *text) {\n  if (strcasestr(text, \"${template\") != nullptr) { return 1; }\n  if (strcasestr(text, \"$template\") != nullptr) { return 1; }\n  return 0;\n}\n"
  },
  {
    "path": "src/content/template.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _TEMPLATE_H\n#define _TEMPLATE_H\n\nchar *find_and_replace_templates(const char *);\nint text_contains_templates(const char *);\n\n#endif /* _TEMPLATE_H */\n"
  },
  {
    "path": "src/content/text_object.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"text_object.h\"\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include \"config.h\"\n#include \"../conky.h\"\n#include \"../logging.h\"\n\nvoid gen_free_opaque(struct text_object *obj) {\n  free_and_zero(obj->data.opaque);\n}\n\nint gen_false_iftest(struct text_object *) { return 0; }\n\nvoid gen_print_nothing(struct text_object *, char *, unsigned int) {\n  // literally does nothing\n}\n\nvoid gen_print_obj_data_s(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  if (obj->data.s == nullptr) { return; }\n  snprintf(p, p_max_size, \"%s\", obj->data.s);\n}\n\n/* text_object_list\n *\n * this list is special. it looks like this:\n *  nullptr <-- obj1 <--> obj2 <--> ... <--> objN --> NULL\n *            ^-------root_object----------^\n *             directions are reversed here\n *\n * why this is cool:\n * - root_object points both to the start and end of the list\n * - while traversing, the end of the list is always a nullptr pointer\n *   (this works in BOTH directions)\n */\n\n/* append an object or list of objects to the given root object's list */\nint append_object(struct text_object *root, struct text_object *obj) {\n  struct text_object *end;\n\n  /* hook in start of list to append */\n  end = root->prev;\n  obj->prev = end;\n\n  /* update pointers of the list to append to */\n  if (end != nullptr) {\n    if (end->next != nullptr) { CRIT_ERR(\"Houston, we have lift-off\"); }\n    end->next = obj;\n  } else {\n    root->next = obj;\n  }\n\n  /* find end of appended list to point root->prev there */\n  while (obj->next != nullptr) { obj = obj->next; }\n  root->prev = obj;\n\n  return 0;\n}\n\n/* ifblock handlers for the object list\n *\n * - each if points to it's else or endif\n * - each else points to it's endif\n *\n */\n\n/* possible ifblock types\n * only used internally, so no need to make this public\n */\nenum ifblock_type { IFBLOCK_IF = 1, IFBLOCK_ELSE, IFBLOCK_ENDIF };\n\n/* linked list of ifblock objects, building a stack\n * only used internally, so no need to make this public\n */\nstruct ifblock_stack_obj {\n  enum ifblock_type type;\n  struct text_object *obj;\n  struct ifblock_stack_obj *next;\n};\n\n/* push an ifblock object onto the stack\n * in fact, this does a lot more:\n * - IFBLOCK_IF is just pushed onto the stack\n * - IFBLOCK_ELSE updates the \"next\" pointer of the upmost\n *   object in the stack and is then pushed onto the stack\n * - IFBLOCK_ENDIF updates the \"next\" pointer of the upmost\n *   object in the stack and then triggers stack popping of\n *   any optional IFBLOCK_ELSE along with it's IFBLOCK_IF\n */\nstatic int push_ifblock(struct ifblock_stack_obj **ifblock_stack_top,\n                        struct text_object *obj, enum ifblock_type type) {\n  struct ifblock_stack_obj *stackobj;\n\n  switch (type) {\n    case IFBLOCK_ENDIF:\n      if ((*ifblock_stack_top) == nullptr) {\n        CRIT_ERR(\"got an endif without matching if\");\n      }\n      (*ifblock_stack_top)->obj->ifblock_next = obj;\n      /* if there's some else in between, remove and free it */\n      if ((*ifblock_stack_top)->type == IFBLOCK_ELSE) {\n        stackobj = *ifblock_stack_top;\n        *ifblock_stack_top = stackobj->next;\n        free(stackobj);\n      }\n      /* finally remove and free the if object */\n      stackobj = *ifblock_stack_top;\n      *ifblock_stack_top = stackobj->next;\n      free(stackobj);\n      break;\n    case IFBLOCK_ELSE:\n      if ((*ifblock_stack_top) == nullptr) {\n        CRIT_ERR(\"got an else without matching if\");\n      }\n      (*ifblock_stack_top)->obj->ifblock_next = obj;\n      /* falls through */\n    case IFBLOCK_IF:\n      stackobj = static_cast<ifblock_stack_obj *>(\n          malloc(sizeof(struct ifblock_stack_obj)));\n      stackobj->type = type;\n      stackobj->obj = obj;\n      stackobj->next = *ifblock_stack_top;\n      *ifblock_stack_top = stackobj;\n      break;\n    default:\n      CRIT_ERR(\"push_ifblock() misuse detected!\");\n  }\n  return 0;\n}\n\n/* public functions for client use */\n\nint obj_be_ifblock_if(void **opaque, struct text_object *obj) {\n  return push_ifblock(reinterpret_cast<struct ifblock_stack_obj **>(opaque),\n                      obj, IFBLOCK_IF);\n}\nint obj_be_ifblock_else(void **opaque, struct text_object *obj) {\n  return push_ifblock(reinterpret_cast<struct ifblock_stack_obj **>(opaque),\n                      obj, IFBLOCK_ELSE);\n}\nint obj_be_ifblock_endif(void **opaque, struct text_object *obj) {\n  return push_ifblock(reinterpret_cast<struct ifblock_stack_obj **>(opaque),\n                      obj, IFBLOCK_ENDIF);\n}\n\n/* check if ifblock stack is empty\n * if so, return true (!= 0)\n */\nint ifblock_stack_empty(void **opaque) {\n  return static_cast<int>(*opaque == nullptr);\n}\n\nvoid obj_be_plain_text(struct text_object *obj, const char *text) {\n  obj->data.s = strdup(text);\n\n  memset(&obj->callbacks, 0, sizeof(obj->callbacks));\n  obj->callbacks.print = &gen_print_obj_data_s;\n  obj->callbacks.free = &gen_free_opaque;\n}\n"
  },
  {
    "path": "src/content/text_object.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _TEXT_OBJECT_H\n#define _TEXT_OBJECT_H\n\n#include \"config.h\"\n\n#include \"../data/exec.h\"\n#include \"specials.h\" /* enum special_types */\n\n#include <cstdint> /* uint8_t */\n\nenum class draw_mode_t : uint32_t {\n  BG = static_cast<uint32_t>(text_node_t::BG),\n  FG = static_cast<uint32_t>(text_node_t::FG),\n  OUTLINE = static_cast<uint32_t>(text_node_t::OUTLINE),\n};\n\n/* text object callbacks */\nstruct obj_cb {\n  /* text object: print obj's output to p */\n  void (*print)(struct text_object *obj, char *p, unsigned int p_max_size);\n\n  /* ifblock object: return zero to trigger jumping */\n  int (*iftest)(struct text_object *obj);\n\n  /* meter objects:\n   * The following functions return the current meter-type value\n   * in a range between 0 and the value passed to the appropriate\n   * scan_* function. Or, if named function has been called with\n   * a value of 0, make use of auto-scaling (i.e., scaling to the\n   * maximum value seen so far). */\n  double (*barval)(struct text_object *obj);\n  double (*gaugeval)(struct text_object *obj);\n  double (*graphval)(struct text_object *obj);\n\n  /* percentage object: return value in range [0, 100] */\n  uint8_t (*percentage)(struct text_object *obj);\n\n  /* free obj's data */\n  void (*free)(struct text_object *obj);\n};\n\n/* generic free opaque callback\n * can be used to simply free obj->data.opaque or obj->data.s */\nvoid gen_free_opaque(struct text_object *);\n\n/* generic iftest returning false (i.e. trigger jumping)\n * used for the else object */\nint gen_false_iftest(struct text_object *);\n\n/* generic nothing printer callback printing nothing\n * used for the endif object */\nvoid gen_print_nothing(struct text_object *, char *, unsigned int);\n\n/* generic obj->data.s printer\n * used by the $text object */\nvoid gen_print_obj_data_s(struct text_object *, char *, unsigned int);\n\nclass legacy_cb : public conky::callback<void *, int (*)()> {\n  typedef conky::callback<void *, int (*)()> Base;\n\n protected:\n  virtual void work() { std::get<0>(tuple)(); }\n\n public:\n  legacy_cb(uint32_t period, int (*fn)())\n      : Base(period, true, Base::Tuple(fn)) {}\n};\n\ntypedef conky::callback_handle<legacy_cb> legacy_cb_handle;\ntypedef conky::callback_handle<exec_cb> exec_cb_handle;\n\n/**\n * This is where Conky collects information on the conky.text objects in your\n * config\n *\n * During startup and reload, objects are parsed and callbacks are set. Note\n * that there are currently two types of callback: obj_cb (old style) and\n * conky::callback (new style). On each update interval,\n * generate_text_internal() in conky.cc traverses the list of text_objects and\n * calls the old callbacks. The new style callbacks are run separately by\n * conky::run_all_callbacks().\n */\nstruct text_object {\n  struct text_object *next, *prev;  /* doubly linked list of text objects */\n  struct text_object *sub;          /* for objects parsing text into objects */\n  struct text_object *ifblock_next; /* jump target for ifblock objects */\n\n  union {\n    void *opaque; /* new style generic per object data */\n    char *s;      /* some string */\n    int i;        /* some integer */\n    int64_t l;    /* some long integer */\n  } data;\n\n  void *special_data;\n  long line;\n  bool parse;  /* if true then data.s should still be parsed */\n  bool thread; /* if true then data.s should be set by a separate thread */\n\n  struct obj_cb callbacks;\n\n  /* Each _cb_handle is a std::shared_ptr with very tight restrictions on\n   * construction. For now, it is necessary to store them here as regular\n   * pointers so we can instantiate them later. */\n  exec_cb_handle *exec_handle;\n  legacy_cb_handle *cb_handle;\n};\n\n/* text object list helpers */\nint append_object(struct text_object *root, struct text_object *obj);\n\n/* ifblock helpers\n *\n * Opaque is a pointer to the address of the ifblock stack's top object.\n * Calling clients should pass the address of a defined void pointer which\n * was initialised to nullptr (empty stack).\n * */\nint obj_be_ifblock_if(void **opaque, struct text_object *);\nint obj_be_ifblock_else(void **opaque, struct text_object *);\nint obj_be_ifblock_endif(void **opaque, struct text_object *);\nint ifblock_stack_empty(void **opaque);\n\n/* make the given object be a plain text object printing given string */\nvoid obj_be_plain_text(struct text_object *, const char *);\n\n#endif /* _TEXT_OBJECT_H */\n"
  },
  {
    "path": "src/core.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n\n/* local headers */\n#include \"content/algebra.h\"\n#include \"core.h\"\n\n#include \"build.h\"\n#include \"lua/colour-settings.hh\"\n#include \"content/colours.hh\"\n#include \"content/combine.h\"\n#include \"content/text_object.h\"\n#include \"data/entropy.h\"\n#include \"data/exec.h\"\n#include \"data/hardware/bsdapm.h\"\n#include \"data/hardware/diskio.h\"\n#include \"data/hardware/i8k.h\"\n#include \"data/misc.h\"\n#include \"data/proc.h\"\n#ifdef BUILD_IMLIB2\n#include \"conky-imlib2.h\"\n#endif /* BUILD_IMLIB2 */\n#ifdef BUILD_MYSQL\n#include \"data/mysql.h\"\n#endif /* BUILD_MYSQL */\n#ifdef BUILD_ICAL\n#include \"data/ical.h\"\n#endif /* BUILD_ICAL */\n#ifdef BUILD_IRC\n#include \"data/network/irc.h\"\n#endif /* BUILD_IRC */\n#ifdef BUILD_GUI\n#include \"lua/fonts.h\"\n#include \"output/gui.h\"\n#endif /* BUILD_GUI */\n#include \"data/fs.h\"\n#ifdef BUILD_IBM\n#include \"data/hardware/ibm.h\"\n#include \"data/hardware/smapi.h\"\n#endif /* BUILD_IBM */\n#ifdef BUILD_ICONV\n#include \"data/iconv_tools.h\"\n#endif /* BUILD_ICONV */\n#include \"data/audio/mixer.h\"\n#include \"data/network/mail.h\"\n#include \"data/network/mboxscan.h\"\n#include \"data/network/net_stat.h\"\n#include \"logging.h\"\n#include \"lua/llua.h\"\n#include \"output/nc.h\"\n#ifdef BUILD_NVIDIA\n#include \"data/hardware/nvidia.h\"\n#endif /* BUILD_NVIDIA */\n#include <inttypes.h>\n#include \"content/scroll.h\"\n#include \"content/specials.h\"\n#include \"content/temphelper.h\"\n#include \"content/template.h\"\n#include \"data/hardware/cpu.h\"\n#include \"data/network/read_tcpip.h\"\n#include \"data/tailhead.h\"\n#include \"data/timeinfo.h\"\n#include \"data/top.h\"\n#include \"data/user.h\"\n#include \"data/users.h\"\n#ifdef BUILD_CURL\n#include \"data/network/ccurl_thread.h\"\n#endif /* BUILD_CURL */\n#ifdef BUILD_RSS\n#include \"data/network/rss.h\"\n#endif /* BUILD_RSS */\n#ifdef BUILD_AUDACIOUS\n#include \"data/audio/audacious.h\"\n#endif /* BUILD_AUDACIOUS */\n#ifdef BUILD_CMUS\n#include \"data/audio/cmus.h\"\n#endif /* BUILD_CMUS */\n#ifdef BUILD_JOURNAL\n#include \"data/os/journal.h\"\n#endif /* BUILD_JOURNAL */\n#ifdef BUILD_PULSEAUDIO\n#include \"data/audio/pulseaudio.h\"\n#endif /* BUILD_PULSEAUDIO */\n#ifdef BUILD_INTEL_BACKLIGHT\n#include \"data/hardware/intel_backlight.h\"\n#endif /* BUILD_INTEL_BACKLIGHT */\n\n/* check for OS and include appropriate headers */\n#if defined(__linux__)\n#include \"data/os/linux.h\"\n#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\n#include \"data/os/freebsd.h\"\n#elif defined(__DragonFly__)\n#include \"data/os/dragonfly.h\"\n#elif defined(__OpenBSD__)\n#include \"data/os/openbsd.h\"\n#elif defined(__APPLE__) && defined(__MACH__)\n#include \"data/os/darwin.h\"\n#endif\n\n#define STRNDUP_ARG strndup(arg ? arg : \"\", text_buffer_size.get(*state))\n\n#include <cctype>\n#include <cstring>\n\n/* strip a leading /dev/ if any, following symlinks first\n *\n * BEWARE: this function returns a pointer to static content\n *         which gets overwritten in consecutive calls. I.e.:\n *         this function is NOT reentrant.\n */\nconst char *dev_name(const char *path) {\n  static char buf[PATH_MAX];\n\n  if (path == nullptr) { return nullptr; }\n\n#define DEV_NAME(x)                                                         \\\n  ((x) != nullptr && strlen(x) > 5 && strncmp(x, \"/dev/\", 5) == 0 ? (x) + 5 \\\n                                                                  : (x))\n  if (realpath(path, buf) == nullptr) { return DEV_NAME(path); }\n  return DEV_NAME(buf);\n#undef DEV_NAME\n}\n\nstatic struct text_object *new_text_object_internal() {\n  auto *obj = static_cast<text_object *>(malloc(sizeof(struct text_object)));\n  memset(obj, 0, sizeof(struct text_object));\n  return obj;\n}\n\nstatic struct text_object *create_plain_text(const char *s) {\n  struct text_object *obj;\n\n  if (s == nullptr || *s == '\\0') { return nullptr; }\n\n  obj = new_text_object_internal();\n\n  obj_be_plain_text(obj, s);\n  return obj;\n}\n\n#ifdef BUILD_CURL\nvoid stock_parse_arg(struct text_object *obj, const char *arg) {\n  char stock[8];\n  char data[16];\n\n  obj->data.s = nullptr;\n  if (sscanf(arg, \"%7s %15s\", stock, data) != 2) {\n    NORM_ERR(\"wrong number of arguments for $stock\");\n    return;\n  }\n  if (!strcasecmp(\"ask\", data)) {\n    strncpy(data, \"a\", 3);\n  } else if (!strcasecmp(\"adv\", data)) {\n    strncpy(data, \"a2\", 3);\n  } else if (!strcasecmp(\"asksize\", data)) {\n    strncpy(data, \"a5\", 3);\n  } else if (!strcasecmp(\"bid\", data)) {\n    strncpy(data, \"b\", 3);\n  } else if (!strcasecmp(\"askrt\", data)) {\n    strncpy(data, \"b2\", 3);\n  } else if (!strcasecmp(\"bidrt\", data)) {\n    strncpy(data, \"b3\", 3);\n  } else if (!strcasecmp(\"bookvalue\", data)) {\n    strncpy(data, \"b4\", 3);\n  } else if (!strcasecmp(\"bidsize\", data)) {\n    strncpy(data, \"b6\", 3);\n  } else if (!strcasecmp(\"change\", data)) {\n    strncpy(data, \"c1\", 3);\n  } else if (!strcasecmp(\"commission\", data)) {\n    strncpy(data, \"c3\", 3);\n  } else if (!strcasecmp(\"changert\", data)) {\n    strncpy(data, \"c6\", 3);\n  } else if (!strcasecmp(\"ahcrt\", data)) {\n    strncpy(data, \"c8\", 3);\n  } else if (!strcasecmp(\"ds\", data)) {\n    strncpy(data, \"d\", 3);\n  } else if (!strcasecmp(\"ltd\", data)) {\n    strncpy(data, \"d1\", 3);\n  } else if (!strcasecmp(\"tradedate\", data)) {\n    strncpy(data, \"d2\", 3);\n  } else if (!strcasecmp(\"es\", data)) {\n    strncpy(data, \"e\", 3);\n  } else if (!strcasecmp(\"ei\", data)) {\n    strncpy(data, \"e1\", 3);\n  } else if (!strcasecmp(\"epsecy\", data)) {\n    strncpy(data, \"e7\", 3);\n  } else if (!strcasecmp(\"epseny\", data)) {\n    strncpy(data, \"e8\", 3);\n  } else if (!strcasecmp(\"epsenq\", data)) {\n    strncpy(data, \"e9\", 3);\n  } else if (!strcasecmp(\"floatshares\", data)) {\n    strncpy(data, \"f6\", 3);\n  } else if (!strcasecmp(\"dayslow\", data)) {\n    strncpy(data, \"g\", 3);\n  } else if (!strcasecmp(\"dayshigh\", data)) {\n    strncpy(data, \"h\", 3);\n  } else if (!strcasecmp(\"52weeklow\", data)) {\n    strncpy(data, \"j\", 3);\n  } else if (!strcasecmp(\"52weekhigh\", data)) {\n    strncpy(data, \"k\", 3);\n  } else if (!strcasecmp(\"hgp\", data)) {\n    strncpy(data, \"g1\", 3);\n  } else if (!strcasecmp(\"ag\", data)) {\n    strncpy(data, \"g3\", 3);\n  } else if (!strcasecmp(\"hg\", data)) {\n    strncpy(data, \"g4\", 3);\n  } else if (!strcasecmp(\"hgprt\", data)) {\n    strncpy(data, \"g5\", 3);\n  } else if (!strcasecmp(\"hgrt\", data)) {\n    strncpy(data, \"g6\", 3);\n  } else if (!strcasecmp(\"moreinfo\", data)) {\n    strncpy(data, \"i\", 3);\n  } else if (!strcasecmp(\"obrt\", data)) {\n    strncpy(data, \"i5\", 3);\n  } else if (!strcasecmp(\"mc\", data)) {\n    strncpy(data, \"j1\", 3);\n  } else if (!strcasecmp(\"mcrt\", data)) {\n    strncpy(data, \"j3\", 3);\n  } else if (!strcasecmp(\"ebitda\", data)) {\n    strncpy(data, \"j4\", 3);\n  } else if (!strcasecmp(\"c52wlow\", data)) {\n    strncpy(data, \"j5\", 3);\n  } else if (!strcasecmp(\"pc52wlow\", data)) {\n    strncpy(data, \"j6\", 3);\n  } else if (!strcasecmp(\"cprt\", data)) {\n    strncpy(data, \"k2\", 3);\n  } else if (!strcasecmp(\"lts\", data)) {\n    strncpy(data, \"k3\", 3);\n  } else if (!strcasecmp(\"c52whigh\", data)) {\n    strncpy(data, \"k4\", 3);\n  } else if (!strcasecmp(\"pc52whigh\", data)) {\n    strncpy(data, \"k5\", 3);\n  } else if (!strcasecmp(\"ltp\", data)) {\n    strncpy(data, \"l1\", 3);\n  } else if (!strcasecmp(\"hl\", data)) {\n    strncpy(data, \"l2\", 3);\n  } else if (!strcasecmp(\"ll\", data)) {\n    strncpy(data, \"l3\", 3);\n  } else if (!strcasecmp(\"dr\", data)) {\n    strncpy(data, \"m\", 3);\n  } else if (!strcasecmp(\"drrt\", data)) {\n    strncpy(data, \"m2\", 3);\n  } else if (!strcasecmp(\"50ma\", data)) {\n    strncpy(data, \"m3\", 3);\n  } else if (!strcasecmp(\"200ma\", data)) {\n    strncpy(data, \"m4\", 3);\n  } else if (!strcasecmp(\"c200ma\", data)) {\n    strncpy(data, \"m5\", 3);\n  } else if (!strcasecmp(\"pc200ma\", data)) {\n    strncpy(data, \"m6\", 3);\n  } else if (!strcasecmp(\"c50ma\", data)) {\n    strncpy(data, \"m7\", 3);\n  } else if (!strcasecmp(\"pc50ma\", data)) {\n    strncpy(data, \"m8\", 3);\n  } else if (!strcasecmp(\"name\", data)) {\n    strncpy(data, \"n\", 3);\n  } else if (!strcasecmp(\"notes\", data)) {\n    strncpy(data, \"n4\", 3);\n  } else if (!strcasecmp(\"open\", data)) {\n    strncpy(data, \"o\", 3);\n  } else if (!strcasecmp(\"pc\", data)) {\n    strncpy(data, \"p\", 3);\n  } else if (!strcasecmp(\"pricepaid\", data)) {\n    strncpy(data, \"p1\", 3);\n  } else if (!strcasecmp(\"cip\", data)) {\n    strncpy(data, \"p2\", 3);\n  } else if (!strcasecmp(\"ps\", data)) {\n    strncpy(data, \"p5\", 3);\n  } else if (!strcasecmp(\"pb\", data)) {\n    strncpy(data, \"p6\", 3);\n  } else if (!strcasecmp(\"edv\", data)) {\n    strncpy(data, \"q\", 3);\n  } else if (!strcasecmp(\"per\", data)) {\n    strncpy(data, \"r\", 3);\n  } else if (!strcasecmp(\"dpd\", data)) {\n    strncpy(data, \"r1\", 3);\n  } else if (!strcasecmp(\"perrt\", data)) {\n    strncpy(data, \"r2\", 3);\n  } else if (!strcasecmp(\"pegr\", data)) {\n    strncpy(data, \"r5\", 3);\n  } else if (!strcasecmp(\"pepsecy\", data)) {\n    strncpy(data, \"r6\", 3);\n  } else if (!strcasecmp(\"pepseny\", data)) {\n    strncpy(data, \"r7\", 3);\n  } else if (!strcasecmp(\"symbol\", data)) {\n    strncpy(data, \"s\", 3);\n  } else if (!strcasecmp(\"sharesowned\", data)) {\n    strncpy(data, \"s1\", 3);\n  } else if (!strcasecmp(\"shortratio\", data)) {\n    strncpy(data, \"s7\", 3);\n  } else if (!strcasecmp(\"ltt\", data)) {\n    strncpy(data, \"t1\", 3);\n  } else if (!strcasecmp(\"tradelinks\", data)) {\n    strncpy(data, \"t6\", 3);\n  } else if (!strcasecmp(\"tt\", data)) {\n    strncpy(data, \"t7\", 3);\n  } else if (!strcasecmp(\"1ytp\", data)) {\n    strncpy(data, \"t8\", 3);\n  } else if (!strcasecmp(\"volume\", data)) {\n    strncpy(data, \"v\", 3);\n  } else if (!strcasecmp(\"hv\", data)) {\n    strncpy(data, \"v1\", 3);\n  } else if (!strcasecmp(\"hvrt\", data)) {\n    strncpy(data, \"v7\", 3);\n  } else if (!strcasecmp(\"52weekrange\", data)) {\n    strncpy(data, \"w\", 3);\n  } else if (!strcasecmp(\"dvc\", data)) {\n    strncpy(data, \"w1\", 3);\n  } else if (!strcasecmp(\"dvcrt\", data)) {\n    strncpy(data, \"w4\", 3);\n  } else if (!strcasecmp(\"se\", data)) {\n    strncpy(data, \"x\", 3);\n  } else if (!strcasecmp(\"dy\", data)) {\n    strncpy(data, \"y\", 3);\n  } else {\n    NORM_ERR(\n        \"\\\"%s\\\" is not supported by $stock. Supported: 1ytp, 200ma, 50ma, \"\n        \"52weeklow, 52weekhigh, 52weekrange, adv, ag, ahcrt, ask, askrt, \"\n        \"asksize, bid, bidrt, bidsize, bookvalue, c200ma, c50ma, c52whigh, \"\n        \"c52wlow, change, changert, cip, commission, cprt, dayshigh, dayslow, \"\n        \"dpd, dr, drrt, ds, dvc, dvcrt, dy, ebitda, edv, ei, epsecy, epsenq, \"\n        \"epseny, es, floatshares, hg, hgp, hgprt, hl, hv, hvrt, ll, ltd, ltp, \"\n        \"lts, ltt, mc, mcrt, moreinfo, name, notes, obrt, open, pb, pc, \"\n        \"pc200ma, pc50ma, pc52whigh, pc52wlow, pegr, pepsecy, pepseny, per, \"\n        \"perrt, pricepaid, ps, se, sharesowned, shortratio, symbol, tradedate, \"\n        \"tradelinks, tt, volume\",\n        data);\n    return;\n  }\n#define MAX_FINYAH_URL_LENGTH 75\n  obj->data.s = static_cast<char *>(malloc(MAX_FINYAH_URL_LENGTH));\n  snprintf(obj->data.s, MAX_FINYAH_URL_LENGTH,\n           \"http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=%s\", stock,\n           data);\n}\n#endif /* BUILD_CURL */\n\nlegacy_cb_handle *create_cb_handle(int (*fn)()) {\n  if (fn != nullptr) {\n    return new legacy_cb_handle(conky::register_cb<legacy_cb>(1, fn));\n  }\n  { return nullptr; }\n}\n\n/* construct_text_object() creates a new text_object */\nstruct text_object *construct_text_object(char *s, const char *arg, long line,\n                                          void **ifblock_opaque,\n                                          void *free_at_crash) {\n  // struct text_object *obj = new_text_object();\n  struct text_object *obj = new_text_object_internal();\n\n  obj->line = line;\n\n/* helper defines for internal use only */\n#define __OBJ_HEAD(a, n) \\\n  if (!strcmp(s, #a)) {  \\\n    obj->cb_handle = create_cb_handle(n);\n#define __OBJ_IF obj_be_ifblock_if(ifblock_opaque, obj)\n#define __OBJ_ARG(...)                              \\\n  if (!arg) {                                       \\\n    free(s);                                        \\\n    CRIT_ERR_FREE(obj, free_at_crash, __VA_ARGS__); \\\n  }\n\n/* defines to be used below */\n#define OBJ(a, n) __OBJ_HEAD(a, n) {\n#define OBJ_ARG(a, n, ...) __OBJ_HEAD(a, n) __OBJ_ARG(__VA_ARGS__) {\n#define OBJ_IF(a, n)         \\\n  __OBJ_HEAD(a, n) __OBJ_IF; \\\n  {\n#define OBJ_IF_ARG(a, n, ...)                       \\\n  __OBJ_HEAD(a, n) __OBJ_ARG(__VA_ARGS__) __OBJ_IF; \\\n  {\n#define END \\\n  }         \\\n  }         \\\n  else\n\n#ifdef BUILD_GUI\n  if (s[0] == '#') {\n    obj->data.l = parse_color(s).to_argb32();\n    obj->callbacks.print = &new_fg;\n  } else\n#endif /* BUILD_GUI */\n#ifndef __OpenBSD__\n    OBJ(acpitemp, nullptr)\n  obj->data.i = open_acpi_temperature(arg);\n  obj->callbacks.print = &print_acpitemp;\n  obj->callbacks.free = &free_acpitemp;\n  END OBJ(acpiacadapter, nullptr) if (arg != nullptr) {\n#ifdef __linux__\n    if (strpbrk(arg, \"/.\") != nullptr) {\n      /*\n       * a bit of paranoia. screen out funky paths\n       * i hope no device will have a '.' in its name\n       */\n      NORM_ERR(\"acpiacadapter: arg must not contain '/' or '.'\");\n    } else\n      obj->data.opaque = strdup(arg);\n#else\n    NORM_ERR(\"acpiacadapter: arg is only used on linux\");\n#endif\n  }\n  obj->callbacks.print = &print_acpiacadapter;\n  obj->callbacks.free = &gen_free_opaque;\n  END\n#endif /* !__OpenBSD__ */\n  OBJ(freq, nullptr) get_cpu_count();\n  if ((arg == nullptr) || strlen(arg) >= 3 ||\n      strtol(&arg[0], nullptr, 10) == 0 ||\n      static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) >\n          info.cpu_count) {\n    obj->data.i = 1;\n    /* NORM_ERR(\"freq: Invalid CPU number or you don't have that many CPUs! \"\n      \"Displaying the clock for CPU 1.\"); */\n  } else {\n    obj->data.i = strtol(&arg[0], nullptr, 10);\n  }\n  obj->callbacks.print = &print_freq;\n  END OBJ(freq_g, nullptr) get_cpu_count();\n  if ((arg == nullptr) || strlen(arg) >= 3 ||\n      strtol(&arg[0], nullptr, 10) == 0 ||\n      static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) >\n          info.cpu_count) {\n    obj->data.i = 1;\n    /* NORM_ERR(\"freq_g: Invalid CPU number or you don't have that many \"\n      \"CPUs! Displaying the clock for CPU 1.\"); */\n  } else {\n    obj->data.i = strtol(&arg[0], nullptr, 10);\n  }\n  obj->callbacks.print = &print_freq_g;\n#if defined(__linux__)\n  END OBJ(cpugovernor, nullptr) get_cpu_count();\n  if ((arg == nullptr) || strlen(arg) >= 3 ||\n      strtol(&arg[0], nullptr, 10) == 0 ||\n      static_cast<unsigned int>(strtol(&arg[0], nullptr, 10)) >\n          info.cpu_count) {\n    obj->data.i = 1;\n    /* NORM_ERR(\"cpugovernor: Invalid CPU number or you don't have that \"\n      \"many CPUs! Displaying the scaling governor for CPU 1.\"); */\n  } else {\n    obj->data.i = strtol(&arg[0], nullptr, 10);\n  }\n  obj->callbacks.print = &print_cpugovernor;\n#endif /* __linux__ */\n  END OBJ_ARG(read_tcp, nullptr,\n              \"read_tcp: Needs \\\"(host) port\\\" as argument(s)\")\n      parse_read_tcpip_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_read_tcp;\n  obj->callbacks.free = &free_read_tcpip;\n  END OBJ_ARG(read_udp, nullptr,\n              \"read_udp: Needs \\\"(host) port\\\" as argument(s)\")\n      parse_read_tcpip_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_read_udp;\n  obj->callbacks.free = &free_read_tcpip;\n  END OBJ_ARG(tcp_ping, nullptr,\n              \"tcp_ping: Needs \\\"host (port)\\\" as argument(s)\")\n      parse_tcp_ping_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_tcp_ping;\n  obj->callbacks.free = &free_tcp_ping;\n#if defined(__linux__)\n  END OBJ(voltage_mv, 0) get_cpu_count();\n  if (!arg || strlen(arg) >= 3 || strtol(&arg[0], nullptr, 10) == 0 ||\n      (unsigned int)strtol(&arg[0], nullptr, 10) > info.cpu_count) {\n    obj->data.i = 1;\n    /* NORM_ERR(\"voltage_mv: Invalid CPU number or you don't have that many \"\n      \"CPUs! Displaying voltage for CPU 1.\"); */\n  } else {\n    obj->data.i = strtol(&arg[0], nullptr, 10);\n  }\n  obj->callbacks.print = &print_voltage_mv;\n  END OBJ(voltage_v, 0) get_cpu_count();\n  if (!arg || strlen(arg) >= 3 || strtol(&arg[0], nullptr, 10) == 0 ||\n      (unsigned int)strtol(&arg[0], nullptr, 10) > info.cpu_count) {\n    obj->data.i = 1;\n    /* NORM_ERR(\"voltage_v: Invalid CPU number or you don't have that many \"\n      \"CPUs! Displaying voltage for CPU 1.\"); */\n  } else {\n    obj->data.i = strtol(&arg[0], nullptr, 10);\n  }\n  obj->callbacks.print = &print_voltage_v;\n\n#endif /* __linux__ */\n\n#ifdef BUILD_WLAN\n  END OBJ(wireless_essid, &update_net_stats) obj->data.opaque =\n      get_net_stat(arg, obj, free_at_crash);\n  parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_essid;\n  END OBJ(wireless_channel, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_channel;\n  END OBJ(wireless_freq, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_frequency;\n  END OBJ(wireless_mode, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_mode;\n  END OBJ(wireless_bitrate, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_bitrate;\n  END OBJ(wireless_ap, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_ap;\n  END OBJ(wireless_link_qual, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_link_qual;\n  END OBJ(wireless_link_qual_max, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_link_qual_max;\n  END OBJ(wireless_link_qual_perc, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_wireless_link_qual_perc;\n  END OBJ(wireless_link_bar, &update_net_stats)\n      parse_net_stat_bar_arg(obj, arg, free_at_crash);\n  obj->callbacks.barval = &wireless_link_barval;\n#endif /* BUILD_WLAN */\n\n#ifndef __OpenBSD__\n  END OBJ(acpifan, nullptr) obj->callbacks.print = &print_acpifan;\n  END OBJ(battery, nullptr) char bat[64];\n\n  if (arg != nullptr) {\n    sscanf(arg, \"%63s\", bat);\n  } else {\n    strncpy(bat, \"BAT0\", 5);\n  }\n  obj->data.s = strndup(bat, text_buffer_size.get(*state));\n  obj->callbacks.print = &print_battery;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(battery_short, nullptr) char bat[64];\n\n  if (arg != nullptr) {\n    sscanf(arg, \"%63s\", bat);\n  } else {\n    strncpy(bat, \"BAT0\", 5);\n  }\n  obj->data.s = strndup(bat, text_buffer_size.get(*state));\n  obj->callbacks.print = &print_battery_short;\n  obj->callbacks.free = &gen_free_opaque;\n\n  END OBJ(battery_status, 0) obj->data.s =\n      strndup(arg ? arg : \"BAT0\", text_buffer_size.get(*state));\n  obj->callbacks.print = &print_battery_status;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(battery_time, nullptr) char bat[64];\n\n  if (arg != nullptr) {\n    sscanf(arg, \"%63s\", bat);\n  } else {\n    strncpy(bat, \"BAT0\", 5);\n  }\n  obj->data.s = strndup(bat, text_buffer_size.get(*state));\n  obj->callbacks.print = &print_battery_time;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(battery_percent, nullptr) char bat[64];\n\n  if (arg != nullptr) {\n    sscanf(arg, \"%63s\", bat);\n  } else {\n    strncpy(bat, \"BAT0\", 5);\n  }\n  obj->data.s = strndup(bat, text_buffer_size.get(*state));\n  obj->callbacks.percentage = &battery_percentage;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(battery_power_draw, nullptr) char bat[64];\n\n  if (arg != nullptr) {\n    sscanf(arg, \"%63s\", bat);\n  } else {\n    strncpy(bat, \"BAT0\", 5);\n  }\n  obj->data.s = strndup(bat, text_buffer_size.get(*state));\n  obj->callbacks.print = &battery_power_draw;\n  obj->callbacks.free = &gen_free_opaque;\n\n  END OBJ(battery_bar, nullptr) char bat[64];\n\n  arg = scan_bar(obj, arg, 100);\n  if ((arg != nullptr) && strlen(arg) > 0) {\n    sscanf(arg, \"%63s\", bat);\n  } else {\n    strncpy(bat, \"BAT0\", 5);\n  }\n  obj->data.s = strndup(bat, text_buffer_size.get(*state));\n  obj->callbacks.barval = &get_battery_perct_bar;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* !__OpenBSD__ */\n\n#if defined(__linux__)\n  END OBJ_ARG(disk_protect, 0, \"disk_protect needs an argument\") obj->data.s =\n      strndup(dev_name(arg), text_buffer_size.get(*state));\n  obj->callbacks.print = &print_disk_protect_queue;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(i8k_version, &update_i8k) obj->callbacks.print = &print_i8k_version;\n  END OBJ(i8k_bios, &update_i8k) obj->callbacks.print = &print_i8k_bios;\n  END OBJ(i8k_serial, &update_i8k) obj->callbacks.print = &print_i8k_serial;\n  END OBJ(i8k_cpu_temp, &update_i8k) obj->callbacks.print = &print_i8k_cpu_temp;\n  END OBJ(i8k_left_fan_status, &update_i8k) obj->callbacks.print =\n      &print_i8k_left_fan_status;\n  END OBJ(i8k_right_fan_status, &update_i8k) obj->callbacks.print =\n      &print_i8k_right_fan_status;\n  END OBJ(i8k_left_fan_rpm, &update_i8k) obj->callbacks.print =\n      &print_i8k_left_fan_rpm;\n  END OBJ(i8k_right_fan_rpm, &update_i8k) obj->callbacks.print =\n      &print_i8k_right_fan_rpm;\n  END OBJ(i8k_ac_status, &update_i8k) obj->callbacks.print =\n      &print_i8k_ac_status;\n  END OBJ(i8k_buttons_status, &update_i8k) obj->callbacks.print =\n      &print_i8k_buttons_status;\n#if defined(BUILD_IBM)\n  END OBJ(ibm_fan, 0) obj->callbacks.print = &get_ibm_acpi_fan;\n  END OBJ_ARG(ibm_temps, &get_ibm_acpi_temps, \"ibm_temps: needs an argument\")\n      parse_ibm_temps_arg(obj, arg);\n  obj->callbacks.print = &print_ibm_temps;\n  END OBJ(ibm_volume, 0) obj->callbacks.print = &get_ibm_acpi_volume;\n  END OBJ(ibm_brightness, 0) obj->callbacks.print = &get_ibm_acpi_brightness;\n  END OBJ(ibm_thinklight, 0) obj->callbacks.print = &get_ibm_acpi_thinklight;\n#endif\n  /* information from sony_laptop kernel module\n   * /sys/devices/platform/sony-laptop */\n  END OBJ(sony_fanspeed, 0) obj->callbacks.print = &get_sony_fanspeed;\n  END OBJ_ARG(ioscheduler, 0, \"get_ioscheduler needs an argument (e.g. hda)\")\n      obj->data.s = strndup(dev_name(arg), text_buffer_size.get(*state));\n  obj->callbacks.print = &print_ioscheduler;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(laptop_mode, 0) obj->callbacks.print = &print_laptop_mode;\n  END OBJ_ARG(\n      pb_battery, 0,\n      \"pb_battery: needs one argument: status, percent or time\") if (strcmp(arg,\n                                                                            \"st\"\n                                                                            \"at\"\n                                                                            \"u\"\n                                                                            \"s\") ==\n                                                                     EQUAL) {\n    obj->data.i = PB_BATT_STATUS;\n  }\n  else if (strcmp(arg, \"percent\") == EQUAL) { obj->data.i = PB_BATT_PERCENT; }\n  else if (strcmp(arg, \"time\") == EQUAL) { obj->data.i = PB_BATT_TIME; }\n  else {\n    NORM_ERR(\"pb_battery: illegal argument '%s', defaulting to status\", arg);\n    obj->data.i = PB_BATT_STATUS;\n  }\n  obj->callbacks.print = get_powerbook_batt_info;\n#endif /* __linux__ */\n#if (defined(__FreeBSD__) || defined(__linux__) || defined(__DragonFly__) || \\\n     (defined(__APPLE__) && defined(__MACH__)))\n  END OBJ_IF_ARG(if_up, nullptr, \"if_up needs an argument\")\n      parse_if_up_arg(obj, arg);\n  obj->callbacks.iftest = &interface_up;\n  obj->callbacks.free = &free_if_up;\n#endif\n#if defined(__OpenBSD__)\n  END OBJ_ARG(obsd_sensors_temp, 0, \"obsd_sensors_temp: needs an argument\")\n      parse_obsd_sensor(obj, arg);\n  obj->callbacks.print = &print_obsd_sensors_temp;\n  END OBJ_ARG(obsd_sensors_fan, 0,\n              \"obsd_sensors_fan: needs 2 arguments (device and sensor number)\")\n      parse_obsd_sensor(obj, arg);\n  obj->callbacks.print = &print_obsd_sensors_fan;\n  END OBJ_ARG(obsd_sensors_volt, 0,\n              \"obsd_sensors_volt: needs 2 arguments (device and sensor number)\")\n      parse_obsd_sensor(obj, arg);\n  obj->callbacks.print = &print_obsd_sensors_volt;\n  END OBJ(obsd_vendor, 0) obj->callbacks.print = &get_obsd_vendor;\n  END OBJ(obsd_product, 0) obj->callbacks.print = &get_obsd_product;\n#endif /* __OpenBSD__ */\n  END OBJ(buffers, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_buffers;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(cached, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_cached;\n  obj->callbacks.free = &gen_free_opaque;\n#define SCAN_CPU(__arg, __var)                                          \\\n  {                                                                     \\\n    int __offset = 0;                                                   \\\n    if ((__arg) && sscanf(__arg, \" cpu%d %n\", &(__var), &__offset) > 0) \\\n      (__arg) += __offset;                                              \\\n    else                                                                \\\n      (__var) = 0;                                                      \\\n  }\n  END OBJ(cpu, &update_cpu_usage) get_cpu_count();\n  SCAN_CPU(arg, obj->data.i);\n  obj->callbacks.percentage = &cpu_percentage;\n  obj->callbacks.free = &free_cpu;\n  DBGP2(\"Adding $cpu for CPU %d\", obj->data.i);\n#ifdef BUILD_GUI\n  END OBJ(cpugauge, &update_cpu_usage) get_cpu_count();\n  SCAN_CPU(arg, obj->data.i);\n  scan_gauge(obj, arg, 1);\n  obj->callbacks.gaugeval = &cpu_barval;\n  obj->callbacks.free = &free_cpu;\n  DBGP2(\"Adding $cpugauge for CPU %d\", obj->data.i);\n#endif\n  END OBJ(cpubar, &update_cpu_usage) get_cpu_count();\n  SCAN_CPU(arg, obj->data.i);\n  scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &cpu_barval;\n  obj->callbacks.free = &free_cpu;\n  DBGP2(\"Adding $cpubar for CPU %d\", obj->data.i);\n#ifdef BUILD_GUI\n  END OBJ(cpugraph, &update_cpu_usage) get_cpu_count();\n  SCAN_CPU(arg, obj->data.i);\n  scan_graph(obj, arg, 1, FALSE);\n  DBGP2(\"Adding $cpugraph for CPU %d\", obj->data.i);\n  obj->callbacks.graphval = &cpu_barval;\n  obj->callbacks.free = &free_cpu;\n  END OBJ(loadgraph, &update_load_average) scan_loadgraph_arg(obj, arg);\n  obj->callbacks.graphval = &loadgraphval;\n#endif /* BUILD_GUI */\n  END OBJ(diskio, &update_diskio) parse_diskio_arg(obj, arg);\n  obj->callbacks.print = &print_diskio;\n  END OBJ(diskio_read, &update_diskio) parse_diskio_arg(obj, arg);\n  obj->callbacks.print = &print_diskio_read;\n  END OBJ(diskio_write, &update_diskio) parse_diskio_arg(obj, arg);\n  obj->callbacks.print = &print_diskio_write;\n#ifdef BUILD_GUI\n  END OBJ(diskiograph, &update_diskio) parse_diskiograph_arg(obj, arg);\n  obj->callbacks.graphval = &diskiographval;\n  END OBJ(diskiograph_read, &update_diskio) parse_diskiograph_arg(obj, arg);\n  obj->callbacks.graphval = &diskiographval_read;\n  END OBJ(diskiograph_write, &update_diskio) parse_diskiograph_arg(obj, arg);\n  obj->callbacks.graphval = &diskiographval_write;\n#endif /* BUILD_GUI */\n  END OBJ(color, nullptr) if (false\n#ifdef BUILD_GUI\n                              || out_to_gui(*state)\n#endif /* BUILD_GUI */\n#ifdef BUILD_NCURSES\n                              || out_to_ncurses.get(*state)\n#endif /* BUILD_NCURSES */\n  ) {\n    Colour c = arg != nullptr ? parse_color(arg) : default_color.get(*state);\n    obj->data.l = c.to_argb32();\n    set_current_text_color(c);\n  }\n  obj->callbacks.print = &new_fg;\n#ifdef BUILD_GUI\n  END OBJ(color0, nullptr) Colour c = color[0].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color1, nullptr) Colour c = color[1].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color2, nullptr) Colour c = color[2].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color3, nullptr) Colour c = color[3].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color4, nullptr) Colour c = color[4].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color5, nullptr) Colour c = color[5].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color6, nullptr) Colour c = color[6].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color7, nullptr) Colour c = color[7].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color8, nullptr) Colour c = color[8].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(color9, nullptr) Colour c = color[9].get(*state);\n  obj->data.l = c.to_argb32();\n  set_current_text_color(c);\n  obj->callbacks.print = &new_fg;\n  END OBJ(font, nullptr) scan_font(obj, arg);\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font0, nullptr) scan_font(obj, font_template[0].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font1, nullptr) scan_font(obj, font_template[1].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font2, nullptr) scan_font(obj, font_template[2].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font3, nullptr) scan_font(obj, font_template[3].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font4, nullptr) scan_font(obj, font_template[4].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font5, nullptr) scan_font(obj, font_template[5].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font6, nullptr) scan_font(obj, font_template[6].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font7, nullptr) scan_font(obj, font_template[7].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font8, nullptr) scan_font(obj, font_template[8].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(font9, nullptr) scan_font(obj, font_template[9].get(*state).c_str());\n  obj->callbacks.print = &new_font;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* BUILD_GUI */\n  END OBJ(conky_version, nullptr) obj_be_plain_text(obj, VERSION);\n  END OBJ(conky_build_arch, nullptr) obj_be_plain_text(obj, BUILD_ARCH);\n  END OBJ(downspeed, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_downspeed;\n  END OBJ(downspeedf, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_downspeedf;\n#ifdef BUILD_GUI\n  END OBJ(downspeedgraph, &update_net_stats)\n      parse_net_stat_graph_arg(obj, arg, free_at_crash);\n  obj->callbacks.graphval = &downspeedgraphval;\n#endif /* BUILD_GUI */\n  END OBJ(else, nullptr) obj_be_ifblock_else(ifblock_opaque, obj);\n  obj->callbacks.iftest = &gen_false_iftest;\n  END OBJ(endif, nullptr) obj_be_ifblock_endif(ifblock_opaque, obj);\n  obj->callbacks.print = &gen_print_nothing;\n  END OBJ(eval, nullptr) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_evaluate;\n  obj->callbacks.free = &gen_free_opaque;\n#if defined(BUILD_IMLIB2) && defined(BUILD_GUI)\n  END OBJ(image, nullptr) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_image_callback;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* BUILD_IMLIB2 */\n#ifdef BUILD_MYSQL\n  END OBJ_ARG(mysql, 0, \"mysql needs a query\") obj->data.s = strdup(arg);\n  obj->callbacks.print = &print_mysql;\n#endif /* BUILD_MYSQL */\n  END OBJ_ARG(no_update, nullptr, \"no_update needs arguments\")\n      scan_no_update(obj, arg);\n  obj->callbacks.print = &print_no_update;\n  obj->callbacks.free = &free_no_update;\n  END OBJ(cat, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_cat;\n  obj->callbacks.free = &gen_free_opaque;\n\n#ifdef BUILD_X11\n  END OBJ(key_num_lock, 0) obj->callbacks.print = &print_key_num_lock;\n  END OBJ(key_caps_lock, 0) obj->callbacks.print = &print_key_caps_lock;\n  END OBJ(key_scroll_lock, 0) obj->callbacks.print = &print_key_scroll_lock;\n  END OBJ(keyboard_layout, 0) obj->callbacks.print = &print_keyboard_layout;\n  END OBJ(mouse_speed, 0) obj->callbacks.print = &print_mouse_speed;\n#endif /* BUILD_GUI */\n\n#ifdef __FreeBSD__\n  END OBJ(sysctlbyname, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_sysctlbyname;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* __FreeBSD__ */\n\n  END OBJ(password, 0) obj->data.s =\n      strndup(arg ? arg : \"20\", text_buffer_size.get(*state));\n  obj->callbacks.print = &print_password;\n  obj->callbacks.free = &gen_free_opaque;\n\n#ifdef __x86_64__\n  END OBJ(freq2, 0) obj->callbacks.print = &print_freq2;\n#endif /* __x86_64__ */\n  END OBJ(startcase, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_startcase;\n  obj->callbacks.free = &gen_free_opaque;\n  // Deprecated, for compatibility purposes only\n  END OBJ(start_case, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_startcase;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(lowercase, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_lowercase;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(uppercase, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_uppercase;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(rstrip, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &strip_trailing_whitespace;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(catp, 0) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_catp;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(exec, nullptr, \"exec needs arguments: <command>\")\n      scan_exec_arg(obj, arg, EF_EXEC);\n  obj->parse = false;\n  obj->thread = false;\n  register_exec(obj);\n  obj->callbacks.print = &print_exec;\n  obj->callbacks.free = &free_exec;\n  END OBJ_ARG(execi, nullptr, \"execi needs arguments: <interval> <command>\")\n      scan_exec_arg(obj, arg, EF_EXECI);\n  obj->parse = false;\n  obj->thread = false;\n  register_execi(obj);\n  obj->callbacks.print = &print_exec;\n  obj->callbacks.free = &free_execi;\n  END OBJ_ARG(execp, nullptr, \"execp needs arguments: <command>\")\n      scan_exec_arg(obj, arg, EF_EXEC);\n  obj->parse = true;\n  obj->thread = false;\n  register_exec(obj);\n  obj->callbacks.print = &print_exec;\n  obj->callbacks.free = &free_exec;\n  END OBJ_ARG(execpi, nullptr, \"execpi needs arguments: <interval> <command>\")\n      scan_exec_arg(obj, arg, EF_EXECI);\n  obj->parse = true;\n  obj->thread = false;\n  register_execi(obj);\n  obj->callbacks.print = &print_exec;\n  obj->callbacks.free = &free_execi;\n  END OBJ_ARG(execbar, nullptr,\n              \"execbar needs arguments: [height],[width] <command>\")\n      scan_exec_arg(obj, arg, EF_EXEC | EF_BAR);\n  register_exec(obj);\n  obj->callbacks.barval = &execbarval;\n  obj->callbacks.free = &free_exec;\n  END OBJ_ARG(execibar, nullptr,\n              \"execibar needs arguments: <interval> [height],[width] <command>\")\n      scan_exec_arg(obj, arg, EF_EXECI | EF_BAR);\n  register_execi(obj);\n  obj->callbacks.barval = &execbarval;\n  obj->callbacks.free = &free_execi;\n#ifdef BUILD_GUI\n  END OBJ_ARG(execgauge, nullptr,\n              \"execgauge needs arguments: [height],[width] <command>\")\n      scan_exec_arg(obj, arg, EF_EXEC | EF_GAUGE);\n  register_exec(obj);\n  obj->callbacks.gaugeval = &execbarval;\n  obj->callbacks.free = &free_exec;\n  END OBJ_ARG(\n      execigauge, nullptr,\n      \"execigauge needs arguments: <interval> [height],[width] <command>\")\n      scan_exec_arg(obj, arg, EF_EXECI | EF_GAUGE);\n  register_execi(obj);\n  obj->callbacks.gaugeval = &execbarval;\n  obj->callbacks.free = &free_execi;\n  END OBJ_ARG(execgraph, nullptr,\n              \"execgraph needs arguments: <command> [height],[width] [color1] \"\n              \"[color2] [scale] [-t|-l]\")\n      scan_exec_arg(obj, arg, EF_EXEC | EF_GRAPH);\n  register_exec(obj);\n  obj->callbacks.graphval = &execbarval;\n  obj->callbacks.free = &free_exec;\n  END OBJ_ARG(execigraph, nullptr,\n              \"execigraph needs arguments: <interval> <command> \"\n              \"[height],[width] [color1] [color2] [scale] [-t|-l]\")\n      scan_exec_arg(obj, arg, EF_EXECI | EF_GRAPH);\n  register_execi(obj);\n  obj->callbacks.graphval = &execbarval;\n  obj->callbacks.free = &free_execi;\n#endif /* BUILD_GUI */\n  END OBJ_ARG(texeci, nullptr, \"texeci needs arguments: <interval> <command>\")\n      scan_exec_arg(obj, arg, EF_EXECI);\n  obj->parse = false;\n  obj->thread = true;\n  register_execi(obj);\n  obj->callbacks.print = &print_exec;\n  obj->callbacks.free = &free_execi;\n  END OBJ_ARG(texecpi, nullptr, \"texecpi needs arguments: <interval> <command>\")\n      scan_exec_arg(obj, arg, EF_EXECI);\n  obj->parse = true;\n  obj->thread = true;\n  register_execi(obj);\n  obj->callbacks.print = &print_exec;\n  obj->callbacks.free = &free_execi;\n  END OBJ(fs_bar, &update_fs_stats) init_fs_bar(obj, arg);\n  obj->callbacks.barval = &fs_barval;\n  END OBJ(fs_bar_free, &update_fs_stats) init_fs_bar(obj, arg);\n  obj->callbacks.barval = &fs_free_barval;\n  END OBJ(fs_free, &update_fs_stats) init_fs(obj, arg);\n  obj->callbacks.print = &print_fs_free;\n  END OBJ(fs_used_perc, &update_fs_stats) init_fs(obj, arg);\n  obj->callbacks.percentage = &fs_used_percentage;\n  END OBJ(fs_free_perc, &update_fs_stats) init_fs(obj, arg);\n  obj->callbacks.percentage = &fs_free_percentage;\n  END OBJ(fs_size, &update_fs_stats) init_fs(obj, arg);\n  obj->callbacks.print = &print_fs_size;\n  END OBJ(fs_type, &update_fs_stats) init_fs(obj, arg);\n  obj->callbacks.print = &print_fs_type;\n  END OBJ(fs_used, &update_fs_stats) init_fs(obj, arg);\n  obj->callbacks.print = &print_fs_used;\n#ifdef BUILD_GUI\n  END OBJ(hr, nullptr) obj->data.l =\n      arg != nullptr ? strtol(arg, nullptr, 10) : 1;\n  obj->callbacks.print = &new_hr;\n#endif /* BUILD_GUI */\n  END OBJ(nameserver, &update_dns_data) parse_nameserver_arg(obj, arg);\n  obj->callbacks.print = &print_nameserver;\n  obj->callbacks.free = &free_dns_data;\n  END OBJ(offset, nullptr) obj->data.l =\n      arg != nullptr ? strtol(arg, nullptr, 10) : 1;\n  obj->callbacks.print = &new_offset;\n  END OBJ(voffset, nullptr) obj->data.l =\n      arg != nullptr ? strtol(arg, nullptr, 10) : 1;\n  obj->callbacks.print = &new_voffset;\n  END OBJ(save_coordinates, nullptr) obj->data.l =\n      arg != nullptr ? strtol(arg, nullptr, 10) : 0;\n  obj->callbacks.print = &new_save_coordinates;\n  END OBJ_ARG(goto, nullptr, \"goto needs arguments\") obj->data.l =\n      strtol(arg, nullptr, 10);\n  obj->callbacks.print = &new_goto;\n#ifdef BUILD_GUI\n  END OBJ(tab, nullptr) scan_tab(obj, arg);\n  obj->callbacks.print = &new_tab;\n#endif /* BUILD_GUI */\n#ifdef __linux__\n  END OBJ_ARG(i2c, 0, \"i2c needs arguments\") parse_i2c_sensor(obj, arg);\n  obj->callbacks.print = &print_sysfs_sensor;\n  obj->callbacks.free = &free_sysfs_sensor;\n  END OBJ_ARG(platform, 0, \"platform needs arguments\")\n      parse_platform_sensor(obj, arg);\n  obj->callbacks.print = &print_sysfs_sensor;\n  obj->callbacks.free = &free_sysfs_sensor;\n  END OBJ_ARG(hwmon, 0, \"hwmon needs arguments\") parse_hwmon_sensor(obj, arg);\n  obj->callbacks.print = &print_sysfs_sensor;\n  obj->callbacks.free = &free_sysfs_sensor;\n#endif /* __linux__ */\n  END\n      /* we have four different types of top (top, top_mem, top_time and\n       * top_io). To avoid having almost-same code four times, we have this\n       * special handler. */\n      /* XXX: maybe fiddle them apart later, as print_top() does\n       * nothing else than just that, using an ugly switch(). */\n      if (strncmp(s, \"top\", 3) == EQUAL) {\n    if (parse_top_args(s, arg, obj) != 0) {\n      obj->cb_handle = create_cb_handle(update_top);\n    } else {\n      free(obj);\n      return nullptr;\n    }\n  }\n  else OBJ(addr, &update_net_stats) parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_addr;\n  END\n#ifdef __linux__\n      OBJ(addrs, &update_net_stats) parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_addrs;\n#ifdef BUILD_IPV6\n  END OBJ(v6addrs, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_v6addrs;\n#endif /* BUILD_IPV6 */\n  END\n#endif /* __linux__ */\n      OBJ_ARG(tail, nullptr, \"tail needs arguments\")\n          init_tailhead(\"tail\", arg, obj, free_at_crash);\n  obj->callbacks.print = &print_tail;\n  obj->callbacks.free = &free_tailhead;\n  END OBJ_ARG(head, nullptr, \"head needs arguments\")\n      init_tailhead(\"head\", arg, obj, free_at_crash);\n  obj->callbacks.print = &print_head;\n  obj->callbacks.free = &free_tailhead;\n  END OBJ_ARG(lines, nullptr, \"lines needs an argument\") obj->data.s =\n      STRNDUP_ARG;\n  obj->callbacks.print = &print_lines;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(words, nullptr, \"words needs a argument\") obj->data.s =\n      STRNDUP_ARG;\n  obj->callbacks.print = &print_words;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(loadavg, &update_load_average) scan_loadavg_arg(obj, arg);\n  obj->callbacks.print = &print_loadavg;\n  END OBJ_IF_ARG(if_empty, nullptr, \"if_empty needs an argument\") obj->sub =\n      static_cast<text_object *>(malloc(sizeof(struct text_object)));\n  extract_variable_text_internal(obj->sub, arg);\n  obj->callbacks.iftest = &if_empty_iftest;\n  END OBJ_IF_ARG(if_match, nullptr, \"if_match needs arguments\") obj->sub =\n      static_cast<text_object *>(malloc(sizeof(struct text_object)));\n  extract_variable_text_internal(obj->sub, arg);\n  obj->callbacks.iftest = &check_if_match;\n  END OBJ_IF_ARG(if_existing, nullptr, \"if_existing needs an argument or two\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.iftest = &if_existing_iftest;\n  obj->callbacks.free = &gen_free_opaque;\n#if defined(__linux__) || defined(__FreeBSD__)\n  END OBJ_IF_ARG(if_mounted, 0, \"if_mounted needs an argument\") obj->data.s =\n      STRNDUP_ARG;\n  obj->callbacks.iftest = &check_mount;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_IF_ARG(if_running, &update_top, \"if_running needs an argument\")\n      top_running = 1;\n  obj->data.s = STRNDUP_ARG;\n  obj->callbacks.iftest = &if_running_iftest;\n  obj->callbacks.free = &gen_free_opaque;\n#elif defined(__APPLE__) && defined(__MACH__)\n  END OBJ_IF_ARG(if_mounted, nullptr, \"if_mounted needs an argument\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.iftest = &check_mount;\n  obj->callbacks.free = &gen_free_opaque;\n\n  /* System Integrity Protection */\n  END OBJ(sip_status, &get_sip_status) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_sip_status;\n  obj->callbacks.free = &gen_free_opaque;\n#else\n  END OBJ_IF_ARG(if_running, 0, \"if_running needs an argument\")\n\n      char buf[DEFAULT_TEXT_BUFFER_SIZE];\n\n  snprintf(buf, DEFAULT_TEXT_BUFFER_SIZE, \"pidof %s >/dev/null\", arg);\n  obj->data.s = STRNDUP_ARG;\n  /* XXX: maybe use a different callback here */\n  obj->callbacks.iftest = &if_running_iftest;\n#endif\n  END OBJ(kernel, nullptr) obj->callbacks.print = &print_kernel;\n  END OBJ(machine, nullptr) obj->callbacks.print = &print_machine;\n#if defined(__DragonFly__)\n  END OBJ(version, 0) obj->callbacks.print = &print_version;\n#endif\n  END OBJ(mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(new_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_new_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(seen_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_seen_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(unseen_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_unseen_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(flagged_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_flagged_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(unflagged_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_unflagged_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(forwarded_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_forwarded_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(unforwarded_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_unforwarded_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(replied_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_replied_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(unreplied_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_unreplied_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(draft_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_draft_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(trashed_mails, nullptr) parse_local_mail_args(obj, arg);\n  obj->callbacks.print = &print_trashed_mails;\n  obj->callbacks.free = &free_local_mails;\n  END OBJ(mboxscan, nullptr) parse_mboxscan_arg(obj, arg);\n  obj->callbacks.print = &print_mboxscan;\n  obj->callbacks.free = &free_mboxscan;\n  END OBJ(mem, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_mem;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(legacymem, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_legacymem;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memwithbuffers, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memwithbuffers;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memeasyfree, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memeasyfree;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memfree, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memfree;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memmax, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memmax;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memperc, &update_meminfo) obj->callbacks.percentage = &mem_percentage;\n#ifdef __linux__\n  END OBJ(memdirty, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memdirty;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memavail, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memavail;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(shmem, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_shmem;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(free_bufcache, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_free_bufcache;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(free_cached, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_free_cached;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* __linux__ */\n#ifdef __FreeBSD__\n  END OBJ(memactive, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memactive;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(meminactive, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_meminactive;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memwired, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memwired;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(memlaundry, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_memlaundry;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* __FreeBSD__ */\n#ifdef BUILD_GUI\n  END OBJ(memgauge, &update_meminfo) scan_gauge(obj, arg, 1);\n  obj->callbacks.gaugeval = &mem_barval;\n#endif /* BUILD_GUI */\n  END OBJ(membar, &update_meminfo) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &mem_barval;\n  END OBJ(memwithbuffersbar, &update_meminfo) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &mem_with_buffers_barval;\n#ifdef BUILD_GUI\n  END OBJ(memgraph, &update_meminfo) scan_graph(obj, arg, 1, FALSE);\n  obj->callbacks.graphval = &mem_barval;\n  END OBJ(memwithbuffersgraph, &update_meminfo) scan_graph(obj, arg, 1, FALSE);\n  obj->callbacks.graphval = &mem_with_buffers_barval;\n#endif /* BUILD_GUI*/\n#ifdef HAVE_SOUNDCARD_H\n  END OBJ(mixer, 0) parse_mixer_arg(obj, arg);\n  obj->callbacks.percentage = &mixer_percentage;\n  END OBJ(mixerl, 0) parse_mixer_arg(obj, arg);\n  obj->callbacks.percentage = &mixerl_percentage;\n  END OBJ(mixerr, 0) parse_mixer_arg(obj, arg);\n  obj->callbacks.percentage = &mixerr_percentage;\n  END OBJ(mixerbar, 0) scan_mixer_bar(obj, arg);\n  obj->callbacks.barval = &mixer_barval;\n  END OBJ(mixerlbar, 0) scan_mixer_bar(obj, arg);\n  obj->callbacks.barval = &mixerl_barval;\n  END OBJ(mixerrbar, 0) scan_mixer_bar(obj, arg);\n  obj->callbacks.barval = &mixerr_barval;\n  END OBJ_IF(if_mixer_mute, 0) parse_mixer_arg(obj, arg);\n  obj->callbacks.iftest = &check_mixer_muted;\n#endif /* HAVE_SOUNDCARD_H */\n#ifdef BUILD_GUI\n  END OBJ(monitor, nullptr) obj->callbacks.print = &print_monitor;\n  END OBJ(monitor_number, nullptr) obj->callbacks.print = &print_monitor_number;\n  END OBJ(desktop, nullptr) obj->callbacks.print = &print_desktop;\n  END OBJ(desktop_number, nullptr) obj->callbacks.print = &print_desktop_number;\n  END OBJ(desktop_name, nullptr) obj->callbacks.print = &print_desktop_name;\n#endif /* BUILD_GUI */\n  END OBJ_ARG(format_time, nullptr, \"format_time needs a pid as argument\")\n      obj->sub = static_cast<text_object *>(malloc(sizeof(struct text_object)));\n  extract_variable_text_internal(obj->sub, arg);\n  obj->callbacks.print = &print_format_time;\n  END OBJ(nodename, nullptr) obj->callbacks.print = &print_nodename;\n  END OBJ(nodename_short, nullptr) obj->callbacks.print = &print_nodename_short;\n  END OBJ_ARG(cmdline_to_pid, nullptr,\n              \"cmdline_to_pid needs a command line as argument\")\n      scan_cmdline_to_pid_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_cmdline_to_pid;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(pid_chroot, nullptr, \"pid_chroot needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_chroot;\n  END OBJ_ARG(pid_cmdline, nullptr, \"pid_cmdline needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_cmdline;\n  END OBJ_ARG(pid_cwd, nullptr, \"pid_cwd needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_cwd;\n  END OBJ_ARG(pid_environ, nullptr, \"pid_environ needs arguments\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_environ;\n  END OBJ_ARG(pid_environ_list, nullptr,\n              \"pid_environ_list needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_environ_list;\n  END OBJ_ARG(pid_exe, nullptr, \"pid_exe needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_exe;\n  END OBJ_ARG(pid_nice, nullptr, \"pid_nice needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_nice;\n  END OBJ_ARG(pid_openfiles, nullptr, \"pid_openfiles needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_openfiles;\n  END OBJ_ARG(pid_parent, nullptr, \"pid_parent needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_parent;\n  END OBJ_ARG(pid_priority, nullptr, \"pid_priority needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_priority;\n  END OBJ_ARG(pid_state, nullptr, \"pid_state needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_state;\n  END OBJ_ARG(pid_state_short, nullptr,\n              \"pid_state_short needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_state_short;\n  END OBJ_ARG(pid_stderr, nullptr, \"pid_stderr needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_stderr;\n  END OBJ_ARG(pid_stdin, nullptr, \"pid_stdin needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_stdin;\n  END OBJ_ARG(pid_stdout, nullptr, \"pid_stdout needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_stdout;\n  END OBJ_ARG(pid_threads, nullptr, \"pid_threads needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_threads;\n  END OBJ_ARG(pid_thread_list, nullptr,\n              \"pid_thread_list needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_thread_list;\n  END OBJ_ARG(pid_time_kernelmode, nullptr,\n              \"pid_time_kernelmode needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_time_kernelmode;\n  END OBJ_ARG(pid_time_usermode, nullptr,\n              \"pid_time_usermode needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_time_usermode;\n  END OBJ_ARG(pid_time, nullptr, \"pid_time needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_time;\n  END OBJ_ARG(pid_uid, nullptr, \"pid_uid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_uid;\n  END OBJ_ARG(pid_euid, nullptr, \"pid_euid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_euid;\n  END OBJ_ARG(pid_suid, nullptr, \"pid_suid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_suid;\n  END OBJ_ARG(pid_fsuid, nullptr, \"pid_fsuid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_fsuid;\n  END OBJ_ARG(pid_gid, nullptr, \"pid_gid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_gid;\n  END OBJ_ARG(pid_egid, nullptr, \"pid_egid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_egid;\n  END OBJ_ARG(pid_sgid, nullptr, \"pid_sgid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_sgid;\n  END OBJ_ARG(pid_fsgid, nullptr, \"pid_fsgid needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_fsgid;\n  END OBJ_ARG(gid_name, nullptr, \"gid_name needs a gid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_gid_name;\n  END OBJ_ARG(uid_name, nullptr, \"uid_name needs a uid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_uid_name;\n  END OBJ_ARG(pid_read, nullptr, \"pid_read needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_read;\n  END OBJ_ARG(pid_vmpeak, nullptr, \"pid_vmpeak needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmpeak;\n  END OBJ_ARG(pid_vmsize, nullptr, \"pid_vmsize needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmsize;\n  END OBJ_ARG(pid_vmlck, nullptr, \"pid_vmlck needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmlck;\n  END OBJ_ARG(pid_vmhwm, nullptr, \"pid_vmhwm needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmhwm;\n  END OBJ_ARG(pid_vmrss, nullptr, \"pid_vmrss needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmrss;\n  END OBJ_ARG(pid_vmdata, nullptr, \"pid_vmdata needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmdata;\n  END OBJ_ARG(pid_vmstk, nullptr, \"pid_vmstk needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmstk;\n  END OBJ_ARG(pid_vmexe, nullptr, \"pid_vmexe needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmexe;\n  END OBJ_ARG(pid_vmlib, nullptr, \"pid_vmlib needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmlib;\n  END OBJ_ARG(pid_vmpte, nullptr, \"pid_vmpte needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_vmpte;\n  END OBJ_ARG(pid_write, nullptr, \"pid_write needs a pid as argument\")\n      extract_object_args_to_sub(obj, arg);\n  obj->callbacks.print = &print_pid_write;\n#ifdef __DragonFly__\n  END OBJ(processes, &update_top)\n#else\n  END OBJ(processes, &update_total_processes)\n#endif\n      obj->callbacks.print = &print_processes;\n#ifdef __linux__\n  END OBJ(distribution, 0) obj->callbacks.print = &print_distribution;\n  END OBJ(running_processes, &update_top) top_running = 1;\n  obj->callbacks.print = &print_running_processes;\n  END OBJ(threads, &update_threads) obj->callbacks.print = &print_threads;\n  END OBJ(running_threads, &update_stat) obj->callbacks.print =\n      &print_running_threads;\n#else\n#if defined(__DragonFly__)\n  END OBJ(running_processes, &update_top) obj->callbacks.print =\n      &print_running_processes;\n#elif (defined(__APPLE__) && defined(__MACH__))\n  END OBJ(running_processes, &update_running_processes) obj->callbacks.print =\n      &print_running_processes;\n  END OBJ(threads, &update_threads) obj->callbacks.print = &print_threads;\n  END OBJ(running_threads, &update_running_threads) obj->callbacks.print =\n      &print_running_threads;\n#else\n  END OBJ(running_processes, &update_running_processes) obj->callbacks.print =\n      &print_running_processes;\n#endif\n#endif /* __linux__ */\n  END OBJ(shadecolor, nullptr)\n#ifdef BUILD_GUI\n      obj->data.l =\n      (arg != nullptr ? parse_color(arg) : default_shade_color.get(*state))\n          .to_argb32();\n  obj->callbacks.print = &new_bg;\n#endif /* BUILD_GUI */\n  END OBJ(outlinecolor, nullptr)\n#ifdef BUILD_GUI\n      obj->data.l =\n      (arg != nullptr ? parse_color(arg) : default_outline_color.get(*state))\n          .to_argb32();\n  obj->callbacks.print = &new_outline;\n#endif /* BUILD_GUI */\n  END OBJ(stippled_hr, nullptr)\n#ifdef BUILD_GUI\n      scan_stippled_hr(obj, arg);\n  obj->callbacks.print = &new_stippled_hr;\n#endif /* BUILD_GUI */\n  END OBJ(swap, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_swap;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(swapfree, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_swapfree;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(swapmax, &update_meminfo) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_swapmax;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ(swapperc, &update_meminfo) obj->callbacks.percentage =\n      &swap_percentage;\n  END OBJ(swapbar, &update_meminfo) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &swap_barval;\n  /* XXX: swapgraph, swapgauge? */\n  END OBJ(sysname, nullptr) obj->callbacks.print = &print_sysname;\n  END OBJ(time, nullptr) scan_time(obj, arg);\n  obj->callbacks.print = &print_time;\n  obj->callbacks.free = &free_time;\n  END OBJ(utime, nullptr) scan_time(obj, arg);\n  obj->callbacks.print = &print_utime;\n  obj->callbacks.free = &free_time;\n  END OBJ(tztime, nullptr) scan_tztime(obj, arg);\n  obj->callbacks.print = &print_tztime;\n  obj->callbacks.free = &free_tztime;\n#ifdef BUILD_ICAL\n  END OBJ_ARG(ical, 0, \"ical requires arguments\")\n      parse_ical_args(obj, arg, free_at_crash, s);\n  obj->callbacks.print = &print_ical;\n  obj->callbacks.free = &free_ical;\n#endif\n#ifdef BUILD_IRC\n  END OBJ_ARG(irc, 0, \"irc requires arguments\") parse_irc_args(obj, arg);\n  obj->callbacks.print = &print_irc;\n  obj->callbacks.free = &free_irc;\n#endif\n#ifdef BUILD_ICONV\n  END OBJ_ARG(iconv_start, 0, \"Iconv requires arguments\")\n      init_iconv_start(obj, free_at_crash, arg);\n  obj->callbacks.print = &print_iconv_start;\n  obj->callbacks.free = &free_iconv;\n  END OBJ(iconv_stop, 0) init_iconv_stop();\n  obj->callbacks.print = &print_iconv_stop;\n#endif\n  END OBJ(totaldown, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_totaldown;\n  END OBJ(totalup, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_totalup;\n  END OBJ(updates, nullptr) obj->callbacks.print = &print_updates;\n  END OBJ_IF(if_updatenr, nullptr) obj->data.i =\n      arg != nullptr ? strtol(arg, nullptr, 10) : 0;\n  if (obj->data.i == 0) {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"if_updatenr needs a number above 0 as argument\");\n  }\n  set_updatereset(obj->data.i > get_updatereset() ? obj->data.i\n                                                  : get_updatereset());\n  obj->callbacks.iftest = &updatenr_iftest;\n  END OBJ(alignr, nullptr) obj->data.l =\n      arg != nullptr ? strtol(arg, nullptr, 10) : 1;\n  obj->callbacks.print = &new_alignr;\n  END OBJ(alignc, nullptr) obj->data.l =\n      arg != nullptr ? strtol(arg, nullptr, 10) : 0;\n  obj->callbacks.print = &new_alignc;\n  END OBJ(upspeed, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_upspeed;\n  END OBJ(upspeedf, &update_net_stats)\n      parse_net_stat_arg(obj, arg, free_at_crash);\n  obj->callbacks.print = &print_upspeedf;\n#ifdef BUILD_GUI\n  END OBJ(upspeedgraph, &update_net_stats)\n      parse_net_stat_graph_arg(obj, arg, free_at_crash);\n  obj->callbacks.graphval = &upspeedgraphval;\n#endif\n  END OBJ(uptime_short, &update_uptime) obj->callbacks.print =\n      &print_uptime_short;\n  END OBJ(uptime, &update_uptime) obj->callbacks.print = &print_uptime;\n#if defined(__linux__)\n  END OBJ(user_names, &update_users) obj->callbacks.print = &print_user_names;\n  obj->callbacks.free = &free_user_names;\n  END OBJ(user_times, &update_users) obj->callbacks.print = &print_user_times;\n  obj->callbacks.free = &free_user_times;\n  END OBJ_ARG(user_time, 0, \"user time needs a console name as argument\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_user_time;\n  obj->callbacks.free = &free_user_time;\n  END OBJ(user_terms, &update_users) obj->callbacks.print = &print_user_terms;\n  obj->callbacks.free = &free_user_terms;\n  END OBJ(user_number, &update_users) obj->callbacks.print = &print_user_number;\n  END OBJ(gw_iface, &update_gateway_info) obj->callbacks.print =\n      &print_gateway_iface;\n  obj->callbacks.free = &free_gateway_info;\n  END OBJ_IF(if_gw, &update_gateway_info) obj->callbacks.iftest =\n      &gateway_exists;\n  obj->callbacks.free = &free_gateway_info;\n  END OBJ(gw_ip, &update_gateway_info) obj->callbacks.print = &print_gateway_ip;\n  obj->callbacks.free = &free_gateway_info;\n  END OBJ(iface, &update_gateway_info2) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_gateway_iface2;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* __linux__ */\n#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n     defined(__DragonFly__) || defined(__OpenBSD__)) &&     \\\n    (defined(i386) || defined(__i386__))\n  END OBJ(apm_adapter, 0) obj->callbacks.print = &print_apm_adapter;\n  END OBJ(apm_battery_life, 0) obj->callbacks.print = &print_apm_battery_life;\n  END OBJ(apm_battery_time, 0) obj->callbacks.print = &print_apm_battery_time;\n#endif /* __FreeBSD__ */\n  END OBJ(imap_unseen, nullptr) parse_imap_mail_args(obj, arg);\n  obj->callbacks.print = &print_imap_unseen;\n  obj->callbacks.free = &free_mail_obj;\n  END OBJ(imap_messages, nullptr) parse_imap_mail_args(obj, arg);\n  obj->callbacks.print = &print_imap_messages;\n  obj->callbacks.free = &free_mail_obj;\n  END OBJ(pop3_unseen, nullptr) parse_pop3_mail_args(obj, arg);\n  obj->callbacks.print = &print_pop3_unseen;\n  obj->callbacks.free = &free_mail_obj;\n  END OBJ(pop3_used, nullptr) parse_pop3_mail_args(obj, arg);\n  obj->callbacks.print = &print_pop3_used;\n  obj->callbacks.free = &free_mail_obj;\n#ifdef BUILD_IBM\n  END OBJ_ARG(smapi, 0, \"smapi needs an argument\") obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_smapi;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_IF_ARG(if_smapi_bat_installed, 0,\n                 \"if_smapi_bat_installed needs an argument\") obj->data.s =\n      STRNDUP_ARG;\n  obj->callbacks.iftest = &smapi_bat_installed;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(smapi_bat_perc, 0, \"smapi_bat_perc needs an argument\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.percentage = &smapi_bat_percentage;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(smapi_bat_temp, 0, \"smapi_bat_temp needs an argument\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_smapi_bat_temp;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(smapi_bat_power, 0, \"smapi_bat_power needs an argument\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_smapi_bat_power;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(smapi_bat_bar, 0, \"smapi_bat_bar needs an argument\") int cnt;\n  if (sscanf(arg, \"%i %n\", &obj->data.i, &cnt) <= 0) {\n    NORM_ERR(\"first argument to smapi_bat_bar must be an integer value\");\n    obj->data.i = -1;\n  } else\n    arg = scan_bar(obj, arg + cnt, 100);\n  obj->callbacks.barval = &smapi_bat_barval;\n#endif /* BUILD_IBM */\n#ifdef BUILD_MPD\n#define mpd_set_maxlen(name)                       \\\n  if (arg) {                                       \\\n    int i;                                         \\\n    sscanf(arg, \"%d\", &i);                         \\\n    if (i > 0)                                     \\\n      obj->data.i = i + 1;                         \\\n    else                                           \\\n      NORM_ERR(#name \": invalid length argument\"); \\\n  }\n  END OBJ(mpd_artist, nullptr) mpd_set_maxlen(mpd_artist);\n  obj->callbacks.print = &print_mpd_artist;\n  END OBJ(mpd_albumartist, nullptr) mpd_set_maxlen(mpd_albumartist);\n  obj->callbacks.print = &print_mpd_albumartist;\n  END OBJ(mpd_title, nullptr) mpd_set_maxlen(mpd_title);\n  obj->callbacks.print = &print_mpd_title;\n  END OBJ(mpd_date, nullptr) mpd_set_maxlen(mpd_date);\n  obj->callbacks.print = &print_mpd_date;\n  END OBJ(mpd_comment, nullptr) mpd_set_maxlen(mpd_comment);\n  obj->callbacks.print = &print_mpd_comment;\n  END OBJ(mpd_random, nullptr) obj->callbacks.print = &print_mpd_random;\n  END OBJ(mpd_repeat, nullptr) obj->callbacks.print = &print_mpd_repeat;\n  END OBJ(mpd_elapsed, nullptr) obj->callbacks.print = &print_mpd_elapsed;\n  END OBJ(mpd_length, nullptr) obj->callbacks.print = &print_mpd_length;\n  END OBJ(mpd_track, nullptr) mpd_set_maxlen(mpd_track);\n  obj->callbacks.print = &print_mpd_track;\n  END OBJ(mpd_name, nullptr) mpd_set_maxlen(mpd_name);\n  obj->callbacks.print = &print_mpd_name;\n  END OBJ(mpd_file, nullptr) mpd_set_maxlen(mpd_file);\n  obj->callbacks.print = &print_mpd_file;\n  END OBJ(mpd_percent, nullptr) obj->callbacks.percentage = &mpd_percentage;\n  END OBJ(mpd_album, nullptr) mpd_set_maxlen(mpd_album);\n  obj->callbacks.print = &print_mpd_album;\n  END OBJ(mpd_vol, nullptr) obj->callbacks.print = &print_mpd_vol;\n  END OBJ(mpd_bitrate, nullptr) obj->callbacks.print = &print_mpd_bitrate;\n  END OBJ(mpd_status, nullptr) obj->callbacks.print = &print_mpd_status;\n  END OBJ(mpd_bar, nullptr) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &mpd_barval;\n  END OBJ(mpd_smart, nullptr) mpd_set_maxlen(mpd_smart);\n  obj->callbacks.print = &print_mpd_smart;\n  END OBJ_IF(if_mpd_playing, nullptr) obj->callbacks.iftest =\n      &check_mpd_playing;\n#undef mpd_set_maxlen\n#endif /* BUILD_MPD */\n#ifdef BUILD_MOC\n  END OBJ(moc_state, nullptr) obj->callbacks.print = &print_moc_state;\n  END OBJ(moc_file, nullptr) obj->callbacks.print = &print_moc_file;\n  END OBJ(moc_title, nullptr) obj->callbacks.print = &print_moc_title;\n  END OBJ(moc_artist, nullptr) obj->callbacks.print = &print_moc_artist;\n  END OBJ(moc_song, nullptr) obj->callbacks.print = &print_moc_song;\n  END OBJ(moc_album, nullptr) obj->callbacks.print = &print_moc_album;\n  END OBJ(moc_totaltime, nullptr) obj->callbacks.print = &print_moc_totaltime;\n  END OBJ(moc_timeleft, nullptr) obj->callbacks.print = &print_moc_timeleft;\n  END OBJ(moc_totalsec, nullptr) obj->callbacks.print = &print_moc_totalsec;\n  END OBJ(moc_curtime, nullptr) obj->callbacks.print = &print_moc_curtime;\n  END OBJ(moc_cursec, nullptr) obj->callbacks.print = &print_moc_cursec;\n  END OBJ(moc_bitrate, nullptr) obj->callbacks.print = &print_moc_bitrate;\n  END OBJ(moc_avgbitrate, nullptr) obj->callbacks.print = &print_moc_avgbitrate;\n  END OBJ(moc_rate, nullptr) obj->callbacks.print = &print_moc_rate;\n  END OBJ(moc_percent, nullptr) obj->callbacks.percentage = &moc_percentage;\n  END OBJ(moc_bar, nullptr) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &moc_barval;\n#endif /* BUILD_MOC */\n#ifdef BUILD_CMUS\n  END OBJ(cmus_state, 0) obj->callbacks.print = &print_cmus_state;\n  END OBJ(cmus_file, 0) obj->callbacks.print = &print_cmus_file;\n  END OBJ(cmus_title, 0) obj->callbacks.print = &print_cmus_title;\n  END OBJ(cmus_artist, 0) obj->callbacks.print = &print_cmus_artist;\n  END OBJ(cmus_album, 0) obj->callbacks.print = &print_cmus_album;\n  END OBJ(cmus_totaltime, 0) obj->callbacks.print = &print_cmus_totaltime;\n  END OBJ(cmus_timeleft, 0) obj->callbacks.print = &print_cmus_timeleft;\n  END OBJ(cmus_curtime, 0) obj->callbacks.print = &print_cmus_curtime;\n  END OBJ(cmus_random, 0) obj->callbacks.print = &print_cmus_random;\n  END OBJ(cmus_state, 0) obj->callbacks.print = &print_cmus_state;\n  END OBJ(cmus_file, 0) obj->callbacks.print = &print_cmus_file;\n  END OBJ(cmus_title, 0) obj->callbacks.print = &print_cmus_title;\n  END OBJ(cmus_artist, 0) obj->callbacks.print = &print_cmus_artist;\n  END OBJ(cmus_album, 0) obj->callbacks.print = &print_cmus_album;\n  END OBJ(cmus_totaltime, 0) obj->callbacks.print = &print_cmus_totaltime;\n  END OBJ(cmus_timeleft, 0) obj->callbacks.print = &print_cmus_timeleft;\n  END OBJ(cmus_curtime, 0) obj->callbacks.print = &print_cmus_curtime;\n  END OBJ(cmus_random, 0) obj->callbacks.print = &print_cmus_random;\n  END OBJ(cmus_repeat, 0) obj->callbacks.print = &print_cmus_repeat;\n  END OBJ(cmus_aaa, 0) obj->callbacks.print = &print_cmus_aaa;\n  END OBJ(cmus_track, 0) obj->callbacks.print = &print_cmus_track;\n  END OBJ(cmus_genre, 0) obj->callbacks.print = &print_cmus_genre;\n  END OBJ(cmus_date, 0) obj->callbacks.print = &print_cmus_date;\n  END OBJ(cmus_progress, 0) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &cmus_progress;\n  END OBJ(cmus_percent, 0) obj->callbacks.percentage = &cmus_percent;\n#endif /* BUILD_CMUS */\n#ifdef BUILD_XMMS2\n  END OBJ(xmms2_artist, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_artist;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_album, &update_xmms2) obj->callbacks.print = &print_xmms2_album;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_title, &update_xmms2) obj->callbacks.print = &print_xmms2_title;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_genre, &update_xmms2) obj->callbacks.print = &print_xmms2_genre;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_comment, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_comment;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_url, &update_xmms2) obj->callbacks.print = &print_xmms2_url;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_tracknr, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_tracknr;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_bitrate, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_bitrate;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_date, &update_xmms2) obj->callbacks.print = &print_xmms2_date;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_id, &update_xmms2) obj->callbacks.print = &print_xmms2_id;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_duration, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_duration;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_elapsed, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_elapsed;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_size, &update_xmms2) obj->callbacks.print = &print_xmms2_size;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_status, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_status;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_percent, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_percent;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_bar, &update_xmms2) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &xmms2_barval;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_smart, &update_xmms2) obj->callbacks.print = &print_xmms2_smart;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_playlist, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_playlist;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ(xmms2_timesplayed, &update_xmms2) obj->callbacks.print =\n      &print_xmms2_timesplayed;\n  obj->callbacks.free = &free_xmms2;\n  END OBJ_IF(if_xmms2_connected, &update_xmms2) obj->callbacks.iftest =\n      &if_xmms2_connected;\n  obj->callbacks.free = &free_xmms2;\n#endif /* BUILD_XMMS2 */\n#ifdef BUILD_AUDACIOUS\n  END OBJ(audacious_status, 0) obj->callbacks.print = &print_audacious_status;\n  END OBJ_ARG(audacious_title, 0, \"audacious_title needs an argument\")\n      sscanf(arg, \"%d\", &obj->data.i);\n  if (obj->data.i > 0) {\n    ++obj->data.i;\n  } else {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"audacious_title: invalid length argument\");\n  }\n  obj->callbacks.print = &print_audacious_title;\n  END OBJ(audacious_length, 0) obj->callbacks.print = &print_audacious_length;\n  END OBJ(audacious_length_seconds, 0) obj->callbacks.print =\n      &print_audacious_length_seconds;\n  END OBJ(audacious_position, 0) obj->callbacks.print =\n      &print_audacious_position;\n  END OBJ(audacious_position_seconds, 0) obj->callbacks.print =\n      &print_audacious_position_seconds;\n  END OBJ(audacious_bitrate, 0) obj->callbacks.print = &print_audacious_bitrate;\n  END OBJ(audacious_frequency, 0) obj->callbacks.print =\n      &print_audacious_frequency;\n  END OBJ(audacious_channels, 0) obj->callbacks.print =\n      &print_audacious_channels;\n  END OBJ(audacious_filename, 0) obj->callbacks.print =\n      &print_audacious_filename;\n  END OBJ(audacious_playlist_length, 0) obj->callbacks.print =\n      &print_audacious_playlist_length;\n  END OBJ(audacious_playlist_position, 0) obj->callbacks.print =\n      &print_audacious_playlist_position;\n  END OBJ(audacious_main_volume, 0) obj->callbacks.print =\n      &print_audacious_main_volume;\n  END OBJ(audacious_bar, 0) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &audacious_barval;\n#endif /* BUILD_AUDACIOUS */\n#ifdef BUILD_CURL\n  END OBJ_ARG(curl, 0, \"curl needs arguments: <uri> <interval in minutes>\")\n      curl_parse_arg(obj, arg);\n  obj->callbacks.print = &curl_print;\n  obj->callbacks.free = &curl_obj_free;\n  END OBJ(github_notifications, 0) obj->callbacks.print = &print_github;\n#endif /* BUILD_CURL */\n#ifdef BUILD_RSS\n  END OBJ_ARG(rss, 0,\n              \"rss needs arguments: <uri> <interval in minutes> <action> \"\n              \"[act_par] [spaces in front]\") rss_scan_arg(obj, arg);\n  obj->callbacks.print = &rss_print_info;\n  obj->callbacks.free = &rss_free_obj_info;\n#endif /* BUILD_RSS */\n  END OBJ_ARG(lua, nullptr,\n              \"lua needs arguments: <function name> [function parameters]\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_lua;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(\n      lua_parse, nullptr,\n      \"lua_parse needs arguments: <function name> [function parameters]\")\n      obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_lua_parse;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(lua_bar, nullptr,\n              \"lua_bar needs arguments: <height>,<width> <function name> \"\n              \"[function parameters]\") arg = scan_bar(obj, arg, 100);\n  if (arg != nullptr) {\n    obj->data.s = STRNDUP_ARG;\n  } else {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"lua_bar needs arguments: <height>,<width> <function name> \"\n                  \"[function parameters]\");\n  }\n  obj->callbacks.barval = &lua_barval;\n  obj->callbacks.free = &gen_free_opaque;\n#ifdef BUILD_GUI\n  END OBJ_ARG(\n      lua_graph, nullptr,\n      \"lua_graph needs arguments: <function name> [height],[width] [gradient \"\n      \"colour 1] [gradient colour 2] [scale] [-t] [-l]\") auto [buf, skip] =\n      scan_command(arg);\n  scan_graph(obj, arg + skip, 100, FALSE);\n  if (buf != nullptr) {\n    obj->data.s = buf;\n  } else {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"lua_graph needs arguments: <function name> [height],[width] \"\n                  \"[gradient colour 1] [gradient colour 2] [scale] [-t] [-l]\");\n  }\n  obj->callbacks.graphval = &lua_barval;\n  obj->callbacks.free = &gen_free_opaque;\n  END OBJ_ARG(lua_gauge, nullptr,\n              \"lua_gauge needs arguments: <height>,<width> <function name> \"\n              \"[function parameters]\") arg = scan_gauge(obj, arg, 100);\n  if (arg != nullptr) {\n    obj->data.s = STRNDUP_ARG;\n  } else {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"lua_gauge needs arguments: <height>,<width> <function name> \"\n                  \"[function parameters]\");\n  }\n  obj->callbacks.gaugeval = &lua_barval;\n  obj->callbacks.free = &gen_free_opaque;\n#endif /* BUILD_GUI */\n#ifdef BUILD_HDDTEMP\n  END OBJ(hddtemp, &update_hddtemp) if (arg) obj->data.s = STRNDUP_ARG;\n  obj->callbacks.print = &print_hddtemp;\n  obj->callbacks.free = &free_hddtemp;\n#endif /* BUILD_HDDTEMP */\n#ifdef BUILD_PORT_MONITORS\n  END OBJ_ARG(tcp_portmon, &tcp_portmon_update, \"tcp_portmon: needs arguments\")\n      tcp_portmon_init(obj, arg);\n  obj->callbacks.print = &tcp_portmon_action;\n  obj->callbacks.free = &tcp_portmon_free;\n#endif /* BUILD_PORT_MONITORS */\n  END OBJ(entropy_avail, &update_entropy) obj->callbacks.print =\n      &print_entropy_avail;\n  END OBJ(entropy_perc, &update_entropy) obj->callbacks.percentage =\n      &entropy_percentage;\n  END OBJ(entropy_poolsize, &update_entropy) obj->callbacks.print =\n      &print_entropy_poolsize;\n  END OBJ(entropy_bar, &update_entropy) scan_bar(obj, arg, 1);\n  obj->callbacks.barval = &entropy_barval;\n  END OBJ_ARG(blink, nullptr, \"blink needs a argument\") obj->sub =\n      static_cast<text_object *>(malloc(sizeof(struct text_object)));\n  extract_variable_text_internal(obj->sub, arg);\n  obj->callbacks.print = &print_blink;\n  END OBJ_ARG(to_bytes, nullptr, \"to_bytes needs a argument\") obj->sub =\n      static_cast<text_object *>(malloc(sizeof(struct text_object)));\n  extract_variable_text_internal(obj->sub, arg);\n  obj->callbacks.print = &print_to_bytes;\n#ifdef BUILD_CURL\n  END OBJ_ARG(stock, 0, \"stock needs arguments\") stock_parse_arg(obj, arg);\n  obj->callbacks.print = &print_stock;\n  obj->callbacks.free = &free_stock;\n#endif /* BUILD_CURL */\n  END OBJ(scroll, nullptr)\n#ifdef BUILD_GUI\n  /* allocate a follower to reset any color changes */\n#endif /* BUILD_GUI */\n      parse_scroll_arg(obj, arg, free_at_crash, s);\n  obj->callbacks.print = &print_scroll;\n  obj->callbacks.free = &free_scroll;\n  END OBJ(combine, nullptr) try {\n    parse_combine_arg(obj, arg);\n  } catch (combine_needs_2_args_error &e) {\n    free(obj);\n    throw obj_create_error(e.what());\n  }\n  obj->callbacks.print = &print_combine;\n  obj->callbacks.free = &free_combine;\n#ifdef BUILD_NVIDIA\n  END OBJ_ARG(nvidia, 0, \"nvidia needs an argument\") if (set_nvidia_query(\n                                                             obj, arg,\n                                                             text_node_t::\n                                                                 NONSPECIAL)) {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"nvidia: invalid argument\"\n                  \" specified: '%s'\",\n                  arg);\n  }\n  obj->callbacks.print = &print_nvidia_value;\n  obj->callbacks.free = &free_nvidia;\n  END OBJ_ARG(\n      nvidiabar, 0,\n      \"nvidiabar needs an argument\") if (set_nvidia_query(obj, arg,\n                                                          text_node_t::BAR)) {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"nvidiabar: invalid argument\"\n                  \" specified: '%s'\",\n                  arg);\n  }\n  obj->callbacks.barval = &get_nvidia_barval;\n  obj->callbacks.free = &free_nvidia;\n  END OBJ_ARG(\n      nvidiagraph, 0,\n      \"nvidiagraph needs an argument\") if (set_nvidia_query(obj, arg,\n                                                            text_node_t::\n                                                                GRAPH)) {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"nvidiagraph: invalid argument\"\n                  \" specified: '%s'\",\n                  arg);\n  }\n  obj->callbacks.graphval = &get_nvidia_barval;\n  obj->callbacks.free = &free_nvidia;\n  END OBJ_ARG(\n      nvidiagauge, 0,\n      \"nvidiagauge needs an argument\") if (set_nvidia_query(obj, arg,\n                                                            text_node_t::\n                                                                GAUGE)) {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"nvidiagauge: invalid argument\"\n                  \" specified: '%s'\",\n                  arg);\n  }\n  obj->callbacks.gaugeval = &get_nvidia_barval;\n  obj->callbacks.free = &free_nvidia;\n#endif /* BUILD_NVIDIA */\n#ifdef BUILD_APCUPSD\n  END OBJ_ARG(\n      apcupsd, &update_apcupsd,\n      \"apcupsd needs arguments: <host> <port>\") if (apcupsd_scan_arg(arg) !=\n                                                    0) {\n    CRIT_ERR_FREE(obj, free_at_crash, \"apcupsd needs arguments: <host> <port>\");\n  }\n  obj->callbacks.print = &gen_print_nothing;\n  END OBJ(apcupsd_name, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_name;\n  END OBJ(apcupsd_model, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_model;\n  END OBJ(apcupsd_upsmode, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_upsmode;\n  END OBJ(apcupsd_cable, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_cable;\n  END OBJ(apcupsd_status, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_status;\n  END OBJ(apcupsd_linev, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_linev;\n  END OBJ(apcupsd_load, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_load;\n  END OBJ(apcupsd_loadbar, &update_apcupsd) scan_bar(obj, arg, 100);\n  obj->callbacks.barval = &apcupsd_loadbarval;\n#ifdef BUILD_GUI\n  END OBJ(apcupsd_loadgraph, &update_apcupsd) scan_graph(obj, arg, 100, FALSE);\n  obj->callbacks.graphval = &apcupsd_loadbarval;\n  END OBJ(apcupsd_loadgauge, &update_apcupsd) scan_gauge(obj, arg, 100);\n  obj->callbacks.gaugeval = &apcupsd_loadbarval;\n#endif /* BUILD_GUI */\n  END OBJ(apcupsd_charge, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_charge;\n  END OBJ(apcupsd_timeleft, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_timeleft;\n  END OBJ(apcupsd_temp, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_temp;\n  END OBJ(apcupsd_lastxfer, &update_apcupsd) obj->callbacks.print =\n      &print_apcupsd_lastxfer;\n#endif /* BUILD_APCUPSD */\n#ifdef BUILD_JOURNAL\n  END OBJ_ARG(journal, 0, \"journal needs arguments\")\n      init_journal(\"journal\", arg, obj, free_at_crash);\n  obj->callbacks.print = &print_journal;\n  obj->callbacks.free = &free_journal;\n#endif /* BUILD_JOURNAL */\n#ifdef BUILD_PULSEAUDIO\n  END OBJ_IF(if_pa_sink_muted, 0) obj->callbacks.iftest = &puau_muted;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ(pa_sink_description, 0) obj->callbacks.print =\n      &print_puau_sink_description;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ(pa_sink_active_port_name, 0) obj->callbacks.print =\n      &print_puau_sink_active_port_name;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ(pa_sink_active_port_description, 0) obj->callbacks.print =\n      &print_puau_sink_active_port_description;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ(pa_sink_volume, 0) obj->callbacks.percentage = &puau_vol;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ(pa_sink_volumebar, 0) scan_bar(obj, arg, 1);\n  init_pulseaudio(obj);\n  obj->callbacks.barval = &puau_volumebarval;\n  obj->callbacks.free = &free_pulseaudio;\n  END OBJ(pa_card_active_profile, 0) obj->callbacks.print =\n      &print_puau_card_active_profile;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ(pa_card_name, 0) obj->callbacks.print = &print_puau_card_name;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ_IF(if_pa_source_running, 0) obj->callbacks.iftest =\n      &puau_source_running;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n  END OBJ_IF(if_pa_source_muted, 0) obj->callbacks.iftest = &puau_source_muted;\n  obj->callbacks.free = &free_pulseaudio;\n  init_pulseaudio(obj);\n#endif /* BUILD_PULSEAUDIO */\n#ifdef BUILD_INTEL_BACKLIGHT\n  END OBJ(intel_backlight, 0) obj->callbacks.print = &print_intel_backlight;\n  obj->callbacks.free = &free_intel_backlight;\n  init_intel_backlight(obj);\n#endif /* BUILD_INTEL_BACKLIGHT */\n  END {\n    auto *buf = static_cast<char *>(malloc(text_buffer_size.get(*state)));\n\n    NORM_ERR(\"unknown variable '$%s'\", s);\n    snprintf(buf, text_buffer_size.get(*state), \"${%s}\", s);\n    obj_be_plain_text(obj, buf);\n    free(buf);\n  }\n#undef OBJ\n#undef OBJ_IF\n#undef OBJ_ARG\n#undef OBJ_IF_ARG\n#undef __OBJ_HEAD\n#undef __OBJ_IF\n#undef __OBJ_ARG\n#undef END\n\n  return obj;\n}\n\n/*\n * - assumes that *string is '#'\n * - removes the part from '#' to the end of line ('\\n' or '\\0')\n * - it removes the '\\n'\n * - copies the last char into 'char *last' argument, which should be a pointer\n *   to a char rather than a string.\n */\nstatic size_t remove_comment(char *string, char *last) {\n  char *end = string;\n  while (*end != '\\0' && *end != '\\n') { ++end; }\n  if (last != nullptr) { *last = *end; }\n  if (*end == '\\n') { end++; }\n  strfold(string, end - string);\n  return end - string;\n}\n\nsize_t remove_comments(char *string) {\n  char *curplace;\n  size_t folded = 0;\n  for (curplace = string; *curplace != 0; curplace++) {\n    if (*curplace == '\\\\' && *(curplace + 1) == '#') {\n      // strcpy can't be used for overlapping strings\n      strfold(curplace, 1);\n      folded += 1;\n    } else if (*curplace == '#') {\n      folded += remove_comment(curplace, nullptr);\n    }\n  }\n  return folded;\n}\n\nint extract_variable_text_internal(struct text_object *retval,\n                                   const char *const_p) {\n  struct text_object *obj;\n  char *p, *s, *orig_p;\n  long line;\n  void *ifblock_opaque = nullptr;\n  char *tmp_p;\n  char *arg = nullptr;\n  size_t len = 0;\n\n  p = strndup(const_p, max_user_text.get(*state) - 1);\n  while (text_contains_templates(p) != 0) {\n    char *tmp;\n    tmp = find_and_replace_templates(p);\n    free(p);\n    p = tmp;\n  }\n  s = orig_p = p;\n\n  if (static_cast<int>(strcmp(p, const_p) != 0) != 0) {\n    DBGP2(\"replaced all templates in text: input is\\n'%s'\\noutput is\\n'%s'\",\n          const_p, p);\n  } else {\n    DBGP2(\"no templates to replace\");\n  }\n\n  memset(retval, 0, sizeof(struct text_object));\n\n  line = global_text_lines;\n\n  while (*p != 0) {\n    if (*p == '\\n') { line++; }\n    if (*p == '$') {\n      *p = '\\0';\n      obj = create_plain_text(s);\n      if (obj != nullptr) { append_object(retval, obj); }\n      *p = '$';\n      p++;\n      s = p;\n\n      if (*p != '$') {\n        auto *buf = static_cast<char *>(malloc(text_buffer_size.get(*state)));\n        const char *var;\n\n        /* variable is either $foo or ${foo} */\n        if (*p == '{') {\n          unsigned int brl = 1, brr = 0;\n\n          p++;\n          s = p;\n          while ((*p != 0) && brl != brr) {\n            if (*p == '{') { brl++; }\n            if (*p == '}') { brr++; }\n            p++;\n          }\n          p--;\n        } else {\n          s = p;\n          if (*p == '#') { p++; }\n          while ((*p != 0) && ((isalnum(static_cast<unsigned char>(*p)) != 0) ||\n                               *p == '_')) {\n            p++;\n          }\n        }\n\n        /* copy variable to buffer */\n        len = (p - s > static_cast<int>(text_buffer_size.get(*state)) - 1)\n                  ? static_cast<int>(text_buffer_size.get(*state)) - 1\n                  : (p - s);\n        strncpy(buf, s, len);\n        buf[len] = '\\0';\n\n        if (*p == '}') { p++; }\n        s = p;\n\n        /* search for variable in environment */\n\n        var = getenv(buf);\n        if (var != nullptr) {\n          obj = create_plain_text(var);\n          if (obj != nullptr) { append_object(retval, obj); }\n          free(buf);\n          continue;\n        }\n\n        /* if variable wasn't found in environment, use some special */\n\n        arg = nullptr;\n\n        /* split arg */\n        if (strchr(buf, ' ') != nullptr) {\n          arg = strchr(buf, ' ');\n          *arg = '\\0';\n          arg++;\n          while (isspace(static_cast<unsigned char>(*arg)) != 0) { arg++; }\n          if (*arg == 0) { arg = nullptr; }\n        }\n\n        /* lowercase variable name */\n        tmp_p = buf;\n        while (*tmp_p != 0) {\n          *tmp_p = tolower(static_cast<unsigned char>(*tmp_p));\n          tmp_p++;\n        }\n\n        try {\n          obj = construct_text_object(buf, arg, line, &ifblock_opaque, orig_p);\n        } catch (obj_create_error &e) {\n          free(buf);\n          free(orig_p);\n          throw;\n        }\n        if (obj != nullptr) { append_object(retval, obj); }\n        free(buf);\n        continue;\n      }\n      obj = create_plain_text(\"$\");\n      s = p + 1;\n      if (obj != nullptr) { append_object(retval, obj); }\n\n    } else if (*p == '\\\\' && *(p + 1) == '#') {\n      strfold(p, 1);\n    } else if (*p == '#') {\n      char c;\n      if ((remove_comment(p, &c) != 0u) && p >= orig_p && c == '\\n') {\n        /* if remove_comment removed a newline, we need to 'back up' with p */\n        p--;\n      }\n    }\n    p++;\n  }\n  obj = create_plain_text(s);\n  if (obj != nullptr) { append_object(retval, obj); }\n\n  if (ifblock_stack_empty(&ifblock_opaque) == 0) {\n    NORM_ERR(\"one or more $endif's are missing\");\n  }\n\n  free(orig_p);\n  return 0;\n}\n\nvoid extract_object_args_to_sub(struct text_object *obj, const char *args) {\n  obj->sub =\n      static_cast<struct text_object *>(malloc(sizeof(struct text_object)));\n  memset(obj->sub, 0, sizeof(struct text_object));\n  extract_variable_text_internal(obj->sub, args);\n}\n\n/* Frees the list of text objects root points to. */\nvoid free_text_objects(struct text_object *root) {\n  struct text_object *obj;\n\n  if ((root != nullptr) && (root->prev != nullptr)) {\n    for (obj = root->prev; obj != nullptr; obj = root->prev) {\n      root->prev = obj->prev;\n      if (obj->callbacks.free != nullptr) { (*obj->callbacks.free)(obj); }\n      free_text_objects(obj->sub);\n      free_and_zero(obj->sub);\n      free_and_zero(obj->special_data);\n      delete obj->cb_handle;\n\n      free(obj);\n    }\n  }\n}\n"
  },
  {
    "path": "src/core.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _CONKY_CORE_H_\n#define _CONKY_CORE_H_\n\n#include \"conky.h\"\n\nstruct text_object *construct_text_object(const char *s, const char *arg,\n                                          long line, void **ifblock_opaque,\n                                          void *free_at_crash);\n\nsize_t remove_comments(char *string);\n\nint extract_variable_text_internal(struct text_object *retval,\n                                   const char *const_p);\n\nvoid free_text_objects(struct text_object *root);\n\nconst char *dev_name(const char *);\n\n#endif /* _CONKY_CORE_H_ */\n"
  },
  {
    "path": "src/data/audio/audacious.cc",
    "content": "/*\n *\n * audacious.c:  conky support for audacious music player\n *\n * Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n\n#include <config.h>\n\n#include <cmath>\n\n#include <mutex>\n#include \"audacious.h\"\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../update-cb.hh\"\n\n#include <glib.h>\n#ifdef NEW_AUDACIOUS_FOUND\n#include <audacious/audctrl.h>\n#include <audacious/dbus.h>\n#include <glib-object.h>\n#else /* NEW_AUDACIOUS_FOUND */\n#include <audacious/beepctrl.h>\n#define audacious_remote_is_running(x) xmms_remote_is_running(x)\n#define audacious_remote_is_paused(x) xmms_remote_is_paused(x)\n#define audacious_remote_is_playing(x) xmms_remote_is_playing(x)\n#define audacious_remote_get_playlist_pos(x) xmms_remote_get_playlist_pos(x)\n#define audacious_remote_get_playlist_title(x, y) \\\n  xmms_remote_get_playlist_title(x, y)\n#define audacious_remote_get_playlist_time(x, y) \\\n  xmms_remote_get_playlist_time(x, y)\n#define audacious_remote_get_output_time(x) xmms_remote_get_output_time(x)\n#define audacious_remote_get_info(w, x, y, z) xmms_remote_get_info(w, x, y, z)\n#define audacious_remote_get_playlist_file(x, y) \\\n  xmms_remote_get_playlist_file(x, y)\n#define audacious_remote_get_playlist_length(x) \\\n  xmms_remote_get_playlist_length(x)\n#endif /* NEW_AUDACIOUS_FOUND */\n\nnamespace {\n\nenum aud_status { AS_NOT_RUNNING, AS_PAUSED, AS_PLAYING, AS_STOPPED };\nconst char *const as_message[] = {\"Not running\", \"Paused\", \"Playing\",\n                                  \"Stopped\"};\n\nstruct aud_result {\n  std::string title;\n  std::string filename;\n  int length;    // in ms\n  int position;  // in ms\n  int bitrate;\n  int frequency;\n  int channels;\n  int playlist_length;\n  int playlist_position;\n  int main_volume;\n  aud_status status;\n\n  aud_result()\n      : length(0),\n        position(0),\n        bitrate(0),\n        frequency(0),\n        channels(0),\n        playlist_length(0),\n        playlist_position(0),\n        main_volume(0),\n        status(AS_NOT_RUNNING) {}\n};\n\nclass audacious_cb : public conky::callback<aud_result> {\n  typedef conky::callback<aud_result> Base;\n\n#ifdef NEW_AUDACIOUS_FOUND\n  DBusGProxy *session;\n#else\n  gint session;\n#endif\n\n protected:\n  virtual void work();\n\n public:\n  audacious_cb(uint32_t period) : Base(period, false, Tuple()) {\n#ifdef NEW_AUDACIOUS_FOUND\n    DBusGConnection *connection = dbus_g_bus_get(DBUS_BUS_SESSION, nullptr);\n    if (!connection)\n      throw std::runtime_error(\"unable to establish dbus connection\");\n\n    session = dbus_g_proxy_new_for_name(connection, AUDACIOUS_DBUS_SERVICE,\n                                        AUDACIOUS_DBUS_PATH,\n                                        AUDACIOUS_DBUS_INTERFACE);\n    if (!session) throw std::runtime_error(\"unable to create dbus proxy\");\n#else\n    session = 0;\n#endif /* NEW_AUDACIOUS_FOUND */\n  }\n\n#ifdef NEW_AUDACIOUS_FOUND\n  ~audacious_cb() {\n    /* release reference to dbus proxy */\n    g_object_unref(session);\n  }\n#endif\n};\n\n/* ---------------------------------------------------\n * Worker thread function for audacious data sampling.\n * --------------------------------------------------- */\nvoid audacious_cb::work() {\n  aud_result tmp;\n  gchar *psong, *pfilename;\n  psong = nullptr;\n  pfilename = nullptr;\n\n  do {\n    if (!audacious_remote_is_running(session)) {\n      tmp.status = AS_NOT_RUNNING;\n      break;\n    }\n\n    /* Player status */\n    if (audacious_remote_is_paused(session)) {\n      tmp.status = AS_PAUSED;\n    } else if (audacious_remote_is_playing(session)) {\n      tmp.status = AS_PLAYING;\n    } else {\n      tmp.status = AS_STOPPED;\n    }\n\n    /* Current song title */\n    tmp.playlist_position = audacious_remote_get_playlist_pos(session);\n    psong = audacious_remote_get_playlist_title(session, tmp.playlist_position);\n    if (psong) {\n      tmp.title = psong;\n      g_free(psong);\n    }\n\n    /* Current song length */\n    tmp.length =\n        audacious_remote_get_playlist_time(session, tmp.playlist_position);\n\n    /* Current song position */\n    tmp.position = audacious_remote_get_output_time(session);\n\n    /* Current song bitrate, frequency, channels */\n    audacious_remote_get_info(session, &tmp.bitrate, &tmp.frequency,\n                              &tmp.channels);\n\n    /* Current song filename */\n    pfilename =\n        audacious_remote_get_playlist_file(session, tmp.playlist_position);\n    if (pfilename) {\n      tmp.filename = pfilename;\n      g_free(pfilename);\n    }\n\n    /* Length of the Playlist (number of songs) */\n    tmp.playlist_length = audacious_remote_get_playlist_length(session);\n\n    /* Main volume */\n    tmp.main_volume = audacious_remote_get_main_volume(session);\n  } while (0);\n  {\n    /* Deliver the refreshed items array to audacious_items. */\n    std::lock_guard<std::mutex> lock(result_mutex);\n    result = tmp;\n  }\n}\n\naud_result get_res() {\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()), 1l);\n  return conky::register_cb<audacious_cb>(period)->get_result_copy();\n}\n}  // namespace\n\nvoid print_audacious_status(struct text_object *, char *p,\n                            unsigned int p_max_size) {\n  const aud_result &res = get_res();\n  snprintf(p, p_max_size, \"%s\", as_message[res.status]);\n}\n\nvoid print_audacious_title(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  snprintf(p, std::min((unsigned int)obj->data.i, p_max_size), \"%s\",\n           get_res().title.c_str());\n}\n\nvoid print_audacious_filename(struct text_object *obj, char *p,\n                              unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%s\",\n           get_res().filename.c_str());\n}\n\ndouble audacious_barval(struct text_object *) {\n  const aud_result &res = get_res();\n  return (double)res.position / res.length;\n}\n\nvoid print_audacious_length(struct text_object *, char *p,\n                            unsigned int p_max_size) {\n  const aud_result &res = get_res();\n  int sec = res.length / 1000;\n  snprintf(p, p_max_size, \"%d:%.2d\", sec / 60, sec % 60);\n}\n\nvoid print_audacious_length_seconds(struct text_object *, char *p,\n                                    unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().length);\n}\n\nvoid print_audacious_position(struct text_object *, char *p,\n                              unsigned int p_max_size) {\n  const aud_result &res = get_res();\n  int sec = res.position / 1000;\n  snprintf(p, p_max_size, \"%d:%.2d\", sec / 60, sec % 60);\n}\n\nvoid print_audacious_position_seconds(struct text_object *, char *p,\n                                      unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().position);\n}\n\nvoid print_audacious_bitrate(struct text_object *, char *p,\n                             unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().bitrate);\n}\n\nvoid print_audacious_frequency(struct text_object *, char *p,\n                               unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().frequency);\n}\n\nvoid print_audacious_channels(struct text_object *, char *p,\n                              unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().channels);\n}\n\nvoid print_audacious_playlist_length(struct text_object *, char *p,\n                                     unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().playlist_length);\n}\n\nvoid print_audacious_playlist_position(struct text_object *, char *p,\n                                       unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().playlist_position + 1);\n}\n\nvoid print_audacious_main_volume(struct text_object *, char *p,\n                                 unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%d\", get_res().main_volume);\n}\n"
  },
  {
    "path": "src/data/audio/audacious.h",
    "content": "/*\n *\n * audacious.h:  conky support for audacious music player\n *\n * Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n\n#ifndef AUDACIOUS_H\n#define AUDACIOUS_H\n\nvoid print_audacious_status(struct text_object *, char *, unsigned int);\nvoid print_audacious_title(struct text_object *, char *, unsigned int);\nvoid print_audacious_length(struct text_object *, char *, unsigned int);\nvoid print_audacious_length_seconds(struct text_object *, char *, unsigned int);\nvoid print_audacious_position(struct text_object *, char *, unsigned int);\nvoid print_audacious_position_seconds(struct text_object *, char *,\n                                      unsigned int);\nvoid print_audacious_bitrate(struct text_object *, char *, unsigned int);\nvoid print_audacious_frequency(struct text_object *, char *, unsigned int);\nvoid print_audacious_channels(struct text_object *, char *, unsigned int);\nvoid print_audacious_filename(struct text_object *, char *, unsigned int);\nvoid print_audacious_playlist_length(struct text_object *, char *,\n                                     unsigned int);\nvoid print_audacious_playlist_position(struct text_object *, char *,\n                                       unsigned int);\nvoid print_audacious_main_volume(struct text_object *, char *, unsigned int);\ndouble audacious_barval(struct text_object *);\n\n#endif /* AUDACIOUS_H */\n"
  },
  {
    "path": "src/data/audio/cmus.cc",
    "content": "/*\n *\n * CMUS Conky integration\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2008, Henri Häkkinen\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\n#include <math.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <cmath>\n#include <mutex>\n\n#include \"../../update-cb.hh\"\n\nnamespace {\nstruct cmus_result {\n  std::string state;\n  std::string file;\n  std::string title;\n  std::string artist;\n  std::string album;\n  std::string totaltime;\n  std::string curtime;\n  std::string random;\n  std::string repeat;\n  std::string aaa;\n  std::string track;\n  std::string genre;\n  std::string date;\n  float progress;\n  float timeleft;\n};\n\nclass cmus_cb : public conky::callback<cmus_result> {\n  typedef conky::callback<cmus_result> Base;\n\n protected:\n  virtual void work();\n\n public:\n  explicit cmus_cb(uint32_t period) : Base(period, false, Tuple()) {}\n};\n\nvoid cmus_cb::work() {\n  cmus_result cmus;\n  FILE *fp;\n\n  fp = popen(\"cmus-remote -Q 2>/dev/null\", \"r\");\n  if (!fp) {\n    cmus.state = \"Can't run 'cmus-remote -Q'\";\n  } else {\n    while (1) {\n      char line[255];\n      char *p;\n\n      /* Read a line from the pipe and strip the possible '\\n'. */\n      if (!fgets(line, 255, fp)) break;\n      if ((p = strrchr(line, '\\n'))) *p = '\\0';\n\n      /* Parse infos. */\n      if (strncmp(line, \"status \", 7) == 0) {\n        cmus.state = line + 7;\n\n      } else if (strncmp(line, \"file \", 5) == 0) {\n        cmus.file = line + 5;\n\n      } else if (strncmp(line, \"tag artist \", 11) == 0) {\n        cmus.artist = line + 11;\n\n      } else if (strncmp(line, \"tag title \", 10) == 0) {\n        cmus.title = line + 10;\n\n      } else if (strncmp(line, \"tag album \", 10) == 0) {\n        cmus.album = line + 10;\n\n      } else if (strncmp(line, \"duration \", 9) == 0) {\n        cmus.totaltime = line + 9;\n\n      } else if (strncmp(line, \"position \", 9) == 0) {\n        cmus.curtime = line + 9;\n        cmus.timeleft = strtol(cmus.totaltime.c_str(), nullptr, 10) -\n                        strtol(cmus.curtime.c_str(), nullptr, 10);\n        if (cmus.curtime.size() > 0) {\n          cmus.progress =\n              static_cast<float>(strtol(cmus.curtime.c_str(), nullptr, 10)) /\n              strtol(cmus.totaltime.c_str(), nullptr, 10);\n        } else {\n          cmus.progress = 0;\n        }\n      }\n\n      else if (strncmp(line, \"set shuffle \", 12) == 0) {\n        cmus.random = (strncmp(line + 12, \"true\", 4) == 0 ? \"on\" : \"off\");\n\n      } else if (strncmp(line, \"set repeat \", 11) == 0) {\n        cmus.repeat = (strncmp((line + 11), \"true\", 4) == 0 ? \"all\" : \"off\");\n\n      } else if (strncmp(line, \"set repeat_current \", 19) == 0) {\n        cmus.repeat =\n            (strncmp((line + 19), \"true\", 4) == 0 ? \"song\" : cmus.repeat);\n      } else if (strncmp(line, \"set aaa_mode \", 13) == 0) {\n        cmus.aaa = line + 13;\n\n      } else if (strncmp(line, \"tag tracknumber \", 16) == 0) {\n        cmus.track = line + 16;\n      } else if (strncmp(line, \"tag genre \", 10) == 0) {\n        cmus.genre = line + 10;\n      } else if (strncmp(line, \"tag date \", 9) == 0) {\n        cmus.date = line + 9;\n      }\n    }\n  }\n\n  pclose(fp);\n\n  std::lock_guard<std::mutex> l(result_mutex);\n  result = cmus;\n}\n}  // namespace\n\n#define CMUS_PRINT_GENERATOR(type, alt)                                       \\\n  void print_cmus_##type(struct text_object *obj, char *p,                    \\\n                         unsigned int p_max_size) {                           \\\n    (void)obj;                                                                \\\n    uint32_t period = std::max(                                               \\\n        lround(music_player_interval.get(*state) / active_update_interval()), \\\n        1l);                                                                  \\\n    const cmus_result &cmus =                                                 \\\n        conky::register_cb<cmus_cb>(period)->get_result_copy();               \\\n    snprintf(p, p_max_size, \"%s\",                                             \\\n             (cmus.type.length() ? cmus.type.c_str() : alt));                 \\\n  }\n\nCMUS_PRINT_GENERATOR(state, \"Off\")\nCMUS_PRINT_GENERATOR(file, \"no file\")\nCMUS_PRINT_GENERATOR(title, \"no title\")\nCMUS_PRINT_GENERATOR(artist, \"no artist\")\nCMUS_PRINT_GENERATOR(album, \"no album\")\nCMUS_PRINT_GENERATOR(random, \"\")\nCMUS_PRINT_GENERATOR(repeat, \"\")\nCMUS_PRINT_GENERATOR(aaa, \"all\")\nCMUS_PRINT_GENERATOR(track, \"no track\")\nCMUS_PRINT_GENERATOR(genre, \"\")\nCMUS_PRINT_GENERATOR(date, \"\")\n\nuint8_t cmus_percent(struct text_object *obj) {\n  (void)obj;\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()), 1l);\n  const cmus_result &cmus =\n      conky::register_cb<cmus_cb>(period)->get_result_copy();\n  return static_cast<uint8_t>(round(cmus.progress * 100.0f));\n}\n\ndouble cmus_progress(struct text_object *obj) {\n  (void)obj;\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()), 1l);\n  const cmus_result &cmus =\n      conky::register_cb<cmus_cb>(period)->get_result_copy();\n  return static_cast<double>(cmus.progress);\n}\n\nvoid print_cmus_totaltime(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  (void)obj;\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()), 1l);\n  const cmus_result &cmus =\n      conky::register_cb<cmus_cb>(period)->get_result_copy();\n  format_seconds_short(p, p_max_size,\n                       strtol(cmus.totaltime.c_str(), nullptr, 10));\n}\n\nvoid print_cmus_timeleft(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  (void)obj;\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()), 1l);\n  const cmus_result &cmus =\n      conky::register_cb<cmus_cb>(period)->get_result_copy();\n  format_seconds_short(p, p_max_size, static_cast<long>(cmus.timeleft));\n}\n\nvoid print_cmus_curtime(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  (void)obj;\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()), 1l);\n  const cmus_result &cmus =\n      conky::register_cb<cmus_cb>(period)->get_result_copy();\n  format_seconds_short(p, p_max_size,\n                       strtol(cmus.curtime.c_str(), nullptr, 10));\n}\n\n#undef CMUS_PRINT_GENERATOR\n"
  },
  {
    "path": "src/data/audio/cmus.h",
    "content": "/*\n *\n * CMUS Conky integration\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2011, Christian Brabandt <cb@256bit.org>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef CMUS_H_\n#define CMUS_H_\n\nvoid print_cmus_state(struct text_object *, char *, unsigned int);\nvoid print_cmus_file(struct text_object *, char *, unsigned int);\nvoid print_cmus_title(struct text_object *, char *, unsigned int);\nvoid print_cmus_artist(struct text_object *, char *, unsigned int);\nvoid print_cmus_album(struct text_object *, char *, unsigned int);\nvoid print_cmus_totaltime(struct text_object *, char *, unsigned int);\nvoid print_cmus_timeleft(struct text_object *, char *, unsigned int);\nvoid print_cmus_curtime(struct text_object *, char *, unsigned int);\nvoid print_cmus_random(struct text_object *, char *, unsigned int);\nvoid print_cmus_repeat(struct text_object *, char *, unsigned int);\nvoid print_cmus_aaa(struct text_object *, char *, unsigned int);\nvoid print_cmus_track(struct text_object *, char *, unsigned int);\nvoid print_cmus_genre(struct text_object *, char *, unsigned int);\nvoid print_cmus_date(struct text_object *, char *, unsigned int);\nvoid print_cmus_bar(struct text_object *, char *, unsigned int);\ndouble cmus_progress(struct text_object *obj);\nuint8_t cmus_percent(struct text_object *obj);\n\n#endif /* CMUS_H_ */\n"
  },
  {
    "path": "src/data/audio/libmpdclient.cc",
    "content": "/*\n *\n * libmpdclient\n * (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)\n * This project's homepage is: http://www.musicpd.org\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * - Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * - Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * - Neither the name of the Music Player Daemon nor the names of its\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\n */\n\n#include \"libmpdclient.h\"\n#include \"../../conky.h\"\n\n#include <fcntl.h>\n#include <sys/param.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include <cctype>\n#include <cerrno>\n#include <climits>\n\n#ifdef WIN32\n#include <winsock.h>\n#include <ws2tcpip.h>\n#else\n#include <arpa/inet.h>\n#include <netdb.h>\n#include <netinet/in.h>\n#include <sys/socket.h>\n#include <sys/un.h>\n#endif\n\n#ifndef SUN_LEN\n#define SUN_LEN(a) sizeof(a)\n#endif\n\n#ifndef SOCK_CLOEXEC\n#define SOCK_CLOEXEC O_CLOEXEC\n#endif /* SOCK_CLOEXEC */\n\n/* (bits + 1) / 3 (plus the sign character) */\n#define INTLEN ((sizeof(int) * CHAR_BIT + 1) / 3 + 1)\n#define LONGLONGLEN ((sizeof(long long) * CHAR_BIT + 1) / 3 + 1)\n\n#define COMMAND_LIST 1\n#define COMMAND_LIST_OK 2\n\n#ifndef MPD_NO_GAI\n#ifdef AI_ADDRCONFIG\n#define MPD_HAVE_GAI\n#endif\n#endif\n\n#ifndef MSG_DONTWAIT\n#define MSG_DONTWAIT 0\n#endif\n\n#ifdef WIN32\n#define SELECT_ERRNO_IGNORE (errno == WSAEINTR || errno == WSAEINPROGRESS)\n#define SENDRECV_ERRNO_IGNORE SELECT_ERRNO_IGNORE\n#else\n#define SELECT_ERRNO_IGNORE (errno == EINTR)\n#define SENDRECV_ERRNO_IGNORE (errno == EINTR || errno == EAGAIN)\n#define winsock_dll_error(c) 0\n#define closesocket(s) close(s)\n#define WSACleanup() \\\n  do { /* nothing */ \\\n  } while (0)\n#endif\n\n#ifdef WIN32\nstatic int winsock_dll_error(mpd_Connection *connection) {\n  WSADATA wsaData;\n\n  if ((WSAStartup(MAKEWORD(2, 2), &wsaData)) != 0 ||\n      LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) {\n    strncpy(connection->errorStr, \"Could not find usable WinSock DLL.\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = MPD_ERROR_SYSTEM;\n    return 1;\n  }\n  return 0;\n}\n\nstatic int do_connect_fail(mpd_Connection *connection,\n                           const struct sockaddr *serv_addr, int addrlen) {\n  int iMode = 1; /* 0 = blocking, else non-blocking */\n\n  ioctlsocket(connection->sock, FIONBIO, (u_long FAR *)&iMode);\n  return (connect(connection->sock, serv_addr, addrlen) == SOCKET_ERROR &&\n          WSAGetLastError() != WSAEWOULDBLOCK);\n}\n#else  /* !WIN32 (sane operating systems) */\nstatic int do_connect_fail(mpd_Connection *connection,\n                           const struct sockaddr *serv_addr, int addrlen) {\n  int flags = fcntl(connection->sock, F_GETFL, 0);\n\n  fcntl(connection->sock, F_SETFL, flags | O_NONBLOCK);\n  return static_cast<int>(connect(connection->sock, serv_addr, addrlen) < 0 &&\n                          errno != EINPROGRESS);\n}\n#endif /* !WIN32 */\n\nstatic int uds_connect(mpd_Connection *connection, const char *host,\n                       float timeout) {\n  struct sockaddr_un addr {};\n\n  strncpy(addr.sun_path, host, sizeof(addr.sun_path) - 1);\n  addr.sun_family = AF_UNIX;\n  addr.sun_path[sizeof(addr.sun_path) - 1] = 0;\n  connection->sock = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);\n\n  if (connection->sock < 0) {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"problems creating socket: %s\", strerror(errno));\n    connection->error = MPD_ERROR_SYSTEM;\n    return -1;\n  }\n\n  mpd_setConnectionTimeout(connection, timeout);\n\n  /* connect stuff */\n  if (do_connect_fail(connection, reinterpret_cast<struct sockaddr *>(&addr),\n                      SUN_LEN(&addr)) != 0) {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"problems connecting socket: %s\", strerror(errno));\n    closesocket(connection->sock);\n    connection->sock = -1;\n    connection->error = MPD_ERROR_SYSTEM;\n    return -1;\n  }\n\n  return 0;\n}\n\n#ifdef MPD_HAVE_GAI\nstatic int mpd_connect(mpd_Connection *connection, const char *host, int port,\n                       float timeout) {\n  int error;\n  char service[INTLEN + 1];\n  struct addrinfo hints {};\n  struct addrinfo *res = nullptr;\n  struct addrinfo *addrinfo = nullptr;\n\n  if (*host == '/') { return uds_connect(connection, host, timeout); }\n\n  /* Setup hints */\n  hints.ai_flags = AI_ADDRCONFIG;\n  hints.ai_family = AF_UNSPEC;\n  hints.ai_socktype = SOCK_STREAM;\n  hints.ai_protocol = IPPROTO_TCP;\n  hints.ai_addrlen = 0;\n  hints.ai_addr = nullptr;\n  hints.ai_canonname = nullptr;\n  hints.ai_next = nullptr;\n\n  snprintf(service, sizeof(service), \"%i\", port);\n\n  error = getaddrinfo(host, service, &hints, &addrinfo);\n\n  if (error != 0) {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"host \\\"%s\\\" not found: %s\", host, gai_strerror(error));\n    connection->error = MPD_ERROR_UNKHOST;\n    return -1;\n  }\n\n  for (res = addrinfo; res != nullptr; res = res->ai_next) {\n    /* create socket */\n    if (connection->sock > -1) { closesocket(connection->sock); }\n    connection->sock =\n        socket(res->ai_family, SOCK_STREAM | SOCK_CLOEXEC, res->ai_protocol);\n    if (connection->sock < 0) {\n      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n               \"problems creating socket: %s\", strerror(errno));\n      connection->error = MPD_ERROR_SYSTEM;\n      freeaddrinfo(addrinfo);\n      return -1;\n    }\n\n    mpd_setConnectionTimeout(connection, timeout);\n\n    /* connect stuff */\n    if (do_connect_fail(connection, res->ai_addr, res->ai_addrlen) != 0) {\n      /* try the next address family */\n      closesocket(connection->sock);\n      connection->sock = -1;\n      continue;\n    }\n  }\n\n  freeaddrinfo(addrinfo);\n\n  if (connection->sock < 0) {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"problems connecting to \\\"%s\\\" on port %i: %s\", host, port,\n             strerror(errno));\n    connection->error = MPD_ERROR_CONNPORT;\n\n    return -1;\n  }\n\n  return 0;\n}\n#else /* !MPD_HAVE_GAI */\nstatic int mpd_connect(mpd_Connection *connection, const char *host, int port,\n                       float timeout) {\n  struct hostent he, *he_res = 0;\n  int he_errno;\n  char hostbuff[2048];\n  struct sockaddr *dest;\n  int destlen;\n  struct sockaddr_in sin;\n\n  if (*host == '/') return uds_connect(connection, host, timeout);\n\n#ifdef HAVE_GETHOSTBYNAME_R\n  if (gethostbyname_r(host, &he, hostbuff, sizeof(hostbuff), &he_res,\n                      &he_errno)) {  // get the host info\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH, \"%s ('%s')\",\n             hstrerror(h_errno), host);\n    connection->error = MPD_ERROR_UNKHOST;\n    return -1;\n  }\n#else  /* HAVE_GETHOSTBYNAME_R */\n  if (!(he_res = gethostbyname(host))) {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"host \\\"%s\\\" not found\", host);\n    connection->error = MPD_ERROR_UNKHOST;\n    return -1;\n  }\n#endif /* HAVE_GETHOSTBYNAME_R */\n\n  memset(&sin, 0, sizeof(struct sockaddr_in));\n  /* dest.sin_family = he_res->h_addrtype; */\n  sin.sin_family = AF_INET;\n  sin.sin_port = htons(port);\n\n  switch (he_res->h_addrtype) {\n    case AF_INET:\n      memcpy((char *)&sin.sin_addr.s_addr, (char *)he_res->h_addr,\n             he_res->h_length);\n      dest = (struct sockaddr *)&sin;\n      destlen = sizeof(struct sockaddr_in);\n      break;\n    default:\n      strncpy(connection->errorStr, \"address type is not IPv4\",\n              MPD_ERRORSTR_MAX_LENGTH);\n      connection->error = MPD_ERROR_SYSTEM;\n      return -1;\n      break;\n  }\n\n  if (connection->sock > -1) { closesocket(connection->sock); }\n  if ((connection->sock = socket(dest->sa_family, SOCK_STREAM, 0)) < 0) {\n    strncpy(connection->errorStr, \"problems creating socket\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = MPD_ERROR_SYSTEM;\n    return -1;\n  }\n\n  mpd_setConnectionTimeout(connection, timeout);\n\n  /* connect stuff */\n  if (do_connect_fail(connection, dest, destlen)) {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"problems connecting to \\\"%s\\\" on port %i\", host, port);\n    connection->error = MPD_ERROR_CONNPORT;\n    return -1;\n  }\n\n  return 0;\n}\n#endif /* !MPD_HAVE_GAI */\n\nconst char *mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES] = {\n    \"Artist\",   \"Album\",     \"Title\",   \"Track\", \"Name\",     \"Genre\", \"Date\",\n    \"Composer\", \"Performer\", \"Comment\", \"Disc\",  \"Filename\", \"Any\"};\n\nstatic char *mpd_sanitizeArg(const char *arg) {\n  size_t i;\n  char *ret;\n  const char *c;\n  char *rc;\n\n  /* instead of counting in that loop above,\n   * just use a bit more memory and halve running time */\n  ret = static_cast<char *>(malloc(strlen(arg) * 2 + 1));\n\n  c = arg;\n  rc = ret;\n  for (i = strlen(arg) + 1; i != 0; --i) {\n    if (*c == '\"' || *c == '\\\\') { *rc++ = '\\\\'; }\n    *(rc++) = *(c++);\n  }\n\n  return ret;\n}\n\nstatic mpd_ReturnElement *mpd_newReturnElement(const char *name,\n                                               const char *value) {\n  auto *ret =\n      static_cast<mpd_ReturnElement *>(malloc(sizeof(mpd_ReturnElement)));\n\n  ret->name = strndup(name, text_buffer_size.get(*state));\n  ret->value = strndup(value, text_buffer_size.get(*state));\n\n  return ret;\n}\n\nstatic void mpd_freeReturnElement(mpd_ReturnElement *re) {\n  free(re->name);\n  free(re->value);\n  free(re);\n}\n\nvoid mpd_setConnectionTimeout(mpd_Connection *connection, float timeout) {\n  connection->timeout.tv_sec = static_cast<int>(timeout);\n  connection->timeout.tv_usec =\n      static_cast<int>((timeout - connection->timeout.tv_sec) * 1e6 + 0.5);\n}\n\nstatic int mpd_parseWelcome(mpd_Connection *connection, const char *host,\n                            int port, /* char *rt, */ char *output) {\n  char *tmp;\n  char *test;\n  int i;\n\n  if (static_cast<int>(strncmp(output, MPD_WELCOME_MESSAGE,\n                               strlen(MPD_WELCOME_MESSAGE)) != 0) != 0) {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"mpd not running on port %i on host \\\"%s\\\"\", port, host);\n    connection->error = MPD_ERROR_NOTMPD;\n    return 1;\n  }\n\n  tmp = &output[strlen(MPD_WELCOME_MESSAGE)];\n\n  for (i = 0; i < 3; i++) {\n    if (tmp != nullptr) { connection->version[i] = strtol(tmp, &test, 10); }\n\n    if ((tmp == nullptr) || (test[0] != '.' && test[0] != '\\0')) {\n      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n               \"error parsing version number at \\\"%s\\\"\",\n               &output[strlen(MPD_WELCOME_MESSAGE)]);\n      connection->error = MPD_ERROR_NOTMPD;\n      return 1;\n    }\n    tmp = ++test;\n  }\n\n  return 0;\n}\n\nmpd_Connection *mpd_newConnection(const char *host, int port, float timeout) {\n  int err;\n  char *rt;\n  char *output = nullptr;\n  auto *connection =\n      static_cast<mpd_Connection *>(malloc(sizeof(mpd_Connection)));\n  struct timeval tv {};\n  fd_set fds;\n\n  strncpy(connection->buffer, \"\", 1);\n  connection->buflen = 0;\n  connection->bufstart = 0;\n  strncpy(connection->errorStr, \"\", MPD_ERRORSTR_MAX_LENGTH);\n  connection->error = 0;\n  connection->doneProcessing = 0;\n  connection->commandList = 0;\n  connection->listOks = 0;\n  connection->doneListOk = 0;\n  connection->sock = -1;\n  connection->returnElement = nullptr;\n  connection->request = nullptr;\n\n  if (winsock_dll_error(connection)) { return connection; }\n\n  if (mpd_connect(connection, host, port, timeout) < 0) { return connection; }\n\n  while ((rt = strstr(connection->buffer, \"\\n\")) == nullptr) {\n    tv.tv_sec = connection->timeout.tv_sec;\n    tv.tv_usec = connection->timeout.tv_usec;\n    FD_ZERO(&fds);\n    FD_SET(connection->sock, &fds);\n    if ((err = select(connection->sock + 1, &fds, nullptr, nullptr, &tv)) ==\n        1) {\n      int readed;\n\n      readed = recv(connection->sock, &(connection->buffer[connection->buflen]),\n                    MPD_BUFFER_MAX_LENGTH - connection->buflen, 0);\n      if (readed <= 0) {\n        snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n                 \"problems getting a response from \\\"%s\\\" on port %i : %s\",\n                 host, port, strerror(errno));\n        connection->error = MPD_ERROR_NORESPONSE;\n        return connection;\n      }\n      connection->buflen += readed;\n      connection->buffer[connection->buflen] = '\\0';\n    } else if (err < 0) {\n      if SELECT_ERRNO_IGNORE { continue; }\n      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n               \"problems connecting to \\\"%s\\\" on port %i\", host, port);\n      connection->error = MPD_ERROR_CONNPORT;\n      return connection;\n    } else {\n      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n               \"timeout in attempting to get a response from \\\"%s\\\" on \"\n               \"port %i\",\n               host, port);\n      connection->error = MPD_ERROR_NORESPONSE;\n      return connection;\n    }\n  }\n\n  *rt = '\\0';\n  output = strndup(connection->buffer, text_buffer_size.get(*state));\n  strncpy(connection->buffer, rt + 1, MPD_BUFFER_MAX_LENGTH);\n  connection->buflen = strlen(connection->buffer);\n\n  if (mpd_parseWelcome(connection, host, port, /* rt, */ output) == 0) {\n    connection->doneProcessing = 1;\n  }\n\n  free(output);\n\n  return connection;\n}\n\nvoid mpd_clearError(mpd_Connection *connection) {\n  connection->error = 0;\n  connection->errorStr[0] = '\\0';\n}\n\nvoid mpd_closeConnection(mpd_Connection *connection) {\n  if (connection != nullptr) {\n    closesocket(connection->sock);\n    free_and_zero(connection->returnElement);\n    free_and_zero(connection->request);\n    free(connection);\n  }\n  WSACleanup();\n}\n\nstatic void mpd_executeCommand(mpd_Connection *connection,\n                               const char *command) {\n  int ret;\n  struct timeval tv {};\n  fd_set fds;\n  const char *commandPtr = command;\n  int commandLen = strlen(command);\n\n  if ((connection->doneProcessing == 0) && (connection->commandList == 0)) {\n    strncpy(connection->errorStr, \"not done processing current command\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  mpd_clearError(connection);\n\n  FD_ZERO(&fds);\n  FD_SET(connection->sock, &fds);\n  tv.tv_sec = connection->timeout.tv_sec;\n  tv.tv_usec = connection->timeout.tv_usec;\n\n  do {\n    ret = static_cast<int>(\n        select(connection->sock + 1, nullptr, &fds, nullptr, &tv));\n    if (ret != 1 && !SELECT_ERRNO_IGNORE) { break; }\n    ret = send(connection->sock, commandPtr, commandLen, MSG_DONTWAIT);\n    if (ret <= 0) {\n      if SENDRECV_ERRNO_IGNORE { continue; }\n      snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n               \"problems giving command \\\"%s\\\"\", command);\n      connection->error = MPD_ERROR_SENDING;\n      return;\n    }\n    commandPtr += ret;\n    commandLen -= ret;\n  } while (commandLen > 0);\n\n  if (commandLen > 0) {\n    perror(\"\");\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"timeout sending command \\\"%s\\\"\", command);\n    connection->error = MPD_ERROR_TIMEOUT;\n    return;\n  }\n\n  if (connection->commandList == 0) {\n    connection->doneProcessing = 0;\n  } else if (connection->commandList == COMMAND_LIST_OK) {\n    connection->listOks++;\n  }\n}\n\nstatic void mpd_getNextReturnElement(mpd_Connection *connection) {\n  char *output = nullptr;\n  char *rt = nullptr;\n  char *name = nullptr;\n  char *value = nullptr;\n  fd_set fds;\n  struct timeval tv {};\n  char *tok = nullptr;\n  int readed;\n  char *bufferCheck = nullptr;\n  int err;\n  int pos;\n\n  if (connection->returnElement != nullptr) {\n    mpd_freeReturnElement(connection->returnElement);\n  }\n  connection->returnElement = nullptr;\n\n  if ((connection->doneProcessing != 0) ||\n      ((connection->listOks != 0) && (connection->doneListOk != 0))) {\n    strncpy(connection->errorStr, \"already done processing current command\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  bufferCheck = connection->buffer + connection->bufstart;\n  while (connection->bufstart >= connection->buflen ||\n         ((rt = strchr(bufferCheck, '\\n')) == nullptr)) {\n    if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) {\n      memmove(connection->buffer, connection->buffer + connection->bufstart,\n              connection->buflen - connection->bufstart + 1);\n      connection->buflen -= connection->bufstart;\n      connection->bufstart = 0;\n    }\n    if (connection->buflen >= MPD_BUFFER_MAX_LENGTH) {\n      strncpy(connection->errorStr, \"buffer overrun\", MPD_ERRORSTR_MAX_LENGTH);\n      connection->error = MPD_ERROR_BUFFEROVERRUN;\n      connection->doneProcessing = 1;\n      connection->doneListOk = 0;\n      return;\n    }\n    bufferCheck = connection->buffer + connection->buflen;\n    tv.tv_sec = connection->timeout.tv_sec;\n    tv.tv_usec = connection->timeout.tv_usec;\n    FD_ZERO(&fds);\n    FD_SET(connection->sock, &fds);\n    if ((err = static_cast<int>(select(connection->sock + 1, &fds, nullptr,\n                                       nullptr, &tv) == 1)) != 0) {\n      readed = recv(connection->sock, connection->buffer + connection->buflen,\n                    MPD_BUFFER_MAX_LENGTH - connection->buflen, MSG_DONTWAIT);\n      if (readed < 0 && SENDRECV_ERRNO_IGNORE) { continue; }\n      if (readed <= 0) {\n        strncpy(connection->errorStr, \"connection closed\",\n                MPD_ERRORSTR_MAX_LENGTH);\n        connection->error = MPD_ERROR_CONNCLOSED;\n        connection->doneProcessing = 1;\n        connection->doneListOk = 0;\n        return;\n      }\n      connection->buflen += readed;\n      connection->buffer[connection->buflen] = '\\0';\n    } else {\n      strncpy(connection->errorStr, \"connection timeout\",\n              MPD_ERRORSTR_MAX_LENGTH);\n      connection->error = MPD_ERROR_TIMEOUT;\n      connection->doneProcessing = 1;\n      connection->doneListOk = 0;\n      return;\n    }\n  }\n\n  *rt = '\\0';\n  output = connection->buffer + connection->bufstart;\n  connection->bufstart = rt - connection->buffer + 1;\n\n  if (strcmp(output, \"OK\") == 0) {\n    if (connection->listOks > 0) {\n      strncpy(connection->errorStr, \"expected more list_OK's\",\n              MPD_ERRORSTR_MAX_LENGTH);\n      connection->error = 1;\n    }\n    connection->listOks = 0;\n    connection->doneProcessing = 1;\n    connection->doneListOk = 0;\n    return;\n  }\n\n  if (strcmp(output, \"list_OK\") == 0) {\n    if (connection->listOks == 0) {\n      strncpy(connection->errorStr, \"got an unexpected list_OK\",\n              MPD_ERRORSTR_MAX_LENGTH);\n      connection->error = 1;\n    } else {\n      connection->doneListOk = 1;\n      connection->listOks--;\n    }\n    return;\n  }\n\n  if (strncmp(output, \"ACK\", strlen(\"ACK\")) == 0) {\n    char *test;\n    char *needle;\n    int val;\n\n    strncpy(connection->errorStr, output, MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = MPD_ERROR_ACK;\n    connection->errorCode = MPD_ACK_ERROR_UNK;\n    connection->errorAt = MPD_ERROR_AT_UNK;\n    connection->doneProcessing = 1;\n    connection->doneListOk = 0;\n\n    needle = strchr(output, '[');\n    if (needle == nullptr) { return; }\n    val = strtol(needle + 1, &test, 10);\n    if (*test != '@') { return; }\n    connection->errorCode = val;\n    val = strtol(test + 1, &test, 10);\n    if (*test != ']') { return; }\n    connection->errorAt = val;\n    return;\n  }\n\n  tok = strchr(output, ':');\n  if (tok == nullptr) { return; }\n  pos = tok - output;\n  value = ++tok;\n  name = output;\n  name[pos] = '\\0';\n\n  if (value[0] == ' ') {\n    connection->returnElement = mpd_newReturnElement(name, &(value[1]));\n  } else {\n    snprintf(connection->errorStr, MPD_ERRORSTR_MAX_LENGTH,\n             \"error parsing: %s:%s\", name, value);\n    connection->error = 1;\n  }\n}\n\nvoid mpd_finishCommand(mpd_Connection *connection) {\n  while ((connection != nullptr) && (connection->doneProcessing == 0)) {\n    if (connection->doneListOk != 0) { connection->doneListOk = 0; }\n    mpd_getNextReturnElement(connection);\n  }\n}\n\nstatic void mpd_finishListOkCommand(mpd_Connection *connection) {\n  while ((connection->doneProcessing == 0) && (connection->listOks != 0) &&\n         (connection->doneListOk == 0)) {\n    mpd_getNextReturnElement(connection);\n  }\n}\n\nint mpd_nextListOkCommand(mpd_Connection *connection) {\n  mpd_finishListOkCommand(connection);\n  if (connection->doneProcessing == 0) { connection->doneListOk = 0; }\n  if (connection->listOks == 0 || (connection->doneProcessing != 0)) {\n    return -1;\n  }\n  return 0;\n}\n\nvoid mpd_sendStatusCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"status\\n\");\n}\n\nmpd_Status *mpd_getStatus(mpd_Connection *connection) {\n  mpd_Status *status;\n\n  /* mpd_executeCommand(connection, \"status\\n\");\n     if (connection->error) {\n     return nullptr;\n     } */\n\n  if ((connection->doneProcessing != 0) ||\n      ((connection->listOks != 0) && (connection->doneListOk != 0))) {\n    return nullptr;\n  }\n\n  if (connection->returnElement == nullptr) {\n    mpd_getNextReturnElement(connection);\n  }\n\n  status = static_cast<mpd_Status *>(malloc(sizeof(mpd_Status)));\n  status->volume = -1;\n  status->repeat = 0;\n  status->random = 0;\n  status->playlist = -1;\n  status->playlistLength = -1;\n  status->state = -1;\n  status->song = 0;\n  status->songid = 0;\n  status->elapsedTime = 0;\n  status->totalTime = 0;\n  status->bitRate = 0;\n  status->sampleRate = 0;\n  status->bits = 0;\n  status->channels = 0;\n  status->crossfade = -1;\n  status->error = nullptr;\n  status->updatingDb = 0;\n\n  if (connection->error != 0) {\n    free(status);\n    return nullptr;\n  }\n  while (connection->returnElement != nullptr) {\n    mpd_ReturnElement *re = connection->returnElement;\n\n    if (strcmp(re->name, \"volume\") == 0) {\n      status->volume = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"repeat\") == 0) {\n      status->repeat = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"random\") == 0) {\n      status->random = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"playlist\") == 0) {\n      status->playlist = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"playlistlength\") == 0) {\n      status->playlistLength = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"bitrate\") == 0) {\n      status->bitRate = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"state\") == 0) {\n      if (strcmp(re->value, \"play\") == 0) {\n        status->state = MPD_STATUS_STATE_PLAY;\n      } else if (strcmp(re->value, \"stop\") == 0) {\n        status->state = MPD_STATUS_STATE_STOP;\n      } else if (strcmp(re->value, \"pause\") == 0) {\n        status->state = MPD_STATUS_STATE_PAUSE;\n      } else {\n        status->state = MPD_STATUS_STATE_UNKNOWN;\n      }\n    } else if (strcmp(re->name, \"song\") == 0) {\n      status->song = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"songid\") == 0) {\n      status->songid = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"time\") == 0) {\n      char *tok = strchr(re->value, ':');\n\n      /* the second strchr below is a safety check */\n      if ((tok != nullptr) && (strchr(tok, 0) > (tok + 1))) {\n        /* strtol stops at the first non-[0-9] char: */\n        status->elapsedTime = strtol(re->value, nullptr, 10);\n        status->totalTime = strtol(tok + 1, nullptr, 10);\n      }\n    } else if (strcmp(re->name, \"error\") == 0) {\n      status->error = strndup(re->value, text_buffer_size.get(*state));\n    } else if (strcmp(re->name, \"xfade\") == 0) {\n      status->crossfade = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"updating_db\") == 0) {\n      status->updatingDb = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"audio\") == 0) {\n      char *tok = strchr(re->value, ':');\n\n      if ((tok != nullptr) && (strchr(tok, 0) > (tok + 1))) {\n        status->sampleRate = strtol(re->value, nullptr, 10);\n        status->bits = strtol(++tok, nullptr, 10);\n        tok = strchr(tok, ':');\n        if ((tok != nullptr) && (strchr(tok, 0) > (tok + 1))) {\n          status->channels = strtol(tok + 1, nullptr, 10);\n        }\n      }\n    }\n\n    mpd_getNextReturnElement(connection);\n    if (connection->error != 0) {\n      free(status);\n      return nullptr;\n    }\n  }\n\n  if (connection->error != 0) {\n    free(status);\n    return nullptr;\n  }\n  if (status->state < 0) {\n    strncpy(connection->errorStr, \"state not found\", MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    free(status);\n    return nullptr;\n  }\n\n  return status;\n}\n\nvoid mpd_freeStatus(mpd_Status *status) {\n  free_and_zero(status->error);\n  free(status);\n}\n\nvoid mpd_sendStatsCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"stats\\n\");\n}\n\nmpd_Stats *mpd_getStats(mpd_Connection *connection) {\n  mpd_Stats *stats;\n\n  /* mpd_executeCommand(connection, \"stats\\n\");\n     if (connection->error) {\n     return nullptr;\n     } */\n\n  if ((connection->doneProcessing != 0) ||\n      ((connection->listOks != 0) && (connection->doneListOk != 0))) {\n    return nullptr;\n  }\n\n  if (connection->returnElement == nullptr) {\n    mpd_getNextReturnElement(connection);\n  }\n\n  stats = static_cast<mpd_Stats *>(malloc(sizeof(mpd_Stats)));\n  stats->numberOfArtists = 0;\n  stats->numberOfAlbums = 0;\n  stats->numberOfSongs = 0;\n  stats->uptime = 0;\n  stats->dbUpdateTime = 0;\n  stats->playTime = 0;\n  stats->dbPlayTime = 0;\n\n  if (connection->error != 0) {\n    free(stats);\n    return nullptr;\n  }\n  while (connection->returnElement != nullptr) {\n    mpd_ReturnElement *re = connection->returnElement;\n\n    if (strcmp(re->name, \"artists\") == 0) {\n      stats->numberOfArtists = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"albums\") == 0) {\n      stats->numberOfAlbums = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"songs\") == 0) {\n      stats->numberOfSongs = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"uptime\") == 0) {\n      stats->uptime = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"db_update\") == 0) {\n      stats->dbUpdateTime = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"playtime\") == 0) {\n      stats->playTime = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"db_playtime\") == 0) {\n      stats->dbPlayTime = strtol(re->value, nullptr, 10);\n    }\n\n    mpd_getNextReturnElement(connection);\n    if (connection->error != 0) {\n      free(stats);\n      return nullptr;\n    }\n  }\n\n  if (connection->error != 0) {\n    free(stats);\n    return nullptr;\n  }\n\n  return stats;\n}\n\nvoid mpd_freeStats(mpd_Stats *stats) { free(stats); }\n\nmpd_SearchStats *mpd_getSearchStats(mpd_Connection *connection) {\n  mpd_SearchStats *stats;\n  mpd_ReturnElement *re;\n\n  if ((connection->doneProcessing != 0) ||\n      ((connection->listOks != 0) && (connection->doneListOk != 0))) {\n    return nullptr;\n  }\n\n  if (connection->returnElement == nullptr) {\n    mpd_getNextReturnElement(connection);\n  }\n\n  if (connection->error != 0) { return nullptr; }\n\n  stats = static_cast<mpd_SearchStats *>(malloc(sizeof(mpd_SearchStats)));\n  stats->numberOfSongs = 0;\n  stats->playTime = 0;\n\n  while (connection->returnElement != nullptr) {\n    re = connection->returnElement;\n\n    if (strcmp(re->name, \"songs\") == 0) {\n      stats->numberOfSongs = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"playtime\") == 0) {\n      stats->playTime = strtol(re->value, nullptr, 10);\n    }\n\n    mpd_getNextReturnElement(connection);\n    if (connection->error != 0) {\n      free(stats);\n      return nullptr;\n    }\n  }\n\n  if (connection->error != 0) {\n    free(stats);\n    return nullptr;\n  }\n\n  return stats;\n}\n\nvoid mpd_freeSearchStats(mpd_SearchStats *stats) { free(stats); }\n\nstatic void mpd_initSong(mpd_Song *song) {\n  song->file = nullptr;\n  song->artist = nullptr;\n  song->albumartist = nullptr;\n  song->album = nullptr;\n  song->track = nullptr;\n  song->title = nullptr;\n  song->name = nullptr;\n  song->date = nullptr;\n  /* added by Qball */\n  song->genre = nullptr;\n  song->composer = nullptr;\n  song->performer = nullptr;\n  song->disc = nullptr;\n  song->comment = nullptr;\n\n  song->time = MPD_SONG_NO_TIME;\n  song->pos = MPD_SONG_NO_NUM;\n  song->id = MPD_SONG_NO_ID;\n}\n\nstatic void mpd_finishSong(mpd_Song *song) {\n  free_and_zero(song->file);\n  free_and_zero(song->artist);\n  free_and_zero(song->albumartist);\n  free_and_zero(song->album);\n  free_and_zero(song->title);\n  free_and_zero(song->track);\n  free_and_zero(song->name);\n  free_and_zero(song->date);\n  free_and_zero(song->genre);\n  free_and_zero(song->composer);\n  free_and_zero(song->disc);\n  free_and_zero(song->comment);\n}\n\nmpd_Song *mpd_newSong() {\n  auto *ret = static_cast<mpd_Song *>(malloc(sizeof(mpd_Song)));\n\n  mpd_initSong(ret);\n\n  return ret;\n}\n\nvoid mpd_freeSong(mpd_Song *song) {\n  mpd_finishSong(song);\n  free(song);\n}\n\nmpd_Song *mpd_songDup(mpd_Song *song) {\n  mpd_Song *ret = mpd_newSong();\n\n  if (song->file != nullptr) {\n    ret->file = strndup(song->file, text_buffer_size.get(*state));\n  }\n  if (song->artist != nullptr) {\n    ret->artist = strndup(song->artist, text_buffer_size.get(*state));\n  }\n  if (song->albumartist != nullptr) {\n    ret->artist = strndup(song->albumartist, text_buffer_size.get(*state));\n  }\n  if (song->album != nullptr) {\n    ret->album = strndup(song->album, text_buffer_size.get(*state));\n  }\n  if (song->title != nullptr) {\n    ret->title = strndup(song->title, text_buffer_size.get(*state));\n  }\n  if (song->track != nullptr) {\n    ret->track = strndup(song->track, text_buffer_size.get(*state));\n  }\n  if (song->name != nullptr) {\n    ret->name = strndup(song->name, text_buffer_size.get(*state));\n  }\n  if (song->date != nullptr) {\n    ret->date = strndup(song->date, text_buffer_size.get(*state));\n  }\n  if (song->genre != nullptr) {\n    ret->genre = strndup(song->genre, text_buffer_size.get(*state));\n  }\n  if (song->composer != nullptr) {\n    ret->composer = strndup(song->composer, text_buffer_size.get(*state));\n  }\n  if (song->disc != nullptr) {\n    ret->disc = strndup(song->disc, text_buffer_size.get(*state));\n  }\n  if (song->comment != nullptr) {\n    ret->comment = strndup(song->comment, text_buffer_size.get(*state));\n  }\n  ret->time = song->time;\n  ret->pos = song->pos;\n  ret->id = song->id;\n\n  return ret;\n}\n\nstatic void mpd_initDirectory(mpd_Directory *directory) {\n  directory->path = nullptr;\n}\n\nstatic void mpd_finishDirectory(mpd_Directory *directory) {\n  free_and_zero(directory->path);\n}\n\nmpd_Directory *mpd_newDirectory() {\n  auto *directory = static_cast<mpd_Directory *>(malloc(sizeof(mpd_Directory)));\n\n  mpd_initDirectory(directory);\n\n  return directory;\n}\n\nvoid mpd_freeDirectory(mpd_Directory *directory) {\n  mpd_finishDirectory(directory);\n\n  free(directory);\n}\n\nmpd_Directory *mpd_directoryDup(mpd_Directory *directory) {\n  mpd_Directory *ret = mpd_newDirectory();\n\n  if (directory->path != nullptr) {\n    ret->path = strndup(directory->path, text_buffer_size.get(*state));\n  }\n\n  return ret;\n}\n\nstatic void mpd_initPlaylistFile(mpd_PlaylistFile *playlist) {\n  playlist->path = nullptr;\n}\n\nstatic void mpd_finishPlaylistFile(mpd_PlaylistFile *playlist) {\n  free_and_zero(playlist->path);\n}\n\nmpd_PlaylistFile *mpd_newPlaylistFile() {\n  auto *playlist =\n      static_cast<mpd_PlaylistFile *>(malloc(sizeof(mpd_PlaylistFile)));\n\n  mpd_initPlaylistFile(playlist);\n\n  return playlist;\n}\n\nvoid mpd_freePlaylistFile(mpd_PlaylistFile *playlist) {\n  mpd_finishPlaylistFile(playlist);\n  free(playlist);\n}\n\nmpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile *playlist) {\n  mpd_PlaylistFile *ret = mpd_newPlaylistFile();\n\n  if (playlist->path != nullptr) {\n    ret->path = strndup(playlist->path, text_buffer_size.get(*state));\n  }\n\n  return ret;\n}\n\nstatic void mpd_initInfoEntity(mpd_InfoEntity *entity) {\n  entity->info.directory = nullptr;\n}\n\nstatic void mpd_finishInfoEntity(mpd_InfoEntity *entity) {\n  if (entity->info.directory != nullptr) {\n    if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) {\n      mpd_freeDirectory(entity->info.directory);\n    } else if (entity->type == MPD_INFO_ENTITY_TYPE_SONG) {\n      mpd_freeSong(entity->info.song);\n    } else if (entity->type == MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) {\n      mpd_freePlaylistFile(entity->info.playlistFile);\n    }\n  }\n}\n\nmpd_InfoEntity *mpd_newInfoEntity() {\n  auto *entity = static_cast<mpd_InfoEntity *>(malloc(sizeof(mpd_InfoEntity)));\n\n  mpd_initInfoEntity(entity);\n\n  return entity;\n}\n\nvoid mpd_freeInfoEntity(mpd_InfoEntity *entity) {\n  mpd_finishInfoEntity(entity);\n  free(entity);\n}\n\nstatic void mpd_sendInfoCommand(mpd_Connection *connection, char *command) {\n  mpd_executeCommand(connection, command);\n}\n\nmpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection *connection) {\n  mpd_InfoEntity *entity = nullptr;\n\n  if ((connection->doneProcessing != 0) ||\n      ((connection->listOks != 0) && (connection->doneListOk != 0))) {\n    return nullptr;\n  }\n\n  if (connection->returnElement == nullptr) {\n    mpd_getNextReturnElement(connection);\n  }\n\n  if (connection->returnElement != nullptr) {\n    if (strcmp(connection->returnElement->name, \"file\") == 0) {\n      entity = mpd_newInfoEntity();\n      entity->type = MPD_INFO_ENTITY_TYPE_SONG;\n      entity->info.song = mpd_newSong();\n      entity->info.song->file = strndup(connection->returnElement->value,\n                                        text_buffer_size.get(*state));\n    } else if (strcmp(connection->returnElement->name, \"directory\") == 0) {\n      entity = mpd_newInfoEntity();\n      entity->type = MPD_INFO_ENTITY_TYPE_DIRECTORY;\n      entity->info.directory = mpd_newDirectory();\n      entity->info.directory->path = strndup(connection->returnElement->value,\n                                             text_buffer_size.get(*state));\n    } else if (strcmp(connection->returnElement->name, \"playlist\") == 0) {\n      entity = mpd_newInfoEntity();\n      entity->type = MPD_INFO_ENTITY_TYPE_PLAYLISTFILE;\n      entity->info.playlistFile = mpd_newPlaylistFile();\n      entity->info.playlistFile->path = strndup(\n          connection->returnElement->value, text_buffer_size.get(*state));\n    } else if (strcmp(connection->returnElement->name, \"cpos\") == 0) {\n      entity = mpd_newInfoEntity();\n      entity->type = MPD_INFO_ENTITY_TYPE_SONG;\n      entity->info.song = mpd_newSong();\n      entity->info.song->pos =\n          strtol(connection->returnElement->value, nullptr, 10);\n    } else {\n      connection->error = 1;\n      strncpy(connection->errorStr, \"problem parsing song info\",\n              MPD_ERRORSTR_MAX_LENGTH);\n      return nullptr;\n    }\n  } else {\n    return nullptr;\n  }\n\n  mpd_getNextReturnElement(connection);\n  while (connection->returnElement != nullptr) {\n    mpd_ReturnElement *re = connection->returnElement;\n\n    if (strcmp(re->name, \"file\") == 0) { return entity; }\n    if (strcmp(re->name, \"directory\") == 0) { return entity; }\n    if (strcmp(re->name, \"playlist\") == 0) { return entity; }\n    if (strcmp(re->name, \"cpos\") == 0) { return entity; }\n\n    if (entity->type == MPD_INFO_ENTITY_TYPE_SONG &&\n        (strlen(re->value) != 0u)) {\n      if ((entity->info.song->artist == nullptr) &&\n          strcmp(re->name, \"Artist\") == 0) {\n        entity->info.song->artist =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->albumartist == nullptr) &&\n                 strcmp(re->name, \"AlbumArtist\") == 0) {\n        entity->info.song->albumartist =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->album == nullptr) &&\n                 strcmp(re->name, \"Album\") == 0) {\n        entity->info.song->album =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->title == nullptr) &&\n                 strcmp(re->name, \"Title\") == 0) {\n        entity->info.song->title =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->track == nullptr) &&\n                 strcmp(re->name, \"Track\") == 0) {\n        entity->info.song->track =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->name == nullptr) &&\n                 strcmp(re->name, \"Name\") == 0) {\n        entity->info.song->name =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if (entity->info.song->time == MPD_SONG_NO_TIME &&\n                 strcmp(re->name, \"Time\") == 0) {\n        entity->info.song->time = strtol(re->value, nullptr, 10);\n      } else if (entity->info.song->pos == MPD_SONG_NO_NUM &&\n                 strcmp(re->name, \"Pos\") == 0) {\n        entity->info.song->pos = strtol(re->value, nullptr, 10);\n      } else if (entity->info.song->id == MPD_SONG_NO_ID &&\n                 strcmp(re->name, \"Id\") == 0) {\n        entity->info.song->id = strtol(re->value, nullptr, 10);\n      } else if ((entity->info.song->date == nullptr) &&\n                 strcmp(re->name, \"Date\") == 0) {\n        entity->info.song->date =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->genre == nullptr) &&\n                 strcmp(re->name, \"Genre\") == 0) {\n        entity->info.song->genre =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->composer == nullptr) &&\n                 strcmp(re->name, \"Composer\") == 0) {\n        entity->info.song->composer =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->performer == nullptr) &&\n                 strcmp(re->name, \"Performer\") == 0) {\n        entity->info.song->performer =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->disc == nullptr) &&\n                 strcmp(re->name, \"Disc\") == 0) {\n        entity->info.song->disc =\n            strndup(re->value, text_buffer_size.get(*state));\n      } else if ((entity->info.song->comment == nullptr) &&\n                 strcmp(re->name, \"Comment\") == 0) {\n        entity->info.song->comment =\n            strndup(re->value, text_buffer_size.get(*state));\n      }\n    } else if (entity->type == MPD_INFO_ENTITY_TYPE_DIRECTORY) {\n    } else if (entity->type == MPD_INFO_ENTITY_TYPE_PLAYLISTFILE) {\n    }\n\n    mpd_getNextReturnElement(connection);\n  }\n\n  return entity;\n}\n\nstatic char *mpd_getNextReturnElementNamed(mpd_Connection *connection,\n                                           const char *name) {\n  if ((connection->doneProcessing != 0) ||\n      ((connection->listOks != 0) && (connection->doneListOk != 0))) {\n    return nullptr;\n  }\n\n  mpd_getNextReturnElement(connection);\n  while (connection->returnElement != nullptr) {\n    mpd_ReturnElement *re = connection->returnElement;\n\n    if (strcmp(re->name, name) == 0) {\n      return strndup(re->value, text_buffer_size.get(*state));\n    }\n    mpd_getNextReturnElement(connection);\n  }\n\n  return nullptr;\n}\n\nchar *mpd_getNextTag(mpd_Connection *connection, int type) {\n  if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES ||\n      type == MPD_TAG_ITEM_ANY) {\n    return nullptr;\n  }\n  if (type == MPD_TAG_ITEM_FILENAME) {\n    return mpd_getNextReturnElementNamed(connection, \"file\");\n  }\n  return mpd_getNextReturnElementNamed(connection, mpdTagItemKeys[type]);\n}\n\nchar *mpd_getNextArtist(mpd_Connection *connection) {\n  return mpd_getNextReturnElementNamed(connection, \"Artist\");\n}\n\nchar *mpd_getNextAlbum(mpd_Connection *connection) {\n  return mpd_getNextReturnElementNamed(connection, \"Album\");\n}\n\nvoid mpd_sendPlaylistInfoCommand(mpd_Connection *connection, int songPos) {\n  int len = strlen(\"playlistinfo\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"playlistinfo \\\"%i\\\"\\n\", songPos);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendPlaylistIdCommand(mpd_Connection *connection, int id) {\n  int len = strlen(\"playlistid\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"playlistid \\\"%i\\\"\\n\", id);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendPlChangesCommand(mpd_Connection *connection, long long playlist) {\n  int len = strlen(\"plchanges\") + 2 + LONGLONGLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"plchanges \\\"%lld\\\"\\n\", playlist);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendPlChangesPosIdCommand(mpd_Connection *connection,\n                                   long long playlist) {\n  int len = strlen(\"plchangesposid\") + 2 + LONGLONGLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"plchangesposid \\\"%lld\\\"\\n\", playlist);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendListallCommand(mpd_Connection *connection, const char *dir) {\n  char *sDir = mpd_sanitizeArg(dir);\n  int len = strlen(\"listall\") + 2 + strlen(sDir) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"listall \\\"%s\\\"\\n\", sDir);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n  free(sDir);\n}\n\nvoid mpd_sendListallInfoCommand(mpd_Connection *connection, const char *dir) {\n  char *sDir = mpd_sanitizeArg(dir);\n  int len = strlen(\"listallinfo\") + 2 + strlen(sDir) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"listallinfo \\\"%s\\\"\\n\", sDir);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n  free(sDir);\n}\n\nvoid mpd_sendLsInfoCommand(mpd_Connection *connection, const char *dir) {\n  char *sDir = mpd_sanitizeArg(dir);\n  int len = strlen(\"lsinfo\") + 2 + strlen(sDir) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"lsinfo \\\"%s\\\"\\n\", sDir);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n  free(sDir);\n}\n\nvoid mpd_sendCurrentSongCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"currentsong\\n\");\n}\n\nvoid mpd_sendSearchCommand(mpd_Connection *connection, int table,\n                           const char *str) {\n  mpd_startSearch(connection, 0);\n  mpd_addConstraintSearch(connection, table, str);\n  mpd_commitSearch(connection);\n}\n\nvoid mpd_sendFindCommand(mpd_Connection *connection, int table,\n                         const char *str) {\n  mpd_startSearch(connection, 1);\n  mpd_addConstraintSearch(connection, table, str);\n  mpd_commitSearch(connection);\n}\n\nvoid mpd_sendListCommand(mpd_Connection *connection, int table,\n                         const char *arg1) {\n  char st[7];\n  int len;\n  char *string;\n\n  if (table == MPD_TABLE_ARTIST) {\n    strncpy(st, \"artist\", strlen(\"artist\") + 1);\n  } else if (table == MPD_TABLE_ALBUM) {\n    strncpy(st, \"album\", strlen(\"album\") + 1);\n  } else {\n    connection->error = 1;\n    strncpy(connection->errorStr, \"unknown table for list\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    return;\n  }\n  if (arg1 != nullptr) {\n    char *sanitArg1 = mpd_sanitizeArg(arg1);\n\n    len = strlen(\"list\") + 1 + strlen(sanitArg1) + 2 + strlen(st) + 3;\n    string = static_cast<char *>(malloc(len));\n    snprintf(string, len, \"list %s \\\"%s\\\"\\n\", st, sanitArg1);\n    free(sanitArg1);\n  } else {\n    len = strlen(\"list\") + 1 + strlen(st) + 2;\n    string = static_cast<char *>(malloc(len));\n    snprintf(string, len, \"list %s\\n\", st);\n  }\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendAddCommand(mpd_Connection *connection, const char *file) {\n  char *sFile = mpd_sanitizeArg(file);\n  int len = strlen(\"add\") + 2 + strlen(sFile) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"add \\\"%s\\\"\\n\", sFile);\n  mpd_executeCommand(connection, string);\n  free(string);\n  free(sFile);\n}\n\nint mpd_sendAddIdCommand(mpd_Connection *connection, const char *file) {\n  int retval = -1;\n  char *sFile = mpd_sanitizeArg(file);\n  int len = strlen(\"addid\") + 2 + strlen(sFile) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"addid \\\"%s\\\"\\n\", sFile);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n  free(sFile);\n\n  string = mpd_getNextReturnElementNamed(connection, \"Id\");\n  if (string != nullptr) {\n    retval = strtol(string, nullptr, 10);\n    free(string);\n  }\n\n  return retval;\n}\n\nvoid mpd_sendDeleteCommand(mpd_Connection *connection, int songPos) {\n  int len = strlen(\"delete\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"delete \\\"%i\\\"\\n\", songPos);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendDeleteIdCommand(mpd_Connection *connection, int id) {\n  int len = strlen(\"deleteid\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"deleteid \\\"%i\\\"\\n\", id);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendSaveCommand(mpd_Connection *connection, const char *name) {\n  char *sName = mpd_sanitizeArg(name);\n  int len = strlen(\"save\") + 2 + strlen(sName) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"save \\\"%s\\\"\\n\", sName);\n  mpd_executeCommand(connection, string);\n  free(string);\n  free(sName);\n}\n\nvoid mpd_sendLoadCommand(mpd_Connection *connection, const char *name) {\n  char *sName = mpd_sanitizeArg(name);\n  int len = strlen(\"load\") + 2 + strlen(sName) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"load \\\"%s\\\"\\n\", sName);\n  mpd_executeCommand(connection, string);\n  free(string);\n  free(sName);\n}\n\nvoid mpd_sendRmCommand(mpd_Connection *connection, const char *name) {\n  char *sName = mpd_sanitizeArg(name);\n  int len = strlen(\"rm\") + 2 + strlen(sName) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"rm \\\"%s\\\"\\n\", sName);\n  mpd_executeCommand(connection, string);\n  free(string);\n  free(sName);\n}\n\nvoid mpd_sendRenameCommand(mpd_Connection *connection, const char *from,\n                           const char *to) {\n  char *sFrom = mpd_sanitizeArg(from);\n  char *sTo = mpd_sanitizeArg(to);\n  int len = strlen(\"rename\") + 2 + strlen(sFrom) + 3 + strlen(sTo) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"rename \\\"%s\\\" \\\"%s\\\"\\n\", sFrom, sTo);\n  mpd_executeCommand(connection, string);\n  free(string);\n  free(sFrom);\n  free(sTo);\n}\n\nvoid mpd_sendShuffleCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"shuffle\\n\");\n}\n\nvoid mpd_sendClearCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"clear\\n\");\n}\n\nvoid mpd_sendPlayCommand(mpd_Connection *connection, int songPos) {\n  int len = strlen(\"play\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"play \\\"%i\\\"\\n\", songPos);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendPlayIdCommand(mpd_Connection *connection, int id) {\n  int len = strlen(\"playid\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"playid \\\"%i\\\"\\n\", id);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendStopCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"stop\\n\");\n}\n\nvoid mpd_sendPauseCommand(mpd_Connection *connection, int pauseMode) {\n  int len = strlen(\"pause\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"pause \\\"%i\\\"\\n\", pauseMode);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendNextCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"next\\n\");\n}\n\nvoid mpd_sendMoveCommand(mpd_Connection *connection, int from, int to) {\n  int len = strlen(\"move\") + 2 + INTLEN + 3 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"move \\\"%i\\\" \\\"%i\\\"\\n\", from, to);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendMoveIdCommand(mpd_Connection *connection, int id, int to) {\n  int len = strlen(\"moveid\") + 2 + INTLEN + 3 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"moveid \\\"%i\\\" \\\"%i\\\"\\n\", id, to);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendSwapCommand(mpd_Connection *connection, int song1, int song2) {\n  int len = strlen(\"swap\") + 2 + INTLEN + 3 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"swap \\\"%i\\\" \\\"%i\\\"\\n\", song1, song2);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendSwapIdCommand(mpd_Connection *connection, int id1, int id2) {\n  int len = strlen(\"swapid\") + 2 + INTLEN + 3 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"swapid \\\"%i\\\" \\\"%i\\\"\\n\", id1, id2);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendSeekCommand(mpd_Connection *connection, int song, int seek_time) {\n  int len = strlen(\"seek\") + 2 + INTLEN + 3 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"seek \\\"%i\\\" \\\"%i\\\"\\n\", song, seek_time);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendSeekIdCommand(mpd_Connection *connection, int id, int seek_time) {\n  int len = strlen(\"seekid\") + 2 + INTLEN + 3 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"seekid \\\"%i\\\" \\\"%i\\\"\\n\", id, seek_time);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendUpdateCommand(mpd_Connection *connection, char *path) {\n  char *sPath = mpd_sanitizeArg(path);\n  int len = strlen(\"update\") + 2 + strlen(sPath) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"update \\\"%s\\\"\\n\", sPath);\n  mpd_sendInfoCommand(connection, string);\n  free(string);\n  free(sPath);\n}\n\nint mpd_getUpdateId(mpd_Connection *connection) {\n  char *jobid;\n  int ret = 0;\n\n  jobid = mpd_getNextReturnElementNamed(connection, \"updating_db\");\n  if (jobid != nullptr) {\n    ret = strtol(jobid, nullptr, 10);\n    free(jobid);\n  }\n\n  return ret;\n}\n\nvoid mpd_sendPrevCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"previous\\n\");\n}\n\nvoid mpd_sendRepeatCommand(mpd_Connection *connection, int repeatMode) {\n  int len = strlen(\"repeat\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"repeat \\\"%i\\\"\\n\", repeatMode);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendRandomCommand(mpd_Connection *connection, int randomMode) {\n  int len = strlen(\"random\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"random \\\"%i\\\"\\n\", randomMode);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendSetvolCommand(mpd_Connection *connection, int volumeChange) {\n  int len = strlen(\"setvol\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"setvol \\\"%i\\\"\\n\", volumeChange);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendVolumeCommand(mpd_Connection *connection, int volumeChange) {\n  int len = strlen(\"volume\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"volume \\\"%i\\\"\\n\", volumeChange);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendCrossfadeCommand(mpd_Connection *connection, int seconds) {\n  int len = strlen(\"crossfade\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"crossfade \\\"%i\\\"\\n\", seconds);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendPasswordCommand(mpd_Connection *connection, const char *pass) {\n  char *sPass = mpd_sanitizeArg(pass);\n  int len = strlen(\"password\") + 2 + strlen(sPass) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"password \\\"%s\\\"\\n\", sPass);\n  mpd_executeCommand(connection, string);\n  free(string);\n  free(sPass);\n}\n\nvoid mpd_sendCommandListBegin(mpd_Connection *connection) {\n  if (connection->commandList != 0) {\n    strncpy(connection->errorStr, \"already in command list mode\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n  connection->commandList = COMMAND_LIST;\n  mpd_executeCommand(connection, \"command_list_begin\\n\");\n}\n\nvoid mpd_sendCommandListOkBegin(mpd_Connection *connection) {\n  if (connection->commandList != 0) {\n    strncpy(connection->errorStr, \"already in command list mode\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n  connection->commandList = COMMAND_LIST_OK;\n  mpd_executeCommand(connection, \"command_list_ok_begin\\n\");\n  connection->listOks = 0;\n}\n\nvoid mpd_sendCommandListEnd(mpd_Connection *connection) {\n  if (connection->commandList == 0) {\n    strncpy(connection->errorStr, \"not in command list mode\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n  connection->commandList = 0;\n  mpd_executeCommand(connection, \"command_list_end\\n\");\n}\n\nvoid mpd_sendOutputsCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"outputs\\n\");\n}\n\nmpd_OutputEntity *mpd_getNextOutput(mpd_Connection *connection) {\n  mpd_OutputEntity *output = nullptr;\n\n  if ((connection->doneProcessing != 0) ||\n      ((connection->listOks != 0) && (connection->doneListOk != 0))) {\n    return nullptr;\n  }\n\n  if (connection->error != 0) { return nullptr; }\n\n  output = static_cast<mpd_OutputEntity *>(malloc(sizeof(mpd_OutputEntity)));\n  output->id = -10;\n  output->name = nullptr;\n  output->enabled = 0;\n\n  if (connection->returnElement == nullptr) {\n    mpd_getNextReturnElement(connection);\n  }\n\n  while (connection->returnElement != nullptr) {\n    mpd_ReturnElement *re = connection->returnElement;\n\n    if (strcmp(re->name, \"outputid\") == 0) {\n      if (output != nullptr && output->id >= 0) { return output; }\n      output->id = strtol(re->value, nullptr, 10);\n    } else if (strcmp(re->name, \"outputname\") == 0) {\n      output->name = strndup(re->value, text_buffer_size.get(*state));\n    } else if (strcmp(re->name, \"outputenabled\") == 0) {\n      output->enabled = strtol(re->value, nullptr, 10);\n    }\n\n    mpd_getNextReturnElement(connection);\n    if (connection->error != 0) {\n      free(output);\n      return nullptr;\n    }\n  }\n\n  return output;\n}\n\nvoid mpd_sendEnableOutputCommand(mpd_Connection *connection, int outputId) {\n  int len = strlen(\"enableoutput\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"enableoutput \\\"%i\\\"\\n\", outputId);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_sendDisableOutputCommand(mpd_Connection *connection, int outputId) {\n  int len = strlen(\"disableoutput\") + 2 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"disableoutput \\\"%i\\\"\\n\", outputId);\n  mpd_executeCommand(connection, string);\n  free(string);\n}\n\nvoid mpd_freeOutputElement(mpd_OutputEntity *output) {\n  free(output->name);\n  free(output);\n}\n\n/** odd naming, but it gets the not allowed commands */\nvoid mpd_sendNotCommandsCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"notcommands\\n\");\n}\n\n/** odd naming, but it gets the allowed commands */\nvoid mpd_sendCommandsCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"commands\\n\");\n}\n\n/** Get the next returned command */\nchar *mpd_getNextCommand(mpd_Connection *connection) {\n  return mpd_getNextReturnElementNamed(connection, \"command\");\n}\n\nvoid mpd_sendUrlHandlersCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"urlhandlers\\n\");\n}\n\nchar *mpd_getNextHandler(mpd_Connection *connection) {\n  return mpd_getNextReturnElementNamed(connection, \"handler\");\n}\n\nvoid mpd_sendTagTypesCommand(mpd_Connection *connection) {\n  mpd_executeCommand(connection, \"tagtypes\\n\");\n}\n\nchar *mpd_getNextTagType(mpd_Connection *connection) {\n  return mpd_getNextReturnElementNamed(connection, \"tagtype\");\n}\n\nvoid mpd_startSearch(mpd_Connection *connection, int exact) {\n  if (connection->request != nullptr) {\n    strncpy(connection->errorStr, \"search already in progress\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  if (exact != 0) {\n    connection->request = strndup(\"find\", text_buffer_size.get(*state));\n  } else {\n    connection->request = strndup(\"search\", text_buffer_size.get(*state));\n  }\n}\n\nvoid mpd_startStatsSearch(mpd_Connection *connection) {\n  if (connection->request != nullptr) {\n    strncpy(connection->errorStr, \"search already in progress\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  connection->request = strndup(\"count\", text_buffer_size.get(*state));\n}\n\nvoid mpd_startPlaylistSearch(mpd_Connection *connection, int exact) {\n  if (connection->request != nullptr) {\n    strncpy(connection->errorStr, \"search already in progress\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  if (exact != 0) {\n    connection->request = strndup(\"playlistfind\", text_buffer_size.get(*state));\n  } else {\n    connection->request =\n        strndup(\"playlistsearch\", text_buffer_size.get(*state));\n  }\n}\n\nvoid mpd_startFieldSearch(mpd_Connection *connection, int type) {\n  const char *strtype;\n  int len;\n\n  if (connection->request != nullptr) {\n    strncpy(connection->errorStr, \"search already in progress\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES) {\n    strncpy(connection->errorStr, \"invalid type specified\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  strtype = mpdTagItemKeys[type];\n\n  len = 5 + strlen(strtype) + 1;\n  connection->request = static_cast<char *>(malloc(len));\n\n  snprintf(connection->request, len, \"list %c%s\",\n           tolower(static_cast<unsigned char>(strtype[0])), strtype + 1);\n}\n\nvoid mpd_addConstraintSearch(mpd_Connection *connection, int type,\n                             const char *name) {\n  const char *strtype;\n  char *arg;\n  int len;\n  char *string;\n\n  if (connection->request == nullptr) {\n    strncpy(connection->errorStr, \"no search in progress\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  if (type < 0 || type >= MPD_TAG_NUM_OF_ITEM_TYPES) {\n    strncpy(connection->errorStr, \"invalid type specified\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  if (name == nullptr) {\n    strncpy(connection->errorStr, \"no name specified\", MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  string = strndup(connection->request, text_buffer_size.get(*state));\n  strtype = mpdTagItemKeys[type];\n  arg = mpd_sanitizeArg(name);\n\n  len = strlen(string) + 1 + strlen(strtype) + 2 + strlen(arg) + 2;\n  connection->request = static_cast<char *>(realloc(connection->request, len));\n  snprintf(connection->request, len, \"%s %c%s \\\"%s\\\"\", string,\n           tolower(static_cast<unsigned char>(strtype[0])), strtype + 1, arg);\n\n  free(string);\n  free(arg);\n}\n\nvoid mpd_commitSearch(mpd_Connection *connection) {\n  int len;\n\n  if (connection->request == nullptr) {\n    strncpy(connection->errorStr, \"no search in progress\",\n            MPD_ERRORSTR_MAX_LENGTH);\n    connection->error = 1;\n    return;\n  }\n\n  len = strlen(connection->request) + 2;\n  connection->request = static_cast<char *>(realloc(connection->request, len));\n  connection->request[len - 2] = '\\n';\n  connection->request[len - 1] = '\\0';\n  mpd_sendInfoCommand(connection, connection->request);\n\n  free_and_zero(connection->request);\n}\n\n/**\n * @param connection\ta MpdConnection\n * @param path\t\t\tthe path to the playlist.\n *\n * List the content, with full metadata, of a stored playlist. */\nvoid mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path) {\n  char *arg = mpd_sanitizeArg(path);\n  int len = strlen(\"listplaylistinfo\") + 2 + strlen(arg) + 3;\n  auto *query = static_cast<char *>(malloc(len));\n\n  snprintf(query, len, \"listplaylistinfo \\\"%s\\\"\\n\", arg);\n  mpd_sendInfoCommand(connection, query);\n  free(arg);\n  free(query);\n}\n\n/**\n * @param connection\ta MpdConnection\n * @param path\t\t\tthe path to the playlist.\n *\n * List the content of a stored playlist. */\nvoid mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path) {\n  char *arg = mpd_sanitizeArg(path);\n  int len = strlen(\"listplaylist\") + 2 + strlen(arg) + 3;\n  auto *query = static_cast<char *>(malloc(len));\n\n  snprintf(query, len, \"listplaylist \\\"%s\\\"\\n\", arg);\n  mpd_sendInfoCommand(connection, query);\n  free(arg);\n  free(query);\n}\n\nvoid mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path) {\n  char *sPath = mpd_sanitizeArg(path);\n  int len = strlen(\"playlistclear\") + 2 + strlen(sPath) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"playlistclear \\\"%s\\\"\\n\", sPath);\n  mpd_executeCommand(connection, string);\n  free(sPath);\n  free(string);\n}\n\nvoid mpd_sendPlaylistAddCommand(mpd_Connection *connection, char *playlist,\n                                char *path) {\n  char *sPlaylist = mpd_sanitizeArg(playlist);\n  char *sPath = mpd_sanitizeArg(path);\n  int len =\n      strlen(\"playlistadd\") + 2 + strlen(sPlaylist) + 3 + strlen(sPath) + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"playlistadd \\\"%s\\\" \\\"%s\\\"\\n\", sPlaylist, sPath);\n  mpd_executeCommand(connection, string);\n  free(sPlaylist);\n  free(sPath);\n  free(string);\n}\n\nvoid mpd_sendPlaylistMoveCommand(mpd_Connection *connection, char *playlist,\n                                 int from, int to) {\n  char *sPlaylist = mpd_sanitizeArg(playlist);\n  int len = strlen(\"playlistmove\") + 2 + strlen(sPlaylist) + 3 + INTLEN + 3 +\n            INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"playlistmove \\\"%s\\\" \\\"%i\\\" \\\"%i\\\"\\n\", sPlaylist, from,\n           to);\n  mpd_executeCommand(connection, string);\n  free(sPlaylist);\n  free(string);\n}\n\nvoid mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, char *playlist,\n                                   int pos) {\n  char *sPlaylist = mpd_sanitizeArg(playlist);\n  int len = strlen(\"playlistdelete\") + 2 + strlen(sPlaylist) + 3 + INTLEN + 3;\n  auto *string = static_cast<char *>(malloc(len));\n\n  snprintf(string, len, \"playlistdelete \\\"%s\\\" \\\"%i\\\"\\n\", sPlaylist, pos);\n  mpd_executeCommand(connection, string);\n  free(sPlaylist);\n  free(string);\n}\n"
  },
  {
    "path": "src/data/audio/libmpdclient.h",
    "content": "/*\n *\n * libmpdclient\n * (c)2003-2006 by Warren Dukes (warren.dukes@gmail.com)\n * This project's homepage is: http://www.musicpd.org\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * - Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n *\n * - Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n *\n * - Neither the name of the Music Player Daemon nor the names of its\n * contributors may be used to endorse or promote products derived from\n * this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */\n\n#ifndef LIBMPDCLIENT_H\n#define LIBMPDCLIENT_H\n\n#ifdef WIN32\n#define __W32API_USE_DLLIMPORT__ 1\n#endif\n\n#include <stdarg.h>\n#include <sys/time.h>\n#define MPD_BUFFER_MAX_LENGTH 50000\n#define MPD_ERRORSTR_MAX_LENGTH 1000\n#define MPD_WELCOME_MESSAGE \"OK MPD \"\n\n#define MPD_ERROR_TIMEOUT 10       /* timeout trying to talk to mpd */\n#define MPD_ERROR_SYSTEM 11        /* system error */\n#define MPD_ERROR_UNKHOST 12       /* unknown host */\n#define MPD_ERROR_CONNPORT 13      /* problems connecting to port on host */\n#define MPD_ERROR_NOTMPD 14        /* mpd not running on port at host */\n#define MPD_ERROR_NORESPONSE 15    /* no response on attempting to connect */\n#define MPD_ERROR_SENDING 16       /* error sending command */\n#define MPD_ERROR_CONNCLOSED 17    /* connection closed by mpd */\n#define MPD_ERROR_ACK 18           /* ACK returned! */\n#define MPD_ERROR_BUFFEROVERRUN 19 /* Buffer was overrun! */\n\n#define MPD_ACK_ERROR_UNK -1\n#define MPD_ERROR_AT_UNK -1\n\n#define MPD_ACK_ERROR_NOT_LIST 1\n#define MPD_ACK_ERROR_ARG 2\n#define MPD_ACK_ERROR_PASSWORD 3\n#define MPD_ACK_ERROR_PERMISSION 4\n#define MPD_ACK_ERROR_UNKNOWN_CMD 5\n\n#define MPD_ACK_ERROR_NO_EXIST 50\n#define MPD_ACK_ERROR_PLAYLIST_MAX 51\n#define MPD_ACK_ERROR_SYSTEM 52\n#define MPD_ACK_ERROR_PLAYLIST_LOAD 53\n#define MPD_ACK_ERROR_UPDATE_ALREADY 54\n#define MPD_ACK_ERROR_PLAYER_SYNC 55\n#define MPD_ACK_ERROR_EXIST 56\n\ntypedef enum mpd_TagItems {\n  MPD_TAG_ITEM_ARTIST,\n  MPD_TAG_ITEM_ALBUMARTIST,\n  MPD_TAG_ITEM_ALBUM,\n  MPD_TAG_ITEM_TITLE,\n  MPD_TAG_ITEM_TRACK,\n  MPD_TAG_ITEM_NAME,\n  MPD_TAG_ITEM_GENRE,\n  MPD_TAG_ITEM_DATE,\n  MPD_TAG_ITEM_COMPOSER,\n  MPD_TAG_ITEM_PERFORMER,\n  MPD_TAG_ITEM_COMMENT,\n  MPD_TAG_ITEM_DISC,\n  MPD_TAG_ITEM_FILENAME,\n  MPD_TAG_ITEM_ANY,\n  MPD_TAG_NUM_OF_ITEM_TYPES\n} mpd_TagItems;\n\nextern const char *mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES];\n\n/* internal stuff don't touch this struct */\ntypedef struct _mpd_ReturnElement {\n  char *name;\n  char *value;\n} mpd_ReturnElement;\n\n/* mpd_Connection\n * holds info about connection to mpd\n * use error, and errorStr to detect errors */\ntypedef struct _mpd_Connection {\n  /* use this to check the version of mpd */\n  int version[3];\n  /* IMPORTANT, you want to get the error messages from here */\n  char errorStr[MPD_ERRORSTR_MAX_LENGTH + 1];\n  int errorCode;\n  int errorAt;\n  /* this will be set to MPD_ERROR_* if there is an error, 0 if not */\n  int error;\n  /* DON'T TOUCH any of the rest of this stuff */\n  int sock;\n  char buffer[MPD_BUFFER_MAX_LENGTH + 1];\n  int buflen;\n  int bufstart;\n  int doneProcessing;\n  int listOks;\n  int doneListOk;\n  int commandList;\n  mpd_ReturnElement *returnElement;\n  struct timeval timeout;\n  char *request;\n} mpd_Connection;\n\n/* mpd_newConnection\n * use this to open a new connection\n * you should use mpd_closeConnection when you're done with the connection,\n * even if an error has occurred\n * _timeout_ is the connection timeout period in seconds */\nmpd_Connection *mpd_newConnection(const char *host, int port, float timeout);\n\nvoid mpd_setConnectionTimeout(mpd_Connection *connection, float timeout);\n\n/* mpd_closeConnection\n * use this to close a connection and free subsequent memory */\nvoid mpd_closeConnection(mpd_Connection *connection);\n\n/* mpd_clearError\n * clears error */\nvoid mpd_clearError(mpd_Connection *connection);\n\n/* STATUS STUFF */\n\n/* use these with status.state to determine what state the player is in */\n#define MPD_STATUS_STATE_UNKNOWN 0\n#define MPD_STATUS_STATE_STOP 1\n#define MPD_STATUS_STATE_PLAY 2\n#define MPD_STATUS_STATE_PAUSE 3\n\n/* use this with status.volume to determine if mpd has volume support */\n#define MPD_STATUS_NO_VOLUME -1\n\n/* mpd_Status\n * holds info return from status command */\ntypedef struct mpd_Status {\n  /* 0-100, or MPD_STATUS_NO_VOLUME when there is no volume support */\n  int volume;\n  /* 1 if repeat is on, 0 otherwise */\n  int repeat;\n  /* 1 if random is on, 0 otherwise */\n  int random;\n  /* playlist length */\n  int playlistLength;\n  /* playlist, use this to determine when the playlist has changed */\n  long long playlist;\n  /* use with MPD_STATUS_STATE_* to determine state of player */\n  int state;\n  /* crossfade setting in seconds */\n  int crossfade;\n  /* if a song is currently selected (always the case when state is PLAY\n   * or PAUSE), this is the position of the currently playing song in the\n   * playlist, beginning with 0 */\n  int song;\n  /* Song ID of the currently selected song */\n  int songid;\n  /* time in seconds that have elapsed in the currently playing/paused song */\n  int elapsedTime;\n  /* length in seconds of the currently playing/paused song */\n  int totalTime;\n  /* current bit rate in kbs */\n  int bitRate;\n  /* audio sample rate */\n  unsigned int sampleRate;\n  /* audio bits */\n  int bits;\n  /* audio channels */\n  int channels;\n  /* 1 if mpd is updating, 0 otherwise */\n  int updatingDb;\n  /* error */\n  char *error;\n} mpd_Status;\n\nvoid mpd_sendStatusCommand(mpd_Connection *connection);\n\n/* mpd_getStatus\n * returns status info, be sure to free it with mpd_freeStatus()\n * call this after mpd_sendStatusCommand() */\nmpd_Status *mpd_getStatus(mpd_Connection *connection);\n\n/* mpd_freeStatus\n * free's status info malloc'd and returned by mpd_getStatus */\nvoid mpd_freeStatus(mpd_Status *status);\n\ntypedef struct _mpd_Stats {\n  int numberOfArtists;\n  int numberOfAlbums;\n  int numberOfSongs;\n  unsigned long uptime;\n  unsigned long dbUpdateTime;\n  unsigned long playTime;\n  unsigned long dbPlayTime;\n} mpd_Stats;\n\ntypedef struct _mpd_SearchStats {\n  int numberOfSongs;\n  unsigned long playTime;\n} mpd_SearchStats;\n\nvoid mpd_sendStatsCommand(mpd_Connection *connection);\n\nmpd_Stats *mpd_getStats(mpd_Connection *connection);\n\nvoid mpd_freeStats(mpd_Stats *stats);\n\nmpd_SearchStats *mpd_getSearchStats(mpd_Connection *connection);\n\nvoid mpd_freeSearchStats(mpd_SearchStats *stats);\n\n/* SONG STUFF */\n\n#define MPD_SONG_NO_TIME -1\n#define MPD_SONG_NO_NUM -1\n#define MPD_SONG_NO_ID -1\n\n/* mpd_Song\n * for storing song info returned by mpd */\ntypedef struct _mpd_Song {\n  /* filename of song */\n  char *file;\n  /* artist, maybe nullptr if there is no tag */\n  char *artist;\n  /* albumartist, maybe nullptr if there is no tag */\n  char *albumartist;\n  /* title, maybe nullptr if there is no tag */\n  char *title;\n  /* album, maybe nullptr if there is no tag */\n  char *album;\n  /* track, maybe nullptr if there is no tag */\n  char *track;\n  /* name, maybe nullptr if there is no tag; it's the name of the current song,\n   * f.e. the icyName of the stream */\n  char *name;\n  /* date */\n  char *date;\n\n  /* added by qball */\n  /* Genre */\n  char *genre;\n  /* Composer */\n  char *composer;\n  /* Performer */\n  char *performer;\n  /* Disc */\n  char *disc;\n  /* Comment */\n  char *comment;\n\n  /* length of song in seconds, check that it is not MPD_SONG_NO_TIME */\n  int time;\n  /* if plchanges/playlistinfo/playlistid used, is the position of the song\n   * in the playlist */\n  int pos;\n  /* song id for a song in the playlist */\n  int id;\n} mpd_Song;\n\n/* mpd_newSong\n * use to allocate memory for a new mpd_Song\n * file, artist, etc all initialized to nullptr\n * if you're going to assign values to file, artist, etc., be sure to\n * malloc or strdup the memory\n * use mpd_freeSong to free the memory for the mpd_Song, it will also\n * free memory for file, artist, etc, so don't do it yourself */\nmpd_Song *mpd_newSong(void);\n\n/* mpd_freeSong\n * use to free memory allocated by mpd_newSong\n * also it will free memory pointed to by file, artist, etc, so be careful */\nvoid mpd_freeSong(mpd_Song *song);\n\n/* mpd_songDup\n * works like strDup, but for a mpd_Song */\nmpd_Song *mpd_songDup(mpd_Song *song);\n\n/* DIRECTORY STUFF */\n\n/* mpd_Directory\n * used to store info from directory (right now just the path) */\ntypedef struct _mpd_Directory {\n  char *path;\n} mpd_Directory;\n\n/* mpd_newDirectory\n * allocates memory for a new directory\n * use mpd_freeDirectory to free this memory */\nmpd_Directory *mpd_newDirectory(void);\n\n/* mpd_freeDirectory\n * used to free memory allocated with mpd_newDirectory, and it frees\n * path of mpd_Directory, so be careful */\nvoid mpd_freeDirectory(mpd_Directory *directory);\n\n/* mpd_directoryDup\n * works like strdup, but for mpd_Directory */\nmpd_Directory *mpd_directoryDup(mpd_Directory *directory);\n\n/* PLAYLISTFILE STUFF */\n\n/* mpd_PlaylistFile\n * stores info about playlist file returned by lsinfo */\ntypedef struct _mpd_PlaylistFile {\n  char *path;\n} mpd_PlaylistFile;\n\n/* mpd_newPlaylistFile\n * allocates memory for new mpd_PlaylistFile, path is set to nullptr\n * free this memory with mpd_freePlaylistFile */\nmpd_PlaylistFile *mpd_newPlaylistFile(void);\n\n/* mpd_freePlaylist\n * free memory allocated for freePlaylistFile\n * will also free path, so be careful */\nvoid mpd_freePlaylistFile(mpd_PlaylistFile *playlist);\n\n/* mpd_playlistFileDup\n * works like strdup, but for mpd_PlaylistFile */\nmpd_PlaylistFile *mpd_playlistFileDup(mpd_PlaylistFile *playlist);\n\n/* INFO ENTITY STUFF */\n\n/* the type of entity returned from one of the commands that generates info\n * use in conjunction with mpd_InfoEntity.type */\n#define MPD_INFO_ENTITY_TYPE_DIRECTORY 0\n#define MPD_INFO_ENTITY_TYPE_SONG 1\n#define MPD_INFO_ENTITY_TYPE_PLAYLISTFILE 2\n\n/* mpd_InfoEntity\n * stores info on stuff returned info commands */\ntypedef struct mpd_InfoEntity {\n  /* the type of entity, use with MPD_INFO_ENTITY_TYPE_* to determine\n   * what this entity is (song, directory, etc...) */\n  int type;\n  /* the actual data you want, mpd_Song, mpd_Directory, etc */\n  union {\n    mpd_Directory *directory;\n    mpd_Song *song;\n    mpd_PlaylistFile *playlistFile;\n  } info;\n} mpd_InfoEntity;\n\nmpd_InfoEntity *mpd_newInfoEntity(void);\n\nvoid mpd_freeInfoEntity(mpd_InfoEntity *entity);\n\n/* INFO COMMANDS AND STUFF */\n\n/* use this function to loop over after calling Info/Listall functions */\nmpd_InfoEntity *mpd_getNextInfoEntity(mpd_Connection *connection);\n\n/* fetches the currently selected song (the song referenced by status->song\n * and status->songid */\nvoid mpd_sendCurrentSongCommand(mpd_Connection *connection);\n\n/* songNum of -1, means to display the whole list */\nvoid mpd_sendPlaylistInfoCommand(mpd_Connection *connection, int songPos);\n\n/* songId of -1, means to display the whole list */\nvoid mpd_sendPlaylistIdCommand(mpd_Connection *connection, int id);\n\n/* use this to get the changes in the playlist since version _playlist_ */\nvoid mpd_sendPlChangesCommand(mpd_Connection *connection, long long playlist);\n\n/**\n * @param connection: A valid and connected mpd_Connection.\n * @param playlist: The playlist version you want the diff with.\n *\n * A more bandwidth efficient version of the mpd_sendPlChangesCommand.\n * It only returns the pos+id of the changes song. */\nvoid mpd_sendPlChangesPosIdCommand(mpd_Connection *connection,\n                                   long long playlist);\n\n/* recursively fetches all songs/dir/playlists in \"dir*\n * (no metadata is returned) */\nvoid mpd_sendListallCommand(mpd_Connection *connection, const char *dir);\n\n/* same as sendListallCommand, but also metadata is returned */\nvoid mpd_sendListallInfoCommand(mpd_Connection *connection, const char *dir);\n\n/* non-recursive version of ListallInfo */\nvoid mpd_sendLsInfoCommand(mpd_Connection *connection, const char *dir);\n\n#define MPD_TABLE_ARTIST MPD_TAG_ITEM_ARTIST\n#define MPD_TABLE_ALBUM MPD_TAG_ITEM_ALBUM\n#define MPD_TABLE_TITLE MPD_TAG_ITEM_TITLE\n#define MPD_TABLE_FILENAME MPD_TAG_ITEM_FILENAME\n\nvoid mpd_sendSearchCommand(mpd_Connection *connection, int table,\n                           const char *str);\n\nvoid mpd_sendFindCommand(mpd_Connection *connection, int table,\n                         const char *str);\n\n/* LIST TAG COMMANDS */\n\n/* use this function fetch next artist entry, be sure to free the\n * returned string.\n * nullptr means there are no more.\n * Best used with sendListArtists */\nchar *mpd_getNextArtist(mpd_Connection *connection);\n\nchar *mpd_getNextAlbum(mpd_Connection *connection);\n\nchar *mpd_getNextTag(mpd_Connection *connection, int type);\n\n/* list artist or albums by artist\n * arg1 should be set to the artist if listing albums by a artist\n * otherwise nullptr for listing all artists or albums */\nvoid mpd_sendListCommand(mpd_Connection *connection, int table,\n                         const char *arg1);\n\n/* SIMPLE COMMANDS */\n\nvoid mpd_sendAddCommand(mpd_Connection *connection, const char *file);\n\nint mpd_sendAddIdCommand(mpd_Connection *connection, const char *file);\n\nvoid mpd_sendDeleteCommand(mpd_Connection *connection, int songPos);\n\nvoid mpd_sendDeleteIdCommand(mpd_Connection *connection, int id);\n\nvoid mpd_sendSaveCommand(mpd_Connection *connection, const char *name);\n\nvoid mpd_sendLoadCommand(mpd_Connection *connection, const char *name);\n\nvoid mpd_sendRmCommand(mpd_Connection *connection, const char *name);\n\nvoid mpd_sendRenameCommand(mpd_Connection *connection, const char *from,\n                           const char *to);\n\nvoid mpd_sendShuffleCommand(mpd_Connection *connection);\n\nvoid mpd_sendClearCommand(mpd_Connection *connection);\n\n/* use this to start playing at the beginning, useful when in random mode */\n#define MPD_PLAY_AT_BEGINNING -1\n\nvoid mpd_sendPlayCommand(mpd_Connection *connection, int songPos);\n\nvoid mpd_sendPlayIdCommand(mpd_Connection *connection, int id);\n\nvoid mpd_sendStopCommand(mpd_Connection *connection);\n\nvoid mpd_sendPauseCommand(mpd_Connection *connection, int pauseMode);\n\nvoid mpd_sendNextCommand(mpd_Connection *connection);\n\nvoid mpd_sendPrevCommand(mpd_Connection *connection);\n\nvoid mpd_sendMoveCommand(mpd_Connection *connection, int from, int to);\n\nvoid mpd_sendMoveIdCommand(mpd_Connection *connection, int id, int to);\n\nvoid mpd_sendSwapCommand(mpd_Connection *connection, int song1, int song2);\n\nvoid mpd_sendSwapIdCommand(mpd_Connection *connection, int id1, int id2);\n\nvoid mpd_sendSeekCommand(mpd_Connection *connection, int song, int seek_time);\n\nvoid mpd_sendSeekIdCommand(mpd_Connection *connection, int id, int seek_time);\n\nvoid mpd_sendRepeatCommand(mpd_Connection *connection, int repeatMode);\n\nvoid mpd_sendRandomCommand(mpd_Connection *connection, int randomMode);\n\nvoid mpd_sendSetvolCommand(mpd_Connection *connection, int volumeChange);\n\n/* WARNING: don't use volume command, its deprecated */\nvoid mpd_sendVolumeCommand(mpd_Connection *connection, int volumeChange);\n\nvoid mpd_sendCrossfadeCommand(mpd_Connection *connection, int seconds);\n\nvoid mpd_sendUpdateCommand(mpd_Connection *connection, char *path);\n\n/* returns the update job id, call this after a update command */\nint mpd_getUpdateId(mpd_Connection *connection);\n\nvoid mpd_sendPasswordCommand(mpd_Connection *connection, const char *pass);\n\n/* after executing a command, when you're done with it to get its status\n * (you want to check connection->error for an error) */\nvoid mpd_finishCommand(mpd_Connection *connection);\n\n/* command list stuff, use this to do things like add files very quickly */\nvoid mpd_sendCommandListBegin(mpd_Connection *connection);\n\nvoid mpd_sendCommandListOkBegin(mpd_Connection *connection);\n\nvoid mpd_sendCommandListEnd(mpd_Connection *connection);\n\n/* advance to the next listOk\n * returns 0 if advanced to the next list_OK,\n * returns -1 if it advanced to an OK or ACK */\nint mpd_nextListOkCommand(mpd_Connection *connection);\n\ntypedef struct _mpd_OutputEntity {\n  int id;\n  char *name;\n  int enabled;\n} mpd_OutputEntity;\n\nvoid mpd_sendOutputsCommand(mpd_Connection *connection);\n\nmpd_OutputEntity *mpd_getNextOutput(mpd_Connection *connection);\n\nvoid mpd_sendEnableOutputCommand(mpd_Connection *connection, int outputId);\n\nvoid mpd_sendDisableOutputCommand(mpd_Connection *connection, int outputId);\n\nvoid mpd_freeOutputElement(mpd_OutputEntity *output);\n\n/**\n * @param connection a #mpd_Connection\n *\n * Queries mpd for the allowed commands */\nvoid mpd_sendCommandsCommand(mpd_Connection *connection);\n\n/**\n * @param connection a #mpd_Connection\n *\n * Queries mpd for the not allowed commands */\nvoid mpd_sendNotCommandsCommand(mpd_Connection *connection);\n\n/**\n * @param connection a #mpd_Connection\n *\n * returns the next supported command.\n *\n * @returns a string, needs to be freed */\nchar *mpd_getNextCommand(mpd_Connection *connection);\n\nvoid mpd_sendUrlHandlersCommand(mpd_Connection *connection);\n\nchar *mpd_getNextHandler(mpd_Connection *connection);\n\nvoid mpd_sendTagTypesCommand(mpd_Connection *connection);\n\nchar *mpd_getNextTagType(mpd_Connection *connection);\n\n/**\n * @param connection\ta MpdConnection\n * @param path\t\t\tthe path to the playlist.\n *\n * List the content, with full metadata, of a stored playlist. */\nvoid mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path);\n\n/**\n * @param connection\ta MpdConnection\n * @param path\t\t\tthe path to the playlist.\n *\n * List the content of a stored playlist. */\nvoid mpd_sendListPlaylistCommand(mpd_Connection *connection, char *path);\n\n/**\n * @param connection\ta #mpd_Connection\n * @param exact\t\t\tif to match exact\n *\n * starts a search\n * use mpd_addConstraintSearch to add a constraint to the search\n * use mpd_commitSearch to do the actual search */\nvoid mpd_startSearch(mpd_Connection *connection, int exact);\n\n/**\n * @param connection a #mpd_Connection\n * @param type\n * @param name */\nvoid mpd_addConstraintSearch(mpd_Connection *connection, int type,\n                             const char *name);\n\n/**\n * @param connection a #mpd_Connection */\nvoid mpd_commitSearch(mpd_Connection *connection);\n\n/**\n * @param connection\ta #mpd_Connection\n * @param type\t\t\tThe type to search for\n *\n * starts a search for fields... f.e. get a list of artists would be:\n * @code\n * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);\n * mpd_commitSearch(connection);\n * @endcode\n *\n * or get a list of artist in genre \"jazz\" would be:\n * @code\n * mpd_startFieldSearch(connection, MPD_TAG_ITEM_ARTIST);\n * mpd_addConstraintSearch(connection, MPD_TAG_ITEM_GENRE, \"jazz\")\n * mpd_commitSearch(connection);\n * @endcode\n *\n * mpd_startSearch will return a list of songs\n * (and you need mpd_getNextInfoEntity)\n * this will return a list of only one field (the one specified with type)\n * you need mpd_getNextTag to get the results */\nvoid mpd_startFieldSearch(mpd_Connection *connection, int type);\n\nvoid mpd_startPlaylistSearch(mpd_Connection *connection, int exact);\n\nvoid mpd_startStatsSearch(mpd_Connection *connection);\n\nvoid mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path);\n\nvoid mpd_sendPlaylistAddCommand(mpd_Connection *connection, char *playlist,\n                                char *path);\n\nvoid mpd_sendPlaylistMoveCommand(mpd_Connection *connection, char *playlist,\n                                 int from, int to);\n\nvoid mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, char *playlist,\n                                   int pos);\n\n#endif\n"
  },
  {
    "path": "src/data/audio/mixer.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <ctype.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <sys/ioctl.h>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/specials.h\"\n#include \"../../content/text_object.h\"\n\n#ifdef HAVE_SOUNDCARD_H\n#if defined(__linux__)\n#include <linux/soundcard.h>\n#elif defined(__OpenBSD__)\n#include <soundcard.h>\n#else\n#include <sys/soundcard.h>\n#endif\n#endif /* HAVE_SOUNDCARD_H */\n\n#if defined(__sun)\n#include <stropts.h>\n#include <unistd.h>\n#endif\n\n#define MIXER_DEV \"/dev/mixer\"\n\nstatic int mixer_fd;\nstatic const char *devs[] = SOUND_DEVICE_NAMES;\n\nint mixer_init(const char *name) {\n  unsigned int i;\n\n  if (name == 0 || name[0] == '\\0') { name = \"vol\"; }\n\n  /* open mixer */\n  if (mixer_fd <= 0) {\n    mixer_fd = open(MIXER_DEV, O_RDONLY);\n    if (mixer_fd == -1) {\n      NORM_ERR(\"can't open %s: %s\", MIXER_DEV, strerror(errno));\n      return -1;\n    }\n  }\n\n  for (i = 0; i < sizeof(devs) / sizeof(const char *); i++) {\n    if (strcasecmp(devs[i], name) == 0) { return i; }\n  }\n\n  return -1;\n}\n\nstatic int mixer_get(int i) {\n  static char rep = 0;\n  int val = -1;\n\n  if (ioctl(mixer_fd, MIXER_READ(i), &val) == -1) {\n    if (!rep) { NORM_ERR(\"mixer ioctl: %s\", strerror(errno)); }\n    rep = 1;\n    return 0;\n  }\n  rep = 0;\n\n  return val;\n}\n\nstatic int mixer_get_avg(int i) {\n  int v = mixer_get(i);\n\n  return ((v >> 8) + (v & 0xFF)) / 2;\n}\n\nstatic int mixer_get_left(int i) { return mixer_get(i) >> 8; }\n\nstatic int mixer_get_right(int i) { return mixer_get(i) & 0xFF; }\nint mixer_is_mute(int i) { return !mixer_get(i); }\n\n#define mixer_to_255(i, x) x\n\nvoid parse_mixer_arg(struct text_object *obj, const char *arg) {\n  obj->data.l = mixer_init(arg);\n}\n\nuint8_t mixer_percentage(struct text_object *obj) {\n  return mixer_get_avg(obj->data.l);\n}\n\nuint8_t mixerl_percentage(struct text_object *obj) {\n  return mixer_get_left(obj->data.l);\n}\n\nuint8_t mixerr_percentage(struct text_object *obj) {\n  return mixer_get_right(obj->data.l);\n}\n\nint check_mixer_muted(struct text_object *obj) {\n  if (!mixer_is_mute(obj->data.l)) return 0;\n  return 1;\n}\n\nvoid scan_mixer_bar(struct text_object *obj, const char *arg) {\n  char buf1[64];\n  int n;\n\n  if (arg && sscanf(arg, \"%63s %n\", buf1, &n) >= 1) {\n    obj->data.i = mixer_init(buf1);\n    scan_bar(obj, arg + n, 100);\n  } else {\n    obj->data.i = mixer_init(nullptr);\n    scan_bar(obj, arg, 100);\n  }\n}\n\ndouble mixer_barval(struct text_object *obj) {\n  return mixer_to_255(obj->data.i, mixer_get_avg(obj->data.i));\n}\n\ndouble mixerl_barval(struct text_object *obj) {\n  return mixer_to_255(obj->data.i, mixer_get_left(obj->data.i));\n}\n\ndouble mixerr_barval(struct text_object *obj) {\n  return mixer_to_255(obj->data.i, mixer_get_right(obj->data.i));\n}\n"
  },
  {
    "path": "src/data/audio/mixer.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef MIXER_H_\n#define MIXER_H_\n\nvoid parse_mixer_arg(struct text_object *, const char *);\nuint8_t mixer_percentage(struct text_object *obj);\nuint8_t mixerl_percentage(struct text_object *obj);\nuint8_t mixerr_percentage(struct text_object *obj);\nint check_mixer_muted(struct text_object *);\n\nvoid scan_mixer_bar(struct text_object *, const char *);\ndouble mixer_barval(struct text_object *);\ndouble mixerl_barval(struct text_object *);\ndouble mixerr_barval(struct text_object *);\n\n#endif /*MIXER_H_*/\n"
  },
  {
    "path": "src/data/audio/moc.cc",
    "content": "/*\n *\n * MOC Conky integration\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2008, Henri Häkkinen\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\n#include <cmath>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <mutex>\n\n#include \"../../update-cb.hh\"\n\nnamespace {\nstruct moc_result {\n  std::string state;\n  std::string file;\n  std::string title;\n  std::string artist;\n  std::string song;\n  std::string album;\n  std::string totaltime;\n  std::string timeleft;\n  std::string totalsec;\n  std::string curtime;\n  std::string cursec;\n  std::string bitrate;\n  std::string avgbitrate;\n  std::string rate;\n};\n\nclass moc_cb : public conky::callback<moc_result> {\n  using Base = conky::callback<moc_result>;\n\n protected:\n  void work() override;\n\n public:\n  explicit moc_cb(uint32_t period) : Base(period, false, Tuple()) {}\n};\n\nvoid moc_cb::work() {\n  moc_result moc;\n  FILE *fp;\n\n  fp = popen(\"mocp -i\", \"r\");\n  if (fp == nullptr) {\n    moc.state = \"Can't run 'mocp -i'\";\n  } else {\n    while (1) {\n      char line[100];\n      char *p;\n\n      /* Read a line from the pipe and strip the possible '\\n'. */\n      if (fgets(line, 100, fp) == nullptr) { break; }\n      if ((p = strrchr(line, '\\n')) != nullptr) { *p = '\\0'; }\n\n      /**\n       * Parse infos. Example output of mocp -i:\n       * State: PLAY\n       * File: /home/user/music/Korn - Falling Away From Me.ogg\n       * Title: 2 Korn - Falling Away From Me (Issues)\n       * Artist: Korn\n       * SongTitle: Falling Away From Me\n       * Album: Issues\n       * TotalTime: 04:31\n       * TimeLeft: 02:44\n       * TotalSec: 271\n       * CurrentTime: 01:47\n       * CurrentSec: 107\n       * Bitrate: 54kbps\n       * AvgBitrate: 233kbps\n       * Rate: 44kHz\n       **/\n      /* Match each line with their lengths, then store where data starts. */\n      if (strncmp(line, \"State:\", 6) == 0) {\n        moc.state = line + 7;\n      } else if (strncmp(line, \"File:\", 5) == 0) {\n        moc.file = line + 6;\n      } else if (strncmp(line, \"Title:\", 6) == 0) {\n        moc.title = line + 7;\n      } else if (strncmp(line, \"Artist:\", 7) == 0) {\n        moc.artist = line + 8;\n      } else if (strncmp(line, \"SongTitle:\", 10) == 0) {\n        moc.song = line + 11;\n      } else if (strncmp(line, \"Album:\", 6) == 0) {\n        moc.album = line + 7;\n      } else if (strncmp(line, \"TotalTime:\", 10) == 0) {\n        moc.totaltime = line + 11;\n      } else if (strncmp(line, \"TimeLeft:\", 9) == 0) {\n        moc.timeleft = line + 10;\n      } else if (strncmp(line, \"TotalSec:\", 9) == 0) {\n        moc.totalsec = line + 10;\n      } else if (strncmp(line, \"CurrentTime:\", 12) == 0) {\n        moc.curtime = line + 13;\n      } else if (strncmp(line, \"CurrentSec:\", 11) == 0) {\n        moc.cursec = line + 12;\n      } else if (strncmp(line, \"Bitrate:\", 8) == 0) {\n        moc.bitrate = line + 9;\n      } else if (strncmp(line, \"AvgBitrate:\", 11) == 0) {\n        moc.avgbitrate = line + 12;\n      } else if (strncmp(line, \"Rate:\", 5) == 0) {\n        moc.rate = line + 6;\n      }\n    }\n  }\n\n  pclose(fp);\n\n  std::lock_guard<std::mutex> l(result_mutex);\n  result = moc;\n}\n}  // namespace\n\n#define MOC_PRINT_GENERATOR(type, alt)                                        \\\n  void print_moc_##type(struct text_object *obj, char *p,                     \\\n                        unsigned int p_max_size) {                            \\\n    (void)obj;                                                                \\\n    uint32_t period = std::max(                                               \\\n        lround(music_player_interval.get(*state) / active_update_interval()), \\\n        1l);                                                                  \\\n    const moc_result &moc =                                                   \\\n        conky::register_cb<moc_cb>(period)->get_result_copy();                \\\n    snprintf(p, p_max_size, \"%s\",                                             \\\n             (moc.type.length() ? moc.type.c_str() : (alt)));                 \\\n  }\n\nMOC_PRINT_GENERATOR(state, \"??\")\nMOC_PRINT_GENERATOR(file, \"no file\")\nMOC_PRINT_GENERATOR(title, \"no title\")\nMOC_PRINT_GENERATOR(artist, \"no artist\")\nMOC_PRINT_GENERATOR(song, \"no song\")\nMOC_PRINT_GENERATOR(album, \"no album\")\nMOC_PRINT_GENERATOR(totaltime, \"0:00\")\nMOC_PRINT_GENERATOR(timeleft, \"0:00\")\nMOC_PRINT_GENERATOR(totalsec, \"0\")\nMOC_PRINT_GENERATOR(curtime, \"0:00\")\nMOC_PRINT_GENERATOR(cursec, \"0\")\nMOC_PRINT_GENERATOR(bitrate, \"0kbps\")\nMOC_PRINT_GENERATOR(avgbitrate, \"0kbps\")\nMOC_PRINT_GENERATOR(rate, \"0kHz\")\n\n#undef MOC_PRINT_GENERATOR\n\ndouble moc_barval(struct text_object * obj) {\n  (void)obj;\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()),\n      1l);\n  const moc_result &moc = conky::register_cb<moc_cb>(period)->get_result_copy();\n  double progress;\n\n  int totalsec = atoi(moc.totalsec.c_str());\n  int cursec = atoi(moc.cursec.c_str());\n\n  if(totalsec == 0) {\n    progress = 0.0;\n  } else {\n    progress = ((double)cursec) / ((double)totalsec);\n  }\n\n  return progress;\n}\n\nuint8_t moc_percentage(struct text_object *obj){\n  return round_to_positive_int(100.0f * moc_barval(obj));\n}\n"
  },
  {
    "path": "src/data/audio/moc.h",
    "content": "/*\n *\n * MOC Conky integration\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2008, Henri Häkkinen\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef MOC_H_\n#define MOC_H_\n\ndouble moc_barval(struct text_object *);\nuint8_t moc_percentage(struct text_object *);\n\n/* Functions created by macro MOC_PRINT_GENERATOR */\nvoid print_moc_state(struct text_object *, char *, unsigned int);\nvoid print_moc_file(struct text_object *, char *, unsigned int);\nvoid print_moc_title(struct text_object *, char *, unsigned int);\nvoid print_moc_artist(struct text_object *, char *, unsigned int);\nvoid print_moc_song(struct text_object *, char *, unsigned int);\nvoid print_moc_album(struct text_object *, char *, unsigned int);\nvoid print_moc_totaltime(struct text_object *, char *, unsigned int);\nvoid print_moc_timeleft(struct text_object *, char *, unsigned int);\nvoid print_moc_totalsec(struct text_object *, char *, unsigned int);\nvoid print_moc_curtime(struct text_object *, char *, unsigned int);\nvoid print_moc_cursec(struct text_object *, char *, unsigned int);\nvoid print_moc_bitrate(struct text_object *, char *, unsigned int);\nvoid print_moc_avgbitrate(struct text_object *, char *, unsigned int);\nvoid print_moc_rate(struct text_object *, char *, unsigned int);\n\n#endif /* MOC_H_ */\n"
  },
  {
    "path": "src/data/audio/mpd.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"mpd.h\"\n#include <cmath>\n#include <mutex>\n#include \"../../conky.h\"\n#include \"libmpdclient.h\"\n#include \"../../logging.h\"\n#include \"../timeinfo.h\"\n#include \"../../update-cb.hh\"\n\nnamespace {\n\n/* this is true if the current host was set from MPD_HOST */\nbool mpd_environment_host = false;\n\nclass mpd_host_setting : public conky::simple_config_setting<std::string> {\n  using Base = conky::simple_config_setting<std::string>;\n\n protected:\n  void lua_setter(lua::state &l, bool init) override;\n\n public:\n  mpd_host_setting() : Base(\"mpd_host\", \"localhost\", false) {}\n};\n\nvoid mpd_host_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  if (l.isnil(-2)) {\n    // get the value from environment\n    mpd_environment_host = true;\n    const char *t = getenv(\"MPD_HOST\");\n    if (t != nullptr) {\n      l.checkstack(1);\n      const char *h = strchr(t, '@');\n      if (h != nullptr) {\n        if (h[1] != 0) { l.pushstring(h + 1); }\n      } else {\n        l.pushstring(t);\n      }\n      l.replace(-3);\n    }\n  }\n\n  Base::lua_setter(l, init);\n\n  ++s;\n}\n\nclass mpd_password_setting : public conky::simple_config_setting<std::string> {\n  using Base = conky::simple_config_setting<std::string>;\n\n protected:\n  void lua_setter(lua::state &l, bool init) override;\n\n public:\n  mpd_password_setting() : Base(\"mpd_password\", std::string(), false) {}\n};\n\nvoid mpd_password_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  /* for security, dont use environment password when user specifies host in\n   * config */\n  if (l.isnil(-2) && mpd_environment_host) {\n    // get the value from environment\n    const char *t = getenv(\"MPD_HOST\");\n    if (t != nullptr) {\n      const char *p = strchr(t, '@');\n      if (p != nullptr) {\n        l.checkstack(1);\n        l.pushstring(t, p - t);\n        l.replace(-3);\n      }\n    }\n  }\n\n  Base::lua_setter(l, init);\n\n  ++s;\n}\n\nconky::range_config_setting<in_port_t> mpd_port(\"mpd_port\", 1, 65535, 6600,\n                                                false);\nmpd_host_setting mpd_host;\nmpd_password_setting mpd_password;\n\nstruct mpd_result {\n  float progress{};\n  int bitrate{};\n  int elapsed{};\n  int is_playing{};\n  int length{};\n  int vol{};\n  std::string album;\n  std::string albumartist;\n  std::string artist;\n  std::string comment;\n  std::string date;\n  std::string file;\n  std::string name;\n  std::string random;\n  std::string repeat;\n  std::string status;\n  std::string title;\n  std::string track;\n};\n\nclass mpd_cb : public conky::callback<mpd_result> {\n  using Base = conky::callback<mpd_result>;\n\n  mpd_Connection *conn;\n\n protected:\n  void work() override;\n\n public:\n  explicit mpd_cb(uint32_t period)\n      : Base(period, false, Tuple()), conn(nullptr) {}\n\n  ~mpd_cb() override {\n    if (conn != nullptr) { mpd_closeConnection(conn); }\n  }\n};\n\nvoid mpd_cb::work() {\n  mpd_Status *status;\n  mpd_InfoEntity *entity;\n  mpd_result mpd_info;\n\n  do {\n    if (conn == nullptr) {\n      conn = mpd_newConnection(mpd_host.get(*state).c_str(),\n                               mpd_port.get(*state), 10);\n    }\n\n    if (static_cast<unsigned int>(!mpd_password.get(*state).empty()) != 0u) {\n      mpd_sendPasswordCommand(conn, mpd_password.get(*state).c_str());\n      mpd_finishCommand(conn);\n    }\n\n    if (conn->error != 0) {\n      NORM_ERR(\"MPD error: %s\\n\", conn->errorStr);\n      mpd_closeConnection(conn);\n      conn = nullptr;\n\n      mpd_info.status = \"MPD not responding\";\n      break;\n    }\n\n    mpd_sendStatusCommand(conn);\n    if ((status = mpd_getStatus(conn)) == nullptr) {\n      NORM_ERR(\"MPD error: %s\\n\", conn->errorStr);\n      mpd_closeConnection(conn);\n      conn = nullptr;\n\n      mpd_info.status = \"MPD not responding\";\n      break;\n    }\n    mpd_finishCommand(conn);\n    if ((conn == nullptr) || (conn->error != 0)) {\n      // fprintf(stderr, \"%s\\n\", conn->errorStr);\n      mpd_closeConnection(conn);\n      conn = nullptr;\n      break;\n    }\n\n    mpd_info.vol = status->volume;\n    if (status->random == 0) {\n      mpd_info.random = \"Off\";\n    } else if (status->random == 1) {\n      mpd_info.random = \"On\";\n    } else {\n      mpd_info.random = \"\";\n    }\n    if (status->repeat == 0) {\n      mpd_info.repeat = \"Off\";\n    } else if (status->repeat == 1) {\n      mpd_info.repeat = \"On\";\n    } else {\n      mpd_info.repeat = \"\";\n    }\n    /* if (status->error) {\n       printf(\"error: %s\\n\", status->error);\n       } */\n\n    switch (status->state) {\n      case MPD_STATUS_STATE_PLAY:\n        mpd_info.status = \"Playing\";\n        break;\n      case MPD_STATUS_STATE_STOP:\n        mpd_info.status = \"Stopped\";\n        break;\n      case MPD_STATUS_STATE_PAUSE:\n        mpd_info.status = \"Paused\";\n        break;\n      default:\n        mpd_info.status = \"\";\n        break;\n    }\n\n    if (status->state == MPD_STATUS_STATE_PLAY ||\n        status->state == MPD_STATUS_STATE_PAUSE) {\n      mpd_info.is_playing = 1;\n      mpd_info.bitrate = status->bitRate;\n      mpd_info.progress =\n          ((0 != status->totalTime)\n               ? static_cast<float>(status->elapsedTime) / status->totalTime\n               : 0.0);\n      mpd_info.elapsed = status->elapsedTime;\n      mpd_info.length = status->totalTime;\n    } else {\n      mpd_info.progress = 0;\n      mpd_info.is_playing = 0;\n      mpd_info.elapsed = 0;\n    }\n\n    if (conn->error != 0) {\n      // fprintf(stderr, \"%s\\n\", conn->errorStr);\n      mpd_closeConnection(conn);\n      conn = nullptr;\n      break;\n    }\n\n    mpd_sendCurrentSongCommand(conn);\n    while ((entity = mpd_getNextInfoEntity(conn)) != nullptr) {\n      mpd_Song *song = entity->info.song;\n\n      if (entity->type != MPD_INFO_ENTITY_TYPE_SONG) {\n        mpd_freeInfoEntity(entity);\n        continue;\n      }\n#define SETSTRING(a, b) \\\n  if (b)                \\\n    (a) = b;            \\\n  else                  \\\n    (a) = \"\";\n      SETSTRING(mpd_info.album, song->album);\n      SETSTRING(mpd_info.albumartist, song->albumartist);\n      SETSTRING(mpd_info.artist, song->artist);\n      SETSTRING(mpd_info.comment, song->comment);\n      SETSTRING(mpd_info.date, song->date);\n      SETSTRING(mpd_info.file, song->file);\n      SETSTRING(mpd_info.name, song->name);\n      SETSTRING(mpd_info.title, song->title);\n      SETSTRING(mpd_info.track, song->track);\n      if (entity != nullptr) {\n        mpd_freeInfoEntity(entity);\n        entity = nullptr;\n      }\n    }\n    mpd_finishCommand(conn);\n    if ((conn != nullptr) && (conn->error != 0)) {\n      // fprintf(stderr, \"%s\\n\", conn->errorStr);\n      mpd_closeConnection(conn);\n      conn = nullptr;\n      break;\n    }\n\n    if (conn->error != 0) {\n      // fprintf(stderr, \"%s\\n\", conn->errorStr);\n      mpd_closeConnection(conn);\n      conn = nullptr;\n      break;\n    }\n\n    mpd_freeStatus(status);\n    /* if (conn) {\n       mpd_closeConnection(conn);\n       conn = 0;\n       } */\n  } while (0);\n  std::lock_guard<std::mutex> lock(Base::result_mutex);\n  result = mpd_info;  // don't forget to save results!\n}\n\nmpd_result get_mpd() {\n  uint32_t period = std::max(\n      lround(music_player_interval.get(*state) / active_update_interval()), 1l);\n  return conky::register_cb<mpd_cb>(period)->get_result_copy();\n}\n}  // namespace\n\nstatic inline void format_media_player_time(char *buf, const int size,\n                                            int seconds) {\n  int days, hours, minutes;\n\n  if (times_in_seconds.get(*state)) {\n    snprintf(buf, size, \"%d\", seconds);\n    return;\n  }\n\n  days = seconds / (24 * 60 * 60);\n  seconds %= (24 * 60 * 60);\n  hours = seconds / (60 * 60);\n  seconds %= (60 * 60);\n  minutes = seconds / 60;\n  seconds %= 60;\n\n  if (days > 0) {\n    snprintf(buf, size, \"%i days %i:%02i:%02i\", days, hours, minutes, seconds);\n  } else if (hours > 0) {\n    snprintf(buf, size, \"%i:%02i:%02i\", hours, minutes, seconds);\n  } else {\n    snprintf(buf, size, \"%i:%02i\", minutes, seconds);\n  }\n}\n\nvoid print_mpd_elapsed(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  (void)obj;\n  format_media_player_time(p, p_max_size, get_mpd().elapsed);\n}\n\nvoid print_mpd_length(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  (void)obj;\n  format_media_player_time(p, p_max_size, get_mpd().length);\n}\n\nuint8_t mpd_percentage(struct text_object *obj) {\n  (void)obj;\n  return round_to_positive_int(get_mpd().progress * 100.0f);\n}\n\ndouble mpd_barval(struct text_object *obj) {\n  (void)obj;\n  return get_mpd().progress;\n}\n\nvoid print_mpd_smart(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  const mpd_result &mpd_info = get_mpd();\n  int len = obj->data.i;\n  if (len == 0 || static_cast<unsigned int>(len) > p_max_size) {\n    len = p_max_size;\n  }\n\n  memset(p, 0, p_max_size);\n  if ((static_cast<unsigned int>(!mpd_info.artist.empty()) != 0u) &&\n      (static_cast<unsigned int>(!mpd_info.title.empty()) != 0u)) {\n    snprintf(p, len, \"%s - %s\", mpd_info.artist.c_str(),\n             mpd_info.title.c_str());\n  } else if (static_cast<unsigned int>(!get_mpd().title.empty()) != 0u) {\n    snprintf(p, len, \"%s\", mpd_info.title.c_str());\n  } else if (static_cast<unsigned int>(!mpd_info.artist.empty()) != 0u) {\n    snprintf(p, len, \"%s\", mpd_info.artist.c_str());\n  } else if (static_cast<unsigned int>(!mpd_info.file.empty()) != 0u) {\n    snprintf(p, len, \"%s\", mpd_info.file.c_str());\n  } else {\n    *p = 0;\n  }\n}\n\nint check_mpd_playing(struct text_object *obj) {\n  (void)obj;\n  return get_mpd().is_playing;\n}\n\n#define MPD_PRINT_GENERATOR(name, fmt, acc)                    \\\n  void print_mpd_##name(struct text_object *obj, char *p,      \\\n                        unsigned int p_max_size) {             \\\n    if (obj->data.i && (unsigned int)obj->data.i < p_max_size) \\\n      p_max_size = obj->data.i;                                \\\n    snprintf(p, p_max_size, fmt, get_mpd().name acc);          \\\n  }\n\nMPD_PRINT_GENERATOR(album, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(albumartist, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(artist, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(bitrate, \"%d\", )\nMPD_PRINT_GENERATOR(comment, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(date, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(file, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(name, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(random, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(repeat, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(status, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(title, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(track, \"%s\", .c_str())\nMPD_PRINT_GENERATOR(vol, \"%d\", )\n\n#undef MPD_PRINT_GENERATOR\n"
  },
  {
    "path": "src/data/audio/mpd.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef MPD_H_\n#define MPD_H_\n\n#include <cstdint>\n\n/* text object functions */\ndouble mpd_barval(struct text_object *);\nint check_mpd_playing(struct text_object *);\nuint8_t mpd_percentage(struct text_object *);\nvoid print_mpd_album(struct text_object *, char *, unsigned int);\nvoid print_mpd_albumartist(struct text_object *, char *, unsigned int);\nvoid print_mpd_artist(struct text_object *, char *, unsigned int);\nvoid print_mpd_bitrate(struct text_object *, char *, unsigned int);\nvoid print_mpd_comment(struct text_object *, char *, unsigned int);\nvoid print_mpd_date(struct text_object *, char *, unsigned int);\nvoid print_mpd_elapsed(struct text_object *, char *, unsigned int);\nvoid print_mpd_file(struct text_object *, char *, unsigned int);\nvoid print_mpd_length(struct text_object *, char *, unsigned int);\nvoid print_mpd_name(struct text_object *, char *, unsigned int);\nvoid print_mpd_random(struct text_object *, char *, unsigned int);\nvoid print_mpd_repeat(struct text_object *, char *, unsigned int);\nvoid print_mpd_smart(struct text_object *, char *, unsigned int);\nvoid print_mpd_status(struct text_object *, char *, unsigned int);\nvoid print_mpd_title(struct text_object *, char *, unsigned int);\nvoid print_mpd_track(struct text_object *, char *, unsigned int);\nvoid print_mpd_vol(struct text_object *, char *, unsigned int);\n\n#endif /*MPD_H_*/\n"
  },
  {
    "path": "src/data/audio/pulseaudio.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *     (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"pulseaudio.h\"\n#include <math.h>\n#include <unistd.h>\n#include \"../../common.h\"\n#include \"config.h\"\n#include \"../../conky.h\"\n#include \"../../core.h\"\n#include \"../../logging.h\"\n#include \"../../content/specials.h\"\n#include \"../../content/text_object.h\"\n\nstruct pulseaudio_default_results get_result_copy();\n\nconst struct pulseaudio_default_results pulseaudio_result0 = {\n    std::string(),\n    std::string(),\n    std::string(),\n    std::string(),\n    0,\n    0,\n    0,\n    0,\n    std::string(),\n    PA_SOURCE_SUSPENDED,\n    0,\n    std::string(),\n    std::string(),\n    0};\npulseaudio_c *pulseaudio = nullptr;\n\nvoid pa_sink_info_callback(pa_context *c, const pa_sink_info *i, int eol,\n                           void *data) {\n  if (i != nullptr && data) {\n    struct pulseaudio_default_results *pdr =\n        (struct pulseaudio_default_results *)data;\n    pdr->sink_description.assign(i->description);\n    pdr->sink_mute = i->mute;\n    pdr->sink_card = i->card;\n    pdr->sink_index = i->index;\n    if (i->active_port != nullptr) {\n      pdr->sink_active_port_name.assign(i->active_port->name);\n      pdr->sink_active_port_description.assign(i->active_port->description);\n    } else {\n      pdr->sink_active_port_name.erase();\n      pdr->sink_active_port_description.erase();\n    }\n    pdr->sink_volume = round_to_positive_int(\n        100.0f * (float)pa_cvolume_avg(&(i->volume)) / (float)PA_VOLUME_NORM);\n    pa_threaded_mainloop_signal(pulseaudio->mainloop, 0);\n  }\n  (void)c;\n  ++eol;\n}\n\nvoid pa_source_info_callback(pa_context *c, const pa_source_info *i, int eol,\n                             void *data) {\n  if (i != nullptr && data) {\n    struct pulseaudio_default_results *pdr =\n        (struct pulseaudio_default_results *)data;\n    pdr->source_state = i->state;\n    pdr->source_mute = i->mute;\n    pa_threaded_mainloop_signal(pulseaudio->mainloop, 0);\n  }\n  (void)c;\n  ++eol;\n}\n\nvoid pa_server_info_callback(pa_context *c, const pa_server_info *i,\n                             void *userdata) {\n  if (i != nullptr) {\n    struct pulseaudio_default_results *pdr =\n        (struct pulseaudio_default_results *)userdata;\n    pdr->sink_name.assign(i->default_sink_name);\n    pdr->source_name.assign(i->default_source_name);\n    pa_threaded_mainloop_signal(pulseaudio->mainloop, 0);\n  }\n  (void)c;\n}\n\nvoid pa_server_sink_info_callback(pa_context *c, const pa_server_info *i,\n                                  void *userdata) {\n  if (i != nullptr) {\n    struct pulseaudio_default_results *pdr =\n        (struct pulseaudio_default_results *)userdata;\n    pdr->sink_name.assign(i->default_sink_name);\n    if (pdr->sink_name.empty()) return;\n    pa_operation *op;\n    if (!(op = pa_context_get_sink_info_by_name(c, pdr->sink_name.c_str(),\n                                                pa_sink_info_callback, pdr))) {\n      NORM_ERR(\"pa_context_get_sink_info_by_index() failed\");\n      return;\n    }\n    pa_operation_unref(op);\n  }\n  (void)c;\n}\n\nvoid pa_card_info_callback(pa_context *c, const pa_card_info *card, int eol,\n                           void *userdata) {\n  if (card) {\n    struct pulseaudio_default_results *pdr =\n        (struct pulseaudio_default_results *)userdata;\n    pdr->card_name.assign(card->name);\n    pdr->card_index = card->index;\n    pdr->card_active_profile_description.assign(\n        card->active_profile->description);\n    pa_threaded_mainloop_signal(pulseaudio->mainloop, 0);\n  }\n  (void)c;\n  eol++;\n}\n\nvoid context_state_cb(pa_context *c, void *userdata) {\n  pulseaudio_c *puau_int = static_cast<pulseaudio_c *>(userdata);\n  switch (pa_context_get_state(c)) {\n    case PA_CONTEXT_UNCONNECTED:\n    case PA_CONTEXT_CONNECTING:\n    case PA_CONTEXT_AUTHORIZING:\n    case PA_CONTEXT_SETTING_NAME:\n      break;\n\n    case PA_CONTEXT_READY: {\n      puau_int->cstate = PULSE_CONTEXT_READY;\n      break;\n    }\n    case PA_CONTEXT_FAILED:\n    case PA_CONTEXT_TERMINATED: {\n      puau_int->cstate = PULSE_CONTEXT_FINISHED;\n      break;\n    }\n    default:\n      return;\n  }\n}\n\n#define PULSEAUDIO_OP(command, error_msg) \\\n  if (!(op = command)) {                  \\\n    NORM_ERR(error_msg);                  \\\n    return;                               \\\n  }                                       \\\n  pa_operation_unref(op);\n\nvoid subscribe_cb(pa_context *c, pa_subscription_event_type_t t, uint32_t index,\n                  void *userdata) {\n  struct pulseaudio_default_results *res =\n      (struct pulseaudio_default_results *)userdata;\n\n  switch (t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) {\n    case PA_SUBSCRIPTION_EVENT_SINK: {\n      if (res->sink_name.empty()) return;\n      pa_operation *op;\n      PULSEAUDIO_OP(pa_context_get_sink_info_by_name(\n                        c, res->sink_name.c_str(), pa_sink_info_callback, res),\n                    \"pa_context_get_sink_info_by_name failed\");\n    } break;\n\n    case PA_SUBSCRIPTION_EVENT_SOURCE: {\n      if (res->source_name.empty()) return;\n      pa_operation *op;\n      PULSEAUDIO_OP(\n          pa_context_get_source_info_by_name(c, res->source_name.c_str(),\n                                             pa_source_info_callback, res),\n          \"pa_context_get_source_info_by_name failed\");\n    } break;\n\n    case PA_SUBSCRIPTION_EVENT_CARD:\n      if (index == res->card_index && res->card_index != (uint32_t)-1) {\n        pa_operation *op;\n        PULSEAUDIO_OP(pa_context_get_card_info_by_index(\n                          c, index, pa_card_info_callback, res),\n                      \"pa_context_get_card_info_by_index() failed\")\n      }\n      break;\n\n    case PA_SUBSCRIPTION_EVENT_SERVER: {\n      pa_operation *op;\n      PULSEAUDIO_OP(\n          pa_context_get_server_info(c, pa_server_sink_info_callback, res),\n          \"pa_context_get_server_info() failed\");\n    } break;\n  }\n}\n\n#define PULSEAUDIO_WAIT(COMMAND)                                 \\\n  {                                                              \\\n    op = COMMAND;                                                \\\n    while (pa_operation_get_state(op) == PA_OPERATION_RUNNING) { \\\n      pa_threaded_mainloop_wait(pulseaudio->mainloop);           \\\n    }                                                            \\\n    pa_operation_unref(op);                                      \\\n  }\n\nvoid init_pulseaudio(struct text_object *obj) {\n  // already initialized\n  (void)obj;\n  if (pulseaudio != nullptr && pulseaudio->cstate == PULSE_CONTEXT_READY) {\n    pulseaudio->ninits++;\n    obj->data.opaque = (void *)pulseaudio;\n    return;\n  }\n  pulseaudio = new pulseaudio_c();\n  obj->data.opaque = (void *)pulseaudio;\n  pulseaudio->ninits++;\n\n  // Create a mainloop API and connection to the default server\n  pulseaudio->mainloop = pa_threaded_mainloop_new();\n  if (!pulseaudio->mainloop) NORM_ERR(\"Cannot create pulseaudio mainloop\");\n\n  pulseaudio->mainloop_api = pa_threaded_mainloop_get_api(pulseaudio->mainloop);\n\n  if (!pulseaudio->mainloop_api) NORM_ERR(\"Cannot get mainloop api\");\n\n  pulseaudio->context = pa_context_new(pulseaudio->mainloop_api, \"Conky Infos\");\n\n  // This function defines a callback so the server will tell us its state.\n  pa_context_set_state_callback(pulseaudio->context, context_state_cb,\n                                pulseaudio);\n\n  // This function connects to the pulse server\n  if (pa_context_connect(pulseaudio->context, nullptr, (pa_context_flags_t)0,\n                         nullptr) < 0) {\n    CRIT_ERR(\"Cannot connect to pulseaudio\");\n    return;\n  }\n  pa_threaded_mainloop_start(pulseaudio->mainloop);\n\n  while (pulseaudio->cstate != PULSE_CONTEXT_READY) {\n    struct timespec req;\n    struct timespec rem;\n    req.tv_sec = 1;\n    req.tv_nsec = 200000;\n\n    nanosleep(&req, &rem);\n  }\n\n  // Initial parameters update\n\n  pa_operation *op;\n  PULSEAUDIO_WAIT(pa_context_get_server_info(\n      pulseaudio->context, pa_server_info_callback, &pulseaudio->result));\n\n  if (pulseaudio->result.sink_name.empty()) return;\n\n  PULSEAUDIO_WAIT(pa_context_get_sink_info_by_name(\n      pulseaudio->context, pulseaudio->result.sink_name.c_str(),\n      pa_sink_info_callback, &pulseaudio->result));\n\n  if (pulseaudio->result.sink_name.empty()) {\n    NORM_ERR(\"Incorrect pulseaudio sink information.\");\n    return;\n  }\n\n  if (pulseaudio->result.source_name.empty()) return;\n\n  PULSEAUDIO_WAIT(pa_context_get_source_info_by_name(\n      pulseaudio->context, pulseaudio->result.source_name.c_str(),\n      pa_source_info_callback, &pulseaudio->result));\n\n  if (pulseaudio->result.source_name.empty()) {\n    NORM_ERR(\"Incorrect pulseaudio source information.\");\n    return;\n  }\n  if (pulseaudio->result.sink_card != (uint32_t)-1)\n    PULSEAUDIO_WAIT(pa_context_get_card_info_by_index(\n        pulseaudio->context, pulseaudio->result.sink_card,\n        pa_card_info_callback, &pulseaudio->result));\n\n  // get notification when something changes in PA\n  pa_context_set_subscribe_callback(pulseaudio->context, subscribe_cb,\n                                    &pulseaudio->result);\n\n  if (!(op = pa_context_subscribe(\n            pulseaudio->context,\n            (pa_subscription_mask_t)(PA_SUBSCRIPTION_MASK_SINK |\n                                     PA_SUBSCRIPTION_MASK_SOURCE |\n                                     PA_SUBSCRIPTION_MASK_SERVER |\n                                     PA_SUBSCRIPTION_MASK_CARD),\n            nullptr, NULL))) {\n    NORM_ERR(\"pa_context_subscribe() failed\");\n    return;\n  }\n  pa_operation_unref(op);\n}\n\nvoid free_pulseaudio(struct text_object *obj) {\n  pulseaudio_c *puau_int = static_cast<pulseaudio_c *>(obj->data.opaque);\n\n  if (!puau_int) return;\n\n  if (--puau_int->ninits > 0) {\n    obj->data.opaque = nullptr;\n    return;\n  }\n\n  puau_int->cstate = PULSE_CONTEXT_FINISHED;\n\n  if (puau_int->context) {\n    pa_context_set_state_callback(puau_int->context, nullptr, NULL);\n    pa_context_disconnect(puau_int->context);\n    pa_context_unref(puau_int->context);\n  }\n  if (puau_int->mainloop) {\n    pa_threaded_mainloop_stop(puau_int->mainloop);\n    pa_threaded_mainloop_free(puau_int->mainloop);\n  }\n  delete puau_int;\n  puau_int = nullptr;\n}\n\nstruct pulseaudio_default_results get_pulseaudio(struct text_object *obj) {\n  pulseaudio_c *puau_int = static_cast<pulseaudio_c *>(obj->data.opaque);\n  if (puau_int && puau_int->cstate == PULSE_CONTEXT_READY)\n    return puau_int->result;\n  return pulseaudio_result0;\n}\n\nuint8_t puau_vol(struct text_object *obj) {\n  return get_pulseaudio(obj).sink_volume;\n}\n\nint puau_muted(struct text_object *obj) {\n  return get_pulseaudio(obj).sink_mute;\n}\n\nint puau_source_running(struct text_object *obj) {\n  return get_pulseaudio(obj).source_state == PA_SOURCE_RUNNING;\n}\n\nint puau_source_muted(struct text_object *obj) {\n  return get_pulseaudio(obj).source_mute;\n}\n\nvoid print_puau_sink_description(struct text_object *obj, char *p,\n                                 unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%s\", get_pulseaudio(obj).sink_description.c_str());\n}\n\nvoid print_puau_sink_active_port_name(struct text_object *obj, char *p,\n                                      unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%s\",\n           get_pulseaudio(obj).sink_active_port_name.c_str());\n}\n\nvoid print_puau_sink_active_port_description(struct text_object *obj, char *p,\n                                             unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%s\",\n           get_pulseaudio(obj).sink_active_port_description.c_str());\n}\n\nvoid print_puau_card_active_profile(struct text_object *obj, char *p,\n                                    unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%s\",\n           get_pulseaudio(obj).card_active_profile_description.c_str());\n}\n\nvoid print_puau_card_name(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  snprintf(p, p_max_size, \"%s\", get_pulseaudio(obj).card_name.c_str());\n}\n\ndouble puau_volumebarval(struct text_object *obj) {\n  return get_pulseaudio(obj).sink_volume / 100.0f;\n}\n"
  },
  {
    "path": "src/data/audio/pulseaudio.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _PULSEAUDIO_H\n#define _PULSEAUDIO_H\n\n#include <pulse/pulseaudio.h>\n#include <string>\n#include \"../../content/text_object.h\"\n\nvoid init_pulseaudio(struct text_object *obj);\nvoid free_pulseaudio(struct text_object *obj);\nuint8_t puau_vol(struct text_object *);  // preserve pa_* for libpulse\nvoid print_puau_sink_description(struct text_object *obj, char *p,\n                                 unsigned int p_max_size);\nvoid print_puau_sink_active_port_name(struct text_object *obj, char *p,\n                                      unsigned int p_max_size);\nvoid print_puau_sink_active_port_description(struct text_object *obj, char *p,\n                                             unsigned int p_max_size);\nvoid print_puau_card_name(struct text_object *obj, char *p,\n                          unsigned int p_max_size);\nvoid print_puau_card_active_profile(struct text_object *obj, char *p,\n                                    unsigned int p_max_size);\ndouble puau_volumebarval(struct text_object *obj);\nint puau_muted(struct text_object *obj);\nint puau_source_running(struct text_object *obj);\nint puau_source_muted(struct text_object *obj);\n\nstruct pulseaudio_default_results {\n  // default sink\n  std::string sink_name;\n  std::string sink_description;\n  std::string sink_active_port_name;\n  std::string sink_active_port_description;\n  uint32_t sink_card;\n  int sink_mute;\n  uint32_t sink_index;\n  unsigned int sink_volume;  // percentage\n\n  // default source\n  std::string source_name;\n  pa_source_state source_state;\n  int source_mute;\n\n  // default card\n  std::string card_active_profile_description;\n  std::string card_name;\n  uint32_t card_index;\n};\n\nenum pulseaudio_state {\n  PULSE_CONTEXT_INITIALIZING,\n  PULSE_CONTEXT_READY,\n  PULSE_CONTEXT_FINISHED\n};\n\nclass pulseaudio_c {\n public:\n  pa_threaded_mainloop *mainloop;\n  pa_mainloop_api *mainloop_api;\n  pa_context *context;\n  volatile enum pulseaudio_state cstate;\n  int ninits;\n  struct pulseaudio_default_results result;\n  pulseaudio_c()\n      : mainloop(nullptr),\n        mainloop_api(nullptr),\n        context(nullptr),\n        cstate(PULSE_CONTEXT_INITIALIZING),\n        ninits(0),\n        result({std::string(), std::string(), std::string(), std::string(), 0,\n                0, 0, 0, std::string(), PA_SOURCE_SUSPENDED, 0, std::string(),\n                std::string(), 0}){};\n};\n\n#endif /* _PULSEAUDIO_H */\n"
  },
  {
    "path": "src/data/audio/xmms2.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"../../conky.h\"\n\nxmmsc_connection_t *xmms2_conn;\n\n#define CONN_INIT 0\n#define CONN_OK 1\n#define CONN_NO 2\n\nstatic void xmms_alloc(struct information *ptr) {\n  if (ptr->xmms2.artist == nullptr) {\n    ptr->xmms2.artist = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  if (ptr->xmms2.album == nullptr) {\n    ptr->xmms2.album = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  if (ptr->xmms2.title == nullptr) {\n    ptr->xmms2.title = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  if (ptr->xmms2.genre == nullptr) {\n    ptr->xmms2.genre = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  if (ptr->xmms2.comment == nullptr) {\n    ptr->xmms2.comment = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  if (ptr->xmms2.url == nullptr) {\n    ptr->xmms2.url = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  if (ptr->xmms2.date == nullptr) {\n    ptr->xmms2.date = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  ptr->xmms2.artist[0] = '\\0';\n  ptr->xmms2.album[0] = '\\0';\n  ptr->xmms2.title[0] = '\\0';\n  ptr->xmms2.genre[0] = '\\0';\n  ptr->xmms2.comment[0] = '\\0';\n  ptr->xmms2.url[0] = '\\0';\n  ptr->xmms2.date[0] = '\\0';\n\n  ptr->xmms2.tracknr = 0;\n  ptr->xmms2.id = 0;\n  ptr->xmms2.bitrate = 0;\n  ptr->xmms2.duration = 0;\n  ptr->xmms2.elapsed = 0;\n  ptr->xmms2.size = 0;\n  ptr->xmms2.progress = 0;\n  ptr->xmms2.timesplayed = -1;\n}\n\nvoid free_xmms2(struct text_object *obj) {\n  (void)obj;\n\n  free_and_zero(info.xmms2.artist);\n  free_and_zero(info.xmms2.album);\n  free_and_zero(info.xmms2.title);\n  free_and_zero(info.xmms2.genre);\n  free_and_zero(info.xmms2.comment);\n  free_and_zero(info.xmms2.url);\n  free_and_zero(info.xmms2.date);\n  free_and_zero(info.xmms2.status);\n  free_and_zero(info.xmms2.playlist);\n}\n\nvoid connection_lost(void *p) {\n  struct information *ptr = (struct information *)p;\n  ptr->xmms2.conn_state = CONN_NO;\n\n  fprintf(stderr, \"XMMS2 connection failed. %s\\n\",\n          xmmsc_get_last_error(xmms2_conn));\n\n  xmms_alloc(ptr);\n  strncpy(ptr->xmms2.status, \"Disconnected\", text_buffer_size.get(*state) - 1);\n  ptr->xmms2.playlist[0] = '\\0';\n  ptr->xmms2.id = 0;\n}\n\nint handle_curent_id(xmmsv_t *value, void *p) {\n  struct information *ptr = (struct information *)p;\n  xmmsv_t *val, *infos, *dict_entry;\n  xmmsc_result_t *res;\n  const char *errbuf;\n  int current_id;\n\n  const char *charval;\n  int intval;\n\n  if (xmmsv_get_error(value, &errbuf)) {\n    fprintf(stderr, \"XMMS2 server error. %s\\n\", errbuf);\n    return TRUE;\n  }\n\n  if (xmmsv_get_int(value, &current_id) && current_id > 0) {\n    res = xmmsc_medialib_get_info(xmms2_conn, current_id);\n    xmmsc_result_wait(res);\n    val = xmmsc_result_get_value(res);\n\n    if (xmmsv_get_error(val, &errbuf)) {\n      fprintf(stderr, \"XMMS2 server error. %s\\n\", errbuf);\n      return TRUE;\n    }\n\n    xmms_alloc(ptr);\n\n    ptr->xmms2.id = current_id;\n\n    infos = xmmsv_propdict_to_dict(val, nullptr);\n\n    if (xmmsv_dict_get(infos, \"artist\", &dict_entry) &&\n        xmmsv_get_string(dict_entry, &charval))\n      strncpy(ptr->xmms2.artist, charval, text_buffer_size.get(*state) - 1);\n\n    if (xmmsv_dict_get(infos, \"title\", &dict_entry) &&\n        xmmsv_get_string(dict_entry, &charval))\n      strncpy(ptr->xmms2.title, charval, text_buffer_size.get(*state) - 1);\n\n    if (xmmsv_dict_get(infos, \"album\", &dict_entry) &&\n        xmmsv_get_string(dict_entry, &charval))\n      strncpy(ptr->xmms2.album, charval, text_buffer_size.get(*state) - 1);\n\n    if (xmmsv_dict_get(infos, \"genre\", &dict_entry) &&\n        xmmsv_get_string(dict_entry, &charval))\n      strncpy(ptr->xmms2.genre, charval, text_buffer_size.get(*state) - 1);\n\n    if (xmmsv_dict_get(infos, \"comment\", &dict_entry) &&\n        xmmsv_get_string(dict_entry, &charval))\n      strncpy(ptr->xmms2.comment, charval, text_buffer_size.get(*state) - 1);\n\n    if (xmmsv_dict_get(infos, \"url\", &dict_entry) &&\n        xmmsv_get_string(dict_entry, &charval))\n      strncpy(ptr->xmms2.url, charval, text_buffer_size.get(*state) - 1);\n\n    if (xmmsv_dict_get(infos, \"date\", &dict_entry) &&\n        xmmsv_get_string(dict_entry, &charval))\n      strncpy(ptr->xmms2.date, charval, text_buffer_size.get(*state) - 1);\n\n    if (xmmsv_dict_get(infos, \"tracknr\", &dict_entry) &&\n        xmmsv_get_int(dict_entry, &intval))\n      ptr->xmms2.tracknr = intval;\n\n    if (xmmsv_dict_get(infos, \"duration\", &dict_entry) &&\n        xmmsv_get_int(dict_entry, &intval))\n      ptr->xmms2.duration = intval;\n\n    if (xmmsv_dict_get(infos, \"bitrate\", &dict_entry) &&\n        xmmsv_get_int(dict_entry, &intval))\n      ptr->xmms2.bitrate = intval / 1000;\n\n    if (xmmsv_dict_get(infos, \"size\", &dict_entry) &&\n        xmmsv_get_int(dict_entry, &intval))\n      ptr->xmms2.size = (float)intval / 1048576;\n\n    if (xmmsv_dict_get(infos, \"timesplayed\", &dict_entry) &&\n        xmmsv_get_int(dict_entry, &intval))\n      ptr->xmms2.timesplayed = intval;\n\n    xmmsv_unref(infos);\n    xmmsc_result_unref(res);\n  }\n  return TRUE;\n}\n\nint handle_playtime(xmmsv_t *value, void *p) {\n  struct information *ptr = (struct information *)p;\n  int play_time;\n  const char *errbuf;\n\n  if (xmmsv_get_error(value, &errbuf)) {\n    fprintf(stderr, \"XMMS2 server error. %s\\n\", errbuf);\n    return TRUE;\n  }\n\n  if (xmmsv_get_int(value, &play_time)) {\n    ptr->xmms2.elapsed = play_time;\n    ptr->xmms2.progress = (float)play_time / ptr->xmms2.duration;\n    ptr->xmms2.percent = (int)(ptr->xmms2.progress * 100);\n  }\n\n  return TRUE;\n}\n\nint handle_playback_state_change(xmmsv_t *value, void *p) {\n  struct information *ptr = (struct information *)p;\n  int pb_state = 0;\n  const char *errbuf;\n\n  if (xmmsv_get_error(value, &errbuf)) {\n    fprintf(stderr, \"XMMS2 server error. %s\\n\", errbuf);\n    return TRUE;\n  }\n\n  if (ptr->xmms2.status == nullptr) {\n    ptr->xmms2.status = (char *)malloc(text_buffer_size.get(*state));\n    ptr->xmms2.status[0] = '\\0';\n  }\n\n  if (xmmsv_get_int(value, &pb_state)) {\n    switch (pb_state) {\n      case XMMS_PLAYBACK_STATUS_PLAY:\n        strncpy(ptr->xmms2.status, \"Playing\", text_buffer_size.get(*state) - 1);\n        break;\n      case XMMS_PLAYBACK_STATUS_PAUSE:\n        strncpy(ptr->xmms2.status, \"Paused\", text_buffer_size.get(*state) - 1);\n        break;\n      case XMMS_PLAYBACK_STATUS_STOP:\n        strncpy(ptr->xmms2.status, \"Stopped\", text_buffer_size.get(*state) - 1);\n        ptr->xmms2.elapsed = ptr->xmms2.progress = ptr->xmms2.percent = 0;\n        break;\n      default:\n        strncpy(ptr->xmms2.status, \"Unknown\", text_buffer_size.get(*state) - 1);\n    }\n  }\n  return TRUE;\n}\n\nint handle_playlist_loaded(xmmsv_t *value, void *p) {\n  struct information *ptr = (struct information *)p;\n  const char *c, *errbuf;\n\n  if (xmmsv_get_error(value, &errbuf)) {\n    fprintf(stderr, \"XMMS2 server error. %s\\n\", errbuf);\n    return TRUE;\n  }\n\n  if (ptr->xmms2.playlist == nullptr) {\n    ptr->xmms2.playlist = (char *)malloc(text_buffer_size.get(*state));\n    ptr->xmms2.playlist[0] = '\\0';\n  }\n\n  if (xmmsv_get_string(value, &c)) {\n    strncpy(ptr->xmms2.playlist, c, text_buffer_size.get(*state) - 1);\n  }\n  return TRUE;\n}\n\nint handle_medialib_changed(xmmsv_t *value, void *p) {\n  struct information *ptr = (struct information *)p;\n  const char *errbuf;\n  int current_id;\n\n  if (xmmsv_get_error(value, &errbuf)) {\n    fprintf(stderr, \"XMMS2 server error. %s\\n\", errbuf);\n    return TRUE;\n  }\n\n  if (xmmsv_get_int(value, &current_id) && current_id > 0 &&\n      ptr->xmms2.id == (unsigned int)current_id) {\n    return handle_curent_id(value, ptr);\n  }\n\n  return TRUE;\n}\n\nint update_xmms2(void) {\n  struct information *current_info = &info;\n\n  /* initialize connection */\n  if (current_info->xmms2.conn_state == CONN_INIT) {\n    if (xmms2_conn == nullptr) { xmms2_conn = xmmsc_init(PACKAGE_NAME); }\n\n    /* did init fail? */\n    if (xmms2_conn == nullptr) {\n      fprintf(stderr, \"XMMS2 init failed. %s\\n\",\n              xmmsc_get_last_error(xmms2_conn));\n      return 0;\n    }\n\n    /* init ok but not connected yet.. */\n    current_info->xmms2.conn_state = CONN_NO;\n\n    /* clear all values */\n    xmms_alloc(current_info);\n  }\n\n  /* connect */\n  if (current_info->xmms2.conn_state == CONN_NO) {\n    char *path = getenv(\"XMMS_PATH\");\n\n    if (!xmmsc_connect(xmms2_conn, path)) {\n      fprintf(stderr, \"XMMS2 connection failed. %s\\n\",\n              xmmsc_get_last_error(xmms2_conn));\n      current_info->xmms2.conn_state = CONN_NO;\n      return 0;\n    }\n\n    /* set callbacks */\n    xmmsc_disconnect_callback_set(xmms2_conn, connection_lost, current_info);\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_broadcast_playback_current_id,\n                      handle_curent_id, current_info);\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_signal_playback_playtime,\n                      handle_playtime, current_info);\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_broadcast_playback_status,\n                      handle_playback_state_change, current_info);\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_broadcast_playlist_loaded,\n                      handle_playlist_loaded, current_info);\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_broadcast_medialib_entry_changed,\n                      handle_medialib_changed, current_info);\n\n    /* get playback status, current id and active playlist */\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_playback_current_id, handle_curent_id,\n                      current_info);\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_playback_status,\n                      handle_playback_state_change, current_info);\n    XMMS_CALLBACK_SET(xmms2_conn, xmmsc_playlist_current_active,\n                      handle_playlist_loaded, current_info);\n\n    /* everything seems to be ok */\n    current_info->xmms2.conn_state = CONN_OK;\n  }\n\n  /* handle callbacks */\n  if (current_info->xmms2.conn_state == CONN_OK) {\n    xmmsc_io_in_handle(xmms2_conn);\n    if (xmmsc_io_want_out(xmms2_conn)) xmmsc_io_out_handle(xmms2_conn);\n  }\n  return 0;\n}\n\nvoid print_xmms2_tracknr(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  (void)obj;\n  if (info.xmms2.tracknr != -1) {\n    snprintf(p, p_max_size, \"%i\", info.xmms2.tracknr);\n  }\n}\n\nvoid print_xmms2_elapsed(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%02d:%02d\", info.xmms2.elapsed / 60000,\n           (info.xmms2.elapsed / 1000) % 60);\n}\n\nvoid print_xmms2_duration(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%02d:%02d\", info.xmms2.duration / 60000,\n           (info.xmms2.duration / 1000) % 60);\n}\n\ndouble xmms2_barval(struct text_object *obj) {\n  (void)obj;\n\n  return info.xmms2.progress;\n}\n\nvoid print_xmms2_smart(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  (void)obj;\n  int artist_len = strlen(info.xmms2.artist);\n  int title_len = strlen(info.xmms2.title);\n  if (artist_len < 2 && title_len < 2) {\n    snprintf(p, p_max_size, \"%s\", info.xmms2.url);\n  } else if (artist_len < 1) {\n    snprintf(p, p_max_size, \"%s\", info.xmms2.title);\n  } else {\n    snprintf(p, p_max_size, \"%s - %s\", info.xmms2.artist, info.xmms2.title);\n  }\n}\n\n#define XMMS2_PRINT_GENERATOR(name, fmt)                    \\\n  void print_xmms2_##name(struct text_object *obj, char *p, \\\n                          unsigned int p_max_size) {        \\\n    (void)obj;                                              \\\n    snprintf(p, p_max_size, fmt, info.xmms2.name);          \\\n  }\n\nXMMS2_PRINT_GENERATOR(artist, \"%s\")\nXMMS2_PRINT_GENERATOR(album, \"%s\")\nXMMS2_PRINT_GENERATOR(title, \"%s\")\nXMMS2_PRINT_GENERATOR(genre, \"%s\")\nXMMS2_PRINT_GENERATOR(comment, \"%s\")\nXMMS2_PRINT_GENERATOR(url, \"%s\")\nXMMS2_PRINT_GENERATOR(status, \"%s\")\nXMMS2_PRINT_GENERATOR(date, \"%s\")\nXMMS2_PRINT_GENERATOR(bitrate, \"%i\")\nXMMS2_PRINT_GENERATOR(id, \"%u\")\nXMMS2_PRINT_GENERATOR(size, \"%2.1f\")\nXMMS2_PRINT_GENERATOR(playlist, \"%s\")\nXMMS2_PRINT_GENERATOR(timesplayed, \"%i\")\nXMMS2_PRINT_GENERATOR(percent, \"%i\")\n\n#undef XMMS2_PRINT_GENERATOR\n\nint if_xmms2_connected(struct text_object *obj) {\n  (void)obj;\n\n  return info.xmms2.conn_state == CONN_OK;\n}\n"
  },
  {
    "path": "src/data/audio/xmms2.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef XMMS2_H_\n#define XMMS2_H_\n\n#include <xmmsclient/xmmsclient.h>\n\nstruct xmms2_s {\n  char *artist;\n  char *album;\n  char *title;\n  char *genre;\n  char *comment;\n  char *url;\n  char *date;\n  char *playlist;\n  int tracknr;\n  int bitrate;\n  unsigned int id;\n  int duration;\n  int elapsed;\n  int timesplayed;\n  float size;\n\n  float progress;\n  int percent;\n  char *status;\n  int conn_state;\n};\n\nint update_xmms2(void);\n\nvoid print_xmms2_tracknr(struct text_object *, char *, unsigned int);\nvoid print_xmms2_elapsed(struct text_object *, char *, unsigned int);\nvoid print_xmms2_duration(struct text_object *, char *, unsigned int);\ndouble xmms2_barval(struct text_object *);\nvoid print_xmms2_smart(struct text_object *, char *, unsigned int);\nvoid print_xmms2_artist(struct text_object *, char *, unsigned int);\nvoid print_xmms2_album(struct text_object *, char *, unsigned int);\nvoid print_xmms2_title(struct text_object *, char *, unsigned int);\nvoid print_xmms2_genre(struct text_object *, char *, unsigned int);\nvoid print_xmms2_comment(struct text_object *, char *, unsigned int);\nvoid print_xmms2_url(struct text_object *, char *, unsigned int);\nvoid print_xmms2_status(struct text_object *, char *, unsigned int);\nvoid print_xmms2_date(struct text_object *, char *, unsigned int);\nvoid print_xmms2_bitrate(struct text_object *, char *, unsigned int);\nvoid print_xmms2_id(struct text_object *, char *, unsigned int);\nvoid print_xmms2_size(struct text_object *, char *, unsigned int);\nvoid print_xmms2_playlist(struct text_object *, char *, unsigned int);\nvoid print_xmms2_timesplayed(struct text_object *, char *, unsigned int);\nvoid print_xmms2_percent(struct text_object *, char *, unsigned int);\nint if_xmms2_connected(struct text_object *);\n\nvoid free_xmms2(struct text_object *);\n\n#endif /*XMMS2_H_*/\n"
  },
  {
    "path": "src/data/data-source.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"data-source.hh\"\n\n#include <iostream>\n#include <sstream>\n#include <unordered_map>\n\nnamespace conky {\nnamespace {\n/*\n * Returned when there is no data available.\n * An alternative would be to throw an exception, but if we don't want to react\n * too aggressively when the user e.g. uses a nonexisting variable, then\n * returning NaN will do just fine.\n */\nfloat NaN = std::numeric_limits<float>::quiet_NaN();\n\ntypedef std::unordered_map<std::string, lua::cpp_function> data_sources_t;\n\n/*\n * We cannot construct this object statically, because order of object\n * construction in different modules is not defined, so register_source could be\n * called before this object is constructed. Therefore, we create it on the\n * first call to register_source.\n */\ndata_sources_t *data_sources;\n\ndata_source_base &get_data_source(lua::state *l) {\n  if (l->gettop() != 1) {\n    throw std::runtime_error(\"Wrong number of parameters\");\n  }\n\n  l->rawgetfield(lua::REGISTRYINDEX, priv::data_source_metatable);\n  if (!l->getmetatable(-2) || !l->rawequal(-1, -2)) {\n    throw std::runtime_error(\"Invalid parameter\");\n  }\n\n  return *static_cast<data_source_base *>(l->touserdata(1));\n}\n\nint data_source_asnumber(lua::state *l) {\n  double x = get_data_source(l).get_number();\n  l->pushnumber(x);\n  return 1;\n}\n\nint data_source_astext(lua::state *l) {\n  std::string x = get_data_source(l).get_text();\n  l->pushstring(x);\n  return 1;\n}\n\nconst char data_source__index[] =\n    \"local table, key = ...;\\n\"\n    \"if key == 'num' then\\n\"\n    \"  return conky.asnumber(table);\\n\"\n    \"elseif key == 'text' then\\n\"\n    \"  return conky.astext(table);\\n\"\n    \"else\\n\"\n    \"  print(string.format([[Invalid data source operation: '%s']], key));\\n\"\n    \"  return 0/0;\\n\"\n    \"end\\n\";\n}  // namespace\n\nnamespace priv {\nvoid do_register_data_source(const std::string &name,\n                             const lua::cpp_function &fn) {\n  struct data_source_constructor {\n    data_source_constructor() { data_sources = new data_sources_t(); }\n    ~data_source_constructor() {\n      delete data_sources;\n      data_sources = nullptr;\n    }\n  };\n  static data_source_constructor constructor;\n\n  bool inserted = data_sources->insert({name, fn}).second;\n  if (!inserted) {\n    throw std::logic_error(\"Data source with name '\" + name +\n                           \"' already registered\");\n  }\n}\n\ndisabled_data_source::disabled_data_source(lua::state *l,\n                                           const std::string &name,\n                                           const std::string &setting)\n    : simple_numeric_source<float>(l, name, &NaN) {\n  // XXX some generic way of reporting errors? NORM_ERR?\n  std::cerr << \"Support for variable '\" << name\n            << \"' has been disabled during compilation. Please recompile with '\"\n            << setting << \"'\" << std::endl;\n}\n}  // namespace priv\n\ndouble data_source_base::get_number() const { return NaN; }\n\nstd::string data_source_base::get_text() const {\n  std::ostringstream s;\n  s << get_number();\n  return s.str();\n}\n\nregister_disabled_data_source::register_disabled_data_source(\n    const std::string &name, const std::string &setting)\n    : register_data_source<priv::disabled_data_source>(name, setting) {}\n\n// at least one data source should always be registered, so data_sources will\n// not be null\nvoid export_data_sources(lua::state &l) {\n  lua::stack_sentry s(l);\n  l.checkstack(2);\n\n  l.newmetatable(priv::data_source_metatable);\n  {\n    l.pushboolean(false);\n    l.rawsetfield(-2, \"__metatable\");\n\n    l.pushdestructor<data_source_base>();\n    l.rawsetfield(-2, \"__gc\");\n\n    l.loadstring(data_source__index);\n    l.rawsetfield(-2, \"__index\");\n  }\n  l.pop();\n\n  l.newtable();\n  {\n    for (auto &data_source : *data_sources) {\n      l.pushfunction(data_source.second);\n      l.rawsetfield(-2, data_source.first.c_str());\n    }\n  }\n  l.rawsetfield(-2, \"variables\");\n\n  l.pushfunction(data_source_asnumber);\n  l.rawsetfield(-2, \"asnumber\");\n\n  l.pushfunction(data_source_astext);\n  l.rawsetfield(-2, \"astext\");\n}\n}  // namespace conky\n\n/////////// example data sources, remove after real data sources are available\n//////////\nint asdf_ = 47;\nconky::register_data_source<conky::simple_numeric_source<int>> asdf(\"asdf\",\n                                                                    &asdf_);\n\nconky::register_disabled_data_source zxcv(\"zxcv\", \"BUILD_ZXCV\");\n"
  },
  {
    "path": "src/data/data-source.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DATA_SOURCE_HH\n#define DATA_SOURCE_HH\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"../lua/luamm.hh\"\n\nnamespace conky {\n\n/*\n * A base class for all data sources.\n * API consists of two functions:\n * - get_number should return numeric representation of the data (if available).\n * This can then be used when drawing graphs, bars, ... The default\n * implementation returns NaN.\n * - get_text should return textual representation of the data. This is used\n * when simple displaying the value of the data source. The default\n * implementation converts get_number() to a string, but you can override to\n * return anything (e.g. add units)\n */\nclass data_source_base {\n public:\n  const std::string name;\n\n  explicit data_source_base(const std::string &name_) : name(name_) {}\n\n  virtual ~data_source_base() {}\n  virtual double get_number() const;\n  virtual std::string get_text() const;\n};\n\n/*\n * A simple data source that returns the value of some variable. It ignores the\n * lua table. The source variable can be specified as a fixed parameter to the\n * register_data_source constructor, or one can create a subclass and then set\n * the source from the subclass constructor.\n */\ntemplate <typename T>\nclass simple_numeric_source : public data_source_base {\n  static_assert(std::is_convertible<T, double>::value,\n                \"T must be convertible to double\");\n\n  const T *source;\n\n public:\n  simple_numeric_source(lua::state *, const std::string &name_,\n                        const T *source_)\n      : data_source_base(name_), source(source_) {}\n\n  virtual double get_number() const { return *source; }\n};\n\n/*\n * This is a part of the implementation, but it cannot be in .cc file because\n * the template functions below call it\n */\nnamespace priv {\nconst char data_source_metatable[] = \"conky::data_source_metatable\";\n\nvoid do_register_data_source(const std::string &name,\n                             const lua::cpp_function &fn);\n\nclass disabled_data_source : public simple_numeric_source<float> {\n public:\n  disabled_data_source(lua::state *l, const std::string &name,\n                       const std::string &setting);\n};\n\n}  // namespace priv\n\n/*\n * Declaring an object of this type at global scope will register a data source\n * with the given name. Any additional parameters are passed on to the data\n * source constructor.\n */\ntemplate <typename T>\nclass register_data_source {\n  template <typename... Args>\n  static int factory(lua::state *l, const std::string &name,\n                     const Args &...args) {\n    T *t = static_cast<T *>(l->newuserdata(sizeof(T)));\n    l->insert(1);\n    new (t) T(l, name, args...);\n    l->settop(1);\n    l->rawgetfield(lua::REGISTRYINDEX, priv::data_source_metatable);\n    l->setmetatable(-2);\n    return 1;\n  }\n\n public:\n  template <typename... Args>\n  explicit register_data_source(const std::string &name, Args &&...args) {\n    priv::do_register_data_source(\n        name,\n        std::bind(&factory<Args...>, std::placeholders::_1, name, args...));\n  }\n};\n\n/*\n * Use this to declare a data source that has been disabled during compilation.\n * We can then print a nice error message telling the used which setting to\n * enable.\n */\nclass register_disabled_data_source\n    : public register_data_source<priv::disabled_data_source> {\n public:\n  register_disabled_data_source(const std::string &name,\n                                const std::string &setting);\n};\n\n/*\n * It expects to have a table at the top of lua stack. It then exports all the\n * data sources into that table (actually, into a \"variables\" subtable).\n */\nvoid export_data_sources(lua::state &l);\n}  // namespace conky\n\n#endif /* DATA_SOURCE_HH */\n"
  },
  {
    "path": "src/data/entropy.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <inttypes.h>\n#include <time.h>\n#include \"config.h\"\n#include \"../conky.h\"\n#include \"../content/text_object.h\"\n\n/* check for OS and include appropriate headers */\n#if defined(__linux__)\n#include \"os/linux.h\"\n#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\n#include \"os/freebsd.h\"\n#elif defined(__DragonFly__)\n#include \"os/dragonfly.h\"\n#elif defined(__OpenBSD__)\n#include \"os/openbsd.h\"\n#elif defined(__NetBSD__)\n#include \"os/netbsd.h\"\n#elif defined(__sun)\n#include \"os/solaris.h\"\n#elif defined(__HAIKU__)\n#include \"os/haiku.h\"\n#elif defined(__APPLE__) && defined(__MACH__)\n#include \"os/darwin.h\"\n#endif\n\nstruct _entropy {\n  _entropy() = default;\n  unsigned int avail{0};\n  unsigned int poolsize{0};\n};\n\nstatic _entropy entropy;\n\nint update_entropy() {\n  get_entropy_avail(&entropy.avail);\n  get_entropy_poolsize(&entropy.poolsize);\n  return 0;\n}\n\nvoid print_entropy_avail(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%u\", entropy.avail);\n}\n\nuint8_t entropy_percentage(struct text_object *obj) {\n  (void)obj;\n  return round_to_positive_int(static_cast<double>(entropy.avail) * 100.0 /\n                               static_cast<double>(entropy.poolsize));\n}\n\nvoid print_entropy_poolsize(struct text_object *obj, char *p,\n                            unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%u\", entropy.poolsize);\n}\n\ndouble entropy_barval(struct text_object *obj) {\n  (void)obj;\n\n  return static_cast<double>(entropy.avail) / entropy.poolsize;\n}\n\nvoid print_password(struct text_object *obj, char *p, unsigned int p_max_size) {\n  time_t t;\n  static const char letters[] =\n      \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789~!@#$%^&*(\"\n      \")_\";\n  static const int len = static_cast<int>(sizeof(letters)) - 1;\n  uintmax_t x = strtoumax(obj->data.s, (char **)NULL, 10);\n  uintmax_t z = 0;\n\n  if (-1 == (t = time(NULL))) { return; }\n  srandom(static_cast<unsigned int>(t));\n\n  for (; z < x && p_max_size - 1 > z; z++) { *p++ = letters[random() % len]; }\n  *p = '\\0';\n}\n"
  },
  {
    "path": "src/data/entropy.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _ENTROPY_H\n#define _ENTROPY_H\n\nint update_entropy(void);\n\nvoid print_entropy_avail(struct text_object *, char *, unsigned int);\nuint8_t entropy_percentage(struct text_object *);\nvoid print_entropy_poolsize(struct text_object *, char *, unsigned int);\ndouble entropy_barval(struct text_object *);\nvoid print_password(struct text_object *, char *, unsigned int);\n\n#endif /* _ENTROPY_H */\n"
  },
  {
    "path": "src/data/exec.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"exec.h\"\n#include <fcntl.h>\n#include <sys/types.h>\n#include <sys/wait.h>\n#include <unistd.h>\n#include <cmath>\n#include <cstdio>\n#include <mutex>\n#include \"../conky.h\"\n#include \"../core.h\"\n#include \"../logging.h\"\n#include \"../content/specials.h\"\n#include \"../content/text_object.h\"\n#include \"../update-cb.hh\"\n\nstruct execi_data {\n  float interval{0};\n  char *cmd{nullptr};\n  execi_data() = default;\n};\n\nstatic const int cmd_len = 256;\nstatic char cmd[cmd_len];\n\nstatic char *remove_excess_quotes(const char *);\nstatic char *remove_excess_quotes(const char *command) {\n  char *cmd_ptr = cmd;\n  const char *command_ptr = command;\n  int skip = 0;\n\n  if ((cmd_len - 1) < (strlen(command) - 1)) {\n    snprintf(cmd, cmd_len - 1, \"%s\", command);\n    return cmd;\n  }\n\n  if (*command_ptr == '\"' || *command_ptr == '\\'') {\n    skip = 1;\n    command_ptr++;\n  }\n\n  for (; *command_ptr; command_ptr++) {\n    if ('\\0' == *(command_ptr + 1) && 1 == skip &&\n        (*command_ptr == '\"' || *command_ptr == '\\'')) {\n      continue;\n    }\n    *cmd_ptr++ = *command_ptr;\n  }\n  *cmd_ptr = '\\0';\n  return cmd;\n}\n\n// our own implementation of popen, the difference : the value of 'childpid'\n// will be filled with the pid of the running 'command'. This is useful if want\n// to kill it when it hangs while reading or writing to it. We have to kill it\n// because pclose will wait until the process dies by itself\nstatic FILE *pid_popen(const char *command, const char *mode, pid_t *child) {\n  int ends[2];\n  int parentend, childend;\n\n  // by running pipe after the strcmp's we make sure that we don't have to\n  // create a pipe and close the ends if mode is something illegal\n  if (strcmp(mode, \"r\") == 0) {\n    if (pipe(ends) != 0) { return nullptr; }\n    parentend = ends[0];\n    childend = ends[1];\n  } else if (strcmp(mode, \"w\") == 0) {\n    if (pipe(ends) != 0) { return nullptr; }\n    parentend = ends[1];\n    childend = ends[0];\n  } else {\n    return nullptr;\n  }\n\n  *child = fork();\n  if (*child == -1) {\n    close(parentend);\n    close(childend);\n    return nullptr;\n  }\n  if (*child > 0) {\n    close(childend);\n    waitpid(*child, nullptr, 0);\n  } else {\n    // don't read from both stdin and pipe or write to both stdout and pipe\n    if (childend == ends[0]) {\n      close(0);\n    } else {\n      close(1);\n    }\n    close(parentend);\n\n    // by dupping childend, the returned fd will have close-on-exec turned off\n    if (fcntl(childend, F_DUPFD, 0) == -1) { perror(\"fcntl()\"); }\n    close(childend);\n\n    execl(\"/bin/sh\", \"sh\", \"-c\", remove_excess_quotes(command),\n          (char *)nullptr);\n    _exit(EXIT_FAILURE);  // child should die here, (normally execl will take\n                          // care of this but it can fail)\n  }\n\n  return fdopen(parentend, mode);\n}\n\n/**\n * Executes a command and stores the result\n *\n * This function is called automatically, either once every update\n * interval, or at specific intervals in the case of execi commands.\n * conky::run_all_callbacks() handles this. In order for this magic to\n * happen, we must register a callback with conky::register_cb<exec_cb>()\n * and store it somewhere, such as obj->exec_handle. To retrieve the\n * results, use the stored callback to call get_result_copy(), which\n * returns a std::string.\n */\nvoid exec_cb::work() {\n  pid_t childpid;\n  std::string buf;\n  std::shared_ptr<FILE> fp;\n  char b[0x1000];\n\n  if (FILE *t = pid_popen(std::get<0>(tuple).c_str(), \"r\", &childpid)) {\n    fp.reset(t, fclose);\n  } else {\n    return;\n  }\n\n  while ((feof(fp.get()) == 0) && (ferror(fp.get()) == 0)) {\n    int length = fread(b, 1, sizeof b, fp.get());\n    buf.append(b, length);\n  }\n\n  if (*buf.rbegin() == '\\n') { buf.resize(buf.size() - 1); }\n\n  std::lock_guard<std::mutex> l(result_mutex);\n  result = buf;\n}\n\n// remove backspaced chars, example: \"dog^H^H^Hcat\" becomes \"cat\"\n// string has to end with \\0 and it's length should fit in a int\n#define BACKSPACE 8\nstatic void remove_deleted_chars(char *string, unsigned int p_max_size) {\n  int i = 0;\n  while (string[i] != 0) {\n    if (string[i] == BACKSPACE) {\n      if (i != 0) {\n        strncpy(&(string[i - 1]), &(string[i + 1]),\n                strnlen(string, p_max_size) - i + 1);\n        i--;\n      } else {\n        strncpy(&(string[i]), &(string[i + 1]),\n                strnlen(string, p_max_size) -\n                    i);  // necessary for ^H's at the start of a string\n      }\n    } else {\n      i++;\n    }\n  }\n}\n\n/**\n * Parses command output to find a number between 0.0 and 100.0.\n * Used by ${exec[i]{bar,gauge,graph}}.\n *\n * @param[in] buf output of a command executed by an exec_cb object\n * @return number between 0.0 and 100.0\n */\nstatic inline double get_barnum(const char *buf) {\n  double barnum;\n\n  if (sscanf(buf, \"%lf\", &barnum) != 1) {\n    NORM_ERR(\n        \"reading exec value failed (perhaps it's not the \"\n        \"correct format?)\");\n    return 0.0;\n  }\n  if (barnum > 100.0 || barnum < 0.0) {\n    NORM_ERR(\n        \"your exec value is not between 0 and 100, \"\n        \"therefore it will be ignored\");\n    return 0.0;\n  }\n\n  return barnum;\n}\n\n/**\n * Store command output in p. For execp objects, we process the output\n * in case it contains special commands like ${color}\n *\n * @param[in] buffer the output of a command\n * @param[in] obj text_object that specifies whether or not to parse\n * @param[out] p the string in which we store command output\n * @param[in] p_max_size the maximum size of p...\n */\nvoid fill_p(const char *buffer, struct text_object *obj, char *p,\n            unsigned int p_max_size) {\n  if (obj->parse) {\n    evaluate(buffer, p, p_max_size);\n  } else {\n    snprintf(p, p_max_size, \"%s\", buffer);\n  }\n\n  remove_deleted_chars(p, p_max_size);\n}\n\n/**\n * Parses arg to find the command to be run, as well as special options\n * like height, width, color, and update interval\n *\n * @param[out] obj stores the command and an execi_data structure (if\n * applicable)\n * @param[in] arg the argument to an ${exec*} object\n * @param[in] execflag bitwise flag used to specify the exec variant we need to\n * process\n */\nvoid scan_exec_arg(struct text_object *obj, const char *arg,\n                   unsigned int execflag) {\n  const char *cmd = arg;\n  char *orig_cmd = nullptr;\n  struct execi_data *ed;\n\n  /* in case we have an execi object, we need to parse out the interval */\n  if ((execflag & EF_EXECI) != 0u) {\n    ed = new execi_data;\n    int n;\n\n    /* store the interval in ed->interval */\n    if (sscanf(arg, \"%f %n\", &ed->interval, &n) <= 0) {\n      NORM_ERR(\"missing execi interval: ${execi* <interval> command}\");\n      delete ed;\n      ed = nullptr;\n      return;\n    }\n\n    /* set cmd to everything after the interval */\n    cmd = strndup(arg + n, text_buffer_size.get(*state));\n    orig_cmd = const_cast<char *>(cmd);\n  }\n\n  /* parse any special options for the graphical exec types */\n  if ((execflag & EF_BAR) != 0u) {\n    cmd = scan_bar(obj, cmd, 100);\n#ifdef BUILD_GUI\n  } else if ((execflag & EF_GAUGE) != 0u) {\n    cmd = scan_gauge(obj, cmd, 100);\n  } else if ((execflag & EF_GRAPH) != 0u) {\n    auto [buf, skip] = scan_command(cmd);\n    scan_graph(obj, cmd + skip, 100, FALSE);\n    cmd = buf;\n    if (cmd == nullptr) {\n      NORM_ERR(\"error parsing arguments to execgraph object\");\n    }\n#endif /* BUILD_GUI */\n  }\n\n  /* finally, store the resulting command, or an empty string if something went\n   * wrong */\n  if ((execflag & EF_EXEC) != 0u) {\n    obj->data.s =\n        strndup(cmd != nullptr ? cmd : \"\", text_buffer_size.get(*state));\n  } else if ((execflag & EF_EXECI) != 0u) {\n    ed->cmd = strndup(cmd != nullptr ? cmd : \"\", text_buffer_size.get(*state));\n    obj->data.opaque = ed;\n  }\n  free_and_zero(orig_cmd);\n}\n\n/**\n * Register an exec_cb object using the command that we have parsed\n *\n * @param[out] obj stores the callback handle\n */\nvoid register_exec(struct text_object *obj) {\n  if ((obj->data.s != nullptr) && (obj->data.s[0] != 0)) {\n    obj->exec_handle = new conky::callback_handle<exec_cb>(\n        conky::register_cb<exec_cb>(1, true, obj->data.s));\n  } else {\n    DBGP(\"unable to register exec callback\");\n  }\n}\n\n/**\n * Register an exec_cb object using the command that we have parsed.\n *\n * This version takes care of execi intervals. Note that we depend on\n * obj->thread, so be sure to run this function *after* setting obj->thread.\n *\n * @param[out] obj stores the callback handle\n */\nvoid register_execi(struct text_object *obj) {\n  auto *ed = static_cast<struct execi_data *>(obj->data.opaque);\n\n  if ((ed != nullptr) && (ed->cmd != nullptr) && (ed->cmd[0] != 0)) {\n    uint32_t period =\n        std::max(lround(ed->interval / active_update_interval()), 1l);\n    obj->exec_handle = new conky::callback_handle<exec_cb>(\n        conky::register_cb<exec_cb>(period, !obj->thread, ed->cmd));\n  } else {\n    DBGP(\"unable to register execi callback\");\n  }\n}\n\n/**\n * Get the results of an exec_cb object (command output)\n *\n * @param[in] obj holds an exec_handle, assuming one was registered\n * @param[out] p the string in which we store command output\n * @param[in] p_max_size the maximum size of p...\n */\nvoid print_exec(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (obj->exec_handle != nullptr) {\n    fill_p((*obj->exec_handle)->get_result_copy().c_str(), obj, p, p_max_size);\n  }\n}\n\n/**\n * Get the results of a graphical (bar, gauge, graph) exec_cb object\n *\n * @param[in] obj hold an exec_handle, assuming one was registered\n * @return a value between 0.0 and 100.0\n */\ndouble execbarval(struct text_object *obj) {\n  if (obj->exec_handle != nullptr) {\n    return get_barnum((*obj->exec_handle)->get_result_copy().c_str());\n  }\n  return 0.0;\n}\n\n/**\n * Free up any dynamically allocated data\n *\n * @param[in] obj holds the data that we need to free up\n */\nvoid free_exec(struct text_object *obj) {\n  free_and_zero(obj->data.s);\n  delete obj->exec_handle;\n  obj->exec_handle = nullptr;\n}\n\n/**\n * Free up any dynamically allocated data, specifically for execi objects\n *\n * @param[in] obj holds the data that we need to free up\n */\nvoid free_execi(struct text_object *obj) {\n  auto *ed = static_cast<struct execi_data *>(obj->data.opaque);\n\n  /* if ed is nullptr, there is nothing to do */\n  if (ed == nullptr) { return; }\n\n  delete obj->exec_handle;\n  obj->exec_handle = nullptr;\n\n  free_and_zero(ed->cmd);\n  delete ed;\n  ed = nullptr;\n  obj->data.opaque = nullptr;\n}\n"
  },
  {
    "path": "src/data/exec.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *   (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _EXEC_H\n#define _EXEC_H\n\n#include \"../update-cb.hh\"\n\n/**\n * A callback that executes a command and stores the output as a std::string.\n *\n * Important note: if more than one exec callback uses the same command,\n * then only ONE callback is actually stored. This saves space. However,\n * suppose we have the following ${exec} objects in our conky.text:\n *\n * ${exec ~/bin/foo.sh}\n * ${execi 10 ~/bin/foo.sh}\n *\n * To the callback system, these are identical! Furthermore, the callback\n * with the smallest period/interval is the one that is stored. So the execi\n * command will in fact run on every update interval, rather than every\n * ten seconds as one would expect.\n */\nclass exec_cb : public conky::callback<std::string, std::string> {\n  typedef conky::callback<std::string, std::string> Base;\n\n protected:\n  virtual void work();\n\n public:\n  exec_cb(uint32_t period, bool wait, const std::string &cmd)\n      : Base(period, wait, Base::Tuple(cmd)) {}\n};\n\n/**\n * Flags used to identify the different types of exec commands during\n * parsing by scan_exec_arg(). These can be used individually or combined.\n * For example, to parse an ${execgraph} object, we pass EF_EXEC | EF_GRAPH\n * as the last argument to scan_exec_arg().\n */\nenum {\n  EF_EXEC = (1 << 0),\n  EF_EXECI = (1 << 1),\n  EF_BAR = (1 << 2),\n  EF_GRAPH = (1 << 3),\n  EF_GAUGE = (1 << 4)\n};\n\nvoid scan_exec_arg(struct text_object *, const char *, unsigned int);\nvoid register_exec(struct text_object *);\nvoid register_execi(struct text_object *);\nvoid print_exec(struct text_object *, char *, unsigned int);\ndouble execbarval(struct text_object *);\nvoid free_exec(struct text_object *);\nvoid free_execi(struct text_object *);\n\n#endif /* _EXEC_H */\n"
  },
  {
    "path": "src/data/fs.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"fs.h\"\n#include <fcntl.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include <cctype>\n#include <cerrno>\n#include \"../conky.h\"\n#include \"../logging.h\"\n#include \"../content/specials.h\"\n#include \"../content/text_object.h\"\n\n#ifdef HAVE_SYS_STATFS_H\n#include <sys/statfs.h>\n#endif\n\n#if defined(__sun)\n#include <sys/statvfs.h>\n#include <sys/types.h>\n#endif\n\n#if defined(__FreeBSD__)\n#include \"os/freebsd.h\"\n#elif defined(__OpenBSD__)\n#include \"os/openbsd.h\"\n#elif defined(__DragonFly__)\n#include \"os/dragonfly.h\"\n#elif defined(__NetBSD__)\n#include \"os/netbsd.h\"\n#elif defined(__HAIKU__)\n#include \"os/haiku.h\"\n#elif defined(__APPLE__) && defined(__MACH__)\n#include \"os/darwin.h\"\n#endif\n\n#if !defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) && !defined(__OpenBSD__) &&  \\\n    !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__sun) && \\\n    !defined(__HAIKU__) && !(defined(__APPLE__) && defined(__MACH__)) && \\\n    !defined(__NetBSD__)\n#include <mntent.h>\n#endif\n\n#define MAX_FS_STATS 64\n\nstatic struct fs_stat fs_stats_[MAX_FS_STATS];\nstruct fs_stat *fs_stats = fs_stats_;\n\nstatic void update_fs_stat(struct fs_stat *fs);\n\nvoid get_fs_type(const char *path, char *result);\n\nint update_fs_stats() {\n  unsigned i;\n  static double last_fs_update = 0.0;\n\n  if (current_update_time - last_fs_update < 13) { return 0; }\n\n  for (i = 0; i < MAX_FS_STATS; ++i) {\n    if (fs_stats[i].set != 0) { update_fs_stat(&fs_stats[i]); }\n  }\n  last_fs_update = current_update_time;\n  return 0;\n}\n\nvoid clear_fs_stats() {\n  unsigned i;\n  for (i = 0; i < MAX_FS_STATS; ++i) {\n    memset(&fs_stats[i], 0, sizeof(struct fs_stat));\n  }\n}\n\nstruct fs_stat *prepare_fs_stat(const char *s) {\n  struct fs_stat *next = nullptr;\n  unsigned i;\n\n  /* lookup existing or get new */\n  for (i = 0; i < MAX_FS_STATS; ++i) {\n    if (fs_stats[i].set != 0) {\n      if (strncmp(fs_stats[i].path, s, DEFAULT_TEXT_BUFFER_SIZE) == 0) {\n        return &fs_stats[i];\n      }\n    } else {\n      next = &fs_stats[i];\n    }\n  }\n  /* new path */\n  if (next == nullptr) {\n    NORM_ERR(\"too many fs stats\");\n    return nullptr;\n  }\n  strncpy(next->path, s, DEFAULT_TEXT_BUFFER_SIZE);\n  next->set = 1;\n  next->errored = 0;\n  update_fs_stat(next);\n  return next;\n}\n\n#if defined(__APPLE__)\n  #define statfs_func statfs\n  #define statfs_struct statfs\n#elif defined(__NetBSD__)\n  #define statfs_func statvfs\n  #define statfs_struct statvfs\n#else\n  #define statfs_func statfs64\n  #define statfs_struct statfs64\n#endif /* defined(__APPLE__) */\n\nstatic void update_fs_stat(struct fs_stat *fs) {\n#if defined(__sun)\n  struct statvfs s;\n\n  if (statvfs(fs->path, &s) == 0) {\n    fs->size = (long long)s.f_blocks * s.f_frsize;\n    fs->avail = (long long)s.f_bavail * s.f_frsize;\n    fs->free = (long long)s.f_bfree * s.f_frsize;\n    (void)strncpy(fs->type, s.f_basetype, sizeof(fs->type));\n#else\n  struct statfs_struct s {};\n\n  if (statfs_func(fs->path, &s) == 0) {\n    fs->size = static_cast<long long>(s.f_blocks) * s.f_bsize;\n    /* bfree (root) or bavail (non-roots) ? */\n    fs->avail = static_cast<long long>(s.f_bavail) * s.f_bsize;\n    fs->free = static_cast<long long>(s.f_bfree) * s.f_bsize;\n    fs->errored = 0;\n    get_fs_type(fs->path, fs->type);\n#endif\n  } else {\n    if (fs->errored == 0) {\n      NORM_ERR(\"statfs '%s': %s\", fs->path, strerror(errno));\n      fs->errored = 1;\n    }\n    fs->size = 0;\n    fs->avail = 0;\n    fs->free = 0;\n    strncpy(fs->type, \"unknown\", DEFAULT_TEXT_BUFFER_SIZE);\n  }\n}\n\nvoid get_fs_type(const char *path, char *result) {\n#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(__FreeBSD__) ||     \\\n    defined(__OpenBSD__) || defined(__DragonFly__) || defined(__HAIKU__) || \\\n    (defined(__APPLE__) && defined(__MACH__)) || defined(__NetBSD__)\n\n  struct statfs_struct s {};\n  if (statfs_func(path, &s) == 0) {\n    strncpy(result, s.f_fstypename, DEFAULT_TEXT_BUFFER_SIZE);\n  } else {\n    NORM_ERR(\"statfs '%s': %s\", path, strerror(errno));\n  }\n  return;\n#elif defined(__sun)\n  assert(0); /* not used - see update_fs_stat() */\n#else  /* HAVE_STRUCT_STATFS_F_FSTYPENAME */\n\n  struct mntent *me;\n  FILE *mtab = setmntent(\"/proc/mounts\", \"r\");\n  char *search_path;\n  int match;\n  char *slash;\n\n  if (mtab == nullptr) {\n    NORM_ERR(\"setmntent /proc/mounts: %s\", strerror(errno));\n    strncpy(result, \"unknown\", DEFAULT_TEXT_BUFFER_SIZE);\n    return;\n  }\n\n  me = getmntent(mtab);\n\n  // find our path in the mtab\n  search_path = strdup(path);\n  do {\n    while ((match = strcmp(search_path, me->mnt_dir)) && getmntent(mtab))\n      ;\n    if (!match) break;\n    fseek(mtab, 0, SEEK_SET);\n    slash = strrchr(search_path, '/');\n    if (slash == nullptr) {\n      CRIT_ERR(\"invalid path '%s'\", path);\n    } else {\n      if (strlen(slash) == 1) /* trailing slash */\n        *(slash) = '\\0';\n      else if (strlen(slash) > 1)\n        *(slash + 1) = '\\0';\n      else\n        CRIT_ERR(\"found a crack in the matrix!\");\n    }\n  } while (strlen(search_path) > 0);\n  free(search_path);\n\n  endmntent(mtab);\n\n  if (me && !match) {\n    strncpy(result, me->mnt_type, DEFAULT_TEXT_BUFFER_SIZE);\n    return;\n  }\n#endif /* HAVE_STRUCT_STATFS_F_FSTYPENAME */\n\n  strncpy(result, \"unknown\", DEFAULT_TEXT_BUFFER_SIZE);\n}\n\nvoid init_fs_bar(struct text_object *obj, const char *arg) {\n  arg = scan_bar(obj, arg, 1);\n  if (arg != nullptr) {\n    while (isspace(static_cast<unsigned char>(*arg)) != 0) { arg++; }\n    if (*arg == '\\0') { arg = \"/\"; }\n  } else {\n    arg = \"/\";\n  }\n  obj->data.opaque = prepare_fs_stat(arg);\n}\n\nstatic double get_fs_perc(struct text_object *obj, bool get_free) {\n  auto *fs = static_cast<struct fs_stat *>(obj->data.opaque);\n  double ret = 0.0;\n\n  if ((fs != nullptr) && (fs->size != 0)) {\n    if (get_free) {\n      ret = fs->avail;\n    } else {\n      ret = fs->size - fs->free;\n    }\n    ret /= fs->size;\n  }\n\n  return ret;\n}\n\ndouble fs_barval(struct text_object *obj) { return get_fs_perc(obj, false); }\n\ndouble fs_free_barval(struct text_object *obj) {\n  return get_fs_perc(obj, true);\n}\n\nvoid init_fs(struct text_object *obj, const char *arg) {\n  obj->data.opaque = prepare_fs_stat(arg != nullptr ? arg : \"/\");\n}\n\nuint8_t fs_free_percentage(struct text_object *obj) {\n  return get_fs_perc(obj, true) * 100;\n}\n\nuint8_t fs_used_percentage(struct text_object *obj) {\n  return get_fs_perc(obj, false) * 100;\n}\n\n#define HUMAN_PRINT_FS_GENERATOR(name, expr)                 \\\n  void print_fs_##name(struct text_object *obj, char *p,     \\\n                       unsigned int p_max_size) {            \\\n    struct fs_stat *fs = (struct fs_stat *)obj->data.opaque; \\\n    if (fs) human_readable(expr, p, p_max_size);             \\\n  }\n\nHUMAN_PRINT_FS_GENERATOR(free, fs->avail)\nHUMAN_PRINT_FS_GENERATOR(size, fs->size)\nHUMAN_PRINT_FS_GENERATOR(used, fs->size - fs->free)\n\nvoid print_fs_type(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *fs = static_cast<struct fs_stat *>(obj->data.opaque);\n\n  if (fs != nullptr) { snprintf(p, p_max_size, \"%s\", fs->type); }\n}\n"
  },
  {
    "path": "src/data/fs.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _FS_H\n#define _FS_H\n\n#include \"../conky.h\" /* DEFAULT_TEXT_BUFFER_SIZE */\n\n/* needed here and by fs.c */\nstruct fs_stat {\n  char path[DEFAULT_TEXT_BUFFER_SIZE];\n  char type[DEFAULT_TEXT_BUFFER_SIZE];\n  long long size;\n  long long avail;\n  long long free;\n  char set;\n  char errored;\n};\n\n/* forward declare to make gcc happy (fs.h <-> text_object.h include) */\nstruct text_object;\n\nvoid init_fs_bar(struct text_object *, const char *);\ndouble fs_barval(struct text_object *);\ndouble fs_free_barval(struct text_object *);\n\nvoid init_fs(struct text_object *, const char *);\nuint8_t fs_free_percentage(struct text_object *);\nuint8_t fs_used_percentage(struct text_object *);\nvoid print_fs_free(struct text_object *, char *, unsigned int);\nvoid print_fs_size(struct text_object *, char *, unsigned int);\nvoid print_fs_used(struct text_object *, char *, unsigned int);\nvoid print_fs_type(struct text_object *, char *, unsigned int);\n\nint update_fs_stats(void);\nstruct fs_stat *prepare_fs_stat(const char *s);\nvoid clear_fs_stats(void);\n\n#endif /* _FS_H */\n"
  },
  {
    "path": "src/data/hardware/apcupsd.cc",
    "content": "/*\n *\n * apcupsd.c:  conky module for APC UPS daemon monitoring\n *\n * Copyright (C) 2009 Jaromir Smrcek <jaromir.smrcek@zoner.com>\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n\n#include \"apcupsd.h\"\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\n#include <netdb.h>\n#include <netinet/in.h>\n#include <sys/time.h>\n#include <unistd.h>\n#include <cerrno>\n\nenum _apcupsd_items {\n  APCUPSD_NAME,\n  APCUPSD_MODEL,\n  APCUPSD_UPSMODE,\n  APCUPSD_CABLE,\n  APCUPSD_STATUS,\n  APCUPSD_LINEV,\n  APCUPSD_LOAD,\n  APCUPSD_CHARGE,\n  APCUPSD_TIMELEFT,\n  APCUPSD_TEMP,\n  APCUPSD_LASTXFER,\n  _APCUPSD_COUNT\n};\n\n/* type for data exchange with main thread */\n#define APCUPSD_MAXSTR 32\ntypedef struct apcupsd_s {\n  char items[_APCUPSD_COUNT]\n            [APCUPSD_MAXSTR + 1]; /* e.g. items[APCUPSD_STATUS] */\n  char host[64];\n  int port;\n} APCUPSD_S, *PAPCUPSD_S;\n\nstatic APCUPSD_S apcupsd;\n\n//\n// encapsulated recv()\n//\nstatic int net_recv_ex(int sock, void *buf, int size, struct timeval *tv) {\n  fd_set fds;\n  int res;\n\n  // wait for some data to be read\n  do {\n    errno = 0;\n    FD_ZERO(&fds);\n    FD_SET(sock, &fds);\n    res = select(sock + 1, &fds, nullptr, nullptr, tv);\n  } while (res < 0 && errno == EINTR);\n  if (res < 0) { return 0; }\n  if (res == 0) {\n    // timeout\n    errno = ETIMEDOUT;  // select was successful, errno is now 0\n    return 0;\n  }\n\n  // socket ready, read the data\n  do {\n    errno = 0;\n    res = recv(sock, static_cast<char *>(buf), size, 0);\n  } while (res < 0 && errno == EINTR);\n  if (res < 0) { return 0; }\n  if (res == 0) {\n    // orderly shutdown\n    errno = ENOTCONN;\n    return 0;\n  }\n\n  return res;\n}\n\n//\n// read whole buffer or fail\n//\nstatic int net_recv(int sock, void *buf, int size) {\n  int todo = size;\n  int off = 0;\n  int len;\n  struct timeval tv = {0, 250000};\n\n  while (todo != 0) {\n    len = net_recv_ex(sock, static_cast<char *>(buf) + off, todo, &tv);\n    if (len == 0) { return 0; }\n    todo -= len;\n    off += len;\n  }\n  return 1;\n}\n\n//\n// get one response line\n//\nstatic int get_line(int sock, char line[], short linesize) {\n  // get the line length\n  short sz;\n  if (net_recv(sock, &sz, sizeof(sz)) == 0) { return -1; }\n  sz = ntohs(sz);\n  if (sz == 0) { return 0; }\n\n  // get the line\n  while (sz >= linesize) {\n    // this is just a hack (being lazy), this should not happen anyway\n    net_recv(sock, line, linesize);\n    sz -= linesize;\n  }\n  if (net_recv(sock, line, sz) == 0) { return 0; }\n  line[sz] = 0;\n  return sz;\n}\n\n#define FILL(NAME, FIELD, FIRST)                                               \\\n  if (!strncmp(NAME, line, sizeof(NAME) - 1)) {                                \\\n    strncpy(apc->items[FIELD], line + 11, APCUPSD_MAXSTR);                     \\\n    /* remove trailing newline and assure termination */                       \\\n    apc->items[FIELD][len - 11 > APCUPSD_MAXSTR ? APCUPSD_MAXSTR : len - 12] = \\\n        0;                                                                     \\\n    if (FIRST) {                                                               \\\n      char *c;                                                                 \\\n      for (c = apc->items[FIELD]; *c; ++c)                                     \\\n        if (*c == ' ' && c > apc->items[FIELD] + 2) {                          \\\n          *c = 0;                                                              \\\n          break;                                                               \\\n        }                                                                      \\\n    }                                                                          \\\n  }\n\n//\n// fills in the data received from a socket\n//\nstatic int fill_items(int sock, PAPCUPSD_S apc) {\n  char line[512];\n  int len;\n  while ((len = get_line(sock, line, sizeof(line))) != 0) {\n    // fill the right types in\n    FILL(\"UPSNAME\", APCUPSD_NAME, FALSE);\n    FILL(\"MODEL\", APCUPSD_MODEL, FALSE);\n    FILL(\"UPSMODE\", APCUPSD_UPSMODE, FALSE);\n    FILL(\"CABLE\", APCUPSD_CABLE, FALSE);\n    FILL(\"STATUS\", APCUPSD_STATUS, TRUE);\n    FILL(\"LINEV\", APCUPSD_LINEV, TRUE);\n    FILL(\"LOADPCT\", APCUPSD_LOAD, TRUE);\n    FILL(\"BCHARGE\", APCUPSD_CHARGE, TRUE);\n    FILL(\"TIMELEFT\", APCUPSD_TIMELEFT, TRUE);\n    FILL(\"ITEMP\", APCUPSD_TEMP, TRUE);\n    FILL(\"LASTXFER\", APCUPSD_LASTXFER, FALSE);\n  }\n\n  return static_cast<int>(len == 0);\n}\n\n//\n// Conky update function for apcupsd data\n//\nint update_apcupsd() {\n  int i;\n  APCUPSD_S apc;\n  int sock = -1;\n\n  for (i = 0; i < _APCUPSD_COUNT; ++i) {\n    memcpy(apc.items[i], \"N/A\", 4);  // including \\0\n  }\n\n  do {\n    struct addrinfo hints {};\n    struct addrinfo *ai, *rp;\n    int res;\n    short sz = 0;\n    char portbuf[8];\n    //\n    // connect to apcupsd daemon\n    //\n    memset(&hints, 0, sizeof(struct addrinfo));\n    hints.ai_family = AF_UNSPEC;\n    hints.ai_socktype = SOCK_STREAM;\n    hints.ai_flags = 0;\n    hints.ai_protocol = 0;\n    snprintf(portbuf, 8, \"%d\", apcupsd.port);\n    res = getaddrinfo(apcupsd.host, portbuf, &hints, &ai);\n    if (res != 0) {\n      NORM_ERR(\"APCUPSD getaddrinfo: %s\", gai_strerror(res));\n      break;\n    }\n    for (rp = ai; rp != nullptr; rp = rp->ai_next) {\n      sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);\n      if (sock == -1) { continue; }\n      if (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1) { break; }\n      close(sock);\n      sock = -1;\n    }\n    freeaddrinfo(ai);\n    if (rp == nullptr) {\n      // no error reporting, the daemon is probably not running\n      if (sock >= 0) { close(sock); }\n      break;\n    }\n\n    //\n    // send status request - \"status\" - 6B\n    //\n    sz = htons(6);\n    // no waiting to become writeable is really needed\n    if (send(sock, &sz, sizeof(sz), 0) != sizeof(sz) ||\n        send(sock, \"status\", 6, 0) != 6) {\n      perror(\"send\");\n      close(sock);\n      break;\n    }\n\n    //\n    // read the lines of output and put them into the info structure\n    //\n    fill_items(sock, &apc);\n    close(sock);\n\n  } while (0);\n\n  //\n  // \"atomically\" copy the data into working set\n  //\n  memcpy(apcupsd.items, apc.items, sizeof(apcupsd.items));\n  return 0;\n}\n\nint apcupsd_scan_arg(const char *arg) {\n  char host[64];\n  int port;\n  if (sscanf(arg, \"%63s %d\", host, &port) != 2) { return 1; }\n\n  apcupsd.port = port;\n  strncpy(apcupsd.host, host, sizeof(apcupsd.host));\n  return 0;\n}\n\ndouble apcupsd_loadbarval(struct text_object *obj) {\n  (void)obj;\n\n  return atof(apcupsd.items[APCUPSD_LOAD]);\n}\n\n#define APCUPSD_PRINT_GENERATOR(name, idx)                       \\\n  void print_apcupsd_##name(struct text_object *obj, char *p,    \\\n                            unsigned int p_max_size) {           \\\n    (void)obj;                                                   \\\n    snprintf(p, p_max_size, \"%s\", apcupsd.items[APCUPSD_##idx]); \\\n  }\n\nAPCUPSD_PRINT_GENERATOR(name, NAME)\nAPCUPSD_PRINT_GENERATOR(model, MODEL)\nAPCUPSD_PRINT_GENERATOR(upsmode, UPSMODE)\nAPCUPSD_PRINT_GENERATOR(cable, CABLE)\nAPCUPSD_PRINT_GENERATOR(status, STATUS)\nAPCUPSD_PRINT_GENERATOR(linev, LINEV)\nAPCUPSD_PRINT_GENERATOR(load, LOAD)\nAPCUPSD_PRINT_GENERATOR(charge, CHARGE)\nAPCUPSD_PRINT_GENERATOR(timeleft, TIMELEFT)\nAPCUPSD_PRINT_GENERATOR(temp, TEMP)\nAPCUPSD_PRINT_GENERATOR(lastxfer, LASTXFER)\n\n#undef APCUPSD_PRINT_GENERATOR\n"
  },
  {
    "path": "src/data/hardware/apcupsd.h",
    "content": "/*\n *\n * apcupsd.h:  conky module for APC UPS daemon monitoring\n *\n * Copyright (C) 2009 Jaromir Smrcek <jaromir.smrcek@zoner.com>\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n\n#ifndef APCUPSD_H_\n#define APCUPSD_H_\n\nint apcupsd_scan_arg(const char *);\n\n/* Service routine for the conky main thread */\nint update_apcupsd(void);\n\ndouble apcupsd_loadbarval(struct text_object *);\n\nvoid print_apcupsd_name(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_model(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_upsmode(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_cable(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_status(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_linev(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_load(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_charge(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_timeleft(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_temp(struct text_object *, char *, unsigned int);\nvoid print_apcupsd_lastxfer(struct text_object *, char *, unsigned int);\n\n#endif /*APCUPSD_H_*/\n"
  },
  {
    "path": "src/data/hardware/bsdapm.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include <fcntl.h>\n#include <sys/ioctl.h>\n#include <unistd.h>\n\n#include \"config.h\"\n#include \"../../conky.h\"\n#include \"../../content/text_object.h\"\n\n#if defined(__OpenBSD__)\n#include <machine/apmvar.h>\n#else\n#include <machine/apm_bios.h>\n#endif\n\nconst char *APMDEV = \"/dev/apm\";\nconst u_int APM_UNKNOWN = 255;\n\n#ifndef APM_AC_OFF\n#define APM_AC_OFF 0\n#endif\n\n#ifndef APM_AC_ON\n#define APM_AC_ON 1\n#endif\n\n#ifndef APM_BATT_CHARGING\n#define APM_BATT_CHARGING 3\n#endif\n\n#ifdef __OpenBSD__\nconst u_long GET_APM_INFO = APM_IOC_GETPOWER;\nusing apm_info = apm_power_info;\n#define seconds_left minutes_left * 1000\n#else\nconst u_long GET_APM_INFO = APMIO_GETINFO;\n#define ac_state ai_acline\n#define battery_state ai_batt_stat\n#define battery_life ai_batt_life\n#define seconds_left ai_batt_time\n#endif\n\nstatic bool apm_getinfo(int fd, apm_info *aip) {\n  return ioctl(fd, GET_APM_INFO, aip) == -1;\n}\n\nvoid print_apm_adapter(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  int fd;\n  apm_info info;\n\n  (void)obj;\n\n  fd = open(APMDEV, O_RDONLY);\n  if (fd < 0) {\n    snprintf(p, p_max_size, \"%s\", \"ERR\");\n    return;\n  }\n\n  if (!apm_getinfo(fd, &info)) {\n    close(fd);\n    snprintf(p, p_max_size, \"%s\", \"ERR\");\n    return;\n  }\n  close(fd);\n\n  const char *out;\n  switch (info.ac_state) {\n    case APM_AC_OFF:\n      out = \"off-line\";\n      break;\n    case APM_AC_ON:\n      if (info.battery_state == APM_BATT_CHARGING) {\n        out = \"charging\";\n      } else {\n        out = \"on-line\";\n      }\n      break;\n    default:\n      out = \"unknown\";\n      break;\n  }\n  snprintf(p, p_max_size, \"%s\", out);\n}\n\nvoid print_apm_battery_life(struct text_object *obj, char *p,\n                            unsigned int p_max_size) {\n  int fd;\n  apm_info info;\n\n  (void)obj;\n\n  fd = open(APMDEV, O_RDONLY);\n  if (fd < 0) {\n    snprintf(p, p_max_size, \"%s\", \"ERR\");\n    return;\n  }\n\n  if (!apm_getinfo(fd, &info)) {\n    close(fd);\n    snprintf(p, p_max_size, \"%s\", \"ERR\");\n    return;\n  }\n  close(fd);\n\n  if (info.battery_life <= 100) {\n    snprintf(p, p_max_size, \"%d%%\", info.battery_life);\n    return;\n  }\n\n  const char *out;\n  if (info.battery_life == APM_UNKNOWN) {\n    out = \"unknown\";\n  } else {\n    out = \"ERR\";\n  }\n  \n  snprintf(p, p_max_size, \"%s\", out);\n}\n\nvoid print_apm_battery_time(struct text_object *obj, char *p,\n                            unsigned int p_max_size) {\n  int fd;\n  int h, m, s;\n  apm_info info;\n\n  (void)obj;\n\n  fd = open(APMDEV, O_RDONLY);\n  if (fd < 0) {\n    snprintf(p, p_max_size, \"%s\", \"ERR\");\n    return;\n  }\n\n  if (!apm_getinfo(fd, &info)) {\n    close(fd);\n    snprintf(p, p_max_size, \"%s\", \"ERR\");\n    return;\n  }\n  close(fd);\n\n  int batt_time = info.seconds_left;\n  if (batt_time == -1) {\n    snprintf(p, p_max_size, \"%s\", \"unknown\");\n  } else {\n    h = batt_time;\n    s = h % 60;\n    h /= 60;\n    m = h % 60;\n    h /= 60;\n    snprintf(p, p_max_size, \"%2d:%02d:%02d\", h, m, s);\n  }\n}\n"
  },
  {
    "path": "src/data/hardware/bsdapm.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _BSDAPM_H\n#define _BSDAPM_H\n\nvoid print_apm_adapter(struct text_object *, char *, unsigned int);\nvoid print_apm_battery_life(struct text_object *, char *, unsigned int);\nvoid print_apm_battery_time(struct text_object *, char *, unsigned int);\n\n#endif /* _BSDAPM_H */\n"
  },
  {
    "path": "src/data/hardware/cpu.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <inttypes.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <time.h>\n#include <unistd.h>\n#include \"config.h\"\n#include \"../../conky.h\"\n#include \"../../content/text_object.h\"\n\n#ifdef __x86_64__\n#define CPU_FEATURE(x, z) __asm__ __volatile__(\"cpuid\" : \"=a\"(z) : \"a\"(x))\n#define CPU_REGS(x, y, z) \\\n  __asm__ __volatile__(\"cpuid\" : \"=a\"(z), \"=b\"(y) : \"a\"(x))\n#define CPU_STR2(regizter, a, b, c, d)                      \\\n  __asm__ __volatile__(\"cpuid\"                              \\\n                       : \"=a\"(a), \"=b\"(b), \"=c\"(c), \"=d\"(d) \\\n                       : \"a\"(regizter))\n\n#define AmD 0x68747541\n#define InteL 0x756e6547\n\n#if defined(__FreeBSD__)\n#define TICKZ 100L\n#else\n#define TICKZ sysconf(_SC_CLK_TCK)\n#endif /* __FreeBSD__ */\n\nuint8_t has_tsc_reg(void) {\n  uint_fast16_t vend = 0;\n  uint_fast16_t leafs = 0;\n  uint_fast16_t eax = 0;\n  uint_fast16_t ecx = 0;\n  uint_fast16_t edx = 0;\n  uint_fast16_t ebx = 0;\n\n  CPU_REGS(0x00000000, vend, leafs);\n  if (0x00000001 > leafs) { return 1U; }\n  if (static_cast<uint32_t>(vend) != AmD &&\n      static_cast<uint32_t>(vend) != InteL) {\n    return 1U;\n  }\n\n  CPU_STR2(0x00000001, eax, ebx, ecx, edx);\n  if (0U == (edx & (1U << 4U))) { return 1U; }\n  return 0U;\n}\n\nuintmax_t rdtsc(void) {\n  unsigned int tickhi = 0;\n  unsigned int ticklo = 0;\n  uint_fast16_t eax = 0;\n  uint_fast16_t ecx = 0;\n  uint_fast16_t edx = 0;\n  uint_fast16_t ebx = 0;\n  uint_fast16_t regz = 0;\n  uint_fast16_t x = 0;\n\n  if (0U != (has_tsc_reg())) { goto seeya; }\n  __asm__ __volatile__(\n      \"cpuid\\n\\t\"\n      \"rdtsc\\n\\t\"\n      : \"=a\"(ticklo), \"=d\"(tickhi)::\"%rbx\", \"%rcx\");\n\n  CPU_FEATURE(0x80000000, regz);\n  if (0x80000001 > static_cast<uint32_t>(regz)) { goto seeya; }\n  CPU_STR2(0x80000001, eax, ebx, ecx, edx);\n\n  if (0U != (edx & (1U << 27U))) {\n    for (x = 0; x < 6U; x++) {\n      __asm__ __volatile__(\n          \"rdtscp\\n\\t\"\n          \"mov %%edx, %0\\n\\t\"\n          \"mov %%eax, %1\\n\\t\"\n          \"cpuid\\n\\t\"\n          : \"=r\"(tickhi), \"=r\"(ticklo)::\"%rax\", \"%rbx\", \"%rcx\", \"%rdx\");\n    }\n  }\n\nseeya:\n  return ((static_cast<uintmax_t>(tickhi) << 32) |\n          static_cast<uintmax_t>(ticklo));\n}\n\nvoid get_cpu_clock_speed(char *str1, unsigned int p_max_size) {\n  uintmax_t x = 0;\n  uintmax_t z = 0;\n  struct timespec tc = {0L, 0L};\n\n  tc.tv_nsec = TICKZ * 1000000L;\n\n  x = rdtsc();\n  if (-1 == (nanosleep(&tc, NULL))) { return; }\n  z = rdtsc();\n\n  snprintf(str1, p_max_size, \"%ju MHz\", ((z - x) / 100000U));\n}\n\nvoid print_freq2(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n  get_cpu_clock_speed(p, p_max_size);\n}\n\n#else\nchar *l337;\n#endif /* __x86_64__ */\n"
  },
  {
    "path": "src/data/hardware/cpu.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _CPU_H\n#define _CPU_H\n\n#ifdef __x86_64__\nuintmax_t rdtsc(void);\nvoid get_cpu_clock_speed(char *, unsigned int);\nuint8_t has_tsc_reg(void);\nvoid print_freq2(struct text_object *, char *, unsigned int);\n#endif /* __x86_64__ */\n\n#endif /* _CPU_H */\n"
  },
  {
    "path": "src/data/hardware/diskio.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n * (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"diskio.h\"\n#include <sys/stat.h>\n#include <cstdlib>\n#include <vector>\n#include \"../../common.h\"\n#include \"config.h\"\n#include \"../../conky.h\" /* text_buffer_size */\n#include \"../../core.h\"\n#include \"../../logging.h\"\n#include \"../../content/specials.h\"\n#include \"../../content/text_object.h\"\n\n/* this is the root of all per disk stats,\n * also containing the totals. */\nstruct diskio_stat stats;\n\nvoid clear_diskio_stats() {\n  struct diskio_stat *cur;\n  while (stats.next != nullptr) {\n    cur = stats.next;\n    stats.next = stats.next->next;\n    free_and_zero(cur->dev);\n    delete cur;\n  }\n}\n\nstruct diskio_stat *prepare_diskio_stat(const char *s) {\n  struct stat sb {};\n  std::vector<char> stat_name(text_buffer_size.get(*state)),\n      device_name(text_buffer_size.get(*state)),\n      device_s(text_buffer_size.get(*state));\n  struct diskio_stat *cur = &stats;\n  char *rpbuf;\n  char rpbuf2[256];\n\n  if (s == nullptr) { return &stats; }\n\n  if (strncmp(s, \"label:\", 6) == 0) {\n    snprintf(&(device_name[0]), text_buffer_size.get(*state),\n             \"/dev/disk/by-label/%s\", s + 6);\n    rpbuf = realpath(&(device_name[0]), nullptr);\n  } else if (0 == (strncmp(s, \"partuuid:\", 9))) {\n    snprintf(&(device_name[0]), text_buffer_size.get(*state),\n             \"/dev/disk/by-partuuid/%s\", s + 9);\n    rpbuf = realpath(&device_name[0], nullptr);\n    snprintf(rpbuf2, 255, \"%s\", rpbuf);\n  } else {\n    rpbuf = realpath(s, nullptr);\n  }\n\n  if (rpbuf != nullptr) {\n    strncpy(&device_s[0], rpbuf, text_buffer_size.get(*state));\n    free(rpbuf);\n  } else {\n    strncpy(&device_s[0], s, text_buffer_size.get(*state));\n  }\n\n#if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__linux__)\n  if (strncmp(&device_s[0], \"/dev/\", 5) == 0) {\n    device_s.erase(device_s.begin(), device_s.begin() + 5);\n  }\n#endif\n  strncpy(&(device_name[0]), &device_s[0], text_buffer_size.get(*state));\n\n#if !defined(__sun)\n  /*\n   * On Solaris we currently don't use the name of disk's special file so\n   * this test is useless.\n   */\n\n  if (strncmp(s, \"label:\", 6) == 0) {\n    snprintf(&(stat_name[0]), text_buffer_size.get(*state), \"/dev/%s\",\n             &(device_name[0]));\n    if ((stat(&(stat_name[0]), &sb) != 0) || !S_ISBLK(sb.st_mode)) {\n      NORM_ERR(\"diskio device '%s' does not exist\", &device_s[0]);\n    }\n  } else if ((0 == (strncmp(s, \"partuuid:\", 9))) &&\n             ((stat(rpbuf2, &sb) != 0) || !S_ISBLK(sb.st_mode))) {\n    NORM_ERR(\"diskio device '%s' does not exist\", &device_s[0]);\n  }\n\n#endif\n\n  /* lookup existing */\n  while (cur->next != nullptr) {\n    cur = cur->next;\n    if (strcmp(cur->dev, &(device_name[0])) == 0) { return cur; }\n  }\n\n  /* no existing found, make a new one */\n  cur->next = new diskio_stat;\n  cur = cur->next;\n  cur->dev = strndup(&(device_s[0]), text_buffer_size.get(*state));\n  cur->last = UINT_MAX;\n  cur->last_read = UINT_MAX;\n  cur->last_write = UINT_MAX;\n\n  return cur;\n}\n\nvoid parse_diskio_arg(struct text_object *obj, const char *arg) {\n  obj->data.opaque = prepare_diskio_stat(arg);\n}\n\n/* dir indicates the direction:\n * -1: read\n *  0: read + write\n *  1: write\n */\nstatic void print_diskio_dir(struct text_object *obj, int dir, char *p,\n                             unsigned int p_max_size) {\n  auto *diskio = static_cast<struct diskio_stat *>(obj->data.opaque);\n  double val;\n\n  if (diskio == nullptr) { return; }\n\n  if (dir < 0) {\n    val = diskio->current_read;\n  } else if (dir == 0) {\n    val = diskio->current;\n  } else {\n    val = diskio->current_write;\n  }\n\n  /* TODO: move this correction from kB to kB/s elsewhere\n   * (or get rid of it??) */\n  human_readable(val / active_update_interval(), p, p_max_size);\n}\n\nvoid print_diskio(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_diskio_dir(obj, 0, p, p_max_size);\n}\n\nvoid print_diskio_read(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  print_diskio_dir(obj, -1, p, p_max_size);\n}\n\nvoid print_diskio_write(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  print_diskio_dir(obj, 1, p, p_max_size);\n}\n\n#ifdef BUILD_GUI\nvoid parse_diskiograph_arg(struct text_object *obj, const char *arg) {\n  auto [buf, skip] = scan_command(arg);\n  scan_graph(obj, arg + skip, 0, FALSE);\n\n  obj->data.opaque = prepare_diskio_stat(dev_name(buf));\n  free_and_zero(buf);\n}\n\ndouble diskiographval(struct text_object *obj) {\n  auto *diskio = static_cast<struct diskio_stat *>(obj->data.opaque);\n\n  return (diskio != nullptr ? diskio->current : 0);\n}\n\ndouble diskiographval_read(struct text_object *obj) {\n  auto *diskio = static_cast<struct diskio_stat *>(obj->data.opaque);\n\n  return (diskio != nullptr ? diskio->current_read : 0);\n}\n\ndouble diskiographval_write(struct text_object *obj) {\n  auto *diskio = static_cast<struct diskio_stat *>(obj->data.opaque);\n\n  return (diskio != nullptr ? diskio->current_write : 0);\n}\n#endif /* BUILD_GUI */\n\nvoid update_diskio_values(struct diskio_stat *ds, unsigned int reads,\n                          unsigned int writes) {\n  int i;\n  double sum = 0, sum_r = 0, sum_w = 0;\n\n  if (reads < ds->last_read || writes < ds->last_write) {\n    /* counter overflow or reset - rebase to sane values */\n    ds->last = reads + writes;\n    ds->last_read = reads;\n    ds->last_write = writes;\n  }\n  /* since the values in /proc/diskstats are absolute, we have to subtract\n   * our last reading. The numbers stand for \"sectors read\", and we therefore\n   * have to divide by two to get KB */\n  ds->sample_read[0] = (reads - ds->last_read) / 2;\n  ds->sample_write[0] = (writes - ds->last_write) / 2;\n  ds->sample[0] = ds->sample_read[0] + ds->sample_write[0];\n\n  /* compute averages */\n  int samples = diskio_avg_samples.get(*state);\n  for (i = 0; i < samples; i++) {\n    sum += ds->sample[i] * 1024LL;\n    sum_r += ds->sample_read[i] * 1024LL;\n    sum_w += ds->sample_write[i] * 1024LL;\n  }\n  ds->current = sum / static_cast<double>(samples);\n  ds->current_read = sum_r / static_cast<double>(samples);\n  ds->current_write = sum_w / static_cast<double>(samples);\n\n  /* shift sample history */\n  for (i = samples - 1; i > 0; i--) {\n    ds->sample[i] = ds->sample[i - 1];\n    ds->sample_read[i] = ds->sample_read[i - 1];\n    ds->sample_write[i] = ds->sample_write[i - 1];\n  }\n\n  /* save last */\n  ds->last_read = reads;\n  ds->last_write = writes;\n  ds->last = ds->last_read + ds->last_write;\n}\n"
  },
  {
    "path": "src/data/hardware/diskio.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n * (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISKIO_H_\n#define DISKIO_H_\n\n#include <limits.h>\n#include <cstring>\n\nstruct diskio_stat {\n  diskio_stat()\n      : next(nullptr),\n        current(0),\n        current_read(0),\n        current_write(0),\n        last(UINT_MAX),\n        last_read(UINT_MAX),\n        last_write(UINT_MAX) {\n    std::memset(sample, 0, sizeof(sample));\n    std::memset(sample_read, 0, sizeof(sample_read));\n    std::memset(sample_write, 0, sizeof(sample_write));\n  }\n  struct diskio_stat *next;\n  char *dev;\n  double sample[15];\n  double sample_read[15];\n  double sample_write[15];\n  double current;\n  double current_read;\n  double current_write;\n  double last;\n  double last_read;\n  double last_write;\n};\n\nextern struct diskio_stat stats;\n\nstruct diskio_stat *prepare_diskio_stat(const char *);\nint update_diskio(void);\nvoid clear_diskio_stats(void);\nvoid update_diskio_values(struct diskio_stat *, unsigned int, unsigned int);\n\nvoid parse_diskio_arg(struct text_object *, const char *);\nvoid print_diskio(struct text_object *, char *, unsigned int);\nvoid print_diskio_read(struct text_object *, char *, unsigned int);\nvoid print_diskio_write(struct text_object *, char *, unsigned int);\n#ifdef BUILD_GUI\nvoid parse_diskiograph_arg(struct text_object *, const char *);\ndouble diskiographval(struct text_object *);\ndouble diskiographval_read(struct text_object *);\ndouble diskiographval_write(struct text_object *);\n#endif /* BUILD_GUI */\n\n#endif /* DISKIO_H_ */\n"
  },
  {
    "path": "src/data/hardware/hddtemp.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <errno.h>\n#include <fcntl.h>\n#include <netdb.h>\n#include <netinet/in.h>\n#include <sys/select.h>\n#include <sys/socket.h>\n#include <unistd.h>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/temphelper.h\"\n#include \"../../content/text_object.h\"\n\n#define BUFLEN 512\n\nstatic conky::simple_config_setting<std::string> hddtemp_host(\"hddtemp_host\",\n                                                              \"localhost\",\n                                                              false);\nstatic conky::simple_config_setting<std::string> hddtemp_port(\"hddtemp_port\",\n                                                              \"7634\", false);\n\nclass hdd_info {\n public:\n  hdd_info() : next(0) {}\n  hdd_info *next;\n  char *dev;\n  short temp;\n  char unit;\n  void reset() {\n    next = 0;\n    dev = 0;\n    temp = 0;\n    unit = 0;\n  }\n};\n\nhdd_info hdd_info_head;\n\nstatic void __free_hddtemp_info(hdd_info *hdi) {\n  if (hdi->next) __free_hddtemp_info(hdi->next);\n  free(hdi->dev);\n  delete hdi;\n}\n\nstatic void free_hddtemp_info(void) {\n  DBGP(\"free_hddtemp_info() called\");\n  if (!hdd_info_head.next) return;\n  __free_hddtemp_info(hdd_info_head.next);\n  hdd_info_head.next = nullptr;\n}\n\nstatic void add_hddtemp_info(char *dev, short temp, char unit) {\n  hdd_info *hdi = &hdd_info_head;\n\n  DBGP(\"add_hddtemp_info(%s, %d, %c) being called\", dev, temp, unit);\n  while (hdi->next) hdi = hdi->next;\n\n  hdi->next = new hdd_info;\n  hdi->next->reset();\n  hdi->next->dev = strdup(dev);\n  hdi->next->temp = temp;\n  hdi->next->unit = unit;\n}\n\nstatic char *fetch_hddtemp_output(void) {\n  int sockfd;\n  char *buf = nullptr;\n  int buflen, offset = 0, rlen;\n  struct addrinfo hints, *result, *rp;\n  int i;\n\n  memset(&hints, 0, sizeof(hints));\n  hints.ai_family = AF_INET; /* XXX: hddtemp has no ipv6 support (yet?) */\n  hints.ai_socktype = SOCK_STREAM;\n\n  if ((i = getaddrinfo(hddtemp_host.get(*state).c_str(),\n                       hddtemp_port.get(*state).c_str(), &hints, &result))) {\n    NORM_ERR(\"getaddrinfo(): %s\", gai_strerror(i));\n    return nullptr;\n  }\n\n  for (rp = result; rp; rp = rp->ai_next) {\n    sockfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);\n    if (sockfd == -1) continue;\n    if (connect(sockfd, rp->ai_addr, rp->ai_addrlen) != -1) break;\n    close(sockfd);\n  }\n  if (!rp) {\n    NORM_ERR(\"could not connect to hddtemp host\");\n    goto GET_OUT;\n  }\n\n  buflen = 1024;\n  buf = (char *)malloc(buflen);\n  while ((rlen = recv(sockfd, buf + offset, buflen - offset - 1, 0)) > 0) {\n    offset += rlen;\n    if (buflen - offset < 1) {\n      buflen += 1024;\n      buf = (char *)realloc(buf, buflen);\n    }\n  }\n  if (rlen < 0) perror(\"recv\");\n\n  buf[offset] = '\\0';\n\n  close(sockfd);\nGET_OUT:\n  freeaddrinfo(result);\n  return buf;\n}\n\n/* this is an iterator:\n * set line to nullptr in consecutive calls to get the next field\n * note that exhausing iteration is assumed - otherwise *saveptr\n * is not being freed!\n */\nstatic int read_hdd_val(const char *line, char **dev, short *val, char *unit,\n                        char **saveptr) {\n  char *line_s, *cval, *endptr;\n  static char *p = 0;\n\n  if (line) {\n    *saveptr = strdup(line);\n    p = *saveptr;\n  }\n  line_s = *saveptr;\n\nagain:\n  if (!*p) goto out_fail;\n  /* read the device */\n  *dev = ++p;\n  if (!(p = strchr(p, line_s[0]))) goto out_fail;\n  *(p++) = '\\0';\n  /* jump over the devname */\n  if (!(p = strchr(p, line_s[0]))) goto out_fail;\n  /* read the value */\n  cval = ++p;\n  if (!(p = strchr(p, line_s[0]))) goto out_fail;\n  *(p++) = '\\0';\n  *unit = *(p++);\n  *val = strtol(cval, &endptr, 10);\n  if (*endptr) {\n    if (!(p = strchr(p, line_s[0]))) goto out_fail;\n\n    p++;\n    goto again;\n  }\n\n  /* preset p for next call */\n  p++;\n\n  return 0;\nout_fail:\n  free(*saveptr);\n  return 1;\n}\n\nint update_hddtemp(void) {\n  char *data, *dev, unit, *saveptr;\n  short val;\n  static double last_hddtemp_update = 0.0;\n\n  /* limit tcp connection overhead */\n  if (current_update_time - last_hddtemp_update < 5) return 0;\n  last_hddtemp_update = current_update_time;\n\n  free_hddtemp_info();\n\n  if (!(data = fetch_hddtemp_output())) return 0;\n\n  if (read_hdd_val(data, &dev, &val, &unit, &saveptr)) {\n    free(data);\n    return 0;\n  }\n  do {\n    add_hddtemp_info(dev, val, unit);\n  } while (!read_hdd_val(nullptr, &dev, &val, &unit, &saveptr));\n  free(data);\n  return 0;\n}\n\nvoid free_hddtemp(struct text_object *obj) {\n  free_hddtemp_info();\n  free_and_zero(obj->data.s);\n}\n\nstatic int get_hddtemp_info(const char *dev, short *val, char *unit) {\n  hdd_info *hdi = hdd_info_head.next;\n\n  /* if no dev is given, just use hdd_info_head->next */\n  while (dev && hdi) {\n    if (!strcmp(dev, hdi->dev)) break;\n    hdi = hdi->next;\n  }\n  if (!hdi) return 1;\n\n  *val = hdi->temp;\n  *unit = hdi->unit;\n  return 0;\n}\n\nvoid print_hddtemp(struct text_object *obj, char *p, unsigned int p_max_size) {\n  short val;\n  char unit;\n\n  if (get_hddtemp_info(obj->data.s, &val, &unit)) {\n    snprintf(p, p_max_size, \"%s\", \"N/A\");\n  } else {\n    temp_print(p, p_max_size, (double)val,\n               (unit == 'C' ? TEMP_CELSIUS : TEMP_FAHRENHEIT), 1);\n  }\n}\n"
  },
  {
    "path": "src/data/hardware/hddtemp.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef HDDTEMP_H_\n#define HDDTEMP_H_\n\nint update_hddtemp(void);\nvoid free_hddtemp(struct text_object *);\nvoid print_hddtemp(struct text_object *, char *, unsigned int);\n\n#endif /*HDDTEMP_H_*/\n"
  },
  {
    "path": "src/data/hardware/i8k.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/temphelper.h\"\n#include \"../../content/text_object.h\"\n\nstruct _i8k {\n  char *version;\n  char *bios;\n  char *serial;\n  char *cpu_temp;\n  char *left_fan_status;\n  char *right_fan_status;\n  char *left_fan_rpm;\n  char *right_fan_rpm;\n  char *ac_status;\n  char *buttons_status;\n} i8k;\n\n/* FIXME: there should be an ioctl interface to request specific data */\n#define PROC_I8K \"/proc/i8k\"\n#define I8K_DELIM \" \"\nstatic char *i8k_procbuf = nullptr;\nint update_i8k(void) {\n  FILE *fp;\n\n  if ((fp = fopen(PROC_I8K, \"r\")) == nullptr) {\n    NORM_ERR(\n        \"/proc/i8k doesn't exist! use insmod to make sure the kernel driver is \"\n        \"loaded...\");\n    return 1;\n  }\n\n  if (!i8k_procbuf) { i8k_procbuf = (char *)malloc(128 * sizeof(char)); }\n  memset(&i8k_procbuf[0], 0, 128);\n  if (fread(&i8k_procbuf[0], sizeof(char), 128, fp) == 0) {\n    NORM_ERR(\"something wrong with /proc/i8k...\");\n  }\n\n  fclose(fp);\n\n  DBGP(\"read `%s' from /proc/i8k\\n\", i8k_procbuf);\n\n  i8k.version = strtok(&i8k_procbuf[0], I8K_DELIM);\n  i8k.bios = strtok(nullptr, I8K_DELIM);\n  i8k.serial = strtok(nullptr, I8K_DELIM);\n  i8k.cpu_temp = strtok(nullptr, I8K_DELIM);\n  i8k.left_fan_status = strtok(nullptr, I8K_DELIM);\n  i8k.right_fan_status = strtok(nullptr, I8K_DELIM);\n  i8k.left_fan_rpm = strtok(nullptr, I8K_DELIM);\n  i8k.right_fan_rpm = strtok(nullptr, I8K_DELIM);\n  i8k.ac_status = strtok(nullptr, I8K_DELIM);\n  i8k.buttons_status = strtok(nullptr, I8K_DELIM);\n  return 0;\n}\n\nstatic void print_i8k_fan_status(char *p, int p_max_size, const char *status) {\n  static const char *status_arr[] = {\"off\", \"low\", \"high\", \"error\"};\n\n  int i = status ? atoi(status) : 3;\n  if (i < 0 || i > 3) i = 3;\n\n  snprintf(p, p_max_size, \"%s\", status_arr[i]);\n}\n\nvoid print_i8k_left_fan_status(struct text_object *obj, char *p,\n                               unsigned int p_max_size) {\n  (void)obj;\n  print_i8k_fan_status(p, p_max_size, i8k.left_fan_status);\n}\n\nvoid print_i8k_cpu_temp(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  int cpu_temp;\n\n  (void)obj;\n\n  sscanf(i8k.cpu_temp, \"%d\", &cpu_temp);\n  temp_print(p, p_max_size, (double)cpu_temp, TEMP_CELSIUS, 1);\n}\n\nvoid print_i8k_right_fan_status(struct text_object *obj, char *p,\n                                unsigned int p_max_size) {\n  (void)obj;\n  print_i8k_fan_status(p, p_max_size, i8k.right_fan_status);\n}\n\nvoid print_i8k_ac_status(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  int ac_status;\n\n  (void)obj;\n\n  sscanf(i8k.ac_status, \"%d\", &ac_status);\n  if (ac_status == -1) {\n    snprintf(p, p_max_size, \"%s\", \"disabled (read i8k docs)\");\n  }\n  if (ac_status == 0) { snprintf(p, p_max_size, \"%s\", \"off\"); }\n  if (ac_status == 1) { snprintf(p, p_max_size, \"%s\", \"on\"); }\n}\n\n#define I8K_PRINT_GENERATOR(name)                         \\\n  void print_i8k_##name(struct text_object *obj, char *p, \\\n                        unsigned int p_max_size) {        \\\n    (void)obj;                                            \\\n    const char *str = i8k.name ? i8k.name : \"error\";      \\\n    snprintf(p, p_max_size, \"%s\", str);                   \\\n  }\n\nI8K_PRINT_GENERATOR(version)\nI8K_PRINT_GENERATOR(bios)\nI8K_PRINT_GENERATOR(serial)\nI8K_PRINT_GENERATOR(left_fan_rpm)\nI8K_PRINT_GENERATOR(right_fan_rpm)\nI8K_PRINT_GENERATOR(buttons_status)\n\n#undef I8K_PRINT_GENERATOR\n"
  },
  {
    "path": "src/data/hardware/i8k.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _I8K_H\n#define _I8K_H\n\nint update_i8k(void);\nvoid print_i8k_left_fan_status(struct text_object *, char *, unsigned int);\nvoid print_i8k_cpu_temp(struct text_object *, char *, unsigned int);\nvoid print_i8k_right_fan_status(struct text_object *, char *, unsigned int);\nvoid print_i8k_ac_status(struct text_object *, char *, unsigned int);\nvoid print_i8k_version(struct text_object *, char *, unsigned int);\nvoid print_i8k_bios(struct text_object *, char *, unsigned int);\nvoid print_i8k_serial(struct text_object *, char *, unsigned int);\nvoid print_i8k_left_fan_rpm(struct text_object *, char *, unsigned int);\nvoid print_i8k_right_fan_rpm(struct text_object *, char *, unsigned int);\nvoid print_i8k_buttons_status(struct text_object *, char *, unsigned int);\n\n#endif /* _I8K_H */\n"
  },
  {
    "path": "src/data/hardware/ibm.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"ibm.h\"\n#include <ctype.h>\n#include <errno.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"config.h\"\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/temphelper.h\"\n\nstatic int ibm_acpi_temps[8];\n\n/* Here come the IBM ACPI-specific things. For reference, see\n * http://ibm-acpi.sourceforge.net/README\n * If IBM ACPI is installed, /proc/acpi/ibm contains the following files:\nbay\nbeep\nbluetooth\nbrightness\ncmos\ndock\ndriver\necdump\nfan\nhotkey\nled\nlight\nthermal\nvideo\nvolume\n * The content of these files is described in detail in the aforementioned\n * README - some of them also in the following functions accessing them.\n * Peter Tarjan (ptarjan@citromail.hu) */\n\n#define IBM_ACPI_DIR \"/proc/acpi/ibm\"\n\n/* get fan speed on IBM/Lenovo laptops running the ibm acpi.\n * /proc/acpi/ibm/fan looks like this (3 lines):\nstatus:         disabled\nspeed:          2944\ncommands:       enable, disable\n * Peter Tarjan (ptarjan@citromail.hu) */\n\nvoid get_ibm_acpi_fan(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  FILE *fp;\n  unsigned int speed = 0;\n  char fan[128];\n\n  (void)obj;\n\n  if (!p || p_max_size <= 0) { return; }\n\n  snprintf(fan, 127, \"%s/fan\", IBM_ACPI_DIR);\n\n  fp = fopen(fan, \"r\");\n  if (fp != nullptr) {\n    while (!feof(fp)) {\n      char line[256];\n\n      if (fgets(line, 255, fp) == nullptr) { break; }\n      if (sscanf(line, \"speed: %u\", &speed)) { break; }\n    }\n  } else {\n    CRIT_ERR(\n        \"can't open '%s': %s\\nYou are not using the IBM ACPI. Remove \"\n        \"ibm* from your \" PACKAGE_NAME \" config file.\",\n        fan, strerror(errno));\n  }\n\n  fclose(fp);\n  snprintf(p, p_max_size, \"%d\", speed);\n}\n\n/* get the measured temperatures from the temperature sensors\n * on IBM/Lenovo laptops running the ibm acpi.\n * There are 8 values in /proc/acpi/ibm/thermal, and according to\n * http://ibm-acpi.sourceforge.net/README\n * these mean the following (at least on an IBM R51...)\n * 0:  CPU (also on the T series laptops)\n * 1:  Mini PCI Module (?)\n * 2:  HDD (?)\n * 3:  GPU (also on the T series laptops)\n * 4:  Battery (?)\n * 5:  N/A\n * 6:  Battery (?)\n * 7:  N/A\n * I'm not too sure about those with the question mark, but the values I'm\n * reading from *my* thermal file (on a T42p) look realistic for the\n * hdd and the battery.\n * #5 and #7 are always -128.\n * /proc/acpi/ibm/thermal looks like this (1 line):\ntemperatures:   41 43 31 46 33 -128 29 -128\n * Peter Tarjan (ptarjan@citromail.hu) */\n\nint get_ibm_acpi_temps(void) {\n  FILE *fp;\n  char thermal[128];\n\n  snprintf(thermal, 127, \"%s/thermal\", IBM_ACPI_DIR);\n  fp = fopen(thermal, \"r\");\n\n  if (fp != nullptr) {\n    while (!feof(fp)) {\n      char line[256];\n\n      if (fgets(line, 255, fp) == nullptr) { break; }\n      if (sscanf(line, \"temperatures: %d %d %d %d %d %d %d %d\",\n                 &ibm_acpi_temps[0], &ibm_acpi_temps[1], &ibm_acpi_temps[2],\n                 &ibm_acpi_temps[3], &ibm_acpi_temps[4], &ibm_acpi_temps[5],\n                 &ibm_acpi_temps[6], &ibm_acpi_temps[7])) {\n        break;\n      }\n    }\n  } else {\n    CRIT_ERR(\n        \"can't open '%s': %s\\nYou are not using the IBM ACPI. Remove \"\n        \"ibm* from your \" PACKAGE_NAME \" config file.\",\n        thermal, strerror(errno));\n  }\n\n  fclose(fp);\n  return 0;\n}\n\n/* get volume (0-14) on IBM/Lenovo laptops running the ibm acpi.\n * \"Volume\" here is none of the mixer volumes, but a \"master of masters\"\n * volume adjusted by the IBM volume keys.\n * /proc/acpi/ibm/fan looks like this (4 lines):\nlevel:          4\nmute:           off\ncommands:       up, down, mute\ncommands:       level <level> (<level> is 0-15)\n * Peter Tarjan (ptarjan@citromail.hu) */\n\nvoid get_ibm_acpi_volume(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  FILE *fp;\n  char volume[128];\n  unsigned int vol = -1;\n  char mute[3] = \"\";\n\n  (void)obj;\n\n  if (!p || p_max_size <= 0) { return; }\n\n  snprintf(volume, 127, \"%s/volume\", IBM_ACPI_DIR);\n\n  fp = fopen(volume, \"r\");\n  if (fp != nullptr) {\n    while (!feof(fp)) {\n      char line[256];\n      unsigned int read_vol = -1;\n\n      if (fgets(line, 255, fp) == nullptr) { break; }\n      if (sscanf(line, \"level: %u\", &read_vol)) {\n        vol = read_vol;\n        continue;\n      }\n      if (sscanf(line, \"mute: %s\", mute)) { break; }\n    }\n  } else {\n    CRIT_ERR(\n        \"can't open '%s': %s\\nYou are not using the IBM ACPI. Remove \"\n        \"ibm* from your \" PACKAGE_NAME \" config file.\",\n        volume, strerror(errno));\n  }\n\n  fclose(fp);\n\n  if (strcmp(mute, \"on\") == 0)\n    snprintf(p, p_max_size, \"%s\", \"mute\");\n  else\n    snprintf(p, p_max_size, \"%d\", vol);\n}\n\n/* static FILE *fp = nullptr; */\n\n/* get LCD brightness on IBM/Lenovo laptops running the ibm acpi.\n * /proc/acpi/ibm/brightness looks like this (3 lines):\nlevel:          7\ncommands:       up, down\ncommands:       level <level> (<level> is 0-7)\n * Peter Tarjan (ptarjan@citromail.hu) */\n\nvoid get_ibm_acpi_brightness(struct text_object *obj, char *p,\n                             unsigned int p_max_size) {\n  FILE *fp;\n  unsigned int brightness = 0;\n  char filename[128];\n\n  (void)obj;\n\n  if (!p || p_max_size <= 0) { return; }\n\n  snprintf(filename, 127, \"%s/brightness\", IBM_ACPI_DIR);\n\n  fp = fopen(filename, \"r\");\n  if (fp != nullptr) {\n    while (!feof(fp)) {\n      char line[256];\n\n      if (fgets(line, 255, fp) == nullptr) { break; }\n      if (sscanf(line, \"level: %u\", &brightness)) { break; }\n    }\n  } else {\n    CRIT_ERR(\n        \"can't open '%s': %s\\nYou are not using the IBM ACPI. Remove \"\n        \"ibm* from your \" PACKAGE_NAME \" config file.\",\n        filename, strerror(errno));\n  }\n\n  fclose(fp);\n\n  snprintf(p, p_max_size, \"%d\", brightness);\n}\n\n/* get ThinkLight status on IBM/Lenovo laptops running the ibm acpi.\n * /proc/acpi/ibm/light looks like this (2 lines):\nstatus:         off\ncommands:       on, off\n * http://ibm-acpi.sourceforge.net/README reports that it's also possible to\n * get \"unknown\" for a few models that do not make the status available.\n * Lluis Esquerda (eskerda@gmail.com) */\n\nvoid get_ibm_acpi_thinklight(struct text_object *obj, char *p,\n                             unsigned int p_max_size) {\n  FILE *fp;\n  char thinklight[8];\n  char filename[128];\n\n  (void)obj;\n\n  if (!p || p_max_size <= 0) { return; }\n\n  snprintf(filename, 127, \"%s/light\", IBM_ACPI_DIR);\n\n  fp = fopen(filename, \"r\");\n  if (fp != nullptr) {\n    while (!feof(fp)) {\n      char line[256];\n\n      if (fgets(line, 255, fp) == nullptr) { break; }\n      if (sscanf(line, \"status: %s\", thinklight)) { break; }\n    }\n  } else {\n    CRIT_ERR(\n        \"can't open '%s': %s\\nYou are not using the IBM \"\n        \"ACPI. Remove ibm* from your \" PACKAGE_NAME \" config file.\",\n        filename, strerror(errno));\n  }\n\n  fclose(fp);\n  snprintf(p, p_max_size, \"%s\", thinklight);\n}\n\nvoid parse_ibm_temps_arg(struct text_object *obj, const char *arg) {\n  if (!isdigit(arg[0]) || strlen(arg) > 1 || atoi(&arg[0]) >= 8) {\n    obj->data.l = 0;\n    NORM_ERR(\n        \"Invalid temperature sensor! Sensor number must be 0 to 7. \"\n        \"Using 0 (CPU temp sensor).\");\n  } else\n    obj->data.l = atoi(arg);\n}\n\nvoid print_ibm_temps(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  temp_print(p, p_max_size, ibm_acpi_temps[obj->data.l], TEMP_CELSIUS, 1);\n}\n"
  },
  {
    "path": "src/data/hardware/ibm.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _IBM_H\n#define _IBM_H\n\nvoid get_ibm_acpi_fan(struct text_object *, char *, unsigned int);\nint get_ibm_acpi_temps(void);\nvoid get_ibm_acpi_volume(struct text_object *, char *, unsigned int);\nvoid get_ibm_acpi_brightness(struct text_object *, char *, unsigned int);\nvoid get_ibm_acpi_thinklight(struct text_object *, char *, unsigned int);\n\nvoid parse_ibm_temps_arg(struct text_object *, const char *);\nvoid print_ibm_temps(struct text_object *, char *, unsigned int);\n\n#endif /* _IBM_H */\n"
  },
  {
    "path": "src/data/hardware/intel_backlight.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo.\n *\n * Any original torsmo code is licensed under the BSD license.\n * All code written since the fork of torsmo is licensed under the GPL.\n * Please see COPYING for details.\n *\n * Copyright (c) 2021 Rogier Reerink\n *  (See AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <https://www.gnu.org/licenses/>.\n *\n */\n\n#include \"intel_backlight.h\"\n#include \"../../logging.h\"\n\n#define FS_BRIGHTNESS_MAX \"/sys/class/backlight/intel_backlight/max_brightness\"\n#define FS_BRIGHTNESS_CURRENT \"/sys/class/backlight/intel_backlight/brightness\"\n\nstruct backlight {\n  FILE *fp_max;\n  unsigned max;\n  FILE *fp_current;\n  unsigned current;\n};\n\nvoid open_backlight(struct backlight *bl) {\n  bl->fp_max = fopen(FS_BRIGHTNESS_MAX, \"r\");\n  if (bl->fp_max == NULL) {\n    NORM_ERR(\"Failed to open file: '\" FS_BRIGHTNESS_MAX \"'.\");\n  }\n  bl->fp_current = fopen(FS_BRIGHTNESS_CURRENT, \"r\");\n  if (bl->fp_current == NULL) {\n    NORM_ERR(\"Failed to open file: '\" FS_BRIGHTNESS_CURRENT \"'.\");\n  }\n}\n\nvoid read_backlight(struct backlight *bl) {\n  FILE *fp_max, *fp_current;\n  fp_max = bl->fp_max;\n  if (fp_max != NULL) {\n    rewind(fp_max);\n    fflush(fp_max);\n    if (fscanf(fp_max, \"%u\", &(bl->max)) < 0) {\n      NORM_ERR(\"Failed to read maximum brightness.\");\n    }\n  } else {\n    bl->max = 0;\n  }\n  fp_current = bl->fp_current;\n  if (fp_current != NULL) {\n    rewind(fp_current);\n    fflush(fp_current);\n    if (fscanf(fp_current, \"%u\", &(bl->current)) < 0) {\n      NORM_ERR(\"Failed to read current brightness.\");\n    }\n  } else {\n    bl->current = 0;\n  }\n}\n\nunsigned get_backlight_percent(struct backlight *bl) {\n  read_backlight(bl);\n  if (bl->max == 0) {\n    return 0;\n  } else {\n    return bl->current * 100.0 / bl->max + 0.5;\n  }\n}\n\nvoid close_backlight(struct backlight *bl) {\n  if (bl->fp_max != NULL) { fclose(bl->fp_max); }\n  if (bl->fp_current != NULL) { fclose(bl->fp_current); }\n}\n\nvoid init_intel_backlight(struct text_object *obj) {\n  struct backlight *bl = (struct backlight *)malloc(sizeof(struct backlight));\n  open_backlight(bl);\n  obj->data.opaque = bl;\n}\n\nvoid free_intel_backlight(struct text_object *obj) {\n  struct backlight *bl = (struct backlight *)obj->data.opaque;\n  close_backlight(bl);\n  free(bl);\n}\n\nvoid print_intel_backlight(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  struct backlight *bl = (struct backlight *)obj->data.opaque;\n  unsigned percent = get_backlight_percent(bl);\n  snprintf(p, p_max_size, \"%d\", percent);\n}"
  },
  {
    "path": "src/data/hardware/intel_backlight.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo.\n *\n * Any original torsmo code is licensed under the BSD license.\n * All code written since the fork of torsmo is licensed under the GPL.\n * Please see COPYING for details.\n *\n * Copyright (c) 2021 Rogier Reerink\n *  (See AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <https://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _INTEL_BACKLIGHT_H\n#define _INTEL_BACKLIGHT_H\n\n#include \"../../conky.h\"\n#include \"../../content/text_object.h\"\n\nvoid init_intel_backlight(struct text_object *obj);\nvoid free_intel_backlight(struct text_object *obj);\nvoid print_intel_backlight(struct text_object *obj, char *p,\n                           unsigned int p_max_size);\n\n#endif /* _INTEL_BACKLIGHT_H */"
  },
  {
    "path": "src/data/hardware/nvidia.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2008 Markus Meissner\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n/*\n *\n * Author:\n * Fonic <fonic.maxxim@live.com>\n *\n * Things to do:\n * - Move decoding of GPU/MEM freqs to print_nvidia_value() using QUERY_SPECIAL\n *   so that all quirks are located there\n * - Implement nvs->print_type to allow control over how the value is printed\n *   (int, float, temperature...)\n *\n * Showcase (conky.conf):\n * --==| NVIDIA | ==--\n * GPU    ${nvidia gpufreq [target_id]}MHz (${nvidia gpufreqmin\n * [target_id]}-${nvidia gpufreqmax [target_id]}MHz) MEM    ${nvidia memfreq\n * [target_id]}MHz (${nvidia memfreqmin [target_id]}-${nvidia memfreqmax\n * [target_id]}MHz) MTR    ${nvidia mtrfreq [target_id]}MHz (${nvidia mtrfreqmin\n * [target_id]}-${nvidia mtrfreqmax [target_id]}MHz) PERF   Level ${nvidia\n * perflevel [target_id]} (${nvidia perflevelmin [target_id]}-${nvidia\n * perflevelmax [target_id]}), Mode: ${nvidia perfmode [target_id]} VRAM\n * ${nvidia memutil [target_id]}% (${nvidia memused [target_id]}MB/${nvidia\n * memtotal [target_id]}MB) LOAD   GPU ${nvidia gpuutil [target_id]}%, RAM\n * ${nvidia membwutil [target_id]}%, VIDEO ${nvidia videoutil [target_id]}%,\n * PCIe ${nvidia pcieutil [target_id]}% TEMP   GPU ${nvidia gputemp\n * [target_id]}°C (${nvidia gputempthreshold [target_id]}°C max.), SYS ${nvidia\n * ambienttemp [target_id]}°C FAN    ${nvidia fanspeed [target_id]} RPM\n * (${nvidia fanlevel [target_id]}%)\n *\n * Miscellaneous:\n * OPENGL ${nvidia imagequality [target_id]}\n * GPU    ${nvidia modelname [target_id]}\n * DRIVER ${nvidia driverversion [target_id]}\n *\n * --==| NVIDIA Bars |==--\n * LOAD  ${nvidiabar [height][,width] gpuutil [target_id]}\n * VRAM  ${nvidiabar [height][,width] memutil [target_id]}\n * RAM   ${nvidiabar [height][,width] membwutil [target_id]}\n * VIDEO ${nvidiabar [height][,width] videoutil [target_id]}\n * PCIe  ${nvidiabar [height][,width] pcieutil [target_id]}\n * Fan   ${nvidiabar [height][,width] fanlevel [target_id]}\n * TEMP  ${nvidiabar [height][,width] gputemp [target_id]}\n *\n * --==| NVIDIA Gauge |==--\n * LOAD  ${nvidiagauge [height][,width] gpuutil [target_id]}\n * VRAM  ${nvidiagauge [height][,width] memutil [target_id]}\n * RAM   ${nvidiagauge [height][,width] membwutil [target_id]}\n * VIDEO ${nvidiagauge [height][,width] videoutil [target_id]}\n * PCIe  ${nvidiagauge [height][,width] pcieutil [target_id]}\n * Fan   ${nvidiagauge [height][,width] fanlevel [target_id]}\n * TEMP  ${nvidiagauge [height][,width] gputemp [target_id]}\n *\n * --==| NVIDIA Graph |==-- (target_id is not optional in this case)\n * LOAD  ${nvidiagraph gpuutil [height][,width] [gradient color 1] [gradient\n * color 2] [scale] [-t] [-l] target_id} VRAM  ${nvidiagraph memutil\n * [height][,width] [gradient color 1] [gradient color 2] [scale] [-t] [-l]\n * target_id} RAM   ${nvidiagraph membwutil [height][,width] [gradient color 1]\n * [gradient color 2] [scale] [-t] [-l] target_id} VIDEO ${nvidiagraph videoutil\n * [height][,width] [gradient color 1] [gradient color 2] [scale] [-t] [-l]\n * target_id} PCIe  ${nvidiagraph pcieutil [height][,width] [gradient color 1]\n * [gradient color 2] [scale] [-t] [-l] target_id} Fan   ${nvidiagraph fanlevel\n * [height][,width] [gradient color 1] [gradient color 2] [scale] [-t] [-l]\n * target_id} TEMP  ${nvidiagraph gputemp [height][,width] [gradient color 1]\n * [gradient color 2] [scale] [-t] [-l] target_id}\n */\n\n#include \"nvidia.h\"\n#include <X11/Xlib.h>\n#include \"NVCtrl/NVCtrl.h\"\n#include \"NVCtrl/NVCtrlLib.h\"\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/temphelper.h\"\n\n// Current implementation uses X11 specific system utils\n#include \"../../output/x11.h\"\n\n#include <memory>\n\n// Separators for nvidia string parsing\n// (sample: \"perf=0, nvclock=324, nvclockmin=324, nvclockmax=324 ; perf=1,\n// nvclock=549, nvclockmin=549, nvclockmax=549\")\n#define NV_KVPAIR_SEPARATORS \", ;\"\n#define NV_KEYVAL_SEPARATORS \"=\"\n\n// Module arguments\nconst char *translate_module_argument[] = {\n    \"temp\",  // Temperatures\n    \"gputemp\", \"threshold\", \"gputempthreshold\", \"ambient\", \"ambienttemp\",\n\n    \"gpufreq\",  // GPU frequency\n    \"gpufreqcur\", \"gpufreqmin\", \"gpufreqmax\",\n\n    \"memfreq\",  // Memory frequency\n    \"memfreqcur\", \"memfreqmin\", \"memfreqmax\",\n\n    \"mtrfreq\",  // Memory transfer rate frequency\n    \"mtrfreqcur\", \"mtrfreqmin\", \"mtrfreqmax\",\n\n    \"perflevel\",  // Performance levels\n    \"perflevelcur\", \"perflevelmin\", \"perflevelmax\", \"perfmode\",\n\n    \"gpuutil\",    // Load/utilization\n    \"membwutil\",  // NOTE: this is the memory _bandwidth_ utilization, not the\n                  // percentage of used/available memory!\n    \"videoutil\", \"pcieutil\",\n\n    \"mem\",  // RAM statistics\n    \"memused\", \"memfree\", \"memavail\", \"memmax\", \"memtotal\", \"memutil\",\n    \"memperc\",\n\n    \"fanspeed\",  // Fan/cooler\n    \"fanlevel\",\n\n    \"imagequality\",  // Miscellaneous\n    \"modelname\", \"driverversion\"};\n\n// Enum for module arguments\ntypedef enum _ARG_ID {\n  ARG_TEMP,\n  ARG_GPU_TEMP,\n  ARG_THRESHOLD,\n  ARG_GPU_TEMP_THRESHOLD,\n  ARG_AMBIENT,\n  ARG_AMBIENT_TEMP,\n\n  ARG_GPU_FREQ,\n  ARG_GPU_FREQ_CUR,\n  ARG_GPU_FREQ_MIN,\n  ARG_GPU_FREQ_MAX,\n\n  ARG_MEM_FREQ,\n  ARG_MEM_FREQ_CUR,\n  ARG_MEM_FREQ_MIN,\n  ARG_MEM_FREQ_MAX,\n\n  ARG_MTR_FREQ,\n  ARG_MTR_FREQ_CUR,\n  ARG_MTR_FREQ_MIN,\n  ARG_MTR_FREQ_MAX,\n\n  ARG_PERF_LEVEL,\n  ARG_PERF_LEVEL_CUR,\n  ARG_PERF_LEVEL_MIN,\n  ARG_PERF_LEVEL_MAX,\n  ARG_PERF_MODE,\n\n  ARG_GPU_UTIL,\n  ARG_MEM_BW_UTIL,\n  ARG_VIDEO_UTIL,\n  ARG_PCIE_UTIL,\n\n  ARG_MEM,\n  ARG_MEM_USED,\n  ARG_MEM_FREE,\n  ARG_MEM_AVAIL,\n  ARG_MEM_MAX,\n  ARG_MEM_TOTAL,\n  ARG_MEM_UTIL,\n  ARG_MEM_PERC,\n\n  ARG_FAN_SPEED,\n  ARG_FAN_LEVEL,\n\n  ARG_IMAGEQUALITY,\n  ARG_MODEL_NAME,\n  ARG_DRIVER_VERSION,\n\n  ARG_UNKNOWN\n} ARG_ID;\n\n// Nvidia query targets\nconst int translate_nvidia_target[] = {\n    NV_CTRL_TARGET_TYPE_X_SCREEN,\n    NV_CTRL_TARGET_TYPE_GPU,\n    NV_CTRL_TARGET_TYPE_FRAMELOCK,\n    NV_CTRL_TARGET_TYPE_VCSC,\n    NV_CTRL_TARGET_TYPE_GVI,\n    NV_CTRL_TARGET_TYPE_COOLER,\n    NV_CTRL_TARGET_TYPE_THERMAL_SENSOR,\n    NV_CTRL_TARGET_TYPE_3D_VISION_PRO_TRANSCEIVER,\n    NV_CTRL_TARGET_TYPE_DISPLAY,\n};\n\n// Enum for nvidia query targets\ntypedef enum _TARGET_ID {\n  TARGET_SCREEN,\n  TARGET_GPU,\n  TARGET_FRAMELOCK,\n  TARGET_VCSC,\n  TARGET_GVI,\n  TARGET_COOLER,\n  TARGET_THERMAL,\n  TARGET_3DVISION,\n  TARGET_DISPLAY\n} TARGET_ID;\n\n// Nvidia query attributes\nconst int translate_nvidia_attribute[] = {\n    NV_CTRL_GPU_CORE_TEMPERATURE,\n    NV_CTRL_GPU_CORE_THRESHOLD,\n    NV_CTRL_AMBIENT_TEMPERATURE,\n\n    NV_CTRL_GPU_CURRENT_CLOCK_FREQS,\n    NV_CTRL_GPU_CURRENT_CLOCK_FREQS,\n    NV_CTRL_STRING_PERFORMANCE_MODES,\n    NV_CTRL_STRING_GPU_CURRENT_CLOCK_FREQS,\n    NV_CTRL_GPU_POWER_MIZER_MODE,\n\n    NV_CTRL_STRING_GPU_UTILIZATION,\n\n    NV_CTRL_USED_DEDICATED_GPU_MEMORY,\n    0,\n    NV_CTRL_TOTAL_DEDICATED_GPU_MEMORY,  // NOTE: NV_CTRL_TOTAL_GPU_MEMORY would\n                                         // be better, but returns KB instead of\n                                         // MB\n    0,\n\n    NV_CTRL_THERMAL_COOLER_SPEED,\n    NV_CTRL_THERMAL_COOLER_LEVEL,\n\n    NV_CTRL_GPU_CURRENT_PERFORMANCE_LEVEL,\n    NV_CTRL_IMAGE_SETTINGS,\n\n    NV_CTRL_STRING_PRODUCT_NAME,\n    NV_CTRL_STRING_NVIDIA_DRIVER_VERSION,\n};\n\n// Enum for nvidia query attributes\ntypedef enum _ATTR_ID {\n  ATTR_GPU_TEMP,\n  ATTR_GPU_TEMP_THRESHOLD,\n  ATTR_AMBIENT_TEMP,\n\n  ATTR_GPU_FREQ,\n  ATTR_MEM_FREQ,\n  ATTR_PERFMODES_STRING,\n  ATTR_FREQS_STRING,\n  ATTR_PERF_MODE,\n\n  ATTR_UTILS_STRING,\n\n  ATTR_MEM_USED,\n  ATTR_MEM_FREE,\n  ATTR_MEM_TOTAL,\n  ATTR_MEM_UTIL,\n\n  ATTR_FAN_SPEED,\n  ATTR_FAN_LEVEL,\n\n  ATTR_PERF_LEVEL,\n  ATTR_IMAGE_QUALITY,\n\n  ATTR_MODEL_NAME,\n  ATTR_DRIVER_VERSION,\n} ATTR_ID;\n\n// Enum for query type\ntypedef enum _QUERY_ID {\n  QUERY_VALUE,\n  QUERY_STRING,\n  QUERY_STRING_VALUE,\n  QUERY_SPECIAL\n} QUERY_ID;\n\n// Enum for string token search mode\ntypedef enum _SEARCH_ID {\n  SEARCH_FIRST,\n  SEARCH_LAST,\n  SEARCH_MIN,\n  SEARCH_MAX\n} SEARCH_ID;\n\n// Translate special_type into command string\nconst char *translate_nvidia_special_type[] = {\n    \"nvidia\",       // NONSPECIAL\n    \"\",             // HORIZONTAL_LINE\n    \"\",             // STIPPLED_HR\n    \"nvidiabar\",    // BAR\n    \"\",             // FG\n    \"\",             // BG\n    \"\",             // OUTLINE\n    \"\",             // ALIGNR\n    \"\",             // ALIGNC\n    \"nvidiagague\",  // GAUGE\n    \"nvidiagraph\",  // GRAPH\n    \"\",             // OFFSET\n    \"\",             // VOFFSET\n    \"\",             // SAVE_COORDINATES\n    \"\",             // FONT\n    \"\",             // GOTO\n    \"\"              // TAB\n};\n\n// Global struct to keep track of queries\nclass nvidia_s {\n public:\n  nvidia_s()\n      : command(0),\n        arg(0),\n        query(QUERY_VALUE),\n        target(TARGET_SCREEN),\n        attribute(ATTR_GPU_TEMP),\n        token(0),\n        search(SEARCH_FIRST),\n        target_id(0),\n        is_percentage(false) {}\n  const char *command;\n  const char *arg;\n  QUERY_ID query;\n  TARGET_ID target;\n  ATTR_ID attribute;\n  char *token;\n  SEARCH_ID search;\n  //  added new field for GPU id\n  int target_id;\n  bool is_percentage;\n};\n\n// Cache by value\nstruct nvidia_c_value {\n  int memtotal = -1;\n  int gputempthreshold = -1;\n};\n\n// Cache by string\nstruct nvidia_c_string {\n  int nvclockmin = -1;\n  int nvclockmax = -1;\n  int memclockmin = -1;\n  int memclockmax = -1;\n  int memTransferRatemin = -1;\n  int memTransferRatemax = -1;\n  int perfmin = -1;\n  int perfmax = -1;\n};\n\n// Maximum number of GPU connected:\n// For cache default value: choosed a model of direct access to array instead of\n// list for speed improvement value based on the incoming quad Naples tech\n// having 256 PCIe lanes available\nconst int MAXNUMGPU = 64;\n\nnamespace {\n\n// Deleter for nv display to use with std::unique_ptr\nvoid close_nvdisplay(Display *dp) { XCloseDisplay(dp); }\n\nusing unique_display_t = std::unique_ptr<Display, decltype(&close_nvdisplay)>;\n\nclass nvidia_display_setting\n    : public conky::simple_config_setting<std::string> {\n  typedef conky::simple_config_setting<std::string> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n  virtual void cleanup(lua::state &l);\n\n  std::string nvdisplay;\n\n public:\n  nvidia_display_setting() : Base(\"nvidia_display\", std::string(), false) {}\n  virtual unique_display_t get_nvdisplay();\n};\n\nvoid nvidia_display_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  nvdisplay = do_convert(l, -1).first;\n\n  ++s;\n}  // namespace\n\nunique_display_t nvidia_display_setting::get_nvdisplay() {\n  if (!nvdisplay.empty()) {\n    unique_display_t nvd(XOpenDisplay(nvdisplay.c_str()), &close_nvdisplay);\n    if (!nvd) {\n      NORM_ERR(nullptr, NULL, \"can't open nvidia display: %s\",\n               XDisplayName(nvdisplay.c_str()));\n    }\n    return nvd;\n  }\n  return unique_display_t(nullptr, &close_nvdisplay);\n}  // namespace\n\nvoid nvidia_display_setting::cleanup(lua::state &l) {\n  lua::stack_sentry s(l, -1);\n\n  l.pop();\n}\n\nnvidia_display_setting nvidia_display;\n}  // namespace\n\n// Evaluate module parameters and prepare query\nint set_nvidia_query(struct text_object *obj, const char *arg,\n                     text_node_t special_type) {\n  nvidia_s *nvs;\n  int aid;\n  int ilen;\n\n  // Initialize global struct\n  nvs = new nvidia_s();\n  obj->data.opaque = nvs;\n\n  // Added new parameter parsing GPU_ID as 0,1,2,..\n  // if no GPU_ID parameter then default to 0\n  nvs->target_id = 0;\n  char *strbuf = strdup(arg);\n  char *p = strrchr(strbuf, ' ');\n  if (p && *(p + 1)) {\n    nvs->target_id = atoi(p + 1);\n    if ((nvs->target_id > 0) || !strcmp(p + 1, \"0\")) {\n      ilen = strlen(strbuf);\n      ilen = ilen - strlen(p);\n      strbuf[ilen] = 0;\n      arg = strbuf;\n    }\n  }\n\n  // If the value is negative it is set to 0\n  if (nvs->target_id < 0) nvs->target_id = 0;\n\n  // Extract arguments for nvidiabar, etc, and run set_nvidia_query\n  switch (special_type) {\n    case text_node_t::BAR:\n      arg = scan_bar(obj, arg, 100);\n      break;\n    case text_node_t::GRAPH: {\n      auto [buf, skip] = scan_command(arg);\n      scan_graph(obj, arg + skip, 100, FALSE);\n      arg = buf;\n    } break;\n    case text_node_t::GAUGE:\n      arg = scan_gauge(obj, arg, 100);\n      break;\n    default:\n      break;\n  }\n\n  // Return error if no argument\n  // (sometimes scan_graph gets excited and eats the whole string!\n  if (!arg) {\n    free_and_zero(strbuf);\n    return 1;\n  }\n\n  // Translate parameter to id\n  for (aid = 0; aid < ARG_UNKNOWN; aid++) {\n    if (strcmp(arg, translate_module_argument[aid]) == 0) break;\n  }\n\n  // free the string buffer after arg is not anymore needed\n  if (strbuf != nullptr) free_and_zero(strbuf);\n\n  // Save pointers to the arg and command strings for debugging and printing\n  nvs->arg = translate_module_argument[aid];\n  nvs->command = translate_nvidia_special_type[*special_type];\n\n  // Evaluate parameter\n  switch (aid) {\n    case ARG_TEMP:  // GPU temperature\n    case ARG_GPU_TEMP:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_GPU_TEMP;\n      break;\n    case ARG_THRESHOLD:  // GPU temperature threshold\n    case ARG_GPU_TEMP_THRESHOLD:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_GPU_TEMP_THRESHOLD;\n      break;\n    case ARG_AMBIENT:  // Ambient temperature\n    case ARG_AMBIENT_TEMP:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_AMBIENT_TEMP;\n      break;\n\n    case ARG_GPU_FREQ:  // Current GPU clock\n    case ARG_GPU_FREQ_CUR:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_GPU_FREQ;\n      break;\n    case ARG_GPU_FREQ_MIN:  // Minimum GPU clock\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"nvclockmin\";\n      nvs->search = SEARCH_MIN;\n      break;\n    case ARG_GPU_FREQ_MAX:  // Maximum GPU clock\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"nvclockmax\";\n      nvs->search = SEARCH_MAX;\n      break;\n\n    case ARG_MEM_FREQ:  // Current memory clock\n    case ARG_MEM_FREQ_CUR:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_MEM_FREQ;\n      break;\n    case ARG_MEM_FREQ_MIN:  // Minimum memory clock\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"memclockmin\";\n      nvs->search = SEARCH_MIN;\n      break;\n    case ARG_MEM_FREQ_MAX:  // Maximum memory clock\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"memclockmax\";\n      nvs->search = SEARCH_MAX;\n      break;\n\n    case ARG_MTR_FREQ:  // Current memory transfer rate clock\n    case ARG_MTR_FREQ_CUR:\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_FREQS_STRING;\n      nvs->token = (char *)\"memTransferRate\";\n      nvs->search = SEARCH_FIRST;\n      break;\n    case ARG_MTR_FREQ_MIN:  // Minimum memory transfer rate clock\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"memTransferRatemin\";\n      nvs->search = SEARCH_MIN;\n      break;\n    case ARG_MTR_FREQ_MAX:  // Maximum memory transfer rate clock\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"memTransferRatemax\";\n      nvs->search = SEARCH_MAX;\n      break;\n\n    case ARG_PERF_LEVEL:  // Current performance level\n    case ARG_PERF_LEVEL_CUR:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERF_LEVEL;\n      break;\n    case ARG_PERF_LEVEL_MIN:  // Lowest performance level\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"perf\";\n      nvs->search = SEARCH_MIN;\n      break;\n    case ARG_PERF_LEVEL_MAX:  // Highest performance level\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERFMODES_STRING;\n      nvs->token = (char *)\"perf\";\n      nvs->search = SEARCH_MAX;\n      break;\n    case ARG_PERF_MODE:  // Performance mode\n      nvs->query = QUERY_SPECIAL;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_PERF_MODE;\n      break;\n\n    case ARG_GPU_UTIL:  // GPU utilization %\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_UTILS_STRING;\n      nvs->token = (char *)\"graphics\";\n      nvs->search = SEARCH_FIRST;\n      nvs->is_percentage = true;\n      break;\n    case ARG_MEM_BW_UTIL:  // Memory bandwidth utilization %\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_UTILS_STRING;\n      nvs->token = (char *)\"memory\";\n      nvs->search = SEARCH_FIRST;\n      nvs->is_percentage = true;\n      break;\n    case ARG_VIDEO_UTIL:  // Video engine utilization %\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_UTILS_STRING;\n      nvs->token = (char *)\"video\";\n      nvs->search = SEARCH_FIRST;\n      nvs->is_percentage = true;\n      break;\n    case ARG_PCIE_UTIL:  // PCIe bandwidth utilization %\n      nvs->query = QUERY_STRING_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_UTILS_STRING;\n      nvs->token = (char *)\"PCIe\";\n      nvs->search = SEARCH_FIRST;\n      nvs->is_percentage = true;\n      break;\n\n    case ARG_MEM:  // Amount of used memory\n    case ARG_MEM_USED:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_MEM_USED;\n      break;\n    case ARG_MEM_FREE:  // Amount of free memory\n    case ARG_MEM_AVAIL:\n      nvs->query = QUERY_SPECIAL;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_MEM_FREE;\n      break;\n    case ARG_MEM_MAX:  // Total amount of memory\n    case ARG_MEM_TOTAL:\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_MEM_TOTAL;\n      break;\n    case ARG_MEM_UTIL:  // Memory utilization %\n    case ARG_MEM_PERC:\n      nvs->query = QUERY_SPECIAL;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_MEM_UTIL;\n      nvs->is_percentage = true;\n      break;\n\n    case ARG_FAN_SPEED:  // Fan speed\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_COOLER;\n      nvs->attribute = ATTR_FAN_SPEED;\n      break;\n    case ARG_FAN_LEVEL:  // Fan level %\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_COOLER;\n      nvs->attribute = ATTR_FAN_LEVEL;\n      nvs->is_percentage = true;\n      break;\n\n    case ARG_IMAGEQUALITY:  // Image quality\n      nvs->query = QUERY_VALUE;\n      nvs->target = TARGET_SCREEN;\n      nvs->attribute = ATTR_IMAGE_QUALITY;\n      break;\n\n    case ARG_MODEL_NAME:\n      nvs->query = QUERY_STRING;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_MODEL_NAME;\n      break;\n\n    case ARG_DRIVER_VERSION:\n      nvs->query = QUERY_STRING;\n      nvs->target = TARGET_GPU;\n      nvs->attribute = ATTR_DRIVER_VERSION;\n      break;\n\n    default:  // Unknown/invalid argument\n      // Error printed by core.cc\n      return 1;\n  }\n  return 0;\n}\n\n// Return the amount of targets present or raise error)\nstatic inline int get_nvidia_target_count(Display *dpy, TARGET_ID tid) {\n  int num_tgts;\n  if (!XNVCTRLQueryTargetCount(dpy, translate_nvidia_target[tid], &num_tgts)) {\n    num_tgts = -1;\n  }\n\n  if (num_tgts < 1 && tid == TARGET_GPU) {\n    // Print error and exit if there's no NVIDIA's GPU\n    NORM_ERR(nullptr, NULL,\n             \"%s:\"\n             \"\\n          Trying to query Nvidia target failed (using the \"\n             \"proprietary drivers).\"\n             \"\\n          Are you sure they are installed correctly and a \"\n             \"Nvidia GPU is in use?\"\n             \"\\n          (display: %d,Nvidia target_count: %d)\",\n             __func__, dpy, num_tgts);\n  }\n\n  return num_tgts;\n}\n\nstatic int cache_nvidia_value(TARGET_ID tid, ATTR_ID aid, Display *dpy,\n                              int *value, int gid, const char *arg) {\n  static nvidia_c_value ac_value[MAXNUMGPU];\n\n  if (aid == ATTR_MEM_TOTAL) {\n    if (ac_value[gid].memtotal < 0) {\n      if (!dpy || !XNVCTRLQueryTargetAttribute(\n                      dpy, translate_nvidia_target[tid], gid, 0,\n                      translate_nvidia_attribute[aid], value)) {\n        NORM_ERR(\n            \"%s: Something went wrong running nvidia query (arg: %s tid: %d, \"\n            \"aid: %d)\",\n            __func__, arg, tid, aid);\n        return -1;\n      }\n      ac_value[gid].memtotal = *value;\n    } else {\n      *value = ac_value[gid].memtotal;\n    }\n  } else if (aid == ATTR_GPU_TEMP_THRESHOLD) {\n    if (ac_value[gid].gputempthreshold < 0) {\n      if (!dpy || !XNVCTRLQueryTargetAttribute(\n                      dpy, translate_nvidia_target[tid], gid, 0,\n                      translate_nvidia_attribute[aid], value)) {\n        NORM_ERR(\n            \"%s: Something went wrong running nvidia query (arg: %s, tid: \"\n            \"%d, aid: %d)\",\n            __func__, arg, tid, aid);\n        return -1;\n      }\n      ac_value[gid].gputempthreshold = *value;\n    } else {\n      *value = ac_value[gid].gputempthreshold;\n    }\n  }\n\n  return 0;\n}\n\n// Retrieve attribute value via nvidia interface\nstatic int get_nvidia_value(TARGET_ID tid, ATTR_ID aid, int gid,\n                            const char *arg) {\n  auto nvdpy = nvidia_display.get_nvdisplay();\n  Display *dpy = nvdpy ? nvdpy.get() : display;\n  int value;\n\n  // Check if the aid is cacheable\n  if (aid == ATTR_MEM_TOTAL || aid == ATTR_GPU_TEMP_THRESHOLD) {\n    if (cache_nvidia_value(tid, aid, dpy, &value, gid, arg)) { return -1; }\n    // If not, then query it\n  } else {\n    if (!dpy ||\n        !XNVCTRLQueryTargetAttribute(dpy, translate_nvidia_target[tid], gid, 0,\n                                     translate_nvidia_attribute[aid], &value)) {\n      NORM_ERR(\n          \"%s: Something went wrong running nvidia query (arg: %s, tid: %d, \"\n          \"aid: %d)\",\n          __func__, arg, tid, aid);\n      return -1;\n    }\n  }\n\n  // Unpack clock values (see NVCtrl.h for details)\n  if (aid == ATTR_GPU_FREQ) return value >> 16;\n  if (aid == ATTR_MEM_FREQ) return value & 0xFFFF;\n\n  // Return value\n  return value;\n}\n\n// Retrieve attribute string via nvidia interface\nstatic char *get_nvidia_string(TARGET_ID tid, ATTR_ID aid, int gid,\n                               const char *arg) {\n  auto nvdpy = nvidia_display.get_nvdisplay();\n  Display *dpy = nvdpy ? nvdpy.get() : display;\n  char *str;\n\n  // Query nvidia interface\n  if (!dpy || !XNVCTRLQueryTargetStringAttribute(\n                  dpy, translate_nvidia_target[tid], gid, 0,\n                  translate_nvidia_attribute[aid], &str)) {\n    NORM_ERR(\n        \"%s: Something went wrong running nvidia string query (arg, tid: %d, \"\n        \"aid: \"\n        \"%d, GPU %d)\",\n        __func__, arg, tid, aid, gid);\n    return nullptr;\n  }\n  return str;\n}\n\nvoid cache_nvidia_string_value_update(nvidia_c_string *ac_string, char *token,\n                                      SEARCH_ID search, int *value, int gid) {\n  if (strcmp(token, (char *)\"nvclockmin\") == 0 &&\n      ac_string[gid].nvclockmin < 0) {\n    ac_string[gid].nvclockmin = *value;\n  } else if (strcmp(token, (char *)\"nvclockmax\") == 0 &&\n             ac_string[gid].nvclockmax < 0) {\n    ac_string[gid].nvclockmax = *value;\n  } else if (strcmp(token, (char *)\"memclockmin\") == 0 &&\n             ac_string[gid].memclockmin < 0) {\n    ac_string[gid].memclockmin = *value;\n  } else if (strcmp(token, (char *)\"memclockmax\") == 0 &&\n             ac_string[gid].memclockmax < 0) {\n    ac_string[gid].memclockmax = *value;\n  } else if (strcmp(token, (char *)\"memTransferRatemin\") == 0 &&\n             ac_string[gid].memTransferRatemin < 0) {\n    ac_string[gid].memTransferRatemin = *value;\n  } else if (strcmp(token, (char *)\"memTransferRatemax\") == 0 &&\n             ac_string[gid].memTransferRatemax < 0) {\n    ac_string[gid].memTransferRatemax = *value;\n\n  } else if (strcmp(token, (char *)\"perf\") == 0) {\n    if (search == SEARCH_MIN &&\n        ac_string[gid].perfmin < 0) {\n      ac_string[gid].perfmin = *value;\n    } else if (search == SEARCH_MAX &&\n               ac_string[gid].perfmax < 0) {\n      ac_string[gid].perfmax = *value;\n    }\n  }\n}\n\nvoid cache_nvidia_string_value_noupdate(nvidia_c_string *ac_string, char *token,\n                                        SEARCH_ID search, int *value, int gid) {\n  if (strcmp(token, (char *)\"nvclockmin\") == 0) {\n    *value = ac_string[gid].nvclockmin;\n  } else if (strcmp(token, (char *)\"nvclockmax\") == 0) {\n    *value = ac_string[gid].nvclockmax;\n  } else if (strcmp(token, (char *)\"memclockmin\") == 0) {\n    *value = ac_string[gid].memclockmin;\n  } else if (strcmp(token, (char *)\"memclockmax\") == 0) {\n    *value = ac_string[gid].memclockmax;\n  } else if (strcmp(token, (char *)\"memTransferRatemin\") == 0) {\n    *value = ac_string[gid].memTransferRatemin;\n  } else if (strcmp(token, (char *)\"memTransferRatemax\") == 0) {\n    *value = ac_string[gid].memTransferRatemax;\n\n  } else if (strcmp(token, (char *)\"perf\") == 0) {\n    if (search == SEARCH_MIN) {\n      *value = ac_string[gid].perfmin;\n    } else if (search == SEARCH_MAX) {\n      *value = ac_string[gid].perfmax;\n    }\n  }\n}\n\nstatic int cache_nvidia_string_value(TARGET_ID tid, ATTR_ID aid, char *token,\n                                     SEARCH_ID search, int *value, int update,\n                                     int gid) {\n  static nvidia_c_string ac_string[MAXNUMGPU];\n  (void)tid;\n  (void)aid;\n\n  if (update) {\n    cache_nvidia_string_value_update(ac_string, token, search, value, gid);\n  } else {\n    cache_nvidia_string_value_noupdate(ac_string, token, search, value, gid);\n  }\n\n  return 0;\n}\n\n// Retrieve token value from nvidia string\nstatic int get_nvidia_string_value(TARGET_ID tid, ATTR_ID aid, char *token,\n                                   SEARCH_ID search, int gid, const char *arg) {\n  char *str;\n  char *kvp;\n  char *key;\n  char *val;\n  char *saveptr1;\n  char *saveptr2;\n  int temp;\n  int value = -1;\n\n  // Checks if the value is cacheable and is already loaded\n  cache_nvidia_string_value(tid, aid, token, search, &value, 0, gid);\n  if (value != -1) { return value; }\n\n  // Get string via nvidia interface\n  str = get_nvidia_string(tid, aid, gid, arg);\n\n  // Split string into 'key=value' substrings, split substring\n  // into key and value, from value, check if token was found,\n  // convert value to int, evaluate value according to specified\n  // token search mode\n  kvp = strtok_r(str, NV_KVPAIR_SEPARATORS, &saveptr1);\n  while (kvp) {\n    key = strtok_r(kvp, NV_KEYVAL_SEPARATORS, &saveptr2);\n    val = strtok_r(nullptr, NV_KEYVAL_SEPARATORS, &saveptr2);\n    if (key && val && (strcmp(token, key) == 0)) {\n      temp = (int)strtol(val, nullptr, 0);\n      if (search == SEARCH_FIRST) {\n        value = temp;\n        break;\n      } else if (search == SEARCH_LAST) {\n        value = temp;\n      } else if (search == SEARCH_MIN) {\n        if ((value == -1) || (temp < value)) value = temp;\n      } else if (search == SEARCH_MAX) {\n        if (temp > value) value = temp;\n      } else {\n        value = -1;\n        break;\n      }\n    }\n    kvp = strtok_r(nullptr, NV_KVPAIR_SEPARATORS, &saveptr1);\n  }\n\n  // This call updated the cache for the cacheable values\n  cache_nvidia_string_value(tid, aid, token, search, &value, 1, gid);\n\n  // Free string, return value\n  free_and_zero(str);\n  return value;\n}\n\nbool validate_target_id(Display *dpy, int target_id, ATTR_ID attribute) {\n  // num_GPU and num_COOLER calculated only once based on the physical target\n  static int num_GPU = get_nvidia_target_count(dpy, TARGET_GPU) - 1;\n  static int num_COOLER = get_nvidia_target_count(dpy, TARGET_COOLER) - 1;\n\n  if (target_id < 0) return false;\n  switch (attribute) {\n    case ATTR_FAN_LEVEL:\n    case ATTR_FAN_SPEED:\n      if (target_id > num_COOLER) return false;\n      break;\n    default:\n      if (target_id > num_GPU) return false;\n      break;\n  }\n  return true;\n}\n\n// Perform query and print result\nvoid print_nvidia_value(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  nvidia_s *nvs = static_cast<nvidia_s *>(obj->data.opaque);\n  int value;\n  int temp1;\n  int temp2;\n  int result;\n  char *str;\n  int event_base;\n  int error_base;\n\n  auto nvdpy = nvidia_display.get_nvdisplay();\n  Display *dpy = nvdpy ? nvdpy.get() : display;\n\n  if (!dpy) {\n    NORM_ERR(\"%s: no display set (try setting nvidia_display)\", __func__);\n    return;\n  }\n\n  if (!XNVCTRLQueryExtension(dpy, &event_base, &error_base)) {\n    NORM_ERR(\"%s: NV-CONTROL X extension not present\", __func__);\n    return;\n  }\n\n  // Assume failure\n  value = -1;\n  str = nullptr;\n\n  // Perform query if the query exists and isnt stupid\n  if (nvs != nullptr &&\n      validate_target_id(dpy, nvs->target_id, nvs->attribute)) {\n    // Execute switch by query type\n    switch (nvs->query) {\n      case QUERY_VALUE:\n        value = get_nvidia_value(nvs->target, nvs->attribute, nvs->target_id,\n                                 nvs->arg);\n        break;\n      case QUERY_STRING:\n        str = get_nvidia_string(nvs->target, nvs->attribute, nvs->target_id,\n                                nvs->arg);\n        break;\n      case QUERY_STRING_VALUE:\n        value = get_nvidia_string_value(nvs->target, nvs->attribute, nvs->token,\n                                        nvs->search, nvs->target_id, nvs->arg);\n        break;\n      case QUERY_SPECIAL:\n        switch (nvs->attribute) {\n          case ATTR_PERF_MODE:\n            temp1 = get_nvidia_value(nvs->target, nvs->attribute,\n                                     nvs->target_id, nvs->arg);\n            switch (temp1) {\n              case NV_CTRL_GPU_POWER_MIZER_MODE_ADAPTIVE:\n                result = asprintf(&str, \"Adaptive\");\n                break;\n              case NV_CTRL_GPU_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE:\n                result = asprintf(&str, \"Max. Perf.\");\n                break;\n              case NV_CTRL_GPU_POWER_MIZER_MODE_AUTO:\n                result = asprintf(&str, \"Auto\");\n                break;\n              case NV_CTRL_GPU_POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE:\n                result = asprintf(&str, \"Consistent\");\n                break;\n              default:\n                result = asprintf(&str, \"Unknown (%d)\", value);\n                break;\n            }\n            if (result < 0) { str = nullptr; }\n            break;\n          case ATTR_MEM_FREE:\n            temp1 = get_nvidia_value(nvs->target, ATTR_MEM_USED, nvs->target_id,\n                                     nvs->arg);\n            temp2 = get_nvidia_value(nvs->target, ATTR_MEM_TOTAL,\n                                     nvs->target_id, nvs->arg);\n            value = temp2 - temp1;\n            break;\n          case ATTR_MEM_UTIL:\n            temp1 = get_nvidia_value(nvs->target, ATTR_MEM_USED, nvs->target_id,\n                                     nvs->arg);\n            temp2 = get_nvidia_value(nvs->target, ATTR_MEM_TOTAL,\n                                     nvs->target_id, nvs->arg);\n            value = ((float)temp1 * 100 / (float)temp2) + 0.5;\n            break;\n          default:\n            break;\n        }\n        break;\n      default:\n        break;\n    }\n  }\n\n  // Print result\n  if (value != -1) {\n    if (nvs->is_percentage) {\n      percent_print(p, p_max_size, value);\n    } else {\n      snprintf(p, p_max_size, \"%d\", value);\n    }\n  } else if (str != nullptr) {\n    snprintf(p, p_max_size, \"%s\", str);\n    free_and_zero(str);\n  } else {\n    snprintf(p, p_max_size, \"%s\", \"N/A\");\n  }\n}\n\ndouble get_nvidia_barval(struct text_object *obj) {\n  nvidia_s *nvs = static_cast<nvidia_s *>(obj->data.opaque);\n  int temp1;\n  int temp2;\n  double value;\n  int event_base;\n  int error_base;\n\n  auto nvdpy = nvidia_display.get_nvdisplay();\n  Display *dpy = nvdpy ? nvdpy.get() : display;\n\n  if (!dpy) {\n    NORM_ERR(\"%s: no display set (try setting nvidia_display)\", __func__);\n    return 0;\n  }\n\n  if (!XNVCTRLQueryExtension(dpy, &event_base, &error_base)) {\n    NORM_ERR(\"%s: NV-CONTROL X extension not present\", __func__);\n    return 0;\n  }\n\n  // Assume failure\n  value = 0;\n\n  // Convert query_result to a percentage using ((val-min)÷(max-min)×100)+0.5 if\n  // needed.\n  if (nvs != nullptr &&\n      validate_target_id(dpy, nvs->target_id, nvs->attribute)) {\n    switch (nvs->attribute) {\n      case ATTR_UTILS_STRING:  // one of the percentage utils (gpuutil,\n                               // membwutil, videoutil and pcieutil)\n        value =\n            get_nvidia_string_value(nvs->target, ATTR_UTILS_STRING, nvs->token,\n                                    nvs->search, nvs->target_id, nvs->arg);\n        break;\n      case ATTR_MEM_UTIL:  // memutil\n      case ATTR_MEM_USED:\n        temp1 = get_nvidia_value(nvs->target, ATTR_MEM_USED, nvs->target_id,\n                                 nvs->arg);\n        temp2 = get_nvidia_value(nvs->target, ATTR_MEM_TOTAL, nvs->target_id,\n                                 nvs->arg);\n        value = ((float)temp1 * 100 / (float)temp2) + 0.5;\n        break;\n      case ATTR_MEM_FREE:  // memfree\n        temp1 = get_nvidia_value(nvs->target, ATTR_MEM_USED, nvs->target_id,\n                                 nvs->arg);\n        temp2 = get_nvidia_value(nvs->target, ATTR_MEM_TOTAL, nvs->target_id,\n                                 nvs->arg);\n        value = temp2 - temp1;\n        break;\n      case ATTR_FAN_SPEED:  // fanspeed: Warn user we are using fanlevel\n        NORM_ERR(\n            \"%s: invalid argument specified: '%s' (using 'fanlevel' instead).\",\n            nvs->command, nvs->arg);\n        /* falls through */\n      case ATTR_FAN_LEVEL:  // fanlevel\n        value = get_nvidia_value(nvs->target, ATTR_FAN_LEVEL, nvs->target_id,\n                                 nvs->arg);\n        break;\n      case ATTR_GPU_TEMP:  // gputemp (calculate out of gputempthreshold)\n        temp1 = get_nvidia_value(nvs->target, ATTR_GPU_TEMP, nvs->target_id,\n                                 nvs->arg);\n        temp2 = get_nvidia_value(nvs->target, ATTR_GPU_TEMP_THRESHOLD,\n                                 nvs->target_id, nvs->arg);\n        value = ((float)temp1 * 100 / (float)temp2) + 0.5;\n        break;\n      case ATTR_AMBIENT_TEMP:  // ambienttemp (calculate out of gputempthreshold\n                               // for consistency)\n        temp1 = get_nvidia_value(nvs->target, ATTR_AMBIENT_TEMP, nvs->target_id,\n                                 nvs->arg);\n        temp2 = get_nvidia_value(nvs->target, ATTR_GPU_TEMP_THRESHOLD,\n                                 nvs->target_id, nvs->arg);\n        value = ((float)temp1 * 100 / (float)temp2) + 0.5;\n        break;\n      case ATTR_GPU_FREQ:  // gpufreq (calculate out of gpufreqmax)\n        temp1 = get_nvidia_value(nvs->target, ATTR_GPU_FREQ, nvs->target_id,\n                                 nvs->arg);\n        temp2 = get_nvidia_string_value(nvs->target, ATTR_PERFMODES_STRING,\n                                        (char *)\"nvclockmax\", SEARCH_MAX,\n                                        nvs->target_id, nvs->arg);\n        value = ((float)temp1 * 100 / (float)temp2) + 0.5;\n        break;\n      case ATTR_MEM_FREQ:  // memfreq (calculate out of memfreqmax)\n        temp1 = get_nvidia_value(nvs->target, ATTR_MEM_FREQ, nvs->target_id,\n                                 nvs->arg);\n        temp2 = get_nvidia_string_value(nvs->target, ATTR_PERFMODES_STRING,\n                                        (char *)\"memclockmax\", SEARCH_MAX,\n                                        nvs->target_id, nvs->arg);\n        value = ((float)temp1 * 100 / (float)temp2) + 0.5;\n        break;\n      case ATTR_FREQS_STRING:  // mtrfreq (calculate out of memfreqmax)\n        if (strcmp(nvs->token, \"memTransferRate\") != 0) {\n          // Just in case error for silly devs\n          CRIT_ERR(\n              \"%s: attribute is 'ATTR_FREQS_STRING' but token is not \"\n              \"\\\"memTransferRate\\\" (arg: '%s')\",\n              nvs->command, nvs->arg);\n          return 0;\n        }\n        temp1 =\n            get_nvidia_string_value(nvs->target, ATTR_FREQS_STRING, nvs->token,\n                                    SEARCH_MAX, nvs->target_id, nvs->arg);\n        temp2 = get_nvidia_string_value(nvs->target, ATTR_PERFMODES_STRING,\n                                        (char *)\"memTransferRatemax\",\n                                        SEARCH_MAX, nvs->target_id, nvs->arg);\n        if (temp1 > temp2) temp1 = temp2;  // extra safe here\n        value = ((float)temp1 * 100 / (float)temp2) + 0.5;\n        break;\n      case ATTR_IMAGE_QUALITY:  // imagequality\n        value = get_nvidia_value(nvs->target, ATTR_IMAGE_QUALITY,\n                                 nvs->target_id, nvs->arg);\n        break;\n\n      default:  // Throw error if unsupported args are used\n        CRIT_ERR(\"%s: invalid argument specified: '%s'\", nvs->command,\n                 nvs->arg);\n    }\n  }\n\n  // Return the percentage\n  return value;\n}\n\n// Cleanup\nvoid free_nvidia(struct text_object *obj) {\n  nvidia_s *nvs = static_cast<nvidia_s *>(obj->data.opaque);\n  delete nvs;\n  obj->data.opaque = nullptr;\n}\n"
  },
  {
    "path": "src/data/hardware/nvidia.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2008 Markus Meissner\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef NVIDIA_CONKY_H\n#define NVIDIA_CONKY_H\n\n#include \"../../content/specials.h\"\n\nint set_nvidia_query(struct text_object *, const char *, text_node_t);\nvoid print_nvidia_value(struct text_object *, char *, unsigned int);\ndouble get_nvidia_barval(struct text_object *);\nvoid free_nvidia(struct text_object *);\n\n#endif\n"
  },
  {
    "path": "src/data/hardware/smapi.cc",
    "content": "/*\n *\n * smapi.c:  conky support for IBM Thinkpad smapi\n *\n * Copyright (C) 2007 Phil Sutter <Phil@nwl.cc>\n *\n * This library is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n#include <errno.h>\n#include <stdio.h>\n#include <string.h>\n#include <sys/stat.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include \"../../conky.h\" /* text_buffer_size, PACKAGE_NAME, maybe more */\n#include \"../../logging.h\"\n#include \"../../content/temphelper.h\"\n\n#define SYS_SMAPI_PATH \"/sys/devices/platform/smapi\"\n\nstatic int smapi_read_int(const char *path) {\n  FILE *fp;\n  int i = 0;\n  if ((fp = fopen(path, \"r\"))) {\n    if (fscanf(fp, \"%i\\n\", &i) < 0) perror(\"fscanf()\");\n    fclose(fp);\n  }\n  return i;\n}\n\nstatic int smapi_bat_installed_internal(int idx) {\n  char path[128];\n  struct stat sb;\n  int ret = 0;\n\n  snprintf(path, 127, SYS_SMAPI_PATH \"/BAT%i\", idx);\n  if (!stat(path, &sb) && (sb.st_mode & S_IFMT) == S_IFDIR) {\n    snprintf(path, 127, SYS_SMAPI_PATH \"/BAT%i/installed\", idx);\n    ret = (smapi_read_int(path) == 1) ? 1 : 0;\n  }\n  return ret;\n}\n\nstatic char *smapi_read_str(const char *path) {\n  FILE *fp;\n  char str[256] = \"failed\";\n  if ((fp = fopen(path, \"r\")) != nullptr) {\n    if (fscanf(fp, \"%255s\\n\", str) < 0) perror(\"fscanf()\");\n    fclose(fp);\n  }\n  return strndup(str, text_buffer_size.get(*state));\n}\n\nstatic char *smapi_get_str(const char *fname) {\n  char path[128];\n  if (snprintf(path, 127, SYS_SMAPI_PATH \"/%s\", fname) < 0) return nullptr;\n\n  return smapi_read_str(path);\n}\n\nstatic char *smapi_get_bat_str(int idx, const char *fname) {\n  char path[128];\n  if (snprintf(path, 127, SYS_SMAPI_PATH \"/BAT%i/%s\", idx, fname) < 0)\n    return nullptr;\n  return smapi_read_str(path);\n}\n\nstatic int smapi_get_bat_int(int idx, const char *fname) {\n  char path[128];\n  if (snprintf(path, 127, SYS_SMAPI_PATH \"/BAT%i/%s\", idx, fname) < 0) return 0;\n  return smapi_read_int(path);\n}\n\nstatic char *smapi_get_bat_val(const char *args) {\n  char fname[128];\n  int idx, cnt;\n\n  if (sscanf(args, \"%i %n\", &idx, &cnt) <= 0 ||\n      snprintf(fname, 127, \"%s\", (args + cnt)) < 0) {\n    NORM_ERR(\"smapi: wrong arguments, should be 'bat,<int>,<str>'\");\n    return nullptr;\n  }\n\n  if (!smapi_bat_installed_internal(idx)) return nullptr;\n\n  return smapi_get_bat_str(idx, fname);\n}\n\nstatic char *smapi_get_val(const char *args) {\n  char str[128];\n\n  if (!args || sscanf(args, \"%127s\", str) <= 0) return nullptr;\n\n  if (!strcmp(str, \"bat\")) return smapi_get_bat_val(args + 4);\n\n  return smapi_get_str(str);\n}\n\nvoid print_smapi(struct text_object *obj, char *p, unsigned int p_max_size) {\n  char *s;\n\n  if (!obj->data.s) return;\n\n  s = smapi_get_val(obj->data.s);\n  snprintf(p, p_max_size, \"%s\", s);\n  free(s);\n}\n\nuint8_t smapi_bat_percentage(struct text_object *obj) {\n  int idx, val = 0;\n  if (obj->data.s && sscanf(obj->data.s, \"%i\", &idx) == 1) {\n    val = smapi_bat_installed_internal(idx)\n              ? smapi_get_bat_int(idx, \"remaining_percent\")\n              : 0;\n  } else\n    NORM_ERR(\"argument to smapi_bat_perc must be an integer\");\n\n  return val;\n}\n\nvoid print_smapi_bat_temp(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  int idx, val;\n  if (obj->data.s && sscanf(obj->data.s, \"%i\", &idx) == 1) {\n    val = smapi_bat_installed_internal(idx)\n              ? smapi_get_bat_int(idx, \"temperature\")\n              : 0;\n    /* temperature is in milli degree celsius */\n    temp_print(p, p_max_size, val / 1000, TEMP_CELSIUS, 1);\n  } else\n    NORM_ERR(\"argument to smapi_bat_temp must be an integer\");\n}\n\nvoid print_smapi_bat_power(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  int idx, val;\n  if (obj->data.s && sscanf(obj->data.s, \"%i\", &idx) == 1) {\n    val = smapi_bat_installed_internal(idx)\n              ? smapi_get_bat_int(idx, \"power_now\")\n              : 0;\n    /* power_now is in mW, set to W with one digit precision */\n    snprintf(p, p_max_size, \"%.1f\", ((double)val / 1000));\n  } else\n    NORM_ERR(\"argument to smapi_bat_power must be an integer\");\n}\n\ndouble smapi_bat_barval(struct text_object *obj) {\n  if (obj->data.i >= 0 && smapi_bat_installed_internal(obj->data.i))\n    return smapi_get_bat_int(obj->data.i, \"remaining_percent\");\n  return 0;\n}\n\nint smapi_bat_installed(struct text_object *obj) {\n  int idx;\n  if (obj->data.s && sscanf(obj->data.s, \"%i\", &idx) == 1) {\n    if (!smapi_bat_installed_internal(idx)) { return 0; }\n  } else\n    NORM_ERR(\"argument to if_smapi_bat_installed must be an integer\");\n  return 1;\n}\n"
  },
  {
    "path": "src/data/hardware/smapi.h",
    "content": "/*\n *\n * smapi.h:  conky support for IBM Thinkpad smapi\n *\n * Copyright (C) 2007 Phil Sutter <Phil@nwl.cc>\n *\n * This library is free software; you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation; either version 2 of the License, or\n * (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n\n#ifndef _SMAPI_H\n#define _SMAPI_H\n\nvoid print_smapi(struct text_object *, char *, unsigned int);\nuint8_t smapi_bat_percentage(struct text_object *);\nvoid print_smapi_bat_temp(struct text_object *, char *, unsigned int);\nvoid print_smapi_bat_power(struct text_object *, char *, unsigned int);\ndouble smapi_bat_barval(struct text_object *);\nint smapi_bat_installed(struct text_object *obj);\n\n#endif /* _SMAPI_H */\n"
  },
  {
    "path": "src/data/hardware/sony.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n * Copyright (c) 2009 Yeon-Hyeong Yang <lbird94@gmail.com>\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n/* conky support for information from sony_laptop kernel module\n *   information from sony_laptop kernel module\n *   /sys/devices/platform/sony-laptop\n *   I mimicked the methods from ibm.c\n * Yeon-Hyeong Yang <lbird94@gmail.com> */\n\n#include \"sony.h\"\n#include <errno.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"config.h\"\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\n#define SONY_LAPTOP_DIR \"/sys/devices/platform/sony-laptop\"\n\n/* fanspeed in SONY_LAPTOP_DIR contains an integer value for fanspeed (0~255).\n * I don't know the exact measurement unit, though. I may assume that 0 for\n * 'fan stopped' and 255 for 'maximum fan speed'. */\nvoid get_sony_fanspeed(struct text_object *obj, char *p_client_buffer,\n                       unsigned int client_buffer_size) {\n  FILE *fp;\n  unsigned int speed = 0;\n  char fan[128];\n\n  (void)obj;\n\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  snprintf(fan, 127, \"%s/fanspeed\", SONY_LAPTOP_DIR);\n\n  fp = fopen(fan, \"r\");\n  if (fp != nullptr) {\n    while (!feof(fp)) {\n      char line[256];\n\n      if (fgets(line, 255, fp) == nullptr) { break; }\n      if (sscanf(line, \"%u\", &speed)) { break; }\n    }\n  } else {\n    CRIT_ERR(\n        \"can't open '%s': %s\\nEnable sony support or remove \"\n        \"sony* from your \" PACKAGE_NAME \" config file.\",\n        fan, strerror(errno));\n  }\n\n  fclose(fp);\n  snprintf(p_client_buffer, client_buffer_size, \"%d\", speed);\n}\n"
  },
  {
    "path": "src/data/hardware/sony.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n * Copyright (c) 2009 Yeon-Hyeong Yang <lbird94@gmail.com>\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n/* conky support for information from sony_laptop kernel module\n *   information from sony_laptop kernel module\n *   /sys/devices/platform/sony-laptop\n *   I mimicked the methods from ibm.c\n * Yeon-Hyeong Yang <lbird94@gmail.com> */\n\n#ifndef _SONY_H\n#define _SONY_H\n\nvoid get_sony_fanspeed(struct text_object *, char *, unsigned int);\n\n#endif /* _SONY_H */\n"
  },
  {
    "path": "src/data/ical.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <libical/ical.h>\n#include \"../conky.h\"\n#include \"../logging.h\"\n\nstruct ical_event {\n  icaltimetype start;\n  icalcomponent *event;\n  ical_event *next, *prev;\n};\n\nstruct obj_ical {\n  struct ical_event *list;\n  icalcomponent *comps;\n  icalparser *parser;\n  unsigned int num;\n};\n\nchar *read_stream(char *s, size_t size, void *d) {\n  return fgets(s, size, (FILE *)d);\n}\n\nstruct ical_event *add_event(struct ical_event *listend,\n                             icalcomponent *new_ev) {\n  struct ical_event *ev_new, *ev_cur;\n  icaltimetype start;\n\n  start = icalcomponent_get_dtstart(new_ev);\n  if (icaltime_compare(\n          start, icaltime_from_timet_with_zone(time(nullptr), 0, NULL)) <= 0) {\n    icalproperty *rrule =\n        icalcomponent_get_first_property(new_ev, ICAL_RRULE_PROPERTY);\n    if (rrule) {\n      icalrecur_iterator *ritr =\n          icalrecur_iterator_new(icalproperty_get_rrule(rrule), start);\n      icaltimetype nexttime = icalrecur_iterator_next(ritr);\n      while (!icaltime_is_null_time(nexttime)) {\n        if (icaltime_compare(nexttime, icaltime_from_timet_with_zone(\n                                           time(nullptr), 0, NULL)) > 0) {\n          start = nexttime;\n          break;\n        }\n        nexttime = icalrecur_iterator_next(ritr);\n      }\n      icalrecur_iterator_free(ritr);\n    } else\n      return nullptr;\n  }\n  ev_new = (struct ical_event *)malloc(sizeof(struct ical_event));\n  memset(ev_new, 0, sizeof(struct ical_event));\n  ev_new->event = new_ev;\n  ev_new->start = start;\n  if (listend) {  // list already contains events\n    ev_cur = listend;\n    while (icaltime_compare(ev_new->start, ev_cur->start) <= 0) {\n      if (!ev_cur->prev) {  // ev_new starts first\n        ev_new->next = ev_cur;\n        ev_cur->prev = ev_new;\n        return listend;\n      }\n      ev_cur = ev_cur->prev;\n    }\n    if (ev_cur == listend) {  // ev_new starts last\n      ev_cur->next = ev_new;\n      ev_new->prev = ev_cur;\n      return ev_new;\n    }\n    // ev_new somewhere in the middle\n    ev_new->prev = ev_cur;\n    ev_new->next = ev_cur->next;\n    ev_cur->next->prev = ev_new;\n    ev_cur->next = ev_new;\n    return listend;\n  }\n  return ev_new;\n}\n\nvoid parse_ical_args(struct text_object *obj, const char *arg,\n                     void *free_at_crash, void *free_at_crash2) {\n  char *filename = strdup(arg);\n  FILE *file;\n  icalparser *parser;\n  icalcomponent *allc, *curc;\n  struct ical_event *ll_start, *ll_end, *ll_new;\n  struct obj_ical *opaque;\n  unsigned int num;\n\n  if (sscanf(arg, \"%d %s\", &num, filename) != 2) {\n    free(filename);\n    free(obj);\n    CRIT_ERR_FREE(free_at_crash, free_at_crash2,\n                  \"wrong number of arguments for $ical\");\n  }\n  file = fopen(filename, \"r\");\n  if (!file) {\n    free(obj);\n    free(free_at_crash);\n    CRIT_ERR_FREE(filename, free_at_crash2, \"Can't read file %s\", filename);\n    return;\n  }\n  free(filename);\n  parser = icalparser_new();\n  icalparser_set_gen_data(parser, file);\n  allc = icalparser_parse(parser, read_stream);\n  fclose(file);\n  curc = icalcomponent_get_first_component(allc, ICAL_VEVENT_COMPONENT);\n  if (!curc) {\n    icalparser_free(parser);\n    icalcomponent_free(allc);\n    NORM_ERR(\"No ical events available\");\n    return;\n  }\n  ll_start = add_event(nullptr, curc);\n  ll_end = ll_start;\n  while (1) {\n    curc = icalcomponent_get_next_component(allc, ICAL_VEVENT_COMPONENT);\n    if (!curc) break;\n    ll_new = add_event(ll_end, curc);\n    if (!ll_start) {  // first component was not added\n      ll_start = ll_new;\n      ll_end = ll_new;\n    } else if (ll_start->prev) {\n      ll_start = ll_start->prev;\n    } else if (ll_end->next) {\n      ll_end = ll_end->next;\n    }\n  }\n  opaque = (struct obj_ical *)malloc(sizeof(struct obj_ical));\n  opaque->list = ll_start;\n  opaque->parser = parser;\n  opaque->comps = allc;\n  opaque->num = num;\n  obj->data.opaque = opaque;\n  free(opaque);\n}\n\nvoid print_ical(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct obj_ical *ical_obj = (struct obj_ical *)obj->data.opaque;\n  struct ical_event *ll_current;\n\n  if (!ical_obj) return;\n  ll_current = ical_obj->list;\n  unsigned int i = 1;\n  while (1) {\n    if (!ll_current) return;\n    if (i > ical_obj->num) return;\n    if (i == ical_obj->num) break;\n    if (i < ical_obj->num) {\n      ll_current = ll_current->next;\n      i++;\n    }\n  }\n  snprintf(p, p_max_size, \"%s\",\n           icalproperty_get_summary(icalcomponent_get_first_property(\n               ll_current->event, ICAL_SUMMARY_PROPERTY)));\n}\n\nvoid free_ical(struct text_object *obj) {\n  struct obj_ical *ical_free_me = (struct obj_ical *)obj->data.opaque;\n\n  if (!ical_free_me) return;\n  icalcomponent_free(ical_free_me->comps);\n  icalparser_free(ical_free_me->parser);\n  while (ical_free_me->list) {\n    if (ical_free_me->list->next) {\n      ical_free_me->list = ical_free_me->list->next;\n      free_and_zero(ical_free_me->list->prev);\n    } else\n      free_and_zero(ical_free_me->list);\n  }\n  free(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/data/ical.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef ICAL_H_\n#define ICAL_H_\n\nvoid parse_ical_args(struct text_object *, const char *, void *, void *);\nvoid print_ical(struct text_object *, char *, unsigned int);\nvoid free_ical(struct text_object *);\n\n#endif /*ICAL_H_*/\n"
  },
  {
    "path": "src/data/iconv_tools.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <iconv.h>\n#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"config.h\"\n#include \"../logging.h\"\n#include \"../content/text_object.h\"\n\n#define ICONV_CODEPAGE_LENGTH 20\n\nstatic long iconv_selected;\nstatic long iconv_count = 0;\nstatic char iconv_converting = 0;\nstatic iconv_t **iconv_cd = 0;\n\nint register_iconv(iconv_t *new_iconv) {\n  iconv_cd = (void ***)realloc(iconv_cd, sizeof(iconv_t *) * (iconv_count + 1));\n  if (!iconv_cd) { CRIT_ERR(\"Out of memory\"); }\n  iconv_cd[iconv_count] = (void **)malloc(sizeof(iconv_t));\n  if (!iconv_cd[iconv_count]) { CRIT_ERR(\"Out of memory\"); }\n  memcpy(iconv_cd[iconv_count], new_iconv, sizeof(iconv_t));\n  iconv_count++;\n  return iconv_count;\n}\n\nvoid free_iconv(struct text_object *obj) {\n  long i;\n\n  (void)obj;\n\n  if (!iconv_cd) return;\n\n  for (i = 0; i < iconv_count; i++) {\n    if (iconv_cd[i]) {\n      iconv_close(*iconv_cd[i]);\n      free(iconv_cd[i]);\n    }\n  }\n  free(iconv_cd);\n  iconv_cd = 0;\n}\n\nvoid iconv_convert(size_t *a, char *buff_in, char *p, size_t p_max_size) {\n  int bytes;\n  size_t dummy1, dummy2;\n#if defined(__DragonFly__)\n  const char *ptr = buff_in;\n#else\n  char *ptr = buff_in;\n#endif\n  char *outptr = p;\n\n  if (*a <= 0 || !iconv_converting || iconv_selected <= 0 ||\n      iconv_cd[iconv_selected - 1] == (iconv_t)(-1))\n    return;\n\n  dummy1 = dummy2 = *a;\n\n  strncpy(buff_in, p, p_max_size);\n\n  iconv(*iconv_cd[iconv_selected - 1], nullptr, NULL, NULL, NULL);\n  while (dummy1 > 0) {\n    bytes =\n        iconv(*iconv_cd[iconv_selected - 1], &ptr, &dummy1, &outptr, &dummy2);\n    if (bytes == -1) {\n      NORM_ERR(\"Iconv codeset conversion failed\");\n      break;\n    }\n  }\n\n  /* It is necessary when we are converting from multibyte to\n   * singlebyte codepage */\n  // a = outptr - p;\n  //(*a) = *a - dummy2;\n  (*a) = outptr - p;\n}\n\nvoid init_iconv_start(struct text_object *obj, void *free_at_crash,\n                      const char *arg) {\n  char iconv_from[ICONV_CODEPAGE_LENGTH];\n  char iconv_to[ICONV_CODEPAGE_LENGTH];\n\n  if (iconv_converting) {\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"You must stop your last iconv conversion before \"\n                  \"starting another\");\n  }\n  if (sscanf(arg, \"%s %s\", iconv_from, iconv_to) != 2) {\n    CRIT_ERR_FREE(obj, free_at_crash, \"Invalid arguments for iconv_start\");\n  } else {\n    iconv_t new_iconv;\n\n    new_iconv = iconv_open(iconv_to, iconv_from);\n    if (new_iconv == (iconv_t)(-1)) {\n      NORM_ERR(\"Can't convert from %s to %s.\", iconv_from, iconv_to);\n    } else {\n      obj->data.i = register_iconv(&new_iconv);\n      iconv_converting = 1;\n    }\n  }\n}\n\nvoid init_iconv_stop(void) { iconv_converting = 0; }\n\nvoid print_iconv_start(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  (void)p;\n  (void)p_max_size;\n\n  iconv_converting = 1;\n  iconv_selected = obj->data.i;\n}\n\nvoid print_iconv_stop(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  (void)obj;\n  (void)p;\n  (void)p_max_size;\n\n  iconv_converting = 0;\n  iconv_selected = 0;\n}\n"
  },
  {
    "path": "src/data/iconv_tools.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _ICONV_TOOLS_H\n#define _ICONV_TOOLS_H\n\nvoid free_iconv(struct text_object *);\nvoid iconv_convert(size_t *, char *, char *, size_t);\nvoid init_iconv_start(struct text_object *, void *, const char *);\nvoid init_iconv_stop(void);\n\nvoid print_iconv_start(struct text_object *, char *, unsigned int);\nvoid print_iconv_stop(struct text_object *, char *, unsigned int);\n\n#endif /* _ICONV_TOOLS_H */\n"
  },
  {
    "path": "src/data/misc.cc",
    "content": "/* -*- mode: c; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-\n * vim: ts=4 sw=4 noet ai cindent syntax=c\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2010 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <ctype.h>\n#include <stdio.h>\n#include <string.h>\n#include <sys/stat.h>\n#include <sys/types.h>\n#include <unistd.h>\n#include \"../conky.h\"\n#include \"../core.h\"\n#include \"../logging.h\"\n#include \"../content/specials.h\"\n#include \"../content/text_object.h\"\n\nstatic inline void read_file(const char *data, char *buf, const int size) {\n  FILE *fp;\n\n  memset(buf, 0, size);\n\n  if (!data) return;\n\n  fp = fopen(data, \"r\");\n  if (fp) {\n    int length;\n\n    length = fread(buf, 1, size - 1, fp);\n    fclose(fp);\n    buf[length] = '\\0';\n    if (length > 0 && buf[length - 1] == '\\n') { buf[length - 1] = '\\0'; }\n  } else {\n    buf[0] = '\\0';\n  }\n}\n\nstatic inline unsigned int file_buffer_size(const char *data,\n                                            const unsigned int maxsize) {\n  struct stat buf;\n  if (stat(data, &buf)) return maxsize;\n  if (buf.st_size < 0 || buf.st_size > maxsize) return maxsize;\n  if (buf.st_size < 10) return 10;\n  return buf.st_size + 1;\n}\n\nvoid print_cat(struct text_object *obj, char *p, unsigned int p_max_size) {\n  read_file(obj->data.s, p, p_max_size);\n}\n\nvoid print_catp(struct text_object *obj, char *p, unsigned int p_max_size) {\n  const unsigned int sz =\n      file_buffer_size(obj->data.s, text_buffer_size.get(*state));\n  char *buf = new char[sz];\n\n  read_file(obj->data.s, buf, sz);\n\n  evaluate(buf, p, p_max_size);\n\n  delete[] buf;\n}\n\nvoid print_startcase(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  evaluate(obj->data.s, p, p_max_size);\n\n  for (unsigned int x = 0, z = 0; x < p_max_size - 1 && p[x]; x++) {\n    if (isspace(p[x])) {\n      z = 0;\n    } else {\n      p[x] = z ? tolower(p[x]) : toupper(p[x]);\n      z++;\n    }\n  }\n}\n\nvoid print_lowercase(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  evaluate(obj->data.s, p, p_max_size);\n\n  for (unsigned int x = 0; x < p_max_size - 1 && p[x]; x++)\n    p[x] = tolower(p[x]);\n}\n\nvoid print_uppercase(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  evaluate(obj->data.s, p, p_max_size);\n\n  for (unsigned int x = 0; x < p_max_size - 1 && p[x]; x++)\n    p[x] = toupper(p[x]);\n}\n\nvoid strip_trailing_whitespace(struct text_object *obj, char *p,\n                               unsigned int p_max_size) {\n  evaluate(obj->data.s, p, p_max_size);\n  for (unsigned int x = p_max_size - 2;; x--) {\n    if (p[x] && !isspace(p[x])) {\n      p[x + 1] = '\\0';\n      break;\n    } else if (x == 0) {\n      p[x] = '\\0';\n      break;\n    }\n  }\n}\n\nlong long int apply_base_multiplier(const char *s, long long int num) {\n  long long int base = 1024LL;\n  if (*s && (0 == (strcmp(s, \"si\")))) { base = 1000LL; }\n  return (num * base);\n}\n"
  },
  {
    "path": "src/data/misc.h",
    "content": "/* -*- mode: c++; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: t -*-\n * vim: ts=4 sw=4 noet ai cindent syntax=cpp\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2012 Brenden Matthews, Philip Kovacs, et. al.\n *   (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _MISC_H\n#define _MISC_H\n\n#include \"../content/text_object.h\"\n\nvoid print_cat(struct text_object *, char *, unsigned int);\nvoid print_catp(struct text_object *, char *, unsigned int);\nvoid print_startcase(struct text_object *, char *, unsigned int);\nvoid print_lowercase(struct text_object *, char *, unsigned int);\nvoid print_uppercase(struct text_object *, char *, unsigned int);\nvoid strip_trailing_whitespace(struct text_object *, char *, unsigned int);\nlong long apply_base_multiplier(const char *, long long int);\n#endif /* _MISC_H */\n"
  },
  {
    "path": "src/data/mysql.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"mysql.h\"\n#include \"../conky.h\"\n#include \"../logging.h\"\n\n#include <mysql.h>\n\n#include \"../lua/setting.hh\"\n\nnamespace {\nconky::simple_config_setting<std::string> host(\"mysql_host\", \"localhost\",\n                                               false);\nconky::range_config_setting<in_port_t> port(\"mysql_port\", 0, 0xffff, 0, false);\nconky::simple_config_setting<std::string> user(\"mysql_user\", \"root\", false);\nconky::simple_config_setting<std::string> password(\"mysql_password\",\n                                                   std::string(), false);\nconky::simple_config_setting<std::string> db(\"mysql_db\", \"mysql\", false);\n}  // namespace\n\nvoid mysql_finish(MYSQL *conn, MYSQL_RES *res) {\n  if (nullptr != res) { mysql_free_result(res); }\n  mysql_close(conn);\n  mysql_library_end();\n}\n\nvoid print_mysql(struct text_object *obj, char *p, unsigned int p_max_size) {\n  MYSQL *conn = mysql_init(nullptr);\n  MYSQL_RES *res = nullptr;\n\n  if (conn == nullptr) {\n    NORM_ERR(\"Can't initialize MySQL\");\n    mysql_library_end();\n    return;\n  }\n  if (!mysql_real_connect(conn, host.get(*state).c_str(),\n                          user.get(*state).c_str(),\n                          password.get(*state).c_str(), db.get(*state).c_str(),\n                          port.get(*state), nullptr, 0)) {\n    NORM_ERR(\"MySQL: %s\", mysql_error(conn));\n    mysql_finish(conn, res);\n    return;\n  }\n  if (mysql_query(conn, obj->data.s)) {\n    NORM_ERR(\"MySQL: %s\", mysql_error(conn));\n    mysql_finish(conn, res);\n    return;\n  }\n  res = mysql_use_result(conn);\n  if (res == nullptr) {\n    NORM_ERR(\"MySQL: %s\", mysql_error(conn));\n    mysql_finish(conn, res);\n    return;\n  }\n  MYSQL_ROW row = mysql_fetch_row(res);\n  if (row) {\n    snprintf(p, p_max_size, \"%s\", row[0]);\n  } else {\n    NORM_ERR(\"MySQL: '%s' returned no results\", obj->data.s);\n  }\n  mysql_finish(conn, res);\n}\n"
  },
  {
    "path": "src/data/mysql.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef MYSQL_H_\n#define MYSQL_H_\n\nvoid print_mysql(struct text_object *, char *, unsigned int);\n\n#endif /*MYSQL_H_*/\n"
  },
  {
    "path": "src/data/network/ccurl_thread.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"ccurl_thread.h\"\n#include <cmath>\n#include <mutex>\n#include \"../../conky.h\"\n#include \"../../content/text_object.h\"\n#include \"../../logging.h\"\n\n#ifdef DEBUG\n#include <assert.h>\n#endif /* DEBUG */\n\n#include <curl/easy.h>\n\n/*\n * The following code is the conky curl thread lib, which can be re-used to\n * create any curl-based object (see rss).  Below is an\n * implementation of a curl-only object ($curl) which can also be used as an\n * example.\n */\n\nnamespace priv {\n/* callback used by curl for parsing the header data */\nsize_t curl_internal::parse_header_cb(void *ptr, size_t size, size_t nmemb,\n                                      void *data) {\n  curl_internal *obj = static_cast<curl_internal *>(data);\n  const char *value = static_cast<const char *>(ptr);\n  size_t realsize = size * nmemb;\n\n  if (realsize > 0 &&\n      (value[realsize - 1] == '\\r' || value[realsize - 1] == 0)) {\n    --realsize;\n  }\n\n  if (strncmp(value, \"Last-Modified: \", 15) == EQUAL) {\n    obj->last_modified = std::string(value + 15, realsize - 15);\n  } else if (strncmp(value, \"ETag: \", 6) == EQUAL) {\n    obj->etag = std::string(value + 6, realsize - 6);\n  }\n\n  return size * nmemb;\n}\n\n/* callback used by curl for writing the received data */\nsize_t curl_internal::write_cb(void *ptr, size_t size, size_t nmemb,\n                               void *data) {\n  curl_internal *obj = static_cast<curl_internal *>(data);\n  const char *value = static_cast<const char *>(ptr);\n  size_t realsize = size * nmemb;\n\n  obj->data += std::string(value, realsize);\n\n  return realsize;\n}\n\ncurl_internal::curl_internal(const std::string &url) : curl(curl_easy_init()) {\n  if (!curl) throw std::runtime_error(\"curl_easy_init() failed\");\n\n  curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1);\n  curl_easy_setopt(curl, CURLOPT_HEADERDATA, this);\n  curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, parse_header_cb);\n  curl_easy_setopt(curl, CURLOPT_WRITEDATA, this);\n  curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_cb);\n  curl_easy_setopt(curl, CURLOPT_URL, url.c_str());\n  curl_easy_setopt(curl, CURLOPT_USERAGENT, \"conky-curl/1.1\");\n#ifdef CURLOPT_PROTOCOLS_STR\n  curl_easy_setopt(curl, CURLOPT_PROTOCOLS_STR, \"http,https\");\n#elif defined(CURLOPT_PROTOCOLS)\n  curl_easy_setopt(curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);\n#endif\n  curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);\n  curl_easy_setopt(curl, CURLOPT_MAXREDIRS, 3L);\n#ifdef CURLOPT_REDIR_PROTOCOLS_STR\n  curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS_STR, \"http,https\");\n#elif defined(CURLOPT_REDIR_PROTOCOLS)\n  curl_easy_setopt(curl, CURLOPT_REDIR_PROTOCOLS,\n                   CURLPROTO_HTTP | CURLPROTO_HTTPS);\n#endif\n  curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1000);\n  curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 60);\n\n  // curl's usage of alarm()+longjmp() is a really bad idea for multi-threaded\n  // applications\n  curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);\n}\n\n/* fetch our datums */\nvoid curl_internal::do_work() {\n  CURLcode res;\n  struct headers_ {\n    struct curl_slist *h;\n\n    headers_() : h(nullptr) {}\n    ~headers_() { curl_slist_free_all(h); }\n  } headers;\n\n  data.clear();\n\n  if (!last_modified.empty()) {\n    headers.h = curl_slist_append(\n        headers.h, (\"If-Modified-Since: \" + last_modified).c_str());\n    last_modified.clear();\n  }\n  if (!etag.empty()) {\n    headers.h =\n        curl_slist_append(headers.h, (\"If-None-Match: \" + etag).c_str());\n    etag.clear();\n  }\n  curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers.h);\n\n  res = curl_easy_perform(curl);\n  if (res == CURLE_OK) {\n    long http_status_code;\n\n    if (curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_status_code) ==\n        CURLE_OK) {\n      switch (http_status_code) {\n        case 200:\n          process_data();\n          break;\n        case 304:\n          break;\n        default:\n          NORM_ERR(\"curl: no data from server, got HTTP status %ld\",\n                   http_status_code);\n          break;\n      }\n    } else {\n      NORM_ERR(\"curl: no HTTP status from server\");\n    }\n  } else {\n    NORM_ERR(\"curl: could not retrieve data from server\");\n  }\n}\n}  // namespace priv\n\nnamespace {\nclass simple_curl_cb : public curl_callback<std::string> {\n  typedef curl_callback<std::string> Base;\n\n protected:\n  virtual void process_data() {\n    std::lock_guard<std::mutex> lock(result_mutex);\n    result = data;\n  }\n\n public:\n  simple_curl_cb(uint32_t period, const std::string &uri)\n      : Base(period, Tuple(uri)) {}\n};\n}  // namespace\n\n/*\n * This is where the $curl section begins.\n */\n\nstruct curl_data {\n  char *uri;\n  float interval;\n};\n\n/* prints result data to text buffer, used by $curl */\nvoid ccurl_process_info(char *p, int p_max_size, const std::string &uri,\n                        int interval) {\n  uint32_t period = std::max(lround(interval / active_update_interval()), 1l);\n  auto cb = conky::register_cb<simple_curl_cb>(period, uri);\n\n  strncpy(p, cb->get_result_copy().c_str(), p_max_size);\n}\n\nvoid curl_parse_arg(struct text_object *obj, const char *arg) {\n  struct curl_data *cd;\n  float interval = 0;\n  char *space;\n\n  if (strlen(arg) < 1) {\n    NORM_ERR(\"wrong number of arguments for $curl\");\n    return;\n  }\n\n  cd = static_cast<struct curl_data *>(malloc(sizeof(struct curl_data)));\n  memset(cd, 0, sizeof(struct curl_data));\n\n  // Default to a 15 minute interval\n  cd->interval = 15 * 60;\n\n  cd->uri = strdup(arg);\n  space = strchr(cd->uri, ' ');\n  if (space) {\n    // If an explicit interval was given, use that\n    char *interval_str = &space[1];\n    *space = '\\0';\n    sscanf(interval_str, \"%f\", &interval);\n    cd->interval = interval > 0 ? interval * 60 : active_update_interval();\n  }\n\n  obj->data.opaque = cd;\n}\n\nvoid curl_print(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct curl_data *cd = static_cast<struct curl_data *>(obj->data.opaque);\n\n  if (!cd) {\n    NORM_ERR(\"error processing Curl data\");\n    return;\n  }\n  ccurl_process_info(p, p_max_size, cd->uri, cd->interval);\n}\n\nvoid curl_obj_free(struct text_object *obj) {\n  struct curl_data *cd = static_cast<struct curl_data *>(obj->data.opaque);\n  free_and_zero(cd->uri);\n  free_and_zero(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/data/network/ccurl_thread.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _CURL_THREAD_H_\n#define _CURL_THREAD_H_\n\n#include <curl/curl.h>\n\n#include \"../../logging.h\"\n#include \"../../update-cb.hh\"\n\nnamespace priv {\n// factored out stuff that does not depend on the template parameters\nclass curl_internal {\n public:\n  std::string last_modified;\n  std::string etag;\n  std::string data;\n  CURL *curl;\n\n  static size_t parse_header_cb(void *ptr, size_t size, size_t nmemb,\n                                void *data);\n  static size_t write_cb(void *ptr, size_t size, size_t nmemb, void *data);\n\n  void do_work();\n\n  // called by do_work() after downloading data from the uri\n  // it should populate the result variable\n  virtual void process_data() = 0;\n\n  explicit curl_internal(const std::string &url);\n  virtual ~curl_internal() {\n    if (curl) curl_easy_cleanup(curl);\n  }\n};\n}  // namespace priv\n\n/*\n * Curl callback class template\n * the key is an url\n */\ntemplate <typename Result, typename... Keys>\nclass curl_callback : public conky::callback<Result, std::string, Keys...>,\n                      public priv::curl_internal {\n  typedef conky::callback<Result, std::string, Keys...> Base1;\n  typedef priv::curl_internal Base2;\n\n protected:\n  virtual void work() {\n    DBGP(\"reading curl data from '%s'\", std::get<0>(Base1::tuple).c_str());\n    do_work();\n  }\n\n public:\n  curl_callback(uint32_t period, const typename Base1::Tuple &tuple)\n      : Base1(period, false, tuple), Base2(std::get<0>(tuple)) {}\n};\n\n/* $curl exports begin */\n\n/* runs instance of $curl */\nvoid ccurl_process_info(char *p, int p_max_size, const std::string &uri,\n                        int interval);\n\nvoid curl_parse_arg(struct text_object *, const char *);\nvoid curl_print(struct text_object *, char *, unsigned int);\nvoid curl_obj_free(struct text_object *);\n\n/* $curl exports end */\n\n#endif /* _CURL_THREAD_H_ */\n"
  },
  {
    "path": "src/data/network/irc.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <libircclient.h>\n#include <pthread.h>\n#include <stdlib.h>\n#include <string.h>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\nstruct ll_text {\n  char *text;\n  struct ll_text *next;\n};\n\nstruct obj_irc {\n  pthread_t *thread;\n  irc_session_t *session;\n  char *arg;\n};\n\nstruct ctx {\n  char *chan;\n  int max_msg_lines;\n  struct ll_text *messages;\n};\n\nvoid ev_connected(irc_session_t *session, const char *, const char *,\n                  const char **, unsigned int) {\n  struct ctx *ctxptr = (struct ctx *)irc_get_ctx(session);\n  if (irc_cmd_join(session, ctxptr->chan, nullptr) != 0) {\n    NORM_ERR(\"irc: %s\", irc_strerror(irc_errno(session)));\n  }\n}\n\nvoid addmessage(struct ctx *ctxptr, char *nick, const char *text) {\n  struct ll_text *lastmsg = ctxptr->messages;\n  struct ll_text *newmsg = (struct ll_text *)malloc(sizeof(struct ll_text));\n  newmsg->text = (char *)malloc(strlen(nick) + strlen(text) + 4);  // 4 = \": \\n\"\n  snprintf(newmsg->text, strlen(nick) + strlen(text) + 4, \"%s: %s\\n\", nick,\n           text);\n  newmsg->next = nullptr;\n  int msgcnt = 1;\n  if (!lastmsg) {\n    ctxptr->messages = newmsg;\n  } else {\n    msgcnt++;\n    while (lastmsg->next) {\n      lastmsg = lastmsg->next;\n      msgcnt++;\n      if (msgcnt < 0) {\n        NORM_ERR(\"irc: too many messages, discarding the last one.\");\n        free(newmsg->text);\n        free(newmsg);\n        return;\n      }\n    }\n    lastmsg->next = newmsg;\n  }\n  if (ctxptr->max_msg_lines > 0) {\n    newmsg = ctxptr->messages;\n    msgcnt -= ctxptr->max_msg_lines;\n    while ((msgcnt > 0) && (ctxptr->messages)) {\n      msgcnt--;\n      newmsg = ctxptr->messages->next;\n      free(ctxptr->messages->text);\n      free(ctxptr->messages);\n      ctxptr->messages = newmsg;\n    }\n  }\n}\n\nvoid ev_talkinchan(irc_session_t *session, const char *, const char *origin,\n                   const char **params, unsigned int) {\n  char nickname[64];\n  struct ctx *ctxptr = (struct ctx *)irc_get_ctx(session);\n\n  irc_target_get_nick(origin, nickname, sizeof(nickname));\n  addmessage(ctxptr, nickname, params[1]);\n}\n\nvoid ev_num(irc_session_t *session, unsigned int event, const char *,\n            const char **params, unsigned int) {\n  char attachment[4] = \"_00\";\n\n  if (event == 433) {  // nick in use\n    int len = strlen(params[1]) + 4;\n    char *newnick = (char *)malloc(len);\n    strncpy(newnick, params[1], len);\n    attachment[1] += rand() % 10;\n    attachment[2] += rand() % 10;\n    strncat(newnick, attachment, len - 1);\n    irc_cmd_nick(session, newnick);\n    free(newnick);\n  }\n}\n\n#define IRCSYNTAX \\\n  \"The correct syntax is ${irc server(:port) #channel (max_msg_lines)}\"\n#define IRCPORT 6667\n#define IRCNICK \"conky\"\n#define IRCSERVERPASS nullptr\n#define IRCUSER nullptr\n#define IRCREAL nullptr\n\nvoid *ircclient(void *ptr) {\n  struct obj_irc *ircobj = (struct obj_irc *)ptr;\n  struct ctx *ctxptr = (struct ctx *)malloc(sizeof(struct ctx));\n  irc_callbacks_t callbacks;\n  char *server;\n  char *strport;\n  char *str_max_msg_lines;\n  unsigned int port;\n\n  memset(&callbacks, 0, sizeof(callbacks));\n  callbacks.event_connect = ev_connected;\n  callbacks.event_channel = ev_talkinchan;\n  callbacks.event_numeric = ev_num;\n  ircobj->session = irc_create_session(&callbacks);\n  server = strtok(ircobj->arg, \" \");\n  ctxptr->chan = strtok(nullptr, \" \");\n  if (!ctxptr->chan) { NORM_ERR(\"irc: %s\", IRCSYNTAX); }\n  str_max_msg_lines = strtok(nullptr, \" \");\n  if (str_max_msg_lines) {\n    ctxptr->max_msg_lines = strtol(str_max_msg_lines, nullptr, 10);\n  }\n  ctxptr->messages = nullptr;\n  irc_set_ctx(ircobj->session, ctxptr);\n  server = strtok(server, \":\");\n  strport = strtok(nullptr, \":\");\n  if (strport) {\n    port = strtol(strport, nullptr, 10);\n    if (port < 1 || port > 65535) port = IRCPORT;\n  } else {\n    port = IRCPORT;\n  }\n  int err = irc_connect(ircobj->session, server, port, IRCSERVERPASS, IRCNICK,\n                        IRCUSER, IRCREAL);\n  if (err != 0) { err = irc_errno(ircobj->session); }\n#ifdef BUILD_IPV6\n  if (err == LIBIRC_ERR_RESOLV) {\n    err = irc_connect6(ircobj->session, server, port, IRCSERVERPASS, IRCNICK,\n                       IRCUSER, IRCREAL);\n    if (err != 0) { err = irc_errno(ircobj->session); }\n  }\n#endif /* BUILD_IPV6 */\n  if (err != 0) { NORM_ERR(\"irc: %s\", irc_strerror(err)); }\n  if (irc_run(ircobj->session) != 0) {\n    int ircerror = irc_errno(ircobj->session);\n    if (irc_is_connected(ircobj->session)) {\n      NORM_ERR(\"irc: %s\", irc_strerror(ircerror));\n    } else {\n      NORM_ERR(\"irc: disconnected\");\n    }\n  }\n  free(ircobj->arg);\n  free(ctxptr);\n  return nullptr;\n}\n\nvoid parse_irc_args(struct text_object *obj, const char *arg) {\n  struct obj_irc *opaque = (struct obj_irc *)malloc(sizeof(struct obj_irc));\n  opaque->thread = (pthread_t *)malloc(sizeof(pthread_t));\n  srand(time(nullptr));\n  opaque->session = nullptr;\n  opaque->arg = strdup(arg);\n  pthread_create(opaque->thread, nullptr, ircclient, opaque);\n  obj->data.opaque = opaque;\n}\n\nvoid print_irc(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct obj_irc *ircobj = (struct obj_irc *)obj->data.opaque;\n  struct ctx *ctxptr;\n  struct ll_text *nextmsg, *curmsg;\n\n  if (!ircobj->session) return;\n  if (!irc_is_connected(ircobj->session)) return;\n  ctxptr = (struct ctx *)irc_get_ctx(ircobj->session);\n  curmsg = ctxptr->messages;\n  while (curmsg) {\n    nextmsg = curmsg->next;\n    strncat(p, curmsg->text, p_max_size - strlen(p) - 1);\n    if (!ctxptr->max_msg_lines) {\n      free(curmsg->text);\n      free(curmsg);\n    }\n    curmsg = nextmsg;\n  }\n  if (p[0] != 0) { p[strlen(p) - 1] = 0; }\n  if (!ctxptr->max_msg_lines) { ctxptr->messages = nullptr; }\n}\n\nvoid free_irc(struct text_object *obj) {\n  struct obj_irc *ircobj = (struct obj_irc *)obj->data.opaque;\n  struct ctx *ctxptr;\n  struct ll_text *nextmsg, *curmsg = nullptr;\n\n  if (ircobj->session) {\n    if (irc_is_connected(ircobj->session)) {\n      ctxptr = (struct ctx *)irc_get_ctx(ircobj->session);\n      curmsg = ctxptr->messages;\n      irc_disconnect(ircobj->session);\n    }\n    pthread_join(*(ircobj->thread), nullptr);\n    irc_destroy_session(ircobj->session);\n  }\n  free(ircobj->thread);\n  free(obj->data.opaque);\n  while (curmsg) {\n    nextmsg = curmsg->next;\n    free(curmsg->text);\n    free(curmsg);\n    curmsg = nextmsg;\n  }\n}\n"
  },
  {
    "path": "src/data/network/irc.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef IRC_H_\n#define IRC_H_\n\nvoid parse_irc_args(struct text_object *, const char *);\nvoid print_irc(struct text_object *, char *, unsigned int);\nvoid free_irc(struct text_object *);\n\n#endif /*IRC_H_*/\n"
  },
  {
    "path": "src/data/network/libtcp-portmon.cc",
    "content": "/*\n *\n * libtcp-portmon.c:  tcp port monitoring library.\n *\n * Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA.\n *\n */\n\n#ifdef HAVE_CONFIG_H\n#include <config.h>\n#endif\n\n#include \"libtcp-portmon.h\"\n\n#include <cstdio>\n#include <cstring>\n#include <unordered_map>\n#include <vector>\n\n/* -------------------------------------------------------------------\n * IMPLEMENTATION INTERFACE\n *\n * Implementation-specific interface begins here.  Clients should not\n * manipulate these structures directly, nor call the defined helper\n * functions.  Use the \"Client interface\" functions defined at bottom.\n * ------------------------------------------------------------------- */\n\nnamespace {\n/* ------------------------------------------------------------------------\n * A single tcp connection\n * ------------------------------------------------------------------------ */\nstruct tcp_connection_t {\n  /* connection's key in monitor hash */\n  struct in6_addr local_addr;\n  struct in6_addr remote_addr;\n  in_port_t local_port;\n  in_port_t remote_port;\n};\n\n/* hash function for tcp connections */\nstruct tcp_connection_hash {\n  size_t operator()(const tcp_connection_t &a) const {\n    size_t hash = 0;\n    size_t i;\n\n    hash = hash * 47 + a.local_port;\n    hash = hash * 47 + a.remote_port;\n    for (i = 0; i < sizeof(a.local_addr.s6_addr); ++i)\n      hash = hash * 47 + a.local_addr.s6_addr[i];\n    for (i = 0; i < sizeof(a.remote_addr.s6_addr); ++i)\n      hash = hash * 47 + a.remote_addr.s6_addr[i];\n\n    return hash;\n  }\n};\n\n/* comparison function for tcp connections */\nbool operator==(const tcp_connection_t &a, const tcp_connection_t &b) {\n  return a.local_port == b.local_port && a.remote_port == b.remote_port &&\n         !std::memcmp(&a.local_addr, &b.local_addr, sizeof(a.local_addr)) &&\n         !std::memcmp(&a.remote_addr.s6_addr, &b.remote_addr,\n                      sizeof(a.remote_addr));\n}\n\n/* ------------------------------------------------------------------------\n * A hash table containing tcp connection\n *\n * The second parameter provides the mechanism for removing connections if\n * they are not seen again in subsequent update cycles.\n * ------------------------------------------------------------------------ */\ntypedef std::unordered_map<tcp_connection_t, int, tcp_connection_hash>\n    connection_hash_t;\n\n/* start and end of port monitor range. Set start=end to monitor a single port\n */\ntypedef std::pair<in_port_t, in_port_t> port_range_t;\n\n/* hash function for port ranges */\nstruct port_range_hash {\n  size_t operator()(const port_range_t &a) const {\n    return a.first * 47 + a.second;\n  }\n};\n\ntypedef std::unordered_map<port_range_t, tcp_port_monitor_t, port_range_hash>\n    monitor_hash_t;\n\n}  // namespace\n\n/* --------------\n * A port monitor\n * -------------- */\nstruct _tcp_port_monitor_t {\n  /* hash table of pointers into connection list */\n  connection_hash_t hash;\n  /* array of connection pointers for O(1) peeking\n   * these point into the hash table*/\n  std::vector<const tcp_connection_t *> p_peek;\n\n  _tcp_port_monitor_t(int max_connections)\n      : hash(),\n        p_peek(max_connections,\n               static_cast<const tcp_connection_t *>(nullptr)) {}\n\n  _tcp_port_monitor_t(const _tcp_port_monitor_t &other)\n      : hash(other.hash),\n        p_peek(other.p_peek.size(),\n               static_cast<const tcp_connection_t *>(nullptr)) {\n    // we must rebuild the peek table because the pointers are no longer valid\n    rebuild_peek_table();\n  }\n\n  void rebuild_peek_table() {\n    /* Run through the monitor's connections and rebuild the peek table of\n     * connection pointers.  This is done so peeking into the monitor can be\n     * done in O(1) time instead of O(n) time for each peek. */\n\n    /* zero out the peek array */\n    std::fill(p_peek.begin(), p_peek.end(),\n              static_cast<tcp_connection_t *>(nullptr));\n\n    size_t i = 0;\n    for (connection_hash_t::iterator j = hash.begin(); j != hash.end();\n         ++j, ++i) {\n      p_peek[i] = &j->first;\n    }\n  }\n\n private:\n  // we don't need this atm\n  const _tcp_port_monitor_t &operator=(const _tcp_port_monitor_t &);\n};\n\n/* -----------------------------\n * A tcp port monitor collection\n * ----------------------------- */\nstruct _tcp_port_monitor_collection_t {\n  /* hash table of monitors */\n  monitor_hash_t hash;\n};\n\nnamespace {\n/* ---------------------------------------\n * A port monitor utility function typedef\n * --------------------------------------- */\ntypedef void (*tcp_port_monitor_function_ptr_t)(\n    monitor_hash_t::value_type &monitor, void *p_void);\n\nvoid age_tcp_port_monitor(monitor_hash_t::value_type &monitor, void *p_void) {\n  /* Run through the monitor's connections and decrement the age variable.\n   * If the age goes negative, we remove the connection from the monitor.\n   * Function takes O(n) time on the number of connections. */\n\n  if (p_void) { /* p_void should be nullptr in this context */\n    return;\n  }\n\n  for (connection_hash_t::iterator i = monitor.second.hash.begin();\n       i != monitor.second.hash.end();) {\n    if (--i->second >= 0)\n      ++i;\n    else {\n      /* connection is old.  remove connection from the hash. */\n      /* erase shouldn't invalidate iterators */\n      monitor.second.hash.erase(i++);\n    }\n  }\n}\n\nvoid rebuild_tcp_port_monitor_peek_table(monitor_hash_t::value_type &monitor,\n                                         void *p_void) {\n  if (p_void) { /* p_void should be nullptr in this context */\n    return;\n  }\n\n  monitor.second.rebuild_peek_table();\n}\n\nvoid show_connection_to_tcp_port_monitor(monitor_hash_t::value_type &monitor,\n                                         void *p_void) {\n  /* The monitor gets to look at each connection to see if it falls within\n   * the monitor's port range of interest.  Connections of interest are first\n   * looked up in the hash to see if they are already there.  If they are, we\n   * reset the age of the connection so it is not deleted.  If the connection\n   * is not in the hash, we add it, but only if we haven't exceeded the\n   * maximum connection limit for the monitor.\n   * The function takes O(1) time. */\n\n  tcp_connection_t *p_connection;\n\n  if (!p_void) { return; }\n\n  /* This p_connection is on caller's stack and not the heap.\n   * If we are interested, we will create a copy of the connection\n   * (on the heap) and add it to our list. */\n  p_connection = (tcp_connection_t *)p_void;\n\n  /* inspect the local port number of the connection to see if we're\n   * interested. */\n  if ((monitor.first.first <= p_connection->local_port) &&\n      (p_connection->local_port <= monitor.first.second)) {\n    /* the connection is in the range of the monitor. */\n\n    /* first check the hash to see if the connection is already there. */\n    connection_hash_t::iterator i = monitor.second.hash.find(*p_connection);\n    if (i != monitor.second.hash.end()) {\n      /* it's already in the hash.  reset the age of the connection. */\n      i->second = TCP_CONNECTION_STARTING_AGE;\n\n      return;\n    }\n\n    /* Connection is not yet in the hash.\n     * Add it if max_connections not exceeded. */\n    if (monitor.second.hash.size() < monitor.second.p_peek.size()) {\n      monitor.second.hash.insert(connection_hash_t::value_type(\n          *p_connection, TCP_CONNECTION_STARTING_AGE));\n    }\n  }\n}\n\n/* ------------------------------------------------------------------------\n * Apply a tcp_port_monitor_function_ptr_t function to each port monitor in\n * the collection.\n * ------------------------------------------------------------------------ */\nvoid for_each_tcp_port_monitor_in_collection(\n    tcp_port_monitor_collection_t *p_collection,\n    tcp_port_monitor_function_ptr_t p_function, void *p_function_args) {\n  if (!p_collection || !p_function) { return; }\n\n  /* for each monitor in the collection */\n  for (monitor_hash_t::iterator i = p_collection->hash.begin();\n       i != p_collection->hash.end(); ++i) {\n    /* apply the function with the given arguments */\n    p_function(*i, p_function_args);\n  }\n}\n\nconst unsigned char prefix_4on6[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\n                                     0x00, 0x00, 0x00, 0x00, 0xff, 0xff};\n\nunion sockaddr_in46 {\n  struct sockaddr_in sa4;\n  struct sockaddr_in6 sa6;\n  struct sockaddr sa;\n};\n\n/* checks whether the address is a IPv4-mapped IPv6 address */\nbool is_4on6(const struct in6_addr *addr) {\n  return !std::memcmp(&addr->s6_addr, prefix_4on6, sizeof(prefix_4on6));\n}\n\n/* converts the address to appropriate textual representation (IPv6, IPv4 or\n * fqdn) */\nvoid print_host(char *p_buffer, size_t buffer_size, const struct in6_addr *addr,\n                int fqdn) {\n  union sockaddr_in46 sa;\n  socklen_t slen;\n\n  std::memset(&sa, 0, sizeof(sa));\n\n  if (is_4on6(addr)) {\n    sa.sa4.sin_family = AF_INET;\n    std::memcpy(&sa.sa4.sin_addr.s_addr, &addr->s6_addr[12], 4);\n    slen = sizeof(sa.sa4);\n  } else {\n    sa.sa6.sin6_family = AF_INET6;\n    std::memcpy(&sa.sa6.sin6_addr, addr, sizeof(struct in6_addr));\n    slen = sizeof(sa.sa6);\n  }\n\n  getnameinfo(&sa.sa, slen, p_buffer, buffer_size, nullptr, 0,\n              fqdn ? 0 : NI_NUMERICHOST);\n}\n\n/* converts the textual representation of an IPv4 or IPv6 address to struct\n * in6_addr */\nvoid string_to_addr(struct in6_addr *addr, const char *p_buffer) {\n  size_t i;\n\n  if (std::strlen(p_buffer) < 32) {  // IPv4 address\n    i = sizeof(prefix_4on6);\n    std::memcpy(addr->s6_addr, prefix_4on6, i);\n  } else {\n    i = 0;\n  }\n\n  for (; i < sizeof(addr->s6_addr); i += 4, p_buffer += 8) {\n    std::sscanf(p_buffer, \"%8x\", (unsigned *)&addr->s6_addr[i]);\n  }\n}\n\n/* adds connections from file to the collection */\nvoid process_file(tcp_port_monitor_collection_t *p_collection,\n                  const char *file) {\n  std::FILE *fp;\n  char buf[256];\n  char local_addr[40];\n  char remote_addr[40];\n  tcp_connection_t conn;\n  unsigned long inode, uid, state;\n\n  if ((fp = std::fopen(file, \"r\")) == nullptr) { return; }\n\n  /* ignore field name line */\n  if (std::fgets(buf, 255, fp) == nullptr) {\n    std::fclose(fp);\n    return;\n  }\n\n  /* read all tcp connections */\n  while (std::fgets(buf, sizeof(buf), fp) != nullptr) {\n    if (std::sscanf(buf,\n                    \"%*d: %39[0-9a-fA-F]:%hx %39[0-9a-fA-F]:%hx %lx %*x:%*x \"\n                    \"%*x:%*x %*x %lu %*d %lu\",\n                    local_addr, &conn.local_port, remote_addr,\n                    &conn.remote_port, (unsigned long *)&state,\n                    (unsigned long *)&uid, (unsigned long *)&inode) != 7) {\n      std::fprintf(stderr, \"%s: bad file format\\n\", file);\n    }\n    /** TCP_ESTABLISHED equals 1, but is not (always??) included **/\n    // if ((inode == 0) || (state != TCP_ESTABLISHED)) {\n    if ((inode == 0) || (state != 1)) { continue; }\n\n    string_to_addr(&conn.local_addr, local_addr);\n    string_to_addr(&conn.remote_addr, remote_addr);\n\n    /* show the connection to each port monitor. */\n    for_each_tcp_port_monitor_in_collection(\n        p_collection, &show_connection_to_tcp_port_monitor, (void *)&conn);\n  }\n\n  std::fclose(fp);\n}\n}  // namespace\n\n/* ----------------------------------------------------------------------\n * CLIENT INTERFACE\n *\n * Clients should call only those functions below this line.\n * ---------------------------------------------------------------------- */\n\n/* ----------------------------------\n * Client operations on port monitors\n * ---------------------------------- */\n\n/* Clients use this function to get connection data from the indicated\n * port monitor.\n * The requested monitor value is copied into a client-supplied char buffer.\n * Returns 0 on success, -1 otherwise. */\nint peek_tcp_port_monitor(const tcp_port_monitor_t *p_monitor, int item,\n                          int connection_index, char *p_buffer,\n                          size_t buffer_size) {\n  struct sockaddr_in sa;\n\n  if (!p_monitor || !p_buffer || connection_index < 0) { return -1; }\n\n  std::memset(p_buffer, 0, buffer_size);\n  std::memset(&sa, 0, sizeof(sa));\n\n  sa.sin_family = AF_INET;\n\n  /* if the connection index is out of range, we simply return with no error,\n   * having first cleared the client-supplied buffer. */\n  if ((item != COUNT) &&\n      (connection_index >= ssize_t(p_monitor->hash.size()))) {\n    return 0;\n  }\n\n  switch (item) {\n    case COUNT:\n\n      std::snprintf(p_buffer, buffer_size, \"%u\",\n                    unsigned(p_monitor->hash.size()));\n      break;\n\n    case REMOTEIP:\n\n      print_host(p_buffer, buffer_size,\n                 &p_monitor->p_peek[connection_index]->remote_addr, 0);\n      break;\n\n    case REMOTEHOST:\n\n      print_host(p_buffer, buffer_size,\n                 &p_monitor->p_peek[connection_index]->remote_addr, 1);\n      break;\n\n    case REMOTEPORT:\n\n      std::snprintf(p_buffer, buffer_size, \"%d\",\n                    p_monitor->p_peek[connection_index]->remote_port);\n      break;\n\n    case REMOTESERVICE:\n\n      sa.sin_port = htons(p_monitor->p_peek[connection_index]->remote_port);\n      getnameinfo((struct sockaddr *)&sa, sizeof(struct sockaddr_in), nullptr,\n                  0, p_buffer, buffer_size, NI_NUMERICHOST);\n      break;\n\n    case LOCALIP:\n\n      print_host(p_buffer, buffer_size,\n                 &p_monitor->p_peek[connection_index]->local_addr, 0);\n      break;\n\n    case LOCALHOST:\n\n      print_host(p_buffer, buffer_size,\n                 &p_monitor->p_peek[connection_index]->local_addr, 1);\n      break;\n\n    case LOCALPORT:\n\n      std::snprintf(p_buffer, buffer_size, \"%d\",\n                    p_monitor->p_peek[connection_index]->local_port);\n      break;\n\n    case LOCALSERVICE:\n\n      sa.sin_port = htons(p_monitor->p_peek[connection_index]->local_port);\n      getnameinfo((struct sockaddr *)&sa, sizeof(struct sockaddr_in), nullptr,\n                  0, p_buffer, buffer_size, NI_NUMERICHOST);\n      break;\n\n    default:\n      return -1;\n  }\n\n  return 0;\n}\n\n/* --------------------------------\n * Client operations on collections\n * -------------------------------- */\n\n/* Create a monitor collection.  Do this one first. */\ntcp_port_monitor_collection_t *create_tcp_port_monitor_collection(void) {\n  return new tcp_port_monitor_collection_t();\n}\n\n/* Destroy the monitor collection (and the monitors inside).\n * Do this one last. */\nvoid destroy_tcp_port_monitor_collection(\n    tcp_port_monitor_collection_t *p_collection) {\n  delete p_collection;\n}\n\n/* Updates the tcp statistics for all monitors within a collection */\nvoid update_tcp_port_monitor_collection(\n    tcp_port_monitor_collection_t *p_collection) {\n  if (!p_collection) { return; }\n\n  process_file(p_collection, \"/proc/net/tcp\");\n  process_file(p_collection, \"/proc/net/tcp6\");\n\n  /* age the connections in all port monitors. */\n  for_each_tcp_port_monitor_in_collection(p_collection, &age_tcp_port_monitor,\n                                          nullptr);\n\n  /* rebuild the connection peek tables of all monitors\n   * so clients can peek in O(1) time */\n  for_each_tcp_port_monitor_in_collection(\n      p_collection, &rebuild_tcp_port_monitor_peek_table, nullptr);\n}\n\n/* Creation of redundant monitors is silently ignored */\nint insert_new_tcp_port_monitor_into_collection(\n    tcp_port_monitor_collection_t *p_collection, in_port_t port_range_begin,\n    in_port_t port_range_end, tcp_port_monitor_args_t *p_creation_args) {\n  if (!p_collection) { return -1; }\n\n  p_collection->hash.insert(monitor_hash_t::value_type(\n      port_range_t(port_range_begin, port_range_end),\n      tcp_port_monitor_t(p_creation_args->max_port_monitor_connections)));\n\n  return 0;\n}\n\n/* Clients need a way to find monitors */\ntcp_port_monitor_t *find_tcp_port_monitor(\n    tcp_port_monitor_collection_t *p_collection, in_port_t port_range_begin,\n    in_port_t port_range_end) {\n  if (!p_collection) { return nullptr; }\n\n  /* is monitor in hash? */\n  monitor_hash_t::iterator i =\n      p_collection->hash.find(port_range_t(port_range_begin, port_range_end));\n\n  return i == p_collection->hash.end() ? nullptr : &i->second;\n}\n"
  },
  {
    "path": "src/data/network/libtcp-portmon.h",
    "content": "/*\n *\n * libtcp-portmon.h:  tcp port monitoring library.\n *\n * Copyright (C) 2005-2007 Philip Kovacs pkovacs@users.sourceforge.net\n *\n * This library is free software; you can redistribute it and/or\n * modify it under the terms of the GNU Lesser General Public\n * License as published by the Free Software Foundation; either\n * version 2.1 of the License, or (at your option) any later version.\n *\n * This library is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n * Lesser General Public License for more details.\n *\n * You should have received a copy of the GNU Lesser General Public\n * License along with this library; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301\n * USA. */\n\n#ifndef LIBTCP_PORTMON_H\n#define LIBTCP_PORTMON_H\n\n#include <sys/socket.h>\n#include <sys/types.h>\n\n#include <arpa/inet.h>\n#include <netinet/in.h>\n#include <netinet/tcp.h>\n\n#include <netdb.h>\n\n/* connection deleted if unseen again after this # of refreshes */\n#define TCP_CONNECTION_STARTING_AGE 1\n#define BUILD_PORT_MONITORS_HASH_KEY_SIZE 12\n#define MAX_PORT_MONITOR_CONNECTIONS_DEFAULT 256\n\n/* -------------------------------------------------------------------\n * IMPLEMENTATION INTERFACE\n *\n * Implementation-specific interface begins here.  Clients should not\n * manipulate these structures directly, nor call the defined helper\n * functions.  Use the \"Client interface\" functions defined at bottom.\n * ------------------------------------------------------------------- */\n\n/* The inventory of peekable items within the port monitor. */\nenum tcp_port_monitor_peekables {\n  COUNT = 0,\n  REMOTEIP,\n  REMOTEHOST,\n  REMOTEPORT,\n  REMOTESERVICE,\n  LOCALIP,\n  LOCALHOST,\n  LOCALPORT,\n  LOCALSERVICE\n};\n\n/* ------------------------------------------------------------\n * A port monitor\n *\n * The definition of the struct is hidden because it contains\n * C++-specific stuff and we want to #include this from C code.\n * ------------------------------------------------------------ */\ntypedef struct _tcp_port_monitor_t tcp_port_monitor_t;\n\n/* ------------------------------------------------------------\n * A tcp port monitor collection\n *\n * The definition of the struct is hidden because it contains\n * C++-specific stuff and we want to #include this from C code.\n * ------------------------------------------------------------ */\ntypedef struct _tcp_port_monitor_collection_t tcp_port_monitor_collection_t;\n\n/* ----------------------------------------------------------------------\n * CLIENT INTERFACE\n *\n * Clients should call only those functions below this line.\n * ---------------------------------------------------------------------- */\n\n/* struct to hold monitor creation arguments */\ntypedef struct _tcp_port_monitor_args_t {\n  /* monitor supports tracking at most this many connections */\n  int max_port_monitor_connections;\n} tcp_port_monitor_args_t;\n\n/* ----------------------------------\n * Client operations on port monitors\n * ---------------------------------- */\n\n/* Clients use this function to get connection data from\n * the indicated port monitor.\n * The requested monitor value is copied into a client-supplied char buffer.\n * Returns 0 on success, -1 otherwise. */\nint peek_tcp_port_monitor(\n    const tcp_port_monitor_t *p_monitor,\n    /* (item of interest, from tcp_port_monitor_peekables enum) */\n    int item,\n    /* (0 to number of connections in monitor - 1) */\n    int connection_index,\n    /* buffer to receive requested value */\n    char *p_buffer,\n    /* size of p_buffer */\n    size_t buffer_size);\n\n/* --------------------------------\n * Client operations on collections\n * -------------------------------- */\n\n/* Create a monitor collection.  Do this one first. */\ntcp_port_monitor_collection_t *create_tcp_port_monitor_collection(void);\n\n/* Destroy the monitor collection (and everything it contains).\n * Do this one last. */\nvoid destroy_tcp_port_monitor_collection(\n    tcp_port_monitor_collection_t *p_collection);\n\n/* Updates the tcp statistics for all monitors within a collection */\nvoid update_tcp_port_monitor_collection(\n    tcp_port_monitor_collection_t *p_collection);\n\n/* Creation of redundant monitors is silently ignored\n * Returns 0 on success, -1 otherwise. */\nint insert_new_tcp_port_monitor_into_collection(\n    tcp_port_monitor_collection_t *p_collection, in_port_t port_range_begin,\n    in_port_t port_range_end, tcp_port_monitor_args_t *p_creation_args);\n\n/* Clients need a way to find monitors */\ntcp_port_monitor_t *find_tcp_port_monitor(\n    tcp_port_monitor_collection_t *p_collection, in_port_t port_range_begin,\n    in_port_t port_range_end);\n\n#endif\n"
  },
  {
    "path": "src/data/network/mail.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n\n#include \"mail.h\"\n\n#include \"../../common.h\"\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\n#include <netdb.h>\n#include <netinet/in.h>\n#include <sys/param.h>\n#include <sys/socket.h>\n#include <sys/stat.h>\n#include <sys/time.h>\n#include <unistd.h>\n#include <cerrno>\n#include <cinttypes>\n#include <climits>\n#include <cstdio>\n#include <cstring>\n\n#include <dirent.h>\n#include <termios.h>\n\n#include <cmath>\n#include <memory>\n#include <mutex>\n#include <sstream>\n\n#include \"../../update-cb.hh\"\n\nstruct local_mail_s {\n  char *mbox;\n  int mail_count;\n  int new_mail_count;\n  int seen_mail_count;\n  int unseen_mail_count;\n  int flagged_mail_count;\n  int unflagged_mail_count;\n  int forwarded_mail_count;\n  int unforwarded_mail_count;\n  int replied_mail_count;\n  int unreplied_mail_count;\n  int draft_mail_count;\n  int trashed_mail_count;\n  float interval;\n  time_t last_mtime;\n  time_t last_ctime; /* needed for mutt at least */\n  double last_update;\n};\n\nclass mail_fail : public std::runtime_error {\n public:\n  explicit mail_fail(const std::string &what_arg) : runtime_error(what_arg) {}\n};\n\nstd::pair<std::string, bool> priv::current_mail_spool_setting::do_convert(\n    lua::state &l, int index) {\n  auto ret = Base::do_convert(l, index);\n  if (ret.second) { ret.first = variable_substitute(ret.first); }\n  return ret;\n}\n\npriv::current_mail_spool_setting current_mail_spool;\n\nnamespace {\nenum { DEFAULT_MAIL_INTERVAL = 300 /*seconds*/ };\n\nenum { MP_USER, MP_PASS, MP_FOLDER, MP_COMMAND, MP_HOST, MP_PORT };\n\nstruct mail_result {\n  unsigned long unseen{0};\n  unsigned long used{0};\n  unsigned long messages{0};\n\n  mail_result() = default;\n};\n\nclass mail_cb\n    : public conky::callback<mail_result, std::string, std::string, std::string,\n                             std::string, std::string, in_port_t> {\n  typedef conky::callback<mail_result, std::string, std::string, std::string,\n                          std::string, std::string, in_port_t>\n      Base;\n\n protected:\n  addrinfo *ai;\n\n  uint16_t fail;\n  uint16_t retries;\n\n  void resolve_host() {\n    struct addrinfo hints {};\n    char portbuf[8];\n\n    memset(&hints, 0, sizeof(struct addrinfo));\n    hints.ai_family = AF_UNSPEC;\n    hints.ai_socktype = SOCK_STREAM;\n    hints.ai_protocol = IPPROTO_TCP;\n    snprintf(portbuf, 8, \"%\" SCNu16, get<MP_PORT>());\n\n    if (int res = getaddrinfo(get<MP_HOST>().c_str(), portbuf, &hints, &ai)) {\n      throw mail_fail(std::string(\"IMAP getaddrinfo: \") + gai_strerror(res));\n    }\n  }\n\n  int connect() {\n    for (struct addrinfo *rp = ai; rp != nullptr; rp = rp->ai_next) {\n      int sockfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);\n      if (sockfd == -1) { continue; }\n      if (::connect(sockfd, rp->ai_addr, rp->ai_addrlen) != -1) {\n        return sockfd;\n      }\n      close(sockfd);\n    }\n    throw mail_fail(\"Unable to connect to mail server\");\n  }\n\n  void merge(callback_base &&other) override {\n    auto &&o = dynamic_cast<mail_cb &&>(other);\n    if (retries < o.retries) {\n      retries = o.retries;\n      fail = 0;\n    }\n\n    Base::merge(std::move(other));\n  }\n\n  mail_cb(uint32_t period, const Tuple &tuple, uint16_t retries_)\n      : Base(period, false, tuple, true),\n        ai(nullptr),\n        fail(0),\n        retries(retries_) {}\n\n  ~mail_cb() override {\n    if (ai != nullptr) { freeaddrinfo(ai); }\n  }\n};\n\nstruct mail_param_ex : public mail_cb::Tuple {\n  uint16_t retries{0};\n  uint32_t period{1};\n\n  mail_param_ex() = default;\n};\n\nclass imap_cb : public mail_cb {\n  using Base = mail_cb;\n\n  void check_status(char *recvbuf);\n  void unseen_command(unsigned long old_unseen, unsigned long old_messages);\n\n protected:\n  void work() override;\n\n public:\n  imap_cb(uint32_t period, const Tuple &tuple, uint16_t retries_)\n      : Base(period, tuple, retries_) {}\n};\n\nclass pop3_cb : public mail_cb {\n  using Base = mail_cb;\n\n protected:\n  void work() override;\n\n public:\n  pop3_cb(uint32_t period, const Tuple &tuple, uint16_t retries_)\n      : Base(period, tuple, retries_) {}\n};\n\nstruct mail_param_ex *global_mail;\n}  // namespace\n\nstatic void update_mail_count(struct local_mail_s *mail) {\n  struct stat st {};\n\n  if (mail == nullptr) { return; }\n\n  /* TODO: use that fine file modification notify on Linux 2.4 */\n\n  /* don't check mail so often (9.5s is minimum interval) */\n  if (current_update_time - mail->last_update < 9.5) { return; }\n  mail->last_update = current_update_time;\n\n  if (stat(mail->mbox, &st) != 0) {\n    static int rep = 0;\n\n    if (rep == 0) {\n      NORM_ERR(\"can't stat %s: %s\", mail->mbox, strerror(errno));\n      rep = 1;\n    }\n    return;\n  }\n#if HAVE_DIRENT_H\n  /* maildir format */\n  if (S_ISDIR(st.st_mode)) {\n    DIR *dir;\n    std::string dirname(mail->mbox);\n    struct dirent *dirent;\n    char *mailflags;\n\n    mail->mail_count = mail->new_mail_count = 0;\n    mail->seen_mail_count = mail->unseen_mail_count = 0;\n    mail->flagged_mail_count = mail->unflagged_mail_count = 0;\n    mail->forwarded_mail_count = mail->unforwarded_mail_count = 0;\n    mail->replied_mail_count = mail->unreplied_mail_count = 0;\n    mail->draft_mail_count = mail->trashed_mail_count = 0;\n    /* checking the cur subdirectory */\n    dirname = dirname + \"/cur\";\n\n    dir = opendir(dirname.c_str());\n    if (dir == nullptr) {\n      NORM_ERR(\"cannot open directory\");\n      return;\n    }\n    dirent = readdir(dir);\n    while (dirent != nullptr) {\n      /* . and .. are skipped */\n      if (dirent->d_name[0] != '.') {\n        mail->mail_count++;\n        mailflags = strdup(dirent->d_name);\n        if (mailflags == nullptr) {\n          NORM_ERR(\"malloc\");\n          return;\n        }\n        strncpy(mailflags, strrchr(dirent->d_name, ','),\n                strlen(strrchr(dirent->d_name, ',')));\n        if (strchr(mailflags, 'T') ==\n            nullptr) { /* The message is not in the trash */\n          if (strchr(mailflags, 'S') !=\n              nullptr) { /*The message has been seen */\n            mail->seen_mail_count++;\n          } else {\n            mail->unseen_mail_count++;\n          }\n          if (strchr(mailflags, 'F') != nullptr) { /*The message was flagged */\n            mail->flagged_mail_count++;\n          } else {\n            mail->unflagged_mail_count++;\n          }\n          if (strchr(mailflags, 'P') !=\n              nullptr) { /*The message was forwarded */\n            mail->forwarded_mail_count++;\n          } else {\n            mail->unforwarded_mail_count++;\n          }\n          if (strchr(mailflags, 'R') != nullptr) { /*The message was replied */\n            mail->replied_mail_count++;\n          } else {\n            mail->unreplied_mail_count++;\n          }\n          if (strchr(mailflags, 'D') != nullptr) { /*The message is a draft */\n            mail->draft_mail_count++;\n          }\n        } else {\n          mail->trashed_mail_count++;\n        }\n        free(mailflags);\n      }\n      dirent = readdir(dir);\n    }\n    closedir(dir);\n\n    dirname.resize(dirname.size() - 3);\n    dirname = dirname + \"new\";\n\n    dir = opendir(dirname.c_str());\n    if (dir == nullptr) {\n      NORM_ERR(\"cannot open directory\");\n      return;\n    }\n    dirent = readdir(dir);\n    while (dirent != nullptr) {\n      /* . and .. are skipped */\n      if (dirent->d_name[0] != '.') {\n        mail->new_mail_count++;\n        mail->mail_count++;\n        mail->unseen_mail_count++; /* new messages cannot have been seen */\n      }\n      dirent = readdir(dir);\n    }\n    closedir(dir);\n\n    return;\n  }\n#endif\n  /* mbox format */\n  if (st.st_mtime != mail->last_mtime || st.st_ctime != mail->last_ctime) {\n    /* yippee, modification time has changed, let's read mail count! */\n    static int rep;\n    FILE *fp;\n    int reading_status = 0;\n\n    /* could lock here but I don't think it's really worth it because\n     * this isn't going to write mail spool */\n\n    mail->new_mail_count = mail->mail_count = 0;\n\n    /* these flags are not supported for mbox */\n    mail->seen_mail_count = mail->unseen_mail_count = -1;\n    mail->flagged_mail_count = mail->unflagged_mail_count = -1;\n    mail->forwarded_mail_count = mail->unforwarded_mail_count = -1;\n    mail->replied_mail_count = mail->unreplied_mail_count = -1;\n    mail->draft_mail_count = mail->trashed_mail_count = -1;\n\n    fp = open_file(mail->mbox, &rep);\n    if (fp == nullptr) { return; }\n\n    /* NOTE: adds mail as new if there isn't Status-field at all */\n\n    while (feof(fp) == 0) {\n      char buf[128];\n\n      if (fgets(buf, 128, fp) == nullptr) { break; }\n\n      if (strncmp(buf, \"From \", 5) == 0) {\n        /* ignore MAILER-DAEMON */\n        if (strncmp(buf + 5, \"MAILER-DAEMON \", 14) != 0) {\n          mail->mail_count++;\n\n          if (reading_status == 1) {\n            mail->new_mail_count++;\n          } else {\n            reading_status = 1;\n          }\n        }\n      } else {\n        if (reading_status == 1 && strncmp(buf, \"X-Mozilla-Status:\", 17) == 0) {\n          int xms = strtol(buf + 17, nullptr, 16);\n          /* check that mail isn't marked for deletion */\n          if ((xms & 0x0008) != 0) {\n            mail->trashed_mail_count++;\n            reading_status = 0;\n            /* Don't check whether the trashed email is unread */\n            continue;\n          }\n          /* check that mail isn't already read */\n          if ((xms & 0x0001) == 0) { mail->new_mail_count++; }\n\n          /* check for an additional X-Status header */\n          reading_status = 2;\n          continue;\n        }\n        if (reading_status == 1 && strncmp(buf, \"Status:\", 7) == 0) {\n          /* check that mail isn't already read */\n          if (strchr(buf + 7, 'R') == nullptr) { mail->new_mail_count++; }\n\n          reading_status = 2;\n          continue;\n        }\n        if (reading_status >= 1 && strncmp(buf, \"X-Status:\", 9) == 0) {\n          /* check that mail isn't marked for deletion */\n          if (strchr(buf + 9, 'D') != nullptr) { mail->trashed_mail_count++; }\n\n          reading_status = 0;\n          continue;\n        }\n      }\n\n      /* skip until \\n */\n      while (strchr(buf, '\\n') == nullptr && (feof(fp) == 0)) {\n        if (fgets(buf, 128, fp) == nullptr) { break; }\n      }\n    }\n\n    fclose(fp);\n\n    if (reading_status != 0) { mail->new_mail_count++; }\n\n    mail->last_mtime = st.st_mtime;\n    mail->last_ctime = st.st_ctime;\n  }\n}\n\nvoid parse_local_mail_args(struct text_object *obj, const char *arg) {\n  float n1;\n  char mbox[256];\n  struct local_mail_s *locmail;\n\n  if (arg == nullptr) {\n    n1 = 9.5;\n    strncpy(mbox, current_mail_spool.get(*state).c_str(), sizeof(mbox));\n  } else {\n    if (sscanf(arg, \"%s %f\", mbox, &n1) != 2) {\n      n1 = 9.5;\n      strncpy(mbox, arg, sizeof(mbox));\n    }\n  }\n\n  std::string dst = variable_substitute(mbox);\n\n  locmail =\n      static_cast<struct local_mail_s *>(malloc(sizeof(struct local_mail_s)));\n  memset(locmail, 0, sizeof(struct local_mail_s));\n  locmail->mbox = strndup(dst.c_str(), text_buffer_size.get(*state));\n  locmail->interval = n1;\n  obj->data.opaque = locmail;\n}\n\n#define PRINT_MAILS_GENERATOR(x)                                            \\\n  void print_##x##mails(struct text_object *obj, char *p,                   \\\n                        unsigned int p_max_size) {                          \\\n    struct local_mail_s *locmail = (struct local_mail_s *)obj->data.opaque; \\\n    if (!locmail) return;                                                   \\\n    update_mail_count(locmail);                                             \\\n    snprintf(p, p_max_size, \"%d\", locmail->x##mail_count);                  \\\n  }\n\nPRINT_MAILS_GENERATOR()\nPRINT_MAILS_GENERATOR(new_)\nPRINT_MAILS_GENERATOR(seen_)\nPRINT_MAILS_GENERATOR(unseen_)\nPRINT_MAILS_GENERATOR(flagged_)\nPRINT_MAILS_GENERATOR(unflagged_)\nPRINT_MAILS_GENERATOR(forwarded_)\nPRINT_MAILS_GENERATOR(unforwarded_)\nPRINT_MAILS_GENERATOR(replied_)\nPRINT_MAILS_GENERATOR(unreplied_)\nPRINT_MAILS_GENERATOR(draft_)\nPRINT_MAILS_GENERATOR(trashed_)\n\nvoid free_local_mails(struct text_object *obj) {\n  auto *locmail = static_cast<struct local_mail_s *>(obj->data.opaque);\n\n  if (locmail == nullptr) { return; }\n\n  free_and_zero(locmail->mbox);\n  free_and_zero(obj->data.opaque);\n}\n\n#define MAXDATASIZE 1000\n\nnamespace {\nenum mail_type { POP3_TYPE, IMAP_TYPE };\n}  // namespace\n\nstd::unique_ptr<mail_param_ex> parse_mail_args(mail_type type,\n                                               const char *arg) {\n  using std::get;\n\n  std::unique_ptr<mail_param_ex> mail;\n  char *tmp;\n  char host[129];\n  char user[129];\n  char pass[129];\n\n  if (sscanf(arg, \"%128s %128s %128s\", host, user, pass) != 3) {\n    if (type == POP3_TYPE) {\n      NORM_ERR(\"Scanning POP3 args failed\");\n    } else if (type == IMAP_TYPE) {\n      NORM_ERR(\"Scanning IMAP args failed\");\n    }\n    return mail;\n  }\n\n  // see if password needs prompting\n  if (pass[0] == '*' && pass[1] == '\\0') {\n    int fp = fileno(stdin);\n    struct termios term {};\n\n    tcgetattr(fp, &term);\n    term.c_lflag &= ~ECHO;\n    tcsetattr(fp, TCSANOW, &term);\n    printf(\"Enter mailbox password (%s@%s): \", user, host);\n    if (scanf(\"%128s\", pass) != 1) { pass[0] = 0; }\n    printf(\"\\n\");\n    term.c_lflag |= ECHO;\n    tcsetattr(fp, TCSANOW, &term);\n  }\n\n  mail = std::make_unique<mail_param_ex>();\n  get<MP_HOST>(*mail) = host;\n  get<MP_USER>(*mail) = user;\n  get<MP_PASS>(*mail) = pass;\n\n  // now we check for optional args\n  tmp = const_cast<char *>(strstr(arg, \"-r \"));\n  if (tmp != nullptr) {\n    tmp += 3;\n    sscanf(tmp, \"%\" SCNu16, &mail->retries);\n  } else {\n    mail->retries = 5;  // 5 retries after failure\n  }\n\n  float interval = DEFAULT_MAIL_INTERVAL;\n  tmp = const_cast<char *>(strstr(arg, \"-i \"));\n  if (tmp != nullptr) {\n    tmp += 3;\n    sscanf(tmp, \"%f\", &interval);\n  }\n  mail->period = std::max(lround(interval / active_update_interval()), 1l);\n\n  tmp = const_cast<char *>(strstr(arg, \"-p \"));\n  if (tmp != nullptr) {\n    tmp += 3;\n    sscanf(tmp, \"%\" SCNu16, &get<MP_PORT>(*mail));\n  } else {\n    if (type == POP3_TYPE) {\n      get<MP_PORT>(*mail) = 110;  // default pop3 port\n    } else if (type == IMAP_TYPE) {\n      get<MP_PORT>(*mail) = 143;  // default imap port\n    }\n  }\n  if (type == IMAP_TYPE) {\n    tmp = const_cast<char *>(strstr(arg, \"-f \"));\n    if (tmp != nullptr) {\n      int len = 0;\n      tmp += 3;\n      if (tmp[0] == '\\'') {\n        len = strstr(tmp + 1, \"'\") - tmp - 1;\n        tmp++;\n      }\n      get<MP_FOLDER>(*mail).assign(tmp, len);\n    } else {\n      get<MP_FOLDER>(*mail) = \"INBOX\";  // default imap inbox\n    }\n  }\n  tmp = const_cast<char *>(strstr(arg, \"-e \"));\n  if (tmp != nullptr) {\n    int len = 0;\n    tmp += 3;\n\n    if (tmp[0] == '\\'') { len = strstr(tmp + 1, \"'\") - tmp - 1; }\n    get<MP_COMMAND>(*mail).assign(tmp + 1, len);\n  }\n\n  return mail;\n}\n\nvoid parse_imap_mail_args(struct text_object *obj, const char *arg) {\n  static int rep = 0;\n\n  if (arg == nullptr) {\n    if ((global_mail == nullptr) && (rep == 0)) {\n      // something is wrong, warn once then stop\n      NORM_ERR(\n          \"There's a problem with your mail settings.  \"\n          \"Check that the global mail settings are properly defined\"\n          \" (line %li).\",\n          obj->line);\n      rep = 1;\n      return;\n    }\n    obj->data.opaque = global_mail;\n    return;\n  }\n  // process\n  obj->data.opaque = parse_mail_args(IMAP_TYPE, arg).release();\n}\n\nvoid parse_pop3_mail_args(struct text_object *obj, const char *arg) {\n  static int rep = 0;\n\n  if (arg == nullptr) {\n    if ((global_mail == nullptr) && (rep == 0)) {\n      // something is wrong, warn once then stop\n      NORM_ERR(\n          \"There's a problem with your mail settings.  \"\n          \"Check that the global mail settings are properly defined\"\n          \" (line %li).\",\n          obj->line);\n      rep = 1;\n      return;\n    }\n    obj->data.opaque = global_mail;\n    return;\n  }\n  // process\n  obj->data.opaque = parse_mail_args(POP3_TYPE, arg).release();\n}\n\nnamespace {\nclass mail_setting : public conky::simple_config_setting<std::string> {\n  using Base = conky::simple_config_setting<std::string>;\n\n  mail_type type;\n\n protected:\n  void lua_setter(lua::state &l, bool init) override {\n    lua::stack_sentry s(l, -2);\n\n    Base::lua_setter(l, init);\n\n    if (init && (global_mail == nullptr)) {\n      const std::string &t = do_convert(l, -1).first;\n      if (static_cast<unsigned int>(!t.empty()) != 0u) {\n        global_mail = parse_mail_args(type, t.c_str()).release();\n      }\n    }\n\n    ++s;\n  }\n\n  void cleanup(lua::state &l) override {\n    lua::stack_sentry s(l, -1);\n\n    delete global_mail;\n    global_mail = nullptr;\n\n    l.pop();\n  }\n\n public:\n  mail_setting(const std::string &name, mail_type type_)\n      : Base(name), type(type_) {}\n};\n\nmail_setting imap(\"imap\", IMAP_TYPE);\nmail_setting pop3(\"pop3\", POP3_TYPE);\n}  // namespace\n\nvoid free_mail_obj(struct text_object *obj) {\n  if (obj->data.opaque == nullptr) { return; }\n\n  if (obj->data.opaque != global_mail) {\n    auto *mail = static_cast<mail_param_ex *>(obj->data.opaque);\n    delete mail;\n    obj->data.opaque = nullptr;\n  }\n}\n\nstatic void command(int sockfd, const std::string &cmd, char *response,\n                    const char *verify) {\n  struct timeval fetchtimeout {};\n  fd_set fdset;\n  ssize_t total = 0;\n  int numbytes = 0;\n\n  if (send(sockfd, cmd.c_str(), cmd.length(), 0) == -1) {\n    throw mail_fail(\"send: \" + strerror_r(errno));\n  }\n  DBGP2(\"command()  command: %s\", cmd.c_str());\n\n  while (1) {\n    fetchtimeout.tv_sec = 60;  // 60 second timeout i guess\n    fetchtimeout.tv_usec = 0;\n    FD_ZERO(&fdset);\n    FD_SET(sockfd, &fdset);\n\n    if (select(sockfd + 1, &fdset, nullptr, nullptr, &fetchtimeout) == 0) {\n      throw mail_fail(\"select: read timeout\");\n    }\n\n    if ((numbytes = recv(sockfd, response + total, MAXDATASIZE - 1 - total,\n                         0)) == -1) {\n      throw mail_fail(\"recv: \" + strerror_r(errno));\n    }\n\n    total += numbytes;\n    response[total] = '\\0';\n    DBGP2(\"command() received: %s\", response);\n\n    if (strstr(response, verify) != nullptr) { return; }\n\n    if (numbytes == 0) { throw mail_fail(\"Unexpected response from server\"); }\n  }\n}\n\nvoid imap_cb::check_status(char *recvbuf) {\n  char *reply;\n  reply = strstr(recvbuf, \" (MESSAGES \");\n  if ((reply == nullptr) || strlen(reply) < 2) {\n    throw mail_fail(\"Unexpected response from server\");\n  }\n\n  reply += 2;\n  *strchr(reply, ')') = '\\0';\n\n  std::lock_guard<std::mutex> lock(result_mutex);\n  if (sscanf(reply, \"MESSAGES %lu UNSEEN %lu\", &result.messages,\n             &result.unseen) != 2) {\n    throw mail_fail(std::string(\"Error parsing response: \") + recvbuf);\n  }\n}\n\nvoid imap_cb::unseen_command(unsigned long old_unseen,\n                             unsigned long old_messages) {\n  if (!get<MP_COMMAND>().empty() &&\n      (result.unseen > old_unseen ||\n       (result.messages > old_messages && result.unseen > 0)) &&\n      system(get<MP_COMMAND>().c_str()) == -1) {\n    perror(\"system()\");\n  }\n}\n\nvoid imap_cb::work() {\n  int sockfd, numbytes;\n  char recvbuf[MAXDATASIZE];\n  unsigned long old_unseen = ULONG_MAX;\n  unsigned long old_messages = ULONG_MAX;\n  bool has_idle = false;\n\n  while (fail < retries) {\n    struct timeval fetchtimeout {};\n    int res;\n    fd_set fdset;\n\n    if (ai == nullptr) { resolve_host(); }\n\n    try {\n      sockfd = connect();\n\n      command(sockfd, \"\", recvbuf, \"* OK\");\n\n      command(sockfd, \"abc CAPABILITY\\r\\n\", recvbuf, \"abc OK\");\n      if (strstr(recvbuf, \" IDLE \") != nullptr) { has_idle = true; }\n\n      std::ostringstream str;\n      str << \"a1 login \" << get<MP_USER>() << \" {\" << get<MP_PASS>().length()\n          << \"}\\r\\n\";\n      command(sockfd, str.str(), recvbuf, \"+\");\n\n      command(sockfd, get<MP_PASS>() + \"\\r\\n\", recvbuf, \"a1 OK\");\n\n      command(sockfd,\n              \"a2 STATUS \\\"\" + get<MP_FOLDER>() + \"\\\" (MESSAGES UNSEEN)\\r\\n\",\n              recvbuf, \"a2 OK\");\n      check_status(recvbuf);\n\n      unseen_command(old_unseen, old_messages);\n      fail = 0;\n      old_unseen = result.unseen;\n      old_messages = result.messages;\n\n      if (!has_idle) {\n        try {\n          command(sockfd, \"a3 LOGOUT\\r\\n\", recvbuf, \"a3 OK\");\n        } catch (mail_fail &e) {\n          NORM_ERR(\"Error while communicating with IMAP server: %s\", e.what());\n        }\n        close(sockfd);\n        return;\n      }\n\n      command(sockfd, \"a4 SELECT \\\"\" + get<MP_FOLDER>() + \"\\\"\\r\\n\", recvbuf,\n              \"a4 OK\");\n\n      command(sockfd, \"a5 IDLE\\r\\n\", recvbuf, \"+ idling\");\n      recvbuf[0] = '\\0';\n\n      while (1) {\n        /*\n         * RFC 2177 says we have to re-idle every 29 minutes.\n         * We'll do it every 20 minutes to be safe.\n         */\n        fetchtimeout.tv_sec = 1200;\n        fetchtimeout.tv_usec = 0;\n        DBGP2(\"idling...\");\n        FD_ZERO(&fdset);\n        FD_SET(sockfd, &fdset);\n        FD_SET(donefd(), &fdset);\n        res = select(std::max(sockfd, donefd()) + 1, &fdset, nullptr, nullptr,\n                     &fetchtimeout);\n        if ((res == -1 && errno == EINTR) || FD_ISSET(donefd(), &fdset)) {\n          try {\n            command(sockfd, \"DONE\\r\\n\", recvbuf, \"a5 OK\");\n            command(sockfd, \"a3 LOGOUT\\r\\n\", recvbuf, \"a3 OK\");\n          } catch (mail_fail &e) {\n            NORM_ERR(\"Error while communicating with IMAP server: %s\",\n                     e.what());\n          }\n          close(sockfd);\n          return;\n        }\n        if (res > 0) {\n          if ((numbytes = recv(sockfd, recvbuf, MAXDATASIZE - 1, 0)) == -1) {\n            throw mail_fail(\"recv idling\");\n          }\n        } else {\n          throw mail_fail(\"\");\n        }\n\n        recvbuf[numbytes] = '\\0';\n        DBGP2(\"imap_thread() received: %s\", recvbuf);\n        unsigned long messages, recent = 0;\n        bool force_check = 0;\n        if (strlen(recvbuf) > 2) {\n          char *buf = recvbuf;\n          buf = strstr(buf, \"EXISTS\");\n          while ((buf != nullptr) && strlen(buf) > 1 &&\n                 (strstr(buf + 1, \"EXISTS\") != nullptr)) {\n            buf = strstr(buf + 1, \"EXISTS\");\n          }\n          if (buf != nullptr) {\n            // back up until we reach '*'\n            while (buf >= recvbuf && buf < (recvbuf + MAXDATASIZE) - 1 &&\n                   buf[0] != '*') {\n              buf--;\n            }\n            if (sscanf(buf, \"* %lu EXISTS\\r\\n\", &messages) == 1) {\n              std::lock_guard<std::mutex> lock(result_mutex);\n              if (result.messages != messages) {\n                force_check = 1;\n                result.messages = messages;\n              }\n            }\n          }\n          buf = recvbuf;\n          buf = strstr(buf, \"RECENT\");\n          while ((buf != nullptr) && strlen(buf) > 1 &&\n                 (strstr(buf + 1, \"RECENT\") != nullptr)) {\n            buf = strstr(buf + 1, \"RECENT\");\n          }\n          if (buf != nullptr) {\n            // back up until we reach '*'\n            while (buf >= recvbuf && buf < (recvbuf + MAXDATASIZE) - 1 &&\n                   buf[0] != '*') {\n              buf--;\n            }\n            if (sscanf(buf, \"* %lu RECENT\\r\\n\", &recent) != 1) { recent = 0; }\n          }\n        }\n        /* check if we got a BYE from server */\n        if (strstr(recvbuf, \"* BYE\") != nullptr) {\n          // need to re-connect\n          throw mail_fail(\"\");\n        }\n\n        /*\n         * check if we got a FETCH from server, recent was\n         * something other than 0, or we had a timeout\n         */\n        if (recent > 0 || (strstr(recvbuf, \" FETCH \") != nullptr) ||\n            fetchtimeout.tv_sec == 0 || force_check) {\n          // re-check messages and unseen\n          command(sockfd, \"DONE\\r\\n\", recvbuf, \"a5 OK\");\n\n          command(\n              sockfd,\n              \"a2 STATUS \\\"\" + get<MP_FOLDER>() + \"\\\" (MESSAGES UNSEEN)\\r\\n\",\n              recvbuf, \"a2 OK\");\n\n          check_status(recvbuf);\n\n          command(sockfd, \"a5 IDLE\\r\\n\", recvbuf, \"+ idling\");\n        }\n        unseen_command(old_unseen, old_messages);\n        fail = 0;\n        old_unseen = result.unseen;\n        old_messages = result.messages;\n      }\n    } catch (mail_fail &e) {\n      if (sockfd != -1) { close(sockfd); }\n      freeaddrinfo(ai);\n      ai = nullptr;\n\n      ++fail;\n      if (*e.what() != 0) {\n        NORM_ERR(\"Error while communicating with IMAP server: %s\", e.what());\n      }\n      NORM_ERR(\"Trying IMAP connection again for %s@%s (try %u/%u)\",\n               get<MP_USER>().c_str(), get<MP_HOST>().c_str(), fail + 1,\n               retries);\n      sleep(fail); /* sleep more for the more failures we have */\n    }\n\n    if (is_done()) { return; }\n  }\n}\n\nvoid print_imap_unseen(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);\n\n  if (mail == nullptr) { return; }\n\n  auto cb = conky::register_cb<imap_cb>(mail->period, *mail, mail->retries);\n\n  snprintf(p, p_max_size, \"%lu\", cb->get_result_copy().unseen);\n}\n\nvoid print_imap_messages(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);\n\n  if (mail == nullptr) { return; }\n\n  auto cb = conky::register_cb<imap_cb>(mail->period, *mail, mail->retries);\n\n  snprintf(p, p_max_size, \"%lu\", cb->get_result_copy().messages);\n}\n\nvoid pop3_cb::work() {\n  int sockfd;\n  char recvbuf[MAXDATASIZE];\n  char *reply;\n  unsigned long old_unseen = ULONG_MAX;\n\n  while (fail < retries) {\n    if (ai == nullptr) { resolve_host(); }\n\n    try {\n      sockfd = connect();\n\n      command(sockfd, \"\", recvbuf, \"+OK \");\n      command(sockfd, \"USER \" + get<MP_USER>() + \"\\r\\n\", recvbuf, \"+OK \");\n      command(sockfd, \"PASS \" + get<MP_PASS>() + \"\\r\\n\", recvbuf, \"+OK \");\n      command(sockfd, \"STAT\\r\\n\", recvbuf, \"+OK \");\n\n      // now we get the data\n      reply = recvbuf + 4;\n      {\n        std::lock_guard<std::mutex> lock(result_mutex);\n        sscanf(reply, \"%lu %lu\", &result.unseen, &result.used);\n      }\n\n      command(sockfd, \"QUIT\\r\\n\", recvbuf, \"+OK\");\n\n      if (get<MP_COMMAND>().length() > 1 && result.unseen > old_unseen &&\n          system(get<MP_COMMAND>().c_str()) == -1) {\n        perror(\"system()\");\n      }\n      fail = 0;\n      return;\n    } catch (mail_fail &e) {\n      if (sockfd != -1) { close(sockfd); }\n      freeaddrinfo(ai);\n      ai = nullptr;\n\n      ++fail;\n      if (*e.what() != 0) {\n        NORM_ERR(\"Error while communicating with POP3 server: %s\", e.what());\n      }\n      NORM_ERR(\"Trying POP3 connection again for %s@%s (try %u/%u)\",\n               get<MP_USER>().c_str(), get<MP_HOST>().c_str(), fail + 1,\n               retries);\n      sleep(fail); /* sleep more for the more failures we have */\n    }\n\n    if (is_done()) { return; }\n  }\n}\n\nvoid print_pop3_unseen(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);\n\n  if (mail == nullptr) { return; }\n\n  auto cb = conky::register_cb<pop3_cb>(mail->period, *mail, mail->retries);\n\n  snprintf(p, p_max_size, \"%lu\", cb->get_result_copy().unseen);\n}\n\nvoid print_pop3_used(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  auto *mail = static_cast<struct mail_param_ex *>(obj->data.opaque);\n\n  if (mail == nullptr) { return; }\n\n  auto cb = conky::register_cb<pop3_cb>(mail->period, *mail, mail->retries);\n\n  snprintf(p, p_max_size, \"%.1f\", cb->get_result_copy().used / 1024.0 / 1024.0);\n}\n"
  },
  {
    "path": "src/data/network/mail.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _MAIL_H\n#define _MAIL_H\n\n#include \"../../lua/setting.hh\"\n\nvoid parse_local_mail_args(struct text_object *, const char *);\n\n#define PRINT_MAILS_PROTO_GENERATOR(x) \\\n  void print_##x##mails(struct text_object *, char *, unsigned int);\n\nPRINT_MAILS_PROTO_GENERATOR()\nPRINT_MAILS_PROTO_GENERATOR(new_)\nPRINT_MAILS_PROTO_GENERATOR(seen_)\nPRINT_MAILS_PROTO_GENERATOR(unseen_)\nPRINT_MAILS_PROTO_GENERATOR(flagged_)\nPRINT_MAILS_PROTO_GENERATOR(unflagged_)\nPRINT_MAILS_PROTO_GENERATOR(forwarded_)\nPRINT_MAILS_PROTO_GENERATOR(unforwarded_)\nPRINT_MAILS_PROTO_GENERATOR(replied_)\nPRINT_MAILS_PROTO_GENERATOR(unreplied_)\nPRINT_MAILS_PROTO_GENERATOR(draft_)\nPRINT_MAILS_PROTO_GENERATOR(trashed_)\n\nvoid free_local_mails(struct text_object *obj);\n\nvoid parse_global_imap_mail_args(const char *);\nvoid parse_global_pop3_mail_args(const char *);\n\nvoid parse_imap_mail_args(struct text_object *, const char *);\nvoid parse_pop3_mail_args(struct text_object *, const char *);\nvoid free_mail_obj(struct text_object *);\nvoid print_imap_unseen(struct text_object *, char *, unsigned int);\nvoid print_imap_messages(struct text_object *, char *, unsigned int);\nvoid print_pop3_unseen(struct text_object *, char *, unsigned int);\nvoid print_pop3_used(struct text_object *, char *, unsigned int);\n\nnamespace priv {\nclass current_mail_spool_setting\n    : public conky::simple_config_setting<std::string> {\n  typedef conky::simple_config_setting<std::string> Base;\n\n protected:\n  virtual std::pair<std::string, bool> do_convert(lua::state &l, int index);\n\n public:\n  current_mail_spool_setting() : Base(\"current_mail_spool\", \"$MAIL\", true) {}\n};\n}  // namespace priv\n\nextern priv::current_mail_spool_setting current_mail_spool;\n\n#endif /* _MAIL_H */\n"
  },
  {
    "path": "src/data/network/mboxscan.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2006 Marco Candrian <mac@calmar.ws>\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <sys/stat.h>\n#include <sys/time.h>\n#include <cerrno>\n#include <memory>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"mail.h\"\n#include \"../../content/text_object.h\"\n\n#define FROM_WIDTH 10\n#define SUBJECT_WIDTH 22\n#define PRINT_MAILS 5\n#define TIME_DELAY 5\n\nstruct ring_list {\n  char *from;\n  char *subject;\n  struct ring_list *previous;\n  struct ring_list *next;\n};\n\nstatic time_t last_ctime; /* needed for mutt at least */\nstatic time_t last_mtime; /* not sure what to test: testing both now */\nstatic double last_update;\n\nstatic int args_ok = 0;\nstatic int from_width;\nstatic int subject_width;\nstatic int print_num_mails;\nstatic int time_delay;\n\nstatic char mbox_mail_spool[DEFAULT_TEXT_BUFFER_SIZE];\n\nstatic void mbox_scan(char *args, char *output, size_t max_len) {\n  int i, u, flag;\n  int force_rescan = 0;\n  std::unique_ptr<char[]> buf_(new char[text_buffer_size.get(*state)]);\n  char *buf = buf_.get();\n  struct stat statbuf {};\n  struct ring_list *curr = nullptr, *prev = nullptr, *startlist = nullptr;\n  FILE *fp;\n\n  /* output was set to 1 after malloc'ing in conky.c */\n  /* -> being able to test it here for catching SIGUSR1 */\n  if (output[0] == 1) {\n    force_rescan = 1;\n    output[0] = '\\0';\n  }\n\n  if ((args_ok == 0) || (force_rescan != 0)) {\n    char *substr = strstr(args, \"-n\");\n\n    if (substr != nullptr) {\n      if (sscanf(substr, \"-n %i\", &print_num_mails) != 1) {\n        print_num_mails = PRINT_MAILS;\n      }\n    } else {\n      print_num_mails = PRINT_MAILS;\n    }\n    if (print_num_mails < 1) { print_num_mails = 1; }\n\n    substr = strstr(args, \"-t\");\n    if (substr != nullptr) {\n      if (sscanf(substr, \"-t %i\", &time_delay) != 1) {\n        time_delay = TIME_DELAY;\n      }\n    } else {\n      time_delay = TIME_DELAY;\n    }\n\n    substr = strstr(args, \"-fw\");\n    if (substr != nullptr) {\n      if (sscanf(substr, \"-fw %i\", &from_width) != 1) {\n        from_width = FROM_WIDTH;\n      }\n    } else {\n      from_width = FROM_WIDTH;\n    }\n\n    substr = strstr(args, \"-sw\");\n    if (substr != nullptr) {\n      if (sscanf(substr, \"-sw %i\", &subject_width) != 1) {\n        subject_width = SUBJECT_WIDTH;\n      }\n    } else {\n      subject_width = SUBJECT_WIDTH;\n    }\n    /* encapsulated with \"'s find first occurrence of \" */\n    if (args[strlen(args) - 1] == '\"') {\n      char *start;\n      strncpy(mbox_mail_spool, args, DEFAULT_TEXT_BUFFER_SIZE);\n      start = strchr(mbox_mail_spool, '\"') + 1;\n\n      start[(strrchr(mbox_mail_spool, '\"') - start)] = '\\0';\n      strncpy(mbox_mail_spool, start, DEFAULT_TEXT_BUFFER_SIZE);\n    } else {\n      char *copy_args = strndup(args, text_buffer_size.get(*state));\n      char *tmp = strtok(copy_args, \" \");\n      char *start = tmp;\n\n      while (tmp != nullptr) {\n        tmp = strtok(nullptr, \" \");\n        if (tmp != nullptr) { start = tmp; }\n      }\n      if (start != nullptr) {\n        strncpy(mbox_mail_spool, start, DEFAULT_TEXT_BUFFER_SIZE);\n      }\n      free(copy_args);\n    }\n    if (strlen(mbox_mail_spool) < 1) {\n      CRIT_ERR(\n          \"Usage: ${mboxscan [-n <number of messages to print>] \"\n          \"[-fw <from width>] [-sw <subject width>] \"\n          \"[-t <delay in sec> mbox]}\");\n    }\n\n    /* allowing $MAIL in the config */\n    if (strcmp(mbox_mail_spool, \"$MAIL\") == 0) {\n      strncpy(mbox_mail_spool, current_mail_spool.get(*state).c_str(),\n              DEFAULT_TEXT_BUFFER_SIZE);\n    }\n\n    if (stat(mbox_mail_spool, &statbuf) != 0) {\n      CRIT_ERR(\"can't stat %s: %s\", mbox_mail_spool, strerror(errno));\n    }\n    args_ok = 1; /* args-computing necessary only once */\n  }\n\n  /* if time_delay not yet reached, then return */\n  if (current_update_time - last_update < time_delay && (force_rescan == 0)) {\n    return;\n  }\n\n  last_update = current_update_time;\n\n  /* mbox still exists? and get stat-infos */\n  if (stat(mbox_mail_spool, &statbuf) != 0) {\n    NORM_ERR(\"can't stat %s: %s\", mbox_mail_spool, strerror(errno));\n    output[0] = '\\0'; /* delete any output */\n    return;\n  }\n\n  /* modification time has not changed, so skip scanning the box */\n  if (statbuf.st_ctime == last_ctime && statbuf.st_mtime == last_mtime &&\n      (force_rescan == 0)) {\n    return;\n  }\n\n  last_ctime = statbuf.st_ctime;\n  last_mtime = statbuf.st_mtime;\n\n  /* build up double-linked ring-list to hold data, while scanning down the\n   * mbox */\n  for (i = 0; i < print_num_mails; i++) {\n    curr = static_cast<struct ring_list *>(malloc(sizeof(struct ring_list)));\n    curr->from = static_cast<char *>(malloc(from_width + 1));\n    curr->subject = static_cast<char *>(malloc(subject_width + 1));\n    curr->from[0] = '\\0';\n    curr->subject[0] = '\\0';\n\n    if (i == 0) { startlist = curr; }\n    if (i > 0) {\n      curr->previous = prev;\n      prev->next = curr;\n    }\n    prev = curr;\n  }\n\n  if (startlist == nullptr) { return; }\n  /* connect end to start for an endless loop-ring */\n  startlist->previous = curr;\n  curr->next = startlist;\n\n  /* mbox */\n  fp = fopen(mbox_mail_spool, \"re\");\n  if (fp == nullptr) { return; }\n\n  /* first find a \"From \" to set it to 0 for header-sarchings */\n  flag = 1;\n  while (feof(fp) == 0) {\n    if (fgets(buf, text_buffer_size.get(*state), fp) == nullptr) { break; }\n\n    if (strncmp(buf, \"From \", 5) == 0) {\n      curr = curr->next;\n\n      /* skip until \\n */\n      while (strchr(buf, '\\n') == nullptr && (feof(fp) == 0)) {\n        if (fgets(buf, text_buffer_size.get(*state), fp) == nullptr) { break; }\n      }\n\n      flag = 0; /* in the headers now */\n      continue;\n    }\n\n    if (flag == 1) { /* in the body, so skip */\n      continue;\n    }\n\n    if (buf[0] == '\\n') {\n      /* beyond the headers now (empty line), skip until \\n */\n      /* then search for new mail (\"From \") */\n\n      while (strchr(buf, '\\n') == nullptr && (feof(fp) == 0)) {\n        if (fgets(buf, text_buffer_size.get(*state), fp) == nullptr) { break; }\n      }\n      flag = 1; /* in the body now */\n      continue;\n    }\n\n    if ((strncmp(buf, \"X-Status: \", 10) == 0) ||\n        (strncmp(buf, \"Status: R\", 9) == 0)) {\n      /* Mail was read or something, so skip that message */\n      flag = 1; /* search for next From */\n      curr->subject[0] = '\\0';\n      curr->from[0] = '\\0';\n      /* (will get current again on new 'From ' finding) */\n      curr = curr->previous;\n      /* Skip until \\n */\n      while (strchr(buf, '\\n') == nullptr && (feof(fp) == 0)) {\n        if (fgets(buf, text_buffer_size.get(*state), fp) == nullptr) { break; }\n      }\n      continue;\n    }\n\n    /* that covers ^From: and ^from: ^From:<tab> */\n    if (strncmp(buf + 1, \"rom:\", 4) == 0) {\n      i = 0;\n      u = 6; /* no \"From: \" string needed, so skip */\n      while (1) {\n        if (buf[u] == '\"') { /* no quotes around names */\n          u++;\n          continue;\n        }\n\n        /* some are: From: <foo@bar.com> */\n        if (buf[u] == '<' && i > 1) {\n          curr->from[i] = '\\0';\n          /* skip until \\n */\n          while (strchr(buf, '\\n') == nullptr && (feof(fp) == 0)) {\n            if (fgets(buf, text_buffer_size.get(*state), fp) == nullptr) {\n              break;\n            }\n          }\n          break;\n        }\n\n        if (buf[u] == '\\n') {\n          curr->from[i] = '\\0';\n          break;\n        }\n\n        if (buf[u] == '\\0') {\n          curr->from[i] = '\\0';\n          break;\n        }\n\n        if (i >= from_width) {\n          curr->from[i] = '\\0';\n          /* skip until \\n */\n          while (strchr(buf, '\\n') == nullptr && (feof(fp) == 0)) {\n            if (fgets(buf, text_buffer_size.get(*state), fp) == nullptr) {\n              break;\n            }\n          }\n          break;\n        }\n\n        /* nothing special so just set it */\n        curr->from[i++] = buf[u++];\n      }\n    }\n\n    /* that covers ^Subject: and ^subject: and ^Subjec:<tab> */\n    if (strncmp(buf + 1, \"ubject:\", 7) == 0) {\n      i = 0;\n      u = 9; /* no \"Subject: \" string needed, so skip */\n      while (1) {\n        if (buf[u] == '\\n') {\n          curr->subject[i] = '\\0';\n          break;\n        }\n        if (buf[u] == '\\0') {\n          curr->subject[i] = '\\0';\n          break;\n        }\n        if (i >= subject_width) {\n          curr->subject[i] = '\\0';\n\n          /* skip until \\n */\n          while (strchr(buf, '\\n') == nullptr && (feof(fp) == 0)) {\n            if (fgets(buf, text_buffer_size.get(*state), fp) == nullptr) {\n              break;\n            }\n          }\n          break;\n        }\n\n        /* nothing special so just set it */\n        curr->subject[i++] = buf[u++];\n      }\n    }\n  }\n\n  fclose(fp);\n\n  output[0] = '\\0';\n\n  i = print_num_mails;\n  while (i != 0) {\n    struct ring_list *tmp;\n    if (curr->from[0] != '\\0') {\n      if (i != print_num_mails) {\n        snprintf(buf, text_buffer_size.get(*state), \"\\nF: %-*s S: %-*s\",\n                 from_width, curr->from, subject_width, curr->subject);\n      } else { /* first time - no \\n in front */\n        snprintf(buf, text_buffer_size.get(*state), \"F: %-*s S: %-*s\",\n                 from_width, curr->from, subject_width, curr->subject);\n      }\n    } else {\n      snprintf(buf, text_buffer_size.get(*state), \"%s\", \"\\n\");\n    }\n    strncat(output, buf, max_len - strlen(output));\n\n    tmp = curr->previous;\n    free(curr->from);\n    free(curr->subject);\n    free(curr);\n    curr = tmp;\n\n    i--;\n  }\n}\n\nstruct mboxscan_data {\n  char *args;\n  char *output;\n};\n\nvoid parse_mboxscan_arg(struct text_object *obj, const char *arg) {\n  struct mboxscan_data *msd;\n\n  msd = static_cast<mboxscan_data *>(malloc(sizeof(struct mboxscan_data)));\n  memset(msd, 0, sizeof(struct mboxscan_data));\n\n  msd->args = strndup(arg, text_buffer_size.get(*state));\n  msd->output = static_cast<char *>(malloc(text_buffer_size.get(*state)));\n  /* if '1' (in mboxscan.c) then there was SIGUSR1, hmm */\n  msd->output[0] = 1;\n\n  obj->data.opaque = msd;\n}\n\nvoid print_mboxscan(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *msd = static_cast<mboxscan_data *>(obj->data.opaque);\n\n  if (msd == nullptr) { return; }\n\n  mbox_scan(msd->args, msd->output, text_buffer_size.get(*state));\n  snprintf(p, p_max_size, \"%s\", msd->output);\n}\n\nvoid free_mboxscan(struct text_object *obj) {\n  auto *msd = static_cast<mboxscan_data *>(obj->data.opaque);\n\n  if (msd == nullptr) { return; }\n  free_and_zero(msd->args);\n  free_and_zero(msd->output);\n  free_and_zero(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/data/network/mboxscan.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2006 Marco Candrian <mac@calmar.ws>\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _MBOXSCAN_H_\n#define _MBOXSCAN_H_\n\nvoid parse_mboxscan_arg(struct text_object *, const char *);\nvoid print_mboxscan(struct text_object *, char *, unsigned int);\nvoid free_mboxscan(struct text_object *);\n\n#endif /* _MBOXSCAN_H_ */\n"
  },
  {
    "path": "src/data/network/net_stat.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"net_stat.h\"\n#include <ctype.h>\n#include <string.h>\n#include <sys/ioctl.h>\n#include <unistd.h>\n#include <cerrno>\n#include <cstring>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"net/if.h\"\n#include \"../../content/specials.h\"\n#include \"../../content/text_object.h\"\n#if defined(__sun)\n#include <sys/sockio.h>\n#endif\n#if defined(__HAIKU__)\n#include <sys/sockio.h>\n#define IFF_RUNNING IFF_LINK\n#endif\n#ifndef SOCK_CLOEXEC\n#define SOCK_CLOEXEC O_CLOEXEC\n#endif /* SOCK_CLOEXEC */\n\n#if defined(__linux__)\n#include \"../os/linux.h\"\n#else\nstatic char e_iface[50] = \"empty\";\nstatic char interfaces_arr[MAX_NET_INTERFACES][64] = {\"\"};\n#endif /* __linux__ */\n\n/* network interface stuff */\n\nenum if_up_strictness_ { IFUP_UP, IFUP_LINK, IFUP_ADDR };\n\ntemplate <>\nconky::lua_traits<if_up_strictness_>::Map\n    conky::lua_traits<if_up_strictness_>::map = {\n        {\"up\", IFUP_UP}, {\"link\", IFUP_LINK}, {\"address\", IFUP_ADDR}};\n\nstatic conky::simple_config_setting<if_up_strictness_> if_up_strictness(\n    \"if_up_strictness\", IFUP_UP, true);\n/**\n * global array of structs containing network statistics for each interface\n **/\nstruct net_stat netstats[MAX_NET_INTERFACES];\nstruct net_stat foo_netstats;\n\n/**\n * Returns pointer to specified interface in netstats array.\n * If not found then add the specified interface to the array.\n * The added interface will have all its members initialized to 0,\n * because clear_net_stats() is called from main() in conky.cc!\n *\n * @param[in] dev  device / interface name. Silently ignores char * == nullptr\n **/\nstruct net_stat *get_net_stat(const char *dev, void * /*free_at_crash1*/,\n                              void * /*free_at_crash2*/) {\n  unsigned int i;\n\n  if (dev == nullptr) { return nullptr; }\n\n  /* find interface stat */\n  for (i = 0; i < MAX_NET_INTERFACES; i++) {\n    if ((netstats[i].dev != nullptr) && strcmp(netstats[i].dev, dev) == 0) {\n      return &netstats[i];\n    }\n  }\n\n  /* wasn't found? add it */\n  for (i = 0; i < MAX_NET_INTERFACES; i++) {\n    if (netstats[i].dev == nullptr) {\n      netstats[i].dev = strndup(dev, text_buffer_size.get(*state));\n      /* initialize last_read_recv and last_read_trans to -1 denoting\n       * that they were never read before */\n      netstats[i].last_read_recv = -1;\n      netstats[i].last_read_trans = -1;\n      return &netstats[i];\n    }\n  }\n\n  clear_net_stats(&foo_netstats);\n  foo_netstats.dev = strndup(dev, text_buffer_size.get(*state));\n  /* initialize last_read_recv and last_read_trans to -1 denoting\n   * that they were never read before */\n  foo_netstats.last_read_recv = -1;\n  foo_netstats.last_read_trans = -1;\n  return &foo_netstats;\n}\n\nvoid parse_net_stat_arg(struct text_object *obj, const char *arg,\n                        void *free_at_crash) {\n#ifdef BUILD_IPV6\n  bool shownetmask = false;\n  bool showscope = false;\n#endif               /* BUILD_IPV6 */\n  char nextarg[21];  // longest arg possible is a devname (max 20 chars)\n  int i = 0;\n  struct net_stat *netstat = nullptr;\n  long int x = 0;\n  unsigned int found = 0;\n  char *arg_ptr = const_cast<char *>(arg);\n  char buf[64];\n  char *buf_ptr = buf;\n\n  if (arg == nullptr) { arg = DEFAULTNETDEV; }\n\n  if (0 == (strcmp(\"$gw_iface\", arg)) || 0 == (strcmp(\"${gw_iface}\", arg))) {\n#if defined(__linux__)\n    update_gateway_info();\n#endif\n    arg = e_iface;\n  }\n\n  if (0 == strncmp(arg, \"${iface\", 7)) {\n    if (nullptr != arg_ptr) {\n      for (; *arg_ptr; arg_ptr++) {\n        if (isdigit(static_cast<unsigned char>(*arg_ptr))) {\n          *buf_ptr++ = *arg_ptr;\n          found = 1;\n        }\n      }\n    }\n    if (1U == found) {\n      *buf_ptr = '\\0';\n      x = strtol(buf, (char **)NULL, 10);\n      if (63L > x) { arg = interfaces_arr[x]; }\n    }\n  }\n\n  while (sscanf(arg + i, \" %20s\", nextarg) == 1) {\n#ifdef BUILD_IPV6\n    if (strcmp(nextarg, \"-n\") == 0 || strcmp(nextarg, \"--netmask\") == 0) {\n      shownetmask = true;\n    } else if (strcmp(nextarg, \"-s\") == 0 || strcmp(nextarg, \"--scope\") == 0) {\n      showscope = true;\n    } else if (nextarg[0] == '-') {  // multiple flags in 1 arg\n      for (int j = 1; nextarg[j] != 0; j++) {\n        if (nextarg[j] == 'n') { shownetmask = true; }\n        if (nextarg[j] == 's') { showscope = true; }\n      }\n    } else {\n#endif /* BUILD_IPV6 */\n      netstat = get_net_stat(nextarg, obj, free_at_crash);\n#ifdef BUILD_IPV6\n    }\n#endif                     /* BUILD_IPV6 */\n    i += strlen(nextarg);  // skip this arg\n    while (\n        !((isspace(static_cast<unsigned char>(arg[i])) != 0) || arg[i] == 0)) {\n      i++;  // and skip the spaces in front of it\n    }\n  }\n  if (netstat == nullptr) {\n    netstat = get_net_stat(DEFAULTNETDEV, obj, free_at_crash);\n  }\n\n#ifdef BUILD_IPV6\n  netstat->v6show_nm = shownetmask;\n  netstat->v6show_sc = showscope;\n#endif /* BUILD_IPV6 */\n  obj->data.opaque = netstat;\n}\n\nvoid parse_net_stat_bar_arg(struct text_object *obj, const char *arg,\n                            void *free_at_crash) {\n  if (arg != nullptr) {\n    arg = scan_bar(obj, arg, 1);\n    obj->data.opaque = get_net_stat(arg, obj, free_at_crash);\n  } else {\n    // default to DEFAULTNETDEV\n    char *buf = strndup(DEFAULTNETDEV, text_buffer_size.get(*state));\n    obj->data.opaque = get_net_stat(buf, obj, free_at_crash);\n    free(buf);\n  }\n}\n\nvoid print_downspeed(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  if (ns == nullptr) { return; }\n\n  human_readable(ns->recv_speed, p, p_max_size);\n}\n\nvoid print_downspeedf(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  if (ns == nullptr) { return; }\n\n  spaced_print(p, p_max_size, \"%.1f\", 8, ns->recv_speed / 1024.0);\n}\n\nvoid print_upspeed(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  if (ns == nullptr) { return; }\n\n  human_readable(ns->trans_speed, p, p_max_size);\n}\n\nvoid print_upspeedf(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  if (ns == nullptr) { return; }\n\n  spaced_print(p, p_max_size, \"%.1f\", 8, ns->trans_speed / 1024.0);\n}\n\nvoid print_totaldown(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  if (ns == nullptr) { return; }\n\n  human_readable(ns->recv, p, p_max_size);\n}\n\nvoid print_totalup(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  if (ns == nullptr) { return; }\n\n  human_readable(ns->trans, p, p_max_size);\n}\n\nvoid print_addr(struct text_object *obj, char *p, unsigned int p_max_size) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  if (ns == nullptr) { return; }\n\n  if ((ns->addr.sa_data[2] & 255) == 0 && (ns->addr.sa_data[3] & 255) == 0 &&\n      (ns->addr.sa_data[4] & 255) == 0 && (ns->addr.sa_data[5] & 255) == 0) {\n    snprintf(p, p_max_size, \"%s\", \"No Address\");\n  } else {\n    snprintf(p, p_max_size, \"%u.%u.%u.%u\", ns->addr.sa_data[2] & 255,\n             ns->addr.sa_data[3] & 255, ns->addr.sa_data[4] & 255,\n             ns->addr.sa_data[5] & 255);\n  }\n}\n\n#ifdef __linux__\nvoid print_addrs(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  if (0 != ns->addrs[0] && strlen(ns->addrs) > 2) {\n    ns->addrs[strlen(ns->addrs) - 2] = 0; /* remove \", \" from end of string */\n    strncpy(p, ns->addrs, p_max_size);\n  } else {\n    strncpy(p, \"0.0.0.0\", p_max_size);\n  }\n}\n\n#ifdef BUILD_IPV6\nvoid print_v6addrs(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n  char tempaddress[INET6_ADDRSTRLEN];\n  struct v6addr *current_v6 = ns->v6addrs;\n\n  if (p_max_size == 0) return;\n  if (!ns->v6addrs) {\n    snprintf(p, p_max_size, \"%s\", \"No Address\");\n    return;\n  }\n  *p = 0;\n  while (current_v6) {\n    inet_ntop(AF_INET6, &(current_v6->addr), tempaddress, INET6_ADDRSTRLEN);\n    strncat(p, tempaddress, p_max_size);\n    // netmask\n    if (ns->v6show_nm) {\n      char netmaskstr[5];  // max 5 chars (/128 + null-terminator)\n      snprintf(netmaskstr, sizeof(netmaskstr), \"/%u\", current_v6->netmask);\n      strncat(p, netmaskstr, p_max_size);\n    }\n    // scope\n    if (ns->v6show_sc) {\n      char scopestr[4];\n      snprintf(scopestr, sizeof(scopestr), \"(%c)\", current_v6->scope);\n      strncat(p, scopestr, p_max_size);\n    }\n    // next (or last) address\n    current_v6 = current_v6->next;\n    if (current_v6) strncat(p, \", \", p_max_size);\n  }\n}\n#endif /* BUILD_IPV6 */\n\n#endif /* __linux__ */\n\n#ifdef BUILD_GUI\n\n/**\n * This function is called periodically to update the download and upload graphs\n *\n * - evaluates argument strings like 'eth0 50,120 #FFFFFF #FF0000 0 -l'\n * - sets the obj->data.opaque pointer to the interface specified\n *\n * @param[out] obj  struct which will hold evaluated arguments\n * @param[in]  arg  argument string to evaluate\n **/\nvoid parse_net_stat_graph_arg(struct text_object *obj, const char *arg,\n                              void *free_at_crash) {\n  /* scan arguments and get interface name back */\n  auto [buf, skip] = scan_command(arg);\n  scan_graph(obj, arg + skip, 0, TRUE);\n\n  // default to DEFAULTNETDEV\n  if (buf != nullptr) {\n#if defined(__linux__)\n    if (0 == (strcmp(\"$gw_iface\", buf)) || 0 == (strcmp(\"${gw_iface}\", buf))) {\n      update_gateway_info();\n      obj->data.opaque = get_net_stat(e_iface, obj, free_at_crash);\n      free(buf);\n      return;\n    }\n#endif\n    obj->data.opaque = get_net_stat(buf, obj, free_at_crash);\n    free(buf);\n    return;\n  }\n  obj->data.opaque = get_net_stat(DEFAULTNETDEV, obj, free_at_crash);\n}\n\n/**\n * returns the download speed in B/s for the interface referenced by obj\n *\n * @param[in] obj struct containing a member data, which is a struct\n *                containing a void * to a net_stat struct\n **/\ndouble downspeedgraphval(struct text_object *obj) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  return (ns != nullptr ? ns->recv_speed : 0);\n}\n\ndouble upspeedgraphval(struct text_object *obj) {\n  auto *ns = static_cast<struct net_stat *>(obj->data.opaque);\n\n  return (ns != nullptr ? ns->trans_speed : 0);\n}\n#endif /* BUILD_GUI */\n\n#ifdef BUILD_WLAN\nvoid print_wireless_essid(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) {\n    for (unsigned int i = 0; *(netstats[i].dev) != 0; i++) {\n      if (*(netstats[i].essid) != 0) {\n        snprintf(p, p_max_size, \"%s\", netstats[i].essid);\n        return;\n      }\n    }\n    return;\n  }\n\n  snprintf(p, p_max_size, \"%s\", ns->essid);\n}\nvoid print_wireless_mode(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  snprintf(p, p_max_size, \"%s\", ns->mode);\n}\nvoid print_wireless_channel(struct text_object *obj, char *p,\n                            unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  if (ns->channel != 0) {\n    snprintf(p, p_max_size, \"%i\", ns->channel);\n  } else {\n    snprintf(p, p_max_size, \"%s\", \"/\");\n  }\n}\nvoid print_wireless_frequency(struct text_object *obj, char *p,\n                              unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  if (ns->freq[0] != 0) {\n    snprintf(p, p_max_size, \"%s\", ns->freq);\n  } else {\n    snprintf(p, p_max_size, \"/\");\n  }\n}\nvoid print_wireless_bitrate(struct text_object *obj, char *p,\n                            unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  snprintf(p, p_max_size, \"%s\", ns->bitrate);\n}\nvoid print_wireless_ap(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  snprintf(p, p_max_size, \"%s\", ns->ap);\n}\nvoid print_wireless_link_qual(struct text_object *obj, char *p,\n                              unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  spaced_print(p, p_max_size, \"%d\", 4, ns->link_qual);\n}\nvoid print_wireless_link_qual_max(struct text_object *obj, char *p,\n                                  unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  spaced_print(p, p_max_size, \"%d\", 4, ns->link_qual_max);\n}\nvoid print_wireless_link_qual_perc(struct text_object *obj, char *p,\n                                   unsigned int p_max_size) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return;\n\n  if (ns->link_qual_max > 0) {\n    spaced_print(p, p_max_size, \"%.0f\", 5,\n                 (double)ns->link_qual / ns->link_qual_max * 100);\n  } else {\n    spaced_print(p, p_max_size, \"unk\", 5);\n  }\n}\ndouble wireless_link_barval(struct text_object *obj) {\n  struct net_stat *ns = (struct net_stat *)obj->data.opaque;\n\n  if (!ns) return 0;\n\n  return (double)ns->link_qual / ns->link_qual_max;\n}\n#endif /* BUILD_WLAN */\n\n/**\n * Clears the global array of net_stat structs which contains networks\n * statistics for every interface.\n **/\nvoid clear_net_stats() {\n#ifdef BUILD_IPV6\n  struct v6addr *nextv6;\n#endif /* BUILD_IPV6 */\n  int i;\n  for (i = 0; i < MAX_NET_INTERFACES; i++) {\n    free_and_zero(netstats[i].dev);\n#ifdef BUILD_IPV6\n    while (netstats[i].v6addrs) {\n      nextv6 = netstats[i].v6addrs;\n      netstats[i].v6addrs = netstats[i].v6addrs->next;\n      free_and_zero(nextv6);\n    }\n#endif /* BUILD_IPV6 */\n  }\n  memset(netstats, 0, sizeof(netstats));\n}\n\nvoid clear_net_stats(net_stat *in) {\n#ifdef BUILD_IPV6\n  struct v6addr *nextv6;\n#endif /* BUILD_IPV6 */\n  free_and_zero(in->dev);\n#ifdef BUILD_IPV6\n  while (in->v6addrs) {\n    nextv6 = in->v6addrs;\n    in->v6addrs = in->v6addrs->next;\n    free_and_zero(nextv6);\n  }\n#endif /* BUILD_IPV6 */\n}\n\nvoid parse_if_up_arg(struct text_object *obj, const char *arg) {\n  obj->data.opaque = strndup(arg, text_buffer_size.get(*state));\n}\n\nvoid free_if_up(struct text_object *obj) { free_and_zero(obj->data.opaque); }\n\n/* We should check if this is ok with OpenBSD and NetBSD as well. */\nint interface_up(struct text_object *obj) {\n  int fd;\n  struct ifreq ifr {};\n  auto *dev = static_cast<char *>(obj->data.opaque);\n\n  if (dev == nullptr) { return 0; }\n\n#if defined(__APPLE__) && defined(__MACH__)\n  if ((fd = socket(PF_INET, SOCK_DGRAM, 0)) < 0) {\n#else\n  if ((fd = socket(PF_INET, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) {\n#endif\n    CRIT_ERR(\"could not create sockfd\");\n    return 0;\n  }\n  strncpy(ifr.ifr_name, dev, IFNAMSIZ);\n  if (ioctl(fd, SIOCGIFFLAGS, &ifr) != 0) {\n    /* if device does not exist, treat like not up */\n    if (errno != ENODEV && errno != ENXIO) { perror(\"SIOCGIFFLAGS\"); }\n    goto END_FALSE;\n  }\n\n  if ((ifr.ifr_flags & IFF_UP) == 0) { /* iface is not up */\n    goto END_FALSE;\n  }\n  if (if_up_strictness.get(*state) == IFUP_UP) { goto END_TRUE; }\n\n#ifdef IFF_RUNNING\n  if ((ifr.ifr_flags & IFF_RUNNING) == 0) { goto END_FALSE; }\n#endif\n  if (if_up_strictness.get(*state) == IFUP_LINK) { goto END_TRUE; }\n\n  if (ioctl(fd, SIOCGIFADDR, &ifr) != 0) {\n    perror(\"SIOCGIFADDR\");\n    goto END_FALSE;\n  }\n  if ((reinterpret_cast<struct sockaddr_in *>(&(ifr.ifr_addr)))\n          ->sin_addr.s_addr != 0u) {\n    goto END_TRUE;\n  }\n\nEND_FALSE:\n  close(fd);\n  return 0;\nEND_TRUE:\n  close(fd);\n  return 1;\n}\n\nclass _dns_data {\n public:\n  _dns_data() = default;\n  int nscount{0};\n  char **ns_list{nullptr};\n  void reset() {\n    nscount = 0;\n    ns_list = nullptr;\n  }\n};\n\nstatic _dns_data dns_data;\n\nvoid free_dns_data(struct text_object *obj) {\n  int i;\n\n  (void)obj;\n\n  for (i = 0; i < dns_data.nscount; i++) { free(dns_data.ns_list[i]); }\n  free(dns_data.ns_list);\n  dns_data.reset();\n}\n\nint update_dns_data() {\n  FILE *fp;\n  char line[256];\n  // static double last_dns_update = 0.0;\n\n  /* maybe updating too often causes higher load because of /etc lying on a real\n  FS if (current_update_time - last_dns_update < 10.0) return 0;\n\n  last_dns_update = current_update_time;\n  */\n\n  free_dns_data(nullptr);\n\n  if ((fp = fopen(\"/etc/resolv.conf\", \"re\")) == nullptr) { return 0; }\n  while (feof(fp) == 0) {\n    if (fgets(line, 255, fp) == nullptr) { break; }\n    if (strncmp(line, \"nameserver \", 11) == 0) {\n      line[strlen(line) - 1] = '\\0';  // remove trailing newline\n      dns_data.nscount++;\n      dns_data.ns_list = static_cast<char **>(\n          realloc(dns_data.ns_list, dns_data.nscount * sizeof(char *)));\n      dns_data.ns_list[dns_data.nscount - 1] =\n          strndup(line + 11, text_buffer_size.get(*state));\n    }\n  }\n  fclose(fp);\n  return 0;\n}\n\nvoid parse_nameserver_arg(struct text_object *obj, const char *arg) {\n  obj->data.l = arg != nullptr ? strtol(arg, nullptr, 10) : 0;\n}\n\nvoid print_nameserver(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  if (dns_data.nscount > obj->data.l) {\n    snprintf(p, p_max_size, \"%s\", dns_data.ns_list[obj->data.l]);\n  }\n}\n"
  },
  {
    "path": "src/data/network/net_stat.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _NET_STAT_H\n#define _NET_STAT_H\n\n#include <netinet/in.h> /* struct in6_addr */\n#include <sys/socket.h> /* struct sockaddr */\n#include \"config.h\"\n\n#ifdef BUILD_IPV6\nstruct v6addr {\n  struct in6_addr addr;\n  unsigned int netmask;\n  char scope;\n  struct v6addr *next;\n};\n#endif /* BUILD_IPV6 */\n\nstruct net_stat {\n  /* interface name, e.g. wlan0, eth0, ... */\n  char *dev;\n  /* set to 1, if interface is up */\n  int up;\n  /* network traffic read on last call in order to calculate how much\n   * was received or transmitted since the last call. contains -1 if\n   * it was never read before. in bytes */\n  long long last_read_recv, last_read_trans;\n  /* total received and transmitted data statistics in bytes */\n  long long recv, trans;\n  /* averaged network speed in bytes / second */\n  double recv_speed, trans_speed;\n  /* struct with at least the member sa_data which is a const * containing\n   * the socket address.\n   * @see http://pubs.opengroup.org/onlinepubs/7908799/xns/syssocket.h.html */\n  struct sockaddr addr;\n#ifdef BUILD_IPV6\n  struct v6addr *v6addrs;\n  bool v6show_nm;\n  bool v6show_sc;\n#endif /* BUILD_IPV6 */\n#if defined(__linux__)\n  char addrs[17 * MAX_NET_INTERFACES + 1];\n#endif /* __linux__ */\n  /* network speeds between two conky calls in bytes per second.\n   * An average over these samples is calculated in recv_speed and\n   * trans_speed */\n  double net_rec[15], net_trans[15];\n  // wireless extensions\n  char essid[35];\n  int channel;\n  char freq[16];\n  char bitrate[16];\n  char mode[16];\n  int link_qual;\n  int link_qual_max;\n  char ap[18];\n};\n\nextern struct net_stat netstats[];\n\nstruct net_stat *get_net_stat(const char *, void *, void *);\n\nvoid parse_net_stat_arg(struct text_object *, const char *, void *);\nvoid parse_net_stat_bar_arg(struct text_object *, const char *, void *);\nvoid print_downspeed(struct text_object *, char *, unsigned int);\nvoid print_downspeedf(struct text_object *, char *, unsigned int);\nvoid print_upspeed(struct text_object *, char *, unsigned int);\nvoid print_upspeedf(struct text_object *, char *, unsigned int);\nvoid print_totaldown(struct text_object *, char *, unsigned int);\nvoid print_totalup(struct text_object *, char *, unsigned int);\nvoid print_addr(struct text_object *, char *, unsigned int);\n#ifdef __linux__\nvoid print_addrs(struct text_object *, char *, unsigned int);\n#ifdef BUILD_IPV6\nvoid print_v6addrs(struct text_object *, char *, unsigned int);\n#endif /* BUILD_IPV6 */\n#endif /* __linux__ */\n#ifdef BUILD_GUI\nvoid parse_net_stat_graph_arg(struct text_object *, const char *, void *);\ndouble downspeedgraphval(struct text_object *);\ndouble upspeedgraphval(struct text_object *);\n#endif /* BUILD_GUI */\n#ifdef BUILD_WLAN\nvoid print_wireless_essid(struct text_object *, char *, unsigned int);\nvoid print_wireless_channel(struct text_object *, char *, unsigned int);\nvoid print_wireless_frequency(struct text_object *, char *, unsigned int);\nvoid print_wireless_mode(struct text_object *, char *, unsigned int);\nvoid print_wireless_bitrate(struct text_object *, char *, unsigned int);\nvoid print_wireless_ap(struct text_object *, char *, unsigned int);\nvoid print_wireless_link_qual(struct text_object *, char *, unsigned int);\nvoid print_wireless_link_qual_max(struct text_object *, char *, unsigned int);\nvoid print_wireless_link_qual_perc(struct text_object *, char *, unsigned int);\ndouble wireless_link_barval(struct text_object *);\n#endif /* BUILD_WLAN */\n\nvoid clear_net_stats(void);\nvoid clear_net_stats(net_stat *);\n\nvoid parse_if_up_arg(struct text_object *, const char *);\nint interface_up(struct text_object *);\nvoid free_if_up(struct text_object *);\n\nvoid free_dns_data(struct text_object *);\nint update_dns_data(void);\nvoid parse_nameserver_arg(struct text_object *, const char *);\nvoid print_nameserver(struct text_object *, char *, unsigned int);\n\n#endif /* _NET_STAT_H */\n"
  },
  {
    "path": "src/data/network/prss.cc",
    "content": "/*\n *\n * Copyright (c) 2007 Mikko Sysikaski <mikko.sysikaski@gmail.com>\n *\t\t\t\t\t  Toni Spets <toni.spets@gmail.com>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.\n *\n */\n\n#include \"prss.h\"\n#include <libxml/parser.h>\n#include <libxml/tree.h>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n\n#ifndef PARSE_OPTIONS\n#define PARSE_OPTIONS 0\n#endif\n\nvoid prss_parse_doc(PRSS *result, xmlDocPtr doc);\n\nPRSS::PRSS(const std::string &xml_data)\n    : version(nullptr),\n      title(nullptr),\n      link(nullptr),\n      description(nullptr),\n      language(nullptr),\n      generator(nullptr),\n      managingEditor(nullptr),\n      webMaster(nullptr),\n      docs(nullptr),\n      lastBuildDate(nullptr),\n      pubDate(nullptr),\n      copyright(nullptr),\n      ttl(nullptr),\n      items(nullptr),\n      item_count(0) {\n  std::unique_ptr<xmlDoc, void (*)(xmlDoc *)> doc(\n      xmlReadMemory(xml_data.c_str(), xml_data.length(), \"\", nullptr,\n                    PARSE_OPTIONS),\n      xmlFreeDoc);\n\n  if (!doc) throw std::runtime_error(\"Unable to parse rss data\");\n\n  prss_parse_doc(this, doc.get());\n}\n\nvoid free_rss_items(PRSS *data) {\n  int i;\n\n  if (data->items) {\n    for (i = 0; i < data->item_count; i++) {\n#define CLEAR(a) free_and_zero(data->items[i].a);\n      CLEAR(title);\n      CLEAR(link);\n      CLEAR(description);\n      CLEAR(category);\n      CLEAR(pubDate);\n      CLEAR(guid);\n#undef CLEAR\n    }\n    free_and_zero(data->items);\n    data->item_count = 0;\n  }\n}\n\nPRSS::~PRSS() {\n  free_rss_items(this);\n  free(version);\n  free(title);\n  free(link);\n  free(description);\n  free(language);\n  free(pubDate);\n  free(lastBuildDate);\n  free(generator);\n  free(docs);\n  free(managingEditor);\n  free(webMaster);\n  free(copyright);\n  free(ttl);\n}\n\nstatic inline void prss_null_item(PRSS_Item *i) {\n  if (i != nullptr) { memset(i, 0, sizeof(*i)); }\n}\n\nstatic inline void read_item(PRSS_Item *res, xmlNodePtr data) {\n  prss_null_item(res);\n\n  for (; data; data = data->next) {\n    xmlNodePtr child;\n\n    if (data->type != XML_ELEMENT_NODE) { continue; }\n    child = data->children;\n\n    if (!child) { continue; }\n\n#define ASSIGN(a)                                          \\\n  if (strcasecmp((const char *)data->name, #a) == EQUAL) { \\\n    free_and_zero(res->a);                                 \\\n    res->a = strdup((const char *)child->content);         \\\n    continue;                                              \\\n  }\n    ASSIGN(title);\n    ASSIGN(link);\n    ASSIGN(description);\n    ASSIGN(category);\n    ASSIGN(pubDate);\n    ASSIGN(guid);\n#undef ASSIGN\n  }\n}\nstatic inline void read_element(PRSS *res, xmlNodePtr n) {\n  xmlNodePtr child;\n\n  if (n->type != XML_ELEMENT_NODE) { return; }\n  child = n->children;\n\n  if (!child) { return; }\n\n#define ASSIGN(a)                                       \\\n  if (strcasecmp((const char *)n->name, #a) == EQUAL) { \\\n    free_and_zero(res->a);                              \\\n    res->a = strdup((const char *)child->content);      \\\n    return;                                             \\\n  }\n  ASSIGN(title);\n  ASSIGN(link);\n  ASSIGN(description);\n  ASSIGN(language);\n  ASSIGN(pubDate);\n  ASSIGN(lastBuildDate);\n  ASSIGN(generator);\n  ASSIGN(docs);\n  ASSIGN(managingEditor);\n  ASSIGN(webMaster);\n  ASSIGN(copyright);\n  ASSIGN(ttl);\n#undef ASSIGN\n  if (!strcasecmp((const char *)n->name, \"item\")) {\n    read_item(&res->items[res->item_count++], n->children);\n  }\n}\n\nstatic inline int parse_rss_2_0(PRSS *res, xmlNodePtr root) {\n  xmlNodePtr channel = root->children;\n  xmlNodePtr n;\n  int items = 0;\n\n  DBGP(\"parsing rss 2.0 or <1 doc\");\n\n  while (channel && (channel->type != XML_ELEMENT_NODE ||\n                     strcmp((const char *)channel->name, \"channel\"))) {\n    channel = channel->next;\n  }\n  if (!channel) { return 0; }\n\n  for (n = channel->children; n; n = n->next) {\n    if (n->type == XML_ELEMENT_NODE && !strcmp((const char *)n->name, \"item\")) {\n      ++items;\n    }\n  }\n\n  free_and_zero(res->version);\n  res->version = strndup(\"2.0\", text_buffer_size.get(*state));\n  free_rss_items(res);\n  res->items = (PRSS_Item *)malloc(items * sizeof(PRSS_Item));\n  res->item_count = 0;\n\n  for (n = channel->children; n; n = n->next) { read_element(res, n); }\n\n  return 1;\n}\nstatic inline int parse_rss_1_0(PRSS *res, xmlNodePtr root) {\n  int items = 0;\n  xmlNodePtr n;\n\n  DBGP(\"parsing rss 1.0 doc\");\n\n  for (n = root->children; n; n = n->next) {\n    if (n->type == XML_ELEMENT_NODE) {\n      if (!strcmp((const char *)n->name, \"item\")) {\n        ++items;\n      } else if (!strcmp((const char *)n->name, \"channel\")) {\n        xmlNodePtr i;\n\n        for (i = n->children; i; i = i->next) { read_element(res, i); }\n      }\n    }\n  }\n\n  free_and_zero(res->version);\n  res->version = strndup(\"1.0\", text_buffer_size.get(*state));\n  free_rss_items(res);\n  res->items = (PRSS_Item *)malloc(items * sizeof(PRSS_Item));\n  res->item_count = 0;\n\n  for (n = root->children; n; n = n->next) {\n    if (n->type == XML_ELEMENT_NODE && !strcmp((const char *)n->name, \"item\")) {\n      read_item(&res->items[res->item_count++], n->children);\n    }\n  }\n\n  return 1;\n}\n\nvoid prss_parse_doc(PRSS *result, xmlDocPtr doc) {\n  xmlNodePtr root = xmlDocGetRootElement(doc);\n\n  do {\n    if (root->type == XML_ELEMENT_NODE) {\n      if (!strcmp((const char *)root->name, \"RDF\")) {\n        // RSS 1.0 document\n        parse_rss_1_0(result, root);\n        return;\n      } else if (!strcmp((const char *)root->name, \"rss\")) {\n        // RSS 2.0 or <1.0 document\n        parse_rss_2_0(result, root);\n        return;\n      }\n    }\n    root = root->next;\n  } while (root);\n  return;\n}\n"
  },
  {
    "path": "src/data/network/prss.h",
    "content": "/*\n *\n * Copyright (c) 2007 Mikko Sysikaski <mikko.sysikaski@gmail.com>\n *\t\t\t\t\t  Toni Spets <toni.spets@gmail.com>\n *\n * Permission to use, copy, modify, and distribute this software for any\n * purpose with or without fee is hereby granted, provided that the above\n * copyright notice and this permission notice appear in all copies.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES\n * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF\n * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR\n * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN\n * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF\n * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */\n\n#ifndef PRSS_H\n#define PRSS_H\n\n#include <libxml/parser.h>\n#include <string>\n\ntypedef struct PRSS_Item_ {\n  char *title;\n  char *link;\n  char *description;\n  char *category;\n  char *pubDate;\n  char *guid;\n} PRSS_Item;\n\nclass PRSS {\n public:\n  char *version;\n\n  char *title;\n  char *link;\n  char *description;\n  char *language;\n  char *generator;\n  char *managingEditor;\n  char *webMaster;\n  char *docs;\n  char *lastBuildDate;\n  char *pubDate;\n  char *copyright;\n  char *ttl;\n\n  PRSS_Item *items;\n  int item_count;\n\n  explicit PRSS(const std::string &xml_data);\n  ~PRSS();\n};\n\n#endif /* PRSS_H */\n"
  },
  {
    "path": "src/data/network/read_tcpip.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <fcntl.h>\n#include <netdb.h>\n#include <netinet/in.h>\n#include <sys/time.h>\n#include <unistd.h>\n#include <cerrno>\n#include <cinttypes>\n#include <cstdlib>\n#include <string>\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\n#ifndef SOCK_CLOEXEC\n#define SOCK_CLOEXEC O_CLOEXEC\n#endif /* SOCK_CLOEXEC */\n\nstruct read_tcpip_data {\n  char *host;\n  unsigned int port;\n};\n\nvoid parse_read_tcpip_arg(struct text_object *obj, const char *arg,\n                          void *free_at_crash) {\n  struct read_tcpip_data *rtd;\n\n  rtd = static_cast<struct read_tcpip_data *>(\n      malloc(sizeof(struct read_tcpip_data)));\n  memset(rtd, 0, sizeof(struct read_tcpip_data));\n\n  rtd->host = static_cast<char *>(malloc(text_buffer_size.get(*state)));\n  sscanf(arg, \"%s\", rtd->host);\n  sscanf(arg + strlen(rtd->host), \"%u\", &(rtd->port));\n  if (rtd->port == 0) {\n    rtd->port = strtol(rtd->host, nullptr, 10);\n    strncpy(rtd->host, \"localhost\", 10);\n  }\n  if (rtd->port < 1 || rtd->port > 65535) {\n    CRIT_ERR_FREE(\n        obj, free_at_crash,\n        \"read_tcp and read_udp need a port from 1 to 65535 as argument\");\n  }\n\n  obj->data.opaque = rtd;\n}\n\nvoid parse_tcp_ping_arg(struct text_object *obj, const char *arg,\n                        void *free_at_crash) {\n#define DEFAULT_TCP_PING_PORT 80\n  struct sockaddr_in *addr;\n  char *hostname;\n  struct hostent *he;\n\n  addr = static_cast<struct sockaddr_in *>(malloc(sizeof(struct sockaddr_in)));\n  obj->data.opaque = addr;\n  memset(addr, 0, sizeof(struct sockaddr_in));\n  hostname = static_cast<char *>(malloc(strlen(arg) + 1));\n  switch (sscanf(arg, \"%s %\" SCNu16, hostname, &(addr->sin_port))) {\n    case 1:\n      addr->sin_port = DEFAULT_TCP_PING_PORT;\n      break;\n    case 2:\n      break;\n    default:  // this point should never be reached\n      free(hostname);\n      CRIT_ERR_FREE(obj, free_at_crash, \"tcp_ping: Reading arguments failed\");\n  }\n  if ((he = gethostbyname(hostname)) == nullptr) {\n    NORM_ERR(\"tcp_ping: Problem with resolving '%s', using 'localhost' instead\",\n             hostname);\n    if ((he = gethostbyname(\"localhost\")) == nullptr) {\n      free(hostname);\n      CRIT_ERR_FREE(obj, free_at_crash,\n                    \"tcp_ping: Resolving 'localhost' also failed\");\n    }\n  }\n  if (he != nullptr) {\n    free(hostname);\n    addr->sin_port = htons(addr->sin_port);\n    addr->sin_family = he->h_addrtype;\n    memcpy(&(addr->sin_addr), he->h_addr, he->h_length);\n  }\n}\n\nvoid print_tcp_ping(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct timeval tv1 {\n  }, tv2{}, timeout{};\n  auto *addr = static_cast<struct sockaddr_in *>(obj->data.opaque);\n  int addrlen = sizeof(struct sockaddr);\n  int sock = socket(addr->sin_family, SOCK_STREAM | SOCK_CLOEXEC, IPPROTO_TCP);\n  unsigned long long usecdiff;\n  fd_set writefds;\n\n  if (sock != -1) {\n    fcntl(sock, F_SETFL, O_NONBLOCK | fcntl(sock, F_GETFL));\n\n    FD_ZERO(&writefds);\n    FD_SET(sock, &writefds);\n#define TCP_PING_TIMEOUT 10\n    timeout.tv_sec = TCP_PING_TIMEOUT;\n    timeout.tv_usec = (TCP_PING_TIMEOUT - timeout.tv_sec) * 1000000;\n    connect(sock, reinterpret_cast<struct sockaddr *>(addr),\n            addrlen);  // this will \"fail\" because sock is non-blocking\n    if (errno == EINPROGRESS) {  // but EINPROGRESS is only a \"false fail\"\n      gettimeofday(&tv1, nullptr);\n      if (select(sock + 1, nullptr, &writefds, nullptr, &timeout) != -1) {\n        int ret = 0;\n        socklen_t len = sizeof(ret);\n        gettimeofday(&tv2, nullptr);\n        usecdiff =\n            ((tv2.tv_sec - tv1.tv_sec) * 1000000) + tv2.tv_usec - tv1.tv_usec;\n        if (getsockopt(sock, SOL_SOCKET, SO_ERROR, &ret, &len) == 0 && ret == 0) {\n          snprintf(p, p_max_size, \"%llu\", (usecdiff / 1000U));\n        } else {\n#define TCP_PING_FAILED \"down\"\n          snprintf(p, p_max_size, \"%s\", TCP_PING_FAILED);\n        }\n      } else {\n        NORM_ERR(\"tcp_ping: Couldn't wait on the 'pong'\");\n      }\n    } else {\n      NORM_ERR(\"tcp_ping: Couldn't start connection\");\n    }\n    close(sock);\n  } else {\n    NORM_ERR(\"tcp_ping: Couldn't create socket\");\n  }\n}\n\nvoid print_read_tcpip(struct text_object *obj, char *p, int p_max_size,\n                      int protocol) {\n  int sock, received;\n  fd_set readfds;\n  struct timeval tv {};\n  auto *rtd = static_cast<struct read_tcpip_data *>(obj->data.opaque);\n  struct addrinfo hints {};\n  struct addrinfo *airesult, *rp;\n  char portbuf[8];\n\n  if (rtd == nullptr) { return; }\n\n  memset(&hints, 0, sizeof(struct addrinfo));\n  hints.ai_family = AF_UNSPEC;\n  hints.ai_socktype = protocol == IPPROTO_TCP ? SOCK_STREAM : SOCK_DGRAM;\n  hints.ai_flags = 0;\n  hints.ai_protocol = protocol;\n  snprintf(portbuf, 8, \"%u\", rtd->port);\n  if (getaddrinfo(rtd->host, portbuf, &hints, &airesult) != 0) {\n    NORM_ERR(\"%s: Problem with resolving the hostname\",\n             protocol == IPPROTO_TCP ? \"read_tcp\" : \"read_udp\");\n    return;\n  }\n  for (rp = airesult; rp != nullptr; rp = rp->ai_next) {\n    sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);\n    if (sock == -1) { continue; }\n    if (connect(sock, rp->ai_addr, rp->ai_addrlen) != -1) { break; }\n    close(sock);\n    return;\n  }\n  freeaddrinfo(airesult);\n  if (rp == nullptr) {\n    if (protocol == IPPROTO_TCP) {\n      NORM_ERR(\"read_tcp: Couldn't create a connection\");\n    } else {\n      NORM_ERR(\"read_udp: Couldn't listen\");  // other error because udp is\n                                              // connectionless\n    }\n    return;\n  }\n  if (protocol == IPPROTO_UDP) {\n    // when using udp send a zero-length packet to let the other end know of our\n    // existence\n    if (write(sock, nullptr, 0) < 0) {\n      NORM_ERR(\"read_udp: Couldn't create a empty package\");\n    }\n  }\n  FD_ZERO(&readfds);\n  FD_SET(sock, &readfds);\n  tv.tv_sec = 1;\n  tv.tv_usec = 0;\n  if (select(sock + 1, &readfds, nullptr, nullptr, &tv) > 0) {\n    received = recv(sock, p, p_max_size, 0);\n    if (received != -1) {\n      p[received] = 0;\n    } else {\n      p[0] = 0;\n    }\n  }\n  close(sock);\n}\n\nvoid print_read_tcp(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_read_tcpip(obj, p, p_max_size, IPPROTO_TCP);\n}\n\nvoid print_read_udp(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_read_tcpip(obj, p, p_max_size, IPPROTO_UDP);\n}\n\nvoid free_read_tcpip(struct text_object *obj) {\n  auto *rtd = static_cast<struct read_tcpip_data *>(obj->data.opaque);\n\n  if (rtd == nullptr) { return; }\n\n  free_and_zero(rtd->host);\n  free_and_zero(obj->data.opaque);\n}\n\nvoid free_tcp_ping(struct text_object *obj) {\n  auto *addr = static_cast<struct sockaddr_in *>(obj->data.opaque);\n\n  if (addr == nullptr) { return; }\n\n  free_and_zero(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/data/network/read_tcpip.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _READ_TCP_H\n#define _READ_TCP_H\n\nvoid parse_read_tcpip_arg(struct text_object *, const char *, void *);\nvoid parse_tcp_ping_arg(struct text_object *obj, const char *arg,\n                        void *free_at_crash);\nvoid print_read_tcp(struct text_object *, char *, unsigned int);\nvoid print_read_udp(struct text_object *, char *, unsigned int);\nvoid print_tcp_ping(struct text_object *, char *, unsigned int);\nvoid free_read_tcpip(struct text_object *);\nvoid free_tcp_ping(struct text_object *);\n\n#endif /* _READ_TCP_H */\n"
  },
  {
    "path": "src/data/network/rss.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <assert.h>\n#include <time.h>\n#include <cmath>\n#include <mutex>\n#include \"../../conky.h\"\n#include \"../../content/text_object.h\"\n#include \"../../logging.h\"\n#include \"ccurl_thread.h\"\n#include \"prss.h\"\n\nstruct rss_data {\n  char uri[128];\n  char action[64];\n  int act_par;\n  float interval;\n  unsigned int nrspaces;\n};\n\nnamespace {\nclass rss_cb : public curl_callback<std::shared_ptr<PRSS>> {\n  typedef curl_callback<std::shared_ptr<PRSS>> Base;\n\n protected:\n  virtual void process_data() {\n    try {\n      std::shared_ptr<PRSS> tmp(new PRSS(data));\n\n      std::unique_lock<std::mutex> lock(Base::result_mutex);\n      Base::result = tmp;\n    } catch (std::runtime_error &e) { NORM_ERR(\"%s\", e.what()); }\n  }\n\n public:\n  rss_cb(uint32_t period, const std::string &uri)\n      : Base(period, Base::Tuple(uri)) {}\n};\n}  // namespace\n\nvoid rss_safe_append(char *dest, unsigned int dest_size, const char *src) {\n  if (dest == nullptr || src == nullptr || dest_size == 0) { return; }\n\n  size_t used = strnlen(dest, dest_size);\n  if (used >= dest_size - 1) {\n    dest[dest_size - 1] = '\\0';\n    return;\n  }\n\n  snprintf(dest + used, dest_size - used, \"%s\", src);\n}\n\nstatic void rss_process_info(char *p, int p_max_size, const std::string &uri,\n                             char *action, int act_par, int interval,\n                             unsigned int nrspaces) {\n  char *str;\n\n  uint32_t period = std::max(lround(interval / active_update_interval()), 1l);\n\n  auto cb = conky::register_cb<rss_cb>(period, uri);\n\n  assert(act_par >= 0 && action);\n\n  std::shared_ptr<PRSS> data = cb->get_result_copy();\n\n  if (!data || data->item_count < 1) {\n    *p = 0;\n  } else {\n    /*\n     * XXX: Refactor this so that we can retrieve any of the fields in the\n     * PRSS struct (in prss.h).\n     */\n    if (strcmp(action, \"feed_title\") == EQUAL) {\n      str = data->title;\n      if (str && strlen(str) > 0) {\n        // remove trailing new line if one exists\n        if (str[strlen(str) - 1] == '\\n') { str[strlen(str) - 1] = 0; }\n        snprintf(p, p_max_size, \"%s\", str);\n      }\n    } else if (strcmp(action, \"item_title\") == EQUAL) {\n      if (act_par < data->item_count) {\n        str = data->items[act_par].title;\n        // remove trailing new line if one exists\n        if (str && strlen(str) > 0) {\n          if (str[strlen(str) - 1] == '\\n') { str[strlen(str) - 1] = 0; }\n          snprintf(p, p_max_size, \"%s\", str);\n        }\n      }\n    } else if (strcmp(action, \"item_desc\") == EQUAL) {\n      if (act_par < data->item_count) {\n        str = data->items[act_par].description;\n        // remove trailing new line if one exists\n        if (str && strlen(str) > 0) {\n          if (str[strlen(str) - 1] == '\\n') { str[strlen(str) - 1] = 0; }\n          snprintf(p, p_max_size, \"%s\", str);\n        }\n      }\n    } else if (strcmp(action, \"item_titles\") == EQUAL) {\n      if (data->item_count > 0) {\n        int itmp;\n        int show;\n        *p = 0;\n        //'tmpspaces' is a string with spaces too be placed in front of each\n        // title\n        char *tmpspaces = (char *)malloc(nrspaces + 1);\n        memset(tmpspaces, ' ', nrspaces);\n        tmpspaces[nrspaces] = 0;\n\n        if (act_par > data->item_count) {\n          show = data->item_count;\n        } else {\n          show = act_par;\n        }\n        for (itmp = 0; itmp < show; itmp++) {\n          PRSS_Item *item = &data->items[itmp];\n\n          str = item->title;\n          if (str) {\n            // don't add new line before first item\n            if (itmp > 0) { rss_safe_append(p, p_max_size, \"\\n\"); }\n            /* remove trailing new line if one exists,\n             * we have our own */\n            if (strlen(str) > 0 && str[strlen(str) - 1] == '\\n') {\n              str[strlen(str) - 1] = 0;\n            }\n            rss_safe_append(p, p_max_size, tmpspaces);\n            rss_safe_append(p, p_max_size, str);\n          }\n        }\n        free(tmpspaces);\n      }\n    } else {\n      NORM_ERR(\"rss: Invalid action '%s'\", action);\n    }\n  }\n}\n\nvoid rss_scan_arg(struct text_object *obj, const char *arg) {\n  int argc;\n  struct rss_data *rd;\n\n  rd = (struct rss_data *)malloc(sizeof(struct rss_data));\n  memset(rd, 0, sizeof(struct rss_data));\n\n  argc = sscanf(arg, \"%127s %f %63s %d %u\", rd->uri, &rd->interval, rd->action,\n                &rd->act_par, &rd->nrspaces);\n  if (argc < 3) {\n    NORM_ERR(\"wrong number of arguments for $rss\");\n    free(rd);\n    return;\n  }\n  obj->data.opaque = rd;\n}\n\nvoid rss_print_info(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct rss_data *rd = (struct rss_data *)obj->data.opaque;\n\n  if (!rd) {\n    NORM_ERR(\"error processing RSS data\");\n    return;\n  }\n  rss_process_info(p, p_max_size, rd->uri, rd->action, rd->act_par,\n                   rd->interval, rd->nrspaces);\n}\n\nvoid rss_free_obj_info(struct text_object *obj) {\n  free_and_zero(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/data/network/rss.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef RSS_H_\n#define RSS_H_\n\nvoid rss_scan_arg(struct text_object *, const char *);\nvoid rss_print_info(struct text_object *, char *, unsigned int);\nvoid rss_free_obj_info(struct text_object *);\nvoid rss_safe_append(char *dest, unsigned int dest_size, const char *src);\n\n#endif /*RSS_H_*/\n"
  },
  {
    "path": "src/data/network/tcp-portmon.cc",
    "content": "/*\n *\n * tcp-portmon.c - libtcp-portmon hooks\n *\n * Copyright (C) 2008 Phil Sutter <Phil@nwl.cc>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"tcp-portmon.h\"\n#include \"../../conky.h\"\n#include \"libtcp-portmon.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\nstatic tcp_port_monitor_collection_t *pmc = nullptr;\n\nstatic conky::range_config_setting<int> max_port_monitor_connections(\n    \"max_port_monitor_connections\", 0, std::numeric_limits<int>::max(),\n    MAX_PORT_MONITOR_CONNECTIONS_DEFAULT, false);\n\nint tcp_portmon_init(struct text_object *obj, const char *arg) {\n  int item = -1;\n  int argc;\n  int port_begin;\n  int port_end;\n  int connection_index;\n  char itembuf[32];\n  struct tcp_port_monitor_data *pmd;\n\n  memset(itembuf, 0, sizeof(itembuf));\n  connection_index = 0;\n  /* massive argument checking */\n  argc = sscanf(arg, \"%d %d %31s %d\", &port_begin, &port_end, itembuf,\n                &connection_index);\n  if ((argc != 3) && (argc != 4)) {\n    CRIT_ERR(\"tcp_portmon: requires 3 or 4 arguments\");\n  }\n  if ((port_begin < 1) || (port_begin > 65535) || (port_end < 1) ||\n      (port_end > 65535)) {\n    CRIT_ERR(\"tcp_portmon: port values must be from 1 to 65535\");\n  }\n  if (port_begin > port_end) {\n    CRIT_ERR(\"tcp_portmon: starting port must be <= ending port\");\n  }\n  if (strncmp(itembuf, \"count\", 31) == EQUAL) {\n    item = COUNT;\n  } else if (strncmp(itembuf, \"rip\", 31) == EQUAL) {\n    item = REMOTEIP;\n  } else if (strncmp(itembuf, \"rhost\", 31) == EQUAL) {\n    item = REMOTEHOST;\n  } else if (strncmp(itembuf, \"rport\", 31) == EQUAL) {\n    item = REMOTEPORT;\n  } else if (strncmp(itembuf, \"rservice\", 31) == EQUAL) {\n    item = REMOTESERVICE;\n  } else if (strncmp(itembuf, \"lip\", 31) == EQUAL) {\n    item = LOCALIP;\n  } else if (strncmp(itembuf, \"lhost\", 31) == EQUAL) {\n    item = LOCALHOST;\n  } else if (strncmp(itembuf, \"lport\", 31) == EQUAL) {\n    item = LOCALPORT;\n  } else if (strncmp(itembuf, \"lservice\", 31) == EQUAL) {\n    item = LOCALSERVICE;\n  } else {\n    CRIT_ERR(\"tcp_portmon: invalid item specified\");\n  }\n  if ((argc == 3) && (item != COUNT)) {\n    CRIT_ERR(\n        \"tcp_portmon: 3 argument form valid only for \\\"count\\\" \"\n        \"item\");\n  }\n  if ((argc == 4) && (connection_index < 0)) {\n    CRIT_ERR(\"tcp_portmon: connection index must be non-negative\");\n  }\n  /* ok, args looks good. save the text object data */\n  pmd = (tcp_port_monitor_data *)malloc(sizeof(struct tcp_port_monitor_data));\n  memset(pmd, 0, sizeof(struct tcp_port_monitor_data));\n  pmd->port_range_begin = (in_port_t)port_begin;\n  pmd->port_range_end = (in_port_t)port_end;\n  pmd->item = item;\n  pmd->connection_index = connection_index;\n  obj->data.opaque = pmd;\n\n  /* if the port monitor collection hasn't been created,\n   * we must create it */\n  if (!pmc) {\n    pmc = create_tcp_port_monitor_collection();\n    if (!pmc) {\n      CRIT_ERR(\n          \"tcp_portmon: unable to create port monitor \"\n          \"collection\");\n    }\n  }\n\n  /* if a port monitor for this port does not exist,\n   * create one and add it to the collection */\n  if (find_tcp_port_monitor(pmc, port_begin, port_end) == nullptr) {\n    tcp_port_monitor_args_t pma;\n    memset(&pma, 0, sizeof pma);\n    pma.max_port_monitor_connections = max_port_monitor_connections.get(*state);\n\n    /* add the newly created monitor to the collection */\n    if (insert_new_tcp_port_monitor_into_collection(pmc, port_begin, port_end,\n                                                    &pma) != 0) {\n      CRIT_ERR(\n          \"tcp_portmon: unable to add port monitor to \"\n          \"collection\");\n    }\n  }\n  return 0;\n}\n\nvoid tcp_portmon_action(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  struct tcp_port_monitor_data *pmd = (tcp_port_monitor_data *)obj->data.opaque;\n  tcp_port_monitor_t *p_monitor;\n\n  if (!pmd) return;\n\n  /* grab a pointer to this port monitor */\n  p_monitor =\n      find_tcp_port_monitor(pmc, pmd->port_range_begin, pmd->port_range_end);\n\n  if (!p_monitor) {\n    snprintf(p, p_max_size, \"%s\", \"monitor not found\");\n    return;\n  }\n\n  /* now grab the text of interest */\n  if (peek_tcp_port_monitor(p_monitor, pmd->item, pmd->connection_index, p,\n                            p_max_size) != 0) {\n    snprintf(p, p_max_size, \"%s\", \"monitor peek error\");\n  }\n}\n\nint tcp_portmon_update(void) {\n  update_tcp_port_monitor_collection(pmc);\n  return 0;\n}\n\nint tcp_portmon_clear(void) {\n  destroy_tcp_port_monitor_collection(pmc);\n  pmc = nullptr;\n  return 0;\n}\n\nvoid tcp_portmon_free(struct text_object *obj) {\n  free_and_zero(obj->data.opaque);\n}\n"
  },
  {
    "path": "src/data/network/tcp-portmon.h",
    "content": "/*\n *\n * tcp-portmon.h - libtcp-portmon hooks prototypes\n *\n * Copyright (C) 2008 Phil Sutter <Phil@nwl.cc>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _TCP_PORTMON_H\n#define _TCP_PORTMON_H\n\n#include \"libtcp-portmon.h\"\n\nstruct tcp_port_monitor_data {\n  /* starting port to monitor */\n  in_port_t port_range_begin;\n  /* ending port to monitor */\n  in_port_t port_range_end;\n  /* enum from libtcp-portmon.h, e.g. COUNT, etc. */\n  int item;\n  /* 0 to n-1 connections. */\n  int connection_index;\n};\n\n/* forward declare to make gcc happy */\nstruct text_object;\n\nint tcp_portmon_init(struct text_object *, const char *);\nvoid tcp_portmon_action(struct text_object *, char *, unsigned int);\nint tcp_portmon_update(void);\nint tcp_portmon_clear(void);\nvoid tcp_portmon_free(struct text_object *);\n\n#endif /* _TCP_PORTMON_H */\n"
  },
  {
    "path": "src/data/os/bsdcommon.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *      (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"bsdcommon.h\"\n#include \"../../logging.h\"\n\n#include <kvm.h>\n\n#include <sys/param.h>\n#include <sys/sysctl.h>\n\n#include <string.h>\n\n#if defined(__NetBSD__)\n  #include <uvm/uvm_extern.h>\n  #include <uvm/uvm_param.h>\n#elif defined(__OpenBSD__)\n  #include <sys/proc.h>\n  #include <sys/sched.h>\n  #include <sys/swap.h>\n  #include <sys/vmmeter.h>\n#else\n  #error Not supported BSD system\n#endif\n\n#include \"../top.h\"\n\nstatic kvm_t *kd = nullptr;\nstatic char kvm_errbuf[_POSIX2_LINE_MAX];\nstatic bool kvm_initialised = false;\nstatic bool cpu_initialised = false;\n\nstatic struct bsdcommon::cpu_load *cpu_loads = nullptr;\n\nbool bsdcommon::init_kvm() {\n  if (kvm_initialised) {\n      return true;\n  }\n\n  kd = kvm_open(nullptr, nullptr, nullptr, KVM_NO_FILES, kvm_errbuf);\n  if (kd == nullptr) {\n    NORM_ERR(\"opening kvm :%s\", kvm_errbuf);\n    return false;\n  }\n\n  kvm_initialised = true;\n  return true;\n}\n\nvoid bsdcommon::deinit_kvm() {\n  if (!kvm_initialised || kd == nullptr) {\n    return;\n  }\n\n  kvm_close(kd);\n}\n\nvoid bsdcommon::get_cpu_count(float **cpu_usage, unsigned int *cpu_count) {\n  int ncpu = 1;\n  int mib[2] = {CTL_HW, HW_NCPU};\n  size_t len = sizeof(ncpu);\n\n  if (sysctl(mib, 2, &ncpu, &len, nullptr, 0) != 0) {\n    NORM_ERR(\"error getting kern.ncpu, defaulting to 1\");\n    ncpu = 1;\n  }\n\n  if (*cpu_count != ncpu) {\n    *cpu_count = ncpu;\n\n    if (*cpu_usage != nullptr) {\n      free(*cpu_usage);\n      *cpu_usage = nullptr;\n    }\n\n    if (cpu_loads != nullptr) {\n      free(cpu_loads);\n      cpu_loads = nullptr;\n    }\n  }\n\n  if (*cpu_usage == nullptr) {\n    // [0] - Total CPU\n    // [1, 2, ... ] - CPU0, CPU1, ...\n    *cpu_usage = (float*)calloc(ncpu + 1, sizeof(float));\n    if (*cpu_usage == nullptr) {\n      CRIT_ERR(\"calloc of cpu_usage\");\n    }\n  }\n\n  if (cpu_loads == nullptr) {\n    cpu_loads = (struct cpu_load*)calloc(ncpu + 1, sizeof(struct cpu_load));\n    if (cpu_loads == nullptr) {\n      CRIT_ERR(\"calloc of cpu_loads\");\n    }\n  }\n}\n\nvoid bsdcommon::update_cpu_usage(float **cpu_usage, unsigned int *cpu_count) {\n  uint64_t cp_time0[CPUSTATES];\n  uint64_t cp_timen[CPUSTATES];\n#if defined(__NetBSD__)\n  int mib_cpu0[2] = {CTL_KERN, KERN_CP_TIME};\n  int mib_cpun[3] = {CTL_KERN, KERN_CP_TIME, 0};\n#elif defined(__OpenBSD__)\n  int mib_cpu0[2] = {CTL_KERN, KERN_CPTIME};\n  int mib_cpun[3] = {CTL_KERN, KERN_CPTIME2, 0};\n#else\n  #error Not supported BSD system\n#endif\n\n  size_t size = 0;\n  u_int64_t used = 0, total = 0;\n\n  if (!cpu_initialised) {\n    get_cpu_count(cpu_usage, cpu_count);\n    cpu_initialised = true;\n  }\n\n  size = sizeof(cp_time0);\n  if (sysctl(mib_cpu0, 2, &cp_time0, &size, nullptr, 0) != 0) {\n      NORM_ERR(\"unable to get cpu time for cpu0\");\n      return;\n  }\n\n  for (int j = 0; j < CPUSTATES; ++j) {\n    total += cp_time0[j];\n  }\n  used = total - cp_time0[CP_IDLE];\n\n  if ((total - cpu_loads[0].old_total) != 0) {\n    const float diff_used = (float)(used - cpu_loads[0].old_used);\n    const float diff_total = (float)(total - cpu_loads[0].old_total);\n    (*cpu_usage)[0] = diff_used / diff_total;\n  } else {\n    (*cpu_usage)[0] = 0;\n  }\n  cpu_loads[0].old_used = used;\n  cpu_loads[0].old_total = total;\n\n  for (int i = 0; i < *cpu_count; ++i) {\n    mib_cpun[2] = i;\n    size = sizeof(cp_timen);\n    if (sysctl(mib_cpun, 3, &cp_timen, &size, nullptr, 0) != 0) {\n      NORM_ERR(\"unable to get cpu time for cpu%d\", i);\n      return;\n    }\n\n    total = 0;\n    used = 0;\n    for (int j = 0; j < CPUSTATES; ++j) {\n      total += cp_timen[j];\n    }\n    used = total - cp_timen[CP_IDLE];\n\n    const int n = i + 1; // [0] is the total CPU, must shift by 1\n    if ((total - cpu_loads[n].old_total) != 0) {\n      const float diff_used = (float)(used - cpu_loads[n].old_used);\n      const float diff_total = (float)(total - cpu_loads[n].old_total);\n      (*cpu_usage)[n] = diff_used / diff_total;\n    } else {\n      (*cpu_usage)[n] = 0;\n    }\n\n    cpu_loads[n].old_used = used;\n    cpu_loads[n].old_total = total;\n  }\n}\n\nBSD_COMMON_PROC_STRUCT *bsdcommon::get_processes(short unsigned int *procs) {\n  if (!init_kvm()) {\n    return nullptr;\n  }\n\n  int n_processes = 0;\n#if defined(__NetBSD__)\n  BSD_COMMON_PROC_STRUCT *ps = kvm_getproc2(kd, KERN_PROC_ALL, 0,\n                                            sizeof(BSD_COMMON_PROC_STRUCT),\n                                            &n_processes);\n #elif defined(__OpenBSD__)\n  BSD_COMMON_PROC_STRUCT *ps = kvm_getprocs(kd, KERN_PROC_ALL, 0,\n                                            sizeof(BSD_COMMON_PROC_STRUCT),\n                                            &n_processes);\n#else\n  #error Not supported BSD system\n#endif\n\n if (ps == nullptr) {\n    NORM_ERR(\"unable to get proceses\");\n    return nullptr;\n  }\n\n  *procs = n_processes;\n  return ps;\n}\n\nstatic bool is_process_running(BSD_COMMON_PROC_STRUCT *p) {\n#if defined(__NetBSD__)\n  return p->p_stat == LSRUN || p->p_stat == LSIDL || p->p_stat == LSONPROC;\n#elif defined(__OpenBSD__)\n  return p->p_stat == SRUN;\n#else\n  #error Not supported BSD system \n#endif\n}\n\nvoid bsdcommon::get_number_of_running_processes(short unsigned int *run_procs) {\n  if (!init_kvm()) {\n    return;\n  }\n\n  short unsigned int nprocs = 0;\n  BSD_COMMON_PROC_STRUCT* ps = get_processes(&nprocs);\n  if (ps == nullptr) {\n    return;\n  }\n\n  short unsigned int ctr = 0;\n  for (int i = 0; i < nprocs; ++i) {\n    if (is_process_running(&ps[i])) {\n      ++ctr;\n    }\n  }\n\n  *run_procs = ctr;\n}\n\nstatic bool is_top_process(BSD_COMMON_PROC_STRUCT *p) {\n#if defined(__NetBSD__) || defined(__OpenBSD__)\n  return !((p->p_flag & P_SYSTEM)) && p->p_comm[0] != 0;\n#else\n  #error Not supported BSD system \n#endif\n}\n\nstatic int32_t get_pid(BSD_COMMON_PROC_STRUCT *p) {\n#if defined(__NetBSD__) || defined(__OpenBSD__)\n  return p->p_pid;\n#else\n  #error Not supported BSD system \n#endif\n}\n\n// conky uses time in hundredths of seconds (centiseconds)\nstatic unsigned long to_conky_time(u_int32_t sec, u_int32_t usec) {\n  return sec * 100 + (unsigned long)(usec * 0.0001);\n}\n\nstatic void proc_from_bsdproc(struct process *proc, BSD_COMMON_PROC_STRUCT *p) {\n  free_and_zero(proc->name);\n  free_and_zero(proc->basename);\n\n  unsigned long user_time = 0;\n  unsigned long kernel_time = 0;\n\n#if defined(__NetBSD__)\n  // https://github.com/netbsd/src/blob/trunk/sys/sys/sysctl.h\n  proc->time_stamp = g_time;\n  proc->user_time = to_conky_time(p->p_uutime_sec, p->p_uutime_usec);\n  proc->kernel_time = to_conky_time(p->p_ustime_sec, p->p_ustime_usec);\n  proc->uid = p->p_uid;\n  proc->name = strndup(p->p_comm, text_buffer_size.get(*::state));\n  proc->basename = strndup(p->p_comm, text_buffer_size.get(*::state));\n  proc->amount = 100.0 * p->p_pctcpu / FSCALE;\n  proc->vsize = p->p_vm_vsize * getpagesize();\n  proc->rss = p->p_vm_rssize * getpagesize();\n  proc->total_cpu_time = to_conky_time(p->p_rtime_sec, p->p_rtime_usec);\n#elif defined(__OpenBSD__)\n  // https://github.com/openbsd/src/blob/master/sys/sys/sysctl.h\n  proc->time_stamp = g_time;\n  proc->user_time = to_conky_time(p->p_uutime_sec, p->p_uutime_usec);\n  proc->kernel_time = to_conky_time(p->p_ustime_sec, p->p_ustime_usec);\n  proc->total = proc->user_time + proc->kernel_time;\n  proc->uid = p->p_uid;\n  proc->name = strndup(p->p_comm, text_buffer_size.get(*state));\n  proc->basename = strndup(p->p_comm, text_buffer_size.get(*state));\n  proc->amount = 100.0 * p->p_pctcpu / FSCALE;\n  proc->vsize = p->p_vm_map_size;\n  proc->rss = (p->p_vm_rssize * getpagesize());\n  proc->total_cpu_time = to_conky_time(p->p_rtime_sec, p->p_rtime_usec);\n#else\n  #error Not supported BSD system \n#endif\n\n  if (proc->previous_user_time == ULONG_MAX) {\n    proc->previous_user_time = proc->user_time;\n  }\n\n  if (proc->previous_kernel_time == ULONG_MAX) {\n    proc->previous_kernel_time = proc->kernel_time;\n  }\n\n  /* strangely, the values aren't monotonous (from Linux) */\n  if (proc->previous_user_time > proc->user_time) {\n    proc->previous_user_time = proc->user_time;\n  }\n\n  if (proc->previous_kernel_time > proc->kernel_time) {\n    proc->previous_kernel_time = proc->kernel_time;\n  }\n\n  /* store the difference of the user_time */\n  user_time = proc->user_time - proc->previous_user_time;\n  kernel_time = proc->kernel_time - proc->previous_kernel_time;\n\n  /* backup the process->user_time for next time around */\n  proc->previous_user_time = proc->user_time;\n  proc->previous_kernel_time = proc->kernel_time;\n\n  /* store only the difference of the user_time here... */\n  proc->user_time = user_time;\n  proc->kernel_time = kernel_time;\n}\n\nvoid bsdcommon::update_top_info() {\n  if (!init_kvm()) {\n    return;\n  }\n\n  struct process *proc = nullptr;\n  short unsigned int nprocs = 0;\n\n  BSD_COMMON_PROC_STRUCT *ps = get_processes(&nprocs);\n  if (ps == nullptr) {\n    return;\n  }\n\n  for (int i = 0; i < nprocs; ++i) {\n    BSD_COMMON_PROC_STRUCT *p = &ps[i];\n\n    if (!is_top_process(p)) {\n      continue;\n    }\n\n    proc = get_process(get_pid(p));\n    if (!proc) {\n      continue;\n    }\n\n    proc_from_bsdproc(proc, p);\n  }\n}\n\nstatic bool is_process(BSD_COMMON_PROC_STRUCT *p, const char *name) {\n#if defined(__NetBSD__) || defined(__OpenBSD__)\n  return p->p_comm[0] != 0 && strcmp(p->p_comm, name) == 0;\n#else\n  #error Not supported BSD system \n#endif\n}\n\nbool bsdcommon::is_conky_already_running() {\n  if (!init_kvm()) {\n    return false;\n  }\n\n  struct process *proc = nullptr;\n  short unsigned int nprocs = 0;\n  int instances = 0;\n\n  BSD_COMMON_PROC_STRUCT *ps = get_processes(&nprocs);\n  if (ps == nullptr) {\n    return false;\n  }\n\n  for (int i = 0; i < nprocs && instances < 2; ++i) {\n    BSD_COMMON_PROC_STRUCT *p = &ps[i];\n\n    if (is_process(p, \"conky\")) {\n      ++instances;\n    }\n  }\n\n  return instances > 1;\n}\n\n// conky uses kilobytes\nstatic unsigned long long to_conky_size(uint64_t size, uint64_t pagesize) {\n  return (size >> 10) * pagesize;\n}\n\n#if defined(__OpenBSD__)\n/* note: swapmode taken from 'top' source */\n/* swapmode is rewritten by Tobias Weingartner <weingart@openbsd.org>\n * to be based on the new swapctl(2) system call. */\nstatic int swapmode(int *used, int *total) {\n  struct swapent *swdev;\n  int nswap, rnswap, i;\n\n  nswap = swapctl(SWAP_NSWAP, 0, 0);\n  if (nswap == 0) { return 0; }\n\n  swdev = (struct swapent *)malloc(nswap * sizeof(*swdev));\n  if (swdev == nullptr) { return 0; }\n\n  rnswap = swapctl(SWAP_STATS, swdev, nswap);\n  if (rnswap == -1) {\n    free(swdev);\n    return 0;\n  }\n\n  /* if rnswap != nswap, then what? */\n\n  /* Total things up */\n  *total = *used = 0;\n  for (i = 0; i < nswap; i++) {\n    if (swdev[i].se_flags & SWF_ENABLE) {\n      *used += (swdev[i].se_inuse / (1024 / DEV_BSIZE));\n      *total += (swdev[i].se_nblks / (1024 / DEV_BSIZE));\n    }\n  }\n  free(swdev);\n  return 1;\n}\n#endif /* OpenBSD */\n\nvoid bsdcommon::update_meminfo(struct information &info) {\n  size_t len;\n#if defined(__NetBSD__)\n  int mib[2] = {CTL_VM, VM_UVMEXP2};\n  // NOTE(gmb): https://github.com/NetBSD/src/blob/trunk/sys/uvm/uvm_extern.h\n  struct uvmexp_sysctl meminfo;\n#elif defined(__OpenBSD__)\n  int mib[2] = {CTL_VM, VM_METER};\n  struct vmtotal meminfo;\n#else\n  #error Not supported BSD system.\n#endif\n\n  len = sizeof(meminfo);\n  if (sysctl(mib, 2, &meminfo, &len, NULL, 0) == -1 ) {\n    NORM_ERR(\"unable to get meminfo\");\n    return;\n  }\n\n// TODO(gmb): Try to fill all memory related fields.\n#if defined(__NetBSD__)\n  info.memmax = to_conky_size(meminfo.npages, meminfo.pagesize);\n  info.memfree = info.memeasyfree = to_conky_size(meminfo.free, meminfo.pagesize);\n  info.mem = info.memmax - info.memfree;\n\n  info.swapmax = to_conky_size(meminfo.swpages, meminfo.pagesize);\n  info.swap = to_conky_size(meminfo.swpginuse, meminfo.pagesize);\n  info.swapfree = info.swapmax - info.swap;\n#elif defined(__OpenBSD__)\n  int pagesize = getpagesize();\n  info.memmax = to_conky_size(meminfo.t_rm + meminfo.t_free, pagesize);\n  info.mem = info.memwithbuffers = to_conky_size(meminfo.t_rm, pagesize);\n  info.memfree = info.memeasyfree = info.memmax - info.mem;\n  info.legacymem = info.mem;\n\n  int swap_avail, swap_used;\n  if ((swapmode(&swap_used, &swap_avail)) >= 0) {\n    info.swapmax = swap_avail;\n    info.swap = swap_used;\n    info.swapfree = swap_avail - swap_used;\n  } else {\n    info.swapmax = 0;\n    info.swap = 0;\n    info.swapfree = 0;\n  }\n#else\n  #error Not supported BSD system.\n#endif\n}\n"
  },
  {
    "path": "src/data/os/bsdcommon.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n/*\n * Shared or very similar code across BSDs.\n */\n\n#ifndef BSDCOMMON_H_\n#define BSDCOMMON_H_\n\n#define BSD_COMMON\n\n#if defined(__NetBSD__)\n  #include <sys/sysctl.h>\n  #define BSD_COMMON_PROC_STRUCT struct kinfo_proc2\n#elif defined(__OpenBSD__)\n  #include <sys/types.h>\n  #include <sys/sysctl.h>\n  #define BSD_COMMON_PROC_STRUCT struct kinfo_proc\n#else\n  #error Not supported BSD system\n#endif\n\n#include <stdint.h>\n\n#include \"../../conky.h\"\n\nnamespace bsdcommon {\n  struct cpu_load {\n    uint64_t old_used;\n    uint64_t old_total;\n  };\n\n  bool init_kvm();\n  void deinit_kvm();\n\n  void get_cpu_count(float **cpu_usage, unsigned int *cpu_count);\n  void update_cpu_usage(float **cpu_usage, unsigned int *cpu_count);\n\n  BSD_COMMON_PROC_STRUCT* get_processes(short unsigned int *procs);\n\n  void get_number_of_running_processes(short unsigned int *run_procs);\n  void update_top_info();\n  bool is_conky_already_running();\n\n  void update_meminfo(struct information &info);\n}\n\n#endif /*BSDCOMMON_H_*/\n"
  },
  {
    "path": "src/data/os/darwin.h",
    "content": "/*\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2018-2019, npyl <n.pylarinos@hotmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DARWIN_H\n#define DARWIN_H\n\n#include <stdio.h>\n#include <strings.h>\n#include <sys/mount.h>\n#include <sys/param.h>\n\n/*\n *  on versions prior to Sierra clock_gettime is not implemented.\n */\n#ifndef HAVE_CLOCK_GETTIME\n\n/* only CLOCK_REALTIME and CLOCK_MONOTONIC are emulated */\n#ifndef CLOCK_REALTIME\n#define CLOCK_REALTIME 0\n#endif\n#ifndef CLOCK_MONOTONIC\n#define CLOCK_MONOTONIC 1\n#endif\n\nint clock_gettime(int clock_id, struct timespec *ts);\n#endif /* ifndef HAVE_CLOCK_GETTIME */\n\nint update_running_threads(void);\n\nint get_entropy_avail(const unsigned int *);\nint get_entropy_poolsize(const unsigned int *);\n\n/* System Integrity Protection */\nint get_sip_status(void);\nvoid print_sip_status(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\n\nvoid deallocate_cpu_sample(struct text_object *obj);\n\n#endif /*DARWIN_H*/\n"
  },
  {
    "path": "src/data/os/darwin.mm",
    "content": "/*\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2018-2019, npyl <n.pylarinos@hotmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n/*\n ***********************************************************************************************\n *\n *  darwin.cc\n *  Nickolas Pylarinos\n *\n *  ~ To mrt and vggol ~\n *\n ***********************************************************************************************\n *\n *  Code for SIP taken from Pike R. Alpha's csrstat tool\n *https://github.com/Piker-Alpha/csrstat csrstat version 1.8 ( works for OS up\n *to High Sierra )\n *\n *  My patches:\n *      made csr_get_active_config weak link and added check for finding if it\n *is available. patched the _csr_check function to return the bool bit instead.\n */\n\n#include \"../../conky.h\"  // for struct info\n#include \"darwin.h\"\n#include \"darwin_top_helpers.h\"\n\n#include <AvailabilityMacros.h>\n\n#include <sys/mount.h>  // statfs\n#include <sys/sysctl.h>\n#include <cstdio>\n\n#include <mach/mach_host.h>\n#include <mach/mach_init.h>\n#include <mach/mach_types.h>\n#include <mach/machine.h>\n#include <mach/vm_statistics.h>\n\n#include <mach/mach.h>  // update_total_processes\n\n#include <dispatch/dispatch.h>  // get_top_info\n#include <libproc.h>            // get_top_info\n#include \"../top.h\"                // get_top_info\n\n#include <ifaddrs.h>   // update_net_stats\n#include \"../network/net_stat.h\"  // update_net_stats\n\n#include \"darwin_sip.h\"  // sip status\n\n#include <vector>\n\n#ifdef BUILD_IPGFREQ\n#include <IntelPowerGadget/EnergyLib.h>\n#endif\n\n#ifdef BUILD_WLAN\n#import <CoreWLAN/CoreWLAN.h>\n#endif\n\n/* clock_gettime includes */\n#ifndef HAVE_CLOCK_GETTIME\n#include <errno.h>\n#include <mach/clock.h>\n#include <mach/mach.h>\n#include <mach/mach_time.h>\n#include <time.h>\n#endif\n\n/* debugging defines */\n#define DEBUG_MODE\n\n/* (E)nhanced printf */\n#ifdef DEBUG_MODE\n#include <cstdarg>\nvoid eprintf(const char *fmt, ...) {\n  va_list args;\n  va_start(args, fmt);\n  vprintf(fmt, args);\n  va_end(args);\n}\n#else\n#define eprintf(...) /* ... */\n#endif\n\n#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))\n\n/*\n * used by calc_cpu_each() for get_top_info()\n */\nstatic conky::simple_config_setting<bool> top_cpu_separate(\"top_cpu_separate\",\n                                                           false, true);\n/*\n * used by update_cpu_usage()\n */\nstruct cpusample *sample_handle = nullptr;\n\nstatic int getsysctl(const char *name, void *ptr, size_t len) {\n  size_t nlen = len;\n\n  if (sysctlbyname(name, ptr, &nlen, nullptr, 0) == -1) { return -1; }\n\n  if (nlen != len && errno == ENOMEM) { return -1; }\n\n  return 0;\n}\n\n/*\n *  clock_gettime is not implemented on versions prior to Sierra!\n *  code taken from\n * https://github.com/lorrden/darwin-posix-rt/blob/master/clock_gettime.c\n */\n#ifndef HAVE_CLOCK_GETTIME\n\nint clock_gettime(int clock_id, struct timespec *ts) {\n  mach_timespec_t mts;\n  static clock_serv_t rt_clock_serv = 0;\n  static clock_serv_t mono_clock_serv = 0;\n\n  switch (clock_id) {\n    case CLOCK_REALTIME:\n      if (rt_clock_serv == 0) {\n        (void)host_get_clock_service(mach_host_self(), CALENDAR_CLOCK,\n                                     &rt_clock_serv);\n      }\n      (void)clock_get_time(rt_clock_serv, &mts);\n      ts->tv_sec = mts.tv_sec;\n      ts->tv_nsec = mts.tv_nsec;\n      return 0;\n    case CLOCK_MONOTONIC:\n      if (mono_clock_serv == 0) {\n        (void)host_get_clock_service(mach_host_self(), SYSTEM_CLOCK,\n                                     &mono_clock_serv);\n      }\n      (void)clock_get_time(mono_clock_serv, &mts);\n      ts->tv_sec = mts.tv_sec;\n      ts->tv_nsec = mts.tv_nsec;\n      return 0;\n    default:\n      errno = EINVAL;\n      return -1;\n  }\n}\n#endif /* ifndef HAVE_CLOCK_GETTIME */\n\n/*\n *  helper_update_threads_processes()\n *\n *  Helper function for update_threads() and update_running_threads()\n *  Uses mach API to get load info ( task_count, thread_count )\n *\n */\nstatic void helper_update_threads_processes() {\n  static host_name_port_t machHost;\n  static processor_set_name_port_t processorSet = 0;\n  static bool machStuffInitialised = false;\n\n  /* Set up our mach host and default processor set for later calls */\n  if (!machStuffInitialised) {\n    machHost = mach_host_self();\n    processor_set_default(machHost, &processorSet);\n\n    /* set this to true so we don't ever initialise stuff again */\n    machStuffInitialised = true;\n  }\n\n  /* get load info */\n  struct processor_set_load_info loadInfo {};\n  mach_msg_type_number_t count = PROCESSOR_SET_LOAD_INFO_COUNT;\n  kern_return_t err = processor_set_statistics(\n      processorSet, PROCESSOR_SET_LOAD_INFO,\n      reinterpret_cast<processor_set_info_t>(&loadInfo), &count);\n\n  if (err != KERN_SUCCESS) { return; }\n\n  info.procs = loadInfo.task_count;\n  info.threads = loadInfo.thread_count;\n}\n\n/*\n * Memory sample\n */\ntypedef struct memorysample {\n  vm_statistics64_data_t vm_stat; /* general VM information */\n  uint64_t pages_stolen;          /* # of stolen pages */\n  vm_size_t pagesize;             /* pagesize (in bytes) */\n  boolean_t purgeable_is_valid; /* check if we have data for purgeable memory */\n} libtop_tsamp_t;\n\n/*\n * get_cpu_sample()\n *\n * Gets systemTime, userTime and idleTime for CPU\n * MenuMeters has been great inspiration for this function\n */\nstatic void get_cpu_sample(struct cpusample **sample) {\n  host_name_port_t machHost;\n  natural_t processorCount;\n  processor_cpu_load_info_t processorTickInfo;\n  mach_msg_type_number_t processorInfoCount;\n\n  machHost = mach_host_self();\n\n  kern_return_t err = host_processor_info(\n      machHost, PROCESSOR_CPU_LOAD_INFO, &processorCount,\n      reinterpret_cast<processor_info_array_t *>(&processorTickInfo),\n      &processorInfoCount);\n  if (err != KERN_SUCCESS) {\n    printf(\"host_statistics: %s\\n\", mach_error_string(err));\n    return;\n  }\n\n  /*\n   * start from samples[1] because samples[0] is overall CPU usage\n   */\n  for (natural_t i = 1; i < processorCount + 1; i++) {\n    (*sample)[i].totalSystemTime =\n        processorTickInfo[i - 1].cpu_ticks[CPU_STATE_SYSTEM],\n    (*sample)[i].totalUserTime =\n        processorTickInfo[i - 1].cpu_ticks[CPU_STATE_USER],\n    (*sample)[i].totalIdleTime =\n        processorTickInfo[i - 1].cpu_ticks[CPU_STATE_IDLE];\n  }\n\n  /*\n   * sum up all totals\n   */\n  sum_cpu_sample_overall(*sample, processorCount);\n\n  /*\n   * Dealloc\n   */\n  vm_deallocate(mach_task_self(), (vm_address_t)processorTickInfo,\n                static_cast<vm_size_t>(processorInfoCount * sizeof(natural_t)));\n}\n\nvoid allocate_cpu_sample(struct cpusample **sample) {\n  if (*sample != nullptr)\n    return;\n\n  /*\n   * allocate ncpus+1 cpusample structs (one foreach CPU)\n   * ** sample_handle[0] is overal CPU usage\n   */\n  *sample = reinterpret_cast<struct cpusample *>(malloc(sizeof(cpusample) * (info.cpu_count + 1)));\n  memset(*sample, 0, sizeof(cpusample) * (info.cpu_count + 1));\n\n  sample_handle = *sample; /* use a public handle for deallocating */\n}\n\nvoid free_cpu(struct text_object *) {\n  if (sample_handle != nullptr) {\n    free(sample_handle);\n    sample_handle = nullptr;\n  }\n}\n\n/*\n * helper_get_proc_list()\n *\n * helper function that returns the count of processes\n * and provides a list of kinfo_proc structs representing each.\n *\n * ERRORS: returns -1 if something failed\n *\n * ATTENTION: Do not forget to free the array once you are done with it,\n *  it is not freed automatically.\n */\nstatic int helper_get_proc_list(struct kinfo_proc **p) {\n  int err = 0;\n  size_t length = 0;\n  static const int name[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0};\n\n  /* Call sysctl with a nullptr buffer to get proper length */\n  err = sysctl((int *)name, (sizeof(name) / sizeof(*name)) - 1, nullptr,\n               &length, nullptr, 0);\n  if (err != 0) {\n    perror(nullptr);\n    return (-1);\n  }\n\n  /* Allocate buffer */\n  *p = static_cast<kinfo_proc *>(malloc(length));\n  if (p == nullptr) {\n    perror(nullptr);\n    return (-1);\n  }\n\n  /* Get the actual process list */\n  err = sysctl((int *)name, (sizeof(name) / sizeof(*name)) - 1, *p, &length,\n               nullptr, 0);\n  if (err != 0) {\n    perror(nullptr);\n    return (-1);\n  }\n\n  int proc_count = length / sizeof(struct kinfo_proc);\n  return proc_count;\n}\n\n/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------\n *  macOS Swapfiles Logic...\n *\n *  o   There is NO separate partition for swap storage ( unlike most Unix-based\n *OSes ) --- Instead swap memory is stored in the currently used partition\n *inside files\n *\n *  o   macOS can use ALL the available space on the used partition\n *\n *  o   Swap memory files are called swapfiles, stored inside /private/var/vm/\n *\n *  o   Every swapfile has index number eg. swapfile0, swapfile1, ...\n *\n *  o   Anyone can change the location of the swapfiles by editing the plist:\n * /System/Library/LaunchDaemons/com.apple.dynamic_pager.plist ( Though it seems\n *like this is not supported by the dynamic_pager application as can be observed\n *from the code:\n *          https://github.com/practicalswift/osx/blob/master/src/system_cmds/dynamic_pager.tproj/dynamic_pager.c\n *) o   Every swapfile has size of 1GB\n *\n *-------------------------------------------------------------------------------------------------------------------------------------------------------------------\n */\nstatic int swapmode(unsigned long *retavail, unsigned long *retfree) {\n  /*\n   *  COMPATIBILITY:  Tiger+\n   */\n\n  int swapMIB[] = {CTL_VM, 5};\n  struct xsw_usage swapUsage {};\n  size_t swapUsageSize = sizeof(swapUsage);\n  memset(&swapUsage, 0, sizeof(swapUsage));\n  if (sysctl(swapMIB, 2, &swapUsage, &swapUsageSize, nullptr, 0) == 0) {\n    *retfree = swapUsage.xsu_avail / 1024;\n    *retavail = swapUsage.xsu_total / 1024;\n  } else {\n    perror(\"sysctl\");\n    return (-1);\n  }\n\n  return 1;\n}\n\nvoid prepare_update() {\n  // in freebsd.cc this is empty so leaving it here too!\n}\n\nint update_uptime() {\n  int mib[2] = {CTL_KERN, KERN_BOOTTIME};\n  struct timeval boottime {};\n  time_t now;\n  size_t size = sizeof(boottime);\n\n  if ((sysctl(mib, 2, &boottime, &size, nullptr, 0) != -1) &&\n      (boottime.tv_sec != 0)) {\n    time(&now);\n    info.uptime = now - boottime.tv_sec;\n  } else {\n    fprintf(stderr, \"could not get uptime\\n\");\n    info.uptime = 0;\n  }\n\n  return 0;\n}\n\n/*\n *  check_mount\n *\n *  Notes on macOS implementation:\n *  1.  path mustn't contain a '/' at the end! ( eg. /Volumes/MacOS/ is not\n * correct but this is correct: /Volumes/MacOS )\n *  2.  it works the same as the FreeBSD function\n */\nint check_mount(struct text_object *obj) {\n  int num_mounts = 0;\n  struct statfs *mounts;\n\n  if (obj->data.s == nullptr) { return 0; }\n\n  num_mounts = getmntinfo(&mounts, MNT_WAIT);\n\n  if (num_mounts < 0) {\n    NORM_ERR(\"could not get mounts using getmntinfo\");\n    return 0;\n  }\n\n  for (int i = 0; i < num_mounts; i++) {\n  }\n\n  return 0;\n}\n\n/*\n * required by update_pages_stolen().\n * Taken from apple's top.\n * The code is intact.\n */\n/* This is for <rdar://problem/6410098>. */\nstatic uint64_t round_down_wired(uint64_t value) {\n  return (value & ~((128 * 1024 * 1024ULL) - 1));\n}\n\n/*\n * must be called before libtop_tsamp_update_vm_stats()\n *  to calculate the pages_stolen variable.\n * Taken from apple's top.\n * The code is intact.\n */\n/* This is for <rdar://problem/6410098>. */\nstatic void update_pages_stolen(libtop_tsamp_t *tsamp) {\n  static int mib_reserved[CTL_MAXNAME];\n  static int mib_unusable[CTL_MAXNAME];\n  static int mib_other[CTL_MAXNAME];\n  static size_t mib_reserved_len = 0;\n  static size_t mib_unusable_len = 0;\n  static size_t mib_other_len = 0;\n  int r;\n\n  tsamp->pages_stolen = 0;\n\n  /* This can be used for testing: */\n  // tsamp->pages_stolen = (256 * 1024 * 1024ULL) / tsamp->pagesize;\n\n  if (0 == mib_reserved_len) {\n    mib_reserved_len = CTL_MAXNAME;\n\n    r = sysctlnametomib(\"machdep.memmap.Reserved\", mib_reserved,\n                        &mib_reserved_len);\n\n    if (-1 == r) {\n      mib_reserved_len = 0;\n      return;\n    }\n\n    mib_unusable_len = CTL_MAXNAME;\n\n    r = sysctlnametomib(\"machdep.memmap.Unusable\", mib_unusable,\n                        &mib_unusable_len);\n\n    if (-1 == r) {\n      mib_reserved_len = 0;\n      return;\n    }\n\n    mib_other_len = CTL_MAXNAME;\n\n    r = sysctlnametomib(\"machdep.memmap.Other\", mib_other, &mib_other_len);\n\n    if (-1 == r) {\n      mib_reserved_len = 0;\n      return;\n    }\n  }\n\n  if (mib_reserved_len > 0 && mib_unusable_len > 0 && mib_other_len > 0) {\n    uint64_t reserved = 0, unusable = 0, other = 0;\n    size_t reserved_len;\n    size_t unusable_len;\n    size_t other_len;\n\n    reserved_len = sizeof(reserved);\n    unusable_len = sizeof(unusable);\n    other_len = sizeof(other);\n\n    /* These are all declared as QUAD/uint64_t sysctls in the kernel. */\n\n    if (-1 == sysctl(mib_reserved, mib_reserved_len, &reserved, &reserved_len,\n                     nullptr, 0)) {\n      return;\n    }\n\n    if (-1 == sysctl(mib_unusable, mib_unusable_len, &unusable, &unusable_len,\n                     nullptr, 0)) {\n      return;\n    }\n\n    if (-1 ==\n        sysctl(mib_other, mib_other_len, &other, &other_len, nullptr, 0)) {\n      return;\n    }\n\n    if (reserved_len == sizeof(reserved) && unusable_len == sizeof(unusable) &&\n        other_len == sizeof(other)) {\n      uint64_t stolen = reserved + unusable + other;\n      uint64_t mb128 = 128 * 1024 * 1024ULL;\n\n      if (stolen >= mb128) {\n        tsamp->pages_stolen = round_down_wired(stolen) / tsamp->pagesize;\n      }\n    }\n  }\n}\n\n/**\n * libtop_tsamp_update_vm_stats\n *\n * taken from apple's top (libtop.c)\n * Changes for conky:\n *  - remove references to p_* and b_* named variables\n *  - remove reference to seq variable\n *  - libtop_port replaced with mach_host_self()\n */\nstatic int libtop_tsamp_update_vm_stats(libtop_tsamp_t *tsamp) {\n  kern_return_t kr;\n\n  mach_msg_type_number_t count = sizeof(tsamp->vm_stat) / sizeof(natural_t);\n  kr = host_statistics64(mach_host_self(), HOST_VM_INFO64,\n                         reinterpret_cast<host_info64_t>(&tsamp->vm_stat),\n                         &count);\n  if (kr != KERN_SUCCESS) { return kr; }\n\n  if (tsamp->pages_stolen > 0) {\n    tsamp->vm_stat.wire_count += tsamp->pages_stolen;\n  }\n\n  // Check whether we got purgeable memory statistics\n  tsamp->purgeable_is_valid = static_cast<boolean_t>(\n      count == (sizeof(tsamp->vm_stat) / sizeof(natural_t)));\n  if (tsamp->purgeable_is_valid == 0u) {\n    tsamp->vm_stat.purgeable_count = 0;\n    tsamp->vm_stat.purges = 0;\n  }\n\n  return kr;\n}\n\n/*\n * helper function for update_meminfo()\n * return physical memory in bytes\n */\nuint64_t get_physical_memory() {\n  int mib[2] = {CTL_HW, HW_MEMSIZE};\n\n  int64_t physical_memory = 0;\n  size_t length = sizeof(int64_t);\n\n  if (sysctl(mib, 2, &physical_memory, &length, nullptr, 0) == -1) {\n    physical_memory = 0;\n  }\n\n  return physical_memory;\n}\n\nint update_meminfo() {\n\n  /* XXX See #34 */\n\n  vm_size_t page_size = getpagesize();  // get pagesize in bytes\n  unsigned long swap_avail, swap_free;\n\n  static libtop_tsamp_t *tsamp = nullptr;\n  if (tsamp == nullptr) {\n    tsamp = new libtop_tsamp_t;\n    if (tsamp == nullptr) { return 0; }\n\n    memset(tsamp, 0, sizeof(libtop_tsamp_t));\n    tsamp->pagesize = page_size;\n  }\n\n  /* get physical memory */\n  uint64_t physical_memory = get_physical_memory() / 1024;\n  info.memmax = physical_memory;\n\n  /*\n   *  get general memory stats\n   *  but first update pages stolen count\n   */\n  update_pages_stolen(tsamp);\n  if (libtop_tsamp_update_vm_stats(tsamp) == KERN_FAILURE) { return 0; }\n\n  /*\n   * This is actually a tricky part.\n   *\n   * MenuMeters, Activity Monitor and top show different values.\n   * Our code uses top's implementation because:\n   *  - it is apple's tool\n   *  - professional projects such as osquery follow it\n   *  - Activity Monitor seems to be hiding the whole truth (e.g. for being user\n   * friendly)\n   *\n   * STEPS:\n   * - get stolen pages count\n   * Occasionally host_statistics64 doesn't return correct values (see\n   * https://stackoverflow.com/questions/14789672/why-does-host-statistics64-return-inconsistent-results)\n   * We need to get the count of stolen pages and add it to wired pages count.\n   * This is a known bug and apple has implemented the function\n   * update_pages_stolen().\n   *\n   * - use vm_stat.free_count instead of the sum of wired, active and inactive\n   * Based on\n   * https://stackoverflow.com/questions/63166/how-to-determine-cpu-and-memory-consumption-from-inside-a-process\n   *  summing up wired, active and inactive is what we should do BUT, based on\n   * top, this is incorrect. Seems like apple keeps some info \"secret\"!\n   */\n  info.mem = physical_memory - (tsamp->vm_stat.free_count * page_size / 1024);\n\n  /* rest memory related variables */\n  info.memwithbuffers = info.mem;\n  info.memeasyfree = info.memfree = info.memmax - info.mem;\n\n  if ((swapmode(&swap_avail, &swap_free)) >= 0) {\n    info.swapmax = swap_avail;\n    info.swap = (swap_avail - swap_free);\n    info.swapfree = swap_free;\n  } else {\n    info.swapmax = 0;\n    info.swap = 0;\n    info.swapfree = 0;\n  }\n\n  return 0;\n}\n\n#ifdef BUILD_WLAN\n\nvoid update_wlan_stats(struct net_stat *ns) {\n  CWWiFiClient *client = [CWWiFiClient sharedWiFiClient];\n  CWInterface *interface = [client interfaceWithName:[NSString stringWithUTF8String:ns->dev]];\n\n  if (!interface)\n    return;\n\n  const char *essid = (ns->up) ? [interface ssid].UTF8String : \"off/any\";\n  const char *freq = \"Unknown\";\n  const char *bitrate = [NSString stringWithFormat:@\"%f\", [interface transmitRate]].UTF8String;\n  const char *mode = \"Unknown\";\n  const char *ap = [interface hardwareAddress].UTF8String;\n\n  if (essid == nullptr || bitrate == nullptr || ap == nullptr)\n    return;\n\n  /*\n   * Freq\n   */\n  switch ([interface wlanChannel].channelBand) {\n    case kCWChannelBand2GHz:\n      freq = \"2 GHz\";\n      break;\n    case kCWChannelBand5GHz:\n      freq = \"5 GHz\";\n      break;\n    case kCWChannelBandUnknown:\n    default:\n      break;\n  }\n\n  /*\n   * Mode\n   */\n  switch ([interface interfaceMode]) {\n    case kCWInterfaceModeStation:\n      mode = \"Managed\";\n      break;\n    case kCWInterfaceModeIBSS:\n      mode = \"Ad-Hoc\";\n      break;\n    case kCWInterfaceModeHostAP:\n      mode = \"Master\";\n      break;\n    case kCWInterfaceModeNone:\n    default:\n      break;\n  }\n\n  /*\n   * Setup\n   */\n  memcpy(ns->essid, essid, sizeof(char)*strlen(essid));\n  ns->channel = interface.wlanChannel.channelNumber;\n  memcpy(ns->freq, freq, sizeof(char)*strlen(freq));\n  memcpy(ns->bitrate, bitrate, sizeof(char)*strlen(bitrate));\n  memcpy(ns->mode, mode, sizeof(char)*strlen(mode));\n  ns->link_qual = 0;\n  ns->link_qual_max = 0;\n  memcpy(ns->ap, ap, sizeof(char)*strlen(ap));\n}\n\n#endif /* BUILD_WLAN */\n\nint update_net_stats() {\n  struct net_stat *ns;\n  double delta;\n  long long r, t, last_recv, last_trans;\n  struct ifaddrs *ifap, *ifa;\n  struct if_data *ifd;\n\n  /* get delta */\n  delta = current_update_time - last_update_time;\n  if (delta <= 0.0001) { return 0; }\n\n  if (getifaddrs(&ifap) < 0) { return 0; }\n\n  for (ifa = ifap; ifa != nullptr; ifa = ifa->ifa_next) {\n    ns = get_net_stat((const char *)ifa->ifa_name, nullptr, nullptr);\n\n    if ((ifa->ifa_flags & IFF_UP) != 0u) {\n      struct ifaddrs *iftmp;\n\n#ifdef BUILD_WLAN\n      update_wlan_stats(ns);\n#endif\n\n      ns->up = 1;\n      last_recv = ns->recv;\n      last_trans = ns->trans;\n\n      if (ifa->ifa_addr->sa_family != AF_LINK) { continue; }\n\n      for (iftmp = ifa->ifa_next;\n           iftmp != nullptr && strcmp(ifa->ifa_name, iftmp->ifa_name) == 0;\n           iftmp = iftmp->ifa_next) {\n        if (iftmp->ifa_addr->sa_family == AF_INET) {\n          memcpy(&(ns->addr), iftmp->ifa_addr, iftmp->ifa_addr->sa_len);\n        }\n      }\n\n      ifd = static_cast<struct if_data *>(ifa->ifa_data);\n      r = ifd->ifi_ibytes;\n      t = ifd->ifi_obytes;\n\n      if (r < ns->last_read_recv) {\n        ns->recv +=\n            (static_cast<long long>(4294967295U) - ns->last_read_recv) + r;\n      } else {\n        ns->recv += (r - ns->last_read_recv);\n      }\n\n      ns->last_read_recv = r;\n\n      if (t < ns->last_read_trans) {\n        ns->trans +=\n            (static_cast<long long>(4294967295U) - ns->last_read_trans) + t;\n      } else {\n        ns->trans += (t - ns->last_read_trans);\n      }\n\n      ns->last_read_trans = t;\n\n      /* calculate speeds */\n      ns->recv_speed = (ns->recv - last_recv) / delta;\n      ns->trans_speed = (ns->trans - last_trans) / delta;\n    } else {\n      ns->up = 0;\n    }\n  }\n\n  freeifaddrs(ifap);\n  return 0;\n}\n\nint update_threads() {\n  helper_update_threads_processes();\n  return 0;\n}\n\n/*\n * XXX This seems to be wrong... We must first find the threads (using\n * thread_info() )\n *\n * Get list of all processes.\n * Foreach process check its state.\n * If it is RUNNING it means that it actually has some threads\n *  that are in TH_STATE_RUNNING.\n * Foreach pid and foreach pid's threads check their state and increment\n *  the run_threads counter accordingly.\n */\nint update_running_threads() {\n  struct kinfo_proc *p = nullptr;\n  int proc_count = 0;\n  int run_threads = 0;\n\n  proc_count = helper_get_proc_list(&p);\n\n  if (proc_count == -1) { return 0; }\n\n  for (int i = 0; i < proc_count; i++) {\n    if ((p[i].kp_proc.p_stat & SRUN) != 0) {\n      pid_t pid = 0;\n      struct proc_taskinfo pti {};\n      struct proc_threadinfo pthi {};\n      int num_threads = 0;\n\n      pid = p[i].kp_proc.p_pid;\n\n      /* get total number of threads this pid has */\n      if (sizeof(pti) ==\n          proc_pidinfo(pid, PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {\n        num_threads = pti.pti_threadnum;\n      } else {\n        continue;\n      }\n\n      /* foreach thread check its state */\n      for (int i = 0; i < num_threads; i++) {\n        if (sizeof(pthi) ==\n            proc_pidinfo(pid, PROC_PIDTHREADINFO, i, &pthi, sizeof(pthi))) {\n          if (pthi.pth_run_state == TH_STATE_RUNNING) { run_threads++; }\n        } else {\n          continue;\n        }\n      }\n    }\n  }\n\n  free(p);\n  info.run_threads = run_threads;\n  return 0;\n}\n\nint update_total_processes() {\n  helper_update_threads_processes();\n  return 0;\n\n  /*\n   *  WARNING: You may stumble upon this implementation:\n   *  https://stackoverflow.com/questions/8141913/is-there-a-lightweight-way-to-obtain-the-current-number-of-processes-in-linux\n   *\n   *  This method DOESN'T find the correct number of tasks.\n   *\n   *  This is probably (??) because on macOS there is no option for\n   *  KERN_PROC_KTHREAD like there is in FreeBSD\n   *\n   *  In FreeBSD's sysctl.h we can see the following:\n   *\n   *  KERN_PROC_KTHREAD   all processes (user-level plus kernel threads)\n   *  KERN_PROC_ALL       all user-level processes\n   *  KERN_PROC_PID       processes with process ID arg\n   *  KERN_PROC_PGRP      processes with process group arg\n   *  KERN_PROC_SESSION   processes with session arg\n   *  KERN_PROC_TTY       processes with tty(4) arg\n   *  KERN_PROC_UID       processes with effective user ID arg\n   *  KERN_PROC_RUID      processes with real user ID arg\n   *\n   *  Though in macOS's sysctl.h there are only:\n   *\n   *  KERN_PROC_ALL        everything\n   *  KERN_PROC_PID        by process id\n   *  KERN_PROC_PGRP      by process group id\n   *  KERN_PROC_SESSION    by session of pid\n   *  KERN_PROC_TTY        by controlling tty\n   *  KERN_PROC_UID        by effective uid\n   *  KERN_PROC_RUID      by real uid\n   *  KERN_PROC_LCID      by login context id\n   *\n   *  Probably by saying \"everything\" they mean that KERN_PROC_ALL gives all\n   *  processes (user-level plus kernel threads) ( So basically this is the\n   *  problem with the old implementation )\n   */\n}\n\nint update_running_processes() {\n  struct kinfo_proc *p = nullptr;\n  int proc_count = 0;\n  int run_procs = 0;\n\n  proc_count = helper_get_proc_list(&p);\n\n  if (proc_count == -1) { return 0; }\n\n  for (int i = 0; i < proc_count; i++) {\n    int state = p[i].kp_proc.p_stat;\n\n    if (state == SRUN) {  // XXX this check needs to be fixed...\n      run_procs++;\n    }\n  }\n\n  free(p);\n  info.run_procs = run_procs;\n  return 0;\n}\n\n/*\n * get_cpu_count\n *\n * The macOS implementation gets the number of active cpus\n * in compliance with linux implementation.\n */\nvoid get_cpu_count() {\n  int cpu_count = 0;\n\n  if (GETSYSCTL(\"hw.activecpu\", cpu_count) == 0) {\n    info.cpu_count = cpu_count;\n  } else {\n    fprintf(stderr, \"Cannot get hw.activecpu\\n\");\n    info.cpu_count = 0;\n  }\n\n  if (info.cpu_usage == nullptr) {\n    /*\n     * Allocate ncpus+1 slots because cpu_usage[0] is overall usage.\n     */\n    info.cpu_usage =\n        static_cast<float *>(malloc((info.cpu_count + 1) * sizeof(float)));\n    if (info.cpu_usage == nullptr) { CRIT_ERR(\"malloc\"); }\n  }\n}\n\n/*\n * used by update_cpu_usage()\n */\nstruct cpu_info {\n  long oldtotal;\n  long oldused;\n};\n\nint update_cpu_usage() {\n  static bool cpu_setup = 0;\n\n  long used, total;\n  static struct cpu_info *cpu = nullptr;\n  unsigned int malloc_cpu_size = 0;\n  extern void *global_cpu;\n\n  static struct cpusample *sample = nullptr;\n\n  static pthread_mutex_t last_stat_update_mutex = PTHREAD_MUTEX_INITIALIZER;\n  static double last_stat_update = 0.0;\n\n  /* since we use wrappers for this function, the update machinery\n   * can't eliminate double invocations of this function. Check for\n   * them here, otherwise cpu_usage counters are freaking out. */\n  pthread_mutex_lock(&last_stat_update_mutex);\n  if (last_stat_update == current_update_time) {\n    pthread_mutex_unlock(&last_stat_update_mutex);\n    return 0;\n  }\n  last_stat_update = current_update_time;\n  pthread_mutex_unlock(&last_stat_update_mutex);\n\n  /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */\n  if ((static_cast<int>(cpu_setup) == 0) || (info.cpu_usage == nullptr)) {\n    get_cpu_count();\n    cpu_setup = 1;\n  }\n\n  if (global_cpu == nullptr) {\n    /*\n     * Allocate ncpus+1 slots because cpu_usage[0] is overall usage.\n     */\n    malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info);\n    cpu = static_cast<cpu_info *>(malloc(malloc_cpu_size));\n    memset(cpu, 0, malloc_cpu_size);\n    global_cpu = cpu;\n  }\n\n  allocate_cpu_sample(&sample);\n\n  get_cpu_sample(&sample);\n\n  /*\n   * Setup conky's structs for-each core\n   */\n  for (unsigned int i = 1; i < info.cpu_count + 1; i++) {\n    unsigned int j = i - 1;\n\n    total = sample[i].totalUserTime + sample[i].totalIdleTime + sample[i].totalSystemTime;\n    used = total - sample[i].totalIdleTime;\n\n    if ((total - cpu[j].oldtotal) != 0) {\n      info.cpu_usage[j] = (static_cast<double>(used - cpu[j].oldused)) /\n      static_cast<double>(total - cpu[j].oldtotal);\n    } else {\n      info.cpu_usage[j] = 0;\n    }\n\n    cpu[j].oldused = used;\n    cpu[j].oldtotal = total;\n  }\n\n  return 0;\n}\n\nint update_load_average() {\n  double v[3];\n\n  getloadavg(v, 3);\n\n  info.loadavg[0] = v[0];\n  info.loadavg[1] = v[1];\n  info.loadavg[2] = v[2];\n\n  return 0;\n}\n\ndouble get_acpi_temperature(int /*fd*/) {\n  printf(\"get_acpi_temperature: STUB\\n\");\n  return 0.0;\n}\n\nvoid get_battery_stuff(char * /*buf*/, unsigned int /*n*/, const char * /*bat*/,\n                       int /*item*/) {\n  printf(\"get_battery_stuff: STUB\\n\");\n}\n\nint get_battery_perct(const char * /*bat*/) {\n  printf(\"get_battery_perct: STUB\\n\");\n  return 1;\n}\n\nvoid get_battery_power_draw(char * /*buffer*/, unsigned int /*n*/, const char * /*bat*/) {\n  printf(\"get_battery_power_draw: STUB\\n\");\n}\n\ndouble get_battery_perct_bar(struct text_object * /*obj*/) {\n  printf(\"get_battery_perct_bar: STUB\\n\");\n  return 0.0;\n}\n\nint open_acpi_temperature(const char *name) {\n  printf(\"open_acpi_temperature: STUB\\n\");\n\n  (void)name;\n  /* Not applicable for FreeBSD. */\n  return 0;\n}\n\nvoid get_acpi_ac_adapter(char * /*p_client_buffer*/,\n                         size_t /*client_buffer_size*/,\n                         const char * /*adapter*/) {\n  printf(\"get_acpi_ac_adapter: STUB\\n\");\n}\n\nvoid get_acpi_fan(char * /*p_client_buffer*/, size_t /*client_buffer_size*/) {\n  printf(\"get_acpi_fan: STUB\\n\");\n}\n\n/* void */\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  (void)cpu;\n\n  if ((p_client_buffer == nullptr) || client_buffer_size <= 0 ||\n      (p_format == nullptr) || divisor <= 0) {\n    return 0;\n  }\n\n#ifdef BUILD_IPGFREQ\n  /*\n   * Our data is always the same for every core, so ignore |cpu| argument.\n   */\n\n  static bool initialised = false;\n\n  if (!initialised) {\n    IntelEnergyLibInitialize();\n    initialised = true;\n  }\n\n  int freq = 0;\n  GetIAFrequency(cpu, &freq);\n\n  snprintf(p_client_buffer, client_buffer_size, p_format,\n           static_cast<float>(freq) / divisor);\n#else\n  /*\n   * We get the factory cpu frequency, not **current** cpu frequency\n   * (Also, it is always the same for every core, so ignore |cpu| argument)\n   * Enable BUILD_IPGFREQ for getting current frequency.\n   */\n\n  int mib[2];\n  unsigned int freq;\n  size_t len;\n\n  mib[0] = CTL_HW;\n  mib[1] = HW_CPU_FREQ;\n  len = sizeof(freq);\n\n  if (sysctl(mib, 2, &freq, &len, nullptr, 0) == 0) {\n    /*\n     * convert to MHz\n     */\n    divisor *= 1000000;\n\n    snprintf(p_client_buffer, client_buffer_size, p_format,\n             static_cast<float>(freq) / divisor);\n  } else {\n    snprintf(p_client_buffer, client_buffer_size, p_format, 0.0f);\n    return 0;\n  }\n#endif\n\n  return 1;\n}\n\nint update_diskio() {\n  printf(\"update_diskio: STUB\\n\");\n  return 0;\n}\n\nvoid get_battery_short_status(char * /*buffer*/, unsigned int /*n*/,\n                              const char * /*bat*/) {\n  printf(\"get_battery_short_status: STUB\\n\");\n}\n\nint get_entropy_avail(const unsigned int *val) {\n  (void)val;\n  return 1;\n}\nint get_entropy_poolsize(const unsigned int *val) {\n  (void)val;\n  return 1;\n}\n\n/******************************************\n *          get top info section          *\n ******************************************/\n\n/*\n * Calculate a process' cpu usage percentage\n */\nstatic void calc_cpu_usage_for_proc(struct process *proc, uint64_t total) {\n  float mul = 100.0;\n  if (top_cpu_separate.get(*state)) { mul *= info.cpu_count; }\n\n  if (total == 0) {\n    proc->amount = 0.0f;\n    return;\n  }\n\n  proc->amount =\n      mul * (proc->user_time + proc->kernel_time) / static_cast<float>(total);\n}\n\n/*\n * calculate total CPU usage based on total CPU usage\n * of previous iteration stored inside |process| struct\n */\nstatic void calc_cpu_total(struct process *proc, uint64_t *total) {\n  uint64_t current_total = 0; /* of current iteration */\n  struct cpusample *sample = nullptr;\n\n  allocate_cpu_sample(&sample);\n\n  get_cpu_sample(&sample);\n  current_total =\n      sample[0].totalUserTime + sample[0].totalIdleTime + sample[0].totalSystemTime;\n\n  uint64_t delta = cpu_total_delta(current_total, &proc->previous_total_cpu_time);\n\n  if (delta == 0) {\n    *total = 0;\n    return;\n  }\n\n  *total = (delta / sysconf(_SC_CLK_TCK)) * 100;\n}\n\n/*\n * calc_cpu_time_for_proc\n *\n * calculates user_time and kernel_time and sets the contents of the |process|\n * struct excessively based on process_parse_stat() from linux.cc\n */\nstatic void calc_cpu_time_for_proc(struct process *process,\n                                   const struct proc_taskinfo *pti) {\n  unsigned long long user_time = 0;\n  unsigned long long kernel_time = 0;\n\n  process->user_time = mach_ticks_to_centis_system(pti->pti_total_user);\n  process->kernel_time = mach_ticks_to_centis_system(pti->pti_total_system);\n\n  process->total_cpu_time = process->user_time + process->kernel_time;\n  if (process->previous_user_time == ULONG_MAX) {\n    process->previous_user_time = process->user_time;\n  }\n  if (process->previous_kernel_time == ULONG_MAX) {\n    process->previous_kernel_time = process->kernel_time;\n  }\n\n  /* store the difference of the user_time */\n  user_time = process->user_time - process->previous_user_time;\n  kernel_time = process->kernel_time - process->previous_kernel_time;\n\n  /* backup the process->user_time for next time around */\n  process->previous_user_time = process->user_time;\n  process->previous_kernel_time = process->kernel_time;\n\n  /* store only the difference of the user_time here... */\n  process->user_time = user_time;\n  process->kernel_time = kernel_time;\n}\n\n/*\n * finds top-information only for one process which is represented by a\n * kinfo_proc struct this function is called multiple types ( one foreach\n * process ) to implement get_top_info()\n */\nstatic void get_top_info_for_kinfo_proc(struct kinfo_proc *p) {\n  struct process *proc = nullptr;\n  struct proc_taskinfo pti {};\n  pid_t pid;\n\n  pid = p->kp_proc.p_pid;\n  proc = get_process(pid);\n\n  free_and_zero(proc->name);\n  free_and_zero(proc->basename);\n\n  proc->name = strndup(p->kp_proc.p_comm, text_buffer_size.get(*state));\n  proc->basename = strndup(p->kp_proc.p_comm, text_buffer_size.get(*state));\n  proc->uid = p->kp_eproc.e_pcred.p_ruid;\n  proc->time_stamp = g_time;\n\n  if (sizeof(pti) ==\n      proc_pidinfo(pid, PROC_PIDTASKINFO, 0, &pti, sizeof(pti))) {\n    /* vsize, rss are in bytes thus we dont have to convert */\n    proc->vsize = pti.pti_virtual_size;\n    proc->rss = pti.pti_resident_size;\n\n    __block uint64_t t = 0;\n\n    __block bool calc_cpu_total_finished = false;\n    __block bool calc_proc_total_finished = false;\n\n    dispatch_async(\n        dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n          /* calc CPU time for process */\n          calc_cpu_time_for_proc(proc, &pti);\n\n          calc_proc_total_finished = true;\n        });\n\n    dispatch_async(\n        dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n          /* calc total CPU time (considering current process) */\n          calc_cpu_total(proc, &t);\n\n          calc_cpu_total_finished = true;\n        });\n\n    /*\n     * wait until done\n     */\n    while (!(calc_cpu_total_finished && calc_proc_total_finished)) { usleep(500); }\n\n    /* calc the amount(%) of CPU the process used  */\n    calc_cpu_usage_for_proc(proc, t);\n  }\n}\n\n/* While topless is obviously better, top is also not bad. */\n\nvoid get_top_info() {\n  int proc_count = 0;\n  struct kinfo_proc *p = nullptr;\n\n  /*\n   * See #16\n   */\n  get_cpu_count();\n\n  /*\n   *  get processes count\n   *  and create the processes list\n   */\n  proc_count = helper_get_proc_list(&p);\n\n  if (proc_count == -1) { return; }\n\n  /*\n   *  get top info for-each process\n   */\n  for (int i = 0; i < proc_count; i++) {\n    if ((((p[i].kp_proc.p_flag & P_SYSTEM)) == 0) &&\n        *p[i].kp_proc.p_comm != '\\0') {\n      get_top_info_for_kinfo_proc(&p[i]);\n    }\n  }\n\n  free(p);\n}\n\n/*********************************************************************************************\n *                                  System Integrity Protection *\n *********************************************************************************************/\n\n#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_9)\n\n/*\n *  Check if a flag is enabled based on the csr_config variable\n *  Also, flip the result on occasion\n */\nbool _csr_check(int aMask, bool aFlipflag) {\n  bool bit = (info.csr_config & aMask) != 0u;\n\n  if (aFlipflag) { return !bit; }\n\n  return bit;\n}\n\n/*\n *  Extract info from the csr_config variable and set the flags struct\n */\nvoid fill_csr_config_flags_struct() {\n  info.csr_config_flags.csr_allow_apple_internal =\n      _csr_check(CSR_ALLOW_APPLE_INTERNAL, 0);\n  info.csr_config_flags.csr_allow_untrusted_kexts =\n      _csr_check(CSR_ALLOW_UNTRUSTED_KEXTS, 1);\n  info.csr_config_flags.csr_allow_task_for_pid =\n      _csr_check(CSR_ALLOW_TASK_FOR_PID, 1);\n  info.csr_config_flags.csr_allow_unrestricted_fs =\n      _csr_check(CSR_ALLOW_UNRESTRICTED_FS, 1);\n  info.csr_config_flags.csr_allow_kernel_debugger =\n      _csr_check(CSR_ALLOW_KERNEL_DEBUGGER, 1);\n  info.csr_config_flags.csr_allow_unrestricted_dtrace =\n      _csr_check(CSR_ALLOW_UNRESTRICTED_DTRACE, 1);\n  info.csr_config_flags.csr_allow_unrestricted_nvram =\n      _csr_check(CSR_ALLOW_UNRESTRICTED_NVRAM, 1);\n  info.csr_config_flags.csr_allow_device_configuration =\n      _csr_check(CSR_ALLOW_DEVICE_CONFIGURATION, 0);\n  info.csr_config_flags.csr_allow_any_recovery_os =\n      _csr_check(CSR_ALLOW_ANY_RECOVERY_OS, 1);\n  info.csr_config_flags.csr_allow_user_approved_kexts =\n      _csr_check(CSR_ALLOW_UNAPPROVED_KEXTS, 1);\n}\n\n/*\n *  Get SIP configuration   ( sets csr_config and csr_config_flags )\n */\nint get_sip_status() {\n  if (csr_get_active_config ==\n      nullptr) /*  check if weakly linked symbol exists    */\n  {\n    NORM_ERR(\"$sip_status will not work on this version of macOS\\n\");\n    return 0;\n  }\n\n  csr_get_active_config(&info.csr_config);\n  fill_csr_config_flags_struct();\n\n  return 0;\n}\n\n/*\n *  Prints SIP status or a specific SIP feature status depending on the argument\n *  passed to $sip_status command\n *\n *  Variables that can be passed to $sip_status command\n *\n *  nothing --> print enabled / disabled\n *  0   --> apple internal\n *  1   --> forbid untrusted kexts\n *  2   --> forbid task-for-pid\n *  3   --> restrict filesystem\n *  4   --> forbid kernel-debugger\n *  5   --> restrict dtrace\n *  6   --> restrict nvram\n *  7   --> forbid device-configuration\n *  8   --> forbid any-recovery-os\n *  9   --> forbid user-approved-kexts\n *  a   --> check if unsupported configuration  ---> this is not an apple SIP\n *  flag. This is for us.\n *\n *  The print function is designed to show 'YES' if a specific protection\n *  measure is ENABLED. For example, if SIP is configured to disallow untrusted\n *  kexts, then our function will print 'YES'.\n *\n *  For this reason, your conkyrc should say for example: Untrusted Kexts\n *  Protection: ${sip_status 1} You should not write: \"Allow Untrusted Kexts\",\n *  this is wrong.\n */\nvoid print_sip_status(struct text_object *obj, char *p, unsigned int p_max_size) {\n  if (csr_get_active_config ==\n      nullptr) /*  check if weakly linked symbol exists    */\n  {\n    snprintf(p, p_max_size, \"%s\", \"unsupported\");\n    NORM_ERR(\"$sip_status will not work on this version of macOS\\n\");\n    return;\n  }\n\n  /* conky window output */\n  (void)obj;\n\n  if (obj->data.s == nullptr) { return; }\n\n  if (strlen(obj->data.s) == 0) {\n    snprintf(p, p_max_size, \"%s\",\n             (info.csr_config == CSR_VALID_FLAGS) ? \"disabled\" : \"enabled\");\n  } else if (strlen(obj->data.s) == 1) {\n    switch (obj->data.s[0]) {\n      case '0':\n        snprintf(p, p_max_size, \"%s\",\n                 info.csr_config_flags.csr_allow_apple_internal ? \"YES\" : \"NO\");\n        break;\n      case '1':\n        snprintf(\n            p, p_max_size, \"%s\",\n            info.csr_config_flags.csr_allow_untrusted_kexts ? \"YES\" : \"NO\");\n        break;\n      case '2':\n        snprintf(p, p_max_size, \"%s\",\n                 info.csr_config_flags.csr_allow_task_for_pid ? \"YES\" : \"NO\");\n        break;\n      case '3':\n        snprintf(\n            p, p_max_size, \"%s\",\n            info.csr_config_flags.csr_allow_unrestricted_fs ? \"YES\" : \"NO\");\n        break;\n      case '4':\n        snprintf(\n            p, p_max_size, \"%s\",\n            info.csr_config_flags.csr_allow_kernel_debugger ? \"YES\" : \"NO\");\n        break;\n      case '5':\n        snprintf(\n            p, p_max_size, \"%s\",\n            info.csr_config_flags.csr_allow_unrestricted_dtrace ? \"YES\" : \"NO\");\n        break;\n      case '6':\n        snprintf(\n            p, p_max_size, \"%s\",\n            info.csr_config_flags.csr_allow_unrestricted_nvram ? \"YES\" : \"NO\");\n        break;\n      case '7':\n        snprintf(p, p_max_size, \"%s\",\n                 info.csr_config_flags.csr_allow_device_configuration ? \"YES\"\n                                                                      : \"NO\");\n        break;\n      case '8':\n        snprintf(\n            p, p_max_size, \"%s\",\n            info.csr_config_flags.csr_allow_any_recovery_os ? \"YES\" : \"NO\");\n        break;\n      case '9':\n        snprintf(\n            p, p_max_size, \"%s\",\n            info.csr_config_flags.csr_allow_user_approved_kexts ? \"YES\" : \"NO\");\n        break;\n      case 'a':\n        snprintf(p, p_max_size, \"%s\",\n                 ((info.csr_config != 0u) &&\n                  (info.csr_config != CSR_ALLOW_APPLE_INTERNAL))\n                     ? \"unsupported configuration, beware!\"\n                     : \"configuration is ok\");\n        break;\n      default:\n        snprintf(p, p_max_size, \"%s\", \"unsupported\");\n        NORM_ERR(\n            \"print_sip_status: unsupported argument passed to $sip_status\");\n        break;\n    }\n  } else { /* bad argument */\n    snprintf(p, p_max_size, \"%s\", \"unsupported\");\n    NORM_ERR(\"print_sip_status: unsupported argument passed to $sip_status\");\n  }\n}\n\n#else /* Mavericks and before */\n/*\n * Versions prior to Yosemite DONT EVEN DEFINE csr_get_active_config()\n * function.  Thus we must avoid calling this function!\n */\n\nint get_sip_status(void) {\n  /* Does not do anything intentionally */\n  return 0;\n}\n\nvoid print_sip_status(struct text_object *obj, char *p, int p_max_size) {\n  /* conky window output */\n  (void)obj;\n\n  if (!obj->data.s) return;\n\n  if (strlen(obj->data.s) == 0) {\n    snprintf(p, p_max_size, \"%s\", \"error unsupported\");\n  } else if (strlen(obj->data.s) == 1) {\n    switch (obj->data.s[0]) {\n      case '0':\n      case '1':\n      case '2':\n      case '3':\n      case '4':\n      case '5':\n      case '6':\n      case '7':\n      case '8':\n      case '9':\n      case 'a':\n        snprintf(p, p_max_size, \"%s\", \"error unsupported\");\n        break;\n      default:\n        snprintf(p, p_max_size, \"%s\", \"unsupported\");\n        NORM_ERR(\n            \"print_sip_status: unsupported argument passed to $sip_status\");\n        break;\n    }\n  } else { /* bad argument */\n    snprintf(p, p_max_size, \"%s\", \"unsupported\");\n    NORM_ERR(\"print_sip_status: unsupported argument passed to $sip_status\");\n  }\n}\n\n#endif\n"
  },
  {
    "path": "src/data/os/darwin_sip.h",
    "content": "/*\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2018-2019, npyl <n.pylarinos@hotmail.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n//\n//  Defines for System Integrity Protection monitoring\n//      based on csrstat tool by Pike R. Alpha.\n//      https://github.com/Piker-Alpha/csrstat\n//\n\n#ifndef DARWIN_SIP_H\n#define DARWIN_SIP_H\n\n/* Rootless configuration flags */\n#define CSR_ALLOW_UNTRUSTED_KEXTS (1 << 0)       // 1\n#define CSR_ALLOW_UNRESTRICTED_FS (1 << 1)       // 2\n#define CSR_ALLOW_TASK_FOR_PID (1 << 2)          // 4\n#define CSR_ALLOW_KERNEL_DEBUGGER (1 << 3)       // 8\n#define CSR_ALLOW_APPLE_INTERNAL (1 << 4)        // 16\n#define CSR_ALLOW_UNRESTRICTED_DTRACE (1 << 5)   // 32\n#define CSR_ALLOW_UNRESTRICTED_NVRAM (1 << 6)    // 64\n#define CSR_ALLOW_DEVICE_CONFIGURATION (1 << 7)  // 128\n#define CSR_ALLOW_ANY_RECOVERY_OS (1 << 8)       // 256\n#define CSR_ALLOW_UNAPPROVED_KEXTS (1 << 9)      // 512\n\n#define CSR_VALID_FLAGS                                            \\\n  (CSR_ALLOW_UNTRUSTED_KEXTS | CSR_ALLOW_UNRESTRICTED_FS |         \\\n   CSR_ALLOW_TASK_FOR_PID | CSR_ALLOW_KERNEL_DEBUGGER |            \\\n   CSR_ALLOW_APPLE_INTERNAL | CSR_ALLOW_UNRESTRICTED_DTRACE |      \\\n   CSR_ALLOW_UNRESTRICTED_NVRAM | CSR_ALLOW_DEVICE_CONFIGURATION | \\\n   CSR_ALLOW_ANY_RECOVERY_OS | CSR_ALLOW_UNAPPROVED_KEXTS)\n\n/* Syscalls */\n// mark these symbols as weakly linked, as they may not be available\n// at runtime on older OS X versions.\nextern \"C\" {\nint csr_get_active_config(information::csr_config_t* config)\n    __attribute__((weak_import));\n};\n\n#endif\n"
  },
  {
    "path": "src/data/os/darwin_top_helpers.cc",
    "content": "/*\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"darwin_top_helpers.h\"\n\n#include <mach/mach_time.h>\n\nvoid reset_cpu_sample_overall(struct cpusample *sample) {\n  if (sample == nullptr) { return; }\n\n  sample[0].totalUserTime = 0;\n  sample[0].totalSystemTime = 0;\n  sample[0].totalIdleTime = 0;\n}\n\nvoid sum_cpu_sample_overall(struct cpusample *sample, size_t processorCount) {\n  if (sample == nullptr) { return; }\n\n  reset_cpu_sample_overall(sample);\n\n  for (size_t i = 1; i < processorCount + 1; i++) {\n    sample[0].totalSystemTime += sample[i].totalSystemTime;\n    sample[0].totalUserTime += sample[i].totalUserTime;\n    sample[0].totalIdleTime += sample[i].totalIdleTime;\n  }\n}\n\nuint64_t cpu_total_delta(uint64_t current_total,\n                         unsigned long *previous_total_cpu_time) {\n  if (previous_total_cpu_time == nullptr) { return 0; }\n\n  if (*previous_total_cpu_time == ULONG_MAX) {\n    *previous_total_cpu_time = current_total;\n    return 0;\n  }\n\n  uint64_t delta = current_total - *previous_total_cpu_time;\n  *previous_total_cpu_time = current_total;\n  return delta;\n}\n\nuint64_t mach_ticks_to_centis(uint64_t ticks, uint32_t numer, uint32_t denom) {\n  if (ticks == 0 || denom == 0) { return 0; }\n\n  unsigned __int128 ns = static_cast<unsigned __int128>(ticks) * numer;\n  ns /= denom;\n  return static_cast<uint64_t>(ns / 10000000ULL);\n}\n\nuint64_t mach_ticks_to_centis_system(uint64_t ticks) {\n  static bool initialized = false;\n  static mach_timebase_info_data_t timebase{};\n\n  if (!initialized) {\n    (void)mach_timebase_info(&timebase);\n    initialized = true;\n  }\n\n  return mach_ticks_to_centis(ticks, timebase.numer, timebase.denom);\n}\n"
  },
  {
    "path": "src/data/os/darwin_top_helpers.h",
    "content": "/*\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef CONKY_DARWIN_TOP_HELPERS_H\n#define CONKY_DARWIN_TOP_HELPERS_H\n\n#include <climits>\n#include <cstddef>\n#include <cstdint>\n\n/*\n * useful info about the cpu used by functions such as update_cpu_usage() and\n * get_top_info()\n */\nstruct cpusample {\n  uint64_t totalUserTime;   /* ticks of CPU in userspace */\n  uint64_t totalSystemTime; /* ticks of CPU in kernelspace */\n  uint64_t totalIdleTime;   /* ticks in idleness */\n\n  uint64_t total;          /* delta of current and previous */\n  uint64_t current_total;  /* total CPU ticks of current iteration */\n  uint64_t previous_total; /* total CPU tick of previous iteration */\n};\n\nvoid reset_cpu_sample_overall(struct cpusample *sample);\nvoid sum_cpu_sample_overall(struct cpusample *sample, size_t processorCount);\nuint64_t cpu_total_delta(uint64_t current_total,\n                         unsigned long *previous_total_cpu_time);\nuint64_t mach_ticks_to_centis(uint64_t ticks, uint32_t numer, uint32_t denom);\nuint64_t mach_ticks_to_centis_system(uint64_t ticks);\n\n#endif /* CONKY_DARWIN_TOP_HELPERS_H */\n"
  },
  {
    "path": "src/data/os/dragonfly.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2011 Andrea Magliano <masterblaster@tiscali.it>\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n\n#include <kinfo_pcpu.h>\n#include <sys/ioctl.h>\n#include <sys/param.h>\n#include <sys/resource.h>\n#include <sys/socket.h>\n#include <sys/stat.h>\n#include <sys/sysctl.h>\n#include <sys/time.h>\n#include <sys/types.h>\n#include <sys/user.h>\n\n#include <net/if.h>\n#include <net/if_media.h>\n#include <net/if_mib.h>\n#include <net/if_var.h>\n\n#include <devstat.h>\n#include <ifaddrs.h>\n#include <limits.h>\n#include <pthread.h>\n#include <unistd.h>\n\n#include <dev/acpica/acpiio.h>\n\n#include \"../../conky.h\"\n#include \"../hardware/diskio.h\"\n#include \"dragonfly.h\"\n#include \"../../logging.h\"\n#include \"../network/net_stat.h\"\n#include \"../top.h\"\n\n#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))\n#define KELVTOC(x) ((x - 2732) / 10.0)\n#define MAXSHOWDEVS 16\n\nstatic short cpu_setup = 0;\n\nstatic int getsysctl(const char *name, void *ptr, size_t len) {\n  size_t nlen = len;\n\n  if (sysctlbyname(name, ptr, &nlen, nullptr, 0) == -1) {\n    fprintf(stderr, \"getsysctl(): %s failed '%s'\\n\", name, strerror(errno));\n    return -1;\n  }\n\n  if (nlen != len && errno == ENOMEM) {\n    fprintf(stderr, \"getsysctl(): %s failed %zu != %zu\\n\", name, nlen, len);\n    return -1;\n  }\n\n  return 0;\n}\n\nstatic int swapmode(unsigned long *retavail, unsigned long *retfree) {\n  int total, used;\n  size_t len = sizeof(int);\n\n  if (sysctlbyname(\"vm.swap_size\", &total, &len, nullptr, 0) == -1)\n    perror(\"vm_swap_usage(): vm.swap_size\");\n  else if (sysctlbyname(\"vm.swap_anon_use\", &used, &len, nullptr, 0) == -1)\n    perror(\"vm_swap_usage(): vm.swap_anon_use\");\n  else {\n    int size = getpagesize();\n\n#define CONVERT(v) ((quad_t)(v) * (size / 1024))\n\n    *retavail = CONVERT(total);\n    *retfree = CONVERT(total - used);\n\n    return (int)((double)used * 100.0 / (double)total);\n  }\n  return 0;\n}\n\nvoid prepare_update(void) {}\n\nint update_uptime(void) {\n  int mib[2] = {CTL_KERN, KERN_BOOTTIME};\n  struct timeval boottime;\n  time_t now;\n  size_t size = sizeof(boottime);\n\n  if ((sysctl(mib, 2, &boottime, &size, nullptr, 0) != -1) && boottime.tv_sec) {\n    time(&now);\n    info.uptime = now - boottime.tv_sec;\n  } else {\n    fprintf(stderr, \"Could not get uptime\\n\");\n    info.uptime = 0;\n  }\n\n  return 0;\n}\n\nint check_mount(char *s) {\n  struct statfs *mntbuf;\n  int i, mntsize;\n\n  mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);\n  for (i = mntsize - 1; i >= 0; i--) {\n    if (strcmp(mntbuf[i].f_mntonname, s) == 0) { return 1; }\n  }\n\n  return 0;\n}\n\nint update_meminfo(void) {\n  u_int total_pages, inactive_pages, free_pages;\n  unsigned long swap_avail, swap_free;\n\n  int pagesize = getpagesize();\n\n  if (GETSYSCTL(\"vm.stats.vm.v_page_count\", total_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_page_count\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vm.stats.vm.v_free_count\", free_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_free_count\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vm.stats.vm.v_inactive_count\", inactive_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_inactive_count\\\"\\n\");\n  }\n\n  info.memmax = total_pages * (pagesize >> 10);\n  info.mem = (total_pages - free_pages - inactive_pages) * (pagesize >> 10);\n  info.memeasyfree = info.memfree = info.memmax - info.mem;\n  info.legacymem = info.mem;\n\n  if ((swapmode(&swap_avail, &swap_free)) >= 0) {\n    info.swapmax = swap_avail;\n    info.swap = (swap_avail - swap_free);\n    info.swapfree = swap_free;\n  } else {\n    info.swapmax = 0;\n    info.swap = 0;\n    info.swapfree = 0;\n  }\n\n  return 0;\n}\n\nint update_net_stats(void) {\n  struct net_stat *ns;\n  double delta;\n  long long r, t, last_recv, last_trans;\n  struct ifaddrs *ifap, *ifa;\n  struct if_data *ifd;\n\n  /* get delta */\n  delta = current_update_time - last_update_time;\n  if (delta <= 0.0001) { return 0; }\n\n  if (getifaddrs(&ifap) < 0) { return 0; }\n\n  for (ifa = ifap; ifa; ifa = ifa->ifa_next) {\n    ns = get_net_stat((const char *)ifa->ifa_name, nullptr, NULL);\n\n    if (ifa->ifa_flags & IFF_UP) {\n      struct ifaddrs *iftmp;\n\n      ns->up = 1;\n      last_recv = ns->recv;\n      last_trans = ns->trans;\n\n      if (ifa->ifa_addr->sa_family != AF_LINK) { continue; }\n\n      for (iftmp = ifa->ifa_next;\n           iftmp != nullptr && strcmp(ifa->ifa_name, iftmp->ifa_name) == 0;\n           iftmp = iftmp->ifa_next) {\n        if (iftmp->ifa_addr->sa_family == AF_INET) {\n          memcpy(&(ns->addr), iftmp->ifa_addr, iftmp->ifa_addr->sa_len);\n        }\n      }\n\n      ifd = (struct if_data *)ifa->ifa_data;\n      r = ifd->ifi_ibytes;\n      t = ifd->ifi_obytes;\n\n      if (r < ns->last_read_recv) {\n        ns->recv += ((long long)4294967295U - ns->last_read_recv) + r;\n      } else {\n        ns->recv += (r - ns->last_read_recv);\n      }\n\n      ns->last_read_recv = r;\n\n      if (t < ns->last_read_trans) {\n        ns->trans += ((long long)4294967295U - ns->last_read_trans) + t;\n      } else {\n        ns->trans += (t - ns->last_read_trans);\n      }\n\n      ns->last_read_trans = t;\n\n      /* calculate speeds */\n      ns->recv_speed = (ns->recv - last_recv) / delta;\n      ns->trans_speed = (ns->trans - last_trans) / delta;\n    } else {\n      ns->up = 0;\n    }\n  }\n\n  freeifaddrs(ifap);\n  return 0;\n}\n\nstatic int kern_proc_all_n() {\n  size_t len = 0;\n\n  if (sysctlbyname(\"kern.proc.all_lwp\", nullptr, &len, NULL, 0) == -1) {\n    perror(\"kern.proc.all_lwp\");\n    return -1;\n  }\n\n  if (len % sizeof(struct kinfo_proc)) {\n    fprintf(stderr,\n            \"kern_proc(): \"\n            \"len %% sizeof(struct kinfo_proc) != 0\");\n    return -1;\n  }\n\n  return len / sizeof(struct kinfo_proc);\n}\n\nstatic struct kinfo_proc *kern_proc_all(size_t proc_n) {\n  if (proc_n > 0) {\n    size_t len = proc_n * sizeof(struct kinfo_proc);\n    struct kinfo_proc *kp = (struct kinfo_proc *)malloc(len);\n\n    if (kp) {\n      if (sysctlbyname(\"kern.proc.all_lwp\", kp, &len, nullptr, 0) == -1)\n        perror(\"kern_proc(): kern.proc.all_lwp\");\n      else\n        return kp;\n      free(kp);\n    } else\n      perror(\"malloc\");\n  }\n  return nullptr;\n}\n\nvoid get_cpu_count(void) {\n  int cpu_count = 0;\n\n  if (GETSYSCTL(\"hw.ncpu\", cpu_count) == 0) {\n    info.cpu_count = cpu_count;\n  } else {\n    fprintf(stderr, \"Cannot get hw.ncpu\\n\");\n    info.cpu_count = 0;\n  }\n\n  info.cpu_usage = (float *)malloc((info.cpu_count + 1) * sizeof(float));\n  if (info.cpu_usage == nullptr) { CRIT_ERR(\"malloc\"); }\n}\n\nstruct cpu_info {\n  long oldtotal;\n  long oldused;\n};\n\nPCPU_STATISTICS_FUNC(cputime, struct kinfo_cputime, uint64_t);\n\nstatic void stat_cpu(struct cpu_info *cpu, struct kinfo_cputime *percpu,\n                     float *usage) {\n  long int used = (percpu->cp_user + percpu->cp_nice + percpu->cp_sys +\n                   percpu->cp_intr),\n           total = used + percpu->cp_idle;\n\n  *usage = (total - cpu->oldtotal) && cpu->oldtotal\n               ? ((float)(used - cpu->oldused)) / (total - cpu->oldtotal)\n               : 0;\n\n  cpu->oldused = used;\n  cpu->oldtotal = total;\n}\n\nint update_cpu_usage(void) {\n  static struct cpu_info *cpu = nullptr;\n  extern void *global_cpu;\n\n  /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */\n  if ((cpu_setup == 0) || (!info.cpu_usage)) {\n    get_cpu_count();\n    cpu_setup = 1;\n  }\n\n  if (!global_cpu) {\n    if (!cpu)\n      cpu = (struct cpu_info *)calloc(sizeof(struct cpu_info),\n                                      info.cpu_count + 1);\n    global_cpu = cpu;\n  }\n\n  {\n    size_t percpu_n = info.cpu_count * sizeof(struct kinfo_cputime);\n    struct kinfo_cputime *percpu = (struct kinfo_cputime *)malloc(\n        info.cpu_count * sizeof(struct kinfo_cputime));\n\n    if (percpu) {\n      if (sysctlbyname(\"kern.cputime\", percpu, &percpu_n, nullptr, 0) == -1 &&\n          errno != ENOMEM) {\n        printf(\"update_cpu_usage(): with %d cpu(s) \", info.cpu_count);\n        perror(\"kern.cputime\");\n      } else {\n        struct kinfo_cputime total;\n        cputime_pcpu_statistics(&percpu[0], &total, info.cpu_count);\n\n        {\n          int i;\n          for (i = 0; i < info.cpu_count; i++)\n            stat_cpu(&cpu[i + 1], &percpu[i], &info.cpu_usage[i + 1]);\n        }\n        stat_cpu(&cpu[0], &total, &info.cpu_usage[0]);\n      }\n      free(percpu);\n    }\n  }\n\n  return 0;\n}\n\nvoid free_cpu(struct text_object *) { /* no-op */\n}\n\nint update_load_average(void) {\n  double v[3];\n\n  getloadavg(v, 3);\n\n  info.loadavg[0] = (double)v[0];\n  info.loadavg[1] = (double)v[1];\n  info.loadavg[2] = (double)v[2];\n\n  return 0;\n}\n\ndouble get_acpi_temperature(int fd) {\n  int temp;\n  (void)fd;\n\n  if (GETSYSCTL(\"hw.acpi.thermal.tz0.temperature\", temp)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.thermal.tz0.temperature\\\"\\n\");\n    return 0.0;\n  }\n\n  return KELVTOC(temp);\n}\n\nstatic void get_battery_stats(int *battime, int *batcapacity, int *batstate,\n                              int *ac) {\n  if (battime && GETSYSCTL(\"hw.acpi.battery.time\", *battime)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.battery.time\\\"\\n\");\n  }\n  if (batcapacity && GETSYSCTL(\"hw.acpi.battery.life\", *batcapacity)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.battery.life\\\"\\n\");\n  }\n  if (batstate && GETSYSCTL(\"hw.acpi.battery.state\", *batstate)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.battery.state\\\"\\n\");\n  }\n  if (ac && GETSYSCTL(\"hw.acpi.acline\", *ac)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.acline\\\"\\n\");\n  }\n}\n\nvoid get_battery_stuff(char *buf, unsigned int n, const char *bat, int item) {\n  int battime, batcapacity, batstate, ac;\n  (void)bat;\n\n  get_battery_stats(&battime, &batcapacity, &batstate, &ac);\n\n  if (batstate != 1 && batstate != 2 && batstate != 0 && batstate != 7)\n    fprintf(stderr, \"Unknown battery state %d!\\n\", batstate);\n  else if (batstate != 1 && ac == 0)\n    fprintf(stderr, \"Battery charging while not on AC!\\n\");\n  else if (batstate == 1 && ac == 1)\n    fprintf(stderr, \"Battery discharing while on AC!\\n\");\n\n  switch (item) {\n    case BATTERY_TIME:\n      if (batstate == 1 && battime != -1)\n        snprintf(buf, n, \"%d:%2.2d\", battime / 60, battime % 60);\n      break;\n    case BATTERY_STATUS:\n      if (batstate == 1)  // Discharging\n        snprintf(buf, n, \"remaining %d%%\", batcapacity);\n      else\n        snprintf(buf, n,\n                 batstate == 2\n                     ? \"charging (%d%%)\"\n                     : (batstate == 7 ? \"absent/on AC\" : \"charged (%d%%)\"),\n                 batcapacity);\n      break;\n    default:\n      fprintf(stderr, \"Unknown requested battery stat %d\\n\", item);\n  }\n}\n\nstatic int check_bat(const char *bat) {\n  int batnum, numbatts;\n  char *endptr;\n  if (GETSYSCTL(\"hw.acpi.battery.units\", numbatts)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.battery.units\\\"\\n\");\n    return -1;\n  }\n  if (numbatts <= 0) {\n    fprintf(stderr, \"No battery unit detected\\n\");\n    return -1;\n  }\n  if (!bat || (batnum = strtol(bat, &endptr, 10)) < 0 || bat == endptr ||\n      batnum > numbatts) {\n    fprintf(stderr, \"Wrong battery unit %s requested\\n\", bat ? bat : \"\");\n    return -1;\n  }\n  return batnum;\n}\n\nint get_battery_perct(const char *bat) {\n  union acpi_battery_ioctl_arg battio;\n  int batnum, acpifd;\n  int designcap, lastfulcap, batperct;\n\n  if ((battio.unit = batnum = check_bat(bat)) < 0) return 0;\n  if ((acpifd = open(\"/dev/acpi\", O_RDONLY)) < 0) {\n    fprintf(stderr, \"Can't open ACPI device\\n\");\n    return 0;\n  }\n  if (ioctl(acpifd, ACPIIO_BATT_GET_BIF, &battio) == -1) {\n    fprintf(stderr, \"Unable to get info for battery unit %d\\n\", batnum);\n    return 0;\n  }\n  close(acpifd);\n  designcap = battio.bif.dcap;\n  lastfulcap = battio.bif.lfcap;\n  batperct = (designcap > 0 && lastfulcap > 0)\n                 ? (((float)lastfulcap / designcap) * 100)\n                 : 0;\n  return batperct > 100 ? 100 : batperct;\n}\n\ndouble get_battery_perct_bar(struct text_object *obj) {\n  int batperct = get_battery_perct(obj->data.s);\n  return batperct * 2.56 - 1;\n}\n\nint open_acpi_temperature(const char *name) {\n  (void)name;\n  /* Not applicable for FreeBSD. */\n  return 0;\n}\n\nvoid get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,\n                         const char *adapter) {\n  int state;\n\n  (void)adapter;  // only linux uses this\n\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  if (GETSYSCTL(\"hw.acpi.acline\", state)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.acline\\\"\\n\");\n    return;\n  }\n\n  if (state) {\n    strncpy(p_client_buffer, \"Running on AC Power\", client_buffer_size);\n  } else {\n    strncpy(p_client_buffer, \"Running on battery\", client_buffer_size);\n  }\n}\n\nvoid get_acpi_fan(char *p_client_buffer, size_t client_buffer_size) {\n  /* not implemented */\n  if (p_client_buffer && client_buffer_size > 0) {\n    memset(p_client_buffer, 0, client_buffer_size);\n  }\n}\n\n/* void */\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  int64_t freq;\n\n  if (p_client_buffer && client_buffer_size > 0 && p_format && divisor > 0) {\n    if (GETSYSCTL(\"hw.tsc_frequency\", freq) == 0) {\n      snprintf(p_client_buffer, client_buffer_size, p_format,\n               (float)freq / (divisor * 1000000));\n    } else {\n      snprintf(p_client_buffer, client_buffer_size, p_format, 0.0f);\n    }\n    return 1;\n  }\n  return 0;\n}\n\n#if 0\nvoid update_wifi_stats(void)\n{\n\tstruct ifreq ifr;\t\t/* interface stats */\n\tstruct wi_req wireq;\n\tstruct net_stat *ns;\n\tstruct ifaddrs *ifap, *ifa;\n\tstruct ifmediareq ifmr;\n\tint s;\n\n\t/* Get iface table */\n\tif (getifaddrs(&ifap) < 0) {\n\t\treturn;\n\t}\n\n\tfor (ifa = ifap; ifa; ifa = ifa->ifa_next) {\n\t\tns = get_net_stat((const char *) ifa->ifa_name, nullptr, NULL);\n\n\t\ts = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);\n\n\t\t/* Get media type */\n\t\tbzero(&ifmr, sizeof(ifmr));\n\t\tstrlcpy(ifmr.ifm_name, ifa->ifa_name, IFNAMSIZ);\n\t\tif (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) {\n\t\t\tclose(s);\n\t\t\treturn;\n\t\t}\n\n\t\t/* We can monitor only wireless interfaces\n\t\t * which are not in hostap mode */\n\t\tif ((ifmr.ifm_active & IFM_IEEE80211)\n\t\t\t\t&& !(ifmr.ifm_active & IFM_IEEE80211_HOSTAP)) {\n\t\t\t/* Get wi status */\n\t\t\tbzero(&ifr, sizeof(ifr));\n\t\t\tstrlcpy(ifr.ifr_name, ifa->ifa_name, IFNAMSIZ);\n\t\t\twireq.wi_type = WI_RID_COMMS_QUALITY;\n\t\t\twireq.wi_len = WI_MAX_DATALEN;\n\t\t\tifr.ifr_data = (void *) &wireq;\n\n\t\t\tif (ioctl(s, SIOCGWAVELAN, (caddr_t) &ifr) < 0) {\n\t\t\t\tperror(\"ioctl (getting wi status)\");\n\t\t\t\texit(1);\n\t\t\t}\n\n\t\t\t/* wi_val[0] = quality\n\t\t\t * wi_val[1] = signal\n\t\t\t * wi_val[2] = noise */\n\t\t\tns->linkstatus = (int) wireq.wi_val[1];\n\t\t}\ncleanup:\n\t\tclose(s);\n\t}\n}\n#endif\n\nint update_diskio(void) {\n  int devs_count, num_selected, num_selections, dn;\n  struct device_selection *dev_select = nullptr;\n  long select_generation;\n  static struct statinfo statinfo_cur;\n  char device_name[DEFAULT_TEXT_BUFFER_SIZE];\n  struct diskio_stat *cur;\n  unsigned int reads, writes;\n  unsigned int total_reads = 0, total_writes = 0;\n\n  memset(&statinfo_cur, 0, sizeof(statinfo_cur));\n  statinfo_cur.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo));\n  stats.current = stats.current_read = stats.current_write = 0;\n\n  if (getdevs(&statinfo_cur) < 0) {\n    free(statinfo_cur.dinfo);\n    return 0;\n  }\n\n  devs_count = statinfo_cur.dinfo->numdevs;\n  if (selectdevs(&dev_select, &num_selected, &num_selections,\n                 &select_generation, statinfo_cur.dinfo->generation,\n                 statinfo_cur.dinfo->devices, devs_count, nullptr, 0, NULL, 0,\n                 DS_SELECT_ONLY, MAXSHOWDEVS, 1) >= 0) {\n    for (dn = 0; dn < devs_count; dn++) {\n      int di;\n      struct devstat *dev;\n\n      di = dev_select[dn].position;\n      dev = &statinfo_cur.dinfo->devices[di];\n      snprintf(device_name, DEFAULT_TEXT_BUFFER_SIZE, \"%s%d\",\n               dev_select[dn].device_name, dev_select[dn].unit_number);\n\n      total_reads += (reads = dev->bytes_read / 512);\n      total_writes += (writes = dev->bytes_written / 512);\n      for (cur = stats.next; cur; cur = cur->next) {\n        if (cur->dev && !strcmp(device_name, cur->dev)) {\n          update_diskio_values(cur, reads, writes);\n          break;\n        }\n      }\n    }\n    update_diskio_values(&stats, total_reads, total_writes);\n\n    free(dev_select);\n  }\n\n  free(statinfo_cur.dinfo);\n  return 0;\n}\n\nstatic int proc_rusage(struct kinfo_proc *p) {\n  struct kinfo_lwp *lwp = &p->kp_lwp;\n  struct rusage *cru = &p->kp_cru;\n\n  return (lwp->kl_uticks + lwp->kl_sticks + lwp->kl_iticks) +\n         (cru->ru_stime.tv_sec + cru->ru_utime.tv_sec) * 1000000;\n}\n\nstatic void proc_count(struct kinfo_proc *kp, size_t proc_n) {\n  size_t i, act = 0, run = 0;\n\n  for (i = 0; i < proc_n; i++) {\n    struct kinfo_proc *p = &kp[i];\n\n    if (!(p->kp_flags & P_SYSTEM)) {\n      struct kinfo_lwp *lwp = &p->kp_lwp;\n\n      if (!lwp->kl_tid) act++;\n      if (lwp->kl_stat == LSRUN) run++;\n    }\n  }\n\n  info.procs = act;\n  info.run_procs = run;\n}\n\nstatic void proc_fill(struct kinfo_proc *kp, size_t proc_n) {\n  size_t i, f = getpagesize();\n  static long prev_ticks = 0; /* safe as long as in same thread */\n\n  for (i = 0; i < proc_n; i++) {\n    struct kinfo_proc *p = &kp[i];\n    struct kinfo_lwp *lwp = &p->kp_lwp;\n\n    if (!(p->kp_flags & P_SYSTEM) && p->kp_comm &&\n        *p->kp_comm &&  /* just to be sure */\n        !lwp->kl_tid) { /* 'main' lwp, the real process (observed) */\n\n      struct process *my = get_process(p->kp_pid);\n      long ticks = proc_rusage(p);\n\n      my->time_stamp = g_time;\n\n      free_and_zero(my->name);\n      my->name = strdup(p->kp_comm);\n\n      my->amount = 100.0 * lwp->kl_pctcpu / FSCALE;\n      my->vsize = p->kp_vm_map_size;\n      my->rss = p->kp_vm_rssize * f;\n\n      my->total_cpu_time = ticks - prev_ticks;\n      prev_ticks = ticks;\n\n      // printf(\"\\tmy[%p]: %s(%u) %d %d 0x%x 0x%x %f\\n\", p,\n      //        my->name, my->pid, my->vsize, my->rss,\n      // \t   p->kp_flags, lwp->kl_stat, my->amount);\n    }\n  }\n}\n\nvoid get_top_info(void) {\n  size_t proc_n = kern_proc_all_n();\n  struct kinfo_proc *kp = kern_proc_all(proc_n);\n\n  if (kp) {\n    proc_count(kp, proc_n);\n    proc_fill(kp, proc_n);\n    free(kp);\n  }\n}\n\n#if defined(i386) || defined(__i386__)\n#define APMDEV \"/dev/apm\"\n#define APM_UNKNOWN 255\n\nint apm_getinfo(int fd, apm_info_t aip) {\n  if (ioctl(fd, APMIO_GETINFO, aip) == -1) { return -1; }\n\n  return 0;\n}\n\nchar *get_apm_adapter(void) {\n  int fd;\n  struct apm_info a_info;\n  char *out;\n\n  out = (char *)calloc(16, sizeof(char));\n\n  fd = open(APMDEV, O_RDONLY);\n  if (fd < 0) {\n    strncpy(out, \"ERR\", 16);\n    return out;\n  }\n\n  if (apm_getinfo(fd, &a_info) != 0) {\n    close(fd);\n    strncpy(out, \"ERR\", 16);\n    return out;\n  }\n  close(fd);\n\n  switch (a_info.ai_acline) {\n    case 0:\n      strncpy(out, \"off-line\", 16);\n      return out;\n      break;\n    case 1:\n      if (a_info.ai_batt_stat == 3) {\n        strncpy(out, \"charging\", 16);\n        return out;\n      } else {\n        strncpy(out, \"on-line\", 16);\n        return out;\n      }\n      break;\n    default:\n      strncpy(out, \"unknown\", 16);\n      return out;\n      break;\n  }\n}\n\nchar *get_apm_battery_life(void) {\n  int fd;\n  u_int batt_life;\n  struct apm_info a_info;\n  char *out;\n\n  out = (char *)calloc(16, sizeof(char));\n\n  fd = open(APMDEV, O_RDONLY);\n  if (fd < 0) {\n    strncpy(out, \"ERR\", 16);\n    return out;\n  }\n\n  if (apm_getinfo(fd, &a_info) != 0) {\n    close(fd);\n    strncpy(out, \"ERR\", 16);\n    return out;\n  }\n  close(fd);\n\n  batt_life = a_info.ai_batt_life;\n  if (batt_life == APM_UNKNOWN) {\n    strncpy(out, \"unknown\", 16);\n  } else if (batt_life <= 100) {\n    snprintf(out, 16, \"%d%%\", batt_life);\n    return out;\n  } else {\n    strncpy(out, \"ERR\", 16);\n  }\n\n  return out;\n}\n\nchar *get_apm_battery_time(void) {\n  int fd;\n  int batt_time;\n  int h, m, s;\n  struct apm_info a_info;\n  char *out;\n\n  out = (char *)calloc(16, sizeof(char));\n\n  fd = open(APMDEV, O_RDONLY);\n  if (fd < 0) {\n    strncpy(out, \"ERR\", 16);\n    return out;\n  }\n\n  if (apm_getinfo(fd, &a_info) != 0) {\n    close(fd);\n    strncpy(out, \"ERR\", 16);\n    return out;\n  }\n  close(fd);\n\n  batt_time = a_info.ai_batt_time;\n\n  if (batt_time == -1) {\n    strncpy(out, \"unknown\", 16);\n  } else {\n    h = batt_time;\n    s = h % 60;\n    h /= 60;\n    m = h % 60;\n    h /= 60;\n    snprintf(out, 16, \"%2d:%02d:%02d\", h, m, s);\n  }\n\n  return out;\n}\n\n#endif\n\nvoid get_battery_short_status(char *buffer, unsigned int n, const char *bat) {\n  get_battery_stuff(buffer, n, bat, BATTERY_STATUS);\n  if (0 == strncmp(\"charging\", buffer, 8)) {\n    buffer[0] = 'C';\n    memmove(buffer + 1, buffer + 8, n - 8);\n  } else if (0 == strncmp(\"discharging\", buffer, 11)) {\n    buffer[0] = 'D';\n    memmove(buffer + 1, buffer + 11, n - 11);\n  } else if (0 == strncmp(\"absent/on AC\", buffer, 12)) {\n    buffer[0] = 'A';\n    memmove(buffer + 1, buffer + 12, n - 12);\n  }\n}\n\nint get_entropy_avail(unsigned int *val) {\n  /* Not applicable for FreeBSD as it uses the yarrow prng. */\n  (void)val;\n  return 1;\n}\n\nint get_entropy_poolsize(unsigned int *val) {\n  /* Not applicable for FreeBSD as it uses the yarrow prng. */\n  (void)val;\n  return 1;\n}\n"
  },
  {
    "path": "src/data/os/dragonfly.h",
    "content": "/* */\n\n#ifndef DRAGONFLY_H_\n#define DRAGONFLY_H_\n\n#include <fcntl.h>\n#include <kvm.h>\n#include <sys/mount.h>\n#include <sys/param.h>\n#include <sys/ucred.h>\n#include \"../../common.h\"\n#if (defined(i386) || defined(__i386__))\n#include <machine/apm_bios.h>\n#endif /* i386 || __i386__ */\n\nint get_entropy_avail(unsigned int *);\nint get_entropy_poolsize(unsigned int *);\n\n#endif /*DRAGONFLY_H_*/\n"
  },
  {
    "path": "src/data/os/freebsd.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"config.h\"\n\n#include <sys/dkstat.h>\n#include <sys/ioctl.h>\n#include <sys/param.h>\n#include <sys/resource.h>\n#include <sys/socket.h>\n#include <sys/stat.h>\n#include <sys/sysctl.h>\n#include <sys/time.h>\n#include <sys/types.h>\n#include <sys/user.h>\n\n#include <net/if.h>\n#include <net/if_media.h>\n#include <net/if_mib.h>\n#include <net/if_var.h>\n\n#include <devstat.h>\n#include <ifaddrs.h>\n#include <limits.h>\n#include <paths.h>\n#include <unistd.h>\n\n#include <dev/acpica/acpiio.h>\n#if 0\n#include <dev/wi/if_wavelan_ieee.h>\n#endif\n\n#include <mutex>\n\n#include \"../../conky.h\"\n#include \"../hardware/diskio.h\"\n#include \"freebsd.h\"\n#include \"../../logging.h\"\n#include \"../network/net_stat.h\"\n#include \"../../content/text_object.h\"\n#include \"../top.h\"\n\n#define GETSYSCTL(name, var) getsysctl(name, &(var), sizeof(var))\n#define KELVTOC(x) ((x - 2732) / 10.0)\n#define MAXSHOWDEVS 16\n\n#if 0\n#define FREEBSD_DEBUG\n#endif\n\nkvm_t *kd;\nstd::mutex kvm_proc_mutex;\n\n__attribute__((gnu_inline)) inline void proc_find_top(struct process **cpu,\n                                                      struct process **mem,\n                                                      struct process **time);\n\nstatic short conky_cpu_setup = 0;\n\nstatic int getsysctl(const char *name, void *ptr, size_t len) {\n  size_t nlen = len;\n\n  if (sysctlbyname(name, ptr, &nlen, nullptr, 0) == -1) { return -1; }\n\n  if (nlen != len && errno == ENOMEM) { return -1; }\n\n  return 0;\n}\n\nstruct ifmibdata *data = nullptr;\nsize_t len = 0;\n\nstatic int swapmode(unsigned long *retavail, unsigned long *retfree) {\n  int n;\n  unsigned long pagesize = getpagesize();\n  struct kvm_swap swapary[1];\n\n  *retavail = 0;\n  *retfree = 0;\n\n#define CONVERT(v) ((quad_t)(v) * (pagesize / 1024))\n\n  n = kvm_getswapinfo(kd, swapary, 1, 0);\n  if (n < 0 || swapary[0].ksw_total == 0) { return 0; }\n\n  *retavail = CONVERT(swapary[0].ksw_total);\n  *retfree = CONVERT(swapary[0].ksw_total - swapary[0].ksw_used);\n\n  n = (int)((double)swapary[0].ksw_used * 100.0 / (double)swapary[0].ksw_total);\n\n  return n;\n}\n\nvoid prepare_update(void) {}\n\nint update_uptime(void) {\n  int mib[2] = {CTL_KERN, KERN_BOOTTIME};\n  struct timeval boottime;\n  time_t now;\n  size_t size = sizeof(boottime);\n\n  if ((sysctl(mib, 2, &boottime, &size, nullptr, 0) != -1) &&\n      (boottime.tv_sec != 0)) {\n    time(&now);\n    info.uptime = now - boottime.tv_sec;\n  } else {\n    fprintf(stderr, \"Could not get uptime\\n\");\n    info.uptime = 0;\n  }\n\n  return 0;\n}\n\nint check_mount(struct text_object *obj) {\n  struct statfs *mntbuf;\n  int i, mntsize;\n\n  if (!obj->data.s) return 0;\n\n  mntsize = getmntinfo(&mntbuf, MNT_NOWAIT);\n  for (i = mntsize - 1; i >= 0; i--) {\n    if (strcmp(mntbuf[i].f_mntonname, obj->data.s) == 0) { return 1; }\n  }\n\n  return 0;\n}\n\nint update_meminfo(void) {\n  u_int total_pages, inactive_pages, free_pages, wire_pages, active_pages,\n      bufferspace, laundry_pages;\n  unsigned long swap_avail, swap_free;\n\n  int pagesize = getpagesize();\n\n  if (GETSYSCTL(\"vm.stats.vm.v_page_count\", total_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_page_count\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vm.stats.vm.v_free_count\", free_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_free_count\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vm.stats.vm.v_inactive_count\", inactive_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_inactive_count\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vm.stats.vm.v_wire_count\", wire_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_wire_count\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vm.stats.vm.v_active_count\", active_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_active_count\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vfs.bufspace\", bufferspace)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vfs.bufspace\\\"\\n\");\n  }\n\n  if (GETSYSCTL(\"vm.stats.vm.v_laundry_count\", laundry_pages)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"vm.stats.vm.v_laundry_count\\\"\\n\");\n  }\n\n  info.memmax = total_pages * (pagesize >> 10);\n  info.mem = (total_pages - free_pages - inactive_pages) * (pagesize >> 10);\n  info.memwithbuffers = info.mem;\n  info.memeasyfree = info.memmax - info.mem;\n  info.memfree = free_pages * (pagesize >> 10);\n  info.legacymem = info.mem;\n  info.memwired = wire_pages * (pagesize >> 10);\n  info.memactive = active_pages * (pagesize >> 10);\n  info.meminactive = inactive_pages * (pagesize >> 10);\n  info.memlaundry = laundry_pages * (pagesize >> 10);\n  info.buffers = bufferspace / 1024;\n\n  if ((swapmode(&swap_avail, &swap_free)) >= 0) {\n    info.swapmax = swap_avail;\n    info.swap = (swap_avail - swap_free);\n    info.swapfree = swap_free;\n  } else {\n    info.swapmax = 0;\n    info.swap = 0;\n    info.swapfree = 0;\n  }\n\n  return 0;\n}\n\nint update_net_stats(void) {\n  struct net_stat *ns;\n  double delta;\n  long long r, t, last_recv, last_trans;\n  struct ifaddrs *ifap, *ifa;\n  struct if_data *ifd;\n\n  /* get delta */\n  delta = current_update_time - last_update_time;\n  if (delta <= 0.0001) { return 0; }\n\n  if (getifaddrs(&ifap) < 0) { return 0; }\n\n  for (ifa = ifap; ifa; ifa = ifa->ifa_next) {\n    ns = get_net_stat((const char *)ifa->ifa_name, nullptr, NULL);\n\n    if (ifa->ifa_flags & IFF_UP) {\n      struct ifaddrs *iftmp;\n\n      ns->up = 1;\n      last_recv = ns->recv;\n      last_trans = ns->trans;\n\n      if (ifa->ifa_addr->sa_family != AF_LINK) { continue; }\n\n      for (iftmp = ifa->ifa_next;\n           iftmp != nullptr && strcmp(ifa->ifa_name, iftmp->ifa_name) == 0;\n           iftmp = iftmp->ifa_next) {\n        if (iftmp->ifa_addr->sa_family == AF_INET) {\n          memcpy(&(ns->addr), iftmp->ifa_addr, iftmp->ifa_addr->sa_len);\n        }\n      }\n\n      ifd = (struct if_data *)ifa->ifa_data;\n      r = ifd->ifi_ibytes;\n      t = ifd->ifi_obytes;\n\n      if (r < ns->last_read_recv) {\n        ns->recv += ((long long)4294967295U - ns->last_read_recv) + r;\n      } else {\n        ns->recv += (r - ns->last_read_recv);\n      }\n\n      ns->last_read_recv = r;\n\n      if (t < ns->last_read_trans) {\n        ns->trans += ((long long)4294967295U - ns->last_read_trans) + t;\n      } else {\n        ns->trans += (t - ns->last_read_trans);\n      }\n\n      ns->last_read_trans = t;\n\n      /* calculate speeds */\n      ns->recv_speed = (ns->recv - last_recv) / delta;\n      ns->trans_speed = (ns->trans - last_trans) / delta;\n    } else {\n      ns->up = 0;\n    }\n  }\n\n  freeifaddrs(ifap);\n  return 0;\n}\n\nint update_total_processes(void) {\n  int n_processes;\n\n  std::lock_guard<std::mutex> guard(kvm_proc_mutex);\n  kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);\n\n  info.procs = n_processes;\n  return 0;\n}\n\nint update_running_processes(void) {\n  struct kinfo_proc *p;\n  int n_processes;\n  int i, cnt = 0;\n\n  std::lock_guard<std::mutex> guard(kvm_proc_mutex);\n  p = kvm_getprocs(kd, KERN_PROC_ALL, 0, &n_processes);\n  for (i = 0; i < n_processes; i++) {\n    if (p[i].ki_stat == SRUN) { cnt++; }\n  }\n\n  info.run_procs = cnt;\n  return 0;\n}\n\nvoid get_cpu_count(void) {\n  int cpu_count = 0;\n\n  if (GETSYSCTL(\"hw.ncpu\", cpu_count) == 0) {\n    info.cpu_count = cpu_count;\n  } else {\n    fprintf(stderr, \"Cannot get hw.ncpu\\n\");\n    info.cpu_count = 0;\n  }\n\n  info.cpu_usage = (float *)malloc((info.cpu_count + 1) * sizeof(float));\n  if (info.cpu_usage == nullptr) { CRIT_ERR(\"malloc\"); }\n}\n\nstruct cpu_info {\n  long oldtotal;\n  long oldused;\n};\n\nint update_cpu_usage(void) {\n  int i, j = 0;\n  long used, total;\n  long *cp_time = nullptr;\n  size_t cp_len;\n  static struct cpu_info *cpu = nullptr;\n  unsigned int malloc_cpu_size = 0;\n  extern void *global_cpu;\n\n  /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */\n  if ((conky_cpu_setup == 0) || (!info.cpu_usage)) {\n    get_cpu_count();\n    conky_cpu_setup = 1;\n  }\n\n  if (!global_cpu) {\n    malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info);\n    cpu = (cpu_info *)malloc(malloc_cpu_size);\n    memset(cpu, 0, malloc_cpu_size);\n    global_cpu = cpu;\n  }\n\n  /* cpu[0] is overall stats, get it from separate sysctl */\n  cp_len = CPUSTATES * sizeof(long);\n  cp_time = (long int *)malloc(cp_len);\n\n  if (sysctlbyname(\"kern.cp_time\", cp_time, &cp_len, nullptr, 0) < 0) {\n    fprintf(stderr, \"Cannot get kern.cp_time\\n\");\n  }\n\n  total = 0;\n  for (j = 0; j < CPUSTATES; j++) total += cp_time[j];\n\n  used = total - cp_time[CP_IDLE];\n\n  if ((total - cpu[0].oldtotal) != 0) {\n    info.cpu_usage[0] =\n        ((double)(used - cpu[0].oldused)) / (double)(total - cpu[0].oldtotal);\n  } else {\n    info.cpu_usage[0] = 0;\n  }\n\n  cpu[0].oldused = used;\n  cpu[0].oldtotal = total;\n\n  free(cp_time);\n\n  /* per-core stats */\n  cp_len = CPUSTATES * sizeof(long) * info.cpu_count;\n  cp_time = (long int *)malloc(cp_len);\n\n  /* on e.g. i386 SMP we may have more values than actual cpus; this will just\n   * drop extra values */\n  if (sysctlbyname(\"kern.cp_times\", cp_time, &cp_len, nullptr, 0) < 0 &&\n      errno != ENOMEM) {\n    fprintf(stderr, \"Cannot get kern.cp_times\\n\");\n  }\n\n  for (i = 0; i < (int)info.cpu_count; i++) {\n    total = 0;\n    for (j = 0; j < CPUSTATES; j++) total += cp_time[i * CPUSTATES + j];\n\n    used = total - cp_time[i * CPUSTATES + CP_IDLE];\n\n    if ((total - cpu[i + 1].oldtotal) != 0) {\n      info.cpu_usage[i + 1] = ((double)(used - cpu[i + 1].oldused)) /\n                              (double)(total - cpu[i + 1].oldtotal);\n    } else {\n      info.cpu_usage[i + 1] = 0;\n    }\n\n    cpu[i + 1].oldused = used;\n    cpu[i + 1].oldtotal = total;\n  }\n\n  free(cp_time);\n  return 0;\n}\n\nvoid free_cpu(struct text_object *) { /* no-op */\n}\n\nint update_load_average(void) {\n  double v[3];\n\n  getloadavg(v, 3);\n\n  info.loadavg[0] = (double)v[0];\n  info.loadavg[1] = (double)v[1];\n  info.loadavg[2] = (double)v[2];\n\n  return 0;\n}\n\ndouble get_acpi_temperature(int fd) {\n  int temp;\n  (void)fd;\n\n  if (GETSYSCTL(\"hw.acpi.thermal.tz0.temperature\", temp) == 0) {\n    return KELVTOC(temp);\n  } else if (GETSYSCTL(\"dev.cpu.0.temperature\", temp) == 0) {\n    return KELVTOC(temp);\n  } else if (GETSYSCTL(\"dev.amdtemp.0.core0.sensor0\", temp) == 0) {\n    return KELVTOC(temp);\n  }\n  fprintf(stderr, \"Cannot get temperature from sysctl\\n\");\n\n  return 0.0;\n}\n\n// If a leaf MIB in the sysctl tree returns ENOENT, that means the entry does\n// not exist. On the contrary, if a non-leaf entry *does exist*, then EISDIR\n// errno is returned, meaning it exists, but it is an array/directory with\n// more elements hanging from it.\nstatic int sysctl_mib_exists(const char *mib)\n{\n  size_t len;\n  void *p = NULL;\n  sysctlbyname(mib, p, &len, NULL, 0);\n  return !(errno == ENOENT);\n}\n\nstatic void get_battery_stats(int *battime, int *batcapacity, int *batstate,\n                              int *ac) {\n  int battery_present = sysctl_mib_exists(\"hw.acpi.battery\");\n  int ac_present = sysctl_mib_exists(\"hw.acpi.acline\");\n\n  if (!battery_present && !ac_present) {\n\t  // According to acpi(4), hw.acpi.acline is optional and only present\n\t  // if supported by the hardware. If no battery and acline is detected,\n\t  // for sure we are running on an AC line.\n\t  *ac = 1;\n\t  *batstate = 7;\n\t  return;\n  }\n\n  if (battery_present) {\n    if (battime && GETSYSCTL(\"hw.acpi.battery.time\", *battime)) {\n      NORM_ERR(\"Cannot read sysctl \\\"hw.acpi.battery.time\\\"\");\n    }\n    if (batcapacity && GETSYSCTL(\"hw.acpi.battery.life\", *batcapacity)) {\n      NORM_ERR(\"Cannot read sysctl \\\"hw.acpi.battery.life\\\"\");\n    }\n    if (batstate && GETSYSCTL(\"hw.acpi.battery.state\", *batstate)) {\n      NORM_ERR(\"Cannot read sysctl \\\"hw.acpi.battery.state\\\"\");\n    }\n  }\n  if (ac_present && ac && GETSYSCTL(\"hw.acpi.acline\", *ac)) {\n    NORM_ERR(\"Cannot read sysctl \\\"hw.acpi.acline\\\"\");\n  }\n}\n\nvoid get_battery_stuff(char *buf, unsigned int n, const char *bat, int item) {\n  int battime = 0, batcapacity = 0, batstate = 0, ac = 0;\n  (void)bat;\n\n  get_battery_stats(&battime, &batcapacity, &batstate, &ac);\n\n  if (batstate != 1 && batstate != 2 && batstate != 0 && batstate != 7)\n    fprintf(stderr, \"Unknown battery state %d!\\n\", batstate);\n  else if (batstate != 1 && ac == 0)\n    fprintf(stderr, \"Battery charging while not on AC!\\n\");\n  else if (batstate == 1 && ac == 1)\n    fprintf(stderr, \"Battery discharing while on AC!\\n\");\n\n  switch (item) {\n    case BATTERY_TIME:\n      if (batstate == 1 && battime != -1)\n        snprintf(buf, n, \"%d:%2.2d\", battime / 60, battime % 60);\n      break;\n    case BATTERY_STATUS:\n      if (batstate == 1)  // Discharging\n        snprintf(buf, n, \"remaining (%d%%)\", batcapacity);\n      else\n        snprintf(buf, n,\n                 batstate == 2\n                     ? \"charging (%d%%)\"\n                     : (batstate == 7 ? \"absent/on AC\" : \"charged (%d%%)\"),\n                 batcapacity);\n      break;\n    default:\n      fprintf(stderr, \"Unknown requested battery stat %d\\n\", item);\n  }\n}\n\nint get_battery_perct(const char *) {\n  int batcapacity;\n\n  get_battery_stats(nullptr, &batcapacity, NULL, NULL);\n  return batcapacity;\n}\n\nvoid get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {\n  int rate = 0;\n  double ret = 0;\n\n  /*\n   * hw.acpi.battery.rate returns battery discharge rate in mW,\n   * or -1 (according to docs, but also 0 in practice) when not discharging.\n   *\n   * ref. acpi_battery(4)\n   */\n  if (GETSYSCTL(\"hw.acpi.battery.rate\", rate)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.battery.rate\\\"\\n\");\n  }\n\n  if (rate > 0) { ret = (double)rate / (double)1000; }\n\n  snprintf(buffer, n, \"%.1f\", ret);\n}\n\ndouble get_battery_perct_bar(struct text_object *obj) {\n  int batperct = get_battery_perct(obj->data.s);\n  return batperct;\n}\n\nint open_acpi_temperature(const char *name) {\n  (void)name;\n  /* Not applicable for FreeBSD. */\n  return 0;\n}\n\nvoid get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,\n                         const char *adapter) {\n  int state;\n\n  (void)adapter;  // only linux uses this\n\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  if (GETSYSCTL(\"hw.acpi.acline\", state)) {\n    fprintf(stderr, \"Cannot read sysctl \\\"hw.acpi.acline\\\"\\n\");\n    return;\n  }\n\n  if (state) {\n    strncpy(p_client_buffer, \"Running on AC Power\", client_buffer_size);\n  } else {\n    strncpy(p_client_buffer, \"Running on battery\", client_buffer_size);\n  }\n}\n\nvoid get_acpi_fan(char *p_client_buffer, size_t client_buffer_size) {\n  /* not implemented */\n  if (p_client_buffer && client_buffer_size > 0) {\n    memset(p_client_buffer, 0, client_buffer_size);\n  }\n}\n\n/* void */\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  int freq;\n  char freq_sysctl[16] = {0};\n\n  if (!p_client_buffer || client_buffer_size <= 0 || !p_format ||\n      divisor <= 0) {\n    return 0;\n  }\n\n  snprintf(freq_sysctl, sizeof(freq_sysctl), \"dev.cpu.%d.freq\", (cpu - 1));\n\n  if (GETSYSCTL(freq_sysctl, freq) == 0) {\n    snprintf(p_client_buffer, client_buffer_size, p_format,\n             (float)freq / divisor);\n  } else {\n    snprintf(p_client_buffer, client_buffer_size, p_format, 0.0f);\n  }\n\n  return 1;\n}\n\n#if 0\nvoid update_wifi_stats(void)\n{\n\tstruct ifreq ifr;\t\t/* interface stats */\n\tstruct wi_req wireq;\n\tstruct net_stat *ns;\n\tstruct ifaddrs *ifap, *ifa;\n\tstruct ifmediareq ifmr;\n\tint s;\n\n\t/* Get iface table */\n\tif (getifaddrs(&ifap) < 0) {\n\t\treturn;\n\t}\n\n\tfor (ifa = ifap; ifa; ifa = ifa->ifa_next) {\n\t\tns = get_net_stat((const char *) ifa->ifa_name, nullptr, NULL);\n\n\t\ts = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);\n\n\t\t/* Get media type */\n\t\tbzero(&ifmr, sizeof(ifmr));\n\t\tstrlcpy(ifmr.ifm_name, ifa->ifa_name, IFNAMSIZ);\n\t\tif (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) {\n\t\t\tclose(s);\n\t\t\treturn;\n\t\t}\n\n\t\t/* We can monitor only wireless interfaces\n\t\t * which are not in hostap mode */\n\t\tif ((ifmr.ifm_active & IFM_IEEE80211)\n\t\t\t\t&& !(ifmr.ifm_active & IFM_IEEE80211_HOSTAP)) {\n\t\t\t/* Get wi status */\n\t\t\tbzero(&ifr, sizeof(ifr));\n\t\t\tstrlcpy(ifr.ifr_name, ifa->ifa_name, IFNAMSIZ);\n\t\t\twireq.wi_type = WI_RID_COMMS_QUALITY;\n\t\t\twireq.wi_len = WI_MAX_DATALEN;\n\t\t\tifr.ifr_data = (void *) &wireq;\n\n\t\t\tif (ioctl(s, SIOCGWAVELAN, (caddr_t) &ifr) < 0) {\n\t\t\t\tperror(\"ioctl (getting wi status)\");\n\t\t\t\texit(1);\n\t\t\t}\n\n\t\t\t/* wi_val[0] = quality\n\t\t\t * wi_val[1] = signal\n\t\t\t * wi_val[2] = noise */\n\t\t\tns->linkstatus = (int) wireq.wi_val[1];\n\t\t}\ncleanup:\n\t\tclose(s);\n\t}\n}\n#endif\n\nint update_diskio(void) {\n  int devs_count, num_selected, num_selections, dn;\n  struct device_selection *dev_select = nullptr;\n  long select_generation;\n  static struct statinfo statinfo_cur;\n  char device_name[DEFAULT_TEXT_BUFFER_SIZE];\n  struct diskio_stat *cur;\n  unsigned int reads, writes;\n  unsigned int total_reads = 0, total_writes = 0;\n\n  memset(&statinfo_cur, 0, sizeof(statinfo_cur));\n  statinfo_cur.dinfo = (struct devinfo *)calloc(1, sizeof(struct devinfo));\n  stats.current = stats.current_read = stats.current_write = 0;\n\n  if (devstat_getdevs(nullptr, &statinfo_cur) < 0) {\n    free(statinfo_cur.dinfo);\n    return 0;\n  }\n\n  devs_count = statinfo_cur.dinfo->numdevs;\n  if (devstat_selectdevs(&dev_select, &num_selected, &num_selections,\n                         &select_generation, statinfo_cur.dinfo->generation,\n                         statinfo_cur.dinfo->devices, devs_count, nullptr, 0,\n                         NULL, 0, DS_SELECT_ONLY, MAXSHOWDEVS, 1) >= 0) {\n    for (dn = 0; dn < devs_count; dn++) {\n      int di;\n      struct devstat *dev;\n\n      di = dev_select[dn].position;\n      dev = &statinfo_cur.dinfo->devices[di];\n      snprintf(device_name, DEFAULT_TEXT_BUFFER_SIZE, \"%s%d\",\n               dev_select[dn].device_name, dev_select[dn].unit_number);\n\n      total_reads += (reads = dev->bytes[DEVSTAT_READ] / 512);\n      total_writes += (writes = dev->bytes[DEVSTAT_WRITE] / 512);\n      for (cur = stats.next; cur; cur = cur->next) {\n        if (cur->dev && !strcmp(device_name, cur->dev)) {\n          update_diskio_values(cur, reads, writes);\n          break;\n        }\n      }\n    }\n    update_diskio_values(&stats, total_reads, total_writes);\n\n    free(dev_select);\n  }\n\n  if (statinfo_cur.dinfo->mem_ptr) { free(statinfo_cur.dinfo->mem_ptr); }\n  free(statinfo_cur.dinfo);\n  return 0;\n}\n\n/* While topless is obviously better, top is also not bad. */\n\nvoid get_top_info(void) {\n  struct kinfo_proc *p;\n  struct process *proc;\n  int n_processes;\n  int i;\n\n  std::lock_guard<std::mutex> guard(kvm_proc_mutex);\n  p = kvm_getprocs(kd, KERN_PROC_PROC, 0, &n_processes);\n\n  for (i = 0; i < n_processes; i++) {\n    if (!(p[i].ki_flag & P_SYSTEM)) {\n      proc = get_process(p[i].ki_pid);\n\n      proc->time_stamp = g_time;\n      proc->name = strndup(p[i].ki_comm, text_buffer_size.get(*state));\n      proc->basename = strndup(p[i].ki_comm, text_buffer_size.get(*state));\n      proc->amount = 100.0 * p[i].ki_pctcpu / FSCALE;\n      proc->vsize = p[i].ki_size;\n      proc->rss = (p[i].ki_rssize * getpagesize());\n      /* ki_runtime is in microseconds, total_cpu_time in centiseconds.\n       * Therefore we divide by 10000. */\n      proc->total_cpu_time = p[i].ki_runtime / 10000;\n    }\n  }\n}\n\nvoid get_battery_short_status(char *buffer, unsigned int n, const char *bat) {\n  get_battery_stuff(buffer, n, bat, BATTERY_STATUS);\n  if (0 == strncmp(\"charging\", buffer, 8)) {\n    buffer[0] = 'C';\n    memmove(buffer + 1, buffer + 8, n - 8);\n  } else if (0 == strncmp(\"remaining\", buffer, 9)) {\n    buffer[0] = 'D';\n    memmove(buffer + 1, buffer + 9, n - 9);\n  } else if (0 == strncmp(\"charged\", buffer, 7)) {\n    buffer[0] = 'F';\n    memmove(buffer + 1, buffer + 7, n - 7);\n  } else if (0 == strncmp(\"absent/on AC\", buffer, 12)) {\n    buffer[0] = 'N';\n    memmove(buffer + 1, buffer + 12, n - 12);\n  }\n}\n\nint get_entropy_avail(unsigned int *val) {\n  /* Not applicable for FreeBSD as it uses the yarrow prng. */\n  (void)val;\n  return 1;\n}\n\nint get_entropy_poolsize(unsigned int *val) {\n  /* Not applicable for FreeBSD as it uses the yarrow prng. */\n  (void)val;\n  return 1;\n}\n\nvoid print_sysctlbyname(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  u_int val[3] = {0};\n  char buf[256] = {\"\"};\n  size_t len = sizeof(val);\n  size_t len2 = sizeof(buf);\n\n  if (0 == strcmp(obj->data.s, \"\")) {\n    snprintf(p, p_max_size, \"%s\", \"sysctlbyname takes an argument\");\n    return;\n  }\n\n  if (0 != sysctlbyname(obj->data.s, &val, &len, NULL, 0)) {\n    if (0 != sysctlbyname(obj->data.s, &buf, &len2, NULL, 0)) {\n      snprintf(p, p_max_size, \"%s\", \"\");\n      return;\n    }\n  }\n\n  if (0 != strcmp(buf, \"\")) {\n    snprintf(p, p_max_size, \"%s\", buf);\n  } else {\n    snprintf(p, p_max_size, \"%lu\", (unsigned long)val[0]);\n  }\n}\n\n/******************************************\n * Check if more than one conky process   *\n * is running                             *\n ******************************************/\n\nbool is_conky_already_running(void) {\n  kvm_t *kd;\n  struct kinfo_proc *kp;\n  char errbuf[_POSIX2_LINE_MAX];\n  int entries = -1;\n  int instances = 0;\n\n  kd = kvm_openfiles(NULL, _PATH_DEVNULL, NULL, O_RDONLY, errbuf);\n  if (kd == NULL) {\n    NORM_ERR(\"%s\\n\", errbuf);\n    return false;\n  }\n\n  kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &entries);\n  if ((kp == NULL && errno != ESRCH) || (kp != NULL && entries < 0)) {\n    NORM_ERR(\"%s\\n\", kvm_geterr(kd));\n    goto cleanup;\n  }\n\n  for (int i = 0; i < entries && instances < 2; ++i) {\n    if (!strcmp(\"conky\", kp[i].ki_comm)) {\n        ++instances;\n    }\n  }\n\ncleanup:\n  kvm_close(kd);\n  return instances > 1;\n}\n"
  },
  {
    "path": "src/data/os/freebsd.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef FREEBSD_H_\n#define FREEBSD_H_\n\n#include <fcntl.h>\n#include <kvm.h>\n#include <strings.h>\n#include <sys/mount.h>\n#include <sys/param.h>\n#include <sys/ucred.h>\n#include \"../../common.h\"\n#if (defined(i386) || defined(__i386__))\n#include <machine/apm_bios.h>\n#endif /* i386 || __i386__ */\n\nextern kvm_t *kd;\n\nint get_entropy_avail(unsigned int *);\nint get_entropy_poolsize(unsigned int *);\nvoid print_sysctlbyname(struct text_object *, char *, unsigned int);\n\nbool is_conky_already_running(void);\n\n#endif /*FREEBSD_H_*/\n"
  },
  {
    "path": "src/data/os/haiku.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <OS.h>\n\n#include \"../../conky.h\"\n#include \"haiku.h\"\n#include \"../network/net_stat.h\"\n#include \"../top.h\"\n\nstatic short cpu_setup = 0;\n\nvoid prepare_update() {}\n\nint update_uptime() {\n  info.uptime = (double)system_time() / 1000000.0;\n  return 0;\n}\n\nint check_mount(struct text_object *obj) {\n  /* stub */\n  (void)obj;\n  return 0;\n}\n\nint update_meminfo() {\n  system_info si;\n\n  if (get_system_info(&si) != B_OK) {\n    fprintf(stderr, \"Cannot get_system_info\\n\");\n    return 1;\n  }\n\n  info.memmax = si.max_pages * (B_PAGE_SIZE >> 10);\n  info.mem = si.used_pages * (B_PAGE_SIZE >> 10);\n  // TODO: we have some more info...\n  info.memwithbuffers = info.mem;\n  info.memeasyfree = info.memfree = info.memmax - info.mem;\n  info.legacymem = info.mem;\n\n  info.swapmax = si.max_swap_pages * (B_PAGE_SIZE >> 10);\n  info.swapfree = si.free_swap_pages * (B_PAGE_SIZE >> 10);\n  info.swap = (info.swapmax - info.swapfree);\n\n  return 0;\n}\n\nint update_net_stats() {\n  // TODO\n  return 1;\n}\n\nint update_total_processes() {\n  // TODO\n  return 0;\n}\n\nint update_running_processes() {\n  // TODO\n  return 1;\n}\n\nvoid get_cpu_count(void) {\n  system_info si;\n\n  if (get_system_info(&si) != B_OK) {\n    fprintf(stderr, \"Cannot get_system_info\\n\");\n    info.cpu_count = 0;\n    return;\n  }\n  info.cpu_count = si.cpu_count;\n\n  info.cpu_usage = (float *)malloc((info.cpu_count + 1) * sizeof(float));\n  if (info.cpu_usage == nullptr) { CRIT_ERR(\"malloc\"); }\n}\n\nint update_cpu_usage() {\n  // TODO\n  static bigtime_t prev = 0;\n  static cpu_info *prev_cpuinfo = nullptr;\n  bigtime_t now;\n  cpu_info *cpuinfo;\n\n  /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */\n  if ((cpu_setup == 0) || (!info.cpu_usage)) {\n    get_cpu_count();\n    cpu_setup = 1;\n  }\n\n  int malloc_cpu_size = sizeof(cpu_info) * (info.cpu_count + 1);\n\n  if (!prev_cpuinfo) {\n    prev_cpuinfo = (cpu_info *)malloc(malloc_cpu_size);\n    if (prev_cpuinfo == nullptr) { CRIT_ERR(\"malloc\"); }\n    memset(prev_cpuinfo, 0, malloc_cpu_size);\n  }\n\n  cpuinfo = (cpu_info *)malloc(malloc_cpu_size);\n  memset(cpuinfo, 0, malloc_cpu_size);\n\n  if (cpuinfo == nullptr) { CRIT_ERR(\"malloc\"); }\n\n  now = system_time();\n  if (get_cpu_info(0, info.cpu_count, &cpuinfo[1]) == B_OK) {\n    for (int i = 1; i <= info.cpu_count; i++)\n      cpuinfo[0].active_time += cpuinfo[i].active_time;\n    cpuinfo[0].active_time /= info.cpu_count;\n    for (int i = 0; i <= info.cpu_count; i++) {\n      double period = (double)(now - prev);\n      info.cpu_usage[i] =\n          ((double)(cpuinfo[i].active_time - prev_cpuinfo[i].active_time)) /\n          period;\n    }\n  }\n\n  memcpy(prev_cpuinfo, cpuinfo, malloc_cpu_size);\n  prev = now;\n  free(cpuinfo);\n  return 1;\n}\n\nvoid free_cpu(struct text_object *) { /* no-op */\n}\n\nint update_load_average() {\n  // TODO\n  return 1;\n}\n\ndouble get_acpi_temperature(int fd) { return -1; }\n\nvoid get_battery_stuff(char *buf, unsigned int n, const char *bat, int item) {\n  // TODO\n}\n\nint get_battery_perct(const char *bat) {\n  /*\n  int batcapacity;\n\n  get_battery_stats(nullptr, &batcapacity, NULL, NULL);\n  return batcapacity;\n  */\n  // TODO\n  return 0;\n}\n\ndouble get_battery_perct_bar(struct text_object *obj) {\n  int batperct = get_battery_perct(obj->data.s);\n  return batperct;\n}\n\nvoid get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {\n  // TODO\n}\n\nint open_acpi_temperature(const char *name) { return -1; }\n\nvoid get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,\n                         const char *adapter) {\n  (void)adapter;  // only linux uses this\n\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  /* not implemented */\n  memset(p_client_buffer, 0, client_buffer_size);\n}\n\n/* char *get_acpi_fan() */\nvoid get_acpi_fan(char *p_client_buffer, size_t client_buffer_size) {\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  /* not implemented */\n  memset(p_client_buffer, 0, client_buffer_size);\n}\n\n/* void */\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  int freq;\n  char *freq_sysctl;\n\n  if (!p_client_buffer || client_buffer_size <= 0 || !p_format ||\n      divisor <= 0) {\n    return 0;\n  }\n  return 0;\n  // TODO\n  //\treturn 1;\n}\n\nint update_diskio(void) { return 1; }\n\nvoid get_top_info(void) {\n  int32 tmcookie = 0;\n  team_info tm;\n  struct process *proc;\n\n  while (get_next_team_info(&tmcookie, &tm) == B_NO_ERROR) {\n    team_usage_info ti;\n\n    if (get_team_usage_info(tm.team, B_TEAM_USAGE_SELF, &ti) != B_OK) continue;\n\n    proc = get_process(tm.team);\n\n    proc->time_stamp = g_time;\n    proc->name = strndup(tm.args, sizeof(tm.args));\n    proc->basename = strndup(tm.args, sizeof(tm.args));\n    // proc->amount = 100.0 * p[i].ki_pctcpu / FSCALE;\n    proc->vsize = 0;\n    proc->rss = 0;\n    /* bigtime_t is in microseconds, total_cpu_time in centiseconds.\n     * Therefore we divide by 10000. */\n    proc->total_cpu_time = (ti.user_time + ti.kernel_time) / 10000;\n  }\n}\n\nvoid get_battery_short_status(char *buffer, unsigned int n, const char *bat) {\n  // TODO\n}\n\nint get_entropy_avail(unsigned int *val) { return 1; }\n\nint get_entropy_poolsize(unsigned int *val) { return 1; }\n\n/******************************************\n * Check if more than one conky process   *\n * is running                             *\n ******************************************/\n\nbool is_conky_already_running(void) {\n  int32 team_cookie = 0;\n  team_info team_info;\n  int32 thread_cookie = 0;\n  thread_info thread_info;\n  int32 instances = 0;\n\n  while (get_next_team_info(&team_cookie, &team_info) >= B_OK) {\n    while (get_next_thread_info(team_info.team, &thread_cookie, &thread_info) >= B_OK) {\n      if (!strcmp(\"conky\", thread_info.name)) {\n        ++instances;\n      }\n    }\n  }\n  return instances > 1;\n}\n"
  },
  {
    "path": "src/data/os/haiku.h",
    "content": "/* */\n\n#ifndef HAIKU_H_\n#define HAIKU_H_\n\n#include <err.h>\n#include <fcntl.h>\n#include <limits.h>\n#include <paths.h>\n#include <time.h>\n#include <unistd.h>\n\n#include <sys/socket.h>\n#include <sys/time.h>\n#include <sys/types.h>\n\n#include <net/if.h>\n\n#include <kernel/fs_info.h>\n\n#include <OS.h>\n\n#include \"../../common.h\"\n#include \"../../conky.h\"\n\nint get_entropy_avail(unsigned int *);\nint get_entropy_poolsize(unsigned int *);\n\n/* let's just mimic statfs64 */\n\nstruct statfs : public fs_info {};\n\ninline int statfs(const char *path, struct statfs *buf) {\n  return fs_stat_dev(dev_for_path(path), buf);\n}\n\n#define f_blocks total_blocks\n#define f_bsize block_size\n#define f_bavail free_blocks\n#define f_bfree free_blocks\n#define f_fstypename fsh_name\n\nbool is_conky_already_running(void);\n\n#endif /*HAIKU_H_*/\n"
  },
  {
    "path": "src/data/os/journal.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <ctype.h>\n#include <string.h>\n#include <systemd/sd-journal.h>\n#include <time.h>\n#include <unistd.h>\n#include <memory>\n#include \"../../common.h\"\n#include \"config.h\"\n#include \"../../conky.h\"\n#include \"../../logging.h\"\n#include \"../../content/text_object.h\"\n\n#define MAX_JOURNAL_LINES 200\n\nclass journal {\n public:\n  int wantedlines;\n  int flags;\n\n  journal() : wantedlines(0), flags(SD_JOURNAL_LOCAL_ONLY) {}\n};\n\nvoid free_journal(struct text_object *obj) {\n  journal *j = (journal *)obj->data.opaque;\n  obj->data.opaque = nullptr;\n  delete j;\n}\n\nvoid init_journal(const char *type, const char *arg, struct text_object *obj,\n                  void *free_at_crash) {\n  unsigned int args;\n  journal *j = new journal;\n\n  std::unique_ptr<char[]> tmp(new char[DEFAULT_TEXT_BUFFER_SIZE]);\n  memset(tmp.get(), 0, DEFAULT_TEXT_BUFFER_SIZE);\n\n  args = sscanf(arg, \"%d %6s\", &j->wantedlines, tmp.get());\n  if (args < 1 || args > 2) {\n    free_journal(obj);\n    CRIT_ERR_FREE(\n        obj, free_at_crash,\n        \"%s a number of lines as 1st argument and optionally a journal \"\n        \"type as 2nd argument\",\n        type);\n  }\n  if (j->wantedlines > 0 && j->wantedlines <= MAX_JOURNAL_LINES) {\n    if (args > 1) {\n      if (strcmp(tmp.get(), \"system\") == 0) {\n        j->flags |= SD_JOURNAL_SYSTEM;\n#ifdef SD_JOURNAL_CURRENT_USER  // not present in older version of systemd\n      } else if (strcmp(tmp.get(), \"user\") == 0) {\n        j->flags |= SD_JOURNAL_CURRENT_USER;\n#endif /* SD_JOURNAL_CURRENT_USER */\n      } else {\n        free_journal(obj);\n        CRIT_ERR_FREE(obj, free_at_crash,\n                      \"invalid arg for %s, type must be 'system' or 'user'\",\n                      type);\n      }\n    } else {\n      NORM_ERR(\"You should type a 'user' or 'system' as an argument\");\n    }\n\n  } else {\n    free_journal(obj);\n    CRIT_ERR_FREE(\n        obj, free_at_crash,\n        \"invalid arg for %s, number of lines must be between 1 and %d\", type,\n        MAX_JOURNAL_LINES);\n  }\n  obj->data.opaque = j;\n}\n\nstatic int print_field(sd_journal *jh, const char *field, char spacer,\n                       size_t *read, char *p, unsigned int p_max_size) {\n  const void *get;\n  size_t length;\n  size_t fieldlen = strlen(field) + 1;\n\n  int ret = sd_journal_get_data(jh, field, &get, &length);\n  if (ret == -ENOENT) goto out;\n\n  if (ret < 0 || length + *read > p_max_size) return -1;\n\n  memcpy(p + *read, (const char *)get + fieldlen, length - fieldlen);\n  *read += length - fieldlen;\n\nout:\n  if (spacer) {\n    if (p_max_size < *read) {\n      *read = p_max_size - 1;\n    } else {\n      p[(*read)++] = spacer;\n    }\n  }\n  return length ? length - fieldlen : 0;\n}\n\nbool read_log(size_t *read, size_t *length, time_t *time, uint64_t *timestamp,\n              sd_journal *jh, char *p, unsigned int p_max_size) {\n  struct tm tm;\n  if (sd_journal_get_realtime_usec(jh, timestamp) < 0) return false;\n  *time = *timestamp / 1000000;\n  localtime_r(time, &tm);\n\n  if ((*length =\n           strftime(p + *read, p_max_size - *read, \"%b %d %H:%M:%S\", &tm)) <= 0)\n    return false;\n  *read += *length;\n\n  if (p_max_size < *read) {\n    *read = p_max_size - 1;\n    return false;\n  }\n  p[*read++] = ' ';\n\n  if (print_field(jh, \"_HOSTNAME\", ' ', read, p, p_max_size) < 0) return false;\n\n  if (print_field(jh, \"SYSLOG_IDENTIFIER\", '[', read, p, p_max_size) < 0)\n    return false;\n\n  if (print_field(jh, \"_PID\", ']', read, p, p_max_size) < 0) return false;\n\n  if (p_max_size < *read) {\n    *read = p_max_size - 1;\n    return false;\n  }\n  p[*read++] = ':';\n\n  if (p_max_size < *read) {\n    *read = p_max_size - 1;\n    return false;\n  }\n  p[*read++] = ' ';\n\n  if (print_field(jh, \"MESSAGE\", '\\n', read, p, p_max_size) < 0) return false;\n  return true;\n}\n\nvoid print_journal(struct text_object *obj, char *p, unsigned int p_max_size) {\n  journal *j = (journal *)obj->data.opaque;\n  sd_journal *jh = nullptr;\n  size_t read = 0;\n  size_t length;\n  time_t time;\n  uint64_t timestamp;\n\n  if (sd_journal_open(&jh, j->flags) != 0) {\n    NORM_ERR(\"unable to open journal\");\n    goto out;\n  }\n\n  if (sd_journal_seek_tail(jh) < 0) {\n    NORM_ERR(\"unable to seek to end of journal\");\n    goto out;\n  }\n  if (sd_journal_previous_skip(jh, j->wantedlines) < 0) {\n    NORM_ERR(\"unable to seek back %d lines\", j->wantedlines);\n    goto out;\n  }\n\n  while (read_log(&read, &length, &time, &timestamp, jh, p, p_max_size) &&\n         sd_journal_next(jh))\n    ;\n\nout:\n  if (jh) sd_journal_close(jh);\n  p[read] = '\\0';\n}\n"
  },
  {
    "path": "src/data/os/journal.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _JOURNAL_H\n#define _JOURNAL_H\n\nvoid free_journal(struct text_object *);\nvoid init_journal(const char *, const char *, struct text_object *, void *);\nvoid print_journal(struct text_object *, char *, unsigned int);\n\n#endif /* _JOURNAL_H */\n"
  },
  {
    "path": "src/data/os/linux.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"linux.h\"\n#include <ctype.h>\n#include <dirent.h>\n#include <errno.h>\n#include <limits.h>\n#include <sys/stat.h>\n#include <sys/sysinfo.h>\n#include <sys/types.h>\n#include <clocale>\n#include \"../../common.h\"\n#include \"../../conky.h\"\n#include \"../hardware/diskio.h\"\n#include \"../../logging.h\"\n#include \"../network/net_stat.h\"\n#include \"../proc.h\"\n#include \"../../content/temphelper.h\"\n#ifndef HAVE_CLOCK_GETTIME\n#include <sys/time.h>\n#endif\n#include <fcntl.h>\n#include <unistd.h>\n// #include <assert.h>\n#include <time.h>\n#include <unordered_map>\n#include \"../../lua/setting.hh\"\n#include \"../top.h\"\n\n#include <arpa/inet.h>\n#include <linux/sockios.h>\n#include <net/if.h>\n#include <netinet/in.h>\n#include <sys/ioctl.h>\n#include <sys/socket.h>\n#ifdef _NET_IF_H\n#define _LINUX_IF_H\n#endif\n#include <linux/route.h>\n#include <linux/version.h>\n#include <math.h>\n#include <pthread.h>\n#include <atomic>\n#include <fstream>\n#include <mutex>\n#include <string_view>\n\n/* The following ifdefs were adapted from gkrellm */\n#include <linux/major.h>\n\n#if !defined(MD_MAJOR)\n#define MD_MAJOR 9\n#endif\n\n#if !defined(LVM_BLK_MAJOR)\n#define LVM_BLK_MAJOR 58\n#endif\n\n#if !defined(NBD_MAJOR)\n#define NBD_MAJOR 43\n#endif\n\n#if !defined(DM_MAJOR)\n#define DM_MAJOR 253\n#endif\n\n#ifdef BUILD_WLAN\n#include <iwlib.h>\n#endif\n\nstruct sysfs {\n  int fd;\n  int arg;\n  char devtype[256];\n  char type[64];\n  float factor, offset;\n};\n\n/* To be used inside upspeed/f downspeed/f as ${gw_iface} variable */\nchar e_iface[64];\n\n/* To use ${iface X} where X is a number and will\n * return the current X NIC name */\nstatic const unsigned int iface_len = 64U;\nchar interfaces_arr[MAX_NET_INTERFACES][iface_len] = {\"\"};\n\n#define SHORTSTAT_TEMPL \"%*s %llu %llu %llu\"\n#define LONGSTAT_TEMPL \"%*s %llu %llu %llu \"\n\nstatic conky::simple_config_setting<bool> top_cpu_separate(\"top_cpu_separate\",\n                                                           false, true);\n\n/* This flag tells the linux routines to use the /proc system where possible,\n * even if other api's are available, e.g. sysinfo() or getloadavg().\n * the reason for this is to allow for /proc-based distributed monitoring.\n * using a flag in this manner creates less confusing code. */\nstatic int prefer_proc = 0;\n\n/* To tell 'print_sysfs_sensor' whether to print the temperature\n * in int or float */\nstatic const char *temp2 = \"empty\";\n\nvoid prepare_update(void) {}\n\nint update_uptime(void) {\n#ifdef HAVE_SYSINFO\n  if (!prefer_proc) {\n    struct sysinfo s_info;\n\n    sysinfo(&s_info);\n    info.uptime = (double)s_info.uptime;\n  } else\n#endif\n  {\n    static int reported = 0;\n    FILE *fp;\n\n    if (!(fp = open_file(\"/proc/uptime\", &reported))) {\n      info.uptime = 0.0;\n      return 0;\n    }\n    if (fscanf(fp, \"%lf\", &info.uptime) <= 0) info.uptime = 0;\n    fclose(fp);\n  }\n  return 0;\n}\n\nint check_mount(struct text_object *obj) {\n  int ret = 0;\n  FILE *mtab;\n\n  if (!obj->data.s) return 0;\n\n  if ((mtab = fopen(\"/proc/mounts\", \"r\"))) {\n    char buf1[256], buf2[129];\n\n    while (fgets(buf1, 256, mtab)) {\n      sscanf(buf1, \"%*s %128s\", buf2);\n      if (!strcmp(obj->data.s, buf2)) {\n        ret = 1;\n        break;\n      }\n    }\n    fclose(mtab);\n  } else {\n    NORM_ERR(\"Could not open mtab\");\n  }\n  return ret;\n}\n\n/* these things are also in sysinfo except Buffers:\n * (that's why I'm reading them from proc) */\n\nint update_meminfo(void) {\n  FILE *meminfo_fp;\n  static int reported = 0;\n\n  /* unsigned int a; */\n  char buf[256];\n\n  /* With multi-threading, calculations that require\n   * multiple steps to reach a final result can cause havok\n   * if the intermediary calculations are directly assigned to the\n   * information struct (they may be read by other functions in the meantime).\n   * These variables keep the calculations local to the function and finish off\n   * the function by assigning the results to the information struct */\n  unsigned long long sreclaimable = 0, curmem = 0, curbufmem = 0,\n                     cureasyfree = 0;\n\n  info.memmax = info.memdirty = info.swap = info.swapfree = info.swapmax =\n      info.memwithbuffers = info.buffers = info.cached = info.memfree =\n          info.memeasyfree = info.legacymem = info.shmem = info.memavail =\n              info.free_bufcache = info.free_cached = 0;\n\n  if (!(meminfo_fp = open_file(\"/proc/meminfo\", &reported))) { return 0; }\n\n  while (!feof(meminfo_fp)) {\n    if (fgets(buf, 255, meminfo_fp) == nullptr) { break; }\n\n    if (strncmp(buf, \"MemTotal:\", 9) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.memmax);\n    } else if (strncmp(buf, \"MemFree:\", 8) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.memfree);\n    } else if (strncmp(buf, \"SwapTotal:\", 10) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.swapmax);\n    } else if (strncmp(buf, \"SwapFree:\", 9) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.swapfree);\n    } else if (strncmp(buf, \"Buffers:\", 8) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.buffers);\n    } else if (strncmp(buf, \"Cached:\", 7) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.cached);\n    } else if (strncmp(buf, \"Dirty:\", 6) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.memdirty);\n    } else if (strncmp(buf, \"MemAvailable:\", 13) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.memavail);\n    } else if (strncmp(buf, \"Shmem:\", 6) == 0) {\n      sscanf(buf, \"%*s %llu\", &info.shmem);\n    } else if (strncmp(buf, \"SReclaimable:\", 13) == 0) {\n      sscanf(buf, \"%*s %llu\", &sreclaimable);\n    }\n  }\n\n  curmem = info.memwithbuffers = info.memmax - info.memfree;\n  cureasyfree = info.memfree;\n  info.swap = info.swapmax - info.swapfree;\n\n  /* Reclaimable memory: does not include shared memory, which is part of cached\n     but unreclaimable. Includes the reclaimable part of the Slab cache though.\n     Note: when shared memory is swapped out, shmem decreases and swapfree\n     decreases - we want this.\n  */\n  curbufmem = (info.cached - info.shmem) + info.buffers + sreclaimable;\n\n  /* Calculate the memory usage.\n   *\n   * The Linux Kernel introduced a new field for memory available,\n   * when possible, use that.\n   * https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=34e431b0ae398fc54ea69ff85ec700722c9da773\n   */\n  if (no_buffers.get(*state)) {\n#if LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 0)\n    /* Now ('info.mem' - 'info.bufmem') is the *really used* (aka unreclaimable)\n       memory. When this value reaches the size of the physical RAM, and swap is\n       full or non-present, OOM happens. Therefore this is the value users want\n       to monitor, regarding their RAM.\n    */\n    curmem -= curbufmem;\n    cureasyfree += curbufmem;\n#else  /* LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 0) */\n    curmem = info.memmax - info.memavail;\n    cureasyfree += curbufmem;\n#endif /* LINUX_VERSION_CODE <= KERNEL_VERSION(3, 14, 0) */\n  }\n\n  /* Now that we know that every calculation is finished we can wrap up\n   * by assigning the values to the information structure */\n  info.mem = curmem;\n  info.bufmem = curbufmem;\n  info.memeasyfree = cureasyfree;\n  info.legacymem =\n      info.memmax - (info.memfree + info.buffers + info.cached + sreclaimable);\n  info.free_cached = info.cached + sreclaimable;\n  info.free_bufcache = info.free_cached + info.buffers;\n\n  fclose(meminfo_fp);\n  return 0;\n}\n\nvoid print_laptop_mode(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  FILE *fp;\n  int val = -1;\n\n  (void)obj;\n\n  if ((fp = fopen(\"/proc/sys/vm/laptop_mode\", \"r\")) != nullptr) {\n    if (fscanf(fp, \"%d\\n\", &val) <= 0) val = 0;\n    fclose(fp);\n  }\n  snprintf(p, p_max_size, \"%d\", val);\n}\n\n/* my system says:\n * # cat /sys/block/sda/queue/scheduler\n * noop [anticipatory] cfq\n */\nvoid print_ioscheduler(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  FILE *fp;\n  char buf[128];\n\n  if (!obj->data.s) goto out_fail;\n\n  snprintf(buf, 127, \"/sys/block/%s/queue/scheduler\", obj->data.s);\n  if ((fp = fopen(buf, \"r\")) == nullptr) goto out_fail;\n\n  while (fscanf(fp, \"%127s\", buf) == 1) {\n    if (buf[0] == '[') {\n      buf[strlen(buf) - 1] = '\\0';\n      snprintf(p, p_max_size, \"%s\", buf + 1);\n      fclose(fp);\n      return;\n    }\n  }\n  fclose(fp);\nout_fail:\n  snprintf(p, p_max_size, \"%s\", \"n/a\");\n  return;\n}\n\nclass gw_info_s {\n public:\n  gw_info_s() : iface(nullptr), ip(nullptr), count(0) {}\n  char *iface;\n  char *ip;\n  std::atomic<int> count;\n  std::mutex mutex;\n\n  void reset() {\n    std::lock_guard<std::mutex> lock(mutex);\n    free_and_zero(iface);\n    free_and_zero(ip);\n  }\n};\nstatic gw_info_s gw_info;\n\nchar *save_set_string(char *x, char *y) {\n  if (x != nullptr && strcmp((char *)x, (char *)y)) {\n    free_and_zero(x);\n    x = strndup(\"multiple\", text_buffer_size.get(*state));\n  } else if (x == nullptr && y != nullptr) {\n    x = strndup(y, text_buffer_size.get(*state));\n  }\n  return x;\n}\n\nvoid update_gateway_info_failure(const char *reason) {\n  if (reason != nullptr) { perror(reason); }\n  // 2 pointers to 1 location causes a crash when we try to free them both\n  std::unique_lock<std::mutex> lock(gw_info.mutex);\n  free_and_zero(gw_info.iface);\n  free_and_zero(gw_info.ip);\n  gw_info.iface = strndup(\"failed\", text_buffer_size.get(*state));\n  gw_info.ip = strndup(\"failed\", text_buffer_size.get(*state));\n}\n\n/* Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT */\n#define RT_ENTRY_FORMAT \"%63s %lx %lx %x %*d %*d %*d %lx %*d %*d %*d\\n\"\n\nFILE *check_procroute() {\n  FILE *fp;\n  if ((fp = fopen(\"/proc/net/route\", \"r\")) == nullptr) {\n    update_gateway_info_failure(\"fopen()\");\n    return nullptr;\n  }\n\n  /* skip over the table header line, which is always present */\n  if (fscanf(fp, \"%*[^\\n]\\n\") < 0) {\n    fclose(fp);\n    return nullptr;\n  }\n\n  return fp;\n}\n\nint update_gateway_info2(void) {\n  FILE *fp;\n  char iface[iface_len];\n  unsigned long dest;\n  unsigned long gate;\n  unsigned long mask;\n  unsigned int flags;\n  unsigned int x = 1;\n  unsigned int z = 1;\n  int strcmpreturn;\n\n  if ((fp = check_procroute()) != nullptr) {\n    while (!feof(fp)) {\n      strcmpreturn = 1;\n      if (fscanf(fp, RT_ENTRY_FORMAT, iface, &dest, &gate, &flags, &mask) !=\n          5) {\n        update_gateway_info_failure(\"fscanf()\");\n        break;\n      }\n      if (!(dest || mask) && ((flags & RTF_GATEWAY) || !gate)) {\n        snprintf(e_iface, 64, \"%s\", iface);\n      }\n      if (1U == x) {\n        snprintf(interfaces_arr[x++], iface_len, \"%s\", iface);\n        continue;\n      } else if (0 == strcmp(iface, interfaces_arr[x - 1])) {\n        continue;\n      }\n      for (z = 1; z < iface_len - 1 && strcmpreturn == 1; z++) {\n        strcmpreturn = strcmp(iface, interfaces_arr[z]);\n      }\n      if (strcmpreturn == 1) {\n        snprintf(interfaces_arr[x++], iface_len, \"%s\", iface);\n      }\n    }\n    fclose(fp);\n  }\n  return 0;\n}\n\nint update_gateway_info(void) {\n  FILE *fp;\n  struct in_addr ina;\n  char iface[iface_len];\n  unsigned long dest, gate, mask;\n  unsigned int flags;\n\n  gw_info.reset();\n  gw_info.count = 0;\n\n  if ((fp = check_procroute()) != nullptr) {\n    while (!feof(fp)) {\n      if (fscanf(fp, RT_ENTRY_FORMAT, iface, &dest, &gate, &flags, &mask) !=\n          5) {\n        update_gateway_info_failure(\"fscanf()\");\n        break;\n      }\n      if (!(dest || mask) && ((flags & RTF_GATEWAY) || !gate)) {\n        gw_info.count++;\n        snprintf(e_iface, 64, \"%s\", iface);\n        std::unique_lock<std::mutex> lock(gw_info.mutex);\n        gw_info.iface = save_set_string(gw_info.iface, iface);\n        ina.s_addr = gate;\n        gw_info.ip = save_set_string(gw_info.ip, inet_ntoa(ina));\n      }\n    }\n    fclose(fp);\n  }\n  return 0;\n}\n\nvoid free_gateway_info(struct text_object *obj) {\n  (void)obj;\n  gw_info.reset();\n}\n\nint gateway_exists(struct text_object *obj) {\n  (void)obj;\n  return !!gw_info.count;\n}\n\nvoid print_gateway_iface(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  (void)obj;\n  std::lock_guard<std::mutex> lock(gw_info.mutex);\n  snprintf(p, p_max_size, \"%s\", gw_info.iface);\n}\n\nvoid print_gateway_iface2(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  long int z = 0;\n  unsigned int x = 1;\n  unsigned int found = 0;\n  char buf[iface_len * iface_len] = {\"\"};\n  char *buf_ptr = buf;\n\n  if (0 == strcmp(obj->data.s, \"\")) {\n    for (; x < iface_len - 1; x++) {\n      if (0 == strcmp(\"\", interfaces_arr[x])) { break; }\n      buf_ptr += snprintf(buf_ptr, iface_len - 1, \"%s, \", interfaces_arr[x]);\n      found = 1;\n    }\n    if (1 == found) {\n      --buf_ptr;\n      *(--buf_ptr) = '\\0';\n    }\n    snprintf(p, p_max_size, \"%s\", buf);\n    return;\n  }\n\n  z = strtol(obj->data.s, (char **)NULL, 10);\n  if ((iface_len - 1) > z) { snprintf(p, p_max_size, \"%s\", interfaces_arr[z]); }\n}\n\nvoid print_gateway_ip(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  (void)obj;\n  std::lock_guard<std::mutex> lock(gw_info.mutex);\n  snprintf(p, p_max_size, \"%s\", gw_info.ip);\n}\n\nvoid update_net_interfaces(FILE *net_dev_fp, bool is_first_update,\n                           double time_between_updates) {\n  /* read each interface */\n#ifdef BUILD_WLAN\n  // wireless info variables\n  struct wireless_info *winfo;\n  struct iwreq wrq;\n#endif\n\n  for (int i = 0; i < MAX_NET_INTERFACES; i++) {\n    struct net_stat *ns;\n    char *s, *p;\n    long long r, t, last_recv, last_trans;\n\n    /* quit only after all non-header lines from /proc/net/dev parsed */\n    // FIXME: arbitrary size chosen to keep code simple.\n    char buf[256];\n    if (fgets(buf, 255, net_dev_fp) == nullptr) { break; }\n    p = buf;\n    /* change char * p to first non-space character, which is the beginning\n     * of the interface name */\n    while (*p != '\\0' && isspace((unsigned char)*p)) { p++; }\n\n    s = p;\n\n    /* increment p until the end of the interface name has been reached */\n    while (*p != '\\0' && *p != ':') { p++; }\n    if (*p == '\\0') { continue; }\n    /* replace ':' with '\\0' in output of /proc/net/dev */\n    *p = '\\0';\n    p++;\n\n    /* get pointer to interface statistics with the interface name in s */\n    ns = get_net_stat(s, nullptr, NULL);\n    ns->up = 1;\n    memset(&(ns->addr.sa_data), 0, 14);\n\n    memset(ns->addrs, 0,\n           17 * MAX_NET_INTERFACES +\n               1); /* Up to 17 chars per ip, max MAX_NET_INTERFACES interfaces.\n                      Nasty memory usage... */\n\n    /* bytes packets errs drop fifo frame compressed multicast|bytes ... */\n    sscanf(p, \"%lld  %*d     %*d  %*d  %*d  %*d   %*d        %*d       %lld\",\n           &r, &t);\n\n    /* if the interface is parsed the first time, then set recv and trans\n     * to currently received, meaning the change in network traffic is 0 */\n    if (ns->last_read_recv == -1) {\n      ns->recv = r;\n      is_first_update = true;\n      ns->last_read_recv = r;\n    }\n    if (ns->last_read_trans == -1) {\n      ns->trans = t;\n      is_first_update = true;\n      ns->last_read_trans = t;\n    }\n    /* move current traffic statistic to last thereby obsoleting the\n     * current statistic */\n    last_recv = ns->recv;\n    last_trans = ns->trans;\n\n    /* If recv or trans is less than last time, an overflow happened.\n     * In that case set the last traffic to the current one, don't set\n     * it to 0, else a spike in the download and upload speed will occur! */\n    if (r < ns->last_read_recv) {\n      last_recv = r;\n    } else {\n      ns->recv += (r - ns->last_read_recv);\n    }\n    ns->last_read_recv = r;\n\n    if (t < ns->last_read_trans) {\n      last_trans = t;\n    } else {\n      ns->trans += (t - ns->last_read_trans);\n    }\n    ns->last_read_trans = t;\n\n    /*** ip addr patch ***/\n    int file_descriptor = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);\n\n    struct ifconf conf;\n    conf.ifc_buf = (char *)malloc(sizeof(struct ifreq) * MAX_NET_INTERFACES);\n    conf.ifc_len = sizeof(struct ifreq) * MAX_NET_INTERFACES;\n    memset(conf.ifc_buf, 0, conf.ifc_len);\n\n    ioctl(file_descriptor, SIOCGIFCONF, &conf);\n\n    for (unsigned int k = 0; k < conf.ifc_len / sizeof(struct ifreq); k++) {\n      struct net_stat *ns2;\n\n      ns2 = get_net_stat(conf.ifc_req[k].ifr_ifrn.ifrn_name, nullptr, NULL);\n      ns2->addr = conf.ifc_req[k].ifr_ifru.ifru_addr;\n      char temp_addr[18];\n      snprintf(temp_addr, sizeof(temp_addr), \"%u.%u.%u.%u, \",\n               ns2->addr.sa_data[2] & 255, ns2->addr.sa_data[3] & 255,\n               ns2->addr.sa_data[4] & 255, ns2->addr.sa_data[5] & 255);\n      if (nullptr == strstr(ns2->addrs, temp_addr))\n        strncpy(ns2->addrs + strlen(ns2->addrs), temp_addr, 17);\n    }\n\n    close(file_descriptor);\n\n    free(conf.ifc_buf);\n    /*** end ip addr patch ***/\n\n    if (!is_first_update) {\n      /* calculate instantaneous speeds */\n      ns->net_rec[0] = (ns->recv - last_recv) / time_between_updates;\n      ns->net_trans[0] = (ns->trans - last_trans) / time_between_updates;\n    }\n\n    unsigned int curtmp1 = 0;\n    unsigned int curtmp2 = 0;\n    /* get an average over the last speed samples */\n    int samples = net_avg_samples.get(*state);\n    /* is OpenMP actually useful here? How large is samples? > 1000 ? */\n#ifdef HAVE_OPENMP\n#pragma omp parallel for reduction(+ : curtmp1, curtmp2) schedule(dynamic, 10)\n#endif /* HAVE_OPENMP */\n    for (int j = 0; j < samples; j++) {\n      curtmp1 = curtmp1 + ns->net_rec[j];\n      curtmp2 = curtmp2 + ns->net_trans[j];\n    }\n    ns->recv_speed = curtmp1 / (double)samples;\n    ns->trans_speed = curtmp2 / (double)samples;\n    if (samples > 1) {\n#ifdef HAVE_OPENMP\n#pragma omp parallel for schedule(dynamic, 10)\n#endif /* HAVE_OPENMP */\n      for (int j = samples; j > 1; j--) {\n        ns->net_rec[j - 1] = ns->net_rec[j - 2];\n        ns->net_trans[j - 1] = ns->net_trans[j - 2];\n      }\n    }\n\n#ifdef BUILD_WLAN\n    /* update wireless info */\n    winfo = (struct wireless_info *)malloc(sizeof(struct wireless_info));\n    memset(winfo, 0, sizeof(struct wireless_info));\n\n    int skfd = iw_sockets_open();\n    if (iw_get_basic_config(skfd, s, &(winfo->b)) > -1) {\n      // set present winfo variables\n      if (iw_get_range_info(skfd, s, &(winfo->range)) >= 0) {\n        winfo->has_range = 1;\n      }\n      if (iw_get_stats(skfd, s, &(winfo->stats), &winfo->range,\n                       winfo->has_range) >= 0) {\n        winfo->has_stats = 1;\n      }\n      if (iw_get_ext(skfd, s, SIOCGIWAP, &wrq) >= 0) {\n        winfo->has_ap_addr = 1;\n        memcpy(&(winfo->ap_addr), &(wrq.u.ap_addr), sizeof(sockaddr));\n      }\n\n      // get bitrate\n      if (iw_get_ext(skfd, s, SIOCGIWRATE, &wrq) >= 0) {\n        memcpy(&(winfo->bitrate), &(wrq.u.bitrate), sizeof(iwparam));\n        iw_print_bitrate(ns->bitrate, 16, winfo->bitrate.value);\n      }\n\n      // get link quality\n      if (winfo->has_range && winfo->has_stats) {\n        bool has_qual_level = (winfo->stats.qual.level != 0) ||\n                              (winfo->stats.qual.updated & IW_QUAL_DBM);\n\n        if (has_qual_level &&\n            !(winfo->stats.qual.updated & IW_QUAL_QUAL_INVALID)) {\n          ns->link_qual = winfo->stats.qual.qual;\n\n          if (winfo->range.max_qual.qual > 0) {\n            ns->link_qual_max = winfo->range.max_qual.qual;\n          }\n        }\n      }\n\n      // get ap mac\n      if (winfo->has_ap_addr) { iw_sawap_ntop(&winfo->ap_addr, ns->ap); }\n\n      // get essid\n      if (winfo->b.has_essid) {\n        if (winfo->b.essid_on) {\n          snprintf(ns->essid, 34, \"%s\", winfo->b.essid);\n        } else {\n          snprintf(ns->essid, 34, \"%s\", \"off/any\");\n        }\n      }\n\n      // get channel and freq\n      if (winfo->b.has_freq) {\n        if (winfo->has_range == 1) {\n          ns->channel = iw_freq_to_channel(winfo->b.freq, &(winfo->range));\n          iw_print_freq_value(ns->freq, 16, winfo->b.freq);\n        } else {\n          ns->channel = 0;\n          ns->freq[0] = 0;\n        }\n      }\n\n      snprintf(ns->mode, 16, \"%s\", iw_operation_mode[winfo->b.mode]);\n    }\n\n    iw_sockets_close(skfd);\n    free(winfo);\n#endif\n  }\n}\n\n#ifdef BUILD_IPV6\nvoid update_ipv6_net_stats() {\n  FILE *file;\n  char v6addr[33];\n  char devname[21];\n  unsigned int netmask, scope;\n  struct net_stat *ns;\n  struct v6addr *lastv6;\n\n  // remove the old v6 addresses otherwise they are listed multiple times\n  for (unsigned int i = 0; i < MAX_NET_INTERFACES; i++) {\n    ns = &netstats[i];\n    while (ns->v6addrs != nullptr) {\n      lastv6 = ns->v6addrs;\n      ns->v6addrs = ns->v6addrs->next;\n      free(lastv6);\n    }\n  }\n\n  if ((file = fopen(PROCDIR \"/net/if_inet6\", \"r\")) == nullptr) { return; }\n\n  while (fscanf(file, \"%32s %*02x %02x %02x %*02x %20s\\n\", v6addr, &netmask,\n                &scope, devname) != EOF) {\n    ns = get_net_stat(devname, nullptr, NULL);\n\n    if (ns->v6addrs == nullptr) {\n      lastv6 = (struct v6addr *)malloc(sizeof(struct v6addr));\n      ns->v6addrs = lastv6;\n    } else {\n      lastv6 = ns->v6addrs;\n      while (lastv6->next) lastv6 = lastv6->next;\n      lastv6->next = (struct v6addr *)malloc(sizeof(struct v6addr));\n      lastv6 = lastv6->next;\n    }\n\n    for (int i = 0; i < 16; i++)\n      sscanf(v6addr + 2 * i, \"%2hhx\", &(lastv6->addr.s6_addr[i]));\n\n    lastv6->netmask = netmask;\n\n    switch (scope) {\n      case 0:  // global\n        lastv6->scope = 'G';\n        break;\n      case 16:  // host-local\n        lastv6->scope = 'H';\n        break;\n      case 32:  // link-local\n        lastv6->scope = 'L';\n        break;\n      case 64:  // site-local\n        lastv6->scope = 'S';\n        break;\n      case 128:  // compat\n        lastv6->scope = 'C';\n        break;\n      default:\n        lastv6->scope = '?';\n    }\n\n    lastv6->next = nullptr;\n  }\n\n  fclose(file);\n}\n#endif /* BUILD_IPV6 */\n\n/**\n * Parses information from /proc/net/dev and stores them in ???\n *\n * For the output format of /proc/net/dev @see http://linux.die.net/man/5/proc\n *\n * @return always returns 0. May change in the future, e.g. returning non zero\n * if some error happened\n **/\nint update_net_stats(void) {\n  update_gateway_info();\n  update_gateway_info2();\n  FILE *net_dev_fp;\n  static int reported = 0;\n  /* variable to notify the parts averaging the download speed, that this\n   * is the first call ever to this function. This variable can't be used\n   * to decide if this is the first time an interface was parsed as there\n   * are many interfaces, which can be activated and deactivated at arbitrary\n   * times */\n  static bool is_first_update = true;\n\n  // FIXME: arbitrary size chosen to keep code simple.\n  char buf[256];\n  double time_between_updates;\n\n  /* get delta */\n  time_between_updates = current_update_time - last_update_time;\n  if (time_between_updates <= 0.0001) { return 0; }\n\n  /* open file /proc/net/dev. If not something went wrong, clear all\n   * network statistics */\n  if (!(net_dev_fp = open_file(\"/proc/net/dev\", &reported))) {\n    clear_net_stats();\n    return 0;\n  }\n  /* ignore first two header lines in file /proc/net/dev. If somethings\n   * goes wrong, e.g. end of file reached, quit.\n   * (Why isn't clear_net_stats called for this case ??? */\n  char *one = fgets(buf, 255, net_dev_fp);\n  char *two = fgets(buf, 255, net_dev_fp);\n  if (!one || /* garbage */\n      !two) { /* garbage (field names) */\n    fclose(net_dev_fp);\n    return 0;\n  }\n\n  update_net_interfaces(net_dev_fp, is_first_update, time_between_updates);\n\n#ifdef BUILD_IPV6\n  update_ipv6_net_stats();\n#endif /* BUILD_IPV6 */\n\n  is_first_update = false;\n\n  fclose(net_dev_fp);\n  return 0;\n}\n\nint result;\n\nint update_total_processes(void) {\n  DIR *dir;\n  struct dirent *entry;\n  int ignore1;\n  char ignore2;\n\n  info.procs = 0;\n  dir = opendir(\"/proc\");\n  if (dir) {\n    while ((entry = readdir(dir))) {\n      if (sscanf(entry->d_name, \"%d%c\", &ignore1, &ignore2) == 1) {\n        info.procs++;\n      }\n    }\n    closedir(dir);\n  }\n  return 0;\n}\n\nint update_threads(void) {\n#ifdef HAVE_SYSINFO\n  if (!prefer_proc) {\n    struct sysinfo s_info;\n\n    sysinfo(&s_info);\n    info.threads = s_info.procs;\n  } else\n#endif\n  {\n    static int reported = 0;\n    FILE *fp;\n\n    if (!(fp = open_file(\"/proc/loadavg\", &reported))) {\n      info.threads = 0;\n      return 0;\n    }\n    if (fscanf(fp, \"%*f %*f %*f %*d/%hu\", &info.threads) <= 0) info.threads = 0;\n    fclose(fp);\n  }\n  return 0;\n}\n\n#define CPU_SAMPLE_COUNT 15\nstruct cpu_info {\n  unsigned long long cpu_user;\n  unsigned long long cpu_system;\n  unsigned long long cpu_nice;\n  unsigned long long cpu_idle;\n  unsigned long long cpu_iowait;\n  unsigned long long cpu_irq;\n  unsigned long long cpu_softirq;\n  unsigned long long cpu_steal;\n  unsigned long long cpu_total;\n  unsigned long long cpu_active_total;\n  unsigned long long cpu_last_total;\n  unsigned long long cpu_last_active_total;\n  double cpu_val[CPU_SAMPLE_COUNT];\n};\nstatic short cpu_setup = 0;\n\n/* Determine if this kernel gives us \"extended\" statistics information in\n * /proc/stat.\n * Kernels around 2.5 and earlier only reported user, system, nice, and\n * idle values in proc stat.\n * Kernels around 2.6 and greater report these PLUS iowait, irq, softirq,\n * and steal */\nvoid determine_longstat(char *buf) {\n  unsigned long long iowait = 0;\n\n  KFLAG_SETOFF(KFLAG_IS_LONGSTAT);\n  /* scanf will either return -1 or 1 because there is only 1 assignment */\n  if (sscanf(buf, \"%*s %*d %*d %*d %*d %llu\", &iowait) > 0) {\n    KFLAG_SETON(KFLAG_IS_LONGSTAT);\n  }\n}\n\nvoid determine_longstat_file(void) {\n#define MAX_PROCSTAT_LINELEN 255\n  FILE *stat_fp;\n  static int reported = 0;\n  char buf[MAX_PROCSTAT_LINELEN + 1];\n  static int stat_initialized = 0;\n\n  /* only execute once */\n  if (stat_initialized) return;\n\n  if (!(stat_fp = open_file(\"/proc/stat\", &reported))) return;\n  while (!feof(stat_fp) &&\n         fgets(buf, MAX_PROCSTAT_LINELEN, stat_fp) != nullptr) {\n    if (strncmp(buf, \"cpu\", 3) == 0) {\n      determine_longstat(buf);\n      break;\n    }\n  }\n  fclose(stat_fp);\n  stat_initialized = 1;\n}\n\nvoid get_cpu_count(void) {\n  FILE *stat_fp;\n  static int reported = 0;\n  char buf[256];\n  char *str1, *str2, *token, *subtoken;\n  char *saveptr1, *saveptr2;\n  int subtoken1 = -1;\n  int subtoken2 = -1;\n\n  if (info.cpu_usage) { return; }\n\n  if (!(stat_fp = open_file(\"/sys/devices/system/cpu/present\", &reported))) {\n    return;\n  }\n\n  info.cpu_count = 0;\n\n  while (!feof(stat_fp)) {\n    if (fgets(buf, 255, stat_fp) == nullptr) { break; }\n\n    // Do some parsing here to handle skipped cpu numbers.  For example,\n    // for an AMD FX(tm)-6350 Six-Core Processor /sys/.../present reports\n    // \"0,3-7\".  I assume that chip is really an 8-core die with two cores\n    // disabled...  Presumably you could also get \"0,3-4,6\", and other\n    // combos too...\n    for (str1 = buf;; str1 = nullptr) {\n      token = strtok_r(str1, \",\", &saveptr1);\n      if (token == nullptr) break;\n      ++info.cpu_count;\n\n      subtoken1 = -1;\n      subtoken2 = -1;\n      for (str2 = token;; str2 = nullptr) {\n        subtoken = strtok_r(str2, \"-\", &saveptr2);\n        if (subtoken == nullptr) break;\n        if (subtoken1 < 0)\n          subtoken1 = strtol(subtoken, nullptr, 10);\n        else\n          subtoken2 = strtol(subtoken, nullptr, 10);\n      }\n      if (subtoken2 > 0) info.cpu_count += subtoken2 - subtoken1;\n    }\n  }\n  info.cpu_usage = (float *)malloc((info.cpu_count + 1) * sizeof(float));\n\n  fclose(stat_fp);\n}\n\n#define TMPL_LONGSTAT \"%*s %llu %llu %llu %llu %llu %llu %llu %llu\"\n#define TMPL_SHORTSTAT \"%*s %llu %llu %llu %llu\"\n\nint update_stat(void) {\n  FILE *stat_fp;\n  static int reported = 0;\n  struct cpu_info *cpu = nullptr;\n  char buf[256];\n  int i;\n  unsigned int idx;\n  double curtmp;\n  const char *stat_template = nullptr;\n  unsigned int malloc_cpu_size = 0;\n  extern void *global_cpu;\n\n  static pthread_mutex_t last_stat_update_mutex = PTHREAD_MUTEX_INITIALIZER;\n  static double last_stat_update = 0.0;\n  float cur_total = 0.0;\n\n  /* since we use wrappers for this function, the update machinery\n   * can't eliminate double invocations of this function. Check for\n   * them here, otherwise cpu_usage counters are freaking out. */\n  pthread_mutex_lock(&last_stat_update_mutex);\n  if (last_stat_update == current_update_time) {\n    pthread_mutex_unlock(&last_stat_update_mutex);\n    return 0;\n  }\n  last_stat_update = current_update_time;\n  pthread_mutex_unlock(&last_stat_update_mutex);\n\n  /* add check for !info.cpu_usage since that mem is freed on a SIGUSR1 */\n  if (!cpu_setup || !info.cpu_usage) {\n    get_cpu_count();\n    cpu_setup = 1;\n  }\n\n  if (!stat_template) {\n    determine_longstat_file();\n    stat_template =\n        KFLAG_ISSET(KFLAG_IS_LONGSTAT) ? TMPL_LONGSTAT : TMPL_SHORTSTAT;\n  }\n\n  if (global_cpu) {\n    cpu = reinterpret_cast<struct cpu_info *>(global_cpu);\n  } else {\n    malloc_cpu_size = (info.cpu_count + 1) * sizeof(struct cpu_info);\n    cpu = (struct cpu_info *)malloc(malloc_cpu_size);\n    memset(cpu, 0, malloc_cpu_size);\n    global_cpu = cpu;\n  }\n\n  if (!(stat_fp = open_file(\"/proc/stat\", &reported))) {\n    info.run_threads = 0;\n    if (info.cpu_usage) {\n      memset(info.cpu_usage, 0, info.cpu_count * sizeof(float));\n    }\n    return 0;\n  }\n\n  idx = 0;\n  while (!feof(stat_fp)) {\n    if (fgets(buf, 255, stat_fp) == nullptr) { break; }\n\n    if (strncmp(buf, \"procs_running \", 14) == 0) {\n      sscanf(buf, \"%*s %hu\", &info.run_threads);\n    } else if (strncmp(buf, \"cpu\", 3) == 0) {\n      double delta;\n      if (isdigit((unsigned char)buf[3])) {\n        idx++;  // just increment here since the CPU index can skip numbers\n      } else {\n        idx = 0;\n      }\n      if (idx > info.cpu_count) { continue; }\n      sscanf(buf, stat_template, &(cpu[idx].cpu_user), &(cpu[idx].cpu_nice),\n             &(cpu[idx].cpu_system), &(cpu[idx].cpu_idle),\n             &(cpu[idx].cpu_iowait), &(cpu[idx].cpu_irq),\n             &(cpu[idx].cpu_softirq), &(cpu[idx].cpu_steal));\n\n      cpu[idx].cpu_total = cpu[idx].cpu_user + cpu[idx].cpu_nice +\n                           cpu[idx].cpu_system + cpu[idx].cpu_idle +\n                           cpu[idx].cpu_iowait + cpu[idx].cpu_irq +\n                           cpu[idx].cpu_softirq + cpu[idx].cpu_steal;\n\n      cpu[idx].cpu_active_total =\n          cpu[idx].cpu_total - (cpu[idx].cpu_idle + cpu[idx].cpu_iowait);\n\n      delta = current_update_time - last_update_time;\n\n      if (delta <= 0.001) { break; }\n\n      cur_total = (float)(cpu[idx].cpu_total - cpu[idx].cpu_last_total);\n      if (cur_total == 0.0) {\n        cpu[idx].cpu_val[0] = 1.0;\n      } else {\n        cpu[idx].cpu_val[0] =\n            (cpu[idx].cpu_active_total - cpu[idx].cpu_last_active_total) /\n            cur_total;\n      }\n      curtmp = 0;\n\n      int samples = std::min(cpu_avg_samples.get(*state), CPU_SAMPLE_COUNT);\n      for (i = 0; i < samples; i++) { curtmp = curtmp + cpu[idx].cpu_val[i]; }\n      info.cpu_usage[idx] = curtmp / samples;\n\n      cpu[idx].cpu_last_total = cpu[idx].cpu_total;\n      cpu[idx].cpu_last_active_total = cpu[idx].cpu_active_total;\n      for (i = samples - 1; i > 0 && i < CPU_SAMPLE_COUNT; i--) {\n        cpu[idx].cpu_val[i] = cpu[idx].cpu_val[i - 1];\n      }\n    }\n  }\n  fclose(stat_fp);\n  return 0;\n}\n\nint update_running_processes(void) {\n  update_stat();\n  return 0;\n}\n\nint update_cpu_usage(void) {\n  struct timespec tc = {0L, 100L * 1000000L};\n  update_stat();\n  if (-1 == (nanosleep(&tc, NULL))) {\n    NORM_ERR(\"update_cpu_usage(): nanosleep() failed\");\n    return 0;\n  }\n  update_stat();\n  return 0;\n}\n\nvoid free_cpu(struct text_object *) { /* no-op */\n}\n\n// fscanf() that reads floats with points even if you are using a locale where\n// floats are with commas\nint fscanf_no_i18n(FILE *stream, const char *format, ...) {\n  int returncode;\n  va_list ap;\n\n#ifdef BUILD_I18N\n  char *oldlocale = strdup(setlocale(LC_NUMERIC, nullptr));\n\n  setlocale(LC_NUMERIC, \"C\");\n#endif\n  va_start(ap, format);\n  returncode = vfscanf(stream, format, ap);\n  va_end(ap);\n#ifdef BUILD_I18N\n  setlocale(LC_NUMERIC, oldlocale);\n  free(oldlocale);\n#endif\n  return returncode;\n}\n\nint update_load_average(void) {\n#ifdef HAVE_GETLOADAVG\n  if (!prefer_proc) {\n    double v[3];\n\n    getloadavg(v, 3);\n    info.loadavg[0] = (float)v[0];\n    info.loadavg[1] = (float)v[1];\n    info.loadavg[2] = (float)v[2];\n  } else\n#endif\n  {\n    static int reported = 0;\n    FILE *fp;\n\n    if (!(fp = open_file(\"/proc/loadavg\", &reported))) {\n      info.loadavg[0] = info.loadavg[1] = info.loadavg[2] = 0.0;\n      return 0;\n    }\n    if (fscanf_no_i18n(fp, \"%f %f %f\", &info.loadavg[0], &info.loadavg[1],\n                       &info.loadavg[2]) < 0)\n      info.loadavg[0] = info.loadavg[1] = info.loadavg[2] = 0.0;\n    fclose(fp);\n  }\n  return 0;\n}\n\n/***********************************************************/\n/***********************************************************/\n/***********************************************************/\n\nstatic int no_dots(const struct dirent *d) {\n  if (d->d_name[0] == '.') { return 0; }\n  return 1;\n}\n\nstatic int get_first_file_in_a_directory(const char *dir, char *s,\n                                         int *reported) {\n  struct dirent **namelist;\n  int i, n;\n\n  n = scandir(dir, &namelist, no_dots, alphasort);\n  if (n < 0) {\n    if (!reported || !*reported) {\n      NORM_ERR(\"scandir for %s: %s\", dir, strerror(errno));\n      if (reported) { *reported = 1; }\n    }\n    return 0;\n  } else {\n    if (n == 0) { return 0; }\n\n    strncpy(s, namelist[0]->d_name, 255);\n    s[255] = '\\0';\n\n    for (i = 0; i < n; i++) { free(namelist[i]); }\n    free(namelist);\n\n    return 1;\n  }\n}\n\n/*\n * Convert @dev \"0\" (hwmon number) or \"k10temp\" (hwmon name) to \"hwmon2/device\"\n */\nstatic void get_dev_path(const char *dir, const char *dev, char *out_buf) {\n  struct dirent **namelist;\n  char path[512] = {'\\0'};\n  char name[512] = {'\\0'};\n  bool found = false;\n  size_t size;\n  int name_fd;\n  int i;\n  int n;\n  int ret;\n\n  /* \"0\" numbered case */\n  ret = sscanf(dev, \"%d\", &n);\n  if (ret == 1) {\n    snprintf(out_buf, 256, \"hwmon%d/device\", n);\n    return;\n  }\n\n  /* \"k10temp\" name case, need to search hwmon*->name to find a match */\n  n = scandir(dir, &namelist, no_dots, alphasort);\n  if (n < 0) {\n    NORM_ERR(\"scandir for %s: %s\", dir, strerror(errno));\n    goto not_found;\n  }\n  if (n == 0) goto not_found;\n\n  /* Search each hwmon%s/name */\n  for (i = 0; i < n; i++) {\n    if (found) continue;\n\n    snprintf(path, 512, \"%s%s/name\", dir, namelist[i]->d_name);\n    name_fd = open(path, O_RDONLY);\n    if (name_fd < 0) {\n      snprintf(path, 512, \"%s%s/device/name\", dir, namelist[i]->d_name);\n      name_fd = open(path, O_RDONLY);\n      if (name_fd < 0) continue;\n    }\n    size = read(name_fd, name, strlen(dev));\n    if (size < strlen(dev)) {\n      close(name_fd);\n      continue;\n    }\n    ret = strncmp(dev, name, strlen(dev));\n    if (!ret) {\n      found = true;\n      snprintf(out_buf, 512, \"%s/device\", namelist[i]->d_name);\n    }\n    close(name_fd);\n  }\n\n  /* cleanup */\n  for (i = 0; i < n; i++) free(namelist[i]);\n  free(namelist);\n  if (found) return;\n\nnot_found:\n  out_buf[0] = '\\0';\n  return;\n}\n\nstatic int open_sysfs_sensor(const char *dir, const char *dev, const char *type,\n                             int n, int *divisor, char *devtype) {\n  char path[256];\n  char buf[512];\n  int fd;\n  int divfd;\n\n  memset(buf, 0, sizeof(buf));\n\n  /* if device is nullptr or *, get first */\n  if (dev == nullptr || strcmp(dev, \"*\") == 0) {\n    static int reported = 0;\n\n    if (!get_first_file_in_a_directory(dir, buf, &reported)) { return -1; }\n    dev = buf;\n  }\n\n  if (strcmp(dir, \"/sys/class/hwmon/\") == 0) {\n    if (*buf) {\n      /* buf holds result from get_first_file_in_a_directory() above,\n       * e.g. \"hwmon0\" -- append \"/device\" */\n      strncat(buf, \"/device\", 255 - strnlen(buf, 255));\n    } else {\n      /*\n       * @dev holds device number N or hwmon name as a string,\n       * convert them as:\n       * \"0\" -> \"hwmon0/device\"\n       * \"k10temp\" -> \"hwmon2/device\", where hwmon2/name is \"k10temp\"\n       */\n      get_dev_path(dir, dev, buf);\n      /* Not found */\n      if (buf[0] == '\\0') {\n        NORM_ERR(\"can't parse device \\\"%s\\\"\", dev);\n        return -1;\n      }\n      dev = buf;\n    }\n  }\n\n  /* change vol to in, tempf to temp */\n  if (strcmp(type, \"vol\") == 0) {\n    type = \"in\";\n  } else if (strcmp(type, \"tempf\") == 0) {\n    type = \"temp\";\n  } else if (strcmp(type, \"temp2\") == 0) {\n    type = \"temp\";\n  }\n\n  DBGP(\"%s: dir=%s dev=%s type=%s n=%d\\n\", __func__, dir, dev, type, n);\n  /* construct path */\n  snprintf(path, 255, \"%s%s/%s%d_input\", dir, dev, type, n);\n\n  /* first, attempt to open file in /device */\n  fd = open(path, O_RDONLY);\n  if (fd < 0) {\n    /* if it fails, strip the /device from dev and attempt again */\n    size_t len_to_trunc = std::max((size_t)7, strnlen(buf, 255)) - 7;\n    buf[len_to_trunc] = 0;\n    snprintf(path, 255, \"%s%s/%s%d_input\", dir, dev, type, n);\n    fd = open(path, O_RDONLY);\n    if (fd < 0) {\n      NORM_ERR(\n          \"can't open '%s': %s\\nplease check your device or remove this \"\n          \"var from \" PACKAGE_NAME,\n          path, strerror(errno));\n    }\n  }\n\n  strncpy(devtype, path, 255);\n\n  if (strcmp(type, \"in\") == 0 || strcmp(type, \"temp\") == 0 ||\n      strcmp(type, \"tempf\") == 0) {\n    *divisor = 1;\n  } else {\n    *divisor = 0;\n  }\n  /* fan does not use *_div as a read divisor */\n  if (strcmp(\"fan\", type) == 0) { return fd; }\n\n  /* test if *_div file exist, open it and use it as divisor */\n  if (strcmp(type, \"tempf\") == 0) {\n    snprintf(path, 255, \"%s%s/%s%d_div\", dir, \"one\", \"two\", n);\n  } else {\n    snprintf(path, 255, \"%s%s/%s%d_div\", dir, dev, type, n);\n  }\n\n  divfd = open(path, O_RDONLY);\n  if (divfd > 0) {\n    /* read integer */\n    char divbuf[64];\n    int divn;\n\n    divn = read(divfd, divbuf, 63);\n    /* should read until n == 0 but I doubt that kernel will give these\n     * in multiple pieces. :) */\n    if (divn < 0) {\n      NORM_ERR(\"open_sysfs_sensor(): can't read from sysfs\");\n    } else {\n      divbuf[divn] = '\\0';\n      *divisor = strtol(divbuf, nullptr, 10);\n    }\n    close(divfd);\n  }\n\n  return fd;\n}\n\nstatic double get_sysfs_info(int *fd, int divisor, char *devtype, char *type) {\n  int val = 0;\n\n  if (*fd <= 0) { return 0; }\n\n  lseek(*fd, 0, SEEK_SET);\n\n  /* read integer */\n  {\n    char buf[64];\n    int n;\n    n = read(*fd, buf, 63);\n    /* should read until n == 0 but I doubt that kernel will give these\n     * in multiple pieces. :) */\n    if (n < 0) {\n      NORM_ERR(\"get_sysfs_info(): read from %s failed\\n\", devtype);\n    } else {\n      buf[n] = '\\0';\n      val = strtol(buf, nullptr, 10);\n    }\n  }\n\n  close(*fd);\n  /* open file */\n  *fd = open(devtype, O_RDONLY);\n  if (*fd < 0) { NORM_ERR(\"can't open '%s': %s\", devtype, strerror(errno)); }\n\n  /* My dirty hack for computing CPU value\n   * Filedil, from forums.gentoo.org */\n  /* if (strstr(devtype, \"temp1_input\") != nullptr) {\n    return -15.096 + 1.4893 * (val / 1000.0);\n  } */\n\n  /* divide voltage and temperature by 1000 */\n  /* or if any other divisor is given, use that */\n  if (0 == (strcmp(type, \"temp2\"))) {\n    temp2 = \"temp2\";\n  } else {\n    temp2 = \"empty\";\n  }\n  if (strcmp(type, \"tempf\") == 0) {\n    if (divisor > 1) {\n      return ((val / divisor + 40) * 9.0 / 5) - 40;\n    } else if (divisor) {\n      return ((val / 1000.0 + 40) * 9.0 / 5) - 40;\n    } else {\n      return ((val + 40) * 9.0 / 5) - 40;\n    }\n  } else {\n    if (divisor > 1) {\n      return val / divisor;\n    } else if (divisor) {\n      return val / 1000.0;\n    } else {\n      return val;\n    }\n  }\n}\n\n#define HWMON_RESET() \\\n  {                   \\\n    buf1[0] = 0;      \\\n    factor = 1.0;     \\\n    offset = 0.0;     \\\n  }\n\nstatic void parse_sysfs_sensor(struct text_object *obj, const char *arg,\n                               const char *path, const char *type) {\n  char buf1[64], buf2[64];\n  float factor, offset;\n  int n, found = 0;\n  struct sysfs *sf;\n  memset(buf1, 0, 64);\n  memset(buf2, 0, 64);\n\n  if (sscanf(arg, \"%63s %d %f %f\", buf2, &n, &factor, &offset) == 4)\n    found = 1;\n  else\n    HWMON_RESET();\n  if (!found &&\n      sscanf(arg, \"%63s %63s %d %f %f\", buf1, buf2, &n, &factor, &offset) == 5)\n    found = 1;\n  else if (!found)\n    HWMON_RESET();\n  if (!found && sscanf(arg, \"%63s %63s %d\", buf1, buf2, &n) == 3)\n    found = 1;\n  else if (!found)\n    HWMON_RESET();\n  if (!found && sscanf(arg, \"%63s %d\", buf2, &n) == 2)\n    found = 1;\n  else if (!found)\n    HWMON_RESET();\n\n  if (!found) {\n    obj_be_plain_text(obj, \"fail\");\n    return;\n  }\n  DBGP(\"parsed %s args: '%s' '%s' %d %f %f\\n\", type, buf1, buf2, n, factor,\n       offset);\n  sf = (struct sysfs *)malloc(sizeof(struct sysfs));\n  memset(sf, 0, sizeof(struct sysfs));\n  sf->fd = open_sysfs_sensor(path, (*buf1) ? buf1 : 0, buf2, n, &sf->arg,\n                             sf->devtype);\n  strncpy(sf->type, buf2, 63);\n  sf->factor = factor;\n  sf->offset = offset;\n  obj->data.opaque = sf;\n}\n\n#define PARSER_GENERATOR(name, path)                                     \\\n  void parse_##name##_sensor(struct text_object *obj, const char *arg) { \\\n    parse_sysfs_sensor(obj, arg, path, #name);                           \\\n  }\n\nPARSER_GENERATOR(i2c, \"/sys/bus/i2c/devices/\")\nPARSER_GENERATOR(hwmon, \"/sys/class/hwmon/\")\nPARSER_GENERATOR(platform, \"/sys/bus/platform/devices/\")\n\nvoid print_sysfs_sensor(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  double r;\n  struct sysfs *sf = (struct sysfs *)obj->data.opaque;\n\n  if (!sf || sf->fd < 0) return;\n\n  r = get_sysfs_info(&sf->fd, sf->arg, sf->devtype, sf->type);\n\n  r = r * sf->factor + sf->offset;\n\n  if (0 == (strcmp(temp2, \"temp2\"))) {\n    temp_print(p, p_max_size, r, TEMP_CELSIUS, 0);\n  } else if (!strncmp(sf->type, \"temp\", 4)) {\n    temp_print(p, p_max_size, r, TEMP_CELSIUS, 1);\n  } else if (r >= 100.0 || r == 0) {\n    snprintf(p, p_max_size, \"%d\", (int)r);\n  } else {\n    snprintf(p, p_max_size, \"%.1f\", r);\n  }\n}\n\nvoid free_sysfs_sensor(struct text_object *obj) {\n  struct sysfs *sf = (struct sysfs *)obj->data.opaque;\n\n  if (!sf) return;\n\n  if (sf->fd >= 0) close(sf->fd);\n  free_and_zero(obj->data.opaque);\n}\n\n#define CPUFREQ_PREFIX \"/sys/devices/system/cpu\"\n#define CPUFREQ_POSTFIX \"cpufreq/scaling_cur_freq\"\n\n/* return system frequency in MHz (use divisor=1) or GHz (use divisor=1000) */\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  FILE *f;\n  static int reported = 0;\n  char frequency[32];\n  char s[256];\n  double freq = 0;\n\n  if (!p_client_buffer || client_buffer_size <= 0 || !p_format ||\n      divisor <= 0) {\n    return 0;\n  }\n\n  if (!prefer_proc) {\n    char current_freq_file[128];\n\n    snprintf(current_freq_file, 127, \"%s/cpu%d/%s\", CPUFREQ_PREFIX, cpu - 1,\n             CPUFREQ_POSTFIX);\n    f = fopen(current_freq_file, \"r\");\n    if (f) {\n      /* if there's a cpufreq /sys node, read the current frequency from\n       * this node and divide by 1000 to get Mhz. */\n      if (fgets(s, sizeof(s), f)) {\n        s[strlen(s) - 1] = '\\0';\n        freq = strtod(s, nullptr);\n      }\n      fclose(f);\n      snprintf(p_client_buffer, client_buffer_size, p_format,\n               (freq / 1000) / divisor);\n      return 1;\n    }\n  }\n\n  // open the CPU information file\n  f = open_file(\"/proc/cpuinfo\", &reported);\n  if (!f) {\n    perror(PACKAGE_NAME \": Failed to access '/proc/cpuinfo' at get_freq()\");\n    return 0;\n  }\n\n  // read the file\n  while (fgets(s, sizeof(s), f) != nullptr) {\n#if defined(__i386) || defined(__x86_64)\n    // and search for the cpu mhz\n    if (strncmp(s, \"cpu MHz\", 7) == 0 && cpu == 0) {\n#else\n#if defined(__alpha)\n    // different on alpha\n    if (strncmp(s, \"cycle frequency [Hz]\", 20) == 0 && cpu == 0) {\n#else\n    // this is different on ppc for some reason\n    if (strncmp(s, \"clock\", 5) == 0 && cpu == 0) {\n#endif  // defined(__alpha)\n#endif  // defined(__i386) || defined(__x86_64)\n\n      // copy just the number\n      strncpy(frequency, strchr(s, ':') + 2, 32);\n#if defined(__alpha)\n      // strip \" est.\\n\"\n      frequency[strlen(frequency) - 6] = '\\0';\n      // kernel reports in Hz\n      freq = strtod(frequency, nullptr) / 1000000;\n#else\n      // strip \\n\n      frequency[strlen(frequency) - 1] = '\\0';\n      freq = strtod(frequency, nullptr);\n#endif\n      break;\n    }\n    if (strncmp(s, \"processor\", 9) == 0) {\n      cpu--;\n      continue;\n    }\n  }\n\n  fclose(f);\n  snprintf(p_client_buffer, client_buffer_size, p_format,\n           (float)freq / divisor);\n  return 1;\n}\n\n#define CPUFREQ_GOVERNOR \"cpufreq/scaling_governor\"\n\n/* print the CPU scaling governor */\nvoid print_cpugovernor(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  FILE *fp;\n  char buf[64];\n  unsigned int cpu = obj->data.i;\n\n  cpu--;\n  snprintf(buf, 63, \"%s/cpu%d/%s\", CPUFREQ_PREFIX, cpu, CPUFREQ_GOVERNOR);\n  if ((fp = fopen(buf, \"r\")) != nullptr) {\n    while (fscanf(fp, \"%63s\", buf) == 1) {\n      snprintf(p, p_max_size, \"%s\", buf);\n      fclose(fp);\n      return;\n    }\n  }\n}\n\n#define CPUFREQ_VOLTAGE \"cpufreq/scaling_voltages\"\n\n/* /sys/devices/system/cpu/cpu0/cpufreq/scaling_voltages looks something\n * like this:\n# frequency voltage\n1800000 1340\n1600000 1292\n1400000 1100\n1200000 988\n1000000 1116\n800000 1004\n600000 988\n * Peter Tarjan (ptarjan@citromail.hu) */\n\n/* return cpu voltage in mV (use divisor=1) or V (use divisor=1000) */\nstatic char get_voltage(char *p_client_buffer, size_t client_buffer_size,\n                        const char *p_format, int divisor, unsigned int cpu) {\n  FILE *f;\n  char s[256];\n  int freq = 0;\n  int voltage = 0;\n  char current_freq_file[128];\n  int freq_comp = 0;\n\n  /* build the voltage file name */\n  cpu--;\n  snprintf(current_freq_file, 127, \"%s/cpu%d/%s\", CPUFREQ_PREFIX, cpu,\n           CPUFREQ_POSTFIX);\n\n  if (!p_client_buffer || client_buffer_size <= 0 || !p_format ||\n      divisor <= 0) {\n    return 0;\n  }\n\n  /* read the current cpu frequency from the /sys node */\n  f = fopen(current_freq_file, \"r\");\n  if (f) {\n    if (fgets(s, sizeof(s), f)) {\n      s[strlen(s) - 1] = '\\0';\n      freq = strtod(s, nullptr);\n    }\n    fclose(f);\n  } else {\n    fprintf(stderr, PACKAGE_NAME \": Failed to access '%s' at \",\n            current_freq_file);\n    perror(\"get_voltage()\");\n    return 0;\n  }\n\n  snprintf(current_freq_file, 127, \"%s/cpu%d/%s\", CPUFREQ_PREFIX, cpu,\n           CPUFREQ_VOLTAGE);\n\n  /* use the current cpu frequency to find the corresponding voltage */\n  f = fopen(current_freq_file, \"r\");\n\n  if (f) {\n    while (!feof(f)) {\n      char line[256];\n\n      if (fgets(line, 255, f) == nullptr) { break; }\n      sscanf(line, \"%d %d\", &freq_comp, &voltage);\n      if (freq_comp == freq) { break; }\n    }\n    fclose(f);\n  } else {\n    fprintf(stderr, PACKAGE_NAME \": Failed to access '%s' at \",\n            current_freq_file);\n    perror(\"get_voltage()\");\n    return 0;\n  }\n  snprintf(p_client_buffer, client_buffer_size, p_format,\n           (float)voltage / divisor);\n  return 1;\n}\n\nvoid print_voltage_mv(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  static int ok = 1;\n  if (ok) { ok = get_voltage(p, p_max_size, \"%.0f\", 1, obj->data.i); }\n}\n\nvoid print_voltage_v(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  static int ok = 1;\n  if (ok) { ok = get_voltage(p, p_max_size, \"%'.3f\", 1000, obj->data.i); }\n}\n\n#define ACPI_FAN_DIR \"/proc/acpi/fan/\"\n\nvoid get_acpi_fan(char *p_client_buffer, size_t client_buffer_size) {\n  static int reported = 0;\n  char buf[512];\n  char buf2[512];\n  FILE *fp;\n\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  /* yeah, slow... :/ */\n  if (!get_first_file_in_a_directory(ACPI_FAN_DIR, buf, &reported)) {\n    snprintf(p_client_buffer, client_buffer_size, \"%s\", \"no fans?\");\n    return;\n  }\n\n  snprintf(buf2, sizeof(buf2), \"%s%.256s/state\", ACPI_FAN_DIR, buf);\n\n  fp = open_file(buf2, &reported);\n  if (!fp) {\n    snprintf(p_client_buffer, client_buffer_size, \"%s\",\n             \"can't open fan's state file\");\n    return;\n  }\n  memset(buf, 0, sizeof(buf));\n  if (fscanf(fp, \"%*s %99s\", buf) <= 0) perror(\"fscanf()\");\n  fclose(fp);\n\n  snprintf(p_client_buffer, client_buffer_size, \"%s\", buf);\n}\n\n#define SYSFS_AC_ADAPTER_DIR \"/sys/class/power_supply\"\n#define ACPI_AC_ADAPTER_DIR \"/proc/acpi/ac_adapter/\"\n/* Linux 2.6.25 onwards ac adapter info is in\n   /sys/class/power_supply/AC/\n   On my system I get the following.\n     /sys/class/power_supply/AC/uevent:\n     PHYSDEVPATH=/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:01/PNP0C09:00/ACPI0003:00\n     PHYSDEVBUS=acpi\n     PHYSDEVDRIVER=ac\n     POWER_SUPPLY_NAME=AC\n     POWER_SUPPLY_TYPE=Mains\n     POWER_SUPPLY_ONLINE=1\n\n   Update: it seems the folder name is hardware-dependent. We add an additional\n   adapter argument, specifying the folder name.\n\n   Update: on some systems it's /sys/class/power_supply/ADP1 instead of\n   /sys/class/power_supply/AC\n*/\n\nvoid get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,\n                         const char *adapter) {\n  static int reported = 0;\n\n  char buf[512];\n  char buf2[512];\n  struct stat sb;\n  FILE *fp;\n\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  if (adapter)\n    snprintf(buf2, sizeof(buf2), \"%s/%s/uevent\", SYSFS_AC_ADAPTER_DIR, adapter);\n  else {\n    snprintf(buf2, sizeof(buf2), \"%s/AC/uevent\", SYSFS_AC_ADAPTER_DIR);\n    if (stat(buf2, &sb) == -1)\n      snprintf(buf2, sizeof(buf2), \"%s/ADP1/uevent\", SYSFS_AC_ADAPTER_DIR);\n  }\n  if (stat(buf2, &sb) == 0)\n    fp = open_file(buf2, &reported);\n  else\n    fp = 0;\n  if (fp) {\n    /* sysfs processing */\n    while (!feof(fp)) {\n      if (fgets(buf, sizeof(buf), fp) == nullptr) break;\n\n      if (strncmp(buf, \"POWER_SUPPLY_ONLINE=\", 20) == 0) {\n        int online = 0;\n        sscanf(buf, \"POWER_SUPPLY_ONLINE=%d\", &online);\n        snprintf(p_client_buffer, client_buffer_size, \"%s-line\",\n                 (online ? \"on\" : \"off\"));\n        break;\n      }\n    }\n    fclose(fp);\n  } else {\n    /* yeah, slow... :/ */\n    if (!get_first_file_in_a_directory(ACPI_AC_ADAPTER_DIR, buf, &reported)) {\n      snprintf(p_client_buffer, client_buffer_size, \"%s\", \"no ac_adapters?\");\n      return;\n    }\n\n    snprintf(buf2, sizeof(buf2), \"%s%.256s/state\", ACPI_AC_ADAPTER_DIR, buf);\n\n    fp = open_file(buf2, &reported);\n    if (!fp) {\n      snprintf(p_client_buffer, client_buffer_size, \"%s\",\n               \"No ac adapter found.... where is it?\");\n      return;\n    }\n    memset(buf, 0, sizeof(buf));\n    if (fscanf(fp, \"%*s %99s\", buf) <= 0) perror(\"fscanf()\");\n    fclose(fp);\n\n    snprintf(p_client_buffer, client_buffer_size, \"%s\", buf);\n  }\n}\n\n/*\n/proc/acpi/thermal_zone/THRM/cooling_mode\ncooling mode:            active\n/proc/acpi/thermal_zone/THRM/polling_frequency\n<polling disabled>\n/proc/acpi/thermal_zone/THRM/state\nstate:                   ok\n/proc/acpi/thermal_zone/THRM/temperature\ntemperature:             45 C\n/proc/acpi/thermal_zone/THRM/trip_points\ncritical (S5):           73 C\npassive:                 73 C: tc1=4 tc2=3 tsp=40 devices=0xcdf6e6c0\n*/\n\n#define ACPI_THERMAL_ZONE_DEFAULT \"thermal_zone0\"\n#define ACPI_THERMAL_FORMAT \"/sys/class/thermal/%s/temp\"\n\nint open_acpi_temperature(const char *name) {\n  char path[256];\n  int fd;\n\n  if (name == nullptr || strcmp(name, \"*\") == 0) {\n    snprintf(path, 255, ACPI_THERMAL_FORMAT, ACPI_THERMAL_ZONE_DEFAULT);\n  } else {\n    snprintf(path, 255, ACPI_THERMAL_FORMAT, name);\n  }\n\n  fd = open(path, O_RDONLY);\n  if (fd < 0) { NORM_ERR(\"can't open '%s': %s\", path, strerror(errno)); }\n\n  return fd;\n}\n\nstatic double last_acpi_temp;\nstatic double last_acpi_temp_time;\n\n// the maximum length of the string inside a ACPI_THERMAL_FORMAT file including\n// the ending 0\n#define MAXTHERMZONELEN 7\n\ndouble get_acpi_temperature(int fd) {\n  if (fd <= 0) { return 0; }\n\n  /* don't update acpi temperature too often */\n  if (current_update_time - last_acpi_temp_time < 11.32) {\n    return last_acpi_temp;\n  }\n  last_acpi_temp_time = current_update_time;\n\n  /* seek to beginning */\n  lseek(fd, 0, SEEK_SET);\n\n  /* read */\n  {\n    char buf[MAXTHERMZONELEN];\n    int n;\n\n    n = read(fd, buf, MAXTHERMZONELEN - 1);\n    if (n < 0) {\n      NORM_ERR(\"can't read fd %d: %s\", fd, strerror(errno));\n    } else {\n      buf[n] = '\\0';\n      sscanf(buf, \"%lf\", &last_acpi_temp);\n      last_acpi_temp /= 1000;\n    }\n  }\n\n  return last_acpi_temp;\n}\n\n/*\nhipo@lepakko hipo $ cat /proc/acpi/battery/BAT1/info\npresent:                 yes\ndesign capacity:         4400 mAh\nlast full capacity:      4064 mAh\nbattery technology:      rechargeable\ndesign voltage:          14800 mV\ndesign capacity warning: 300 mAh\ndesign capacity low:     200 mAh\ncapacity granularity 1:  32 mAh\ncapacity granularity 2:  32 mAh\nmodel number:            02KT\nserial number:           16922\nbattery type:            LION\nOEM info:                SANYO\n*/\n\n/*\nhipo@lepakko conky $ cat /proc/acpi/battery/BAT1/state\npresent:                 yes\ncapacity state:          ok\ncharging state:          unknown\npresent rate:            0 mA\nremaining capacity:      4064 mAh\npresent voltage:         16608 mV\n*/\n\n/*\n2213<@jupetkellari> jupet@lagi-unstable:~$ cat /proc/apm\n2213<@jupetkellari> 1.16 1.2 0x03 0x01 0xff 0x10 -1% -1 ?\n2213<@jupetkellari> (-1 ollee ei akkua kiinni, koska akku on pydll)\n2214<@jupetkellari> jupet@lagi-unstable:~$ cat /proc/apm\n2214<@jupetkellari> 1.16 1.2 0x03 0x01 0x03 0x09 98% -1 ?\n\n2238<@jupetkellari> 1.16 1.2 0x03 0x00 0x00 0x01 100% -1 ? ilman verkkovirtaa\n2239<@jupetkellari> 1.16 1.2 0x03 0x01 0x00 0x01 99% -1 ? verkkovirralla\n\n2240<@jupetkellari> 1.16 1.2 0x03 0x01 0x03 0x09 100% -1 ? verkkovirralla ja\nmonitori pll 2241<@jupetkellari> 1.16 1.2 0x03 0x00 0x00 0x01 99% -1 ?\nmonitori pll mutta ilman verkkovirtaa\n*/\n\n/* Kapil Hari Paranjape <kapil@imsc.res.in>\n  Linux 2.6.24 onwards battery info is in\n  /sys/class/power_supply/BAT0/\n  On my system I get the following.\n  /sys/class/power_supply/BAT0/uevent:\n  PHYSDEVPATH=/devices/LNXSYSTM:00/device:00/PNP0A03:00/device:01/PNP0C09:00/PNP0C0A:00\n  PHYSDEVBUS=acpi\n  PHYSDEVDRIVER=battery\n  POWER_SUPPLY_NAME=BAT0\n  POWER_SUPPLY_TYPE=Battery\n  POWER_SUPPLY_STATUS=Discharging\n  POWER_SUPPLY_PRESENT=1\n  POWER_SUPPLY_TECHNOLOGY=Li-ion\n  POWER_SUPPLY_VOLTAGE_MIN_DESIGN=10800000\n  POWER_SUPPLY_VOLTAGE_NOW=10780000\n  POWER_SUPPLY_CURRENT_NOW=13970000\n  POWER_SUPPLY_ENERGY_FULL_DESIGN=47510000\n  POWER_SUPPLY_ENERGY_FULL=27370000\n  POWER_SUPPLY_ENERGY_NOW=11810000\n  POWER_SUPPLY_MODEL_NAME=IBM-92P1060\n  POWER_SUPPLY_MANUFACTURER=Panasonic\n  On some systems POWER_SUPPLY_ENERGY_* is replaced by POWER_SUPPLY_CHARGE_*\n*/\n\n/* Tiago Marques Vale <tiagomarquesvale@gmail.com>\n  Regarding the comment above, since kernel 2.6.36.1 I have\n  POWER_SUPPLY_POWER_NOW instead of POWER_SUPPLY_CURRENT_NOW\n  See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=532000\n*/\n\n#define SYSFS_BATTERY_BASE_PATH \"/sys/class/power_supply\"\n#define ACPI_BATTERY_BASE_PATH \"/proc/acpi/battery\"\n#define APM_PATH \"/proc/apm\"\n#define MAX_BATTERY_COUNT 4\n\nstatic FILE *sysfs_bat_fp[MAX_BATTERY_COUNT] = {nullptr, NULL, NULL, NULL};\nstatic FILE *acpi_bat_fp[MAX_BATTERY_COUNT] = {nullptr, NULL, NULL, NULL};\nstatic FILE *apm_bat_fp[MAX_BATTERY_COUNT] = {nullptr, NULL, NULL, NULL};\n\nstatic int batteries_initialized = 0;\nstatic char batteries[MAX_BATTERY_COUNT][32];\n\nstatic int acpi_last_full[MAX_BATTERY_COUNT];\nstatic int acpi_design_capacity[MAX_BATTERY_COUNT];\n\n/* e.g. \"charging 75%\" */\nstatic char last_battery_str[MAX_BATTERY_COUNT][64];\n/* e.g. \"3h 15m\" */\nstatic char last_battery_time_str[MAX_BATTERY_COUNT][64];\n\nstatic double last_battery_time[MAX_BATTERY_COUNT];\n\nstatic int last_battery_perct[MAX_BATTERY_COUNT];\nstatic double last_battery_perct_time[MAX_BATTERY_COUNT];\n\nvoid init_batteries(void) {\n  int idx;\n\n  if (batteries_initialized) { return; }\n#ifdef HAVE_OPENMP\n#pragma omp parallel for schedule(dynamic, 10)\n#endif /* HAVE_OPENMP */\n  for (idx = 0; idx < MAX_BATTERY_COUNT; idx++) { batteries[idx][0] = '\\0'; }\n  batteries_initialized = 1;\n}\n\nint get_battery_idx(const char *bat) {\n  int idx;\n\n  for (idx = 0; idx < MAX_BATTERY_COUNT; idx++) {\n    if (!strlen(batteries[idx]) || !strcmp(batteries[idx], bat)) { break; }\n  }\n\n  /* if not found, enter a new entry */\n  if (!strlen(batteries[idx])) { snprintf(batteries[idx], 31, \"%s\", bat); }\n\n  return idx;\n}\n\nvoid set_return_value(char *buffer, unsigned int n, int item, int idx);\n\nvoid get_battery_stuff(char *buffer, unsigned int n, const char *bat,\n                       int item) {\n  static int idx, rep = 0, rep1 = 0, rep2 = 0;\n  char acpi_path[128];\n  char sysfs_path[128];\n\n  snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH \"/%s/state\", bat);\n  snprintf(sysfs_path, 127, SYSFS_BATTERY_BASE_PATH \"/%s/uevent\", bat);\n\n  init_batteries();\n\n  idx = get_battery_idx(bat);\n\n  /* don't update battery too often */\n  if (current_update_time - last_battery_time[idx] < 29.5) {\n    set_return_value(buffer, n, item, idx);\n    return;\n  }\n\n  last_battery_time[idx] = current_update_time;\n\n  memset(last_battery_str[idx], 0, sizeof(last_battery_str[idx]));\n  memset(last_battery_time_str[idx], 0, sizeof(last_battery_time_str[idx]));\n\n  /* first try SYSFS if that fails try ACPI */\n\n  if (sysfs_bat_fp[idx] == nullptr && acpi_bat_fp[idx] == NULL &&\n      apm_bat_fp[idx] == nullptr) {\n    sysfs_bat_fp[idx] = open_file(sysfs_path, &rep);\n  }\n\n  if (sysfs_bat_fp[idx] == nullptr && acpi_bat_fp[idx] == NULL &&\n      apm_bat_fp[idx] == nullptr) {\n    acpi_bat_fp[idx] = open_file(acpi_path, &rep1);\n  }\n\n  if (sysfs_bat_fp[idx] != nullptr) {\n    /* SYSFS */\n    int present_rate = -1;\n    int remaining_capacity = -1;\n    char charging_state[64];\n    char present[4];\n\n    strncpy(charging_state, \"unknown\", 64);\n\n    while (!feof(sysfs_bat_fp[idx])) {\n      char buf[256];\n      if (fgets(buf, 256, sysfs_bat_fp[idx]) == nullptr) break;\n\n      /* let's just hope units are ok */\n      if (strncmp(buf, \"POWER_SUPPLY_PRESENT=1\", 22) == 0)\n        strncpy(present, \"yes\", 4);\n      else if (strncmp(buf, \"POWER_SUPPLY_PRESENT=0\", 22) == 0)\n        strncpy(present, \"no\", 4);\n      else if (strncmp(buf, \"POWER_SUPPLY_STATUS=\", 20) == 0)\n        sscanf(buf, \"POWER_SUPPLY_STATUS=%63s\", charging_state);\n      /* present_rate is not the same as the current flowing now but it\n       * is the same value which was used in the past. so we continue the\n       * tradition! */\n      else if (strncmp(buf, \"POWER_SUPPLY_CURRENT_NOW=\", 25) == 0)\n        sscanf(buf, \"POWER_SUPPLY_CURRENT_NOW=%d\", &present_rate);\n      else if (strncmp(buf, \"POWER_SUPPLY_POWER_NOW=\", 23) == 0)\n        sscanf(buf, \"POWER_SUPPLY_POWER_NOW=%d\", &present_rate);\n      else if (strncmp(buf, \"POWER_SUPPLY_ENERGY_NOW=\", 24) == 0)\n        sscanf(buf, \"POWER_SUPPLY_ENERGY_NOW=%d\", &remaining_capacity);\n      else if (strncmp(buf, \"POWER_SUPPLY_ENERGY_FULL=\", 25) == 0)\n        sscanf(buf, \"POWER_SUPPLY_ENERGY_FULL=%d\", &acpi_last_full[idx]);\n      else if (strncmp(buf, \"POWER_SUPPLY_CHARGE_NOW=\", 24) == 0)\n        sscanf(buf, \"POWER_SUPPLY_CHARGE_NOW=%d\", &remaining_capacity);\n      else if (strncmp(buf, \"POWER_SUPPLY_CHARGE_FULL=\", 25) == 0)\n        sscanf(buf, \"POWER_SUPPLY_CHARGE_FULL=%d\", &acpi_last_full[idx]);\n    }\n\n    fclose(sysfs_bat_fp[idx]);\n    sysfs_bat_fp[idx] = nullptr;\n\n    /* Hellf[i]re notes that remaining capacity can exceed acpi_last_full */\n    if (remaining_capacity > acpi_last_full[idx])\n      acpi_last_full[idx] = remaining_capacity; /* normalize to 100% */\n\n    /* not present */\n    if (strcmp(present, \"No\") == 0) {\n      strncpy(last_battery_str[idx], \"not present\", 64);\n    }\n    /* charging */\n    else if (strcmp(charging_state, \"Charging\") == 0) {\n      if (acpi_last_full[idx] != 0 && present_rate > 0) {\n        /* e.g. charging 75% */\n        snprintf(\n            last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n            \"charging %i%%\",\n            (int)(((float)remaining_capacity / acpi_last_full[idx]) * 100));\n        /* e.g. 2h 37m */\n        format_seconds(\n            last_battery_time_str[idx], sizeof(last_battery_time_str[idx]) - 1,\n            (long)(((float)(acpi_last_full[idx] - remaining_capacity) /\n                    present_rate) *\n                   3600));\n      } else if (acpi_last_full[idx] != 0 && present_rate <= 0) {\n        snprintf(\n            last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n            \"charging %d%%\",\n            (int)(((float)remaining_capacity / acpi_last_full[idx]) * 100));\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      } else {\n        strncpy(last_battery_str[idx], \"charging\",\n                sizeof(last_battery_str[idx]) - 1);\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      }\n    }\n    /* discharging */\n    else if (strncmp(charging_state, \"Discharging\", 64) == 0) {\n      if (present_rate > 0) {\n        /* e.g. discharging 35% */\n        snprintf(\n            last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n            \"discharging %i%%\",\n            (int)(((float)remaining_capacity / acpi_last_full[idx]) * 100));\n        /* e.g. 1h 12m */\n        format_seconds(\n            last_battery_time_str[idx], sizeof(last_battery_time_str[idx]) - 1,\n            (long)(((float)remaining_capacity / present_rate) * 3600));\n      } else if (present_rate == 0) { /* Thanks to Nexox for this one */\n        snprintf(last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n                 \"full\");\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      } else {\n        snprintf(\n            last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n            \"discharging %d%%\",\n            (int)(((float)remaining_capacity / acpi_last_full[idx]) * 100));\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      }\n    }\n    /* charged */\n    /* thanks to Lukas Zapletal <lzap@seznam.cz> */\n    else if (strncmp(charging_state, \"Charged\", 64) == 0 ||\n             strncmp(charging_state, \"Full\", 64) == 0) {\n      /* Below happens with the second battery on my X40,\n       * when the second one is empty and the first one\n       * being charged. */\n      if (remaining_capacity == 0)\n        strncpy(last_battery_str[idx], \"empty\", 64);\n      else\n        strncpy(last_battery_str[idx], \"charged\", 64);\n    }\n    /* unknown, probably full / AC */\n    else {\n      if (acpi_last_full[idx] != 0 && remaining_capacity != acpi_last_full[idx])\n        snprintf(\n            last_battery_str[idx], 64, \"unknown %d%%\",\n            (int)(((float)remaining_capacity / acpi_last_full[idx]) * 100));\n      else\n        strncpy(last_battery_str[idx], \"not present\", 64);\n    }\n  } else if (acpi_bat_fp[idx] != nullptr) {\n    /* ACPI */\n    int present_rate = -1;\n    int remaining_capacity = -1;\n    char charging_state[64];\n    char present[5];\n\n    /* read last full capacity if it's zero */\n    if (acpi_last_full[idx] == 0) {\n      static int rep3 = 0;\n      char path[128];\n      FILE *fp;\n\n      snprintf(path, 127, ACPI_BATTERY_BASE_PATH \"/%s/info\", bat);\n      fp = open_file(path, &rep3);\n      if (fp != nullptr) {\n        while (!feof(fp)) {\n          char b[256];\n\n          if (fgets(b, 256, fp) == nullptr) { break; }\n          if (sscanf(b, \"last full capacity: %d\", &acpi_last_full[idx]) != 0) {\n            break;\n          }\n        }\n\n        fclose(fp);\n      }\n    }\n\n    fseek(acpi_bat_fp[idx], 0, SEEK_SET);\n\n    strncpy(charging_state, \"unknown\", 8);\n\n    while (!feof(acpi_bat_fp[idx])) {\n      char buf[256];\n\n      if (fgets(buf, 256, acpi_bat_fp[idx]) == nullptr) { break; }\n\n      /* let's just hope units are ok */\n      if (strncmp(buf, \"present:\", 8) == 0) {\n        sscanf(buf, \"present: %4s\", present);\n      } else if (strncmp(buf, \"charging state:\", 15) == 0) {\n        sscanf(buf, \"charging state: %63s\", charging_state);\n      } else if (strncmp(buf, \"present rate:\", 13) == 0) {\n        sscanf(buf, \"present rate: %d\", &present_rate);\n      } else if (strncmp(buf, \"remaining capacity:\", 19) == 0) {\n        sscanf(buf, \"remaining capacity: %d\", &remaining_capacity);\n      }\n    }\n    /* Hellf[i]re notes that remaining capacity can exceed acpi_last_full */\n    if (remaining_capacity > acpi_last_full[idx]) {\n      /* normalize to 100% */\n      acpi_last_full[idx] = remaining_capacity;\n    }\n\n    /* not present */\n    if (strcmp(present, \"no\") == 0) {\n      strncpy(last_battery_str[idx], \"not present\", 64);\n      /* charging */\n    } else if (strcmp(charging_state, \"charging\") == 0) {\n      if (acpi_last_full[idx] != 0 && present_rate > 0) {\n        /* e.g. charging 75% */\n        snprintf(last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n                 \"charging %i%%\",\n                 (int)((remaining_capacity * 100) / acpi_last_full[idx]));\n        /* e.g. 2h 37m */\n        format_seconds(\n            last_battery_time_str[idx], sizeof(last_battery_time_str[idx]) - 1,\n            (long)(((acpi_last_full[idx] - remaining_capacity) * 3600) /\n                   present_rate));\n      } else if (acpi_last_full[idx] != 0 && present_rate <= 0) {\n        snprintf(last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n                 \"charging %d%%\",\n                 (int)((remaining_capacity * 100) / acpi_last_full[idx]));\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      } else {\n        strncpy(last_battery_str[idx], \"charging\",\n                sizeof(last_battery_str[idx]) - 1);\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      }\n      /* discharging */\n    } else if (strncmp(charging_state, \"discharging\", 64) == 0) {\n      if (present_rate > 0) {\n        /* e.g. discharging 35% */\n        snprintf(last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n                 \"discharging %i%%\",\n                 (int)((remaining_capacity * 100) / acpi_last_full[idx]));\n        /* e.g. 1h 12m */\n        format_seconds(last_battery_time_str[idx],\n                       sizeof(last_battery_time_str[idx]) - 1,\n                       (long)((remaining_capacity * 3600) / present_rate));\n      } else if (present_rate == 0) { /* Thanks to Nexox for this one */\n        snprintf(last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n                 \"charged\");\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      } else {\n        snprintf(last_battery_str[idx], sizeof(last_battery_str[idx]) - 1,\n                 \"discharging %d%%\",\n                 (int)((remaining_capacity * 100) / acpi_last_full[idx]));\n        snprintf(last_battery_time_str[idx],\n                 sizeof(last_battery_time_str[idx]) - 1, \"%s\", \"unknown\");\n      }\n      /* charged */\n    } else if (strncmp(charging_state, \"charged\", 64) == 0) {\n      /* thanks to Lukas Zapletal <lzap@seznam.cz> */\n      /* Below happens with the second battery on my X40,\n       * when the second one is empty and the first one being charged. */\n      if (remaining_capacity == 0) {\n        strncpy(last_battery_str[idx], \"empty\", 6);\n      } else {\n        strncpy(last_battery_str[idx], \"charged\", 8);\n      }\n      /* unknown, probably full / AC */\n    } else {\n      if (strncmp(charging_state, \"Full\", 64) == 0) {\n        strncpy(last_battery_str[idx], \"charged\", 64);\n      } else if (acpi_last_full[idx] != 0 &&\n                 remaining_capacity != acpi_last_full[idx]) {\n        snprintf(last_battery_str[idx], 64, \"unknown %d%%\",\n                 (int)((remaining_capacity * 100) / acpi_last_full[idx]));\n      } else {\n        strncpy(last_battery_str[idx], \"not present\", 64);\n      }\n    }\n    fclose(acpi_bat_fp[idx]);\n    acpi_bat_fp[idx] = nullptr;\n  } else {\n    /* APM */\n    if (apm_bat_fp[idx] == nullptr) {\n      apm_bat_fp[idx] = open_file(APM_PATH, &rep2);\n    }\n\n    if (apm_bat_fp[idx] != nullptr) {\n      unsigned int ac, status, flag;\n      int life;\n\n      if (fscanf(apm_bat_fp[idx], \"%*s %*s %*x %x   %x       %x     %d%%\", &ac,\n                 &status, &flag, &life) <= 0)\n        goto read_bat_fp_end;\n\n      if (life == -1) {\n        /* could check now that there is ac */\n        snprintf(last_battery_str[idx], 64, \"%s\", \"not present\");\n\n        /* could check that status == 3 here? */\n      } else if (ac && life != 100) {\n        snprintf(last_battery_str[idx], 64, \"charging %d%%\", life);\n      } else {\n        snprintf(last_battery_str[idx], 64, \"%d%%\", life);\n      }\n\n    read_bat_fp_end:\n      /* it seemed to buffer it so file must be closed (or could use\n       * syscalls directly but I don't feel like coding it now) */\n      fclose(apm_bat_fp[idx]);\n      apm_bat_fp[idx] = nullptr;\n    }\n  }\n  set_return_value(buffer, n, item, idx);\n}\n\nvoid set_return_value(char *buffer, unsigned int n, int item, int idx) {\n  switch (item) {\n    case BATTERY_STATUS:\n      snprintf(buffer, n, \"%s\", last_battery_str[idx]);\n      break;\n    case BATTERY_TIME:\n      snprintf(buffer, n, \"%s\", last_battery_time_str[idx]);\n      break;\n    default:\n      break;\n  }\n}\n\nvoid get_battery_short_status(char *buffer, unsigned int n, const char *bat) {\n  get_battery_stuff(buffer, n, bat, BATTERY_STATUS);\n  if (0 == strncmp(\"charging\", buffer, 8)) {\n    buffer[0] = 'C';\n    memmove(buffer + 1, buffer + 8, n - 8);\n  } else if (0 == strncmp(\"discharging\", buffer, 11)) {\n    buffer[0] = 'D';\n    memmove(buffer + 1, buffer + 11, n - 11);\n  } else if (0 == strncmp(\"charged\", buffer, 7)) {\n    buffer[0] = 'F';\n    memmove(buffer + 1, buffer + 7, n - 7);\n  } else if (0 == strncmp(\"not present\", buffer, 11)) {\n    buffer[0] = 'N';\n    memmove(buffer + 1, buffer + 11, n - 11);\n  } else if (0 == strncmp(\"empty\", buffer, 5)) {\n    buffer[0] = 'E';\n    memmove(buffer + 1, buffer + 5, n - 5);\n  } else if (0 == strncmp(\"unknown\", buffer, 7)) {\n    buffer[0] = 'U';\n    memmove(buffer + 1, buffer + 7, n - 7);\n  }\n  // Otherwise, don't shorten.\n}\n\nvoid get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {\n  static int reported_power = 0;\n  static int reported_other = 0;\n  char path[256];\n  char value[256];\n  FILE *fp;\n  char *ret;\n\n  snprintf(path, 255, SYSFS_BATTERY_BASE_PATH \"/%s/power_now\", bat);\n  fp = open_file(path, &reported_power);\n  if (fp != nullptr) {\n    ret = fgets(value, 256, fp);\n    fclose(fp);\n\n    if (ret != nullptr) {\n      double result = strtol(value, NULL, 10) * 1e-6;\n      snprintf(buffer, n, \"%.1f\", result);\n      return;\n    }\n  }\n\n  snprintf(path, 255, SYSFS_BATTERY_BASE_PATH \"/%s/current_now\", bat);\n  fp = open_file(path, &reported_other);\n  if (fp == nullptr)\n    return;\n  ret = fgets(value, 256, fp);\n  fclose(fp);\n\n  if (ret == nullptr)\n    return;\n  double result = strtol(value, NULL, 10) * 1e-6;\n\n  snprintf(path, 255, SYSFS_BATTERY_BASE_PATH \"/%s/voltage_now\", bat);\n  fp = open_file(path, &reported_other);\n  if (fp == nullptr)\n    return;\n  ret = fgets(value, 256, fp);\n  fclose(fp);\n\n  if (fp == nullptr)\n    return;\n  result *= strtol(value, NULL, 10) * 1e-6;\n  snprintf(buffer, n, \"%.1f\", result);\n}\n\nint _get_battery_perct(const char *bat) {\n  static int reported = 0;\n  int idx;\n  char acpi_path[128];\n  char sysfs_path[128];\n  int remaining_capacity = -1;\n\n  snprintf(acpi_path, 127, ACPI_BATTERY_BASE_PATH \"/%s/state\", bat);\n  snprintf(sysfs_path, 127, SYSFS_BATTERY_BASE_PATH \"/%s/uevent\", bat);\n\n  idx = get_battery_idx(bat);\n\n  /* don't update battery too often */\n  if (current_update_time - last_battery_perct_time[idx] < 30) {\n    return last_battery_perct[idx];\n  }\n  last_battery_perct_time[idx] = current_update_time;\n\n  /* Only check for SYSFS or ACPI */\n\n  if (sysfs_bat_fp[idx] == nullptr && acpi_bat_fp[idx] == NULL &&\n      apm_bat_fp[idx] == nullptr) {\n    sysfs_bat_fp[idx] = open_file(sysfs_path, &reported);\n    reported = 0;\n  }\n\n  if (sysfs_bat_fp[idx] == nullptr && acpi_bat_fp[idx] == NULL &&\n      apm_bat_fp[idx] == nullptr) {\n    acpi_bat_fp[idx] = open_file(acpi_path, &reported);\n  }\n\n  if (sysfs_bat_fp[idx] != nullptr) {\n    /* SYSFS */\n    while (!feof(sysfs_bat_fp[idx])) {\n      char buf[256];\n      if (fgets(buf, 256, sysfs_bat_fp[idx]) == nullptr) break;\n\n      if (strncmp(buf, \"POWER_SUPPLY_CHARGE_NOW=\", 24) == 0) {\n        sscanf(buf, \"POWER_SUPPLY_CHARGE_NOW=%d\", &remaining_capacity);\n      } else if (strncmp(buf, \"POWER_SUPPLY_CHARGE_FULL=\", 25) == 0) {\n        sscanf(buf, \"POWER_SUPPLY_CHARGE_FULL=%d\", &acpi_design_capacity[idx]);\n      } else if (strncmp(buf, \"POWER_SUPPLY_ENERGY_NOW=\", 24) == 0) {\n        sscanf(buf, \"POWER_SUPPLY_ENERGY_NOW=%d\", &remaining_capacity);\n      } else if (strncmp(buf, \"POWER_SUPPLY_ENERGY_FULL=\", 25) == 0) {\n        sscanf(buf, \"POWER_SUPPLY_ENERGY_FULL=%d\", &acpi_design_capacity[idx]);\n      }\n    }\n\n    fclose(sysfs_bat_fp[idx]);\n    sysfs_bat_fp[idx] = nullptr;\n\n  } else if (acpi_bat_fp[idx] != nullptr) {\n    /* ACPI */\n    /* read last full capacity if it's zero */\n    if (acpi_design_capacity[idx] == 0) {\n      static int rep2;\n      char path[128];\n      FILE *fp;\n\n      snprintf(path, 127, ACPI_BATTERY_BASE_PATH \"/%s/info\", bat);\n      fp = open_file(path, &rep2);\n      if (fp != nullptr) {\n        while (!feof(fp)) {\n          char b[256];\n\n          if (fgets(b, 256, fp) == nullptr) { break; }\n          if (sscanf(b, \"last full capacity: %d\", &acpi_design_capacity[idx]) !=\n              0) {\n            break;\n          }\n        }\n        fclose(fp);\n      }\n    }\n\n    fseek(acpi_bat_fp[idx], 0, SEEK_SET);\n\n    while (!feof(acpi_bat_fp[idx])) {\n      char buf[256];\n\n      if (fgets(buf, 256, acpi_bat_fp[idx]) == nullptr) { break; }\n\n      if (buf[0] == 'r') {\n        sscanf(buf, \"remaining capacity: %d\", &remaining_capacity);\n      }\n    }\n  }\n  if (remaining_capacity < 0) { return 0; }\n  /* compute the battery percentage */\n  last_battery_perct[idx] =\n      (int)(((float)remaining_capacity / acpi_design_capacity[idx]) * 100);\n  if (last_battery_perct[idx] > 100) last_battery_perct[idx] = 100;\n  return last_battery_perct[idx];\n}\n\nint get_battery_perct(const char *bat) {\n  int idx, n = 0, total_capacity = 0, remaining_capacity;\n  ;\n#define BATTERY_LEN 8\n  char battery[BATTERY_LEN];\n\n  init_batteries();\n\n  /* Check if user asked for the mean percentage of all batteries. */\n  if (!strcmp(bat, \"all\")) {\n    for (idx = 0; idx < MAX_BATTERY_COUNT; idx++) {\n      snprintf(battery, BATTERY_LEN - 1, \"BAT%d\", idx);\n#undef BATTERY_LEN\n      remaining_capacity = _get_battery_perct(battery);\n      if (remaining_capacity > 0) {\n        total_capacity += remaining_capacity;\n        n++;\n      }\n    }\n\n    if (n == 0)\n      return 0;\n    else\n      return total_capacity / n;\n  } else {\n    return _get_battery_perct(bat);\n  }\n}\n\ndouble get_battery_perct_bar(struct text_object *obj) {\n  int idx;\n\n  get_battery_perct(obj->data.s);\n  idx = get_battery_idx(obj->data.s);\n  return last_battery_perct[idx];\n}\n\n/* On Apple powerbook and ibook:\n$ cat /proc/pmu/battery_0\nflags      : 00000013\ncharge     : 3623\nmax_charge : 3720\ncurrent    : 388\nvoltage    : 16787\ntime rem.  : 900\n$ cat /proc/pmu/info\nPMU driver version     : 2\nPMU firmware version   : 0c\nAC Power               : 1\nBattery count          : 1\n*/\n\n/* defines as in <linux/pmu.h> */\n#define PMU_BATT_PRESENT 0x00000001\n#define PMU_BATT_CHARGING 0x00000002\n\nstatic FILE *pmu_battery_fp;\nstatic FILE *pmu_info_fp;\nstatic char pb_battery_info[3][32];\nstatic double pb_battery_info_update;\n\nvoid powerbook_update_status(unsigned int flags, int ac);\nvoid powerbook_update_percentage(long timeval, unsigned int flags, int ac,\n                                 int charge, int max_charge);\nvoid powerbook_update_time(long timeval);\n\n#define PMU_PATH \"/proc/pmu\"\nvoid get_powerbook_batt_info(struct text_object *obj, char *buffer,\n                             unsigned int n) {\n  static int reported = 0;\n  const char *batt_path = PMU_PATH \"/battery_0\";\n  const char *info_path = PMU_PATH \"/info\";\n  unsigned int flags = 0;\n  int charge = 0;\n  int max_charge = 1;\n  int ac = -1;\n  long timeval = -1;\n\n  /* don't update battery too often */\n  if (current_update_time - pb_battery_info_update < 29.5) {\n    snprintf(buffer, n, \"%s\", pb_battery_info[obj->data.i]);\n    return;\n  }\n  pb_battery_info_update = current_update_time;\n\n  if (pmu_battery_fp == nullptr) {\n    pmu_battery_fp = open_file(batt_path, &reported);\n    if (pmu_battery_fp == nullptr) { return; }\n  }\n\n  rewind(pmu_battery_fp);\n  while (!feof(pmu_battery_fp)) {\n    char buf[32];\n\n    if (fgets(buf, sizeof(buf), pmu_battery_fp) == nullptr) { break; }\n\n    if (buf[0] == 'f') {\n      sscanf(buf, \"flags      : %8x\", &flags);\n    } else if (buf[0] == 'c' && buf[1] == 'h') {\n      sscanf(buf, \"charge     : %d\", &charge);\n    } else if (buf[0] == 'm') {\n      sscanf(buf, \"max_charge : %d\", &max_charge);\n    } else if (buf[0] == 't') {\n      sscanf(buf, \"time rem.  : %ld\", &timeval);\n    }\n  }\n  pmu_info_fp = open_file(info_path, &reported);\n  if (pmu_info_fp == nullptr) { return; }\n\n  rewind(pmu_info_fp);\n  while (!feof(pmu_info_fp)) {\n    char buf[32];\n\n    if (fgets(buf, sizeof(buf), pmu_info_fp) == nullptr) { break; }\n    if (buf[0] == 'A') { sscanf(buf, \"AC Power               : %d\", &ac); }\n  }\n\n  powerbook_update_status(flags, ac);\n  powerbook_update_percentage(timeval, flags, ac, charge, max_charge);\n  powerbook_update_time(timeval);\n\n  snprintf(buffer, n, \"%s\", pb_battery_info[obj->data.i]);\n}\n\nvoid powerbook_update_status(unsigned int flags, int ac) {\n  /* update status string */\n  if ((ac && !(flags & PMU_BATT_PRESENT))) {\n    strncpy(pb_battery_info[PB_BATT_STATUS], \"AC\",\n            sizeof(pb_battery_info[PB_BATT_STATUS]));\n  } else if (ac && (flags & PMU_BATT_PRESENT) && !(flags & PMU_BATT_CHARGING)) {\n    strncpy(pb_battery_info[PB_BATT_STATUS], \"charged\",\n            sizeof(pb_battery_info[PB_BATT_STATUS]));\n  } else if ((flags & PMU_BATT_PRESENT) && (flags & PMU_BATT_CHARGING)) {\n    strncpy(pb_battery_info[PB_BATT_STATUS], \"charging\",\n            sizeof(pb_battery_info[PB_BATT_STATUS]));\n  } else {\n    strncpy(pb_battery_info[PB_BATT_STATUS], \"discharging\",\n            sizeof(pb_battery_info[PB_BATT_STATUS]));\n  }\n}\n\nvoid powerbook_update_percentage(long timeval, unsigned int flags, int ac,\n                                 int charge, int max_charge) {\n  /* update percentage string */\n  if (timeval == 0 && ac && (flags & PMU_BATT_PRESENT) &&\n      !(flags & PMU_BATT_CHARGING)) {\n    snprintf(pb_battery_info[PB_BATT_PERCENT],\n             sizeof(pb_battery_info[PB_BATT_PERCENT]), \"%s\", \"100%%\");\n  } else if (timeval == 0) {\n    snprintf(pb_battery_info[PB_BATT_PERCENT],\n             sizeof(pb_battery_info[PB_BATT_PERCENT]), \"%s\", \"unknown\");\n  } else {\n    snprintf(pb_battery_info[PB_BATT_PERCENT],\n             sizeof(pb_battery_info[PB_BATT_PERCENT]), \"%d%%\",\n             (charge * 100) / max_charge);\n  }\n}\n\nvoid powerbook_update_time(long timeval) {\n  /* update time string */\n  if (timeval == 0) { /* fully charged or battery not present */\n    snprintf(pb_battery_info[PB_BATT_TIME],\n             sizeof(pb_battery_info[PB_BATT_TIME]), \"%s\", \"unknown\");\n  } else if (timeval < 60 * 60) { /* don't show secs */\n    format_seconds_short(pb_battery_info[PB_BATT_TIME],\n                         sizeof(pb_battery_info[PB_BATT_TIME]), timeval);\n  } else {\n    format_seconds(pb_battery_info[PB_BATT_TIME],\n                   sizeof(pb_battery_info[PB_BATT_TIME]), timeval);\n  }\n}\n\n#define ENTROPY_AVAIL_PATH \"/proc/sys/kernel/random/entropy_avail\"\n\nint get_entropy_avail(unsigned int *val) {\n  static int reported = 0;\n  FILE *fp;\n\n  if (!(fp = open_file(ENTROPY_AVAIL_PATH, &reported))) return 1;\n\n  if (fscanf(fp, \"%u\", val) != 1) return 1;\n\n  fclose(fp);\n  return 0;\n}\n\n#define ENTROPY_POOLSIZE_PATH \"/proc/sys/kernel/random/poolsize\"\n\nint get_entropy_poolsize(unsigned int *val) {\n  static int reported = 0;\n  FILE *fp;\n\n  if (!(fp = open_file(ENTROPY_POOLSIZE_PATH, &reported))) return 1;\n\n  if (fscanf(fp, \"%u\", val) != 1) return 1;\n\n  fclose(fp);\n  return 0;\n}\n\nvoid print_disk_protect_queue(struct text_object *obj, char *p,\n                              unsigned int p_max_size) {\n  FILE *fp;\n  char path[128];\n  int state;\n\n  snprintf(path, 127, \"/sys/block/%s/device/unload_heads\", obj->data.s);\n  if (access(path, F_OK)) {\n    snprintf(path, 127, \"/sys/block/%s/queue/protect\", obj->data.s);\n  }\n  if ((fp = fopen(path, \"r\")) == nullptr) {\n    snprintf(p, p_max_size, \"%s\", \"n/a   \");\n    return;\n  }\n  if (fscanf(fp, \"%d\\n\", &state) != 1) {\n    fclose(fp);\n    snprintf(p, p_max_size, \"%s\", \"failed\");\n    return;\n  }\n  fclose(fp);\n  snprintf(p, p_max_size, \"%s\", (state > 0) ? \"frozen\" : \"free  \");\n}\n\nstd::unordered_map<std::string, bool> dev_list;\n\n/* Same as sf #2942117 but memoized using a linked list */\nint is_disk(char *dev) {\n  std::string orig(dev);\n  std::string syspath(\"/sys/block/\");\n  char *slash;\n\n  auto i = dev_list.find(orig);\n  if (i != dev_list.end()) return i->second;\n\n  while ((slash = strchr(dev, '/'))) *slash = '!';\n  syspath += dev;\n\n  return dev_list[orig] = !(access(syspath.c_str(), F_OK));\n}\n\nint update_diskio(void) {\n  FILE *fp;\n  static int reported = 0;\n  char buf[512], devbuf[64];\n  unsigned int major, minor;\n  int col_count = 0;\n  struct diskio_stat *cur;\n  unsigned int reads, writes;\n  unsigned int total_reads = 0, total_writes = 0;\n\n  stats.current = 0;\n  stats.current_read = 0;\n  stats.current_write = 0;\n\n  if (!(fp = open_file(\"/proc/diskstats\", &reported))) { return 0; }\n\n  /* read reads and writes from all disks (minor = 0), including cd-roms\n   * and floppies, and sum them up */\n  while (fgets(buf, 512, fp)) {\n    col_count = sscanf(buf, \"%u %u %s %*u %*u %u %*u %*u %*u %u\", &major,\n                       &minor, devbuf, &reads, &writes);\n    /* ignore subdevices (they have only 3 matching entries in their line)\n     * and virtual devices (LVM, network block devices, RAM disks, Loopback)\n     *\n     * XXX: ignore devices which are part of a SW RAID (MD_MAJOR) */\n    if (col_count == 5 && major != LVM_BLK_MAJOR && major != NBD_MAJOR &&\n        major != RAMDISK_MAJOR && major != LOOP_MAJOR && major != DM_MAJOR) {\n      /* check needed for kernel >= 2.6.31, see sf #2942117 */\n      if (is_disk(devbuf)) {\n        total_reads += reads;\n        total_writes += writes;\n      }\n    } else {\n      col_count = sscanf(buf, \"%u %u %s %*u %u %*u %u\", &major, &minor, devbuf,\n                         &reads, &writes);\n      if (col_count != 5) { continue; }\n    }\n    cur = stats.next;\n    while (cur && strcmp(devbuf, cur->dev)) cur = cur->next;\n\n    if (cur) update_diskio_values(cur, reads, writes);\n  }\n  update_diskio_values(&stats, total_reads, total_writes);\n  fclose(fp);\n  return 0;\n}\n\nvoid print_distribution(struct text_object * /*obj*/, char *p,\n                        unsigned int p_max_size) {\n  if (p_max_size == 0) return;  // can't do nothing\n\n  const auto set_result = [&](std::string_view value) {\n    auto len = std::min<std::size_t>(p_max_size - 1, value.length());\n    std::memcpy(p, value.data(), len);\n    p[len] = '\\0';\n  };\n\n  // 1) Try /etc/os-release\n  // This file is provided even in some non-systemd distros like Void and\n  // Devuan- Minimal distros like \"Linux From Scratch\" won't have it. But it can\n  // be provided to ensure proper output (though it's mostly aesthetic). See:\n  // https://www.freedesktop.org/software/systemd/man/latest/os-release.html\n  std::ifstream os_rel(\"/etc/os-release\");\n  if (!os_rel) {\n    // attempt alternative path\n    os_rel.open(\"/usr/lib/os-release\");\n  }\n  if (os_rel) {\n    std::string line;\n    while (std::getline(os_rel, line)) {\n      // NAME is \"A string identifying the operating system, without a version\n      // component, and suitable for presentation to the user.\"\n      if (line.rfind(\"NAME=\", 0) == 0) {\n        std::string name = line.substr(5);\n\n        if (name.size() >= 2 && name.front() == '\"' && name.back() == '\"') {\n          name = name.substr(1, name.size() - 2);\n        } else {\n          // unexpected format - string not quoted\n          break;\n        }\n\n        set_result(name);\n        return;\n      }\n    }\n  }\n\n  // Alternatives that are already handled by above file:\n  // /etc/lsb-release - Debian/Ubuntu only, LSB spec\n  // /etc/redhat-release - single string\n  // /etc/centos-release - single string e.g. \"CentOS Linux release 7.9.2009 (Core)\"\n  // /etc/fedora-release - single string\n  // /etc/debian_version - version only\n  // /etc/alpine-release - version only\n  // /etc/arch-release - single string: \"Arch Linux\"\n\n  // 2) Fallback: parse /proc/version\n  // This file doesn't necessarily have distribution name in it (e.g. on Arch).\n  // Though on popular distros it could. This isn't a good fallback.\n  std::ifstream proc_version(\"/proc/version\");\n  if (proc_version) {\n    std::string buff;\n    std::getline(proc_version, buff);\n    for (size_t from = 1; from < buff.size(); ++from) {\n      // First braced uppercase text is usually the distribution name:\n      if (buff[from - 1] == '(' && std::isupper(buff[from])) {\n        size_t to = from;\n        // Capture braced content until version number or closing brace:\n        for (size_t to = from + 1; to < buff.size() - 1; to++) {\n          if (buff[to] == ' ' &&\n              (std::isdigit(buff[to + 1]) || buff[to + 1] == ')')) {\n            break;\n          }\n        }\n        if (to == buff.size() - 1) {\n          // No ending delimiter found.\n          break;\n        }\n        buff = buff.substr(from, to - from);\n        set_result(buff);\n        return;\n      }\n    }\n  }\n\n  set_result(\"Linux\");\n}\n\n/******************************************\n * Calculate cpu total\t\t\t\t\t  *\n ******************************************/\n#define TMPL_SHORTPROC \"%*s %llu %llu %llu %llu\"\n#define TMPL_LONGPROC \"%*s %llu %llu %llu %llu %llu %llu %llu %llu\"\n\nstatic unsigned long long calc_cpu_total(void) {\n  static unsigned long long previous_total = 0;\n  unsigned long long total = 0;\n  unsigned long long t = 0;\n  int rc;\n  int ps;\n  char line[BUFFER_LEN] = {0};\n  unsigned long long cpu = 0;\n  unsigned long long niceval = 0;\n  unsigned long long systemval = 0;\n  unsigned long long idle = 0;\n  unsigned long long iowait = 0;\n  unsigned long long irq = 0;\n  unsigned long long softirq = 0;\n  unsigned long long steal = 0;\n  const char *template_ =\n      KFLAG_ISSET(KFLAG_IS_LONGSTAT) ? TMPL_LONGPROC : TMPL_SHORTPROC;\n\n  ps = open(\"/proc/stat\", O_RDONLY);\n  rc = read(ps, line, BUFFER_LEN - 1);\n  close(ps);\n  if (rc < 0) { return 0; }\n\n  sscanf(line, template_, &cpu, &niceval, &systemval, &idle, &iowait, &irq,\n         &softirq, &steal);\n  total = cpu + niceval + systemval + idle + iowait + irq + softirq + steal;\n\n  t = total - previous_total;\n  previous_total = total;\n\n  return t;\n}\n\n/******************************************\n * Calculate each processes cpu\t\t\t  *\n ******************************************/\n\ninline static void calc_cpu_each(unsigned long long total) {\n  float mul = 100.0;\n  if (top_cpu_separate.get(*state)) mul *= info.cpu_count;\n\n  for (struct process *p = first_process; p; p = p->next)\n    p->amount = mul * (p->user_time + p->kernel_time) / (float)total;\n}\n\n#ifdef BUILD_IOSTATS\nstatic void calc_io_each(void) {\n  struct process *p;\n  unsigned long long sum = 0;\n\n  for (p = first_process; p; p = p->next) sum += p->read_bytes + p->write_bytes;\n\n  if (sum == 0) sum = 1; /* to avoid having NANs if no I/O occurred */\n  for (p = first_process; p; p = p->next)\n    p->io_perc = 100.0 * (p->read_bytes + p->write_bytes) / (float)sum;\n}\n#endif /* BUILD_IOSTATS */\n\n/******************************************\n * Extract information from /proc\t\t  *\n ******************************************/\n\n#define PROCFS_TEMPLATE \"/proc/%d/stat\"\n#define PROCFS_CMDLINE_TEMPLATE \"/proc/%d/cmdline\"\n\n/* These are the guts that extract information out of /proc.\n * Anyone hoping to port wmtop should look here first. */\nstatic void process_parse_stat(struct process *process) {\n  char line[BUFFER_LEN] = {0}, filename[BUFFER_LEN], procname[BUFFER_LEN];\n  char cmdline[BUFFER_LEN] = {0}, cmdline_filename[BUFFER_LEN],\n       cmdline_procname[BUFFER_LEN];\n  char basename[BUFFER_LEN] = {0};\n  char tmpstr[BUFFER_LEN] = {0};\n  char state[4];\n  int ps, cmdline_ps;\n  unsigned long user_time = 0;\n  unsigned long kernel_time = 0;\n  int rc;\n  int endl;\n  int nice_val;\n  char *lparen, *rparen;\n  struct stat process_stat;\n\n  snprintf(filename, sizeof(filename), PROCFS_TEMPLATE, process->pid);\n  snprintf(cmdline_filename, sizeof(cmdline_filename), PROCFS_CMDLINE_TEMPLATE,\n           process->pid);\n\n  ps = open(filename, O_RDONLY);\n  if (ps == -1) {\n    /* The process must have finished in the last few jiffies! */\n    return;\n  }\n\n  if (fstat(ps, &process_stat) != 0) {\n    close(ps);\n    return;\n  }\n  process->uid = process_stat.st_uid;\n\n  /* Mark process as up-to-date. */\n  process->time_stamp = g_time;\n\n  rc = read(ps, line, BUFFER_LEN - 1);\n  close(ps);\n  if (rc < 0) { return; }\n\n  /* Read /proc/<pid>/cmdline */\n  cmdline_ps = open(cmdline_filename, O_RDONLY);\n  if (cmdline_ps < 0) {\n    /* The process must have finished in the last few jiffies! */\n    return;\n  }\n\n  endl = read(cmdline_ps, cmdline, BUFFER_LEN - 1);\n  close(cmdline_ps);\n  if (endl < 0) { return; }\n\n  /* Some processes have null-separated arguments (see proc(5)); let's fix it */\n  int i = endl;\n  while (i && cmdline[i - 1] == 0) {\n    /* Skip past any trailing null characters */\n    --i;\n  }\n  while (i--) {\n    /* Replace null character between arguments with a space */\n    if (cmdline[i] == 0) { cmdline[i] = ' '; }\n  }\n\n  cmdline[endl] = 0;\n\n  /* We want to transform for example \"/usr/bin/python program.py\" to \"python\n   * program.py\"\n   * 1. search for first space\n   * 2. search for last / before first space\n   * 3. copy string from its position\n   */\n  char *space_ptr = strchr(cmdline, ' ');\n  if (space_ptr == nullptr) {\n    strncpy(tmpstr, cmdline, BUFFER_LEN);\n  } else {\n    long int space_pos = space_ptr - cmdline;\n    strncpy(tmpstr, cmdline, space_pos);\n    tmpstr[space_pos] = 0;\n  }\n\n  char *slash_ptr = strrchr(tmpstr, '/');\n  if (slash_ptr == nullptr) {\n    strncpy(cmdline_procname, cmdline, BUFFER_LEN);\n  } else {\n    long int slash_pos = slash_ptr - tmpstr;\n    strncpy(cmdline_procname, cmdline + slash_pos + 1,\n            BUFFER_LEN - slash_pos - 1);\n    cmdline_procname[BUFFER_LEN - slash_pos - 1] = 0;\n  }\n\n  /* Extract cpu times from data in /proc filesystem */\n  lparen = strchr(line, '(');\n  rparen = strrchr(line, ')');\n  if (!lparen || !rparen || rparen < lparen) return;  // this should not happen\n\n  rc = MIN((unsigned)(rparen - lparen - 1), sizeof(procname) - 1);\n  strncpy(procname, lparen + 1, rc);\n  procname[rc] = '\\0';\n  strncpy(basename, procname, strlen(procname) + 1);\n\n  if (strlen(procname) < strlen(cmdline_procname))\n    strncpy(procname, cmdline_procname, strlen(cmdline_procname) + 1);\n\n  rc = sscanf(rparen + 1,\n              \"%3s %*s %*s %*s %*s %*s %*s %*s %*s %*s %*s %lu \"\n              \"%lu %*s %*s %*s %d %*s %*s %*s %llu %llu\",\n              state, &process->user_time, &process->kernel_time, &nice_val,\n              &process->vsize, &process->rss);\n  if (rc < 6) {\n    NORM_ERR(\"scanning data for %s failed, got only %d fields\", procname, rc);\n    return;\n  }\n\n  if (state[0] == 'R') ++info.run_procs;\n\n  free_and_zero(process->name);\n  free_and_zero(process->basename);\n  process->name = strndup(procname, text_buffer_size.get(*::state));\n  process->basename = strndup(basename, text_buffer_size.get(*::state));\n  process->rss *= getpagesize();\n\n  process->total_cpu_time = process->user_time + process->kernel_time;\n  if (process->previous_user_time == ULONG_MAX) {\n    process->previous_user_time = process->user_time;\n  }\n  if (process->previous_kernel_time == ULONG_MAX) {\n    process->previous_kernel_time = process->kernel_time;\n  }\n\n  /* strangely, the values aren't monotonous */\n  if (process->previous_user_time > process->user_time)\n    process->previous_user_time = process->user_time;\n\n  if (process->previous_kernel_time > process->kernel_time)\n    process->previous_kernel_time = process->kernel_time;\n\n  /* store the difference of the user_time */\n  user_time = process->user_time - process->previous_user_time;\n  kernel_time = process->kernel_time - process->previous_kernel_time;\n\n  /* backup the process->user_time for next time around */\n  process->previous_user_time = process->user_time;\n  process->previous_kernel_time = process->kernel_time;\n\n  /* store only the difference of the user_time here... */\n  process->user_time = user_time;\n  process->kernel_time = kernel_time;\n}\n\n#ifdef BUILD_IOSTATS\n#define PROCFS_TEMPLATE_IO \"/proc/%d/io\"\nstatic void process_parse_io(struct process *process) {\n  static const char *read_bytes_str = \"read_bytes:\";\n  static const char *write_bytes_str = \"write_bytes:\";\n\n  char line[BUFFER_LEN] = {0}, filename[BUFFER_LEN];\n  int ps;\n  int rc;\n  char *pos, *endpos;\n  unsigned long long read_bytes, write_bytes;\n\n  snprintf(filename, sizeof(filename), PROCFS_TEMPLATE_IO, process->pid);\n\n  ps = open(filename, O_RDONLY);\n  if (ps < 0) {\n    /* The process must have finished in the last few jiffies!\n     * Or, the kernel doesn't support I/O accounting.\n     */\n    return;\n  }\n\n  rc = read(ps, line, BUFFER_LEN - 1);\n  close(ps);\n  if (rc < 0) { return; }\n\n  pos = strstr(line, read_bytes_str);\n  if (pos == nullptr) {\n    /* these should not happen (unless the format of the file changes) */\n    return;\n  }\n  pos += strlen(read_bytes_str);\n  process->read_bytes = strtoull(pos, &endpos, 10);\n  if (endpos == pos) { return; }\n\n  pos = strstr(line, write_bytes_str);\n  if (pos == nullptr) { return; }\n  pos += strlen(write_bytes_str);\n  process->write_bytes = strtoull(pos, &endpos, 10);\n  if (endpos == pos) { return; }\n\n  if (process->previous_read_bytes == ULLONG_MAX) {\n    process->previous_read_bytes = process->read_bytes;\n  }\n  if (process->previous_write_bytes == ULLONG_MAX) {\n    process->previous_write_bytes = process->write_bytes;\n  }\n\n  /* store the difference of the byte counts */\n  read_bytes = process->read_bytes - process->previous_read_bytes;\n  write_bytes = process->write_bytes - process->previous_write_bytes;\n\n  /* backup the counts for next time around */\n  process->previous_read_bytes = process->read_bytes;\n  process->previous_write_bytes = process->write_bytes;\n\n  /* store only the difference here... */\n  process->read_bytes = read_bytes;\n  process->write_bytes = write_bytes;\n}\n#endif /* BUILD_IOSTATS */\n\n/******************************************\n * Get process structure for process pid  *\n ******************************************/\n\n/* This function seems to hog all of the CPU time.\n * I can't figure out why - it doesn't do much. */\nstatic void calculate_stats(struct process *process) {\n  /* compute each process cpu usage by reading /proc/<proc#>/stat */\n  process_parse_stat(process);\n\n#ifdef BUILD_IOSTATS\n  process_parse_io(process);\n#endif /* BUILD_IOSTATS */\n\n  /*\n   * Check name against the exclusion list\n   */\n  /* if (process->counted && exclusion_expression &&\n   * !regexec(exclusion_expression, process->name, 0, 0, 0))\n   * process->counted = 0; */\n}\n\n/******************************************\n * Update process table\t\t\t\t\t  *\n ******************************************/\n\nstatic void update_process_table(void) {\n  DIR *dir;\n  struct dirent *entry;\n\n  if (!(dir = opendir(\"/proc\"))) { return; }\n\n  info.run_procs = 0;\n\n  /* Get list of processes from /proc directory */\n  while ((entry = readdir(dir))) {\n    pid_t pid;\n\n    if (sscanf(entry->d_name, \"%d\", &pid) > 0) {\n      /* compute each process cpu usage */\n      calculate_stats(get_process(pid));\n    }\n  }\n\n  closedir(dir);\n}\n\nvoid get_top_info(void) {\n  unsigned long long total = 0;\n\n  total = calc_cpu_total(); /* calculate the total of the processor */\n  update_process_table();   /* update the table with process list */\n  calc_cpu_each(total);     /* and then the percentage for each task */\n#ifdef BUILD_IOSTATS\n  calc_io_each(); /* percentage of I/O for each task */\n#endif            /* BUILD_IOSTATS */\n}\n\n/******************************************\n * Check if more than one conky process   *\n * is running                             *\n ******************************************/\n\nbool is_conky_already_running(void) {\n  DIR *dir;\n  struct dirent *ent;\n  char buf[512];\n  int instances = 0;\n\n  if (!(dir = opendir(\"/proc\"))) {\n    NORM_ERR(\"can't open /proc: %s\\n\", strerror(errno));\n    return false;\n  }\n\n  while ((ent = readdir(dir)) != NULL) {\n    char *endptr = ent->d_name;\n    long lpid = strtol(ent->d_name, &endptr, 10);\n    if (*endptr != '\\0') {\n      continue;\n    }\n\n    snprintf(buf, sizeof(buf), \"/proc/%ld/stat\", lpid);\n    FILE *fp = fopen(buf, \"r\");\n    if (!fp) {\n      continue;\n    }\n\n    if (fgets(buf, sizeof(buf), fp) != NULL) {\n      char *conky = strstr(buf, \"(conky)\");\n      if (conky) {\n        instances++;\n      }\n    }\n    fclose(fp);\n  }\n\n  closedir(dir);\n  return instances > 1;\n}\n"
  },
  {
    "path": "src/data/os/linux.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _LINUX_H\n#define _LINUX_H\n\n#include \"../../common.h\"\n\nvoid print_disk_protect_queue(struct text_object *, char *, unsigned int);\n\nvoid print_ioscheduler(struct text_object *, char *, unsigned int);\nvoid print_laptop_mode(struct text_object *, char *, unsigned int);\nvoid print_cpugovernor(struct text_object *, char *, unsigned int);\n\nint update_gateway_info(void);\nint update_gateway_info2(void);\nvoid free_gateway_info(struct text_object *obj);\nint gateway_exists(struct text_object *);\nvoid print_gateway_iface(struct text_object *, char *, unsigned int);\nvoid print_gateway_iface2(struct text_object *, char *, unsigned int);\nvoid print_gateway_ip(struct text_object *, char *, unsigned int);\nvoid print_battery_status(struct text_object *, char *, unsigned int);\n\nenum { PB_BATT_STATUS, PB_BATT_PERCENT, PB_BATT_TIME };\nvoid get_powerbook_batt_info(struct text_object *, char *, unsigned int);\n\nvoid parse_i2c_sensor(struct text_object *, const char *);\nvoid parse_hwmon_sensor(struct text_object *, const char *);\nvoid parse_platform_sensor(struct text_object *, const char *);\nvoid print_sysfs_sensor(struct text_object *, char *, unsigned int);\nvoid free_sysfs_sensor(struct text_object *);\n\nint get_entropy_avail(unsigned int *);\nint get_entropy_poolsize(unsigned int *);\n\nint update_stat(void);\n\nvoid print_distribution(struct text_object *, char *, unsigned int);\n\nbool is_conky_already_running(void);\n\nextern char e_iface[64];\nextern char interfaces_arr[MAX_NET_INTERFACES][64];\n\n#endif /* _LINUX_H */\n"
  },
  {
    "path": "src/data/os/netbsd.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"netbsd.h\"\n#include \"../network/net_stat.h\"\n#include \"bsdcommon.h\"\n\n#include <err.h>\n#include <fcntl.h>\n#include <kvm.h>\n#include <limits.h>\n#include <nlist.h>\n#include <paths.h>\n#include <time.h>\n#include <unistd.h>\n\n#include <sys/envsys.h>\n#include <sys/param.h>\n#include <sys/sched.h>\n#include <sys/socket.h>\n#include <sys/swap.h>\n#include <sys/sysctl.h>\n#include <sys/time.h>\n#include <sys/types.h>\n#include <uvm/uvm_param.h>\n#include <uvm/uvm_extern.h>\n\n#include <net/if.h>\n#include <net/if_types.h>\n\nstatic int nkd_init = 0;\nstatic u_int32_t sensvalue;\nstatic char errbuf[_POSIX2_LINE_MAX];\n\nvoid prepare_update() {}\n\nint update_uptime() {\n  int mib[2] = {CTL_KERN, KERN_BOOTTIME};\n  struct timeval boottime;\n  time_t now;\n  size_t size = sizeof(boottime);\n\n  if ((sysctl(mib, 2, &boottime, &size, nullptr, 0) != -1) &&\n      (boottime.tv_sec != 0)) {\n    time(&now);\n    info.uptime = now - boottime.tv_sec;\n  } else {\n    NORM_ERR(\"could not get uptime\");\n    info.uptime = 0;\n  }\n\n  return 1;\n}\n\nint check_mount(struct text_object *obj) {\n  /* stub */\n  (void)obj;\n  return 0;\n}\n\nint update_meminfo() {\n  bsdcommon::update_meminfo(info);\n  return 1;\n}\n\nint update_net_stats() {\n  int i;\n  double delta;\n  struct ifnet ifnet;\n  struct ifnet_head ifhead; /* interfaces are in a tail queue */\n  u_long ifnetaddr;\n  static struct nlist namelist[] = {{\"_ifnet\"}, {nullptr}};\n  static kvm_t *nkd;\n\n  if (!nkd_init) {\n    nkd = kvm_openfiles(nullptr, NULL, NULL, O_RDONLY, errbuf);\n    if (nkd == nullptr) {\n      NORM_ERR(\"cannot kvm_openfiles: %s\", errbuf);\n      NORM_ERR(\"maybe you need to setgid kmem this program?\");\n      return 1;\n    } else if (kvm_nlist(nkd, namelist) != 0) {\n      NORM_ERR(\"cannot kvm_nlist\");\n      return 1;\n    } else {\n      nkd_init = 1;\n    }\n  }\n\n  if (kvm_read(nkd, (u_long)namelist[0].n_value, (void *)&ifhead,\n               sizeof(ifhead)) < 0) {\n    NORM_ERR(\"cannot kvm_read\");\n    return 1;\n  }\n\n  /* get delta */\n  delta = current_update_time - last_update_time;\n  if (delta <= 0.0001) { return 1; }\n\n  // TODO(gmb)\n  /*\n  for (i = 0, ifnetaddr = (u_long)ifhead.tqh_first;\n       ifnet.if_list.tqe_next && i < 16;\n       ifnetaddr = (u_long)ifnet.if_list.tqe_next, i++) {\n    struct net_stat *ns;\n    long long last_recv, last_trans;\n\n    kvm_read(nkd, (u_long)ifnetaddr, (void *)&ifnet, sizeof(ifnet));\n    ns = get_net_stat(ifnet.if_xname, nullptr, NULL);\n    ns->up = 1;\n    last_recv = ns->recv;\n    last_trans = ns->trans;\n\n    if (ifnet.if_ibytes < ns->last_read_recv) {\n      ns->recv +=\n          ((long long)4294967295U - ns->last_read_recv) + ifnet.if_ibytes;\n    } else {\n      ns->recv += (ifnet.if_ibytes - ns->last_read_recv);\n    }\n\n    ns->last_read_recv = ifnet.if_ibytes;\n\n    if (ifnet.if_obytes < ns->last_read_trans) {\n      ns->trans +=\n          ((long long)4294967295U - ns->last_read_trans) + ifnet.if_obytes;\n    } else {\n      ns->trans += (ifnet.if_obytes - ns->last_read_trans);\n    }\n\n    ns->last_read_trans = ifnet.if_obytes;\n\n    ns->recv += (ifnet.if_ibytes - ns->last_read_recv);\n    ns->last_read_recv = ifnet.if_ibytes;\n    ns->trans += (ifnet.if_obytes - ns->last_read_trans);\n    ns->last_read_trans = ifnet.if_obytes;\n\n    ns->recv_speed = (ns->recv - last_recv) / delta;\n    ns->trans_speed = (ns->trans - last_trans) / delta;\n  }*/\n\n  return 1;\n}\n\nint update_total_processes() {\n  bsdcommon::get_processes(&info.procs);\n  return 1;\n}\n\nint update_running_processes() {\n  bsdcommon::get_number_of_running_processes(&info.run_procs);\n  return 1;\n}\n\nvoid get_cpu_count(void) {\n  bsdcommon::get_cpu_count(&info.cpu_usage, &info.cpu_count);\n}\n\nint update_cpu_usage() {\n  bsdcommon::update_cpu_usage(&info.cpu_usage, &info.cpu_count);\n  return 1;\n}\n\nvoid get_top_info(void) {\n  bsdcommon::update_top_info();\n}\n\nvoid free_cpu(struct text_object *) { /* no-op */\n}\n\nint update_load_average() {\n  double v[3];\n\n  getloadavg(v, 3);\n\n  info.loadavg[0] = (float)v[0];\n  info.loadavg[1] = (float)v[1];\n  info.loadavg[2] = (float)v[2];\n\n  return 1;\n}\n\ndouble get_acpi_temperature(int fd) { return -1; }\n\nvoid get_battery_stuff(char *buf, unsigned int n, const char *bat, int item) {}\n\nint open_acpi_temperature(const char *name) { return -1; }\n\nvoid get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,\n                         const char *adapter) {\n  (void)adapter;  // only linux uses this\n\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  /* not implemented */\n  memset(p_client_buffer, 0, client_buffer_size);\n}\n\n/* char *get_acpi_fan() */\nvoid get_acpi_fan(char *p_client_buffer, size_t client_buffer_size) {\n  if (!p_client_buffer || client_buffer_size <= 0) { return; }\n\n  /* not implemented */\n  memset(p_client_buffer, 0, client_buffer_size);\n}\n\nint get_entropy_avail(unsigned int *val) { return 1; }\nint get_entropy_poolsize(unsigned int *val) { return 1; }\n\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  //TODO(gmb)\n  return 1;\n}\n\nint get_battery_perct(const char *) {\n  // TODO(gmb)\n  return 0;\n}\n\nvoid get_battery_power_draw(char *buffer, unsigned int n, const char *bat) {\n  // TODO(gmb)\n}\n\nvoid get_battery_short_status(char *buffer, unsigned int n, const char *bat) {\n  // TODO(gmb)\n}\n\ndouble get_battery_perct_bar(struct text_object *obj) {\n  int batperct = get_battery_perct(obj->data.s);\n  return batperct;\n}\n\nint update_diskio(void) {\n  // TODO(gmb)\n  return 1;\n}\n\nbool is_conky_already_running() {\n  return bsdcommon::is_conky_already_running();\n}\n"
  },
  {
    "path": "src/data/os/netbsd.h",
    "content": "/* */\n\n#ifndef NETBSD_H_\n#define NETBSD_H_\n\n#include <kvm.h>\n#include <limits.h>\n#include <strings.h>\n#include <unistd.h>\n\n#include <sys/param.h>\n#include <sys/mount.h>\n#include <sys/statvfs.h>\n\n#include \"../../common.h\"\n#include \"../../conky.h\"\n\n#include \"bsdcommon.h\"\n\nint get_entropy_avail(unsigned int *);\nint get_entropy_poolsize(unsigned int *);\n\nbool is_conky_already_running();\n\n#endif /*NETBSD_H_*/\n"
  },
  {
    "path": "src/data/os/openbsd.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2007 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <kvm.h>\n#include <sys/ioctl.h>\n#include <sys/malloc.h>\n#include <sys/param.h>\n#include <sys/resource.h>\n#include <sys/proc.h>\n#include <sys/sensors.h>\n#include <sys/sched.h>\n#include <sys/socket.h>\n#include <sys/swap.h>\n#include <sys/sysctl.h>\n#include <sys/time.h>\n#include <sys/types.h>\n#include <sys/user.h>\n#include <sys/vmmeter.h>\n\n#include <net/if.h>\n#include <net/if_media.h>\n#include <netinet/in.h>\n\n#include <err.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <ifaddrs.h>\n#include <limits.h>\n#include <machine/apmvar.h>\n#include <unistd.h>\n\n#include <net80211/ieee80211.h>\n#include <net80211/ieee80211_ioctl.h>\n\n#include \"../../conky.h\"\n#include \"../hardware/diskio.h\"\n#include \"../../logging.h\"\n#include \"../network/net_stat.h\"\n#include \"openbsd.h\"\n#include \"../../content/temphelper.h\"\n#include \"../top.h\"\n\n#define MAXSHOWDEVS 16\n\n#define LOG1024 10\n#define pagetok(size) ((size) << pageshift)\n\ninline void proc_find_top(struct process **cpu, struct process **mem);\n\nstruct ifmibdata *data = nullptr;\nsize_t len = 0;\n\nstatic int init_sensors = 0;\n\nint check_mount(struct text_object *obj) {\n  /* stub */\n  (void)obj;\n  return 0;\n}\n\nint update_uptime() {\n  int mib[2] = {CTL_KERN, KERN_BOOTTIME};\n  struct timeval boottime;\n  time_t now;\n  size_t size = sizeof(boottime);\n\n  if ((sysctl(mib, 2, &boottime, &size, nullptr, 0) != -1) &&\n      (boottime.tv_sec != 0)) {\n    time(&now);\n    info.uptime = now - boottime.tv_sec;\n  } else {\n    NORM_ERR(\"Could not get uptime\");\n    info.uptime = 0;\n  }\n\n  return 0;\n}\n\nint update_meminfo() {\n  bsdcommon::update_meminfo(info);\n  return 1;\n}\n\nint update_net_stats() {\n  struct net_stat *ns;\n  double delta;\n  long long r, t, last_recv, last_trans;\n  struct ifaddrs *ifap, *ifa;\n  struct if_data *ifd;\n\n  /* get delta */\n  delta = current_update_time - last_update_time;\n  if (delta <= 0.0001) { return 0; }\n\n  if (getifaddrs(&ifap) < 0) { return 0; }\n\n  for (ifa = ifap; ifa; ifa = ifa->ifa_next) {\n    ns = get_net_stat((const char *)ifa->ifa_name, nullptr, NULL);\n\n    if (ifa->ifa_flags & IFF_UP) {\n      struct ifaddrs *iftmp;\n\n      ns->up = 1;\n      last_recv = ns->recv;\n      last_trans = ns->trans;\n\n      if (ifa->ifa_addr->sa_family != AF_LINK) { continue; }\n\n      for (iftmp = ifa->ifa_next;\n           iftmp != nullptr && strcmp(ifa->ifa_name, iftmp->ifa_name) == 0;\n           iftmp = iftmp->ifa_next) {\n        if (iftmp->ifa_addr->sa_family == AF_INET) {\n          memcpy(&(ns->addr), iftmp->ifa_addr, iftmp->ifa_addr->sa_len);\n        }\n      }\n\n      ifd = (struct if_data *)ifa->ifa_data;\n      r = ifd->ifi_ibytes;\n      t = ifd->ifi_obytes;\n\n      if (r < ns->last_read_recv) {\n        ns->recv += ((long long)4294967295U - ns->last_read_recv) + r;\n      } else {\n        ns->recv += (r - ns->last_read_recv);\n      }\n\n      ns->last_read_recv = r;\n\n      if (t < ns->last_read_trans) {\n        ns->trans += (long long)4294967295U - ns->last_read_trans + t;\n      } else {\n        ns->trans += (t - ns->last_read_trans);\n      }\n\n      ns->last_read_trans = t;\n\n      /* calculate speeds */\n      ns->recv_speed = (ns->recv - last_recv) / delta;\n      ns->trans_speed = (ns->trans - last_trans) / delta;\n    } else {\n      ns->up = 0;\n    }\n  }\n\n  freeifaddrs(ifap);\n\n  return 0;\n}\n\nint update_total_processes() {\n  bsdcommon::get_processes(&info.procs);\n  return 1;\n}\n\nint update_running_processes() {\n  bsdcommon::get_number_of_running_processes(&info.run_procs);\n  return 1;\n}\n\nvoid get_cpu_count() {\n  bsdcommon::get_cpu_count(&info.cpu_usage, &info.cpu_count);\n}\n\nint update_cpu_usage() {\n  bsdcommon::update_cpu_usage(&info.cpu_usage, &info.cpu_count);\n  return 1;\n}\n\nvoid free_cpu(struct text_object *) { /* no-op */\n}\n\nint update_load_average() {\n  double v[3];\n\n  getloadavg(v, 3);\n\n  info.loadavg[0] = (float)v[0];\n  info.loadavg[1] = (float)v[1];\n  info.loadavg[2] = (float)v[2];\n\n  return 0;\n}\n\n#define MAXSENSORDEVICES 128\n#define OBSD_MAX_SENSORS 256\nstatic struct obsd_sensors_struct {\n  int device;\n  float temp[MAXSENSORDEVICES][OBSD_MAX_SENSORS];\n  unsigned int fan[MAXSENSORDEVICES][OBSD_MAX_SENSORS];\n  float volt[MAXSENSORDEVICES][OBSD_MAX_SENSORS];\n} obsd_sensors;\n\nstatic conky::simple_config_setting<int> sensor_device(\"sensor_device\", 0,\n                                                       false);\n\n/* read sensors from sysctl */\nint update_obsd_sensors() {\n  int sensor_cnt, dev, numt, mib[5] = {CTL_HW, HW_SENSORS, 0, 0, 0};\n  struct sensor sensor;\n  struct sensordev sensordev;\n  size_t slen, sdlen;\n  enum sensor_type type;\n\n  slen = sizeof(sensor);\n  sdlen = sizeof(sensordev);\n\n  sensor_cnt = 0;\n\n  dev = obsd_sensors.device;  // FIXME: read more than one device\n\n  /* for (dev = 0; dev < MAXSENSORDEVICES; dev++) { */\n  mib[2] = dev;\n  if (sysctl(mib, 3, &sensordev, &sdlen, nullptr, 0) == -1) {\n    if (errno != ENOENT) { warn(\"sysctl\"); }\n    return 0;\n    // continue;\n  }\n  for (int t = 0; t < SENSOR_MAX_TYPES; t++) {\n    type = (enum sensor_type) t;\n    mib[3] = type;\n    for (numt = 0; numt < sensordev.maxnumt[type]; numt++) {\n      mib[4] = numt;\n      if (sysctl(mib, 5, &sensor, &slen, nullptr, 0) == -1) {\n        if (errno != ENOENT) { warn(\"sysctl\"); }\n        continue;\n      }\n      if (sensor.flags & SENSOR_FINVALID) { continue; }\n\n      switch (type) {\n        case SENSOR_TEMP:\n          obsd_sensors.temp[dev][sensor.numt] =\n              (sensor.value - 273150000) / 1000000.0;\n          break;\n        case SENSOR_FANRPM:\n          obsd_sensors.fan[dev][sensor.numt] = sensor.value;\n          break;\n        case SENSOR_VOLTS_DC:\n          obsd_sensors.volt[dev][sensor.numt] = sensor.value / 1000000.0;\n          break;\n        default:\n          break;\n      }\n\n      sensor_cnt++;\n    }\n  }\n  /* } */\n\n  init_sensors = 1;\n\n  return 0;\n}\n\nvoid parse_obsd_sensor(struct text_object *obj, const char *arg) {\n  if (!isdigit((unsigned char)arg[0]) || atoi(&arg[0]) < 0 ||\n      atoi(&arg[0]) > OBSD_MAX_SENSORS - 1) {\n    obj->data.l = 0;\n    NORM_ERR(\"Invalid sensor number!\");\n  } else\n    obj->data.l = atoi(&arg[0]);\n}\n\nvoid print_obsd_sensors_temp(struct text_object *obj, char *p,\n                             unsigned int p_max_size) {\n  obsd_sensors.device = sensor_device.get(*state);\n  update_obsd_sensors();\n  temp_print(p, p_max_size, obsd_sensors.temp[obsd_sensors.device][obj->data.l],\n             TEMP_CELSIUS, 1);\n}\n\nvoid print_obsd_sensors_fan(struct text_object *obj, char *p,\n                            unsigned int p_max_size) {\n  obsd_sensors.device = sensor_device.get(*state);\n  update_obsd_sensors();\n  snprintf(p, p_max_size, \"%d\",\n           obsd_sensors.fan[obsd_sensors.device][obj->data.l]);\n}\n\nvoid print_obsd_sensors_volt(struct text_object *obj, char *p,\n                             unsigned int p_max_size) {\n  obsd_sensors.device = sensor_device.get(*state);\n  update_obsd_sensors();\n  snprintf(p, p_max_size, \"%.2f\",\n           obsd_sensors.volt[obsd_sensors.device][obj->data.l]);\n}\n\n/* chipset vendor */\nvoid get_obsd_vendor(struct text_object *obj, char *buf,\n                     unsigned int client_buffer_size) {\n  int mib[2];\n  char vendor[64];\n  size_t size = sizeof(vendor);\n\n  (void)obj;\n\n  mib[0] = CTL_HW;\n  mib[1] = HW_VENDOR;\n\n  if (sysctl(mib, 2, vendor, &size, nullptr, 0) == -1) {\n    NORM_ERR(\"error reading vendor\");\n    snprintf(buf, client_buffer_size, \"%s\", \"unknown\");\n  } else {\n    snprintf(buf, client_buffer_size, \"%s\", vendor);\n  }\n}\n\n/* chipset name */\nvoid get_obsd_product(struct text_object *obj, char *buf,\n                      unsigned int client_buffer_size) {\n  int mib[2];\n  char product[64];\n  size_t size = sizeof(product);\n\n  (void)obj;\n\n  mib[0] = CTL_HW;\n  mib[1] = HW_PRODUCT;\n\n  if (sysctl(mib, 2, product, &size, nullptr, 0) == -1) {\n    NORM_ERR(\"error reading product\");\n    snprintf(buf, client_buffer_size, \"%s\", \"unknown\");\n  } else {\n    snprintf(buf, client_buffer_size, \"%s\", product);\n  }\n}\n\n/* void */\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  int freq = cpu;\n  int mib[2] = {CTL_HW, HW_CPUSPEED};\n\n  if (!p_client_buffer || client_buffer_size <= 0 || !p_format ||\n      divisor <= 0) {\n    return 0;\n  }\n\n  size_t size = sizeof(freq);\n\n  if (sysctl(mib, 2, &freq, &size, nullptr, 0) == 0) {\n    snprintf(p_client_buffer, client_buffer_size, p_format,\n             (float)freq / divisor);\n  } else {\n    snprintf(p_client_buffer, client_buffer_size, p_format, 0.0f);\n  }\n\n  return 1;\n}\n\n#if 0\n/* deprecated, will rewrite this soon in update_net_stats() -hifi */\nvoid update_wifi_stats()\n{\n\tstruct net_stat *ns;\n\tstruct ifaddrs *ifap, *ifa;\n\tstruct ifmediareq ifmr;\n\tstruct ieee80211_nodereq nr;\n\tstruct ieee80211_bssid bssid;\n\tint s, ibssid;\n\n\t/* Get iface table */\n\tif (getifaddrs(&ifap) < 0) {\n\t\treturn;\n\t}\n\n\tfor (ifa = ifap; ifa; ifa = ifa->ifa_next) {\n\t\tns = get_net_stat((const char *) ifa->ifa_name);\n\n\t\ts = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);\n\n\t\t/* Get media type */\n\t\tbzero(&ifmr, sizeof(ifmr));\n\t\tstrlcpy(ifmr.ifm_name, ifa->ifa_name, IFNAMSIZ);\n\t\tif (ioctl(s, SIOCGIFMEDIA, (caddr_t) &ifmr) < 0) {\n\t\t\tclose(s);\n\t\t\treturn;\n\t\t}\n\n\t\t/* We can monitor only wireless interfaces\n\t\t * which are not in hostap mode */\n\t\tif ((ifmr.ifm_active & IFM_IEEE80211)\n\t\t\t\t&& !(ifmr.ifm_active & IFM_IEEE80211_HOSTAP)) {\n\t\t\t/* Get wi status */\n\n\t\t\tmemset(&bssid, 0, sizeof(bssid));\n\t\t\tstrlcpy(bssid.i_name, ifa->ifa_name, sizeof(bssid.i_name));\n\t\t\tibssid = ioctl(s, SIOCG80211BSSID, &bssid);\n\n\t\t\tbzero(&nr, sizeof(nr));\n\t\t\tbcopy(bssid.i_bssid, &nr.nr_macaddr, sizeof(nr.nr_macaddr));\n\t\t\tstrlcpy(nr.nr_ifname, ifa->ifa_name, sizeof(nr.nr_ifname));\n\n\t\t\tif (ioctl(s, SIOCG80211NODE, &nr) == 0 && nr.nr_rssi) {\n\t\t\t\tns->linkstatus = nr.nr_rssi;\n\t\t\t}\n\t\t}\ncleanup:\n\t\tclose(s);\n\t}\n}\n#endif\n\nint update_diskio() { return 0; /* XXX: implement? hifi: not sure how */ }\n\nvoid get_top_info(void) {\n  bsdcommon::update_top_info();\n}\n\nvoid get_battery_short_status(char *buffer, unsigned int n, const char *bat) {\n  /* Not implemented */\n  (void)bat;\n  if (buffer && n > 0) memset(buffer, 0, n);\n}\n\n/* empty stubs so conky links */\nvoid prepare_update() {}\n\nint get_entropy_avail(unsigned int *val) { return 1; }\n\nint get_entropy_poolsize(unsigned int *val) { return 1; }\n\nbool is_conky_already_running() {\n  return bsdcommon::is_conky_already_running();\n}\n\n"
  },
  {
    "path": "src/data/os/openbsd.h",
    "content": "/* */\n\n#ifndef OPENBSD_H_\n#define OPENBSD_H_\n\n#include <machine/apmvar.h>\n#include <sys/param.h>\n#include <sys/sensors.h>\n#include <sys/sysctl.h>\n#include <sys/types.h>\n#include <sys/mount.h>\n\n#include \"../../common.h\"\n\n#include \"bsdcommon.h\"\n\nvoid parse_obsd_sensor(struct text_object *, const char *);\nvoid print_obsd_sensors_temp(struct text_object *, char *, unsigned int);\nvoid print_obsd_sensors_fan(struct text_object *, char *, unsigned int);\nvoid print_obsd_sensors_volt(struct text_object *, char *, unsigned int);\nvoid get_obsd_vendor(struct text_object *, char *buf,\n                     unsigned int client_buffer_size);\nvoid get_obsd_product(struct text_object *, char *buf,\n                     unsigned int client_buffer_size);\n\n#if defined(i386) || defined(__i386__)\ntypedef struct apm_power_info *apm_info_t;\n#endif\n\nint get_entropy_avail(unsigned int *);\nint get_entropy_poolsize(unsigned int *);\n\nbool is_conky_already_running();\n\n#endif /*OPENBSD_H_*/\n"
  },
  {
    "path": "src/data/os/solaris.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <dirent.h>\n#include <kstat.h>\n#include <limits.h>\n#include <net/if.h>\n#include <procfs.h>\n#include <project.h>\n#include <sys/loadavg.h>\n#include <sys/socket.h>\n#include <sys/sockio.h>\n#include <sys/stat.h>\n#include <sys/swap.h>\n#include <sys/sysinfo.h>\n#include <sys/task.h>\n#include <unistd.h>\n#include \"../../common.h\"\n#include \"../../conky.h\"\n#include \"../hardware/diskio.h\"\n#include \"../top.h\"\n\n#include <assert.h>\n\n#include \"../network/net_stat.h\"\n#include \"solaris.h\"\n\nstatic kstat_ctl_t *kstat;\nstatic time_t kstat_updated;\nstatic int pageshift = INT_MAX;\n\nstatic pthread_mutex_t kstat_mtx = PTHREAD_MUTEX_INITIALIZER;\n\nstatic int pagetok(int pages) {\n  if (pageshift == INT_MAX) {\n    int pagesize = sysconf(_SC_PAGESIZE);\n    pageshift = 0;\n    while ((pagesize >>= 1) > 0) pageshift++;\n    pageshift -= 10; /* 2^10 = 1024 */\n  }\n  return (pageshift > 0 ? pages << pageshift : pages >> -pageshift);\n}\n\nstatic void update_kstat() {\n  time_t now;\n\n  pthread_mutex_lock(&kstat_mtx);\n  now = time(nullptr);\n\n  if (kstat == nullptr) {\n    if ((kstat = kstat_open()) == nullptr) {\n      pthread_mutex_unlock(&kstat_mtx);\n      NORM_ERR(\"can't open kstat: %s\", strerror(errno));\n      return;\n    }\n    kstat_updated = 0;\n  }\n  if (now - kstat_updated < 2) {\n    /* Do not update kstats too often */\n    pthread_mutex_unlock(&kstat_mtx);\n    return;\n  }\n\n  if (kstat_chain_update(kstat) == -1) {\n    pthread_mutex_unlock(&kstat_mtx);\n    perror(\"kstat_chain_update\");\n    return;\n  }\n  kstat_updated = now;\n  pthread_mutex_unlock(&kstat_mtx);\n}\n\nstatic kstat_named_t *get_kstat(const char *module, int inst, const char *name,\n                                const char *stat) {\n  kstat_t *ksp;\n\n  update_kstat();\n\n  pthread_mutex_lock(&kstat_mtx);\n  ksp = kstat_lookup(kstat, (char *)module, inst, (char *)name);\n  if (ksp == nullptr) {\n    NORM_ERR(\"cannot lookup kstat %s:%d:%s:%s %s\", module, inst, name, stat,\n             strerror(errno));\n    pthread_mutex_unlock(&kstat_mtx);\n    return nullptr;\n  }\n\n  if (kstat_read(kstat, ksp, nullptr) >= 0) {\n    if (ksp->ks_type == KSTAT_TYPE_NAMED || ksp->ks_type == KSTAT_TYPE_TIMER) {\n      kstat_named_t *knp =\n          (kstat_named_t *)kstat_data_lookup(ksp, (char *)stat);\n      pthread_mutex_unlock(&kstat_mtx);\n      return knp;\n    } else {\n      NORM_ERR(\"kstat %s:%d:%s:%s has unexpected type %d\", module, inst, name,\n               stat, ksp->ks_type);\n      pthread_mutex_unlock(&kstat_mtx);\n      return nullptr;\n    }\n  }\n  NORM_ERR(\"cannot read kstat %s:%d:%s:%s\", module, inst, name, stat);\n  pthread_mutex_unlock(&kstat_mtx);\n  return nullptr;\n}\n\nvoid prepare_update() { kstat_updated = 0; }\n\nint update_meminfo() {\n  kstat_named_t *knp;\n  int nswap = swapctl(SC_GETNSWP, 0);\n  struct swaptable *swt;\n  struct swapent *swe;\n  char path[PATH_MAX];\n  unsigned long stp, sfp;\n\n  /* RAM stats */\n  knp = get_kstat(\"unix\", -1, \"system_pages\", \"freemem\");\n  if (knp != nullptr) info.memfree = pagetok(knp->value.ui32);\n  info.memmax = pagetok(sysconf(_SC_PHYS_PAGES));\n  if (info.memmax > info.memfree)\n    info.mem = info.memmax - info.memfree;\n  else /* for non-global zones with capped memory */\n    info.mem = info.memmax;\n\n  /* Swap stats */\n  if (nswap < 1) return 0;\n  /* for swapctl(2) */\n  swt =\n      (struct swaptable *)malloc(nswap * sizeof(struct swapent) + sizeof(int));\n  if (swt == nullptr) return 0;\n  swt->swt_n = nswap;\n  swe = &(swt->swt_ent[0]);\n  /* We are not interested in ste_path */\n  for (int i = 0; i < nswap; i++) swe[i].ste_path = path;\n  nswap = swapctl(SC_LIST, swt);\n  swe = &(swt->swt_ent[0]);\n  stp = sfp = 0;\n  for (int i = 0; i < nswap; i++) {\n    if ((swe[i].ste_flags & ST_INDEL) || (swe[i].ste_flags & ST_DOINGDEL))\n      continue;\n    stp += swe->ste_pages;\n    sfp += swe->ste_free;\n  }\n  free(swt);\n  info.swapfree = pagetok(sfp);\n  info.swapmax = pagetok(stp);\n  info.swap = info.swapmax - info.swapfree;\n\n  return 0;\n}\n\nint check_mount(struct text_object *obj) {\n  /* stub */\n  (void)obj;\n  return 0;\n}\n\ndouble get_battery_perct_bar(struct text_object *obj) {\n  /* Not implemented */\n  (void)obj;\n\n  return 100.0;\n}\n\ndouble get_acpi_temperature(int fd) {\n  /* Not implemented */\n  (void)fd;\n\n  return 0.0;\n}\n\nint update_total_processes(void) {\n  kstat_named_t *knp = get_kstat(\"unix\", -1, \"system_misc\", \"nproc\");\n  if (knp != nullptr) info.procs = knp->value.ui32;\n\n  return 0;\n}\n\nvoid get_battery_stuff(char *buf, unsigned int n, const char *bat, int item) {\n  /* Not implemented */\n}\n\nint update_running_processes(void) {\n  /* There is no kstat for this, see update_proc_entry() */\n  return 0;\n}\n\nint update_net_stats(void) {\n  struct ifconf ifc;\n  int sockfd;\n  char buf[1024];\n  double d = current_update_time - last_update_time;\n\n  if (d < 0.1) return 0;\n\n  /* Find all active net interfaces */\n  if ((sockfd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {\n    NORM_ERR(\"cannot create socket: %s\", strerror(errno));\n    return 0;\n  }\n  ifc.ifc_buf = buf;\n  ifc.ifc_len = sizeof(buf);\n  if (ioctl(sockfd, SIOCGIFCONF, &ifc) < 0) {\n    NORM_ERR(\"ioctl(SIOCGIFCONF) failed: %s\", strerror(errno));\n    (void)close(sockfd);\n    return 0;\n  }\n  (void)close(sockfd);\n\n  /* Collect stats for all active interfaces */\n  for (int i = 0; i < ifc.ifc_len / sizeof(struct ifreq); i++) {\n    struct net_stat *ns;\n    struct ifreq *ifr = &ifc.ifc_req[i];\n    long long last_recv, last_trans;\n    long long r, t;\n    kstat_named_t *knp;\n\n    ns = get_net_stat((const char *)ifr->ifr_name, nullptr, NULL);\n    ns->up = 1;\n    memcpy(&(ns->addr), &ifr->ifr_addr, sizeof(ifr->ifr_addr));\n\n    /* Skip the loopback interface, it does not have kstat data */\n    if (ifr->ifr_flags & IFF_LOOPBACK || strcmp(ifr->ifr_name, \"lo0\") == 0)\n      continue;\n    last_recv = ns->recv;\n    last_trans = ns->trans;\n\n    /* Get received bytes */\n    knp = get_kstat(\"link\", -1, ifr->ifr_name, \"rbytes\");\n    if (knp == nullptr) {\n      NORM_ERR(\"cannot read rbytes for %s\\n\", ifr->ifr_name);\n      continue;\n    }\n    r = (long long)knp->value.ui32;\n    if (r <= ns->last_read_recv) {\n      ns->recv += ((long long)4294967295U - ns->last_read_recv) + r;\n    } else {\n      ns->recv += (r - ns->last_read_recv);\n    }\n    ns->last_read_recv = r;\n\n    /* Get transceived bytes */\n    knp = get_kstat(\"link\", -1, ifr->ifr_name, \"obytes\");\n    if (knp == nullptr) {\n      NORM_ERR(\"cannot read obytes for %s\\n\", ifr->ifr_name);\n      continue;\n    }\n    t = (long long)knp->value.ui32;\n    if (t < ns->last_read_trans) {\n      ns->trans += ((long long)4294967295U - ns->last_read_trans) + t;\n    } else {\n      ns->trans += (t - ns->last_read_trans);\n    }\n    ns->last_read_trans = t;\n\n    ns->recv_speed = (ns->recv - last_recv) / d;\n    ns->trans_speed = (ns->trans - last_trans) / d;\n  }\n  return 0;\n}\n\nint update_cpu_usage(void) {\n  static int last_cpu_cnt = 0;\n  static int *last_cpu_use = nullptr;\n  double d = current_update_time - last_update_time;\n  double total_cpu_usage = 0;\n  int cpu;\n\n  if (d < 0.1) return 0;\n\n  update_kstat();\n\n  info.cpu_count = sysconf(_SC_NPROCESSORS_ONLN);\n\n  /* (Re)allocate the array with previous values */\n  if (last_cpu_cnt != info.cpu_count || last_cpu_use == nullptr) {\n    last_cpu_use =\n        (int *)realloc(last_cpu_use, (info.cpu_count + 1) * sizeof(int));\n    last_cpu_cnt = info.cpu_count;\n    if (last_cpu_use == nullptr) return 0;\n  }\n\n  info.cpu_usage = (float *)malloc((info.cpu_count + 1) * sizeof(float));\n\n  pthread_mutex_lock(&kstat_mtx);\n  for (cpu = 1; cpu <= info.cpu_count; cpu++) {\n    char stat_name[PATH_MAX];\n    unsigned long cpu_user, cpu_nice, cpu_system, cpu_idle;\n    unsigned long cpu_use;\n    cpu_stat_t *cs;\n    kstat_t *ksp;\n\n    snprintf(stat_name, PATH_MAX, \"cpu_stat%d\", cpu - 1);\n    ksp = kstat_lookup(kstat, (char *)\"cpu_stat\", cpu - 1, stat_name);\n    if (ksp == nullptr) continue;\n    if (kstat_read(kstat, ksp, nullptr) == -1) continue;\n    cs = (cpu_stat_t *)ksp->ks_data;\n\n    cpu_idle = cs->cpu_sysinfo.cpu[CPU_IDLE];\n    cpu_user = cs->cpu_sysinfo.cpu[CPU_USER];\n    cpu_nice = cs->cpu_sysinfo.cpu[CPU_WAIT];\n    cpu_system = cs->cpu_sysinfo.cpu[CPU_KERNEL];\n\n    cpu_use = cpu_user + cpu_nice + cpu_system;\n\n    info.cpu_usage[cpu] = (double)(cpu_use - last_cpu_use[cpu]) / d / 100.0;\n    total_cpu_usage += info.cpu_usage[cpu];\n    last_cpu_use[cpu] = cpu_use;\n  }\n  pthread_mutex_unlock(&kstat_mtx);\n\n  info.cpu_usage[0] = total_cpu_usage / info.cpu_count;\n\n  return 0;\n}\n\nvoid free_cpu(struct text_object *) { /* no-op */\n}\n\nvoid update_proc_entry(struct process *p) {\n  psinfo_t proc;\n  int fd;\n  char pfn[PATH_MAX];\n\n  snprintf(pfn, PATH_MAX, \"/proc/%d/psinfo\", p->pid);\n  /* Ignore errors here as the process can be gone */\n  if ((fd = open(pfn, O_RDONLY)) < 0) return;\n  if (pread(fd, &proc, sizeof(psinfo_t), 0) != sizeof(psinfo_t)) {\n    (void)close(fd);\n    return;\n  }\n  (void)close(fd);\n  free_and_zero(p->name);\n  free_and_zero(p->basename);\n  p->name = strndup(proc.pr_fname, text_buffer_size.get(*::state));\n  p->basename = strndup(proc.pr_fname, text_buffer_size.get(*::state));\n  p->uid = proc.pr_uid;\n  /* see proc(4) */\n  p->amount = (double)proc.pr_pctcpu / (double)0x8000 * 100.0;\n  p->rss = proc.pr_rssize * 1024;                /* to bytes */\n  p->vsize = proc.pr_size * 1024;                /* to bytes */\n  p->total_cpu_time = proc.pr_time.tv_sec * 100; /* to hundredths of secs */\n  if (proc.pr_lwp.pr_sname == 'O' || proc.pr_lwp.pr_sname == 'R')\n    info.run_procs++;\n  p->time_stamp = g_time;\n}\n\nvoid get_top_info(void) {\n  DIR *dir;\n  struct dirent *entry;\n\n  if (!(dir = opendir(\"/proc\"))) { return; }\n  info.run_procs = 0;\n\n  while ((entry = readdir(dir))) {\n    pid_t pid;\n\n    if (entry == nullptr) break;\n    if (sscanf(entry->d_name, \"%u\", &pid) != 1) continue;\n    update_proc_entry(get_process(pid));\n  }\n  (void)closedir(dir);\n}\n\n/*\n * Because Solaris systems often have 100s or 1000s of disks, we don't collect\n * data for all of them but only for those mentioned in conkyrc.\n * Instead of disk's special file in SVR4 format, we use the driver name and\n * and the instance number to specify the disk or partition. For example: sd0,\n * ssd3, or sd5,b.\n */\nint update_diskio(void) {\n  unsigned int tot_read = 0;\n  unsigned int tot_written = 0;\n\n  update_kstat();\n\n  pthread_mutex_lock(&kstat_mtx);\n  for (struct diskio_stat *cur = &stats; cur; cur = cur->next) {\n    unsigned int read, written;\n    kstat_io_t *ksio;\n    kstat_t *ksp;\n\n    if (cur->dev == nullptr) continue;\n    if ((ksp = kstat_lookup(kstat, nullptr, -1, cur->dev)) == NULL) continue;\n    if (kstat_read(kstat, ksp, nullptr) == -1) continue;\n    ksio = (kstat_io_t *)ksp->ks_data;\n    tot_read += read = (unsigned int)(ksio->nread / 512);\n    tot_written += written = (unsigned int)(ksio->nwritten / 512);\n    update_diskio_values(cur, read, written);\n  }\n\n  update_diskio_values(&stats, tot_read, tot_written);\n  pthread_mutex_unlock(&kstat_mtx);\n\n  return 0;\n}\n\nvoid get_battery_short_status(char *buffer, unsigned int n, const char *bat) {\n  /* Not implemented */\n  (void)bat;\n  if (buffer && n > 0) memset(buffer, 0, n);\n}\n\nvoid get_acpi_fan(char *p_client_buffer, size_t client_buffer_size) {\n  /* Not implemented */\n  if (p_client_buffer && client_buffer_size > 0)\n    memset(p_client_buffer, 0, client_buffer_size);\n}\n\nvoid get_acpi_ac_adapter(char *p_client_buffer, size_t client_buffer_size,\n                         const char *adapter) {\n  /* Not implemented */\n  if (p_client_buffer && client_buffer_size > 0)\n    memset(p_client_buffer, 0, client_buffer_size);\n}\n\nint get_battery_perct(const char *bat) {\n  /* Not implemented */\n  (void)bat;\n  return 1;\n}\n\nint get_entropy_poolsize(unsigned int *val) {\n  /* Not implemented */\n  (void)val;\n  return 1;\n}\n\nchar get_freq(char *p_client_buffer, size_t client_buffer_size,\n              const char *p_format, int divisor, unsigned int cpu) {\n  char stat_name[PATH_MAX];\n  kstat_named_t *knp;\n\n  snprintf(stat_name, PATH_MAX, \"cpu_info%d\", cpu - 1);\n  knp = get_kstat(\"cpu_info\", cpu - 1, stat_name, \"current_clock_Hz\");\n  if (knp == nullptr) return 0;\n  snprintf(p_client_buffer, client_buffer_size, p_format,\n           (float)knp->value.ui32 / divisor / 1000000.0);\n  return 1;\n}\n\nint update_uptime(void) {\n  kstat_named_t *knp;\n\n  knp = get_kstat(\"unix\", -1, \"system_misc\", \"boot_time\");\n  if (knp == nullptr) return 0;\n  info.uptime = time(nullptr) - knp->value.ui32;\n  return 1;\n}\n\nint open_acpi_temperature(const char *name) {\n  /* Not implemented */\n  (void)name;\n  return 1;\n}\n\nint get_entropy_avail(unsigned int *val) {\n  /* Not implemented */\n  (void)val;\n  return 1;\n}\n\nint update_load_average(void) {\n  double load[3];\n\n  getloadavg(load, 3);\n  info.loadavg[0] = (float)load[0];\n  info.loadavg[1] = (float)load[1];\n  info.loadavg[2] = (float)load[2];\n\n  return 0;\n}\n\nvoid get_cpu_count(void) {\n  kstat_named_t *knp = get_kstat(\"unix\", -1, \"system_misc\", \"ncpus\");\n  if (knp != nullptr) info.cpu_count = knp->value.ui32;\n}\n"
  },
  {
    "path": "src/data/os/solaris.h",
    "content": "#ifndef SOLARIS_H_\n#define SOLARIS_H_\n\nint get_entropy_avail(unsigned int *);\nint get_entropy_poolsize(unsigned int *);\n\n#endif /*SOLARIS_H_*/\n"
  },
  {
    "path": "src/data/proc.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *   (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"proc.h\"\n#include <dirent.h>\n#include <unistd.h>\n#include <cctype>\n#include <cstdlib>\n#include <cstring>\n#include <memory>\n#include <sstream>\n#include <string>\n#include \"../conky.h\"\n#include \"../core.h\"\n#include \"../logging.h\"\n\nstatic const char *skip_proc_stat_comm(const char *stat) {\n  if (stat == nullptr) { return nullptr; }\n  const char *close = strrchr(stat, ')');\n  if (close == nullptr) { return nullptr; }\n  const char *after = close + 1;\n  while (*after == ' ') { ++after; }\n  return after;\n}\n\nchar *readfile(const char *filename, int *total_read, char showerror) {\n  FILE *file;\n  char *buf = nullptr;\n  int bytes_read;\n\n  *total_read = 0;\n  file = fopen(filename, \"re\");\n  if (file != nullptr) {\n    do {\n      buf = static_cast<char *>(realloc(buf, *total_read + READSIZE + 1));\n      bytes_read = fread(buf + *total_read, 1, READSIZE, file);\n      *total_read += bytes_read;\n      buf[*total_read] = 0;\n    } while (bytes_read != 0);\n    fclose(file);\n  } else if (showerror != 0) {\n    NORM_ERR(READERR, filename);\n  }\n  return buf;\n}\n\nstatic bool parse_proc_stat_times(const char *buf, unsigned long int *utime,\n                                  unsigned long int *stime) {\n  if (buf == nullptr || utime == nullptr || stime == nullptr) { return false; }\n\n  const char *close_paren = strrchr(buf, ')');\n  if (close_paren == nullptr) { return false; }\n\n  const char *after = close_paren + 1;\n  while (*after == ' ') { ++after; }\n\n  int parsed =\n      sscanf(after, \"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu %lu\",\n             utime, stime);\n  return parsed == 2;\n}\n\nstatic bool parse_proc_stat_prio_nice(const char *after, long int *priority,\n                                      long int *nice) {\n  if (after == nullptr || priority == nullptr || nice == nullptr) {\n    return false;\n  }\n\n  char state;\n  int ppid;\n  int pgrp;\n  int session;\n  int tty_nr;\n  int tpgid;\n  unsigned int flags;\n  unsigned long minflt;\n  unsigned long cminflt;\n  unsigned long majflt;\n  unsigned long cmajflt;\n  unsigned long utime;\n  unsigned long stime;\n  long cutime;\n  long cstime;\n\n  int parsed = sscanf(\n      after, \"%c %d %d %d %d %d %u %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld\",\n      &state, &ppid, &pgrp, &session, &tty_nr, &tpgid, &flags, &minflt,\n      &cminflt, &majflt, &cmajflt, &utime, &stime, &cutime, &cstime, priority,\n      nice);\n  return parsed == 17;\n}\n\nvoid pid_readlink(const char *file, char *p, unsigned int p_max_size) {\n  std::unique_ptr<char[]> buf(new char[p_max_size]);\n\n  memset(buf.get(), 0, p_max_size);\n  if (readlink(file, buf.get(), p_max_size) >= 0) {\n    snprintf(p, p_max_size, \"%s\", buf.get());\n  } else {\n    NORM_ERR(READERR, file);\n  }\n}\n\nstruct ll_string {\n  char *string;\n  struct ll_string *next;\n};\n\nstruct ll_string *addnode(struct ll_string *end, char *string) {\n  auto *current =\n      static_cast<struct ll_string *>(malloc(sizeof(struct ll_string)));\n  current->string = strdup(string);\n  current->next = nullptr;\n  if (end != nullptr) { end->next = current; }\n  return current;\n}\n\nvoid freelist(struct ll_string *front) {\n  if (front != nullptr) {\n    free(front->string);\n    if (front->next != nullptr) { freelist(front->next); }\n    free(front);\n  }\n}\n\nint inlist(struct ll_string *front, char *string) {\n  struct ll_string *current;\n\n  for (current = front; current != nullptr; current = current->next) {\n    if (strcmp(current->string, string) == 0) { return 1; }\n  }\n  return 0;\n}\n\nvoid print_pid_chroot(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> buf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(buf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << buf.get() << \"/root\";\n  pid_readlink(pathstream.str().c_str(), p, p_max_size);\n}\n\nvoid print_pid_cmdline(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  char *buf;\n  int i, bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  if (*(objbuf.get()) != 0) {\n    pathstream << PROCDIR \"/\" << objbuf.get() << \"/cmdline\";\n    buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n    if (buf != nullptr) {\n      for (i = 0; i < bytes_read - 1; i++) {\n        if (buf[i] == 0) { buf[i] = ' '; }\n      }\n      snprintf(p, p_max_size, \"%s\", buf);\n      free(buf);\n    }\n  } else {\n    NORM_ERR(\"$pid_cmdline didn't receive a argument\");\n  }\n}\n\nvoid print_pid_cwd(struct text_object *obj, char *p, unsigned int p_max_size) {\n  std::unique_ptr<char[]> buf(new char[p_max_size]);\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/cwd\";\n  bytes_read = readlink(pathstream.str().c_str(), buf.get(), p_max_size);\n  if (bytes_read != -1) {\n    buf[bytes_read] = 0;\n    snprintf(p, p_max_size, \"%s\", buf.get());\n  } else {\n    NORM_ERR(READERR, pathstream.str().c_str());\n  }\n}\n\nvoid print_pid_environ(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  int i, total_read;\n  pid_t pid;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n  char *buf = nullptr;\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  char *end = nullptr;\n  long pid_value = strtol(objbuf.get(), &end, 10);\n  if (end == objbuf.get() || pid_value <= 0) {\n    *p = 0;\n    return;\n  }\n  pid = static_cast<pid_t>(pid_value);\n  while (*end == ' ' || *end == '\\t') { ++end; }\n  if (*end == 0) {\n    *p = 0;\n    return;\n  }\n\n  std::string var_name(end);\n  size_t stop = var_name.find_first_of(\" \\t\");\n  if (stop != std::string::npos) { var_name.resize(stop); }\n  if (var_name.empty()) {\n    *p = 0;\n    return;\n  }\n  for (char &ch : var_name) { ch = toupper(static_cast<unsigned char>(ch)); }\n  pathstream << PROCDIR \"/\" << pid << \"/environ\";\n  buf = readfile(pathstream.str().c_str(), &total_read, 1);\n  if (buf != nullptr) {\n    for (i = 0; i < total_read; i += strlen(buf + i) + 1) {\n      if (strncmp(buf + i, var_name.c_str(), var_name.size()) == 0 &&\n          *(buf + i + var_name.size()) == '=') {\n        snprintf(p, p_max_size, \"%s\", buf + i + var_name.size() + 1);\n        free(buf);\n        return;\n      }\n    }\n    free(buf);\n  }\n  *p = 0;\n}\n\nvoid print_pid_environ_list(struct text_object *obj, char *p,\n                            unsigned int p_max_size) {\n  char *buf = nullptr;\n  char *buf2;\n  int bytes_read, total_read;\n  int i = 0;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/environ\";\n\n  buf = readfile(pathstream.str().c_str(), &total_read, 1);\n  if (buf != nullptr) {\n    for (bytes_read = 0; bytes_read < total_read; buf[i - 1] = ';') {\n      buf2 = strdup(buf + bytes_read);\n      bytes_read += strlen(buf2) + 1;\n      sscanf(buf2, \"%[^=]\", buf + i);\n      free(buf2);\n      i = strlen(buf) + 1;\n    }\n    buf[i - 1] = 0;\n    snprintf(p, p_max_size, \"%s\", buf);\n    free(buf);\n  }\n}\n\nvoid print_pid_exe(struct text_object *obj, char *p, unsigned int p_max_size) {\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/exe\";\n  pid_readlink(pathstream.str().c_str(), p, p_max_size);\n}\n\nvoid print_pid_nice(struct text_object *obj, char *p, unsigned int p_max_size) {\n  char *buf = nullptr;\n  int bytes_read;\n  long int nice_value;\n  const char *after = nullptr;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  if (!obj->data.s) {\n    pathstream << PROCDIR \"/\" << objbuf.get() << \"/stat\";\n    buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n    if (buf != nullptr) {\n      after = skip_proc_stat_comm(buf);\n      long int priority_value = 0;\n      if (parse_proc_stat_prio_nice(after, &priority_value, &nice_value)) {\n        snprintf(p, p_max_size, \"%ld\", nice_value);\n      }\n      free(buf);\n    }\n  } else {\n    NORM_ERR(\"$pid_nice didn't receive a argument\");\n  }\n}\n\nvoid print_pid_openfiles(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  DIR *dir;\n  struct dirent *entry;\n  std::unique_ptr<char[]> buf(new char[p_max_size]);\n  int length, totallength = 0;\n  struct ll_string *files_front = nullptr;\n  struct ll_string *files_back = nullptr;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  dir = opendir(objbuf.get());\n  if (dir != nullptr) {\n    p[0] = 0;\n    while ((entry = readdir(dir)) != nullptr) {\n      if (entry->d_name[0] != '.') {\n        snprintf(buf.get(), p_max_size, \"%s/%s\", objbuf.get(), entry->d_name);\n        length = readlink(buf.get(), buf.get(), p_max_size - 1);\n        if (length < 0) { continue; }\n        if (length >= static_cast<int>(p_max_size)) { length = p_max_size - 1; }\n        buf[length] = 0;\n        if (inlist(files_front, buf.get()) == 0) {\n          files_back = addnode(files_back, buf.get());\n          int remaining = static_cast<int>(p_max_size) - totallength;\n          if (remaining <= 1) { break; }\n          int written = snprintf(p + totallength, remaining, \"%s; \", buf.get());\n          if (written < 0) { break; }\n          if (written >= remaining) {\n            totallength = p_max_size - 1;\n            break;\n          }\n          totallength += written;\n        }\n        if (files_front == nullptr) { files_front = files_back; }\n      }\n    }\n    closedir(dir);\n    freelist(files_front);\n    if (totallength >= 2 && p[totallength - 1] == ' ' &&\n        p[totallength - 2] == ';') {\n      p[totallength - 2] = 0;\n    }\n  } else {\n    p[0] = 0;\n  }\n}\n\nvoid print_pid_parent(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n#define PARENT_ENTRY \"PPid:\\t\"\n#define PARENTNOTFOUND \"Can't find the process parent in '%s'\"\n  char *begin, *end, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/status\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    begin = strstr(buf, PARENT_ENTRY);\n    if (begin != nullptr) {\n      begin += strlen(PARENT_ENTRY);\n      end = strchr(begin, '\\n');\n      if (end != nullptr) { *(end) = 0; }\n      snprintf(p, p_max_size, \"%s\", begin);\n    } else {\n      NORM_ERR(PARENTNOTFOUND, pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n\nvoid print_pid_priority(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  char *buf = nullptr;\n  int bytes_read;\n  long int priority;\n  const char *after = nullptr;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  if (*(objbuf.get()) != 0) {\n    pathstream << PROCDIR \"/\" << objbuf.get() << \"/stat\";\n    buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n    if (buf != nullptr) {\n      after = skip_proc_stat_comm(buf);\n      long int nice_value = 0;\n      if (parse_proc_stat_prio_nice(after, &priority, &nice_value)) {\n        snprintf(p, p_max_size, \"%ld\", priority);\n      }\n      free(buf);\n    }\n  } else {\n    NORM_ERR(\"$pid_priority didn't receive a argument\");\n  }\n}\n\nvoid print_pid_state(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n#define STATE_ENTRY \"State:\\t\"\n#define STATENOTFOUND \"Can't find the process state in '%s'\"\n  char *begin, *end, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/status\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    begin = strstr(buf, STATE_ENTRY);\n    if (begin != nullptr) {\n      begin += strlen(STATE_ENTRY) +\n               3;  // +3 will strip the char representing the short state and\n                   // the space and '(' that follow\n      end = strchr(begin, '\\n');\n      if (end != nullptr) {\n        *(end - 1) = 0;  // -1 strips the ')'\n      }\n      snprintf(p, p_max_size, \"%s\", begin);\n    } else {\n      NORM_ERR(STATENOTFOUND, pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n\nvoid print_pid_state_short(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  char *begin, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/status\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    begin = strstr(buf, STATE_ENTRY);\n    if (begin != nullptr) {\n      begin += strlen(STATE_ENTRY);\n      if (*begin != 0) { snprintf(p, p_max_size, \"%c\", *begin); }\n    } else {\n      NORM_ERR(STATENOTFOUND, pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n\nvoid print_pid_stderr(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/fd/2\";\n  pid_readlink(pathstream.str().c_str(), p, p_max_size);\n}\n\nvoid print_pid_stdin(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n  std::ostringstream pathstream;\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/fd/0\";\n  pid_readlink(pathstream.str().c_str(), p, p_max_size);\n}\n\nvoid print_pid_stdout(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/fd/1\";\n  pid_readlink(pathstream.str().c_str(), p, p_max_size);\n}\n\nvoid scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg,\n                             void *free_at_crash) {\n  unsigned int i;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  /* FIXME */\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  if (strlen(arg) > 0) {\n    obj->data.s = strdup(arg);\n    for (i = 0; obj->data.s[i] != 0; i++) {\n      while (obj->data.s[i] == ' ' && obj->data.s[i + 1] == ' ') {\n        memmove(obj->data.s + i, obj->data.s + i + 1,\n                strlen(obj->data.s + i + 1) + 1);\n      }\n    }\n    if (obj->data.s[i - 1] == ' ') { obj->data.s[i - 1] = 0; }\n  } else {\n    CRIT_ERR_FREE(obj, free_at_crash, \"${cmdline_to_pid commandline}\");\n  }\n}\n\nvoid print_cmdline_to_pid(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  DIR *dir;\n  struct dirent *entry;\n  char *buf;\n  int bytes_read, i;\n  std::ostringstream pathstream;\n\n  dir = opendir(PROCDIR);\n  if (dir != nullptr) {\n    while ((entry = readdir(dir)) != nullptr) {\n      bool numeric = true;\n      for (const char *ch = entry->d_name; *ch != '\\0'; ++ch) {\n        if (!std::isdigit(static_cast<unsigned char>(*ch))) {\n          numeric = false;\n          break;\n        }\n      }\n      if (!numeric) { continue; }\n\n      pathstream.str(\"\");\n      pathstream.clear();\n      pathstream << PROCDIR \"/\" << entry->d_name << \"/cmdline\";\n\n      buf = readfile(pathstream.str().c_str(), &bytes_read, 0);\n      if (buf != nullptr) {\n        for (i = 0; i < bytes_read - 1; i++) {\n          if (buf[i] == 0) { buf[i] = ' '; }\n        }\n        if (strstr(buf, obj->data.s) != nullptr) {\n          snprintf(p, p_max_size, \"%s\", entry->d_name);\n          free(buf);\n          closedir(dir);\n          return;\n        }\n        free(buf);\n      }\n    }\n    closedir(dir);\n  } else {\n    NORM_ERR(READERR, PROCDIR);\n  }\n}\n\nvoid print_pid_threads(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n#define THREADS_ENTRY \"Threads:\\t\"\n#define THREADSNOTFOUND \\\n  \"Can't find the number of the threads of the process in '%s'\"\n  char *begin, *end, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/status\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    begin = strstr(buf, THREADS_ENTRY);\n    if (begin != nullptr) {\n      begin += strlen(THREADS_ENTRY);\n      end = strchr(begin, '\\n');\n      if (end != nullptr) { *(end) = 0; }\n      snprintf(p, p_max_size, \"%s\", begin);\n    } else {\n      NORM_ERR(THREADSNOTFOUND, pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n\nvoid print_pid_thread_list(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  DIR *dir;\n  struct dirent *entry;\n  unsigned int totallength = 0;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/task\";\n\n  dir = opendir(pathstream.str().c_str());\n  if (dir != nullptr) {\n    while ((entry = readdir(dir)) != nullptr) {\n      if (entry->d_name[0] != '.') {\n        if (totallength + 1 >= p_max_size) { break; }\n        unsigned int remaining = p_max_size - totallength;\n        int written =\n            snprintf(p + totallength, remaining, \"%s,\", entry->d_name);\n        if (written < 0) { break; }\n        if (static_cast<unsigned int>(written) >= remaining) {\n          totallength = p_max_size - 1;\n          break;\n        }\n        totallength += static_cast<unsigned int>(written);\n      }\n    }\n    closedir(dir);\n    if (totallength > 0 && p[totallength - 1] == ',') {\n      p[totallength - 1] = 0;\n    }\n  } else {\n    p[0] = 0;\n  }\n}\n\nvoid print_pid_time_kernelmode(struct text_object *obj, char *p,\n                               unsigned int p_max_size) {\n  char *buf = nullptr;\n  int bytes_read;\n  unsigned long int utime = 0;\n  unsigned long int stime = 0;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  if (*(objbuf.get()) != 0) {\n    pathstream << PROCDIR \"/\" << objbuf.get() << \"/stat\";\n    buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n    if (buf != nullptr) {\n      if (parse_proc_stat_times(buf, &utime, &stime)) {\n        snprintf(p, p_max_size, \"%.2f\", static_cast<float>(stime) / 100);\n      }\n      free(buf);\n    }\n  } else {\n    NORM_ERR(\"$pid_time_kernelmode didn't receive a argument\");\n  }\n}\n\nvoid print_pid_time_usermode(struct text_object *obj, char *p,\n                             unsigned int p_max_size) {\n  char *buf = nullptr;\n  int bytes_read;\n  unsigned long int utime = 0;\n  unsigned long int stime = 0;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  if (*(objbuf.get()) != 0) {\n    pathstream << PROCDIR \"/\" << objbuf.get() << \"/stat\";\n    buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n    if (buf != nullptr) {\n      if (parse_proc_stat_times(buf, &utime, &stime)) {\n        snprintf(p, p_max_size, \"%.2f\", static_cast<float>(utime) / 100);\n      }\n      free(buf);\n    }\n  } else {\n    NORM_ERR(\"$pid_time_usermode didn't receive a argument\");\n  }\n}\n\nvoid print_pid_time(struct text_object *obj, char *p, unsigned int p_max_size) {\n  char *buf = nullptr;\n  int bytes_read;\n  unsigned long int utime = 0;\n  unsigned long int stime = 0;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  if (*(objbuf.get()) != 0) {\n    pathstream << PROCDIR \"/\" << objbuf.get() << \"/stat\";\n    buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n    if (buf != nullptr) {\n      if (parse_proc_stat_times(buf, &utime, &stime)) {\n        snprintf(p, p_max_size, \"%.2f\",\n                 static_cast<float>(utime + stime) / 100);\n      }\n      free(buf);\n    }\n  } else {\n    NORM_ERR(\"$pid_time didn't receive a argument\");\n  }\n}\n\nenum xid_type { egid, euid, fsgid, fsuid, gid, sgid, suid, uid };\n\nvoid print_pid_Xid(struct text_object *obj, char *p, int p_max_size,\n                   xid_type type) {\n  char *begin, *end, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::string errorstring;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/status\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    switch (type) {\n      case egid:\n        begin = strstr(buf, \"Gid:\\t\");\n        break;\n      case euid:\n        begin = strstr(buf, \"Uid:\\t\");\n        break;\n      case fsgid:\n        begin = strstr(buf, \"Gid:\\t\");\n        break;\n      case fsuid:\n        begin = strstr(buf, \"Uid:\\t\");\n        break;\n      case gid:\n        begin = strstr(buf, \"Gid:\\t\");\n        break;\n      case sgid:\n        begin = strstr(buf, \"Gid:\\t\");\n        break;\n      case suid:\n        begin = strstr(buf, \"Uid:\\t\");\n        break;\n      case uid:\n        begin = strstr(buf, \"Uid:\\t\");\n        break;\n      default:\n        break;\n    }\n    if (begin != nullptr) {\n      switch (type) {\n        case gid:\n          begin += strlen(\"Gid:\\t\");\n          break;\n        case uid:\n          begin += strlen(\"Uid:\\t\");\n          break;\n        case egid:\n        case euid:\n          begin = strchr(begin, '\\t');\n          begin++;\n          begin = strchr(begin, '\\t');\n          begin++;\n          break;\n        case sgid:\n        case suid:\n          begin = strchr(begin, '\\t');\n          begin++;\n          begin = strchr(begin, '\\t');\n          begin++;\n          begin = strchr(begin, '\\t');\n          begin++;\n          break;\n        case fsgid:\n        case fsuid:\n          begin = strchr(begin, '\\t');\n          begin++;\n          begin = strchr(begin, '\\t');\n          begin++;\n          begin = strchr(begin, '\\t');\n          begin++;\n          begin = strchr(begin, '\\t');\n          begin++;\n          break;\n        default:\n          break;\n      }\n      if (type == fsgid || type == fsuid) {\n        end = strchr(begin, '\\n');\n      } else {\n        end = strchr(begin, '\\t');\n      }\n      if (end != nullptr) { *(end) = 0; }\n      snprintf(p, p_max_size, \"%s\", begin);\n    } else {\n      errorstring = \"Can't find the process \";\n      switch (type) {\n        case egid:\n          errorstring.append(\"effective gid\");\n          break;\n        case euid:\n          errorstring.append(\"effective uid\");\n          break;\n        case fsgid:\n          errorstring.append(\"process file system gid\");\n          break;\n        case fsuid:\n          errorstring.append(\"process file system uid\");\n          break;\n        case gid:\n          errorstring.append(\"real gid\");\n          break;\n        case sgid:\n          errorstring.append(\"saved set gid\");\n          break;\n        case suid:\n          errorstring.append(\"saved set uid\");\n          break;\n        case uid:\n          errorstring.append(\"real uid\");\n          break;\n        default:\n          break;\n      }\n      errorstring.append(\" in '%s'\");\n      NORM_ERR(errorstring.c_str(), pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n\nvoid print_pid_egid(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, egid);\n}\n\nvoid print_pid_euid(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, euid);\n}\n\nvoid print_pid_fsgid(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, fsgid);\n}\n\nvoid print_pid_fsuid(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, fsuid);\n}\n\nvoid print_pid_gid(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, gid);\n}\n\nvoid print_pid_sgid(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, sgid);\n}\n\nvoid print_pid_suid(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, suid);\n}\n\nvoid print_pid_uid(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_pid_Xid(obj, p, p_max_size, uid);\n}\n\nvoid internal_print_pid_vm(struct text_object *obj, char *p, int p_max_size,\n                           const char *entry, const char *errorstring) {\n  char *begin, *end, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/status\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    begin = strstr(buf, entry);\n    if (begin != nullptr) {\n      begin += strlen(entry);\n      while (*begin == '\\t' || *begin == ' ') { begin++; }\n      end = strchr(begin, '\\n');\n      if (end != nullptr) { *(end) = 0; }\n      snprintf(p, p_max_size, \"%s\", begin);\n    } else {\n      NORM_ERR(errorstring, pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n\nvoid print_pid_vmpeak(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  internal_print_pid_vm(\n      obj, p, p_max_size, \"VmPeak:\\t\",\n      \"Can't find the process peak virtual memory size in '%s'\");\n}\n\nvoid print_pid_vmsize(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  internal_print_pid_vm(obj, p, p_max_size, \"VmSize:\\t\",\n                        \"Can't find the process virtual memory size in '%s'\");\n}\n\nvoid print_pid_vmlck(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  internal_print_pid_vm(obj, p, p_max_size, \"VmLck:\\t\",\n                        \"Can't find the process locked memory size in '%s'\");\n}\n\nvoid print_pid_vmhwm(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  internal_print_pid_vm(\n      obj, p, p_max_size, \"VmHWM:\\t\",\n      \"Can't find the process peak resident set size in '%s'\");\n}\n\nvoid print_pid_vmrss(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  internal_print_pid_vm(obj, p, p_max_size, \"VmRSS:\\t\",\n                        \"Can't find the process resident set size in '%s'\");\n}\n\nvoid print_pid_vmdata(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  internal_print_pid_vm(obj, p, p_max_size, \"VmData:\\t\",\n                        \"Can't find the process data segment size in '%s'\");\n}\n\nvoid print_pid_vmstk(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  internal_print_pid_vm(obj, p, p_max_size, \"VmStk:\\t\",\n                        \"Can't find the process stack segment size in '%s'\");\n}\n\nvoid print_pid_vmexe(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  internal_print_pid_vm(obj, p, p_max_size, \"VmExe:\\t\",\n                        \"Can't find the process text segment size in '%s'\");\n}\n\nvoid print_pid_vmlib(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  internal_print_pid_vm(\n      obj, p, p_max_size, \"VmLib:\\t\",\n      \"Can't find the process shared library code size in '%s'\");\n}\n\nvoid print_pid_vmpte(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  internal_print_pid_vm(\n      obj, p, p_max_size, \"VmPTE:\\t\",\n      \"Can't find the process page table entries size in '%s'\");\n}\n\n#define READ_ENTRY \"read_bytes: \"\n#define READNOTFOUND \"Can't find the amount of bytes read in '%s'\"\nvoid print_pid_read(struct text_object *obj, char *p, unsigned int p_max_size) {\n  char *begin, *end, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/io\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    begin = strstr(buf, READ_ENTRY);\n    if (begin != nullptr) {\n      end = strchr(begin, '\\n');\n      if (end != nullptr) { *(end) = 0; }\n      snprintf(p, p_max_size, \"%s\", begin);\n    } else {\n      NORM_ERR(READNOTFOUND, pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n\n#define WRITE_ENTRY \"write_bytes: \"\n#define WRITENOTFOUND \"Can't find the amount of bytes written in '%s'\"\nvoid print_pid_write(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  char *begin, *end, *buf = nullptr;\n  int bytes_read;\n  std::ostringstream pathstream;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n  pathstream << PROCDIR \"/\" << objbuf.get() << \"/io\";\n\n  buf = readfile(pathstream.str().c_str(), &bytes_read, 1);\n  if (buf != nullptr) {\n    begin = strstr(buf, WRITE_ENTRY);\n    if (begin != nullptr) {\n      end = strchr(begin, '\\n');\n      if (end != nullptr) { *(end) = 0; }\n      snprintf(p, p_max_size, \"%s\", begin);\n    } else {\n      NORM_ERR(WRITENOTFOUND, pathstream.str().c_str());\n    }\n    free(buf);\n  }\n}\n"
  },
  {
    "path": "src/data/proc.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *   (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef CONKY_PROC_H\n#define CONKY_PROC_H\n\n#define PROCDIR \"/proc\"\n#define READERR \"Can't read '%s'\"\n#define READSIZE 128\n\nvoid print_pid_chroot(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\nvoid print_pid_cmdline(struct text_object *obj, char *p,\n                       unsigned int p_max_size);\nvoid print_pid_cwd(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_environ(struct text_object *obj, char *p,\n                       unsigned int p_max_size);\nvoid print_pid_environ_list(struct text_object *obj, char *p,\n                            unsigned int p_max_size);\nvoid print_pid_exe(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_nice(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_openfiles(struct text_object *obj, char *p,\n                         unsigned int p_max_size);\nvoid print_pid_parent(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\nvoid print_pid_priority(struct text_object *obj, char *p,\n                        unsigned int p_max_size);\nvoid print_pid_state(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_state_short(struct text_object *obj, char *p,\n                           unsigned int p_max_size);\nvoid print_pid_stderr(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\nvoid print_pid_stdin(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_stdout(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\nvoid print_pid_threads(struct text_object *obj, char *p,\n                       unsigned int p_max_size);\nvoid print_pid_thread_list(struct text_object *obj, char *p,\n                           unsigned int p_max_size);\nvoid print_pid_time_kernelmode(struct text_object *obj, char *p,\n                               unsigned int p_max_size);\nvoid print_pid_time_usermode(struct text_object *obj, char *p,\n                             unsigned int p_max_size);\nvoid print_pid_time(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_uid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_euid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_suid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_fsuid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_gid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_egid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_sgid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_fsgid(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_read(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_vmpeak(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\nvoid print_pid_vmsize(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\nvoid print_pid_vmlck(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_vmhwm(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_vmrss(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_vmdata(struct text_object *obj, char *p,\n                      unsigned int p_max_size);\nvoid print_pid_vmstk(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_vmexe(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_vmlib(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_vmpte(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_pid_write(struct text_object *obj, char *p, unsigned int p_max_size);\n\nvoid scan_cmdline_to_pid_arg(struct text_object *obj, const char *arg,\n                             void *free_at_crash);\nvoid print_cmdline_to_pid(struct text_object *obj, char *p,\n                          unsigned int p_max_size);\n\n#endif /* CONKY_PROC_H */\n"
  },
  {
    "path": "src/data/tailhead.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <fcntl.h>\n#include <sys/stat.h>\n#include <unistd.h>\n#include <cctype>\n#include <cstring>\n#include <memory>\n#include \"../common.h\"\n#include \"config.h\"\n#include \"../conky.h\"\n#include \"../logging.h\"\n#include \"../content/text_object.h\"\n\n#define MAX_HEADTAIL_LINES 30\n#define DEFAULT_MAX_HEADTAIL_USES 2\n\nstruct headtail {\n  int wantedlines{0};\n  std::string logfile;\n  char *buffer{nullptr};\n  int current_use{0};\n  int max_uses{0};\n  int reported{0};\n\n  headtail() = default;\n\n  ~headtail() { free(buffer); }\n};\n\nstatic void tailstring(char *string, int endofstring, int wantedlines) {\n  int i, linescounted = 0;\n\n  string[endofstring] = 0;\n  if (endofstring > 0) {\n    if (string[endofstring - 1] ==\n        '\\n') {  // work with or without \\n at end of file\n      string[endofstring - 1] = 0;\n    }\n    for (i = endofstring - 1; i >= 0 && linescounted < wantedlines; i--) {\n      if (string[i] == '\\n') { linescounted++; }\n    }\n    if (i > 0) { strfold(string, i + 2); }\n  }\n}\n\nvoid free_tailhead(struct text_object *obj) {\n  auto *ht = static_cast<struct headtail *>(obj->data.opaque);\n  obj->data.opaque = nullptr;\n  delete ht;\n}\n\nvoid init_tailhead(const char *type, const char *arg, struct text_object *obj,\n                   void *free_at_crash) {\n  unsigned int args;\n  auto *ht = new headtail;\n\n  std::unique_ptr<char[]> tmp(new char[DEFAULT_TEXT_BUFFER_SIZE]);\n  memset(tmp.get(), 0, DEFAULT_TEXT_BUFFER_SIZE);\n\n  ht->max_uses = DEFAULT_MAX_HEADTAIL_USES;\n\n  // XXX: Buffer overflow ?\n  args = sscanf(arg, \"%s %d %d\", tmp.get(), &ht->wantedlines, &ht->max_uses);\n  if (args < 2 || args > 3) {\n    free_tailhead(obj);\n    CRIT_ERR_FREE(\n        obj, free_at_crash,\n        \"%s needs a file as 1st and a number of lines as 2nd argument\", type);\n  }\n  if (ht->max_uses < 1) {\n    free_tailhead(obj);\n    CRIT_ERR_FREE(obj, free_at_crash,\n                  \"invalid arg for %s, next_check must be larger than 0\", type);\n  }\n  if (ht->wantedlines > 0 && ht->wantedlines <= MAX_HEADTAIL_LINES) {\n    ht->logfile = to_real_path(tmp.get());\n    ht->buffer = nullptr;\n    ht->current_use = 0;\n  } else {\n    free_tailhead(obj);\n    CRIT_ERR_FREE(\n        obj, free_at_crash,\n        \"invalid arg for %s, number of lines must be between 1 and %d\", type,\n        MAX_HEADTAIL_LINES);\n  }\n  obj->data.opaque = ht;\n}\n\nstatic void print_tailhead(const char *type, struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  int fd, i, endofstring = 0, linescounted = 0;\n  FILE *fp;\n  struct stat st {};\n  auto *ht = static_cast<struct headtail *>(obj->data.opaque);\n\n  if (ht == nullptr) { return; }\n\n  // empty the buffer and reset the counter if we used it the max number of\n  // times\n  if ((ht->buffer != nullptr) && ht->current_use >= ht->max_uses - 1) {\n    free_and_zero(ht->buffer);\n    ht->current_use = 0;\n  }\n  // use the buffer if possible\n  if (ht->buffer != nullptr) {\n    strncpy(p, ht->buffer, p_max_size);\n    ht->current_use++;\n  } else {  // otherwise find the needed data\n    if (stat(ht->logfile.c_str(), &st) == 0) {\n      if (S_ISFIFO(st.st_mode)) {\n        fd = open_fifo(ht->logfile.c_str(), &ht->reported);\n        if (fd != -1) {\n          if (strcmp(type, \"head\") == 0) {\n            for (i = 0; linescounted < ht->wantedlines; i++) {\n              if (read(fd, p + i, 1) <= 0) { break; }\n              if (p[i] == '\\n') { linescounted++; }\n            }\n            p[i] = 0;\n          } else if (strcmp(type, \"tail\") == 0) {\n            i = read(fd, p, p_max_size - 1);\n            tailstring(p, i, ht->wantedlines);\n          } else {\n            CRIT_ERR(\n                \"If you are seeing this then there is a bug in the code, \"\n                \"report it !\");\n          }\n        }\n        close(fd);\n      } else {\n        fp = open_file(ht->logfile.c_str(), &ht->reported);\n        if (fp != nullptr) {\n          if (strcmp(type, \"head\") == 0) {\n            for (i = 0; i < ht->wantedlines; i++) {\n              if (fgets(p + endofstring, p_max_size - endofstring, fp) ==\n                  nullptr) {\n                break;\n              }\n              endofstring = strlen(p);\n            }\n          } else if (strcmp(type, \"tail\") == 0) {\n            fseek(fp, -static_cast<long>(p_max_size), SEEK_END);\n            i = fread(p, 1, p_max_size - 1, fp);\n            tailstring(p, i, ht->wantedlines);\n          } else {\n            CRIT_ERR(\n                \"If you are seeing this then there is a bug in the code, \"\n                \"report it !\");\n          }\n          fclose(fp);\n        }\n      }\n      ht->buffer = strdup(p);\n    } else {\n      CRIT_ERR(\"$%s can't find information about %s\", type,\n               ht->logfile.c_str());\n    }\n  }\n}\n\nvoid print_head(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_tailhead(\"head\", obj, p, p_max_size);\n}\n\nvoid print_tail(struct text_object *obj, char *p, unsigned int p_max_size) {\n  print_tailhead(\"tail\", obj, p, p_max_size);\n}\n\n/* FIXME: use something more general (see also tail.c, head.c */\n#define BUFSZ 0x1000\n\nvoid print_lines(struct text_object *obj, char *p, unsigned int p_max_size) {\n  static int rep = 0;\n  FILE *fp = open_file(obj->data.s, &rep);\n  char buf[BUFSZ];\n  int j, lines;\n\n  if (fp == nullptr) {\n    snprintf(p, p_max_size, \"%s\", \"File Unreadable\");\n    return;\n  }\n\n  lines = 0;\n  while (fgets(buf, BUFSZ, fp) != nullptr) {\n    for (j = 0; buf[j] != 0; j++) {\n      if (buf[j] == '\\n') { lines++; }\n    }\n  }\n  snprintf(p, p_max_size, \"%d\", lines);\n  fclose(fp);\n}\n\nvoid print_words(struct text_object *obj, char *p, unsigned int p_max_size) {\n  static int rep = 0;\n  FILE *fp = open_file(obj->data.s, &rep);\n  char buf[BUFSZ];\n  int j, words;\n  char inword = 0;\n\n  if (fp == nullptr) {\n    snprintf(p, p_max_size, \"%s\", \"File Unreadable\");\n    return;\n  }\n\n  words = 0;\n  while (fgets(buf, BUFSZ, fp) != nullptr) {\n    for (j = 0; buf[j] != 0; j++) {\n      if (isspace(static_cast<unsigned char>(buf[j])) == 0) {\n        if (inword == 0) {\n          words++;\n          inword = 1;\n        }\n      } else {\n        inword = 0;\n      }\n    }\n  }\n  snprintf(p, p_max_size, \"%d\", words);\n  fclose(fp);\n}\n"
  },
  {
    "path": "src/data/tailhead.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _TAILHEAD_H\n#define _TAILHEAD_H\n\nvoid free_tailhead(struct text_object *);\nvoid init_tailhead(const char *, const char *, struct text_object *, void *);\nvoid print_head(struct text_object *, char *, unsigned int);\nvoid print_tail(struct text_object *, char *, unsigned int);\n\nvoid print_lines(struct text_object *, char *, unsigned int);\nvoid print_words(struct text_object *, char *, unsigned int);\n\n#endif /* _TAILHEAD_H */\n"
  },
  {
    "path": "src/data/timeinfo.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n\n#include \"timeinfo.h\"\n\n#include <stdio.h>\n#include <cerrno>\n#include <clocale>\n#include <cstring>\n#include <ctime>\n#include \"../conky.h\"\n#include \"../logging.h\"\n#include \"../content/text_object.h\"\n\n#include <memory>\n\nstruct tztime_s {\n  char *tz;  /* timezone variable */\n  char *fmt; /* time display formatting */\n};\n\nconky::simple_config_setting<bool> times_in_seconds(\"times_in_seconds\", false,\n                                                    false);\n\nvoid scan_time(struct text_object *obj, const char *arg) {\n  obj->data.opaque =\n      strndup(arg != nullptr ? arg : \"%F %T\", text_buffer_size.get(*state));\n}\n\nvoid scan_tztime(struct text_object *obj, const char *arg) {\n  char buf1[256], buf2[256], *fmt, *tz;\n  struct tztime_s *ts;\n\n  fmt = tz = nullptr;\n  if (arg != nullptr) {\n    int nArgs = sscanf(arg, \"%255s %255[^\\n]\", buf1, buf2);\n\n    if (nArgs == 2) {\n      fmt = buf2;\n      tz = buf1;\n    } else if (nArgs == 1) {\n      tz = buf1;\n    }\n  }\n\n  ts = static_cast<tztime_s *>(malloc(sizeof(struct tztime_s)));\n  memset(ts, 0, sizeof(struct tztime_s));\n  ts->fmt =\n      strndup(fmt != nullptr ? fmt : \"%F %T\", text_buffer_size.get(*state));\n  ts->tz = tz != nullptr ? strndup(tz, text_buffer_size.get(*state)) : nullptr;\n  obj->data.opaque = ts;\n}\n\nvoid print_time(struct text_object *obj, char *p, unsigned int p_max_size) {\n  time_t t = time(nullptr);\n  struct tm *tm = localtime(&t);\n\n  setlocale(LC_TIME, \"\");\n  strftime(p, p_max_size, static_cast<char *>(obj->data.opaque), tm);\n}\n\nvoid print_utime(struct text_object *obj, char *p, unsigned int p_max_size) {\n  time_t t = time(nullptr);\n  struct tm *tm = gmtime(&t);\n\n  setlocale(LC_TIME, \"\");\n  strftime(p, p_max_size, static_cast<char *>(obj->data.opaque), tm);\n}\n\nvoid print_tztime(struct text_object *obj, char *p, unsigned int p_max_size) {\n  char *oldTZ = nullptr;\n  time_t t;\n  struct tm *tm;\n  auto *ts = static_cast<tztime_s *>(obj->data.opaque);\n\n  if (ts == nullptr) { return; }\n\n  if (ts->tz != nullptr) {\n    oldTZ = getenv(\"TZ\");\n    setenv(\"TZ\", ts->tz, 1);\n    tzset();\n  }\n  t = time(nullptr);\n  tm = localtime(&t);\n\n  setlocale(LC_TIME, \"\");\n  strftime(p, p_max_size, ts->fmt, tm);\n  if (oldTZ != nullptr) {\n    setenv(\"TZ\", oldTZ, 1);\n    tzset();\n  } else {\n    unsetenv(\"TZ\");\n  }\n  // Needless to free oldTZ since getenv gives ptr to static data\n}\n\nvoid free_time(struct text_object *obj) { free_and_zero(obj->data.opaque); }\n\nvoid free_tztime(struct text_object *obj) {\n  auto *ts = static_cast<tztime_s *>(obj->data.opaque);\n\n  if (ts == nullptr) { return; }\n\n  free_and_zero(ts->tz);\n  free_and_zero(ts->fmt);\n\n  free_and_zero(obj->data.opaque);\n}\n\n/* a safer asprintf()\n * - no need to check for errors\n * - exit conky on memory allocation failure\n * - XXX: no return value at all, otherwise this\n *        could be used globally */\n#define safe_asprintf(bufp, ...)                                   \\\n  {                                                                \\\n    int __v;                                                       \\\n    if ((__v = asprintf(bufp, __VA_ARGS__)) == -1) {               \\\n      fprintf(stderr, \"%s: memory allocation failed\\n\", __func__); \\\n      exit(__v);                                                   \\\n    }                                                              \\\n  }\n\n// all chars after the ending \" and between the seconds and the starting \" are\n// silently ignored, this is wanted behavior, not a bug, so don't \"fix\" this.\nstatic void do_format_time(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  double seconds;\n  char *currentchar, *temp;\n  unsigned int output_length = 0;\n  int minutes, hours, days, weeks;\n  char show_minutes = 0, show_hours = 0, show_days = 0, show_weeks = 0,\n       hidestring;\n\n  if (!times_in_seconds.get(*state)) {\n    NORM_ERR(\"Enable \\\"times_in_seconds\\\" to use $format_time\");\n    return;\n  }\n\n  errno = 0;\n  seconds = strtod(obj->data.s, &currentchar);\n  if (errno == 0 && obj->data.s != currentchar) {\n    while (*currentchar != 0 && *currentchar != '\"') { currentchar++; }\n    if (*currentchar != 0) {\n      currentchar++;\n      minutes = seconds / 60;\n      seconds -= minutes * 60;\n      hours = minutes / 60;\n      minutes %= 60;\n      days = hours / 24;\n      hours %= 24;\n      weeks = days / 7;\n      days %= 7;\n      for (temp = currentchar; *temp != 0 && *temp != '\"'; temp++) {\n        if (*temp == '\\\\') {\n          switch (*(temp + 1)) {\n            case '\\\\':\n              temp++;\n              break;\n            case 'w':\n              show_weeks = 1;\n              break;\n            case 'd':\n              show_days = 1;\n              break;\n            case 'h':\n              show_hours = 1;\n              break;\n            case 'm':\n              show_minutes = 1;\n              break;\n          }\n        }\n      }\n      if (show_weeks == 0) { days += weeks * 7; }\n      if (show_days == 0) { hours += days * 24; }\n      if (show_hours == 0) { minutes += hours * 60; }\n      if (show_minutes == 0) { seconds += minutes * 60; }\n      hidestring = 0;\n      while (output_length < p_max_size - 1) {\n        if (*currentchar != 0 && *currentchar != '\"') {\n          temp = nullptr;\n          if (*currentchar == '\\\\' && hidestring == 0) {\n            currentchar++;\n            switch (*currentchar) {\n              case 'w':\n                safe_asprintf(&temp, \"%d\", weeks);\n                break;\n              case 'd':\n                safe_asprintf(&temp, \"%d\", days);\n                break;\n              case 'h':\n                safe_asprintf(&temp, \"%d\", hours);\n                break;\n              case 'm':\n                safe_asprintf(&temp, \"%d\", minutes);\n                break;\n              case 's':\n                safe_asprintf(&temp, \"%d\", (int)seconds);\n                break;\n              case 'S':\n                currentchar++;\n                if (*currentchar >= '0' && *currentchar <= '9') {\n                  safe_asprintf(&temp, \"%.*f\", (*currentchar) - '0', seconds);\n                } else if (*currentchar == 'x') {\n                  if (seconds == static_cast<int>(seconds)) {\n                    safe_asprintf(&temp, \"%d\", (int)seconds);\n                  } else {\n                    safe_asprintf(&temp, \"%.9f\", seconds);\n                    while (*(temp + strlen(temp) - 1) == '0' ||\n                           *(temp + strlen(temp) - 1) == '.') {\n                      *(temp + strlen(temp) - 1) = 0;\n                    }\n                  }\n                } else {\n                  currentchar--;\n                  NORM_ERR(\n                      \"$format_time needs a digit behind 'S' to specify \"\n                      \"precision\");\n                }\n                break;\n              case '\\\\':\n              case '(':\n              case ')':\n                p[output_length] = *currentchar;\n                output_length++;\n                break;\n              default:\n                NORM_ERR(\"$format_time doesn't have a special char '%c'\",\n                         *currentchar);\n            }\n          } else if (*currentchar == '(') {\n            for (temp = currentchar + 1; *temp != 0 && *temp != ')'; temp++) {\n              if (*(temp - 1) == '\\\\') {\n                switch (*temp) {\n                  case 'w':\n                    if (weeks == 0) { hidestring = 1; }\n                    break;\n                  case 'd':\n                    if (days == 0) { hidestring = 1; }\n                    break;\n                  case 'h':\n                    if (hours == 0) { hidestring = 1; }\n                    break;\n                  case 'm':\n                    if (minutes == 0) { hidestring = 1; }\n                    break;\n                  case 's':\n                  case 'S':\n                    if (seconds == 0) { hidestring = 1; }\n                    break;\n                }\n              }\n            }\n            temp = nullptr;\n          } else if (*currentchar == ')') {\n            hidestring = 0;\n          } else if (hidestring == 0) {\n            p[output_length] = *currentchar;\n            output_length++;\n          }\n          if (temp != nullptr) {\n            if (output_length + strlen(temp) < p_max_size - 1) {\n              strncpy(p + output_length, temp,\n                      p_max_size - output_length + strlen(temp));\n              output_length += strlen(temp);\n            } else {\n              NORM_ERR(\"The format string for $format_time is too long\");\n            }\n            free(temp);\n          }\n          currentchar++;\n        } else {\n          break;\n        }\n      }\n      p[output_length] = 0;\n    } else {\n      NORM_ERR(\n          \"$format_time needs a output-format starting with a \\\"-char as 2nd \"\n          \"argument\");\n    }\n  } else {\n    NORM_ERR(\"$format_time didn't receive a time in seconds as first argument\");\n  }\n}\n\nvoid print_format_time(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  std::unique_ptr<char[]> buf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(buf.get(), max_user_text.get(*state), *obj->sub);\n  obj->data.s = buf.get();\n  do_format_time(obj, p, p_max_size);\n}\n"
  },
  {
    "path": "src/data/timeinfo.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _TIMEINFO_H\n#define _TIMEINFO_H\n\n#include \"../lua/setting.hh\"\n\nextern conky::simple_config_setting<bool> times_in_seconds;\n\n/* since time and utime are quite equal, certain functions\n * are shared in between both text object types. */\n\n/* parse args passed to *time objects */\nvoid scan_time(struct text_object *, const char *);\nvoid scan_tztime(struct text_object *, const char *);\n\n/* print the time */\nvoid print_time(struct text_object *, char *, unsigned int);\nvoid print_utime(struct text_object *, char *, unsigned int);\nvoid print_tztime(struct text_object *, char *, unsigned int);\nvoid print_format_time(struct text_object *obj, char *p,\n                       unsigned int p_max_size);\n\n/* free object data */\nvoid free_time(struct text_object *);\nvoid free_tztime(struct text_object *);\n\n#endif /* _TIMEINFO_H */\n"
  },
  {
    "path": "src/data/top.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005 Adi Zaimi, Dan Piponi <dan@tanelorn.demon.co.uk>,\n *\t\t\t\t\t  Dave Clark <clarkd@skynet.ca>\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"top.h\"\n\n#include <cstring>\n\n#include \"../logging.h\"\n#include \"../prioqueue.h\"\n\n/* hash table size - always a power of 2 */\n#define HTABSIZE 256\n\nstruct process *first_process = nullptr;\n\nunsigned long g_time = 0;\n\n/* a simple hash table to speed up find_process() */\nstruct proc_hash_entry {\n  struct proc_hash_entry *next;\n  struct process *proc;\n};\nstatic struct proc_hash_entry proc_hash_table[HTABSIZE];\n\nstatic void hash_process(struct process *p) {\n  struct proc_hash_entry *phe;\n  static char first_run = 1;\n  int bucket;\n\n  /* better make sure all next pointers are zero upon first access */\n  if (first_run != 0) {\n    memset(proc_hash_table, 0, sizeof(struct proc_hash_entry) * HTABSIZE);\n    first_run = 0;\n  }\n\n  /* get the bucket index */\n  bucket = p->pid & (HTABSIZE - 1);\n\n  /* insert a new element on bucket's top */\n  phe = static_cast<struct proc_hash_entry *>(\n      malloc(sizeof(struct proc_hash_entry)));\n  phe->proc = p;\n  phe->next = proc_hash_table[bucket].next;\n  proc_hash_table[bucket].next = phe;\n}\n\nstatic void unhash_process(struct process *p) {\n  struct proc_hash_entry *phe, *tmp;\n\n  /* get the bucket head */\n  phe = &proc_hash_table[p->pid & (HTABSIZE - 1)];\n  /* find the entry pointing to p and drop it */\n  while (phe->next != nullptr) {\n    if (phe->next->proc == p) {\n      tmp = phe->next;\n      phe->next = phe->next->next;\n      free(tmp);\n      return;\n    }\n    phe = phe->next;\n  }\n}\n\nstatic void __unhash_all_processes(struct proc_hash_entry *phe) {\n  if (phe->next != nullptr) { __unhash_all_processes(phe->next); }\n  free(phe->next);\n}\n\nstatic void unhash_all_processes() {\n  int i;\n\n  for (i = 0; i < HTABSIZE; i++) {\n    __unhash_all_processes(&proc_hash_table[i]);\n    proc_hash_table[i].next = nullptr;\n  }\n}\n\nstruct process *get_first_process() { return first_process; }\n\nvoid free_all_processes() {\n  // Before freeing all the things, we need to clear globals pointing 'em.\n  std::memset(info.cpu, 0, sizeof(info.cpu));\n  std::memset(info.memu, 0, sizeof(info.memu));\n  std::memset(info.time, 0, sizeof(info.time));\n#ifdef BUILD_IOSTATS\n  std::memset(info.io, 0, sizeof(info.io));\n#endif\n\n  struct process *next = nullptr, *pr = first_process;\n\n  while (pr != nullptr) {\n    next = pr->next;\n    free_and_zero(pr->name);\n    free_and_zero(pr->basename);\n    free(pr);\n    pr = next;\n  }\n  first_process = nullptr;\n\n  /* drop the whole hash table */\n  unhash_all_processes();\n}\n\nstruct process *get_process_by_name(std::string_view name) {\n  struct process *p = first_process;\n\n  while (p != nullptr) {\n    // Try matching against the full command line first.\n    if (p->name != nullptr && name == p->name) { return p; }\n    // If matching against full command line fails, fall back to the basename.\n    if (p->basename != nullptr && name == p->basename) { return p; }\n    p = p->next;\n  }\n\n  return nullptr;\n}\nbool is_process_running(std::string_view name) {\n  return get_process_by_name(name) != nullptr;\n}\n\nstatic struct process *find_process(pid_t pid) {\n  struct proc_hash_entry *phe;\n\n  phe = &proc_hash_table[pid & (HTABSIZE - 1)];\n  while (phe->next != nullptr) {\n    if (phe->next->proc->pid == pid) { return phe->next->proc; }\n    phe = phe->next;\n  }\n  return nullptr;\n}\n\nstatic struct process *new_process(pid_t pid) {\n  auto *p = static_cast<struct process *>(malloc(sizeof(struct process)));\n\n  /* Do stitching necessary for doubly linked list */\n  p->previous = nullptr;\n  p->next = first_process;\n  if (p->next != nullptr) { p->next->previous = p; }\n  first_process = p;\n\n  p->pid = pid;\n  p->name = nullptr;\n  p->basename = nullptr;\n  p->amount = 0;\n  p->user_time = 0;\n  p->total = 0;\n  p->kernel_time = 0;\n  p->previous_user_time = ULONG_MAX;\n  p->previous_kernel_time = ULONG_MAX;\n  p->total_cpu_time = 0;\n  p->previous_total_cpu_time = ULONG_MAX;\n  p->vsize = 0;\n  p->rss = 0;\n#ifdef BUILD_IOSTATS\n  p->read_bytes = 0;\n  p->previous_read_bytes = ULLONG_MAX;\n  p->write_bytes = 0;\n  p->previous_write_bytes = ULLONG_MAX;\n  p->io_perc = 0;\n#endif /* BUILD_IOSTATS */\n  p->time_stamp = 0;\n  p->counted = 1;\n  p->changed = 0;\n\n  /* process_find_name(p); */\n\n  /* add the process to the hash table */\n  hash_process(p);\n\n  return p;\n}\n\n/* Get / create a new process object and insert it into the process list */\nstruct process *get_process(pid_t pid) {\n  struct process *p = find_process(pid);\n  return p != nullptr ? p : new_process(pid);\n}\n\n/******************************************\n * Functions\t\t\t\t\t\t\t  *\n ******************************************/\n\n/******************************************\n * Destroy and remove a process           *\n ******************************************/\n\nstatic void delete_process(struct process *p) {\n#if defined(PARANOID)\n  assert(p->id == 0x0badfeed);\n\n  /*\n   * Ensure that deleted processes aren't reused.\n   */\n  p->id = 0x007babe;\n#endif /* defined(PARANOID) */\n\n  /*\n   * Maintain doubly linked list.\n   */\n  if (p->next != nullptr) { p->next->previous = p->previous; }\n  if (p->previous != nullptr) {\n    p->previous->next = p->next;\n  } else {\n    first_process = p->next;\n  }\n\n  free_and_zero(p->name);\n  free_and_zero(p->basename);\n  /* remove the process from the hash table */\n  unhash_process(p);\n  free(p);\n}\n\n/******************************************\n * Strip dead process entries\t\t\t  *\n ******************************************/\n\nstatic void process_cleanup() {\n  struct process *p = first_process;\n\n  while (p != nullptr) {\n    struct process *current = p;\n\n#if defined(PARANOID)\n    assert(p->id == 0x0badfeed);\n#endif /* defined(PARANOID) */\n\n    p = p->next;\n    /* Delete processes that have died */\n    if (current->time_stamp != g_time) {\n      delete_process(current);\n      if (current == first_process) { first_process = nullptr; }\n      current = nullptr;\n    }\n  }\n}\n\n/******************************************\n * Find the top processes\t\t\t\t  *\n ******************************************/\n\n/* cpu comparison function for prio queue */\nstatic int compare_cpu(void *va, void *vb) {\n  auto *a = static_cast<struct process *>(va),\n       *b = static_cast<struct process *>(vb);\n\n  if (b->amount > a->amount) { return 1; }\n  if (a->amount > b->amount) { return -1; }\n  return 0;\n}\n\n/* mem comparison function for prio queue */\nstatic int compare_mem(void *va, void *vb) {\n  auto *a = static_cast<struct process *>(va),\n       *b = static_cast<struct process *>(vb);\n\n  if (b->rss > a->rss) { return 1; }\n  if (a->rss > b->rss) { return -1; }\n  return 0;\n}\n\n/* CPU time comparison function for prio queue */\nstatic int compare_time(void *va, void *vb) {\n  auto *a = static_cast<struct process *>(va),\n       *b = static_cast<struct process *>(vb);\n\n  if (b->total_cpu_time > a->total_cpu_time) { return 1; }\n  if (b->total_cpu_time < a->total_cpu_time) { return -1; }\n  return 0;\n}\n\n#ifdef BUILD_IOSTATS\n/* I/O comparison function for prio queue */\nstatic int compare_io(void *va, void *vb) {\n  auto *a = static_cast<struct process *>(va),\n       *b = static_cast<struct process *>(vb);\n\n  if (b->io_perc > a->io_perc) { return 1; }\n  if (a->io_perc > b->io_perc) { return -1; }\n  return 0;\n}\n#endif /* BUILD_IOSTATS */\n\n/* ****************************************************************** *\n * Get a sorted list of the top cpu hogs and top mem hogs. * Results are stored\n * in the cpu,mem arrays in decreasing order[0-9]. *\n * ****************************************************************** */\n\nstatic void process_find_top(struct process **cpu, struct process **mem,\n                             struct process **ptime\n#ifdef BUILD_IOSTATS\n                             ,\n                             struct process **io\n#endif /* BUILD_IOSTATS */\n) {\n  prio_queue_t cpu_queue, mem_queue, time_queue;\n#ifdef BUILD_IOSTATS\n  prio_queue_t io_queue;\n#endif\n  struct process *cur_proc = nullptr;\n  int i;\n\n  if ((top_cpu == 0) && (top_mem == 0) && (top_time == 0)\n#ifdef BUILD_IOSTATS\n      && (top_io == 0)\n#endif /* BUILD_IOSTATS */\n      && (top_running == 0)) {\n    return;\n  }\n\n  cpu_queue = init_prio_queue();\n  pq_set_compare(cpu_queue, &compare_cpu);\n  pq_set_max_size(cpu_queue, MAX_SP);\n\n  mem_queue = init_prio_queue();\n  pq_set_compare(mem_queue, &compare_mem);\n  pq_set_max_size(mem_queue, MAX_SP);\n\n  time_queue = init_prio_queue();\n  pq_set_compare(time_queue, &compare_time);\n  pq_set_max_size(time_queue, MAX_SP);\n\n#ifdef BUILD_IOSTATS\n  io_queue = init_prio_queue();\n  pq_set_compare(io_queue, &compare_io);\n  pq_set_max_size(io_queue, MAX_SP);\n#endif\n\n  /* g_time is the time_stamp entry for process.  It is updated when the\n   * process information is updated to indicate that the process is still\n   * alive (and must not be removed from the process list in\n   * process_cleanup()) */\n  ++g_time;\n\n  /* OS-specific function updating process list */\n  get_top_info();\n\n  process_cleanup(); /* cleanup list from exited processes */\n\n  cur_proc = first_process;\n\n  while (cur_proc != nullptr) {\n    if (top_cpu != 0) { insert_prio_elem(cpu_queue, cur_proc); }\n    if (top_mem != 0) { insert_prio_elem(mem_queue, cur_proc); }\n    if (top_time != 0) { insert_prio_elem(time_queue, cur_proc); }\n#ifdef BUILD_IOSTATS\n    if (top_io != 0) { insert_prio_elem(io_queue, cur_proc); }\n#endif /* BUILD_IOSTATS */\n    cur_proc = cur_proc->next;\n  }\n\n  for (i = 0; i < MAX_SP; i++) {\n    if (top_cpu != 0) {\n      cpu[i] = static_cast<process *>(pop_prio_elem(cpu_queue));\n    }\n    if (top_mem != 0) {\n      mem[i] = static_cast<process *>(pop_prio_elem(mem_queue));\n    }\n    if (top_time != 0) {\n      ptime[i] = static_cast<process *>(pop_prio_elem(time_queue));\n    }\n#ifdef BUILD_IOSTATS\n    if (top_io != 0) {\n      io[i] = static_cast<process *>(pop_prio_elem(io_queue));\n    }\n#endif /* BUILD_IOSTATS */\n  }\n  free_prio_queue(cpu_queue);\n  free_prio_queue(mem_queue);\n  free_prio_queue(time_queue);\n#ifdef BUILD_IOSTATS\n  free_prio_queue(io_queue);\n#endif /* BUILD_IOSTATS */\n}\n\nint update_top() {\n  // if nothing else has ever set up info, we need to update it here, because\n  // info.memmax is used to print percentages in `print_top_mem`\n  if (info.memmax == 0) { update_meminfo(); }\n  process_find_top(info.cpu, info.memu, info.time\n#ifdef BUILD_IOSTATS\n                   ,\n                   info.io\n#endif\n  );\n  info.first_process = get_first_process();\n  return 0;\n}\n\nstatic char *format_time(unsigned long timeval, const int width) {\n  char buf[10];\n  unsigned long nt;  // narrow time, for speed on 32-bit\n  unsigned cc;       // centiseconds\n  unsigned nn;       // multi-purpose whatever\n\n  nt = timeval;\n  cc = nt % 100;  // centiseconds past second\n  nt /= 100;      // total seconds\n  nn = nt % 60;   // seconds past the minute\n  nt /= 60;       // total minutes\n  if (width >= snprintf(buf, sizeof buf, \"%lu:%02u.%02u\", nt, nn, cc)) {\n    return strndup(buf, text_buffer_size.get(*state));\n  }\n  if (width >= snprintf(buf, sizeof buf, \"%lu:%02u\", nt, nn)) {\n    return strndup(buf, text_buffer_size.get(*state));\n  }\n  nn = nt % 60;  // minutes past the hour\n  nt /= 60;      // total hours\n  if (width >= snprintf(buf, sizeof buf, \"%lu,%02u\", nt, nn)) {\n    return strndup(buf, text_buffer_size.get(*state));\n  }\n  nn = nt;  // now also hours\n  if (width >= snprintf(buf, sizeof buf, \"%uh\", nn)) {\n    return strndup(buf, text_buffer_size.get(*state));\n  }\n  nn /= 24;  // now days\n  if (width >= snprintf(buf, sizeof buf, \"%ud\", nn)) {\n    return strndup(buf, text_buffer_size.get(*state));\n  }\n  nn /= 7;  // now weeks\n  if (width >= snprintf(buf, sizeof buf, \"%uw\", nn)) {\n    return strndup(buf, text_buffer_size.get(*state));\n  }\n  // well shoot, this outta' fit...\n  return strndup(\"<inf>\", text_buffer_size.get(*state));\n}\n\nstruct top_data {\n  struct process **list;\n  int num;\n  int was_parsed;\n  char *s;\n};\n\nstatic conky::range_config_setting<unsigned int> top_name_width(\n    \"top_name_width\", 0, std::numeric_limits<unsigned int>::max(), 15, true);\nstatic conky::simple_config_setting<bool> top_name_verbose(\"top_name_verbose\",\n                                                           false, true);\n\nstatic void print_top_name(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  auto *td = static_cast<struct top_data *>(obj->data.opaque);\n  int width;\n\n  if ((td == nullptr) || (td->list == nullptr) ||\n      (td->list[td->num] == nullptr)) {\n    return;\n  }\n\n  width = std::min(p_max_size,\n                   static_cast<unsigned int>(top_name_width.get(*state)) + 1);\n  if (top_name_verbose.get(*state)) {\n    /* print the full command line */\n    snprintf(p, width + 1, \"%-*s\", width, td->list[td->num]->name);\n  } else {\n    /* print only the basename (i.e. executable name) */\n    snprintf(p, width + 1, \"%-*s\", width, td->list[td->num]->basename);\n  }\n}\n\nstatic void print_top_mem(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  auto *td = static_cast<struct top_data *>(obj->data.opaque);\n  int width;\n\n  if ((td == nullptr) || (td->list == nullptr) ||\n      (td->list[td->num] == nullptr)) {\n    return;\n  }\n\n  width = std::min(p_max_size, static_cast<unsigned int>(7));\n  snprintf(p, width, \"%6.2f\",\n           (static_cast<float>(td->list[td->num]->rss) / info.memmax) / 10);\n}\n\nstatic void print_top_time(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  auto *td = static_cast<struct top_data *>(obj->data.opaque);\n  int width;\n  char *timeval;\n\n  if ((td == nullptr) || (td->list == nullptr) ||\n      (td->list[td->num] == nullptr)) {\n    return;\n  }\n\n  width = std::min(p_max_size, static_cast<unsigned int>(10));\n  timeval = format_time(td->list[td->num]->total_cpu_time, 9);\n  snprintf(p, width, \"%9s\", timeval);\n  free(timeval);\n}\n\nstatic void print_top_user(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  auto *td = static_cast<struct top_data *>(obj->data.opaque);\n  struct passwd *pw;\n\n  if ((td == nullptr) || (td->list == nullptr) ||\n      (td->list[td->num] == nullptr)) {\n    return;\n  }\n\n  pw = getpwuid(td->list[td->num]->uid);\n  if (pw != nullptr) {\n    snprintf(p, p_max_size, \"%.8s\", pw->pw_name);\n  } else {\n    snprintf(p, p_max_size, \"%d\", td->list[td->num]->uid);\n  }\n}\n\n#define PRINT_TOP_GENERATOR(name, width, fmt, field)                         \\\n  static void print_top_##name(struct text_object *obj, char *p,             \\\n                               unsigned int p_max_size) {                    \\\n    struct top_data *td = (struct top_data *)obj->data.opaque;               \\\n    if (!td || !td->list || !td->list[td->num]) return;                      \\\n    snprintf(p, std::min(p_max_size, width), fmt, td->list[td->num]->field); \\\n  }\n\n#define PRINT_TOP_HR_GENERATOR(name, field, denom)                     \\\n  static void print_top_##name(struct text_object *obj, char *p,       \\\n                               unsigned int p_max_size) {              \\\n    struct top_data *td = (struct top_data *)obj->data.opaque;         \\\n    if (!td || !td->list || !td->list[td->num]) return;                \\\n    human_readable(td->list[td->num]->field / (denom), p, p_max_size); \\\n  }\n\nPRINT_TOP_GENERATOR(cpu, (unsigned int)7, \"%6.2f\", amount)\nPRINT_TOP_GENERATOR(pid, (unsigned int)8, \"%7i\", pid)\nPRINT_TOP_GENERATOR(uid, (unsigned int)6, \"%5i\", uid)\nPRINT_TOP_HR_GENERATOR(mem_res, rss, 1)\nPRINT_TOP_HR_GENERATOR(mem_vsize, vsize, 1)\n#ifdef BUILD_IOSTATS\nPRINT_TOP_HR_GENERATOR(read_bytes, read_bytes, active_update_interval())\nPRINT_TOP_HR_GENERATOR(write_bytes, write_bytes, active_update_interval())\nPRINT_TOP_GENERATOR(io_perc, (unsigned int)7, \"%6.2f\", io_perc)\n#endif /* BUILD_IOSTATS */\n\nstatic void free_top(struct text_object *obj) {\n  auto *td = static_cast<struct top_data *>(obj->data.opaque);\n\n  if (td == nullptr) { return; }\n  free_and_zero(td->s);\n  free_and_zero(obj->data.opaque);\n}\n\nint parse_top_args(const char *s, const char *arg, struct text_object *obj) {\n  struct top_data *td;\n  char buf[64];\n  int n;\n\n  if (arg == nullptr) {\n    NORM_ERR(\"top needs arguments\");\n    return 0;\n  }\n\n  obj->data.opaque = td =\n      static_cast<struct top_data *>(malloc(sizeof(struct top_data)));\n  memset(td, 0, sizeof(struct top_data));\n\n  if (s[3] == 0) {\n    td->list = info.cpu;\n    top_cpu = 1;\n  } else if (strcmp(&s[3], \"_mem\") == EQUAL) {\n    td->list = info.memu;\n    top_mem = 1;\n  } else if (strcmp(&s[3], \"_time\") == EQUAL) {\n    td->list = info.time;\n    top_time = 1;\n#ifdef BUILD_IOSTATS\n  } else if (strcmp(&s[3], \"_io\") == EQUAL) {\n    td->list = info.io;\n    top_io = 1;\n#endif /* BUILD_IOSTATS */\n  } else {\n#ifdef BUILD_IOSTATS\n    NORM_ERR(\"Must be top, top_mem, top_time or top_io\");\n#else  /* BUILD_IOSTATS */\n    NORM_ERR(\"Must be top, top_mem or top_time\");\n#endif /* BUILD_IOSTATS */\n    free_and_zero(obj->data.opaque);\n    return 0;\n  }\n\n  td->s = strndup(arg, text_buffer_size.get(*state));\n\n  if (sscanf(arg, \"%63s %i\", buf, &n) == 2) {\n    if (strcmp(buf, \"name\") == EQUAL) {\n      obj->callbacks.print = &print_top_name;\n    } else if (strcmp(buf, \"cpu\") == EQUAL) {\n      obj->callbacks.print = &print_top_cpu;\n    } else if (strcmp(buf, \"pid\") == EQUAL) {\n      obj->callbacks.print = &print_top_pid;\n    } else if (strcmp(buf, \"mem\") == EQUAL) {\n      obj->callbacks.print = &print_top_mem;\n    } else if (strcmp(buf, \"time\") == EQUAL) {\n      obj->callbacks.print = &print_top_time;\n    } else if (strcmp(buf, \"mem_res\") == EQUAL) {\n      obj->callbacks.print = &print_top_mem_res;\n    } else if (strcmp(buf, \"mem_vsize\") == EQUAL) {\n      obj->callbacks.print = &print_top_mem_vsize;\n    } else if (strcmp(buf, \"uid\") == EQUAL) {\n      obj->callbacks.print = &print_top_uid;\n    } else if (strcmp(buf, \"user\") == EQUAL) {\n      obj->callbacks.print = &print_top_user;\n#ifdef BUILD_IOSTATS\n    } else if (strcmp(buf, \"io_read\") == EQUAL) {\n      obj->callbacks.print = &print_top_read_bytes;\n    } else if (strcmp(buf, \"io_write\") == EQUAL) {\n      obj->callbacks.print = &print_top_write_bytes;\n    } else if (strcmp(buf, \"io_perc\") == EQUAL) {\n      obj->callbacks.print = &print_top_io_perc;\n#endif /* BUILD_IOSTATS */\n    } else {\n      NORM_ERR(\"invalid type arg for top\");\n#ifdef BUILD_IOSTATS\n      NORM_ERR(\n          \"must be one of: name, cpu, pid, mem, time, mem_res, mem_vsize, \"\n          \"io_read, io_write, io_perc\");\n#else  /* BUILD_IOSTATS */\n      NORM_ERR(\"must be one of: name, cpu, pid, mem, time, mem_res, mem_vsize\");\n#endif /* BUILD_IOSTATS */\n      free_and_zero(td->s);\n      free_and_zero(obj->data.opaque);\n      return 0;\n    }\n    if (n < 1 || n > MAX_SP) {\n      NORM_ERR(\"invalid num arg for top. Must be between 1 and %d.\", MAX_SP);\n      free_and_zero(td->s);\n      free_and_zero(obj->data.opaque);\n      return 0;\n    }\n    td->num = n - 1;\n\n  } else {\n    NORM_ERR(\"invalid argument count for top\");\n    free_and_zero(td->s);\n    free_and_zero(obj->data.opaque);\n    return 0;\n  }\n  obj->callbacks.free = &free_top;\n  return 1;\n}\n"
  },
  {
    "path": "src/data/top.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005 Adi Zaimi, Dan Piponi <dan@tanelorn.demon.co.uk>,\n *\t\t\t\t\t  Dave Clark <clarkd@skynet.ca>\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _top_h_\n#define _top_h_\n\n/* Ensure there's an operating system defined.\n * compile with gcc -DOS ...\n * There is *no* default because every OS has it's own way of revealing\n * CPU/memory usage. */\n\n/******************************************\n * Includes\t\t\t\t\t\t\t\t  *\n ******************************************/\n\n#include \"../conky.h\"\n#include \"../content/text_object.h\"\n\n#define CPU_THRESHHOLD 0 /* threshold for the cpu diff to appear */\n\n#include <string_view>\n\n#include <assert.h>\n#include <ctype.h>\n#include <dirent.h>\n#include <errno.h>\n#include <fcntl.h>\n#include <limits.h>\n#include <math.h>\n#include <signal.h>\n#include <string.h>\n#include <time.h>\n#include <unistd.h>\n\n#include <sys/ioctl.h>\n#include <sys/param.h>\n#include <sys/stat.h>\n#include <sys/time.h>\n#include <sys/types.h>\n#include <sys/wait.h>\n\n#include <pwd.h>\n#include <regex.h>\n\n/******************************************\n * Defines\t\t\t\t\t\t\t\t  *\n ******************************************/\n\n/* XXX: I shouldn't really use this BUFFER_LEN variable but scanf is so lame\n * and it'll take me a while to write a replacement. */\n#define BUFFER_LEN 1024\n\n#define MAX_SP 10  // number of elements to sort\n\n/******************************************\n * Process class\t\t\t\t\t\t  *\n ******************************************/\n\nstruct process {\n  struct process *next;\n  struct process *previous;\n\n  pid_t pid;\n  char *name;\n  char *basename;\n  uid_t uid;\n  float amount;\n  // User and kernel times are in hundredths of seconds\n  unsigned long user_time;\n  unsigned long total;\n  unsigned long kernel_time;\n  unsigned long previous_user_time;\n  unsigned long previous_kernel_time;\n  unsigned long total_cpu_time;\n  unsigned long previous_total_cpu_time;\n  unsigned long long vsize;\n  unsigned long long rss;\n#ifdef BUILD_IOSTATS\n  unsigned long long read_bytes;\n  unsigned long long previous_read_bytes;\n  unsigned long long write_bytes;\n  unsigned long long previous_write_bytes;\n  float io_perc;\n#endif\n  unsigned int time_stamp;\n  unsigned int counted;\n  unsigned int changed;\n};\n\nstruct sorted_process {\n  struct sorted_process *greater;\n  struct sorted_process *less;\n  struct process *proc;\n};\n\n/**\n * @brief Returns process information for specified `name`.\n * \n * @param name full command line or base name of the process.\n * @return struct process* containing usage details of a process. \n */\nstruct process *get_process_by_name(std::string_view name);\n/**\n * @brief Checks if a process is running.\n *\n * @param name full command line or base name of the process.\n * @return `true` if process with given command line or base name is currently\n *         running, `false` otherwise.\n */\nbool is_process_running(std::string_view name);\n\nint parse_top_args(const char *s, const char *arg, struct text_object *obj);\n\nint update_top(void);\n\nvoid get_top_info(void);\n\nextern struct process *first_process;\nextern unsigned long g_time;\n\nstruct process *get_process(pid_t pid);\n\n#endif /* _top_h_ */\n"
  },
  {
    "path": "src/data/user.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *   (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include <grp.h>\n#include <pwd.h>\n#include <cerrno>\n#include <memory>\n#include \"../conky.h\"\n#include \"../logging.h\"\n\nvoid print_uid_name(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct passwd *pw;\n  uid_t uid;\n  char *firstinvalid;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  errno = 0;\n  uid = strtol(objbuf.get(), &firstinvalid, 10);\n  if (errno == 0 && objbuf.get() != firstinvalid) {\n    pw = getpwuid(uid);\n    if (pw != nullptr) {\n      snprintf(p, p_max_size, \"%s\", pw->pw_name);\n    } else {\n      NORM_ERR(\"The uid %d doesn't exist\", uid);\n    }\n  } else {\n    NORM_ERR(\"$uid_name didn't receive a uid as argument\");\n  }\n}\n\nvoid print_gid_name(struct text_object *obj, char *p, unsigned int p_max_size) {\n  struct group *grp;\n  gid_t gid;\n  char *firstinvalid;\n  std::unique_ptr<char[]> objbuf(new char[max_user_text.get(*state)]);\n\n  generate_text_internal(objbuf.get(), max_user_text.get(*state), *obj->sub);\n\n  errno = 0;\n  gid = strtol(objbuf.get(), &firstinvalid, 10);\n  if (errno == 0 && objbuf.get() != firstinvalid) {\n    grp = getgrgid(gid);\n    if (grp != nullptr) {\n      snprintf(p, p_max_size, \"%s\", grp->gr_name);\n    } else {\n      NORM_ERR(\"The gid %d doesn't exist\", gid);\n    }\n  } else {\n    NORM_ERR(\"$gid_name didn't receive a gid as argument\");\n  }\n}\n"
  },
  {
    "path": "src/data/user.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *   (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _USER_H\n#define _USER_H\n\nvoid print_gid_name(struct text_object *obj, char *p, unsigned int p_max_size);\nvoid print_uid_name(struct text_object *obj, char *p, unsigned int p_max_size);\n\n#endif /* _USER_H */\n"
  },
  {
    "path": "src/data/users.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <time.h>\n#include <unistd.h>\n#include <utmp.h>\n#include \"../conky.h\"\n\n#define BUFLEN 512\n\nstatic void user_name(char *ptr) {\n  const struct utmp *usr = 0;\n\n  setutent();\n  while ((usr = getutent()) != nullptr) {\n    if (usr->ut_type == USER_PROCESS) {\n      memcpy(ptr, usr->ut_name, UT_NAMESIZE);\n      ptr[UT_NAMESIZE] = 0;\n    }\n  }\n}\nstatic void user_num(int *ptr) {\n  const struct utmp *usr;\n  int users_num = 0;\n\n  setutent();\n  while ((usr = getutent()) != nullptr) {\n    if (usr->ut_type == USER_PROCESS) { ++users_num; }\n  }\n  *ptr = users_num;\n}\nstatic void user_term(char *ptr) {\n  const struct utmp *usr;\n\n  setutent();\n  while ((usr = getutent()) != nullptr) {\n    if (usr->ut_type == USER_PROCESS) {\n      memcpy(ptr, usr->ut_line, UT_LINESIZE);\n      ptr[UT_LINESIZE] = 0;\n    }\n  }\n}\nstatic void user_time(char *ptr) {\n  const struct utmp *usr;\n  time_t log_in, real, diff;\n  char buf[BUFLEN] = \"\";\n\n  setutent();\n  while ((usr = getutent()) != nullptr) {\n    if (usr->ut_type == USER_PROCESS) {\n      log_in = usr->ut_time;\n      time(&real);\n      diff = difftime(real, log_in);\n      format_seconds(buf, BUFLEN, diff);\n      if (strlen(ptr) + strlen(buf) + 1 <= BUFLEN) {\n        strncat(ptr, buf, BUFLEN - strlen(ptr) - 1);\n      }\n    }\n  }\n}\nstatic void tty_user_time(char *ptr, char *tty) {\n  time_t real, diff, log_in;\n  char buf[BUFLEN] = \"\";\n\n  struct utmp *usr, line;\n\n  setutent();\n  strncpy(line.ut_line, tty, UT_LINESIZE);\n  usr = getutline(&line);\n  if (usr == nullptr) { return; }\n\n  log_in = usr->ut_time;\n\n  time(&real);\n  diff = difftime(real, log_in);\n  format_seconds(buf, BUFLEN, diff);\n  strncpy(ptr, buf, BUFLEN - 1);\n}\n\nstatic void users_alloc(struct information *ptr) {\n  if (ptr->users.names == nullptr) {\n    ptr->users.names = (char *)malloc(text_buffer_size.get(*state));\n  }\n  if (ptr->users.terms == nullptr) {\n    ptr->users.terms = (char *)malloc(text_buffer_size.get(*state));\n  }\n  if (ptr->users.times == nullptr) {\n    ptr->users.times = (char *)malloc(text_buffer_size.get(*state));\n  }\n}\n\nstatic void update_user_time(char *tty) {\n  struct information *current_info = &info;\n  char temp[BUFLEN] = \"\";\n\n  if (current_info->users.ctime == nullptr) {\n    current_info->users.ctime = (char *)malloc(text_buffer_size.get(*state));\n  }\n\n  tty_user_time(temp, tty);\n\n  if (*temp != 0) {\n    free_and_zero(current_info->users.ctime);\n    current_info->users.ctime = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.ctime, temp, text_buffer_size.get(*state));\n  } else {\n    free_and_zero(current_info->users.ctime);\n    current_info->users.ctime = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.ctime, \"broken\", text_buffer_size.get(*state));\n  }\n}\n\nint update_users(void) {\n  struct information *current_info = &info;\n  char temp[BUFLEN] = \"\";\n  int t;\n  users_alloc(current_info);\n  user_name(temp);\n  if (*temp != 0) {\n    free_and_zero(current_info->users.names);\n    current_info->users.names = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.names, temp, text_buffer_size.get(*state));\n  } else {\n    free_and_zero(current_info->users.names);\n    current_info->users.names = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.names, \"broken\", text_buffer_size.get(*state));\n  }\n  user_num(&t);\n  if (t != 0) {\n    if (current_info->users.number) { current_info->users.number = 0; }\n    current_info->users.number = t;\n  } else {\n    current_info->users.number = 0;\n  }\n  temp[0] = 0;\n  user_term(temp);\n  if (*temp != 0) {\n    free_and_zero(current_info->users.terms);\n    current_info->users.terms = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.terms, temp, text_buffer_size.get(*state));\n  } else {\n    free_and_zero(current_info->users.terms);\n    current_info->users.terms = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.terms, \"broken\", text_buffer_size.get(*state));\n  }\n  user_time(temp);\n  if (*temp != 0) {\n    free_and_zero(current_info->users.times);\n    current_info->users.times = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.times, temp, text_buffer_size.get(*state));\n  } else {\n    free_and_zero(current_info->users.times);\n    current_info->users.times = (char *)malloc(text_buffer_size.get(*state));\n    strncpy(current_info->users.times, \"broken\", text_buffer_size.get(*state));\n  }\n  return 0;\n}\n\nvoid print_user_names(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.users.names);\n}\n\nvoid print_user_terms(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.users.terms);\n}\n\nvoid print_user_times(struct text_object *obj, char *p,\n                      unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%s\", info.users.times);\n}\n\nvoid print_user_time(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  update_user_time(obj->data.s);\n  snprintf(p, p_max_size, \"%s\", info.users.ctime);\n}\n\nvoid print_user_number(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  (void)obj;\n  snprintf(p, p_max_size, \"%d\", info.users.number);\n}\n\nvoid free_user_names(struct text_object *obj) {\n  (void)obj;\n  free_and_zero(info.users.names);\n}\n\nvoid free_user_terms(struct text_object *obj) {\n  (void)obj;\n  free_and_zero(info.users.terms);\n}\n\nvoid free_user_times(struct text_object *obj) {\n  (void)obj;\n  free_and_zero(info.users.times);\n}\n\nvoid free_user_time(struct text_object *obj) {\n  free_and_zero(info.users.ctime);\n  free_and_zero(obj->data.s);\n}\n"
  },
  {
    "path": "src/data/users.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _USERS_H\n#define _USERS_H\n\nint update_users(void);\n\nvoid print_user_names(struct text_object *, char *, unsigned int);\nvoid print_user_terms(struct text_object *, char *, unsigned int);\nvoid print_user_times(struct text_object *, char *, unsigned int);\nvoid print_user_time(struct text_object *, char *, unsigned int);\nvoid print_user_number(struct text_object *, char *, unsigned int);\n\nvoid free_user_names(struct text_object *);\nvoid free_user_terms(struct text_object *);\nvoid free_user_times(struct text_object *);\nvoid free_user_time(struct text_object *);\n\n#endif /* _USERS_H */\n"
  },
  {
    "path": "src/geometry.h",
    "content": "#ifndef _CONKY_GEOMETRY_H_\n#define _CONKY_GEOMETRY_H_\n\n#include \"config.h\"\n\n#include \"macros.h\"\n\n#include <algorithm>\n#include <array>\n#include <cmath>\n#include <cstddef>\n#include <cstdint>\n#include <cstdlib>\n#include <limits>\n#include <numeric>\n#include <type_traits>\n\n#include <Vc/Vc>\n\n#ifdef BUILD_X11\n#include <X11/Xlib.h>\n#endif /* BUILD_X11 */\n\nnamespace conky {\nnamespace _priv_geom {\n/// @brief Constructs an index assignable type from an array with different\n/// value types using `static_cast`.\n///\n/// Panics at runtime if `O` can be indexed by every value in range `0` to\n/// (excluding) `Length`.\n///\n/// @tparam Input source array element\n/// @tparam R target element type\n/// @tparam Output target container\n/// @tparam Length array length\n/// @param value array to pad/trim\n/// @return casted array\ntemplate <typename Input, typename R, size_t Length, typename Output>\ninline Output cast_to_assignable(const Input &value, Output &target) {\n  if constexpr (std::is_same_v<Input, Output>) { return value; }\n  for (size_t i = 0; i < Length; i++) {\n    target[i] = static_cast<R>(value.at(i));\n  }\n  return target;\n}\n\n/// @brief Constructs a casted array from an array with different value types\n/// using `static_cast`.\n///\n/// @tparam T source array element\n/// @tparam R target array element\n/// @tparam Length array length\n/// @param value array to pad/trim\n/// @return casted array\ntemplate <typename T, typename R, size_t Length>\ninline std::array<R, Length> cast_array(const std::array<T, Length> &value) {\n  static_assert(std::is_convertible_v<T, R>, \"T is not convertible to R\");\n  if constexpr (std::is_same_v<T, R>) { return value; }\n  std::array<R, Length> result;\n  cast_to_assignable<std::array<T, Length>, R, Length, std::array<R, Length>>(\n      value, result);\n  return result;\n}\n\n/// @brief Takes an array and pads/trims it to the desired length by inserting\n/// zeros or discarding unwanted elements\n/// @tparam T array element\n/// @tparam Source source array length\n/// @tparam Target target array length\n/// @param value array to pad/trim\n/// @return padded/trimmed array\ntemplate <typename T, size_t Source, size_t Target>\ninline std::array<T, Target> resize_array(std::array<T, Source> value) {\n  if constexpr (Source == Target) { return value; }\n  auto buff = std::array<T, Target>{0};\n  std::copy_n(value.begin(), std::min(Source, Target), buff.begin());\n  return buff;\n}\n}  // namespace _priv_geom\n\n/// @brief A 2D vector representation.\n///\n/// Uses eigen under to hood to provide SIMD optimizations on appropriate\n/// platforms if available. Doesn't expose any of the eigen functionality\n/// directly to avoid pollution.\n///\n/// @tparam T numeric component type.\ntemplate <typename T, size_t Length>\nstruct vec {\n  static_assert(std::is_arithmetic_v<T>, \"T must be a number\");\n  static_assert(Length >= 2, \"Length must be greater than 2\");\n\n  /// @brief Compile time component type information.\n  using Component = T;\n\n private:\n  /// Sealed type used to disable constructor selection.\n  class _disabled {};\n\n protected:\n  using Data = Vc::array<T, Length>;\n\n  Data value;\n\n public:\n  vec() : value(Data{0}) {}\n  vec(const Data &value) : value(value) {}\n  vec(std::array<T, Length> array) {\n    _priv_geom::cast_to_assignable<std::array<T, Length>, T, Length,\n                                   Vc::array<T, Length>>(array, this->value);\n  }\n\n  vec(const vec<T, Length> &other) : vec(other.value) {}\n\n  vec(T x, T y) : vec<T, 2>(std::array<T, 2>{x, y}) {\n    static_assert(Length == 2, \"constructor only valid for vec2<T>\");\n  }\n  vec(T x, T y, T z) : vec<T, 3>(std::array<T, 3>{x, y, z, 0}) {\n    static_assert(Length == 3, \"constructor only valid for vec3<T>\");\n  }\n  vec(T x, T y, T z, T w) : vec<T, 4>(std::array<T, 4>{x, y, z, w}) {\n    static_assert(Length == 4, \"constructor only valid for vec4<T>\");\n  }\n\n  vec(vec<T, Length> &&other) = default;\n\n  static inline vec<T, Length> uniform(T v) {\n    std::array<T, Length> data;\n    data.fill(v);\n    return vec<T, Length>(data);\n  }\n\n  /// @brief Returns vec component at `index`.\n  /// @param index component index.\n  /// @return component at `index` of this vec.\n  T at(size_t index) const { return static_cast<T>(this->value[index]); }\n\n  /// @brief vec x component.\n  /// @return x value of this vec.\n  inline T x() const { return this->at(0); }\n  /// @brief vec y component.\n  /// @return y value of this vec.\n  inline T y() const { return this->at(1); }\n  /// @brief vec z component.\n  /// @return z value of this vec.\n  inline T z() const {\n    static_assert(Length >= 3, \"vector doesn't have a z component\");\n    return this->at(2);\n  }\n  /// @brief vec w component.\n  /// @return w value of this vec.\n  inline T w() const {\n    static_assert(Length >= 4, \"vector doesn't have a w component\");\n    return this->at(3);\n  }\n\n  void set(size_t index, T value) { this->value[index] = value; }\n\n  inline void set_x(T new_value) { this->set(0, new_value); }\n  inline void set_y(T new_value) { this->set(1, new_value); }\n  inline void set_z(T new_value) {\n    static_assert(Length >= 3, \"vector doesn't have a z component\");\n    this->set(2, new_value);\n  }\n  inline void set_w(T new_value) {\n    static_assert(Length >= 4, \"vector doesn't have a w component\");\n    this->set(3, new_value);\n  }\n\n  vec<T, Length> &operator=(const vec<T, Length> &other) {\n    this->value = other.value;\n    return *this;\n  }\n  vec<T, Length> &operator=(vec<T, Length> &&other) {\n    this->value = std::move(other.value);\n    return *this;\n  }\n  template <typename O = T>\n  vec<T, Length> &operator=(std::array<O, Length> other) {\n    _priv_geom::cast_to_assignable(other, this->value);\n    return *this;\n  }\n\n  inline T operator[](size_t index) { return this->at(index); }\n\n  /// @brief Zero vector value.\n  static vec<T, Length> Zero() { return vec<T, Length>::uniform(0); }\n  /// @brief Unit vector value.\n  static vec<T, Length> One() { return vec<T, Length>::uniform(1); }\n  /// @brief X unit vector value.\n  static vec<T, Length> UnitX() {\n    Data buffer{0};\n    buffer[0] = static_cast<T>(1);\n    return vec(buffer);\n  }\n  /// @brief Y unit vector value.\n  static vec<T, Length> UnitY() {\n    Data buffer{0};\n    buffer[1] = static_cast<T>(1);\n    return vec(buffer);\n  }\n  /// @brief Z unit vector value.\n  static vec<T, Length> UnitZ() {\n    static_assert(Length >= 3, \"vector doesn't have a z component\");\n    Data buffer{0};\n    buffer[2] = static_cast<T>(1);\n    return vec(buffer);\n  }\n  /// @brief W unit vector value.\n  static vec<T, Length> UnitW() {\n    static_assert(Length >= 4, \"vector doesn't have a w component\");\n    Data buffer{0};\n    buffer[3] = static_cast<T>(1);\n    return vec(buffer);\n  }\n\n  // NOTE: All of the following loops will get unrolled by the compiler because\n  // Length is a constant expression (unless Length is very large).\n\n  inline vec<T, Length> operator+(vec<T, Length> other) const {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) { result[i] += other.value[i]; }\n    return vec<T, Length>(result);\n  }\n  inline vec<T, Length> &operator+=(vec<T, Length> other) {\n    for (size_t i = 0; i < Length; i++) { this->value[i] += other.value[i]; }\n    return *this;\n  }\n  inline vec<T, Length> operator-(vec<T, Length> other) const {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) { result[i] -= other.value[i]; }\n    return vec<T, Length>(result);\n  }\n  inline vec<T, Length> &operator-=(vec<T, Length> other) {\n    for (size_t i = 0; i < Length; i++) { this->value[i] -= other.value[i]; }\n    return *this;\n  }\n  inline vec<T, Length> operator*(T scalar) const {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) { result[i] *= scalar; }\n    return vec<T, Length>(result);\n  }\n  inline vec<T, Length> &operator*=(T scalar) {\n    for (size_t i = 0; i < Length; i++) { this->value[i] *= scalar; }\n    return *this;\n  }\n  inline vec<T, Length> operator*(vec<T, Length> other) const {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) { result[i] *= other.value[i]; }\n    return vec<T, Length>(result);\n  }\n  inline vec<T, Length> &operator*=(vec<T, Length> other) {\n    for (size_t i = 0; i < Length; i++) { this->value[i] *= other.value[i]; }\n    return *this;\n  }\n  inline vec<T, Length> operator/(T scalar) const {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) { result[i] /= scalar; }\n    return vec<T, Length>(result);\n  }\n  inline vec<T, Length> &operator/=(T scalar) {\n    for (size_t i = 0; i < Length; i++) { this->value[i] /= scalar; }\n    return *this;\n  }\n  inline vec<T, Length> operator/(vec<T, Length> other) const {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) { result[i] /= other.value[i]; }\n    return vec<T, Length>(result);\n  }\n  inline vec<T, Length> &operator/=(vec<T, Length> other) {\n    for (size_t i = 0; i < Length; i++) { this->value[i] /= other.value[i]; }\n    return *this;\n  }\n\n  inline bool operator==(vec<T, Length> other) const {\n    for (size_t i = 0; i < Length; i++) {\n      if (this->value[i] != other.value[i]) { return false; }\n    }\n    return true;\n  }\n  inline bool operator!=(vec<T, Length> other) const {\n    return !(*this == other);\n  }\n\n  inline vec<T, Length> operator-() const {\n    if constexpr (std::is_signed_v<T>) {\n      return *this * Data{-1};\n    } else {\n      return Data{std::numeric_limits<T>::max()} - *this;\n    }\n  }\n  inline vec<T, Length> abs() const {\n    if constexpr (std::is_signed_v<T>) {\n      Data result;\n      std::transform(this->value.begin(), this->value.end(), result.begin(),\n                     std::abs);\n      return vec<T, Length>(result);\n    } else {\n      return *this;\n    }\n  }\n\n  /// @brief Computes component-wise vector minimum\n  /// @param other other vector\n  /// @returns new vector with min values\n  inline vec<T, Length> min(const vec<T, Length> &other) {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) {\n      result[i] = std::min(result[i], other.value[i]);\n    }\n    return vec<T, Length>(result);\n  }\n\n  /// @brief Computes component-wise vector maximum\n  /// @param other other vector\n  /// @returns new vector with max values\n  inline vec<T, Length> max(const vec<T, Length> &other) {\n    Data result{this->value};\n    for (size_t i = 0; i < Length; i++) {\n      result[i] = std::max(result[i], other.value[i]);\n    }\n    return vec<T, Length>(result);\n  }\n\n  inline T distance_squared(vec<T, Length> other) const {\n    vec<T, Length> buffer = other - *this;\n    buffer *= buffer;\n    return std::accumulate(buffer.value.begin(), buffer.value.end(), T{0});\n  }\n  inline T distance(vec<T, Length> &other) const {\n    return std::sqrt(this->distance_squared(other));\n  }\n  inline T magnitude_squared() const {\n    vec<T, Length> buffer = this->value * this->value;\n    return std::accumulate(buffer.value.begin(), buffer.value.end(), T{0});\n  }\n  inline T magnitude() const { return std::sqrt(this->magnitude_squared()); }\n\n  T surface() const {\n    static_assert(Length == 2, \"surface computable only for 2D vectors\");\n    return this->x() * this->y();\n  }\n\n  template <typename O>\n  vec<O, Length> cast() const {\n    Vc::array<O, Length> buffer;\n    _priv_geom::cast_to_assignable<Vc::array<T, Length>, O, Length,\n                                   Vc::array<O, Length>>(this->value, buffer);\n    return vec<O, Length>(buffer);\n  }\n\n  std::array<T, Length> to_array() const {\n    std::array<T, Length> result;\n    for (size_t i = 0; i < Length; ++i) { result[i] = this->value[i]; }\n    return result;\n  }\n\n  template <typename O>\n  operator vec<O, Length>() const {\n    return this->cast<O>();\n  }\n  operator std::array<T, Length>() const { return this->to_array(); }\n};\n\ntemplate <typename T>\nusing vec2 = vec<T, 2>;\nusing vec2f = vec2<float>;\nusing vec2d = vec2<double>;\nusing vec2i = vec2<std::int32_t>;\ntemplate <typename T>\nusing vec3 = vec<T, 3>;\nusing vec3f = vec3<float>;\nusing vec3d = vec3<double>;\nusing vec3i = vec3<std::int32_t>;\ntemplate <typename T>\nusing vec4 = vec<T, 4>;\nusing vec4f = vec4<float>;\nusing vec4d = vec4<double>;\nusing vec4i = vec4<std::int32_t>;\n\nenum class rect_kind {\n  SIZED,\n  ABSOLUTE,\n};\n\n/// @brief 2D rectangle representation using position and size vectors.\n/// @tparam T component number type.\ntemplate <typename T = std::int32_t, rect_kind Kind = rect_kind::SIZED>\nstruct rect {\n  static_assert(std::is_arithmetic_v<T>, \"T must be a number\");\n\n  using Component = T;\n\n private:\n  vec2<T> m_pos;\n  vec2<T> m_other;\n\n public:\n  rect() : m_pos(vec2<T>::Zero()), m_other(vec2<T>::Zero()) {}\n  rect(vec2<T> pos, vec2<T> other) : m_pos(pos), m_other(other) {}\n\n  /// @brief Rectangle x position.\n  /// @return x position of this rectangle.\n  inline T x() const { return this->m_pos.x(); }\n  /// @brief Rectangle y position.\n  /// @return y position of this rectangle.\n  inline T y() const { return this->m_pos.y(); }\n\n  inline vec2<T> pos() const { return this->m_pos; }\n  inline vec2<T> size() const {\n    if constexpr (Kind == rect_kind::SIZED) {\n      return this->m_other;\n    } else {\n      return this->m_other - this->m_pos;\n    }\n  }\n  inline vec2<T> end_pos() const {\n    if constexpr (Kind == rect_kind::SIZED) {\n      return this->m_pos + this->m_other;\n    } else {\n      return this->m_other;\n    }\n  }\n\n  /// @brief Rectangle end x position.\n  /// @return ending x position of this rectangle.\n  inline T end_x() const { return this->end_pos().x(); }\n  /// @brief Rectangle end y position.\n  /// @return ending y position of this rectangle.\n  inline T end_y() const { return this->end_pos().y(); }\n\n  /// @brief Rectangle width.\n  /// @return width of this rectangle.\n  inline T width() const {\n    return size().x();\n  }\n\n  /// @brief Rectangle height.\n  /// @return height of this rectangle.\n  inline T height() const {\n    return size().y();\n  }\n\n  /// @brief Returns rectangle component at `index`.\n  /// @param index component index.\n  /// @return component at `index` of this rectangle.\n  T at(size_t index) const {\n    assert_print(index < static_cast<size_t>(4), \"index out of bounds\");\n    switch (index) {\n      case 0:\n        return this->m_pos.x();\n      case 1:\n        return this->m_pos.y();\n      case 2:\n        return this->m_other.x();\n      case 3:\n        return this->m_other.y();\n      default:\n        UNREACHABLE();\n    }\n  }\n\n  inline void set_pos(vec2<T> value) { this->m_pos = value; }\n  inline void set_pos(T x, T y) { this->set_pos(vec2<T>(x, y)); }\n  inline void set_size(vec2<T> value) {\n    if constexpr (Kind == rect_kind::SIZED) {\n      this->m_other = value;\n    } else {\n      this->m_other = this->m_pos + value;\n    }\n  }\n  inline void set_size(T width, T height) {\n    this->set_size(vec2<T>(width, height));\n  }\n  inline void set_end_pos(vec2<T> value) {\n    if constexpr (Kind == rect_kind::SIZED) {\n      this->m_other = value - this->m_pos;\n    } else {\n      this->m_other = value;\n    }\n  }\n  inline void set_end_pos(T x, T y) { this->set_end_pos(vec2<T>(x, y)); }\n\n  inline void set_x(T value) { this->m_pos.set_x(value); }\n  inline void set_y(T value) { this->m_pos.set_y(value); }\n\n  inline void set_width(T value) {\n    if constexpr (Kind == rect_kind::SIZED) {\n      this->m_other.set_x(value);\n    } else {\n      this->m_other.set_x(this->m_pos.get_x() + value);\n    }\n  }\n  inline void set_height(T value) {\n    if constexpr (Kind == rect_kind::SIZED) {\n      this->m_other.set_y(value);\n    } else {\n      this->m_other.set_y(this->m_pos.get_y() + value);\n    }\n  }\n  inline void set_end_x(T value) {\n    if constexpr (Kind == rect_kind::SIZED) {\n      this->m_other.set_x(value - this->m_pos.get_x());\n    } else {\n      this->m_other.set_x(value);\n    }\n  }\n  inline void set_end_y(T value) {\n    if constexpr (Kind == rect_kind::SIZED) {\n      this->m_other.set_y(value - this->m_pos.get_y());\n    } else {\n      this->m_other.set_y(value);\n    }\n  }\n\n  void set(size_t index, T value) {\n    assert_print(index < static_cast<size_t>(4), \"index out of bounds\");\n    switch (index) {\n      case 0:\n        return this->m_pos.set_x(value);\n      case 1:\n        return this->m_pos.set_y(value);\n      case 2:\n        return this->m_other.set_x(value);\n      case 3:\n        return this->m_other.set_y(value);\n      default:\n        UNREACHABLE();\n    }\n  }\n\n  std::array<vec2<T>, 4> corners() const {\n    return std::array<vec2<T>, 4>{\n        this->m_pos,\n        this->m_pos + vec2<T>(this->width(), 0),\n        this->end_pos(),\n        this->m_pos + vec2<T>(0, this->height()),\n    };\n  }\n\n  template <typename O = T>\n  bool contains(vec2<O> p) const {\n    return p.x() >= this->x() && p.x() < this->x() + this->width() &&\n           p.y() >= this->y() && p.y() < this->y() + this->height();\n  }\n\n  template <typename O = T>\n  bool contains(rect<O> other) const {\n    return contains(other.m_pos) &&\n           contains(other.m_pos + vec2<O>(other.width(), 0)) &&\n           contains(other.m_pos + other.m_other) &&\n           contains(other.m_pos + vec2<O>(0, other.height()));\n  }\n\n private:\n  template <typename O = T>\n  bool _intersects_partial(rect<O> other) const {\n    return contains(other.m_pos) ||\n           contains(other.m_pos + vec2<O>(other.width(), 0)) ||\n           contains(other.m_pos + other.m_other) ||\n           contains(other.m_pos + vec2<O>(0, other.height()));\n  }\n\n public:\n  template <typename O = T>\n  bool intersects(rect<O> other) const {\n    return this->_intersects_partial(m_other) ||\n           other._intersects_partial(*this);\n  }\n\n  rect<T, Kind> &operator=(const rect<T, Kind> &other) {\n    this->m_pos = other.m_pos;\n    this->m_other = other.m_other;\n    return *this;\n  }\n  rect<T, Kind> &operator=(rect<T, Kind> &&other) {\n    this->m_pos = other.m_pos;\n    this->m_other = other.m_other;\n    return *this;\n  }\n  template <typename O = T>\n  rect<T, Kind> &operator=(std::array<O, 4> other) {\n    _priv_geom::cast_to_assignable(other.m_pos, this->m_pos);\n    _priv_geom::cast_to_assignable(other.m_other, this->m_other);\n    return *this;\n  }\n\n  inline T operator[](size_t index) {\n    if (index < 2) {\n      return this->m_pos[index];\n    } else if (index < 4) {\n      return this->m_other[index - 2];\n    } else {\n      CRIT_ERR(\"index out of bounds\");\n    }\n  }\n\n#ifdef BUILD_X11\n  XRectangle to_xrectangle() const {\n    return XRectangle{.x = static_cast<short>(this->x()),\n                      .y = static_cast<short>(this->y()),\n                      .width = static_cast<unsigned short>(this->width()),\n                      .height = static_cast<unsigned short>(this->height())};\n  }\n#endif /* BUILD_X11 */\n\n  rect<T, rect_kind::SIZED> to_sized() const {\n    if constexpr (Kind == rect_kind::SIZED) {\n      return *this;\n    } else {\n      return rect<T, rect_kind::SIZED>{this->m_pos,\n                                       this->m_other - this->m_pos};\n    }\n  }\n\n  rect<T, rect_kind::ABSOLUTE> to_absolute() const {\n    if constexpr (Kind == rect_kind::ABSOLUTE) {\n      return *this;\n    } else {\n      return rect<T, rect_kind::ABSOLUTE>{this->m_pos,\n                                          this->m_pos + this->m_other};\n    }\n  }\n\n  std::array<T, 4> to_array() const {\n    return std::array<T, 4>{this->m_pos.x(), this->m_pos.y(), this->m_other.x(),\n                            this->m_other.y()};\n  }\n\n  inline operator std::array<T, 4>() const { return this->to_array(); }\n  inline explicit operator rect<T, rect_kind::SIZED>() const {\n    return this->to_sized();\n  }\n  inline explicit operator rect<T, rect_kind::ABSOLUTE>() const {\n    return this->to_absolute();\n  }\n};\n\ntemplate <typename T>\nusing sized_rect = rect<T>;\n\ntemplate <typename T>\nusing absolute_rect = rect<T, rect_kind::ABSOLUTE>;\n\n}  // namespace conky\n\n#endif /* _CONKY_GEOMETRY_H_ */\n"
  },
  {
    "path": "src/i18n.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef I18N_H_\n#define I18N_H_\n\n#define _nop(string) string\n\n#ifdef BUILD_I18N\n#include <libintl.h>\n#define _(string) gettext(string)\n#else\n#define _(string) string\n#endif\n\n#endif /*I18N_H_*/\n"
  },
  {
    "path": "src/logging.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _LOGGING_H\n#define _LOGGING_H\n\n#include <cinttypes>  // correct formatting for int types\n#include <cstdio>\n#include <stdexcept>\n#include \"config.h\"\n#include \"i18n.h\"\n\nclass fork_throw : public std::runtime_error {\n public:\n  fork_throw() : std::runtime_error(\"Fork happened\") {}\n  fork_throw(const std::string &msg) : std::runtime_error(msg) {}\n};\n\nclass unknown_arg_throw : public std::runtime_error {\n public:\n  unknown_arg_throw() : std::runtime_error(\"Unknown argumunt given\") {}\n  unknown_arg_throw(const std::string &msg) : std::runtime_error(msg) {}\n};\n\nclass combine_needs_2_args_error : public std::runtime_error {\n public:\n  combine_needs_2_args_error()\n      : std::runtime_error(\"combine needs arguments: <text1> <text2>\") {}\n  combine_needs_2_args_error(const std::string &msg)\n      : std::runtime_error(msg) {}\n};\n\nclass obj_create_error : public std::runtime_error {\n public:\n  obj_create_error() : std::runtime_error(\"Failed to create object\") {}\n  obj_create_error(const std::string &msg) : std::runtime_error(msg) {}\n};\n\nvoid clean_up(void);\n\ntemplate <typename... Args>\ninline void gettextize_format(const char *format, Args &&...args) {\n  fprintf(stderr, _(format), args...);\n}\n\n// explicit specialization for no arguments to avoid the\n// \"format not a string literal and no format arguments\" warning\ninline void gettextize_format(const char *format) { fputs(_(format), stderr); }\n\ntemplate <typename... Args>\nvoid NORM_ERR(const char *format, Args &&...args) {\n  fprintf(stderr, PACKAGE_NAME \": \");\n  gettextize_format(format, args...);\n  fputs(\"\\n\", stderr);\n}\n\n/* critical error with additional cleanup */\ntemplate <typename... Args>\n__attribute__((noreturn)) inline void CRIT_ERR_FREE(void *memtofree1,\n                                                    void *memtofree2,\n                                                    const char *format,\n                                                    Args &&...args) {\n  NORM_ERR(format, args...);\n  free(memtofree1);\n  free(memtofree2);\n  clean_up();\n  exit(EXIT_FAILURE);\n}\n\n/* critical error */\ntemplate <typename... Args>\n__attribute__((noreturn)) inline void CRIT_ERR(const char *format,\n                                               Args &&...args) {\n  CRIT_ERR_FREE(nullptr, nullptr, format, args...);\n}\n\nnamespace conky {\nclass error : public std::runtime_error {\n public:\n  error(const std::string &msg) : std::runtime_error(msg) {}\n};\n}  // namespace conky\n\n/* debugging output */\nextern int global_debug_level;\n\n#define __DBGP(level, ...)                                               \\\n  do {                                                                   \\\n    if (global_debug_level > level) {                                    \\\n      fprintf(stderr, \"DEBUG(%d) [\" __FILE__ \":%d]: \", level, __LINE__); \\\n      gettextize_format(__VA_ARGS__);                                    \\\n      fputs(\"\\n\", stderr);                                               \\\n    }                                                                    \\\n  } while (0)\n#define DBGP(...) __DBGP(0, __VA_ARGS__)\n#define DBGP2(...) __DBGP(1, __VA_ARGS__)\n\n#endif /* _LOGGING_H */\n"
  },
  {
    "path": "src/lua/colour-settings.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"colour-settings.hh\"\n\nnamespace priv {\nvoid colour_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n  Base::lua_setter(l, init);\n  ++s;\n}\n}  // namespace priv\n\npriv::colour_setting color[COLORS_CUSTOM] = {\n    {\"color0\", white_argb32}, {\"color1\", white_argb32},\n    {\"color2\", white_argb32}, {\"color3\", white_argb32},\n    {\"color4\", white_argb32}, {\"color5\", white_argb32},\n    {\"color6\", white_argb32}, {\"color7\", white_argb32},\n    {\"color8\", white_argb32}, {\"color9\", white_argb32}};\npriv::colour_setting default_color(\"default_color\", white_argb32);\n"
  },
  {
    "path": "src/lua/colour-settings.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#pragma once\n\n#include \"../content/colours.hh\"\n#include \"config.h\"\n#include \"setting.hh\"\n\nnamespace priv {\nstruct colour_traits {\n  static const lua::Type type = lua::TSTRING;\n  typedef Colour Type;\n\n  static inline std::pair<Type, bool> convert(lua::state &l, int index,\n                                              const std::string &) {\n    return {parse_color(l.tostring(index)), true};\n  }\n};\n\nclass colour_setting\n    : public conky::simple_config_setting<Colour, colour_traits> {\n  typedef conky::simple_config_setting<Colour, colour_traits> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n\n public:\n  colour_setting(const std::string &name_, unsigned long default_value_ = 0)\n      : Base(name_, Colour::from_argb32(default_value_), true) {}\n};\n}  // namespace priv\n\n#define COLORS_CUSTOM 10\n\nextern priv::colour_setting color[COLORS_CUSTOM];\nextern priv::colour_setting default_color;\n\nconst unsigned long white_argb32 = 0xffffffff;\nconst unsigned long black_argb32 = 0xff000000;\n"
  },
  {
    "path": "src/lua/fonts.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"fonts.h\"\n#include \"../output/display-output.hh\"\n#include \"../output/gui.h\"\n#include \"../logging.h\"\n\nunsigned int selected_font = 0;\nstd::vector<font_list> fonts;\nchar fontloaded = 0;\n\nvoid font_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (init) {\n    if (fonts.empty()) { fonts.resize(1); }\n    fonts[0].name = do_convert(l, -1).first;\n  }\n\n  ++s;\n}\n\nfont_setting font;\n\nconky::simple_config_setting<std::string> font_template[10] = {\n    {\"font0\", \"\"}, {\"font1\", \"\"}, {\"font2\", \"\"}, {\"font3\", \"\"}, {\"font4\", \"\"},\n    {\"font5\", \"\"}, {\"font6\", \"\"}, {\"font7\", \"\"}, {\"font8\", \"\"}, {\"font9\", \"\"}};\n\nvoid set_font() {\n  if (selected_font >= fonts.size()) return;\n  for (auto output : display_outputs()) output->set_font(selected_font);\n}\n\nvoid setup_fonts() {\n  DBGP2(\"setting up fonts\");\n  for (auto output : display_outputs()) output->setup_fonts();\n  set_font();\n}\n\nint add_font(const char *data_in) {\n  if (!out_to_gui(*state)) { return 0; }\n  fonts.emplace_back();\n  fonts.rbegin()->name = data_in;\n\n  return fonts.size() - 1;\n}\n\nvoid free_fonts(bool utf8) {\n  for (auto output : display_outputs()) output->free_fonts(utf8);\n  fonts.clear();\n  selected_font = 0;\n}\n\nvoid load_fonts(bool utf8) {\n  DBGP2(\"loading fonts\");\n  for (auto output : display_outputs()) output->load_fonts(utf8);\n}\n\nint font_height() {\n  assert(selected_font < fonts.size());\n  return display_output()->font_height(selected_font);\n}\n\nint font_ascent() {\n  assert(selected_font < fonts.size());\n  return display_output()->font_ascent(selected_font);\n}\n\nint font_descent() {\n  assert(selected_font < fonts.size());\n  return display_output()->font_descent(selected_font);\n}\n"
  },
  {
    "path": "src/lua/fonts.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _FONTS_H\n#define _FONTS_H\n\n#include <vector>\n\n#include \"../conky.h\"\n\n/* for fonts */\nstruct font_list {\n  std::string name;\n\n  font_list() : name() {}\n};\n\n/* direct access to registered fonts (FIXME: bad encapsulation) */\nextern std::vector<font_list> fonts;\nextern unsigned int selected_font;\n\nint font_height();\nint font_ascent();\nint font_descent();\nvoid setup_fonts(void);\nvoid set_font(void);\nint add_font(const char *);\nvoid free_fonts(bool utf8);\nvoid load_fonts(bool utf8);\n\nclass font_setting : public conky::simple_config_setting<std::string> {\n  typedef conky::simple_config_setting<std::string> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n\n public:\n  font_setting() : Base(\"font\", \"6x10\", false) {}\n};\n\nextern font_setting font;\n\nextern conky::simple_config_setting<std::string> font_template[10];\n\n#endif /* _FONTS_H */\n"
  },
  {
    "path": "src/lua/llua.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Copyright (c) 2009 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"config.h\"\n\n#include <cstring>\n#include <filesystem>\n#include <sstream>\n\n#include \"../conky.h\"\n#include \"../geometry.h\"\n#include \"../logging.h\"\n#include \"build.h\"\n#include \"llua.h\"\n\n#ifdef BUILD_GUI\n#include \"../output/gui.h\"\n\n#ifdef BUILD_X11\n#include \"../output/x11.h\"\n#include \"x11-settings.h\"\n#endif /* BUILD_X11 */\n\n#ifdef BUILD_MOUSE_EVENTS\n#include \"../mouse-events.h\"\n#endif /* BUILD_MOUSE_EVENTS */\n#endif /* BUILD_GUI */\n\nextern \"C\" {\n#include <tolua++.h>\n}\n\n#ifdef HAVE_SYS_INOTIFY_H\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wc99-extensions\"\n#include <sys/inotify.h>\n#pragma clang diagnostic pop\n\nvoid llua_append_notify(const char *name);\nvoid llua_rm_notifies(void);\nstatic int llua_block_notify = 0;\n#endif /* HAVE_SYS_INOTIFY_H */\n\n// POSIX compliant\n#include <sys/stat.h>\n\nstatic void llua_load(const char *script);\n\nlua_State *lua_L = nullptr;\n\nnamespace {\nclass lua_load_setting : public conky::simple_config_setting<std::string> {\n  using Base = conky::simple_config_setting<std::string>;\n\n protected:\n  void lua_setter(lua::state &l, bool init) override {\n    lua::stack_sentry s(l, -2);\n\n    Base::lua_setter(l, init);\n\n    if (init) {\n      std::string files = do_convert(l, -1).first;\n\n      // Split file names into separate `\\0` strings\n      if (files.find(';') != std::string::npos) {\n        for (auto &ch : files) {\n          if (ch == ';') { ch = '\\0'; }\n        }\n      } else {\n        // TODO: Remove space-delimited file name handling in 3 years (2028.)\n        for (auto &ch : files) {\n          if (ch == ' ') { ch = '\\0'; }\n        }\n      }\n\n      const char *start = files.c_str();\n      const char *end = start + files.size();\n      while (start < end) {\n        if (*start != '\\0') {  // Skip empty strings\n          llua_load(start);\n        }\n        start += strlen(start) + 1;\n      }\n    }\n\n    ++s;\n  }\n\n  void cleanup(lua::state &l) override {\n    lua::stack_sentry s(l, -1);\n\n#ifdef HAVE_SYS_INOTIFY_H\n    llua_rm_notifies();\n#endif /* HAVE_SYS_INOTIFY_H */\n    lua_close(lua_L);\n    lua_L = nullptr;\n  }\n\n public:\n  lua_load_setting() : Base(\"lua_load\", std::string(), false) {}\n};\n\nlua_load_setting lua_load;\n\nconky::simple_config_setting<std::string> lua_startup_hook(\"lua_startup_hook\",\n                                                           std::string(), true);\nconky::simple_config_setting<std::string> lua_shutdown_hook(\"lua_shutdown_hook\",\n                                                            std::string(),\n                                                            true);\n#ifdef BUILD_GUI\nconky::simple_config_setting<std::string> lua_draw_hook_pre(\"lua_draw_hook_pre\",\n                                                            std::string(),\n                                                            true);\nconky::simple_config_setting<std::string> lua_draw_hook_post(\n    \"lua_draw_hook_post\", std::string(), true);\n\n#ifdef BUILD_MOUSE_EVENTS\nconky::simple_config_setting<std::string> lua_mouse_hook(\"lua_mouse_hook\",\n                                                         std::string(), true);\n#endif /* BUILD_MOUSE_EVENTS */\n\n#endif\n}  // namespace\n\nstatic int llua_conky_parse(lua_State *L) {\n  int n = lua_gettop(L); /* number of arguments */\n  char *str;\n  auto *buf = static_cast<char *>(calloc(1, max_user_text.get(*state)));\n  if (n != 1) {\n    lua_pushstring(\n        L, \"incorrect arguments, conky_parse(string) takes exactly 1 argument\");\n    lua_error(L);\n  }\n  if (lua_isstring(L, 1) == 0) {\n    lua_pushstring(L, \"incorrect argument (expecting a string)\");\n    lua_error(L);\n  }\n  str = strdup(lua_tostring(L, 1));\n  evaluate(str, buf, max_user_text.get(*state));\n  lua_pushstring(L, buf);\n  free(str);\n  free(buf);\n  return 1; /* number of results */\n}\n\nstatic int llua_conky_set_update_interval(lua_State *L) {\n  int n = lua_gettop(L); /* number of arguments */\n  if (n != 1) {\n    lua_pushstring(L,\n                   \"incorrect arguments, conky_set_update_interval(number) \"\n                   \"takes exactly 1 argument\");\n    lua_error(L);\n  }\n  if (lua_isnumber(L, 1) == 0) {\n    lua_pushstring(L, \"incorrect argument (expecting a number)\");\n    lua_error(L);\n  }\n  state->pushnumber(lua_tonumber(L, 1));\n  update_interval.lua_set(*state);\n  return 0; /* number of results */\n}\n\nvoid llua_init() {\n  std::string libs(PACKAGE_LIBDIR \"/lib?.so;\");\n  std::string old_path, new_path;\n  if (lua_L != nullptr) { return; }\n  lua_L = luaL_newstate();\n\n  /* add our library path to the lua package.cpath global var */\n  luaL_openlibs(lua_L);\n  lua_getglobal(lua_L, \"package\");   // stack: package\n  lua_getfield(lua_L, -1, \"cpath\");  // stack: package.cpath, package\n\n  old_path = std::string(lua_tostring(lua_L, -1));\n  new_path = libs + old_path;\n\n  lua_pushstring(lua_L,\n                 new_path.c_str());  // stack: new_path, package.cpath, package\n  lua_setfield(lua_L, -3, \"cpath\");  // stack: package.cpath, package\n  lua_pop(lua_L, 1);                 // stack: package\n\n  /* Add config file and XDG paths to package.path so scripts can load other\n   * scripts from relative paths */\n  {\n    struct stat file_stat{};\n\n    std::string path_ext;\n\n    // add XDG directory to lua path\n    auto xdg_path =\n        std::filesystem::path(to_real_path(XDG_CONFIG_FILE)).parent_path();\n    if (stat(xdg_path.c_str(), &file_stat) == 0) {\n      path_ext.append(xdg_path);\n      path_ext.append(\"/?.lua\");\n      path_ext.push_back(';');\n    }\n\n    auto parent_path = current_config.parent_path();\n    if (xdg_path != parent_path && stat(parent_path.c_str(), &file_stat) == 0) {\n      path_ext.append(parent_path);\n      path_ext.append(\"/?.lua\");\n      path_ext.push_back(';');\n    }\n\n    lua_getfield(lua_L, -1, \"path\");  // stack: package.path, package\n    old_path = std::string(lua_tostring(lua_L, -1));\n    new_path = path_ext + old_path;\n\n    lua_pushstring(lua_L,\n                   new_path.c_str());  // stack: new_path, package.path, package\n    lua_setfield(lua_L, -3, \"path\");   // stack: package.path, package\n    lua_pop(lua_L, 1);                 // stack: package\n  }\n  lua_pop(lua_L, 1);  // stack is empty\n\n  lua_pushstring(lua_L, PACKAGE_NAME \" \" VERSION \" compiled for \" BUILD_ARCH);\n  lua_setglobal(lua_L, \"conky_build_info\");\n\n  lua_pushstring(lua_L, VERSION);\n  lua_setglobal(lua_L, \"conky_version\");\n\n  lua_pushstring(lua_L, BUILD_ARCH);\n  lua_setglobal(lua_L, \"conky_build_arch\");\n\n  lua_pushstring(lua_L, current_config.c_str());\n  lua_setglobal(lua_L, \"conky_config\");\n\n  lua_pushcfunction(lua_L, &llua_conky_parse);\n  lua_setglobal(lua_L, \"conky_parse\");\n\n  lua_pushcfunction(lua_L, &llua_conky_set_update_interval);\n  lua_setglobal(lua_L, \"conky_set_update_interval\");\n\n#if defined(BUILD_X11)\n  /* register tolua++ user types */\n  tolua_open(lua_L);\n  tolua_usertype(lua_L, \"Drawable\");\n  tolua_usertype(lua_L, \"Visual\");\n  tolua_usertype(lua_L, \"Display\");\n#endif /* BUILD_X11 */\n}\n\ninline bool file_exists(const char *path) {\n  struct stat buffer;\n  return (stat(path, &buffer) == 0);\n}\n\nvoid llua_load(const char *script) {\n  int error;\n\n  std::filesystem::path path;\n  std::filesystem::path script_path(script);\n\n  path = to_real_path(script); // handles ~/some/path.lua\n  if (!file_exists(path.c_str())) {\n    if (!script_path.is_absolute()) {\n      auto cfg_path = std::filesystem::path(to_real_path(XDG_CONFIG_FILE));\n      auto cfg_dir  = cfg_path.parent_path();\n  \n      // prepend the config directory to the script path\n      auto full = cfg_dir / script_path;\n      path = to_real_path(full.c_str());\n    }\n    else {\n      // Already an absolute path\n      path = to_real_path(script);\n    }\n  }\n\n  if (!file_exists(path.c_str())) {\n    bool found_alternative = false;\n\n    // Try resolving file name by using files in lua path:\n    lua_getglobal(lua_L, \"package\");  // stack: package\n    lua_getfield(lua_L, -1, \"path\");  // stack: package.path, package\n    auto lua_path = lua_tostring(lua_L, -1);\n    lua_pop(lua_L, 2);  // stack is empty\n\n    std::stringstream path_stream(lua_path);\n    std::string current;\n    while (std::getline(path_stream, current, ';')) {\n      // lua_load conky variable accepts full file names, so replace \"?.lua\"\n      // with \"?\" to ensure file names don't get the unexpected .lua suffix; but\n      // modules with init.lua will still work.\n      size_t substitute_pos = current.find(\"?.lua\");\n      if (substitute_pos != std::string::npos) {\n        current.replace(substitute_pos, 5, \"?\");\n      }\n\n      substitute_pos = current.find('?');\n      if (substitute_pos == std::string::npos) { continue; }\n      current.replace(substitute_pos, 1, script);\n      path = to_real_path(current);\n\n      if (file_exists(path.c_str())) {\n        found_alternative = true;\n        break;\n      }\n    }\n\n    if (!found_alternative) {\n      NORM_ERR(\"llua_load: specified script file '%s' doesn't exist\", script);\n      // return without initializing lua_L because other parts of the code rely\n      // on it being null if the script is not loaded\n      return;\n    }\n  }\n\n  error = luaL_dofile(lua_L, path.c_str());\n  if (error != 0) {\n    NORM_ERR(\"llua_load: %s\", lua_tostring(lua_L, -1));\n    lua_pop(lua_L, 1);\n#ifdef HAVE_SYS_INOTIFY_H\n  } else if (!llua_block_notify && inotify_fd != -1) {\n    llua_append_notify(path.c_str());\n#endif /* HAVE_SYS_INOTIFY_H */\n  }\n}\n\n/*\n * Returns the first space-delimited token of the string starting at position\n * *len. On return *len contains the length of the token. Spaces inside brackets\n * are ignored, so that eg. '${foo bar}' is treated as a single token. Sets *len\n * to zero and *str points to the end of the string when there are no more\n * tokens.\n */\nstatic const char *tokenize(const char *str, size_t *len) {\n  str += *len;\n  *len = 0;\n  while ((str != nullptr) && (isspace(static_cast<unsigned char>(*str)) != 0)) {\n    ++str;\n  }\n\n  size_t level = 0;\n  while ((str != nullptr) && (str[*len] != 0) &&\n         (level > 0 || (isspace(static_cast<unsigned char>(str[*len])) == 0))) {\n    switch (str[*len]) {\n      case '{':\n        ++level;\n        break;\n      case '}':\n        --level;\n        break;\n    }\n    ++*len;\n  }\n\n  if (str != nullptr && (str[*len] == 0) && level > 0) {\n    NORM_ERR(\"tokenize: improperly nested token: %s\", str);\n  }\n\n  return str;\n}\n\n/*\n   llua_do_call does a flexible call to any Lua function\nstring: <function> [par1] [par2...]\nretc: the number of return values expected\n */\nstatic char *llua_do_call(const char *string, int retc) {\n  static char func[64];\n  int argc = 0;\n\n  size_t len = 0;\n\n  const char *ptr = tokenize(string, &len);\n\n  /* proceed only if the function name is present */\n  if (len == 0U) { return nullptr; }\n\n  /* call only conky_ prefixed functions */\n  if (strncmp(ptr, LUAPREFIX, strlen(LUAPREFIX)) != 0) {\n    snprintf(func, sizeof func, \"%s\", LUAPREFIX);\n  } else {\n    *func = 0;\n  }\n  strncat(func, ptr, std::min(len, sizeof(func) - strlen(func) - 1));\n\n  /* push the function name to stack */\n  lua_getglobal(lua_L, func);\n\n  /* parse all function parameters from args and push them to the stack */\n  while (ptr = tokenize(ptr, &len), len != 0u) {\n    lua_pushlstring(lua_L, ptr, len);\n    argc++;\n  }\n\n  if (lua_pcall(lua_L, argc, retc, 0) != 0) {\n    NORM_ERR(\"llua_do_call: function %s execution failed: %s\", func,\n             lua_tostring(lua_L, -1));\n    lua_pop(lua_L, -1);\n    return nullptr;\n  }\n\n  return func;\n}\n\n#if 0\n/*\n * same as llua_do_call() except passes everything after func as one arg.\n */\nstatic char *llua_do_read_call(const char *function, const char *arg, int retc)\n{\n\tstatic char func[64];\n\tsnprintf(func, 64, \"conky_%s\", function);\n\n\t/* push the function name to stack */\n\tlua_getglobal(lua_L, func);\n\n\t/* push function parameter to the stack */\n\tlua_pushstring(lua_L, arg);\n\n\tif (lua_pcall(lua_L, 1, retc, 0) != 0) {\n\t\tNORM_ERR(\"llua_do_call: function %s execution failed: %s\", func, lua_tostring(lua_L, -1));\n\t\tlua_pop(lua_L, -1);\n\t\treturn nullptr;\n\t}\n\n\treturn func;\n}\n#endif\n\n/* call a function with args, and return a string from it (must be free'd) */\nstatic char *llua_getstring(const char *args) {\n  char *func;\n  char *ret = nullptr;\n\n  func = llua_do_call(args, 1);\n  if (func != nullptr) {\n    if (lua_isstring(lua_L, -1) == 0) {\n      NORM_ERR(\n          \"llua_getstring: function %s didn't return a string, result \"\n          \"discarded\",\n          func);\n    } else {\n      ret = strdup(lua_tostring(lua_L, -1));\n      lua_pop(lua_L, 1);\n    }\n  }\n\n  return ret;\n}\n\n#if 0\n/* call a function with args, and return a string from it (must be free'd) */\nstatic char *llua_getstring_read(const char *function, const char *arg)\n{\n\tchar *func;\n\tchar *ret = nullptr;\n\n\tif(!lua_L) return nullptr;\n\n\tfunc = llua_do_read_call(function, arg, 1);\n\tif (func) {\n\t\tif(!lua_isstring(lua_L, -1)) {\n\t\t\tNORM_ERR(\"llua_getstring_read: function %s didn't return a string, result discarded\", func);\n\t\t} else {\n\t\t\tret = strdup(lua_tostring(lua_L, -1));\n\t\t\tlua_pop(lua_L, 1);\n\t\t}\n\t}\n\n\treturn ret;\n}\n#endif\n\n/* call a function with args, and put the result in ret */\nstatic int llua_getnumber(const char *args, double *ret) {\n  char *func;\n\n  func = llua_do_call(args, 1);\n  if (func != nullptr) {\n    if (lua_isnumber(lua_L, -1) == 0) {\n      NORM_ERR(\n          \"llua_getnumber: function %s didn't return a number, result \"\n          \"discarded\",\n          func);\n    } else {\n      *ret = lua_tonumber(lua_L, -1);\n      lua_pop(lua_L, 1);\n      return 1;\n    }\n  }\n  return 0;\n}\n\n#ifdef HAVE_SYS_INOTIFY_H\nstruct _lua_notify_s {\n  int wd;\n  char name[DEFAULT_TEXT_BUFFER_SIZE];\n  struct _lua_notify_s *next;\n};\nstatic struct _lua_notify_s *lua_notifies = 0;\n\nstatic struct _lua_notify_s *llua_notify_list_do_alloc(const char *name) {\n  struct _lua_notify_s *ret =\n      (struct _lua_notify_s *)malloc(sizeof(struct _lua_notify_s));\n  memset(ret, 0, sizeof(struct _lua_notify_s));\n  strncpy(ret->name, name, DEFAULT_TEXT_BUFFER_SIZE);\n  return ret;\n}\n\nvoid llua_append_notify(const char *name) {\n  /* do it */\n  struct _lua_notify_s *new_tail = 0;\n  if (!lua_notifies) {\n    /* empty, fresh new digs */\n    new_tail = lua_notifies = llua_notify_list_do_alloc(name);\n  } else {\n    struct _lua_notify_s *tail = lua_notifies;\n    while (tail->next) { tail = tail->next; }\n    // should be @ the end now\n    new_tail = llua_notify_list_do_alloc(name);\n    tail->next = new_tail;\n  }\n  new_tail->wd = inotify_add_watch(inotify_fd, new_tail->name, IN_MODIFY);\n}\n\nvoid llua_rm_notifies(void) {\n  /* git 'er done */\n  struct _lua_notify_s *head = lua_notifies;\n  struct _lua_notify_s *next = 0;\n  if (!lua_notifies) return;\n  inotify_rm_watch(inotify_fd, head->wd);\n  if (head->next) next = head->next;\n  free(head);\n  while (next) {\n    head = next;\n    next = head->next;\n    inotify_rm_watch(inotify_fd, head->wd);\n    free(head);\n  }\n  lua_notifies = 0;\n}\n\nvoid llua_inotify_query(int wd, int mask) {\n  struct _lua_notify_s *head = lua_notifies;\n  if (mask & IN_MODIFY || mask & IN_IGNORED) {\n    /* for whatever reason, i keep getting IN_IGNORED when the file is\n     * modified */\n    while (head) {\n      if (head->wd == wd) {\n        llua_block_notify = 1;\n        llua_load(head->name);\n        llua_block_notify = 0;\n        NORM_ERR(\"Lua script '%s' reloaded\", head->name);\n        if (mask & IN_IGNORED) {\n          /* for some reason we get IN_IGNORED here\n           * sometimes, so we need to re-add the watch */\n          head->wd = inotify_add_watch(inotify_fd, head->name, IN_MODIFY);\n        }\n        return;\n      }\n      head = head->next;\n    }\n  }\n}\n#endif /* HAVE_SYS_INOTIFY_H */\n\nvoid llua_set_number(const char *key, double value) {\n  lua_pushnumber(lua_L, value);\n  lua_setfield(lua_L, -2, key);\n}\n\nvoid llua_startup_hook() {\n  if (lua_startup_hook.get(*state).empty()) { return; }\n  llua_do_call(lua_startup_hook.get(*state).c_str(), 0);\n}\n\nvoid llua_shutdown_hook() {\n  if (lua_shutdown_hook.get(*state).empty()) { return; }\n  llua_do_call(lua_shutdown_hook.get(*state).c_str(), 0);\n}\n\n#ifdef BUILD_GUI\nvoid llua_draw_pre_hook() {\n  if (lua_draw_hook_pre.get(*state).empty()) { return; }\n  llua_do_call(lua_draw_hook_pre.get(*state).c_str(), 0);\n}\n\nvoid llua_draw_post_hook() {\n  if (lua_draw_hook_post.get(*state).empty()) { return; }\n  llua_do_call(lua_draw_hook_post.get(*state).c_str(), 0);\n}\n\n#ifdef BUILD_MOUSE_EVENTS\ntemplate <typename EventT>\nbool llua_mouse_hook(const EventT &ev) {\n  if (lua_mouse_hook.get(*state).empty()) { return false; }\n  const std::string raw_hook_name = lua_mouse_hook.get(*state);\n  std::string hook_name;\n  if (raw_hook_name.rfind(\"conky_\", 0) == 0) {\n    hook_name = raw_hook_name;\n  } else {\n    hook_name = \"conky_\" + raw_hook_name;\n  }\n\n  int ty = lua_getglobal(lua_L, hook_name.c_str());\n  if (ty == LUA_TNIL) {\n    int ty_raw = lua_getglobal(lua_L, raw_hook_name.c_str());\n    if (ty_raw == LUA_TFUNCTION) {\n      // TODO: (1.22.0) Force conky_ prefix on use_mouse_hook like llua_do_call\n      // does\n      // - keep only else case, remove ty_raw and make hook_name const.\n      NORM_ERR(\n          \"llua_mouse_hook: hook %s declaration is missing 'conky_' prefix\",\n          raw_hook_name.c_str());\n      hook_name = raw_hook_name;\n      ty = ty_raw;\n      lua_insert(lua_L, -2);\n      lua_pop(lua_L, 1);\n    } else {\n      NORM_ERR(\"llua_mouse_hook: hook %s is not defined\", hook_name.c_str());\n      lua_pop(lua_L, 2);\n      return false;\n    }\n  } else if (ty != LUA_TFUNCTION) {\n    NORM_ERR(\"llua_mouse_hook: hook %s is not a function\", hook_name.c_str());\n    lua_pop(lua_L, 1);\n    return false;\n  }\n\n  ev.push_lua_table(lua_L);\n\n  bool result = false;\n  if (lua_pcall(lua_L, 1, 1, 0) != LUA_OK) {\n    NORM_ERR(\"llua_mouse_hook: hook %s execution failed: %s\", hook_name.c_str(),\n             lua_tostring(lua_L, -1));\n    lua_pop(lua_L, 1);\n  } else {\n    result = lua_toboolean(lua_L, -1);\n    lua_pop(lua_L, 1);\n  }\n\n  return result;\n}\n\ntemplate bool llua_mouse_hook<conky::mouse_scroll_event>(\n    const conky::mouse_scroll_event &ev);\ntemplate bool llua_mouse_hook<conky::mouse_button_event>(\n    const conky::mouse_button_event &ev);\ntemplate bool llua_mouse_hook<conky::mouse_move_event>(\n    const conky::mouse_move_event &ev);\ntemplate bool llua_mouse_hook<conky::mouse_crossing_event>(\n    const conky::mouse_crossing_event &ev);\n#endif /* BUILD_MOUSE_EVENTS */\n\nvoid llua_set_userdata(const char *key, const char *type, void *value) {\n  tolua_pushusertype(lua_L, value, type);\n  lua_setfield(lua_L, -2, key);\n}\n\nvoid llua_setup_window_table(conky::rect<int> text_rect) {\n  lua_newtable(lua_L);\n\n#ifdef BUILD_X11\n  if (out_to_x.get(*state)) {\n    llua_set_userdata(\"drawable\", \"Drawable\", (void *)&window.drawable);\n    llua_set_userdata(\"visual\", \"Visual\", window.visual);\n    llua_set_userdata(\"display\", \"Display\", display);\n  }\n#endif /*BUILD_X11*/\n\n#ifdef BUILD_GUI\n  if (out_to_gui(*state)) {\n#ifdef BUILD_X11\n    llua_set_number(\"width\", window.geometry.width());\n    llua_set_number(\"height\", window.geometry.height());\n#endif /*BUILD_X11*/\n    llua_set_number(\"border_inner_margin\", border_inner_margin.get(*state));\n    llua_set_number(\"border_outer_margin\", border_outer_margin.get(*state));\n    llua_set_number(\"border_width\", border_width.get(*state));\n\n    llua_set_number(\"text_start_x\", text_rect.x());\n    llua_set_number(\"text_start_y\", text_rect.y());\n    llua_set_number(\"text_width\", text_rect.width());\n    llua_set_number(\"text_height\", text_rect.height());\n\n    lua_setglobal(lua_L, \"conky_window\");\n  }\n#endif /*BUILD_GUI*/\n}\n\nvoid llua_update_window_table(conky::rect<int> text_rect) {\n  lua_getglobal(lua_L, \"conky_window\");\n  if (lua_isnil(lua_L, -1)) {\n    /* window table isn't populated yet */\n    lua_pop(lua_L, 1);\n    return;\n  }\n\n#ifdef BUILD_X11\n  llua_set_number(\"width\", window.geometry.width());\n  llua_set_number(\"height\", window.geometry.height());\n#endif /*BUILD_X11*/\n\n  llua_set_number(\"text_start_x\", text_rect.x());\n  llua_set_number(\"text_start_y\", text_rect.y());\n  llua_set_number(\"text_width\", text_rect.width());\n  llua_set_number(\"text_height\", text_rect.height());\n\n  lua_setglobal(lua_L, \"conky_window\");\n}\n#endif /* BUILD_GUI */\n\nvoid llua_setup_info(struct information *i, double u_interval) {\n  lua_newtable(lua_L);\n\n  llua_set_number(\"update_interval\", u_interval);\n  llua_set_number(\"cpu_count\", i->cpu_count);\n\n  lua_setglobal(lua_L, \"conky_info\");\n}\n\nvoid llua_update_info(struct information *i, double u_interval) {\n  lua_getglobal(lua_L, \"conky_info\");\n  if (lua_isnil(lua_L, -1)) {\n    /* window table isn't populated yet */\n    lua_pop(lua_L, 1);\n    return;\n  }\n\n  llua_set_number(\"update_interval\", u_interval);\n  (void)i;\n\n  lua_setglobal(lua_L, \"conky_info\");\n}\n\nvoid print_lua(struct text_object *obj, char *p, unsigned int p_max_size) {\n  char *str = llua_getstring(obj->data.s);\n  if (str != nullptr) {\n    snprintf(p, p_max_size, \"%s\", str);\n    free(str);\n  }\n}\n\nvoid print_lua_parse(struct text_object *obj, char *p,\n                     unsigned int p_max_size) {\n  char *str = llua_getstring(obj->data.s);\n  if (str != nullptr) {\n    evaluate(str, p, p_max_size);\n    free(str);\n  }\n}\n\ndouble lua_barval(struct text_object *obj) {\n  double per;\n  if (llua_getnumber(obj->data.s, &per) != 0) { return per; }\n  return 0;\n}\n"
  },
  {
    "path": "src/lua/llua.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Copyright (c) 2009 Toni Spets\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef LUA_H_\n#define LUA_H_\n\nextern \"C\" {\n#include <lauxlib.h>\n#include <lua.h>\n#include <lualib.h>\n}\n\n#include <config.h>\n#include \"../geometry.h\"\n\n#ifdef BUILD_MOUSE_EVENTS\n#include \"../mouse-events.h\"\n#endif /* BUILD_MOUSE_EVENTS */\n\n#define LUAPREFIX \"conky_\"\n\n#ifdef HAVE_SYS_INOTIFY_H\n/* check our lua inotify status */\nvoid llua_inotify_query(int wd, int mask);\n#endif /* HAVE_SYS_INOTIFY_H */\n\nvoid llua_init();\nvoid llua_startup_hook(void);\nvoid llua_shutdown_hook(void);\n\n#ifdef BUILD_GUI\nvoid llua_draw_pre_hook(void);\nvoid llua_draw_post_hook(void);\n\n#ifdef BUILD_MOUSE_EVENTS\n/**\n  Takes a mouse_event as argument.\n  Returns true if event was properly consumed, false otherwise.\n */\ntemplate <typename EventT>\nbool llua_mouse_hook(const EventT &ev);\n#endif /* BUILD_MOUSE_EVENTS */\n\nvoid llua_setup_window_table(conky::rect<int> text_rect);\nvoid llua_update_window_table(conky::rect<int> text_rect);\n#endif /* BUILD_GUI */\n\nvoid llua_setup_info(struct information *i, double u_interval);\nvoid llua_update_info(struct information *i, double u_interval);\n\nvoid print_lua(struct text_object *, char *, unsigned int);\nvoid print_lua_parse(struct text_object *, char *, unsigned int);\ndouble lua_barval(struct text_object *);\n\n#endif /* LUA_H_*/\n"
  },
  {
    "path": "src/lua/lua-config.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"lua-config.hh\"\n\n#include \"../data/data-source.hh\"\n#include \"setting.hh\"\n\nnamespace conky {\nvoid export_symbols(lua::state &l) {\n  lua::stack_sentry s(l);\n  l.checkstack(3);\n\n  l.newtable();\n  {\n    export_data_sources(l);\n\n    l.newtable();\n    l.rawsetfield(-2, \"config\");\n  }\n  l.setglobal(\"conky\");\n}\n}  // namespace conky\n"
  },
  {
    "path": "src/lua/lua-config.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef LUA_CONFIG_HH\n#define LUA_CONFIG_HH\n\n#include \"luamm.hh\"\n\nnamespace conky {\nvoid export_symbols(lua::state &l);\n}\n\n#endif /* LUA_CONFIG_HH */\n"
  },
  {
    "path": "src/lua/luamm.cc",
    "content": "/*\n *\n * luamm:  C++ binding for lua\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"luamm.hh\"\n\nnamespace lua {\nnamespace {\n\n#if LUA_VERSION_NUM >= 502\n// These two functions were deprecated in 5.2. Limited backwards compatibility\n// is provided by macros. We want them as real functions, because we take their\n// addresses.\n\n#undef lua_equal\nint lua_equal(lua_State *L, int index1, int index2) {\n  return lua_compare(L, index1, index2, LUA_OPEQ);\n}\n\n#undef lua_lessthan\nint lua_lessthan(lua_State *L, int index1, int index2) {\n  return lua_compare(L, index1, index2, LUA_OPLT);\n}\n#endif\n\n// keys for storing values in lua registry\nconst char cpp_exception_metatable[] = \"lua::cpp_exception_metatable\";\nconst char cpp_function_metatable[] = \"lua::cpp_function_metatable\";\nconst char lua_exception_namespace[] = \"lua::lua_exception_namespace\";\nconst char this_cpp_object[] = \"lua::this_cpp_object\";\n\n// converts C++ exceptions to strings, so lua can do something with them\nint exception_to_string(lua_State *l) {\n  auto *ptr = static_cast<std::exception_ptr *>(lua_touserdata(l, -1));\n  assert(ptr);\n  try {\n    std::rethrow_exception(*ptr);\n  } catch (std::exception &e) { lua_pushstring(l, e.what()); } catch (...) {\n    lua_pushstring(l, typeid(*ptr).name());\n  }\n  return 1;\n}\n\nint absindex(lua_State *l, int index) {\n  return index < 0 && -index <= lua_gettop(l) ? lua_gettop(l) + 1 + index\n                                              : index;\n}\n\n// Just like getfield(), only without calling metamethods (or throwing random\n// exceptions)\ninline void rawgetfield(lua_State *l, int index, const char *k) {\n  index = absindex(l, index);\n  if (lua_checkstack(l, 1) == 0) { throw std::bad_alloc(); }\n\n  lua_pushstring(l, k);\n  lua_rawget(l, index);\n}\n\n// Just like setfield(), only without calling metamethods (or throwing random\n// exceptions)\ninline void rawsetfield(lua_State *l, int index, const char *k) {\n  index = absindex(l, index);\n  if (lua_checkstack(l, 2) == 0) { throw std::bad_alloc(); }\n\n  lua_pushstring(l, k);\n  lua_insert(l, -2);\n  lua_rawset(l, index);\n}\n\nint closure_trampoline(lua_State *l) {\n  lua_checkstack(l, 2);\n  rawgetfield(l, REGISTRYINDEX, this_cpp_object);\n  assert(lua_islightuserdata(l, -1));\n  auto *L = static_cast<state *>(lua_touserdata(l, -1));\n  lua_pop(l, 1);\n\n  try {\n    auto *fn = static_cast<cpp_function *>(L->touserdata(lua_upvalueindex(1)));\n    assert(fn);\n    return (*fn)(L);\n  } catch (lua::exception &e) {\n    // rethrow lua errors as such\n    e.push_lua_error(L);\n  } catch (...) {\n    // C++ exceptions (pointers to them, actually) are stored as lua userdata\n    // and then thrown\n    L->createuserdata<std::exception_ptr>(std::current_exception());\n    L->rawgetfield(REGISTRYINDEX, cpp_exception_metatable);\n    L->setmetatable(-2);\n  }\n\n  // lua_error does longjmp(), so destructors for objects in this function will\n  // not be called\n  return lua_error(l);\n}\n\n/*\n * This function is called when lua encounters an error outside of any protected\n * environment\n * Throwing the exception through lua code appears to work, even if it was\n * compiled without -fexceptions. If it turns out, it fails in some conditions,\n * it could be replaced with some longjmp() magic. But that shouldn't be\n * necessary, as this function will not be called under normal conditions (we\n * execute everything in protected mode).\n */\nint panic_throw(lua_State *l) {\n  if (lua_checkstack(l, 1) == 0) { throw std::bad_alloc(); }\n\n  rawgetfield(l, REGISTRYINDEX, this_cpp_object);\n  assert(lua_islightuserdata(l, -1));\n  auto *L = static_cast<state *>(lua_touserdata(l, -1));\n  lua_pop(l, 1);\n\n  throw lua::exception(L);\n}\n\n// protected mode wrappers for various lua functions\nint safe_concat_trampoline(lua_State *l) {\n  lua_concat(l, lua_gettop(l));\n  return 1;\n}\n\ntemplate <int (*compare)(lua_State *, int, int)>\nint safe_compare_trampoline(lua_State *l) {\n  int r = compare(l, 1, 2);\n  lua_pop(l, 2);\n  lua_pushinteger(l, r);\n  return 1;\n}\n\nint safe_gc_trampoline(lua_State *l) {\n  int what = lua_tointeger(l, -2);\n  int data = lua_tointeger(l, -1);\n  lua_pop(l, 2);\n  lua_pushinteger(l, lua_gc(l, what, data));\n  return 1;\n}\n\ntemplate <void (*misc)(lua_State *, int), int nresults>\nint safe_misc_trampoline(lua_State *l) {\n  misc(l, 1);\n  return nresults;\n}\n\n// Overloaded for Lua 5.3+ as lua_gettable and others return an int\ntemplate <int (*misc)(lua_State *, int), int nresults>\nint safe_misc_trampoline(lua_State *l) {\n  misc(l, 1);\n  return nresults;\n}\n\nint safe_next_trampoline(lua_State *l) {\n  int r = lua_next(l, 1);\n  lua_checkstack(l, 1);\n  lua_pushinteger(l, r);\n  return r != 0 ? 3 : 1;\n}\n\n}  // namespace\n\nstd::string exception::get_error_msg(state *L) {\n  static const std::string default_msg(\"Unknown lua exception\");\n\n  try {\n    return L->tostring(-1);\n  } catch (not_string_error &e) { return default_msg; }\n}\n\nexception::exception(state *l) : std::runtime_error(get_error_msg(l)), L(l) {\n  L->checkstack(1);\n\n  L->rawgetfield(REGISTRYINDEX, lua_exception_namespace);\n  L->insert(-2);\n  key = L->ref(-2);\n  L->pop(1);\n}\n\nexception::~exception() {\n  if (L == nullptr) { return; }\n  L->checkstack(1);\n\n  L->rawgetfield(REGISTRYINDEX, lua_exception_namespace);\n  L->unref(-1, key);\n  L->pop();\n}\n\nvoid exception::push_lua_error(state *l) {\n  if (l != L) {\n    throw std::runtime_error(\n        \"Cannot transfer exceptions between different lua contexts\");\n  }\n  l->checkstack(2);\n\n  l->rawgetfield(REGISTRYINDEX, lua_exception_namespace);\n  l->rawgeti(-1, key);\n  l->replace(-2);\n}\n\nstate::state() {\n  if (lua_State *l = luaL_newstate()) {\n    cobj.reset(l, &lua_close);\n  } else {\n    // docs say this can happen only in case of a memory allocation error\n    throw std::bad_alloc();\n  }\n\n  // set our panic function\n  lua_atpanic(cobj.get(), panic_throw);\n\n  checkstack(2);\n\n  // store a pointer to ourselves\n  pushlightuserdata(this);\n  rawsetfield(REGISTRYINDEX, this_cpp_object);\n\n  // a metatable for C++ exceptions travelling through lua code\n  newmetatable(cpp_exception_metatable);\n  lua_pushcfunction(cobj.get(), &exception_to_string);\n  rawsetfield(-2, \"__tostring\");\n  pushboolean(false);\n  rawsetfield(-2, \"__metatable\");\n  pushdestructor<std::exception_ptr>();\n  rawsetfield(-2, \"__gc\");\n  pop();\n\n  // a metatable for C++ functions callable from lua code\n  newmetatable(cpp_function_metatable);\n  pushboolean(false);\n  rawsetfield(-2, \"__metatable\");\n  pushdestructor<cpp_function>();\n  rawsetfield(-2, \"__gc\");\n  pop();\n\n  // while they're travelling through C++ code, lua exceptions will reside here\n  newtable();\n  rawsetfield(REGISTRYINDEX, lua_exception_namespace);\n\n  luaL_openlibs(cobj.get());\n}\n\nvoid state::call(int nargs, int nresults, int errfunc) {\n  int r = lua_pcall(cobj.get(), nargs, nresults, errfunc);\n  if (r == 0) { return; }\n\n  if (r == LUA_ERRMEM) {\n    // memory allocation error, cross your fingers\n    throw std::bad_alloc();\n  }\n\n  checkstack(3);\n  rawgetfield(REGISTRYINDEX, cpp_exception_metatable);\n  if (getmetatable(-2)) {\n    if (rawequal(-1, -2)) {\n      // it's a C++ exception, rethrow it\n      auto *ptr = static_cast<std::exception_ptr *>(touserdata(-3));\n      assert(ptr);\n\n      /*\n       * we create a copy, so we can pop the object without fearing the\n       * exception will be collected by lua's GC\n       */\n      std::exception_ptr t(*ptr);\n      ptr = nullptr;\n      pop(3);\n      std::rethrow_exception(t);\n    }\n    pop(2);\n  }\n  // it's a lua exception, wrap it\n  if (r == LUA_ERRERR) { throw lua::errfunc_error(this); }\n  { throw lua::exception(this); }\n}\n\nvoid state::checkstack(int extra) {\n  if (lua_checkstack(cobj.get(), extra) == 0) { throw std::bad_alloc(); }\n}\n\nvoid state::concat(int n) {\n  assert(n >= 0);\n  checkstack(1);\n  lua_pushcfunction(cobj.get(), safe_concat_trampoline);\n  insert(-n - 1);\n  call(n, 1, 0);\n}\n\nbool state::equal(int index1, int index2) {\n  // avoid pcall overhead in trivial cases\n  if (rawequal(index1, index2)) { return true; }\n\n  return safe_compare(&safe_compare_trampoline<lua_equal>, index1, index2);\n}\n\nint state::gc(int what, int data) {\n  checkstack(3);\n  lua_pushcfunction(cobj.get(), safe_gc_trampoline);\n  pushinteger(what);\n  pushinteger(data);\n  call(2, 1, 0);\n  assert(state::_isnumber(-1));\n  int r = tointeger(-1);\n  pop();\n  return r;\n}\n\nvoid state::getfield(int index, const char *k) {\n  checkstack(1);\n  index = absindex(index);\n  pushstring(k);\n  gettable(index);\n}\n\nvoid state::getglobal(const char *name) {\n#if LUA_VERSION_NUM >= 502\n  checkstack(1);\n  pushinteger(LUA_RIDX_GLOBALS);\n  gettable(REGISTRYINDEX);\n  getfield(-1, name);\n  replace(-2);\n#else\n  getfield(LUA_GLOBALSINDEX, name);\n#endif\n}\n\nvoid state::gettable(int index) {\n  checkstack(2);\n  pushvalue(index);\n  insert(-2);\n  lua_pushcfunction(cobj.get(), (&safe_misc_trampoline<&lua_gettable, 1>));\n  insert(-3);\n  call(2, 1, 0);\n}\n\nbool state::lessthan(int index1, int index2) {\n  return safe_compare(&safe_compare_trampoline<&lua_lessthan>, index1, index2);\n}\n\nvoid state::loadfile(const char *filename) {\n  switch (luaL_loadfile(cobj.get(), filename)) {\n    case 0:\n      return;\n    case LUA_ERRSYNTAX:\n      throw lua::syntax_error(this);\n    case LUA_ERRFILE:\n      throw lua::file_error(this);\n    case LUA_ERRMEM:\n      throw std::bad_alloc();\n    default:\n      assert(0);\n  }\n}\n\nvoid state::loadstring(const char *s) {\n  switch (luaL_loadstring(cobj.get(), s)) {\n    case 0:\n      return;\n    case LUA_ERRSYNTAX:\n      throw lua::syntax_error(this);\n    case LUA_ERRMEM:\n      throw std::bad_alloc();\n    default:\n      assert(0);\n  }\n}\n\nbool state::next(int index) {\n  checkstack(2);\n  pushvalue(index);\n  insert(-2);\n  lua_pushcfunction(cobj.get(), &safe_next_trampoline);\n  insert(-3);\n\n  call(2, MULTRET, 0);\n\n  assert(state::_isnumber(-1));\n  int r = tointeger(-1);\n  pop();\n  return r != 0;\n}\n\nvoid state::pushclosure(const cpp_function &fn, int n) {\n  checkstack(2);\n\n  createuserdata<cpp_function>(fn);\n  rawgetfield(REGISTRYINDEX, cpp_function_metatable);\n  setmetatable(-2);\n\n  insert(-n - 1);\n  lua_pushcclosure(cobj.get(), &closure_trampoline, n + 1);\n}\n\nvoid state::rawgetfield(int index, const char *k) {\n  lua::rawgetfield(cobj.get(), index, k);\n}\n\nvoid state::rawsetfield(int index, const char *k) {\n  lua::rawsetfield(cobj.get(), index, k);\n}\n\nbool state::safe_compare(lua_CFunction trampoline, int index1, int index2) {\n  // if one of the indexes is invalid, return false\n  if (isnone(index1) || isnone(index2)) { return false; }\n\n  // convert relative indexes into absolute\n  index1 = absindex(index1);\n  index2 = absindex(index2);\n\n  checkstack(3);\n  lua_pushcfunction(cobj.get(), trampoline);\n  pushvalue(index1);\n  pushvalue(index2);\n  call(2, 1, 0);\n  assert(state::_isnumber(-1));\n  int r = tointeger(-1);\n  pop();\n  return r != 0;\n}\n\nvoid state::setfield(int index, const char *k) {\n  checkstack(1);\n  index = absindex(index);\n  pushstring(k);\n  insert(-2);\n  settable(index);\n}\n\nvoid state::setglobal(const char *name) {\n#if LUA_VERSION_NUM >= 502\n  stack_sentry s(*this, -1);\n  checkstack(1);\n  pushinteger(LUA_RIDX_GLOBALS);\n  gettable(REGISTRYINDEX);\n  insert(-2);\n  setfield(-2, name);\n  pop();\n#else\n  setfield(LUA_GLOBALSINDEX, name);\n#endif\n}\n\nvoid state::settable(int index) {\n  checkstack(2);\n  pushvalue(index);\n  insert(-3);\n  lua_pushcfunction(cobj.get(), (&safe_misc_trampoline<&lua_settable, 0>));\n  insert(-4);\n  call(3, 0, 0);\n}\n\nstd::string state::tostring(int index) {\n  size_t len;\n  const char *str = lua_tolstring(cobj.get(), index, &len);\n  if (str == nullptr) { throw not_string_error(); }\n  return std::string(str, len);\n}\n}  // namespace lua\n"
  },
  {
    "path": "src/lua/luamm.hh",
    "content": "/*\n *\n * luamm:  C++ binding for lua\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef LUAMM_HH\n#define LUAMM_HH\n\n#include <assert.h>\n#include <exception>\n#include <functional>\n#include <memory>\n#include <mutex>\n#include <stdexcept>\n#include <string>\n\n#include <lua.hpp>\n\nnamespace lua {\nclass state;\n\ntypedef lua_Integer integer;\ntypedef lua_Number number;\ntypedef std::function<int(state *)> cpp_function;\n\nenum { REGISTRYINDEX = LUA_REGISTRYINDEX };\n\nenum {\n  GCSTOP = LUA_GCSTOP,\n  GCRESTART = LUA_GCRESTART,\n  GCCOLLECT = LUA_GCCOLLECT,\n  GCCOUNT = LUA_GCCOUNT,\n  GCCOUNTB = LUA_GCCOUNTB,\n  GCSTEP = LUA_GCSTEP,\n  GCSETPAUSE = LUA_GCSETPAUSE,\n  GCSETSTEPMUL = LUA_GCSETSTEPMUL\n};\n\nenum { MULTRET = LUA_MULTRET };\n\nenum Type {\n  TBOOLEAN = LUA_TBOOLEAN,\n  TFUNCTION = LUA_TFUNCTION,\n  TLIGHTUSERDATA = LUA_TLIGHTUSERDATA,\n  TNIL = LUA_TNIL,\n  TNONE = LUA_TNONE,\n  TNUMBER = LUA_TNUMBER,\n  TSTRING = LUA_TSTRING,\n  TTABLE = LUA_TTABLE,\n  TTHREAD = LUA_TTHREAD,\n  TUSERDATA = LUA_TUSERDATA\n};\n\n// we reserve one upvalue for the function pointer\ninline int upvalueindex(int n) { return lua_upvalueindex(n + 1); }\n\n/*\n * Lua error()s are wrapped in this class when rethrown into C++ code. what()\n * returns the error message. push_lua_error() pushes the error onto lua stack.\n * The error can only be pushed into the same state it was generated in.\n */\nclass exception : public std::runtime_error {\n  /*\n   * We only allow moving, to avoid complications with multiple references. It\n   * shouldn't be difficult to modify this to work with copying, if that proves\n   * unavoidable.\n   */\n  state *L;\n  int key;\n\n  static std::string get_error_msg(state *L);\n\n  exception(const exception &) = delete;\n  const exception &operator=(const exception &) = delete;\n\n public:\n  exception(exception &&other)\n      : std::runtime_error(std::move(other)), L(other.L), key(other.key) {\n    other.L = nullptr;\n  }\n\n  explicit exception(state *l);\n  virtual ~exception();\n\n  void push_lua_error(state *l);\n};\n\nclass not_string_error : public std::runtime_error {\n public:\n  not_string_error() : std::runtime_error(\"Cannot convert value to a string\") {}\n};\n\n// the name says it all\nclass syntax_error : public lua::exception {\n  syntax_error(const syntax_error &) = delete;\n  const syntax_error &operator=(const syntax_error &) = delete;\n\n public:\n  explicit syntax_error(state *L) : lua::exception(L) {}\n\n  syntax_error(syntax_error &&other) : lua::exception(std::move(other)) {}\n};\n\n// loadfile() encountered an error while opening/reading the file\nclass file_error : public lua::exception {\n  file_error(const file_error &) = delete;\n  const file_error &operator=(const file_error &) = delete;\n\n public:\n  explicit file_error(state *L) : lua::exception(L) {}\n\n  file_error(file_error &&other) : lua::exception(std::move(other)) {}\n};\n\n// double fault, lua encountered an error while running the error handler\n// function\nclass errfunc_error : public lua::exception {\n  errfunc_error(const errfunc_error &) = delete;\n  const errfunc_error &operator=(const errfunc_error &) = delete;\n\n public:\n  explicit errfunc_error(state *L) : lua::exception(L) {}\n\n  errfunc_error(errfunc_error &&other) : lua::exception(std::move(other)) {}\n};\n\n// a fancy wrapper around lua_State\nclass state : private std::mutex {\n  std::shared_ptr<lua_State> cobj;\n\n  // destructor for C++ objects stored as lua userdata\n  template <typename T>\n  static int destroy_cpp_object(lua_State *l) {\n    T *ptr = static_cast<T *>(lua_touserdata(l, -1));\n    assert(ptr);\n    try {\n      // throwing exceptions in destructors is a bad idea\n      // but we catch (and ignore) them, just in case\n      ptr->~T();\n    } catch (...) {}\n    return 0;\n  }\n\n  bool safe_compare(lua_CFunction trampoline, int index1, int index2);\n\n public:\n  state();\n\n  /*\n   * Lua functions come in three flavours\n   * a) functions that never throw an exception\n   * b) functions that throw only in case of a memory allocation error\n   * c) functions that throw other kinds of errors\n   *\n   * Calls to type a functions are simply forwarded to the C api.\n   * Type c functions are executed in protected mode, to make sure they don't\n   * longjmp() over us (and our destructors). This add a certain amount\n   * overhead. If you care about performance, try using the raw versions (if\n   * possible). Type b functions are not executed in protected mode atm. as\n   * memory allocation errors don't happen that often (as opposed to the type c,\n   * where the user get deliberately set a metamethod that throws an error).\n   * That means those errors will do something undefined, but hopefully that\n   * won't be a problem.\n   *\n   * Semantics are mostly identical to those of the underlying C api. Any\n   * deviation is noted in the respective functions comment. The most important\n   * difference is that instead of return values, we use exceptions to indicate\n   * errors.\tThe lua and C++ exception mechanisms are integrated. That means\n   * one can throw a C++ exception and catch it in lua (with pcall). Lua\n   * error()s can be caught in C++ as exceptions of type lua::exception.\n   */\n\n  // type a, never throw\n  int absindex(int index) throw() {\n    return index < 0 && -index <= gettop() ? gettop() + 1 + index : index;\n  }\n  bool getmetatable(int index) throw() {\n    return lua_getmetatable(cobj.get(), index);\n  }\n  int gettop() throw() { return lua_gettop(cobj.get()); }\n  void insert(int index) throw() { lua_insert(cobj.get(), index); }\n  bool isboolean(int index) throw() { return lua_isboolean(cobj.get(), index); }\n  bool isfunction(int index) throw() {\n    return lua_isfunction(cobj.get(), index);\n  }\n  bool islightuserdata(int index) throw() {\n    return lua_islightuserdata(cobj.get(), index);\n  }\n  bool isnil(int index) throw() { return lua_isnil(cobj.get(), index); }\n  bool isnone(int index) throw() { return lua_isnone(cobj.get(), index); }\n  /* isnumber conflicts with some headers on BSD systems */\n  bool _isnumber(int index) throw() { return lua_isnumber(cobj.get(), index); }\n  bool isstring(int index) throw() { return lua_isstring(cobj.get(), index); }\n  void pop(int n = 1) throw() { lua_pop(cobj.get(), n); }\n  void pushboolean(bool b) throw() { lua_pushboolean(cobj.get(), b); }\n  void pushinteger(integer n) throw() { lua_pushinteger(cobj.get(), n); }\n  void pushlightuserdata(void *p) throw() {\n    lua_pushlightuserdata(cobj.get(), p);\n  }\n  void pushnil() throw() { lua_pushnil(cobj.get()); }\n  void pushnumber(number n) throw() { lua_pushnumber(cobj.get(), n); }\n  void pushvalue(int index) throw() { lua_pushvalue(cobj.get(), index); }\n  void rawget(int index) throw() { lua_rawget(cobj.get(), index); }\n  void rawgeti(int index, int n) throw() { lua_rawgeti(cobj.get(), index, n); }\n  bool rawequal(int index1, int index2) throw() {\n    return lua_rawequal(cobj.get(), index1, index2);\n  }\n  void replace(int index) throw() { lua_replace(cobj.get(), index); }\n  // lua_setmetatable returns int, but docs don't specify it's meaning :/\n  int setmetatable(int index) throw() {\n    return lua_setmetatable(cobj.get(), index);\n  }\n  void settop(int index) throw() { return lua_settop(cobj.get(), index); }\n  bool toboolean(int index) throw() { return lua_toboolean(cobj.get(), index); }\n  integer tointeger(int index) throw() {\n    return lua_tointeger(cobj.get(), index);\n  }\n  number tonumber(int index) throw() { return lua_tonumber(cobj.get(), index); }\n  void *touserdata(int index) throw() {\n    return lua_touserdata(cobj.get(), index);\n  }\n  Type type(int index) throw() {\n    return static_cast<Type>(lua_type(cobj.get(), index));\n  }\n  // typename is a reserved word :/\n  const char *type_name(Type tp) throw() {\n    return lua_typename(cobj.get(), tp);\n  }\n  void unref(int t, int ref) throw() { return luaL_unref(cobj.get(), t, ref); }\n\n  // type b, throw only on memory allocation errors\n  // checkstack correctly throws bad_alloc, because lua_checkstack kindly\n  // informs us of that sitution\n  void checkstack(int extra);\n  const char *gsub(const char *s, const char *p, const char *r) {\n    return luaL_gsub(cobj.get(), s, p, r);\n  }\n  bool newmetatable(const char *tname) {\n    return luaL_newmetatable(cobj.get(), tname);\n  }\n  void newtable() { lua_newtable(cobj.get()); }\n  void *newuserdata(size_t size) { return lua_newuserdata(cobj.get(), size); }\n  // cpp_function can be anything that std::function can handle, everything else\n  // remains identical\n  void pushclosure(const cpp_function &fn, int n);\n  void pushfunction(const cpp_function &fn) { pushclosure(fn, 0); }\n  void pushstring(const char *s) { lua_pushstring(cobj.get(), s); }\n  void pushstring(const char *s, size_t len) {\n    lua_pushlstring(cobj.get(), s, len);\n  }\n  void pushstring(const std::string &s) {\n    lua_pushlstring(cobj.get(), s.c_str(), s.size());\n  }\n  void rawgetfield(int index, const char *k);\n  void rawset(int index) { lua_rawset(cobj.get(), index); }\n  void rawsetfield(int index, const char *k);\n  int ref(int t) { return luaL_ref(cobj.get(), t); }\n  // len receives length, if not null. Returned value may contain '\\0'\n  const char *tocstring(int index, size_t *len = nullptr) {\n    return lua_tolstring(cobj.get(), index, len);\n  }\n  // Don't use pushclosure() to create a __gc function. The problem is that lua\n  // calls them in an unspecified order, and we may end up destroying the object\n  // holding the std::function before we get a chance to call it. This pushes a\n  // function that simply calls ~T when the time comes. Only set it as __gc on\n  // userdata of type T.\n  template <typename T>\n  void pushdestructor() {\n    lua_pushcfunction(cobj.get(), &destroy_cpp_object<T>);\n  }\n\n  // type c, throw everything but the kitchen sink\n  // call() is a protected mode call, we don't allow unprotected calls\n  void call(int nargs, int nresults, int errfunc = 0);\n  void concat(int n);\n  bool equal(int index1, int index2);\n  int gc(int what, int data);\n  void getfield(int index, const char *k);\n  void getglobal(const char *name);\n  void gettable(int index);\n  bool lessthan(int index1, int index2);\n  void loadfile(const char *filename);\n  void loadstring(const char *s);\n  bool next(int index);\n  // register is a reserved word :/\n  void register_fn(const char *name, const cpp_function &f) {\n    pushfunction(f);\n    setglobal(name);\n  }\n  void setfield(int index, const char *k);\n  void setglobal(const char *name);\n  void settable(int index);\n  // lua_tostring uses nullptr to indicate conversion error, since there is no\n  // such thing as a nullptr std::string, we throw an exception. Returned value\n  // may contain '\\0'\n  std::string tostring(int index);\n  // allocate a new lua userdata of appropriate size, and create a object in it\n  // pushes the userdata on stack and returns the pointer\n  template <typename T, typename... Args>\n  T *createuserdata(Args &&...args);\n\n  using std::mutex::lock;\n  using std::mutex::try_lock;\n  using std::mutex::unlock;\n};\n\n/*\n * Can be used to automatically pop temporary values off the lua stack on exit\n * from the function/block (e.g. via an exception). It's destructor makes sure\n * the stack contains exactly n items. The constructor initializes n to\n * l.gettop()+n_, but that can be later changed with the overloaded operators.\n * It is an error if stack contains less than n elements at entry into the\n * destructor.\n *\n * Proposed stack discipline for functions is this:\n * - called function always pops parameters off the stack.\n * - if functions returns normally, it's return values are on the stack.\n * - if function throws an exception, there are no return values on the stack.\n * The last point differs from lua C api, which return an error message on the\n * stack. But since we have exception.what() for that, putting the message on\n * the stack is not necessary.\n */\nclass stack_sentry {\n  state *L;\n  int n;\n\n  stack_sentry(const stack_sentry &) = delete;\n  const stack_sentry &operator=(const stack_sentry &) = delete;\n\n public:\n  explicit stack_sentry(state &l, int n_ = 0) : L(&l), n(l.gettop() + n_) {\n    assert(n >= 0);\n  }\n\n  ~stack_sentry() {\n    assert(L->gettop() >= n);\n    L->settop(n);\n  }\n\n  void operator++() { ++n; }\n  void operator--() {\n    --n;\n    assert(n >= 0);\n  }\n  void operator+=(int n_) { n += n_; }\n  void operator-=(int n_) {\n    n -= n_;\n    assert(n >= 0);\n  }\n};\n\ntemplate <typename T, typename... Args>\nT *state::createuserdata(Args &&...args) {\n  stack_sentry s(*this);\n\n  void *t = newuserdata(sizeof(T));\n  new (t) T(std::forward<Args>(args)...);\n  ++s;\n  return static_cast<T *>(t);\n}\n}  // namespace lua\n\n#endif /* LUAMM_HH */\n"
  },
  {
    "path": "src/lua/setting.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"setting.hh\"\n\n#include <algorithm>\n#include <memory>\n#include <unordered_map>\n#include <utility>\n#include <vector>\n\nnamespace conky {\n\nnamespace {\ntypedef std::unordered_map<std::string, priv::config_setting_base *>\n    settings_map;\nusing settings_vector = std::vector<priv::config_setting_base *>;\n\n/*\n * We cannot construct this object statically, because order of object\n * construction in different modules is not defined, so config_setting_base\n * could be called before this object is constructed. Therefore, we create it on\n * the first call to config_setting_base constructor.\n */\nsettings_map *settings;\n\n/*\n * Returns the setting record corresponding to the value at the specified index.\n * If the value is not valid, returns nullptr and prints an error.\n */\npriv::config_setting_base *get_setting(lua::state &l, int index) {\n  lua::Type type = l.type(index);\n  if (type != lua::TSTRING) {\n    NORM_ERR(\"invalid setting of type '%s'\", l.type_name(type));\n    return nullptr;\n  }\n\n  const std::string &name = l.tostring(index);\n  auto iter = settings->find(name);\n  if (iter == settings->end()) {\n    NORM_ERR(\"Unknown setting '%s'\", name.c_str());\n    return nullptr;\n  }\n\n  return iter->second;\n}\n\nconst std::vector<std::string> settings_ordering{\n    \"display\",\n    \"out_to_x\",\n    \"use_xft\",\n    \"font\",\n    \"font0\",\n    \"font1\",\n    \"font2\",\n    \"font3\",\n    \"font4\",\n    \"font5\",\n    \"font6\",\n    \"font7\",\n    \"font8\",\n    \"font9\",\n    \"color0\",\n    \"color1\",\n    \"color2\",\n    \"color3\",\n    \"color4\",\n    \"color5\",\n    \"color6\",\n    \"color7\",\n    \"color8\",\n    \"color9\",\n    \"default_color\",\n    \"default_shade_color\",\n    \"default_outline_color\",\n    \"border_inner_margin\",\n    \"border_outer_margin\",\n    \"border_width\",\n    \"alignment\",\n    \"xinerama_head\",\n    \"own_window_transparent\",\n    \"own_window_class\",\n    \"own_window_title\",\n    \"own_window_type\",\n    \"own_window_hints\",\n    \"own_window_argb_value\",\n    \"own_window_argb_visual\",\n    \"own_window_colour\",\n    \"own_window\",\n    \"double_buffer\",\n    \"out_to_wayland\",\n    \"imlib_cache_size\",\n};\n\n// returns a vector of all settings, sorted in order of registration\nsettings_vector make_settings_vector() {\n  settings_vector ret;\n  ret.reserve(settings->size());\n\n  // for _some_ settings, the order matters, for others it does not. first we\n  // fill the vec with the settings which are ordered, then we add the remainder\n  // in.\n  for (auto &name : settings_ordering) {\n    if (settings->count(name) > 0) {\n      auto setting = settings->at(name);\n      ret.push_back(setting);\n    }\n  }\n  for (auto &setting : *settings) {\n    if (std::find(settings_ordering.begin(), settings_ordering.end(),\n                  setting.second->name) == settings_ordering.end()) {\n      ret.push_back(setting.second);\n    }\n  }\n  auto start = ret.begin();\n  std::advance(start, settings_ordering.size());\n  sort(start, ret.end(), &priv::config_setting_base::seq_compare);\n\n  return ret;\n}\n\n/*\n * Returns the seq_no for the new setting object. Also constructs settings\n * object if needed.\n */\nsize_t get_next_seq_no() {\n  struct settings_constructor {\n    settings_constructor() { settings = new settings_map; }\n    ~settings_constructor() {\n      delete settings;\n      settings = nullptr;\n    }\n  };\n  static settings_constructor constructor;\n\n  return settings->size();\n}\n}  // namespace\n\nnamespace priv {\n\nconfig_setting_base::config_setting_base(std::string name_)\n    : name(std::move(name_)), seq_no(get_next_seq_no()) {\n  bool inserted = settings->insert({name, this}).second;\n  if (!inserted) {\n    throw std::logic_error(\"Setting with name '\" + name +\n                           \"' already registered\");\n  }\n}\n\nvoid config_setting_base::lua_set(lua::state &l) {\n  std::lock_guard<lua::state> guard(l);\n  lua::stack_sentry s(l, -1);\n  l.checkstack(2);\n\n  l.getglobal(\"conky\");\n  l.rawgetfield(-1, \"config\");\n  l.replace(-2);\n  l.insert(-2);\n\n  l.setfield(-2, name.c_str());\n  l.pop();\n}\n\n/*\n * Performs the actual assignment of settings. Calls the setting-specific setter\n * after some sanity-checking. stack on entry: | ..., new_config_table, key,\n * value, old_value | stack on exit:  | ..., new_config_table |\n */\nvoid config_setting_base::process_setting(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -3);\n\n  config_setting_base *ptr = get_setting(l, -3);\n  if (ptr == nullptr) { return; }\n\n  ptr->lua_setter(l, init);\n  l.pushvalue(-2);\n  l.insert(-2);\n  l.rawset(-4);\n}\n\n/*\n * Called when user sets a new value for a setting\n * stack on entry: | config_table, key, value |\n * stack on exit:  | |\n */\nint config_setting_base::config__newindex(lua::state *l) {\n  lua::stack_sentry s(*l, -3);\n  l->checkstack(1);\n\n  l->getmetatable(-3);\n  l->replace(-4);\n\n  l->pushvalue(-2);\n  l->rawget(-4);\n  process_setting(*l, false);\n\n  return 0;\n}\n\n/*\n * conky.config will not be a table, but a userdata with some metamethods we do\n * this because we want to control access to the settings we use the metatable\n * for storing the settings, that means having a setting whose name starts with\n * \"__\" is a bad idea stack on entry: | ... | stack on exit:  | ...\n * new_config_table |\n */\nvoid config_setting_base::make_conky_config(lua::state &l) {\n  lua::stack_sentry s(l);\n  l.checkstack(3);\n\n  l.newuserdata(1);\n\n  l.newtable();\n  {\n    l.pushboolean(false);\n    l.rawsetfield(-2, \"__metatable\");\n\n    l.pushvalue(-1);\n    l.rawsetfield(-2, \"__index\");\n\n    l.pushfunction(&priv::config_setting_base::config__newindex);\n    l.rawsetfield(-2, \"__newindex\");\n  }\n  l.setmetatable(-2);\n\n  ++s;\n}\n}  // namespace priv\n\nvoid set_config_settings(lua::state &l) {\n  lua::stack_sentry s(l);\n  l.checkstack(6);\n\n  // Force creation of settings map. In the off chance we have no settings.\n  get_next_seq_no();\n\n  l.getglobal(\"conky\");\n  {\n    if (l.type(-1) != lua::TTABLE) {\n      throw std::runtime_error(\"conky must be a table\");\n    }\n\n    l.rawgetfield(-1, \"config\");\n    {\n      if (l.type(-1) != lua::TTABLE) {\n        throw std::runtime_error(\"conky.config must be a table\");\n      }\n\n      priv::config_setting_base::make_conky_config(l);\n      l.rawsetfield(-3, \"config\");\n\n      l.rawgetfield(-2, \"config\");\n      l.getmetatable(-1);\n      l.replace(-2);\n      {\n        const settings_vector &v = make_settings_vector();\n\n        for (auto i : v) {\n          l.pushstring(i->name);\n          l.rawgetfield(-3, i->name.c_str());\n          l.pushnil();\n          priv::config_setting_base::process_setting(l, true);\n        }\n      }\n      l.pop();\n\n      // print error messages for unknown settings\n      l.pushnil();\n      while (l.next(-2)) {\n        l.pop();\n        get_setting(l, -1);\n      }\n    }\n    l.pop();\n  }\n  l.pop();\n}\n\nvoid cleanup_config_settings(lua::state &l) {\n  lua::stack_sentry s(l);\n  l.checkstack(2);\n\n  l.getglobal(\"conky\");\n  l.rawgetfield(-1, \"config\");\n  l.replace(-2);\n\n  const settings_vector &v = make_settings_vector();\n  for (size_t i = v.size(); i > 0; --i) {\n    l.getfield(-1, v[i - 1]->name.c_str());\n    v[i - 1]->cleanup(l);\n  }\n\n  l.pop();\n}\n\n}  // namespace conky\n"
  },
  {
    "path": "src/lua/setting.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef SETTING_HH\n#define SETTING_HH\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"../logging.h\"\n#include \"luamm.hh\"\n\nnamespace conky {\n\n/*\n * Checks settings, and does initial calls to the setters.\n * Should be called after reading the user config.\n * stack on entry: | ... |\n * stack on exit:  | ... |\n */\nvoid set_config_settings(lua::state &l);\n\n/*\n * Calls cleanup functions.\n * Should be called before exit/restart.\n * stack on entry: | ... |\n * stack on exit:  | ... |\n */\nvoid cleanup_config_settings(lua::state &l);\n\ntemplate <typename T, bool is_integral = std::is_integral<T>::value,\n          bool floating_point = std::is_floating_point<T>::value,\n          bool is_enum = std::is_enum<T>::value>\nstruct lua_traits {\n  // integral is here to force the compiler to evaluate the assert at\n  // instantiation time\n  static_assert(is_integral && false,\n                \"Only specializations for enum, string, integral and floating \"\n                \"point types are available\");\n};\n\n// specialization for integral types\ntemplate <typename T>\nstruct lua_traits<T, true, false, false> {\n  static const lua::Type type = lua::TNUMBER;\n  typedef lua::integer Type;\n\n  static inline std::pair<Type, bool> convert(lua::state &l, int index,\n                                              const std::string &) {\n    return {l.tointeger(index), true};\n  }\n};\n\n// specialization for floating point types\ntemplate <typename T>\nstruct lua_traits<T, false, true, false> {\n  static const lua::Type type = lua::TNUMBER;\n  typedef lua::number Type;\n\n  static inline std::pair<Type, bool> convert(lua::state &l, int index,\n                                              const std::string &) {\n    return {l.tonumber(index), true};\n  }\n};\n\n// specialization for std::string\ntemplate <>\nstruct lua_traits<std::string, false, false, false> {\n  static const lua::Type type = lua::TSTRING;\n  typedef std::string Type;\n\n  static inline std::pair<Type, bool> convert(lua::state &l, int index,\n                                              const std::string &) {\n    return {l.tostring(index), true};\n  }\n};\n\n// specialization for bool\ntemplate <>\nstruct lua_traits<bool, true, false, false> {\n  static const lua::Type type = lua::TBOOLEAN;\n  typedef bool Type;\n\n  static inline std::pair<Type, bool> convert(lua::state &l, int index,\n                                              const std::string &) {\n    return {l.toboolean(index), true};\n  }\n};\n\n// specialization for enums\n// to use this, one first has to declare string<->value map\ntemplate <typename T>\nstruct lua_traits<T, false, false, true> {\n  static const lua::Type type = lua::TSTRING;\n  typedef T Type;\n\n  typedef std::initializer_list<std::pair<std::string, T>> Map;\n  static Map map;\n\n  static std::pair<T, bool> convert(lua::state &l, int index,\n                                    const std::string &name) {\n    std::string val = l.tostring(index);\n\n    for (auto i = map.begin(); i != map.end(); ++i) {\n      if (i->first == val) return {i->second, true};\n    }\n\n    std::string msg = \"Invalid value '\" + val + \"' for setting '\" + name +\n                      \"'. Valid values are: \";\n    for (auto i = map.begin(); i != map.end(); ++i) {\n      if (i != map.begin()) msg += \", \";\n      msg += \"'\" + i->first + \"'\";\n    }\n    msg += \".\";\n    NORM_ERR(\"%s\", msg.c_str());\n\n    return {T(), false};\n  }\n};\n\nnamespace priv {\nclass config_setting_base {\n private:\n  static void process_setting(lua::state &l, bool init);\n  static int config__newindex(lua::state *l);\n  static void make_conky_config(lua::state &l);\n\n  // copying is a REALLY bad idea\n  config_setting_base(const config_setting_base &) = delete;\n  config_setting_base &operator=(const config_setting_base &) = delete;\n\n protected:\n  /*\n   * Set the setting, if the value is sane\n   * stack on entry: | ... potential_new_value old_value |\n   * stack on exit:  | ... real_new_value |\n   * real_new_value can be the old value if the new value doesn't make sense\n   */\n  virtual void lua_setter(lua::state &l, bool init) = 0;\n\n  /*\n   * Called on exit/restart.\n   * stack on entry: | ... new_value |\n   * stack on exit:  | ... |\n   */\n  virtual void cleanup(lua::state &l) { l.pop(); }\n\n public:\n  const std::string name;\n  const size_t seq_no;\n\n  static bool seq_compare(const config_setting_base *a,\n                          const config_setting_base *b) {\n    return a->seq_no < b->seq_no;\n  }\n\n  explicit config_setting_base(std::string name_);\n  virtual ~config_setting_base() {}\n\n  /*\n   * Set the setting manually.\n   * stack on entry: | ... new_value |\n   * stack on exit:  | ... |\n   */\n  void lua_set(lua::state &l);\n\n  friend void conky::set_config_settings(lua::state &l);\n  friend void conky::cleanup_config_settings(lua::state &l);\n};\n}  // namespace priv\n\n// If you need some very exotic setting, derive it from this class. Otherwise,\n// scroll down.\ntemplate <typename T>\nclass config_setting_template : public priv::config_setting_base {\n public:\n  explicit config_setting_template(const std::string &name_)\n      : config_setting_base(name_) {}\n\n  // get the value of the setting as a C++ type\n  T get(lua::state &l);\n\n protected:\n  /*\n   * Convert the value into a C++ type.\n   * stack on entry: | ... value |\n   * stack on exit:  | ... |\n   */\n  virtual T getter(lua::state &l) = 0;\n};\n\ntemplate <typename T>\nT config_setting_template<T>::get(lua::state &l) {\n  std::lock_guard<lua::state> guard(l);\n  lua::stack_sentry s(l);\n  l.checkstack(2);\n\n  l.getglobal(\"conky\");\n  l.getfield(-1, \"config\");\n  l.replace(-2);\n\n  l.getfield(-1, name.c_str());\n  l.replace(-2);\n\n  return getter(l);\n}\n\n/*\n * Declares a setting <name> in the conky.config table.\n * Getter function is used to translate the lua value into C++. It receives the\n * value on the lua stack. It should pop it and return the C++ value. In case\n * the value is nil, it should return a predefined default value. Translation\n * into basic types works with the help of lua_traits template above The\n * lua_setter function is called when someone tries to set the value.  It\n * receives the new and the old value on the stack (old one is on top). It\n * should return the new value for the setting. It doesn't have to be the value\n * the user set, if e.g. the value doesn't make sense. The second parameter is\n * true if the assignment occurs during the initial parsing of the config file,\n * and false afterwards. Some settings obviously cannot be changed (easily?)\n * when conky is running, but some (e.g. x/y position of the window) can.\n */\ntemplate <typename T, typename Traits = lua_traits<T>>\nclass simple_config_setting : public config_setting_template<T> {\n  typedef config_setting_template<T> Base;\n\n public:\n  explicit simple_config_setting(const std::string &name_,\n                                 const T &default_value_ = T(),\n                                 bool modifiable_ = false)\n      : Base(name_), default_value(default_value_), modifiable(modifiable_) {}\n  simple_config_setting(const char *name_, const T &default_value_ = T(),\n                        bool modifiable_ = false)\n      : Base(std::string(name_)),\n        default_value(default_value_),\n        modifiable(modifiable_) {}\n\n protected:\n  const T default_value;\n  const bool modifiable;\n\n  virtual std::pair<typename Traits::Type, bool> do_convert(lua::state &l,\n                                                            int index);\n  virtual void lua_setter(lua::state &l, bool init);\n\n  virtual T getter(lua::state &l) {\n    lua::stack_sentry s(l, -1);\n    auto ret = do_convert(l, -1);\n    l.pop();\n\n    // setter function should make sure the value is valid\n    assert(ret.second);\n\n    return ret.first;\n  }\n};\n\ntemplate <typename T, typename Traits>\nstd::pair<typename Traits::Type, bool>\nsimple_config_setting<T, Traits>::do_convert(lua::state &l, int index) {\n  if (l.isnil(index)) return {default_value, true};\n\n  if (l.type(index) != Traits::type) {\n    NORM_ERR(\n        \"Invalid value of type '%s' for setting '%s'. \"\n        \"Expected value of type '%s'.\",\n        l.type_name(l.type(index)), Base::name.c_str(),\n        l.type_name(Traits::type));\n    return {default_value, false};\n  }\n\n  return Traits::convert(l, index, Base::name);\n}\n\ntemplate <typename T, typename Traits>\nvoid simple_config_setting<T, Traits>::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  bool ok = true;\n  if (!init && !modifiable) {\n    NORM_ERR(\"Setting '%s' is not modifiable\", Base::name.c_str());\n    ok = false;\n  }\n\n  if (ok && do_convert(l, -2).second) {\n    l.pop();\n  } else {\n    l.replace(-2);\n  }\n  ++s;\n}\n\ntemplate <typename Signed1, typename Signed2>\nbool between(Signed1 value, Signed2 min,\n             typename std::enable_if<std::is_signed<Signed2>::value,\n                                     Signed2>::type max) {\n  return value >= min && value <= max;\n}\n\ntemplate <typename Signed1, typename Unsigned2>\nbool between(Signed1 value, Unsigned2 min,\n             typename std::enable_if<std::is_unsigned<Unsigned2>::value,\n                                     Unsigned2>::type max) {\n  return value >= 0 &&\n         static_cast<typename std::make_unsigned<Signed1>::type>(value) >=\n             min &&\n         static_cast<typename std::make_unsigned<Signed1>::type>(value) <= max;\n}\n\n// Just like simple_config_setting, except that in only accepts value in the\n// [min, max] range\ntemplate <typename T, typename Traits = lua_traits<T>>\nclass range_config_setting : public simple_config_setting<T, Traits> {\n  typedef simple_config_setting<T, Traits> Base;\n\n  const T min;\n  const T max;\n\n public:\n  explicit range_config_setting(const std::string &name_,\n                                const T &min_ = std::numeric_limits<T>::min(),\n                                const T &max_ = std::numeric_limits<T>::max(),\n                                const T &default_value_ = T(),\n                                bool modifiable_ = false)\n      : Base(name_, default_value_, modifiable_), min(min_), max(max_) {\n    assert(min <= Base::default_value && Base::default_value <= max);\n  }\n\n protected:\n  virtual std::pair<typename Traits::Type, bool> do_convert(lua::state &l,\n                                                            int index) {\n    auto ret = Base::do_convert(l, index);\n    if (ret.second && !between(ret.first, min, max)) {\n      NORM_ERR(\"Value is out of range for setting '%s'\", Base::name.c_str());\n      // we ignore out-of-range values. an alternative would be to clamp them.\n      // do we want to do that?\n      ret.second = false;\n    }\n    return ret;\n  }\n};\n\n}  // namespace conky\n\n#endif /* SETTING_HH */\n"
  },
  {
    "path": "src/lua/x11-settings.cc",
    "content": "#include \"x11-settings.h\"\n\n#include \"../output/x11.h\"\n\n#include \"../conky-imlib2.h\"\n\n#include <X11/Xlib.h>\n\nconky::simple_config_setting<std::string> display_name(\"display\", std::string(),\n                                                       false);\n\nnamespace priv {\nvoid out_to_x_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (init && do_convert(l, -1).first) { init_x11(); }\n\n  ++s;\n}\n\nvoid out_to_x_setting::cleanup(lua::state &l) {\n  lua::stack_sentry s(l, -1);\n\n  if (do_convert(l, -1).first) { deinit_x11(); }\n\n  l.pop();\n}\n\n#ifdef BUILD_XDBE\nbool use_xdbe_setting::set_up(lua::state &l) {\n  // double_buffer makes no sense when not drawing to X\n  if (!out_to_x.get(l) || !display || !window.window) { return false; }\n\n  int major, minor;\n\n  if (XdbeQueryExtension(display, &major, &minor) == 0) {\n    NORM_ERR(\"No compatible double buffer extension found\");\n    return false;\n  }\n\n  window.back_buffer =\n      XdbeAllocateBackBufferName(display, window.window, XdbeBackground);\n  if (window.back_buffer != None) {\n    window.drawable = window.back_buffer;\n  } else {\n    NORM_ERR(\"Failed to allocate back buffer\");\n    return false;\n  }\n\n  XFlush(display);\n  return true;\n}\n\nvoid use_xdbe_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (init && do_convert(l, -1).first) {\n    if (!set_up(l)) {\n      l.pop();\n      l.pushboolean(false);\n    }\n\n    NORM_ERR(\"drawing to %s buffer\",\n             do_convert(l, -1).first ? \"double\" : \"single\");\n  }\n\n  ++s;\n}\n\n#else\nbool use_xpmdb_setting::set_up(lua::state &l) {\n  // double_buffer makes no sense when not drawing to X\n  if (!out_to_x.get(l)) return false;\n\n  window.back_buffer =\n      XCreatePixmap(display, window.window, window.geometry.width() + 1, window.geometry.height() + 1,\n                    DefaultDepth(display, screen));\n  if (window.back_buffer != None) {\n    window.drawable = window.back_buffer;\n  } else {\n    NORM_ERR(\"Failed to allocate back buffer\");\n    return false;\n  }\n\n  XFlush(display);\n  return true;\n}\n\nvoid use_xpmdb_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (init && do_convert(l, -1).first) {\n    if (!set_up(l)) {\n      l.pop();\n      l.pushboolean(false);\n    }\n\n    NORM_ERR(\"drawing to %s buffer\",\n             do_convert(l, -1).first ? \"double\" : \"single\");\n  }\n\n  ++s;\n}\n#endif\n}  // namespace priv\n\nconky::simple_config_setting<int> head_index(\"xinerama_head\", 0, true);\npriv::out_to_x_setting out_to_x;\n\n#ifdef BUILD_XFT\nconky::simple_config_setting<bool> use_xft(\"use_xft\", false, false);\n#endif\n\nconky::simple_config_setting<bool> forced_redraw(\"forced_redraw\", false, false);\n\n#ifdef BUILD_XDBE\npriv::use_xdbe_setting use_xdbe;\n#else\npriv::use_xpmdb_setting use_xpmdb;\n#endif\n"
  },
  {
    "path": "src/lua/x11-settings.h",
    "content": "#ifndef CONKY_X11_SETTINGS_H\n#define CONKY_X11_SETTINGS_H\n\n#include \"setting.hh\"\n\nextern conky::simple_config_setting<std::string> display_name;\n\nnamespace priv {\nclass out_to_x_setting : public conky::simple_config_setting<bool> {\n  typedef conky::simple_config_setting<bool> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n  virtual void cleanup(lua::state &l);\n\n public:\n  out_to_x_setting() : Base(\"out_to_x\", true, false) {}\n};\n\n#ifdef BUILD_XDBE\nclass use_xdbe_setting : public conky::simple_config_setting<bool> {\n  typedef conky::simple_config_setting<bool> Base;\n\n  bool set_up(lua::state &l);\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n\n public:\n  use_xdbe_setting() : Base(\"double_buffer\", false, false) {}\n};\n\n#else\nclass use_xpmdb_setting : public conky::simple_config_setting<bool> {\n  typedef conky::simple_config_setting<bool> Base;\n\n  bool set_up(lua::state &l);\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n\n public:\n  use_xpmdb_setting() : Base(\"double_buffer\", false, false) {}\n};\n#endif\n} /* namespace priv */\n\nextern priv::out_to_x_setting out_to_x;\n\n#ifdef BUILD_XFT\nextern conky::simple_config_setting<bool> use_xft;\n#endif\n\n#ifdef BUILD_XDBE\nextern priv::use_xdbe_setting use_xdbe;\n#else\nextern priv::use_xpmdb_setting use_xpmdb;\n#endif\n\n#endif /* CONKY_X11_SETTINGS_H */\n"
  },
  {
    "path": "src/macros.h",
    "content": "#ifndef _CONKY_MACROS_H_\n#define _CONKY_MACROS_H_\n\n#include \"logging.h\"\n\n// LIKELY and UNLIKELY can be used to mark if statement branches as likely (hot)\n// or unlikely (cold). They help compiler rearange code to optimize hot paths\n// and can improve perfomance when used on architectures with support for branch\n// prediction.\n\n#if defined(__clang__) || defined(__GNUC__)\n#define LIKELY(x) __builtin_expect(!!(x), 1)\n#define UNLIKELY(x) __builtin_expect(!!(x), 0)\n#else\n#define LIKELY(x) (!!(x))\n#define UNLIKELY(x) (!!(x))\n#endif  // defined(__clang__) || defined(__GNUC__)\n\n// Assertion with custom error message.\n#define assert_print(cond, error) \\\n  (LIKELY(cond) ? static_cast<void>(0) : CRIT_ERR(error))\n\n// Assumptions are contracts which are expected to be upheld by the developer\n// 100% of the time. They help the compiler significantly optimize code, but\n// cause UB if not upheld. As such, they are not a substitute for proper error\n// handling or assertions.\n//\n// They throw CRIT_ERR in debug builds.\n\n#ifdef NDEBUG\n#ifdef _MSC_VER\n#define ASSUME(cond) __assume(cond)\n#elif defined(__clang__)\n#define ASSUME(cond) __builtin_assume(cond)\n#elif defined(__GNUC__)\n#define ASSUME(cond) ((cond) ? static_cast<void>(0) : __builtin_unreachable())\n#else /* other compilers */\n#define ASSUME(cond) static_cast<void>(!!(cond))\n#endif /* compiler selection */\n#else  /* DEBUG */\n#define ASSUME(cond) assert_print(cond, \"assertion \" #cond \" failed\")\n#endif /* NDEBUG */\n\n// UNREACHABLE is used to mark unreachable part of code execution which helps\n// the compiler optimize code, but also causes UB if marked position in code is\n// actually reached.\n//\n// It throws CRIT_ERR in debug builds.\n\n#ifdef NDEBUG\n#ifdef __GNUC__  // GCC, Clang, ICC\n#define UNREACHABLE() (__builtin_unreachable())\n#elif defined(_MSC_VER)  // MSVC\n#define UNREACHABLE() (__assume(false))\n#else /* other compilers */\n// unreachable_impl must be emitted in a separated TU if used from C code due to\n// the difference in rule for inline functions in C. Conky is compiled by a C++\n// compiler though so it's fine to place it here.\n[[noreturn]] inline void unreachable_impl() {}\n#define UNREACHABLE() (unreachable_impl())\n#endif /* compiler selection */\n#else  /* DEBUG */\n#define UNREACHABLE() (CRIT_ERR(\"reached unreachable\"))\n#endif /* NDEBUG */\n\n#endif /* _CONKY_MACROS_H_ */"
  },
  {
    "path": "src/main.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <getopt.h>\n#include <cstdio>\n#include <iostream>\n\n#include \"build.h\"\n#include \"config.h\"\n#include \"conky.h\"\n#include \"output/display-output.hh\"\n#include \"lua/lua-config.hh\"\n\n#ifdef BUILD_X11\n#include \"output/x11.h\"\n#endif /* BUILD_X11 */\n\n#ifdef BUILD_CURL\n#include \"data/network/ccurl_thread.h\"\n#endif /* BUILD_CURL */\n\n#if defined(__linux__)\n#include \"data/os/linux.h\"\n#endif /* Linux */\n\n#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\n#include \"data/os/freebsd.h\"\n#endif /* FreeBSD */\n\n#if defined(__NetBSD__)\n#include \"data/os/netbsd.h\"\n#endif /* NetBSD */\n\n#if defined(__OpenBSD__)\n#include \"data/os/openbsd.h\"\n#endif /* OpenBSD */\n\n#if defined(__HAIKU__)\n#include \"data/os/haiku.h\"\n#endif /* Haiku */\n\n#ifdef BUILD_BUILTIN_CONFIG\n#include \"defconfig.h\"\n\n#ifdef BUILD_OLD_CONFIG\n#include \"convertconf.h\"\n#endif /* BUILD_OLD_CONFIG */\n#endif /* BUILD_BUILTIN_CONFIG */\n\nstatic void print_short_version() { std::cout << VERSION << std::endl; }\n\nstatic void print_version() {\n  std::cout << _(PACKAGE_NAME \" \" VERSION \" compiled for \" BUILD_ARCH\n                              \"\\n\"\n                              \"\\nCompiled in features:\\n\\n\"\n                              \"System config file: \" SYSTEM_CONFIG_FILE\n                              \"\\n\"\n                              \"Package library path: \" PACKAGE_LIBDIR \"\\n\\n\")\n            << _(\"\\n General:\\n\")\n#ifdef HAVE_OPENMP\n            << _(\"  * OpenMP\\n\")\n#endif /* HAVE_OPENMP */\n#ifdef BUILD_MATH\n            << _(\"  * math\\n\")\n#endif /* BUILD_MATH */\n#ifdef BUILD_HDDTEMP\n            << _(\"  * hddtemp\\n\")\n#endif /* BUILD_HDDTEMP */\n#ifdef BUILD_PORT_MONITORS\n            << _(\"  * portmon\\n\")\n#endif /* BUILD_PORT_MONITORS */\n#ifdef BUILD_HTTP\n            << _(\"  * HTTP\\n\")\n#endif /* BUILD_HTTP */\n#ifdef BUILD_IPV6\n            << _(\"  * IPv6\\n\")\n#endif /* BUILD_IPV6 */\n#ifdef BUILD_IRC\n            << _(\"  * IRC\\n\")\n#endif\n#ifdef BUILD_CURL\n            << _(\"  * Curl\\n\")\n#endif /* BUILD_CURL */\n#ifdef BUILD_RSS\n            << _(\"  * RSS\\n\")\n#endif /* BUILD_RSS */\n#ifdef BUILD_ICAL\n            << _(\"  * ICal\\n\")\n#endif /* BUILD_ICAL */\n#ifdef BUILD_ICONV\n            << _(\"  * iconv\\n\")\n#endif /* BUILD_ICONV */\n#ifdef BUILD_MYSQL\n            << _(\"  * MySQL\\n\")\n#endif /* BUILD_MYSQL */\n#ifdef BUILD_WLAN\n            << _(\"  * wireless\\n\")\n#endif /* BUILD_WLAN */\n#ifdef BUILD_IBM\n            << _(\"  * support for IBM/Lenovo notebooks\\n\")\n#endif /* BUILD_IBM */\n#ifdef BUILD_NVIDIA\n            << _(\"  * nvidia\\n\")\n#endif /* BUILD_NVIDIA */\n#ifdef BUILD_BUILTIN_CONFIG\n            << _(\"  * builtin default configuration\\n\")\n#endif /* BUILD_BUILTIN_CONFIG */\n#ifdef BUILD_OLD_CONFIG\n            << _(\"  * old configuration syntax\\n\")\n#endif /* BUILD_OLD_CONFIG */\n#ifdef BUILD_IMLIB2\n            << _(\"  * Imlib2\\n\")\n#endif /* BUILD_IMLIB2 */\n#ifdef HAVE_SOUNDCARD_H\n            << _(\"  * OSS mixer support\\n\")\n#endif /* HAVE_SOUNDCARD_H */\n#ifdef BUILD_MIXER_ALSA\n            << _(\"  * ALSA mixer support\\n\")\n#endif /* BUILD_MIXER_ALSA */\n#ifdef BUILD_APCUPSD\n            << _(\"  * apcupsd\\n\")\n#endif /* BUILD_APCUPSD */\n#ifdef BUILD_IOSTATS\n            << _(\"  * iostats\\n\")\n#endif /* BUILD_IOSTATS */\n#ifdef BUILD_NCURSES\n            << _(\"  * ncurses\\n\")\n#endif /* BUILD_NCURSES */\n#ifdef BUILD_I18N\n            << _(\"  * Internationalization support\\n\")\n#endif\n#ifdef BUILD_PULSEAUDIO\n            << _(\"  * PulseAudio\\n\")\n#endif /* BUIL_PULSEAUDIO */\n#ifdef DEBUG\n            << _(\"  * Debugging extensions\\n\")\n#endif\n#if defined BUILD_LUA_CAIRO || defined BUILD_LUA_IMLIB2 || BUILD_LUA_RSVG || BUILD_LUA_TEXT\n            << _(\"\\n Lua bindings:\\n\")\n#endif\n#ifdef BUILD_LUA_CAIRO\n            << _(\"  * Cairo\\n\")\n#endif /* BUILD_LUA_CAIRO */\n#ifdef BUILD_LUA_IMLIB2\n            << _(\"  * Imlib2\\n\")\n#endif /* BUILD_LUA_IMLIB2 */\n#ifdef BUILD_LUA_RSVG\n            << _(\"  * RSVG\\n\")\n#endif /* BUILD_LUA_RSVG */\n#ifdef BUILD_LUA_TEXT\n            << _(\"  * TEXT\\n\")\n#endif /* BUILD_LUA_RSVG */\n#ifdef BUILD_X11\n            << _(\" X11:\\n\")\n#ifdef BUILD_XDAMAGE\n            << _(\"  * Xdamage extension\\n\")\n#endif /* BUILD_XDAMAGE */\n#ifdef BUILD_XINERAMA\n            << _(\"  * Xinerama extension (virtual display)\\n\")\n#endif /* BUILD_XINERAMA */\n#ifdef BUILD_XSHAPE\n            << _(\"  * Xshape extension (click through)\\n\")\n#endif /* BUILD_XSHAPE */\n#ifdef BUILD_XDBE\n            << _(\"  * XDBE (double buffer extension)\\n\")\n#endif /* BUILD_XDBE */\n#ifdef BUILD_XFT\n            << _(\"  * Xft\\n\")\n#endif /* BUILD_XFT */\n#ifdef BUILD_XINPUT\n            << _(\"  * Xinput\\n\")\n#endif /* BUILD_XINPUT */\n#ifdef BUILD_ARGB\n            << _(\"  * ARGB visual\\n\")\n#endif /* BUILD_ARGB */\n#ifdef OWN_WINDOW\n            << _(\"  * Own window\\n\")\n#endif\n#ifdef BUILD_MOUSE_EVENTS\n            << _(\"  * Mouse events\\n\")\n#endif /* BUILD_MOUSE_EVENTS */\n#endif /* BUILD_X11 */\n#ifdef BUILD_WAYLAND\n            << _(\" Wayland:\\n\")\n#ifdef BUILD_ARGB\n            << _(\"  * ARGB visual\\n\")\n#endif /* BUILD_ARGB */\n#ifdef BUILD_MOUSE_EVENTS\n            << _(\"  * Mouse events\\n\")\n#endif /* BUILD_MOUSE_EVENTS */\n#endif /* BUILD_WAYLAND */\n#if defined BUILD_AUDACIOUS || defined BUILD_CMUS || defined BUILD_MPD || \\\n    defined BUILD_MOC || defined BUILD_XMMS2\n            << _(\"\\n Music detection:\\n\")\n#endif\n#ifdef BUILD_AUDACIOUS\n            << _(\"  * Audacious\\n\")\n#endif /* BUILD_AUDACIOUS */\n#ifdef BUILD_CMUS\n            << _(\"  * CMUS\\n\")\n#endif /* BUILD_CMUS */\n#ifdef BUILD_MPD\n            << _(\"  * MPD\\n\")\n#endif /* BUILD_MPD */\n#ifdef BUILD_MOC\n            << _(\"  * MOC\\n\")\n#endif /* BUILD_MOC */\n#ifdef BUILD_XMMS2\n            << _(\"  * XMMS2\\n\")\n#endif /* BUILD_XMMS2 */\n            << _(\"\\n Default values:\\n\") << \"  * Netdevice: \" DEFAULTNETDEV \"\\n\"\n            << \"  * Local configfile: \" CONFIG_FILE \"\\n\"\n#ifdef BUILD_I18N\n            << \"  * Localedir: \" LOCALE_DIR \"\\n\"\n#endif /* BUILD_I18N */\n#ifdef BUILD_HTTP\n            << \"  * HTTP-port: \" << HTTPPORT << \"\\n\"\n#endif /* BUILD_HTTP */\n            << \"  * Maximum netdevices: \" << MAX_NET_INTERFACES << \"\\n\"\n            << \"  * Maximum text size: \" << MAX_USER_TEXT_DEFAULT << \"\\n\"\n            << \"  * Size text buffer: \" << DEFAULT_TEXT_BUFFER_SIZE << \"\\n\";\n}\n\nstatic void print_help(const char *prog_name) {\n  printf(\"Usage: %s [OPTION]...\\n\" PACKAGE_NAME\n         \" is a system monitor that renders text on desktop or to own \"\n         \"transparent\\n\"\n         \"window. Command line options will override configurations defined in \"\n         \"config\\n\"\n         \"file.\\n\"\n         \"   -v, --version             version with build details\\n\"\n         \"   -V, --short-version       short version\\n\"\n         \"   -q, --quiet               quiet mode\\n\"\n         \"   -D, --debug               increase debugging output, ie. -DD for \"\n         \"more debugging\\n\"\n         \"   -c, --config=FILE         config file to load\\n\"\n#ifdef BUILD_BUILTIN_CONFIG\n         \"   -C, --print-config        print the builtin default config to \"\n         \"stdout\\n\"\n         \"                             e.g. 'conky -C > ~/.conkyrc' will \"\n         \"create a new default config\\n\"\n#endif\n         \"   -d, --daemonize           daemonize, fork to background\\n\"\n         \"   -h, --help                help\\n\"\n#ifdef BUILD_X11\n         \"   -a, --alignment=ALIGNMENT text alignment on screen, \"\n         \"{top,bottom,middle}_{left,right,middle}\\n\"\n         \"   -X, --display=DISPLAY     X11 display to use\\n\"\n         \"   -m, --xinerama-head=N     Xinerama monitor index (0=first)\\n\"\n         \"   -f, --font=FONT           font to use\\n\"\n#ifdef OWN_WINDOW\n         \"   -o, --own-window          create own window to draw\\n\"\n#endif\n         \"   -b, --double-buffer       double buffer (prevents flickering)\\n\"\n         \"   -w, --window-id=WIN_ID    window id to draw\\n\"\n         \"   -x X                      x position\\n\"\n         \"   -y Y                      y position\\n\"\n#endif /* BUILD_X11 */\n         \"   -t, --text=TEXT           text to render, remember single quotes, \"\n         \"like -t '$uptime'\\n\"\n         \"   -u, --interval=SECS       update interval\\n\"\n         \"   -i COUNT                  number of times to update \" PACKAGE_NAME\n         \" (and quit)\\n\"\n         \"   -p, --pause=SECS          pause for SECS seconds at startup \"\n         \"before doing anything\\n\"\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n    defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)\n         \"   -U, --unique              only one conky process can be created\\n\"\n#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */\n         , prog_name);\n}\n\ninline void reset_optind() {\n#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n    defined(__OpenBSD__) || defined(__DragonFly__)\n  optind = optreset = 1;\n#else\n  optind = 0;\n#endif\n}\n\nint main(int argc, char **argv) {\n#ifdef BUILD_I18N\n  setlocale(LC_ALL, \"\");\n  bindtextdomain(PACKAGE_NAME, LOCALE_DIR);\n  textdomain(PACKAGE_NAME);\n#endif\n  argc_copy = argc;\n  argv_copy = argv;\n  g_sigterm_pending = 0;\n  g_sighup_pending = 0;\n  g_sigusr2_pending = 0;\n\n  bool unique_process = false;\n\n#ifdef BUILD_CURL\n  struct curl_global_initializer {\n    curl_global_initializer() {\n      if (curl_global_init(CURL_GLOBAL_ALL)) {\n        NORM_ERR(\n            \"curl_global_init() failed, you may not be able to use curl \"\n            \"variables\");\n      }\n    }\n    ~curl_global_initializer() { curl_global_cleanup(); }\n  };\n  curl_global_initializer curl_global;\n#endif\n\n  /* handle command line parameters that don't change configs */\n#ifdef BUILD_X11\n  if (!setlocale(LC_CTYPE, \"\")) {\n    NORM_ERR(\"Can't set the specified locale!\\nCheck LANG, LC_CTYPE, LC_ALL.\");\n  }\n#endif /* BUILD_X11 */\n  while (1) {\n    int c = getopt_long(argc, argv, getopt_string, longopts, nullptr);\n\n    if (c == -1) { break; }\n\n    switch (c) {\n      case 'D':\n        global_debug_level++;\n        break;\n      case 'v':\n        print_version();\n        return EXIT_SUCCESS;\n      case 'V':\n        print_short_version();\n        return EXIT_SUCCESS;\n      case 'c':\n        current_config = optarg;\n        break;\n      case 'q':\n        if (freopen(\"/dev/null\", \"w\", stderr) == nullptr) {\n          CRIT_ERR(\"could not open /dev/null as stderr!\");\n        }\n        break;\n      case 'h':\n        print_help(argv[0]);\n        return 0;\n#ifdef BUILD_BUILTIN_CONFIG\n      case 'C':\n        std::cout << defconfig;\n        return 0;\n#endif\n#ifdef BUILD_X11\n      case 'w':\n        window.window = strtol(optarg, nullptr, 0);\n        break;\n#endif /* BUILD_X11 */\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n    defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)\n      case 'U':\n        unique_process = true;\n        break;\n#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */\n      case '?':\n        return EXIT_FAILURE;\n    }\n  }\n\n#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \\\n    defined(__HAIKU__) || defined(__NetBSD__) || defined(__OpenBSD__)\n  if (unique_process && is_conky_already_running()) {\n    NORM_ERR(\"already running\");\n    return 0;\n  }\n#endif /* Linux || FreeBSD || Haiku || NetBSD || OpenBSD */\n\n  try {\n    set_current_config();\n\n    state = std::make_unique<lua::state>();\n\n    conky::export_symbols(*state);\n\n    setup_inotify();\n\n    initialisation(argc, argv);\n\n    first_pass = 0; /* don't ever call fork() again */\n\n    main_loop();\n  } catch (fork_throw &e) {\n    return EXIT_SUCCESS;\n  } catch (unknown_arg_throw &e) {\n    return EXIT_FAILURE;\n  } catch (obj_create_error &e) {\n    std::cerr << e.what() << std::endl;\n    clean_up();\n    return EXIT_FAILURE;\n  } catch (std::exception &e) {\n    std::cerr << PACKAGE_NAME \": \" << e.what() << std::endl;\n    return EXIT_FAILURE;\n  }\n\n  conky::shutdown_display_outputs();\n\n#ifdef BSD_COMMON\n  bsdcommon::deinit_kvm();\n#endif\n\n//TODO(gmb): Move this to bsdcommon and remove external kd.\n#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)\n  kvm_close(kd);\n#endif\n\n#ifdef LEAKFREE_NCURSES\n  _nc_free_and_exit(0);  // hide false memleaks\n#endif\n  return 0;\n}\n"
  },
  {
    "path": "src/mouse-events.cc",
    "content": "/*\n * mouse_events.cc: conky support for mouse events\n *\n * Copyright (C) 2020 Tin Svagelj tin.svagelj@live.com\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <https://www.gnu.org/licenses/>.\n *\n */\n\n#include \"mouse-events.h\"\n\n#include <array>\n#include <ctime>\n#include <string>\n#include <type_traits>\n\n#include \"logging.h\"\n\n#ifdef BUILD_XINPUT\n#include <cstring>\n#endif\n\nextern \"C\" {\n#include <lua.h>\n\n#include <X11/Xatom.h>\n#include <X11/Xlib.h>\n#include <X11/Xutil.h>\n}\n\nnamespace conky {\n\n#ifdef BUILD_MOUSE_EVENTS\n/* Lua helper functions */\nvoid push_table_value(lua_State *L, std::string key, std::string value) {\n  lua_pushstring(L, key.c_str());\n  lua_pushstring(L, value.c_str());\n  lua_settable(L, -3);\n}\n\ntemplate <typename T>\ntypename std::enable_if<std::is_integral<T>::value>::type push_table_value(\n    lua_State *L, std::string key, T value) {\n  lua_pushstring(L, key.c_str());\n  lua_pushinteger(L, value);\n  lua_settable(L, -3);\n}\n\ntemplate <typename T>\ntypename std::enable_if<std::is_floating_point<T>::value>::type\npush_table_value(lua_State *L, std::string key, T value) {\n  lua_pushstring(L, key.c_str());\n  lua_pushnumber(L, value);\n  lua_settable(L, -3);\n}\n\nvoid push_table_value(lua_State *L, std::string key, bool value) {\n  lua_pushstring(L, key.c_str());\n  lua_pushboolean(L, value);\n  lua_settable(L, -3);\n}\n\ntemplate <std::size_t N>\nvoid push_bitset(lua_State *L, std::bitset<N> it,\n                 std::array<std::string, N> labels) {\n  lua_newtable(L);\n  for (std::size_t i = 0; i < N; i++)\n    push_table_value(L, labels[i], it.test(i));\n}\n\nconst std::array<std::string, 6> mod_names = {{\n    \"shift\",\n    \"control\",\n    \"alt\",\n    \"super\",\n    \"caps_lock\",\n    \"num_lock\",\n}};\n\nvoid push_mods(lua_State *L, modifier_state_t mods) {\n  lua_pushstring(L, \"mods\");\n  push_bitset(L, mods, mod_names);\n  lua_settable(L, -3);\n}\n\n// Returns ms since Epoch.\ninline std::size_t current_time_ms() {\n  struct timespec spec;\n  clock_gettime(CLOCK_REALTIME, &spec);\n  return static_cast<std::size_t>(static_cast<std::uint64_t>(spec.tv_sec) *\n                                      1'000 +\n                                  spec.tv_nsec / 1'000'000);\n}\n\nvoid push_table_value(lua_State *L, std::string key, mouse_event_t type) {\n  lua_pushstring(L, key.c_str());\n  switch (type) {\n    case mouse_event_t::PRESS:\n      lua_pushstring(L, \"button_down\");\n      break;\n    case mouse_event_t::RELEASE:\n      lua_pushstring(L, \"button_up\");\n      break;\n    case mouse_event_t::SCROLL:\n      lua_pushstring(L, \"mouse_scroll\");\n      break;\n    case mouse_event_t::MOVE:\n      lua_pushstring(L, \"mouse_move\");\n      break;\n    case mouse_event_t::AREA_ENTER:\n      lua_pushstring(L, \"mouse_enter\");\n      break;\n    case mouse_event_t::AREA_LEAVE:\n      lua_pushstring(L, \"mouse_leave\");\n      break;\n    default:\n      lua_pushnil(L);\n      break;\n  }\n  lua_settable(L, -3);\n}\n\nvoid push_table_value(lua_State *L, std::string key,\n                      scroll_direction_t direction) {\n  lua_pushstring(L, key.c_str());\n  switch (direction) {\n    case scroll_direction_t::DOWN:\n      lua_pushstring(L, \"down\");\n      break;\n    case scroll_direction_t::UP:\n      lua_pushstring(L, \"up\");\n      break;\n    case scroll_direction_t::LEFT:\n      lua_pushstring(L, \"left\");\n      break;\n    case scroll_direction_t::RIGHT:\n      lua_pushstring(L, \"right\");\n      break;\n    default:\n      lua_pushnil(L);\n      break;\n  }\n  lua_settable(L, -3);\n}\n\nvoid push_table_value(lua_State *L, std::string key, mouse_button_t button) {\n  lua_pushstring(L, key.c_str());\n  switch (button) {\n    case mouse_button_t::LEFT:\n      lua_pushstring(L, \"left\");\n      break;\n    case mouse_button_t::RIGHT:\n      lua_pushstring(L, \"right\");\n      break;\n    case mouse_button_t::MIDDLE:\n      lua_pushstring(L, \"middle\");\n      break;\n    case mouse_button_t::BACK:\n      lua_pushstring(L, \"back\");\n      break;\n    case mouse_button_t::FORWARD:\n      lua_pushstring(L, \"forward\");\n      break;\n    default:\n      lua_pushnil(L);\n      break;\n  }\n  lua_settable(L, -3);\n}\n\n/* Class methods */\nmouse_event::mouse_event(mouse_event_t type)\n    : type(type), time(current_time_ms()){};\n\nvoid mouse_event::push_lua_table(lua_State *L) const {\n  lua_newtable(L);\n  push_table_value(L, \"type\", this->type);\n  push_table_value(L, \"time\", this->time);\n  push_lua_data(L);\n}\n\nvoid mouse_positioned_event::push_lua_data(lua_State *L) const {\n  push_table_value(L, \"x\", this->pos.x());\n  push_table_value(L, \"y\", this->pos.y());\n  push_table_value(L, \"x_abs\", this->pos_absolute.x());\n  push_table_value(L, \"y_abs\", this->pos_absolute.y());\n}\n\nvoid mouse_move_event::push_lua_data(lua_State *L) const {\n  mouse_positioned_event::push_lua_data(L);\n  push_mods(L, this->mods);\n}\n\nvoid mouse_scroll_event::push_lua_data(lua_State *L) const {\n  mouse_positioned_event::push_lua_data(L);\n  push_table_value(L, \"direction\", this->direction);\n  push_mods(L, this->mods);\n}\n\nvoid mouse_button_event::push_lua_data(lua_State *L) const {\n  mouse_positioned_event::push_lua_data(L);\n  push_table_value(L, \"button_code\", static_cast<std::uint32_t>(this->button));\n  push_table_value(L, \"button\", this->button);\n  push_mods(L, this->mods);\n}\n#endif /* BUILD_MOUSE_EVENTS */\n\n#ifdef BUILD_XINPUT\n/// Last global device id.\nsize_t last_device_id = 0;\n\nstatic std::map<size_t, device_info> device_info_cache{};\nstatic std::map<xi_device_id, size_t> xi_id_mapping{};\n\ndevice_info *device_info::from_xi_id(xi_device_id device_id, Display *display) {\n  if (xi_id_mapping.count(device_id) > 0) {\n    return &device_info_cache[xi_id_mapping[device_id]];\n  }\n  if (display == nullptr) return nullptr;\n\n  int num_devices;\n  XIDeviceInfo *device = XIQueryDevice(display, device_id, &num_devices);\n  if (num_devices == 0) return nullptr;\n\n  int master;\n  \n  if(device->use == XIMasterPointer){\n    master = device->deviceid;\n  }\n  else{\n    master = device->attachment;\n  }\n\n  device_info info =\n      device_info{device_id, master, std::string(device->name)};\n\n  size_t id = last_device_id++;\n  info.init_xi_device(display, device);\n  XIFreeDeviceInfo(device);\n\n  device_info_cache[id] = info;\n  xi_id_mapping[device_id] = id;\n\n  return &device_info_cache[id];\n}\n\nvoid handle_xi_device_change(const XIHierarchyEvent *event) {\n  if ((event->flags & XISlaveRemoved) != 0) {\n    for (int i = 0; i < event->num_info; i++) {\n      auto info = event->info[i];\n      if ((info.flags & XISlaveRemoved) == 0) continue;\n      if (xi_id_mapping.count(info.deviceid) == 0) continue;\n\n      size_t id = xi_id_mapping[info.deviceid];\n      xi_id_mapping.erase(info.deviceid);\n      device_info_cache.erase(id);\n    }\n  }\n\n  if ((event->flags & XISlaveAdded) != 0) {\n    for (int i = 0; i < event->num_info; i++) {\n      auto info = event->info[i];\n      if ((info.flags & XISlaveAdded) == 0) continue;\n      if (info.use == IsXPointer || info.use == IsXExtensionPointer)\n        conky::device_info::from_xi_id(info.deviceid, event->display);\n    }\n  }\n}\n\n/// Allows override of valuator indices in `xorg.conf` in case they're wrong for\n/// some device (unlikely).\nsize_t fixed_valuator_index(Display *display, XIDeviceInfo *device,\n                            valuator_t valuator) {\n  const std::array<const char *, VALUATOR_COUNT> atom_names = {\n      \"ConkyValuatorMoveX\", \"ConkyValuatorMoveY\", \"ConkyValuatorScrollX\",\n      \"ConkyValuatorScrollY\"};\n  Atom override_atom = XInternAtom(display, atom_names[*valuator], False);\n  unsigned char *value;\n  Atom type_return;\n  int format_return;\n  unsigned long num_items;\n  unsigned long bytes_after;\n  do {\n    if (XIGetProperty(display, device->deviceid, override_atom, 0, 1, False,\n                      XA_INTEGER, &type_return, &format_return, &num_items,\n                      &bytes_after,\n                      reinterpret_cast<unsigned char **>(&value)) == 0) {\n      if (num_items == 0) break;\n      if (type_return != XA_INTEGER) {\n        NORM_ERR(\n            \"invalid '%s' option value, expected a single integer; value will \"\n            \"be ignored\",\n            atom_names[*valuator]);\n        XFree(value);\n        break;\n      }\n      uint32_t result = *reinterpret_cast<uint32_t *>(value);\n      XFree(value);\n      return static_cast<size_t>(result);\n    }\n  } while (true);\n  return *valuator;\n}\n\n/// Allows override of valuator value type in `xorg.conf` in case they're wrong\n/// for some device (happens with VMs and some devices/setups).\nbool fixed_valuator_relative(Display *display, XIDeviceInfo *device,\n                             valuator_t valuator,\n                             XIValuatorClassInfo *class_info) {\n  const std::array<const char *, 2> atom_names = {\n      \"ConkyValuatorMoveMode\",\n      \"ConkyValuatorScrollMode\",\n  };\n\n  Atom override_atom = XInternAtom(display, atom_names[*valuator >> 1], False);\n  unsigned char *value_return;\n  Atom type_return;\n  int format_return;\n  unsigned long num_items;\n  unsigned long bytes_after;\n\n  do {\n    if (XIGetProperty(display, device->deviceid, override_atom, 0, 9, False,\n                      XA_ATOM, &type_return, &format_return, &num_items,\n                      &bytes_after,\n                      reinterpret_cast<unsigned char **>(&value_return)) == 0) {\n      if (num_items == 0) break;\n      if (type_return != XA_ATOM) {\n        NORM_ERR(\n            \"invalid '%s' option value, expected an atom (string); value will \"\n            \"be ignored\",\n            atom_names[*valuator >> 1]);\n        XFree(value_return);\n        break;\n      }\n      Atom return_atom = *reinterpret_cast<Atom *>(value_return);\n      XFree(value_return);\n      char *value = XGetAtomName(display, return_atom);\n\n      // lowercase value\n      for (auto c = value; *c; ++c) *c = tolower(*c);\n\n      bool relative = false;\n      if (strcmp(reinterpret_cast<char *>(value), \"relative\") == 0) {\n        relative = true;\n      } else if (strcmp(reinterpret_cast<char *>(value), \"absolute\") != 0) {\n        NORM_ERR(\n            \"unknown '%s' option value: '%s', expected 'absolute' or \"\n            \"'relative'; \"\n            \"value will be ignored\",\n            atom_names[*valuator >> 1]);\n        XFree(value);\n        break;\n      }\n      XFree(value);\n      return relative;\n    }\n  } while (true);\n  return class_info->mode == XIModeRelative;\n}\n\nvoid device_info::init_xi_device(\n    Display *display, std::variant<xi_device_id, XIDeviceInfo *> source) {\n  XIDeviceInfo *device = nullptr;\n  if (std::holds_alternative<XIDeviceInfo *>(source)) {\n    device = std::get<XIDeviceInfo *>(source);\n  } else if (std::holds_alternative<xi_device_id>(source)) {\n    int num_devices;\n    device =\n        XIQueryDevice(display, std::get<xi_device_id>(source), &num_devices);\n    if (num_devices == 0) return;\n  }\n  if (device == nullptr) return;\n\n  std::array<size_t, VALUATOR_COUNT> valuator_indices;\n  for (size_t i = 0; i < VALUATOR_COUNT; i++) {\n    valuator_indices[i] =\n        fixed_valuator_index(display, device, static_cast<valuator_t>(i));\n  }\n\n  // class order is undefined!\n  for (int i = 0; i < device->num_classes; i++) {\n    if (device->classes[i]->type != XIValuatorClass) continue;\n    XIValuatorClassInfo *class_info = (XIValuatorClassInfo *)device->classes[i];\n\n    // check if one of used (mapped) valuators\n    valuator_t valuator = valuator_t::UNKNOWN;\n    for (size_t i = 0; i < VALUATOR_COUNT; i++) {\n      if (valuator_indices[i] == class_info->number) {\n        valuator = static_cast<valuator_t>(i);\n        break;\n      }\n    }\n    if (valuator == valuator_t::UNKNOWN) { continue; }\n\n    auto info = conky_valuator_info{\n        .index = static_cast<size_t>(class_info->number),\n        .min = class_info->min,\n        .max = class_info->max,\n        .value = class_info->value,\n        .relative =\n            fixed_valuator_relative(display, device, valuator, class_info),\n    };\n\n    this->valuators[*valuator] = info;\n  }\n\n  if (std::holds_alternative<xi_device_id>(source)) {\n    XIFreeDeviceInfo(device);\n  }\n}\nconky_valuator_info &device_info::valuator(valuator_t valuator) {\n  return this->valuators[*valuator];\n}\n\nxi_event_data *xi_event_data::read_cookie(Display *display, const void *data) {\n  const XIDeviceEvent *source = reinterpret_cast<const XIDeviceEvent *>(data);\n  xi_event_type event_type = source->evtype;\n  if (!(event_type == XI_Motion || event_type == XI_ButtonPress ||\n        event_type == XI_ButtonRelease)) {\n    return nullptr;\n  }\n\n  std::bitset<32> buttons;\n  for (size_t bi = 1; bi < source->buttons.mask_len * 8; bi++) {\n    if (XIMaskIsSet(source->buttons.mask, bi)) buttons[bi] = true;\n  }\n\n  std::map<size_t, double> valuators{};\n  double *values = source->valuators.values;\n  for (size_t vi = 0; vi < source->valuators.mask_len * 8; vi++) {\n    if (XIMaskIsSet(source->valuators.mask, vi)) valuators[vi] = *values++;\n  }\n\n  auto device = device_info::from_xi_id(source->deviceid, source->display);\n  if (device == nullptr) return nullptr;  // shouldn't happen\n\n  auto result = new xi_event_data{\n      .evtype = static_cast<xi_event_type>(source->evtype),\n      .serial = source->serial,\n      .send_event = source->send_event,\n      .display = source->display,\n      .extension = source->extension,\n      .time = source->time,\n      .device = device,\n      .sourceid = source->sourceid,\n      .detail = source->detail,\n      .root = source->root,\n      .event = source->event,\n      .child = source->child,\n      .pos_absolute = vec2d{source->root_x, source->root_y},\n      .pos = vec2d{source->event_x, source->event_y},\n      .flags = source->flags,\n      .buttons = buttons,\n      .valuators = valuators,\n      .mods = source->mods,\n      .group = source->group,\n      .valuators_relative = {0.0, 0.0, 0.0, 0.0},\n  };\n\n  for (size_t v = 0; v < VALUATOR_COUNT; v++) {\n    valuator_t valuator = static_cast<valuator_t>(v);\n    auto &valuator_info = device->valuator(valuator);\n\n    if (result->valuators.count(valuator_info.index) == 0) { continue; }\n    auto current = result->valuators[valuator_info.index];\n\n    if (valuator_info.relative) {\n      result->valuators_relative[v] = current;\n    } else {\n      // XXX these doubles come from int values and might wrap around though\n      // it's hard to tell what int type is the source as it depends on the\n      // device/driver.\n      result->valuators_relative[v] = current - valuator_info.value;\n    }\n    valuator_info.value = current;\n  }\n\n  return result;\n}\n\nbool xi_event_data::test_valuator(valuator_t valuator) const {\n  return this->valuators.count(this->device->valuator(valuator).index) > 0;\n}\nconky_valuator_info *xi_event_data::valuator_info(valuator_t valuator) const {\n  return &this->device->valuator(valuator);\n}\nstd::optional<double> xi_event_data::valuator_value(valuator_t valuator) const {\n  auto info = this->valuator_info(valuator);\n  if (info == nullptr) return std::nullopt;\n  size_t index = info->index;\n  if (this->valuators.count(index) == 0) return std::nullopt;\n  return this->valuators.at(index);\n}\n\nstd::optional<double> xi_event_data::valuator_relative_value(\n    valuator_t valuator) const {\n  return this->valuators_relative.at(*valuator);\n}\n\nstd::vector<std::tuple<int, XEvent *>> xi_event_data::generate_events(\n    Window target, Window child, conky::vec2d target_pos) const {\n  std::vector<std::tuple<int, XEvent *>> result{};\n\n  if (this->evtype == XI_Motion) {\n    auto device_info = this->device;\n\n    bool is_move = this->test_valuator(valuator_t::MOVE_X) ||\n                   this->test_valuator(valuator_t::MOVE_Y);\n    bool is_scroll = this->test_valuator(valuator_t::SCROLL_X) ||\n                     this->test_valuator(valuator_t::SCROLL_Y);\n\n    if (is_move) {\n      XEvent *produced = new XEvent;\n      std::memset(produced, 0, sizeof(XEvent));\n\n      XMotionEvent *e = &produced->xmotion;\n      e->type = MotionNotify;\n      e->display = this->display;\n      e->root = this->root;\n      e->window = target;\n      e->subwindow = child;\n      e->time = CurrentTime;\n      e->x = static_cast<int>(target_pos.x());\n      e->y = static_cast<int>(target_pos.y());\n      e->x_root = static_cast<int>(this->pos_absolute.x());\n      e->y_root = static_cast<int>(this->pos_absolute.y());\n      e->state = this->mods.effective;\n      e->is_hint = NotifyNormal;\n      e->same_screen = True;\n      result.emplace_back(std::make_tuple(PointerMotionMask, produced));\n    }\n    if (is_scroll) {\n      XEvent *produced = new XEvent;\n      std::memset(produced, 0, sizeof(XEvent));\n\n      uint scroll_direction = 4;\n      auto vertical = this->valuator_relative_value(valuator_t::SCROLL_Y);\n      double vertical_value = vertical.value_or(0.0);\n\n      if (vertical_value != 0.0) {\n        scroll_direction = vertical_value < 0.0 ? Button4 : Button5;\n      } else {\n        auto horizontal = this->valuator_relative_value(valuator_t::SCROLL_X);\n        double horizontal_value = horizontal.value_or(0.0);\n        if (horizontal_value != 0.0) {\n          scroll_direction = horizontal_value < 0.0 ? 6 : 7;\n        }\n      }\n\n      XButtonEvent *e = &produced->xbutton;\n      e->display = display;\n      e->root = this->root;\n      e->window = target;\n      e->subwindow = child;\n      e->time = CurrentTime;\n      e->x = static_cast<int>(target_pos.x());\n      e->y = static_cast<int>(target_pos.y());\n      e->x_root = static_cast<int>(this->pos_absolute.x());\n      e->y_root = static_cast<int>(this->pos_absolute.y());\n      e->state = this->mods.effective;\n      e->button = scroll_direction;\n      e->same_screen = True;\n\n      XEvent *press = new XEvent;\n      e->type = ButtonPress;\n      std::memcpy(press, produced, sizeof(XEvent));\n      result.emplace_back(std::make_tuple(ButtonPressMask, press));\n\n      e->type = ButtonRelease;\n      result.emplace_back(std::make_tuple(ButtonReleaseMask, produced));\n    }\n  } else {\n    XEvent *produced = new XEvent;\n    std::memset(produced, 0, sizeof(XEvent));\n\n    XButtonEvent *e = &produced->xbutton;\n    e->display = display;\n    e->root = this->root;\n    e->window = target;\n    e->subwindow = child;\n    e->time = CurrentTime;\n    e->x = static_cast<int>(target_pos.x());\n    e->y = static_cast<int>(target_pos.y());\n    e->x_root = static_cast<int>(this->pos_absolute.x());\n    e->y_root = static_cast<int>(this->pos_absolute.y());\n    e->state = this->mods.effective;\n    e->button = this->detail;\n    e->same_screen = True;\n\n    long event_mask = NoEventMask;\n    switch (this->evtype) {\n      case XI_ButtonPress:\n        e->type = ButtonPress;\n        event_mask = ButtonPressMask;\n        break;\n      case XI_ButtonRelease:\n        e->type = ButtonRelease;\n        event_mask = ButtonReleaseMask;\n        switch (this->detail) {\n          case 1:\n            event_mask |= Button1MotionMask;\n            break;\n          case 2:\n            event_mask |= Button2MotionMask;\n            break;\n          case 3:\n            event_mask |= Button3MotionMask;\n            break;\n          case 4:\n            event_mask |= Button4MotionMask;\n            break;\n          case 5:\n            event_mask |= Button5MotionMask;\n            break;\n        }\n        break;\n    }\n\n    result.emplace_back(std::make_tuple(event_mask, produced));\n  }\n\n  return result;\n}\n#endif /* BUILD_XINPUT */\n\n}  // namespace conky"
  },
  {
    "path": "src/mouse-events.h",
    "content": "/*\n * mouse_events.h: conky support for mouse events\n *\n * Copyright (C) 2020 Tin Svagelj tin.svagelj@live.com\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n *\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <https://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef MOUSE_EVENTS_H\n#define MOUSE_EVENTS_H\n\n#include <bitset>\n#include <cstdint>\n#include <string>\n\n#include \"config.h\"\n\n#include \"geometry.h\"\n#include \"logging.h\"\n\n#ifdef BUILD_XINPUT\n#include <array>\n#include <map>\n#include <optional>\n#include <tuple>\n#include <variant>\n#include <vector>\n#endif /* BUILD_XINPUT */\n\nextern \"C\" {\n#ifdef BUILD_X11\n#include <X11/X.h>\n\n#ifdef BUILD_XINPUT\n#include <X11/extensions/XInput.h>\n#include <X11/extensions/XInput2.h>\n#undef COUNT  // define from X11/extensions/Xi.h\n\n#endif /* BUILD_XINPUT */\n#endif /* BUILD_X11 */\n\n#include <lua.h>\n\n#ifdef __linux\n#include <linux/input-event-codes.h>\n#elif __FreeBSD__\n#include <dev/evdev/input-event-codes.h>\n#elif __DragonFly__\n#include <dev/misc/evdev/input-event-codes.h>\n#else /* platform */\n// Probably incorrect for some platforms, feel free to add your platform to the\n// above list if it has other event codes or a standard file containing them.\n\n// Left mouse button event code\n#define BTN_LEFT 0x110\n// Right mouse button event code\n#define BTN_RIGHT 0x111\n// Middle mouse button event code\n#define BTN_MIDDLE 0x112\n\n// Back mouse button event code\n#define BTN_BACK 0x116\n// Forward mouse button event code\n#define BTN_FORWARD 0x115\n#endif /* platform */\n}\n\nnamespace conky {\n\n#ifdef BUILD_MOUSE_EVENTS\nenum class mouse_event_t : uint32_t {\n  PRESS = 0,\n  RELEASE = 1,\n  SCROLL = 2,\n  MOVE = 3,\n  AREA_ENTER = 4,\n  AREA_LEAVE = 5,\n};\nconst size_t MOUSE_EVENT_COUNT =\n    static_cast<size_t>(mouse_event_t::AREA_LEAVE) + 1;\nconstexpr uint32_t operator*(mouse_event_t index) {\n  return static_cast<uint32_t>(index);\n}\n\nenum class mouse_button_t : uint32_t {\n  LEFT = BTN_LEFT,\n  RIGHT = BTN_RIGHT,\n  MIDDLE = BTN_MIDDLE,\n  BACK = BTN_BACK,\n  FORWARD = BTN_FORWARD,\n};\nconstexpr uint32_t operator*(mouse_button_t index) {\n  return static_cast<uint32_t>(index);\n}\n\n#ifdef BUILD_X11\ninline mouse_button_t x11_mouse_button_code(unsigned int x11_mouse_button) {\n  mouse_button_t button;\n  switch (x11_mouse_button) {\n    case Button1:\n      button = mouse_button_t::LEFT;\n      break;\n    case Button2:\n      button = mouse_button_t::MIDDLE;\n      break;\n    case Button3:\n      button = mouse_button_t::RIGHT;\n      break;\n    case 8:\n      button = mouse_button_t::BACK;\n      break;\n    case 9:\n      button = mouse_button_t::FORWARD;\n      break;\n    default:\n      DBGP(\"X11 button %d is not mapped\", x11_mouse_button);\n      break;\n  }\n  return button;\n}\n#endif /* BUILD_X11 */\n\nstruct mouse_event {\n  mouse_event_t type;  // type of event\n  std::size_t time;    // ms since epoch when the event happened\n\n  explicit mouse_event(mouse_event_t type);\n\n  void push_lua_table(lua_State *L) const;\n\n  virtual void push_lua_data(lua_State *L) const = 0;\n};\n\nstruct mouse_positioned_event : public mouse_event {\n  /// @brief Position relative to event window\n  vec2<size_t> pos;\n  /// @brief Position relative to desktop/root window\n  vec2<size_t> pos_absolute;\n\n  mouse_positioned_event(mouse_event_t type, vec2<size_t> pos,\n                         vec2<size_t> pos_absolute)\n      : mouse_event(type), pos(pos), pos_absolute(pos_absolute){};\n\n  void push_lua_data(lua_State *L) const;\n};\n\ntypedef std::bitset<6> modifier_state_t;\nenum class modifier_key : uint32_t {\n  SHIFT = 0,\n  CONTROL = 1,\n  ALT = 2,\n  // Windows/MacOS key on most keyboards\n  SUPER = 3,\n  CAPS_LOCK = 4,\n  NUM_LOCK = 5,\n};\nconstexpr uint32_t operator*(modifier_key index) {\n  return static_cast<uint32_t>(index);\n}\nstd::string modifier_name(modifier_key key);\n\n#ifdef BUILD_X11\ninline modifier_state_t x11_modifier_state(unsigned int mods) {\n  modifier_state_t result;\n  result[*modifier_key::SHIFT] = mods & ShiftMask;\n  result[*modifier_key::CONTROL] = mods & ControlMask;\n  result[*modifier_key::ALT] = mods & Mod1Mask;\n  result[*modifier_key::SUPER] = mods & Mod4Mask;\n  result[*modifier_key::CAPS_LOCK] = mods & LockMask;\n  result[*modifier_key::NUM_LOCK] = mods & Mod2Mask;\n  return result;\n}\n#endif /* BUILD_X11 */\n\nstruct mouse_move_event : public mouse_positioned_event {\n  modifier_state_t mods;  // held buttons and modifiers (ctrl, shift, ...)\n\n  mouse_move_event(vec2<size_t> pos, vec2<size_t> pos_absolute,\n                   modifier_state_t mods = 0)\n      : mouse_positioned_event{mouse_event_t::MOVE, pos, pos_absolute},\n        mods(mods){};\n\n  void push_lua_data(lua_State *L) const;\n};\n\nenum class scroll_direction_t : uint8_t {\n  UNKNOWN = 0,\n  UP,\n  DOWN,\n  LEFT,\n  RIGHT,\n};\nconstexpr uint8_t operator*(scroll_direction_t index) {\n  return static_cast<uint8_t>(index);\n}\n\n#ifdef BUILD_X11\ninline scroll_direction_t x11_scroll_direction(unsigned int x11_mouse_button) {\n  scroll_direction_t direction = scroll_direction_t::UNKNOWN;\n  switch (x11_mouse_button) {\n    case Button4:\n      direction = scroll_direction_t::UP;\n      break;\n    case Button5:\n      direction = scroll_direction_t::DOWN;\n      break;\n    case 6:\n      direction = scroll_direction_t::LEFT;\n      break;\n    case 7:\n      direction = scroll_direction_t::RIGHT;\n      break;\n  }\n  return direction;\n}\n#endif /* BUILD_X11 */\n\nstruct mouse_scroll_event : public mouse_positioned_event {\n  modifier_state_t mods;  // held buttons and modifiers (ctrl, shift, ...)\n  scroll_direction_t direction;\n\n  mouse_scroll_event(vec2<size_t> pos, vec2<size_t> pos_absolute,\n                     scroll_direction_t direction, modifier_state_t mods = 0)\n      : mouse_positioned_event{mouse_event_t::SCROLL, pos, pos_absolute},\n        direction(direction),\n        mods(mods){};\n\n  void push_lua_data(lua_State *L) const;\n};\n\nstruct mouse_button_event : public mouse_positioned_event {\n  modifier_state_t mods;  // held buttons and modifiers (ctrl, shift, ...)\n  mouse_button_t button;\n\n  mouse_button_event(mouse_event_t type, vec2<size_t> pos,\n                     vec2<size_t> pos_absolute, mouse_button_t button,\n                     modifier_state_t mods = 0)\n      : mouse_positioned_event{type, pos, pos_absolute},\n        button(button),\n        mods(mods){};\n\n  void push_lua_data(lua_State *L) const;\n};\n\nstruct mouse_crossing_event : public mouse_positioned_event {\n  mouse_crossing_event(mouse_event_t type, vec2<size_t> pos,\n                       vec2<size_t> pos_absolute)\n      : mouse_positioned_event{type, pos, pos_absolute} {};\n};\n#endif /* BUILD_MOUSE_EVENTS */\n\n#ifdef BUILD_XINPUT\ntypedef int xi_device_id;\ntypedef int xi_event_type;\n\nenum class valuator_t : size_t { MOVE_X, MOVE_Y, SCROLL_X, SCROLL_Y, UNKNOWN };\nconst size_t VALUATOR_COUNT = static_cast<size_t>(valuator_t::UNKNOWN);\nconstexpr uint8_t operator*(valuator_t index) {\n  return static_cast<uint8_t>(index);\n}\n\nstruct conky_valuator_info {\n  size_t index;\n  double min;\n  double max;\n  double value;\n  bool relative;\n};\n\nstruct device_info {\n  /// @brief Device name.\n  xi_device_id id;\n  xi_device_id master;\n  std::string name;\n  std::array<conky_valuator_info, VALUATOR_COUNT> valuators{};\n\n  static device_info *from_xi_id(xi_device_id id, Display *display = nullptr);\n\n  conky_valuator_info &valuator(valuator_t valuator);\n\n private:\n  void init_xi_device(Display *display,\n                      std::variant<xi_device_id, XIDeviceInfo *> device);\n};\n\nvoid handle_xi_device_change(const XIHierarchyEvent *event);\n\n/// Almost an exact copy of `XIDeviceEvent`, except it owns all data.\nstruct xi_event_data {\n  xi_event_type evtype;\n  unsigned long serial;\n  Bool send_event;\n  Display *display;\n  /// XI extension offset\n  // TODO: Check whether this is consistent between different clients by\n  // printing.\n  int extension;\n  Time time;\n  device_info *device;\n  int sourceid;\n  int detail;\n  Window root;\n  Window event;\n  Window child;\n  conky::vec2d pos_absolute;\n  conky::vec2d pos;\n  int flags;\n  /// pressed button mask\n  std::bitset<32> buttons;\n  std::map<size_t, double> valuators;\n  XIModifierState mods;\n  XIGroupState group;\n\n  // Extra data\n\n  /// Precomputed relative values\n  std::array<double, VALUATOR_COUNT> valuators_relative;\n\n  static xi_event_data *read_cookie(Display *display, const void *data);\n\n  bool test_valuator(valuator_t id) const;\n  conky_valuator_info *valuator_info(valuator_t id) const;\n  std::optional<double> valuator_value(valuator_t id) const;\n  std::optional<double> valuator_relative_value(valuator_t valuator) const;\n\n  std::vector<std::tuple<int, XEvent *>> generate_events(\n      Window target, Window child, conky::vec2d target_pos) const;\n};\n\n#endif /* BUILD_XINPUT */\n}  // namespace conky\n\n#endif /* MOUSE_EVENTS_H */\n"
  },
  {
    "path": "src/output/display-console.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"../conky.h\"\n#include \"display-console.hh\"\n#include \"nc.h\"\n\n#include <iostream>\n#include <sstream>\n#include <unordered_map>\n\nstatic conky::simple_config_setting<bool> extra_newline(\"extra_newline\", false,\n                                                        false);\n\nnamespace conky {\nnamespace {\n\nconky::display_output_console console_output(\"console\");\n\n}  // namespace\n\ntemplate <>\nvoid register_output<output_t::CONSOLE>(display_outputs_t &outputs) {\n  outputs.push_back(&console_output);\n}\n\ndisplay_output_console::display_output_console(const std::string &name_)\n    : display_output_base(name_) {}\n\nbool display_output_console::detect() {\n  if ((out_to_stdout.get(*state) || out_to_stderr.get(*state))\n#ifdef BUILD_NCURSES\n      && !out_to_ncurses.get(*state)\n#endif\n  ) {\n    DBGP2(\"Display output '%s' enabled in config.\", name.c_str());\n    return true;\n  }\n  return false;\n}\n\nbool display_output_console::initialize() { return true; }\n\nbool display_output_console::shutdown() { return true; }\n\nvoid display_output_console::draw_string(const char *s, int) {\n  if (out_to_stdout.get(*state)) {\n    printf(\"%s\\n\", s);\n    if (extra_newline.get(*state)) { fputc('\\n', stdout); }\n    fflush(stdout); /* output immediately, don't buffer */\n  }\n  if (out_to_stderr.get(*state)) {\n    fprintf(stderr, \"%s\\n\", s);\n    fflush(stderr); /* output immediately, don't buffer */\n  }\n}\n\n}  // namespace conky\n"
  },
  {
    "path": "src/output/display-console.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISPLAY_CONSOLE_HH\n#define DISPLAY_CONSOLE_HH\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"display-output.hh\"\n#include \"../lua/luamm.hh\"\n\nnamespace conky {\n\n/*\n * A base class for console display output.\n */\nclass display_output_console : public display_output_base {\n public:\n  explicit display_output_console(const std::string &name_);\n\n  virtual ~display_output_console() {}\n\n  // check if available and enabled in settings\n  virtual bool detect();\n  // connect to DISPLAY and other stuff\n  virtual bool initialize();\n  virtual bool shutdown();\n\n  virtual void draw_string(const char *s, int w);\n\n  // console-specific\n};\n\n}  // namespace conky\n\n#endif /* DISPLAY_CONSOLE_HH */\n"
  },
  {
    "path": "src/output/display-file.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"../conky.h\"\n#include \"display-file.hh\"\n#include \"nc.h\"\n\n#include <iostream>\n#include <sstream>\n#include <unordered_map>\n\n/* filenames for output */\nstatic conky::simple_config_setting<std::string> overwrite_file(\n    \"overwrite_file\", std::string(), true);\nstatic FILE *overwrite_fpointer = nullptr;\nstatic conky::simple_config_setting<std::string> append_file(\"append_file\",\n                                                             std::string(),\n                                                             true);\nstatic FILE *append_fpointer = nullptr;\n\nnamespace conky {\nnamespace {\n\nconky::display_output_file file_output(\"file\");\n\n}  // namespace\ntemplate <>\nvoid register_output<output_t::FILE>(display_outputs_t &outputs) {\n  outputs.push_back(&file_output);\n}\n\ndisplay_output_file::display_output_file(const std::string &name_)\n    : display_output_base(name_) {\n}\n\nbool display_output_file::detect() {\n  if (static_cast<unsigned int>(!overwrite_file.get(*state).empty()) != 0u ||\n      static_cast<unsigned int>(!append_file.get(*state).empty()) != 0u) {\n    DBGP2(\"Display output '%s' enabled in config.\", name.c_str());\n    return true;\n  }\n  return false;\n}\n\nbool display_output_file::initialize() { return true; }\n\nbool display_output_file::shutdown() { return true; }\n\nvoid display_output_file::draw_string(const char *s, int) {\n  if (overwrite_fpointer != nullptr) { fprintf(overwrite_fpointer, \"%s\\n\", s); }\n  if (append_fpointer != nullptr) { fprintf(append_fpointer, \"%s\\n\", s); }\n}\n\nvoid display_output_file::begin_draw_stuff() {\n  if (static_cast<unsigned int>(!overwrite_file.get(*state).empty()) != 0u) {\n    overwrite_fpointer = fopen(overwrite_file.get(*state).c_str(), \"we\");\n    if (overwrite_fpointer == nullptr) {\n      NORM_ERR(\"Cannot overwrite '%s'\", overwrite_file.get(*state).c_str());\n    }\n  }\n  if (static_cast<unsigned int>(!append_file.get(*state).empty()) != 0u) {\n    append_fpointer = fopen(append_file.get(*state).c_str(), \"ae\");\n    if (append_fpointer == nullptr) {\n      NORM_ERR(\"Cannot append to '%s'\", append_file.get(*state).c_str());\n    }\n  }\n}\n\nvoid display_output_file::end_draw_stuff() {\n  if (overwrite_fpointer != nullptr) {\n    fclose(overwrite_fpointer);\n    overwrite_fpointer = nullptr;\n  }\n  if (append_fpointer != nullptr) {\n    fclose(append_fpointer);\n    append_fpointer = nullptr;\n  }\n}\n\n}  // namespace conky\n"
  },
  {
    "path": "src/output/display-file.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISPLAY_FILE_HH\n#define DISPLAY_FILE_HH\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"display-output.hh\"\n#include \"../lua/luamm.hh\"\n\nnamespace conky {\n\n/*\n * A base class for file display output.\n */\nclass display_output_file : public display_output_base {\n public:\n  explicit display_output_file(const std::string &name_);\n\n  virtual ~display_output_file() {}\n\n  // check if available and enabled in settings\n  virtual bool detect();\n  // connect to DISPLAY and other stuff\n  virtual bool initialize();\n  virtual bool shutdown();\n\n  virtual void draw_string(const char *s, int w);\n\n  virtual void begin_draw_stuff();\n  virtual void end_draw_stuff();\n\n  // file-specific\n};\n\n}  // namespace conky\n\n#endif /* DISPLAY_FILE_HH */\n"
  },
  {
    "path": "src/output/display-http.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"../conky.h\"\n#include \"display-http.hh\"\n\n#include <iostream>\n#include <sstream>\n#include <unordered_map>\n\n#include <microhttpd.h>\n\nnamespace conky {\nnamespace {\nconky::display_output_http http_output;\n}  // namespace\ntemplate <>\nvoid register_output<output_t::HTTP>(display_outputs_t &outputs) {\n  outputs.push_back(&http_output);\n}\n\n// TODO: cleanup namespace\n// namespace priv {\n\n#ifdef MHD_YES\n/* older API */\n#define MHD_Result int\n#endif /* MHD_YES */\nstd::string webpage;\nstruct MHD_Daemon *httpd;\nstatic conky::simple_config_setting<bool> http_refresh(\"http_refresh\", false,\n                                                       true);\nstatic conky::simple_config_setting<unsigned short> http_port(\"http_port\",\n                                                              HTTPPORT, true);\n\nMHD_Result sendanswer(void *cls, struct MHD_Connection *connection,\n                      const char *url, const char *method, const char *version,\n                      const char *upload_data, size_t *upload_data_size,\n                      void **con_cls) {\n  struct MHD_Response *response = MHD_create_response_from_buffer(\n      webpage.length(), (void *)webpage.c_str(), MHD_RESPMEM_PERSISTENT);\n  MHD_Result ret = MHD_queue_response(connection, MHD_HTTP_OK, response);\n  MHD_destroy_response(response);\n  if (cls || url || method || version || upload_data || upload_data_size ||\n      con_cls) {}  // make compiler happy\n  return ret;\n}\n\nclass out_to_http_setting : public conky::simple_config_setting<bool> {\n  typedef conky::simple_config_setting<bool> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init) {\n    lua::stack_sentry s(l, -2);\n\n    Base::lua_setter(l, init);\n\n    if (init && do_convert(l, -1).first) {\n      /* warn about old default port */\n      if (http_port.get(*state) == 10080) {\n        NORM_ERR(\n            \"warning: port 10080 is blocked by browsers \"\n            \"like Firefox and Chromium, you may want to change http_port.\");\n      }\n      httpd =\n          MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, http_port.get(*state),\n                           nullptr, NULL, &sendanswer, nullptr, MHD_OPTION_END);\n    }\n\n    ++s;\n  }\n\n  virtual void cleanup(lua::state &l) {\n    lua::stack_sentry s(l, -1);\n\n    if (do_convert(l, -1).first) {\n      MHD_stop_daemon(httpd);\n      httpd = nullptr;\n    }\n\n    l.pop();\n  }\n\n public:\n  out_to_http_setting() : Base(\"out_to_http\", false, false) {}\n};\nstatic out_to_http_setting out_to_http;\n\nstd::string string_replace_all(std::string original, const std::string &oldpart,\n                               const std::string &newpart,\n                               std::string::size_type start) {\n  std::string::size_type i = start;\n  int oldpartlen = oldpart.length();\n  while (1) {\n    i = original.find(oldpart, i);\n    if (i == std::string::npos) { break; }\n    original.replace(i, oldpartlen, newpart);\n  }\n  return original;\n}\n\nstd::string html_escape(const std::string &input) {\n  std::string escaped;\n  escaped.reserve(input.size());\n\n  for (char ch : input) {\n    switch (ch) {\n      case '&':\n        escaped.append(\"&amp;\");\n        break;\n      case '<':\n        escaped.append(\"&lt;\");\n        break;\n      case '>':\n        escaped.append(\"&gt;\");\n        break;\n      case '\"':\n        escaped.append(\"&quot;\");\n        break;\n      case '\\'':\n        escaped.append(\"&#39;\");\n        break;\n      default:\n        escaped.push_back(ch);\n        break;\n    }\n  }\n\n  return escaped;\n}\n\n//}  // namespace priv\n\ndisplay_output_http::display_output_http() : display_output_base(\"http\") {\n  httpd = NULL;\n}\n\nbool display_output_http::detect() {\n  if (/*priv::*/ out_to_http.get(*state)) {\n    DBGP2(\"Display output '%s' enabled in config.\", name.c_str());\n    return true;\n  }\n  return false;\n}\n\nbool display_output_http::initialize() {\n  if (/*priv::*/ out_to_http.get(*state)) {\n    is_active = true;\n    return true;\n  }\n  return false;\n}\n\nbool display_output_http::shutdown() { return true; }\n\nvoid display_output_http::begin_draw_text() {\n#define WEBPAGE_START1                                             \\\n  \"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Strict//EN\\\" \"    \\\n  \"\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\\\">\\n<html \" \\\n  \"xmlns=\\\"http://www.w3.org/1999/xhtml\\\"><head><meta \"            \\\n  \"http-equiv=\\\"Content-type\\\" content=\\\"text/html;charset=UTF-8\\\" />\"\n#define WEBPAGE_START2 \\\n  \"<title>Conky</title></head><body style=\\\"font-family: monospace\\\"><p>\"\n#define WEBPAGE_END \"</p></body></html>\"\n  if (out_to_http.get(*state)) {\n    webpage = WEBPAGE_START1;\n    if (http_refresh.get(*state)) {\n      webpage.append(\"<meta http-equiv=\\\"refresh\\\" content=\\\"\");\n      std::stringstream update_interval_str;\n      update_interval_str << update_interval.get(*state);\n      webpage.append(update_interval_str.str());\n      webpage.append(\"\\\" />\");\n    }\n    webpage.append(WEBPAGE_START2);\n  }\n}\n\nvoid display_output_http::end_draw_text() { webpage.append(WEBPAGE_END); }\n\nvoid display_output_http::draw_string(const char *s, int) {\n  std::string::size_type origlen = webpage.length();\n  webpage.append(html_escape(s));\n  webpage = string_replace_all(webpage, \"\\n\", \"<br />\", origlen);\n  webpage = string_replace_all(webpage, \"  \", \"&nbsp;&nbsp;\", origlen);\n  webpage = string_replace_all(webpage, \"&nbsp; \", \"&nbsp;&nbsp;\", origlen);\n  webpage.append(\"<br />\");\n}\n\n}  // namespace conky\n"
  },
  {
    "path": "src/output/display-http.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018-2021 François Revol et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISPLAY_HTTP_HH\n#define DISPLAY_HTTP_HH\n\n#include \"config.h\"\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"../lua/luamm.hh\"\n#include \"display-output.hh\"\n\nnamespace conky {\n\n/*\n * A base class for HTTP display output.\n */\nclass display_output_http : public display_output_base {\n public:\n  explicit display_output_http();\n\n  virtual ~display_output_http() {}\n\n  // check if available and enabled in settings\n  virtual bool detect();\n  // connect to DISPLAY and other stuff\n  virtual bool initialize();\n  virtual bool shutdown();\n\n  // drawing primitives\n  virtual void set_foreground_color(Colour) {}\n  virtual void begin_draw_text();\n  virtual void end_draw_text();\n  virtual void draw_string(const char *, int);\n\n  // HTTP-specific\n private:\n  // std::string webpage;\n  // struct MHD_Daemon *httpd;\n};\n\nstd::string html_escape(const std::string &input);\n\n}  // namespace conky\n\n#endif /* DISPLAY_HTTP_HH */\n"
  },
  {
    "path": "src/output/display-ncurses.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"../conky.h\"\n#include \"../content/colours.hh\"\n#include \"display-ncurses.hh\"\n#include \"gui.h\"\n#include \"nc.h\"\n\n#include <iostream>\n#include <sstream>\n#include <unordered_map>\n\n#include <ncurses.h>\n\nextern WINDOW* ncurses_window;\n\nnamespace conky {\nnamespace {\nconky::display_output_ncurses ncurses_output;\n}  // namespace\ntemplate <>\nvoid register_output<output_t::NCURSES>(display_outputs_t& outputs) {\n  outputs.push_back(&ncurses_output);\n}\n\n// namespace priv {\n\n//}  // namespace priv\n\n#define COLORS_BUILTIN 8\n\nColour ncurses_colors[COLORS_BUILTIN + COLORS_CUSTOM] = {\n    {0x00, 0x00, 0x00, 0xff},  // BLACK\n    {0xff, 0x00, 0x00, 0xff},  // RED\n    {0x00, 0xff, 0x00, 0xff},  // GREEN\n    {0xff, 0xff, 0x00, 0xff},  // YELLOW\n    {0x00, 0x00, 0xff, 0xff},  // BLUE\n    {0xff, 0x00, 0xff, 0xff},  // MAGENTA\n    {0x00, 0xff, 0xff, 0xff},  // CYAN\n    {0xff, 0xff, 0xff, 0xff},  // WHITE\n};\n\n// Find the nearest ncurses color.\nint to_ncurses(const Colour& c) {\n  int mindiff = INT_MAX;\n  int best_nccolor = 0;\n  for (int nccolor = 0; nccolor < COLORS_BUILTIN + COLORS_CUSTOM; nccolor++) {\n    const Colour& other = ncurses_colors[nccolor];\n    int diff = abs(c.red - other.red) + abs(c.green - other.green) +\n               abs(c.blue - other.blue);\n\n    if (diff < mindiff) {\n      mindiff = diff;\n      best_nccolor = nccolor;\n    }\n  }\n  return best_nccolor;\n}\n\nColour from_ncurses(int nccolor) {\n  if (nccolor >= 0 && nccolor < COLORS_BUILTIN + COLORS_CUSTOM) {\n    return ncurses_colors[nccolor];\n  }\n  return ERROR_COLOUR;\n}\n\ndisplay_output_ncurses::display_output_ncurses()\n    : display_output_console(\"ncurses\") {}\n\nbool display_output_ncurses::detect() {\n  if (out_to_ncurses.get(*state)) {\n    DBGP2(\"Display output '%s' enabled in config.\", name.c_str());\n    return true;\n  }\n  return false;\n}\n\nbool display_output_ncurses::initialize() {\n  for (int i = 0; i < COLORS_CUSTOM; i++) {\n    Colour c = color[i].get(*state);\n    init_color(COLORS_BUILTIN + i, (1000 * c.red) / 255, (1000 * c.green) / 255,\n               (1000 * c.blue) / 255);\n    ncurses_colors[COLORS_BUILTIN + i] = c;\n  }\n\n  is_active = ncurses_window != nullptr;\n  return is_active;\n}\n\nbool display_output_ncurses::shutdown() { return false; }\n\nvoid display_output_ncurses::set_foreground_color(Colour c) {\n  int nccolor = to_ncurses(c);\n  init_pair(nccolor + 1, nccolor, COLOR_BLACK);\n  attron(COLOR_PAIR(nccolor + 1));\n}\n\nvoid display_output_ncurses::begin_draw_text() {\n  init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);\n  attron(COLOR_PAIR(COLOR_WHITE));\n}\n\nvoid display_output_ncurses::end_draw_text() {}\n\nvoid display_output_ncurses::draw_string(const char* s, int) {\n  printw(\"%s\", s);\n}\n\nvoid display_output_ncurses::line_inner_done() { printw(\"\\n\"); }\n\nint display_output_ncurses::getx() {\n  int x, y;\n  getyx(ncurses_window, y, x);\n  (void)y;\n  return x;\n}\n\nint display_output_ncurses::gety() {\n  int x, y;\n  getyx(ncurses_window, y, x);\n  (void)x;\n  return y;\n}\n\nvoid display_output_ncurses::gotox(int x) {\n  int y, old_x;\n  getyx(ncurses_window, y, old_x);\n  (void)old_x;\n  move(y, x);\n}\n\nvoid display_output_ncurses::gotoy(int y) {\n  int x, old_y;\n  getyx(ncurses_window, old_y, x);\n  (void)old_y;\n  move(y, x);\n}\n\nvoid display_output_ncurses::gotoxy(int x, int y) { move(y, x); }\n\nvoid display_output_ncurses::flush() {\n  refresh();\n  clear();\n}\n}  // namespace conky\n"
  },
  {
    "path": "src/output/display-ncurses.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISPLAY_NCURSES_HH\n#define DISPLAY_NCURSES_HH\n\n#include \"config.h\"\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"../content/colours.hh\"\n#include \"../lua/luamm.hh\"\n#include \"display-console.hh\"\n\nnamespace conky {\n\n/*\n * A base class for ncurses display output.\n */\nclass display_output_ncurses : public display_output_console {\n public:\n  explicit display_output_ncurses();\n\n  virtual ~display_output_ncurses() {}\n\n  // check if available and enabled in settings\n  virtual bool detect();\n  // connect to DISPLAY and other stuff\n  virtual bool initialize();\n  virtual bool shutdown();\n  virtual bool draw_line_inner_required() { return true; }\n\n  // drawing primitives\n  virtual void set_foreground_color(Colour c);\n\n  virtual void begin_draw_text();\n  virtual void end_draw_text();\n  virtual void draw_string(const char *s, int w);\n  virtual void line_inner_done();\n\n  virtual int getx();\n  virtual int gety();\n  virtual void gotox(int x);\n  virtual void gotoy(int y);\n  virtual void gotoxy(int x, int y);\n\n  virtual void flush();\n\n  // ncurses-specific\n};\n\n}  // namespace conky\n\n#endif /* DISPLAY_NCURSES_HH */\n"
  },
  {
    "path": "src/output/display-output.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"display-output.hh\"\n\n#include <algorithm>\n#include <iostream>\n#include <sstream>\n#include <unordered_map>\n\nnamespace conky {\n\ninline void log_missing(const char *name, const char *flag) {\n  DBGP(\n      \"%s display output disabled. Enable by recompiling with '%s' \"\n      \"flag enabled.\",\n      name, flag);\n}\n#ifndef BUILD_HTTP\ntemplate <>\nvoid register_output<output_t::HTTP>(display_outputs_t &outputs) {\n  log_missing(\"HTTP\", \"BUILD_HTTP\");\n}\n#endif\n#ifndef BUILD_NCURSES\ntemplate <>\nvoid register_output<output_t::NCURSES>(display_outputs_t &outputs) {\n  log_missing(\"ncurses\", \"BUILD_NCURSES\");\n}\n#endif\n#ifndef BUILD_WAYLAND\ntemplate <>\nvoid register_output<output_t::WAYLAND>(display_outputs_t &outputs) {\n  log_missing(\"Wayland\", \"BUILD_WAYLAND\");\n}\n#endif\n#ifndef BUILD_X11\ntemplate <>\nvoid register_output<output_t::X11>(display_outputs_t &outputs) {\n  log_missing(\"X11\", \"BUILD_X11\");\n}\n#endif\n\n/*\n * The selected and active display output.\n */\nstd::vector<display_output_base *> active_display_outputs;\n\n/*\n * the list of the only current output, when inside draw_text,\n * else we iterate over each active outputs.\n */\nstd::vector<conky::display_output_base *> current_display_outputs;\n\nbool initialize_display_outputs() {\n  std::vector<display_output_base *> outputs;\n  outputs.reserve(static_cast<size_t>(output_t::OUTPUT_COUNT));\n\n  // Order of registration is important!\n  // - Graphical outputs go before textual (e.g. X11 before NCurses).\n  // - Optional outputs go before non-optional (e.g. Wayland before X11).\n  // - Newer outputs go before older (e.g. NCurses before (hypothetical) Curses).\n  // - Fallbacks go last (in group)\n  register_output<output_t::WAYLAND>(outputs);\n  register_output<output_t::X11>(outputs);\n  register_output<output_t::HTTP>(outputs);\n  register_output<output_t::FILE>(outputs);\n  register_output<output_t::NCURSES>(outputs);\n  register_output<output_t::CONSOLE>(outputs);  // global fallback - always works\n\n  for (auto out : outputs) { NORM_ERR(\"FOUND: %s\", out->name.c_str()); }\n\n  int graphical_count = 0;\n\n  for (auto output : outputs) {\n    DBGP2(\"Testing display output '%s'... \", output->name.c_str());\n    if (output->detect()) {\n      DBGP2(\"Detected display output '%s'... \", output->name.c_str());\n\n      if (graphical_count && output->graphical()) continue;\n\n      // X11 init needs to draw, so we must add it to the list first.\n      active_display_outputs.push_back(output);\n\n      if (output->initialize()) {\n        DBGP(\"Initialized display output '%s'... \", output->name.c_str());\n\n        output->is_active = true;\n        if (output->graphical()) graphical_count++;\n        /*\n         * We only support a single graphical display for now.\n         * More than one text display (ncurses + http, ...) should be ok.\n         */\n        // if (graphical_count)\n        // return true;\n      } else {\n        // failed, so remove from list\n        active_display_outputs.pop_back();\n      }\n    }\n  }\n  if (active_display_outputs.size()) return true;\n\n  std::cerr << \"Unable to find a usable display output.\" << std::endl;\n  return true;\n}\n\nbool shutdown_display_outputs() {\n  bool ret = true;\n  for (auto output : active_display_outputs) {\n    output->is_active = false;\n    ret = output->shutdown();\n  }\n  active_display_outputs.clear();\n  return ret;\n}\n\n}  // namespace conky\n"
  },
  {
    "path": "src/output/display-output.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018 François Revol et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISPLAY_OUTPUT_HH\n#define DISPLAY_OUTPUT_HH\n\n#include <string.h>\n#include <cmath>\n#include <limits>\n#include <string>\n#include <type_traits>\n#include <vector>\n\n#include \"../content/colours.hh\"\n#include \"../logging.h\"\n#include \"../lua/luamm.hh\"\n\nnamespace conky {\n\nbool initialize_display_outputs();\n\nbool shutdown_display_outputs();\n\n/*\n * A base class for all display outputs.\n * API consists of two functions:\n * - get_number should return numeric representation of the data (if available).\n * This can then be used when drawing graphs, bars, ... The default\n * implementation returns NaN.\n * - get_text should return textual representation of the data. This is used\n * when simple displaying the value of the data source. The default\n * implementation converts get_number() to a string, but you can override to\n * return anything (e.g. add units)\n */\nclass display_output_base {\n private:\n  // copying is a REALLY bad idea\n  display_output_base(const display_output_base &) = delete;\n  display_output_base &operator=(const display_output_base &) = delete;\n\n public:\n  const std::string name;\n  bool is_active = false;\n  bool is_graphical = false;\n\n  explicit display_output_base(const std::string &name) : name(name){};\n\n  virtual ~display_output_base() {}\n\n  // check if available and enabled in settings\n  virtual bool detect() { return false; }\n  // connect to DISPLAY and other stuff\n  virtual bool initialize() { return false; }\n  virtual bool shutdown() { return false; }\n\n  virtual bool graphical() { return is_graphical; };\n  virtual bool draw_line_inner_required() { return is_graphical; }\n\n  virtual bool main_loop_wait(double /*t*/) { return false; }\n\n  virtual void sigterm_cleanup() {}\n  virtual void cleanup() {}\n\n  // drawing primitives\n  virtual void set_foreground_color(Colour /*c*/) {}\n\n  virtual int calc_text_width(const char *s) { return strlen(s); }\n\n  virtual void begin_draw_text() {}\n  virtual void end_draw_text() {}\n  virtual void draw_string(const char * /*s*/, int /*w*/) {}\n  virtual void line_inner_done() {}\n\n  // GUI interface\n  virtual void draw_string_at(int /*x*/, int /*y*/, const char * /*s*/,\n                              int /*w*/) {}\n  // X11 lookalikes\n  virtual void set_line_style(int /*w*/, bool /*solid*/) {}\n  virtual void set_dashes(char * /*s*/) {}\n  virtual void draw_line(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/) {}\n  virtual void draw_rect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) {}\n  virtual void fill_rect(int /*x*/, int /*y*/, int /*w*/, int /*h*/) {}\n  virtual void draw_arc(int /*x*/, int /*y*/, int /*w*/, int /*h*/, int /*a1*/,\n                        int /*a2*/) {}\n  virtual void move_win(int /*x*/, int /*y*/) {}\n  virtual float get_dpi_scale() { return 1.0; };\n\n  virtual void begin_draw_stuff() {}\n  virtual void end_draw_stuff() {}\n  virtual void clear_text(int /*exposures*/) {}\n\n  // font stuff\n  virtual int font_height(unsigned int) { return 0; }\n  virtual int font_ascent(unsigned int) { return 0; }\n  virtual int font_descent(unsigned int) { return 0; }\n  virtual void setup_fonts(void) {}\n  virtual void set_font(unsigned int) {}\n  virtual void free_fonts(bool /*utf8*/) {}\n  virtual void load_fonts(bool /*utf8*/) {}\n\n  // tty interface\n  virtual int getx() { return 0; }\n  virtual int gety() { return 0; }\n  virtual void gotox(int /*x*/) {}\n  virtual void gotoy(int /*y*/) {}\n  virtual void gotoxy(int /*x*/, int /*y*/) {}\n\n  virtual void flush() {}\n\n  friend bool conky::initialize_display_outputs();\n  friend bool conky::shutdown_display_outputs();\n\n protected:\n  virtual bool active() { return is_active; }\n};\n\nusing display_outputs_t = std::vector<display_output_base *>;\n\nenum class output_t : uint32_t {\n  CONSOLE,\n  NCURSES,\n  FILE,\n  HTTP,\n  X11,\n  WAYLAND,\n  OUTPUT_COUNT\n};\ntemplate <output_t Output>\nvoid register_output(display_outputs_t &outputs);\n\n/*\n * The selected and active display outputs.\n */\nextern std::vector<display_output_base *> active_display_outputs;\n\n/*\n * the list of the only current output, when inside draw_text,\n * else we iterate over each active outputs.\n */\nextern std::vector<conky::display_output_base *> current_display_outputs;\n\n}  // namespace conky\n\n// XXX: move to namespace?\n\nstatic inline std::vector<conky::display_output_base *> &display_outputs() {\n  if (conky::current_display_outputs.size())\n    return conky::current_display_outputs;\n  return conky::active_display_outputs;\n}\n\nstatic inline conky::display_output_base *display_output() {\n  if (conky::current_display_outputs.size())\n    return conky::current_display_outputs[0];\n  // XXX; not really what intended yet...\n  if (conky::active_display_outputs.size())\n    return conky::active_display_outputs[0];\n  return nullptr;\n}\n\ntemplate <typename T>\ninline T dpi_scale(T value) {\n  static_assert(std::is_arithmetic_v<T>,\n                \"dpi_scale value type must be a number\");\n#ifdef BUILD_GUI\n  auto output = display_output();\n  if (output) {\n    return T(std::round(static_cast<double>(value) * output->get_dpi_scale()));\n  }\n#endif /* BUILD_GUI */\n\n  return value;\n}\n\nstatic inline void unset_display_output() {\n  conky::current_display_outputs.clear();\n}\n\nstatic inline void set_display_output(conky::display_output_base *output) {\n  conky::current_display_outputs.clear();\n  conky::current_display_outputs.push_back(output);\n}\n\n#endif /* DISPLAY_OUTPUT_HH */\n"
  },
  {
    "path": "src/output/display-wayland.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018-2021 François Revol et al.\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"display-wayland.hh\"\n\n#include <wayland-client.h>\n// #include \"wayland.h\"\n#include <cairo.h>\n#include <fontconfig/fontconfig.h>\n#include <pango/pangocairo.h>\n#include <pango/pangofc-fontmap.h>\n\n#include <fcntl.h>\n#include <sys/epoll.h>\n#include <sys/mman.h>\n#include <sys/timerfd.h>\n#include <unistd.h>\n\n#include <wayland-client-protocol.h>\n#include <wlr-layer-shell-client-protocol.h>\n#include <xdg-shell-client-protocol.h>\n\n#include <cerrno>\n#include <cstdint>\n#include <iostream>\n#include <sstream>\n\n#include \"../conky.h\"\n#include \"display-output.hh\"\n#include \"../geometry.h\"\n#include \"gui.h\"\n#include \"../lua/llua.h\"\n#include \"../logging.h\"\n\n#include \"../lua/fonts.h\"\n\n#ifdef BUILD_MOUSE_EVENTS\n#include <array>\n#include <map>\n#include \"../mouse-events.h\"\n#endif\n\n#pragma GCC diagnostic ignored \"-Wunused-parameter\"\n\nstatic int set_cloexec_or_close(int fd) {\n  long flags;\n\n  if (fd == -1) return -1;\n\n  flags = fcntl(fd, F_GETFD);\n  if (flags == -1) goto err;\n\n  if (fcntl(fd, F_SETFD, flags | FD_CLOEXEC) == -1) goto err;\n\n  return fd;\n\nerr:\n  close(fd);\n  return -1;\n}\n\nstatic int create_tmpfile_cloexec(char *tmpname) {\n  int fd;\n\n#ifdef HAVE_MKOSTEMP\n  fd = mkostemp(tmpname, O_CLOEXEC);\n  if (fd >= 0) unlink(tmpname);\n#else\n  fd = mkstemp(tmpname);\n  if (fd >= 0) {\n    fd = set_cloexec_or_close(fd);\n    unlink(tmpname);\n  }\n#endif\n\n  return fd;\n}\n\n/*\n * Create a new, unique, anonymous file of the given size, and\n * return the file descriptor for it. The file descriptor is set\n * CLOEXEC. The file is immediately suitable for mmap()'ing\n * the given size at offset zero.\n *\n * The file should not have a permanent backing store like a disk,\n * but may have if XDG_RUNTIME_DIR is not properly implemented in OS.\n *\n * The file name is deleted from the file system.\n *\n * The file is suitable for buffer sharing between processes by\n * transmitting the file descriptor over Unix sockets using the\n * SCM_RIGHTS methods.\n *\n * If the C library implements posix_fallocate(), it is used to\n * guarantee that disk space is available for the file at the\n * given size. If disk space is insufficent, errno is set to ENOSPC.\n * If posix_fallocate() is not supported, program may receive\n * SIGBUS on accessing mmap()'ed file contents instead.\n */\nstatic int os_create_anonymous_file(off_t size) {\n  static const char templ[] = \"/weston-shared-XXXXXX\";\n  const char *path;\n  char *name;\n  int fd;\n  int ret;\n\n  path = getenv(\"XDG_RUNTIME_DIR\");\n  if (!path) {\n    errno = ENOENT;\n    return -1;\n  }\n\n  name = static_cast<char *>(malloc(strlen(path) + sizeof(templ)));\n  if (!name) return -1;\n\n  strcpy(name, path);\n  strcat(name, templ);\n\n  fd = create_tmpfile_cloexec(name);\n\n  free(name);\n\n  if (fd < 0) return -1;\n  ret = posix_fallocate(fd, 0, size);\n  if (ret != 0) {\n    close(fd);\n    errno = ret;\n    return -1;\n  }\n  return fd;\n}\n\n// TODO: cleanup externs (move to conky.h ?)\n#ifdef OWN_WINDOW\nextern int fixed_size, fixed_pos;\n#endif\nextern conky::vec2i text_start;  /* text start position in window */\nextern conky::vec2i text_offset; /* offset for start position */\nextern conky::vec2i\n    text_size; /* initially 1 so no zero-sized window is created */\nextern double current_update_time, next_update_time, last_update_time;\nvoid update_text();\nextern int need_to_update;\nint get_border_total();\nextern conky::range_config_setting<int> maximum_width;\nextern Colour current_color;\n\n/* for pango_fonts */\nstruct pango_font {\n  PangoFontDescription *desc;\n\n  struct {\n    uint32_t ascent;\n    uint32_t descent;\n  } metrics;\n  int font_alpha;\n\n  pango_font() : desc(nullptr), metrics({0, 0}), font_alpha(0xffff) {}\n};\n\nstatic std::vector<pango_font> pango_fonts; /* indexed by selected_font */\n\nnamespace {\nclass textalpha_setting : public conky::simple_config_setting<float> {\n  using Base = conky::simple_config_setting<float>;\n\n protected:\n  void lua_setter(lua::state &l, bool init) override {\n    lua::stack_sentry s(l, -2);\n\n    Base::lua_setter(l, init);\n\n    if (init) {\n      pango_fonts.resize(std::max(1, static_cast<int>(fonts.size())));\n      pango_fonts[0].desc = nullptr;\n      pango_fonts[0].font_alpha = do_convert(l, -1).first * 0xffff;\n    }\n\n    ++s;\n  }\n\n public:\n  textalpha_setting() : Base(\"textalpha\", 1.0, false) {}\n};\n\ntextalpha_setting textalpha;\n}  // namespace\n\nstatic void wayland_create_window();\n\nstatic void wayland_create_window() {\n  setup_fonts();\n  load_fonts(utf8_mode.get(*state));\n  update_text_area(); /* to position text/window on screen */\n\n#ifdef OWN_WINDOW\n  if (own_window.get(*state)) {\n    if (fixed_pos == 0) {\n      // XMoveWindow(display, window.window, window.x, window.y);\n      // TODO\n    }\n\n    // set_transparent_background(window.window);\n  }\n#endif\n\n  selected_font = 0;\n  update_text_area(); /* to get initial size of the window */\n}\n\nnamespace conky {\nnamespace {\nconky::display_output_wayland wayland_output;\n}  // namespace\n\ntemplate <>\nvoid register_output<output_t::WAYLAND>(display_outputs_t &outputs) {\n  outputs.push_back(&wayland_output);\n}\n\ndisplay_output_wayland::display_output_wayland()\n    : display_output_base(\"wayland\") {\n  is_graphical = true;\n}\n\nbool display_output_wayland::detect() {\n  if (out_to_wayland.get(*state)) {\n    DBGP2(\"Wayland display output '%s' enabled in config.\", name.c_str());\n    return true;\n  }\n  return false;\n}\n\nstatic int epoll_fd;\nstatic struct epoll_event ep[1];\n\nstatic struct window *global_window;\nstatic wl_display *global_display;\n\nstruct window {\n  struct rect<size_t> rectangle;\n  struct wl_shm *shm;\n  struct wl_surface *surface;\n  struct zwlr_layer_surface_v1 *layer_surface;\n  int scale, pending_scale;\n  cairo_surface_t *cairo_surface;\n  cairo_t *cr;\n  PangoLayout *layout;\n  PangoContext *pango_context;\n};\n\nstruct {\n  struct wl_registry *registry;\n  struct wl_compositor *compositor;\n  struct wl_shm *shm;\n  struct wl_surface *surface;\n  struct wl_seat *seat;\n  struct wl_pointer *pointer;\n  struct wl_output *output;\n  struct xdg_wm_base *shell;\n  struct zwlr_layer_shell_v1 *layer_shell;\n} wl_globals;\n\nstatic void xdg_wm_base_ping(void *data, struct xdg_wm_base *shell,\n                             uint32_t serial) {\n  xdg_wm_base_pong(shell, serial);\n}\n\nstatic const struct xdg_wm_base_listener xdg_wm_base_listener = {\n    /*.ping =*/&xdg_wm_base_ping,\n};\n\nstatic void output_geometry(void *data, struct wl_output *wl_output, int32_t x,\n                            int32_t y, int32_t physical_width,\n                            int32_t physical_height, int32_t subpixel,\n                            const char *make, const char *model,\n                            int32_t transform) {\n  // TODO: Add support for proper output management through:\n  // - xdg-output-unstable-v1\n  // Maybe also support (if XDG protocol not reported):\n  // - kde-output-management(-v2)\n  // - wlr-output-management-unstable-v1\n  workarea = absolute_rect<int>(\n      vec2i(x, y),\n      vec2i(x + physical_width,\n            y + physical_height));  // TODO: use xdg_output.logical_position\n}\n\nstatic void output_mode(void *data, struct wl_output *wl_output, uint32_t flags,\n                        int32_t width, int32_t height, int32_t refresh) {}\n\n#ifdef WL_OUTPUT_DONE_SINCE_VERSION\nstatic void output_done(void *data, struct wl_output *wl_output) {}\n#endif\n\n#ifdef WL_OUTPUT_SCALE_SINCE_VERSION\nvoid output_scale(void *data, struct wl_output *wl_output, int32_t factor) {\n  /* For now, assume we have one output and adopt its scale unconditionally. */\n  /* We should also re-render immediately when scale changes. */\n  global_window->pending_scale = factor;\n}\n#endif\n\n#ifdef WL_OUTPUT_NAME_SINCE_VERSION\nstatic void output_name(void *data, struct wl_output *wl_output,\n                        const char *name) {}\n#endif\n\n#ifdef WL_OUTPUT_DESCRIPTION_SINCE_VERSION\nstatic void output_description(void *data, struct wl_output *wl_output,\n                               const char *description) {}\n#endif\n\nstatic const wl_output_listener output_listener = {\n    /*.geometry =*/output_geometry,\n    /*.mode =*/output_mode,\n#ifdef WL_OUTPUT_DONE_SINCE_VERSION\n    /*.done =*/output_done,\n#endif\n#ifdef WL_OUTPUT_SCALE_SINCE_VERSION\n    /*.scale =*/&output_scale,\n#endif\n#ifdef WL_OUTPUT_NAME_SINCE_VERSION\n    /*.name =*/&output_name,\n#endif\n#ifdef WL_OUTPUT_DESCRIPTION_SINCE_VERSION\n    /*.description =*/&output_description,\n#endif\n};\n\nvoid registry_handle_global(void *data, struct wl_registry *registry,\n                            uint32_t name, const char *interface,\n                            uint32_t version) {\n  if (strcmp(interface, \"wl_compositor\") == 0) {\n    wl_globals.compositor = static_cast<wl_compositor *>(\n        wl_registry_bind(registry, name, &wl_compositor_interface, 3));\n  } else if (strcmp(interface, \"wl_shm\") == 0) {\n    wl_globals.shm = static_cast<wl_shm *>(\n        wl_registry_bind(registry, name, &wl_shm_interface, 1));\n  } else if (strcmp(interface, \"wl_seat\") == 0) {\n    wl_globals.seat = static_cast<wl_seat *>(\n        wl_registry_bind(registry, name, &wl_seat_interface, 1));\n  } else if (strcmp(interface, \"wl_output\") == 0) {\n    wl_globals.output = static_cast<wl_output *>(\n        wl_registry_bind(registry, name, &wl_output_interface, 2));\n    wl_output_add_listener(wl_globals.output, &output_listener, nullptr);\n  } else if (strcmp(interface, \"xdg_wm_base\") == 0) {\n    wl_globals.shell = static_cast<xdg_wm_base *>(\n        wl_registry_bind(registry, name, &xdg_wm_base_interface, 1));\n    xdg_wm_base_add_listener(wl_globals.shell, &xdg_wm_base_listener, nullptr);\n  } else if (strcmp(interface, \"zwlr_layer_shell_v1\") == 0) {\n    wl_globals.layer_shell = static_cast<zwlr_layer_shell_v1 *>(\n        wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 1));\n  }\n}\n\nvoid registry_handle_global_remove(void *data, struct wl_registry *registry,\n                                   uint32_t name) {}\n\nstatic const wl_registry_listener registry_listener = {\n    registry_handle_global, registry_handle_global_remove};\n\nstatic void layer_surface_configure(void *data,\n                                    struct zwlr_layer_surface_v1 *layer_surface,\n                                    uint32_t serial, uint32_t width,\n                                    uint32_t height) {\n  zwlr_layer_surface_v1_ack_configure(layer_surface, serial);\n}\n\nstatic void layer_surface_closed(void *data,\n                                 struct zwlr_layer_surface_v1 *layer_surface) {}\n\nstatic const zwlr_layer_surface_v1_listener layer_surface_listener = {\n    /*.configure =*/&layer_surface_configure,\n    /*.closed =*/&layer_surface_closed,\n};\n\nstruct window *window_create(struct wl_surface *surface, struct wl_shm *shm,\n                             int width, int height);\n\nvoid window_resize(struct window *window, int width, int height);\n\nvoid window_allocate_buffer(struct window *window);\n\nvoid window_destroy(struct window *window);\n\nvoid window_commit_buffer(struct window *window);\n\nvoid window_get_width_height(struct window *window, int *w, int *h);\n\nvoid window_layer_surface_set_size(struct window *window) {\n  zwlr_layer_surface_v1_set_size(global_window->layer_surface,\n                                 global_window->rectangle.width(),\n                                 global_window->rectangle.height());\n}\n\n#ifdef BUILD_MOUSE_EVENTS\nstatic std::map<wl_pointer *, vec2<size_t>> last_known_positions{};\n\nstatic void on_pointer_enter(void *data, wl_pointer *pointer,\n                             std::uint32_t serial, wl_surface *surface,\n                             wl_fixed_t surface_x, wl_fixed_t surface_y) {\n  auto w = reinterpret_cast<struct window *>(data);\n\n  auto pos =\n      vec2d(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y));\n  last_known_positions[pointer] = pos;\n  auto pos_abs = w->rectangle.pos() + pos;\n\n  mouse_crossing_event event{mouse_event_t::AREA_ENTER, pos, pos_abs};\n  llua_mouse_hook(event);\n}\n\nstatic void on_pointer_leave(void *data, struct wl_pointer *pointer,\n                             std::uint32_t serial, struct wl_surface *surface) {\n  auto w = reinterpret_cast<struct window *>(data);\n\n  auto pos = last_known_positions[pointer];\n  auto pos_abs = w->rectangle.pos() + pos;\n\n  mouse_crossing_event event{mouse_event_t::AREA_LEAVE, pos, pos_abs};\n  llua_mouse_hook(event);\n}\n\nstatic void on_pointer_motion(void *data, struct wl_pointer *pointer,\n                              std::uint32_t _time, wl_fixed_t surface_x,\n                              wl_fixed_t surface_y) {\n  auto w = reinterpret_cast<struct window *>(data);\n\n  auto pos =\n      vec2d(wl_fixed_to_double(surface_x), wl_fixed_to_double(surface_y));\n  last_known_positions[pointer] = pos;\n  auto pos_abs = w->rectangle.pos() + pos;\n\n  mouse_move_event event{pos, pos_abs};\n  llua_mouse_hook(event);\n}\n\nstatic void on_pointer_button(void *data, struct wl_pointer *pointer,\n                              std::uint32_t serial, std::uint32_t time,\n                              std::uint32_t button, std::uint32_t state) {\n  auto w = reinterpret_cast<struct window *>(data);\n\n  auto pos = last_known_positions[pointer];\n  auto pos_abs = w->rectangle.pos() + pos;\n\n  mouse_button_event event{\n      mouse_event_t::RELEASE,\n      pos,\n      pos_abs,\n      static_cast<mouse_button_t>(button),\n  };\n\n  switch (static_cast<wl_pointer_button_state>(state)) {\n    case WL_POINTER_BUTTON_STATE_RELEASED:\n      // pass; default is MOUSE_RELEASE\n      break;\n    case WL_POINTER_BUTTON_STATE_PRESSED:\n      event.type = mouse_event_t::PRESS;\n      break;\n    default:\n      return;\n  }\n  llua_mouse_hook(event);\n}\n\nvoid on_pointer_axis(void *data, struct wl_pointer *pointer, std::uint32_t time,\n                     std::uint32_t axis, wl_fixed_t value) {\n  if (value == 0) return;\n\n  auto w = reinterpret_cast<struct window *>(data);\n\n  auto pos = last_known_positions[pointer];\n  auto pos_abs = w->rectangle.pos() + pos;\n\n  mouse_scroll_event event{\n      pos,\n      pos_abs,\n      scroll_direction_t::UP,\n  };\n\n  switch (static_cast<wl_pointer_axis>(axis)) {\n    case WL_POINTER_AXIS_VERTICAL_SCROLL:\n      event.direction =\n          value > 0 ? scroll_direction_t::DOWN : scroll_direction_t::UP;\n      break;\n    case WL_POINTER_AXIS_HORIZONTAL_SCROLL:\n      event.direction =\n          value > 0 ? scroll_direction_t::RIGHT : scroll_direction_t::LEFT;\n      break;\n    default:\n      return;\n  }\n  llua_mouse_hook(event);\n}\n\nstatic const wl_pointer_listener pointer_listener = {\n    .enter = on_pointer_enter,\n    .leave = on_pointer_leave,\n    .motion = on_pointer_motion,\n    .button = on_pointer_button,\n    .axis = on_pointer_axis,\n};\n\nstatic void seat_capability_listener(void *data, wl_seat *seat,\n                                     uint32_t capability_int) {\n  wl_seat_capability capabilities =\n      static_cast<wl_seat_capability>(capability_int);\n  if (wl_globals.seat == seat) {\n    if ((capabilities & WL_SEAT_CAPABILITY_POINTER) > 0) {\n      wl_globals.pointer = wl_seat_get_pointer(seat);\n\n      wl_pointer_add_listener(wl_globals.pointer, &pointer_listener, data);\n    }\n  }\n}\nstatic void seat_name_listener(void *data, struct wl_seat *wl_seat,\n                               const char *name) {}\n\nstatic const wl_seat_listener seat_listener = {\n    .capabilities = seat_capability_listener,\n    .name = seat_name_listener,\n};\n#endif /* BUILD_MOUSE_EVENTS */\n\nbool display_output_wayland::initialize() {\n  epoll_fd = epoll_create1(0);\n  if (epoll_fd < 0) {\n    perror(\"conky: epoll_create\");\n    return false;\n  }\n  global_display = wl_display_connect(NULL);\n  if (!global_display) {\n    perror(\"conky: wl_display_connect\");\n    return false;\n  }\n\n  wl_globals.registry = wl_display_get_registry(global_display);\n  wl_registry_add_listener(wl_globals.registry, &registry_listener, NULL);\n\n  wl_display_roundtrip(global_display);\n  if (wl_globals.layer_shell == nullptr) {\n    // TODO: Implement OWN_WINDOW and XDG Shell support\n    CRIT_ERR(\n        \"Compositor doesn't support wlr-layer-shell-unstable-v1. Can't run \"\n        \"conky.\");\n  }\n\n  struct wl_surface *surface =\n      wl_compositor_create_surface(wl_globals.compositor);\n  global_window = window_create(surface, wl_globals.shm, 1, 1);\n  window_allocate_buffer(global_window);\n\n  global_window->layer_surface = zwlr_layer_shell_v1_get_layer_surface(\n      wl_globals.layer_shell, global_window->surface, nullptr,\n      ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM, \"conky_namespace\");\n  window_layer_surface_set_size(global_window);\n  zwlr_layer_surface_v1_add_listener(global_window->layer_surface,\n                                     &layer_surface_listener, nullptr);\n\n#ifdef BUILD_MOUSE_EVENTS\n  wl_seat_add_listener(wl_globals.seat, &seat_listener, global_window);\n#endif /* BUILD_MOUSE_EVENTS */\n\n  wl_surface_commit(global_window->surface);\n  wl_display_roundtrip(global_display);\n\n  wayland_create_window();\n  return true;\n}\n\ntypedef void (*display_global_handler_t)(struct display *display, uint32_t name,\n                                         const char *interface,\n                                         uint32_t version, void *data);\ntypedef void (*display_output_handler_t)(struct output *output, void *data);\n\nbool display_output_wayland::shutdown() { return false; }\n\n#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))\n\nbool display_output_wayland::main_loop_wait(double t) {\n  errno = 0;\n  while (wl_display_prepare_read(global_display) != 0) {\n    if (wl_display_dispatch_pending(global_display) == -1) {\n      CRIT_ERR(\"wayland error: %s\", strerror(errno));\n    }\n  }\n\n  errno = 0;\n  if (wl_display_flush(global_display) < 0 && errno != EAGAIN) {\n    wl_display_cancel_read(global_display);\n    CRIT_ERR(\"wayland error: %s\", strerror(errno));\n  }\n\n  if (t < 0.0) { t = 0.0; }\n  int ms = t * 1000;\n\n  /* add fd to epoll set the first time around */\n  static bool configured_epoll = false;\n  if (!configured_epoll) {\n    ep[0].events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLET;\n    ep[0].data.ptr = nullptr;\n    if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, wl_display_get_fd(global_display),\n                  &ep[0]) == -1) {\n      CRIT_ERR(\"unable to setup epoll for display fd\");\n      return false;\n    }\n    configured_epoll = true;\n  }\n\n  /* wait for Wayland event or timeout */\n  int ep_count = epoll_wait(epoll_fd, ep, ARRAY_LENGTH(ep), ms);\n\n  if (ep_count > 0) {\n    if (ep[0].events & (EPOLLERR | EPOLLHUP)) { CRIT_ERR(\"output closed\"); }\n  }\n\n  int read_status = 0;\n  if (ep_count > 0) {\n    read_status = wl_display_read_events(global_display);\n  } else {\n    wl_display_cancel_read(global_display);\n  }\n\n  if (read_status == 0) {\n    int num = wl_display_dispatch_pending(global_display);\n    (void)num;\n    DBGP2(\"dispatched %d Wayland events\", num);\n  }\n\n  wl_display_flush(global_display);\n\n  /* timeout */\n  if (ep_count == 0) { update_text(); }\n\n  if (need_to_update != 0) {\n    need_to_update = 0;\n    selected_font = 0;\n    update_text_area();\n\n    int changed = 0;\n    int border_total = get_border_total();\n\n    int width, height;\n    window_get_width_height(global_window, &width, &height);\n\n    int fixed_size = 0;\n\n    bool scale_changed = global_window->scale != global_window->pending_scale;\n\n    /* resize window if it isn't right size */\n    if ((fixed_size == 0) &&\n        (text_size.x() + 2 * border_total != width ||\n         text_size.y() + 2 * border_total != height || scale_changed)) {\n      /* clamp text_width to configured maximum */\n      if (maximum_width.get(*state)) {\n        int mw = global_window->scale * maximum_width.get(*state);\n        if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); }\n      }\n\n      /* pending scale will be applied by resizing the window */\n      global_window->scale = global_window->pending_scale;\n\n      width = text_size.x() + 2 * border_total;\n      height = text_size.y() + 2 * border_total;\n      window_resize(global_window, width, height); /* resize window */\n\n      changed++;\n      /* update lua window globals */\n      llua_update_window_table(conky::rect<int>(text_start, text_size));\n    }\n\n/* move window if it isn't in right position */\n#ifdef POSITION\n    if ((fixed_pos == 0) && (window.x != wx || window.y != wy)) {\n      // XMoveWindow(display, window.window, window.x, window.y);\n      changed++;\n    }\n#endif\n\n    /* update struts */\n    if (changed != 0) {\n      int anchor = 0;\n\n      DBGP(\"%s\", _(PACKAGE_NAME \": defining struts\\n\"));\n      fflush(stderr);\n\n      alignment text_align = text_alignment.get(*state);\n      switch (vertical_alignment(text_align)) {\n        case axis_align::START:\n          anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_TOP;\n          break;\n        case axis_align::END:\n          anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM;\n          break;\n        default:\n          break;\n      }\n      switch (horizontal_alignment(text_align)) {\n        case axis_align::START:\n          anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT;\n          break;\n        case axis_align::END:\n          anchor |= ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT;\n          break;\n        default:\n          break;\n      }\n      // middle anchor alignment is the default and requires no special\n      // handling.\n\n      if (anchor != -1) {\n        zwlr_layer_surface_v1_set_anchor(global_window->layer_surface, anchor);\n        zwlr_layer_surface_v1_set_margin(global_window->layer_surface,\n                                         gap_y.get(*state), gap_x.get(*state),\n                                         gap_y.get(*state), gap_x.get(*state));\n      }\n    }\n\n    clear_text(1);\n    draw_stuff();\n  }\n  wl_display_flush(global_display);\n\n#ifdef INPUT\n#ifdef X_EVENT\n  case ButtonPress:\n    if (own_window.get(*state)) {\n      /* if an ordinary window with decorations */\n      if ((own_window_type.get(*state) == TYPE_NORMAL &&\n           !TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)) ||\n          own_window_type.get(*state) == TYPE_DESKTOP) {\n        /* allow conky to hold input focus. */\n        break;\n      }\n      /* forward the click to the desktop window */\n      XUngrabPointer(display, ev.xbutton.time);\n      ev.xbutton.window = window.desktop;\n      ev.xbutton.x = ev.xbutton.x_root;\n      ev.xbutton.y = ev.xbutton.y_root;\n      XSendEvent(display, ev.xbutton.window, False, ButtonPressMask, &ev);\n      XSetInputFocus(display, ev.xbutton.window, RevertToParent,\n                     ev.xbutton.time);\n    }\n    break;\n\n  case ButtonRelease:\n    if (own_window.get(*state)) {\n      /* if an ordinary window with decorations */\n      if ((own_window_type.get(*state) == TYPE_NORMAL) &&\n          !TEST_HINT(own_window_hints.get(*state), HINT_UNDECORATED)) {\n        /* allow conky to hold input focus. */\n        break;\n      }\n      /* forward the release to the desktop window */\n      ev.xbutton.window = window.desktop;\n      ev.xbutton.x = ev.xbutton.x_root;\n      ev.xbutton.y = ev.xbutton.y_root;\n      XSendEvent(display, ev.xbutton.window, False, ButtonReleaseMask, &ev);\n    }\n    break;\n#endif /*X_EVENT*/\n#endif /*INPUT*/\n\n    // handled\n    return true;\n}\n\nvoid display_output_wayland::sigterm_cleanup() {}\n\nvoid display_output_wayland::cleanup() {\n  if (global_window != nullptr) {\n    window_destroy(global_window);\n    global_window = nullptr;\n  }\n  free_fonts(utf8_mode.get(*state));\n}\n\nvoid display_output_wayland::set_foreground_color(Colour c) {\n  current_color = c;\n  if (global_window->cr) {\n    cairo_set_source_rgba(global_window->cr, current_color.red / 255.0,\n                          current_color.green / 255.0,\n                          current_color.blue / 255.0,\n                          current_color.alpha / 255.0);\n  }\n}\n\nint display_output_wayland::calc_text_width(const char *s) {\n  struct window *window = global_window;\n  size_t slen = strlen(s);\n  pango_layout_set_text(window->layout, s, slen);\n  PangoRectangle margin_rect;\n  pango_layout_set_font_description(window->layout,\n                                    pango_fonts[selected_font].desc);\n  pango_layout_get_pixel_extents(window->layout, nullptr, &margin_rect);\n  return margin_rect.width;\n}\n\nstatic void adjust_coords(int &x, int &y) {\n  x -= text_start.x();\n  y -= text_start.y();\n  int border = get_border_total();\n  x += border;\n  y += border;\n}\n\nvoid display_output_wayland::draw_string_at(int x, int y, const char *s,\n                                            int w) {\n  struct window *window = global_window;\n  y -= pango_fonts[selected_font].metrics.ascent;\n  adjust_coords(x, y);\n  pango_layout_set_text(window->layout, s, strlen(s));\n  cairo_save(window->cr);\n  uint8_t r = current_color.red;\n  uint8_t g = current_color.green;\n  uint8_t b = current_color.blue;\n  unsigned int a = pango_fonts[selected_font].font_alpha;\n  cairo_set_source_rgba(global_window->cr, r / 255.0, g / 255.0, b / 255.0,\n                        a / 65535.);\n  cairo_move_to(window->cr, x, y);\n  pango_cairo_show_layout(window->cr, window->layout);\n  cairo_restore(window->cr);\n}\n\nvoid display_output_wayland::set_line_style(int w, bool solid) {\n  struct window *window = global_window;\n  static double dashes[2] = {1.0, 1.0};\n  if (solid)\n    cairo_set_dash(window->cr, nullptr, 0, 0);\n  else\n    cairo_set_dash(window->cr, dashes, 2, 0);\n  cairo_set_line_width(window->cr, w);\n}\n\nvoid display_output_wayland::set_dashes(char *s) {\n  struct window *window = global_window;\n  size_t len = strlen(s);\n  double *dashes = new double[len];\n  for (size_t i = 0; i < len; i++) { dashes[i] = s[i]; }\n  cairo_set_dash(window->cr, dashes, len, 0);\n  delete[] dashes;\n}\n\nvoid display_output_wayland::draw_line(int x1, int y1, int x2, int y2) {\n  struct window *window = global_window;\n  adjust_coords(x1, y1);\n  adjust_coords(x2, y2);\n  cairo_save(window->cr);\n  cairo_move_to(window->cr, x1 - 0.5, y1 - 0.5);\n  cairo_line_to(window->cr, x2 - 0.5, y2 - 0.5);\n  cairo_stroke(window->cr);\n  cairo_restore(window->cr);\n}\n\nstatic void do_rect(int x, int y, int w, int h, bool fill) {\n  struct window *window = global_window;\n  adjust_coords(x, y);\n\n  cairo_save(window->cr);\n  if (fill) {\n    /* Note that cairo interprets fill and stroke coordinates differently,\n    so here we don't add 0.5 to move between centers and corners of pixels. */\n    cairo_rectangle(window->cr, x, y, w - 1, h - 1);\n    cairo_fill(window->cr);\n  } else {\n    cairo_rectangle(window->cr, x - 0.5, y - 0.5, w, h);\n    cairo_stroke(window->cr);\n  }\n  cairo_restore(window->cr);\n}\n\nvoid display_output_wayland::draw_rect(int x, int y, int w, int h) {\n  do_rect(x, y, w, h, false);\n}\n\nvoid display_output_wayland::fill_rect(int x, int y, int w, int h) {\n  do_rect(x, y, w, h, true);\n}\n\nvoid display_output_wayland::draw_arc(int x, int y, int w, int h, int a1,\n                                      int a2) {\n  struct window *window = global_window;\n  adjust_coords(x, y);\n  cairo_save(window->cr);\n  cairo_translate(window->cr, x + w / 2. - 0.5, y + h / 2. - 0.5);\n  cairo_scale(window->cr, w / 2., h / 2.);\n  cairo_set_line_width(window->cr, 2. / (w + h));\n  double mult = M_PI / (180. * 64.);\n  cairo_arc_negative(window->cr, 0., 0., 1., a1 * mult, a2 * mult);\n  cairo_stroke(window->cr);\n  cairo_restore(window->cr);\n}\n\nvoid display_output_wayland::move_win(int x, int y) {\n  // window.x = x;\n  // window.y = y;\n  // TODO\n}\nfloat display_output_wayland::get_dpi_scale() { return 1.0; }\n\nvoid display_output_wayland::end_draw_stuff() {\n  window_commit_buffer(global_window);\n}\n\nvoid display_output_wayland::clear_text(int exposures) {\n  struct window *window = global_window;\n  cairo_save(window->cr);\n\n  Colour color;\n  if (set_transparent.get(*state)) {\n    color.alpha = 0;\n  } else {\n    color = background_colour.get(*state);\n    color.alpha = own_window_argb_value.get(*state);\n  }\n\n  cairo_set_operator(window->cr, CAIRO_OPERATOR_CLEAR);\n  cairo_paint(window->cr);\n  cairo_set_source_rgba(window->cr, color.red / 255.0, color.green / 255.0,\n                        color.blue / 255.0, color.alpha / 255.0);\n  cairo_set_operator(window->cr, CAIRO_OPERATOR_OVER);\n  cairo_rectangle(window->cr, 0, 0, window->rectangle.width(),\n                  window->rectangle.height());\n  cairo_fill(window->cr);\n  cairo_restore(window->cr);\n}\n\nint display_output_wayland::font_height(unsigned int f) {\n  if (pango_fonts.size() == 0) { return 2; }\n  assert(f < pango_fonts.size());\n  return pango_fonts[f].metrics.ascent + pango_fonts[f].metrics.descent;\n}\n\nint display_output_wayland::font_ascent(unsigned int f) {\n  if (pango_fonts.size() == 0) { return 1; }\n  assert(f < pango_fonts.size());\n  return pango_fonts[f].metrics.ascent;\n}\n\nint display_output_wayland::font_descent(unsigned int f) {\n  if (pango_fonts.size() == 0) { return 1; }\n  assert(f < pango_fonts.size());\n  return pango_fonts[f].metrics.descent;\n}\n\nvoid display_output_wayland::setup_fonts(void) { /* Nothing to do here */\n}\n\nvoid display_output_wayland::set_font(unsigned int f) {\n  assert(f < pango_fonts.size());\n  if (pango_fonts.size() > f && pango_fonts[f].desc != nullptr) {\n    pango_layout_set_font_description(global_window->layout,\n                                      pango_fonts[f].desc);\n  }\n}\n\nvoid display_output_wayland::free_fonts(bool utf8) {\n  for (auto &font : pango_fonts) {\n    if (font.desc != nullptr) {\n      pango_font_description_free(font.desc);\n      font.desc = nullptr;\n    }\n  }\n  pango_fonts.clear();\n}\n\nvoid display_output_wayland::load_fonts(bool utf8) {\n  free_fonts(utf8);\n  pango_fonts.resize(fonts.size());\n  for (unsigned int i = 0; i < fonts.size(); i++) {\n    auto &font = fonts[i];\n    auto &pango_font_entry = pango_fonts[i];\n    FcPattern *fc_pattern =\n        FcNameParse(reinterpret_cast<const unsigned char *>(font.name.c_str()));\n    // pango_fc_font_description_from_pattern requires a FAMILY to be set,\n    // so set an empty one if none is present.\n    FcValue dummy;\n    if (FcPatternGet(fc_pattern, FC_FAMILY, 0, &dummy) != FcResultMatch) {\n      FcPatternAddString(fc_pattern, FC_FAMILY, (FcChar8 *)\"\");\n    }\n    pango_font_entry.desc =\n        pango_fc_font_description_from_pattern(fc_pattern, true);\n\n    // Handle pixel size ourselves because\n    // pango_fc_font_description_from_pattern does not\n    double pixel_size = -1;\n    if (FcPatternGetDouble(fc_pattern, FC_PIXEL_SIZE, 0, &pixel_size) ==\n        FcResultMatch) {\n      pango_font_description_set_absolute_size(pango_font_entry.desc,\n                                               pixel_size * PANGO_SCALE);\n    }\n    FcPatternDestroy(fc_pattern);\n\n    PangoFont *pango_font = pango_context_load_font(\n        global_window->pango_context, pango_font_entry.desc);\n    PangoFontMetrics *font_metrics =\n        pango_font_get_metrics(pango_font, nullptr);\n    auto ascent = pango_font_metrics_get_ascent(font_metrics) / PANGO_SCALE;\n    auto descent = pango_font_metrics_get_descent(font_metrics) / PANGO_SCALE;\n    pango_font_metrics_unref(font_metrics);\n    g_object_unref(pango_font);\n\n    pango_font_entry.metrics.ascent = ascent;\n    pango_font_entry.metrics.descent = descent;\n  }\n}\n\nstruct shm_pool {\n  struct wl_shm_pool *pool;\n  size_t size;\n  size_t used;\n  void *data;\n};\n\nstruct shm_surface_data {\n  struct wl_buffer *buffer;\n  struct shm_pool *pool;\n};\n\nstatic const cairo_user_data_key_t shm_surface_data_key = {0};\n\nstruct wl_buffer *get_buffer_from_cairo_surface(cairo_surface_t *surface) {\n  struct shm_surface_data *data;\n\n  data = static_cast<struct shm_surface_data *>(\n      cairo_surface_get_user_data(surface, &shm_surface_data_key));\n\n  return data->buffer;\n}\n\nstatic void shm_pool_destroy(struct shm_pool *pool);\n\nstatic void shm_surface_data_destroy(void *p) {\n  struct shm_surface_data *data = static_cast<struct shm_surface_data *>(p);\n  wl_buffer_destroy(data->buffer);\n  if (data->pool) shm_pool_destroy(data->pool);\n\n  delete data;\n}\n\nstatic struct wl_shm_pool *make_shm_pool(struct wl_shm *shm, int size,\n                                         void **data) {\n  struct wl_shm_pool *pool;\n  int fd;\n\n  fd = os_create_anonymous_file(size);\n  if (fd < 0) {\n    fprintf(stderr, \"creating a buffer file for %d B failed: %m\\n\", size);\n    return NULL;\n  }\n\n  *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);\n  if (*data == MAP_FAILED) {\n    fprintf(stderr, \"mmap failed: %m\\n\");\n    close(fd);\n    return NULL;\n  }\n\n  pool = wl_shm_create_pool(shm, fd, size);\n\n  close(fd);\n\n  return pool;\n}\n\nstatic struct shm_pool *shm_pool_create(struct wl_shm *shm, size_t size) {\n  struct shm_pool *pool = new struct shm_pool;\n\n  if (!pool) return NULL;\n\n  pool->pool = make_shm_pool(shm, size, &pool->data);\n  if (!pool->pool) {\n    delete pool;\n    return NULL;\n  }\n\n  pool->size = size;\n  pool->used = 0;\n\n  return pool;\n}\n\nstatic void *shm_pool_allocate(struct shm_pool *pool, size_t size,\n                               int *offset) {\n  if (pool->used + size > pool->size) return NULL;\n\n  *offset = pool->used;\n  pool->used += size;\n\n  return (char *)pool->data + *offset;\n}\n\n/* destroy the pool. this does not unmap the memory though */\nstatic void shm_pool_destroy(struct shm_pool *pool) {\n  munmap(pool->data, pool->size);\n  wl_shm_pool_destroy(pool->pool);\n  delete pool;\n}\n\nstatic int stride_for_shm_surface(rect<size_t> *rect, int scale) {\n  return cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32,\n                                       rect->width() * scale);\n}\n\nstatic int data_length_for_shm_surface(rect<size_t> *rect, int scale) {\n  int stride;\n\n  stride = stride_for_shm_surface(rect, scale);\n  return stride * rect->height() * scale;\n}\n\nstatic cairo_surface_t *create_shm_surface_from_pool(void *none,\n                                                     rect<size_t> *rectangle,\n                                                     struct shm_pool *pool,\n                                                     int scale) {\n  struct shm_surface_data *data;\n  uint32_t format;\n  cairo_surface_t *surface;\n  cairo_format_t cairo_format;\n  int stride, length, offset;\n  void *map;\n\n  data = new struct shm_surface_data;\n  if (data == NULL) return NULL;\n\n  cairo_format = CAIRO_FORMAT_ARGB32; /*or CAIRO_FORMAT_RGB16_565 who knows??*/\n\n  stride = stride_for_shm_surface(rectangle, scale);\n  length = data_length_for_shm_surface(rectangle, scale);\n  data->pool = NULL;\n  map = shm_pool_allocate(pool, length, &offset);\n\n  if (!map) {\n    delete data;\n    return NULL;\n  }\n\n  auto scaled = rectangle->size() * scale;\n  surface = cairo_image_surface_create_for_data(\n      static_cast<unsigned char *>(map), cairo_format, scaled.x(), scaled.y(),\n      stride);\n\n  cairo_surface_set_user_data(surface, &shm_surface_data_key, data,\n                              shm_surface_data_destroy);\n\n  format = WL_SHM_FORMAT_ARGB8888; /*or WL_SHM_FORMAT_RGB565*/\n\n  data->buffer = wl_shm_pool_create_buffer(pool->pool, offset, scaled.x(),\n                                           scaled.y(), stride, format);\n\n  return surface;\n}\n\nvoid window_allocate_buffer(struct window *window) {\n  assert(window->shm != nullptr);\n\n  int scale = window->pending_scale;\n  struct shm_pool *pool;\n  pool = shm_pool_create(\n      window->shm, data_length_for_shm_surface(&window->rectangle, scale));\n  if (!pool) {\n    fprintf(stderr, \"could not allocate shm pool\\n\");\n    return;\n  }\n\n  window->cairo_surface = create_shm_surface_from_pool(\n      window->shm, &window->rectangle, pool, scale);\n  cairo_surface_set_device_scale(window->cairo_surface, scale, scale);\n\n  if (!window->cairo_surface) {\n    shm_pool_destroy(pool);\n    return;\n  }\n\n  window->cr = cairo_create(window->cairo_surface);\n  window->layout = pango_cairo_create_layout(window->cr);\n  window->pango_context = pango_cairo_create_context(window->cr);\n\n  /* make sure we destroy the pool when the surface is destroyed */\n  struct shm_surface_data *data;\n  data = static_cast<struct shm_surface_data *>(cairo_surface_get_user_data(\n      window->cairo_surface, &shm_surface_data_key));\n  data->pool = pool;\n}\n\nstruct window *window_create(struct wl_surface *surface, struct wl_shm *shm,\n                             int width, int height) {\n  struct window *window;\n  window = new struct window;\n\n  window->rectangle.set_pos(vec2<size_t>::Zero());\n  window->rectangle.set_size(width, height);\n  window->scale = 0;\n  window->pending_scale = 1;\n\n  window->surface = surface;\n  window->shm = shm;\n\n  window->cairo_surface = nullptr;\n  window->cr = nullptr;\n  window->layout = nullptr;\n  window->pango_context = nullptr;\n\n  return window;\n}\n\nvoid window_free_buffer(struct window *window) {\n  cairo_surface_destroy(window->cairo_surface);\n  cairo_destroy(window->cr);\n  g_object_unref(window->layout);\n  g_object_unref(window->pango_context);\n  window->cairo_surface = nullptr;\n  window->cr = nullptr;\n  window->layout = nullptr;\n  window->pango_context = nullptr;\n}\n\nvoid window_destroy(struct window *window) {\n  window_free_buffer(window);\n  zwlr_layer_surface_v1_destroy(window->layer_surface);\n  wl_surface_attach(window->surface, nullptr, 0, 0);\n  wl_surface_commit(window->surface);\n  wl_display_roundtrip(global_display);\n  wl_surface_destroy(window->surface);\n  wl_shm_destroy(window->shm);\n  delete window;\n}\n\nvoid window_resize(struct window *window, int width, int height) {\n  window_free_buffer(window);\n  window->rectangle.set_size(width, height);\n  window_allocate_buffer(window);\n  window_layer_surface_set_size(window);\n}\n\nvoid window_commit_buffer(struct window *window) {\n  assert(window->cairo_surface != nullptr);\n  wl_surface_set_buffer_scale(global_window->surface,\n                              global_window->pending_scale);\n  wl_surface_attach(window->surface,\n                    get_buffer_from_cairo_surface(window->cairo_surface), 0, 0);\n  /* repaint all the pixels in the surface, change size to only repaint changed\n   * area*/\n  wl_surface_damage(window->surface, window->rectangle.x(),\n                    window->rectangle.y(), window->rectangle.width(),\n                    window->rectangle.height());\n  wl_surface_commit(window->surface);\n}\n\nvoid window_get_width_height(struct window *window, int *w, int *h) {\n  *w = window->rectangle.width();\n  *h = window->rectangle.height();\n}\n\n}  // namespace conky\n"
  },
  {
    "path": "src/output/display-wayland.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018-2021 François Revol et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISPLAY_WAYLAND_HH\n#define DISPLAY_WAYLAND_HH\n\n#include \"config.h\"\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"../content/colours.hh\"\n#include \"../lua/luamm.hh\"\n#include \"display-output.hh\"\n#include \"wl.h\"\n\nnamespace conky {\n\n/*\n * A base class for Wayland display output.\n */\nclass display_output_wayland : public display_output_base {\n public:\n  explicit display_output_wayland();\n\n  virtual ~display_output_wayland() {}\n\n  // check if available and enabled in settings\n  virtual bool detect();\n  // connect to DISPLAY and other stuff\n  virtual bool initialize();\n  virtual bool shutdown();\n\n  virtual bool main_loop_wait(double);\n\n  virtual void sigterm_cleanup();\n  virtual void cleanup();\n\n  // drawing primitives\n  virtual void set_foreground_color(Colour);\n\n  virtual int calc_text_width(const char *);\n\n  // GUI interface\n  virtual void draw_string_at(int, int, const char *, int);\n  // X11 lookalikes\n  virtual void set_line_style(int, bool);\n  virtual void set_dashes(char *);\n  virtual void draw_line(int, int, int, int);\n  virtual void draw_rect(int, int, int, int);\n  virtual void fill_rect(int, int, int, int);\n  virtual void draw_arc(int, int, int, int, int, int);\n  virtual void move_win(int, int);\n  virtual float get_dpi_scale();\n\n  virtual void end_draw_stuff();\n  virtual void clear_text(int);\n\n  virtual int font_height(unsigned int);\n  virtual int font_ascent(unsigned int);\n  virtual int font_descent(unsigned int);\n  virtual void setup_fonts(void);\n  virtual void set_font(unsigned int);\n  virtual void free_fonts(bool);\n  virtual void load_fonts(bool);\n\n  // Wayland-specific\n};\n\n}  // namespace conky\n\n#endif /* DISPLAY_WAYLAND_HH */\n"
  },
  {
    "path": "src/output/display-x11.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018-2021 François Revol et al.\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n\n#include \"display-x11.hh\"\n\n#include <X11/X.h>\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wvariadic-macros\"\n#include <X11/Xutil.h>\n#ifdef BUILD_XFT\n#include <X11/Xlib.h>\n#endif /* BUILD_XFT */\n#pragma GCC diagnostic pop\n#ifdef BUILD_XDAMAGE\n#include <X11/extensions/Xdamage.h>\n#endif /* BUILD_XDAMAGE */\n#include \"../lua/fonts.h\"\n#ifdef BUILD_IMLIB2\n#include \"../conky-imlib2.h\"\n#endif /* BUILD_IMLIB2 */\n#if defined(BUILD_MOUSE_EVENTS) || defined(BUILD_XINPUT)\n#include \"../mouse-events.h\"\n#endif /* BUILD_MOUSE_EVENTS || BUILD_XINPUT */\n#ifdef BUILD_XINPUT\n#include <X11/extensions/XI2.h>\n#include <X11/extensions/XInput2.h>\n#undef COUNT\n#endif /* BUILD_XINPUT */\n#include <X11/Xresource.h>\n\n#include <cstdint>\n#include <iostream>\n#include <map>\n#include <sstream>\n#include <tuple>\n#include <unordered_map>\n#include <vector>\n\n#include \"../conky.h\"\n#include \"../content/colours.hh\"\n#include \"../geometry.h\"\n#include \"../logging.h\"\n#include \"../lua/llua.h\"\n#include \"gui.h\"\n\n#include \"../lua/x11-settings.h\"\n#include \"x11.h\"\n\n// TODO: cleanup externs (move to conky.h ?)\n#ifdef OWN_WINDOW\nextern int fixed_size, fixed_pos;\n#endif                           /* OWN_WINDOW */\nextern conky::vec2i text_start;  /* text start position in window */\nextern conky::vec2i text_offset; /* offset for start position */\nextern conky::vec2i\n    text_size; /* initially 1 so no zero-sized window is created */\nextern double current_update_time, next_update_time, last_update_time;\nvoid update_text();\nextern int need_to_update;\nint get_border_total();\nextern conky::range_config_setting<int> maximum_width;\nextern Colour current_color;\nstatic float screen_dpi = -1;\n\n/* for x_fonts */\nstruct x_font_list {\n  XFontStruct *font;\n  XFontSet fontset;\n\n#ifdef BUILD_XFT\n  XftFont *xftfont;\n  int font_alpha;\n#endif\n\n  x_font_list()\n      : font(nullptr),\n        fontset(nullptr)\n#ifdef BUILD_XFT\n        ,\n        xftfont(nullptr),\n        font_alpha(0xffff)\n#endif\n  {\n  }\n};\n\nstatic std::vector<x_font_list> x_fonts; /* indexed by selected_font */\n\n#ifdef BUILD_XFT\nnamespace {\nclass xftalpha_setting : public conky::simple_config_setting<float> {\n  using Base = conky::simple_config_setting<float>;\n\n protected:\n  void lua_setter(lua::state &l, bool init) override {\n    lua::stack_sentry s(l, -2);\n\n    Base::lua_setter(l, init);\n\n    if (init && out_to_x.get(*state)) {\n      x_fonts.resize(std::max(1, static_cast<int>(fonts.size())));\n      x_fonts[0].font_alpha = do_convert(l, -1).first * 0xffff;\n    }\n\n    ++s;\n  }\n\n public:\n  xftalpha_setting() : Base(\"xftalpha\", 1.0, false) {}\n};\n\nxftalpha_setting xftalpha;\n}  // namespace\n#endif /* BUILD_XFT */\n\nstatic void X11_create_window();\n\nstruct _x11_stuff_s {\n  Region region;\n#ifdef BUILD_XDAMAGE\n  Damage damage;\n  XserverRegion region2, part;\n  int event_base, error_base;\n#endif\n} x11_stuff;\n\nvoid update_dpi() {\n  // Add XRandR support if used\n  // See dunst PR: https://github.com/dunst-project/dunst/pull/608\n\n#ifdef BUILD_XFT\n  if (screen_dpi > 0) return;\n  if (use_xft.get(*state)) {\n    XrmDatabase db = XrmGetDatabase(display);\n    if (db != nullptr) {\n      char *xrmType;\n      XrmValue xrmValue;\n      if (XrmGetResource(db, \"Xft.dpi\", \"Xft.dpi\", &xrmType, &xrmValue)) {\n        screen_dpi = strtof(xrmValue.addr, NULL);\n      }\n    } else {\n      auto dpi = XGetDefault(display, \"Xft\", \"dpi\");\n      if (dpi) { screen_dpi = strtof(dpi, nullptr); }\n    }\n  }\n#endif /* BUILD_XFT */\n  if (screen_dpi > 0) return;\n  screen_dpi = static_cast<float>(DisplayWidth(display, screen)) * 25.4 /\n               static_cast<float>(DisplayWidthMM(display, screen));\n}\n\nstatic void X11_create_window() {\n  if (!window.window) { return; }\n  setup_fonts();\n  load_fonts(utf8_mode.get(*state));\n  update_dpi();\n  update_text_area(); /* to position text/window on screen */\n\n#ifdef OWN_WINDOW\n  if (own_window.get(*state)) {\n    if (fixed_pos == 0) {\n      XMoveWindow(display, window.window, window.geometry.x(),\n                  window.geometry.y());\n    }\n\n    set_transparent_background(window.window);\n  }\n#endif\n\n  create_gc();\n\n  draw_stuff();\n\n  x11_stuff.region = XCreateRegion();\n#ifdef BUILD_XDAMAGE\n  if (XDamageQueryExtension(display, &x11_stuff.event_base,\n                            &x11_stuff.error_base) == 0) {\n    NORM_ERR(\"Xdamage extension unavailable\");\n    x11_stuff.damage = 0;\n  } else {\n    x11_stuff.damage =\n        XDamageCreate(display, window.window, XDamageReportNonEmpty);\n    x11_stuff.region2 = XFixesCreateRegionFromWindow(display, window.window, 0);\n    x11_stuff.part = XFixesCreateRegionFromWindow(display, window.window, 0);\n  }\n#endif /* BUILD_XDAMAGE */\n\n  selected_font = 0;\n  update_text_area(); /* to get initial size of the window */\n}\n\nnamespace conky {\nnamespace {\nconky::display_output_x11 x11_output;\n}  // namespace\n\ntemplate <>\nvoid register_output<output_t::X11>(display_outputs_t &outputs) {\n  outputs.push_back(&x11_output);\n}\n\ndisplay_output_x11::display_output_x11() : display_output_base(\"x11\") {\n  is_graphical = true;\n}\n\nbool display_output_x11::detect() {\n  if (out_to_x.get(*state)) {\n    DBGP2(\"Display output '%s' enabled in config.\", name.c_str());\n    return true;\n  }\n  return false;\n}\n\nbool display_output_x11::initialize() {\n  X11_create_window();\n  return true;\n}\n\nbool display_output_x11::shutdown() {\n  deinit_x11();\n  return true;\n}\n\nvoid process_surface_events(conky::display_output_x11 *surface,\n                            Display *display);\n\nbool display_output_x11::main_loop_wait(double t) {\n  /* wait for X event or timeout */\n  if (!display || !window.gc) return true;\n\n  if (XPending(display) == 0) {\n    fd_set fdsr;\n    struct timeval tv {};\n    int s;\n    // t = next_update_time - get_time();\n\n    t = std::min(std::max(t, 0.0), active_update_interval());\n\n    tv.tv_sec = static_cast<long>(t);\n    tv.tv_usec = static_cast<long>(t * 1000000) % 1000000;\n    FD_ZERO(&fdsr);\n    FD_SET(ConnectionNumber(display), &fdsr);\n\n    s = select(ConnectionNumber(display) + 1, &fdsr, nullptr, nullptr, &tv);\n    if (s == -1) {\n      if (errno != EINTR) { NORM_ERR(\"can't select(): %s\", strerror(errno)); }\n    } else {\n      /* timeout */\n      if (s == 0) { update_text(); }\n    }\n  }\n\n  vec2i border_total = vec2i::uniform(get_border_total());\n  if (need_to_update != 0) {\n#ifdef OWN_WINDOW\n    auto old_pos = window.geometry.pos();\n#endif\n\n    need_to_update = 0;\n    selected_font = 0;\n    update_text_area();\n\n#ifdef OWN_WINDOW\n    if (own_window.get(*state)) {\n      int changed = 0;\n\n      /* resize window if it isn't right size */\n      vec2<long> border_size = border_total * 2;\n      if ((fixed_size == 0) &&\n          (text_size + border_size != window.geometry.size())) {\n        window.geometry.set_size(text_size + border_size);\n        draw_stuff(); /* redraw everything in our newly sized window */\n        XResizeWindow(display, window.window, window.geometry.width(),\n                      window.geometry.height()); /* resize window */\n        set_transparent_background(window.window);\n#ifdef BUILD_XDBE\n        /* swap buffers */\n        xdbe_swap_buffers();\n#else\n        if (use_xpmdb.get(*state)) {\n          XFreePixmap(display, window.back_buffer);\n          window.back_buffer = XCreatePixmap(\n              display, window.window, window.geometry.width(),\n              window.geometry.height(), DefaultDepth(display, screen));\n\n          if (window.back_buffer != None) {\n            window.drawable = window.back_buffer;\n          } else {\n            // this is probably reallllly bad\n            NORM_ERR(\"Failed to allocate back buffer\");\n          }\n          XSetForeground(display, window.gc, 0);\n          XFillRectangle(display, window.drawable, window.gc, 0, 0,\n                         window.geometry.width(), window.geometry.height());\n        }\n#endif\n\n        changed++;\n        /* update lua window globals */\n        llua_update_window_table(rect<int>(text_start, text_size));\n      }\n\n      /* move window if it isn't in right position */\n      if ((fixed_pos == 0) && old_pos != window.geometry.pos()) {\n        XMoveWindow(display, window.window, window.geometry.x(),\n                    window.geometry.y());\n        changed++;\n      }\n\n      /* update struts */\n      if (changed != 0) {\n        auto window_type = own_window_type.get(*state);\n        // Openbox will implicitly set struts even for window_type::DOCK\n        if (window_type == window_type::PANEL) { set_struts(); }\n      }\n    }\n#endif\n\n    clear_text(1);\n\n#if defined(BUILD_XDBE)\n    if (use_xdbe.get(*state)) {\n#else\n    if (use_xpmdb.get(*state)) {\n#endif\n      XRectangle rect = conky::rect<int>(text_start - border_total,\n                                         text_size + border_total * 2)\n                            .to_xrectangle();\n      XUnionRectWithRegion(&rect, x11_stuff.region, x11_stuff.region);\n    }\n  }\n\n  process_surface_events(this, display);\n\n#ifdef BUILD_XDAMAGE\n  if (x11_stuff.damage) {\n    XDamageSubtract(display, x11_stuff.damage, x11_stuff.region2, None);\n    XFixesSetRegion(display, x11_stuff.region2, nullptr, 0);\n  }\n#endif /* BUILD_XDAMAGE */\n\n  /* XDBE doesn't seem to provide a way to clear the back buffer\n   * without interfering with the front buffer, other than passing\n   * XdbeBackground to XdbeSwapBuffers. That means that if we're\n   * using XDBE, we need to redraw the text even if it wasn't part of\n   * the exposed area. OTOH, if we're not going to call draw_stuff at\n   * all, then no swap happens and we can safely do nothing. */\n\n  if (XEmptyRegion(x11_stuff.region) == 0) {\n#if defined(BUILD_XDBE)\n    if (use_xdbe.get(*state)) {\n#else\n    if (use_xpmdb.get(*state)) {\n#endif\n      XRectangle rect = conky::rect<int>(text_start - border_total,\n                                         text_size + border_total * 2)\n                            .to_xrectangle();\n      XUnionRectWithRegion(&rect, x11_stuff.region, x11_stuff.region);\n    }\n    XSetRegion(display, window.gc, x11_stuff.region);\n#ifdef BUILD_XFT\n    if (use_xft.get(*state)) {\n      XftDrawSetClip(window.xftdraw, x11_stuff.region);\n    }\n#endif\n    draw_stuff();\n    XDestroyRegion(x11_stuff.region);\n    x11_stuff.region = XCreateRegion();\n  }\n\n  // handled\n  return true;\n}\n\nenum class x_event_handler {\n  XINPUT_MOTION,\n  MOUSE_INPUT,\n  PROPERTY_NOTIFY,\n  EXPOSE,\n  REPARENT,\n  CONFIGURE,\n  BORDER_CROSSING,\n  DAMAGE,\n};\n\ntemplate <x_event_handler handler>\nbool handle_event(conky::display_output_x11 *surface, Display *display,\n                  XEvent &ev, bool *consumed, void **cookie) {\n  return false;\n}\n\n#ifdef OWN_WINDOW\ntemplate <>\nbool handle_event<x_event_handler::MOUSE_INPUT>(\n    conky::display_output_x11 *surface, Display *display, XEvent &ev,\n    bool *consumed, void **cookie) {\n#ifdef BUILD_XINPUT\n  if (ev.type == ButtonPress || ev.type == ButtonRelease ||\n      ev.type == MotionNotify) {\n    // destroy basic X11 events; and manufacture them later when trying to\n    // propagate XInput ones - this is required because there's no (simple) way\n    // of making sure the lua hook controls both when it only handles XInput\n    // ones.\n    *consumed = true;\n    return true;\n  }\n\n  if (ev.type != GenericEvent || ev.xgeneric.extension != window.xi_opcode)\n    return false;\n\n  if (!XGetEventData(display, &ev.xcookie)) {\n    // already consumed\n    return true;\n  }\n  xi_event_type event_type = ev.xcookie.evtype;\n\n  if (event_type == XI_HierarchyChanged) {\n    auto device_change = reinterpret_cast<XIHierarchyEvent *>(ev.xcookie.data);\n    handle_xi_device_change(device_change);\n    XFreeEventData(display, &ev.xcookie);\n    return true;\n  }\n\n  auto *data = xi_event_data::read_cookie(display, ev.xcookie.data);\n  XFreeEventData(display, &ev.xcookie);\n  if (data == nullptr) {\n    // we ate the cookie, Xi event not handled\n    return true;\n  }\n  *cookie = data;\n\n  Window event_window = query_x11_window_at_pos(display, data->pos_absolute, data->device->master);\n\n  bool same_window = query_x11_top_parent(display, event_window) ==\n                     query_x11_top_parent(display, window.window);\n  bool cursor_over_conky =\n      same_window && window.geometry.contains(data->pos_absolute);\n\n  // XInput reports events twice on some hardware (even by 'xinput --test-xi2')\n  auto hash = std::make_tuple(data->serial, data->evtype, data->event);\n  typedef std::map<decltype(hash), Time> MouseEventDebounceMap;\n  static MouseEventDebounceMap debounce{};\n\n  Time now = data->time;\n  bool already_handled = debounce.count(hash) > 0;\n  debounce[hash] = now;\n\n  // clear stale entries\n  for (auto iter = debounce.begin(); iter != debounce.end();) {\n    if (data->time - iter->second > 1000) {\n      iter = debounce.erase(iter);\n    } else {\n      ++iter;\n    }\n  }\n\n  if (already_handled) {\n    *consumed = true;\n    return true;\n  }\n\n#ifdef BUILD_MOUSE_EVENTS\n  // query_result is not window.window in some cases.\n  modifier_state_t mods = x11_modifier_state(data->mods.effective);\n\n  if (data->evtype == XI_Motion) {\n    // TODO: Make valuator_index names configurable?\n\n    bool is_move = data->test_valuator(valuator_t::MOVE_X) ||\n                   data->test_valuator(valuator_t::MOVE_Y);\n    bool is_scroll = data->test_valuator(valuator_t::SCROLL_X) ||\n                     data->test_valuator(valuator_t::SCROLL_Y);\n\n    if (is_move) {\n      static bool cursor_inside = false;\n\n      // generate crossing events\n      if (cursor_over_conky) {\n        if (!cursor_inside) {\n          *consumed = llua_mouse_hook(mouse_crossing_event(\n              mouse_event_t::AREA_ENTER,\n              data->pos_absolute - window.geometry.pos(), data->pos_absolute));\n        }\n        cursor_inside = true;\n      } else if (cursor_inside) {\n        *consumed = llua_mouse_hook(mouse_crossing_event(\n            mouse_event_t::AREA_LEAVE,\n            data->pos_absolute - window.geometry.pos(), data->pos_absolute));\n        cursor_inside = false;\n      }\n\n      // generate movement events\n      if (cursor_over_conky) {\n        *consumed = llua_mouse_hook(\n            mouse_move_event(data->pos, data->pos_absolute, mods));\n      }\n    }\n    if (is_scroll && cursor_over_conky) {\n      scroll_direction_t scroll_direction;\n      auto vertical = data->valuator_relative_value(valuator_t::SCROLL_Y);\n      double vertical_value = vertical.value_or(0.0);\n\n      if (vertical_value != 0.0) {\n        scroll_direction = vertical_value < 0.0 ? scroll_direction_t::UP\n                                                : scroll_direction_t::DOWN;\n      } else {\n        auto horizontal = data->valuator_relative_value(valuator_t::SCROLL_X);\n        double horizontal_value = horizontal.value_or(0.0);\n        if (horizontal_value != 0.0) {\n          scroll_direction = horizontal_value < 0.0 ? scroll_direction_t::LEFT\n                                                    : scroll_direction_t::RIGHT;\n        }\n      }\n\n      if (scroll_direction != scroll_direction_t::UNKNOWN) {\n        *consumed = llua_mouse_hook(mouse_scroll_event(\n            data->pos, data->pos_absolute, scroll_direction, mods));\n      }\n    }\n  } else if (cursor_over_conky && (data->evtype == XI_ButtonPress ||\n                                   data->evtype == XI_ButtonRelease)) {\n    if (data->detail >= 4 && data->detail <= 7) {\n      // Handled via motion event valuators, ignoring \"backward compatibility\"\n      // ones.\n      return true;\n    }\n\n    mouse_event_t type = mouse_event_t::PRESS;\n    if (data->evtype == XI_ButtonRelease) { type = mouse_event_t::RELEASE; }\n\n    mouse_button_t button = x11_mouse_button_code(data->detail);\n    *consumed = llua_mouse_hook(\n        mouse_button_event(type, data->pos, data->pos_absolute, button, mods));\n  }\n#endif /* BUILD_MOUSE_EVENTS */\n\n#else /* BUILD_XINPUT */\n  if (ev.type != ButtonPress && ev.type != ButtonRelease &&\n      ev.type != MotionNotify)\n    return false;\n  if (ev.xany.window != window.window) return true;  // Skip other windows\n\n#ifdef BUILD_MOUSE_EVENTS\n  switch (ev.type) {\n    case ButtonPress: {\n      modifier_state_t mods = x11_modifier_state(ev.xbutton.state);\n      if (ev.xbutton.button >= 4 &&\n          ev.xbutton.button <= 7) {  // scroll \"buttons\"\n        scroll_direction_t direction = x11_scroll_direction(ev.xbutton.button);\n        *consumed = llua_mouse_hook(mouse_scroll_event(\n            vec2i(ev.xbutton.x, ev.xbutton.y),\n            vec2i(ev.xbutton.x_root, ev.xbutton.y_root), direction, mods));\n      } else {\n        mouse_button_t button = x11_mouse_button_code(ev.xbutton.button);\n        *consumed = llua_mouse_hook(mouse_button_event(\n            mouse_event_t::PRESS, vec2i(ev.xbutton.x, ev.xbutton.y),\n            vec2i(ev.xbutton.x_root, ev.xbutton.y_root), button, mods));\n      }\n      break;\n    }\n    case ButtonRelease: {\n      /* don't report scroll release events */\n      if (ev.xbutton.button >= 4 && ev.xbutton.button <= 7) return true;\n\n      modifier_state_t mods = x11_modifier_state(ev.xbutton.state);\n      mouse_button_t button = x11_mouse_button_code(ev.xbutton.button);\n      *consumed = llua_mouse_hook(mouse_button_event(\n          mouse_event_t::RELEASE, vec2i(ev.xbutton.x, ev.xbutton.y),\n          vec2i(ev.xbutton.x_root, ev.xbutton.y_root), button, mods));\n      break;\n    }\n    case MotionNotify: {\n      modifier_state_t mods = x11_modifier_state(ev.xmotion.state);\n      *consumed = llua_mouse_hook(\n          mouse_move_event(vec2i(ev.xmotion.x, ev.xmotion.y),\n                           vec2i(ev.xmotion.x_root, ev.xmotion.y_root), mods));\n      break;\n    }\n  }\n#endif /* BUILD_MOUSE_EVENTS */\n#endif /* BUILD_XINPUT */\n#ifndef BUILD_MOUSE_EVENTS\n  // always propagate mouse input if not handling mouse events\n  *consumed = false;\n#endif /* BUILD_MOUSE_EVENTS */\n\n  if (!own_window.get(*state)) return true;\n  switch (own_window_type.get(*state)) {\n    case window_type::NORMAL:\n    case window_type::UTILITY:\n      // decorated normal windows always consume events\n      if (!TEST_HINT(own_window_hints.get(*state), window_hints::UNDECORATED)) {\n        *consumed = true;\n      }\n      break;\n    case window_type::DESKTOP:\n      // assume conky is always on bottom; nothing to propagate events to\n      *consumed = true;\n    default:\n      break;\n  }\n\n  return true;\n}\n\ntemplate <>\nbool handle_event<x_event_handler::REPARENT>(conky::display_output_x11 *surface,\n                                             Display *display, XEvent &ev,\n                                             bool *consumed, void **cookie) {\n  if (ev.type != ReparentNotify) return false;\n\n  if (own_window.get(*state)) { set_transparent_background(window.window); }\n  return true;\n}\n\ntemplate <>\nbool handle_event<x_event_handler::CONFIGURE>(\n    conky::display_output_x11 *surface, Display *display, XEvent &ev,\n    bool *consumed, void **cookie) {\n  if (ev.type != ConfigureNotify) return false;\n\n  if (own_window.get(*state)) {\n    auto configure_size = vec2i(ev.xconfigure.width, ev.xconfigure.height);\n    /* if window size isn't what's expected, set fixed size */\n    if (configure_size != window.geometry.size()) {\n      if (window.geometry.size().surface() != 0) { fixed_size = 1; }\n\n      /* clear old stuff before screwing up\n       * size and pos */\n      surface->clear_text(1);\n\n      {\n        XWindowAttributes attrs;\n        if (XGetWindowAttributes(display, window.window, &attrs) != 0) {\n          window.geometry.set_size(attrs.width, attrs.height);\n        }\n      }\n\n      auto border_total = vec2i::uniform(get_border_total() * 2);\n      text_size = window.geometry.size() - border_total;\n\n      // don't apply dpi scaling to max pixel size\n      int mw = dpi_scale(maximum_width.get(*state));\n      if (mw > 0) { text_size.set_x(std::min(mw, text_size.x())); }\n    }\n\n    /* if position isn't what expected, set fixed pos\n     * total_updates avoids setting fixed_pos when window\n     * is set to weird locations when started */\n    /* // this is broken\n    if (total_updates >= 2 && !fixed_pos\n        && (window.geometry.x != ev.xconfigure.x\n        || window.geometry.y != ev.xconfigure.y)\n        && (ev.xconfigure.x != 0\n        || ev.xconfigure.y != 0)) {\n      fixed_pos = 1;\n    } */\n  }\n\n  return true;\n}\n\n#ifdef BUILD_MOUSE_EVENTS\ntemplate <>\nbool handle_event<x_event_handler::BORDER_CROSSING>(\n    conky::display_output_x11 *surface, Display *display, XEvent &ev,\n    bool *consumed, void **cookie) {\n  if (ev.type != EnterNotify && ev.type != LeaveNotify) return false;\n  if (window.xi_opcode != 0) return true;  // handled by mouse_input already\n\n  auto crossing_pos = vec2i(ev.xcrossing.x_root, ev.xcrossing.y_root);\n  bool over_conky = window.geometry.contains(crossing_pos);\n\n  if ((!over_conky && ev.xcrossing.type == LeaveNotify) ||\n      (over_conky && ev.xcrossing.type == EnterNotify)) {\n    llua_mouse_hook(mouse_crossing_event(\n        ev.xcrossing.type == EnterNotify ? mouse_event_t::AREA_ENTER\n                                         : mouse_event_t::AREA_LEAVE,\n        vec2i(ev.xcrossing.x, ev.xcrossing.y),\n        vec2i(ev.xcrossing.x_root, ev.xcrossing.y_root)));\n  }\n  return true;\n}\n#endif /* BUILD_MOUSE_EVENTS */\n#endif /* OWN_WINDOW */\n\ntemplate <>\nbool handle_event<x_event_handler::PROPERTY_NOTIFY>(\n    conky::display_output_x11 *surface, Display *display, XEvent &ev,\n    bool *consumed, void **cookie) {\n  if (ev.type != PropertyNotify) return false;\n\n  if (ev.xproperty.state == PropertyNewValue) {\n    get_x11_desktop_info(ev.xproperty.display, ev.xproperty.atom);\n  }\n\n  if (ev.xproperty.atom == 0) return false;\n\n  if (ev.xproperty.atom == XA_RESOURCE_MANAGER) {\n    update_x11_resource_db();\n    update_x11_workarea();\n    screen_dpi = -1;\n    update_dpi();\n    return true;\n  }\n\n  if (!have_argb_visual) {\n    Atom _XROOTPMAP_ID = XInternAtom(display, \"_XROOTPMAP_ID\", True);\n    Atom _XROOTMAP_ID = XInternAtom(display, \"_XROOTMAP_ID\", True);\n    if (ev.xproperty.atom == _XROOTPMAP_ID ||\n        ev.xproperty.atom == _XROOTMAP_ID) {\n      if (forced_redraw.get(*state)) {\n        draw_stuff();\n        next_update_time = get_time();\n        need_to_update = 1;\n      }\n      return true;\n    }\n  }\n\n  return false;\n}\n\ntemplate <>\nbool handle_event<x_event_handler::EXPOSE>(conky::display_output_x11 *surface,\n                                           Display *display, XEvent &ev,\n                                           bool *consumed, void **cookie) {\n  if (ev.type != Expose) return false;\n\n  XRectangle r{\n      .x = static_cast<short>(ev.xexpose.x),\n      .y = static_cast<short>(ev.xexpose.y),\n      .width = static_cast<unsigned short>(ev.xexpose.width),\n      .height = static_cast<unsigned short>(ev.xexpose.height),\n  };\n  XUnionRectWithRegion(&r, x11_stuff.region, x11_stuff.region);\n  XSync(display, False);\n  return true;\n}\n\n#ifdef BUILD_XDAMAGE\ntemplate <>\nbool handle_event<x_event_handler::DAMAGE>(conky::display_output_x11 *surface,\n                                           Display *display, XEvent &ev,\n                                           bool *consumed, void **cookie) {\n  if (ev.type != x11_stuff.event_base + XDamageNotify) return false;\n\n  auto *dev = reinterpret_cast<XDamageNotifyEvent *>(&ev);\n\n  XFixesSetRegion(display, x11_stuff.part, &dev->area, 1);\n  XFixesUnionRegion(display, x11_stuff.region2, x11_stuff.region2,\n                    x11_stuff.part);\n  return true;\n}\n#endif /* BUILD_XDAMAGE */\n\n/// Handles all events conky can receive.\n///\n/// @return true if event should move input focus to conky\nbool process_event(conky::display_output_x11 *surface, Display *display,\n                   XEvent ev, bool *consumed, void **cookie) {\n#define HANDLE_EV(event)                                                   \\\n  if (handle_event<x_event_handler::event>(surface, display, ev, consumed, \\\n                                           cookie)) {                      \\\n    return true;                                                           \\\n  }\n\n  HANDLE_EV(XINPUT_MOTION)\n  HANDLE_EV(MOUSE_INPUT)\n  HANDLE_EV(PROPERTY_NOTIFY)\n\n  // only accept remaining events if they're sent to Conky.\n  if (ev.xany.window != window.window) return false;\n\n  HANDLE_EV(EXPOSE)\n  HANDLE_EV(REPARENT)\n  HANDLE_EV(CONFIGURE)\n  HANDLE_EV(BORDER_CROSSING)\n  HANDLE_EV(DAMAGE)\n\n#undef HANDLE_EV\n\n  // event not handled\n  return false;\n}\n\nvoid process_surface_events(conky::display_output_x11 *surface,\n                            Display *display) {\n  int pending = XPending(display);\n  if (pending == 0) return;\n\n  DBGP2(\"Processing %d X11 events...\", pending);\n\n  /* handle X events */\n  while (XPending(display) != 0) {\n    XEvent ev;\n    XNextEvent(display, &ev);\n\n    /*\n    indicates whether processed event was consumed; true by default so we\n    don't propagate handled events unless they explicitly state they haven't\n    been consumed.\n    */\n    bool consumed = true;\n    void *cookie = nullptr;\n    bool handled = process_event(surface, display, ev, &consumed, &cookie);\n\n    if (!consumed) { propagate_x11_event(ev, cookie); }\n\n    if (cookie != nullptr) { free(cookie); }\n  }\n\n  DBGP2(\"Done processing %d events.\", pending);\n}\n\nvoid display_output_x11::sigterm_cleanup() {\n  XDestroyRegion(x11_stuff.region);\n  x11_stuff.region = nullptr;\n#ifdef BUILD_XDAMAGE\n  if (x11_stuff.damage) {\n    XDamageDestroy(display, x11_stuff.damage);\n    XFixesDestroyRegion(display, x11_stuff.region2);\n    XFixesDestroyRegion(display, x11_stuff.part);\n  }\n#endif /* BUILD_XDAMAGE */\n}\n\nvoid display_output_x11::cleanup() {\n  if (window_created == 1) {\n    int border_total = get_border_total();\n\n    XClearArea(display, window.window, text_start.x() - border_total,\n               text_start.y() - border_total, text_size.x() + 2 * border_total,\n               text_size.y() + 2 * border_total, 0);\n  }\n  destroy_window();\n  free_fonts(utf8_mode.get(*state));\n  if (x11_stuff.region != nullptr) {\n    XDestroyRegion(x11_stuff.region);\n    x11_stuff.region = nullptr;\n  }\n}\n\nvoid display_output_x11::set_foreground_color(Colour c) {\n  current_color = c;\n#ifdef BUILD_ARGB\n  if (have_argb_visual) {\n    current_color.alpha = own_window_argb_value.get(*state);\n  }\n#endif /* BUILD_ARGB */\n  XSetForeground(display, window.gc,\n                 current_color.to_x11_color(display, screen, have_argb_visual));\n}\n\nint display_output_x11::calc_text_width(const char *s) {\n  std::size_t slen = strlen(s);\n#ifdef BUILD_XFT\n  if (use_xft.get(*state)) {\n    XGlyphInfo gi;\n\n    if (utf8_mode.get(*state)) {\n      XftTextExtentsUtf8(display, x_fonts[selected_font].xftfont,\n                         reinterpret_cast<const FcChar8 *>(s), slen, &gi);\n    } else {\n      XftTextExtents8(display, x_fonts[selected_font].xftfont,\n                      reinterpret_cast<const FcChar8 *>(s), slen, &gi);\n    }\n    return gi.xOff;\n  }\n#endif /* BUILD_XFT */\n\n  return XTextWidth(x_fonts[selected_font].font, s, slen);\n}\n\nvoid display_output_x11::draw_string_at(int x, int y, const char *s, int w) {\n#ifdef BUILD_XFT\n  if (use_xft.get(*state)) {\n    XColor c{};\n    XftColor c2{};\n\n    c.pixel = current_color.to_x11_color(display, screen, have_argb_visual);\n    // query color on custom colormap\n    XQueryColor(display, window.colourmap, &c);\n\n    c2.pixel = c.pixel;\n    c2.color.red = c.red;\n    c2.color.green = c.green;\n    c2.color.blue = c.blue;\n    c2.color.alpha = x_fonts[selected_font].font_alpha;\n    if (utf8_mode.get(*state)) {\n      XftDrawStringUtf8(window.xftdraw, &c2, x_fonts[selected_font].xftfont, x,\n                        y, reinterpret_cast<const XftChar8 *>(s), w);\n    } else {\n      XftDrawString8(window.xftdraw, &c2, x_fonts[selected_font].xftfont, x, y,\n                     reinterpret_cast<const XftChar8 *>(s), w);\n    }\n  } else\n#endif\n  {\n    if (utf8_mode.get(*state)) {\n      Xutf8DrawString(display, window.drawable, x_fonts[selected_font].fontset,\n                      window.gc, x, y, s, w);\n    } else {\n      XDrawString(display, window.drawable, window.gc, x, y, s, w);\n    }\n  }\n}\n\nvoid display_output_x11::set_line_style(int w, bool solid) {\n  XSetLineAttributes(display, window.gc, w, solid ? LineSolid : LineOnOffDash,\n                     CapButt, JoinMiter);\n}\n\nvoid display_output_x11::set_dashes(char *s) {\n  XSetDashes(display, window.gc, 0, s, 2);\n}\n\nvoid display_output_x11::draw_line(int x1, int y1, int x2, int y2) {\n  XDrawLine(display, window.drawable, window.gc, x1, y1, x2, y2);\n}\n\nvoid display_output_x11::draw_rect(int x, int y, int w, int h) {\n  XDrawRectangle(display, window.drawable, window.gc, x, y, w, h);\n}\n\nvoid display_output_x11::fill_rect(int x, int y, int w, int h) {\n  XFillRectangle(display, window.drawable, window.gc, x, y, w, h);\n}\n\nvoid display_output_x11::draw_arc(int x, int y, int w, int h, int a1, int a2) {\n  XDrawArc(display, window.drawable, window.gc, x, y, w, h, a1, a2);\n}\n\nvoid display_output_x11::move_win(int x, int y) {\n#ifdef OWN_WINDOW\n  window.geometry.set_pos(x, y);\n  XMoveWindow(display, window.window, x, y);\n#endif /* OWN_WINDOW */\n}\n\nconst float PIXELS_PER_INCH = 96.0;\nfloat display_output_x11::get_dpi_scale() {\n  if (screen_dpi > 0) {\n    return static_cast<float>(screen_dpi) / PIXELS_PER_INCH;\n  }\n  return 1.0;\n}\n\nvoid display_output_x11::end_draw_stuff() {\n#if defined(BUILD_XDBE)\n  xdbe_swap_buffers();\n#else\n  xpmdb_swap_buffers();\n#endif\n}\n\nvoid display_output_x11::clear_text(int exposures) {\n#ifdef BUILD_XDBE\n  if (use_xdbe.get(*state)) {\n    /* The swap action is XdbeBackground, which clears */\n    return;\n  }\n#else\n  if (use_xpmdb.get(*state)) {\n    return;\n  } else\n#endif\n  if ((display != nullptr) &&\n      (window.window != 0u)) {  // make sure these are !null\n    /* there is some extra space for borders and outlines */\n    int border_total = get_border_total();\n\n    XClearArea(display, window.window, text_start.x() - border_total,\n               text_start.y() - border_total, text_size.x() + 2 * border_total,\n               text_size.y() + 2 * border_total, exposures != 0 ? True : 0);\n  }\n}\n\n#ifdef BUILD_XFT\n\nint display_output_x11::font_height(unsigned int f) {\n  assert(f < x_fonts.size());\n  if (use_xft.get(*state)) {\n    return x_fonts[f].xftfont->ascent + x_fonts[f].xftfont->descent;\n  } else {\n    return x_fonts[f].font->max_bounds.ascent +\n           x_fonts[f].font->max_bounds.descent;\n  }\n}\n\nint display_output_x11::font_ascent(unsigned int f) {\n  assert(f < x_fonts.size());\n  if (use_xft.get(*state)) {\n    return x_fonts[f].xftfont->ascent;\n  } else {\n    return x_fonts[f].font->max_bounds.ascent;\n  }\n}\n\nint display_output_x11::font_descent(unsigned int f) {\n  assert(f < x_fonts.size());\n  if (use_xft.get(*state)) {\n    return x_fonts[f].xftfont->descent;\n  } else {\n    return x_fonts[f].font->max_bounds.descent;\n  }\n}\n\n#else\n\nint display_output_x11::font_height(unsigned int f) {\n  assert(f < x_fonts.size());\n  return x_fonts[f].font->max_bounds.ascent +\n         x_fonts[f].font->max_bounds.descent;\n}\n\nint display_output_x11::font_ascent(unsigned int f) {\n  assert(f < x_fonts.size());\n  return x_fonts[f].font->max_bounds.ascent;\n}\n\nint display_output_x11::font_descent(unsigned int f) {\n  assert(f < x_fonts.size());\n  return x_fonts[f].font->max_bounds.descent;\n}\n\n#endif\n\nvoid display_output_x11::setup_fonts(void) {\n#ifdef BUILD_XFT\n  if (use_xft.get(*state)) {\n    if (window.xftdraw != nullptr) {\n      XftDrawDestroy(window.xftdraw);\n      window.xftdraw = nullptr;\n    }\n    window.xftdraw = XftDrawCreate(display, window.drawable, window.visual,\n                                   window.colourmap);\n  }\n#endif /* BUILD_XFT */\n}\n\nvoid display_output_x11::set_font(unsigned int f) {\n  if (f >= x_fonts.size()) {\n    DBGP(\"%d >= x_fonts.size()\", f);\n    return;\n  }\n#ifdef BUILD_XFT\n  if (use_xft.get(*state)) { return; }\n#endif /* BUILD_XFT */\n  if (x_fonts.size() > f && x_fonts[f].font != nullptr &&\n      window.gc != nullptr) {\n    XSetFont(display, window.gc, x_fonts[f].font->fid);\n  }\n}\n\nvoid display_output_x11::free_fonts(bool utf8) {\n  for (auto &font : x_fonts) {\n#ifdef BUILD_XFT\n    if (use_xft.get(*state)) {\n      /* Close each font if it has been initialized */\n      if (font.xftfont) { XftFontClose(display, font.xftfont); }\n    } else\n#endif /* BUILD_XFT */\n    {\n      if (font.font != nullptr) { XFreeFont(display, font.font); }\n      if (utf8 && (font.fontset != nullptr)) {\n        XFreeFontSet(display, font.fontset);\n      }\n    }\n  }\n  x_fonts.clear();\n#ifdef BUILD_XFT\n  if (window.xftdraw != nullptr) {\n    XftDrawDestroy(window.xftdraw);\n    window.xftdraw = nullptr;\n  }\n#endif /* BUILD_XFT */\n}\nvoid display_output_x11::load_fonts(bool utf8) {\n  x_fonts.resize(fonts.size());\n  for (unsigned int i = 0; i < fonts.size(); i++) {\n    auto &font = fonts[i];\n    auto &xfont = x_fonts[i];\n#ifdef BUILD_XFT\n    /* load Xft font */\n    if (use_xft.get(*state)) {\n      if (xfont.xftfont == nullptr) {\n        xfont.xftfont = XftFontOpenName(display, screen, font.name.c_str());\n      }\n\n      if (xfont.xftfont != nullptr) { continue; }\n\n      NORM_ERR(\"can't load Xft font '%s'\", font.name.c_str());\n      if ((xfont.xftfont = XftFontOpenName(display, screen, \"courier-12\")) !=\n          nullptr) {\n        continue;\n      }\n\n      CRIT_ERR(\"can't load Xft font '%s'\", \"courier-12\");\n\n      continue;\n    }\n#endif\n    if (utf8 && xfont.fontset == nullptr) {\n      char **missing;\n      int missingnum;\n      char *missingdrawn;\n      xfont.fontset = XCreateFontSet(display, font.name.c_str(), &missing,\n                                     &missingnum, &missingdrawn);\n      XFreeStringList(missing);\n      if (xfont.fontset == nullptr) {\n        NORM_ERR(\"can't load font '%s'\", font.name.c_str());\n        xfont.fontset = XCreateFontSet(display, \"fixed\", &missing, &missingnum,\n                                       &missingdrawn);\n        if (xfont.fontset == nullptr) {\n          CRIT_ERR(\"can't load font '%s'\", \"fixed\");\n        }\n      }\n    }\n    /* load normal font */\n    if ((xfont.font == nullptr) &&\n        (xfont.font = XLoadQueryFont(display, font.name.c_str())) == nullptr) {\n      NORM_ERR(\"can't load font '%s'\", font.name.c_str());\n      if ((xfont.font = XLoadQueryFont(display, \"fixed\")) == nullptr) {\n        CRIT_ERR(\"can't load font '%s'\", \"fixed\");\n      }\n    }\n  }\n}\n\n}  // namespace conky\n"
  },
  {
    "path": "src/output/display-x11.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2018-2021 François Revol et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef DISPLAY_X11_HH\n#define DISPLAY_X11_HH\n\n#include \"config.h\"\n\n#include <limits>\n#include <string>\n#include <type_traits>\n\n#include \"display-output.hh\"\n#include \"../lua/luamm.hh\"\n\nnamespace conky {\n\n/*\n * A base class for X11 display output.\n */\nclass display_output_x11 : public display_output_base {\n public:\n  explicit display_output_x11();\n\n  virtual ~display_output_x11() {}\n\n  // check if available and enabled in settings\n  virtual bool detect();\n  // connect to DISPLAY and other stuff\n  virtual bool initialize();\n  virtual bool shutdown();\n\n  virtual bool main_loop_wait(double);\n\n  virtual void sigterm_cleanup();\n  virtual void cleanup();\n\n  // drawing primitives\n  virtual void set_foreground_color(Colour);\n\n  virtual int calc_text_width(const char *);\n\n  // GUI interface\n  virtual void draw_string_at(int, int, const char *, int);\n  // X11 lookalikes\n  virtual void set_line_style(int, bool);\n  virtual void set_dashes(char *);\n  virtual void draw_line(int, int, int, int);\n  virtual void draw_rect(int, int, int, int);\n  virtual void fill_rect(int, int, int, int);\n  virtual void draw_arc(int, int, int, int, int, int);\n  virtual void move_win(int, int);\n  virtual float get_dpi_scale();\n\n  virtual void end_draw_stuff();\n  virtual void clear_text(int);\n\n  virtual int font_height(unsigned int);\n  virtual int font_ascent(unsigned int);\n  virtual int font_descent(unsigned int);\n  virtual void setup_fonts(void);\n  virtual void set_font(unsigned int);\n  virtual void free_fonts(bool);\n  virtual void load_fonts(bool);\n\n  // X11-specific\n};\n\n}  // namespace conky\n\n#endif /* DISPLAY_X11_HH */\n"
  },
  {
    "path": "src/output/gui.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#include \"gui.h\"\n#include \"../common.h\"\n#include \"config.h\"\n#include \"../conky.h\"\n#include \"../logging.h\"\n\n#ifdef BUILD_X11\n#include \"../lua/x11-settings.h\"\n#endif /* BUILD_X11 */\n\n#ifdef BUILD_WAYLAND\n#include \"wl.h\"\n#endif /* BUILD_WAYLAND */\n\n// #ifdef BUILD_IMLIB2\n// #include \"../conky-imlib2.h\"\n// #endif /* BUILD_IMLIB2 */\n#ifndef OWN_WINDOW\n#include <iostream>\n#endif\n\n/* workarea where window / text is aligned (from _NET_WORKAREA on X11) */\nconky::absolute_rect<int> workarea;\n\n/* Window stuff */\nchar window_created = 0;\n\n/* local prototypes */\n#ifdef BUILD_X11\nvoid x11_init_window(lua::state &l, bool own);\n#endif /*BUILD_X11*/\n\n/********************* <SETTINGS> ************************/\n\nbool out_to_gui(lua::state &l) {\n  bool to_gui = false;\n#ifdef BUILD_X11\n  to_gui |= out_to_x.get(l);\n#endif /* BUILD_X11 */\n#ifdef BUILD_WAYLAND\n  to_gui |= out_to_wayland.get(l);\n#endif /* BUILD_WAYLAND */\n  return to_gui;\n}\n\nnamespace priv {\nvoid own_window_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (init) {\n    if (do_convert(l, -1).first) {\n#ifndef OWN_WINDOW\n      std::cerr << \"Support for the own_window setting has been \"\n                   \"disabled during compilation\\n\";\n      l.pop();\n      l.pushboolean(false);\n#endif\n    }\n\n    if (out_to_gui(l)) {\n#ifdef BUILD_X11\n      x11_init_window(l, do_convert(l, -1).first);\n#endif /*BUILD_X11*/\n    } else {\n      // own_window makes no sense when not drawing to X\n      l.pop();\n      l.pushboolean(false);\n    }\n  }\n\n  ++s;\n}\n}  // namespace priv\n\ntemplate <>\nconky::lua_traits<alignment>::Map conky::lua_traits<alignment>::map = {\n    {\"top_left\", alignment::TOP_LEFT},\n    {\"top_right\", alignment::TOP_RIGHT},\n    {\"top_middle\", alignment::TOP_MIDDLE},\n    {\"top\", alignment::TOP_MIDDLE},\n    {\"bottom_left\", alignment::BOTTOM_LEFT},\n    {\"bottom_right\", alignment::BOTTOM_RIGHT},\n    {\"bottom_middle\", alignment::BOTTOM_MIDDLE},\n    {\"bottom\", alignment::BOTTOM_MIDDLE},\n    {\"middle_left\", alignment::MIDDLE_LEFT},\n    {\"left\", alignment::MIDDLE_LEFT},\n    {\"middle_middle\", alignment::MIDDLE_MIDDLE},\n    {\"center\", alignment::MIDDLE_MIDDLE},\n    {\"middle_right\", alignment::MIDDLE_RIGHT},\n    {\"right\", alignment::MIDDLE_RIGHT},\n    {\"tl\", alignment::TOP_LEFT},\n    {\"tr\", alignment::TOP_RIGHT},\n    {\"tm\", alignment::TOP_MIDDLE},\n    {\"bl\", alignment::BOTTOM_LEFT},\n    {\"br\", alignment::BOTTOM_RIGHT},\n    {\"bm\", alignment::BOTTOM_MIDDLE},\n    {\"ml\", alignment::MIDDLE_LEFT},\n    {\"mm\", alignment::MIDDLE_MIDDLE},\n    {\"mr\", alignment::MIDDLE_RIGHT},\n    {\"none\", alignment::NONE}};\n\n#ifdef OWN_WINDOW\ntemplate <>\nconky::lua_traits<window_type>::Map conky::lua_traits<window_type>::map = {\n    {\"normal\", window_type::NORMAL},   {\"dock\", window_type::DOCK},\n    {\"panel\", window_type::PANEL},     {\"desktop\", window_type::DESKTOP},\n    {\"utility\", window_type::UTILITY}, {\"override\", window_type::OVERRIDE}};\n\ntemplate <>\nconky::lua_traits<window_hints>::Map conky::lua_traits<window_hints>::map = {\n    {\"undecorated\", window_hints::UNDECORATED},\n    {\"below\", window_hints::BELOW},\n    {\"above\", window_hints::ABOVE},\n    {\"sticky\", window_hints::STICKY},\n    {\"skip_taskbar\", window_hints::SKIP_TASKBAR},\n    {\"skip_pager\", window_hints::SKIP_PAGER}};\n\nstd::pair<uint16_t, bool> window_hints_traits::convert(\n    lua::state &l, int index, const std::string &name) {\n  lua::stack_sentry s(l);\n  l.checkstack(1);\n\n  std::string hints = l.tostring(index);\n  // add a sentinel to simplify the following loop\n  hints += ',';\n  size_t pos = 0;\n  size_t newpos;\n  uint16_t ret = 0;\n  while ((newpos = hints.find_first_of(\", \", pos)) != std::string::npos) {\n    if (newpos > pos) {\n      l.pushstring(hints.substr(pos, newpos - pos));\n      auto t = conky::lua_traits<window_hints>::convert(l, -1, name);\n      if (!t.second) { return {0, false}; }\n      SET_HINT(ret, t.first);\n      l.pop();\n    }\n    pos = newpos + 1;\n  }\n  return {ret, true};\n}\n#endif\n\n#ifdef OWN_WINDOW\nnamespace {\n// used to set the default value for own_window_title\nstd::string gethostnamecxx() {\n  update_uname();\n  return info.uname_s.nodename;\n}\n}  // namespace\n#endif /* OWN_WINDOW */\n\n/*\n * The order of these settings cannot be completely arbitrary. Some of them\n * depend on others, and the setters are called in the order in which they are\n * defined. The order should be: x11_display_name -> out_to_x -> everything\n * colour related -> border_*, own_window_*, etc -> own_window -> double_buffer\n * ->  imlib_cache_size.\n *\n * The settings order can be modified with the settings_ordering vector in\n * setting.cc.\n */\n\nconky::simple_config_setting<alignment> text_alignment(\"alignment\",\n                                                       alignment::BOTTOM_LEFT,\n                                                       false);\n\npriv::colour_setting default_shade_color(\"default_shade_color\", black_argb32);\npriv::colour_setting default_outline_color(\"default_outline_color\",\n                                           black_argb32);\n\nconky::range_config_setting<int> border_inner_margin(\n    \"border_inner_margin\", 0, std::numeric_limits<int>::max(), 3, true);\nconky::range_config_setting<int> border_outer_margin(\n    \"border_outer_margin\", 0, std::numeric_limits<int>::max(), 1, true);\nconky::range_config_setting<int> border_width(\"border_width\", 0,\n                                              std::numeric_limits<int>::max(),\n                                              1, true);\n\n#ifdef OWN_WINDOW\nconky::simple_config_setting<std::string> own_window_title(\n    \"own_window_title\", PACKAGE_NAME \" (\" + gethostnamecxx() + \")\", false);\nconky::simple_config_setting<window_type> own_window_type(\"own_window_type\",\n                                                          window_type::NORMAL,\n                                                          false);\nconky::simple_config_setting<std::string> own_window_class(\"own_window_class\",\n                                                           PACKAGE_NAME, false);\n#endif /* OWN_WINDOW */\n\n#if defined(OWN_WINDOW) && defined(BUILD_X11)\nconky::simple_config_setting<uint16_t, window_hints_traits> own_window_hints(\n    \"own_window_hints\", 0, false);\n#endif /* OWN_WINDOW && BUILD_X11 */\n\n#if defined(OWN_WINDOW) || defined(BUILD_WAYLAND)\npriv::colour_setting background_colour(\"own_window_colour\", 0);\nconky::simple_config_setting<bool> set_transparent(\"own_window_transparent\",\n                                                   false, false);\n#endif /* OWN_WINDOW || BUILD_WAYLAND */\n\n#if defined(BUILD_ARGB) || defined(BUILD_WAYLAND)\nconky::simple_config_setting<bool> use_argb_visual(\"own_window_argb_visual\",\n                                                   false, false);\nconky::range_config_setting<int> own_window_argb_value(\"own_window_argb_value\",\n                                                       0, 255, 255, false);\n#endif /* BUILD_ARGB || BUILD_WAYLAND */\npriv::own_window_setting own_window;\n\n/******************** </SETTINGS> ************************/\n"
  },
  {
    "path": "src/output/gui.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n#ifndef _CONKY_GUI_H_\n#define _CONKY_GUI_H_\n\n#include \"config.h\"\n\n#include \"../geometry.h\"\n#include \"../lua/setting.hh\"\n\n#include \"../lua/colour-settings.hh\"\n\n/// @brief Represents alignment on a single axis.\nenum class axis_align : uint8_t {\n  /// No alignment\n  NONE = 0,\n  /// Top or left alignment\n  START = 0b01,\n  /// Middle alignment\n  MIDDLE = 0b10,\n  /// Bottom or right alignment\n  END = 0b11,\n};\nconstexpr uint8_t operator*(axis_align index) {\n  return static_cast<uint8_t>(index);\n}\n\n/// @brief Represents alignment on a 2D plane.\n///\n/// Values are composed of 2 `axis_align` values: 2 bits (at 0x0C) for vertical\n/// aligment and 2 least significant bits for horizontal.\nenum class alignment : uint8_t {\n  NONE = 0,\n  NONE_LEFT = 0b0001,\n  NONE_MIDDLE = 0b0010,\n  NONE_RIGHT = 0b0011,\n  TOP_LEFT = 0b0101,\n  TOP_MIDDLE = 0b0110,\n  TOP_RIGHT = 0b0111,\n  MIDDLE_LEFT = 0b1001,\n  MIDDLE_MIDDLE = 0b1010,\n  MIDDLE_RIGHT = 0b1011,\n  BOTTOM_LEFT = 0b1101,\n  BOTTOM_MIDDLE = 0b1110,\n  BOTTOM_RIGHT = 0b1111,\n};\nconstexpr uint8_t operator*(alignment index) {\n  return static_cast<uint8_t>(index);\n}\n\n/// @brief Returns the horizontal axis alignment component of `alignment`.\n/// @param of 2D alignment to extract axis alignment from\n/// @return horizontal `axis_align`\n[[nodiscard]] inline axis_align horizontal_alignment(alignment of) {\n  return static_cast<axis_align>(static_cast<uint8_t>(of) & 0b11);\n}\n/// @brief Returns the vertical axis alignment component of `alignment`.\n/// @param of 2D alignment to extract axis alignment from\n/// @return vertical `axis_align`\n[[nodiscard]] inline axis_align vertical_alignment(alignment of) {\n  return static_cast<axis_align>((static_cast<uint8_t>(of) >> 2) & 0b11);\n}\n\n/// @brief Describes how and where a window should be mounted, as well as its\n/// behavior.\n///\n/// We assume the following order of layers:\n/// - Background - behind conky and any other windows, contains icons and\n///   desktop menus\n/// - Background widgets and docks\n/// - Windows\n/// - Panels - contains content that covers windows\n/// - Override windows - input-override windows on X11, custom overlays, lock\n///   screens, etc.\n///\n/// See also:\n/// - [X11 wm-spec `_NET_WM_WINDOW_TYPE` property](\n///   https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html#idm45684324619328)\n/// - [wlr-layer-shell layers](\n///   https://wayland.app/protocols/wlr-layer-shell-unstable-v1#zwlr_layer_shell_v1:enum:layer)\n/// - [xdg-positioner::anchor](\n///   https://wayland.app/protocols/xdg-shell#xdg_positioner:enum:anchor)\nenum class window_type : uint8_t {\n  /// @brief Acts as a normal window - has decorations, above\n  /// background, widgets and docks, below panels.\n  NORMAL = 0,\n  /// @brief Screen background, no decorations, positioned at the very bottom\n  /// and behind widgets and docks.\n  DESKTOP,\n  /// @brief Normal window, always shown above parent window (group).\n  ///\n  /// See: [Popup](https://wayland.app/protocols/xdg-shell#xdg_popup) XDG shell\n  /// surface.\n  UTILITY,\n  /// @brief No decorations, between windows and background, attached to screen\n  /// edge.\n  DOCK,\n  /// @brief No decorations, above windows, attached to screen edge, reserves\n  /// space.\n  PANEL,\n#ifdef BUILD_X11\n  /// @brief On top of everything else, not controlled by WM.\n  OVERRIDE,\n#endif /* BUILD_X11 */\n};\nconstexpr uint8_t operator*(window_type index) {\n  return static_cast<uint8_t>(index);\n}\n\n#if defined(BUILD_X11) && defined(OWN_WINDOW)\n// Only works in X11 because Wayland doesn't support\n\n/// @brief Hints are used to tell WM how it should treat a window.\n///\n/// See: [X11 wm-spec `_NET_WM_STATE` property](\n/// https://specifications.freedesktop.org/wm-spec/1.3/ar01s05.html#idm45684324611552)\nenum class window_hints : uint16_t {\n  UNDECORATED = 0,\n  BELOW,\n  ABOVE,\n  STICKY,\n  SKIP_TASKBAR,\n  SKIP_PAGER\n};\nconstexpr uint8_t operator*(window_hints index) {\n  return static_cast<uint8_t>(index);\n}\n\ninline void SET_HINT(window_hints &mask, window_hints hint) {\n  mask = static_cast<window_hints>(*mask | (1 << (*hint)));\n}\ninline void SET_HINT(uint16_t &mask, window_hints hint) {\n  mask = mask | (1 << (*hint));\n}\ninline bool TEST_HINT(window_hints mask, window_hints hint) {\n  return (*mask & (1 << (*hint))) != 0;\n}\ninline bool TEST_HINT(uint16_t mask, window_hints hint) {\n  return (mask & (1 << (*hint))) != 0;\n}\n#endif\n\nextern conky::absolute_rect<int> workarea;\n\nextern char window_created;\n\nvoid destroy_window(void);\nvoid create_gc(void);\n\nbool out_to_gui(lua::state &l);\n\nvoid print_monitor(struct text_object *, char *, unsigned int);\nvoid print_monitor_number(struct text_object *, char *, unsigned int);\nvoid print_desktop(struct text_object *, char *, unsigned int);\nvoid print_desktop_number(struct text_object *, char *, unsigned int);\nvoid print_desktop_name(struct text_object *, char *, unsigned int);\n\n/* Num lock, Scroll lock, Caps Lock */\nvoid print_key_num_lock(struct text_object *, char *, unsigned int);\nvoid print_key_caps_lock(struct text_object *, char *, unsigned int);\nvoid print_key_scroll_lock(struct text_object *, char *, unsigned int);\n\n/* Keyboard layout and mouse speed in percentage */\nvoid print_keyboard_layout(struct text_object *, char *, unsigned int);\nvoid print_mouse_speed(struct text_object *, char *, unsigned int);\n\nextern conky::simple_config_setting<alignment> text_alignment;\n\nnamespace priv {\nclass own_window_setting : public conky::simple_config_setting<bool> {\n  typedef conky::simple_config_setting<bool> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n\n public:\n  own_window_setting() : Base(\"own_window\", false, false) {}\n};\n}  // namespace priv\n\nextern conky::simple_config_setting<int> head_index;\nextern priv::colour_setting default_shade_color;\nextern priv::colour_setting default_outline_color;\n\nextern conky::range_config_setting<int> border_inner_margin;\nextern conky::range_config_setting<int> border_outer_margin;\nextern conky::range_config_setting<int> border_width;\n\nextern conky::simple_config_setting<bool> forced_redraw;\n\n#ifdef OWN_WINDOW\nextern priv::own_window_setting own_window;\nextern conky::simple_config_setting<std::string> own_window_title;\n\n/// @brief Window type.\n///\n/// @see window_type\nextern conky::simple_config_setting<window_type> own_window_type;\n/// @brief X11 window class; Wayland XDG Shell app_id.\nextern conky::simple_config_setting<std::string> own_window_class;\n#endif /* OWN_WINDOW */\n\n#if defined(OWN_WINDOW) && defined(BUILD_X11)\nstruct window_hints_traits {\n  static const lua::Type type = lua::TSTRING;\n  typedef uint16_t Type;\n  static std::pair<Type, bool> convert(lua::state &l, int index,\n                                       const std::string &name);\n};\nextern conky::simple_config_setting<uint16_t, window_hints_traits>\n    own_window_hints;\n#endif /* OWN_WINDOW && BUILD_X11 */\n\n#if defined(OWN_WINDOW) || defined(BUILD_WAYLAND)\nextern priv::colour_setting background_colour;\nextern conky::simple_config_setting<bool> set_transparent;\n#endif /* OWN_WINDOW || BUILD_WAYLAND */\n\n#if defined(BUILD_ARGB) || defined(BUILD_WAYLAND)\nextern conky::simple_config_setting<bool> use_argb_visual;\nextern conky::range_config_setting<int> own_window_argb_value;\n#endif /* BUILD_ARGB || BUILD_WAYLAND */\n\n#endif /* _CONKY_GUI_H_ */\n"
  },
  {
    "path": "src/output/nc.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n\n#include \"nc.h\"\n\n#ifdef BUILD_NCURSES\nWINDOW *ncurses_window;\n#endif\n\nnamespace priv {\nvoid out_to_ncurses_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (init && do_convert(l, -1).first) {\n    ncurses_window = initscr();\n    start_color();\n  }\n\n  ++s;\n}\n\nvoid out_to_ncurses_setting::cleanup(lua::state &l) {\n  lua::stack_sentry s(l, -1);\n\n  if (do_convert(l, -1).first) { endwin(); }\n\n  l.pop();\n}\n}  // namespace priv\n\npriv::out_to_ncurses_setting out_to_ncurses;\n"
  },
  {
    "path": "src/output/nc.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#if defined(BUILD_NCURSES) && !defined(CONKY_NC_H)\n#define CONKY_NC_H\n\n#include <ncurses.h>\n\n#include \"../lua/setting.hh\"\n\n#ifdef LEAKFREE_NCURSES\nextern \"C\" {\nvoid _nc_free_and_exit(int);\n}\n#endif\n\nnamespace priv {\nclass out_to_ncurses_setting : public conky::simple_config_setting<bool> {\n  typedef conky::simple_config_setting<bool> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n  virtual void cleanup(lua::state &l);\n\n public:\n  out_to_ncurses_setting() : Base(\"out_to_ncurses\", false, false) {}\n};\n}  // namespace priv\n\nextern priv::out_to_ncurses_setting out_to_ncurses;\n\n#endif /* CONKY_NC_H */\n"
  },
  {
    "path": "src/output/wl.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <config.h>\n#include <cstring>\n\n#include \"../conky.h\"\n#include \"wl.h\"\n\n#ifdef BUILD_WAYLAND\n\nnamespace priv {\nvoid out_to_wayland_setting::lua_setter(lua::state &l, bool init) {\n  lua::stack_sentry s(l, -2);\n\n  Base::lua_setter(l, init);\n\n  if (init && do_convert(l, -1).first) {\n    // init\n  }\n\n  ++s;\n}\n\nvoid out_to_wayland_setting::cleanup(lua::state &l) {\n  lua::stack_sentry s(l, -1);\n\n  if (do_convert(l, -1).first) {\n    // deinit\n  }\n\n  l.pop();\n}\n}  // namespace priv\n\npriv::out_to_wayland_setting out_to_wayland;\n\nstatic const char NOT_IN_WAYLAND[] = \"Not running in Wayland\";\n\n__attribute__((weak)) void print_monitor(struct text_object *obj, char *p,\n                                         unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_wayland.get(*state)) {\n    strncpy(p, NOT_IN_WAYLAND, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", -1);\n}\n\n__attribute__((weak)) void print_monitor_number(struct text_object *obj,\n                                                char *p,\n                                                unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_wayland.get(*state)) {\n    strncpy(p, NOT_IN_WAYLAND, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", -1);\n}\n\n__attribute__((weak)) void print_desktop(struct text_object *obj, char *p,\n                                         unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_wayland.get(*state)) {\n    strncpy(p, NOT_IN_WAYLAND, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", -1);\n}\n\n__attribute__((weak)) void print_desktop_number(struct text_object *obj,\n                                                char *p,\n                                                unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_wayland.get(*state)) {\n    strncpy(p, NOT_IN_WAYLAND, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", -1);\n}\n\n__attribute__((weak)) void print_desktop_name(struct text_object *obj, char *p,\n                                              unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_wayland.get(*state)) {\n    strncpy(p, NOT_IN_WAYLAND, p_max_size);\n  } else {\n    strncpy(p, \"NYI\", p_max_size);\n  }\n}\n#endif\n"
  },
  {
    "path": "src/output/wl.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef CONKY_WL_H\n#define CONKY_WL_H\n\n#include \"config.h\"\n\n#ifndef BUILD_WAYLAND\n#error wl.h included when BUILD_WAYLAND is disabled\n#endif\n\n#include <wayland-client.h>\n\n#include \"../lua/setting.hh\"\n\nnamespace priv {\nclass out_to_wayland_setting : public conky::simple_config_setting<bool> {\n  typedef conky::simple_config_setting<bool> Base;\n\n protected:\n  virtual void lua_setter(lua::state &l, bool init);\n  virtual void cleanup(lua::state &l);\n\n public:\n  out_to_wayland_setting() : Base(\"out_to_wayland\", false, false) {}\n};\n}  // namespace priv\n\nextern priv::out_to_wayland_setting out_to_wayland;\n\n#endif /* CONKY_WL_H */\n"
  },
  {
    "path": "src/output/x11-color.cc",
    "content": "#include \"../content/colours.hh\"\n\n#include <X11/Xlib.h>\n\nunsigned long Colour::to_x11_color(Display *display, int screen,\n                                   bool transparency, bool premultiply) {\n  static std::unordered_map<Colour, unsigned long, Colour::Hash> x11_pixels;\n\n  if (display == nullptr) {\n    /* cannot work if display is not open */\n    return 0;\n  }\n\n  unsigned long pixel;\n\n  /* Either get a cached X11 pixel or allocate one */\n  if (auto pixel_iter = x11_pixels.find(*this);\n      pixel_iter != x11_pixels.end()) {\n    pixel = pixel_iter->second;\n  } else {\n    XColor xcolor{};\n    xcolor.red = this->red * 257;\n    xcolor.green = this->green * 257;\n    xcolor.blue = this->blue * 257;\n    if (XAllocColor(display, DefaultColormap(display, screen), &xcolor) == 0) {\n      // NORM_ERR(\"can't allocate X color\");\n      return 0;\n    }\n\n    /* Save pixel value in the cache to avoid reallocating it */\n    x11_pixels[*this] = xcolor.pixel;\n    pixel = static_cast<unsigned long>(xcolor.pixel);\n  }\n\n  pixel &= 0xffffff;\n#ifdef BUILD_ARGB\n  if (transparency) {\n    if (premultiply)\n      pixel = (red * alpha / 255) << 16 | (green * alpha / 255) << 8 |\n              (blue * alpha / 255);\n    pixel |= ((unsigned long)alpha << 24);\n  }\n#endif /* BUILD_ARGB */\n  return pixel;\n}"
  },
  {
    "path": "src/output/x11.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2004, Hannu Saransaari and Lauri Hakkarainen\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n\n#include \"../lua/x11-settings.h\"\n#include \"x11.h\"\n\n#include <X11/X.h>\n#include <X11/Xlibint.h>\n#undef min\n#undef max\n#include <sys/types.h>\n\n#include \"../common.h\"\n#include \"../conky.h\"\n#include \"../geometry.h\"\n#include \"../logging.h\"\n#include \"gui.h\"\n\n#ifdef BUILD_XINPUT\n#include \"../mouse-events.h\"\n\n#include <vector>\n#endif\n\n#include <algorithm>\n#include <array>\n#include <cstddef>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <numeric>\n#include <string>\n\n// #ifndef OWN_WINDOW\n// #include <iostream>\n// #endif\n\nextern \"C\" {\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wvariadic-macros\"\n#pragma GCC diagnostic ignored \"-Wregister\"\n#include <X11/XKBlib.h>\n#pragma GCC diagnostic pop\n#include <X11/Xatom.h>\n#include <X11/Xlib.h>\n#include <X11/Xmd.h>\n#include <X11/Xutil.h>\n\n#ifdef BUILD_IMLIB2\n#include \"../conky-imlib2.h\"\n#endif /* BUILD_IMLIB2 */\n#ifdef BUILD_XFT\n#include <X11/Xft/Xft.h>\n#endif\n#ifdef BUILD_XINERAMA\n#include <X11/extensions/Xinerama.h>\n#endif\n#ifdef BUILD_XSHAPE\n#include <X11/extensions/shape.h>\n#endif /* BUILD_XSHAPE */\n#ifdef BUILD_XFIXES\n#include <X11/extensions/Xfixes.h>\n#endif /* BUILD_XFIXES */\n#ifdef BUILD_XINPUT\n#include <X11/extensions/XInput.h>\n#include <X11/extensions/XInput2.h>\n#endif /* BUILD_XINPUT */\n#ifdef HAVE_XCB_ERRORS\n#include <xcb/xcb.h>\n#include <xcb/xcb_errors.h>\n#endif\n#include <X11/Xresource.h>\n}\n\nDisplay *display = nullptr;\nint screen;\n\n#ifdef HAVE_XCB_ERRORS\nxcb_connection_t *xcb_connection;\nxcb_errors_context_t *xcb_errors_ctx;\n#endif\n\n/* Window stuff */\nstruct conky_x11_window window;\n\nbool have_argb_visual = false;\n\n/* local prototypes */\nstatic Window find_desktop_window(Window *p_root, Window *p_desktop);\nstatic Window find_desktop_window_impl(Window win, int w, int h);\n\n/* WARNING, this type not in Xlib spec */\nstatic int x11_error_handler(Display *d, XErrorEvent *err) {\n  char *error_name = nullptr;\n  bool name_allocated = false;\n\n  char *code_description = nullptr;\n  bool code_allocated = false;\n\n#ifdef HAVE_XCB_ERRORS\n  if (xcb_errors_ctx != nullptr) {\n    const char *extension;\n    const char *base_name = xcb_errors_get_name_for_error(\n        xcb_errors_ctx, err->error_code, &extension);\n    if (extension != nullptr) {\n      const std::size_t size = strlen(base_name) + strlen(extension) + 4;\n      error_name = new char[size];\n      snprintf(error_name, size, \"%s (%s)\", base_name, extension);\n      name_allocated = true;\n    } else {\n      error_name = const_cast<char *>(base_name);\n    }\n\n    const char *major =\n        xcb_errors_get_name_for_major_code(xcb_errors_ctx, err->request_code);\n    const char *minor = xcb_errors_get_name_for_minor_code(\n        xcb_errors_ctx, err->request_code, err->minor_code);\n    if (minor != nullptr) {\n      const std::size_t size = strlen(major) + strlen(minor) + 4;\n      code_description = new char[size];\n      snprintf(code_description, size, \"%s - %s\", major, minor);\n      code_allocated = true;\n    } else {\n      code_description = const_cast<char *>(major);\n    }\n  }\n#endif\n\n  if (error_name == nullptr) {\n    if (err->error_code > 0 && err->error_code < 17) {\n      static std::array<std::string, 17> NAMES = {\n          \"request\", \"value\",         \"window\",    \"pixmap\",    \"atom\",\n          \"cursor\",  \"font\",          \"match\",     \"drawable\",  \"access\",\n          \"alloc\",   \"colormap\",      \"G context\", \"ID choice\", \"name\",\n          \"length\",  \"implementation\"};\n      error_name = const_cast<char *>(NAMES[err->error_code].c_str());\n    } else {\n      static char code_name_buffer[5];\n      error_name = reinterpret_cast<char *>(&code_name_buffer);\n      snprintf(error_name, 4, \"%d\", err->error_code);\n    }\n  }\n  if (code_description == nullptr) {\n    const std::size_t size = 37;\n    code_description = new char[size];\n    snprintf(code_description, size, \"error code: [major: %i, minor: %i]\",\n             err->request_code, err->minor_code);\n    code_allocated = true;\n  }\n\n  DBGP(\n      \"X %s Error:\\n\"\n      \"Display: %lx, XID: %li, Serial: %lu\\n\"\n      \"%s\",\n      error_name, reinterpret_cast<uint64_t>(err->display),\n      static_cast<int64_t>(err->resourceid), err->serial, code_description);\n\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wfree-nonheap-object\"\n  // *_allocated takes care of avoiding freeing unallocated objects\n  if (name_allocated) delete[] error_name;\n  if (code_allocated) delete[] code_description;\n#pragma GCC diagnostic pop\n\n  return 0;\n}\n\n__attribute__((noreturn)) static int x11_ioerror_handler(Display *d) {\n  CRIT_ERR(\"X IO Error: Display %lx\\n\", reinterpret_cast<uint64_t>(d));\n}\n\n/// @brief Function to get virtual root windows of screen.\n///\n/// Some WMs (swm, tvtwm, amiwm, enlightenment, etc.) use virtual roots to\n/// manage workspaces. These are direct descendants of root and WMs reparent all\n/// children to them.\n///\n/// @param screen screen to get the (current) virtual root of\n/// @return the virtual root window of the screen\nstatic Window VRootWindowOfScreen(Screen *screen) {\n  Window root = RootWindowOfScreen(screen);\n  Display *dpy = DisplayOfScreen(screen);\n\n  /* go look for a virtual root */\n  Atom _NET_VIRTUAL_ROOTS = XInternAtom(display, \"_NET_VIRTUAL_ROOTS\", True);\n  if (_NET_VIRTUAL_ROOTS == 0) return root;\n\n  auto vroots = x11_atom_window_list(dpy, root, _NET_VIRTUAL_ROOTS);\n\n  if (vroots.empty()) return root;\n\n  Atom _NET_CURRENT_DESKTOP =\n      XInternAtom(display, \"_NET_CURRENT_DESKTOP\", True);\n  if (_NET_CURRENT_DESKTOP == 0) return root;\n\n  Atom actual_type;\n  int actual_format;\n  unsigned long nitems, bytesafter;\n  int *cardinal;\n\n  XGetWindowProperty(dpy, root, _NET_CURRENT_DESKTOP, 0, 1, False, XA_CARDINAL,\n                     &actual_type, &actual_format, &nitems, &bytesafter,\n                     (unsigned char **)&cardinal);\n\n  if (vroots.size() > *cardinal) { root = vroots[*cardinal]; }\n  XFree(cardinal);\n\n  return root;\n}\ninline Window VRootWindow(Display *display, int screen) {\n  return VRootWindowOfScreen(ScreenOfDisplay(display, screen));\n}\ninline Window DefaultVRootWindow(Display *display) {\n  return VRootWindowOfScreen(DefaultScreenOfDisplay(display));\n}\n\n/* X11 initializer */\nvoid init_x11() {\n  DBGP(\"enter init_x11()\");\n  if (display == nullptr) {\n    const std::string &dispstr = display_name.get(*state);\n    // passing nullptr to XOpenDisplay should open the default display\n    const char *disp = static_cast<unsigned int>(!dispstr.empty()) != 0u\n                           ? dispstr.c_str()\n                           : nullptr;\n    if ((display = XOpenDisplay(disp)) == nullptr) {\n      std::string err =\n          std::string(\"can't open display: \") + XDisplayName(disp);\n#ifdef BUILD_WAYLAND\n      NORM_ERR(err.c_str());\n      return;\n#else  /* BUILD_WAYLAND */\n      throw std::runtime_error(err);\n#endif /* BUILD_WAYLAND */\n    }\n  }\n\n  info.x11.monitor.number = 1;\n  info.x11.monitor.current = 0;\n  info.x11.desktop.current = 1;\n  info.x11.desktop.number = 1;\n  info.x11.desktop.all_names.clear();\n  info.x11.desktop.name.clear();\n\n  screen = DefaultScreen(display);\n\n  XSetErrorHandler(&x11_error_handler);\n  XSetIOErrorHandler(&x11_ioerror_handler);\n\n  update_x11_resource_db(true);\n  update_x11_workarea();\n\n  get_x11_desktop_info(display, 0);\n\n#ifdef HAVE_XCB_ERRORS\n  auto connection = xcb_connect(NULL, NULL);\n  if (!xcb_connection_has_error(connection)) {\n    if (xcb_errors_context_new(connection, &xcb_errors_ctx) != 0) {\n      xcb_errors_ctx = nullptr;\n    }\n  }\n#endif /* HAVE_XCB_ERRORS */\n  DBGP(\"leave init_x11()\");\n}\n\nvoid deinit_x11() {\n  if (display) {\n    DBGP(\"deinit_x11()\");\n    XCloseDisplay(display);\n    display = nullptr;\n  }\n}\n\n// Source: dunst\n// https://github.com/bebehei/dunst/blob/1bc3237a359f37905426012c0cca90d71c4b3b18/src/x11/x.c#L463\nvoid update_x11_resource_db(bool first_run) {\n  XrmDatabase db;\n  XTextProperty prop;\n  Window root;\n\n  XFlush(display);\n\n  root = RootWindow(display, screen);\n\n  XLockDisplay(display);\n  if (XGetTextProperty(display, root, &prop, XA_RESOURCE_MANAGER)) {\n    if (!first_run) {\n      db = XrmGetDatabase(display);\n      XrmDestroyDatabase(db);\n    }\n\n    // https://github.com/dunst-project/dunst/blob/master/src/x11/x.c#L499\n    display->db = NULL; // should be new or deleted\n    db = XrmGetStringDatabase((const char *)prop.value);\n    XrmSetDatabase(display, db);\n  }\n  XUnlockDisplay(display);\n\n  XFlush(display);\n  XSync(display, false);\n}\n\nvoid update_x11_workarea() {\n  /* default work area is display */\n  workarea = conky::absolute_rect<int>(\n      conky::vec2i::Zero(), conky::vec2i(DisplayWidth(display, screen),\n                                         DisplayHeight(display, screen)));\n\n#ifdef BUILD_XINERAMA\n  /* if xinerama is being used, adjust workarea to the head's area */\n  int useless1, useless2;\n  if (XineramaQueryExtension(display, &useless1, &useless2) == 0) {\n    return; /* doesn't even have xinerama */\n  }\n\n  if (XineramaIsActive(display) == 0) {\n    return; /* has xinerama but isn't using it */\n  }\n\n  int heads = 0;\n  XineramaScreenInfo *si = XineramaQueryScreens(display, &heads);\n  if (si == nullptr) {\n    NORM_ERR(\n        \"warning: XineramaQueryScreen returned nullptr, ignoring head \"\n        \"settings\");\n    return; /* queryscreens failed? */\n  }\n\n  int i = head_index.get(*state);\n  if (i < 0 || i >= heads) {\n    NORM_ERR(\"warning: invalid head index, ignoring head settings\");\n    return;\n  }\n\n  XineramaScreenInfo *ps = &si[i];\n  workarea.set_pos(ps->x_org, ps->y_org);\n  workarea.set_size(ps->width, ps->height);\n  XFree(si);\n\n  DBGP(\"Fixed xinerama area to: %d %d %d %d\", workarea[0], workarea[1],\n       workarea[2], workarea[3]);\n#endif\n}\n\n/* Find root window and desktop window.\n * Return desktop window on success,\n * and set root and desktop byref return values.\n * Return 0 on failure. */\nstatic Window find_desktop_window(Window root) {\n  Window desktop = root;\n\n  /* get subwindows from root */\n  int display_width = DisplayWidth(display, screen);\n  int display_height = DisplayHeight(display, screen);\n  desktop = find_desktop_window_impl(root, display_width, display_height);\n  update_x11_workarea();\n  desktop =\n      find_desktop_window_impl(desktop, workarea.width(), workarea.height());\n\n  if (desktop != root) {\n    NORM_ERR(\"desktop window (0x%lx) is subwindow of root window (0x%lx)\",\n             desktop, root);\n  } else {\n    NORM_ERR(\"desktop window (0x%lx) is root window\", desktop);\n  }\n  return desktop;\n}\n\n#ifdef OWN_WINDOW\n#ifdef BUILD_ARGB\nnamespace {\n/* helper function for set_transparent_background() */\nvoid do_set_background(Window win, uint8_t alpha) {\n  Colour colour = background_colour.get(*state);\n  colour.alpha = alpha;\n  unsigned long xcolor =\n      colour.to_x11_color(display, screen, have_argb_visual, true);\n  XSetWindowBackground(display, win, xcolor);\n}\n}  // namespace\n#endif /* BUILD_ARGB */\n\n/* if no argb visual is configured sets background to ParentRelative for the\n   Window and all parents, else real transparency is used */\nvoid set_transparent_background(Window win) {\n#ifdef BUILD_ARGB\n  if (have_argb_visual) {\n    // real transparency\n    do_set_background(win, set_transparent.get(*state)\n                               ? 0\n                               : own_window_argb_value.get(*state));\n    return;\n  }\n#endif /* BUILD_ARGB */\n\n  // pseudo transparency\n  if (set_transparent.get(*state)) {\n    Window parent = win;\n    unsigned int i;\n\n    for (i = 0; i < 50 && parent != RootWindow(display, screen); i++) {\n      Window r, *children;\n      unsigned int n;\n\n      XSetWindowBackgroundPixmap(display, parent, ParentRelative);\n\n      XQueryTree(display, parent, &r, &parent, &children, &n);\n      XFree(children);\n    }\n    return;\n  }\n\n#ifdef BUILD_ARGB\n  do_set_background(win, 0);\n#endif /* BUILD_ARGB */\n}\n#endif /* OWN_WINDOW */\n\n#ifdef BUILD_ARGB\nstatic int get_argb_visual(Visual **visual, int *depth) {\n  /* code from gtk project, gdk_screen_get_rgba_visual */\n  XVisualInfo visual_template;\n  XVisualInfo *visual_list;\n  int nxvisuals = 0, i;\n\n  visual_template.screen = screen;\n  visual_list =\n      XGetVisualInfo(display, VisualScreenMask, &visual_template, &nxvisuals);\n  for (i = 0; i < nxvisuals; i++) {\n    if (visual_list[i].depth == 32 && (visual_list[i].red_mask == 0xff0000 &&\n                                       visual_list[i].green_mask == 0x00ff00 &&\n                                       visual_list[i].blue_mask == 0x0000ff)) {\n      *visual = visual_list[i].visual;\n      *depth = visual_list[i].depth;\n      DBGP(\"Found ARGB Visual\");\n      XFree(visual_list);\n      return 1;\n    }\n  }\n\n  // no argb visual available\n  DBGP(\"No ARGB Visual found\");\n  XFree(visual_list);\n\n  return 0;\n}\n#endif /* BUILD_ARGB */\n\nvoid destroy_window() {\n#ifdef BUILD_XFT\n  if (window.xftdraw != nullptr) { XftDrawDestroy(window.xftdraw); }\n#endif /* BUILD_XFT */\n  if (window.gc != nullptr) { XFreeGC(display, window.gc); }\n  memset(&window, 0, sizeof(struct conky_x11_window));\n}\n\nvoid x11_init_window(lua::state &l, bool own) {\n  DBGP(\"enter x11_init_window()\");\n  // own is unused if OWN_WINDOW is not defined\n  (void)own;\n\n  window.root = VRootWindow(display, screen);\n  if (window.root == None) {\n    DBGP2(\"no desktop window found\");\n    return;\n  }\n  window.desktop = find_desktop_window(window.root);\n\n  window.visual = DefaultVisual(display, screen);\n  window.colourmap = DefaultColormap(display, screen);\n\n#ifdef OWN_WINDOW\n  if (own) {\n    int depth = 0, flags = CWOverrideRedirect | CWBackingStore;\n    Visual *visual = nullptr;\n\n    depth = CopyFromParent;\n    visual = CopyFromParent;\n#ifdef BUILD_ARGB\n    if (use_argb_visual.get(l) && (get_argb_visual(&visual, &depth) != 0)) {\n      have_argb_visual = true;\n      window.visual = visual;\n      window.colourmap = XCreateColormap(display, DefaultRootWindow(display),\n                                         window.visual, AllocNone);\n    }\n#endif /* BUILD_ARGB */\n\n    int b = border_inner_margin.get(l) + border_width.get(l) +\n            border_outer_margin.get(l);\n\n    /* Sanity check to avoid making an invalid 0x0 window */\n    if (b == 0) { b = 1; }\n\n    XClassHint classHint;\n\n    // class_name must be a named local variable, so that c_str() remains\n    // valid until we call XmbSetWMProperties() or XSetClassHint. We use\n    // const_cast because, for whatever reason, res_name is not declared as\n    // const char *. XmbSetWMProperties hopefully doesn't modify the value\n    // (hell, even their own example app assigns a literal string constant to\n    // the field)\n    const std::string &class_name = own_window_class.get(l);\n\n    classHint.res_name = const_cast<char *>(class_name.c_str());\n    classHint.res_class = classHint.res_name;\n\n    if (own_window_type.get(l) == window_type::OVERRIDE) {\n      /* An override_redirect True window.\n       * No WM hints or button processing needed. */\n      XSetWindowAttributes attrs = {ParentRelative,\n                                    0L,\n                                    0,\n                                    0L,\n                                    0,\n                                    0,\n                                    Always,\n                                    0L,\n                                    0L,\n                                    False,\n                                    StructureNotifyMask | ExposureMask,\n                                    0L,\n                                    True,\n                                    0,\n                                    0};\n      flags |= CWBackPixel;\n      if (have_argb_visual) {\n        attrs.colormap = window.colourmap;\n        flags &= ~CWBackPixel;\n        flags |= CWBorderPixel | CWColormap;\n      }\n\n      /* Parent is desktop window (which might be a child of root) */\n      window.window = XCreateWindow(\n          display, window.desktop, window.geometry.x(), window.geometry.y(), b,\n          b, 0, depth, InputOutput, visual, flags, &attrs);\n\n      XLowerWindow(display, window.window);\n      XSetClassHint(display, window.window, &classHint);\n\n      NORM_ERR(\"window type - override\");\n    } else { /* own_window_type.get(l) != TYPE_OVERRIDE */\n\n      /* A window managed by the window manager.\n       * Process hints and buttons. */\n      XSetWindowAttributes attrs = {\n          ParentRelative,\n          0L,\n          0,\n          0L,\n          0,\n          0,\n          Always,\n          0L,\n          0L,\n          False,\n          StructureNotifyMask | ExposureMask | ButtonPressMask |\n              ButtonReleaseMask,\n          0L,\n          own_window_type.get(l) == window_type::UTILITY ? True : False,\n          0,\n          0};\n\n      XWMHints wmHint;\n      Atom xa;\n\n      flags |= CWBackPixel;\n      if (have_argb_visual) {\n        attrs.colormap = window.colourmap;\n        flags &= ~CWBackPixel;\n        flags |= CWBorderPixel | CWColormap;\n      }\n\n      if (own_window_type.get(l) == window_type::DOCK) {\n        window.geometry.set_pos(conky::vec2i::Zero());\n      }\n      /* Parent is root window so WM can take control */\n      window.window = XCreateWindow(display, window.root, window.geometry.x(),\n                                    window.geometry.y(), b, b, 0, depth,\n                                    InputOutput, visual, flags, &attrs);\n\n      uint16_t hints = own_window_hints.get(l);\n\n      wmHint.flags = InputHint | StateHint;\n      /* allow decorated windows to be given input focus by WM */\n      wmHint.input = TEST_HINT(hints, window_hints::UNDECORATED) ? False : True;\n#ifdef BUILD_XSHAPE\n#ifdef BUILD_XFIXES\n      if (own_window_type.get(l) == window_type::UTILITY) {\n        XRectangle rect;\n        XserverRegion region = XFixesCreateRegion(display, &rect, 1);\n        XFixesSetWindowShapeRegion(display, window.window, ShapeInput, 0, 0,\n                                   region);\n        XFixesDestroyRegion(display, region);\n      }\n#endif /* BUILD_XFIXES */\n      if (!wmHint.input) {\n        /* allow only decorated windows to be given mouse input */\n        int major_version;\n        int minor_version;\n        if (XShapeQueryVersion(display, &major_version, &minor_version) == 0) {\n          NORM_ERR(\"Input shapes are not supported\");\n        } else {\n          if (own_window.get(*state) &&\n              (own_window_type.get(*state) != window_type::NORMAL ||\n               ((TEST_HINT(own_window_hints.get(*state),\n                           window_hints::UNDECORATED)) != 0))) {\n            XShapeCombineRectangles(display, window.window, ShapeInput, 0, 0,\n                                    nullptr, 0, ShapeSet, Unsorted);\n          }\n        }\n      }\n#endif /* BUILD_XSHAPE */\n      wmHint.initial_state = NormalState;\n      if (own_window_type.get(l) == window_type::DOCK ||\n          own_window_type.get(l) == window_type::PANEL) {\n        // Docks and panels MUST have WithdrawnState initially for Fluxbox to\n        // move the window into the slit area.\n        // See: https://github.com/brndnmtthws/conky/issues/2046\n        // But most other WMs will explicitly ignore windows in WithdrawnState\n        // See: https://github.com/brndnmtthws/conky/issues/2112\n        // So we must resort to checking for WM at runtime\n        if (info.system.wm == conky::info::window_manager::fluxbox) {\n          wmHint.initial_state = WithdrawnState;\n        }\n      }\n\n      XmbSetWMProperties(display, window.window, nullptr, nullptr, argv_copy,\n                         argc_copy, nullptr, &wmHint, &classHint);\n      XStoreName(display, window.window, own_window_title.get(l).c_str());\n\n      /* Sets an empty WM_PROTOCOLS property */\n      XSetWMProtocols(display, window.window, nullptr, 0);\n\n      /* Set window type */\n      if ((xa = ATOM(_NET_WM_WINDOW_TYPE)) != None) {\n        Atom prop;\n\n        switch (own_window_type.get(l)) {\n          case window_type::DESKTOP:\n            prop = ATOM(_NET_WM_WINDOW_TYPE_DESKTOP);\n            NORM_ERR(\"window type - desktop\");\n            break;\n          case window_type::DOCK:\n            prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK);\n            NORM_ERR(\"window type - dock\");\n            break;\n          case window_type::PANEL:\n            prop = ATOM(_NET_WM_WINDOW_TYPE_DOCK);\n            NORM_ERR(\"window type - panel\");\n            break;\n          case window_type::UTILITY:\n            prop = ATOM(_NET_WM_WINDOW_TYPE_UTILITY);\n            NORM_ERR(\"window type - utility\");\n            break;\n          case window_type::NORMAL:\n          default:\n            prop = ATOM(_NET_WM_WINDOW_TYPE_NORMAL);\n            NORM_ERR(\"window type - normal\");\n            break;\n        }\n        XChangeProperty(display, window.window, xa, XA_ATOM, 32,\n                        PropModeReplace,\n                        reinterpret_cast<unsigned char *>(&prop), 1);\n      }\n\n      /* Set desired hints */\n\n      /* Window decorations */\n      if (TEST_HINT(hints, window_hints::UNDECORATED)) {\n        DBGP(\"hint - undecorated\");\n        xa = ATOM(_MOTIF_WM_HINTS);\n        if (xa != None) {\n          long prop[5] = {2, 0, 0, 0, 0};\n          XChangeProperty(display, window.window, xa, xa, 32, PropModeReplace,\n                          reinterpret_cast<unsigned char *>(prop), 5);\n        }\n      }\n\n      /* Below other windows */\n      if (TEST_HINT(hints, window_hints::BELOW)) {\n        DBGP(\"hint - below\");\n        xa = ATOM(_WIN_LAYER);\n        if (xa != None) {\n          long prop = 0;\n\n          XChangeProperty(display, window.window, xa, XA_CARDINAL, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&prop), 1);\n        }\n\n        xa = ATOM(_NET_WM_STATE);\n        if (xa != None) {\n          Atom xa_prop = ATOM(_NET_WM_STATE_BELOW);\n\n          XChangeProperty(display, window.window, xa, XA_ATOM, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&xa_prop), 1);\n        }\n      }\n\n      /* Above other windows */\n      if (TEST_HINT(hints, window_hints::ABOVE)) {\n        DBGP(\"hint - above\");\n        xa = ATOM(_WIN_LAYER);\n        if (xa != None) {\n          long prop = 6;\n\n          XChangeProperty(display, window.window, xa, XA_CARDINAL, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&prop), 1);\n        }\n\n        xa = ATOM(_NET_WM_STATE);\n        if (xa != None) {\n          Atom xa_prop = ATOM(_NET_WM_STATE_ABOVE);\n\n          XChangeProperty(display, window.window, xa, XA_ATOM, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&xa_prop), 1);\n        }\n      }\n\n      /* Sticky */\n      if (TEST_HINT(hints, window_hints::STICKY)) {\n        DBGP(\"hint - sticky\");\n        xa = ATOM(_NET_WM_DESKTOP);\n        if (xa != None) {\n          CARD32 xa_prop = 0xFFFFFFFF;\n\n          XChangeProperty(display, window.window, xa, XA_CARDINAL, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&xa_prop), 1);\n        }\n\n        xa = ATOM(_NET_WM_STATE);\n        if (xa != None) {\n          Atom xa_prop = ATOM(_NET_WM_STATE_STICKY);\n\n          XChangeProperty(display, window.window, xa, XA_ATOM, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&xa_prop), 1);\n        }\n      }\n\n      /* Skip taskbar */\n      if (TEST_HINT(hints, window_hints::SKIP_TASKBAR)) {\n        DBGP(\"hint - skip taskbar\");\n        xa = ATOM(_NET_WM_STATE);\n        if (xa != None) {\n          Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_TASKBAR);\n\n          XChangeProperty(display, window.window, xa, XA_ATOM, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&xa_prop), 1);\n        }\n      }\n\n      /* Skip pager */\n      if (TEST_HINT(hints, window_hints::SKIP_PAGER)) {\n        DBGP(\"hint - skip pager\");\n        xa = ATOM(_NET_WM_STATE);\n        if (xa != None) {\n          Atom xa_prop = ATOM(_NET_WM_STATE_SKIP_PAGER);\n\n          XChangeProperty(display, window.window, xa, XA_ATOM, 32,\n                          PropModeAppend,\n                          reinterpret_cast<unsigned char *>(&xa_prop), 1);\n        }\n      }\n    }\n\n    NORM_ERR(\"drawing to created window (0x%lx)\", window.window);\n    XMapWindow(display, window.window);\n  } else\n#endif /* OWN_WINDOW */\n  {\n    XWindowAttributes attrs;\n\n    if (window.window == None) { window.window = window.desktop; }\n\n    if (XGetWindowAttributes(display, window.window, &attrs) != 0) {\n      window.geometry.set_size(attrs.width, attrs.height);\n    }\n\n    NORM_ERR(\"drawing to desktop window\");\n  }\n\n  /* Drawable is same as window. This may be changed by double buffering. */\n  window.drawable = window.window;\n\n  XFlush(display);\n\n  int64_t input_mask = ExposureMask | PropertyChangeMask;\n#ifdef OWN_WINDOW\n  if (own_window.get(l)) {\n    input_mask |= StructureNotifyMask;\n#if !defined(BUILD_XINPUT)\n    input_mask |= ButtonPressMask | ButtonReleaseMask;\n#endif\n  }\n#if defined(BUILD_MOUSE_EVENTS) || defined(BUILD_XINPUT)\n  bool xinput_ok = false;\n#ifdef BUILD_XINPUT\n  // not a loop; substitutes goto with break - if checks fail\n  do {\n    int _ignored;  // segfault if NULL\n    if (!XQueryExtension(display, \"XInputExtension\", &window.xi_opcode,\n                         &_ignored, &_ignored)) {\n      // events will still ~work but let the user know why they're buggy\n      NORM_ERR(\"XInput extension is not supported by X11!\");\n      break;\n    }\n\n    int major = 2, minor = 0;\n    int retval = XIQueryVersion(display, &major, &minor);\n    if (retval != 0) {\n      NORM_ERR(\"Error: XInput 2.0 is not supported!\");\n      break;\n    }\n\n    const std::size_t mask_size = (XI_LASTEVENT + 7) / 8;\n    unsigned char mask_bytes[mask_size] = {0}; /* must be zeroed! */\n    XISetMask(mask_bytes, XI_HierarchyChanged);\n#ifdef BUILD_MOUSE_EVENTS\n    XISetMask(mask_bytes, XI_Motion);\n    XISetMask(mask_bytes, XI_ButtonPress);\n    XISetMask(mask_bytes, XI_ButtonRelease);\n#endif /* BUILD_MOUSE_EVENTS */\n\n    XIEventMask ev_masks[1];\n    ev_masks[0].deviceid = XIAllDevices;\n    ev_masks[0].mask_len = sizeof(mask_bytes);\n    ev_masks[0].mask = mask_bytes;\n    XISelectEvents(display, window.root, ev_masks, 1);\n\n    if (own) {\n#ifdef BUILD_MOUSE_EVENTS\n      XIClearMask(mask_bytes, XI_Motion);\n#endif /* BUILD_MOUSE_EVENTS */\n      XISetMask(mask_bytes, XI_ButtonPress);\n      XISetMask(mask_bytes, XI_ButtonRelease);\n\n      ev_masks[0].deviceid = XIAllDevices;\n      ev_masks[0].mask_len = sizeof(mask_bytes);\n      ev_masks[0].mask = mask_bytes;\n      XISelectEvents(display, window.window, ev_masks, 1);\n    }\n\n    // setup cache\n    int num_devices;\n    XDeviceInfo *info = XListInputDevices(display, &num_devices);\n    for (int i = 0; i < num_devices; i++) {\n      if (info[i].use == IsXPointer || info[i].use == IsXExtensionPointer) {\n        conky::device_info::from_xi_id(info[i].id, display);\n      }\n    }\n    XFreeDeviceList(info);\n\n    xinput_ok = true;\n  } while (false);\n#endif /* BUILD_XINPUT */\n  // Fallback to basic X11 enter/leave events if xinput fails to init.\n  // It's not recommended to add event masks to special windows in X; causes a\n  // crash (thus own_window_type != TYPE_DESKTOP)\n#ifdef BUILD_MOUSE_EVENTS\n  if (!xinput_ok && own && own_window_type.get(l) != window_type::DESKTOP) {\n    input_mask |= PointerMotionMask | EnterWindowMask | LeaveWindowMask;\n  }\n#endif /* BUILD_MOUSE_EVENTS */\n#endif /* BUILD_MOUSE_EVENTS || BUILD_XINPUT */\n#endif /* OWN_WINDOW */\n  window.event_mask = input_mask;\n  XSelectInput(display, window.window, input_mask);\n\n  window_created = 1;\n  DBGP(\"leave x11_init_window()\");\n}\n\nstatic Window find_desktop_window_impl(Window win, int w, int h) {\n  unsigned int i, j;\n  Window troot, parent, *children;\n  unsigned int n;\n\n  /* search subwindows with same size as display or work area */\n\n  for (i = 0; i < 10; i++) {\n    XQueryTree(display, win, &troot, &parent, &children, &n);\n\n    for (j = 0; j < n; j++) {\n      XWindowAttributes attrs;\n      if (XGetWindowAttributes(display, children[j], &attrs) != 0) {\n        /* Window must be mapped and same size as display or\n         * work space */\n        if (attrs.map_state == IsViewable && attrs.override_redirect == false &&\n            ((attrs.width == w && attrs.height == h))) {\n          win = children[j];\n          break;\n        }\n      }\n    }\n\n    XFree(children);\n    if (j == n) { break; }\n  }\n\n  return win;\n}\n\nvoid create_gc() {\n  XGCValues values;\n\n  values.graphics_exposures = 0;\n  values.function = GXcopy;\n  window.gc = XCreateGC(display, window.drawable,\n                        GCFunction | GCGraphicsExposures, &values);\n}\n\n// Get current desktop number\nstatic inline void get_x11_desktop_current(Display *current_display,\n                                           Window root, Atom atom) {\n  Atom actual_type;\n  int actual_format;\n  unsigned long nitems;\n  unsigned long bytes_after;\n  unsigned char *prop = nullptr;\n  struct information *current_info = &info;\n\n  if (atom == None) { return; }\n\n  if ((XGetWindowProperty(current_display, root, atom, 0, 1L, False,\n                          XA_CARDINAL, &actual_type, &actual_format, &nitems,\n                          &bytes_after, &prop) == 0) &&\n      (actual_type == XA_CARDINAL) && (nitems == 1L) && (actual_format == 32)) {\n    current_info->x11.desktop.current = prop[0] + 1;\n  }\n  if (prop != nullptr) { XFree(prop); }\n}\n\n// Get total number of available desktops\nstatic inline void get_x11_desktop_number(Display *current_display, Window root,\n                                          Atom atom) {\n  Atom actual_type;\n  int actual_format;\n  unsigned long nitems;\n  unsigned long bytes_after;\n  unsigned char *prop = nullptr;\n  struct information *current_info = &info;\n\n  if (atom == None) { return; }\n\n  if ((XGetWindowProperty(current_display, root, atom, 0, 1L, False,\n                          XA_CARDINAL, &actual_type, &actual_format, &nitems,\n                          &bytes_after, &prop) == 0) &&\n      (actual_type == XA_CARDINAL) && (nitems == 1L) && (actual_format == 32)) {\n    current_info->x11.desktop.number = prop[0];\n  }\n  if (prop != nullptr) { XFree(prop); }\n}\n\n// Get all desktop names\nstatic inline void get_x11_desktop_names(Display *current_display, Window root,\n                                         Atom atom) {\n  Atom actual_type;\n  int actual_format;\n  unsigned long nitems;\n  unsigned long bytes_after;\n  unsigned char *prop = nullptr;\n  struct information *current_info = &info;\n\n  if (atom == None) { return; }\n\n  if ((XGetWindowProperty(current_display, root, atom, 0, (~0L), False,\n                          ATOM(UTF8_STRING), &actual_type, &actual_format,\n                          &nitems, &bytes_after, &prop) == 0) &&\n      (actual_type == ATOM(UTF8_STRING)) && (nitems > 0L) &&\n      (actual_format == 8)) {\n    current_info->x11.desktop.all_names.assign(\n        reinterpret_cast<const char *>(prop), nitems);\n  }\n  if (prop != nullptr) { XFree(prop); }\n}\n\n// Get current desktop name\nstatic inline void get_x11_desktop_current_name(const std::string &names) {\n  struct information *current_info = &info;\n  unsigned int i = 0, j = 0;\n  int k = 0;\n\n  while (i < names.size()) {\n    if (names[i++] == '\\0') {\n      if (++k == current_info->x11.desktop.current) {\n        current_info->x11.desktop.name.assign(names.c_str() + j);\n        break;\n      }\n      j = i;\n    }\n  }\n}\n\nvoid get_x11_desktop_info(Display *current_display, Atom atom) {\n  Window root;\n  static Atom atom_current, atom_number, atom_names;\n  struct information *current_info = &info;\n  XWindowAttributes window_attributes;\n\n  root = RootWindow(current_display, current_info->x11.monitor.current);\n\n  /* Check if we initialise else retrieve changed property */\n  if (atom == 0) {\n    atom_current = XInternAtom(current_display, \"_NET_CURRENT_DESKTOP\", True);\n    atom_number = XInternAtom(current_display, \"_NET_NUMBER_OF_DESKTOPS\", True);\n    atom_names = XInternAtom(current_display, \"_NET_DESKTOP_NAMES\", True);\n    get_x11_desktop_current(current_display, root, atom_current);\n    get_x11_desktop_number(current_display, root, atom_number);\n    get_x11_desktop_names(current_display, root, atom_names);\n    get_x11_desktop_current_name(current_info->x11.desktop.all_names);\n\n    /* Set the PropertyChangeMask on the root window, if not set */\n    XGetWindowAttributes(display, root, &window_attributes);\n    if ((window_attributes.your_event_mask & PropertyChangeMask) == 0) {\n      XSetWindowAttributes attributes;\n      attributes.event_mask =\n          window_attributes.your_event_mask | PropertyChangeMask;\n      XChangeWindowAttributes(display, root, CWEventMask, &attributes);\n      XGetWindowAttributes(display, root, &window_attributes);\n    }\n  } else {\n    if (atom == atom_current) {\n      get_x11_desktop_current(current_display, root, atom_current);\n      get_x11_desktop_current_name(current_info->x11.desktop.all_names);\n    } else if (atom == atom_number) {\n      get_x11_desktop_number(current_display, root, atom_number);\n    } else if (atom == atom_names) {\n      get_x11_desktop_names(current_display, root, atom_names);\n      get_x11_desktop_current_name(current_info->x11.desktop.all_names);\n    }\n  }\n}\n\nstatic const char NOT_IN_X[] = \"Not running in X\";\n\nvoid print_monitor(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_x.get(*state)) {\n    strncpy(p, NOT_IN_X, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", XDefaultScreen(display));\n}\n\nvoid print_monitor_number(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_x.get(*state)) {\n    strncpy(p, NOT_IN_X, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", XScreenCount(display));\n}\n\nvoid print_desktop(struct text_object *obj, char *p, unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_x.get(*state)) {\n    strncpy(p, NOT_IN_X, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", info.x11.desktop.current);\n}\n\nvoid print_desktop_number(struct text_object *obj, char *p,\n                          unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_x.get(*state)) {\n    strncpy(p, NOT_IN_X, p_max_size);\n    return;\n  }\n  snprintf(p, p_max_size, \"%d\", info.x11.desktop.number);\n}\n\nvoid print_desktop_name(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  (void)obj;\n\n  if (!out_to_x.get(*state)) {\n    strncpy(p, NOT_IN_X, p_max_size);\n  } else {\n    strncpy(p, info.x11.desktop.name.c_str(), p_max_size);\n  }\n}\n\n#ifdef OWN_WINDOW\nnamespace x11_strut {\nenum value : size_t {\n  LEFT,\n  RIGHT,\n  TOP,\n  BOTTOM,\n  LEFT_START_Y,\n  LEFT_END_Y,\n  RIGHT_START_Y,\n  RIGHT_END_Y,\n  TOP_START_X,\n  TOP_END_X,\n  BOTTOM_START_X,\n  BOTTOM_END_X,\n  COUNT,\n};\n\ninline std::array<long, x11_strut::COUNT> array() {\n  std::array<long, COUNT> sizes;\n  std::memset(sizes.data(), 0, sizeof(long) * COUNT);\n  return sizes;\n}\n}  // namespace x11_strut\n\nvoid set_struts() {\n  /* clang-format on */\n  static bool warn_once = true;\n  if (warn_once) {\n    // Before adding new sessions to the unsupported list, please check whether\n    // it's at all possible to support them by re-arranging values provided in\n    // this function\n    /* clang-format off */\n    const bool unsupported = wm_is({\n      /* clang-format off */\n      conky::info::window_manager::enlightenment  // has its own gadgets system; requires a custom output and additional libraries\n        /* clang-format on */\n    });\n\n    if (unsupported) {\n      // feel free to add any special support\n      NORM_ERR(\n          \"WM/DE you're using (%s) doesn't support WM_STRUT hints (well); \"\n          \"reserved area functionality might not work correctly\",\n          info.system.wm_name);\n    }\n    warn_once = false;\n  }\n\n  // Most WMs simply subtract the primary strut side from workarea where windows\n  // will be placed. e.g. TOP_LEFT will cause all windows to be shifted down\n  // even if conky is a thin and tall window. It's our responsibility to set the\n  // primary strut side to the value that's going to eat up least available\n  // space.\n  //\n  // compiz:\n  // https://github.com/compiz-reloaded/compiz/blob/155c201ec62c289c5a44b6dd23eddec3e3c20e26/src/window.c#L1843\n  // Fluxbox:\n  // https://github.com/fluxbox/fluxbox/blob/88bbf811dade299ca2dac66cb81e4b3d96cfe741/src/Ewmh.cc#L1397\n  // i3:\n  // https://github.com/i3/i3/blob/cfa4cf16bea809c7c715a86c428757e577c85254/src/manage.c#L260\n  // Mutter:\n  // https://gitlab.gnome.org/GNOME/mutter/-/blob/ea8b65d0c92ebf84060ea0b5c61d02fa9004e1e9/src/core/boxes.c#L564\n  // Openbox:\n  // https://github.com/Mikachu/openbox/blob/dac6e2f6f8f2e0c5586a9e19f18508a03db639cb/openbox/screen.c#L1428\n  // xfwm:\n  // https://github.com/xfce-mirror/xfwm4/blob/37636f55bcbca064e62489d7fe183ef7b9371b4c/src/placement.c#L220\n  //\n  // The EWMH spec doesn't handle placement of panels/docks in middle of the\n  // screen (e.g. left side of the right monitor with Xinerama). Submissions are\n  // closed and it won't be fixed.\n  // See: https://gitlab.freedesktop.org/xdg/xdg-specs/-/merge_requests/22\n\n  Atom atom = ATOM(_NET_WM_STRUT);\n  if (atom == None) return;\n\n  auto sizes = x11_strut::array();\n\n  const int display_width = DisplayWidth(display, screen);\n  const int display_height = DisplayHeight(display, screen);\n\n  bool supports_cutout =\n      ENABLE_RUNTIME_TWEAKS &&\n      wm_is({\n          /* clang-format off */\n      conky::info::window_manager::compiz,\n      conky::info::window_manager::fluxbox,\n      conky::info::window_manager::i3,  // only uses WM_STRUT_PARTIAL to determine top/bottom dock placement\n      conky::info::window_manager::kwin,\n          /* clang-format on */\n      });\n\n  if (supports_cutout) {\n    alignment align = text_alignment.get(*state);\n    // Middle and none align don't have least significant bit set.\n    // Ensures either vertical or horizontal axis are start/end\n    if ((*align & 0b0101) == 0) return;\n\n    // Compute larger dimension only once; so we don't jump between axes for\n    // corner alignments.\n    // If window is wider than it's tall, top/bottom placement is preferred.\n    // It's also preferred for WMs that completely ignore horizontal docks.\n    static bool is_wide_window =\n        window.geometry.width() > window.geometry.height() ||\n        wm_is(conky::info::window_manager::i3);\n    if (is_wide_window) {\n      switch (align) {\n        case alignment::TOP_LEFT:\n        case alignment::TOP_RIGHT:\n        case alignment::TOP_MIDDLE:\n          sizes[x11_strut::TOP] =\n              std::clamp(window.geometry.end_y(), 0, display_height);\n          sizes[x11_strut::TOP_START_X] =\n              std::clamp(window.geometry.x(), 0, display_width);\n          sizes[x11_strut::TOP_END_X] =\n              std::clamp(window.geometry.end_x(), 0, display_width);\n          break;\n        case alignment::BOTTOM_LEFT:\n        case alignment::BOTTOM_RIGHT:\n        case alignment::BOTTOM_MIDDLE:\n          sizes[x11_strut::BOTTOM] =\n              display_height -\n              std::clamp(window.geometry.y(), 0, display_height);\n          sizes[x11_strut::BOTTOM_START_X] =\n              std::clamp(window.geometry.x(), 0, display_width);\n          sizes[x11_strut::BOTTOM_END_X] =\n              std::clamp(window.geometry.end_x(), 0, display_width);\n          break;\n        case alignment::MIDDLE_LEFT:\n          sizes[x11_strut::LEFT] =\n              std::clamp(window.geometry.end_x(), 0, display_width);\n          sizes[x11_strut::LEFT_START_Y] =\n              std::clamp(window.geometry.y(), 0, display_height);\n          sizes[x11_strut::LEFT_END_Y] =\n              std::clamp(window.geometry.end_y(), 0, display_height);\n          break;\n        case alignment::MIDDLE_RIGHT:\n          sizes[x11_strut::RIGHT] =\n              display_width - std::clamp(window.geometry.x(), 0, display_width);\n          sizes[x11_strut::RIGHT_START_Y] =\n              std::clamp(window.geometry.y(), 0, display_height);\n          sizes[x11_strut::RIGHT_END_Y] =\n              std::clamp(window.geometry.end_y(), 0, display_height);\n          break;\n        default:\n          // can't reserve space in middle of the screen\n          break;\n      }\n    } else {\n      // if window is thin, prefer left/right placement\n      switch (align) {\n        case alignment::TOP_LEFT:\n        case alignment::MIDDLE_LEFT:\n        case alignment::BOTTOM_LEFT:\n          sizes[x11_strut::LEFT] =\n              std::clamp(window.geometry.end_x(), 0, display_width);\n          sizes[x11_strut::LEFT_START_Y] =\n              std::clamp(window.geometry.y(), 0, display_height);\n          sizes[x11_strut::LEFT_END_Y] =\n              std::clamp(window.geometry.end_y(), 0, display_height);\n          break;\n        case alignment::TOP_RIGHT:\n        case alignment::MIDDLE_RIGHT:\n        case alignment::BOTTOM_RIGHT:\n          sizes[x11_strut::RIGHT] =\n              display_width - std::clamp(window.geometry.x(), 0, display_width);\n          sizes[x11_strut::RIGHT_START_Y] =\n              std::clamp(window.geometry.y(), 0, display_height);\n          sizes[x11_strut::RIGHT_END_Y] =\n              std::clamp(window.geometry.end_y(), 0, display_height);\n          break;\n        case alignment::TOP_MIDDLE:\n          sizes[x11_strut::TOP] =\n              std::clamp(window.geometry.end_y(), 0, display_height);\n          sizes[x11_strut::TOP_START_X] =\n              std::clamp(window.geometry.x(), 0, display_width);\n          sizes[x11_strut::TOP_END_X] =\n              std::clamp(window.geometry.end_x(), 0, display_width);\n          break;\n        case alignment::BOTTOM_MIDDLE:\n          sizes[x11_strut::BOTTOM] =\n              display_height -\n              std::clamp(window.geometry.y(), 0, display_height);\n          sizes[x11_strut::BOTTOM_START_X] =\n              std::clamp(window.geometry.x(), 0, display_width);\n          sizes[x11_strut::BOTTOM_END_X] =\n              std::clamp(window.geometry.end_x(), 0, display_width);\n          break;\n        default:\n          // can't reserve space in middle of the screen\n          break;\n      }\n    }\n  } else {\n    // This approach works better for fully spec-compliant WMs\n    if (window.geometry.width() < window.geometry.height()) {\n      const int space_left = window.geometry.end_x();\n      const int space_right =\n          display_width - window.geometry.end_x() + window.geometry.width();\n      if (space_left < space_right) {\n        sizes[x11_strut::LEFT] =\n            std::clamp(window.geometry.end_x(), 0, display_width);\n        sizes[x11_strut::LEFT_START_Y] =\n            std::clamp(window.geometry.y(), 0, display_height);\n        sizes[x11_strut::LEFT_END_Y] =\n            std::clamp(window.geometry.end_y(), 0, display_height);\n      } else {\n        // we subtract x from display_width in case conky isn't flush with the\n        // right screen side; i.e. there's a gap between conky and the right\n        // side of the screen\n        sizes[x11_strut::RIGHT] =\n            display_width - std::clamp(window.geometry.x(), 0, display_width);\n        sizes[x11_strut::RIGHT_START_Y] =\n            std::clamp(window.geometry.y(), 0, display_height);\n        sizes[x11_strut::RIGHT_END_Y] =\n            std::clamp(window.geometry.end_y(), 0, display_height);\n      }\n    } else {\n      const int space_top = window.geometry.end_y();\n      const int space_bottom =\n          display_height - window.geometry.end_y() + window.geometry.height();\n      if (space_top < space_bottom) {\n        sizes[x11_strut::TOP] =\n            std::clamp(window.geometry.end_y(), 0, display_height);\n        sizes[x11_strut::TOP_START_X] =\n            std::clamp(window.geometry.x(), 0, display_width);\n        sizes[x11_strut::TOP_END_X] =\n            std::clamp(window.geometry.end_x(), 0, display_width);\n      } else {\n        // we subtract y from display_height in case conky isn't flush with the\n        // bottom screen side; i.e. there's a gap between conky and the bottom\n        // of the screen\n        sizes[x11_strut::BOTTOM] =\n            display_height - std::clamp(window.geometry.y(), 0, display_height);\n        sizes[x11_strut::BOTTOM_START_X] =\n            std::clamp(window.geometry.x(), 0, display_width);\n        sizes[x11_strut::BOTTOM_END_X] =\n            std::clamp(window.geometry.end_x(), 0, display_width);\n      }\n    }\n  }\n\n  DBGP(\n      \"Reserved space: left=%d, right=%d, top=%d, \"\n      \"bottom=%d\",\n      sizes[0], sizes[1], sizes[2], sizes[3]);\n\n  XChangeProperty(display, window.window, atom, XA_CARDINAL, 32,\n                  PropModeReplace, reinterpret_cast<unsigned char *>(&sizes),\n                  4);\n\n  atom = ATOM(_NET_WM_STRUT_PARTIAL);\n  if (atom == None) return;\n\n  DBGP(\n      \"Reserved space edges: left_start_y=%d, left_end_y=%d, \"\n      \"right_start_y=%d, right_end_y=%d, top_start_x=%d, \"\n      \"top_end_x=%d, bottom_start_x=%d, bottom_end_x=%d\",\n      sizes[4], sizes[5], sizes[6], sizes[7], sizes[8], sizes[9], sizes[10],\n      sizes[11]);\n\n  XChangeProperty(display, window.window, atom, XA_CARDINAL, 32,\n                  PropModeReplace, reinterpret_cast<unsigned char *>(&sizes),\n                  12);\n}\n#endif /* OWN_WINDOW */\n\n#ifdef BUILD_XDBE\nvoid xdbe_swap_buffers() {\n  if (use_xdbe.get(*state)) {\n    XdbeSwapInfo swap;\n\n    swap.swap_window = window.window;\n    swap.swap_action = XdbeBackground;\n    XdbeSwapBuffers(display, &swap, 1);\n  }\n}\n#else\nvoid xpmdb_swap_buffers(void) {\n  if (use_xpmdb.get(*state)) {\n    XCopyArea(display, window.back_buffer, window.window, window.gc, 0, 0,\n              window.geometry.width(), window.geometry.height(), 0, 0);\n    XSetForeground(display, window.gc, 0);\n    XFillRectangle(display, window.drawable, window.gc, 0, 0, window.geometry.width(),\n                   window.geometry.height());\n    XFlush(display);\n  }\n}\n#endif /* BUILD_XDBE */\n\nvoid print_kdb_led(const int keybit, char *p, unsigned int p_max_size) {\n  XKeyboardState x;\n  XGetKeyboardControl(display, &x);\n  snprintf(p, p_max_size, \"%s\", (x.led_mask & keybit ? \"On\" : \"Off\"));\n}\nvoid print_key_caps_lock(struct text_object *obj, char *p,\n                         unsigned int p_max_size) {\n  (void)obj;\n  print_kdb_led(1, p, p_max_size);\n}\n\nvoid print_key_num_lock(struct text_object *obj, char *p,\n                        unsigned int p_max_size) {\n  (void)obj;\n  print_kdb_led(2, p, p_max_size);\n}\n\nvoid print_key_scroll_lock(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  (void)obj;\n  print_kdb_led(4, p, p_max_size);\n}\n\nvoid print_keyboard_layout(struct text_object *obj, char *p,\n                           unsigned int p_max_size) {\n  (void)obj;\n\n  char *group = NULL;\n  XkbStateRec state;\n  XkbDescPtr desc;\n\n  XkbGetState(display, XkbUseCoreKbd, &state);\n  desc = XkbGetKeyboard(display, XkbAllComponentsMask, XkbUseCoreKbd);\n  group = XGetAtomName(display, desc->names->groups[state.group]);\n\n  snprintf(p, p_max_size, \"%s\", (group != NULL ? group : \"unknown\"));\n  XFree(group);\n  XkbFreeKeyboard(desc, XkbGBN_AllComponentsMask, True);\n}\n\nvoid print_mouse_speed(struct text_object *obj, char *p,\n                       unsigned int p_max_size) {\n  (void)obj;\n  int acc_num = 0;\n  int acc_denom = 0;\n  int threshold = 0;\n\n  XGetPointerControl(display, &acc_num, &acc_denom, &threshold);\n  snprintf(p, p_max_size, \"%d%%\", (110 - threshold));\n}\n\n/// @brief Returns a mask for the event_type\n/// @param event_type Xlib event type\n/// @return Xlib event mask\nint ev_to_mask(int event_type, int button) {\n  switch (event_type) {\n    case KeyPress:\n      return KeyPressMask;\n    case KeyRelease:\n      return KeyReleaseMask;\n    case ButtonPress:\n      return ButtonPressMask;\n    case ButtonRelease:\n      switch (button) {\n        case 1:\n          return ButtonReleaseMask | Button1MotionMask;\n        case 2:\n          return ButtonReleaseMask | Button2MotionMask;\n        case 3:\n          return ButtonReleaseMask | Button3MotionMask;\n        case 4:\n          return ButtonReleaseMask | Button4MotionMask;\n        case 5:\n          return ButtonReleaseMask | Button5MotionMask;\n        default:\n          return ButtonReleaseMask;\n      }\n    case EnterNotify:\n      return EnterWindowMask;\n    case LeaveNotify:\n      return LeaveWindowMask;\n    case MotionNotify:\n      return PointerMotionMask;\n    default:\n      return NoEventMask;\n  }\n}\n\n#ifdef BUILD_XINPUT\nvoid propagate_xinput_event(const conky::xi_event_data *ev) {\n  if (ev->evtype != XI_Motion && ev->evtype != XI_ButtonPress &&\n      ev->evtype != XI_ButtonRelease) {\n    return;\n  }\n\n  Window target = window.root;\n  Window child = None;\n  conky::vec2i target_pos = ev->pos;\n  {\n    std::vector<Window> below = query_x11_windows_at_pos(\n        display, ev->pos_absolute,\n        [](XWindowAttributes &a) { return a.map_state == IsViewable; });\n    auto it = std::remove_if(below.begin(), below.end(),\n                             [](Window w) { return w == window.window; });\n    below.erase(it, below.end());\n    if (!below.empty()) {\n      target = below.back();\n\n      int read_x, read_y;\n      // Update event x and y coordinates to be target window relative\n      XTranslateCoordinates(display, window.desktop, ev->event,\n                            ev->pos_absolute.x(), ev->pos_absolute.y(), &read_x,\n                            &read_y, &child);\n      target_pos = conky::vec2i(read_x, read_y);\n    }\n  }\n\n  auto events = ev->generate_events(target, child, target_pos);\n\n  XUngrabPointer(display, CurrentTime);\n  for (auto it : events) {\n    auto ev = std::get<1>(it);\n    XSendEvent(display, target, True, std::get<0>(it), ev);\n    free(ev);\n  }\n\n  XFlush(display);\n}\n#endif\n\nvoid propagate_x11_event(XEvent &ev, const void *cookie) {\n  bool focus = ev.type == ButtonPress;\n\n  // cookie must be allocated before propagation, and freed after\n#ifdef BUILD_XINPUT\n  if (ev.type == GenericEvent && ev.xgeneric.extension == window.xi_opcode) {\n    if (cookie == nullptr) { return; }\n    return propagate_xinput_event(\n        reinterpret_cast<const conky::xi_event_data *>(cookie));\n  }\n#endif\n\n  if (!(ev.type == KeyPress || ev.type == KeyRelease ||\n        ev.type == ButtonPress || ev.type == ButtonRelease ||\n        ev.type == MotionNotify || ev.type == EnterNotify ||\n        ev.type == LeaveNotify)) {\n    // Not a known input event; blindly propagating them causes loops and all\n    // sorts of other evil.\n    return;\n  }\n  // Note that using ev.xbutton is the same as using any of the above events.\n  // It's only important we don't access fields that are not common to all of\n  // them.\n\n  ev.xbutton.window = window.desktop;\n  ev.xbutton.x = ev.xbutton.x_root;\n  ev.xbutton.y = ev.xbutton.y_root;\n  ev.xbutton.time = CurrentTime;\n\n  /* forward the event to the window below conky (e.g. caja) or desktop */\n  {\n    std::vector<Window> below = query_x11_windows_at_pos(\n        display, conky::vec2i(ev.xbutton.x_root, ev.xbutton.y_root),\n        [](XWindowAttributes &a) { return a.map_state == IsViewable; });\n    auto it = std::remove_if(below.begin(), below.end(),\n                             [](Window w) { return w == window.window; });\n    below.erase(it, below.end());\n    if (!below.empty()) {\n      ev.xbutton.window = below.back();\n\n      Window _ignore;\n      // Update event x and y coordinates to be target window relative\n      XTranslateCoordinates(display, window.root, ev.xbutton.window,\n                            ev.xbutton.x_root, ev.xbutton.y_root, &ev.xbutton.x,\n                            &ev.xbutton.y, &_ignore);\n    }\n    // drop below vector\n  }\n\n  int mask =\n      ev_to_mask(ev.type, ev.type == ButtonRelease ? ev.xbutton.button : 0);\n  XUngrabPointer(display, CurrentTime);\n  XSendEvent(display, ev.xbutton.window, True, mask, &ev);\n  if (focus) {\n    XSetInputFocus(display, ev.xbutton.window, RevertToParent, CurrentTime);\n  }\n}\n\nWindow query_x11_top_parent(Display *display, Window child) {\n  Window root = DefaultVRootWindow(display);\n\n  if (child == None || child == root) return child;\n\n  Window ret_root, parent, *children;\n  std::uint32_t child_count;\n\n  Window current = child;\n  int i;\n  do {\n    if (XQueryTree(display, current, &ret_root, &parent, &children,\n                   &child_count) == 0) {\n      break;\n    }\n    if (child_count != 0) XFree(children);\n    if (parent == root) break;\n    current = parent;\n  } while (true);\n\n  return current;\n}\n\nstd::vector<Window> x11_atom_window_list(Display *display, Window window,\n                                         Atom atom) {\n  Atom actual_type;\n  int actual_format;\n  unsigned long nitems;\n  unsigned long bytes_after;\n  unsigned char *data = nullptr;\n\n  if (XGetWindowProperty(display, window, atom, 0, (~0L), False, XA_WINDOW,\n                         &actual_type, &actual_format, &nitems, &bytes_after,\n                         &data) == 0) {\n    if (actual_format == XA_WINDOW && nitems > 0) {\n      Window *wdata = reinterpret_cast<Window *>(data);\n      std::vector<Window> result(wdata, wdata + nitems);\n      XFree(data);\n      return result;\n    }\n  }\n\n  return std::vector<Window>{};\n}\n\nstd::vector<Window> query_x11_windows(Display *display, bool eager) {\n  Window root = DefaultRootWindow(display);\n\n  std::vector<Window> result;\n\n  Atom clients_atom = XInternAtom(display, \"_NET_CLIENT_LIST_STACKING\", True);\n  if (clients_atom != 0) {\n    result = x11_atom_window_list(display, root, clients_atom);\n    if (!result.empty()) { return result; }\n  }\n\n  clients_atom = XInternAtom(display, \"_NET_CLIENT_LIST\", True);\n  if (clients_atom != 0) {\n    result = x11_atom_window_list(display, root, clients_atom);\n    if (!result.empty()) { return result; }\n  }\n\n  // slowest method\n\n  if (eager) {\n    std::vector<Window> queue = {DefaultVRootWindow(display)};\n\n    Window _ignored, *children;\n    std::uint32_t count;\n\n    const auto has_wm_hints = [&](Window window) {\n      auto hints = XGetWMHints(display, window);\n      bool result = hints != NULL;\n      if (result) XFree(hints);\n      return result;\n    };\n\n    while (!queue.empty()) {\n      Window current = queue.back();\n      queue.pop_back();\n      if (XQueryTree(display, current, &_ignored, &_ignored, &children,\n                     &count)) {\n        for (size_t i = 0; i < count; i++) queue.push_back(children[i]);\n        if (has_wm_hints(current)) result.push_back(current);\n        if (count > 0) XFree(children);\n      }\n    }\n  }\n\n  return result;\n}\n\nWindow query_x11_window_at_pos(Display *display, conky::vec2i pos, int device_id) {\n  (void) device_id;\n  Window root = DefaultVRootWindow(display);\n\n  \n  Window root_return;\n  Window last = None;\n\n  #ifdef BUILD_XINPUT\n  // these values are ignored but NULL can't be passed to XIQueryPointer.\n  double root_x_return, root_y_return, win_x_return, win_y_return;\n  XIButtonState buttons_return;\n  XIModifierState modifiers_return;\n  XIGroupState group_return;\n\n  \n  XIQueryPointer(display,device_id, window.root, &root_return, &last, &root_x_return,\n                &root_y_return, &win_x_return, &win_y_return, &buttons_return, &modifiers_return, &group_return);\n  #else\n  // these values are ignored but NULL can't be passed to XQueryPointer.\n  int root_x_return, root_y_return, win_x_return, win_y_return;\n  unsigned int mask_return;\n\n  XQueryPointer(display, window.root, &root_return, &last, &root_x_return,\n                &root_y_return, &win_x_return, &win_y_return, &mask_return);\n  #endif\n\n  if (last == 0) return root;\n  return last;\n}\n\nstd::vector<Window> query_x11_windows_at_pos(\n    Display *display, conky::vec2i pos,\n    std::function<bool(XWindowAttributes &)> predicate, bool eager) {\n  std::vector<Window> result;\n\n  Window root = DefaultVRootWindow(display);\n  XWindowAttributes attr;\n\n  for (Window current : query_x11_windows(display, eager)) {\n    int pos_x, pos_y;\n    Window _ignore;\n    // Doesn't account for decorations. There's no sane way to do that.\n    XTranslateCoordinates(display, current, root, 0, 0, &pos_x, &pos_y,\n                          &_ignore);\n    XGetWindowAttributes(display, current, &attr);\n\n    if (pos_x <= pos.x() && pos_y <= pos.y() && pos_x + attr.width >= pos.x() &&\n        pos_y + attr.height >= pos.y() && predicate(attr)) {\n      result.push_back(current);\n    }\n  }\n\n  return result;\n}\n"
  },
  {
    "path": "src/output/x11.h",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *  (see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef CONKY_X11_H\n#define CONKY_X11_H\n\n#include \"config.h\"\n\n#ifndef BUILD_X11\n#error x11.h included when BUILD_X11 is disabled\n#endif\n\n#include <X11/Xatom.h>\n#pragma GCC diagnostic push\n#pragma GCC diagnostic ignored \"-Wvariadic-macros\"\n#include <X11/Xlib.h>\n#pragma GCC diagnostic pop\n\n#ifdef BUILD_XFT\n#include <X11/Xft/Xft.h>\n#endif\n#ifdef BUILD_XDBE\n#include <X11/extensions/Xdbe.h>\n#endif\n\n#include <cstdint>\n#include <functional>\n#include <vector>\n\n// TODO: remove lua requirement from x11_init_window\n#include \"../lua/llua.h\"\n\n#include \"../geometry.h\"\n#include \"gui.h\"\n\n/* true if use_argb_visual=true and argb visual was found*/\nextern bool have_argb_visual;\n\n#define ATOM(a) XInternAtom(display, #a, False)\n\n/// @brief Display where conky is placed\nextern Display *display;\n/// @brief Screen with conky\nextern int screen;\n\nstruct conky_x11_window {\n  /// XID of x11 root window\n  Window root;\n  /// XID of Conky window\n  Window window;\n  /// XID of DE desktop window (or root if none)\n  Window desktop;\n  Drawable drawable;\n  Visual *visual;\n  Colormap colourmap;\n  GC gc;\n\n  // Mask containing all events captured by conky\n  int64_t event_mask;\n\n#ifdef BUILD_XDBE\n  XdbeBackBuffer back_buffer;\n#else  /*BUILD_XDBE*/\n  Pixmap back_buffer;\n#endif /*BUILD_XDBE*/\n#ifdef BUILD_XFT\n  XftDraw *xftdraw;\n#endif /*BUILD_XFT*/\n#if defined(BUILD_MOUSE_EVENTS) || defined(BUILD_XINPUT)\n  // Don't feature gate with BUILD_XINPUT; controls fallback.\n  std::int32_t xi_opcode;\n#endif /* BUILD_MOUSE_EVENTS || BUILD_XINPUT */\n\n  /// @brief Window geometry in screen coordinate space\n  conky::rect<int> geometry;\n};\n\nextern struct conky_x11_window window;\n\nvoid update_x11_resource_db(bool first_run = false);\nvoid update_x11_workarea();\nvoid init_x11();\nvoid destroy_window(void);\nvoid create_gc(void);\nvoid set_transparent_background(Window win);\nvoid get_x11_desktop_info(Display *current_display, Atom atom);\n/// @brief Sets reserved area atoms for the conky window to avoid other windows\n/// covering it.\n///\n/// Prints out a warning if user is using one of sessions that are known not to\n/// work.\nvoid set_struts();\nvoid x11_init_window(lua::state &l, bool own);\nvoid deinit_x11();\n\n/// @brief Forwards argument event to the top-most window at event positon that\n/// isn't conky.\n///\n/// Calling this function is time sensitive as it will query window at event\n/// position **at invocation time**.\n/// @param event event to forward\n/// @param cookie optional cookie data\nvoid propagate_x11_event(XEvent &event, const void *cookie = nullptr);\n\n/// @brief Returns a list of window values for the given atom.\n/// @param display display with which the atom is associated\n/// @param window window to query for the atom value\n/// @param atom atom to query for\n/// @return a list of window values for the given atom\nstd::vector<Window> x11_atom_window_list(Display *display, Window window,\n                                         Atom atom);\n\n/// @brief Tries getting a list of windows ordered from bottom to top.\n///\n/// Whether the list is correctly ordered depends on WM/DE providing the\n/// `_NET_CLIENT_LIST_STACKING` atom. If only `_NET_CLIENT_LIST` is defined,\n/// this function assumes the WM/DE is a tiling one without stacking order.\n///\n/// If neither of the atoms are provided, this function tries traversing the\n/// window graph in order to collect windows. In this case, map state of windows\n/// is ignored.\n///\n/// @param display which display to query for windows\n/// @param eager fallback to very slow tree traversal to ensure a list of\n/// windows is returned even if window list atoms aren't defined\n/// @return a (likely) ordered list of windows\nstd::vector<Window> query_x11_windows(Display *display, bool eager = false);\n\n/// @brief Finds the last ascendant of a window (trunk) before root.\n///\n/// If provided `child` is root or has no windows between root and itself, the\n/// `child` is returned.\n///\n/// @param display display of parent\n/// @param child window whose parents to query\n/// @return the top level ascendant window\nWindow query_x11_top_parent(Display *display, Window child);\n\n/// @brief Returns the top-most window overlapping provided screen coordinates.\n///\n/// @param display display of parent\n/// @param x screen X position contained by window\n/// @param y screen Y position contained by window\n/// @param device_id pointer device id to be queried (will be ignored if BUILD_XINPUT is disabled)\n/// @return a top-most window at provided screen coordinates, or root\nWindow query_x11_window_at_pos(Display *display, conky::vec2i pos, int device_id);\n\n/// @brief Returns a list of windows overlapping provided screen coordinates.\n///\n/// Vector returned by this function will never contain root because it's\n/// assumed to always cover the entire display.\n///\n/// @param display display of parent\n/// @param x screen X position contained by window\n/// @param y screen Y position contained by window\n/// @param predicate any additional predicates to apply for XWindowAttributes\n/// (besides bounds testing).\n/// @return a vector of windows at provided screen coordinates\nstd::vector<Window> query_x11_windows_at_pos(\n    Display *display, conky::vec2i pos,\n    std::function<bool(XWindowAttributes &)> predicate =\n        [](XWindowAttributes &a) { return true; },\n    bool eager = false);\n\n#ifdef BUILD_XDBE\nvoid xdbe_swap_buffers(void);\n#else\nvoid xpmdb_swap_buffers(void);\n#endif /* BUILD_XDBE */\n\n#endif /* CONKY_X11_H */\n"
  },
  {
    "path": "src/prioqueue.cc",
    "content": "/*\n *\n * prioqueue:  a simple priority queue implementation\n *\n * The queue organises it's data internally using a doubly linked\n * list, into which elements are inserted at the right position. This\n * is definitely not the best algorithm for a priority queue, but it\n * fits best for the given purpose, i.e. the top process sorting.\n * This means we have a rather little amount of total elements (~200\n * on a normal system), which are to be inserted into a queue of only\n * the few top-most elements (10 at the current state). Additionally,\n * at each update interval, the queue is drained completely and\n * refilled from scratch.\n *\n * Copyright (C) 2009 Phil Sutter <phil@nwl.cc>\n *\n * Initially based on the former implementation of sorted processes in\n * top.c, Copyright (C) 2005 David Carter <boojit@pundo.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <climits> /* INT_MAX */\n#include <cstdlib>\n#include <cstring>\n#include \"conky.h\"\n\nstruct prio_elem {\n  struct prio_elem *next, *prev;\n  void *data;\n};\n\nstruct prio_queue {\n  /* Compare a and b. Return:\n   * <0 if a should come before b,\n   * >0 if b should come before a,\n   *  0 if don't care */\n  int (*compare)(void *a, void *b);\n\n  /* Free element payload. Called when dropping elements. */\n  void (*free)(void *a);\n\n  /* Maximum size of queue. The first\n   * elements in the list take precedence. */\n  int max_size;\n\n  /* The pointers to the actual list. */\n  struct prio_elem *head, *tail;\n\n  /* The current number of elements in the list. */\n  int cur_size;\n};\n\n/* nop callback to save us from conditional calling */\nstatic void pq_free_nop(void *a) { (void)a; }\n\nstruct prio_queue *init_prio_queue() {\n  struct prio_queue *retval;\n\n  retval = static_cast<struct prio_queue *>(malloc(sizeof(struct prio_queue)));\n  memset(retval, 0, sizeof(struct prio_queue));\n\n  /* use pq_free_nop by default */\n  retval->free = &pq_free_nop;\n\n  /* Default to maximum possible size as restricted\n   * by the used data type. This also saves us from\n   * checking if caller has set this field or not. */\n  retval->max_size = INT_MAX;\n\n  return retval;\n}\n\nvoid pq_set_compare(struct prio_queue *queue,\n                    int (*pqcompare)(void *a, void *b)) {\n  if (pqcompare != nullptr) { queue->compare = pqcompare; }\n}\n\nvoid pq_set_free(struct prio_queue *queue, void (*pqfree)(void *a)) {\n  if (pqfree != nullptr) { queue->free = pqfree; }\n}\n\nvoid pq_set_max_size(struct prio_queue *queue, int max_size) {\n  if (max_size >= 0) { queue->max_size = max_size; }\n}\n\nint pq_get_cur_size(struct prio_queue *queue) { return queue->cur_size; }\n\nstatic struct prio_elem *init_prio_elem(void *data) {\n  struct prio_elem *retval;\n\n  retval = static_cast<struct prio_elem *>(malloc(sizeof(struct prio_elem)));\n  memset(retval, 0, sizeof(struct prio_elem));\n\n  retval->data = data;\n  return retval;\n}\n\nvoid insert_prio_elem(struct prio_queue *queue, void *data) {\n  struct prio_elem *cur;\n\n  /* queue->compare is a must-have */\n  if (queue->compare == nullptr) { return; }\n\n  /* empty queue, insert the first item */\n  if (queue->cur_size == 0) {\n    queue->cur_size++;\n    queue->head = queue->tail = init_prio_elem(data);\n    return;\n  }\n\n  /* short-cut 1: new item is lower than all others */\n  if (queue->compare(queue->tail->data, data) <= 0) {\n    if (queue->cur_size < queue->max_size) {\n      queue->cur_size++;\n      queue->tail->next = init_prio_elem(data);\n      queue->tail->next->prev = queue->tail;\n      queue->tail = queue->tail->next;\n    } else { /* list was already full */\n      (*queue->free)(data);\n    }\n    return;\n  }\n\n  /* short-cut 2: we have a new maximum */\n  if (queue->compare(queue->head->data, data) >= 0) {\n    queue->cur_size++;\n    queue->head->prev = init_prio_elem(data);\n    queue->head->prev->next = queue->head;\n    queue->head = queue->head->prev;\n    goto check_cur_size;\n  }\n\n  /* find the actual position if short-cuts failed */\n  for (cur = queue->head->next; cur != nullptr; cur = cur->next) {\n    if (queue->compare(cur->data, data) >= 0) {\n      queue->cur_size++;\n      cur->prev->next = init_prio_elem(data);\n      cur->prev->next->prev = cur->prev;\n      cur->prev->next->next = cur;\n      cur->prev = cur->prev->next;\n      break;\n    }\n  }\n\ncheck_cur_size:\n  /* drop the lowest item if queue overrun */\n  if (queue->cur_size > queue->max_size) {\n    queue->cur_size--;\n    queue->tail = queue->tail->prev;\n    (*queue->free)(queue->tail->next->data);\n    free_and_zero(queue->tail->next);\n  }\n}\n\nvoid *pop_prio_elem(struct prio_queue *queue) {\n  struct prio_elem *tmp;\n  void *data;\n\n  if (queue->cur_size <= 0) { return nullptr; }\n\n  tmp = queue->head;\n  data = tmp->data;\n\n  queue->head = queue->head->next;\n  queue->cur_size--;\n  if (queue->head != nullptr) {\n    queue->head->prev = nullptr;\n  } else { /* list is now empty */\n    queue->tail = nullptr;\n  }\n\n  free(tmp);\n  return data;\n}\n\nvoid free_prio_queue(struct prio_queue *queue) {\n  void *data;\n  while ((data = pop_prio_elem(queue)) != nullptr) { (*queue->free)(data); }\n  free(queue);\n}\n"
  },
  {
    "path": "src/prioqueue.h",
    "content": "/*\n *\n * prioqueue:  a simple priority queue implementation\n *\n * Copyright (C) 2009 Phil Sutter <phil@nwl.cc>\n *\n * Initially based on the former implementation of sorted processes in\n * top.c, Copyright (C) 2005 David Carter <boojit@pundo.com>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef _PRIOQUEUE_H\n#define _PRIOQUEUE_H\n\n/* forward-define for private data */\nstruct prio_queue;\n\n/* typedef for a distinct prioqueue object */\ntypedef struct prio_queue *prio_queue_t;\n\n/* initialise a prioqueue object (mandatory) */\nprio_queue_t init_prio_queue(void);\n\n/* set the compare function (mandatory)\n * (*compare) shall return:\n * <0 if a should come before b,\n * >0 if b should come before a,\n *  0 if doesn't matter */\nvoid pq_set_compare(prio_queue_t, int (*compare)(void *a, void *b));\n\n/* set the data free function (optional)\n * (*free) will be called when:\n * - dropping elements from the end of a limited size queue and\n * - free_prio_queue() finds leftover elements in the given queue */\nvoid pq_set_free(prio_queue_t, void (*free)(void *));\n\n/* set a maximum queue size (optional) (defaults to INT_MAX) */\nvoid pq_set_max_size(prio_queue_t, int);\n\n/* insert an element into the given queue */\nvoid insert_prio_elem(prio_queue_t, void *);\n\n/* return the number of elements in the queue */\nint pq_get_cur_size(prio_queue_t queue);\n\n/* pop the top-most element from the queue\n * returns nullptr if queue is empty */\nvoid *pop_prio_elem(prio_queue_t);\n\n/* clear and free the given queue */\nvoid free_prio_queue(prio_queue_t);\n\n#endif /* _PRIOQUEUE_H */\n"
  },
  {
    "path": "src/semaphore.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef SEMAPHORE_HH\n#define SEMAPHORE_HH\n\n#include <cerrno>\n#include <cstdlib>\n#include <cstring>\n#include <stdexcept>\n\n#if defined(__APPLE__) && defined(__MACH__)\n\n/*\n *  On Darwin, unnamed semaphores are not supported!\n *  The only close equivalent to unnamed semaphores is using\n *      GCD!\n */\n\n#include <dispatch/dispatch.h>\n\nclass semaphore {\n  dispatch_semaphore_t sem;\n\n  semaphore(const semaphore &) = delete;\n  semaphore &operator=(const semaphore &) = delete;\n\n public:\n  explicit semaphore(unsigned int value = 0) {\n    sem = dispatch_semaphore_create(value);\n\n    if (!sem) throw std::logic_error(strerror(errno));\n  }\n\n  ~semaphore() { dispatch_release(sem); }\n  void post() { dispatch_semaphore_signal(sem); }\n\n  void wait() { dispatch_semaphore_wait(sem, DISPATCH_TIME_FOREVER); }\n\n  bool trywait() {\n    /* XXX Quick patch */\n#define DISPATCH_EAGAIN 49\n\n    int ret = dispatch_semaphore_wait(sem, DISPATCH_TIME_NOW);\n\n    while (ret > 0) {\n      if (ret == DISPATCH_EAGAIN) {\n        return false;\n      } else if (errno != EINTR) {\n        abort();\n      }\n    }\n    return true;\n  }\n};\n\n#else\n\n#include <semaphore.h>\n\nclass semaphore {\n  sem_t sem;\n\n  semaphore(const semaphore &) = delete;\n  semaphore &operator=(const semaphore &) = delete;\n\n public:\n  semaphore(unsigned int value = 0) {\n    if (sem_init(&sem, 0, value)) throw std::logic_error(strerror(errno));\n  }\n\n  ~semaphore() { sem_destroy(&sem); }\n\n  void post() {\n    if (sem_post(&sem)) throw std::overflow_error(strerror(errno));\n  }\n\n  void wait() {\n    while (sem_wait(&sem)) {\n      if (errno != EINTR) abort();\n    }\n  }\n\n  bool trywait() {\n    while (sem_trywait(&sem)) {\n      if (errno == EAGAIN)\n        return false;\n      else if (errno != EINTR)\n        abort();\n    }\n    return true;\n  }\n};\n\n#endif /* defined(__APPLE__) && defined(__MACH__) */\n\n#endif\n"
  },
  {
    "path": "src/update-cb.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"config.h\"\n#include \"logging.h\"\n\n#include \"update-cb.hh\"\n\n#include <unistd.h>\n#include <typeinfo>\n\nnamespace conky {\nnamespace {\nsemaphore sem_wait;\nenum { UNUSED_MAX = 5 };\n}  // namespace\n\nnamespace priv {\ncallback_base::~callback_base() { stop(); }\n\nvoid callback_base::stop() {\n  if (thread != nullptr) {\n    done = true;\n    sem_start.post();\n    if (pipefd.second >= 0) {\n      if (write(pipefd.second, \"X\", 1) != 1) {\n        NORM_ERR(\"can't write 'X' to pipefd %d: %s\", pipefd.second,\n                 strerror(errno));\n      }\n    }\n    thread->join();\n    delete thread;\n    thread = nullptr;\n  }\n  if (pipefd.first >= 0) {\n    close(pipefd.first);\n    pipefd.first = -1;\n  }\n  if (pipefd.second >= 0) {\n    close(pipefd.second);\n    pipefd.second = -1;\n  }\n}\n\ninline size_t callback_base::get_hash(const handle &h) { return h->hash; }\n\ninline bool callback_base::is_equal(const handle &a, const handle &b) {\n  if (a->hash != b->hash) { return false; }\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpotentially-evaluated-expression\"\n  if (typeid(*a) != typeid(*b)) { return false; }\n#pragma clang diagnostic pop\n\n  return *a == *b;\n}\n\n/*\n * If a callback is not successfully inserted into the set, it must have\n * the same hash as an existing callback. If this is so, merge the incoming\n * callback with the one that prevented insertion. Keep the smaller of the\n * two periods.\n */\nvoid callback_base::merge(callback_base &&other) {\n  if (other.period < period) {\n    period = other.period;\n    remaining = 0;\n  }\n  assert(wait == other.wait);\n  unused = 0;\n}\n\n/*\n * Register a callback (i.e. insert it into the callbacks set)\n */\ncallback_base::handle callback_base::do_register_cb(const handle &h) {\n  const auto &p = callbacks.insert(h);\n\n  /* insertion failed; callback already exists */\n  if (!p.second) { (*p.first)->merge(std::move(*h)); }\n\n  return *p.first;\n}\n\nvoid callback_base::run() {\n  if (thread == nullptr) {\n    thread = new std::thread(&callback_base::start_routine, this);\n  }\n\n  sem_start.post();\n}\n\nvoid callback_base::start_routine() {\n  for (;;) {\n    sem_start.wait();\n    if (done) { return; }\n\n    // clear any remaining posts in case the previous iteration was very slow\n    // (this should only happen if wait == false)\n    while (sem_start.trywait()) {\n      // do nothing\n    }\n\n    work();\n    if (wait) { sem_wait.post(); }\n  }\n}\n\ncallback_base::Callbacks callback_base::callbacks(1, get_hash, is_equal);\n}  // namespace priv\n\nvoid run_all_callbacks() {\n  using priv::callback_base;\n\n  size_t wait = 0;\n  for (auto i = callback_base::callbacks.begin();\n       i != callback_base::callbacks.end();) {\n    callback_base &cb = **i;\n\n    /* check whether enough update intervals have elapsed (up to period) */\n    if (cb.remaining-- == 0) {\n      /* run the callback as long as someone holds a pointer to it;\n       * if no one owns the callback, run it at most UNUSED_MAX times */\n      if (i->use_count() > 1 || ++cb.unused < UNUSED_MAX) {\n        cb.remaining = cb.period - 1;\n        cb.run();\n        if (cb.wait) { ++wait; }\n      }\n    }\n    if (cb.unused == UNUSED_MAX) {\n      auto t = i;\n      ++i;\n      callback_base::callbacks.erase(t);\n    } else {\n      ++i;\n    }\n  }\n\n  while (wait-- > 0) { sem_wait.wait(); }\n}\n}  // namespace conky\n"
  },
  {
    "path": "src/update-cb.hh",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Please see COPYING for details\n *\n * Copyright (C) 2010 Pavel Labath et al.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#ifndef UPDATE_CB_HH\n#define UPDATE_CB_HH\n\n#include <cstdint>\n#include <memory>\n#include <thread>\n// the following probably requires a is-gcc-4.7.0 check\n#include <mutex>\n#include <tuple>\n#include <unordered_set>\n\n#include <assert.h>\n\n#include \"c++wrap.hh\"\n#include \"semaphore.hh\"\n\nnamespace conky {\n// forward declarations\ntemplate <typename Callback>\nclass callback_handle;\nvoid run_all_callbacks();\ntemplate <typename Callback, typename... Params>\ncallback_handle<Callback> register_cb(uint32_t period, Params &&...params);\n\nnamespace priv {\nclass callback_base {\n  typedef callback_handle<callback_base> handle;\n  typedef std::unordered_set<handle, size_t (*)(const handle &),\n                             bool (*)(const handle &, const handle &)>\n      Callbacks;\n\n  semaphore sem_start;\n  std::thread *thread;\n  const size_t hash; /* used to determined callback uniqueness */\n  uint32_t period;   /* how often to run a callback */\n  uint32_t\n      remaining; /* update intervals remaining until we can run a callback */\n  std::pair<int, int> pipefd;\n  const bool wait; /* whether or not to wait for a callback to finish */\n  bool done;       /* if true, callback is being stopped and destroyed */\n  uint8_t unused;  /* number of update intervals during which no one owns a\n                      callback */\n\n  callback_base(const callback_base &) = delete;\n  callback_base &operator=(const callback_base &) = delete;\n\n  virtual bool operator==(const callback_base &) = 0;\n\n  void run();\n  void start_routine();\n  void stop();\n\n  static void deleter(callback_base *ptr) {\n    ptr->stop();\n    delete ptr;\n  }\n\n  // a list of registered callbacks\n  static Callbacks callbacks;\n\n  // used by the callbacks list\n  static inline size_t get_hash(const handle &h);\n  static inline bool is_equal(const handle &a, const handle &b);\n\n  static handle do_register_cb(const handle &h);\n\n  template <typename Callback, typename... Params>\n  friend callback_handle<Callback> conky::register_cb(uint32_t period,\n                                                      Params &&...params);\n\n  friend void conky::run_all_callbacks();\n\n  template <typename Callback>\n  friend class conky::callback_handle;\n\n protected:\n  callback_base(size_t hash_, uint32_t period_, bool wait_, bool use_pipe)\n      : thread(nullptr),\n        hash(hash_),\n        period(period_),\n        remaining(0),\n        pipefd(use_pipe ? pipe2(O_CLOEXEC) : std::pair<int, int>(-1, -1)),\n        wait(wait_),\n        done(false),\n        unused(0) {}\n\n  int donefd() { return pipefd.first; }\n\n  bool is_done() { return done; }\n\n  // to be implemented by descendant classes\n  virtual void work() = 0;\n\n  // called when two registered objects evaluate as equal, the latter is removed\n  // afterwards\n  virtual void merge(callback_base &&);\n\n public:\n  std::mutex result_mutex;\n\n  virtual ~callback_base();\n};\n\n}  // namespace priv\n\ntemplate <typename Callback>\nclass callback_handle : private std::shared_ptr<Callback> {\n  typedef std::shared_ptr<Callback> Base;\n\n  callback_handle(Callback *ptr) : Base(ptr, &priv::callback_base::deleter) {}\n\n  callback_handle(Base &&ptr) : Base(std::move(ptr)) {}\n\n public:\n  using Base::operator->;\n  using Base::operator*;\n\n  friend void conky::run_all_callbacks();\n  template <typename Callback_, typename... Params>\n  friend callback_handle<Callback_> register_cb(uint32_t period,\n                                                Params &&...params);\n};\n\ntemplate <typename Callback, typename... Params>\ncallback_handle<Callback> register_cb(uint32_t period, Params &&...params) {\n  return std::dynamic_pointer_cast<Callback>(\n      priv::callback_base::do_register_cb(priv::callback_base::handle(\n          new Callback(period, std::forward<Params>(params)...))));\n}\n\n/*\n * Callback uniqueness is determined by the hash computed here.\n */\nnamespace priv {\ntemplate <size_t pos, typename... Elements>\nstruct hash_tuple {\n  typedef std::tuple<Elements...> Tuple;\n  typedef typename std::tuple_element<pos - 1, Tuple>::type Element;\n\n  static inline size_t hash(const Tuple &tuple) {\n    return std::hash<Element>()(std::get<pos - 1>(tuple)) +\n           47 * hash_tuple<pos - 1, Elements...>::hash(tuple);\n  }\n};\n\ntemplate <typename... Elements>\nstruct hash_tuple<0, Elements...> {\n  static inline size_t hash(const std::tuple<Elements...> &) { return 0; }\n};\n}  // namespace priv\n\n/*\n * To create a callback, inherit from this class. The Result template parameter\n * should be the type of your output, so that your users can retrieve it with\n * the get_result* functions.\n *\n * get_result() returns a reference to the internal variable. It can be used\n * without locking if the object has wait set to true (wait=true means that the\n * run_all_callbacks() waits for the callback to finish work()ing before\n * returning). If object has wait=false then the user must first lock the\n * result_mutex.\n *\n * get_result_copy() returns a copy of the result object and it handles the\n * necessary locking. Don't call it if you hold a lock on the result_mutex.\n *\n * You should implement the work() function to do the actual updating and store\n * the result in the result variable (lock the mutex while you are doing it,\n * especially if you have wait=false).\n *\n * The Keys... template parameters are parameters for your work function. E.g.,\n * a curl callback can have one parameter - the url to retrieve,. hddtemp may\n * have two - host and port number of the hddtemp server, etc. The register_cb()\n * function make sure that there exists only one object (of the same type) with\n * the same values for all the keys.\n *\n * Callbacks are registered with the register_cb() function. You pass the class\n * name as the template parameter, and any additional parameters to the\n * constructor as function parameters. The period parameter specifies how often\n * the callback will run. It should be left for the user to decide that.\n * register_cb() returns a pointer to the newly created object. As long as\n * someone holds a pointer to the object, the callback will be run.\n *\n * run_all_callbacks() runs the registered callbacks (with the specified\n * periodicity). It should be called from somewhere inside the main loop,\n * according to the update_interval setting. It waits for the callbacks which\n * have wait=true. It leaves the rest to run in background.\n */\ntemplate <typename Result, typename... Keys>\nclass callback : public priv::callback_base {\n  virtual bool operator==(const callback_base &other) {\n    return tuple == dynamic_cast<const callback &>(other).tuple;\n  }\n\n public:\n  typedef std::tuple<Keys...> Tuple;\n\n protected:\n  const Tuple tuple;\n  Result result;\n\n  template <size_t i>\n  typename std::add_lvalue_reference<\n      const typename std::tuple_element<i, Tuple>::type>::type\n  get() {\n    return std::get<i>(tuple);\n  }\n\n public:\n  callback(uint32_t period_, bool wait_, const Tuple &tuple_,\n           bool use_pipe = false)\n      : callback_base(priv::hash_tuple<sizeof...(Keys), Keys...>::hash(tuple_),\n                      period_, wait_, use_pipe),\n        tuple(tuple_) {}\n\n  const Result &get_result() { return result; }\n\n  Result get_result_copy() {\n    std::lock_guard<std::mutex> l(result_mutex);\n    return result;\n  }\n};\n}  // namespace conky\n\n#endif /* UPDATE_CB_HH */\n"
  },
  {
    "path": "src/wl_protocols/wlr-layer-shell-unstable-v1.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<protocol name=\"wlr_layer_shell_unstable_v1\">\n  <copyright>\n    Copyright © 2017 Drew DeVault\n\n    Permission to use, copy, modify, distribute, and sell this\n    software and its documentation for any purpose is hereby granted\n    without fee, provided that the above copyright notice appear in\n    all copies and that both that copyright notice and this permission\n    notice appear in supporting documentation, and that the name of\n    the copyright holders not be used in advertising or publicity\n    pertaining to distribution of the software without specific,\n    written prior permission.  The copyright holders make no\n    representations about the suitability of this software for any\n    purpose.  It is provided \"as is\" without express or implied\n    warranty.\n\n    THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS\n    SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND\n    FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY\n    SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES\n    WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN\n    AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,\n    ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF\n    THIS SOFTWARE.\n  </copyright>\n\n  <interface name=\"zwlr_layer_shell_v1\" version=\"4\">\n    <description summary=\"create surfaces that are layers of the desktop\">\n      Clients can use this interface to assign the surface_layer role to\n      wl_surfaces. Such surfaces are assigned to a \"layer\" of the output and\n      rendered with a defined z-depth respective to each other. They may also be\n      anchored to the edges and corners of a screen and specify input handling\n      semantics. This interface should be suitable for the implementation of\n      many desktop shell components, and a broad number of other applications\n      that interact with the desktop.\n    </description>\n\n    <request name=\"get_layer_surface\">\n      <description summary=\"create a layer_surface from a surface\">\n        Create a layer surface for an existing surface. This assigns the role of\n        layer_surface, or raises a protocol error if another role is already\n        assigned.\n\n        Creating a layer surface from a wl_surface which has a buffer attached\n        or committed is a client error, and any attempts by a client to attach\n        or manipulate a buffer prior to the first layer_surface.configure call\n        must also be treated as errors.\n\n        After creating a layer_surface object and setting it up, the client\n        must perform an initial commit without any buffer attached.\n        The compositor will reply with a layer_surface.configure event.\n        The client must acknowledge it and is then allowed to attach a buffer\n        to map the surface.\n\n        You may pass NULL for output to allow the compositor to decide which\n        output to use. Generally this will be the one that the user most\n        recently interacted with.\n\n        Clients can specify a namespace that defines the purpose of the layer\n        surface.\n      </description>\n      <arg name=\"id\" type=\"new_id\" interface=\"zwlr_layer_surface_v1\"/>\n      <arg name=\"surface\" type=\"object\" interface=\"wl_surface\"/>\n      <arg name=\"output\" type=\"object\" interface=\"wl_output\" allow-null=\"true\"/>\n      <arg name=\"layer\" type=\"uint\" enum=\"layer\" summary=\"layer to add this surface to\"/>\n      <arg name=\"namespace_\" type=\"string\" summary=\"namespace for the layer surface\"/>\n    </request>\n\n    <enum name=\"error\">\n      <entry name=\"role\" value=\"0\" summary=\"wl_surface has another role\"/>\n      <entry name=\"invalid_layer\" value=\"1\" summary=\"layer value is invalid\"/>\n      <entry name=\"already_constructed\" value=\"2\" summary=\"wl_surface has a buffer attached or committed\"/>\n    </enum>\n\n    <enum name=\"layer\">\n      <description summary=\"available layers for surfaces\">\n        These values indicate which layers a surface can be rendered in. They\n        are ordered by z depth, bottom-most first. Traditional shell surfaces\n        will typically be rendered between the bottom and top layers.\n        Fullscreen shell surfaces are typically rendered at the top layer.\n        Multiple surfaces can share a single layer, and ordering within a\n        single layer is undefined.\n      </description>\n\n      <entry name=\"background\" value=\"0\"/>\n      <entry name=\"bottom\" value=\"1\"/>\n      <entry name=\"top\" value=\"2\"/>\n      <entry name=\"overlay\" value=\"3\"/>\n    </enum>\n\n    <!-- Version 3 additions -->\n\n    <request name=\"destroy\" type=\"destructor\" since=\"3\">\n      <description summary=\"destroy the layer_shell object\">\n        This request indicates that the client will not use the layer_shell\n        object any more. Objects that have been created through this instance\n        are not affected.\n      </description>\n    </request>\n  </interface>\n\n  <interface name=\"zwlr_layer_surface_v1\" version=\"4\">\n    <description summary=\"layer metadata interface\">\n      An interface that may be implemented by a wl_surface, for surfaces that\n      are designed to be rendered as a layer of a stacked desktop-like\n      environment.\n\n      Layer surface state (layer, size, anchor, exclusive zone,\n      margin, interactivity) is double-buffered, and will be applied at the\n      time wl_surface.commit of the corresponding wl_surface is called.\n\n      Attaching a null buffer to a layer surface unmaps it.\n\n      Unmapping a layer_surface means that the surface cannot be shown by the\n      compositor until it is explicitly mapped again. The layer_surface\n      returns to the state it had right after layer_shell.get_layer_surface.\n      The client can re-map the surface by performing a commit without any\n      buffer attached, waiting for a configure event and handling it as usual.\n    </description>\n\n    <request name=\"set_size\">\n      <description summary=\"sets the size of the surface\">\n        Sets the size of the surface in surface-local coordinates. The\n        compositor will display the surface centered with respect to its\n        anchors.\n\n        If you pass 0 for either value, the compositor will assign it and\n        inform you of the assignment in the configure event. You must set your\n        anchor to opposite edges in the dimensions you omit; not doing so is a\n        protocol error. Both values are 0 by default.\n\n        Size is double-buffered, see wl_surface.commit.\n      </description>\n      <arg name=\"width\" type=\"uint\"/>\n      <arg name=\"height\" type=\"uint\"/>\n    </request>\n\n    <request name=\"set_anchor\">\n      <description summary=\"configures the anchor point of the surface\">\n        Requests that the compositor anchor the surface to the specified edges\n        and corners. If two orthogonal edges are specified (e.g. 'top' and\n        'left'), then the anchor point will be the intersection of the edges\n        (e.g. the top left corner of the output); otherwise the anchor point\n        will be centered on that edge, or in the center if none is specified.\n\n        Anchor is double-buffered, see wl_surface.commit.\n      </description>\n      <arg name=\"anchor\" type=\"uint\" enum=\"anchor\"/>\n    </request>\n\n    <request name=\"set_exclusive_zone\">\n      <description summary=\"configures the exclusive geometry of this surface\">\n        Requests that the compositor avoids occluding an area with other\n        surfaces. The compositor's use of this information is\n        implementation-dependent - do not assume that this region will not\n        actually be occluded.\n\n        A positive value is only meaningful if the surface is anchored to one\n        edge or an edge and both perpendicular edges. If the surface is not\n        anchored, anchored to only two perpendicular edges (a corner), anchored\n        to only two parallel edges or anchored to all edges, a positive value\n        will be treated the same as zero.\n\n        A positive zone is the distance from the edge in surface-local\n        coordinates to consider exclusive.\n\n        Surfaces that do not wish to have an exclusive zone may instead specify\n        how they should interact with surfaces that do. If set to zero, the\n        surface indicates that it would like to be moved to avoid occluding\n        surfaces with a positive exclusive zone. If set to -1, the surface\n        indicates that it would not like to be moved to accommodate for other\n        surfaces, and the compositor should extend it all the way to the edges\n        it is anchored to.\n\n        For example, a panel might set its exclusive zone to 10, so that\n        maximized shell surfaces are not shown on top of it. A notification\n        might set its exclusive zone to 0, so that it is moved to avoid\n        occluding the panel, but shell surfaces are shown underneath it. A\n        wallpaper or lock screen might set their exclusive zone to -1, so that\n        they stretch below or over the panel.\n\n        The default value is 0.\n\n        Exclusive zone is double-buffered, see wl_surface.commit.\n      </description>\n      <arg name=\"zone\" type=\"int\"/>\n    </request>\n\n    <request name=\"set_margin\">\n      <description summary=\"sets a margin from the anchor point\">\n        Requests that the surface be placed some distance away from the anchor\n        point on the output, in surface-local coordinates. Setting this value\n        for edges you are not anchored to has no effect.\n\n        The exclusive zone includes the margin.\n\n        Margin is double-buffered, see wl_surface.commit.\n      </description>\n      <arg name=\"top\" type=\"int\"/>\n      <arg name=\"right\" type=\"int\"/>\n      <arg name=\"bottom\" type=\"int\"/>\n      <arg name=\"left\" type=\"int\"/>\n    </request>\n\n    <enum name=\"keyboard_interactivity\">\n      <description summary=\"types of keyboard interaction possible for a layer shell surface\">\n        Types of keyboard interaction possible for layer shell surfaces. The\n        rationale for this is twofold: (1) some applications are not interested\n        in keyboard events and not allowing them to be focused can improve the\n        desktop experience; (2) some applications will want to take exclusive\n        keyboard focus.\n      </description>\n\n      <entry name=\"none\" value=\"0\">\n        <description summary=\"no keyboard focus is possible\">\n          This value indicates that this surface is not interested in keyboard\n          events and the compositor should never assign it the keyboard focus.\n\n          This is the default value, set for newly created layer shell surfaces.\n\n          This is useful for e.g. desktop widgets that display information or\n          only have interaction with non-keyboard input devices.\n        </description>\n      </entry>\n      <entry name=\"exclusive\" value=\"1\">\n        <description summary=\"request exclusive keyboard focus\">\n          Request exclusive keyboard focus if this surface is above the shell surface layer.\n\n          For the top and overlay layers, the seat will always give\n          exclusive keyboard focus to the top-most layer which has keyboard\n          interactivity set to exclusive. If this layer contains multiple\n          surfaces with keyboard interactivity set to exclusive, the compositor\n          determines the one receiving keyboard events in an implementation-\n          defined manner. In this case, no guarantee is made when this surface\n          will receive keyboard focus (if ever).\n\n          For the bottom and background layers, the compositor is allowed to use\n          normal focus semantics.\n\n          This setting is mainly intended for applications that need to ensure\n          they receive all keyboard events, such as a lock screen or a password\n          prompt.\n        </description>\n      </entry>\n      <entry name=\"on_demand\" value=\"2\" since=\"4\">\n        <description summary=\"request regular keyboard focus semantics\">\n          This requests the compositor to allow this surface to be focused and\n          unfocused by the user in an implementation-defined manner. The user\n          should be able to unfocus this surface even regardless of the layer\n          it is on.\n\n          Typically, the compositor will want to use its normal mechanism to\n          manage keyboard focus between layer shell surfaces with this setting\n          and regular toplevels on the desktop layer (e.g. click to focus).\n          Nevertheless, it is possible for a compositor to require a special\n          interaction to focus or unfocus layer shell surfaces (e.g. requiring\n          a click even if focus follows the mouse normally, or providing a\n          keybinding to switch focus between layers).\n\n          This setting is mainly intended for desktop shell components (e.g.\n          panels) that allow keyboard interaction. Using this option can allow\n          implementing a desktop shell that can be fully usable without the\n          mouse.\n        </description>\n      </entry>\n    </enum>\n\n    <request name=\"set_keyboard_interactivity\">\n      <description summary=\"requests keyboard events\">\n        Set how keyboard events are delivered to this surface. By default,\n        layer shell surfaces do not receive keyboard events; this request can\n        be used to change this.\n\n        This setting is inherited by child surfaces set by the get_popup\n        request.\n\n        Layer surfaces receive pointer, touch, and tablet events normally. If\n        you do not want to receive them, set the input region on your surface\n        to an empty region.\n\n        Keyboard interactivity is double-buffered, see wl_surface.commit.\n      </description>\n      <arg name=\"keyboard_interactivity\" type=\"uint\" enum=\"keyboard_interactivity\"/>\n    </request>\n\n    <request name=\"get_popup\">\n      <description summary=\"assign this layer_surface as an xdg_popup parent\">\n        This assigns an xdg_popup's parent to this layer_surface.  This popup\n        should have been created via xdg_surface::get_popup with the parent set\n        to NULL, and this request must be invoked before committing the popup's\n        initial state.\n\n        See the documentation of xdg_popup for more details about what an\n        xdg_popup is and how it is used.\n      </description>\n      <arg name=\"popup\" type=\"object\" interface=\"xdg_popup\"/>\n    </request>\n\n    <request name=\"ack_configure\">\n      <description summary=\"ack a configure event\">\n        When a configure event is received, if a client commits the\n        surface in response to the configure event, then the client\n        must make an ack_configure request sometime before the commit\n        request, passing along the serial of the configure event.\n\n        If the client receives multiple configure events before it\n        can respond to one, it only has to ack the last configure event.\n\n        A client is not required to commit immediately after sending\n        an ack_configure request - it may even ack_configure several times\n        before its next surface commit.\n\n        A client may send multiple ack_configure requests before committing, but\n        only the last request sent before a commit indicates which configure\n        event the client really is responding to.\n      </description>\n      <arg name=\"serial\" type=\"uint\" summary=\"the serial from the configure event\"/>\n    </request>\n\n    <request name=\"destroy\" type=\"destructor\">\n      <description summary=\"destroy the layer_surface\">\n        This request destroys the layer surface.\n      </description>\n    </request>\n\n    <event name=\"configure\">\n      <description summary=\"suggest a surface change\">\n        The configure event asks the client to resize its surface.\n\n        Clients should arrange their surface for the new states, and then send\n        an ack_configure request with the serial sent in this configure event at\n        some point before committing the new surface.\n\n        The client is free to dismiss all but the last configure event it\n        received.\n\n        The width and height arguments specify the size of the window in\n        surface-local coordinates.\n\n        The size is a hint, in the sense that the client is free to ignore it if\n        it doesn't resize, pick a smaller size (to satisfy aspect ratio or\n        resize in steps of NxM pixels). If the client picks a smaller size and\n        is anchored to two opposite anchors (e.g. 'top' and 'bottom'), the\n        surface will be centered on this axis.\n\n        If the width or height arguments are zero, it means the client should\n        decide its own window dimension.\n      </description>\n      <arg name=\"serial\" type=\"uint\"/>\n      <arg name=\"width\" type=\"uint\"/>\n      <arg name=\"height\" type=\"uint\"/>\n    </event>\n\n    <event name=\"closed\">\n      <description summary=\"surface should be closed\">\n        The closed event is sent by the compositor when the surface will no\n        longer be shown. The output may have been destroyed or the user may\n        have asked for it to be removed. Further changes to the surface will be\n        ignored. The client should destroy the resource after receiving this\n        event, and create a new surface if they so choose.\n      </description>\n    </event>\n\n    <enum name=\"error\">\n      <entry name=\"invalid_surface_state\" value=\"0\" summary=\"provided surface state is invalid\"/>\n      <entry name=\"invalid_size\" value=\"1\" summary=\"size is invalid\"/>\n      <entry name=\"invalid_anchor\" value=\"2\" summary=\"anchor bitfield is invalid\"/>\n      <entry name=\"invalid_keyboard_interactivity\" value=\"3\" summary=\"keyboard interactivity is invalid\"/>\n    </enum>\n\n    <enum name=\"anchor\" bitfield=\"true\">\n      <entry name=\"top\" value=\"1\" summary=\"the top edge of the anchor rectangle\"/>\n      <entry name=\"bottom\" value=\"2\" summary=\"the bottom edge of the anchor rectangle\"/>\n      <entry name=\"left\" value=\"4\" summary=\"the left edge of the anchor rectangle\"/>\n      <entry name=\"right\" value=\"8\" summary=\"the right edge of the anchor rectangle\"/>\n    </enum>\n\n    <!-- Version 2 additions -->\n\n    <request name=\"set_layer\" since=\"2\">\n      <description summary=\"change the layer of the surface\">\n        Change the layer that the surface is rendered on.\n\n        Layer is double-buffered, see wl_surface.commit.\n      </description>\n      <arg name=\"layer\" type=\"uint\" enum=\"zwlr_layer_shell_v1.layer\" summary=\"layer to move this surface to\"/>\n    </request>\n  </interface>\n</protocol>\n"
  },
  {
    "path": "tests/CMakeLists.txt",
    "content": "include(CTest)\n\ninclude_directories(${CMAKE_SOURCE_DIR}/src)\ninclude_directories(${CMAKE_BINARY_DIR})\ninclude_directories(${conky_includes})\n\nfile(GLOB test_srcs test-*.cc)\n\nif(NOT OS_LINUX)\n  list(FILTER test_srcs EXCLUDE REGEX \".*linux.*\\.cc?\")\nendif()\n\nif(NOT OS_DARWIN)\n  list(FILTER test_srcs EXCLUDE REGEX \".*darwin.*\\.cc?\")\nendif()\n\nadd_library(Catch2 STATIC catch2/catch_amalgamated.cpp)\n\nadd_executable(test-conky test-common.cc ${test_srcs})\ntarget_include_directories(test-conky PRIVATE\n  ${CMAKE_SOURCE_DIR}/src\n  ${CMAKE_BINARY_DIR})\ntarget_link_libraries(test-conky\n  PRIVATE Catch2\n  PUBLIC conky_core\n)\ncatch_discover_tests(test-conky)\n\nif(RUN_TESTS)\n  add_custom_command(TARGET test-conky\n    POST_BUILD\n    COMMAND ctest -C $<CONFIGURATION> --output-on-failure)\nendif()\n\nif(CODE_COVERAGE)\n  set(COVERAGE_LCOV_EXCLUDES\n    \"*/include/c++/v1/*\"\n    \"/usr/include/*\"\n    \"/usr/lib/*\"\n    \"/usr/local/Cellar/*\"\n    \"/usr/local/include/*\"\n    \"/usr/local/lib/*\"\n    \"/usr/include/libkern/i386/*\"\n    \"/usr/include/sys/_types/*\"\n    \"/usr/local/opt/gettext/include/*\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/*\"\n    \"${CMAKE_CURRENT_SOURCE_DIR}/catch2/*\"\n    \"${CMAKE_SOURCE_DIR}/3rdparty/*\")\n\n  setup_target_for_coverage_lcov_html(NAME\n    test-conky-coverage-html\n    EXECUTABLE\n    test-conky\n    DEPENDENCIES\n    test-conky)\n  setup_target_for_coverage_lcov_txt(NAME\n    test-conky-coverage-txt\n    EXECUTABLE\n    test-conky\n    DEPENDENCIES\n    test-conky)\nendif()\n"
  },
  {
    "path": "tests/catch2/catch.hpp",
    "content": "#include \"catch_amalgamated.hpp\"  // IWYU pragma: export\n"
  },
  {
    "path": "tests/catch2/catch_amalgamated.cpp",
    "content": "\n//              Copyright Catch2 Authors\n// Distributed under the Boost Software License, Version 1.0.\n//   (See accompanying file LICENSE.txt or copy at\n//        https://www.boost.org/LICENSE_1_0.txt)\n\n// SPDX-License-Identifier: BSL-1.0\n\n//  Catch v3.7.1\n//  Generated: 2024-09-17 10:36:45.608896\n//  ----------------------------------------------------------\n//  This file is an amalgamation of multiple different files.\n//  You probably shouldn't edit it directly.\n//  ----------------------------------------------------------\n\n#include \"catch_amalgamated.hpp\"\n\n\n#ifndef CATCH_WINDOWS_H_PROXY_HPP_INCLUDED\n#define CATCH_WINDOWS_H_PROXY_HPP_INCLUDED\n\n\n#if defined(CATCH_PLATFORM_WINDOWS)\n\n// We might end up with the define made globally through the compiler,\n// and we don't want to trigger warnings for this\n#if !defined(NOMINMAX)\n#  define NOMINMAX\n#endif\n#if !defined(WIN32_LEAN_AND_MEAN)\n#  define WIN32_LEAN_AND_MEAN\n#endif\n\n#include <windows.h>\n\n#endif // defined(CATCH_PLATFORM_WINDOWS)\n\n#endif // CATCH_WINDOWS_H_PROXY_HPP_INCLUDED\n\n\n\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            ChronometerConcept::~ChronometerConcept() = default;\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n\n// Adapted from donated nonius code.\n\n\n#include <vector>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            SampleAnalysis analyse(const IConfig &cfg, FDuration* first, FDuration* last) {\n                if (!cfg.benchmarkNoAnalysis()) {\n                    std::vector<double> samples;\n                    samples.reserve(static_cast<size_t>(last - first));\n                    for (auto current = first; current != last; ++current) {\n                        samples.push_back( current->count() );\n                    }\n\n                    auto analysis = Catch::Benchmark::Detail::analyse_samples(\n                        cfg.benchmarkConfidenceInterval(),\n                        cfg.benchmarkResamples(),\n                        samples.data(),\n                        samples.data() + samples.size() );\n                    auto outliers = Catch::Benchmark::Detail::classify_outliers(\n                        samples.data(), samples.data() + samples.size() );\n\n                    auto wrap_estimate = [](Estimate<double> e) {\n                        return Estimate<FDuration> {\n                            FDuration(e.point),\n                                FDuration(e.lower_bound),\n                                FDuration(e.upper_bound),\n                                e.confidence_interval,\n                        };\n                    };\n                    std::vector<FDuration> samples2;\n                    samples2.reserve(samples.size());\n                    for (auto s : samples) {\n                        samples2.push_back( FDuration( s ) );\n                    }\n\n                    return {\n                        CATCH_MOVE(samples2),\n                        wrap_estimate(analysis.mean),\n                        wrap_estimate(analysis.standard_deviation),\n                        outliers,\n                        analysis.outlier_variance,\n                    };\n                } else {\n                    std::vector<FDuration> samples;\n                    samples.reserve(static_cast<size_t>(last - first));\n\n                    FDuration mean = FDuration(0);\n                    int i = 0;\n                    for (auto it = first; it < last; ++it, ++i) {\n                        samples.push_back(*it);\n                        mean += *it;\n                    }\n                    mean /= i;\n\n                    return SampleAnalysis{\n                        CATCH_MOVE(samples),\n                        Estimate<FDuration>{ mean, mean, mean, 0.0 },\n                        Estimate<FDuration>{ FDuration( 0 ),\n                                             FDuration( 0 ),\n                                             FDuration( 0 ),\n                                             0.0 },\n                        OutlierClassification{},\n                        0.0\n                    };\n                }\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n\n\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            struct do_nothing {\n                void operator()() const {}\n            };\n\n            BenchmarkFunction::callable::~callable() = default;\n            BenchmarkFunction::BenchmarkFunction():\n                f( new model<do_nothing>{ {} } ){}\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n\n\n\n#include <exception>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            struct optimized_away_error : std::exception {\n                const char* what() const noexcept override;\n            };\n\n            const char* optimized_away_error::what() const noexcept {\n                return \"could not measure benchmark, maybe it was optimized away\";\n            }\n\n            void throw_optimized_away_error() {\n                Catch::throw_exception(optimized_away_error{});\n            }\n\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n\n// Adapted from donated nonius code.\n\n\n\n#include <algorithm>\n#include <cassert>\n#include <cmath>\n#include <cstddef>\n#include <numeric>\n#include <random>\n\n\n#if defined(CATCH_CONFIG_USE_ASYNC)\n#include <future>\n#endif\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            namespace {\n\n                template <typename URng, typename Estimator>\n                static sample\n                resample( URng& rng,\n                          unsigned int resamples,\n                          double const* first,\n                          double const* last,\n                          Estimator& estimator ) {\n                    auto n = static_cast<size_t>( last - first );\n                    Catch::uniform_integer_distribution<size_t> dist( 0, n - 1 );\n\n                    sample out;\n                    out.reserve( resamples );\n                    std::vector<double> resampled;\n                    resampled.reserve( n );\n                    for ( size_t i = 0; i < resamples; ++i ) {\n                        resampled.clear();\n                        for ( size_t s = 0; s < n; ++s ) {\n                            resampled.push_back( first[dist( rng )] );\n                        }\n                        const auto estimate =\n                            estimator( resampled.data(), resampled.data() + resampled.size() );\n                        out.push_back( estimate );\n                    }\n                    std::sort( out.begin(), out.end() );\n                    return out;\n                }\n\n                static double outlier_variance( Estimate<double> mean,\n                                                Estimate<double> stddev,\n                                                int n ) {\n                    double sb = stddev.point;\n                    double mn = mean.point / n;\n                    double mg_min = mn / 2.;\n                    double sg = (std::min)( mg_min / 4., sb / std::sqrt( n ) );\n                    double sg2 = sg * sg;\n                    double sb2 = sb * sb;\n\n                    auto c_max = [n, mn, sb2, sg2]( double x ) -> double {\n                        double k = mn - x;\n                        double d = k * k;\n                        double nd = n * d;\n                        double k0 = -n * nd;\n                        double k1 = sb2 - n * sg2 + nd;\n                        double det = k1 * k1 - 4 * sg2 * k0;\n                        return static_cast<int>( -2. * k0 /\n                                                 ( k1 + std::sqrt( det ) ) );\n                    };\n\n                    auto var_out = [n, sb2, sg2]( double c ) {\n                        double nc = n - c;\n                        return ( nc / n ) * ( sb2 - nc * sg2 );\n                    };\n\n                    return (std::min)( var_out( 1 ),\n                                       var_out(\n                                           (std::min)( c_max( 0. ),\n                                                       c_max( mg_min ) ) ) ) /\n                           sb2;\n                }\n\n                static double erf_inv( double x ) {\n                    // Code accompanying the article \"Approximating the erfinv\n                    // function\" in GPU Computing Gems, Volume 2\n                    double w, p;\n\n                    w = -log( ( 1.0 - x ) * ( 1.0 + x ) );\n\n                    if ( w < 6.250000 ) {\n                        w = w - 3.125000;\n                        p = -3.6444120640178196996e-21;\n                        p = -1.685059138182016589e-19 + p * w;\n                        p = 1.2858480715256400167e-18 + p * w;\n                        p = 1.115787767802518096e-17 + p * w;\n                        p = -1.333171662854620906e-16 + p * w;\n                        p = 2.0972767875968561637e-17 + p * w;\n                        p = 6.6376381343583238325e-15 + p * w;\n                        p = -4.0545662729752068639e-14 + p * w;\n                        p = -8.1519341976054721522e-14 + p * w;\n                        p = 2.6335093153082322977e-12 + p * w;\n                        p = -1.2975133253453532498e-11 + p * w;\n                        p = -5.4154120542946279317e-11 + p * w;\n                        p = 1.051212273321532285e-09 + p * w;\n                        p = -4.1126339803469836976e-09 + p * w;\n                        p = -2.9070369957882005086e-08 + p * w;\n                        p = 4.2347877827932403518e-07 + p * w;\n                        p = -1.3654692000834678645e-06 + p * w;\n                        p = -1.3882523362786468719e-05 + p * w;\n                        p = 0.0001867342080340571352 + p * w;\n                        p = -0.00074070253416626697512 + p * w;\n                        p = -0.0060336708714301490533 + p * w;\n                        p = 0.24015818242558961693 + p * w;\n                        p = 1.6536545626831027356 + p * w;\n                    } else if ( w < 16.000000 ) {\n                        w = sqrt( w ) - 3.250000;\n                        p = 2.2137376921775787049e-09;\n                        p = 9.0756561938885390979e-08 + p * w;\n                        p = -2.7517406297064545428e-07 + p * w;\n                        p = 1.8239629214389227755e-08 + p * w;\n                        p = 1.5027403968909827627e-06 + p * w;\n                        p = -4.013867526981545969e-06 + p * w;\n                        p = 2.9234449089955446044e-06 + p * w;\n                        p = 1.2475304481671778723e-05 + p * w;\n                        p = -4.7318229009055733981e-05 + p * w;\n                        p = 6.8284851459573175448e-05 + p * w;\n                        p = 2.4031110387097893999e-05 + p * w;\n                        p = -0.0003550375203628474796 + p * w;\n                        p = 0.00095328937973738049703 + p * w;\n                        p = -0.0016882755560235047313 + p * w;\n                        p = 0.0024914420961078508066 + p * w;\n                        p = -0.0037512085075692412107 + p * w;\n                        p = 0.005370914553590063617 + p * w;\n                        p = 1.0052589676941592334 + p * w;\n                        p = 3.0838856104922207635 + p * w;\n                    } else {\n                        w = sqrt( w ) - 5.000000;\n                        p = -2.7109920616438573243e-11;\n                        p = -2.5556418169965252055e-10 + p * w;\n                        p = 1.5076572693500548083e-09 + p * w;\n                        p = -3.7894654401267369937e-09 + p * w;\n                        p = 7.6157012080783393804e-09 + p * w;\n                        p = -1.4960026627149240478e-08 + p * w;\n                        p = 2.9147953450901080826e-08 + p * w;\n                        p = -6.7711997758452339498e-08 + p * w;\n                        p = 2.2900482228026654717e-07 + p * w;\n                        p = -9.9298272942317002539e-07 + p * w;\n                        p = 4.5260625972231537039e-06 + p * w;\n                        p = -1.9681778105531670567e-05 + p * w;\n                        p = 7.5995277030017761139e-05 + p * w;\n                        p = -0.00021503011930044477347 + p * w;\n                        p = -0.00013871931833623122026 + p * w;\n                        p = 1.0103004648645343977 + p * w;\n                        p = 4.8499064014085844221 + p * w;\n                    }\n                    return p * x;\n                }\n\n                static double\n                standard_deviation( double const* first, double const* last ) {\n                    auto m = Catch::Benchmark::Detail::mean( first, last );\n                    double variance =\n                        std::accumulate( first,\n                                         last,\n                                         0.,\n                                         [m]( double a, double b ) {\n                                             double diff = b - m;\n                                             return a + diff * diff;\n                                         } ) /\n                        ( last - first );\n                    return std::sqrt( variance );\n                }\n\n                static sample jackknife( double ( *estimator )( double const*,\n                                                                double const* ),\n                                         double* first,\n                                         double* last ) {\n                    const auto second = first + 1;\n                    sample results;\n                    results.reserve( static_cast<size_t>( last - first ) );\n\n                    for ( auto it = first; it != last; ++it ) {\n                        std::iter_swap( it, first );\n                        results.push_back( estimator( second, last ) );\n                    }\n\n                    return results;\n                }\n\n\n            } // namespace\n        }     // namespace Detail\n    }         // namespace Benchmark\n} // namespace Catch\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n\n            double weighted_average_quantile( int k,\n                                              int q,\n                                              double* first,\n                                              double* last ) {\n                auto count = last - first;\n                double idx = (count - 1) * k / static_cast<double>(q);\n                int j = static_cast<int>(idx);\n                double g = idx - j;\n                std::nth_element(first, first + j, last);\n                auto xj = first[j];\n                if ( Catch::Detail::directCompare( g, 0 ) ) {\n                    return xj;\n                }\n\n                auto xj1 = *std::min_element(first + (j + 1), last);\n                return xj + g * (xj1 - xj);\n            }\n\n            OutlierClassification\n            classify_outliers( double const* first, double const* last ) {\n                std::vector<double> copy( first, last );\n\n                auto q1 = weighted_average_quantile( 1, 4, copy.data(), copy.data() + copy.size() );\n                auto q3 = weighted_average_quantile( 3, 4, copy.data(), copy.data() + copy.size() );\n                auto iqr = q3 - q1;\n                auto los = q1 - ( iqr * 3. );\n                auto lom = q1 - ( iqr * 1.5 );\n                auto him = q3 + ( iqr * 1.5 );\n                auto his = q3 + ( iqr * 3. );\n\n                OutlierClassification o;\n                for ( ; first != last; ++first ) {\n                    const double t = *first;\n                    if ( t < los ) {\n                        ++o.low_severe;\n                    } else if ( t < lom ) {\n                        ++o.low_mild;\n                    } else if ( t > his ) {\n                        ++o.high_severe;\n                    } else if ( t > him ) {\n                        ++o.high_mild;\n                    }\n                    ++o.samples_seen;\n                }\n                return o;\n            }\n\n            double mean( double const* first, double const* last ) {\n                auto count = last - first;\n                double sum = 0.;\n                while (first != last) {\n                    sum += *first;\n                    ++first;\n                }\n                return sum / static_cast<double>(count);\n            }\n\n            double normal_cdf( double x ) {\n                return std::erfc( -x / std::sqrt( 2.0 ) ) / 2.0;\n            }\n\n            double erfc_inv(double x) {\n                return erf_inv(1.0 - x);\n            }\n\n            double normal_quantile(double p) {\n                static const double ROOT_TWO = std::sqrt(2.0);\n\n                double result = 0.0;\n                assert(p >= 0 && p <= 1);\n                if (p < 0 || p > 1) {\n                    return result;\n                }\n\n                result = -erfc_inv(2.0 * p);\n                // result *= normal distribution standard deviation (1.0) * sqrt(2)\n                result *= /*sd * */ ROOT_TWO;\n                // result += normal disttribution mean (0)\n                return result;\n            }\n\n            Estimate<double>\n            bootstrap( double confidence_level,\n                       double* first,\n                       double* last,\n                       sample const& resample,\n                       double ( *estimator )( double const*, double const* ) ) {\n                auto n_samples = last - first;\n\n                double point = estimator( first, last );\n                // Degenerate case with a single sample\n                if ( n_samples == 1 )\n                    return { point, point, point, confidence_level };\n\n                sample jack = jackknife( estimator, first, last );\n                double jack_mean =\n                    mean( jack.data(), jack.data() + jack.size() );\n                double sum_squares = 0, sum_cubes = 0;\n                for ( double x : jack ) {\n                    auto difference = jack_mean - x;\n                    auto square = difference * difference;\n                    auto cube = square * difference;\n                    sum_squares += square;\n                    sum_cubes += cube;\n                }\n\n                double accel = sum_cubes / ( 6 * std::pow( sum_squares, 1.5 ) );\n                long n = static_cast<long>( resample.size() );\n                double prob_n =\n                    std::count_if( resample.begin(),\n                                   resample.end(),\n                                   [point]( double x ) { return x < point; } ) /\n                    static_cast<double>( n );\n                // degenerate case with uniform samples\n                if ( Catch::Detail::directCompare( prob_n, 0. ) ) {\n                    return { point, point, point, confidence_level };\n                }\n\n                double bias = normal_quantile( prob_n );\n                double z1 = normal_quantile( ( 1. - confidence_level ) / 2. );\n\n                auto cumn = [n]( double x ) -> long {\n                    return std::lround( normal_cdf( x ) *\n                                        static_cast<double>( n ) );\n                };\n                auto a = [bias, accel]( double b ) {\n                    return bias + b / ( 1. - accel * b );\n                };\n                double b1 = bias + z1;\n                double b2 = bias - z1;\n                double a1 = a( b1 );\n                double a2 = a( b2 );\n                auto lo = static_cast<size_t>( (std::max)( cumn( a1 ), 0l ) );\n                auto hi =\n                    static_cast<size_t>( (std::min)( cumn( a2 ), n - 1 ) );\n\n                return { point, resample[lo], resample[hi], confidence_level };\n            }\n\n            bootstrap_analysis analyse_samples(double confidence_level,\n                                               unsigned int n_resamples,\n                                               double* first,\n                                               double* last) {\n                auto mean = &Detail::mean;\n                auto stddev = &standard_deviation;\n\n#if defined(CATCH_CONFIG_USE_ASYNC)\n                auto Estimate = [=](double(*f)(double const*, double const*)) {\n                    std::random_device rd;\n                    auto seed = rd();\n                    return std::async(std::launch::async, [=] {\n                        SimplePcg32 rng( seed );\n                        auto resampled = resample(rng, n_resamples, first, last, f);\n                        return bootstrap(confidence_level, first, last, resampled, f);\n                    });\n                };\n\n                auto mean_future = Estimate(mean);\n                auto stddev_future = Estimate(stddev);\n\n                auto mean_estimate = mean_future.get();\n                auto stddev_estimate = stddev_future.get();\n#else\n                auto Estimate = [=](double(*f)(double const* , double const*)) {\n                    std::random_device rd;\n                    auto seed = rd();\n                    SimplePcg32 rng( seed );\n                    auto resampled = resample(rng, n_resamples, first, last, f);\n                    return bootstrap(confidence_level, first, last, resampled, f);\n                };\n\n                auto mean_estimate = Estimate(mean);\n                auto stddev_estimate = Estimate(stddev);\n#endif // CATCH_USE_ASYNC\n\n                auto n = static_cast<int>(last - first); // seriously, one can't use integral types without hell in C++\n                double outlier_variance = Detail::outlier_variance(mean_estimate, stddev_estimate, n);\n\n                return { mean_estimate, stddev_estimate, outlier_variance };\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n\n\n#include <cmath>\n#include <limits>\n\nnamespace {\n\n// Performs equivalent check of std::fabs(lhs - rhs) <= margin\n// But without the subtraction to allow for INFINITY in comparison\nbool marginComparison(double lhs, double rhs, double margin) {\n    return (lhs + margin >= rhs) && (rhs + margin >= lhs);\n}\n\n}\n\nnamespace Catch {\n\n    Approx::Approx ( double value )\n    :   m_epsilon( static_cast<double>(std::numeric_limits<float>::epsilon())*100. ),\n        m_margin( 0.0 ),\n        m_scale( 0.0 ),\n        m_value( value )\n    {}\n\n    Approx Approx::custom() {\n        return Approx( 0 );\n    }\n\n    Approx Approx::operator-() const {\n        auto temp(*this);\n        temp.m_value = -temp.m_value;\n        return temp;\n    }\n\n\n    std::string Approx::toString() const {\n        ReusableStringStream rss;\n        rss << \"Approx( \" << ::Catch::Detail::stringify( m_value ) << \" )\";\n        return rss.str();\n    }\n\n    bool Approx::equalityComparisonImpl(const double other) const {\n        // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value\n        // Thanks to Richard Harris for his help refining the scaled margin value\n        return marginComparison(m_value, other, m_margin)\n            || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value)));\n    }\n\n    void Approx::setMargin(double newMargin) {\n        CATCH_ENFORCE(newMargin >= 0,\n            \"Invalid Approx::margin: \" << newMargin << '.'\n            << \" Approx::Margin has to be non-negative.\");\n        m_margin = newMargin;\n    }\n\n    void Approx::setEpsilon(double newEpsilon) {\n        CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0,\n            \"Invalid Approx::epsilon: \" << newEpsilon << '.'\n            << \" Approx::epsilon has to be in [0, 1]\");\n        m_epsilon = newEpsilon;\n    }\n\nnamespace literals {\n    Approx operator \"\"_a(long double val) {\n        return Approx(val);\n    }\n    Approx operator \"\"_a(unsigned long long val) {\n        return Approx(val);\n    }\n} // end namespace literals\n\nstd::string StringMaker<Catch::Approx>::convert(Catch::Approx const& value) {\n    return value.toString();\n}\n\n} // end namespace Catch\n\n\n\nnamespace Catch {\n\n    AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const& _lazyExpression):\n        lazyExpression(_lazyExpression),\n        resultType(_resultType) {}\n\n    std::string AssertionResultData::reconstructExpression() const {\n\n        if( reconstructedExpression.empty() ) {\n            if( lazyExpression ) {\n                ReusableStringStream rss;\n                rss << lazyExpression;\n                reconstructedExpression = rss.str();\n            }\n        }\n        return reconstructedExpression;\n    }\n\n    AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData&& data )\n    :   m_info( info ),\n        m_resultData( CATCH_MOVE(data) )\n    {}\n\n    // Result was a success\n    bool AssertionResult::succeeded() const {\n        return Catch::isOk( m_resultData.resultType );\n    }\n\n    // Result was a success, or failure is suppressed\n    bool AssertionResult::isOk() const {\n        return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition );\n    }\n\n    ResultWas::OfType AssertionResult::getResultType() const {\n        return m_resultData.resultType;\n    }\n\n    bool AssertionResult::hasExpression() const {\n        return !m_info.capturedExpression.empty();\n    }\n\n    bool AssertionResult::hasMessage() const {\n        return !m_resultData.message.empty();\n    }\n\n    std::string AssertionResult::getExpression() const {\n        // Possibly overallocating by 3 characters should be basically free\n        std::string expr; expr.reserve(m_info.capturedExpression.size() + 3);\n        if (isFalseTest(m_info.resultDisposition)) {\n            expr += \"!(\";\n        }\n        expr += m_info.capturedExpression;\n        if (isFalseTest(m_info.resultDisposition)) {\n            expr += ')';\n        }\n        return expr;\n    }\n\n    std::string AssertionResult::getExpressionInMacro() const {\n        if ( m_info.macroName.empty() ) {\n            return static_cast<std::string>( m_info.capturedExpression );\n        }\n        std::string expr;\n        expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 );\n        expr += m_info.macroName;\n        expr += \"( \";\n        expr += m_info.capturedExpression;\n        expr += \" )\";\n        return expr;\n    }\n\n    bool AssertionResult::hasExpandedExpression() const {\n        return hasExpression() && getExpandedExpression() != getExpression();\n    }\n\n    std::string AssertionResult::getExpandedExpression() const {\n        std::string expr = m_resultData.reconstructExpression();\n        return expr.empty()\n                ? getExpression()\n                : expr;\n    }\n\n    StringRef AssertionResult::getMessage() const {\n        return m_resultData.message;\n    }\n    SourceLineInfo AssertionResult::getSourceInfo() const {\n        return m_info.lineInfo;\n    }\n\n    StringRef AssertionResult::getTestMacroName() const {\n        return m_info.macroName;\n    }\n\n} // end namespace Catch\n\n\n\n#include <fstream>\n\nnamespace Catch {\n\n    namespace {\n        static bool enableBazelEnvSupport() {\n#if defined( CATCH_CONFIG_BAZEL_SUPPORT )\n            return true;\n#else\n            return Detail::getEnv( \"BAZEL_TEST\" ) != nullptr;\n#endif\n        }\n\n        struct bazelShardingOptions {\n            unsigned int shardIndex, shardCount;\n            std::string shardFilePath;\n        };\n\n        static Optional<bazelShardingOptions> readBazelShardingOptions() {\n            const auto bazelShardIndex = Detail::getEnv( \"TEST_SHARD_INDEX\" );\n            const auto bazelShardTotal = Detail::getEnv( \"TEST_TOTAL_SHARDS\" );\n            const auto bazelShardInfoFile = Detail::getEnv( \"TEST_SHARD_STATUS_FILE\" );\n\n\n            const bool has_all =\n                bazelShardIndex && bazelShardTotal && bazelShardInfoFile;\n            if ( !has_all ) {\n                // We provide nice warning message if the input is\n                // misconfigured.\n                auto warn = []( const char* env_var ) {\n                    Catch::cerr()\n                        << \"Warning: Bazel shard configuration is missing '\"\n                        << env_var << \"'. Shard configuration is skipped.\\n\";\n                };\n                if ( !bazelShardIndex ) {\n                    warn( \"TEST_SHARD_INDEX\" );\n                }\n                if ( !bazelShardTotal ) {\n                    warn( \"TEST_TOTAL_SHARDS\" );\n                }\n                if ( !bazelShardInfoFile ) {\n                    warn( \"TEST_SHARD_STATUS_FILE\" );\n                }\n                return {};\n            }\n\n            auto shardIndex = parseUInt( bazelShardIndex );\n            if ( !shardIndex ) {\n                Catch::cerr()\n                    << \"Warning: could not parse 'TEST_SHARD_INDEX' ('\" << bazelShardIndex\n                    << \"') as unsigned int.\\n\";\n                return {};\n            }\n            auto shardTotal = parseUInt( bazelShardTotal );\n            if ( !shardTotal ) {\n                Catch::cerr()\n                    << \"Warning: could not parse 'TEST_TOTAL_SHARD' ('\"\n                    << bazelShardTotal << \"') as unsigned int.\\n\";\n                return {};\n            }\n\n            return bazelShardingOptions{\n                *shardIndex, *shardTotal, bazelShardInfoFile };\n\n        }\n    } // end namespace\n\n\n    bool operator==( ProcessedReporterSpec const& lhs,\n                     ProcessedReporterSpec const& rhs ) {\n        return lhs.name == rhs.name &&\n               lhs.outputFilename == rhs.outputFilename &&\n               lhs.colourMode == rhs.colourMode &&\n               lhs.customOptions == rhs.customOptions;\n    }\n\n    Config::Config( ConfigData const& data ):\n        m_data( data ) {\n        // We need to trim filter specs to avoid trouble with superfluous\n        // whitespace (esp. important for bdd macros, as those are manually\n        // aligned with whitespace).\n\n        for (auto& elem : m_data.testsOrTags) {\n            elem = trim(elem);\n        }\n        for (auto& elem : m_data.sectionsToRun) {\n            elem = trim(elem);\n        }\n\n        // Insert the default reporter if user hasn't asked for a specific one\n        if ( m_data.reporterSpecifications.empty() ) {\n#if defined( CATCH_CONFIG_DEFAULT_REPORTER )\n            const auto default_spec = CATCH_CONFIG_DEFAULT_REPORTER;\n#else\n            const auto default_spec = \"console\";\n#endif\n            auto parsed = parseReporterSpec(default_spec);\n            CATCH_ENFORCE( parsed,\n                           \"Cannot parse the provided default reporter spec: '\"\n                               << default_spec << '\\'' );\n            m_data.reporterSpecifications.push_back( std::move( *parsed ) );\n        }\n\n        if ( enableBazelEnvSupport() ) {\n            readBazelEnvVars();\n        }\n\n        // Bazel support can modify the test specs, so parsing has to happen\n        // after reading Bazel env vars.\n        TestSpecParser parser( ITagAliasRegistry::get() );\n        if ( !m_data.testsOrTags.empty() ) {\n            m_hasTestFilters = true;\n            for ( auto const& testOrTags : m_data.testsOrTags ) {\n                parser.parse( testOrTags );\n            }\n        }\n        m_testSpec = parser.testSpec();\n\n\n        // We now fixup the reporter specs to handle default output spec,\n        // default colour spec, etc\n        bool defaultOutputUsed = false;\n        for ( auto const& reporterSpec : m_data.reporterSpecifications ) {\n            // We do the default-output check separately, while always\n            // using the default output below to make the code simpler\n            // and avoid superfluous copies.\n            if ( reporterSpec.outputFile().none() ) {\n                CATCH_ENFORCE( !defaultOutputUsed,\n                               \"Internal error: cannot use default output for \"\n                               \"multiple reporters\" );\n                defaultOutputUsed = true;\n            }\n\n            m_processedReporterSpecs.push_back( ProcessedReporterSpec{\n                reporterSpec.name(),\n                reporterSpec.outputFile() ? *reporterSpec.outputFile()\n                                          : data.defaultOutputFilename,\n                reporterSpec.colourMode().valueOr( data.defaultColourMode ),\n                reporterSpec.customOptions() } );\n        }\n    }\n\n    Config::~Config() = default;\n\n\n    bool Config::listTests() const          { return m_data.listTests; }\n    bool Config::listTags() const           { return m_data.listTags; }\n    bool Config::listReporters() const      { return m_data.listReporters; }\n    bool Config::listListeners() const      { return m_data.listListeners; }\n\n    std::vector<std::string> const& Config::getTestsOrTags() const { return m_data.testsOrTags; }\n    std::vector<std::string> const& Config::getSectionsToRun() const { return m_data.sectionsToRun; }\n\n    std::vector<ReporterSpec> const& Config::getReporterSpecs() const {\n        return m_data.reporterSpecifications;\n    }\n\n    std::vector<ProcessedReporterSpec> const&\n    Config::getProcessedReporterSpecs() const {\n        return m_processedReporterSpecs;\n    }\n\n    TestSpec const& Config::testSpec() const { return m_testSpec; }\n    bool Config::hasTestFilters() const { return m_hasTestFilters; }\n\n    bool Config::showHelp() const { return m_data.showHelp; }\n\n    // IConfig interface\n    bool Config::allowThrows() const                   { return !m_data.noThrow; }\n    StringRef Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }\n    bool Config::includeSuccessfulResults() const      { return m_data.showSuccessfulTests; }\n    bool Config::warnAboutMissingAssertions() const {\n        return !!( m_data.warnings & WarnAbout::NoAssertions );\n    }\n    bool Config::warnAboutUnmatchedTestSpecs() const {\n        return !!( m_data.warnings & WarnAbout::UnmatchedTestSpec );\n    }\n    bool Config::zeroTestsCountAsSuccess() const       { return m_data.allowZeroTests; }\n    ShowDurations Config::showDurations() const        { return m_data.showDurations; }\n    double Config::minDuration() const                 { return m_data.minDuration; }\n    TestRunOrder Config::runOrder() const              { return m_data.runOrder; }\n    uint32_t Config::rngSeed() const                   { return m_data.rngSeed; }\n    unsigned int Config::shardCount() const            { return m_data.shardCount; }\n    unsigned int Config::shardIndex() const            { return m_data.shardIndex; }\n    ColourMode Config::defaultColourMode() const       { return m_data.defaultColourMode; }\n    bool Config::shouldDebugBreak() const              { return m_data.shouldDebugBreak; }\n    int Config::abortAfter() const                     { return m_data.abortAfter; }\n    bool Config::showInvisibles() const                { return m_data.showInvisibles; }\n    Verbosity Config::verbosity() const                { return m_data.verbosity; }\n\n    bool Config::skipBenchmarks() const                           { return m_data.skipBenchmarks; }\n    bool Config::benchmarkNoAnalysis() const                      { return m_data.benchmarkNoAnalysis; }\n    unsigned int Config::benchmarkSamples() const                 { return m_data.benchmarkSamples; }\n    double Config::benchmarkConfidenceInterval() const            { return m_data.benchmarkConfidenceInterval; }\n    unsigned int Config::benchmarkResamples() const               { return m_data.benchmarkResamples; }\n    std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); }\n\n    void Config::readBazelEnvVars() {\n        // Register a JUnit reporter for Bazel. Bazel sets an environment\n        // variable with the path to XML output. If this file is written to\n        // during test, Bazel will not generate a default XML output.\n        // This allows the XML output file to contain higher level of detail\n        // than what is possible otherwise.\n        const auto bazelOutputFile = Detail::getEnv( \"XML_OUTPUT_FILE\" );\n\n        if ( bazelOutputFile ) {\n            m_data.reporterSpecifications.push_back(\n                { \"junit\", std::string( bazelOutputFile ), {}, {} } );\n        }\n\n        const auto bazelTestSpec = Detail::getEnv( \"TESTBRIDGE_TEST_ONLY\" );\n        if ( bazelTestSpec ) {\n            // Presumably the test spec from environment should overwrite\n            // the one we got from CLI (if we got any)\n            m_data.testsOrTags.clear();\n            m_data.testsOrTags.push_back( bazelTestSpec );\n        }\n\n        const auto bazelShardOptions = readBazelShardingOptions();\n        if ( bazelShardOptions ) {\n            std::ofstream f( bazelShardOptions->shardFilePath,\n                             std::ios_base::out | std::ios_base::trunc );\n            if ( f.is_open() ) {\n                f << \"\";\n                m_data.shardIndex = bazelShardOptions->shardIndex;\n                m_data.shardCount = bazelShardOptions->shardCount;\n            }\n        }\n    }\n\n} // end namespace Catch\n\n\n\n\n\nnamespace Catch {\n    std::uint32_t getSeed() {\n        return getCurrentContext().getConfig()->rngSeed();\n    }\n}\n\n\n\n#include <cassert>\n#include <stack>\n\nnamespace Catch {\n\n    ////////////////////////////////////////////////////////////////////////////\n\n\n    ScopedMessage::ScopedMessage( MessageBuilder&& builder ):\n        m_info( CATCH_MOVE(builder.m_info) ) {\n        m_info.message = builder.m_stream.str();\n        getResultCapture().pushScopedMessage( m_info );\n    }\n\n    ScopedMessage::ScopedMessage( ScopedMessage&& old ) noexcept:\n        m_info( CATCH_MOVE( old.m_info ) ) {\n        old.m_moved = true;\n    }\n\n    ScopedMessage::~ScopedMessage() {\n        if ( !uncaught_exceptions() && !m_moved ){\n            getResultCapture().popScopedMessage(m_info);\n        }\n    }\n\n\n    Capturer::Capturer( StringRef macroName,\n                        SourceLineInfo const& lineInfo,\n                        ResultWas::OfType resultType,\n                        StringRef names ):\n        m_resultCapture( getResultCapture() ) {\n        auto trimmed = [&] (size_t start, size_t end) {\n            while (names[start] == ',' || isspace(static_cast<unsigned char>(names[start]))) {\n                ++start;\n            }\n            while (names[end] == ',' || isspace(static_cast<unsigned char>(names[end]))) {\n                --end;\n            }\n            return names.substr(start, end - start + 1);\n        };\n        auto skipq = [&] (size_t start, char quote) {\n            for (auto i = start + 1; i < names.size() ; ++i) {\n                if (names[i] == quote)\n                    return i;\n                if (names[i] == '\\\\')\n                    ++i;\n            }\n            CATCH_INTERNAL_ERROR(\"CAPTURE parsing encountered unmatched quote\");\n        };\n\n        size_t start = 0;\n        std::stack<char> openings;\n        for (size_t pos = 0; pos < names.size(); ++pos) {\n            char c = names[pos];\n            switch (c) {\n            case '[':\n            case '{':\n            case '(':\n            // It is basically impossible to disambiguate between\n            // comparison and start of template args in this context\n//            case '<':\n                openings.push(c);\n                break;\n            case ']':\n            case '}':\n            case ')':\n//           case '>':\n                openings.pop();\n                break;\n            case '\"':\n            case '\\'':\n                pos = skipq(pos, c);\n                break;\n            case ',':\n                if (start != pos && openings.empty()) {\n                    m_messages.emplace_back(macroName, lineInfo, resultType);\n                    m_messages.back().message = static_cast<std::string>(trimmed(start, pos));\n                    m_messages.back().message += \" := \";\n                    start = pos;\n                }\n                break;\n            default:; // noop\n            }\n        }\n        assert(openings.empty() && \"Mismatched openings\");\n        m_messages.emplace_back(macroName, lineInfo, resultType);\n        m_messages.back().message = static_cast<std::string>(trimmed(start, names.size() - 1));\n        m_messages.back().message += \" := \";\n    }\n    Capturer::~Capturer() {\n        if ( !uncaught_exceptions() ){\n            assert( m_captured == m_messages.size() );\n            for( size_t i = 0; i < m_captured; ++i  )\n                m_resultCapture.popScopedMessage( m_messages[i] );\n        }\n    }\n\n    void Capturer::captureValue( size_t index, std::string const& value ) {\n        assert( index < m_messages.size() );\n        m_messages[index].message += value;\n        m_resultCapture.pushScopedMessage( m_messages[index] );\n        m_captured++;\n    }\n\n} // end namespace Catch\n\n\n\n\n#include <exception>\n\nnamespace Catch {\n\n    namespace {\n\n        class RegistryHub : public IRegistryHub,\n                            public IMutableRegistryHub,\n                            private Detail::NonCopyable {\n\n        public: // IRegistryHub\n            RegistryHub() = default;\n            ReporterRegistry const& getReporterRegistry() const override {\n                return m_reporterRegistry;\n            }\n            ITestCaseRegistry const& getTestCaseRegistry() const override {\n                return m_testCaseRegistry;\n            }\n            IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override {\n                return m_exceptionTranslatorRegistry;\n            }\n            ITagAliasRegistry const& getTagAliasRegistry() const override {\n                return m_tagAliasRegistry;\n            }\n            StartupExceptionRegistry const& getStartupExceptionRegistry() const override {\n                return m_exceptionRegistry;\n            }\n\n        public: // IMutableRegistryHub\n            void registerReporter( std::string const& name, IReporterFactoryPtr factory ) override {\n                m_reporterRegistry.registerReporter( name, CATCH_MOVE(factory) );\n            }\n            void registerListener( Detail::unique_ptr<EventListenerFactory> factory ) override {\n                m_reporterRegistry.registerListener( CATCH_MOVE(factory) );\n            }\n            void registerTest( Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker ) override {\n                m_testCaseRegistry.registerTest( CATCH_MOVE(testInfo), CATCH_MOVE(invoker) );\n            }\n            void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) override {\n                m_exceptionTranslatorRegistry.registerTranslator( CATCH_MOVE(translator) );\n            }\n            void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override {\n                m_tagAliasRegistry.add( alias, tag, lineInfo );\n            }\n            void registerStartupException() noexcept override {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n                m_exceptionRegistry.add(std::current_exception());\n#else\n                CATCH_INTERNAL_ERROR(\"Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!\");\n#endif\n            }\n            IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override {\n                return m_enumValuesRegistry;\n            }\n\n        private:\n            TestRegistry m_testCaseRegistry;\n            ReporterRegistry m_reporterRegistry;\n            ExceptionTranslatorRegistry m_exceptionTranslatorRegistry;\n            TagAliasRegistry m_tagAliasRegistry;\n            StartupExceptionRegistry m_exceptionRegistry;\n            Detail::EnumValuesRegistry m_enumValuesRegistry;\n        };\n    }\n\n    using RegistryHubSingleton = Singleton<RegistryHub, IRegistryHub, IMutableRegistryHub>;\n\n    IRegistryHub const& getRegistryHub() {\n        return RegistryHubSingleton::get();\n    }\n    IMutableRegistryHub& getMutableRegistryHub() {\n        return RegistryHubSingleton::getMutable();\n    }\n    void cleanUp() {\n        cleanupSingletons();\n        cleanUpContext();\n    }\n    std::string translateActiveException() {\n        return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException();\n    }\n\n\n} // end namespace Catch\n\n\n\n#include <algorithm>\n#include <cassert>\n#include <exception>\n#include <iomanip>\n#include <set>\n\nnamespace Catch {\n\n    namespace {\n        static constexpr int TestFailureExitCode = 42;\n        static constexpr int UnspecifiedErrorExitCode = 1;\n        static constexpr int AllTestsSkippedExitCode = 4;\n        static constexpr int NoTestsRunExitCode = 2;\n        static constexpr int UnmatchedTestSpecExitCode = 3;\n        static constexpr int InvalidTestSpecExitCode = 5;\n\n\n        IEventListenerPtr createReporter(std::string const& reporterName, ReporterConfig&& config) {\n            auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, CATCH_MOVE(config));\n            CATCH_ENFORCE(reporter, \"No reporter registered with name: '\" << reporterName << '\\'');\n\n            return reporter;\n        }\n\n        IEventListenerPtr prepareReporters(Config const* config) {\n            if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()\n                    && config->getProcessedReporterSpecs().size() == 1) {\n                auto const& spec = config->getProcessedReporterSpecs()[0];\n                return createReporter(\n                    spec.name,\n                    ReporterConfig( config,\n                                    makeStream( spec.outputFilename ),\n                                    spec.colourMode,\n                                    spec.customOptions ) );\n            }\n\n            auto multi = Detail::make_unique<MultiReporter>(config);\n\n            auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners();\n            for (auto const& listener : listeners) {\n                multi->addListener(listener->create(config));\n            }\n\n            for ( auto const& reporterSpec : config->getProcessedReporterSpecs() ) {\n                multi->addReporter( createReporter(\n                    reporterSpec.name,\n                    ReporterConfig( config,\n                                    makeStream( reporterSpec.outputFilename ),\n                                    reporterSpec.colourMode,\n                                    reporterSpec.customOptions ) ) );\n            }\n\n            return multi;\n        }\n\n        class TestGroup {\n        public:\n            explicit TestGroup(IEventListenerPtr&& reporter, Config const* config):\n                m_reporter(reporter.get()),\n                m_config{config},\n                m_context{config, CATCH_MOVE(reporter)} {\n\n                assert( m_config->testSpec().getInvalidSpecs().empty() &&\n                        \"Invalid test specs should be handled before running tests\" );\n\n                auto const& allTestCases = getAllTestCasesSorted(*m_config);\n                auto const& testSpec = m_config->testSpec();\n                if ( !testSpec.hasFilters() ) {\n                    for ( auto const& test : allTestCases ) {\n                        if ( !test.getTestCaseInfo().isHidden() ) {\n                            m_tests.emplace( &test );\n                        }\n                    }\n                } else {\n                    m_matches =\n                        testSpec.matchesByFilter( allTestCases, *m_config );\n                    for ( auto const& match : m_matches ) {\n                        m_tests.insert( match.tests.begin(),\n                                        match.tests.end() );\n                    }\n                }\n\n                m_tests = createShard(m_tests, m_config->shardCount(), m_config->shardIndex());\n            }\n\n            Totals execute() {\n                Totals totals;\n                for (auto const& testCase : m_tests) {\n                    if (!m_context.aborting())\n                        totals += m_context.runTest(*testCase);\n                    else\n                        m_reporter->skipTest(testCase->getTestCaseInfo());\n                }\n\n                for (auto const& match : m_matches) {\n                    if (match.tests.empty()) {\n                        m_unmatchedTestSpecs = true;\n                        m_reporter->noMatchingTestCases( match.name );\n                    }\n                }\n\n                return totals;\n            }\n\n            bool hadUnmatchedTestSpecs() const {\n                return m_unmatchedTestSpecs;\n            }\n\n\n        private:\n            IEventListener* m_reporter;\n            Config const* m_config;\n            RunContext m_context;\n            std::set<TestCaseHandle const*> m_tests;\n            TestSpec::Matches m_matches;\n            bool m_unmatchedTestSpecs = false;\n        };\n\n        void applyFilenamesAsTags() {\n            for (auto const& testInfo : getRegistryHub().getTestCaseRegistry().getAllInfos()) {\n                testInfo->addFilenameTag();\n            }\n        }\n\n    } // anon namespace\n\n    Session::Session() {\n        static bool alreadyInstantiated = false;\n        if( alreadyInstantiated ) {\n            CATCH_TRY { CATCH_INTERNAL_ERROR( \"Only one instance of Catch::Session can ever be used\" ); }\n            CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); }\n        }\n\n        // There cannot be exceptions at startup in no-exception mode.\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n        const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions();\n        if ( !exceptions.empty() ) {\n            config();\n            getCurrentMutableContext().setConfig(m_config.get());\n\n            m_startupExceptions = true;\n            auto errStream = makeStream( \"%stderr\" );\n            auto colourImpl = makeColourImpl(\n                ColourMode::PlatformDefault, errStream.get() );\n            auto guard = colourImpl->guardColour( Colour::Red );\n            errStream->stream() << \"Errors occurred during startup!\" << '\\n';\n            // iterate over all exceptions and notify user\n            for ( const auto& ex_ptr : exceptions ) {\n                try {\n                    std::rethrow_exception(ex_ptr);\n                } catch ( std::exception const& ex ) {\n                    errStream->stream() << TextFlow::Column( ex.what() ).indent(2) << '\\n';\n                }\n            }\n        }\n#endif\n\n        alreadyInstantiated = true;\n        m_cli = makeCommandLineParser( m_configData );\n    }\n    Session::~Session() {\n        Catch::cleanUp();\n    }\n\n    void Session::showHelp() const {\n        Catch::cout()\n                << \"\\nCatch2 v\" << libraryVersion() << '\\n'\n                << m_cli << '\\n'\n                << \"For more detailed usage please see the project docs\\n\\n\" << std::flush;\n    }\n    void Session::libIdentify() {\n        Catch::cout()\n                << std::left << std::setw(16) << \"description: \" << \"A Catch2 test executable\\n\"\n                << std::left << std::setw(16) << \"category: \" << \"testframework\\n\"\n                << std::left << std::setw(16) << \"framework: \" << \"Catch2\\n\"\n                << std::left << std::setw(16) << \"version: \" << libraryVersion() << '\\n' << std::flush;\n    }\n\n    int Session::applyCommandLine( int argc, char const * const * argv ) {\n        if ( m_startupExceptions ) { return UnspecifiedErrorExitCode; }\n\n        auto result = m_cli.parse( Clara::Args( argc, argv ) );\n\n        if( !result ) {\n            config();\n            getCurrentMutableContext().setConfig(m_config.get());\n            auto errStream = makeStream( \"%stderr\" );\n            auto colour = makeColourImpl( ColourMode::PlatformDefault, errStream.get() );\n\n            errStream->stream()\n                << colour->guardColour( Colour::Red )\n                << \"\\nError(s) in input:\\n\"\n                << TextFlow::Column( result.errorMessage() ).indent( 2 )\n                << \"\\n\\n\";\n            errStream->stream() << \"Run with -? for usage\\n\\n\" << std::flush;\n            return UnspecifiedErrorExitCode;\n        }\n\n        if( m_configData.showHelp )\n            showHelp();\n        if( m_configData.libIdentify )\n            libIdentify();\n\n        m_config.reset();\n        return 0;\n    }\n\n#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)\n    int Session::applyCommandLine( int argc, wchar_t const * const * argv ) {\n\n        char **utf8Argv = new char *[ argc ];\n\n        for ( int i = 0; i < argc; ++i ) {\n            int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, nullptr, 0, nullptr, nullptr );\n\n            utf8Argv[ i ] = new char[ bufSize ];\n\n            WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, nullptr, nullptr );\n        }\n\n        int returnCode = applyCommandLine( argc, utf8Argv );\n\n        for ( int i = 0; i < argc; ++i )\n            delete [] utf8Argv[ i ];\n\n        delete [] utf8Argv;\n\n        return returnCode;\n    }\n#endif\n\n    void Session::useConfigData( ConfigData const& configData ) {\n        m_configData = configData;\n        m_config.reset();\n    }\n\n    int Session::run() {\n        if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) {\n            Catch::cout() << \"...waiting for enter/ return before starting\\n\" << std::flush;\n            static_cast<void>(std::getchar());\n        }\n        int exitCode = runInternal();\n        if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) {\n            Catch::cout() << \"...waiting for enter/ return before exiting, with code: \" << exitCode << '\\n' << std::flush;\n            static_cast<void>(std::getchar());\n        }\n        return exitCode;\n    }\n\n    Clara::Parser const& Session::cli() const {\n        return m_cli;\n    }\n    void Session::cli( Clara::Parser const& newParser ) {\n        m_cli = newParser;\n    }\n    ConfigData& Session::configData() {\n        return m_configData;\n    }\n    Config& Session::config() {\n        if( !m_config )\n            m_config = Detail::make_unique<Config>( m_configData );\n        return *m_config;\n    }\n\n    int Session::runInternal() {\n        if ( m_startupExceptions ) { return UnspecifiedErrorExitCode; }\n\n        if (m_configData.showHelp || m_configData.libIdentify) {\n            return 0;\n        }\n\n        if ( m_configData.shardIndex >= m_configData.shardCount ) {\n            Catch::cerr() << \"The shard count (\" << m_configData.shardCount\n                          << \") must be greater than the shard index (\"\n                          << m_configData.shardIndex << \")\\n\"\n                          << std::flush;\n            return UnspecifiedErrorExitCode;\n        }\n\n        CATCH_TRY {\n            config(); // Force config to be constructed\n\n            seedRng( *m_config );\n\n            if (m_configData.filenamesAsTags) {\n                applyFilenamesAsTags();\n            }\n\n            // Set up global config instance before we start calling into other functions\n            getCurrentMutableContext().setConfig(m_config.get());\n\n            // Create reporter(s) so we can route listings through them\n            auto reporter = prepareReporters(m_config.get());\n\n            auto const& invalidSpecs = m_config->testSpec().getInvalidSpecs();\n            if ( !invalidSpecs.empty() ) {\n                for ( auto const& spec : invalidSpecs ) {\n                    reporter->reportInvalidTestSpec( spec );\n                }\n                return InvalidTestSpecExitCode;\n            }\n\n\n            // Handle list request\n            if (list(*reporter, *m_config)) {\n                return 0;\n            }\n\n            TestGroup tests { CATCH_MOVE(reporter), m_config.get() };\n            auto const totals = tests.execute();\n\n            if ( tests.hadUnmatchedTestSpecs()\n                && m_config->warnAboutUnmatchedTestSpecs() ) {\n                // UnmatchedTestSpecExitCode\n                return UnmatchedTestSpecExitCode;\n            }\n\n            if ( totals.testCases.total() == 0\n                && !m_config->zeroTestsCountAsSuccess() ) {\n                return NoTestsRunExitCode;\n            }\n\n            if ( totals.testCases.total() > 0 &&\n                 totals.testCases.total() == totals.testCases.skipped\n                && !m_config->zeroTestsCountAsSuccess() ) {\n                return AllTestsSkippedExitCode;\n            }\n\n            if ( totals.assertions.failed ) { return TestFailureExitCode; }\n            return 0;\n\n        }\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n        catch( std::exception& ex ) {\n            Catch::cerr() << ex.what() << '\\n' << std::flush;\n            return UnspecifiedErrorExitCode;\n        }\n#endif\n    }\n\n} // end namespace Catch\n\n\n\n\nnamespace Catch {\n\n    RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) {\n        CATCH_TRY {\n            getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo);\n        } CATCH_CATCH_ALL {\n            // Do not throw when constructing global objects, instead register the exception to be processed later\n            getMutableRegistryHub().registerStartupException();\n        }\n    }\n\n}\n\n\n\n#include <cassert>\n#include <cctype>\n#include <algorithm>\n\nnamespace Catch {\n\n    namespace {\n        using TCP_underlying_type = uint8_t;\n        static_assert(sizeof(TestCaseProperties) == sizeof(TCP_underlying_type),\n                      \"The size of the TestCaseProperties is different from the assumed size\");\n\n        constexpr TestCaseProperties operator|(TestCaseProperties lhs, TestCaseProperties rhs) {\n            return static_cast<TestCaseProperties>(\n                static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)\n            );\n        }\n\n        constexpr TestCaseProperties& operator|=(TestCaseProperties& lhs, TestCaseProperties rhs) {\n            lhs = static_cast<TestCaseProperties>(\n                static_cast<TCP_underlying_type>(lhs) | static_cast<TCP_underlying_type>(rhs)\n            );\n            return lhs;\n        }\n\n        constexpr TestCaseProperties operator&(TestCaseProperties lhs, TestCaseProperties rhs) {\n            return static_cast<TestCaseProperties>(\n                static_cast<TCP_underlying_type>(lhs) & static_cast<TCP_underlying_type>(rhs)\n            );\n        }\n\n        constexpr bool applies(TestCaseProperties tcp) {\n            static_assert(static_cast<TCP_underlying_type>(TestCaseProperties::None) == 0,\n                          \"TestCaseProperties::None must be equal to 0\");\n            return tcp != TestCaseProperties::None;\n        }\n\n        TestCaseProperties parseSpecialTag( StringRef tag ) {\n            if( !tag.empty() && tag[0] == '.' )\n                return TestCaseProperties::IsHidden;\n            else if( tag == \"!throws\"_sr )\n                return TestCaseProperties::Throws;\n            else if( tag == \"!shouldfail\"_sr )\n                return TestCaseProperties::ShouldFail;\n            else if( tag == \"!mayfail\"_sr )\n                return TestCaseProperties::MayFail;\n            else if( tag == \"!nonportable\"_sr )\n                return TestCaseProperties::NonPortable;\n            else if( tag == \"!benchmark\"_sr )\n                return TestCaseProperties::Benchmark | TestCaseProperties::IsHidden;\n            else\n                return TestCaseProperties::None;\n        }\n        bool isReservedTag( StringRef tag ) {\n            return parseSpecialTag( tag ) == TestCaseProperties::None\n                && tag.size() > 0\n                && !std::isalnum( static_cast<unsigned char>(tag[0]) );\n        }\n        void enforceNotReservedTag( StringRef tag, SourceLineInfo const& _lineInfo ) {\n            CATCH_ENFORCE( !isReservedTag(tag),\n                          \"Tag name: [\" << tag << \"] is not allowed.\\n\"\n                          << \"Tag names starting with non alphanumeric characters are reserved\\n\"\n                          << _lineInfo );\n        }\n\n        std::string makeDefaultName() {\n            static size_t counter = 0;\n            return \"Anonymous test case \" + std::to_string(++counter);\n        }\n\n        constexpr StringRef extractFilenamePart(StringRef filename) {\n            size_t lastDot = filename.size();\n            while (lastDot > 0 && filename[lastDot - 1] != '.') {\n                --lastDot;\n            }\n            // In theory we could have filename without any extension in it\n            if ( lastDot == 0 ) { return StringRef(); }\n\n            --lastDot;\n            size_t nameStart = lastDot;\n            while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\\\') {\n                --nameStart;\n            }\n\n            return filename.substr(nameStart, lastDot - nameStart);\n        }\n\n        // Returns the upper bound on size of extra tags ([#file]+[.])\n        constexpr size_t sizeOfExtraTags(StringRef filepath) {\n            // [.] is 3, [#] is another 3\n            const size_t extras = 3 + 3;\n            return extractFilenamePart(filepath).size() + extras;\n        }\n    } // end unnamed namespace\n\n    bool operator<(  Tag const& lhs, Tag const& rhs ) {\n        Detail::CaseInsensitiveLess cmp;\n        return cmp( lhs.original, rhs.original );\n    }\n    bool operator==( Tag const& lhs, Tag const& rhs ) {\n        Detail::CaseInsensitiveEqualTo cmp;\n        return cmp( lhs.original, rhs.original );\n    }\n\n    Detail::unique_ptr<TestCaseInfo>\n        makeTestCaseInfo(StringRef _className,\n                         NameAndTags const& nameAndTags,\n                         SourceLineInfo const& _lineInfo ) {\n        return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);\n    }\n\n    TestCaseInfo::TestCaseInfo(StringRef _className,\n                               NameAndTags const& _nameAndTags,\n                               SourceLineInfo const& _lineInfo):\n        name( _nameAndTags.name.empty() ? makeDefaultName() : _nameAndTags.name ),\n        className( _className ),\n        lineInfo( _lineInfo )\n    {\n        StringRef originalTags = _nameAndTags.tags;\n        // We need to reserve enough space to store all of the tags\n        // (including optional hidden tag and filename tag)\n        auto requiredSize = originalTags.size() + sizeOfExtraTags(_lineInfo.file);\n        backingTags.reserve(requiredSize);\n\n        // We cannot copy the tags directly, as we need to normalize\n        // some tags, so that [.foo] is copied as [.][foo].\n        size_t tagStart = 0;\n        size_t tagEnd = 0;\n        bool inTag = false;\n        for (size_t idx = 0; idx < originalTags.size(); ++idx) {\n            auto c = originalTags[idx];\n            if (c == '[') {\n                CATCH_ENFORCE(\n                    !inTag,\n                    \"Found '[' inside a tag while registering test case '\"\n                        << _nameAndTags.name << \"' at \" << _lineInfo );\n\n                inTag = true;\n                tagStart = idx;\n            }\n            if (c == ']') {\n                CATCH_ENFORCE(\n                    inTag,\n                    \"Found unmatched ']' while registering test case '\"\n                        << _nameAndTags.name << \"' at \" << _lineInfo );\n\n                inTag = false;\n                tagEnd = idx;\n                assert(tagStart < tagEnd);\n\n                // We need to check the tag for special meanings, copy\n                // it over to backing storage and actually reference the\n                // backing storage in the saved tags\n                StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1);\n                CATCH_ENFORCE( !tagStr.empty(),\n                               \"Found an empty tag while registering test case '\"\n                                   << _nameAndTags.name << \"' at \"\n                                   << _lineInfo );\n\n                enforceNotReservedTag(tagStr, lineInfo);\n                properties |= parseSpecialTag(tagStr);\n                // When copying a tag to the backing storage, we need to\n                // check if it is a merged hide tag, such as [.foo], and\n                // if it is, we need to handle it as if it was [foo].\n                if (tagStr.size() > 1 && tagStr[0] == '.') {\n                    tagStr = tagStr.substr(1, tagStr.size() - 1);\n                }\n                // We skip over dealing with the [.] tag, as we will add\n                // it later unconditionally and then sort and unique all\n                // the tags.\n                internalAppendTag(tagStr);\n            }\n        }\n        CATCH_ENFORCE( !inTag,\n                       \"Found an unclosed tag while registering test case '\"\n                           << _nameAndTags.name << \"' at \" << _lineInfo );\n\n\n        // Add [.] if relevant\n        if (isHidden()) {\n            internalAppendTag(\".\"_sr);\n        }\n\n        // Sort and prepare tags\n        std::sort(begin(tags), end(tags));\n        tags.erase(std::unique(begin(tags), end(tags)),\n                   end(tags));\n    }\n\n    bool TestCaseInfo::isHidden() const {\n        return applies( properties & TestCaseProperties::IsHidden );\n    }\n    bool TestCaseInfo::throws() const {\n        return applies( properties & TestCaseProperties::Throws );\n    }\n    bool TestCaseInfo::okToFail() const {\n        return applies( properties & (TestCaseProperties::ShouldFail | TestCaseProperties::MayFail ) );\n    }\n    bool TestCaseInfo::expectedToFail() const {\n        return applies( properties & (TestCaseProperties::ShouldFail) );\n    }\n\n    void TestCaseInfo::addFilenameTag() {\n        std::string combined(\"#\");\n        combined += extractFilenamePart(lineInfo.file);\n        internalAppendTag(combined);\n    }\n\n    std::string TestCaseInfo::tagsAsString() const {\n        std::string ret;\n        // '[' and ']' per tag\n        std::size_t full_size = 2 * tags.size();\n        for (const auto& tag : tags) {\n            full_size += tag.original.size();\n        }\n        ret.reserve(full_size);\n        for (const auto& tag : tags) {\n            ret.push_back('[');\n            ret += tag.original;\n            ret.push_back(']');\n        }\n\n        return ret;\n    }\n\n    void TestCaseInfo::internalAppendTag(StringRef tagStr) {\n        backingTags += '[';\n        const auto backingStart = backingTags.size();\n        backingTags += tagStr;\n        const auto backingEnd = backingTags.size();\n        backingTags += ']';\n        tags.emplace_back(StringRef(backingTags.c_str() + backingStart, backingEnd - backingStart));\n    }\n\n    bool operator<( TestCaseInfo const& lhs, TestCaseInfo const& rhs ) {\n        // We want to avoid redoing the string comparisons multiple times,\n        // so we store the result of a three-way comparison before using\n        // it in the actual comparison logic.\n        const auto cmpName = lhs.name.compare( rhs.name );\n        if ( cmpName != 0 ) {\n            return cmpName < 0;\n        }\n        const auto cmpClassName = lhs.className.compare( rhs.className );\n        if ( cmpClassName != 0 ) {\n            return cmpClassName < 0;\n        }\n        return lhs.tags < rhs.tags;\n    }\n\n} // end namespace Catch\n\n\n\n#include <algorithm>\n#include <string>\n#include <vector>\n#include <ostream>\n\nnamespace Catch {\n\n    TestSpec::Pattern::Pattern( std::string const& name )\n    : m_name( name )\n    {}\n\n    TestSpec::Pattern::~Pattern() = default;\n\n    std::string const& TestSpec::Pattern::name() const {\n        return m_name;\n    }\n\n\n    TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString )\n    : Pattern( filterString )\n    , m_wildcardPattern( toLower( name ), CaseSensitive::No )\n    {}\n\n    bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const {\n        return m_wildcardPattern.matches( testCase.name );\n    }\n\n    void TestSpec::NamePattern::serializeTo( std::ostream& out ) const {\n        out << '\"' << name() << '\"';\n    }\n\n\n    TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString )\n    : Pattern( filterString )\n    , m_tag( tag )\n    {}\n\n    bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const {\n        return std::find( begin( testCase.tags ),\n                          end( testCase.tags ),\n                          Tag( m_tag ) ) != end( testCase.tags );\n    }\n\n    void TestSpec::TagPattern::serializeTo( std::ostream& out ) const {\n        out << name();\n    }\n\n    bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const {\n        bool should_use = !testCase.isHidden();\n        for (auto const& pattern : m_required) {\n            should_use = true;\n            if (!pattern->matches(testCase)) {\n                return false;\n            }\n        }\n        for (auto const& pattern : m_forbidden) {\n            if (pattern->matches(testCase)) {\n                return false;\n            }\n        }\n        return should_use;\n    }\n\n    void TestSpec::Filter::serializeTo( std::ostream& out ) const {\n        bool first = true;\n        for ( auto const& pattern : m_required ) {\n            if ( !first ) {\n                out << ' ';\n            }\n            out << *pattern;\n            first = false;\n        }\n        for ( auto const& pattern : m_forbidden ) {\n            if ( !first ) {\n                out << ' ';\n            }\n            out << *pattern;\n            first = false;\n        }\n    }\n\n\n    std::string TestSpec::extractFilterName( Filter const& filter ) {\n        Catch::ReusableStringStream sstr;\n        sstr << filter;\n        return sstr.str();\n    }\n\n    bool TestSpec::hasFilters() const {\n        return !m_filters.empty();\n    }\n\n    bool TestSpec::matches( TestCaseInfo const& testCase ) const {\n        return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } );\n    }\n\n    TestSpec::Matches TestSpec::matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const {\n        Matches matches;\n        matches.reserve( m_filters.size() );\n        for ( auto const& filter : m_filters ) {\n            std::vector<TestCaseHandle const*> currentMatches;\n            for ( auto const& test : testCases )\n                if ( isThrowSafe( test, config ) &&\n                     filter.matches( test.getTestCaseInfo() ) )\n                    currentMatches.emplace_back( &test );\n            matches.push_back(\n                FilterMatch{ extractFilterName( filter ), currentMatches } );\n        }\n        return matches;\n    }\n\n    const TestSpec::vectorStrings& TestSpec::getInvalidSpecs() const {\n        return m_invalidSpecs;\n    }\n\n    void TestSpec::serializeTo( std::ostream& out ) const {\n        bool first = true;\n        for ( auto const& filter : m_filters ) {\n            if ( !first ) {\n                out << ',';\n            }\n            out << filter;\n            first = false;\n        }\n    }\n\n}\n\n\n\n#include <chrono>\n\nnamespace Catch {\n\n    namespace {\n        static auto getCurrentNanosecondsSinceEpoch() -> uint64_t {\n            return std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::steady_clock::now().time_since_epoch()).count();\n        }\n    } // end unnamed namespace\n\n    void Timer::start() {\n       m_nanoseconds = getCurrentNanosecondsSinceEpoch();\n    }\n    auto Timer::getElapsedNanoseconds() const -> uint64_t {\n        return getCurrentNanosecondsSinceEpoch() - m_nanoseconds;\n    }\n    auto Timer::getElapsedMicroseconds() const -> uint64_t {\n        return getElapsedNanoseconds()/1000;\n    }\n    auto Timer::getElapsedMilliseconds() const -> unsigned int {\n        return static_cast<unsigned int>(getElapsedMicroseconds()/1000);\n    }\n    auto Timer::getElapsedSeconds() const -> double {\n        return getElapsedMicroseconds()/1000000.0;\n    }\n\n\n} // namespace Catch\n\n\n\n\n#include <cmath>\n#include <iomanip>\n\nnamespace Catch {\n\nnamespace Detail {\n\n    namespace {\n        const int hexThreshold = 255;\n\n        struct Endianness {\n            enum Arch { Big, Little };\n\n            static Arch which() {\n                int one = 1;\n                // If the lowest byte we read is non-zero, we can assume\n                // that little endian format is used.\n                auto value = *reinterpret_cast<char*>(&one);\n                return value ? Little : Big;\n            }\n        };\n\n        template<typename T>\n        std::string fpToString(T value, int precision) {\n            if (Catch::isnan(value)) {\n                return \"nan\";\n            }\n\n            ReusableStringStream rss;\n            rss << std::setprecision(precision)\n                << std::fixed\n                << value;\n            std::string d = rss.str();\n            std::size_t i = d.find_last_not_of('0');\n            if (i != std::string::npos && i != d.size() - 1) {\n                if (d[i] == '.')\n                    i++;\n                d = d.substr(0, i + 1);\n            }\n            return d;\n        }\n    } // end unnamed namespace\n\n    std::string convertIntoString(StringRef string, bool escapeInvisibles) {\n        std::string ret;\n        // This is enough for the \"don't escape invisibles\" case, and a good\n        // lower bound on the \"escape invisibles\" case.\n        ret.reserve(string.size() + 2);\n\n        if (!escapeInvisibles) {\n            ret += '\"';\n            ret += string;\n            ret += '\"';\n            return ret;\n        }\n\n        ret += '\"';\n        for (char c : string) {\n            switch (c) {\n            case '\\r':\n                ret.append(\"\\\\r\");\n                break;\n            case '\\n':\n                ret.append(\"\\\\n\");\n                break;\n            case '\\t':\n                ret.append(\"\\\\t\");\n                break;\n            case '\\f':\n                ret.append(\"\\\\f\");\n                break;\n            default:\n                ret.push_back(c);\n                break;\n            }\n        }\n        ret += '\"';\n\n        return ret;\n    }\n\n    std::string convertIntoString(StringRef string) {\n        return convertIntoString(string, getCurrentContext().getConfig()->showInvisibles());\n    }\n\n    std::string rawMemoryToString( const void *object, std::size_t size ) {\n        // Reverse order for little endian architectures\n        int i = 0, end = static_cast<int>( size ), inc = 1;\n        if( Endianness::which() == Endianness::Little ) {\n            i = end-1;\n            end = inc = -1;\n        }\n\n        unsigned char const *bytes = static_cast<unsigned char const *>(object);\n        ReusableStringStream rss;\n        rss << \"0x\" << std::setfill('0') << std::hex;\n        for( ; i != end; i += inc )\n             rss << std::setw(2) << static_cast<unsigned>(bytes[i]);\n       return rss.str();\n    }\n} // end Detail namespace\n\n\n\n//// ======================================================= ////\n//\n//   Out-of-line defs for full specialization of StringMaker\n//\n//// ======================================================= ////\n\nstd::string StringMaker<std::string>::convert(const std::string& str) {\n    return Detail::convertIntoString( str );\n}\n\n#ifdef CATCH_CONFIG_CPP17_STRING_VIEW\nstd::string StringMaker<std::string_view>::convert(std::string_view str) {\n    return Detail::convertIntoString( StringRef( str.data(), str.size() ) );\n}\n#endif\n\nstd::string StringMaker<char const*>::convert(char const* str) {\n    if (str) {\n        return Detail::convertIntoString( str );\n    } else {\n        return{ \"{null string}\" };\n    }\n}\nstd::string StringMaker<char*>::convert(char* str) { // NOLINT(readability-non-const-parameter)\n    if (str) {\n        return Detail::convertIntoString( str );\n    } else {\n        return{ \"{null string}\" };\n    }\n}\n\n#ifdef CATCH_CONFIG_WCHAR\nstd::string StringMaker<std::wstring>::convert(const std::wstring& wstr) {\n    std::string s;\n    s.reserve(wstr.size());\n    for (auto c : wstr) {\n        s += (c <= 0xff) ? static_cast<char>(c) : '?';\n    }\n    return ::Catch::Detail::stringify(s);\n}\n\n# ifdef CATCH_CONFIG_CPP17_STRING_VIEW\nstd::string StringMaker<std::wstring_view>::convert(std::wstring_view str) {\n    return StringMaker<std::wstring>::convert(std::wstring(str));\n}\n# endif\n\nstd::string StringMaker<wchar_t const*>::convert(wchar_t const * str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::wstring{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\nstd::string StringMaker<wchar_t *>::convert(wchar_t * str) {\n    if (str) {\n        return ::Catch::Detail::stringify(std::wstring{ str });\n    } else {\n        return{ \"{null string}\" };\n    }\n}\n#endif\n\n#if defined(CATCH_CONFIG_CPP17_BYTE)\n#include <cstddef>\nstd::string StringMaker<std::byte>::convert(std::byte value) {\n    return ::Catch::Detail::stringify(std::to_integer<unsigned long long>(value));\n}\n#endif // defined(CATCH_CONFIG_CPP17_BYTE)\n\nstd::string StringMaker<int>::convert(int value) {\n    return ::Catch::Detail::stringify(static_cast<long long>(value));\n}\nstd::string StringMaker<long>::convert(long value) {\n    return ::Catch::Detail::stringify(static_cast<long long>(value));\n}\nstd::string StringMaker<long long>::convert(long long value) {\n    ReusableStringStream rss;\n    rss << value;\n    if (value > Detail::hexThreshold) {\n        rss << \" (0x\" << std::hex << value << ')';\n    }\n    return rss.str();\n}\n\nstd::string StringMaker<unsigned int>::convert(unsigned int value) {\n    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));\n}\nstd::string StringMaker<unsigned long>::convert(unsigned long value) {\n    return ::Catch::Detail::stringify(static_cast<unsigned long long>(value));\n}\nstd::string StringMaker<unsigned long long>::convert(unsigned long long value) {\n    ReusableStringStream rss;\n    rss << value;\n    if (value > Detail::hexThreshold) {\n        rss << \" (0x\" << std::hex << value << ')';\n    }\n    return rss.str();\n}\n\nstd::string StringMaker<signed char>::convert(signed char value) {\n    if (value == '\\r') {\n        return \"'\\\\r'\";\n    } else if (value == '\\f') {\n        return \"'\\\\f'\";\n    } else if (value == '\\n') {\n        return \"'\\\\n'\";\n    } else if (value == '\\t') {\n        return \"'\\\\t'\";\n    } else if ('\\0' <= value && value < ' ') {\n        return ::Catch::Detail::stringify(static_cast<unsigned int>(value));\n    } else {\n        char chstr[] = \"' '\";\n        chstr[1] = value;\n        return chstr;\n    }\n}\nstd::string StringMaker<char>::convert(char c) {\n    return ::Catch::Detail::stringify(static_cast<signed char>(c));\n}\nstd::string StringMaker<unsigned char>::convert(unsigned char value) {\n    return ::Catch::Detail::stringify(static_cast<char>(value));\n}\n\nint StringMaker<float>::precision = std::numeric_limits<float>::max_digits10;\n\nstd::string StringMaker<float>::convert(float value) {\n    return Detail::fpToString(value, precision) + 'f';\n}\n\nint StringMaker<double>::precision = std::numeric_limits<double>::max_digits10;\n\nstd::string StringMaker<double>::convert(double value) {\n    return Detail::fpToString(value, precision);\n}\n\n} // end namespace Catch\n\n\n\nnamespace Catch {\n\n    Counts Counts::operator - ( Counts const& other ) const {\n        Counts diff;\n        diff.passed = passed - other.passed;\n        diff.failed = failed - other.failed;\n        diff.failedButOk = failedButOk - other.failedButOk;\n        diff.skipped = skipped - other.skipped;\n        return diff;\n    }\n\n    Counts& Counts::operator += ( Counts const& other ) {\n        passed += other.passed;\n        failed += other.failed;\n        failedButOk += other.failedButOk;\n        skipped += other.skipped;\n        return *this;\n    }\n\n    std::uint64_t Counts::total() const {\n        return passed + failed + failedButOk + skipped;\n    }\n    bool Counts::allPassed() const {\n        return failed == 0 && failedButOk == 0 && skipped == 0;\n    }\n    bool Counts::allOk() const {\n        return failed == 0;\n    }\n\n    Totals Totals::operator - ( Totals const& other ) const {\n        Totals diff;\n        diff.assertions = assertions - other.assertions;\n        diff.testCases = testCases - other.testCases;\n        return diff;\n    }\n\n    Totals& Totals::operator += ( Totals const& other ) {\n        assertions += other.assertions;\n        testCases += other.testCases;\n        return *this;\n    }\n\n    Totals Totals::delta( Totals const& prevTotals ) const {\n        Totals diff = *this - prevTotals;\n        if( diff.assertions.failed > 0 )\n            ++diff.testCases.failed;\n        else if( diff.assertions.failedButOk > 0 )\n            ++diff.testCases.failedButOk;\n        else if ( diff.assertions.skipped > 0 )\n            ++ diff.testCases.skipped;\n        else\n            ++diff.testCases.passed;\n        return diff;\n    }\n\n}\n\n\n\n\nnamespace Catch {\n    namespace Detail {\n        void registerTranslatorImpl(\n            Detail::unique_ptr<IExceptionTranslator>&& translator ) {\n            getMutableRegistryHub().registerTranslator(\n                CATCH_MOVE( translator ) );\n        }\n    } // namespace Detail\n} // namespace Catch\n\n\n#include <ostream>\n\nnamespace Catch {\n\n    Version::Version\n        (   unsigned int _majorVersion,\n            unsigned int _minorVersion,\n            unsigned int _patchNumber,\n            char const * const _branchName,\n            unsigned int _buildNumber )\n    :   majorVersion( _majorVersion ),\n        minorVersion( _minorVersion ),\n        patchNumber( _patchNumber ),\n        branchName( _branchName ),\n        buildNumber( _buildNumber )\n    {}\n\n    std::ostream& operator << ( std::ostream& os, Version const& version ) {\n        os  << version.majorVersion << '.'\n            << version.minorVersion << '.'\n            << version.patchNumber;\n        // branchName is never null -> 0th char is \\0 if it is empty\n        if (version.branchName[0]) {\n            os << '-' << version.branchName\n               << '.' << version.buildNumber;\n        }\n        return os;\n    }\n\n    Version const& libraryVersion() {\n        static Version version( 3, 7, 1, \"\", 0 );\n        return version;\n    }\n\n}\n\n\n\n\nnamespace Catch {\n\n    const char* GeneratorException::what() const noexcept {\n        return m_msg;\n    }\n\n} // end namespace Catch\n\n\n\n\nnamespace Catch {\n\n    IGeneratorTracker::~IGeneratorTracker() = default;\n\nnamespace Generators {\n\nnamespace Detail {\n\n    [[noreturn]]\n    void throw_generator_exception(char const* msg) {\n        Catch::throw_exception(GeneratorException{ msg });\n    }\n} // end namespace Detail\n\n    GeneratorUntypedBase::~GeneratorUntypedBase() = default;\n\n    IGeneratorTracker* acquireGeneratorTracker(StringRef generatorName, SourceLineInfo const& lineInfo ) {\n        return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo );\n    }\n\n    IGeneratorTracker* createGeneratorTracker( StringRef generatorName,\n                                 SourceLineInfo lineInfo,\n                                 GeneratorBasePtr&& generator ) {\n        return getResultCapture().createGeneratorTracker(\n            generatorName, lineInfo, CATCH_MOVE( generator ) );\n    }\n\n} // namespace Generators\n} // namespace Catch\n\n\n\n\n#include <random>\n\nnamespace Catch {\n    namespace Generators {\n        namespace Detail {\n            std::uint32_t getSeed() { return sharedRng()(); }\n        } // namespace Detail\n\n        struct RandomFloatingGenerator<long double>::PImpl {\n            PImpl( long double a, long double b, uint32_t seed ):\n                rng( seed ), dist( a, b ) {}\n\n            Catch::SimplePcg32 rng;\n            std::uniform_real_distribution<long double> dist;\n        };\n\n        RandomFloatingGenerator<long double>::RandomFloatingGenerator(\n            long double a, long double b, std::uint32_t seed) :\n            m_pimpl(Catch::Detail::make_unique<PImpl>(a, b, seed)) {\n            static_cast<void>( next() );\n        }\n\n        RandomFloatingGenerator<long double>::~RandomFloatingGenerator() =\n            default;\n        bool RandomFloatingGenerator<long double>::next() {\n            m_current_number = m_pimpl->dist( m_pimpl->rng );\n            return true;\n        }\n    } // namespace Generators\n} // namespace Catch\n\n\n\n\nnamespace Catch {\n    IResultCapture::~IResultCapture() = default;\n}\n\n\n\n\nnamespace Catch {\n    IConfig::~IConfig() = default;\n}\n\n\n\n\nnamespace Catch {\n    IExceptionTranslator::~IExceptionTranslator() = default;\n    IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default;\n}\n\n\n\n#include <string>\n\nnamespace Catch {\n    namespace Generators {\n\n        bool GeneratorUntypedBase::countedNext() {\n            auto ret = next();\n            if ( ret ) {\n                m_stringReprCache.clear();\n                ++m_currentElementIndex;\n            }\n            return ret;\n        }\n\n        StringRef GeneratorUntypedBase::currentElementAsString() const {\n            if ( m_stringReprCache.empty() ) {\n                m_stringReprCache = stringifyImpl();\n            }\n            return m_stringReprCache;\n        }\n\n    } // namespace Generators\n} // namespace Catch\n\n\n\n\nnamespace Catch {\n    IRegistryHub::~IRegistryHub() = default;\n    IMutableRegistryHub::~IMutableRegistryHub() = default;\n}\n\n\n\n#include <cassert>\n\nnamespace Catch {\n\n    ReporterConfig::ReporterConfig(\n        IConfig const* _fullConfig,\n        Detail::unique_ptr<IStream> _stream,\n        ColourMode colourMode,\n        std::map<std::string, std::string> customOptions ):\n        m_stream( CATCH_MOVE(_stream) ),\n        m_fullConfig( _fullConfig ),\n        m_colourMode( colourMode ),\n        m_customOptions( CATCH_MOVE( customOptions ) ) {}\n\n    Detail::unique_ptr<IStream> ReporterConfig::takeStream() && {\n        assert( m_stream );\n        return CATCH_MOVE( m_stream );\n    }\n    IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }\n    ColourMode ReporterConfig::colourMode() const { return m_colourMode; }\n\n    std::map<std::string, std::string> const&\n    ReporterConfig::customOptions() const {\n        return m_customOptions;\n    }\n\n    ReporterConfig::~ReporterConfig() = default;\n\n    AssertionStats::AssertionStats( AssertionResult const& _assertionResult,\n                                    std::vector<MessageInfo> const& _infoMessages,\n                                    Totals const& _totals )\n    :   assertionResult( _assertionResult ),\n        infoMessages( _infoMessages ),\n        totals( _totals )\n    {\n        if( assertionResult.hasMessage() ) {\n            // Copy message into messages list.\n            // !TBD This should have been done earlier, somewhere\n            MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() );\n            builder.m_info.message = static_cast<std::string>(assertionResult.getMessage());\n\n            infoMessages.push_back( CATCH_MOVE(builder.m_info) );\n        }\n    }\n\n    SectionStats::SectionStats(  SectionInfo&& _sectionInfo,\n                                 Counts const& _assertions,\n                                 double _durationInSeconds,\n                                 bool _missingAssertions )\n    :   sectionInfo( CATCH_MOVE(_sectionInfo) ),\n        assertions( _assertions ),\n        durationInSeconds( _durationInSeconds ),\n        missingAssertions( _missingAssertions )\n    {}\n\n\n    TestCaseStats::TestCaseStats(  TestCaseInfo const& _testInfo,\n                                   Totals const& _totals,\n                                   std::string&& _stdOut,\n                                   std::string&& _stdErr,\n                                   bool _aborting )\n    : testInfo( &_testInfo ),\n        totals( _totals ),\n        stdOut( CATCH_MOVE(_stdOut) ),\n        stdErr( CATCH_MOVE(_stdErr) ),\n        aborting( _aborting )\n    {}\n\n\n    TestRunStats::TestRunStats(   TestRunInfo const& _runInfo,\n                    Totals const& _totals,\n                    bool _aborting )\n    :   runInfo( _runInfo ),\n        totals( _totals ),\n        aborting( _aborting )\n    {}\n\n    IEventListener::~IEventListener() = default;\n\n} // end namespace Catch\n\n\n\n\nnamespace Catch {\n    IReporterFactory::~IReporterFactory() = default;\n    EventListenerFactory::~EventListenerFactory() = default;\n}\n\n\n\n\nnamespace Catch {\n    ITestCaseRegistry::~ITestCaseRegistry() = default;\n}\n\n\n\nnamespace Catch {\n\n    AssertionHandler::AssertionHandler\n        (   StringRef macroName,\n            SourceLineInfo const& lineInfo,\n            StringRef capturedExpression,\n            ResultDisposition::Flags resultDisposition )\n    :   m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition },\n        m_resultCapture( getResultCapture() )\n    {\n        m_resultCapture.notifyAssertionStarted( m_assertionInfo );\n    }\n\n    void AssertionHandler::handleExpr( ITransientExpression const& expr ) {\n        m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction );\n    }\n    void AssertionHandler::handleMessage(ResultWas::OfType resultType, std::string&& message) {\n        m_resultCapture.handleMessage( m_assertionInfo, resultType, CATCH_MOVE(message), m_reaction );\n    }\n\n    auto AssertionHandler::allowThrows() const -> bool {\n        return getCurrentContext().getConfig()->allowThrows();\n    }\n\n    void AssertionHandler::complete() {\n        m_completed = true;\n        if( m_reaction.shouldDebugBreak ) {\n\n            // If you find your debugger stopping you here then go one level up on the\n            // call-stack for the code that caused it (typically a failed assertion)\n\n            // (To go back to the test and change execution, jump over the throw, next)\n            CATCH_BREAK_INTO_DEBUGGER();\n        }\n        if (m_reaction.shouldThrow) {\n            throw_test_failure_exception();\n        }\n        if ( m_reaction.shouldSkip ) {\n            throw_test_skip_exception();\n        }\n    }\n\n    void AssertionHandler::handleUnexpectedInflightException() {\n        m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction );\n    }\n\n    void AssertionHandler::handleExceptionThrownAsExpected() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n    void AssertionHandler::handleExceptionNotThrownAsExpected() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n\n    void AssertionHandler::handleUnexpectedExceptionNotThrown() {\n        m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction );\n    }\n\n    void AssertionHandler::handleThrowingCallSkipped() {\n        m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction);\n    }\n\n    // This is the overload that takes a string and infers the Equals matcher from it\n    // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp\n    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str ) {\n        handleExceptionMatchExpr( handler, Matchers::Equals( str ) );\n    }\n\n} // namespace Catch\n\n\n\n\n#include <algorithm>\n\nnamespace Catch {\n    namespace Detail {\n\n        bool CaseInsensitiveLess::operator()( StringRef lhs,\n                                              StringRef rhs ) const {\n            return std::lexicographical_compare(\n                lhs.begin(), lhs.end(),\n                rhs.begin(), rhs.end(),\n                []( char l, char r ) { return toLower( l ) < toLower( r ); } );\n        }\n\n        bool\n        CaseInsensitiveEqualTo::operator()( StringRef lhs,\n                                            StringRef rhs ) const {\n            return std::equal(\n                lhs.begin(), lhs.end(),\n                rhs.begin(), rhs.end(),\n                []( char l, char r ) { return toLower( l ) == toLower( r ); } );\n        }\n\n    } // namespace Detail\n} // namespace Catch\n\n\n\n\n#include <algorithm>\n#include <ostream>\n\nnamespace {\n    bool isOptPrefix( char c ) {\n        return c == '-'\n#ifdef CATCH_PLATFORM_WINDOWS\n               || c == '/'\n#endif\n            ;\n    }\n\n    Catch::StringRef normaliseOpt( Catch::StringRef optName ) {\n        if ( optName[0] == '-'\n#if defined(CATCH_PLATFORM_WINDOWS)\n             || optName[0] == '/'\n#endif\n        ) {\n            return optName.substr( 1, optName.size() );\n        }\n\n        return optName;\n    }\n\n    static size_t find_first_separator(Catch::StringRef sr) {\n        auto is_separator = []( char c ) {\n            return c == ' ' || c == ':' || c == '=';\n        };\n        size_t pos = 0;\n        while (pos < sr.size()) {\n            if (is_separator(sr[pos])) { return pos; }\n            ++pos;\n        }\n\n        return Catch::StringRef::npos;\n    }\n\n} // namespace\n\nnamespace Catch {\n    namespace Clara {\n        namespace Detail {\n\n            void TokenStream::loadBuffer() {\n                m_tokenBuffer.clear();\n\n                // Skip any empty strings\n                while ( it != itEnd && it->empty() ) {\n                    ++it;\n                }\n\n                if ( it != itEnd ) {\n                    StringRef next = *it;\n                    if ( isOptPrefix( next[0] ) ) {\n                        auto delimiterPos = find_first_separator(next);\n                        if ( delimiterPos != StringRef::npos ) {\n                            m_tokenBuffer.push_back(\n                                { TokenType::Option,\n                                  next.substr( 0, delimiterPos ) } );\n                            m_tokenBuffer.push_back(\n                                { TokenType::Argument,\n                                  next.substr( delimiterPos + 1, next.size() ) } );\n                        } else {\n                            if ( next.size() > 1 && next[1] != '-' && next.size() > 2 ) {\n                                // Combined short args, e.g. \"-ab\" for \"-a -b\"\n                                for ( size_t i = 1; i < next.size(); ++i ) {\n                                    m_tokenBuffer.push_back(\n                                        { TokenType::Option,\n                                          next.substr( i, 1 ) } );\n                                }\n                            } else {\n                                m_tokenBuffer.push_back(\n                                    { TokenType::Option, next } );\n                            }\n                        }\n                    } else {\n                        m_tokenBuffer.push_back(\n                            { TokenType::Argument, next } );\n                    }\n                }\n            }\n\n            TokenStream::TokenStream( Args const& args ):\n                TokenStream( args.m_args.begin(), args.m_args.end() ) {}\n\n            TokenStream::TokenStream( Iterator it_, Iterator itEnd_ ):\n                it( it_ ), itEnd( itEnd_ ) {\n                loadBuffer();\n            }\n\n            TokenStream& TokenStream::operator++() {\n                if ( m_tokenBuffer.size() >= 2 ) {\n                    m_tokenBuffer.erase( m_tokenBuffer.begin() );\n                } else {\n                    if ( it != itEnd )\n                        ++it;\n                    loadBuffer();\n                }\n                return *this;\n            }\n\n            ParserResult convertInto( std::string const& source,\n                                      std::string& target ) {\n                target = source;\n                return ParserResult::ok( ParseResultType::Matched );\n            }\n\n            ParserResult convertInto( std::string const& source,\n                                      bool& target ) {\n                std::string srcLC = toLower( source );\n\n                if ( srcLC == \"y\" || srcLC == \"1\" || srcLC == \"true\" ||\n                     srcLC == \"yes\" || srcLC == \"on\" ) {\n                    target = true;\n                } else if ( srcLC == \"n\" || srcLC == \"0\" || srcLC == \"false\" ||\n                            srcLC == \"no\" || srcLC == \"off\" ) {\n                    target = false;\n                } else {\n                    return ParserResult::runtimeError(\n                        \"Expected a boolean value but did not recognise: '\" +\n                        source + '\\'' );\n                }\n                return ParserResult::ok( ParseResultType::Matched );\n            }\n\n            size_t ParserBase::cardinality() const { return 1; }\n\n            InternalParseResult ParserBase::parse( Args const& args ) const {\n                return parse( static_cast<std::string>(args.exeName()), TokenStream( args ) );\n            }\n\n            ParseState::ParseState( ParseResultType type,\n                                    TokenStream remainingTokens ):\n                m_type( type ), m_remainingTokens( CATCH_MOVE(remainingTokens) ) {}\n\n            ParserResult BoundFlagRef::setFlag( bool flag ) {\n                m_ref = flag;\n                return ParserResult::ok( ParseResultType::Matched );\n            }\n\n            ResultBase::~ResultBase() = default;\n\n            bool BoundRef::isContainer() const { return false; }\n\n            bool BoundRef::isFlag() const { return false; }\n\n            bool BoundFlagRefBase::isFlag() const { return true; }\n\n} // namespace Detail\n\n        Detail::InternalParseResult Arg::parse(std::string const&,\n                                               Detail::TokenStream tokens) const {\n            auto validationResult = validate();\n            if (!validationResult)\n                return Detail::InternalParseResult(validationResult);\n\n            auto token = *tokens;\n            if (token.type != Detail::TokenType::Argument)\n                return Detail::InternalParseResult::ok(Detail::ParseState(\n                    ParseResultType::NoMatch, CATCH_MOVE(tokens)));\n\n            assert(!m_ref->isFlag());\n            auto valueRef =\n                static_cast<Detail::BoundValueRefBase*>(m_ref.get());\n\n            auto result = valueRef->setValue(static_cast<std::string>(token.token));\n            if ( !result )\n                return Detail::InternalParseResult( result );\n            else\n                return Detail::InternalParseResult::ok(\n                    Detail::ParseState( ParseResultType::Matched,\n                                        CATCH_MOVE( ++tokens ) ) );\n        }\n\n        Opt::Opt(bool& ref) :\n            ParserRefImpl(std::make_shared<Detail::BoundFlagRef>(ref)) {}\n\n        Detail::HelpColumns Opt::getHelpColumns() const {\n            ReusableStringStream oss;\n            bool first = true;\n            for (auto const& opt : m_optNames) {\n                if (first)\n                    first = false;\n                else\n                    oss << \", \";\n                oss << opt;\n            }\n            if (!m_hint.empty())\n                oss << \" <\" << m_hint << '>';\n            return { oss.str(), m_description };\n        }\n\n        bool Opt::isMatch(StringRef optToken) const {\n            auto normalisedToken = normaliseOpt(optToken);\n            for (auto const& name : m_optNames) {\n                if (normaliseOpt(name) == normalisedToken)\n                    return true;\n            }\n            return false;\n        }\n\n        Detail::InternalParseResult Opt::parse(std::string const&,\n                                       Detail::TokenStream tokens) const {\n            auto validationResult = validate();\n            if (!validationResult)\n                return Detail::InternalParseResult(validationResult);\n\n            if (tokens &&\n                tokens->type == Detail::TokenType::Option) {\n                auto const& token = *tokens;\n                if (isMatch(token.token)) {\n                    if (m_ref->isFlag()) {\n                        auto flagRef =\n                            static_cast<Detail::BoundFlagRefBase*>(\n                                m_ref.get());\n                        auto result = flagRef->setFlag(true);\n                        if (!result)\n                            return Detail::InternalParseResult(result);\n                        if (result.value() ==\n                            ParseResultType::ShortCircuitAll)\n                            return Detail::InternalParseResult::ok(Detail::ParseState(\n                                result.value(), CATCH_MOVE(tokens)));\n                    } else {\n                        auto valueRef =\n                            static_cast<Detail::BoundValueRefBase*>(\n                                m_ref.get());\n                        ++tokens;\n                        if (!tokens)\n                            return Detail::InternalParseResult::runtimeError(\n                                \"Expected argument following \" +\n                                token.token);\n                        auto const& argToken = *tokens;\n                        if (argToken.type != Detail::TokenType::Argument)\n                            return Detail::InternalParseResult::runtimeError(\n                                \"Expected argument following \" +\n                                token.token);\n                        const auto result = valueRef->setValue(static_cast<std::string>(argToken.token));\n                        if (!result)\n                            return Detail::InternalParseResult(result);\n                        if (result.value() ==\n                            ParseResultType::ShortCircuitAll)\n                            return Detail::InternalParseResult::ok(Detail::ParseState(\n                                result.value(), CATCH_MOVE(tokens)));\n                    }\n                    return Detail::InternalParseResult::ok(Detail::ParseState(\n                        ParseResultType::Matched, CATCH_MOVE(++tokens)));\n                }\n            }\n            return Detail::InternalParseResult::ok(\n                Detail::ParseState(ParseResultType::NoMatch, CATCH_MOVE(tokens)));\n        }\n\n        Detail::Result Opt::validate() const {\n            if (m_optNames.empty())\n                return Detail::Result::logicError(\"No options supplied to Opt\");\n            for (auto const& name : m_optNames) {\n                if (name.empty())\n                    return Detail::Result::logicError(\n                        \"Option name cannot be empty\");\n#ifdef CATCH_PLATFORM_WINDOWS\n                if (name[0] != '-' && name[0] != '/')\n                    return Detail::Result::logicError(\n                        \"Option name must begin with '-' or '/'\");\n#else\n                if (name[0] != '-')\n                    return Detail::Result::logicError(\n                        \"Option name must begin with '-'\");\n#endif\n            }\n            return ParserRefImpl::validate();\n        }\n\n        ExeName::ExeName() :\n            m_name(std::make_shared<std::string>(\"<executable>\")) {}\n\n        ExeName::ExeName(std::string& ref) : ExeName() {\n            m_ref = std::make_shared<Detail::BoundValueRef<std::string>>(ref);\n        }\n\n        Detail::InternalParseResult\n            ExeName::parse(std::string const&,\n                           Detail::TokenStream tokens) const {\n            return Detail::InternalParseResult::ok(\n                Detail::ParseState(ParseResultType::NoMatch, CATCH_MOVE(tokens)));\n        }\n\n        ParserResult ExeName::set(std::string const& newName) {\n            auto lastSlash = newName.find_last_of(\"\\\\/\");\n            auto filename = (lastSlash == std::string::npos)\n                ? newName\n                : newName.substr(lastSlash + 1);\n\n            *m_name = filename;\n            if (m_ref)\n                return m_ref->setValue(filename);\n            else\n                return ParserResult::ok(ParseResultType::Matched);\n        }\n\n\n\n\n        Parser& Parser::operator|=( Parser const& other ) {\n            m_options.insert( m_options.end(),\n                              other.m_options.begin(),\n                              other.m_options.end() );\n            m_args.insert(\n                m_args.end(), other.m_args.begin(), other.m_args.end() );\n            return *this;\n        }\n\n        std::vector<Detail::HelpColumns> Parser::getHelpColumns() const {\n            std::vector<Detail::HelpColumns> cols;\n            cols.reserve( m_options.size() );\n            for ( auto const& o : m_options ) {\n                cols.push_back(o.getHelpColumns());\n            }\n            return cols;\n        }\n\n        void Parser::writeToStream( std::ostream& os ) const {\n            if ( !m_exeName.name().empty() ) {\n                os << \"usage:\\n\"\n                   << \"  \" << m_exeName.name() << ' ';\n                bool required = true, first = true;\n                for ( auto const& arg : m_args ) {\n                    if ( first )\n                        first = false;\n                    else\n                        os << ' ';\n                    if ( arg.isOptional() && required ) {\n                        os << '[';\n                        required = false;\n                    }\n                    os << '<' << arg.hint() << '>';\n                    if ( arg.cardinality() == 0 )\n                        os << \" ... \";\n                }\n                if ( !required )\n                    os << ']';\n                if ( !m_options.empty() )\n                    os << \" options\";\n                os << \"\\n\\nwhere options are:\\n\";\n            }\n\n            auto rows = getHelpColumns();\n            size_t consoleWidth = CATCH_CONFIG_CONSOLE_WIDTH;\n            size_t optWidth = 0;\n            for ( auto const& cols : rows )\n                optWidth = ( std::max )( optWidth, cols.left.size() + 2 );\n\n            optWidth = ( std::min )( optWidth, consoleWidth / 2 );\n\n            for ( auto& cols : rows ) {\n                auto row = TextFlow::Column( CATCH_MOVE(cols.left) )\n                               .width( optWidth )\n                               .indent( 2 ) +\n                           TextFlow::Spacer( 4 ) +\n                           TextFlow::Column( static_cast<std::string>(cols.descriptions) )\n                               .width( consoleWidth - 7 - optWidth );\n                os << row << '\\n';\n            }\n        }\n\n        Detail::Result Parser::validate() const {\n            for ( auto const& opt : m_options ) {\n                auto result = opt.validate();\n                if ( !result )\n                    return result;\n            }\n            for ( auto const& arg : m_args ) {\n                auto result = arg.validate();\n                if ( !result )\n                    return result;\n            }\n            return Detail::Result::ok();\n        }\n\n        Detail::InternalParseResult\n        Parser::parse( std::string const& exeName,\n                       Detail::TokenStream tokens ) const {\n\n            struct ParserInfo {\n                ParserBase const* parser = nullptr;\n                size_t count = 0;\n            };\n            std::vector<ParserInfo> parseInfos;\n            parseInfos.reserve( m_options.size() + m_args.size() );\n            for ( auto const& opt : m_options ) {\n                parseInfos.push_back( { &opt, 0 } );\n            }\n            for ( auto const& arg : m_args ) {\n                parseInfos.push_back( { &arg, 0 } );\n            }\n\n            m_exeName.set( exeName );\n\n            auto result = Detail::InternalParseResult::ok(\n                Detail::ParseState( ParseResultType::NoMatch, CATCH_MOVE(tokens) ) );\n            while ( result.value().remainingTokens() ) {\n                bool tokenParsed = false;\n\n                for ( auto& parseInfo : parseInfos ) {\n                    if ( parseInfo.parser->cardinality() == 0 ||\n                         parseInfo.count < parseInfo.parser->cardinality() ) {\n                        result = parseInfo.parser->parse(\n                            exeName, CATCH_MOVE(result).value().remainingTokens() );\n                        if ( !result )\n                            return result;\n                        if ( result.value().type() !=\n                             ParseResultType::NoMatch ) {\n                            tokenParsed = true;\n                            ++parseInfo.count;\n                            break;\n                        }\n                    }\n                }\n\n                if ( result.value().type() == ParseResultType::ShortCircuitAll )\n                    return result;\n                if ( !tokenParsed )\n                    return Detail::InternalParseResult::runtimeError(\n                        \"Unrecognised token: \" +\n                        result.value().remainingTokens()->token );\n            }\n            // !TBD Check missing required options\n            return result;\n        }\n\n        Args::Args(int argc, char const* const* argv) :\n            m_exeName(argv[0]), m_args(argv + 1, argv + argc) {}\n\n        Args::Args(std::initializer_list<StringRef> args) :\n            m_exeName(*args.begin()),\n            m_args(args.begin() + 1, args.end()) {}\n\n\n        Help::Help( bool& showHelpFlag ):\n            Opt( [&]( bool flag ) {\n                showHelpFlag = flag;\n                return ParserResult::ok( ParseResultType::ShortCircuitAll );\n            } ) {\n            static_cast<Opt&> ( *this )(\n                \"display usage information\" )[\"-?\"][\"-h\"][\"--help\"]\n                .optional();\n        }\n\n    } // namespace Clara\n} // namespace Catch\n\n\n\n\n#include <fstream>\n#include <string>\n\nnamespace Catch {\n\n    Clara::Parser makeCommandLineParser( ConfigData& config ) {\n\n        using namespace Clara;\n\n        auto const setWarning = [&]( std::string const& warning ) {\n            if ( warning == \"NoAssertions\" ) {\n                config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::NoAssertions);\n                return ParserResult::ok( ParseResultType::Matched );\n            } else if ( warning == \"UnmatchedTestSpec\" ) {\n                config.warnings = static_cast<WarnAbout::What>(config.warnings | WarnAbout::UnmatchedTestSpec);\n                return ParserResult::ok( ParseResultType::Matched );\n            }\n\n            return ParserResult ::runtimeError(\n                \"Unrecognised warning option: '\" + warning + '\\'' );\n        };\n        auto const loadTestNamesFromFile = [&]( std::string const& filename ) {\n                std::ifstream f( filename.c_str() );\n                if( !f.is_open() )\n                    return ParserResult::runtimeError( \"Unable to load input file: '\" + filename + '\\'' );\n\n                std::string line;\n                while( std::getline( f, line ) ) {\n                    line = trim(line);\n                    if( !line.empty() && !startsWith( line, '#' ) ) {\n                        if( !startsWith( line, '\"' ) )\n                            line = '\"' + CATCH_MOVE(line) + '\"';\n                        config.testsOrTags.push_back( line );\n                        config.testsOrTags.emplace_back( \",\" );\n                    }\n                }\n                //Remove comma in the end\n                if(!config.testsOrTags.empty())\n                    config.testsOrTags.erase( config.testsOrTags.end()-1 );\n\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setTestOrder = [&]( std::string const& order ) {\n                if( startsWith( \"declared\", order ) )\n                    config.runOrder = TestRunOrder::Declared;\n                else if( startsWith( \"lexical\", order ) )\n                    config.runOrder = TestRunOrder::LexicographicallySorted;\n                else if( startsWith( \"random\", order ) )\n                    config.runOrder = TestRunOrder::Randomized;\n                else\n                    return ParserResult::runtimeError( \"Unrecognised ordering: '\" + order + '\\'' );\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setRngSeed = [&]( std::string const& seed ) {\n                if( seed == \"time\" ) {\n                    config.rngSeed = generateRandomSeed(GenerateFrom::Time);\n                    return ParserResult::ok(ParseResultType::Matched);\n                } else if (seed == \"random-device\") {\n                    config.rngSeed = generateRandomSeed(GenerateFrom::RandomDevice);\n                    return ParserResult::ok(ParseResultType::Matched);\n                }\n\n                // TODO: ideally we should be parsing uint32_t directly\n                //       fix this later when we add new parse overload\n                auto parsedSeed = parseUInt( seed, 0 );\n                if ( !parsedSeed ) {\n                    return ParserResult::runtimeError( \"Could not parse '\" + seed + \"' as seed\" );\n                }\n                config.rngSeed = *parsedSeed;\n                return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setDefaultColourMode = [&]( std::string const& colourMode ) {\n            Optional<ColourMode> maybeMode = Catch::Detail::stringToColourMode(toLower( colourMode ));\n            if ( !maybeMode ) {\n                return ParserResult::runtimeError(\n                    \"colour mode must be one of: default, ansi, win32, \"\n                    \"or none. '\" +\n                    colourMode + \"' is not recognised\" );\n            }\n            auto mode = *maybeMode;\n            if ( !isColourImplAvailable( mode ) ) {\n                return ParserResult::runtimeError(\n                    \"colour mode '\" + colourMode +\n                    \"' is not supported in this binary\" );\n            }\n            config.defaultColourMode = mode;\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n        auto const setWaitForKeypress = [&]( std::string const& keypress ) {\n                auto keypressLc = toLower( keypress );\n                if (keypressLc == \"never\")\n                    config.waitForKeypress = WaitForKeypress::Never;\n                else if( keypressLc == \"start\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeStart;\n                else if( keypressLc == \"exit\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeExit;\n                else if( keypressLc == \"both\" )\n                    config.waitForKeypress = WaitForKeypress::BeforeStartAndExit;\n                else\n                    return ParserResult::runtimeError( \"keypress argument must be one of: never, start, exit or both. '\" + keypress + \"' not recognised\" );\n            return ParserResult::ok( ParseResultType::Matched );\n            };\n        auto const setVerbosity = [&]( std::string const& verbosity ) {\n            auto lcVerbosity = toLower( verbosity );\n            if( lcVerbosity == \"quiet\" )\n                config.verbosity = Verbosity::Quiet;\n            else if( lcVerbosity == \"normal\" )\n                config.verbosity = Verbosity::Normal;\n            else if( lcVerbosity == \"high\" )\n                config.verbosity = Verbosity::High;\n            else\n                return ParserResult::runtimeError( \"Unrecognised verbosity, '\" + verbosity + '\\'' );\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n        auto const setReporter = [&]( std::string const& userReporterSpec ) {\n            if ( userReporterSpec.empty() ) {\n                return ParserResult::runtimeError( \"Received empty reporter spec.\" );\n            }\n\n            Optional<ReporterSpec> parsed =\n                parseReporterSpec( userReporterSpec );\n            if ( !parsed ) {\n                return ParserResult::runtimeError(\n                    \"Could not parse reporter spec '\" + userReporterSpec +\n                    \"'\" );\n            }\n\n            auto const& reporterSpec = *parsed;\n\n            auto const& factories =\n                getRegistryHub().getReporterRegistry().getFactories();\n            auto result = factories.find( reporterSpec.name() );\n\n            if ( result == factories.end() ) {\n                return ParserResult::runtimeError(\n                    \"Unrecognized reporter, '\" + reporterSpec.name() +\n                    \"'. Check available with --list-reporters\" );\n            }\n\n\n            const bool hadOutputFile = reporterSpec.outputFile().some();\n            config.reporterSpecifications.push_back( CATCH_MOVE( *parsed ) );\n            // It would be enough to check this only once at the very end, but\n            // there is  not a place where we could call this check, so do it\n            // every time it could fail. For valid inputs, this is still called\n            // at most once.\n            if (!hadOutputFile) {\n                int n_reporters_without_file = 0;\n                for (auto const& spec : config.reporterSpecifications) {\n                    if (spec.outputFile().none()) {\n                        n_reporters_without_file++;\n                    }\n                }\n                if (n_reporters_without_file > 1) {\n                    return ParserResult::runtimeError( \"Only one reporter may have unspecified output file.\" );\n                }\n            }\n\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n        auto const setShardCount = [&]( std::string const& shardCount ) {\n            auto parsedCount = parseUInt( shardCount );\n            if ( !parsedCount ) {\n                return ParserResult::runtimeError(\n                    \"Could not parse '\" + shardCount + \"' as shard count\" );\n            }\n            if ( *parsedCount == 0 ) {\n                return ParserResult::runtimeError(\n                    \"Shard count must be positive\" );\n            }\n            config.shardCount = *parsedCount;\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n\n        auto const setShardIndex = [&](std::string const& shardIndex) {\n            auto parsedIndex = parseUInt( shardIndex );\n            if ( !parsedIndex ) {\n                return ParserResult::runtimeError(\n                    \"Could not parse '\" + shardIndex + \"' as shard index\" );\n            }\n            config.shardIndex = *parsedIndex;\n            return ParserResult::ok( ParseResultType::Matched );\n        };\n\n        auto cli\n            = ExeName( config.processName )\n            | Help( config.showHelp )\n            | Opt( config.showSuccessfulTests )\n                [\"-s\"][\"--success\"]\n                ( \"include successful tests in output\" )\n            | Opt( config.shouldDebugBreak )\n                [\"-b\"][\"--break\"]\n                ( \"break into debugger on failure\" )\n            | Opt( config.noThrow )\n                [\"-e\"][\"--nothrow\"]\n                ( \"skip exception tests\" )\n            | Opt( config.showInvisibles )\n                [\"-i\"][\"--invisibles\"]\n                ( \"show invisibles (tabs, newlines)\" )\n            | Opt( config.defaultOutputFilename, \"filename\" )\n                [\"-o\"][\"--out\"]\n                ( \"default output filename\" )\n            | Opt( accept_many, setReporter, \"name[::key=value]*\" )\n                [\"-r\"][\"--reporter\"]\n                ( \"reporter to use (defaults to console)\" )\n            | Opt( config.name, \"name\" )\n                [\"-n\"][\"--name\"]\n                ( \"suite name\" )\n            | Opt( [&]( bool ){ config.abortAfter = 1; } )\n                [\"-a\"][\"--abort\"]\n                ( \"abort at first failure\" )\n            | Opt( [&]( int x ){ config.abortAfter = x; }, \"no. failures\" )\n                [\"-x\"][\"--abortx\"]\n                ( \"abort after x failures\" )\n            | Opt( accept_many, setWarning, \"warning name\" )\n                [\"-w\"][\"--warn\"]\n                ( \"enable warnings\" )\n            | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, \"yes|no\" )\n                [\"-d\"][\"--durations\"]\n                ( \"show test durations\" )\n            | Opt( config.minDuration, \"seconds\" )\n                [\"-D\"][\"--min-duration\"]\n                ( \"show test durations for tests taking at least the given number of seconds\" )\n            | Opt( loadTestNamesFromFile, \"filename\" )\n                [\"-f\"][\"--input-file\"]\n                ( \"load test names to run from a file\" )\n            | Opt( config.filenamesAsTags )\n                [\"-#\"][\"--filenames-as-tags\"]\n                ( \"adds a tag for the filename\" )\n            | Opt( config.sectionsToRun, \"section name\" )\n                [\"-c\"][\"--section\"]\n                ( \"specify section to run\" )\n            | Opt( setVerbosity, \"quiet|normal|high\" )\n                [\"-v\"][\"--verbosity\"]\n                ( \"set output verbosity\" )\n            | Opt( config.listTests )\n                [\"--list-tests\"]\n                ( \"list all/matching test cases\" )\n            | Opt( config.listTags )\n                [\"--list-tags\"]\n                ( \"list all/matching tags\" )\n            | Opt( config.listReporters )\n                [\"--list-reporters\"]\n                ( \"list all available reporters\" )\n            | Opt( config.listListeners )\n                [\"--list-listeners\"]\n                ( \"list all listeners\" )\n            | Opt( setTestOrder, \"decl|lex|rand\" )\n                [\"--order\"]\n                ( \"test case order (defaults to decl)\" )\n            | Opt( setRngSeed, \"'time'|'random-device'|number\" )\n                [\"--rng-seed\"]\n                ( \"set a specific seed for random numbers\" )\n            | Opt( setDefaultColourMode, \"ansi|win32|none|default\" )\n                [\"--colour-mode\"]\n                ( \"what color mode should be used as default\" )\n            | Opt( config.libIdentify )\n                [\"--libidentify\"]\n                ( \"report name and version according to libidentify standard\" )\n            | Opt( setWaitForKeypress, \"never|start|exit|both\" )\n                [\"--wait-for-keypress\"]\n                ( \"waits for a keypress before exiting\" )\n            | Opt( config.skipBenchmarks)\n                [\"--skip-benchmarks\"]\n                ( \"disable running benchmarks\")\n            | Opt( config.benchmarkSamples, \"samples\" )\n                [\"--benchmark-samples\"]\n                ( \"number of samples to collect (default: 100)\" )\n            | Opt( config.benchmarkResamples, \"resamples\" )\n                [\"--benchmark-resamples\"]\n                ( \"number of resamples for the bootstrap (default: 100000)\" )\n            | Opt( config.benchmarkConfidenceInterval, \"confidence interval\" )\n                [\"--benchmark-confidence-interval\"]\n                ( \"confidence interval for the bootstrap (between 0 and 1, default: 0.95)\" )\n            | Opt( config.benchmarkNoAnalysis )\n                [\"--benchmark-no-analysis\"]\n                ( \"perform only measurements; do not perform any analysis\" )\n            | Opt( config.benchmarkWarmupTime, \"benchmarkWarmupTime\" )\n                [\"--benchmark-warmup-time\"]\n                ( \"amount of time in milliseconds spent on warming up each test (default: 100)\" )\n            | Opt( setShardCount, \"shard count\" )\n                [\"--shard-count\"]\n                ( \"split the tests to execute into this many groups\" )\n            | Opt( setShardIndex, \"shard index\" )\n                [\"--shard-index\"]\n                ( \"index of the group of tests to execute (see --shard-count)\" )\n            | Opt( config.allowZeroTests )\n                [\"--allow-running-no-tests\"]\n                ( \"Treat 'No tests run' as a success\" )\n            | Arg( config.testsOrTags, \"test name|pattern|tags\" )\n                ( \"which test or tests to use\" );\n\n        return cli;\n    }\n\n} // end namespace Catch\n\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\n\n\n#include <cassert>\n#include <ostream>\n#include <utility>\n\nnamespace Catch {\n\n    ColourImpl::~ColourImpl() = default;\n\n    ColourImpl::ColourGuard ColourImpl::guardColour( Colour::Code colourCode ) {\n        return ColourGuard(colourCode, this );\n    }\n\n    void ColourImpl::ColourGuard::engageImpl( std::ostream& stream ) {\n        assert( &stream == &m_colourImpl->m_stream->stream() &&\n                \"Engaging colour guard for different stream than used by the \"\n                \"parent colour implementation\" );\n        static_cast<void>( stream );\n\n        m_engaged = true;\n        m_colourImpl->use( m_code );\n    }\n\n    ColourImpl::ColourGuard::ColourGuard( Colour::Code code,\n                                          ColourImpl const* colour ):\n        m_colourImpl( colour ), m_code( code ) {\n    }\n    ColourImpl::ColourGuard::ColourGuard( ColourGuard&& rhs ) noexcept:\n        m_colourImpl( rhs.m_colourImpl ),\n        m_code( rhs.m_code ),\n        m_engaged( rhs.m_engaged ) {\n        rhs.m_engaged = false;\n    }\n    ColourImpl::ColourGuard&\n    ColourImpl::ColourGuard::operator=( ColourGuard&& rhs ) noexcept {\n        using std::swap;\n        swap( m_colourImpl, rhs.m_colourImpl );\n        swap( m_code, rhs.m_code );\n        swap( m_engaged, rhs.m_engaged );\n\n        return *this;\n    }\n    ColourImpl::ColourGuard::~ColourGuard() {\n        if ( m_engaged ) {\n            m_colourImpl->use( Colour::None );\n        }\n    }\n\n    ColourImpl::ColourGuard&\n    ColourImpl::ColourGuard::engage( std::ostream& stream ) & {\n        engageImpl( stream );\n        return *this;\n    }\n\n    ColourImpl::ColourGuard&&\n    ColourImpl::ColourGuard::engage( std::ostream& stream ) && {\n        engageImpl( stream );\n        return CATCH_MOVE(*this);\n    }\n\n    namespace {\n        //! A do-nothing implementation of colour, used as fallback for unknown\n        //! platforms, and when the user asks to deactivate all colours.\n        class NoColourImpl final : public ColourImpl {\n        public:\n            NoColourImpl( IStream* stream ): ColourImpl( stream ) {}\n\n        private:\n            void use( Colour::Code ) const override {}\n        };\n    } // namespace\n\n\n} // namespace Catch\n\n\n#if defined ( CATCH_CONFIG_COLOUR_WIN32 ) /////////////////////////////////////////\n\nnamespace Catch {\nnamespace {\n\n    class Win32ColourImpl final : public ColourImpl {\n    public:\n        Win32ColourImpl(IStream* stream):\n            ColourImpl(stream) {\n            CONSOLE_SCREEN_BUFFER_INFO csbiInfo;\n            GetConsoleScreenBufferInfo( GetStdHandle( STD_OUTPUT_HANDLE ),\n                                        &csbiInfo );\n            originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY );\n            originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY );\n        }\n\n        static bool useImplementationForStream(IStream const& stream) {\n            // Win32 text colour APIs can only be used on console streams\n            // We cannot check that the output hasn't been redirected,\n            // so we just check that the original stream is console stream.\n            return stream.isConsole();\n        }\n\n    private:\n        void use( Colour::Code _colourCode ) const override {\n            switch( _colourCode ) {\n                case Colour::None:      return setTextAttribute( originalForegroundAttributes );\n                case Colour::White:     return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );\n                case Colour::Red:       return setTextAttribute( FOREGROUND_RED );\n                case Colour::Green:     return setTextAttribute( FOREGROUND_GREEN );\n                case Colour::Blue:      return setTextAttribute( FOREGROUND_BLUE );\n                case Colour::Cyan:      return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN );\n                case Colour::Yellow:    return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN );\n                case Colour::Grey:      return setTextAttribute( 0 );\n\n                case Colour::LightGrey:     return setTextAttribute( FOREGROUND_INTENSITY );\n                case Colour::BrightRed:     return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED );\n                case Colour::BrightGreen:   return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN );\n                case Colour::BrightWhite:   return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE );\n                case Colour::BrightYellow:  return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN );\n\n                case Colour::Bright: CATCH_INTERNAL_ERROR( \"not a colour\" );\n\n                default:\n                    CATCH_ERROR( \"Unknown colour requested\" );\n            }\n        }\n\n        void setTextAttribute( WORD _textAttribute ) const {\n            SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ),\n                                     _textAttribute |\n                                         originalBackgroundAttributes );\n        }\n        WORD originalForegroundAttributes;\n        WORD originalBackgroundAttributes;\n    };\n\n} // end anon namespace\n} // end namespace Catch\n\n#endif // Windows/ ANSI/ None\n\n\n#if defined( CATCH_PLATFORM_LINUX ) || defined( CATCH_PLATFORM_MAC )\n#    define CATCH_INTERNAL_HAS_ISATTY\n#    include <unistd.h>\n#endif\n\nnamespace Catch {\nnamespace {\n\n    class ANSIColourImpl final : public ColourImpl {\n    public:\n        ANSIColourImpl( IStream* stream ): ColourImpl( stream ) {}\n\n        static bool useImplementationForStream(IStream const& stream) {\n            // This is kinda messy due to trying to support a bunch of\n            // different platforms at once.\n            // The basic idea is that if we are asked to do autodetection (as\n            // opposed to being told to use posixy colours outright), then we\n            // only want to use the colours if we are writing to console.\n            // However, console might be redirected, so we make an attempt at\n            // checking for that on platforms where we know how to do that.\n            bool useColour = stream.isConsole();\n#if defined( CATCH_INTERNAL_HAS_ISATTY ) && \\\n    !( defined( __DJGPP__ ) && defined( __STRICT_ANSI__ ) )\n            ErrnoGuard _; // for isatty\n            useColour = useColour && isatty( STDOUT_FILENO );\n#    endif\n#    if defined( CATCH_PLATFORM_MAC ) || defined( CATCH_PLATFORM_IPHONE )\n            useColour = useColour && !isDebuggerActive();\n#    endif\n\n            return useColour;\n        }\n\n    private:\n        void use( Colour::Code _colourCode ) const override {\n            auto setColour = [&out =\n                                  m_stream->stream()]( char const* escapeCode ) {\n                // The escape sequence must be flushed to console, otherwise\n                // if stdin and stderr are intermixed, we'd get accidentally\n                // coloured output.\n                out << '\\033' << escapeCode << std::flush;\n            };\n            switch( _colourCode ) {\n                case Colour::None:\n                case Colour::White:     return setColour( \"[0m\" );\n                case Colour::Red:       return setColour( \"[0;31m\" );\n                case Colour::Green:     return setColour( \"[0;32m\" );\n                case Colour::Blue:      return setColour( \"[0;34m\" );\n                case Colour::Cyan:      return setColour( \"[0;36m\" );\n                case Colour::Yellow:    return setColour( \"[0;33m\" );\n                case Colour::Grey:      return setColour( \"[1;30m\" );\n\n                case Colour::LightGrey:     return setColour( \"[0;37m\" );\n                case Colour::BrightRed:     return setColour( \"[1;31m\" );\n                case Colour::BrightGreen:   return setColour( \"[1;32m\" );\n                case Colour::BrightWhite:   return setColour( \"[1;37m\" );\n                case Colour::BrightYellow:  return setColour( \"[1;33m\" );\n\n                case Colour::Bright: CATCH_INTERNAL_ERROR( \"not a colour\" );\n                default: CATCH_INTERNAL_ERROR( \"Unknown colour requested\" );\n            }\n        }\n    };\n\n} // end anon namespace\n} // end namespace Catch\n\nnamespace Catch {\n\n    Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode colourSelection,\n                                                   IStream* stream ) {\n#if defined( CATCH_CONFIG_COLOUR_WIN32 )\n        if ( colourSelection == ColourMode::Win32 ) {\n            return Detail::make_unique<Win32ColourImpl>( stream );\n        }\n#endif\n        if ( colourSelection == ColourMode::ANSI ) {\n            return Detail::make_unique<ANSIColourImpl>( stream );\n        }\n        if ( colourSelection == ColourMode::None ) {\n            return Detail::make_unique<NoColourImpl>( stream );\n        }\n\n        if ( colourSelection == ColourMode::PlatformDefault) {\n#if defined( CATCH_CONFIG_COLOUR_WIN32 )\n            if ( Win32ColourImpl::useImplementationForStream( *stream ) ) {\n                return Detail::make_unique<Win32ColourImpl>( stream );\n            }\n#endif\n            if ( ANSIColourImpl::useImplementationForStream( *stream ) ) {\n                return Detail::make_unique<ANSIColourImpl>( stream );\n            }\n            return Detail::make_unique<NoColourImpl>( stream );\n        }\n\n        CATCH_ERROR( \"Could not create colour impl for selection \" << static_cast<int>(colourSelection) );\n    }\n\n    bool isColourImplAvailable( ColourMode colourSelection ) {\n        switch ( colourSelection ) {\n#if defined( CATCH_CONFIG_COLOUR_WIN32 )\n        case ColourMode::Win32:\n#endif\n        case ColourMode::ANSI:\n        case ColourMode::None:\n        case ColourMode::PlatformDefault:\n            return true;\n        default:\n            return false;\n        }\n    }\n\n\n} // end namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n\n\n\n\nnamespace Catch {\n\n    Context* Context::currentContext = nullptr;\n\n    void cleanUpContext() {\n        delete Context::currentContext;\n        Context::currentContext = nullptr;\n    }\n    void Context::createContext() {\n        currentContext = new Context();\n    }\n\n    Context& getCurrentMutableContext() {\n        if ( !Context::currentContext ) { Context::createContext(); }\n        // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn)\n        return *Context::currentContext;\n    }\n\n    SimplePcg32& sharedRng() {\n        static SimplePcg32 s_rng;\n        return s_rng;\n    }\n\n}\n\n\n\n\n\n#include <ostream>\n\n#if defined(CATCH_CONFIG_ANDROID_LOGWRITE)\n#include <android/log.h>\n\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            __android_log_write( ANDROID_LOG_DEBUG, \"Catch\", text.c_str() );\n        }\n    }\n\n#elif defined(CATCH_PLATFORM_WINDOWS)\n\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            ::OutputDebugStringA( text.c_str() );\n        }\n    }\n\n#else\n\n    namespace Catch {\n        void writeToDebugConsole( std::string const& text ) {\n            // !TBD: Need a version for Mac/ XCode and other IDEs\n            Catch::cout() << text;\n        }\n    }\n\n#endif // Platform\n\n\n\n#if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE)\n\n#  include <cassert>\n#  include <sys/types.h>\n#  include <unistd.h>\n#  include <cstddef>\n#  include <ostream>\n\n#ifdef __apple_build_version__\n    // These headers will only compile with AppleClang (XCode)\n    // For other compilers (Clang, GCC, ... ) we need to exclude them\n#  include <sys/sysctl.h>\n#endif\n\n    namespace Catch {\n        #ifdef __apple_build_version__\n        // The following function is taken directly from the following technical note:\n        // https://developer.apple.com/library/archive/qa/qa1361/_index.html\n\n        // Returns true if the current process is being debugged (either\n        // running under the debugger or has a debugger attached post facto).\n        bool isDebuggerActive(){\n            int                 mib[4];\n            struct kinfo_proc   info;\n            std::size_t         size;\n\n            // Initialize the flags so that, if sysctl fails for some bizarre\n            // reason, we get a predictable result.\n\n            info.kp_proc.p_flag = 0;\n\n            // Initialize mib, which tells sysctl the info we want, in this case\n            // we're looking for information about a specific process ID.\n\n            mib[0] = CTL_KERN;\n            mib[1] = KERN_PROC;\n            mib[2] = KERN_PROC_PID;\n            mib[3] = getpid();\n\n            // Call sysctl.\n\n            size = sizeof(info);\n            if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) {\n                Catch::cerr() << \"\\n** Call to sysctl failed - unable to determine if debugger is active **\\n\\n\" << std::flush;\n                return false;\n            }\n\n            // We're being debugged if the P_TRACED flag is set.\n\n            return ( (info.kp_proc.p_flag & P_TRACED) != 0 );\n        }\n        #else\n        bool isDebuggerActive() {\n            // We need to find another way to determine this for non-appleclang compilers on macOS\n            return false;\n        }\n        #endif\n    } // namespace Catch\n\n#elif defined(CATCH_PLATFORM_LINUX)\n    #include <fstream>\n    #include <string>\n\n    namespace Catch{\n        // The standard POSIX way of detecting a debugger is to attempt to\n        // ptrace() the process, but this needs to be done from a child and not\n        // this process itself to still allow attaching to this process later\n        // if wanted, so is rather heavy. Under Linux we have the PID of the\n        // \"debugger\" (which doesn't need to be gdb, of course, it could also\n        // be strace, for example) in /proc/$PID/status, so just get it from\n        // there instead.\n        bool isDebuggerActive(){\n            // Libstdc++ has a bug, where std::ifstream sets errno to 0\n            // This way our users can properly assert over errno values\n            ErrnoGuard guard;\n            std::ifstream in(\"/proc/self/status\");\n            for( std::string line; std::getline(in, line); ) {\n                static const int PREFIX_LEN = 11;\n                if( line.compare(0, PREFIX_LEN, \"TracerPid:\\t\") == 0 ) {\n                    // We're traced if the PID is not 0 and no other PID starts\n                    // with 0 digit, so it's enough to check for just a single\n                    // character.\n                    return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0';\n                }\n            }\n\n            return false;\n        }\n    } // namespace Catch\n#elif defined(_MSC_VER)\n    extern \"C\" __declspec(dllimport) int __stdcall IsDebuggerPresent();\n    namespace Catch {\n        bool isDebuggerActive() {\n            return IsDebuggerPresent() != 0;\n        }\n    }\n#elif defined(__MINGW32__)\n    extern \"C\" __declspec(dllimport) int __stdcall IsDebuggerPresent();\n    namespace Catch {\n        bool isDebuggerActive() {\n            return IsDebuggerPresent() != 0;\n        }\n    }\n#else\n    namespace Catch {\n       bool isDebuggerActive() { return false; }\n    }\n#endif // Platform\n\n\n\n\nnamespace Catch {\n\n    void ITransientExpression::streamReconstructedExpression(\n        std::ostream& os ) const {\n        // We can't make this function pure virtual to keep ITransientExpression\n        // constexpr, so we write error message instead\n        os << \"Some class derived from ITransientExpression without overriding streamReconstructedExpression\";\n    }\n\n    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) {\n        if( lhs.size() + rhs.size() < 40 &&\n                lhs.find('\\n') == std::string::npos &&\n                rhs.find('\\n') == std::string::npos )\n            os << lhs << ' ' << op << ' ' << rhs;\n        else\n            os << lhs << '\\n' << op << '\\n' << rhs;\n    }\n}\n\n\n\n#include <stdexcept>\n\n\nnamespace Catch {\n#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER)\n    [[noreturn]]\n    void throw_exception(std::exception const& e) {\n        Catch::cerr() << \"Catch will terminate because it needed to throw an exception.\\n\"\n                      << \"The message was: \" << e.what() << '\\n';\n        std::terminate();\n    }\n#endif\n\n    [[noreturn]]\n    void throw_logic_error(std::string const& msg) {\n        throw_exception(std::logic_error(msg));\n    }\n\n    [[noreturn]]\n    void throw_domain_error(std::string const& msg) {\n        throw_exception(std::domain_error(msg));\n    }\n\n    [[noreturn]]\n    void throw_runtime_error(std::string const& msg) {\n        throw_exception(std::runtime_error(msg));\n    }\n\n\n\n} // namespace Catch;\n\n\n\n#include <cassert>\n\nnamespace Catch {\n\n    IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() = default;\n\n    namespace Detail {\n\n        namespace {\n            // Extracts the actual name part of an enum instance\n            // In other words, it returns the Blue part of Bikeshed::Colour::Blue\n            StringRef extractInstanceName(StringRef enumInstance) {\n                // Find last occurrence of \":\"\n                size_t name_start = enumInstance.size();\n                while (name_start > 0 && enumInstance[name_start - 1] != ':') {\n                    --name_start;\n                }\n                return enumInstance.substr(name_start, enumInstance.size() - name_start);\n            }\n        }\n\n        std::vector<StringRef> parseEnums( StringRef enums ) {\n            auto enumValues = splitStringRef( enums, ',' );\n            std::vector<StringRef> parsed;\n            parsed.reserve( enumValues.size() );\n            for( auto const& enumValue : enumValues ) {\n                parsed.push_back(trim(extractInstanceName(enumValue)));\n            }\n            return parsed;\n        }\n\n        EnumInfo::~EnumInfo() = default;\n\n        StringRef EnumInfo::lookup( int value ) const {\n            for( auto const& valueToName : m_values ) {\n                if( valueToName.first == value )\n                    return valueToName.second;\n            }\n            return \"{** unexpected enum value **}\"_sr;\n        }\n\n        Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {\n            auto enumInfo = Catch::Detail::make_unique<EnumInfo>();\n            enumInfo->m_name = enumName;\n            enumInfo->m_values.reserve( values.size() );\n\n            const auto valueNames = Catch::Detail::parseEnums( allValueNames );\n            assert( valueNames.size() == values.size() );\n            std::size_t i = 0;\n            for( auto value : values )\n                enumInfo->m_values.emplace_back(value, valueNames[i++]);\n\n            return enumInfo;\n        }\n\n        EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values ) {\n            m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values));\n            return *m_enumInfos.back();\n        }\n\n    } // Detail\n} // Catch\n\n\n\n\n\n#include <cerrno>\n\nnamespace Catch {\n        ErrnoGuard::ErrnoGuard():m_oldErrno(errno){}\n        ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; }\n}\n\n\n\n#include <exception>\n\nnamespace Catch {\n\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    namespace {\n        static std::string tryTranslators(\n            std::vector<\n                Detail::unique_ptr<IExceptionTranslator const>> const& translators ) {\n            if ( translators.empty() ) {\n                std::rethrow_exception( std::current_exception() );\n            } else {\n                return translators[0]->translate( translators.begin() + 1,\n                                                  translators.end() );\n            }\n        }\n\n    }\n#endif //!defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n\n    ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() = default;\n\n    void ExceptionTranslatorRegistry::registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) {\n        m_translators.push_back( CATCH_MOVE( translator ) );\n    }\n\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    std::string ExceptionTranslatorRegistry::translateActiveException() const {\n        // Compiling a mixed mode project with MSVC means that CLR\n        // exceptions will be caught in (...) as well. However, these do\n        // do not fill-in std::current_exception and thus lead to crash\n        // when attempting rethrow.\n        // /EHa switch also causes structured exceptions to be caught\n        // here, but they fill-in current_exception properly, so\n        // at worst the output should be a little weird, instead of\n        // causing a crash.\n        if ( std::current_exception() == nullptr ) {\n            return \"Non C++ exception. Possibly a CLR exception.\";\n        }\n\n        // First we try user-registered translators. If none of them can\n        // handle the exception, it will be rethrown handled by our defaults.\n        try {\n            return tryTranslators(m_translators);\n        }\n        // To avoid having to handle TFE explicitly everywhere, we just\n        // rethrow it so that it goes back up the caller.\n        catch( TestFailureException& ) {\n            std::rethrow_exception(std::current_exception());\n        }\n        catch( TestSkipException& ) {\n            std::rethrow_exception(std::current_exception());\n        }\n        catch( std::exception const& ex ) {\n            return ex.what();\n        }\n        catch( std::string const& msg ) {\n            return msg;\n        }\n        catch( const char* msg ) {\n            return msg;\n        }\n        catch(...) {\n            return \"Unknown exception\";\n        }\n    }\n\n#else // ^^ Exceptions are enabled // Exceptions are disabled vv\n    std::string ExceptionTranslatorRegistry::translateActiveException() const {\n        CATCH_INTERNAL_ERROR(\"Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!\");\n    }\n#endif\n\n}\n\n\n\n/** \\file\n * This file provides platform specific implementations of FatalConditionHandler\n *\n * This means that there is a lot of conditional compilation, and platform\n * specific code. Currently, Catch2 supports a dummy handler (if no\n * handler is desired), and 2 platform specific handlers:\n *  * Windows' SEH\n *  * POSIX signals\n *\n * Consequently, various pieces of code below are compiled if either of\n * the platform specific handlers is enabled, or if none of them are\n * enabled. It is assumed that both cannot be enabled at the same time,\n * and doing so should cause a compilation error.\n *\n * If another platform specific handler is added, the compile guards\n * below will need to be updated taking these assumptions into account.\n */\n\n\n\n#include <algorithm>\n\n#if !defined( CATCH_CONFIG_WINDOWS_SEH ) && !defined( CATCH_CONFIG_POSIX_SIGNALS )\n\nnamespace Catch {\n\n    // If neither SEH nor signal handling is required, the handler impls\n    // do not have to do anything, and can be empty.\n    void FatalConditionHandler::engage_platform() {}\n    void FatalConditionHandler::disengage_platform() noexcept {}\n    FatalConditionHandler::FatalConditionHandler() = default;\n    FatalConditionHandler::~FatalConditionHandler() = default;\n\n} // end namespace Catch\n\n#endif // !CATCH_CONFIG_WINDOWS_SEH && !CATCH_CONFIG_POSIX_SIGNALS\n\n#if defined( CATCH_CONFIG_WINDOWS_SEH ) && defined( CATCH_CONFIG_POSIX_SIGNALS )\n#error \"Inconsistent configuration: Windows' SEH handling and POSIX signals cannot be enabled at the same time\"\n#endif // CATCH_CONFIG_WINDOWS_SEH && CATCH_CONFIG_POSIX_SIGNALS\n\n#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS )\n\nnamespace {\n    //! Signals fatal error message to the run context\n    void reportFatal( char const * const message ) {\n        Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message );\n    }\n\n    //! Minimal size Catch2 needs for its own fatal error handling.\n    //! Picked empirically, so it might not be sufficient on all\n    //! platforms, and for all configurations.\n    constexpr std::size_t minStackSizeForErrors = 32 * 1024;\n} // end unnamed namespace\n\n#endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS\n\n#if defined( CATCH_CONFIG_WINDOWS_SEH )\n\nnamespace Catch {\n\n    struct SignalDefs { DWORD id; const char* name; };\n\n    // There is no 1-1 mapping between signals and windows exceptions.\n    // Windows can easily distinguish between SO and SigSegV,\n    // but SigInt, SigTerm, etc are handled differently.\n    static SignalDefs signalDefs[] = {\n        { EXCEPTION_ILLEGAL_INSTRUCTION,  \"SIGILL - Illegal instruction signal\" },\n        { EXCEPTION_STACK_OVERFLOW, \"SIGSEGV - Stack overflow\" },\n        { EXCEPTION_ACCESS_VIOLATION, \"SIGSEGV - Segmentation violation signal\" },\n        { EXCEPTION_INT_DIVIDE_BY_ZERO, \"Divide by zero error\" },\n    };\n\n    static LONG CALLBACK topLevelExceptionFilter(PEXCEPTION_POINTERS ExceptionInfo) {\n        for (auto const& def : signalDefs) {\n            if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) {\n                reportFatal(def.name);\n            }\n        }\n        // If its not an exception we care about, pass it along.\n        // This stops us from eating debugger breaks etc.\n        return EXCEPTION_CONTINUE_SEARCH;\n    }\n\n    // Since we do not support multiple instantiations, we put these\n    // into global variables and rely on cleaning them up in outlined\n    // constructors/destructors\n    static LPTOP_LEVEL_EXCEPTION_FILTER previousTopLevelExceptionFilter = nullptr;\n\n\n    // For MSVC, we reserve part of the stack memory for handling\n    // memory overflow structured exception.\n    FatalConditionHandler::FatalConditionHandler() {\n        ULONG guaranteeSize = static_cast<ULONG>(minStackSizeForErrors);\n        if (!SetThreadStackGuarantee(&guaranteeSize)) {\n            // We do not want to fully error out, because needing\n            // the stack reserve should be rare enough anyway.\n            Catch::cerr()\n                << \"Failed to reserve piece of stack.\"\n                << \" Stack overflows will not be reported successfully.\";\n        }\n    }\n\n    // We do not attempt to unset the stack guarantee, because\n    // Windows does not support lowering the stack size guarantee.\n    FatalConditionHandler::~FatalConditionHandler() = default;\n\n\n    void FatalConditionHandler::engage_platform() {\n        // Register as a the top level exception filter.\n        previousTopLevelExceptionFilter = SetUnhandledExceptionFilter(topLevelExceptionFilter);\n    }\n\n    void FatalConditionHandler::disengage_platform() noexcept {\n        if (SetUnhandledExceptionFilter(previousTopLevelExceptionFilter) != topLevelExceptionFilter) {\n            Catch::cerr()\n                << \"Unexpected SEH unhandled exception filter on disengage.\"\n                << \" The filter was restored, but might be rolled back unexpectedly.\";\n        }\n        previousTopLevelExceptionFilter = nullptr;\n    }\n\n} // end namespace Catch\n\n#endif // CATCH_CONFIG_WINDOWS_SEH\n\n#if defined( CATCH_CONFIG_POSIX_SIGNALS )\n\n#include <signal.h>\n\nnamespace Catch {\n\n    struct SignalDefs {\n        int id;\n        const char* name;\n    };\n\n    static SignalDefs signalDefs[] = {\n        { SIGINT,  \"SIGINT - Terminal interrupt signal\" },\n        { SIGILL,  \"SIGILL - Illegal instruction signal\" },\n        { SIGFPE,  \"SIGFPE - Floating point error signal\" },\n        { SIGSEGV, \"SIGSEGV - Segmentation violation signal\" },\n        { SIGTERM, \"SIGTERM - Termination request signal\" },\n        { SIGABRT, \"SIGABRT - Abort (abnormal termination) signal\" }\n    };\n\n// Older GCCs trigger -Wmissing-field-initializers for T foo = {}\n// which is zero initialization, but not explicit. We want to avoid\n// that.\n#if defined(__GNUC__)\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wmissing-field-initializers\"\n#endif\n\n    static char* altStackMem = nullptr;\n    static std::size_t altStackSize = 0;\n    static stack_t oldSigStack{};\n    static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{};\n\n    static void restorePreviousSignalHandlers() noexcept {\n        // We set signal handlers back to the previous ones. Hopefully\n        // nobody overwrote them in the meantime, and doesn't expect\n        // their signal handlers to live past ours given that they\n        // installed them after ours..\n        for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) {\n            sigaction(signalDefs[i].id, &oldSigActions[i], nullptr);\n        }\n        // Return the old stack\n        sigaltstack(&oldSigStack, nullptr);\n    }\n\n    static void handleSignal( int sig ) {\n        char const * name = \"<unknown signal>\";\n        for (auto const& def : signalDefs) {\n            if (sig == def.id) {\n                name = def.name;\n                break;\n            }\n        }\n        // We need to restore previous signal handlers and let them do\n        // their thing, so that the users can have the debugger break\n        // when a signal is raised, and so on.\n        restorePreviousSignalHandlers();\n        reportFatal( name );\n        raise( sig );\n    }\n\n    FatalConditionHandler::FatalConditionHandler() {\n        assert(!altStackMem && \"Cannot initialize POSIX signal handler when one already exists\");\n        if (altStackSize == 0) {\n            altStackSize = std::max(static_cast<size_t>(SIGSTKSZ), minStackSizeForErrors);\n        }\n        altStackMem = new char[altStackSize]();\n    }\n\n    FatalConditionHandler::~FatalConditionHandler() {\n        delete[] altStackMem;\n        // We signal that another instance can be constructed by zeroing\n        // out the pointer.\n        altStackMem = nullptr;\n    }\n\n    void FatalConditionHandler::engage_platform() {\n        stack_t sigStack;\n        sigStack.ss_sp = altStackMem;\n        sigStack.ss_size = altStackSize;\n        sigStack.ss_flags = 0;\n        sigaltstack(&sigStack, &oldSigStack);\n        struct sigaction sa = { };\n\n        sa.sa_handler = handleSignal;\n        sa.sa_flags = SA_ONSTACK;\n        for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) {\n            sigaction(signalDefs[i].id, &sa, &oldSigActions[i]);\n        }\n    }\n\n#if defined(__GNUC__)\n#    pragma GCC diagnostic pop\n#endif\n\n\n    void FatalConditionHandler::disengage_platform() noexcept {\n        restorePreviousSignalHandlers();\n    }\n\n} // end namespace Catch\n\n#endif // CATCH_CONFIG_POSIX_SIGNALS\n\n\n\n\n#include <cstring>\n\nnamespace Catch {\n    namespace Detail {\n\n        uint32_t convertToBits(float f) {\n            static_assert(sizeof(float) == sizeof(uint32_t), \"Important ULP matcher assumption violated\");\n            uint32_t i;\n            std::memcpy(&i, &f, sizeof(f));\n            return i;\n        }\n\n        uint64_t convertToBits(double d) {\n            static_assert(sizeof(double) == sizeof(uint64_t), \"Important ULP matcher assumption violated\");\n            uint64_t i;\n            std::memcpy(&i, &d, sizeof(d));\n            return i;\n        }\n\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n        bool directCompare( float lhs, float rhs ) { return lhs == rhs; }\n        bool directCompare( double lhs, double rhs ) { return lhs == rhs; }\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic pop\n#endif\n\n\n    } // end namespace Detail\n} // end namespace Catch\n\n\n\n\n\n\n#include <cstdlib>\n\nnamespace Catch {\n    namespace Detail {\n\n#if !defined (CATCH_CONFIG_GETENV)\n        char const* getEnv( char const* ) { return nullptr; }\n#else\n\n        char const* getEnv( char const* varName ) {\n#    if defined( _MSC_VER )\n#        pragma warning( push )\n#        pragma warning( disable : 4996 ) // use getenv_s instead of getenv\n#    endif\n\n            return std::getenv( varName );\n\n#    if defined( _MSC_VER )\n#        pragma warning( pop )\n#    endif\n        }\n#endif\n} // namespace Detail\n} // namespace Catch\n\n\n\n\n#include <cstdio>\n#include <fstream>\n#include <sstream>\n#include <vector>\n\nnamespace Catch {\n\n    Catch::IStream::~IStream() = default;\n\nnamespace Detail {\n    namespace {\n        template<typename WriterF, std::size_t bufferSize=256>\n        class StreamBufImpl final : public std::streambuf {\n            char data[bufferSize];\n            WriterF m_writer;\n\n        public:\n            StreamBufImpl() {\n                setp( data, data + sizeof(data) );\n            }\n\n            ~StreamBufImpl() noexcept override {\n                StreamBufImpl::sync();\n            }\n\n        private:\n            int overflow( int c ) override {\n                sync();\n\n                if( c != EOF ) {\n                    if( pbase() == epptr() )\n                        m_writer( std::string( 1, static_cast<char>( c ) ) );\n                    else\n                        sputc( static_cast<char>( c ) );\n                }\n                return 0;\n            }\n\n            int sync() override {\n                if( pbase() != pptr() ) {\n                    m_writer( std::string( pbase(), static_cast<std::string::size_type>( pptr() - pbase() ) ) );\n                    setp( pbase(), epptr() );\n                }\n                return 0;\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        struct OutputDebugWriter {\n\n            void operator()( std::string const& str ) {\n                if ( !str.empty() ) {\n                    writeToDebugConsole( str );\n                }\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class FileStream final : public IStream {\n            std::ofstream m_ofs;\n        public:\n            FileStream( std::string const& filename ) {\n                m_ofs.open( filename.c_str() );\n                CATCH_ENFORCE( !m_ofs.fail(), \"Unable to open file: '\" << filename << '\\'' );\n                m_ofs << std::unitbuf;\n            }\n        public: // IStream\n            std::ostream& stream() override {\n                return m_ofs;\n            }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class CoutStream final : public IStream {\n            std::ostream m_os;\n        public:\n            // Store the streambuf from cout up-front because\n            // cout may get redirected when running tests\n            CoutStream() : m_os( Catch::cout().rdbuf() ) {}\n\n        public: // IStream\n            std::ostream& stream() override { return m_os; }\n            bool isConsole() const override { return true; }\n        };\n\n        class CerrStream : public IStream {\n            std::ostream m_os;\n\n        public:\n            // Store the streambuf from cerr up-front because\n            // cout may get redirected when running tests\n            CerrStream(): m_os( Catch::cerr().rdbuf() ) {}\n\n        public: // IStream\n            std::ostream& stream() override { return m_os; }\n            bool isConsole() const override { return true; }\n        };\n\n        ///////////////////////////////////////////////////////////////////////////\n\n        class DebugOutStream final : public IStream {\n            Detail::unique_ptr<StreamBufImpl<OutputDebugWriter>> m_streamBuf;\n            std::ostream m_os;\n        public:\n            DebugOutStream()\n            :   m_streamBuf( Detail::make_unique<StreamBufImpl<OutputDebugWriter>>() ),\n                m_os( m_streamBuf.get() )\n            {}\n\n        public: // IStream\n            std::ostream& stream() override { return m_os; }\n        };\n\n    } // unnamed namespace\n} // namespace Detail\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream> {\n        if ( filename.empty() || filename == \"-\" ) {\n            return Detail::make_unique<Detail::CoutStream>();\n        }\n        if( filename[0] == '%' ) {\n            if ( filename == \"%debug\" ) {\n                return Detail::make_unique<Detail::DebugOutStream>();\n            } else if ( filename == \"%stderr\" ) {\n                return Detail::make_unique<Detail::CerrStream>();\n            } else if ( filename == \"%stdout\" ) {\n                return Detail::make_unique<Detail::CoutStream>();\n            } else {\n                CATCH_ERROR( \"Unrecognised stream: '\" << filename << '\\'' );\n            }\n        }\n        return Detail::make_unique<Detail::FileStream>( filename );\n    }\n\n}\n\n\n\nnamespace Catch {\n    void JsonUtils::indent( std::ostream& os, std::uint64_t level ) {\n        for ( std::uint64_t i = 0; i < level; ++i ) {\n            os << \"  \";\n        }\n    }\n    void JsonUtils::appendCommaNewline( std::ostream& os,\n                                        bool& should_comma,\n                                        std::uint64_t level ) {\n        if ( should_comma ) { os << ','; }\n        should_comma = true;\n        os << '\\n';\n        indent( os, level );\n    }\n\n    JsonObjectWriter::JsonObjectWriter( std::ostream& os ):\n        JsonObjectWriter{ os, 0 } {}\n\n    JsonObjectWriter::JsonObjectWriter( std::ostream& os,\n                                        std::uint64_t indent_level ):\n        m_os{ os }, m_indent_level{ indent_level } {\n        m_os << '{';\n    }\n    JsonObjectWriter::JsonObjectWriter( JsonObjectWriter&& source ) noexcept:\n        m_os{ source.m_os },\n        m_indent_level{ source.m_indent_level },\n        m_should_comma{ source.m_should_comma },\n        m_active{ source.m_active } {\n        source.m_active = false;\n    }\n\n    JsonObjectWriter::~JsonObjectWriter() {\n        if ( !m_active ) { return; }\n\n        m_os << '\\n';\n        JsonUtils::indent( m_os, m_indent_level );\n        m_os << '}';\n    }\n\n    JsonValueWriter JsonObjectWriter::write( StringRef key ) {\n        JsonUtils::appendCommaNewline(\n            m_os, m_should_comma, m_indent_level + 1 );\n\n        m_os << '\"' << key << \"\\\": \";\n        return JsonValueWriter{ m_os, m_indent_level + 1 };\n    }\n\n    JsonArrayWriter::JsonArrayWriter( std::ostream& os ):\n        JsonArrayWriter{ os, 0 } {}\n    JsonArrayWriter::JsonArrayWriter( std::ostream& os,\n                                      std::uint64_t indent_level ):\n        m_os{ os }, m_indent_level{ indent_level } {\n        m_os << '[';\n    }\n    JsonArrayWriter::JsonArrayWriter( JsonArrayWriter&& source ) noexcept:\n        m_os{ source.m_os },\n        m_indent_level{ source.m_indent_level },\n        m_should_comma{ source.m_should_comma },\n        m_active{ source.m_active } {\n        source.m_active = false;\n    }\n    JsonArrayWriter::~JsonArrayWriter() {\n        if ( !m_active ) { return; }\n\n        m_os << '\\n';\n        JsonUtils::indent( m_os, m_indent_level );\n        m_os << ']';\n    }\n\n    JsonObjectWriter JsonArrayWriter::writeObject() {\n        JsonUtils::appendCommaNewline(\n            m_os, m_should_comma, m_indent_level + 1 );\n        return JsonObjectWriter{ m_os, m_indent_level + 1 };\n    }\n\n    JsonArrayWriter JsonArrayWriter::writeArray() {\n        JsonUtils::appendCommaNewline(\n            m_os, m_should_comma, m_indent_level + 1 );\n        return JsonArrayWriter{ m_os, m_indent_level + 1 };\n    }\n\n    JsonArrayWriter& JsonArrayWriter::write( bool value ) {\n        return writeImpl( value );\n    }\n\n    JsonValueWriter::JsonValueWriter( std::ostream& os ):\n        JsonValueWriter{ os, 0 } {}\n\n    JsonValueWriter::JsonValueWriter( std::ostream& os,\n                                      std::uint64_t indent_level ):\n        m_os{ os }, m_indent_level{ indent_level } {}\n\n    JsonObjectWriter JsonValueWriter::writeObject() && {\n        return JsonObjectWriter{ m_os, m_indent_level };\n    }\n\n    JsonArrayWriter JsonValueWriter::writeArray() && {\n        return JsonArrayWriter{ m_os, m_indent_level };\n    }\n\n    void JsonValueWriter::write( Catch::StringRef value ) && {\n        writeImpl( value, true );\n    }\n\n    void JsonValueWriter::write( bool value ) && {\n        writeImpl( value ? \"true\"_sr : \"false\"_sr, false );\n    }\n\n    void JsonValueWriter::writeImpl( Catch::StringRef value, bool quote ) {\n        if ( quote ) { m_os << '\"'; }\n        for (char c : value) {\n            // Escape list taken from https://www.json.org/json-en.html,\n            // string definition.\n            // Note that while forward slash _can_ be escaped, it does\n            // not have to be, if JSON is not further embedded somewhere\n            // where forward slash is meaningful.\n            if ( c == '\"' ) {\n                m_os << \"\\\\\\\"\";\n            } else if ( c == '\\\\' ) {\n                m_os << \"\\\\\\\\\";\n            } else if ( c == '\\b' ) {\n                m_os << \"\\\\b\";\n            } else if ( c == '\\f' ) {\n                m_os << \"\\\\f\";\n            } else if ( c == '\\n' ) {\n                m_os << \"\\\\n\";\n            } else if ( c == '\\r' ) {\n                m_os << \"\\\\r\";\n            } else if ( c == '\\t' ) {\n                m_os << \"\\\\t\";\n            } else {\n                m_os << c;\n            }\n        }\n        if ( quote ) { m_os << '\"'; }\n    }\n\n} // namespace Catch\n\n\n\n\nnamespace Catch {\n\n    auto operator << (std::ostream& os, LazyExpression const& lazyExpr) -> std::ostream& {\n        if (lazyExpr.m_isNegated)\n            os << '!';\n\n        if (lazyExpr) {\n            if (lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression())\n                os << '(' << *lazyExpr.m_transientExpression << ')';\n            else\n                os << *lazyExpr.m_transientExpression;\n        } else {\n            os << \"{** error - unchecked empty expression requested **}\";\n        }\n        return os;\n    }\n\n} // namespace Catch\n\n\n\n\n#ifdef CATCH_CONFIG_WINDOWS_CRTDBG\n#include <crtdbg.h>\n\nnamespace Catch {\n\n    LeakDetector::LeakDetector() {\n        int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG);\n        flag |= _CRTDBG_LEAK_CHECK_DF;\n        flag |= _CRTDBG_ALLOC_MEM_DF;\n        _CrtSetDbgFlag(flag);\n        _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);\n        _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR);\n        // Change this to leaking allocation's number to break there\n        _CrtSetBreakAlloc(-1);\n    }\n}\n\n#else // ^^ Windows crt debug heap enabled // Windows crt debug heap disabled vv\n\n    Catch::LeakDetector::LeakDetector() = default;\n\n#endif // CATCH_CONFIG_WINDOWS_CRTDBG\n\nCatch::LeakDetector::~LeakDetector() {\n    Catch::cleanUp();\n}\n\n\n\n\nnamespace Catch {\n    namespace {\n\n        void listTests(IEventListener& reporter, IConfig const& config) {\n            auto const& testSpec = config.testSpec();\n            auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);\n            reporter.listTests(matchedTestCases);\n        }\n\n        void listTags(IEventListener& reporter, IConfig const& config) {\n            auto const& testSpec = config.testSpec();\n            std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);\n\n            std::map<StringRef, TagInfo, Detail::CaseInsensitiveLess> tagCounts;\n            for (auto const& testCase : matchedTestCases) {\n                for (auto const& tagName : testCase.getTestCaseInfo().tags) {\n                    auto it = tagCounts.find(tagName.original);\n                    if (it == tagCounts.end())\n                        it = tagCounts.insert(std::make_pair(tagName.original, TagInfo())).first;\n                    it->second.add(tagName.original);\n                }\n            }\n\n            std::vector<TagInfo> infos; infos.reserve(tagCounts.size());\n            for (auto& tagc : tagCounts) {\n                infos.push_back(CATCH_MOVE(tagc.second));\n            }\n\n            reporter.listTags(infos);\n        }\n\n        void listReporters(IEventListener& reporter) {\n            std::vector<ReporterDescription> descriptions;\n\n            auto const& factories = getRegistryHub().getReporterRegistry().getFactories();\n            descriptions.reserve(factories.size());\n            for (auto const& fac : factories) {\n                descriptions.push_back({ fac.first, fac.second->getDescription() });\n            }\n\n            reporter.listReporters(descriptions);\n        }\n\n        void listListeners(IEventListener& reporter) {\n            std::vector<ListenerDescription> descriptions;\n\n            auto const& factories =\n                getRegistryHub().getReporterRegistry().getListeners();\n            descriptions.reserve( factories.size() );\n            for ( auto const& fac : factories ) {\n                descriptions.push_back( { fac->getName(), fac->getDescription() } );\n            }\n\n            reporter.listListeners( descriptions );\n        }\n\n    } // end anonymous namespace\n\n    void TagInfo::add( StringRef spelling ) {\n        ++count;\n        spellings.insert( spelling );\n    }\n\n    std::string TagInfo::all() const {\n        // 2 per tag for brackets '[' and ']'\n        size_t size =  spellings.size() * 2;\n        for (auto const& spelling : spellings) {\n            size += spelling.size();\n        }\n\n        std::string out; out.reserve(size);\n        for (auto const& spelling : spellings) {\n            out += '[';\n            out += spelling;\n            out += ']';\n        }\n        return out;\n    }\n\n    bool list( IEventListener& reporter, Config const& config ) {\n        bool listed = false;\n        if (config.listTests()) {\n            listed = true;\n            listTests(reporter, config);\n        }\n        if (config.listTags()) {\n            listed = true;\n            listTags(reporter, config);\n        }\n        if (config.listReporters()) {\n            listed = true;\n            listReporters(reporter);\n        }\n        if ( config.listListeners() ) {\n            listed = true;\n            listListeners( reporter );\n        }\n        return listed;\n    }\n\n} // end namespace Catch\n\n\n\nnamespace Catch {\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS\n    static LeakDetector leakDetector;\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n}\n\n// Allow users of amalgamated .cpp file to remove our main and provide their own.\n#if !defined(CATCH_AMALGAMATED_CUSTOM_MAIN)\n\n#if defined(CATCH_CONFIG_WCHAR) && defined(CATCH_PLATFORM_WINDOWS) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN)\n// Standard C/C++ Win32 Unicode wmain entry point\nextern \"C\" int __cdecl wmain (int argc, wchar_t * argv[], wchar_t * []) {\n#else\n// Standard C/C++ main entry point\nint main (int argc, char * argv[]) {\n#endif\n\n    // We want to force the linker not to discard the global variable\n    // and its constructor, as it (optionally) registers leak detector\n    (void)&Catch::leakDetector;\n\n    return Catch::Session().run( argc, argv );\n}\n\n#endif // !defined(CATCH_AMALGAMATED_CUSTOM_MAIN\n\n\n\n\nnamespace Catch {\n\n    MessageInfo::MessageInfo(   StringRef _macroName,\n                                SourceLineInfo const& _lineInfo,\n                                ResultWas::OfType _type )\n    :   macroName( _macroName ),\n        lineInfo( _lineInfo ),\n        type( _type ),\n        sequence( ++globalCount )\n    {}\n\n    // This may need protecting if threading support is added\n    unsigned int MessageInfo::globalCount = 0;\n\n} // end namespace Catch\n\n\n\n#include <cstdio>\n#include <cstring>\n#include <iosfwd>\n#include <sstream>\n\n#if defined( CATCH_CONFIG_NEW_CAPTURE )\n#    if defined( _MSC_VER )\n#        include <io.h> //_dup and _dup2\n#        define dup _dup\n#        define dup2 _dup2\n#        define fileno _fileno\n#    else\n#        include <unistd.h> // dup and dup2\n#    endif\n#endif\n\nnamespace Catch {\n\n    namespace {\n        //! A no-op implementation, used if no reporter wants output\n        //! redirection.\n        class NoopRedirect : public OutputRedirect {\n            void activateImpl() override {}\n            void deactivateImpl() override {}\n            std::string getStdout() override { return {}; }\n            std::string getStderr() override { return {}; }\n            void clearBuffers() override {}\n        };\n\n        /**\n         * Redirects specific stream's rdbuf with another's.\n         *\n         * Redirection can be stopped and started on-demand, assumes\n         * that the underlying stream's rdbuf aren't changed by other\n         * users.\n         */\n        class RedirectedStreamNew {\n            std::ostream& m_originalStream;\n            std::ostream& m_redirectionStream;\n            std::streambuf* m_prevBuf;\n\n        public:\n            RedirectedStreamNew( std::ostream& originalStream,\n                                 std::ostream& redirectionStream ):\n                m_originalStream( originalStream ),\n                m_redirectionStream( redirectionStream ),\n                m_prevBuf( m_originalStream.rdbuf() ) {}\n\n            void startRedirect() {\n                m_originalStream.rdbuf( m_redirectionStream.rdbuf() );\n            }\n            void stopRedirect() { m_originalStream.rdbuf( m_prevBuf ); }\n        };\n\n        /**\n         * Redirects the `std::cout`, `std::cerr`, `std::clog` streams,\n         * but does not touch the actual `stdout`/`stderr` file descriptors.\n         */\n        class StreamRedirect : public OutputRedirect {\n            ReusableStringStream m_redirectedOut, m_redirectedErr;\n            RedirectedStreamNew m_cout, m_cerr, m_clog;\n\n        public:\n            StreamRedirect():\n                m_cout( Catch::cout(), m_redirectedOut.get() ),\n                m_cerr( Catch::cerr(), m_redirectedErr.get() ),\n                m_clog( Catch::clog(), m_redirectedErr.get() ) {}\n\n            void activateImpl() override {\n                m_cout.startRedirect();\n                m_cerr.startRedirect();\n                m_clog.startRedirect();\n            }\n            void deactivateImpl() override {\n                m_cout.stopRedirect();\n                m_cerr.stopRedirect();\n                m_clog.stopRedirect();\n            }\n            std::string getStdout() override { return m_redirectedOut.str(); }\n            std::string getStderr() override { return m_redirectedErr.str(); }\n            void clearBuffers() override {\n                m_redirectedOut.str( \"\" );\n                m_redirectedErr.str( \"\" );\n            }\n        };\n\n#if defined( CATCH_CONFIG_NEW_CAPTURE )\n\n        // Windows's implementation of std::tmpfile is terrible (it tries\n        // to create a file inside system folder, thus requiring elevated\n        // privileges for the binary), so we have to use tmpnam(_s) and\n        // create the file ourselves there.\n        class TempFile {\n        public:\n            TempFile( TempFile const& ) = delete;\n            TempFile& operator=( TempFile const& ) = delete;\n            TempFile( TempFile&& ) = delete;\n            TempFile& operator=( TempFile&& ) = delete;\n\n#    if defined( _MSC_VER )\n            TempFile() {\n                if ( tmpnam_s( m_buffer ) ) {\n                    CATCH_RUNTIME_ERROR( \"Could not get a temp filename\" );\n                }\n                if ( fopen_s( &m_file, m_buffer, \"wb+\" ) ) {\n                    char buffer[100];\n                    if ( strerror_s( buffer, errno ) ) {\n                        CATCH_RUNTIME_ERROR(\n                            \"Could not translate errno to a string\" );\n                    }\n                    CATCH_RUNTIME_ERROR( \"Could not open the temp file: '\"\n                                         << m_buffer\n                                         << \"' because: \" << buffer );\n                }\n            }\n#    else\n            TempFile() {\n                m_file = std::tmpfile();\n                if ( !m_file ) {\n                    CATCH_RUNTIME_ERROR( \"Could not create a temp file.\" );\n                }\n            }\n#    endif\n\n            ~TempFile() {\n                // TBD: What to do about errors here?\n                std::fclose( m_file );\n                // We manually create the file on Windows only, on Linux\n                // it will be autodeleted\n#    if defined( _MSC_VER )\n                std::remove( m_buffer );\n#    endif\n            }\n\n            std::FILE* getFile() { return m_file; }\n            std::string getContents() {\n                ReusableStringStream sstr;\n                constexpr long buffer_size = 100;\n                char buffer[buffer_size + 1] = {};\n                long current_pos = ftell( m_file );\n                CATCH_ENFORCE( current_pos >= 0,\n                               \"ftell failed, errno: \" << errno );\n                std::rewind( m_file );\n                while ( current_pos > 0 ) {\n                    auto read_characters =\n                        std::fread( buffer,\n                                    1,\n                                    std::min( buffer_size, current_pos ),\n                                    m_file );\n                    buffer[read_characters] = '\\0';\n                    sstr << buffer;\n                    current_pos -= static_cast<long>( read_characters );\n                }\n                return sstr.str();\n            }\n\n            void clear() { std::rewind( m_file ); }\n\n        private:\n            std::FILE* m_file = nullptr;\n            char m_buffer[L_tmpnam] = { 0 };\n        };\n\n        /**\n         * Redirects the actual `stdout`/`stderr` file descriptors.\n         *\n         * Works by replacing the file descriptors numbered 1 and 2\n         * with an open temporary file.\n         */\n        class FileRedirect : public OutputRedirect {\n            TempFile m_outFile, m_errFile;\n            int m_originalOut = -1;\n            int m_originalErr = -1;\n\n            // Flushes cout/cerr/clog streams and stdout/stderr FDs\n            void flushEverything() {\n                Catch::cout() << std::flush;\n                fflush( stdout );\n                // Since we support overriding these streams, we flush cerr\n                // even though std::cerr is unbuffered\n                Catch::cerr() << std::flush;\n                Catch::clog() << std::flush;\n                fflush( stderr );\n            }\n\n        public:\n            FileRedirect():\n                m_originalOut( dup( fileno( stdout ) ) ),\n                m_originalErr( dup( fileno( stderr ) ) ) {\n                CATCH_ENFORCE( m_originalOut >= 0, \"Could not dup stdout\" );\n                CATCH_ENFORCE( m_originalErr >= 0, \"Could not dup stderr\" );\n            }\n\n            std::string getStdout() override { return m_outFile.getContents(); }\n            std::string getStderr() override { return m_errFile.getContents(); }\n            void clearBuffers() override {\n                m_outFile.clear();\n                m_errFile.clear();\n            }\n\n            void activateImpl() override {\n                // We flush before starting redirect, to ensure that we do\n                // not capture the end of message sent before activation.\n                flushEverything();\n\n                int ret;\n                ret = dup2( fileno( m_outFile.getFile() ), fileno( stdout ) );\n                CATCH_ENFORCE( ret >= 0,\n                               \"dup2 to stdout has failed, errno: \" << errno );\n                ret = dup2( fileno( m_errFile.getFile() ), fileno( stderr ) );\n                CATCH_ENFORCE( ret >= 0,\n                               \"dup2 to stderr has failed, errno: \" << errno );\n            }\n            void deactivateImpl() override {\n                // We flush before ending redirect, to ensure that we\n                // capture all messages sent while the redirect was active.\n                flushEverything();\n\n                int ret;\n                ret = dup2( m_originalOut, fileno( stdout ) );\n                CATCH_ENFORCE(\n                    ret >= 0,\n                    \"dup2 of original stdout has failed, errno: \" << errno );\n                ret = dup2( m_originalErr, fileno( stderr ) );\n                CATCH_ENFORCE(\n                    ret >= 0,\n                    \"dup2 of original stderr has failed, errno: \" << errno );\n            }\n        };\n\n#endif // CATCH_CONFIG_NEW_CAPTURE\n\n    } // end namespace\n\n    bool isRedirectAvailable( OutputRedirect::Kind kind ) {\n        switch ( kind ) {\n        // These two are always available\n        case OutputRedirect::None:\n        case OutputRedirect::Streams:\n            return true;\n#if defined( CATCH_CONFIG_NEW_CAPTURE )\n        case OutputRedirect::FileDescriptors:\n            return true;\n#endif\n        default:\n            return false;\n        }\n    }\n\n    Detail::unique_ptr<OutputRedirect> makeOutputRedirect( bool actual ) {\n        if ( actual ) {\n            // TODO: Clean this up later\n#if defined( CATCH_CONFIG_NEW_CAPTURE )\n            return Detail::make_unique<FileRedirect>();\n#else\n            return Detail::make_unique<StreamRedirect>();\n#endif\n        } else {\n            return Detail::make_unique<NoopRedirect>();\n        }\n    }\n\n    RedirectGuard scopedActivate( OutputRedirect& redirectImpl ) {\n        return RedirectGuard( true, redirectImpl );\n    }\n\n    RedirectGuard scopedDeactivate( OutputRedirect& redirectImpl ) {\n        return RedirectGuard( false, redirectImpl );\n    }\n\n    OutputRedirect::~OutputRedirect() = default;\n\n    RedirectGuard::RedirectGuard( bool activate, OutputRedirect& redirectImpl ):\n        m_redirect( &redirectImpl ),\n        m_activate( activate ),\n        m_previouslyActive( redirectImpl.isActive() ) {\n\n        // Skip cases where there is no actual state change.\n        if ( m_activate == m_previouslyActive ) { return; }\n\n        if ( m_activate ) {\n            m_redirect->activate();\n        } else {\n            m_redirect->deactivate();\n        }\n    }\n\n    RedirectGuard::~RedirectGuard() noexcept( false ) {\n        if ( m_moved ) { return; }\n        // Skip cases where there is no actual state change.\n        if ( m_activate == m_previouslyActive ) { return; }\n\n        if ( m_activate ) {\n            m_redirect->deactivate();\n        } else {\n            m_redirect->activate();\n        }\n    }\n\n    RedirectGuard::RedirectGuard( RedirectGuard&& rhs ) noexcept:\n        m_redirect( rhs.m_redirect ),\n        m_activate( rhs.m_activate ),\n        m_previouslyActive( rhs.m_previouslyActive ),\n        m_moved( false ) {\n        rhs.m_moved = true;\n    }\n\n    RedirectGuard& RedirectGuard::operator=( RedirectGuard&& rhs ) noexcept {\n        m_redirect = rhs.m_redirect;\n        m_activate = rhs.m_activate;\n        m_previouslyActive = rhs.m_previouslyActive;\n        m_moved = false;\n        rhs.m_moved = true;\n        return *this;\n    }\n\n} // namespace Catch\n\n#if defined( CATCH_CONFIG_NEW_CAPTURE )\n#    if defined( _MSC_VER )\n#        undef dup\n#        undef dup2\n#        undef fileno\n#    endif\n#endif\n\n\n\n\n#include <limits>\n#include <stdexcept>\n\nnamespace Catch {\n\n    Optional<unsigned int> parseUInt(std::string const& input, int base) {\n        auto trimmed = trim( input );\n        // std::stoull is annoying and accepts numbers starting with '-',\n        // it just negates them into unsigned int\n        if ( trimmed.empty() || trimmed[0] == '-' ) {\n            return {};\n        }\n\n        CATCH_TRY {\n            size_t pos = 0;\n            const auto ret = std::stoull( trimmed, &pos, base );\n\n            // We did not consume the whole input, so there is an issue\n            // This can be bunch of different stuff, like multiple numbers\n            // in the input, or invalid digits/characters and so on. Either\n            // way, we do not want to return the partially parsed result.\n            if ( pos != trimmed.size() ) {\n                return {};\n            }\n            // Too large\n            if ( ret > std::numeric_limits<unsigned int>::max() ) {\n                return {};\n            }\n            return static_cast<unsigned int>(ret);\n        }\n        CATCH_CATCH_ANON( std::invalid_argument const& ) {\n            // no conversion could be performed\n        }\n        CATCH_CATCH_ANON( std::out_of_range const& ) {\n            // the input does not fit into an unsigned long long\n        }\n        return {};\n    }\n\n} // namespace Catch\n\n\n\n\n#include <cmath>\n\nnamespace Catch {\n\n#if !defined(CATCH_CONFIG_POLYFILL_ISNAN)\n    bool isnan(float f) {\n        return std::isnan(f);\n    }\n    bool isnan(double d) {\n        return std::isnan(d);\n    }\n#else\n    // For now we only use this for embarcadero\n    bool isnan(float f) {\n        return std::_isnan(f);\n    }\n    bool isnan(double d) {\n        return std::_isnan(d);\n    }\n#endif\n\n#if !defined( CATCH_CONFIG_GLOBAL_NEXTAFTER )\n    float nextafter( float x, float y ) { return std::nextafter( x, y ); }\n    double nextafter( double x, double y ) { return std::nextafter( x, y ); }\n#else\n    float nextafter( float x, float y ) { return ::nextafterf( x, y ); }\n    double nextafter( double x, double y ) { return ::nextafter( x, y ); }\n#endif\n\n} // end namespace Catch\n\n\n\nnamespace Catch {\n\nnamespace {\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4146) // we negate uint32 during the rotate\n#endif\n        // Safe rotr implementation thanks to John Regehr\n        uint32_t rotate_right(uint32_t val, uint32_t count) {\n            const uint32_t mask = 31;\n            count &= mask;\n            return (val >> count) | (val << (-count & mask));\n        }\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n}\n\n\n    SimplePcg32::SimplePcg32(result_type seed_) {\n        seed(seed_);\n    }\n\n\n    void SimplePcg32::seed(result_type seed_) {\n        m_state = 0;\n        (*this)();\n        m_state += seed_;\n        (*this)();\n    }\n\n    void SimplePcg32::discard(uint64_t skip) {\n        // We could implement this to run in O(log n) steps, but this\n        // should suffice for our use case.\n        for (uint64_t s = 0; s < skip; ++s) {\n            static_cast<void>((*this)());\n        }\n    }\n\n    SimplePcg32::result_type SimplePcg32::operator()() {\n        // prepare the output value\n        const uint32_t xorshifted = static_cast<uint32_t>(((m_state >> 18u) ^ m_state) >> 27u);\n        const auto output = rotate_right(xorshifted, m_state >> 59u);\n\n        // advance state\n        m_state = m_state * 6364136223846793005ULL + s_inc;\n\n        return output;\n    }\n\n    bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {\n        return lhs.m_state == rhs.m_state;\n    }\n\n    bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) {\n        return lhs.m_state != rhs.m_state;\n    }\n}\n\n\n\n\n\n#include <ctime>\n#include <random>\n\nnamespace Catch {\n\n    std::uint32_t generateRandomSeed( GenerateFrom from ) {\n        switch ( from ) {\n        case GenerateFrom::Time:\n            return static_cast<std::uint32_t>( std::time( nullptr ) );\n\n        case GenerateFrom::Default:\n        case GenerateFrom::RandomDevice: {\n            std::random_device rd;\n            return Detail::fillBitsFrom<std::uint32_t>( rd );\n        }\n\n        default:\n            CATCH_ERROR(\"Unknown generation method\");\n        }\n    }\n\n} // end namespace Catch\n\n\n\n\nnamespace Catch {\n    struct ReporterRegistry::ReporterRegistryImpl {\n        std::vector<Detail::unique_ptr<EventListenerFactory>> listeners;\n        std::map<std::string, IReporterFactoryPtr, Detail::CaseInsensitiveLess>\n            factories;\n    };\n\n    ReporterRegistry::ReporterRegistry():\n        m_impl( Detail::make_unique<ReporterRegistryImpl>() ) {\n        // Because it is impossible to move out of initializer list,\n        // we have to add the elements manually\n        m_impl->factories[\"Automake\"] =\n            Detail::make_unique<ReporterFactory<AutomakeReporter>>();\n        m_impl->factories[\"compact\"] =\n            Detail::make_unique<ReporterFactory<CompactReporter>>();\n        m_impl->factories[\"console\"] =\n            Detail::make_unique<ReporterFactory<ConsoleReporter>>();\n        m_impl->factories[\"JUnit\"] =\n            Detail::make_unique<ReporterFactory<JunitReporter>>();\n        m_impl->factories[\"SonarQube\"] =\n            Detail::make_unique<ReporterFactory<SonarQubeReporter>>();\n        m_impl->factories[\"TAP\"] =\n            Detail::make_unique<ReporterFactory<TAPReporter>>();\n        m_impl->factories[\"TeamCity\"] =\n            Detail::make_unique<ReporterFactory<TeamCityReporter>>();\n        m_impl->factories[\"XML\"] =\n            Detail::make_unique<ReporterFactory<XmlReporter>>();\n        m_impl->factories[\"JSON\"] =\n            Detail::make_unique<ReporterFactory<JsonReporter>>();\n    }\n\n    ReporterRegistry::~ReporterRegistry() = default;\n\n    IEventListenerPtr\n    ReporterRegistry::create( std::string const& name,\n                              ReporterConfig&& config ) const {\n        auto it = m_impl->factories.find( name );\n        if ( it == m_impl->factories.end() ) return nullptr;\n        return it->second->create( CATCH_MOVE( config ) );\n    }\n\n    void ReporterRegistry::registerReporter( std::string const& name,\n                                             IReporterFactoryPtr factory ) {\n        CATCH_ENFORCE( name.find( \"::\" ) == name.npos,\n                       \"'::' is not allowed in reporter name: '\" + name +\n                           '\\'' );\n        auto ret = m_impl->factories.emplace( name, CATCH_MOVE( factory ) );\n        CATCH_ENFORCE( ret.second,\n                       \"reporter using '\" + name +\n                           \"' as name was already registered\" );\n    }\n    void ReporterRegistry::registerListener(\n        Detail::unique_ptr<EventListenerFactory> factory ) {\n        m_impl->listeners.push_back( CATCH_MOVE( factory ) );\n    }\n\n    std::map<std::string,\n             IReporterFactoryPtr,\n             Detail::CaseInsensitiveLess> const&\n    ReporterRegistry::getFactories() const {\n        return m_impl->factories;\n    }\n\n    std::vector<Detail::unique_ptr<EventListenerFactory>> const&\n    ReporterRegistry::getListeners() const {\n        return m_impl->listeners;\n    }\n} // namespace Catch\n\n\n\n\n\n#include <algorithm>\n\nnamespace Catch {\n\n    namespace {\n        struct kvPair {\n            StringRef key, value;\n        };\n\n        kvPair splitKVPair(StringRef kvString) {\n            auto splitPos = static_cast<size_t>(\n                std::find( kvString.begin(), kvString.end(), '=' ) -\n                kvString.begin() );\n\n            return { kvString.substr( 0, splitPos ),\n                     kvString.substr( splitPos + 1, kvString.size() ) };\n        }\n    }\n\n    namespace Detail {\n        std::vector<std::string> splitReporterSpec( StringRef reporterSpec ) {\n            static constexpr auto separator = \"::\";\n            static constexpr size_t separatorSize = 2;\n\n            size_t separatorPos = 0;\n            auto findNextSeparator = [&reporterSpec]( size_t startPos ) {\n                static_assert(\n                    separatorSize == 2,\n                    \"The code below currently assumes 2 char separator\" );\n\n                auto currentPos = startPos;\n                do {\n                    while ( currentPos < reporterSpec.size() &&\n                            reporterSpec[currentPos] != separator[0] ) {\n                        ++currentPos;\n                    }\n                    if ( currentPos + 1 < reporterSpec.size() &&\n                         reporterSpec[currentPos + 1] == separator[1] ) {\n                        return currentPos;\n                    }\n                    ++currentPos;\n                } while ( currentPos < reporterSpec.size() );\n\n                return static_cast<size_t>( -1 );\n            };\n\n            std::vector<std::string> parts;\n\n            while ( separatorPos < reporterSpec.size() ) {\n                const auto nextSeparator = findNextSeparator( separatorPos );\n                parts.push_back( static_cast<std::string>( reporterSpec.substr(\n                    separatorPos, nextSeparator - separatorPos ) ) );\n\n                if ( nextSeparator == static_cast<size_t>( -1 ) ) {\n                    break;\n                }\n                separatorPos = nextSeparator + separatorSize;\n            }\n\n            // Handle a separator at the end.\n            // This is not a valid spec, but we want to do validation in a\n            // centralized place\n            if ( separatorPos == reporterSpec.size() ) {\n                parts.emplace_back();\n            }\n\n            return parts;\n        }\n\n        Optional<ColourMode> stringToColourMode( StringRef colourMode ) {\n            if ( colourMode == \"default\" ) {\n                return ColourMode::PlatformDefault;\n            } else if ( colourMode == \"ansi\" ) {\n                return ColourMode::ANSI;\n            } else if ( colourMode == \"win32\" ) {\n                return ColourMode::Win32;\n            } else if ( colourMode == \"none\" ) {\n                return ColourMode::None;\n            } else {\n                return {};\n            }\n        }\n    } // namespace Detail\n\n\n    bool operator==( ReporterSpec const& lhs, ReporterSpec const& rhs ) {\n        return lhs.m_name == rhs.m_name &&\n               lhs.m_outputFileName == rhs.m_outputFileName &&\n               lhs.m_colourMode == rhs.m_colourMode &&\n               lhs.m_customOptions == rhs.m_customOptions;\n    }\n\n    Optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec ) {\n        auto parts = Detail::splitReporterSpec( reporterSpec );\n\n        assert( parts.size() > 0 && \"Split should never return empty vector\" );\n\n        std::map<std::string, std::string> kvPairs;\n        Optional<std::string> outputFileName;\n        Optional<ColourMode> colourMode;\n\n        // First part is always reporter name, so we skip it\n        for ( size_t i = 1; i < parts.size(); ++i ) {\n            auto kv = splitKVPair( parts[i] );\n            auto key = kv.key, value = kv.value;\n\n            if ( key.empty() || value.empty() ) { // NOLINT(bugprone-branch-clone)\n                return {};\n            } else if ( key[0] == 'X' ) {\n                // This is a reporter-specific option, we don't check these\n                // apart from basic sanity checks\n                if ( key.size() == 1 ) {\n                    return {};\n                }\n\n                auto ret = kvPairs.emplace( std::string(kv.key), std::string(kv.value) );\n                if ( !ret.second ) {\n                    // Duplicated key. We might want to handle this differently,\n                    // e.g. by overwriting the existing value?\n                    return {};\n                }\n            } else if ( key == \"out\" ) {\n                // Duplicated key\n                if ( outputFileName ) {\n                    return {};\n                }\n                outputFileName = static_cast<std::string>( value );\n            } else if ( key == \"colour-mode\" ) {\n                // Duplicated key\n                if ( colourMode ) {\n                    return {};\n                }\n                colourMode = Detail::stringToColourMode( value );\n                // Parsing failed\n                if ( !colourMode ) {\n                    return {};\n                }\n            } else {\n                // Unrecognized option\n                return {};\n            }\n        }\n\n        return ReporterSpec{ CATCH_MOVE( parts[0] ),\n                             CATCH_MOVE( outputFileName ),\n                             CATCH_MOVE( colourMode ),\n                             CATCH_MOVE( kvPairs ) };\n    }\n\nReporterSpec::ReporterSpec(\n        std::string name,\n        Optional<std::string> outputFileName,\n        Optional<ColourMode> colourMode,\n        std::map<std::string, std::string> customOptions ):\n        m_name( CATCH_MOVE( name ) ),\n        m_outputFileName( CATCH_MOVE( outputFileName ) ),\n        m_colourMode( CATCH_MOVE( colourMode ) ),\n        m_customOptions( CATCH_MOVE( customOptions ) ) {}\n\n} // namespace Catch\n\n\n\n#include <cstdio>\n#include <sstream>\n#include <vector>\n\nnamespace Catch {\n\n    // This class encapsulates the idea of a pool of ostringstreams that can be reused.\n    struct StringStreams {\n        std::vector<Detail::unique_ptr<std::ostringstream>> m_streams;\n        std::vector<std::size_t> m_unused;\n        std::ostringstream m_referenceStream; // Used for copy state/ flags from\n\n        auto add() -> std::size_t {\n            if( m_unused.empty() ) {\n                m_streams.push_back( Detail::make_unique<std::ostringstream>() );\n                return m_streams.size()-1;\n            }\n            else {\n                auto index = m_unused.back();\n                m_unused.pop_back();\n                return index;\n            }\n        }\n\n        void release( std::size_t index ) {\n            m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state\n            m_unused.push_back(index);\n        }\n    };\n\n    ReusableStringStream::ReusableStringStream()\n    :   m_index( Singleton<StringStreams>::getMutable().add() ),\n        m_oss( Singleton<StringStreams>::getMutable().m_streams[m_index].get() )\n    {}\n\n    ReusableStringStream::~ReusableStringStream() {\n        static_cast<std::ostringstream*>( m_oss )->str(\"\");\n        m_oss->clear();\n        Singleton<StringStreams>::getMutable().release( m_index );\n    }\n\n    std::string ReusableStringStream::str() const {\n        return static_cast<std::ostringstream*>( m_oss )->str();\n    }\n\n    void ReusableStringStream::str( std::string const& str ) {\n        static_cast<std::ostringstream*>( m_oss )->str( str );\n    }\n\n\n}\n\n\n\n\n#include <cassert>\n#include <algorithm>\n\nnamespace Catch {\n\n    namespace Generators {\n        namespace {\n            struct GeneratorTracker final : TestCaseTracking::TrackerBase,\n                                      IGeneratorTracker {\n                GeneratorBasePtr m_generator;\n\n                GeneratorTracker(\n                    TestCaseTracking::NameAndLocation&& nameAndLocation,\n                    TrackerContext& ctx,\n                    ITracker* parent ):\n                    TrackerBase( CATCH_MOVE( nameAndLocation ), ctx, parent ) {}\n\n                static GeneratorTracker*\n                acquire( TrackerContext& ctx,\n                         TestCaseTracking::NameAndLocationRef const&\n                             nameAndLocation ) {\n                    GeneratorTracker* tracker;\n\n                    ITracker& currentTracker = ctx.currentTracker();\n                    // Under specific circumstances, the generator we want\n                    // to acquire is also the current tracker. If this is\n                    // the case, we have to avoid looking through current\n                    // tracker's children, and instead return the current\n                    // tracker.\n                    // A case where this check is important is e.g.\n                    //     for (int i = 0; i < 5; ++i) {\n                    //         int n = GENERATE(1, 2);\n                    //     }\n                    //\n                    // without it, the code above creates 5 nested generators.\n                    if ( currentTracker.nameAndLocation() == nameAndLocation ) {\n                        auto thisTracker = currentTracker.parent()->findChild(\n                            nameAndLocation );\n                        assert( thisTracker );\n                        assert( thisTracker->isGeneratorTracker() );\n                        tracker = static_cast<GeneratorTracker*>( thisTracker );\n                    } else if ( ITracker* childTracker =\n                                    currentTracker.findChild(\n                                        nameAndLocation ) ) {\n                        assert( childTracker );\n                        assert( childTracker->isGeneratorTracker() );\n                        tracker =\n                            static_cast<GeneratorTracker*>( childTracker );\n                    } else {\n                        return nullptr;\n                    }\n\n                    if ( !tracker->isComplete() ) { tracker->open(); }\n\n                    return tracker;\n                }\n\n                // TrackerBase interface\n                bool isGeneratorTracker() const override { return true; }\n                auto hasGenerator() const -> bool override {\n                    return !!m_generator;\n                }\n                void close() override {\n                    TrackerBase::close();\n                    // If a generator has a child (it is followed by a section)\n                    // and none of its children have started, then we must wait\n                    // until later to start consuming its values.\n                    // This catches cases where `GENERATE` is placed between two\n                    // `SECTION`s.\n                    // **The check for m_children.empty cannot be removed**.\n                    // doing so would break `GENERATE` _not_ followed by\n                    // `SECTION`s.\n                    const bool should_wait_for_child = [&]() {\n                        // No children -> nobody to wait for\n                        if ( m_children.empty() ) { return false; }\n                        // If at least one child started executing, don't wait\n                        if ( std::find_if(\n                                 m_children.begin(),\n                                 m_children.end(),\n                                 []( TestCaseTracking::ITrackerPtr const&\n                                         tracker ) {\n                                     return tracker->hasStarted();\n                                 } ) != m_children.end() ) {\n                            return false;\n                        }\n\n                        // No children have started. We need to check if they\n                        // _can_ start, and thus we should wait for them, or\n                        // they cannot start (due to filters), and we shouldn't\n                        // wait for them\n                        ITracker* parent = m_parent;\n                        // This is safe: there is always at least one section\n                        // tracker in a test case tracking tree\n                        while ( !parent->isSectionTracker() ) {\n                            parent = parent->parent();\n                        }\n                        assert( parent &&\n                                \"Missing root (test case) level section\" );\n\n                        auto const& parentSection =\n                            static_cast<SectionTracker const&>( *parent );\n                        auto const& filters = parentSection.getFilters();\n                        // No filters -> no restrictions on running sections\n                        if ( filters.empty() ) { return true; }\n\n                        for ( auto const& child : m_children ) {\n                            if ( child->isSectionTracker() &&\n                                 std::find( filters.begin(),\n                                            filters.end(),\n                                            static_cast<SectionTracker const&>(\n                                                *child )\n                                                .trimmedName() ) !=\n                                     filters.end() ) {\n                                return true;\n                            }\n                        }\n                        return false;\n                    }();\n\n                    // This check is a bit tricky, because m_generator->next()\n                    // has a side-effect, where it consumes generator's current\n                    // value, but we do not want to invoke the side-effect if\n                    // this generator is still waiting for any child to start.\n                    assert( m_generator && \"Tracker without generator\" );\n                    if ( should_wait_for_child ||\n                         ( m_runState == CompletedSuccessfully &&\n                           m_generator->countedNext() ) ) {\n                        m_children.clear();\n                        m_runState = Executing;\n                    }\n                }\n\n                // IGeneratorTracker interface\n                auto getGenerator() const -> GeneratorBasePtr const& override {\n                    return m_generator;\n                }\n                void setGenerator( GeneratorBasePtr&& generator ) override {\n                    m_generator = CATCH_MOVE( generator );\n                }\n            };\n        } // namespace\n    }\n\n    RunContext::RunContext(IConfig const* _config, IEventListenerPtr&& reporter)\n    :   m_runInfo(_config->name()),\n        m_config(_config),\n        m_reporter(CATCH_MOVE(reporter)),\n        m_lastAssertionInfo{ StringRef(), SourceLineInfo(\"\",0), StringRef(), ResultDisposition::Normal },\n        m_outputRedirect( makeOutputRedirect( m_reporter->getPreferences().shouldRedirectStdOut ) ),\n        m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions )\n    {\n        getCurrentMutableContext().setResultCapture( this );\n        m_reporter->testRunStarting(m_runInfo);\n    }\n\n    RunContext::~RunContext() {\n        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting()));\n    }\n\n    Totals RunContext::runTest(TestCaseHandle const& testCase) {\n        const Totals prevTotals = m_totals;\n\n        auto const& testInfo = testCase.getTestCaseInfo();\n        m_reporter->testCaseStarting(testInfo);\n        testCase.prepareTestCase();\n        m_activeTestCase = &testCase;\n\n\n        ITracker& rootTracker = m_trackerContext.startRun();\n        assert(rootTracker.isSectionTracker());\n        static_cast<SectionTracker&>(rootTracker).addInitialFilters(m_config->getSectionsToRun());\n\n        // We intentionally only seed the internal RNG once per test case,\n        // before it is first invoked. The reason for that is a complex\n        // interplay of generator/section implementation details and the\n        // Random*Generator types.\n        //\n        // The issue boils down to us needing to seed the Random*Generators\n        // with different seed each, so that they return different sequences\n        // of random numbers. We do this by giving them a number from the\n        // shared RNG instance as their seed.\n        //\n        // However, this runs into an issue if the reseeding happens each\n        // time the test case is entered (as opposed to first time only),\n        // because multiple generators could get the same seed, e.g. in\n        // ```cpp\n        // TEST_CASE() {\n        //     auto i = GENERATE(take(10, random(0, 100));\n        //     SECTION(\"A\") {\n        //         auto j = GENERATE(take(10, random(0, 100));\n        //     }\n        //     SECTION(\"B\") {\n        //         auto k = GENERATE(take(10, random(0, 100));\n        //     }\n        // }\n        // ```\n        // `i` and `j` would properly return values from different sequences,\n        // but `i` and `k` would return the same sequence, because their seed\n        // would be the same.\n        // (The reason their seeds would be the same is that the generator\n        //  for k would be initialized when the test case is entered the second\n        //  time, after the shared RNG instance was reset to the same value\n        //  it had when the generator for i was initialized.)\n        seedRng( *m_config );\n\n        uint64_t testRuns = 0;\n        std::string redirectedCout;\n        std::string redirectedCerr;\n        do {\n            m_trackerContext.startCycle();\n            m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocationRef(testInfo.name, testInfo.lineInfo));\n\n            m_reporter->testCasePartialStarting(testInfo, testRuns);\n\n            const auto beforeRunTotals = m_totals;\n            runCurrentTest();\n            std::string oneRunCout = m_outputRedirect->getStdout();\n            std::string oneRunCerr = m_outputRedirect->getStderr();\n            m_outputRedirect->clearBuffers();\n            redirectedCout += oneRunCout;\n            redirectedCerr += oneRunCerr;\n\n            const auto singleRunTotals = m_totals.delta(beforeRunTotals);\n            auto statsForOneRun = TestCaseStats(testInfo, singleRunTotals, CATCH_MOVE(oneRunCout), CATCH_MOVE(oneRunCerr), aborting());\n            m_reporter->testCasePartialEnded(statsForOneRun, testRuns);\n\n            ++testRuns;\n        } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting());\n\n        Totals deltaTotals = m_totals.delta(prevTotals);\n        if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) {\n            deltaTotals.assertions.failed++;\n            deltaTotals.testCases.passed--;\n            deltaTotals.testCases.failed++;\n        }\n        m_totals.testCases += deltaTotals.testCases;\n        testCase.tearDownTestCase();\n        m_reporter->testCaseEnded(TestCaseStats(testInfo,\n                                  deltaTotals,\n                                  CATCH_MOVE(redirectedCout),\n                                  CATCH_MOVE(redirectedCerr),\n                                  aborting()));\n\n        m_activeTestCase = nullptr;\n        m_testCaseTracker = nullptr;\n\n        return deltaTotals;\n    }\n\n\n    void RunContext::assertionEnded(AssertionResult&& result) {\n        if (result.getResultType() == ResultWas::Ok) {\n            m_totals.assertions.passed++;\n            m_lastAssertionPassed = true;\n        } else if (result.getResultType() == ResultWas::ExplicitSkip) {\n            m_totals.assertions.skipped++;\n            m_lastAssertionPassed = true;\n        } else if (!result.succeeded()) {\n            m_lastAssertionPassed = false;\n            if (result.isOk()) {\n            }\n            else if( m_activeTestCase->getTestCaseInfo().okToFail() )\n                m_totals.assertions.failedButOk++;\n            else\n                m_totals.assertions.failed++;\n        }\n        else {\n            m_lastAssertionPassed = true;\n        }\n\n        {\n            auto _ = scopedDeactivate( *m_outputRedirect );\n            m_reporter->assertionEnded( AssertionStats( result, m_messages, m_totals ) );\n        }\n\n        if ( result.getResultType() != ResultWas::Warning ) {\n            m_messageScopes.clear();\n        }\n\n        // Reset working state. assertion info will be reset after\n        // populateReaction is run if it is needed\n        m_lastResult = CATCH_MOVE( result );\n    }\n    void RunContext::resetAssertionInfo() {\n        m_lastAssertionInfo.macroName = StringRef();\n        m_lastAssertionInfo.capturedExpression = \"{Unknown expression after the reported line}\"_sr;\n        m_lastAssertionInfo.resultDisposition = ResultDisposition::Normal;\n    }\n\n    void RunContext::notifyAssertionStarted( AssertionInfo const& info ) {\n        auto _ = scopedDeactivate( *m_outputRedirect );\n        m_reporter->assertionStarting( info );\n    }\n\n    bool RunContext::sectionStarted( StringRef sectionName,\n                                     SourceLineInfo const& sectionLineInfo,\n                                     Counts& assertions ) {\n        ITracker& sectionTracker =\n            SectionTracker::acquire( m_trackerContext,\n                                     TestCaseTracking::NameAndLocationRef(\n                                         sectionName, sectionLineInfo ) );\n\n        if (!sectionTracker.isOpen())\n            return false;\n        m_activeSections.push_back(&sectionTracker);\n\n        SectionInfo sectionInfo( sectionLineInfo, static_cast<std::string>(sectionName) );\n        m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo;\n\n        {\n            auto _ = scopedDeactivate( *m_outputRedirect );\n            m_reporter->sectionStarting( sectionInfo );\n        }\n\n        assertions = m_totals.assertions;\n\n        return true;\n    }\n    IGeneratorTracker*\n    RunContext::acquireGeneratorTracker( StringRef generatorName,\n                                         SourceLineInfo const& lineInfo ) {\n        using namespace Generators;\n        GeneratorTracker* tracker = GeneratorTracker::acquire(\n            m_trackerContext,\n            TestCaseTracking::NameAndLocationRef(\n                 generatorName, lineInfo ) );\n        m_lastAssertionInfo.lineInfo = lineInfo;\n        return tracker;\n    }\n\n    IGeneratorTracker* RunContext::createGeneratorTracker(\n        StringRef generatorName,\n        SourceLineInfo lineInfo,\n        Generators::GeneratorBasePtr&& generator ) {\n\n        auto nameAndLoc = TestCaseTracking::NameAndLocation( static_cast<std::string>( generatorName ), lineInfo );\n        auto& currentTracker = m_trackerContext.currentTracker();\n        assert(\n            currentTracker.nameAndLocation() != nameAndLoc &&\n            \"Trying to create tracker for a genreator that already has one\" );\n\n        auto newTracker = Catch::Detail::make_unique<Generators::GeneratorTracker>(\n            CATCH_MOVE(nameAndLoc), m_trackerContext, &currentTracker );\n        auto ret = newTracker.get();\n        currentTracker.addChild( CATCH_MOVE( newTracker ) );\n\n        ret->setGenerator( CATCH_MOVE( generator ) );\n        ret->open();\n        return ret;\n    }\n\n    bool RunContext::testForMissingAssertions(Counts& assertions) {\n        if (assertions.total() != 0)\n            return false;\n        if (!m_config->warnAboutMissingAssertions())\n            return false;\n        if (m_trackerContext.currentTracker().hasChildren())\n            return false;\n        m_totals.assertions.failed++;\n        assertions.failed++;\n        return true;\n    }\n\n    void RunContext::sectionEnded(SectionEndInfo&& endInfo) {\n        Counts assertions = m_totals.assertions - endInfo.prevAssertions;\n        bool missingAssertions = testForMissingAssertions(assertions);\n\n        if (!m_activeSections.empty()) {\n            m_activeSections.back()->close();\n            m_activeSections.pop_back();\n        }\n\n        {\n            auto _ = scopedDeactivate( *m_outputRedirect );\n            m_reporter->sectionEnded(\n                SectionStats( CATCH_MOVE( endInfo.sectionInfo ),\n                              assertions,\n                              endInfo.durationInSeconds,\n                              missingAssertions ) );\n        }\n\n        m_messages.clear();\n        m_messageScopes.clear();\n    }\n\n    void RunContext::sectionEndedEarly(SectionEndInfo&& endInfo) {\n        if ( m_unfinishedSections.empty() ) {\n            m_activeSections.back()->fail();\n        } else {\n            m_activeSections.back()->close();\n        }\n        m_activeSections.pop_back();\n\n        m_unfinishedSections.push_back(CATCH_MOVE(endInfo));\n    }\n\n    void RunContext::benchmarkPreparing( StringRef name ) {\n        auto _ = scopedDeactivate( *m_outputRedirect );\n        m_reporter->benchmarkPreparing( name );\n    }\n    void RunContext::benchmarkStarting( BenchmarkInfo const& info ) {\n        auto _ = scopedDeactivate( *m_outputRedirect );\n        m_reporter->benchmarkStarting( info );\n    }\n    void RunContext::benchmarkEnded( BenchmarkStats<> const& stats ) {\n        auto _ = scopedDeactivate( *m_outputRedirect );\n        m_reporter->benchmarkEnded( stats );\n    }\n    void RunContext::benchmarkFailed( StringRef error ) {\n        auto _ = scopedDeactivate( *m_outputRedirect );\n        m_reporter->benchmarkFailed( error );\n    }\n\n    void RunContext::pushScopedMessage(MessageInfo const & message) {\n        m_messages.push_back(message);\n    }\n\n    void RunContext::popScopedMessage(MessageInfo const & message) {\n        m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end());\n    }\n\n    void RunContext::emplaceUnscopedMessage( MessageBuilder&& builder ) {\n        m_messageScopes.emplace_back( CATCH_MOVE(builder) );\n    }\n\n    std::string RunContext::getCurrentTestName() const {\n        return m_activeTestCase\n            ? m_activeTestCase->getTestCaseInfo().name\n            : std::string();\n    }\n\n    const AssertionResult * RunContext::getLastResult() const {\n        return &(*m_lastResult);\n    }\n\n    void RunContext::exceptionEarlyReported() {\n        m_shouldReportUnexpected = false;\n    }\n\n    void RunContext::handleFatalErrorCondition( StringRef message ) {\n        // TODO: scoped deactivate here? Just give up and do best effort?\n        //       the deactivation can break things further, OTOH so can the\n        //       capture\n        auto _ = scopedDeactivate( *m_outputRedirect );\n\n        // First notify reporter that bad things happened\n        m_reporter->fatalErrorEncountered( message );\n\n        // Don't rebuild the result -- the stringification itself can cause more fatal errors\n        // Instead, fake a result data.\n        AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } );\n        tempResult.message = static_cast<std::string>(message);\n        AssertionResult result(m_lastAssertionInfo, CATCH_MOVE(tempResult));\n\n        assertionEnded(CATCH_MOVE(result) );\n        resetAssertionInfo();\n\n        // Best effort cleanup for sections that have not been destructed yet\n        // Since this is a fatal error, we have not had and won't have the opportunity to destruct them properly\n        while (!m_activeSections.empty()) {\n            auto nl = m_activeSections.back()->nameAndLocation();\n            SectionEndInfo endInfo{ SectionInfo(CATCH_MOVE(nl.location), CATCH_MOVE(nl.name)), {}, 0.0 };\n            sectionEndedEarly(CATCH_MOVE(endInfo));\n        }\n        handleUnfinishedSections();\n\n        // Recreate section for test case (as we will lose the one that was in scope)\n        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();\n        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);\n\n        Counts assertions;\n        assertions.failed = 1;\n        SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, 0, false);\n        m_reporter->sectionEnded( testCaseSectionStats );\n\n        auto const& testInfo = m_activeTestCase->getTestCaseInfo();\n\n        Totals deltaTotals;\n        deltaTotals.testCases.failed = 1;\n        deltaTotals.assertions.failed = 1;\n        m_reporter->testCaseEnded(TestCaseStats(testInfo,\n                                  deltaTotals,\n                                  std::string(),\n                                  std::string(),\n                                  false));\n        m_totals.testCases.failed++;\n        m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false));\n    }\n\n    bool RunContext::lastAssertionPassed() {\n         return m_lastAssertionPassed;\n    }\n\n    void RunContext::assertionPassed() {\n        m_lastAssertionPassed = true;\n        ++m_totals.assertions.passed;\n        resetAssertionInfo();\n        m_messageScopes.clear();\n    }\n\n    bool RunContext::aborting() const {\n        return m_totals.assertions.failed >= static_cast<std::size_t>(m_config->abortAfter());\n    }\n\n    void RunContext::runCurrentTest() {\n        auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo();\n        SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name);\n        m_reporter->sectionStarting(testCaseSection);\n        Counts prevAssertions = m_totals.assertions;\n        double duration = 0;\n        m_shouldReportUnexpected = true;\n        m_lastAssertionInfo = { \"TEST_CASE\"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal };\n\n        Timer timer;\n        CATCH_TRY {\n            {\n                auto _ = scopedActivate( *m_outputRedirect );\n                timer.start();\n                invokeActiveTestCase();\n            }\n            duration = timer.getElapsedSeconds();\n        } CATCH_CATCH_ANON (TestFailureException&) {\n            // This just means the test was aborted due to failure\n        } CATCH_CATCH_ANON (TestSkipException&) {\n            // This just means the test was explicitly skipped\n        } CATCH_CATCH_ALL {\n            // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions\n            // are reported without translation at the point of origin.\n            if( m_shouldReportUnexpected ) {\n                AssertionReaction dummyReaction;\n                handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction );\n            }\n        }\n        Counts assertions = m_totals.assertions - prevAssertions;\n        bool missingAssertions = testForMissingAssertions(assertions);\n\n        m_testCaseTracker->close();\n        handleUnfinishedSections();\n        m_messages.clear();\n        m_messageScopes.clear();\n\n        SectionStats testCaseSectionStats(CATCH_MOVE(testCaseSection), assertions, duration, missingAssertions);\n        m_reporter->sectionEnded(testCaseSectionStats);\n    }\n\n    void RunContext::invokeActiveTestCase() {\n        // We need to engage a handler for signals/structured exceptions\n        // before running the tests themselves, or the binary can crash\n        // without failed test being reported.\n        FatalConditionHandlerGuard _(&m_fatalConditionhandler);\n        // We keep having issue where some compilers warn about an unused\n        // variable, even though the type has non-trivial constructor and\n        // destructor. This is annoying and ugly, but it makes them stfu.\n        (void)_;\n\n        m_activeTestCase->invoke();\n    }\n\n    void RunContext::handleUnfinishedSections() {\n        // If sections ended prematurely due to an exception we stored their\n        // infos here so we can tear them down outside the unwind process.\n        for ( auto it = m_unfinishedSections.rbegin(),\n                   itEnd = m_unfinishedSections.rend();\n              it != itEnd;\n              ++it ) {\n            sectionEnded( CATCH_MOVE( *it ) );\n        }\n        m_unfinishedSections.clear();\n    }\n\n    void RunContext::handleExpr(\n        AssertionInfo const& info,\n        ITransientExpression const& expr,\n        AssertionReaction& reaction\n    ) {\n        bool negated = isFalseTest( info.resultDisposition );\n        bool result = expr.getResult() != negated;\n\n        if( result ) {\n            if (!m_includeSuccessfulResults) {\n                assertionPassed();\n            }\n            else {\n                reportExpr(info, ResultWas::Ok, &expr, negated);\n            }\n        }\n        else {\n            reportExpr(info, ResultWas::ExpressionFailed, &expr, negated );\n            populateReaction( reaction );\n        }\n        resetAssertionInfo();\n    }\n    void RunContext::reportExpr(\n            AssertionInfo const &info,\n            ResultWas::OfType resultType,\n            ITransientExpression const *expr,\n            bool negated ) {\n\n        m_lastAssertionInfo = info;\n        AssertionResultData data( resultType, LazyExpression( negated ) );\n\n        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };\n        assertionResult.m_resultData.lazyExpression.m_transientExpression = expr;\n\n        assertionEnded( CATCH_MOVE(assertionResult) );\n    }\n\n    void RunContext::handleMessage(\n            AssertionInfo const& info,\n            ResultWas::OfType resultType,\n            std::string&& message,\n            AssertionReaction& reaction\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( resultType, LazyExpression( false ) );\n        data.message = CATCH_MOVE( message );\n        AssertionResult assertionResult{ m_lastAssertionInfo,\n                                         CATCH_MOVE( data ) };\n\n        const auto isOk = assertionResult.isOk();\n        assertionEnded( CATCH_MOVE(assertionResult) );\n        if ( !isOk ) {\n            populateReaction( reaction );\n        } else if ( resultType == ResultWas::ExplicitSkip ) {\n            // TODO: Need to handle this explicitly, as ExplicitSkip is\n            // considered \"OK\"\n            reaction.shouldSkip = true;\n        }\n        resetAssertionInfo();\n    }\n    void RunContext::handleUnexpectedExceptionNotThrown(\n            AssertionInfo const& info,\n            AssertionReaction& reaction\n    ) {\n        handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction);\n    }\n\n    void RunContext::handleUnexpectedInflightException(\n            AssertionInfo const& info,\n            std::string&& message,\n            AssertionReaction& reaction\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );\n        data.message = CATCH_MOVE(message);\n        AssertionResult assertionResult{ info, CATCH_MOVE(data) };\n        assertionEnded( CATCH_MOVE(assertionResult) );\n        populateReaction( reaction );\n        resetAssertionInfo();\n    }\n\n    void RunContext::populateReaction( AssertionReaction& reaction ) {\n        reaction.shouldDebugBreak = m_config->shouldDebugBreak();\n        reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal);\n    }\n\n    void RunContext::handleIncomplete(\n            AssertionInfo const& info\n    ) {\n        using namespace std::string_literals;\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) );\n        data.message = \"Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE\"s;\n        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };\n        assertionEnded( CATCH_MOVE(assertionResult) );\n        resetAssertionInfo();\n    }\n    void RunContext::handleNonExpr(\n            AssertionInfo const &info,\n            ResultWas::OfType resultType,\n            AssertionReaction &reaction\n    ) {\n        m_lastAssertionInfo = info;\n\n        AssertionResultData data( resultType, LazyExpression( false ) );\n        AssertionResult assertionResult{ info, CATCH_MOVE( data ) };\n\n        const auto isOk = assertionResult.isOk();\n        assertionEnded( CATCH_MOVE(assertionResult) );\n        if ( !isOk ) { populateReaction( reaction ); }\n        resetAssertionInfo();\n    }\n\n\n    IResultCapture& getResultCapture() {\n        if (auto* capture = getCurrentContext().getResultCapture())\n            return *capture;\n        else\n            CATCH_INTERNAL_ERROR(\"No result capture instance\");\n    }\n\n    void seedRng(IConfig const& config) {\n        sharedRng().seed(config.rngSeed());\n    }\n\n    unsigned int rngSeed() {\n        return getCurrentContext().getConfig()->rngSeed();\n    }\n\n}\n\n\n\nnamespace Catch {\n\n    Section::Section( SectionInfo&& info ):\n        m_info( CATCH_MOVE( info ) ),\n        m_sectionIncluded(\n            getResultCapture().sectionStarted( m_info.name, m_info.lineInfo, m_assertions ) ) {\n        // Non-\"included\" sections will not use the timing information\n        // anyway, so don't bother with the potential syscall.\n        if (m_sectionIncluded) {\n            m_timer.start();\n        }\n    }\n\n    Section::Section( SourceLineInfo const& _lineInfo,\n                      StringRef _name,\n                      const char* const ):\n        m_info( { \"invalid\", static_cast<std::size_t>( -1 ) }, std::string{} ),\n        m_sectionIncluded(\n            getResultCapture().sectionStarted( _name, _lineInfo, m_assertions ) ) {\n        // We delay initialization the SectionInfo member until we know\n        // this section needs it, so we avoid allocating std::string for name.\n        // We also delay timer start to avoid the potential syscall unless we\n        // will actually use the result.\n        if ( m_sectionIncluded ) {\n            m_info.name = static_cast<std::string>( _name );\n            m_info.lineInfo = _lineInfo;\n            m_timer.start();\n        }\n    }\n\n    Section::~Section() {\n        if( m_sectionIncluded ) {\n            SectionEndInfo endInfo{ CATCH_MOVE(m_info), m_assertions, m_timer.getElapsedSeconds() };\n            if ( uncaught_exceptions() ) {\n                getResultCapture().sectionEndedEarly( CATCH_MOVE(endInfo) );\n            } else {\n                getResultCapture().sectionEnded( CATCH_MOVE( endInfo ) );\n            }\n        }\n    }\n\n    // This indicates whether the section should be executed or not\n    Section::operator bool() const {\n        return m_sectionIncluded;\n    }\n\n\n} // end namespace Catch\n\n\n\n#include <vector>\n\nnamespace Catch {\n\n    namespace {\n        static auto getSingletons() -> std::vector<ISingleton*>*& {\n            static std::vector<ISingleton*>* g_singletons = nullptr;\n            if( !g_singletons )\n                g_singletons = new std::vector<ISingleton*>();\n            return g_singletons;\n        }\n    }\n\n    ISingleton::~ISingleton() = default;\n\n    void addSingleton(ISingleton* singleton ) {\n        getSingletons()->push_back( singleton );\n    }\n    void cleanupSingletons() {\n        auto& singletons = getSingletons();\n        for( auto singleton : *singletons )\n            delete singleton;\n        delete singletons;\n        singletons = nullptr;\n    }\n\n} // namespace Catch\n\n\n\n#include <cstring>\n#include <ostream>\n\nnamespace Catch {\n\n    bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept {\n        return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0);\n    }\n    bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept {\n        // We can assume that the same file will usually have the same pointer.\n        // Thus, if the pointers are the same, there is no point in calling the strcmp\n        return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0));\n    }\n\n    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) {\n#ifndef __GNUG__\n        os << info.file << '(' << info.line << ')';\n#else\n        os << info.file << ':' << info.line;\n#endif\n        return os;\n    }\n\n} // end namespace Catch\n\n\n\n\nnamespace Catch {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept {\n        CATCH_TRY {\n            m_exceptions.push_back(exception);\n        } CATCH_CATCH_ALL {\n            // If we run out of memory during start-up there's really not a lot more we can do about it\n            std::terminate();\n        }\n    }\n\n    std::vector<std::exception_ptr> const& StartupExceptionRegistry::getExceptions() const noexcept {\n        return m_exceptions;\n    }\n#endif\n\n} // end namespace Catch\n\n\n\n\n\n#include <iostream>\n\nnamespace Catch {\n\n// If you #define this you must implement these functions\n#if !defined( CATCH_CONFIG_NOSTDOUT )\n    std::ostream& cout() { return std::cout; }\n    std::ostream& cerr() { return std::cerr; }\n    std::ostream& clog() { return std::clog; }\n#endif\n\n} // namespace Catch\n\n\n\n#include <ostream>\n#include <cstring>\n#include <cctype>\n#include <vector>\n\nnamespace Catch {\n\n    bool startsWith( std::string const& s, std::string const& prefix ) {\n        return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin());\n    }\n    bool startsWith( StringRef s, char prefix ) {\n        return !s.empty() && s[0] == prefix;\n    }\n    bool endsWith( std::string const& s, std::string const& suffix ) {\n        return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin());\n    }\n    bool endsWith( std::string const& s, char suffix ) {\n        return !s.empty() && s[s.size()-1] == suffix;\n    }\n    bool contains( std::string const& s, std::string const& infix ) {\n        return s.find( infix ) != std::string::npos;\n    }\n    void toLowerInPlace( std::string& s ) {\n        for ( char& c : s ) {\n            c = toLower( c );\n        }\n    }\n    std::string toLower( std::string const& s ) {\n        std::string lc = s;\n        toLowerInPlace( lc );\n        return lc;\n    }\n    char toLower(char c) {\n        return static_cast<char>(std::tolower(static_cast<unsigned char>(c)));\n    }\n\n    std::string trim( std::string const& str ) {\n        static char const* whitespaceChars = \"\\n\\r\\t \";\n        std::string::size_type start = str.find_first_not_of( whitespaceChars );\n        std::string::size_type end = str.find_last_not_of( whitespaceChars );\n\n        return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string();\n    }\n\n    StringRef trim(StringRef ref) {\n        const auto is_ws = [](char c) {\n            return c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n        };\n        size_t real_begin = 0;\n        while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; }\n        size_t real_end = ref.size();\n        while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; }\n\n        return ref.substr(real_begin, real_end - real_begin);\n    }\n\n    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) {\n        std::size_t i = str.find( replaceThis );\n        if (i == std::string::npos) {\n            return false;\n        }\n        std::size_t copyBegin = 0;\n        std::string origStr = CATCH_MOVE(str);\n        str.clear();\n        // There is at least one replacement, so reserve with the best guess\n        // we can make without actually counting the number of occurences.\n        str.reserve(origStr.size() - replaceThis.size() + withThis.size());\n        do {\n            str.append(origStr, copyBegin, i-copyBegin );\n            str += withThis;\n            copyBegin = i + replaceThis.size();\n            if( copyBegin < origStr.size() )\n                i = origStr.find( replaceThis, copyBegin );\n            else\n                i = std::string::npos;\n        } while( i != std::string::npos );\n        if ( copyBegin < origStr.size() ) {\n            str.append(origStr, copyBegin, origStr.size() );\n        }\n        return true;\n    }\n\n    std::vector<StringRef> splitStringRef( StringRef str, char delimiter ) {\n        std::vector<StringRef> subStrings;\n        std::size_t start = 0;\n        for(std::size_t pos = 0; pos < str.size(); ++pos ) {\n            if( str[pos] == delimiter ) {\n                if( pos - start > 1 )\n                    subStrings.push_back( str.substr( start, pos-start ) );\n                start = pos+1;\n            }\n        }\n        if( start < str.size() )\n            subStrings.push_back( str.substr( start, str.size()-start ) );\n        return subStrings;\n    }\n\n    std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) {\n        os << pluraliser.m_count << ' ' << pluraliser.m_label;\n        if( pluraliser.m_count != 1 )\n            os << 's';\n        return os;\n    }\n\n}\n\n\n\n#include <algorithm>\n#include <ostream>\n#include <cstring>\n#include <cstdint>\n\nnamespace Catch {\n    StringRef::StringRef( char const* rawChars ) noexcept\n    : StringRef( rawChars, std::strlen(rawChars) )\n    {}\n\n\n    bool StringRef::operator<(StringRef rhs) const noexcept {\n        if (m_size < rhs.m_size) {\n            return strncmp(m_start, rhs.m_start, m_size) <= 0;\n        }\n        return strncmp(m_start, rhs.m_start, rhs.m_size) < 0;\n    }\n\n    int StringRef::compare( StringRef rhs ) const {\n        auto cmpResult =\n            strncmp( m_start, rhs.m_start, std::min( m_size, rhs.m_size ) );\n\n        // This means that strncmp found a difference before the strings\n        // ended, and we can return it directly\n        if ( cmpResult != 0 ) {\n            return cmpResult;\n        }\n\n        // If strings are equal up to length, then their comparison results on\n        // their size\n        if ( m_size < rhs.m_size ) {\n            return -1;\n        } else if ( m_size > rhs.m_size ) {\n            return 1;\n        } else {\n            return 0;\n        }\n    }\n\n    auto operator << ( std::ostream& os, StringRef str ) -> std::ostream& {\n        return os.write(str.data(), static_cast<std::streamsize>(str.size()));\n    }\n\n    std::string operator+(StringRef lhs, StringRef rhs) {\n        std::string ret;\n        ret.reserve(lhs.size() + rhs.size());\n        ret += lhs;\n        ret += rhs;\n        return ret;\n    }\n\n    auto operator+=( std::string& lhs, StringRef rhs ) -> std::string& {\n        lhs.append(rhs.data(), rhs.size());\n        return lhs;\n    }\n\n} // namespace Catch\n\n\n\nnamespace Catch {\n\n    TagAliasRegistry::~TagAliasRegistry() = default;\n\n    TagAlias const* TagAliasRegistry::find( std::string const& alias ) const {\n        auto it = m_registry.find( alias );\n        if( it != m_registry.end() )\n            return &(it->second);\n        else\n            return nullptr;\n    }\n\n    std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const {\n        std::string expandedTestSpec = unexpandedTestSpec;\n        for( auto const& registryKvp : m_registry ) {\n            std::size_t pos = expandedTestSpec.find( registryKvp.first );\n            if( pos != std::string::npos ) {\n                expandedTestSpec =  expandedTestSpec.substr( 0, pos ) +\n                                    registryKvp.second.tag +\n                                    expandedTestSpec.substr( pos + registryKvp.first.size() );\n            }\n        }\n        return expandedTestSpec;\n    }\n\n    void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) {\n        CATCH_ENFORCE( startsWith(alias, \"[@\") && endsWith(alias, ']'),\n                      \"error: tag alias, '\" << alias << \"' is not of the form [@alias name].\\n\" << lineInfo );\n\n        CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second,\n                      \"error: tag alias, '\" << alias << \"' already registered.\\n\"\n                      << \"\\tFirst seen at: \" << find(alias)->lineInfo << \"\\n\"\n                      << \"\\tRedefined at: \" << lineInfo );\n    }\n\n    ITagAliasRegistry::~ITagAliasRegistry() = default;\n\n    ITagAliasRegistry const& ITagAliasRegistry::get() {\n        return getRegistryHub().getTagAliasRegistry();\n    }\n\n} // end namespace Catch\n\n\n\n\nnamespace Catch {\n    TestCaseInfoHasher::TestCaseInfoHasher( hash_t seed ): m_seed( seed ) {}\n\n    uint32_t TestCaseInfoHasher::operator()( TestCaseInfo const& t ) const {\n        // FNV-1a hash algorithm that is designed for uniqueness:\n        const hash_t prime = 1099511628211u;\n        hash_t hash = 14695981039346656037u;\n        for ( const char c : t.name ) {\n            hash ^= c;\n            hash *= prime;\n        }\n        for ( const char c : t.className ) {\n            hash ^= c;\n            hash *= prime;\n        }\n        for ( const Tag& tag : t.tags ) {\n            for ( const char c : tag.original ) {\n                hash ^= c;\n                hash *= prime;\n            }\n        }\n        hash ^= m_seed;\n        hash *= prime;\n        const uint32_t low{ static_cast<uint32_t>( hash ) };\n        const uint32_t high{ static_cast<uint32_t>( hash >> 32 ) };\n        return low * high;\n    }\n} // namespace Catch\n\n\n\n\n#include <algorithm>\n#include <set>\n\nnamespace Catch {\n\n    namespace {\n        static void enforceNoDuplicateTestCases(\n            std::vector<TestCaseHandle> const& tests ) {\n            auto testInfoCmp = []( TestCaseInfo const* lhs,\n                                   TestCaseInfo const* rhs ) {\n                return *lhs < *rhs;\n            };\n            std::set<TestCaseInfo const*, decltype( testInfoCmp )&> seenTests(\n                testInfoCmp );\n            for ( auto const& test : tests ) {\n                const auto infoPtr = &test.getTestCaseInfo();\n                const auto prev = seenTests.insert( infoPtr );\n                CATCH_ENFORCE( prev.second,\n                               \"error: test case \\\"\"\n                                   << infoPtr->name << \"\\\", with tags \\\"\"\n                                   << infoPtr->tagsAsString()\n                                   << \"\\\" already defined.\\n\"\n                                   << \"\\tFirst seen at \"\n                                   << ( *prev.first )->lineInfo << \"\\n\"\n                                   << \"\\tRedefined at \" << infoPtr->lineInfo );\n            }\n        }\n\n        static bool matchTest( TestCaseHandle const& testCase,\n                               TestSpec const& testSpec,\n                               IConfig const& config ) {\n            return testSpec.matches( testCase.getTestCaseInfo() ) &&\n                   isThrowSafe( testCase, config );\n        }\n\n    } // end unnamed namespace\n\n    std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases ) {\n        switch (config.runOrder()) {\n        case TestRunOrder::Declared:\n            return unsortedTestCases;\n\n        case TestRunOrder::LexicographicallySorted: {\n            std::vector<TestCaseHandle> sorted = unsortedTestCases;\n            std::sort(\n                sorted.begin(),\n                sorted.end(),\n                []( TestCaseHandle const& lhs, TestCaseHandle const& rhs ) {\n                    return lhs.getTestCaseInfo() < rhs.getTestCaseInfo();\n                }\n            );\n            return sorted;\n        }\n        case TestRunOrder::Randomized: {\n            using TestWithHash = std::pair<TestCaseInfoHasher::hash_t, TestCaseHandle>;\n\n            TestCaseInfoHasher h{ config.rngSeed() };\n            std::vector<TestWithHash> indexed_tests;\n            indexed_tests.reserve(unsortedTestCases.size());\n\n            for (auto const& handle : unsortedTestCases) {\n                indexed_tests.emplace_back(h(handle.getTestCaseInfo()), handle);\n            }\n\n            std::sort( indexed_tests.begin(),\n                       indexed_tests.end(),\n                       []( TestWithHash const& lhs, TestWithHash const& rhs ) {\n                           if ( lhs.first == rhs.first ) {\n                               return lhs.second.getTestCaseInfo() <\n                                      rhs.second.getTestCaseInfo();\n                           }\n                           return lhs.first < rhs.first;\n                       } );\n\n            std::vector<TestCaseHandle> randomized;\n            randomized.reserve(indexed_tests.size());\n\n            for (auto const& indexed : indexed_tests) {\n                randomized.push_back(indexed.second);\n            }\n\n            return randomized;\n        }\n        }\n\n        CATCH_INTERNAL_ERROR(\"Unknown test order value!\");\n    }\n\n    bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config ) {\n        return !testCase.getTestCaseInfo().throws() || config.allowThrows();\n    }\n\n    std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config ) {\n        std::vector<TestCaseHandle> filtered;\n        filtered.reserve( testCases.size() );\n        for (auto const& testCase : testCases) {\n            if ((!testSpec.hasFilters() && !testCase.getTestCaseInfo().isHidden()) ||\n                (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) {\n                filtered.push_back(testCase);\n            }\n        }\n        return createShard(filtered, config.shardCount(), config.shardIndex());\n    }\n    std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config ) {\n        return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );\n    }\n\n    TestRegistry::~TestRegistry() = default;\n\n    void TestRegistry::registerTest(Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker) {\n        m_handles.emplace_back(testInfo.get(), testInvoker.get());\n        m_viewed_test_infos.push_back(testInfo.get());\n        m_owned_test_infos.push_back(CATCH_MOVE(testInfo));\n        m_invokers.push_back(CATCH_MOVE(testInvoker));\n    }\n\n    std::vector<TestCaseInfo*> const& TestRegistry::getAllInfos() const {\n        return m_viewed_test_infos;\n    }\n\n    std::vector<TestCaseHandle> const& TestRegistry::getAllTests() const {\n        return m_handles;\n    }\n    std::vector<TestCaseHandle> const& TestRegistry::getAllTestsSorted( IConfig const& config ) const {\n        if( m_sortedFunctions.empty() )\n            enforceNoDuplicateTestCases( m_handles );\n\n        if(  m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {\n            m_sortedFunctions = sortTests( config, m_handles );\n            m_currentSortOrder = config.runOrder();\n        }\n        return m_sortedFunctions;\n    }\n\n} // end namespace Catch\n\n\n\n\n#include <algorithm>\n#include <cassert>\n\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n\nnamespace Catch {\nnamespace TestCaseTracking {\n\n    NameAndLocation::NameAndLocation( std::string&& _name, SourceLineInfo const& _location )\n    :   name( CATCH_MOVE(_name) ),\n        location( _location )\n    {}\n\n\n    ITracker::~ITracker() = default;\n\n    void ITracker::markAsNeedingAnotherRun() {\n        m_runState = NeedsAnotherRun;\n    }\n\n    void ITracker::addChild( ITrackerPtr&& child ) {\n        m_children.push_back( CATCH_MOVE(child) );\n    }\n\n    ITracker* ITracker::findChild( NameAndLocationRef const& nameAndLocation ) {\n        auto it = std::find_if(\n            m_children.begin(),\n            m_children.end(),\n            [&nameAndLocation]( ITrackerPtr const& tracker ) {\n                auto const& tnameAndLoc = tracker->nameAndLocation();\n                if ( tnameAndLoc.location.line !=\n                     nameAndLocation.location.line ) {\n                    return false;\n                }\n                return tnameAndLoc == nameAndLocation;\n            } );\n        return ( it != m_children.end() ) ? it->get() : nullptr;\n    }\n\n    bool ITracker::isSectionTracker() const { return false; }\n    bool ITracker::isGeneratorTracker() const { return false; }\n\n    bool ITracker::isOpen() const {\n        return m_runState != NotStarted && !isComplete();\n    }\n\n    bool ITracker::hasStarted() const { return m_runState != NotStarted; }\n\n    void ITracker::openChild() {\n        if (m_runState != ExecutingChildren) {\n            m_runState = ExecutingChildren;\n            if (m_parent) {\n                m_parent->openChild();\n            }\n        }\n    }\n\n    ITracker& TrackerContext::startRun() {\n        using namespace std::string_literals;\n        m_rootTracker = Catch::Detail::make_unique<SectionTracker>(\n            NameAndLocation( \"{root}\"s, CATCH_INTERNAL_LINEINFO ),\n            *this,\n            nullptr );\n        m_currentTracker = nullptr;\n        m_runState = Executing;\n        return *m_rootTracker;\n    }\n\n    void TrackerContext::completeCycle() {\n        m_runState = CompletedCycle;\n    }\n\n    bool TrackerContext::completedCycle() const {\n        return m_runState == CompletedCycle;\n    }\n    void TrackerContext::setCurrentTracker( ITracker* tracker ) {\n        m_currentTracker = tracker;\n    }\n\n\n    TrackerBase::TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent ):\n        ITracker(CATCH_MOVE(nameAndLocation), parent),\n        m_ctx( ctx )\n    {}\n\n    bool TrackerBase::isComplete() const {\n        return m_runState == CompletedSuccessfully || m_runState == Failed;\n    }\n\n    void TrackerBase::open() {\n        m_runState = Executing;\n        moveToThis();\n        if( m_parent )\n            m_parent->openChild();\n    }\n\n    void TrackerBase::close() {\n\n        // Close any still open children (e.g. generators)\n        while( &m_ctx.currentTracker() != this )\n            m_ctx.currentTracker().close();\n\n        switch( m_runState ) {\n            case NeedsAnotherRun:\n                break;\n\n            case Executing:\n                m_runState = CompletedSuccessfully;\n                break;\n            case ExecutingChildren:\n                if( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->isComplete(); }) )\n                    m_runState = CompletedSuccessfully;\n                break;\n\n            case NotStarted:\n            case CompletedSuccessfully:\n            case Failed:\n                CATCH_INTERNAL_ERROR( \"Illogical state: \" << m_runState );\n\n            default:\n                CATCH_INTERNAL_ERROR( \"Unknown state: \" << m_runState );\n        }\n        moveToParent();\n        m_ctx.completeCycle();\n    }\n    void TrackerBase::fail() {\n        m_runState = Failed;\n        if( m_parent )\n            m_parent->markAsNeedingAnotherRun();\n        moveToParent();\n        m_ctx.completeCycle();\n    }\n\n    void TrackerBase::moveToParent() {\n        assert( m_parent );\n        m_ctx.setCurrentTracker( m_parent );\n    }\n    void TrackerBase::moveToThis() {\n        m_ctx.setCurrentTracker( this );\n    }\n\n    SectionTracker::SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent )\n    :   TrackerBase( CATCH_MOVE(nameAndLocation), ctx, parent ),\n        m_trimmed_name(trim(StringRef(ITracker::nameAndLocation().name)))\n    {\n        if( parent ) {\n            while ( !parent->isSectionTracker() ) {\n                parent = parent->parent();\n            }\n\n            SectionTracker& parentSection = static_cast<SectionTracker&>( *parent );\n            addNextFilters( parentSection.m_filters );\n        }\n    }\n\n    bool SectionTracker::isComplete() const {\n        bool complete = true;\n\n        if (m_filters.empty()\n            || m_filters[0].empty()\n            || std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) {\n            complete = TrackerBase::isComplete();\n        }\n        return complete;\n    }\n\n    bool SectionTracker::isSectionTracker() const { return true; }\n\n    SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation ) {\n        SectionTracker* tracker;\n\n        ITracker& currentTracker = ctx.currentTracker();\n        if ( ITracker* childTracker =\n                 currentTracker.findChild( nameAndLocation ) ) {\n            assert( childTracker );\n            assert( childTracker->isSectionTracker() );\n            tracker = static_cast<SectionTracker*>( childTracker );\n        } else {\n            auto newTracker = Catch::Detail::make_unique<SectionTracker>(\n                NameAndLocation{ static_cast<std::string>(nameAndLocation.name),\n                                 nameAndLocation.location },\n                ctx,\n                &currentTracker );\n            tracker = newTracker.get();\n            currentTracker.addChild( CATCH_MOVE( newTracker ) );\n        }\n\n        if ( !ctx.completedCycle() ) {\n            tracker->tryOpen();\n        }\n\n        return *tracker;\n    }\n\n    void SectionTracker::tryOpen() {\n        if( !isComplete() )\n            open();\n    }\n\n    void SectionTracker::addInitialFilters( std::vector<std::string> const& filters ) {\n        if( !filters.empty() ) {\n            m_filters.reserve( m_filters.size() + filters.size() + 2 );\n            m_filters.emplace_back(StringRef{}); // Root - should never be consulted\n            m_filters.emplace_back(StringRef{}); // Test Case - not a section filter\n            m_filters.insert( m_filters.end(), filters.begin(), filters.end() );\n        }\n    }\n    void SectionTracker::addNextFilters( std::vector<StringRef> const& filters ) {\n        if( filters.size() > 1 )\n            m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() );\n    }\n\n    StringRef SectionTracker::trimmedName() const {\n        return m_trimmed_name;\n    }\n\n} // namespace TestCaseTracking\n\n} // namespace Catch\n\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n\n\n\n\nnamespace Catch {\n\n    void throw_test_failure_exception() {\n#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )\n        throw TestFailureException{};\n#else\n        CATCH_ERROR( \"Test failure requires aborting test!\" );\n#endif\n    }\n\n    void throw_test_skip_exception() {\n#if !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS )\n        throw Catch::TestSkipException();\n#else\n        CATCH_ERROR( \"Explicitly skipping tests during runtime requires exceptions\" );\n#endif\n    }\n\n} // namespace Catch\n\n\n\n#include <algorithm>\n#include <iterator>\n\nnamespace Catch {\n    void ITestInvoker::prepareTestCase() {}\n    void ITestInvoker::tearDownTestCase() {}\n    ITestInvoker::~ITestInvoker() = default;\n\n    namespace {\n        static StringRef extractClassName( StringRef classOrMethodName ) {\n            if ( !startsWith( classOrMethodName, '&' ) ) {\n                return classOrMethodName;\n            }\n\n            // Remove the leading '&' to avoid having to special case it later\n            const auto methodName =\n                classOrMethodName.substr( 1, classOrMethodName.size() );\n\n            auto reverseStart = std::make_reverse_iterator( methodName.end() );\n            auto reverseEnd = std::make_reverse_iterator( methodName.begin() );\n\n            // We make a simplifying assumption that \":\" is only present\n            // in the input as part of \"::\" from C++ typenames (this is\n            // relatively safe assumption because the input is generated\n            // as stringification of type through preprocessor).\n            auto lastColons = std::find( reverseStart, reverseEnd, ':' ) + 1;\n            auto secondLastColons =\n                std::find( lastColons + 1, reverseEnd, ':' );\n\n            auto const startIdx = reverseEnd - secondLastColons;\n            auto const classNameSize = secondLastColons - lastColons - 1;\n\n            return methodName.substr(\n                static_cast<std::size_t>( startIdx ),\n                static_cast<std::size_t>( classNameSize ) );\n        }\n\n        class TestInvokerAsFunction final : public ITestInvoker {\n            using TestType = void ( * )();\n            TestType m_testAsFunction;\n\n        public:\n            constexpr TestInvokerAsFunction( TestType testAsFunction ) noexcept:\n                m_testAsFunction( testAsFunction ) {}\n\n            void invoke() const override { m_testAsFunction(); }\n        };\n\n    } // namespace\n\n    Detail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() ) {\n        return Detail::make_unique<TestInvokerAsFunction>( testAsFunction );\n    }\n\n    AutoReg::AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept {\n        CATCH_TRY {\n            getMutableRegistryHub()\n                    .registerTest(\n                        makeTestCaseInfo(\n                            extractClassName( classOrMethod ),\n                            nameAndTags,\n                            lineInfo),\n                        CATCH_MOVE(invoker)\n                    );\n        } CATCH_CATCH_ALL {\n            // Do not throw when constructing global objects, instead register the exception to be processed later\n            getMutableRegistryHub().registerStartupException();\n        }\n    }\n}\n\n\n\n\n\nnamespace Catch {\n\n    TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {}\n\n    TestSpecParser& TestSpecParser::parse( std::string const& arg ) {\n        m_mode = None;\n        m_exclusion = false;\n        m_arg = m_tagAliases->expandAliases( arg );\n        m_escapeChars.clear();\n        m_substring.reserve(m_arg.size());\n        m_patternName.reserve(m_arg.size());\n        m_realPatternPos = 0;\n\n        for( m_pos = 0; m_pos < m_arg.size(); ++m_pos )\n          //if visitChar fails\n           if( !visitChar( m_arg[m_pos] ) ){\n               m_testSpec.m_invalidSpecs.push_back(arg);\n               break;\n           }\n        endMode();\n        return *this;\n    }\n    TestSpec TestSpecParser::testSpec() {\n        addFilter();\n        return CATCH_MOVE(m_testSpec);\n    }\n    bool TestSpecParser::visitChar( char c ) {\n        if( (m_mode != EscapedName) && (c == '\\\\') ) {\n            escape();\n            addCharToPattern(c);\n            return true;\n        }else if((m_mode != EscapedName) && (c == ',') )  {\n            return separate();\n        }\n\n        switch( m_mode ) {\n        case None:\n            if( processNoneChar( c ) )\n                return true;\n            break;\n        case Name:\n            processNameChar( c );\n            break;\n        case EscapedName:\n            endMode();\n            addCharToPattern(c);\n            return true;\n        default:\n        case Tag:\n        case QuotedName:\n            if( processOtherChar( c ) )\n                return true;\n            break;\n        }\n\n        m_substring += c;\n        if( !isControlChar( c ) ) {\n            m_patternName += c;\n            m_realPatternPos++;\n        }\n        return true;\n    }\n    // Two of the processing methods return true to signal the caller to return\n    // without adding the given character to the current pattern strings\n    bool TestSpecParser::processNoneChar( char c ) {\n        switch( c ) {\n        case ' ':\n            return true;\n        case '~':\n            m_exclusion = true;\n            return false;\n        case '[':\n            startNewMode( Tag );\n            return false;\n        case '\"':\n            startNewMode( QuotedName );\n            return false;\n        default:\n            startNewMode( Name );\n            return false;\n        }\n    }\n    void TestSpecParser::processNameChar( char c ) {\n        if( c == '[' ) {\n            if( m_substring == \"exclude:\" )\n                m_exclusion = true;\n            else\n                endMode();\n            startNewMode( Tag );\n        }\n    }\n    bool TestSpecParser::processOtherChar( char c ) {\n        if( !isControlChar( c ) )\n            return false;\n        m_substring += c;\n        endMode();\n        return true;\n    }\n    void TestSpecParser::startNewMode( Mode mode ) {\n        m_mode = mode;\n    }\n    void TestSpecParser::endMode() {\n        switch( m_mode ) {\n        case Name:\n        case QuotedName:\n            return addNamePattern();\n        case Tag:\n            return addTagPattern();\n        case EscapedName:\n            revertBackToLastMode();\n            return;\n        case None:\n        default:\n            return startNewMode( None );\n        }\n    }\n    void TestSpecParser::escape() {\n        saveLastMode();\n        m_mode = EscapedName;\n        m_escapeChars.push_back(m_realPatternPos);\n    }\n    bool TestSpecParser::isControlChar( char c ) const {\n        switch( m_mode ) {\n            default:\n                return false;\n            case None:\n                return c == '~';\n            case Name:\n                return c == '[';\n            case EscapedName:\n                return true;\n            case QuotedName:\n                return c == '\"';\n            case Tag:\n                return c == '[' || c == ']';\n        }\n    }\n\n    void TestSpecParser::addFilter() {\n        if( !m_currentFilter.m_required.empty() || !m_currentFilter.m_forbidden.empty() ) {\n            m_testSpec.m_filters.push_back( CATCH_MOVE(m_currentFilter) );\n            m_currentFilter = TestSpec::Filter();\n        }\n    }\n\n    void TestSpecParser::saveLastMode() {\n      lastMode = m_mode;\n    }\n\n    void TestSpecParser::revertBackToLastMode() {\n      m_mode = lastMode;\n    }\n\n    bool TestSpecParser::separate() {\n      if( (m_mode==QuotedName) || (m_mode==Tag) ){\n         //invalid argument, signal failure to previous scope.\n         m_mode = None;\n         m_pos = m_arg.size();\n         m_substring.clear();\n         m_patternName.clear();\n         m_realPatternPos = 0;\n         return false;\n      }\n      endMode();\n      addFilter();\n      return true; //success\n    }\n\n    std::string TestSpecParser::preprocessPattern() {\n        std::string token = m_patternName;\n        for (std::size_t i = 0; i < m_escapeChars.size(); ++i)\n            token = token.substr(0, m_escapeChars[i] - i) + token.substr(m_escapeChars[i] - i + 1);\n        m_escapeChars.clear();\n        if (startsWith(token, \"exclude:\")) {\n            m_exclusion = true;\n            token = token.substr(8);\n        }\n\n        m_patternName.clear();\n        m_realPatternPos = 0;\n\n        return token;\n    }\n\n    void TestSpecParser::addNamePattern() {\n        auto token = preprocessPattern();\n\n        if (!token.empty()) {\n            if (m_exclusion) {\n                m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring));\n            } else {\n                m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::NamePattern>(token, m_substring));\n            }\n        }\n        m_substring.clear();\n        m_exclusion = false;\n        m_mode = None;\n    }\n\n    void TestSpecParser::addTagPattern() {\n        auto token = preprocessPattern();\n\n        if (!token.empty()) {\n            // If the tag pattern is the \"hide and tag\" shorthand (e.g. [.foo])\n            // we have to create a separate hide tag and shorten the real one\n            if (token.size() > 1 && token[0] == '.') {\n                token.erase(token.begin());\n                if (m_exclusion) {\n                    m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(\".\", m_substring));\n                } else {\n                    m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(\".\", m_substring));\n                }\n            }\n            if (m_exclusion) {\n                m_currentFilter.m_forbidden.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));\n            } else {\n                m_currentFilter.m_required.emplace_back(Detail::make_unique<TestSpec::TagPattern>(token, m_substring));\n            }\n        }\n        m_substring.clear();\n        m_exclusion = false;\n        m_mode = None;\n    }\n\n} // namespace Catch\n\n\n\n#include <algorithm>\n#include <cstring>\n#include <ostream>\n\nnamespace {\n    bool isWhitespace( char c ) {\n        return c == ' ' || c == '\\t' || c == '\\n' || c == '\\r';\n    }\n\n    bool isBreakableBefore( char c ) {\n        static const char chars[] = \"[({<|\";\n        return std::memchr( chars, c, sizeof( chars ) - 1 ) != nullptr;\n    }\n\n    bool isBreakableAfter( char c ) {\n        static const char chars[] = \"])}>.,:;*+-=&/\\\\\";\n        return std::memchr( chars, c, sizeof( chars ) - 1 ) != nullptr;\n    }\n\n} // namespace\n\nnamespace Catch {\n    namespace TextFlow {\n        void AnsiSkippingString::preprocessString() {\n            for ( auto it = m_string.begin(); it != m_string.end(); ) {\n                // try to read through an ansi sequence\n                while ( it != m_string.end() && *it == '\\033' &&\n                        it + 1 != m_string.end() && *( it + 1 ) == '[' ) {\n                    auto cursor = it + 2;\n                    while ( cursor != m_string.end() &&\n                            ( isdigit( *cursor ) || *cursor == ';' ) ) {\n                        ++cursor;\n                    }\n                    if ( cursor == m_string.end() || *cursor != 'm' ) {\n                        break;\n                    }\n                    // 'm' -> 0xff\n                    *cursor = AnsiSkippingString::sentinel;\n                    // if we've read an ansi sequence, set the iterator and\n                    // return to the top of the loop\n                    it = cursor + 1;\n                }\n                if ( it != m_string.end() ) {\n                    ++m_size;\n                    ++it;\n                }\n            }\n        }\n\n        AnsiSkippingString::AnsiSkippingString( std::string const& text ):\n            m_string( text ) {\n            preprocessString();\n        }\n\n        AnsiSkippingString::AnsiSkippingString( std::string&& text ):\n            m_string( CATCH_MOVE( text ) ) {\n            preprocessString();\n        }\n\n        AnsiSkippingString::const_iterator AnsiSkippingString::begin() const {\n            return const_iterator( m_string );\n        }\n\n        AnsiSkippingString::const_iterator AnsiSkippingString::end() const {\n            return const_iterator( m_string, const_iterator::EndTag{} );\n        }\n\n        std::string AnsiSkippingString::substring( const_iterator begin,\n                                                   const_iterator end ) const {\n            // There's one caveat here to an otherwise simple substring: when\n            // making a begin iterator we might have skipped ansi sequences at\n            // the start. If `begin` here is a begin iterator, skipped over\n            // initial ansi sequences, we'll use the true beginning of the\n            // string. Lastly: We need to transform any chars we replaced with\n            // 0xff back to 'm'\n            auto str = std::string( begin == this->begin() ? m_string.begin()\n                                                           : begin.m_it,\n                                    end.m_it );\n            std::transform( str.begin(), str.end(), str.begin(), []( char c ) {\n                return c == AnsiSkippingString::sentinel ? 'm' : c;\n            } );\n            return str;\n        }\n\n        void AnsiSkippingString::const_iterator::tryParseAnsiEscapes() {\n            // check if we've landed on an ansi sequence, and if so read through\n            // it\n            while ( m_it != m_string->end() && *m_it == '\\033' &&\n                    m_it + 1 != m_string->end() &&  *( m_it + 1 ) == '[' ) {\n                auto cursor = m_it + 2;\n                while ( cursor != m_string->end() &&\n                        ( isdigit( *cursor ) || *cursor == ';' ) ) {\n                    ++cursor;\n                }\n                if ( cursor == m_string->end() ||\n                     *cursor != AnsiSkippingString::sentinel ) {\n                    break;\n                }\n                // if we've read an ansi sequence, set the iterator and\n                // return to the top of the loop\n                m_it = cursor + 1;\n            }\n        }\n\n        void AnsiSkippingString::const_iterator::advance() {\n            assert( m_it != m_string->end() );\n            m_it++;\n            tryParseAnsiEscapes();\n        }\n\n        void AnsiSkippingString::const_iterator::unadvance() {\n            assert( m_it != m_string->begin() );\n            m_it--;\n            // if *m_it is 0xff, scan back to the \\033 and then m_it-- once more\n            // (and repeat check)\n            while ( *m_it == AnsiSkippingString::sentinel ) {\n                while ( *m_it != '\\033' ) {\n                    assert( m_it != m_string->begin() );\n                    m_it--;\n                }\n                // if this happens, we must have been a begin iterator that had\n                // skipped over ansi sequences at the start of a string\n                assert( m_it != m_string->begin() );\n                assert( *m_it == '\\033' );\n                m_it--;\n            }\n        }\n\n        static bool isBoundary( AnsiSkippingString const& line,\n                                AnsiSkippingString::const_iterator it ) {\n            return it == line.end() ||\n                   ( isWhitespace( *it ) &&\n                     !isWhitespace( *it.oneBefore() ) ) ||\n                   isBreakableBefore( *it ) ||\n                   isBreakableAfter( *it.oneBefore() );\n        }\n\n        void Column::const_iterator::calcLength() {\n            m_addHyphen = false;\n            m_parsedTo = m_lineStart;\n            AnsiSkippingString const& current_line = m_column.m_string;\n\n            if ( m_parsedTo == current_line.end() ) {\n                m_lineEnd = m_parsedTo;\n                return;\n            }\n\n            assert( m_lineStart != current_line.end() );\n            if ( *m_lineStart == '\\n' ) { ++m_parsedTo; }\n\n            const auto maxLineLength = m_column.m_width - indentSize();\n            std::size_t lineLength = 0;\n            while ( m_parsedTo != current_line.end() &&\n                    lineLength < maxLineLength && *m_parsedTo != '\\n' ) {\n                ++m_parsedTo;\n                ++lineLength;\n            }\n\n            // If we encountered a newline before the column is filled,\n            // then we linebreak at the newline and consider this line\n            // finished.\n            if ( lineLength < maxLineLength ) {\n                m_lineEnd = m_parsedTo;\n            } else {\n                // Look for a natural linebreak boundary in the column\n                // (We look from the end, so that the first found boundary is\n                // the right one)\n                m_lineEnd = m_parsedTo;\n                while ( lineLength > 0 &&\n                        !isBoundary( current_line, m_lineEnd ) ) {\n                    --lineLength;\n                    --m_lineEnd;\n                }\n                while ( lineLength > 0 &&\n                        isWhitespace( *m_lineEnd.oneBefore() ) ) {\n                    --lineLength;\n                    --m_lineEnd;\n                }\n\n                // If we found one, then that is where we linebreak, otherwise\n                // we have to split text with a hyphen\n                if ( lineLength == 0 ) {\n                    m_addHyphen = true;\n                    m_lineEnd = m_parsedTo.oneBefore();\n                }\n            }\n        }\n\n        size_t Column::const_iterator::indentSize() const {\n            auto initial = m_lineStart == m_column.m_string.begin()\n                               ? m_column.m_initialIndent\n                               : std::string::npos;\n            return initial == std::string::npos ? m_column.m_indent : initial;\n        }\n\n        std::string Column::const_iterator::addIndentAndSuffix(\n            AnsiSkippingString::const_iterator start,\n            AnsiSkippingString::const_iterator end ) const {\n            std::string ret;\n            const auto desired_indent = indentSize();\n            // ret.reserve( desired_indent + (end - start) + m_addHyphen );\n            ret.append( desired_indent, ' ' );\n            // ret.append( start, end );\n            ret += m_column.m_string.substring( start, end );\n            if ( m_addHyphen ) { ret.push_back( '-' ); }\n\n            return ret;\n        }\n\n        Column::const_iterator::const_iterator( Column const& column ):\n            m_column( column ),\n            m_lineStart( column.m_string.begin() ),\n            m_lineEnd( column.m_string.begin() ),\n            m_parsedTo( column.m_string.begin() ) {\n            assert( m_column.m_width > m_column.m_indent );\n            assert( m_column.m_initialIndent == std::string::npos ||\n                    m_column.m_width > m_column.m_initialIndent );\n            calcLength();\n            if ( m_lineStart == m_lineEnd ) {\n                m_lineStart = m_column.m_string.end();\n            }\n        }\n\n        std::string Column::const_iterator::operator*() const {\n            assert( m_lineStart <= m_parsedTo );\n            return addIndentAndSuffix( m_lineStart, m_lineEnd );\n        }\n\n        Column::const_iterator& Column::const_iterator::operator++() {\n            m_lineStart = m_lineEnd;\n            AnsiSkippingString const& current_line = m_column.m_string;\n            if ( m_lineStart != current_line.end() && *m_lineStart == '\\n' ) {\n                m_lineStart++;\n            } else {\n                while ( m_lineStart != current_line.end() &&\n                        isWhitespace( *m_lineStart ) ) {\n                    ++m_lineStart;\n                }\n            }\n\n            if ( m_lineStart != current_line.end() ) { calcLength(); }\n            return *this;\n        }\n\n        Column::const_iterator Column::const_iterator::operator++( int ) {\n            const_iterator prev( *this );\n            operator++();\n            return prev;\n        }\n\n        std::ostream& operator<<( std::ostream& os, Column const& col ) {\n            bool first = true;\n            for ( auto line : col ) {\n                if ( first ) {\n                    first = false;\n                } else {\n                    os << '\\n';\n                }\n                os << line;\n            }\n            return os;\n        }\n\n        Column Spacer( size_t spaceWidth ) {\n            Column ret{ \"\" };\n            ret.width( spaceWidth );\n            return ret;\n        }\n\n        Columns::iterator::iterator( Columns const& columns, EndTag ):\n            m_columns( columns.m_columns ), m_activeIterators( 0 ) {\n\n            m_iterators.reserve( m_columns.size() );\n            for ( auto const& col : m_columns ) {\n                m_iterators.push_back( col.end() );\n            }\n        }\n\n        Columns::iterator::iterator( Columns const& columns ):\n            m_columns( columns.m_columns ),\n            m_activeIterators( m_columns.size() ) {\n\n            m_iterators.reserve( m_columns.size() );\n            for ( auto const& col : m_columns ) {\n                m_iterators.push_back( col.begin() );\n            }\n        }\n\n        std::string Columns::iterator::operator*() const {\n            std::string row, padding;\n\n            for ( size_t i = 0; i < m_columns.size(); ++i ) {\n                const auto width = m_columns[i].width();\n                if ( m_iterators[i] != m_columns[i].end() ) {\n                    std::string col = *m_iterators[i];\n                    row += padding;\n                    row += col;\n\n                    padding.clear();\n                    if ( col.size() < width ) {\n                        padding.append( width - col.size(), ' ' );\n                    }\n                } else {\n                    padding.append( width, ' ' );\n                }\n            }\n            return row;\n        }\n\n        Columns::iterator& Columns::iterator::operator++() {\n            for ( size_t i = 0; i < m_columns.size(); ++i ) {\n                if ( m_iterators[i] != m_columns[i].end() ) {\n                    ++m_iterators[i];\n                }\n            }\n            return *this;\n        }\n\n        Columns::iterator Columns::iterator::operator++( int ) {\n            iterator prev( *this );\n            operator++();\n            return prev;\n        }\n\n        std::ostream& operator<<( std::ostream& os, Columns const& cols ) {\n            bool first = true;\n            for ( auto line : cols ) {\n                if ( first ) {\n                    first = false;\n                } else {\n                    os << '\\n';\n                }\n                os << line;\n            }\n            return os;\n        }\n\n        Columns operator+( Column const& lhs, Column const& rhs ) {\n            Columns cols;\n            cols += lhs;\n            cols += rhs;\n            return cols;\n        }\n        Columns operator+( Column&& lhs, Column&& rhs ) {\n            Columns cols;\n            cols += CATCH_MOVE( lhs );\n            cols += CATCH_MOVE( rhs );\n            return cols;\n        }\n\n        Columns& operator+=( Columns& lhs, Column const& rhs ) {\n            lhs.m_columns.push_back( rhs );\n            return lhs;\n        }\n        Columns& operator+=( Columns& lhs, Column&& rhs ) {\n            lhs.m_columns.push_back( CATCH_MOVE( rhs ) );\n            return lhs;\n        }\n        Columns operator+( Columns const& lhs, Column const& rhs ) {\n            auto combined( lhs );\n            combined += rhs;\n            return combined;\n        }\n        Columns operator+( Columns&& lhs, Column&& rhs ) {\n            lhs += CATCH_MOVE( rhs );\n            return CATCH_MOVE( lhs );\n        }\n\n    } // namespace TextFlow\n} // namespace Catch\n\n\n\n\n#include <exception>\n\nnamespace Catch {\n    bool uncaught_exceptions() {\n#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n        return false;\n#elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)\n        return std::uncaught_exceptions() > 0;\n#else\n        return std::uncaught_exception();\n#endif\n  }\n} // end namespace Catch\n\n\n\nnamespace Catch {\n\n    WildcardPattern::WildcardPattern( std::string const& pattern,\n                                      CaseSensitive caseSensitivity )\n    :   m_caseSensitivity( caseSensitivity ),\n        m_pattern( normaliseString( pattern ) )\n    {\n        if( startsWith( m_pattern, '*' ) ) {\n            m_pattern = m_pattern.substr( 1 );\n            m_wildcard = WildcardAtStart;\n        }\n        if( endsWith( m_pattern, '*' ) ) {\n            m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );\n            m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );\n        }\n    }\n\n    bool WildcardPattern::matches( std::string const& str ) const {\n        switch( m_wildcard ) {\n            case NoWildcard:\n                return m_pattern == normaliseString( str );\n            case WildcardAtStart:\n                return endsWith( normaliseString( str ), m_pattern );\n            case WildcardAtEnd:\n                return startsWith( normaliseString( str ), m_pattern );\n            case WildcardAtBothEnds:\n                return contains( normaliseString( str ), m_pattern );\n            default:\n                CATCH_INTERNAL_ERROR( \"Unknown enum\" );\n        }\n    }\n\n    std::string WildcardPattern::normaliseString( std::string const& str ) const {\n        return trim( m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str );\n    }\n}\n\n\n// Note: swapping these two includes around causes MSVC to error out\n//       while in /permissive- mode. No, I don't know why.\n//       Tested on VS 2019, 18.{3, 4}.x\n\n#include <cstdint>\n#include <iomanip>\n#include <type_traits>\n\nnamespace Catch {\n\nnamespace {\n\n    size_t trailingBytes(unsigned char c) {\n        if ((c & 0xE0) == 0xC0) {\n            return 2;\n        }\n        if ((c & 0xF0) == 0xE0) {\n            return 3;\n        }\n        if ((c & 0xF8) == 0xF0) {\n            return 4;\n        }\n        CATCH_INTERNAL_ERROR(\"Invalid multibyte utf-8 start byte encountered\");\n    }\n\n    uint32_t headerValue(unsigned char c) {\n        if ((c & 0xE0) == 0xC0) {\n            return c & 0x1F;\n        }\n        if ((c & 0xF0) == 0xE0) {\n            return c & 0x0F;\n        }\n        if ((c & 0xF8) == 0xF0) {\n            return c & 0x07;\n        }\n        CATCH_INTERNAL_ERROR(\"Invalid multibyte utf-8 start byte encountered\");\n    }\n\n    void hexEscapeChar(std::ostream& os, unsigned char c) {\n        std::ios_base::fmtflags f(os.flags());\n        os << \"\\\\x\"\n            << std::uppercase << std::hex << std::setfill('0') << std::setw(2)\n            << static_cast<int>(c);\n        os.flags(f);\n    }\n\n    constexpr bool shouldNewline(XmlFormatting fmt) {\n        return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Newline));\n    }\n\n    constexpr bool shouldIndent(XmlFormatting fmt) {\n        return !!(static_cast<std::underlying_type_t<XmlFormatting>>(fmt & XmlFormatting::Indent));\n    }\n\n} // anonymous namespace\n\n    void XmlEncode::encodeTo( std::ostream& os ) const {\n        // Apostrophe escaping not necessary if we always use \" to write attributes\n        // (see: http://www.w3.org/TR/xml/#syntax)\n\n        for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) {\n            unsigned char c = static_cast<unsigned char>(m_str[idx]);\n            switch (c) {\n            case '<':   os << \"&lt;\"; break;\n            case '&':   os << \"&amp;\"; break;\n\n            case '>':\n                // See: http://www.w3.org/TR/xml/#syntax\n                if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']')\n                    os << \"&gt;\";\n                else\n                    os << c;\n                break;\n\n            case '\\\"':\n                if (m_forWhat == ForAttributes)\n                    os << \"&quot;\";\n                else\n                    os << c;\n                break;\n\n            default:\n                // Check for control characters and invalid utf-8\n\n                // Escape control characters in standard ascii\n                // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0\n                if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n\n                // Plain ASCII: Write it to stream\n                if (c < 0x7F) {\n                    os << c;\n                    break;\n                }\n\n                // UTF-8 territory\n                // Check if the encoding is valid and if it is not, hex escape bytes.\n                // Important: We do not check the exact decoded values for validity, only the encoding format\n                // First check that this bytes is a valid lead byte:\n                // This means that it is not encoded as 1111 1XXX\n                // Or as 10XX XXXX\n                if (c <  0xC0 ||\n                    c >= 0xF8) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n\n                auto encBytes = trailingBytes(c);\n                // Are there enough bytes left to avoid accessing out-of-bounds memory?\n                if (idx + encBytes - 1 >= m_str.size()) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n                // The header is valid, check data\n                // The next encBytes bytes must together be a valid utf-8\n                // This means: bitpattern 10XX XXXX and the extracted value is sane (ish)\n                bool valid = true;\n                uint32_t value = headerValue(c);\n                for (std::size_t n = 1; n < encBytes; ++n) {\n                    unsigned char nc = static_cast<unsigned char>(m_str[idx + n]);\n                    valid &= ((nc & 0xC0) == 0x80);\n                    value = (value << 6) | (nc & 0x3F);\n                }\n\n                if (\n                    // Wrong bit pattern of following bytes\n                    (!valid) ||\n                    // Overlong encodings\n                    (value < 0x80) ||\n                    (0x80 <= value && value < 0x800   && encBytes > 2) ||\n                    (0x800 < value && value < 0x10000 && encBytes > 3) ||\n                    // Encoded value out of range\n                    (value >= 0x110000)\n                    ) {\n                    hexEscapeChar(os, c);\n                    break;\n                }\n\n                // If we got here, this is in fact a valid(ish) utf-8 sequence\n                for (std::size_t n = 0; n < encBytes; ++n) {\n                    os << m_str[idx + n];\n                }\n                idx += encBytes - 1;\n                break;\n            }\n        }\n    }\n\n    std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) {\n        xmlEncode.encodeTo( os );\n        return os;\n    }\n\n    XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer, XmlFormatting fmt )\n    :   m_writer( writer ),\n        m_fmt(fmt)\n    {}\n\n    XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept\n    :   m_writer( other.m_writer ),\n        m_fmt(other.m_fmt)\n    {\n        other.m_writer = nullptr;\n        other.m_fmt = XmlFormatting::None;\n    }\n    XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept {\n        if ( m_writer ) {\n            m_writer->endElement();\n        }\n        m_writer = other.m_writer;\n        other.m_writer = nullptr;\n        m_fmt = other.m_fmt;\n        other.m_fmt = XmlFormatting::None;\n        return *this;\n    }\n\n\n    XmlWriter::ScopedElement::~ScopedElement() {\n        if (m_writer) {\n            m_writer->endElement(m_fmt);\n        }\n    }\n\n    XmlWriter::ScopedElement&\n    XmlWriter::ScopedElement::writeText( StringRef text, XmlFormatting fmt ) {\n        m_writer->writeText( text, fmt );\n        return *this;\n    }\n\n    XmlWriter::ScopedElement&\n    XmlWriter::ScopedElement::writeAttribute( StringRef name,\n                                              StringRef attribute ) {\n        m_writer->writeAttribute( name, attribute );\n        return *this;\n    }\n\n\n    XmlWriter::XmlWriter( std::ostream& os ) : m_os( os )\n    {\n        writeDeclaration();\n    }\n\n    XmlWriter::~XmlWriter() {\n        while (!m_tags.empty()) {\n            endElement();\n        }\n        newlineIfNecessary();\n    }\n\n    XmlWriter& XmlWriter::startElement( std::string const& name, XmlFormatting fmt ) {\n        ensureTagClosed();\n        newlineIfNecessary();\n        if (shouldIndent(fmt)) {\n            m_os << m_indent;\n            m_indent += \"  \";\n        }\n        m_os << '<' << name;\n        m_tags.push_back( name );\n        m_tagIsOpen = true;\n        applyFormatting(fmt);\n        return *this;\n    }\n\n    XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name, XmlFormatting fmt ) {\n        ScopedElement scoped( this, fmt );\n        startElement( name, fmt );\n        return scoped;\n    }\n\n    XmlWriter& XmlWriter::endElement(XmlFormatting fmt) {\n        m_indent = m_indent.substr(0, m_indent.size() - 2);\n\n        if( m_tagIsOpen ) {\n            m_os << \"/>\";\n            m_tagIsOpen = false;\n        } else {\n            newlineIfNecessary();\n            if (shouldIndent(fmt)) {\n                m_os << m_indent;\n            }\n            m_os << \"</\" << m_tags.back() << '>';\n        }\n        m_os << std::flush;\n        applyFormatting(fmt);\n        m_tags.pop_back();\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeAttribute( StringRef name,\n                                          StringRef attribute ) {\n        if( !name.empty() && !attribute.empty() )\n            m_os << ' ' << name << \"=\\\"\" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '\"';\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeAttribute( StringRef name, bool attribute ) {\n        writeAttribute(name, (attribute ? \"true\"_sr : \"false\"_sr));\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeAttribute( StringRef name,\n                                          char const* attribute ) {\n        writeAttribute( name, StringRef( attribute ) );\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeText( StringRef text, XmlFormatting fmt ) {\n        CATCH_ENFORCE(!m_tags.empty(), \"Cannot write text as top level element\");\n        if( !text.empty() ){\n            bool tagWasOpen = m_tagIsOpen;\n            ensureTagClosed();\n            if (tagWasOpen && shouldIndent(fmt)) {\n                m_os << m_indent;\n            }\n            m_os << XmlEncode( text, XmlEncode::ForTextNodes );\n            applyFormatting(fmt);\n        }\n        return *this;\n    }\n\n    XmlWriter& XmlWriter::writeComment( StringRef text, XmlFormatting fmt ) {\n        ensureTagClosed();\n        if (shouldIndent(fmt)) {\n            m_os << m_indent;\n        }\n        m_os << \"<!-- \" << text << \" -->\";\n        applyFormatting(fmt);\n        return *this;\n    }\n\n    void XmlWriter::writeStylesheetRef( StringRef url ) {\n        m_os << R\"(<?xml-stylesheet type=\"text/xsl\" href=\")\" << url << R\"(\"?>)\" << '\\n';\n    }\n\n    void XmlWriter::ensureTagClosed() {\n        if( m_tagIsOpen ) {\n            m_os << '>' << std::flush;\n            newlineIfNecessary();\n            m_tagIsOpen = false;\n        }\n    }\n\n    void XmlWriter::applyFormatting(XmlFormatting fmt) {\n        m_needsNewline = shouldNewline(fmt);\n    }\n\n    void XmlWriter::writeDeclaration() {\n        m_os << R\"(<?xml version=\"1.0\" encoding=\"UTF-8\"?>)\" << '\\n';\n    }\n\n    void XmlWriter::newlineIfNecessary() {\n        if( m_needsNewline ) {\n            m_os << '\\n' << std::flush;\n            m_needsNewline = false;\n        }\n    }\n}\n\n\n\n\n\nnamespace Catch {\nnamespace Matchers {\n\n    std::string MatcherUntypedBase::toString() const {\n        if (m_cachedToString.empty()) {\n            m_cachedToString = describe();\n        }\n        return m_cachedToString;\n    }\n\n    MatcherUntypedBase::~MatcherUntypedBase() = default;\n\n} // namespace Matchers\n} // namespace Catch\n\n\n\n\nnamespace Catch {\nnamespace Matchers {\n\n    std::string IsEmptyMatcher::describe() const {\n        return \"is empty\";\n    }\n\n    std::string HasSizeMatcher::describe() const {\n        ReusableStringStream sstr;\n        sstr << \"has size == \" << m_target_size;\n        return sstr.str();\n    }\n\n    IsEmptyMatcher IsEmpty() {\n        return {};\n    }\n\n    HasSizeMatcher SizeIs(std::size_t sz) {\n        return HasSizeMatcher{ sz };\n    }\n\n} // end namespace Matchers\n} // end namespace Catch\n\n\n\nnamespace Catch {\nnamespace Matchers {\n\nbool ExceptionMessageMatcher::match(std::exception const& ex) const {\n    return ex.what() == m_message;\n}\n\nstd::string ExceptionMessageMatcher::describe() const {\n    return \"exception message matches \\\"\" + m_message + '\"';\n}\n\nExceptionMessageMatcher Message(std::string const& message) {\n    return ExceptionMessageMatcher(message);\n}\n\n} // namespace Matchers\n} // namespace Catch\n\n\n\n#include <algorithm>\n#include <cmath>\n#include <cstdlib>\n#include <cstdint>\n#include <sstream>\n#include <iomanip>\n#include <limits>\n\n\nnamespace Catch {\nnamespace {\n\n    template <typename FP>\n    bool almostEqualUlps(FP lhs, FP rhs, uint64_t maxUlpDiff) {\n        // Comparison with NaN should always be false.\n        // This way we can rule it out before getting into the ugly details\n        if (Catch::isnan(lhs) || Catch::isnan(rhs)) {\n            return false;\n        }\n\n        // This should also handle positive and negative zeros, infinities\n        const auto ulpDist = ulpDistance(lhs, rhs);\n\n        return ulpDist <= maxUlpDiff;\n    }\n\n\ntemplate <typename FP>\nFP step(FP start, FP direction, uint64_t steps) {\n    for (uint64_t i = 0; i < steps; ++i) {\n        start = Catch::nextafter(start, direction);\n    }\n    return start;\n}\n\n// Performs equivalent check of std::fabs(lhs - rhs) <= margin\n// But without the subtraction to allow for INFINITY in comparison\nbool marginComparison(double lhs, double rhs, double margin) {\n    return (lhs + margin >= rhs) && (rhs + margin >= lhs);\n}\n\ntemplate <typename FloatingPoint>\nvoid write(std::ostream& out, FloatingPoint num) {\n    out << std::scientific\n        << std::setprecision(std::numeric_limits<FloatingPoint>::max_digits10 - 1)\n        << num;\n}\n\n} // end anonymous namespace\n\nnamespace Matchers {\nnamespace Detail {\n\n    enum class FloatingPointKind : uint8_t {\n        Float,\n        Double\n    };\n\n} // end namespace Detail\n\n\n    WithinAbsMatcher::WithinAbsMatcher(double target, double margin)\n        :m_target{ target }, m_margin{ margin } {\n        CATCH_ENFORCE(margin >= 0, \"Invalid margin: \" << margin << '.'\n            << \" Margin has to be non-negative.\");\n    }\n\n    // Performs equivalent check of std::fabs(lhs - rhs) <= margin\n    // But without the subtraction to allow for INFINITY in comparison\n    bool WithinAbsMatcher::match(double const& matchee) const {\n        return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee);\n    }\n\n    std::string WithinAbsMatcher::describe() const {\n        return \"is within \" + ::Catch::Detail::stringify(m_margin) + \" of \" + ::Catch::Detail::stringify(m_target);\n    }\n\n\n    WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, Detail::FloatingPointKind baseType)\n        :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } {\n        CATCH_ENFORCE(m_type == Detail::FloatingPointKind::Double\n                   || m_ulps < (std::numeric_limits<uint32_t>::max)(),\n            \"Provided ULP is impossibly large for a float comparison.\");\n        CATCH_ENFORCE( std::numeric_limits<double>::is_iec559,\n                       \"WithinUlp matcher only supports platforms with \"\n                       \"IEEE-754 compatible floating point representation\" );\n    }\n\n#if defined(__clang__)\n#pragma clang diagnostic push\n// Clang <3.5 reports on the default branch in the switch below\n#pragma clang diagnostic ignored \"-Wunreachable-code\"\n#endif\n\n    bool WithinUlpsMatcher::match(double const& matchee) const {\n        switch (m_type) {\n        case Detail::FloatingPointKind::Float:\n            return almostEqualUlps<float>(static_cast<float>(matchee), static_cast<float>(m_target), m_ulps);\n        case Detail::FloatingPointKind::Double:\n            return almostEqualUlps<double>(matchee, m_target, m_ulps);\n        default:\n            CATCH_INTERNAL_ERROR( \"Unknown Detail::FloatingPointKind value\" );\n        }\n    }\n\n#if defined(__clang__)\n#pragma clang diagnostic pop\n#endif\n\n    std::string WithinUlpsMatcher::describe() const {\n        std::stringstream ret;\n\n        ret << \"is within \" << m_ulps << \" ULPs of \";\n\n        if (m_type == Detail::FloatingPointKind::Float) {\n            write(ret, static_cast<float>(m_target));\n            ret << 'f';\n        } else {\n            write(ret, m_target);\n        }\n\n        ret << \" ([\";\n        if (m_type == Detail::FloatingPointKind::Double) {\n            write( ret,\n                   step( m_target,\n                         -std::numeric_limits<double>::infinity(),\n                         m_ulps ) );\n            ret << \", \";\n            write( ret,\n                   step( m_target,\n                         std::numeric_limits<double>::infinity(),\n                         m_ulps ) );\n        } else {\n            // We have to cast INFINITY to float because of MinGW, see #1782\n            write( ret,\n                   step( static_cast<float>( m_target ),\n                         -std::numeric_limits<float>::infinity(),\n                         m_ulps ) );\n            ret << \", \";\n            write( ret,\n                   step( static_cast<float>( m_target ),\n                         std::numeric_limits<float>::infinity(),\n                         m_ulps ) );\n        }\n        ret << \"])\";\n\n        return ret.str();\n    }\n\n    WithinRelMatcher::WithinRelMatcher(double target, double epsilon):\n        m_target(target),\n        m_epsilon(epsilon){\n        CATCH_ENFORCE(m_epsilon >= 0., \"Relative comparison with epsilon <  0 does not make sense.\");\n        CATCH_ENFORCE(m_epsilon  < 1., \"Relative comparison with epsilon >= 1 does not make sense.\");\n    }\n\n    bool WithinRelMatcher::match(double const& matchee) const {\n        const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target));\n        return marginComparison(matchee, m_target,\n                                std::isinf(relMargin)? 0 : relMargin);\n    }\n\n    std::string WithinRelMatcher::describe() const {\n        Catch::ReusableStringStream sstr;\n        sstr << \"and \" << ::Catch::Detail::stringify(m_target) << \" are within \" << m_epsilon * 100. << \"% of each other\";\n        return sstr.str();\n    }\n\n\nWithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff) {\n    return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Double);\n}\n\nWithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff) {\n    return WithinUlpsMatcher(target, maxUlpDiff, Detail::FloatingPointKind::Float);\n}\n\nWithinAbsMatcher WithinAbs(double target, double margin) {\n    return WithinAbsMatcher(target, margin);\n}\n\nWithinRelMatcher WithinRel(double target, double eps) {\n    return WithinRelMatcher(target, eps);\n}\n\nWithinRelMatcher WithinRel(double target) {\n    return WithinRelMatcher(target, std::numeric_limits<double>::epsilon() * 100);\n}\n\nWithinRelMatcher WithinRel(float target, float eps) {\n    return WithinRelMatcher(target, eps);\n}\n\nWithinRelMatcher WithinRel(float target) {\n    return WithinRelMatcher(target, std::numeric_limits<float>::epsilon() * 100);\n}\n\n\n\nbool IsNaNMatcher::match( double const& matchee ) const {\n    return std::isnan( matchee );\n}\n\nstd::string IsNaNMatcher::describe() const {\n    using namespace std::string_literals;\n    return \"is NaN\"s;\n}\n\nIsNaNMatcher IsNaN() { return IsNaNMatcher(); }\n\n    } // namespace Matchers\n} // namespace Catch\n\n\n\n\nstd::string Catch::Matchers::Detail::finalizeDescription(const std::string& desc) {\n    if (desc.empty()) {\n        return \"matches undescribed predicate\";\n    } else {\n        return \"matches predicate: \\\"\" + desc + '\"';\n    }\n}\n\n\n\nnamespace Catch {\n    namespace Matchers {\n        std::string AllTrueMatcher::describe() const { return \"contains only true\"; }\n\n        AllTrueMatcher AllTrue() { return AllTrueMatcher{}; }\n\n        std::string NoneTrueMatcher::describe() const { return \"contains no true\"; }\n\n        NoneTrueMatcher NoneTrue() { return NoneTrueMatcher{}; }\n\n        std::string AnyTrueMatcher::describe() const { return \"contains at least one true\"; }\n\n        AnyTrueMatcher AnyTrue() { return AnyTrueMatcher{}; }\n    } // namespace Matchers\n} // namespace Catch\n\n\n\n#include <regex>\n\nnamespace Catch {\nnamespace Matchers {\n\n    CasedString::CasedString( std::string const& str, CaseSensitive caseSensitivity )\n    :   m_caseSensitivity( caseSensitivity ),\n        m_str( adjustString( str ) )\n    {}\n    std::string CasedString::adjustString( std::string const& str ) const {\n        return m_caseSensitivity == CaseSensitive::No\n               ? toLower( str )\n               : str;\n    }\n    StringRef CasedString::caseSensitivitySuffix() const {\n        return m_caseSensitivity == CaseSensitive::Yes\n                   ? StringRef()\n                   : \" (case insensitive)\"_sr;\n    }\n\n\n    StringMatcherBase::StringMatcherBase( StringRef operation, CasedString const& comparator )\n    : m_comparator( comparator ),\n      m_operation( operation ) {\n    }\n\n    std::string StringMatcherBase::describe() const {\n        std::string description;\n        description.reserve(5 + m_operation.size() + m_comparator.m_str.size() +\n                                    m_comparator.caseSensitivitySuffix().size());\n        description += m_operation;\n        description += \": \\\"\";\n        description += m_comparator.m_str;\n        description += '\"';\n        description += m_comparator.caseSensitivitySuffix();\n        return description;\n    }\n\n    StringEqualsMatcher::StringEqualsMatcher( CasedString const& comparator ) : StringMatcherBase( \"equals\"_sr, comparator ) {}\n\n    bool StringEqualsMatcher::match( std::string const& source ) const {\n        return m_comparator.adjustString( source ) == m_comparator.m_str;\n    }\n\n\n    StringContainsMatcher::StringContainsMatcher( CasedString const& comparator ) : StringMatcherBase( \"contains\"_sr, comparator ) {}\n\n    bool StringContainsMatcher::match( std::string const& source ) const {\n        return contains( m_comparator.adjustString( source ), m_comparator.m_str );\n    }\n\n\n    StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( \"starts with\"_sr, comparator ) {}\n\n    bool StartsWithMatcher::match( std::string const& source ) const {\n        return startsWith( m_comparator.adjustString( source ), m_comparator.m_str );\n    }\n\n\n    EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( \"ends with\"_sr, comparator ) {}\n\n    bool EndsWithMatcher::match( std::string const& source ) const {\n        return endsWith( m_comparator.adjustString( source ), m_comparator.m_str );\n    }\n\n\n\n    RegexMatcher::RegexMatcher(std::string regex, CaseSensitive caseSensitivity): m_regex(CATCH_MOVE(regex)), m_caseSensitivity(caseSensitivity) {}\n\n    bool RegexMatcher::match(std::string const& matchee) const {\n        auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway\n        if (m_caseSensitivity == CaseSensitive::No) {\n            flags |= std::regex::icase;\n        }\n        auto reg = std::regex(m_regex, flags);\n        return std::regex_match(matchee, reg);\n    }\n\n    std::string RegexMatcher::describe() const {\n        return \"matches \" + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Yes)? \" case sensitively\" : \" case insensitively\");\n    }\n\n\n    StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity ) {\n        return StringEqualsMatcher( CasedString( str, caseSensitivity) );\n    }\n    StringContainsMatcher ContainsSubstring( std::string const& str, CaseSensitive caseSensitivity ) {\n        return StringContainsMatcher( CasedString( str, caseSensitivity) );\n    }\n    EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity ) {\n        return EndsWithMatcher( CasedString( str, caseSensitivity) );\n    }\n    StartsWithMatcher StartsWith( std::string const& str, CaseSensitive caseSensitivity ) {\n        return StartsWithMatcher( CasedString( str, caseSensitivity) );\n    }\n\n    RegexMatcher Matches(std::string const& regex, CaseSensitive caseSensitivity) {\n        return RegexMatcher(regex, caseSensitivity);\n    }\n\n} // namespace Matchers\n} // namespace Catch\n\n\n\nnamespace Catch {\nnamespace Matchers {\n    MatcherGenericBase::~MatcherGenericBase() = default;\n\n    namespace Detail {\n\n        std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end) {\n            std::string description;\n            std::size_t combined_size = 4;\n            for ( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) {\n                combined_size += desc->size();\n            }\n            combined_size += static_cast<size_t>(descriptions_end - descriptions_begin - 1) * combine.size();\n\n            description.reserve(combined_size);\n\n            description += \"( \";\n            bool first = true;\n            for( auto desc = descriptions_begin; desc != descriptions_end; ++desc ) {\n                if( first )\n                    first = false;\n                else\n                    description += combine;\n                description += *desc;\n            }\n            description += \" )\";\n            return description;\n        }\n\n    } // namespace Detail\n} // namespace Matchers\n} // namespace Catch\n\n\n\n\nnamespace Catch {\n\n    // This is the general overload that takes a any string matcher\n    // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers\n    // the Equals matcher (so the header does not mention matchers)\n    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher ) {\n        std::string exceptionMessage = Catch::translateActiveException();\n        MatchExpr<std::string, StringMatcher const&> expr( CATCH_MOVE(exceptionMessage), matcher );\n        handler.handleExpr( expr );\n    }\n\n} // namespace Catch\n\n\n\n#include <ostream>\n\nnamespace Catch {\n\n    AutomakeReporter::~AutomakeReporter() = default;\n\n    void AutomakeReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {\n        // Possible values to emit are PASS, XFAIL, SKIP, FAIL, XPASS and ERROR.\n        m_stream << \":test-result: \";\n        if ( _testCaseStats.totals.testCases.skipped > 0 ) {\n            m_stream << \"SKIP\";\n        } else if (_testCaseStats.totals.assertions.allPassed()) {\n            m_stream << \"PASS\";\n        } else if (_testCaseStats.totals.assertions.allOk()) {\n            m_stream << \"XFAIL\";\n        } else {\n            m_stream << \"FAIL\";\n        }\n        m_stream << ' ' << _testCaseStats.testInfo->name << '\\n';\n        StreamingReporterBase::testCaseEnded(_testCaseStats);\n    }\n\n    void AutomakeReporter::skipTest(TestCaseInfo const& testInfo) {\n        m_stream << \":test-result: SKIP \" << testInfo.name << '\\n';\n    }\n\n} // end namespace Catch\n\n\n\n\n\n\nnamespace Catch {\n    ReporterBase::ReporterBase( ReporterConfig&& config ):\n        IEventListener( config.fullConfig() ),\n        m_wrapped_stream( CATCH_MOVE(config).takeStream() ),\n        m_stream( m_wrapped_stream->stream() ),\n        m_colour( makeColourImpl( config.colourMode(), m_wrapped_stream.get() ) ),\n        m_customOptions( config.customOptions() )\n    {}\n\n    ReporterBase::~ReporterBase() = default;\n\n    void ReporterBase::listReporters(\n        std::vector<ReporterDescription> const& descriptions ) {\n        defaultListReporters(m_stream, descriptions, m_config->verbosity());\n    }\n\n    void ReporterBase::listListeners(\n        std::vector<ListenerDescription> const& descriptions ) {\n        defaultListListeners( m_stream, descriptions );\n    }\n\n    void ReporterBase::listTests(std::vector<TestCaseHandle> const& tests) {\n        defaultListTests(m_stream,\n                         m_colour.get(),\n                         tests,\n                         m_config->hasTestFilters(),\n                         m_config->verbosity());\n    }\n\n    void ReporterBase::listTags(std::vector<TagInfo> const& tags) {\n        defaultListTags( m_stream, tags, m_config->hasTestFilters() );\n    }\n\n} // namespace Catch\n\n\n\n\n#include <ostream>\n\nnamespace Catch {\nnamespace {\n\n    // Colour::LightGrey\n    static constexpr Colour::Code compactDimColour = Colour::FileName;\n\n#ifdef CATCH_PLATFORM_MAC\n    static constexpr Catch::StringRef compactFailedString = \"FAILED\"_sr;\n    static constexpr Catch::StringRef compactPassedString = \"PASSED\"_sr;\n#else\n    static constexpr Catch::StringRef compactFailedString = \"failed\"_sr;\n    static constexpr Catch::StringRef compactPassedString = \"passed\"_sr;\n#endif\n\n// Implementation of CompactReporter formatting\nclass AssertionPrinter {\npublic:\n    AssertionPrinter& operator= (AssertionPrinter const&) = delete;\n    AssertionPrinter(AssertionPrinter const&) = delete;\n    AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages, ColourImpl* colourImpl_)\n        : stream(_stream)\n        , result(_stats.assertionResult)\n        , messages(_stats.infoMessages)\n        , itMessage(_stats.infoMessages.begin())\n        , printInfoMessages(_printInfoMessages)\n        , colourImpl(colourImpl_)\n    {}\n\n    void print() {\n        printSourceInfo();\n\n        itMessage = messages.begin();\n\n        switch (result.getResultType()) {\n        case ResultWas::Ok:\n            printResultType(Colour::ResultSuccess, compactPassedString);\n            printOriginalExpression();\n            printReconstructedExpression();\n            if (!result.hasExpression())\n                printRemainingMessages(Colour::None);\n            else\n                printRemainingMessages();\n            break;\n        case ResultWas::ExpressionFailed:\n            if (result.isOk())\n                printResultType(Colour::ResultSuccess, compactFailedString + \" - but was ok\"_sr);\n            else\n                printResultType(Colour::Error, compactFailedString);\n            printOriginalExpression();\n            printReconstructedExpression();\n            printRemainingMessages();\n            break;\n        case ResultWas::ThrewException:\n            printResultType(Colour::Error, compactFailedString);\n            printIssue(\"unexpected exception with message:\");\n            printMessage();\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::FatalErrorCondition:\n            printResultType(Colour::Error, compactFailedString);\n            printIssue(\"fatal error condition with message:\");\n            printMessage();\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::DidntThrowException:\n            printResultType(Colour::Error, compactFailedString);\n            printIssue(\"expected exception, got none\");\n            printExpressionWas();\n            printRemainingMessages();\n            break;\n        case ResultWas::Info:\n            printResultType(Colour::None, \"info\"_sr);\n            printMessage();\n            printRemainingMessages();\n            break;\n        case ResultWas::Warning:\n            printResultType(Colour::None, \"warning\"_sr);\n            printMessage();\n            printRemainingMessages();\n            break;\n        case ResultWas::ExplicitFailure:\n            printResultType(Colour::Error, compactFailedString);\n            printIssue(\"explicitly\");\n            printRemainingMessages(Colour::None);\n            break;\n        case ResultWas::ExplicitSkip:\n            printResultType(Colour::Skip, \"skipped\"_sr);\n            printMessage();\n            printRemainingMessages();\n            break;\n            // These cases are here to prevent compiler warnings\n        case ResultWas::Unknown:\n        case ResultWas::FailureBit:\n        case ResultWas::Exception:\n            printResultType(Colour::Error, \"** internal error **\");\n            break;\n        }\n    }\n\nprivate:\n    void printSourceInfo() const {\n        stream << colourImpl->guardColour( Colour::FileName )\n               << result.getSourceInfo() << ':';\n    }\n\n    void printResultType(Colour::Code colour, StringRef passOrFail) const {\n        if (!passOrFail.empty()) {\n            stream << colourImpl->guardColour(colour) << ' ' << passOrFail;\n            stream << ':';\n        }\n    }\n\n    void printIssue(char const* issue) const {\n        stream << ' ' << issue;\n    }\n\n    void printExpressionWas() {\n        if (result.hasExpression()) {\n            stream << ';';\n            {\n                stream << colourImpl->guardColour(compactDimColour) << \" expression was:\";\n            }\n            printOriginalExpression();\n        }\n    }\n\n    void printOriginalExpression() const {\n        if (result.hasExpression()) {\n            stream << ' ' << result.getExpression();\n        }\n    }\n\n    void printReconstructedExpression() const {\n        if (result.hasExpandedExpression()) {\n            stream << colourImpl->guardColour(compactDimColour) << \" for: \";\n            stream << result.getExpandedExpression();\n        }\n    }\n\n    void printMessage() {\n        if (itMessage != messages.end()) {\n            stream << \" '\" << itMessage->message << '\\'';\n            ++itMessage;\n        }\n    }\n\n    void printRemainingMessages(Colour::Code colour = compactDimColour) {\n        if (itMessage == messages.end())\n            return;\n\n        const auto itEnd = messages.cend();\n        const auto N = static_cast<std::size_t>(itEnd - itMessage);\n\n        stream << colourImpl->guardColour( colour ) << \" with \"\n               << pluralise( N, \"message\"_sr ) << ':';\n\n        while (itMessage != itEnd) {\n            // If this assertion is a warning ignore any INFO messages\n            if (printInfoMessages || itMessage->type != ResultWas::Info) {\n                printMessage();\n                if (itMessage != itEnd) {\n                    stream << colourImpl->guardColour(compactDimColour) << \" and\";\n                }\n                continue;\n            }\n            ++itMessage;\n        }\n    }\n\nprivate:\n    std::ostream& stream;\n    AssertionResult const& result;\n    std::vector<MessageInfo> const& messages;\n    std::vector<MessageInfo>::const_iterator itMessage;\n    bool printInfoMessages;\n    ColourImpl* colourImpl;\n};\n\n} // anon namespace\n\n        std::string CompactReporter::getDescription() {\n            return \"Reports test results on a single line, suitable for IDEs\";\n        }\n\n        void CompactReporter::noMatchingTestCases( StringRef unmatchedSpec ) {\n            m_stream << \"No test cases matched '\" << unmatchedSpec << \"'\\n\";\n        }\n\n        void CompactReporter::testRunStarting( TestRunInfo const& ) {\n            if ( m_config->testSpec().hasFilters() ) {\n                m_stream << m_colour->guardColour( Colour::BrightYellow )\n                         << \"Filters: \"\n                         << m_config->testSpec()\n                         << '\\n';\n            }\n            m_stream << \"RNG seed: \" << getSeed() << '\\n';\n        }\n\n        void CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) {\n            AssertionResult const& result = _assertionStats.assertionResult;\n\n            bool printInfoMessages = true;\n\n            // Drop out if result was successful and we're not printing those\n            if( !m_config->includeSuccessfulResults() && result.isOk() ) {\n                if( result.getResultType() != ResultWas::Warning && result.getResultType() != ResultWas::ExplicitSkip )\n                    return;\n                printInfoMessages = false;\n            }\n\n            AssertionPrinter printer( m_stream, _assertionStats, printInfoMessages, m_colour.get() );\n            printer.print();\n\n            m_stream << '\\n' << std::flush;\n        }\n\n        void CompactReporter::sectionEnded(SectionStats const& _sectionStats) {\n            double dur = _sectionStats.durationInSeconds;\n            if ( shouldShowDuration( *m_config, dur ) ) {\n                m_stream << getFormattedDuration( dur ) << \" s: \" << _sectionStats.sectionInfo.name << '\\n' << std::flush;\n            }\n        }\n\n        void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) {\n            printTestRunTotals( m_stream, *m_colour, _testRunStats.totals );\n            m_stream << \"\\n\\n\" << std::flush;\n            StreamingReporterBase::testRunEnded( _testRunStats );\n        }\n\n        CompactReporter::~CompactReporter() = default;\n\n} // end namespace Catch\n\n\n\n\n#include <cstdio>\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n // Note that 4062 (not all labels are handled and default is missing) is enabled\n#endif\n\n#if defined(__clang__)\n#  pragma clang diagnostic push\n// For simplicity, benchmarking-only helpers are always enabled\n#  pragma clang diagnostic ignored \"-Wunused-function\"\n#endif\n\n\n\nnamespace Catch {\n\nnamespace {\n\n// Formatter impl for ConsoleReporter\nclass ConsoleAssertionPrinter {\npublic:\n    ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete;\n    ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete;\n    ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, ColourImpl* colourImpl_, bool _printInfoMessages)\n        : stream(_stream),\n        stats(_stats),\n        result(_stats.assertionResult),\n        colour(Colour::None),\n        messages(_stats.infoMessages),\n        colourImpl(colourImpl_),\n        printInfoMessages(_printInfoMessages) {\n        switch (result.getResultType()) {\n        case ResultWas::Ok:\n            colour = Colour::Success;\n            passOrFail = \"PASSED\"_sr;\n            //if( result.hasMessage() )\n            if (messages.size() == 1)\n                messageLabel = \"with message\"_sr;\n            if (messages.size() > 1)\n                messageLabel = \"with messages\"_sr;\n            break;\n        case ResultWas::ExpressionFailed:\n            if (result.isOk()) {\n                colour = Colour::Success;\n                passOrFail = \"FAILED - but was ok\"_sr;\n            } else {\n                colour = Colour::Error;\n                passOrFail = \"FAILED\"_sr;\n            }\n            if (messages.size() == 1)\n                messageLabel = \"with message\"_sr;\n            if (messages.size() > 1)\n                messageLabel = \"with messages\"_sr;\n            break;\n        case ResultWas::ThrewException:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\"_sr;\n            // todo switch\n            switch (messages.size()) { case 0:\n                messageLabel = \"due to unexpected exception with \"_sr;\n                break;\n            case 1:\n                messageLabel = \"due to unexpected exception with message\"_sr;\n                break;\n            default:\n                messageLabel = \"due to unexpected exception with messages\"_sr;\n                break;\n            }\n            break;\n        case ResultWas::FatalErrorCondition:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\"_sr;\n            messageLabel = \"due to a fatal error condition\"_sr;\n            break;\n        case ResultWas::DidntThrowException:\n            colour = Colour::Error;\n            passOrFail = \"FAILED\"_sr;\n            messageLabel = \"because no exception was thrown where one was expected\"_sr;\n            break;\n        case ResultWas::Info:\n            messageLabel = \"info\"_sr;\n            break;\n        case ResultWas::Warning:\n            messageLabel = \"warning\"_sr;\n            break;\n        case ResultWas::ExplicitFailure:\n            passOrFail = \"FAILED\"_sr;\n            colour = Colour::Error;\n            if (messages.size() == 1)\n                messageLabel = \"explicitly with message\"_sr;\n            if (messages.size() > 1)\n                messageLabel = \"explicitly with messages\"_sr;\n            break;\n        case ResultWas::ExplicitSkip:\n            colour = Colour::Skip;\n            passOrFail = \"SKIPPED\"_sr;\n            if (messages.size() == 1)\n                messageLabel = \"explicitly with message\"_sr;\n            if (messages.size() > 1)\n                messageLabel = \"explicitly with messages\"_sr;\n            break;\n            // These cases are here to prevent compiler warnings\n        case ResultWas::Unknown:\n        case ResultWas::FailureBit:\n        case ResultWas::Exception:\n            passOrFail = \"** internal error **\"_sr;\n            colour = Colour::Error;\n            break;\n        }\n    }\n\n    void print() const {\n        printSourceInfo();\n        if (stats.totals.assertions.total() > 0) {\n            printResultType();\n            printOriginalExpression();\n            printReconstructedExpression();\n        } else {\n            stream << '\\n';\n        }\n        printMessage();\n    }\n\nprivate:\n    void printResultType() const {\n        if (!passOrFail.empty()) {\n            stream << colourImpl->guardColour(colour) << passOrFail << \":\\n\";\n        }\n    }\n    void printOriginalExpression() const {\n        if (result.hasExpression()) {\n            stream << colourImpl->guardColour( Colour::OriginalExpression )\n                   << \"  \" << result.getExpressionInMacro() << '\\n';\n        }\n    }\n    void printReconstructedExpression() const {\n        if (result.hasExpandedExpression()) {\n            stream << \"with expansion:\\n\";\n            stream << colourImpl->guardColour( Colour::ReconstructedExpression )\n                   << TextFlow::Column( result.getExpandedExpression() )\n                          .indent( 2 )\n                   << '\\n';\n        }\n    }\n    void printMessage() const {\n        if (!messageLabel.empty())\n            stream << messageLabel << ':' << '\\n';\n        for (auto const& msg : messages) {\n            // If this assertion is a warning ignore any INFO messages\n            if (printInfoMessages || msg.type != ResultWas::Info)\n                stream << TextFlow::Column(msg.message).indent(2) << '\\n';\n        }\n    }\n    void printSourceInfo() const {\n        stream << colourImpl->guardColour( Colour::FileName )\n               << result.getSourceInfo() << \": \";\n    }\n\n    std::ostream& stream;\n    AssertionStats const& stats;\n    AssertionResult const& result;\n    Colour::Code colour;\n    StringRef passOrFail;\n    StringRef messageLabel;\n    std::vector<MessageInfo> const& messages;\n    ColourImpl* colourImpl;\n    bool printInfoMessages;\n};\n\nstd::size_t makeRatio( std::uint64_t number, std::uint64_t total ) {\n    const auto ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0;\n    return (ratio == 0 && number > 0) ? 1 : static_cast<std::size_t>(ratio);\n}\n\nstd::size_t&\nfindMax( std::size_t& i, std::size_t& j, std::size_t& k, std::size_t& l ) {\n    if (i > j && i > k && i > l)\n        return i;\n    else if (j > k && j > l)\n        return j;\n    else if (k > l)\n        return k;\n    else\n        return l;\n}\n\nstruct ColumnBreak {};\nstruct RowBreak {};\nstruct OutputFlush {};\n\nclass Duration {\n    enum class Unit {\n        Auto,\n        Nanoseconds,\n        Microseconds,\n        Milliseconds,\n        Seconds,\n        Minutes\n    };\n    static const uint64_t s_nanosecondsInAMicrosecond = 1000;\n    static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond;\n    static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond;\n    static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond;\n\n    double m_inNanoseconds;\n    Unit m_units;\n\npublic:\n    explicit Duration(double inNanoseconds, Unit units = Unit::Auto)\n        : m_inNanoseconds(inNanoseconds),\n        m_units(units) {\n        if (m_units == Unit::Auto) {\n            if (m_inNanoseconds < s_nanosecondsInAMicrosecond)\n                m_units = Unit::Nanoseconds;\n            else if (m_inNanoseconds < s_nanosecondsInAMillisecond)\n                m_units = Unit::Microseconds;\n            else if (m_inNanoseconds < s_nanosecondsInASecond)\n                m_units = Unit::Milliseconds;\n            else if (m_inNanoseconds < s_nanosecondsInAMinute)\n                m_units = Unit::Seconds;\n            else\n                m_units = Unit::Minutes;\n        }\n\n    }\n\n    auto value() const -> double {\n        switch (m_units) {\n        case Unit::Microseconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMicrosecond);\n        case Unit::Milliseconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMillisecond);\n        case Unit::Seconds:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInASecond);\n        case Unit::Minutes:\n            return m_inNanoseconds / static_cast<double>(s_nanosecondsInAMinute);\n        default:\n            return m_inNanoseconds;\n        }\n    }\n    StringRef unitsAsString() const {\n        switch (m_units) {\n        case Unit::Nanoseconds:\n            return \"ns\"_sr;\n        case Unit::Microseconds:\n            return \"us\"_sr;\n        case Unit::Milliseconds:\n            return \"ms\"_sr;\n        case Unit::Seconds:\n            return \"s\"_sr;\n        case Unit::Minutes:\n            return \"m\"_sr;\n        default:\n            return \"** internal error **\"_sr;\n        }\n\n    }\n    friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& {\n        return os << duration.value() << ' ' << duration.unitsAsString();\n    }\n};\n} // end anon namespace\n\nenum class Justification { Left, Right };\n\nstruct ColumnInfo {\n    std::string name;\n    std::size_t width;\n    Justification justification;\n};\n\nclass TablePrinter {\n    std::ostream& m_os;\n    std::vector<ColumnInfo> m_columnInfos;\n    ReusableStringStream m_oss;\n    int m_currentColumn = -1;\n    bool m_isOpen = false;\n\npublic:\n    TablePrinter( std::ostream& os, std::vector<ColumnInfo> columnInfos )\n    :   m_os( os ),\n        m_columnInfos( CATCH_MOVE( columnInfos ) ) {}\n\n    auto columnInfos() const -> std::vector<ColumnInfo> const& {\n        return m_columnInfos;\n    }\n\n    void open() {\n        if (!m_isOpen) {\n            m_isOpen = true;\n            *this << RowBreak();\n\n\t\t\tTextFlow::Columns headerCols;\n\t\t\tfor (auto const& info : m_columnInfos) {\n                assert(info.width > 2);\n\t\t\t\theaderCols += TextFlow::Column(info.name).width(info.width - 2);\n                headerCols += TextFlow::Spacer( 2 );\n\t\t\t}\n\t\t\tm_os << headerCols << '\\n';\n\n            m_os << lineOfChars('-') << '\\n';\n        }\n    }\n    void close() {\n        if (m_isOpen) {\n            *this << RowBreak();\n            m_os << '\\n' << std::flush;\n            m_isOpen = false;\n        }\n    }\n\n    template<typename T>\n    friend TablePrinter& operator<< (TablePrinter& tp, T const& value) {\n        tp.m_oss << value;\n        return tp;\n    }\n\n    friend TablePrinter& operator<< (TablePrinter& tp, ColumnBreak) {\n        auto colStr = tp.m_oss.str();\n        const auto strSize = colStr.size();\n        tp.m_oss.str(\"\");\n        tp.open();\n        if (tp.m_currentColumn == static_cast<int>(tp.m_columnInfos.size() - 1)) {\n            tp.m_currentColumn = -1;\n            tp.m_os << '\\n';\n        }\n        tp.m_currentColumn++;\n\n        auto colInfo = tp.m_columnInfos[tp.m_currentColumn];\n        auto padding = (strSize + 1 < colInfo.width)\n            ? std::string(colInfo.width - (strSize + 1), ' ')\n            : std::string();\n        if (colInfo.justification == Justification::Left)\n            tp.m_os << colStr << padding << ' ';\n        else\n            tp.m_os << padding << colStr << ' ';\n        return tp;\n    }\n\n    friend TablePrinter& operator<< (TablePrinter& tp, RowBreak) {\n        if (tp.m_currentColumn > 0) {\n            tp.m_os << '\\n';\n            tp.m_currentColumn = -1;\n        }\n        return tp;\n    }\n\n    friend TablePrinter& operator<<(TablePrinter& tp, OutputFlush) {\n        tp.m_os << std::flush;\n        return tp;\n    }\n};\n\nConsoleReporter::ConsoleReporter(ReporterConfig&& config):\n    StreamingReporterBase( CATCH_MOVE( config ) ),\n    m_tablePrinter(Detail::make_unique<TablePrinter>(m_stream,\n        [&config]() -> std::vector<ColumnInfo> {\n        if (config.fullConfig()->benchmarkNoAnalysis())\n        {\n            return{\n                { \"benchmark name\", CATCH_CONFIG_CONSOLE_WIDTH - 43, Justification::Left },\n                { \"     samples\", 14, Justification::Right },\n                { \"  iterations\", 14, Justification::Right },\n                { \"        mean\", 14, Justification::Right }\n            };\n        }\n        else\n        {\n            return{\n                { \"benchmark name\", CATCH_CONFIG_CONSOLE_WIDTH - 43, Justification::Left },\n                { \"samples      mean       std dev\", 14, Justification::Right },\n                { \"iterations   low mean   low std dev\", 14, Justification::Right },\n                { \"est run time high mean  high std dev\", 14, Justification::Right }\n            };\n        }\n    }())) {}\nConsoleReporter::~ConsoleReporter() = default;\n\nstd::string ConsoleReporter::getDescription() {\n    return \"Reports test results as plain lines of text\";\n}\n\nvoid ConsoleReporter::noMatchingTestCases( StringRef unmatchedSpec ) {\n    m_stream << \"No test cases matched '\" << unmatchedSpec << \"'\\n\";\n}\n\nvoid ConsoleReporter::reportInvalidTestSpec( StringRef arg ) {\n    m_stream << \"Invalid Filter: \" << arg << '\\n';\n}\n\nvoid ConsoleReporter::assertionStarting(AssertionInfo const&) {}\n\nvoid ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) {\n    AssertionResult const& result = _assertionStats.assertionResult;\n\n    bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();\n\n    // Drop out if result was successful but we're not printing them.\n    // TODO: Make configurable whether skips should be printed\n    if (!includeResults && result.getResultType() != ResultWas::Warning && result.getResultType() != ResultWas::ExplicitSkip)\n        return;\n\n    lazyPrint();\n\n    ConsoleAssertionPrinter printer(m_stream, _assertionStats, m_colour.get(), includeResults);\n    printer.print();\n    m_stream << '\\n' << std::flush;\n}\n\nvoid ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) {\n    m_tablePrinter->close();\n    m_headerPrinted = false;\n    StreamingReporterBase::sectionStarting(_sectionInfo);\n}\nvoid ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) {\n    m_tablePrinter->close();\n    if (_sectionStats.missingAssertions) {\n        lazyPrint();\n        auto guard =\n            m_colour->guardColour( Colour::ResultError ).engage( m_stream );\n        if (m_sectionStack.size() > 1)\n            m_stream << \"\\nNo assertions in section\";\n        else\n            m_stream << \"\\nNo assertions in test case\";\n        m_stream << \" '\" << _sectionStats.sectionInfo.name << \"'\\n\\n\" << std::flush;\n    }\n    double dur = _sectionStats.durationInSeconds;\n    if (shouldShowDuration(*m_config, dur)) {\n        m_stream << getFormattedDuration(dur) << \" s: \" << _sectionStats.sectionInfo.name << '\\n' << std::flush;\n    }\n    if (m_headerPrinted) {\n        m_headerPrinted = false;\n    }\n    StreamingReporterBase::sectionEnded(_sectionStats);\n}\n\nvoid ConsoleReporter::benchmarkPreparing( StringRef name ) {\n\tlazyPrintWithoutClosingBenchmarkTable();\n\n\tauto nameCol = TextFlow::Column( static_cast<std::string>( name ) )\n                       .width( m_tablePrinter->columnInfos()[0].width - 2 );\n\n\tbool firstLine = true;\n\tfor (auto line : nameCol) {\n\t\tif (!firstLine)\n\t\t\t(*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak();\n\t\telse\n\t\t\tfirstLine = false;\n\n\t\t(*m_tablePrinter) << line << ColumnBreak();\n\t}\n}\n\nvoid ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) {\n    (*m_tablePrinter) << info.samples << ColumnBreak()\n        << info.iterations << ColumnBreak();\n    if ( !m_config->benchmarkNoAnalysis() ) {\n        ( *m_tablePrinter )\n            << Duration( info.estimatedDuration ) << ColumnBreak();\n    }\n    ( *m_tablePrinter ) << OutputFlush{};\n}\nvoid ConsoleReporter::benchmarkEnded(BenchmarkStats<> const& stats) {\n    if (m_config->benchmarkNoAnalysis())\n    {\n        (*m_tablePrinter) << Duration(stats.mean.point.count()) << ColumnBreak();\n    }\n    else\n    {\n        (*m_tablePrinter) << ColumnBreak()\n            << Duration(stats.mean.point.count()) << ColumnBreak()\n            << Duration(stats.mean.lower_bound.count()) << ColumnBreak()\n            << Duration(stats.mean.upper_bound.count()) << ColumnBreak() << ColumnBreak()\n            << Duration(stats.standardDeviation.point.count()) << ColumnBreak()\n            << Duration(stats.standardDeviation.lower_bound.count()) << ColumnBreak()\n            << Duration(stats.standardDeviation.upper_bound.count()) << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak() << ColumnBreak();\n    }\n}\n\nvoid ConsoleReporter::benchmarkFailed( StringRef error ) {\n    auto guard = m_colour->guardColour( Colour::Red ).engage( m_stream );\n    (*m_tablePrinter)\n        << \"Benchmark failed (\" << error << ')'\n        << ColumnBreak() << RowBreak();\n}\n\nvoid ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) {\n    m_tablePrinter->close();\n    StreamingReporterBase::testCaseEnded(_testCaseStats);\n    m_headerPrinted = false;\n}\nvoid ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) {\n    printTotalsDivider(_testRunStats.totals);\n    printTestRunTotals( m_stream, *m_colour, _testRunStats.totals );\n    m_stream << '\\n' << std::flush;\n    StreamingReporterBase::testRunEnded(_testRunStats);\n}\nvoid ConsoleReporter::testRunStarting(TestRunInfo const& _testRunInfo) {\n    StreamingReporterBase::testRunStarting(_testRunInfo);\n    if ( m_config->testSpec().hasFilters() ) {\n        m_stream << m_colour->guardColour( Colour::BrightYellow ) << \"Filters: \"\n                 << m_config->testSpec() << '\\n';\n    }\n    m_stream << \"Randomness seeded to: \" << getSeed() << '\\n';\n}\n\nvoid ConsoleReporter::lazyPrint() {\n\n    m_tablePrinter->close();\n    lazyPrintWithoutClosingBenchmarkTable();\n}\n\nvoid ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() {\n\n    if ( !m_testRunInfoPrinted ) {\n        lazyPrintRunInfo();\n    }\n    if (!m_headerPrinted) {\n        printTestCaseAndSectionHeader();\n        m_headerPrinted = true;\n    }\n}\nvoid ConsoleReporter::lazyPrintRunInfo() {\n    m_stream << '\\n'\n             << lineOfChars( '~' ) << '\\n'\n             << m_colour->guardColour( Colour::SecondaryText )\n             << currentTestRunInfo.name << \" is a Catch2 v\" << libraryVersion()\n             << \" host application.\\n\"\n             << \"Run with -? for options\\n\\n\";\n\n    m_testRunInfoPrinted = true;\n}\nvoid ConsoleReporter::printTestCaseAndSectionHeader() {\n    assert(!m_sectionStack.empty());\n    printOpenHeader(currentTestCaseInfo->name);\n\n    if (m_sectionStack.size() > 1) {\n        auto guard = m_colour->guardColour( Colour::Headers ).engage( m_stream );\n\n        auto\n            it = m_sectionStack.begin() + 1, // Skip first section (test case)\n            itEnd = m_sectionStack.end();\n        for (; it != itEnd; ++it)\n            printHeaderString(it->name, 2);\n    }\n\n    SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;\n\n\n    m_stream << lineOfChars( '-' ) << '\\n'\n             << m_colour->guardColour( Colour::FileName ) << lineInfo << '\\n'\n             << lineOfChars( '.' ) << \"\\n\\n\"\n             << std::flush;\n}\n\nvoid ConsoleReporter::printClosedHeader(std::string const& _name) {\n    printOpenHeader(_name);\n    m_stream << lineOfChars('.') << '\\n';\n}\nvoid ConsoleReporter::printOpenHeader(std::string const& _name) {\n    m_stream << lineOfChars('-') << '\\n';\n    {\n        auto guard = m_colour->guardColour( Colour::Headers ).engage( m_stream );\n        printHeaderString(_name);\n    }\n}\n\nvoid ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) {\n    // We want to get a bit fancy with line breaking here, so that subsequent\n    // lines start after \":\" if one is present, e.g.\n    // ```\n    // blablabla: Fancy\n    //            linebreaking\n    // ```\n    // but we also want to avoid problems with overly long indentation causing\n    // the text to take up too many lines, e.g.\n    // ```\n    // blablabla: F\n    //            a\n    //            n\n    //            c\n    //            y\n    //            .\n    //            .\n    //            .\n    // ```\n    // So we limit the prefix indentation check to first quarter of the possible\n    // width\n    std::size_t idx = _string.find( \": \" );\n    if ( idx != std::string::npos && idx < CATCH_CONFIG_CONSOLE_WIDTH / 4 ) {\n        idx += 2;\n    } else {\n        idx = 0;\n    }\n    m_stream << TextFlow::Column( _string )\n                  .indent( indent + idx )\n                  .initialIndent( indent )\n           << '\\n';\n}\n\nvoid ConsoleReporter::printTotalsDivider(Totals const& totals) {\n    if (totals.testCases.total() > 0) {\n        std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total());\n        std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total());\n        std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total());\n        std::size_t skippedRatio = makeRatio(totals.testCases.skipped, totals.testCases.total());\n        while (failedRatio + failedButOkRatio + passedRatio + skippedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1)\n            findMax(failedRatio, failedButOkRatio, passedRatio, skippedRatio)++;\n        while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1)\n            findMax(failedRatio, failedButOkRatio, passedRatio, skippedRatio)--;\n\n        m_stream << m_colour->guardColour( Colour::Error )\n                 << std::string( failedRatio, '=' )\n                 << m_colour->guardColour( Colour::ResultExpectedFailure )\n                 << std::string( failedButOkRatio, '=' );\n        if ( totals.testCases.allPassed() ) {\n            m_stream << m_colour->guardColour( Colour::ResultSuccess )\n                     << std::string( passedRatio, '=' );\n        } else {\n            m_stream << m_colour->guardColour( Colour::Success )\n                     << std::string( passedRatio, '=' );\n        }\n        m_stream << m_colour->guardColour( Colour::Skip )\n                 << std::string( skippedRatio, '=' );\n    } else {\n        m_stream << m_colour->guardColour( Colour::Warning )\n                 << std::string( CATCH_CONFIG_CONSOLE_WIDTH - 1, '=' );\n    }\n    m_stream << '\\n';\n}\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n\n#if defined(__clang__)\n#  pragma clang diagnostic pop\n#endif\n\n\n\n\n#include <algorithm>\n#include <cassert>\n\nnamespace Catch {\n    namespace {\n        struct BySectionInfo {\n            BySectionInfo( SectionInfo const& other ): m_other( other ) {}\n            BySectionInfo( BySectionInfo const& other ) = default;\n            bool operator()(\n                Detail::unique_ptr<CumulativeReporterBase::SectionNode> const&\n                    node ) const {\n                return (\n                    ( node->stats.sectionInfo.name == m_other.name ) &&\n                    ( node->stats.sectionInfo.lineInfo == m_other.lineInfo ) );\n            }\n            void operator=( BySectionInfo const& ) = delete;\n\n        private:\n            SectionInfo const& m_other;\n        };\n\n    } // namespace\n\n    namespace Detail {\n        AssertionOrBenchmarkResult::AssertionOrBenchmarkResult(\n            AssertionStats const& assertion ):\n            m_assertion( assertion ) {}\n\n        AssertionOrBenchmarkResult::AssertionOrBenchmarkResult(\n            BenchmarkStats<> const& benchmark ):\n            m_benchmark( benchmark ) {}\n\n        bool AssertionOrBenchmarkResult::isAssertion() const {\n            return m_assertion.some();\n        }\n        bool AssertionOrBenchmarkResult::isBenchmark() const {\n            return m_benchmark.some();\n        }\n\n        AssertionStats const& AssertionOrBenchmarkResult::asAssertion() const {\n            assert(m_assertion.some());\n\n            return *m_assertion;\n        }\n        BenchmarkStats<> const& AssertionOrBenchmarkResult::asBenchmark() const {\n            assert(m_benchmark.some());\n\n            return *m_benchmark;\n        }\n\n    }\n\n    CumulativeReporterBase::~CumulativeReporterBase() = default;\n\n    void CumulativeReporterBase::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) {\n        m_sectionStack.back()->assertionsAndBenchmarks.emplace_back(benchmarkStats);\n    }\n\n    void\n    CumulativeReporterBase::sectionStarting( SectionInfo const& sectionInfo ) {\n        // We need a copy, because SectionStats expect to take ownership\n        SectionStats incompleteStats( SectionInfo(sectionInfo), Counts(), 0, false );\n        SectionNode* node;\n        if ( m_sectionStack.empty() ) {\n            if ( !m_rootSection ) {\n                m_rootSection =\n                    Detail::make_unique<SectionNode>( incompleteStats );\n            }\n            node = m_rootSection.get();\n        } else {\n            SectionNode& parentNode = *m_sectionStack.back();\n            auto it = std::find_if( parentNode.childSections.begin(),\n                                    parentNode.childSections.end(),\n                                    BySectionInfo( sectionInfo ) );\n            if ( it == parentNode.childSections.end() ) {\n                auto newNode =\n                    Detail::make_unique<SectionNode>( incompleteStats );\n                node = newNode.get();\n                parentNode.childSections.push_back( CATCH_MOVE( newNode ) );\n            } else {\n                node = it->get();\n            }\n        }\n\n        m_deepestSection = node;\n        m_sectionStack.push_back( node );\n    }\n\n    void CumulativeReporterBase::assertionEnded(\n        AssertionStats const& assertionStats ) {\n        assert( !m_sectionStack.empty() );\n        // AssertionResult holds a pointer to a temporary DecomposedExpression,\n        // which getExpandedExpression() calls to build the expression string.\n        // Our section stack copy of the assertionResult will likely outlive the\n        // temporary, so it must be expanded or discarded now to avoid calling\n        // a destroyed object later.\n        if ( m_shouldStoreFailedAssertions &&\n             !assertionStats.assertionResult.isOk() ) {\n            static_cast<void>(\n                assertionStats.assertionResult.getExpandedExpression() );\n        }\n        if ( m_shouldStoreSuccesfulAssertions &&\n             assertionStats.assertionResult.isOk() ) {\n            static_cast<void>(\n                assertionStats.assertionResult.getExpandedExpression() );\n        }\n        SectionNode& sectionNode = *m_sectionStack.back();\n        sectionNode.assertionsAndBenchmarks.emplace_back( assertionStats );\n    }\n\n    void CumulativeReporterBase::sectionEnded( SectionStats const& sectionStats ) {\n        assert( !m_sectionStack.empty() );\n        SectionNode& node = *m_sectionStack.back();\n        node.stats = sectionStats;\n        m_sectionStack.pop_back();\n    }\n\n    void CumulativeReporterBase::testCaseEnded(\n        TestCaseStats const& testCaseStats ) {\n        auto node = Detail::make_unique<TestCaseNode>( testCaseStats );\n        assert( m_sectionStack.size() == 0 );\n        node->children.push_back( CATCH_MOVE(m_rootSection) );\n        m_testCases.push_back( CATCH_MOVE(node) );\n\n        assert( m_deepestSection );\n        m_deepestSection->stdOut = testCaseStats.stdOut;\n        m_deepestSection->stdErr = testCaseStats.stdErr;\n    }\n\n\n    void CumulativeReporterBase::testRunEnded( TestRunStats const& testRunStats ) {\n        assert(!m_testRun && \"CumulativeReporterBase assumes there can only be one test run\");\n        m_testRun = Detail::make_unique<TestRunNode>( testRunStats );\n        m_testRun->children.swap( m_testCases );\n        testRunEndedCumulative();\n    }\n\n    bool CumulativeReporterBase::SectionNode::hasAnyAssertions() const {\n        return std::any_of(\n            assertionsAndBenchmarks.begin(),\n            assertionsAndBenchmarks.end(),\n            []( Detail::AssertionOrBenchmarkResult const& res ) {\n                return res.isAssertion();\n            } );\n    }\n\n} // end namespace Catch\n\n\n\n\nnamespace Catch {\n\n    void EventListenerBase::fatalErrorEncountered( StringRef ) {}\n\n    void EventListenerBase::benchmarkPreparing( StringRef ) {}\n    void EventListenerBase::benchmarkStarting( BenchmarkInfo const& ) {}\n    void EventListenerBase::benchmarkEnded( BenchmarkStats<> const& ) {}\n    void EventListenerBase::benchmarkFailed( StringRef ) {}\n\n    void EventListenerBase::assertionStarting( AssertionInfo const& ) {}\n\n    void EventListenerBase::assertionEnded( AssertionStats const& ) {}\n    void EventListenerBase::listReporters(\n        std::vector<ReporterDescription> const& ) {}\n    void EventListenerBase::listListeners(\n        std::vector<ListenerDescription> const& ) {}\n    void EventListenerBase::listTests( std::vector<TestCaseHandle> const& ) {}\n    void EventListenerBase::listTags( std::vector<TagInfo> const& ) {}\n    void EventListenerBase::noMatchingTestCases( StringRef ) {}\n    void EventListenerBase::reportInvalidTestSpec( StringRef ) {}\n    void EventListenerBase::testRunStarting( TestRunInfo const& ) {}\n    void EventListenerBase::testCaseStarting( TestCaseInfo const& ) {}\n    void EventListenerBase::testCasePartialStarting(TestCaseInfo const&, uint64_t) {}\n    void EventListenerBase::sectionStarting( SectionInfo const& ) {}\n    void EventListenerBase::sectionEnded( SectionStats const& ) {}\n    void EventListenerBase::testCasePartialEnded(TestCaseStats const&, uint64_t) {}\n    void EventListenerBase::testCaseEnded( TestCaseStats const& ) {}\n    void EventListenerBase::testRunEnded( TestRunStats const& ) {}\n    void EventListenerBase::skipTest( TestCaseInfo const& ) {}\n} // namespace Catch\n\n\n\n\n#include <algorithm>\n#include <cfloat>\n#include <cstdio>\n#include <ostream>\n#include <iomanip>\n\nnamespace Catch {\n\n    namespace {\n        void listTestNamesOnly(std::ostream& out,\n                               std::vector<TestCaseHandle> const& tests) {\n            for (auto const& test : tests) {\n                auto const& testCaseInfo = test.getTestCaseInfo();\n\n                if (startsWith(testCaseInfo.name, '#')) {\n                    out << '\"' << testCaseInfo.name << '\"';\n                } else {\n                    out << testCaseInfo.name;\n                }\n\n                out << '\\n';\n            }\n            out << std::flush;\n        }\n    } // end unnamed namespace\n\n\n    // Because formatting using c++ streams is stateful, drop down to C is\n    // required Alternatively we could use stringstream, but its performance\n    // is... not good.\n    std::string getFormattedDuration( double duration ) {\n        // Max exponent + 1 is required to represent the whole part\n        // + 1 for decimal point\n        // + 3 for the 3 decimal places\n        // + 1 for null terminator\n        const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1;\n        char buffer[maxDoubleSize];\n\n        // Save previous errno, to prevent sprintf from overwriting it\n        ErrnoGuard guard;\n#ifdef _MSC_VER\n        size_t printedLength = static_cast<size_t>(\n            sprintf_s( buffer, \"%.3f\", duration ) );\n#else\n        size_t printedLength = static_cast<size_t>(\n            std::snprintf( buffer, maxDoubleSize, \"%.3f\", duration ) );\n#endif\n        return std::string( buffer, printedLength );\n    }\n\n    bool shouldShowDuration( IConfig const& config, double duration ) {\n        if ( config.showDurations() == ShowDurations::Always ) {\n            return true;\n        }\n        if ( config.showDurations() == ShowDurations::Never ) {\n            return false;\n        }\n        const double min = config.minDuration();\n        return min >= 0 && duration >= min;\n    }\n\n    std::string serializeFilters( std::vector<std::string> const& filters ) {\n        // We add a ' ' separator between each filter\n        size_t serialized_size = filters.size() - 1;\n        for (auto const& filter : filters) {\n            serialized_size += filter.size();\n        }\n\n        std::string serialized;\n        serialized.reserve(serialized_size);\n        bool first = true;\n\n        for (auto const& filter : filters) {\n            if (!first) {\n                serialized.push_back(' ');\n            }\n            first = false;\n            serialized.append(filter);\n        }\n\n        return serialized;\n    }\n\n    std::ostream& operator<<( std::ostream& out, lineOfChars value ) {\n        for ( size_t idx = 0; idx < CATCH_CONFIG_CONSOLE_WIDTH - 1; ++idx ) {\n            out.put( value.c );\n        }\n        return out;\n    }\n\n    void\n    defaultListReporters( std::ostream& out,\n                          std::vector<ReporterDescription> const& descriptions,\n                          Verbosity verbosity ) {\n        out << \"Available reporters:\\n\";\n        const auto maxNameLen =\n            std::max_element( descriptions.begin(),\n                              descriptions.end(),\n                              []( ReporterDescription const& lhs,\n                                  ReporterDescription const& rhs ) {\n                                  return lhs.name.size() < rhs.name.size();\n                              } )\n                ->name.size();\n\n        for ( auto const& desc : descriptions ) {\n            if ( verbosity == Verbosity::Quiet ) {\n                out << TextFlow::Column( desc.name )\n                           .indent( 2 )\n                           .width( 5 + maxNameLen )\n                    << '\\n';\n            } else {\n                out << TextFlow::Column( desc.name + ':' )\n                               .indent( 2 )\n                               .width( 5 + maxNameLen ) +\n                           TextFlow::Column( desc.description )\n                               .initialIndent( 0 )\n                               .indent( 2 )\n                               .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8 )\n                    << '\\n';\n            }\n        }\n        out << '\\n' << std::flush;\n    }\n\n    void defaultListListeners( std::ostream& out,\n                               std::vector<ListenerDescription> const& descriptions ) {\n        out << \"Registered listeners:\\n\";\n\n        if(descriptions.empty()) {\n            return;\n        }\n\n        const auto maxNameLen =\n            std::max_element( descriptions.begin(),\n                              descriptions.end(),\n                              []( ListenerDescription const& lhs,\n                                  ListenerDescription const& rhs ) {\n                                  return lhs.name.size() < rhs.name.size();\n                              } )\n                ->name.size();\n\n        for ( auto const& desc : descriptions ) {\n            out << TextFlow::Column( static_cast<std::string>( desc.name ) +\n                                     ':' )\n                           .indent( 2 )\n                           .width( maxNameLen + 5 ) +\n                       TextFlow::Column( desc.description )\n                           .initialIndent( 0 )\n                           .indent( 2 )\n                           .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen - 8 )\n                << '\\n';\n        }\n\n        out << '\\n' << std::flush;\n    }\n\n    void defaultListTags( std::ostream& out,\n                          std::vector<TagInfo> const& tags,\n                          bool isFiltered ) {\n        if ( isFiltered ) {\n            out << \"Tags for matching test cases:\\n\";\n        } else {\n            out << \"All available tags:\\n\";\n        }\n\n        for ( auto const& tagCount : tags ) {\n            ReusableStringStream rss;\n            rss << \"  \" << std::setw( 2 ) << tagCount.count << \"  \";\n            auto str = rss.str();\n            auto wrapper = TextFlow::Column( tagCount.all() )\n                               .initialIndent( 0 )\n                               .indent( str.size() )\n                               .width( CATCH_CONFIG_CONSOLE_WIDTH - 10 );\n            out << str << wrapper << '\\n';\n        }\n        out << pluralise(tags.size(), \"tag\"_sr) << \"\\n\\n\" << std::flush;\n    }\n\n    void defaultListTests(std::ostream& out, ColourImpl* streamColour, std::vector<TestCaseHandle> const& tests, bool isFiltered, Verbosity verbosity) {\n        // We special case this to provide the equivalent of old\n        // `--list-test-names-only`, which could then be used by the\n        // `--input-file` option.\n        if (verbosity == Verbosity::Quiet) {\n            listTestNamesOnly(out, tests);\n            return;\n        }\n\n        if (isFiltered) {\n            out << \"Matching test cases:\\n\";\n        } else {\n            out << \"All available test cases:\\n\";\n        }\n\n        for (auto const& test : tests) {\n            auto const& testCaseInfo = test.getTestCaseInfo();\n            Colour::Code colour = testCaseInfo.isHidden()\n                ? Colour::SecondaryText\n                : Colour::None;\n            auto colourGuard = streamColour->guardColour( colour ).engage( out );\n\n            out << TextFlow::Column(testCaseInfo.name).indent(2) << '\\n';\n            if (verbosity >= Verbosity::High) {\n                out << TextFlow::Column(Catch::Detail::stringify(testCaseInfo.lineInfo)).indent(4) << '\\n';\n            }\n            if (!testCaseInfo.tags.empty() &&\n                verbosity > Verbosity::Quiet) {\n                out << TextFlow::Column(testCaseInfo.tagsAsString()).indent(6) << '\\n';\n            }\n        }\n\n        if (isFiltered) {\n            out << pluralise(tests.size(), \"matching test case\"_sr);\n        } else {\n            out << pluralise(tests.size(), \"test case\"_sr);\n        }\n        out << \"\\n\\n\" << std::flush;\n    }\n\n    namespace {\n        class SummaryColumn {\n        public:\n            SummaryColumn( std::string suffix, Colour::Code colour ):\n                m_suffix( CATCH_MOVE( suffix ) ), m_colour( colour ) {}\n\n            SummaryColumn&& addRow( std::uint64_t count ) && {\n                std::string row = std::to_string(count);\n                auto const new_width = std::max( m_width, row.size() );\n                if ( new_width > m_width ) {\n                    for ( auto& oldRow : m_rows ) {\n                        oldRow.insert( 0, new_width - m_width, ' ' );\n                    }\n                } else {\n                    row.insert( 0, m_width - row.size(), ' ' );\n                }\n                m_width = new_width;\n                m_rows.push_back( row );\n                return std::move( *this );\n            }\n\n            std::string const& getSuffix() const { return m_suffix; }\n            Colour::Code getColour() const { return m_colour; }\n            std::string const& getRow( std::size_t index ) const {\n                return m_rows[index];\n            }\n\n        private:\n            std::string m_suffix;\n            Colour::Code m_colour;\n            std::size_t m_width = 0;\n            std::vector<std::string> m_rows;\n        };\n\n        void printSummaryRow( std::ostream& stream,\n                              ColourImpl& colour,\n                              StringRef label,\n                              std::vector<SummaryColumn> const& cols,\n                              std::size_t row ) {\n            for ( auto const& col : cols ) {\n                auto const& value = col.getRow( row );\n                auto const& suffix = col.getSuffix();\n                if ( suffix.empty() ) {\n                    stream << label << \": \";\n                    if ( value != \"0\" ) {\n                        stream << value;\n                    } else {\n                        stream << colour.guardColour( Colour::Warning )\n                               << \"- none -\";\n                    }\n                } else if ( value != \"0\" ) {\n                    stream << colour.guardColour( Colour::LightGrey ) << \" | \"\n                           << colour.guardColour( col.getColour() ) << value\n                           << ' ' << suffix;\n                }\n            }\n            stream << '\\n';\n        }\n    } // namespace\n\n    void printTestRunTotals( std::ostream& stream,\n                             ColourImpl& streamColour,\n                             Totals const& totals ) {\n        if ( totals.testCases.total() == 0 ) {\n            stream << streamColour.guardColour( Colour::Warning )\n                   << \"No tests ran\\n\";\n            return;\n        }\n\n        if ( totals.assertions.total() > 0 && totals.testCases.allPassed() ) {\n            stream << streamColour.guardColour( Colour::ResultSuccess )\n                   << \"All tests passed\";\n            stream << \" (\"\n                   << pluralise( totals.assertions.passed, \"assertion\"_sr )\n                   << \" in \"\n                   << pluralise( totals.testCases.passed, \"test case\"_sr )\n                   << ')' << '\\n';\n            return;\n        }\n\n        std::vector<SummaryColumn> columns;\n        // Don't include \"skipped assertions\" in total count\n        const auto totalAssertionCount =\n            totals.assertions.total() - totals.assertions.skipped;\n        columns.push_back( SummaryColumn( \"\", Colour::None )\n                               .addRow( totals.testCases.total() )\n                               .addRow( totalAssertionCount ) );\n        columns.push_back( SummaryColumn( \"passed\", Colour::Success )\n                               .addRow( totals.testCases.passed )\n                               .addRow( totals.assertions.passed ) );\n        columns.push_back( SummaryColumn( \"failed\", Colour::ResultError )\n                               .addRow( totals.testCases.failed )\n                               .addRow( totals.assertions.failed ) );\n        columns.push_back( SummaryColumn( \"skipped\", Colour::Skip )\n                               .addRow( totals.testCases.skipped )\n                               // Don't print \"skipped assertions\"\n                               .addRow( 0 ) );\n        columns.push_back(\n            SummaryColumn( \"failed as expected\", Colour::ResultExpectedFailure )\n                .addRow( totals.testCases.failedButOk )\n                .addRow( totals.assertions.failedButOk ) );\n        printSummaryRow( stream, streamColour, \"test cases\"_sr, columns, 0 );\n        printSummaryRow( stream, streamColour, \"assertions\"_sr, columns, 1 );\n    }\n\n} // namespace Catch\n\n\n//\n\nnamespace Catch {\n    namespace {\n        void writeSourceInfo( JsonObjectWriter& writer,\n                              SourceLineInfo const& sourceInfo ) {\n            auto source_location_writer =\n                writer.write( \"source-location\"_sr ).writeObject();\n            source_location_writer.write( \"filename\"_sr )\n                .write( sourceInfo.file );\n            source_location_writer.write( \"line\"_sr ).write( sourceInfo.line );\n        }\n\n        void writeTags( JsonArrayWriter writer, std::vector<Tag> const& tags ) {\n            for ( auto const& tag : tags ) {\n                writer.write( tag.original );\n            }\n        }\n\n        void writeProperties( JsonArrayWriter writer,\n                              TestCaseInfo const& info ) {\n            if ( info.isHidden() ) { writer.write( \"is-hidden\"_sr ); }\n            if ( info.okToFail() ) { writer.write( \"ok-to-fail\"_sr ); }\n            if ( info.expectedToFail() ) {\n                writer.write( \"expected-to-fail\"_sr );\n            }\n            if ( info.throws() ) { writer.write( \"throws\"_sr ); }\n        }\n\n    } // namespace\n\n    JsonReporter::JsonReporter( ReporterConfig&& config ):\n        StreamingReporterBase{ CATCH_MOVE( config ) } {\n\n        m_preferences.shouldRedirectStdOut = true;\n        // TBD: Do we want to report all assertions? XML reporter does\n        //      not, but for machine-parseable reporters I think the answer\n        //      should be yes.\n        m_preferences.shouldReportAllAssertions = true;\n\n        m_objectWriters.emplace( m_stream );\n        m_writers.emplace( Writer::Object );\n        auto& writer = m_objectWriters.top();\n\n        writer.write( \"version\"_sr ).write( 1 );\n\n        {\n            auto metadata_writer = writer.write( \"metadata\"_sr ).writeObject();\n            metadata_writer.write( \"name\"_sr ).write( m_config->name() );\n            metadata_writer.write( \"rng-seed\"_sr ).write( m_config->rngSeed() );\n            metadata_writer.write( \"catch2-version\"_sr )\n                .write( libraryVersion() );\n            if ( m_config->testSpec().hasFilters() ) {\n                metadata_writer.write( \"filters\"_sr )\n                    .write( m_config->testSpec() );\n            }\n        }\n    }\n\n    JsonReporter::~JsonReporter() {\n        endListing();\n        // TODO: Ensure this closes the top level object, add asserts\n        assert( m_writers.size() == 1 && \"Only the top level object should be open\" );\n        assert( m_writers.top() == Writer::Object );\n        endObject();\n        m_stream << '\\n' << std::flush;\n        assert( m_writers.empty() );\n    }\n\n    JsonArrayWriter& JsonReporter::startArray() {\n        m_arrayWriters.emplace( m_arrayWriters.top().writeArray() );\n        m_writers.emplace( Writer::Array );\n        return m_arrayWriters.top();\n    }\n    JsonArrayWriter& JsonReporter::startArray( StringRef key ) {\n        m_arrayWriters.emplace(\n            m_objectWriters.top().write( key ).writeArray() );\n        m_writers.emplace( Writer::Array );\n        return m_arrayWriters.top();\n    }\n\n    JsonObjectWriter& JsonReporter::startObject() {\n        m_objectWriters.emplace( m_arrayWriters.top().writeObject() );\n        m_writers.emplace( Writer::Object );\n        return m_objectWriters.top();\n    }\n    JsonObjectWriter& JsonReporter::startObject( StringRef key ) {\n        m_objectWriters.emplace(\n            m_objectWriters.top().write( key ).writeObject() );\n        m_writers.emplace( Writer::Object );\n        return m_objectWriters.top();\n    }\n\n    void JsonReporter::endObject() {\n        assert( isInside( Writer::Object ) );\n        m_objectWriters.pop();\n        m_writers.pop();\n    }\n    void JsonReporter::endArray() {\n        assert( isInside( Writer::Array ) );\n        m_arrayWriters.pop();\n        m_writers.pop();\n    }\n\n    bool JsonReporter::isInside( Writer writer ) {\n        return !m_writers.empty() && m_writers.top() == writer;\n    }\n\n    void JsonReporter::startListing() {\n        if ( !m_startedListing ) { startObject( \"listings\"_sr ); }\n        m_startedListing = true;\n    }\n    void JsonReporter::endListing() {\n        if ( m_startedListing ) { endObject(); }\n        m_startedListing = false;\n    }\n\n    std::string JsonReporter::getDescription() {\n        return \"Outputs listings as JSON. Test listing is Work-in-Progress!\";\n    }\n\n    void JsonReporter::testRunStarting( TestRunInfo const& runInfo ) {\n        StreamingReporterBase::testRunStarting( runInfo );\n        endListing();\n\n        assert( isInside( Writer::Object ) );\n        startObject( \"test-run\"_sr );\n        startArray( \"test-cases\"_sr );\n    }\n\n     static void writeCounts( JsonObjectWriter&& writer, Counts const& counts ) {\n        writer.write( \"passed\"_sr ).write( counts.passed );\n        writer.write( \"failed\"_sr ).write( counts.failed );\n        writer.write( \"fail-but-ok\"_sr ).write( counts.failedButOk );\n        writer.write( \"skipped\"_sr ).write( counts.skipped );\n    }\n\n    void JsonReporter::testRunEnded(TestRunStats const& runStats) {\n        assert( isInside( Writer::Array ) );\n        // End \"test-cases\"\n        endArray();\n\n        {\n            auto totals =\n                m_objectWriters.top().write( \"totals\"_sr ).writeObject();\n            writeCounts( totals.write( \"assertions\"_sr ).writeObject(),\n                         runStats.totals.assertions );\n            writeCounts( totals.write( \"test-cases\"_sr ).writeObject(),\n                         runStats.totals.testCases );\n        }\n\n        // End the \"test-run\" object\n        endObject();\n    }\n\n    void JsonReporter::testCaseStarting( TestCaseInfo const& tcInfo ) {\n        StreamingReporterBase::testCaseStarting( tcInfo );\n\n        assert( isInside( Writer::Array ) &&\n                \"We should be in the 'test-cases' array\" );\n        startObject();\n        // \"test-info\" prelude\n        {\n            auto testInfo =\n                m_objectWriters.top().write( \"test-info\"_sr ).writeObject();\n            // TODO: handle testName vs className!!\n            testInfo.write( \"name\"_sr ).write( tcInfo.name );\n            writeSourceInfo(testInfo, tcInfo.lineInfo);\n            writeTags( testInfo.write( \"tags\"_sr ).writeArray(), tcInfo.tags );\n            writeProperties( testInfo.write( \"properties\"_sr ).writeArray(),\n                             tcInfo );\n        }\n\n\n        // Start the array for individual test runs (testCasePartial pairs)\n        startArray( \"runs\"_sr );\n    }\n\n    void JsonReporter::testCaseEnded( TestCaseStats const& tcStats ) {\n        StreamingReporterBase::testCaseEnded( tcStats );\n\n        // We need to close the 'runs' array before finishing the test case\n        assert( isInside( Writer::Array ) );\n        endArray();\n\n        {\n            auto totals =\n                m_objectWriters.top().write( \"totals\"_sr ).writeObject();\n            writeCounts( totals.write( \"assertions\"_sr ).writeObject(),\n                         tcStats.totals.assertions );\n            // We do not write the test case totals, because there will always be just one test case here.\n            // TODO: overall \"result\" -> success, skip, fail here? Or in partial result?\n        }\n        // We do not write out stderr/stdout, because we instead wrote those out in partial runs\n\n        // TODO: aborting?\n\n        // And we also close this test case's object\n        assert( isInside( Writer::Object ) );\n        endObject();\n    }\n\n    void JsonReporter::testCasePartialStarting( TestCaseInfo const& /*tcInfo*/,\n                                                uint64_t index ) {\n        startObject();\n        m_objectWriters.top().write( \"run-idx\"_sr ).write( index );\n        startArray( \"path\"_sr );\n        // TODO: we want to delay most of the printing to the 'root' section\n        // TODO: childSection key name?\n    }\n\n    void JsonReporter::testCasePartialEnded( TestCaseStats const& tcStats,\n                                             uint64_t /*index*/ ) {\n        // Fixme: the top level section handles this.\n        //// path object\n        endArray();\n        if ( !tcStats.stdOut.empty() ) {\n            m_objectWriters.top()\n                .write( \"captured-stdout\"_sr )\n                .write( tcStats.stdOut );\n        }\n        if ( !tcStats.stdErr.empty() ) {\n            m_objectWriters.top()\n                .write( \"captured-stderr\"_sr )\n                .write( tcStats.stdErr );\n        }\n        {\n            auto totals =\n                m_objectWriters.top().write( \"totals\"_sr ).writeObject();\n            writeCounts( totals.write( \"assertions\"_sr ).writeObject(),\n                         tcStats.totals.assertions );\n            // We do not write the test case totals, because there will\n            // always be just one test case here.\n            // TODO: overall \"result\" -> success, skip, fail here? Or in\n            // partial result?\n        }\n        // TODO: aborting?\n        // run object\n        endObject();\n    }\n\n    void JsonReporter::sectionStarting( SectionInfo const& sectionInfo ) {\n        assert( isInside( Writer::Array ) &&\n                \"Section should always start inside an object\" );\n        // We want to nest top level sections, even though it shares name\n        // and source loc with the TEST_CASE\n        auto& sectionObject = startObject();\n        sectionObject.write( \"kind\"_sr ).write( \"section\"_sr );\n        sectionObject.write( \"name\"_sr ).write( sectionInfo.name );\n        writeSourceInfo( m_objectWriters.top(), sectionInfo.lineInfo );\n\n\n        // TBD: Do we want to create this event lazily? It would become\n        //      rather complex, but we could do it, and it would look\n        //      better for empty sections. OTOH, empty sections should\n        //      be rare.\n        startArray( \"path\"_sr );\n    }\n    void JsonReporter::sectionEnded( SectionStats const& /*sectionStats */) {\n        // End the subpath array\n        endArray();\n        // TODO: metadata\n        // TODO: what info do we have here?\n\n        // End the section object\n        endObject();\n    }\n\n    void JsonReporter::assertionStarting( AssertionInfo const& /*assertionInfo*/ ) {}\n    void JsonReporter::assertionEnded( AssertionStats const& assertionStats ) {\n        // TODO: There is lot of different things to handle here, but\n        //       we can fill it in later, after we show that the basic\n        //       outline and streaming reporter impl works well enough.\n        //if ( !m_config->includeSuccessfulResults()\n        //    && assertionStats.assertionResult.isOk() ) {\n        //    return;\n        //}\n        assert( isInside( Writer::Array ) );\n        auto assertionObject = m_arrayWriters.top().writeObject();\n\n        assertionObject.write( \"kind\"_sr ).write( \"assertion\"_sr );\n        writeSourceInfo( assertionObject,\n                         assertionStats.assertionResult.getSourceInfo() );\n        assertionObject.write( \"status\"_sr )\n            .write( assertionStats.assertionResult.isOk() );\n        // TODO: handling of result.\n        // TODO: messages\n        // TODO: totals?\n    }\n\n\n    void JsonReporter::benchmarkPreparing( StringRef name ) { (void)name; }\n    void JsonReporter::benchmarkStarting( BenchmarkInfo const& ) {}\n    void JsonReporter::benchmarkEnded( BenchmarkStats<> const& ) {}\n    void JsonReporter::benchmarkFailed( StringRef error ) { (void)error; }\n\n    void JsonReporter::listReporters(\n        std::vector<ReporterDescription> const& descriptions ) {\n        startListing();\n\n        auto writer =\n            m_objectWriters.top().write( \"reporters\"_sr ).writeArray();\n        for ( auto const& desc : descriptions ) {\n            auto desc_writer = writer.writeObject();\n            desc_writer.write( \"name\"_sr ).write( desc.name );\n            desc_writer.write( \"description\"_sr ).write( desc.description );\n        }\n    }\n    void JsonReporter::listListeners(\n        std::vector<ListenerDescription> const& descriptions ) {\n        startListing();\n\n        auto writer =\n            m_objectWriters.top().write( \"listeners\"_sr ).writeArray();\n\n        for ( auto const& desc : descriptions ) {\n            auto desc_writer = writer.writeObject();\n            desc_writer.write( \"name\"_sr ).write( desc.name );\n            desc_writer.write( \"description\"_sr ).write( desc.description );\n        }\n    }\n    void JsonReporter::listTests( std::vector<TestCaseHandle> const& tests ) {\n        startListing();\n\n        auto writer = m_objectWriters.top().write( \"tests\"_sr ).writeArray();\n\n        for ( auto const& test : tests ) {\n            auto desc_writer = writer.writeObject();\n            auto const& info = test.getTestCaseInfo();\n\n            desc_writer.write( \"name\"_sr ).write( info.name );\n            desc_writer.write( \"class-name\"_sr ).write( info.className );\n            {\n                auto tag_writer = desc_writer.write( \"tags\"_sr ).writeArray();\n                for ( auto const& tag : info.tags ) {\n                    tag_writer.write( tag.original );\n                }\n            }\n            writeSourceInfo( desc_writer, info.lineInfo );\n        }\n    }\n    void JsonReporter::listTags( std::vector<TagInfo> const& tags ) {\n        startListing();\n\n        auto writer = m_objectWriters.top().write( \"tags\"_sr ).writeArray();\n        for ( auto const& tag : tags ) {\n            auto tag_writer = writer.writeObject();\n            {\n                auto aliases_writer =\n                    tag_writer.write( \"aliases\"_sr ).writeArray();\n                for ( auto alias : tag.spellings ) {\n                    aliases_writer.write( alias );\n                }\n            }\n            tag_writer.write( \"count\"_sr ).write( tag.count );\n        }\n    }\n} // namespace Catch\n\n\n\n\n#include <cassert>\n#include <ctime>\n#include <algorithm>\n#include <iomanip>\n\nnamespace Catch {\n\n    namespace {\n        std::string getCurrentTimestamp() {\n            time_t rawtime;\n            std::time(&rawtime);\n\n            std::tm timeInfo = {};\n#if defined (_MSC_VER) || defined (__MINGW32__)\n            gmtime_s(&timeInfo, &rawtime);\n#elif defined (CATCH_PLATFORM_PLAYSTATION)\n            gmtime_s(&rawtime, &timeInfo);\n#elif defined (__IAR_SYSTEMS_ICC__)\n            timeInfo = *std::gmtime(&rawtime);\n#else\n            gmtime_r(&rawtime, &timeInfo);\n#endif\n\n            auto const timeStampSize = sizeof(\"2017-01-16T17:06:45Z\");\n            char timeStamp[timeStampSize];\n            const char * const fmt = \"%Y-%m-%dT%H:%M:%SZ\";\n\n            std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);\n\n            return std::string(timeStamp, timeStampSize - 1);\n        }\n\n        std::string fileNameTag(std::vector<Tag> const& tags) {\n            auto it = std::find_if(begin(tags),\n                                   end(tags),\n                                   [] (Tag const& tag) {\n                                       return tag.original.size() > 0\n                                           && tag.original[0] == '#'; });\n            if (it != tags.end()) {\n                return static_cast<std::string>(\n                    it->original.substr(1, it->original.size() - 1)\n                );\n            }\n            return std::string();\n        }\n\n        // Formats the duration in seconds to 3 decimal places.\n        // This is done because some genius defined Maven Surefire schema\n        // in a way that only accepts 3 decimal places, and tools like\n        // Jenkins use that schema for validation JUnit reporter output.\n        std::string formatDuration( double seconds ) {\n            ReusableStringStream rss;\n            rss << std::fixed << std::setprecision( 3 ) << seconds;\n            return rss.str();\n        }\n\n        static void normalizeNamespaceMarkers(std::string& str) {\n            std::size_t pos = str.find( \"::\" );\n            while ( pos != std::string::npos ) {\n                str.replace( pos, 2, \".\" );\n                pos += 1;\n                pos = str.find( \"::\", pos );\n            }\n        }\n\n    } // anonymous namespace\n\n    JunitReporter::JunitReporter( ReporterConfig&& _config )\n        :   CumulativeReporterBase( CATCH_MOVE(_config) ),\n            xml( m_stream )\n        {\n            m_preferences.shouldRedirectStdOut = true;\n            m_preferences.shouldReportAllAssertions = false;\n            m_shouldStoreSuccesfulAssertions = false;\n        }\n\n    std::string JunitReporter::getDescription() {\n        return \"Reports test results in an XML format that looks like Ant's junitreport target\";\n    }\n\n    void JunitReporter::testRunStarting( TestRunInfo const& runInfo )  {\n        CumulativeReporterBase::testRunStarting( runInfo );\n        xml.startElement( \"testsuites\" );\n        suiteTimer.start();\n        stdOutForSuite.clear();\n        stdErrForSuite.clear();\n        unexpectedExceptions = 0;\n    }\n\n    void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) {\n        m_okToFail = testCaseInfo.okToFail();\n    }\n\n    void JunitReporter::assertionEnded( AssertionStats const& assertionStats ) {\n        if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail )\n            unexpectedExceptions++;\n        CumulativeReporterBase::assertionEnded( assertionStats );\n    }\n\n    void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        stdOutForSuite += testCaseStats.stdOut;\n        stdErrForSuite += testCaseStats.stdErr;\n        CumulativeReporterBase::testCaseEnded( testCaseStats );\n    }\n\n    void JunitReporter::testRunEndedCumulative() {\n        const auto suiteTime = suiteTimer.getElapsedSeconds();\n        writeRun( *m_testRun, suiteTime );\n        xml.endElement();\n    }\n\n    void JunitReporter::writeRun( TestRunNode const& testRunNode, double suiteTime ) {\n        XmlWriter::ScopedElement e = xml.scopedElement( \"testsuite\" );\n\n        TestRunStats const& stats = testRunNode.value;\n        xml.writeAttribute( \"name\"_sr, stats.runInfo.name );\n        xml.writeAttribute( \"errors\"_sr, unexpectedExceptions );\n        xml.writeAttribute( \"failures\"_sr, stats.totals.assertions.failed-unexpectedExceptions );\n        xml.writeAttribute( \"skipped\"_sr, stats.totals.assertions.skipped );\n        xml.writeAttribute( \"tests\"_sr, stats.totals.assertions.total() );\n        xml.writeAttribute( \"hostname\"_sr, \"tbd\"_sr ); // !TBD\n        if( m_config->showDurations() == ShowDurations::Never )\n            xml.writeAttribute( \"time\"_sr, \"\"_sr );\n        else\n            xml.writeAttribute( \"time\"_sr, formatDuration( suiteTime ) );\n        xml.writeAttribute( \"timestamp\"_sr, getCurrentTimestamp() );\n\n        // Write properties\n        {\n            auto properties = xml.scopedElement(\"properties\");\n            xml.scopedElement(\"property\")\n                .writeAttribute(\"name\"_sr, \"random-seed\"_sr)\n                .writeAttribute(\"value\"_sr, m_config->rngSeed());\n            if (m_config->testSpec().hasFilters()) {\n                xml.scopedElement(\"property\")\n                    .writeAttribute(\"name\"_sr, \"filters\"_sr)\n                    .writeAttribute(\"value\"_sr, m_config->testSpec());\n            }\n        }\n\n        // Write test cases\n        for( auto const& child : testRunNode.children )\n            writeTestCase( *child );\n\n        xml.scopedElement( \"system-out\" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline );\n        xml.scopedElement( \"system-err\" ).writeText( trim( stdErrForSuite ), XmlFormatting::Newline );\n    }\n\n    void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) {\n        TestCaseStats const& stats = testCaseNode.value;\n\n        // All test cases have exactly one section - which represents the\n        // test case itself. That section may have 0-n nested sections\n        assert( testCaseNode.children.size() == 1 );\n        SectionNode const& rootSection = *testCaseNode.children.front();\n\n        std::string className =\n            static_cast<std::string>( stats.testInfo->className );\n\n        if( className.empty() ) {\n            className = fileNameTag(stats.testInfo->tags);\n            if ( className.empty() ) {\n                className = \"global\";\n            }\n        }\n\n        if ( !m_config->name().empty() )\n            className = static_cast<std::string>(m_config->name()) + '.' + className;\n\n        normalizeNamespaceMarkers(className);\n\n        writeSection( className, \"\", rootSection, stats.testInfo->okToFail() );\n    }\n\n    void JunitReporter::writeSection( std::string const& className,\n                                      std::string const& rootName,\n                                      SectionNode const& sectionNode,\n                                      bool testOkToFail) {\n        std::string name = trim( sectionNode.stats.sectionInfo.name );\n        if( !rootName.empty() )\n            name = rootName + '/' + name;\n\n        if ( sectionNode.stats.assertions.total() > 0\n           || !sectionNode.stdOut.empty()\n           || !sectionNode.stdErr.empty() ) {\n            XmlWriter::ScopedElement e = xml.scopedElement( \"testcase\" );\n            if( className.empty() ) {\n                xml.writeAttribute( \"classname\"_sr, name );\n                xml.writeAttribute( \"name\"_sr, \"root\"_sr );\n            }\n            else {\n                xml.writeAttribute( \"classname\"_sr, className );\n                xml.writeAttribute( \"name\"_sr, name );\n            }\n            xml.writeAttribute( \"time\"_sr, formatDuration( sectionNode.stats.durationInSeconds ) );\n            // This is not ideal, but it should be enough to mimic gtest's\n            // junit output.\n            // Ideally the JUnit reporter would also handle `skipTest`\n            // events and write those out appropriately.\n            xml.writeAttribute( \"status\"_sr, \"run\"_sr );\n\n            if (sectionNode.stats.assertions.failedButOk) {\n                xml.scopedElement(\"skipped\")\n                    .writeAttribute(\"message\", \"TEST_CASE tagged with !mayfail\");\n            }\n\n            writeAssertions( sectionNode );\n\n\n            if( !sectionNode.stdOut.empty() )\n                xml.scopedElement( \"system-out\" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline );\n            if( !sectionNode.stdErr.empty() )\n                xml.scopedElement( \"system-err\" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline );\n        }\n        for( auto const& childNode : sectionNode.childSections )\n            if( className.empty() )\n                writeSection( name, \"\", *childNode, testOkToFail );\n            else\n                writeSection( className, name, *childNode, testOkToFail );\n    }\n\n    void JunitReporter::writeAssertions( SectionNode const& sectionNode ) {\n        for (auto const& assertionOrBenchmark : sectionNode.assertionsAndBenchmarks) {\n            if (assertionOrBenchmark.isAssertion()) {\n                writeAssertion(assertionOrBenchmark.asAssertion());\n            }\n        }\n    }\n\n    void JunitReporter::writeAssertion( AssertionStats const& stats ) {\n        AssertionResult const& result = stats.assertionResult;\n        if ( !result.isOk() ||\n             result.getResultType() == ResultWas::ExplicitSkip ) {\n            std::string elementName;\n            switch( result.getResultType() ) {\n                case ResultWas::ThrewException:\n                case ResultWas::FatalErrorCondition:\n                    elementName = \"error\";\n                    break;\n                case ResultWas::ExplicitFailure:\n                case ResultWas::ExpressionFailed:\n                case ResultWas::DidntThrowException:\n                    elementName = \"failure\";\n                    break;\n                case ResultWas::ExplicitSkip:\n                    elementName = \"skipped\";\n                    break;\n                // We should never see these here:\n                case ResultWas::Info:\n                case ResultWas::Warning:\n                case ResultWas::Ok:\n                case ResultWas::Unknown:\n                case ResultWas::FailureBit:\n                case ResultWas::Exception:\n                    elementName = \"internalError\";\n                    break;\n            }\n\n            XmlWriter::ScopedElement e = xml.scopedElement( elementName );\n\n            xml.writeAttribute( \"message\"_sr, result.getExpression() );\n            xml.writeAttribute( \"type\"_sr, result.getTestMacroName() );\n\n            ReusableStringStream rss;\n            if ( result.getResultType() == ResultWas::ExplicitSkip ) {\n                rss << \"SKIPPED\\n\";\n            } else {\n                rss << \"FAILED\" << \":\\n\";\n                if (result.hasExpression()) {\n                    rss << \"  \";\n                    rss << result.getExpressionInMacro();\n                    rss << '\\n';\n                }\n                if (result.hasExpandedExpression()) {\n                    rss << \"with expansion:\\n\";\n                    rss << TextFlow::Column(result.getExpandedExpression()).indent(2) << '\\n';\n                }\n            }\n\n            if( result.hasMessage() )\n                rss << result.getMessage() << '\\n';\n            for( auto const& msg : stats.infoMessages )\n                if( msg.type == ResultWas::Info )\n                    rss << msg.message << '\\n';\n\n            rss << \"at \" << result.getSourceInfo();\n            xml.writeText( rss.str(), XmlFormatting::Newline );\n        }\n    }\n\n} // end namespace Catch\n\n\n\n\n#include <ostream>\n\nnamespace Catch {\n    void MultiReporter::updatePreferences(IEventListener const& reporterish) {\n        m_preferences.shouldRedirectStdOut |=\n            reporterish.getPreferences().shouldRedirectStdOut;\n        m_preferences.shouldReportAllAssertions |=\n            reporterish.getPreferences().shouldReportAllAssertions;\n    }\n\n    void MultiReporter::addListener( IEventListenerPtr&& listener ) {\n        updatePreferences(*listener);\n        m_reporterLikes.insert(m_reporterLikes.begin() + m_insertedListeners, CATCH_MOVE(listener) );\n        ++m_insertedListeners;\n    }\n\n    void MultiReporter::addReporter( IEventListenerPtr&& reporter ) {\n        updatePreferences(*reporter);\n\n        // We will need to output the captured stdout if there are reporters\n        // that do not want it captured.\n        // We do not consider listeners, because it is generally assumed that\n        // listeners are output-transparent, even though they can ask for stdout\n        // capture to do something with it.\n        m_haveNoncapturingReporters |= !reporter->getPreferences().shouldRedirectStdOut;\n\n        // Reporters can always be placed to the back without breaking the\n        // reporting order\n        m_reporterLikes.push_back( CATCH_MOVE( reporter ) );\n    }\n\n    void MultiReporter::noMatchingTestCases( StringRef unmatchedSpec ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->noMatchingTestCases( unmatchedSpec );\n        }\n    }\n\n    void MultiReporter::fatalErrorEncountered( StringRef error ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->fatalErrorEncountered( error );\n        }\n    }\n\n    void MultiReporter::reportInvalidTestSpec( StringRef arg ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->reportInvalidTestSpec( arg );\n        }\n    }\n\n    void MultiReporter::benchmarkPreparing( StringRef name ) {\n        for (auto& reporterish : m_reporterLikes) {\n            reporterish->benchmarkPreparing(name);\n        }\n    }\n    void MultiReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->benchmarkStarting( benchmarkInfo );\n        }\n    }\n    void MultiReporter::benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->benchmarkEnded( benchmarkStats );\n        }\n    }\n\n    void MultiReporter::benchmarkFailed( StringRef error ) {\n        for (auto& reporterish : m_reporterLikes) {\n            reporterish->benchmarkFailed(error);\n        }\n    }\n\n    void MultiReporter::testRunStarting( TestRunInfo const& testRunInfo ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->testRunStarting( testRunInfo );\n        }\n    }\n\n    void MultiReporter::testCaseStarting( TestCaseInfo const& testInfo ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->testCaseStarting( testInfo );\n        }\n    }\n\n    void\n    MultiReporter::testCasePartialStarting( TestCaseInfo const& testInfo,\n                                                uint64_t partNumber ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->testCasePartialStarting( testInfo, partNumber );\n        }\n    }\n\n    void MultiReporter::sectionStarting( SectionInfo const& sectionInfo ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->sectionStarting( sectionInfo );\n        }\n    }\n\n    void MultiReporter::assertionStarting( AssertionInfo const& assertionInfo ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->assertionStarting( assertionInfo );\n        }\n    }\n\n    void MultiReporter::assertionEnded( AssertionStats const& assertionStats ) {\n        const bool reportByDefault =\n            assertionStats.assertionResult.getResultType() != ResultWas::Ok ||\n            m_config->includeSuccessfulResults();\n\n        for ( auto & reporterish : m_reporterLikes ) {\n            if ( reportByDefault ||\n                 reporterish->getPreferences().shouldReportAllAssertions ) {\n                    reporterish->assertionEnded( assertionStats );\n            }\n        }\n    }\n\n    void MultiReporter::sectionEnded( SectionStats const& sectionStats ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->sectionEnded( sectionStats );\n        }\n    }\n\n    void MultiReporter::testCasePartialEnded( TestCaseStats const& testStats,\n                                                  uint64_t partNumber ) {\n        if ( m_preferences.shouldRedirectStdOut &&\n             m_haveNoncapturingReporters ) {\n            if ( !testStats.stdOut.empty() ) {\n                Catch::cout() << testStats.stdOut << std::flush;\n            }\n            if ( !testStats.stdErr.empty() ) {\n                Catch::cerr() << testStats.stdErr << std::flush;\n            }\n        }\n\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->testCasePartialEnded( testStats, partNumber );\n        }\n    }\n\n    void MultiReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->testCaseEnded( testCaseStats );\n        }\n    }\n\n    void MultiReporter::testRunEnded( TestRunStats const& testRunStats ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->testRunEnded( testRunStats );\n        }\n    }\n\n\n    void MultiReporter::skipTest( TestCaseInfo const& testInfo ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->skipTest( testInfo );\n        }\n    }\n\n    void MultiReporter::listReporters(std::vector<ReporterDescription> const& descriptions) {\n        for (auto& reporterish : m_reporterLikes) {\n            reporterish->listReporters(descriptions);\n        }\n    }\n\n    void MultiReporter::listListeners(\n        std::vector<ListenerDescription> const& descriptions ) {\n        for ( auto& reporterish : m_reporterLikes ) {\n            reporterish->listListeners( descriptions );\n        }\n    }\n\n    void MultiReporter::listTests(std::vector<TestCaseHandle> const& tests) {\n        for (auto& reporterish : m_reporterLikes) {\n            reporterish->listTests(tests);\n        }\n    }\n\n    void MultiReporter::listTags(std::vector<TagInfo> const& tags) {\n        for (auto& reporterish : m_reporterLikes) {\n            reporterish->listTags(tags);\n        }\n    }\n\n} // end namespace Catch\n\n\n\n\n\nnamespace Catch {\n    namespace Detail {\n\n        void registerReporterImpl( std::string const& name,\n                                   IReporterFactoryPtr reporterPtr ) {\n            CATCH_TRY {\n                getMutableRegistryHub().registerReporter(\n                    name, CATCH_MOVE( reporterPtr ) );\n            }\n            CATCH_CATCH_ALL {\n                // Do not throw when constructing global objects, instead\n                // register the exception to be processed later\n                getMutableRegistryHub().registerStartupException();\n            }\n        }\n\n        void registerListenerImpl( Detail::unique_ptr<EventListenerFactory> listenerFactory ) {\n            getMutableRegistryHub().registerListener( CATCH_MOVE(listenerFactory) );\n        }\n\n\n    } // namespace Detail\n} // namespace Catch\n\n\n\n\n#include <map>\n\nnamespace Catch {\n\n    namespace {\n        std::string createMetadataString(IConfig const& config) {\n            ReusableStringStream sstr;\n            if ( config.testSpec().hasFilters() ) {\n                sstr << \"filters='\"\n                         << config.testSpec()\n                         << \"' \";\n            }\n            sstr << \"rng-seed=\" << config.rngSeed();\n            return sstr.str();\n        }\n    }\n\n    void SonarQubeReporter::testRunStarting(TestRunInfo const& testRunInfo) {\n        CumulativeReporterBase::testRunStarting(testRunInfo);\n\n        xml.writeComment( createMetadataString( *m_config ) );\n        xml.startElement(\"testExecutions\");\n        xml.writeAttribute(\"version\"_sr, '1');\n    }\n\n    void SonarQubeReporter::writeRun( TestRunNode const& runNode ) {\n        std::map<StringRef, std::vector<TestCaseNode const*>> testsPerFile;\n\n        for ( auto const& child : runNode.children ) {\n            testsPerFile[child->value.testInfo->lineInfo.file].push_back(\n                child.get() );\n        }\n\n        for ( auto const& kv : testsPerFile ) {\n            writeTestFile( kv.first, kv.second );\n        }\n    }\n\n    void SonarQubeReporter::writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes) {\n        XmlWriter::ScopedElement e = xml.scopedElement(\"file\");\n        xml.writeAttribute(\"path\"_sr, filename);\n\n        for (auto const& child : testCaseNodes)\n            writeTestCase(*child);\n    }\n\n    void SonarQubeReporter::writeTestCase(TestCaseNode const& testCaseNode) {\n        // All test cases have exactly one section - which represents the\n        // test case itself. That section may have 0-n nested sections\n        assert(testCaseNode.children.size() == 1);\n        SectionNode const& rootSection = *testCaseNode.children.front();\n        writeSection(\"\", rootSection, testCaseNode.value.testInfo->okToFail());\n    }\n\n    void SonarQubeReporter::writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail) {\n        std::string name = trim(sectionNode.stats.sectionInfo.name);\n        if (!rootName.empty())\n            name = rootName + '/' + name;\n\n        if ( sectionNode.stats.assertions.total() > 0\n            || !sectionNode.stdOut.empty()\n            || !sectionNode.stdErr.empty() ) {\n            XmlWriter::ScopedElement e = xml.scopedElement(\"testCase\");\n            xml.writeAttribute(\"name\"_sr, name);\n            xml.writeAttribute(\"duration\"_sr, static_cast<long>(sectionNode.stats.durationInSeconds * 1000));\n\n            writeAssertions(sectionNode, okToFail);\n        }\n\n        for (auto const& childNode : sectionNode.childSections)\n            writeSection(name, *childNode, okToFail);\n    }\n\n    void SonarQubeReporter::writeAssertions(SectionNode const& sectionNode, bool okToFail) {\n        for (auto const& assertionOrBenchmark : sectionNode.assertionsAndBenchmarks) {\n            if (assertionOrBenchmark.isAssertion()) {\n                writeAssertion(assertionOrBenchmark.asAssertion(), okToFail);\n            }\n        }\n    }\n\n    void SonarQubeReporter::writeAssertion(AssertionStats const& stats, bool okToFail) {\n        AssertionResult const& result = stats.assertionResult;\n        if ( !result.isOk() ||\n             result.getResultType() == ResultWas::ExplicitSkip ) {\n            std::string elementName;\n            if (okToFail) {\n                elementName = \"skipped\";\n            } else {\n                switch (result.getResultType()) {\n                case ResultWas::ThrewException:\n                case ResultWas::FatalErrorCondition:\n                    elementName = \"error\";\n                    break;\n                case ResultWas::ExplicitFailure:\n                case ResultWas::ExpressionFailed:\n                case ResultWas::DidntThrowException:\n                    elementName = \"failure\";\n                    break;\n                case ResultWas::ExplicitSkip:\n                    elementName = \"skipped\";\n                    break;\n                    // We should never see these here:\n                case ResultWas::Info:\n                case ResultWas::Warning:\n                case ResultWas::Ok:\n                case ResultWas::Unknown:\n                case ResultWas::FailureBit:\n                case ResultWas::Exception:\n                    elementName = \"internalError\";\n                    break;\n                }\n            }\n\n            XmlWriter::ScopedElement e = xml.scopedElement(elementName);\n\n            ReusableStringStream messageRss;\n            messageRss << result.getTestMacroName() << '(' << result.getExpression() << ')';\n            xml.writeAttribute(\"message\"_sr, messageRss.str());\n\n            ReusableStringStream textRss;\n            if ( result.getResultType() == ResultWas::ExplicitSkip ) {\n                textRss << \"SKIPPED\\n\";\n            } else {\n                textRss << \"FAILED:\\n\";\n                if (result.hasExpression()) {\n                    textRss << '\\t' << result.getExpressionInMacro() << '\\n';\n                }\n                if (result.hasExpandedExpression()) {\n                    textRss << \"with expansion:\\n\\t\" << result.getExpandedExpression() << '\\n';\n                }\n            }\n\n            if (result.hasMessage())\n                textRss << result.getMessage() << '\\n';\n\n            for (auto const& msg : stats.infoMessages)\n                if (msg.type == ResultWas::Info)\n                    textRss << msg.message << '\\n';\n\n            textRss << \"at \" << result.getSourceInfo();\n            xml.writeText(textRss.str(), XmlFormatting::Newline);\n        }\n    }\n\n} // end namespace Catch\n\n\n\nnamespace Catch {\n\n    StreamingReporterBase::~StreamingReporterBase() = default;\n\n    void\n    StreamingReporterBase::testRunStarting( TestRunInfo const& _testRunInfo ) {\n        currentTestRunInfo = _testRunInfo;\n    }\n\n    void StreamingReporterBase::testRunEnded( TestRunStats const& ) {\n        currentTestCaseInfo = nullptr;\n    }\n\n} // end namespace Catch\n\n\n\n#include <algorithm>\n#include <ostream>\n\nnamespace Catch {\n\n    namespace {\n        // Yes, this has to be outside the class and namespaced by naming.\n        // Making older compiler happy is hard.\n        static constexpr StringRef tapFailedString = \"not ok\"_sr;\n        static constexpr StringRef tapPassedString = \"ok\"_sr;\n        static constexpr Colour::Code tapDimColour = Colour::FileName;\n\n        class TapAssertionPrinter {\n        public:\n            TapAssertionPrinter& operator= (TapAssertionPrinter const&) = delete;\n            TapAssertionPrinter(TapAssertionPrinter const&) = delete;\n            TapAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, std::size_t _counter, ColourImpl* colour_)\n                : stream(_stream)\n                , result(_stats.assertionResult)\n                , messages(_stats.infoMessages)\n                , itMessage(_stats.infoMessages.begin())\n                , printInfoMessages(true)\n                , counter(_counter)\n                , colourImpl( colour_ ) {}\n\n            void print() {\n                itMessage = messages.begin();\n\n                switch (result.getResultType()) {\n                case ResultWas::Ok:\n                    printResultType(tapPassedString);\n                    printOriginalExpression();\n                    printReconstructedExpression();\n                    if (!result.hasExpression())\n                        printRemainingMessages(Colour::None);\n                    else\n                        printRemainingMessages();\n                    break;\n                case ResultWas::ExpressionFailed:\n                    if (result.isOk()) {\n                        printResultType(tapPassedString);\n                    } else {\n                        printResultType(tapFailedString);\n                    }\n                    printOriginalExpression();\n                    printReconstructedExpression();\n                    if (result.isOk()) {\n                        printIssue(\" # TODO\");\n                    }\n                    printRemainingMessages();\n                    break;\n                case ResultWas::ThrewException:\n                    printResultType(tapFailedString);\n                    printIssue(\"unexpected exception with message:\"_sr);\n                    printMessage();\n                    printExpressionWas();\n                    printRemainingMessages();\n                    break;\n                case ResultWas::FatalErrorCondition:\n                    printResultType(tapFailedString);\n                    printIssue(\"fatal error condition with message:\"_sr);\n                    printMessage();\n                    printExpressionWas();\n                    printRemainingMessages();\n                    break;\n                case ResultWas::DidntThrowException:\n                    printResultType(tapFailedString);\n                    printIssue(\"expected exception, got none\"_sr);\n                    printExpressionWas();\n                    printRemainingMessages();\n                    break;\n                case ResultWas::Info:\n                    printResultType(\"info\"_sr);\n                    printMessage();\n                    printRemainingMessages();\n                    break;\n                case ResultWas::Warning:\n                    printResultType(\"warning\"_sr);\n                    printMessage();\n                    printRemainingMessages();\n                    break;\n                case ResultWas::ExplicitFailure:\n                    printResultType(tapFailedString);\n                    printIssue(\"explicitly\"_sr);\n                    printRemainingMessages(Colour::None);\n                    break;\n                case ResultWas::ExplicitSkip:\n                    printResultType(tapPassedString);\n                    printIssue(\" # SKIP\"_sr);\n                    printMessage();\n                    printRemainingMessages();\n                    break;\n                    // These cases are here to prevent compiler warnings\n                case ResultWas::Unknown:\n                case ResultWas::FailureBit:\n                case ResultWas::Exception:\n                    printResultType(\"** internal error **\"_sr);\n                    break;\n                }\n            }\n\n        private:\n            void printResultType(StringRef passOrFail) const {\n                if (!passOrFail.empty()) {\n                    stream << passOrFail << ' ' << counter << \" -\";\n                }\n            }\n\n            void printIssue(StringRef issue) const {\n                stream << ' ' << issue;\n            }\n\n            void printExpressionWas() {\n                if (result.hasExpression()) {\n                    stream << ';';\n                    stream << colourImpl->guardColour( tapDimColour )\n                           << \" expression was:\";\n                    printOriginalExpression();\n                }\n            }\n\n            void printOriginalExpression() const {\n                if (result.hasExpression()) {\n                    stream << ' ' << result.getExpression();\n                }\n            }\n\n            void printReconstructedExpression() const {\n                if (result.hasExpandedExpression()) {\n                    stream << colourImpl->guardColour( tapDimColour ) << \" for: \";\n\n                    std::string expr = result.getExpandedExpression();\n                    std::replace(expr.begin(), expr.end(), '\\n', ' ');\n                    stream << expr;\n                }\n            }\n\n            void printMessage() {\n                if (itMessage != messages.end()) {\n                    stream << \" '\" << itMessage->message << '\\'';\n                    ++itMessage;\n                }\n            }\n\n            void printRemainingMessages(Colour::Code colour = tapDimColour) {\n                if (itMessage == messages.end()) {\n                    return;\n                }\n\n                // using messages.end() directly (or auto) yields compilation error:\n                std::vector<MessageInfo>::const_iterator itEnd = messages.end();\n                const std::size_t N = static_cast<std::size_t>(itEnd - itMessage);\n\n                stream << colourImpl->guardColour( colour ) << \" with \"\n                       << pluralise( N, \"message\"_sr ) << ':';\n\n                for (; itMessage != itEnd; ) {\n                    // If this assertion is a warning ignore any INFO messages\n                    if (printInfoMessages || itMessage->type != ResultWas::Info) {\n                        stream << \" '\" << itMessage->message << '\\'';\n                        if (++itMessage != itEnd) {\n                            stream << colourImpl->guardColour(tapDimColour) << \" and\";\n                        }\n                    }\n                }\n            }\n\n        private:\n            std::ostream& stream;\n            AssertionResult const& result;\n            std::vector<MessageInfo> const& messages;\n            std::vector<MessageInfo>::const_iterator itMessage;\n            bool printInfoMessages;\n            std::size_t counter;\n            ColourImpl* colourImpl;\n        };\n\n    } // End anonymous namespace\n\n    void TAPReporter::testRunStarting( TestRunInfo const& ) {\n        if ( m_config->testSpec().hasFilters() ) {\n            m_stream << \"# filters: \" << m_config->testSpec() << '\\n';\n        }\n        m_stream << \"# rng-seed: \" << m_config->rngSeed() << '\\n';\n    }\n\n    void TAPReporter::noMatchingTestCases( StringRef unmatchedSpec ) {\n        m_stream << \"# No test cases matched '\" << unmatchedSpec << \"'\\n\";\n    }\n\n    void TAPReporter::assertionEnded(AssertionStats const& _assertionStats) {\n        ++counter;\n\n        m_stream << \"# \" << currentTestCaseInfo->name << '\\n';\n        TapAssertionPrinter printer(m_stream, _assertionStats, counter, m_colour.get());\n        printer.print();\n\n        m_stream << '\\n' << std::flush;\n    }\n\n    void TAPReporter::testRunEnded(TestRunStats const& _testRunStats) {\n        m_stream << \"1..\" << _testRunStats.totals.assertions.total();\n        if (_testRunStats.totals.testCases.total() == 0) {\n            m_stream << \" # Skipped: No tests ran.\";\n        }\n        m_stream << \"\\n\\n\" << std::flush;\n        StreamingReporterBase::testRunEnded(_testRunStats);\n    }\n\n\n\n\n} // end namespace Catch\n\n\n\n\n#include <cassert>\n#include <ostream>\n\nnamespace Catch {\n\n    namespace {\n        // if string has a : in first line will set indent to follow it on\n        // subsequent lines\n        void printHeaderString(std::ostream& os, std::string const& _string, std::size_t indent = 0) {\n            std::size_t i = _string.find(\": \");\n            if (i != std::string::npos)\n                i += 2;\n            else\n                i = 0;\n            os << TextFlow::Column(_string)\n                  .indent(indent + i)\n                  .initialIndent(indent) << '\\n';\n        }\n\n        std::string escape(StringRef str) {\n            std::string escaped = static_cast<std::string>(str);\n            replaceInPlace(escaped, \"|\", \"||\");\n            replaceInPlace(escaped, \"'\", \"|'\");\n            replaceInPlace(escaped, \"\\n\", \"|n\");\n            replaceInPlace(escaped, \"\\r\", \"|r\");\n            replaceInPlace(escaped, \"[\", \"|[\");\n            replaceInPlace(escaped, \"]\", \"|]\");\n            return escaped;\n        }\n    } // end anonymous namespace\n\n\n    TeamCityReporter::~TeamCityReporter() = default;\n\n    void TeamCityReporter::testRunStarting( TestRunInfo const& runInfo ) {\n        m_stream << \"##teamcity[testSuiteStarted name='\" << escape( runInfo.name )\n               << \"']\\n\";\n    }\n\n    void TeamCityReporter::testRunEnded( TestRunStats const& runStats ) {\n        m_stream << \"##teamcity[testSuiteFinished name='\"\n               << escape( runStats.runInfo.name ) << \"']\\n\";\n    }\n\n    void TeamCityReporter::assertionEnded(AssertionStats const& assertionStats) {\n        AssertionResult const& result = assertionStats.assertionResult;\n        if ( !result.isOk() ||\n             result.getResultType() == ResultWas::ExplicitSkip ) {\n\n            ReusableStringStream msg;\n            if (!m_headerPrintedForThisSection)\n                printSectionHeader(msg.get());\n            m_headerPrintedForThisSection = true;\n\n            msg << result.getSourceInfo() << '\\n';\n\n            switch (result.getResultType()) {\n            case ResultWas::ExpressionFailed:\n                msg << \"expression failed\";\n                break;\n            case ResultWas::ThrewException:\n                msg << \"unexpected exception\";\n                break;\n            case ResultWas::FatalErrorCondition:\n                msg << \"fatal error condition\";\n                break;\n            case ResultWas::DidntThrowException:\n                msg << \"no exception was thrown where one was expected\";\n                break;\n            case ResultWas::ExplicitFailure:\n                msg << \"explicit failure\";\n                break;\n            case ResultWas::ExplicitSkip:\n                msg << \"explicit skip\";\n                break;\n\n                // We shouldn't get here because of the isOk() test\n            case ResultWas::Ok:\n            case ResultWas::Info:\n            case ResultWas::Warning:\n                CATCH_ERROR(\"Internal error in TeamCity reporter\");\n                // These cases are here to prevent compiler warnings\n            case ResultWas::Unknown:\n            case ResultWas::FailureBit:\n            case ResultWas::Exception:\n                CATCH_ERROR(\"Not implemented\");\n            }\n            if (assertionStats.infoMessages.size() == 1)\n                msg << \" with message:\";\n            if (assertionStats.infoMessages.size() > 1)\n                msg << \" with messages:\";\n            for (auto const& messageInfo : assertionStats.infoMessages)\n                msg << \"\\n  \\\"\" << messageInfo.message << '\"';\n\n\n            if (result.hasExpression()) {\n                msg <<\n                    \"\\n  \" << result.getExpressionInMacro() << \"\\n\"\n                    \"with expansion:\\n\"\n                    \"  \" << result.getExpandedExpression() << '\\n';\n            }\n\n            if ( result.getResultType() == ResultWas::ExplicitSkip ) {\n                m_stream << \"##teamcity[testIgnored\";\n            } else if ( currentTestCaseInfo->okToFail() ) {\n                msg << \"- failure ignore as test marked as 'ok to fail'\\n\";\n                m_stream << \"##teamcity[testIgnored\";\n            } else {\n                m_stream << \"##teamcity[testFailed\";\n            }\n            m_stream << \" name='\" << escape( currentTestCaseInfo->name ) << '\\''\n                     << \" message='\" << escape( msg.str() ) << '\\'' << \"]\\n\";\n        }\n        m_stream.flush();\n    }\n\n    void TeamCityReporter::testCaseStarting(TestCaseInfo const& testInfo) {\n        m_testTimer.start();\n        StreamingReporterBase::testCaseStarting(testInfo);\n        m_stream << \"##teamcity[testStarted name='\"\n            << escape(testInfo.name) << \"']\\n\";\n        m_stream.flush();\n    }\n\n    void TeamCityReporter::testCaseEnded(TestCaseStats const& testCaseStats) {\n        StreamingReporterBase::testCaseEnded(testCaseStats);\n        auto const& testCaseInfo = *testCaseStats.testInfo;\n        if (!testCaseStats.stdOut.empty())\n            m_stream << \"##teamcity[testStdOut name='\"\n            << escape(testCaseInfo.name)\n            << \"' out='\" << escape(testCaseStats.stdOut) << \"']\\n\";\n        if (!testCaseStats.stdErr.empty())\n            m_stream << \"##teamcity[testStdErr name='\"\n            << escape(testCaseInfo.name)\n            << \"' out='\" << escape(testCaseStats.stdErr) << \"']\\n\";\n        m_stream << \"##teamcity[testFinished name='\"\n            << escape(testCaseInfo.name) << \"' duration='\"\n            << m_testTimer.getElapsedMilliseconds() << \"']\\n\";\n        m_stream.flush();\n    }\n\n    void TeamCityReporter::printSectionHeader(std::ostream& os) {\n        assert(!m_sectionStack.empty());\n\n        if (m_sectionStack.size() > 1) {\n            os << lineOfChars('-') << '\\n';\n\n            std::vector<SectionInfo>::const_iterator\n                it = m_sectionStack.begin() + 1, // Skip first section (test case)\n                itEnd = m_sectionStack.end();\n            for (; it != itEnd; ++it)\n                printHeaderString(os, it->name);\n            os << lineOfChars('-') << '\\n';\n        }\n\n        SourceLineInfo lineInfo = m_sectionStack.front().lineInfo;\n\n        os << lineInfo << '\\n';\n        os << lineOfChars('.') << \"\\n\\n\";\n    }\n\n} // end namespace Catch\n\n\n\n\n#if defined(_MSC_VER)\n#pragma warning(push)\n#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch\n                              // Note that 4062 (not all labels are handled\n                              // and default is missing) is enabled\n#endif\n\nnamespace Catch {\n    XmlReporter::XmlReporter( ReporterConfig&& _config )\n    :   StreamingReporterBase( CATCH_MOVE(_config) ),\n        m_xml(m_stream)\n    {\n        m_preferences.shouldRedirectStdOut = true;\n        m_preferences.shouldReportAllAssertions = true;\n    }\n\n    XmlReporter::~XmlReporter() = default;\n\n    std::string XmlReporter::getDescription() {\n        return \"Reports test results as an XML document\";\n    }\n\n    std::string XmlReporter::getStylesheetRef() const {\n        return std::string();\n    }\n\n    void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) {\n        m_xml\n            .writeAttribute( \"filename\"_sr, sourceInfo.file )\n            .writeAttribute( \"line\"_sr, sourceInfo.line );\n    }\n\n    void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) {\n        StreamingReporterBase::testRunStarting( testInfo );\n        std::string stylesheetRef = getStylesheetRef();\n        if( !stylesheetRef.empty() )\n            m_xml.writeStylesheetRef( stylesheetRef );\n        m_xml.startElement(\"Catch2TestRun\")\n             .writeAttribute(\"name\"_sr, m_config->name())\n             .writeAttribute(\"rng-seed\"_sr, m_config->rngSeed())\n             .writeAttribute(\"xml-format-version\"_sr, 3)\n             .writeAttribute(\"catch2-version\"_sr, libraryVersion());\n        if ( m_config->testSpec().hasFilters() ) {\n            m_xml.writeAttribute( \"filters\"_sr, m_config->testSpec() );\n        }\n    }\n\n    void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) {\n        StreamingReporterBase::testCaseStarting(testInfo);\n        m_xml.startElement( \"TestCase\" )\n            .writeAttribute( \"name\"_sr, trim( StringRef(testInfo.name) ) )\n            .writeAttribute( \"tags\"_sr, testInfo.tagsAsString() );\n\n        writeSourceInfo( testInfo.lineInfo );\n\n        if ( m_config->showDurations() == ShowDurations::Always )\n            m_testCaseTimer.start();\n        m_xml.ensureTagClosed();\n    }\n\n    void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) {\n        StreamingReporterBase::sectionStarting( sectionInfo );\n        if( m_sectionDepth++ > 0 ) {\n            m_xml.startElement( \"Section\" )\n                .writeAttribute( \"name\"_sr, trim( StringRef(sectionInfo.name) ) );\n            writeSourceInfo( sectionInfo.lineInfo );\n            m_xml.ensureTagClosed();\n        }\n    }\n\n    void XmlReporter::assertionStarting( AssertionInfo const& ) { }\n\n    void XmlReporter::assertionEnded( AssertionStats const& assertionStats ) {\n\n        AssertionResult const& result = assertionStats.assertionResult;\n\n        bool includeResults = m_config->includeSuccessfulResults() || !result.isOk();\n\n        if( includeResults || result.getResultType() == ResultWas::Warning ) {\n            // Print any info messages in <Info> tags.\n            for( auto const& msg : assertionStats.infoMessages ) {\n                if( msg.type == ResultWas::Info && includeResults ) {\n                    auto t = m_xml.scopedElement( \"Info\" );\n                    writeSourceInfo( msg.lineInfo );\n                    t.writeText( msg.message );\n                } else if ( msg.type == ResultWas::Warning ) {\n                    auto t = m_xml.scopedElement( \"Warning\" );\n                    writeSourceInfo( msg.lineInfo );\n                    t.writeText( msg.message );\n                }\n            }\n        }\n\n        // Drop out if result was successful but we're not printing them.\n        if ( !includeResults && result.getResultType() != ResultWas::Warning &&\n             result.getResultType() != ResultWas::ExplicitSkip ) {\n            return;\n        }\n\n        // Print the expression if there is one.\n        if( result.hasExpression() ) {\n            m_xml.startElement( \"Expression\" )\n                .writeAttribute( \"success\"_sr, result.succeeded() )\n                .writeAttribute( \"type\"_sr, result.getTestMacroName() );\n\n            writeSourceInfo( result.getSourceInfo() );\n\n            m_xml.scopedElement( \"Original\" )\n                .writeText( result.getExpression() );\n            m_xml.scopedElement( \"Expanded\" )\n                .writeText( result.getExpandedExpression() );\n        }\n\n        // And... Print a result applicable to each result type.\n        switch( result.getResultType() ) {\n            case ResultWas::ThrewException:\n                m_xml.startElement( \"Exception\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            case ResultWas::FatalErrorCondition:\n                m_xml.startElement( \"FatalErrorCondition\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            case ResultWas::Info:\n                m_xml.scopedElement( \"Info\" )\n                     .writeText( result.getMessage() );\n                break;\n            case ResultWas::Warning:\n                // Warning will already have been written\n                break;\n            case ResultWas::ExplicitFailure:\n                m_xml.startElement( \"Failure\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            case ResultWas::ExplicitSkip:\n                m_xml.startElement( \"Skip\" );\n                writeSourceInfo( result.getSourceInfo() );\n                m_xml.writeText( result.getMessage() );\n                m_xml.endElement();\n                break;\n            default:\n                break;\n        }\n\n        if( result.hasExpression() )\n            m_xml.endElement();\n    }\n\n    void XmlReporter::sectionEnded( SectionStats const& sectionStats ) {\n        StreamingReporterBase::sectionEnded( sectionStats );\n        if ( --m_sectionDepth > 0 ) {\n            {\n                XmlWriter::ScopedElement e = m_xml.scopedElement( \"OverallResults\" );\n                e.writeAttribute( \"successes\"_sr, sectionStats.assertions.passed );\n                e.writeAttribute( \"failures\"_sr, sectionStats.assertions.failed );\n                e.writeAttribute( \"expectedFailures\"_sr, sectionStats.assertions.failedButOk );\n                e.writeAttribute( \"skipped\"_sr, sectionStats.assertions.skipped > 0 );\n\n                if ( m_config->showDurations() == ShowDurations::Always )\n                    e.writeAttribute( \"durationInSeconds\"_sr, sectionStats.durationInSeconds );\n            }\n            // Ends assertion tag\n            m_xml.endElement();\n        }\n    }\n\n    void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) {\n        StreamingReporterBase::testCaseEnded( testCaseStats );\n        XmlWriter::ScopedElement e = m_xml.scopedElement( \"OverallResult\" );\n        e.writeAttribute( \"success\"_sr, testCaseStats.totals.assertions.allOk() );\n        e.writeAttribute( \"skips\"_sr, testCaseStats.totals.assertions.skipped );\n\n        if ( m_config->showDurations() == ShowDurations::Always )\n            e.writeAttribute( \"durationInSeconds\"_sr, m_testCaseTimer.getElapsedSeconds() );\n        if( !testCaseStats.stdOut.empty() )\n            m_xml.scopedElement( \"StdOut\" ).writeText( trim( StringRef(testCaseStats.stdOut) ), XmlFormatting::Newline );\n        if( !testCaseStats.stdErr.empty() )\n            m_xml.scopedElement( \"StdErr\" ).writeText( trim( StringRef(testCaseStats.stdErr) ), XmlFormatting::Newline );\n\n        m_xml.endElement();\n    }\n\n    void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) {\n        StreamingReporterBase::testRunEnded( testRunStats );\n        m_xml.scopedElement( \"OverallResults\" )\n            .writeAttribute( \"successes\"_sr, testRunStats.totals.assertions.passed )\n            .writeAttribute( \"failures\"_sr, testRunStats.totals.assertions.failed )\n            .writeAttribute( \"expectedFailures\"_sr, testRunStats.totals.assertions.failedButOk )\n            .writeAttribute( \"skips\"_sr, testRunStats.totals.assertions.skipped );\n        m_xml.scopedElement( \"OverallResultsCases\")\n            .writeAttribute( \"successes\"_sr, testRunStats.totals.testCases.passed )\n            .writeAttribute( \"failures\"_sr, testRunStats.totals.testCases.failed )\n            .writeAttribute( \"expectedFailures\"_sr, testRunStats.totals.testCases.failedButOk )\n            .writeAttribute( \"skips\"_sr, testRunStats.totals.testCases.skipped );\n        m_xml.endElement();\n    }\n\n    void XmlReporter::benchmarkPreparing( StringRef name ) {\n        m_xml.startElement(\"BenchmarkResults\")\n             .writeAttribute(\"name\"_sr, name);\n    }\n\n    void XmlReporter::benchmarkStarting(BenchmarkInfo const &info) {\n        m_xml.writeAttribute(\"samples\"_sr, info.samples)\n            .writeAttribute(\"resamples\"_sr, info.resamples)\n            .writeAttribute(\"iterations\"_sr, info.iterations)\n            .writeAttribute(\"clockResolution\"_sr, info.clockResolution)\n            .writeAttribute(\"estimatedDuration\"_sr, info.estimatedDuration)\n            .writeComment(\"All values in nano seconds\"_sr);\n    }\n\n    void XmlReporter::benchmarkEnded(BenchmarkStats<> const& benchmarkStats) {\n        m_xml.scopedElement(\"mean\")\n            .writeAttribute(\"value\"_sr, benchmarkStats.mean.point.count())\n            .writeAttribute(\"lowerBound\"_sr, benchmarkStats.mean.lower_bound.count())\n            .writeAttribute(\"upperBound\"_sr, benchmarkStats.mean.upper_bound.count())\n            .writeAttribute(\"ci\"_sr, benchmarkStats.mean.confidence_interval);\n        m_xml.scopedElement(\"standardDeviation\")\n            .writeAttribute(\"value\"_sr, benchmarkStats.standardDeviation.point.count())\n            .writeAttribute(\"lowerBound\"_sr, benchmarkStats.standardDeviation.lower_bound.count())\n            .writeAttribute(\"upperBound\"_sr, benchmarkStats.standardDeviation.upper_bound.count())\n            .writeAttribute(\"ci\"_sr, benchmarkStats.standardDeviation.confidence_interval);\n        m_xml.scopedElement(\"outliers\")\n            .writeAttribute(\"variance\"_sr, benchmarkStats.outlierVariance)\n            .writeAttribute(\"lowMild\"_sr, benchmarkStats.outliers.low_mild)\n            .writeAttribute(\"lowSevere\"_sr, benchmarkStats.outliers.low_severe)\n            .writeAttribute(\"highMild\"_sr, benchmarkStats.outliers.high_mild)\n            .writeAttribute(\"highSevere\"_sr, benchmarkStats.outliers.high_severe);\n        m_xml.endElement();\n    }\n\n    void XmlReporter::benchmarkFailed(StringRef error) {\n        m_xml.scopedElement(\"failed\").\n            writeAttribute(\"message\"_sr, error);\n        m_xml.endElement();\n    }\n\n    void XmlReporter::listReporters(std::vector<ReporterDescription> const& descriptions) {\n        auto outerTag = m_xml.scopedElement(\"AvailableReporters\");\n        for (auto const& reporter : descriptions) {\n            auto inner = m_xml.scopedElement(\"Reporter\");\n            m_xml.startElement(\"Name\", XmlFormatting::Indent)\n                 .writeText(reporter.name, XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n            m_xml.startElement(\"Description\", XmlFormatting::Indent)\n                 .writeText(reporter.description, XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n        }\n    }\n\n    void XmlReporter::listListeners(std::vector<ListenerDescription> const& descriptions) {\n        auto outerTag = m_xml.scopedElement( \"RegisteredListeners\" );\n        for ( auto const& listener : descriptions ) {\n            auto inner = m_xml.scopedElement( \"Listener\" );\n            m_xml.startElement( \"Name\", XmlFormatting::Indent )\n                .writeText( listener.name, XmlFormatting::None )\n                .endElement( XmlFormatting::Newline );\n            m_xml.startElement( \"Description\", XmlFormatting::Indent )\n                .writeText( listener.description, XmlFormatting::None )\n                .endElement( XmlFormatting::Newline );\n        }\n    }\n\n    void XmlReporter::listTests(std::vector<TestCaseHandle> const& tests) {\n        auto outerTag = m_xml.scopedElement(\"MatchingTests\");\n        for (auto const& test : tests) {\n            auto innerTag = m_xml.scopedElement(\"TestCase\");\n            auto const& testInfo = test.getTestCaseInfo();\n            m_xml.startElement(\"Name\", XmlFormatting::Indent)\n                 .writeText(testInfo.name, XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n            m_xml.startElement(\"ClassName\", XmlFormatting::Indent)\n                 .writeText(testInfo.className, XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n            m_xml.startElement(\"Tags\", XmlFormatting::Indent)\n                 .writeText(testInfo.tagsAsString(), XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n\n            auto sourceTag = m_xml.scopedElement(\"SourceInfo\");\n            m_xml.startElement(\"File\", XmlFormatting::Indent)\n                 .writeText(testInfo.lineInfo.file, XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n            m_xml.startElement(\"Line\", XmlFormatting::Indent)\n                 .writeText(std::to_string(testInfo.lineInfo.line), XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n        }\n    }\n\n    void XmlReporter::listTags(std::vector<TagInfo> const& tags) {\n        auto outerTag = m_xml.scopedElement(\"TagsFromMatchingTests\");\n        for (auto const& tag : tags) {\n            auto innerTag = m_xml.scopedElement(\"Tag\");\n            m_xml.startElement(\"Count\", XmlFormatting::Indent)\n                 .writeText(std::to_string(tag.count), XmlFormatting::None)\n                 .endElement(XmlFormatting::Newline);\n            auto aliasTag = m_xml.scopedElement(\"Aliases\");\n            for (auto const& alias : tag.spellings) {\n                m_xml.startElement(\"Alias\", XmlFormatting::Indent)\n                     .writeText(alias, XmlFormatting::None)\n                     .endElement(XmlFormatting::Newline);\n            }\n        }\n    }\n\n} // end namespace Catch\n\n#if defined(_MSC_VER)\n#pragma warning(pop)\n#endif\n"
  },
  {
    "path": "tests/catch2/catch_amalgamated.hpp",
    "content": "\n//              Copyright Catch2 Authors\n// Distributed under the Boost Software License, Version 1.0.\n//   (See accompanying file LICENSE.txt or copy at\n//        https://www.boost.org/LICENSE_1_0.txt)\n\n// SPDX-License-Identifier: BSL-1.0\n\n//  Catch v3.7.1\n//  Generated: 2024-09-17 10:36:40.974985\n//  ----------------------------------------------------------\n//  This file is an amalgamation of multiple different files.\n//  You probably shouldn't edit it directly.\n//  ----------------------------------------------------------\n#ifndef CATCH_AMALGAMATED_HPP_INCLUDED\n#define CATCH_AMALGAMATED_HPP_INCLUDED\n\n\n/** \\file\n * This is a convenience header for Catch2. It includes **all** of Catch2 headers.\n *\n * Generally the Catch2 users should use specific includes they need,\n * but this header can be used instead for ease-of-experimentation, or\n * just plain convenience, at the cost of (significantly) increased\n * compilation times.\n *\n * When a new header is added to either the top level folder, or to the\n * corresponding internal subfolder, it should be added here. Headers\n * added to the various subparts (e.g. matchers, generators, etc...),\n * should go their respective catch-all headers.\n */\n\n#ifndef CATCH_ALL_HPP_INCLUDED\n#define CATCH_ALL_HPP_INCLUDED\n\n\n\n/** \\file\n * This is a convenience header for Catch2's benchmarking. It includes\n * **all** of Catch2 headers related to benchmarking.\n *\n * Generally the Catch2 users should use specific includes they need,\n * but this header can be used instead for ease-of-experimentation, or\n * just plain convenience, at the cost of (significantly) increased\n * compilation times.\n *\n * When a new header is added to either the `benchmark` folder, or to\n * the corresponding internal (detail) subfolder, it should be added here.\n */\n\n#ifndef CATCH_BENCHMARK_ALL_HPP_INCLUDED\n#define CATCH_BENCHMARK_ALL_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_BENCHMARK_HPP_INCLUDED\n#define CATCH_BENCHMARK_HPP_INCLUDED\n\n\n\n#ifndef CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED\n#define CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED\n\n// Detect a number of compiler features - by compiler\n// The following features are defined:\n//\n// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported?\n// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported?\n// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled?\n// ****************\n// Note to maintainers: if new toggles are added please document them\n// in configuration.md, too\n// ****************\n\n// In general each macro has a _NO_<feature name> form\n// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature.\n// Many features, at point of detection, define an _INTERNAL_ macro, so they\n// can be combined, en-mass, with the _NO_ forms later.\n\n\n\n#ifndef CATCH_PLATFORM_HPP_INCLUDED\n#define CATCH_PLATFORM_HPP_INCLUDED\n\n// See e.g.:\n// https://opensource.apple.com/source/CarbonHeaders/CarbonHeaders-18.1/TargetConditionals.h.auto.html\n#ifdef __APPLE__\n#  ifndef __has_extension\n#    define __has_extension(x) 0\n#  endif\n#  include <TargetConditionals.h>\n#  if (defined(TARGET_OS_OSX) && TARGET_OS_OSX == 1) || \\\n      (defined(TARGET_OS_MAC) && TARGET_OS_MAC == 1)\n#    define CATCH_PLATFORM_MAC\n#  elif (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE == 1)\n#    define CATCH_PLATFORM_IPHONE\n#  endif\n\n#elif defined(linux) || defined(__linux) || defined(__linux__)\n#  define CATCH_PLATFORM_LINUX\n\n#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__)\n#  define CATCH_PLATFORM_WINDOWS\n\n#  if defined( WINAPI_FAMILY ) && ( WINAPI_FAMILY == WINAPI_FAMILY_APP )\n#      define CATCH_PLATFORM_WINDOWS_UWP\n#  endif\n\n#elif defined(__ORBIS__) || defined(__PROSPERO__)\n#  define CATCH_PLATFORM_PLAYSTATION\n\n#endif\n\n#endif // CATCH_PLATFORM_HPP_INCLUDED\n\n#ifdef __cplusplus\n\n#  if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)\n#    define CATCH_CPP17_OR_GREATER\n#  endif\n\n#  if (__cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L)\n#    define CATCH_CPP20_OR_GREATER\n#  endif\n\n#endif\n\n// Only GCC compiler should be used in this block, so other compilers trying to\n// mask themselves as GCC should be ignored.\n#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && !defined(__CUDACC__) && !defined(__LCC__) && !defined(__NVCOMPILER)\n#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( \"GCC diagnostic push\" )\n#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( \"GCC diagnostic pop\" )\n\n// This only works on GCC 9+. so we have to also add a global suppression of Wparentheses\n// for older versions of GCC.\n#    define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \\\n         _Pragma( \"GCC diagnostic ignored \\\"-Wparentheses\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \\\n         _Pragma( \"GCC diagnostic ignored \\\"-Wunused-result\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n         _Pragma( \"GCC diagnostic ignored \\\"-Wunused-variable\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \\\n         _Pragma( \"GCC diagnostic ignored \\\"-Wuseless-cast\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \\\n         _Pragma( \"GCC diagnostic ignored \\\"-Wshadow\\\"\" )\n\n#    define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__)\n\n#endif\n\n#if defined(__NVCOMPILER)\n#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( \"diag push\" )\n#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( \"diag pop\" )\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( \"diag_suppress declared_but_not_referenced\" )\n#endif\n\n#if defined(__CUDACC__) && !defined(__clang__)\n#  ifdef __NVCC_DIAG_PRAGMA_SUPPORT__\n// New pragmas introduced in CUDA 11.5+\n#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( \"nv_diagnostic push\" )\n#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( \"nv_diagnostic pop\" )\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( \"nv_diag_suppress 177\" )\n#  else\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS _Pragma( \"diag_suppress 177\" )\n#  endif\n#endif\n\n// clang-cl defines _MSC_VER as well as __clang__, which could cause the\n// start/stop internal suppression macros to be double defined.\n#if defined(__clang__) && !defined(_MSC_VER)\n\n#    define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION _Pragma( \"clang diagnostic push\" )\n#    define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION  _Pragma( \"clang diagnostic pop\" )\n\n#endif // __clang__ && !_MSC_VER\n\n#if defined(__clang__)\n\n// As of this writing, IBM XL's implementation of __builtin_constant_p has a bug\n// which results in calls to destructors being emitted for each temporary,\n// without a matching initialization. In practice, this can result in something\n// like `std::string::~string` being called on an uninitialized value.\n//\n// For example, this code will likely segfault under IBM XL:\n// ```\n// REQUIRE(std::string(\"12\") + \"34\" == \"1234\")\n// ```\n//\n// Similarly, NVHPC's implementation of `__builtin_constant_p` has a bug which\n// results in calls to the immediately evaluated lambda expressions to be\n// reported as unevaluated lambdas.\n// https://developer.nvidia.com/nvidia_bug/3321845.\n//\n// Therefore, `CATCH_INTERNAL_IGNORE_BUT_WARN` is not implemented.\n#  if !defined(__ibmxl__) && !defined(__CUDACC__) && !defined( __NVCOMPILER )\n#    define CATCH_INTERNAL_IGNORE_BUT_WARN(...) (void)__builtin_constant_p(__VA_ARGS__) /* NOLINT(cppcoreguidelines-pro-type-vararg, hicpp-vararg) */\n#  endif\n\n\n#    define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wexit-time-destructors\\\"\" ) \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wglobal-constructors\\\"\")\n\n#    define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wparentheses\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wunused-variable\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wgnu-zero-variadic-macro-arguments\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n         _Pragma( \"clang diagnostic ignored \\\"-Wunused-template\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \\\n        _Pragma( \"clang diagnostic ignored \\\"-Wcomma\\\"\" )\n\n#    define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS \\\n        _Pragma( \"clang diagnostic ignored \\\"-Wshadow\\\"\" )\n\n#endif // __clang__\n\n\n////////////////////////////////////////////////////////////////////////////////\n// We know some environments not to support full POSIX signals\n#if defined( CATCH_PLATFORM_WINDOWS ) ||                                       \\\n    defined( CATCH_PLATFORM_PLAYSTATION ) ||                                   \\\n    defined( __CYGWIN__ ) ||                                                   \\\n    defined( __QNX__ ) ||                                                      \\\n    defined( __EMSCRIPTEN__ ) ||                                               \\\n    defined( __DJGPP__ ) ||                                                    \\\n    defined( __OS400__ )\n#    define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS\n#else\n#    define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Assume that some platforms do not support getenv.\n#if defined( CATCH_PLATFORM_WINDOWS_UWP ) ||                                   \\\n    defined( CATCH_PLATFORM_PLAYSTATION ) ||                                   \\\n    defined( _GAMING_XBOX )\n#    define CATCH_INTERNAL_CONFIG_NO_GETENV\n#else\n#    define CATCH_INTERNAL_CONFIG_GETENV\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Android somehow still does not support std::to_string\n#if defined(__ANDROID__)\n#    define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Not all Windows environments support SEH properly\n#if defined(__MINGW32__)\n#    define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// PS4\n#if defined(__ORBIS__)\n#    define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n// Cygwin\n#ifdef __CYGWIN__\n\n// Required for some versions of Cygwin to declare gettimeofday\n// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin\n#   define _BSD_SOURCE\n// some versions of cygwin (most) do not support std::to_string. Use the libstd check.\n// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813\n# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \\\n           && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF))\n\n#    define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING\n\n# endif\n#endif // __CYGWIN__\n\n////////////////////////////////////////////////////////////////////////////////\n// Visual C++\n#if defined(_MSC_VER)\n\n// We want to defer to nvcc-specific warning suppression if we are compiled\n// with nvcc masquerading for MSVC.\n#    if !defined( __CUDACC__ )\n#        define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n            __pragma( warning( push ) )\n#        define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n            __pragma( warning( pop ) )\n#    endif\n\n// Universal Windows platform does not support SEH\n// Or console colours (or console at all...)\n#  if defined(CATCH_PLATFORM_WINDOWS_UWP)\n#    define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32\n#  else\n#    define CATCH_INTERNAL_CONFIG_WINDOWS_SEH\n#  endif\n\n// MSVC traditional preprocessor needs some workaround for __VA_ARGS__\n// _MSVC_TRADITIONAL == 0 means new conformant preprocessor\n// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor\n#  if !defined(__clang__) // Handle Clang masquerading for msvc\n#    if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL)\n#      define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#    endif // MSVC_TRADITIONAL\n#  endif // __clang__\n\n#endif // _MSC_VER\n\n#if defined(_REENTRANT) || defined(_MSC_VER)\n// Enable async processing, as -pthread is specified or no additional linking is required\n# define CATCH_INTERNAL_CONFIG_USE_ASYNC\n#endif // _MSC_VER\n\n////////////////////////////////////////////////////////////////////////////////\n// Check if we are compiled with -fno-exceptions or equivalent\n#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND)\n#  define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED\n#endif\n\n\n////////////////////////////////////////////////////////////////////////////////\n// Embarcadero C++Build\n#if defined(__BORLANDC__)\n    #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN\n#endif\n\n////////////////////////////////////////////////////////////////////////////////\n\n// RTX is a special version of Windows that is real time.\n// This means that it is detected as Windows, but does not provide\n// the same set of capabilities as real Windows does.\n#if defined(UNDER_RTSS) || defined(RTX64_BUILD)\n    #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH\n    #define CATCH_INTERNAL_CONFIG_NO_ASYNC\n    #define CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32\n#endif\n\n#if !defined(_GLIBCXX_USE_C99_MATH_TR1)\n#define CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER\n#endif\n\n// Various stdlib support checks that require __has_include\n#if defined(__has_include)\n  // Check if string_view is available and usable\n  #if __has_include(<string_view>) && defined(CATCH_CPP17_OR_GREATER)\n  #    define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW\n  #endif\n\n  // Check if optional is available and usable\n  #  if __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)\n  #    define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL\n  #  endif // __has_include(<optional>) && defined(CATCH_CPP17_OR_GREATER)\n\n  // Check if byte is available and usable\n  #  if __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)\n  #    include <cstddef>\n  #    if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0)\n  #      define CATCH_INTERNAL_CONFIG_CPP17_BYTE\n  #    endif\n  #  endif // __has_include(<cstddef>) && defined(CATCH_CPP17_OR_GREATER)\n\n  // Check if variant is available and usable\n  #  if __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)\n  #    if defined(__clang__) && (__clang_major__ < 8)\n         // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852\n         // fix should be in clang 8, workaround in libstdc++ 8.2\n  #      include <ciso646>\n  #      if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)\n  #        define CATCH_CONFIG_NO_CPP17_VARIANT\n  #      else\n  #        define CATCH_INTERNAL_CONFIG_CPP17_VARIANT\n  #      endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9)\n  #    else\n  #      define CATCH_INTERNAL_CONFIG_CPP17_VARIANT\n  #    endif // defined(__clang__) && (__clang_major__ < 8)\n  #  endif // __has_include(<variant>) && defined(CATCH_CPP17_OR_GREATER)\n#endif // defined(__has_include)\n\n\n#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH)\n#   define CATCH_CONFIG_WINDOWS_SEH\n#endif\n// This is set by default, because we assume that unix compilers are posix-signal-compatible by default.\n#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS)\n#   define CATCH_CONFIG_POSIX_SIGNALS\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_GETENV) && !defined(CATCH_INTERNAL_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_NO_GETENV) && !defined(CATCH_CONFIG_GETENV)\n#   define CATCH_CONFIG_GETENV\n#endif\n\n#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING)\n#    define CATCH_CONFIG_CPP11_TO_STRING\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_NO_CPP17_OPTIONAL) && !defined(CATCH_CONFIG_CPP17_OPTIONAL)\n#  define CATCH_CONFIG_CPP17_OPTIONAL\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW)\n#  define CATCH_CONFIG_CPP17_STRING_VIEW\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT)\n#  define CATCH_CONFIG_CPP17_VARIANT\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_BYTE) && !defined(CATCH_CONFIG_NO_CPP17_BYTE) && !defined(CATCH_CONFIG_CPP17_BYTE)\n#  define CATCH_CONFIG_CPP17_BYTE\n#endif\n\n\n#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT)\n#  define CATCH_INTERNAL_CONFIG_NEW_CAPTURE\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE)\n#  define CATCH_CONFIG_NEW_CAPTURE\n#endif\n\n#if !defined( CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED ) && \\\n    !defined( CATCH_CONFIG_DISABLE_EXCEPTIONS ) &&          \\\n    !defined( CATCH_CONFIG_NO_DISABLE_EXCEPTIONS )\n#  define CATCH_CONFIG_DISABLE_EXCEPTIONS\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN)\n#  define CATCH_CONFIG_POLYFILL_ISNAN\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_USE_ASYNC)  && !defined(CATCH_INTERNAL_CONFIG_NO_ASYNC) && !defined(CATCH_CONFIG_NO_USE_ASYNC) && !defined(CATCH_CONFIG_USE_ASYNC)\n#  define CATCH_CONFIG_USE_ASYNC\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_NO_GLOBAL_NEXTAFTER) && !defined(CATCH_CONFIG_GLOBAL_NEXTAFTER)\n#  define CATCH_CONFIG_GLOBAL_NEXTAFTER\n#endif\n\n\n// Even if we do not think the compiler has that warning, we still have\n// to provide a macro that can be used by the code.\n#if !defined(CATCH_INTERNAL_START_WARNINGS_SUPPRESSION)\n#   define CATCH_INTERNAL_START_WARNINGS_SUPPRESSION\n#endif\n#if !defined(CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION)\n#   define CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT)\n#   define CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS\n#endif\n#if !defined(CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS)\n#   define CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS\n#endif\n#if !defined( CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS )\n#    define CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS\n#endif\n#if !defined( CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS )\n#    define CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS\n#endif\n#if !defined( CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS )\n#    define CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS\n#endif\n\n\n// The goal of this macro is to avoid evaluation of the arguments, but\n// still have the compiler warn on problems inside...\n#if !defined(CATCH_INTERNAL_IGNORE_BUT_WARN)\n#   define CATCH_INTERNAL_IGNORE_BUT_WARN(...)\n#endif\n\n#if defined(__APPLE__) && defined(__apple_build_version__) && (__clang_major__ < 10)\n#   undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS\n#elif defined(__clang__) && (__clang_major__ < 5)\n#   undef CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS\n#endif\n\n\n#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n#define CATCH_TRY if ((true))\n#define CATCH_CATCH_ALL if ((false))\n#define CATCH_CATCH_ANON(type) if ((false))\n#else\n#define CATCH_TRY try\n#define CATCH_CATCH_ALL catch (...)\n#define CATCH_CATCH_ANON(type) catch (type)\n#endif\n\n#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR)\n#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#endif\n\n#if defined( CATCH_PLATFORM_WINDOWS ) &&       \\\n    !defined( CATCH_CONFIG_COLOUR_WIN32 ) && \\\n    !defined( CATCH_CONFIG_NO_COLOUR_WIN32 ) && \\\n    !defined( CATCH_INTERNAL_CONFIG_NO_COLOUR_WIN32 )\n#    define CATCH_CONFIG_COLOUR_WIN32\n#endif\n\n#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \\\n    !defined( CATCH_CONFIG_STATIC )\n#    ifdef Catch2_EXPORTS\n#        define CATCH_EXPORT //__declspec( dllexport ) // not needed\n#    else\n#        define CATCH_EXPORT __declspec( dllimport )\n#    endif\n#else\n#    define CATCH_EXPORT\n#endif\n\n#endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED\n\n\n#ifndef CATCH_CONTEXT_HPP_INCLUDED\n#define CATCH_CONTEXT_HPP_INCLUDED\n\n\nnamespace Catch {\n\n    class IResultCapture;\n    class IConfig;\n\n    class Context {\n        IConfig const* m_config = nullptr;\n        IResultCapture* m_resultCapture = nullptr;\n\n        CATCH_EXPORT static Context* currentContext;\n        friend Context& getCurrentMutableContext();\n        friend Context const& getCurrentContext();\n        static void createContext();\n        friend void cleanUpContext();\n\n    public:\n        constexpr IResultCapture* getResultCapture() const {\n            return m_resultCapture;\n        }\n        constexpr IConfig const* getConfig() const { return m_config; }\n        constexpr void setResultCapture( IResultCapture* resultCapture ) {\n            m_resultCapture = resultCapture;\n        }\n        constexpr void setConfig( IConfig const* config ) { m_config = config; }\n\n    };\n\n    Context& getCurrentMutableContext();\n\n    inline Context const& getCurrentContext() {\n        // We duplicate the logic from `getCurrentMutableContext` here,\n        // to avoid paying the call overhead in debug mode.\n        if ( !Context::currentContext ) { Context::createContext(); }\n        // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn)\n        return *Context::currentContext;\n    }\n\n    void cleanUpContext();\n\n    class SimplePcg32;\n    SimplePcg32& sharedRng();\n}\n\n#endif // CATCH_CONTEXT_HPP_INCLUDED\n\n\n#ifndef CATCH_MOVE_AND_FORWARD_HPP_INCLUDED\n#define CATCH_MOVE_AND_FORWARD_HPP_INCLUDED\n\n#include <type_traits>\n\n//! Replacement for std::move with better compile time performance\n#define CATCH_MOVE(...) static_cast<std::remove_reference_t<decltype(__VA_ARGS__)>&&>(__VA_ARGS__)\n\n//! Replacement for std::forward with better compile time performance\n#define CATCH_FORWARD(...) static_cast<decltype(__VA_ARGS__)&&>(__VA_ARGS__)\n\n#endif // CATCH_MOVE_AND_FORWARD_HPP_INCLUDED\n\n\n#ifndef CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED\n#define CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED\n\nnamespace Catch {\n\n    //! Used to signal that an assertion macro failed\n    struct TestFailureException{};\n    //! Used to signal that the remainder of a test should be skipped\n    struct TestSkipException {};\n\n    /**\n     * Outlines throwing of `TestFailureException` into a single TU\n     *\n     * Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers.\n     */\n    [[noreturn]] void throw_test_failure_exception();\n\n    /**\n     * Outlines throwing of `TestSkipException` into a single TU\n     *\n     * Also handles `CATCH_CONFIG_DISABLE_EXCEPTIONS` for callers.\n     */\n    [[noreturn]] void throw_test_skip_exception();\n\n} // namespace Catch\n\n#endif // CATCH_TEST_FAILURE_EXCEPTION_HPP_INCLUDED\n\n\n#ifndef CATCH_UNIQUE_NAME_HPP_INCLUDED\n#define CATCH_UNIQUE_NAME_HPP_INCLUDED\n\n\n\n\n/** \\file\n * Wrapper for the CONFIG configuration option\n *\n * When generating internal unique names, there are two options. Either\n * we mix in the current line number, or mix in an incrementing number.\n * We prefer the latter, using `__COUNTER__`, but users might want to\n * use the former.\n */\n\n#ifndef CATCH_CONFIG_COUNTER_HPP_INCLUDED\n#define CATCH_CONFIG_COUNTER_HPP_INCLUDED\n\n\n#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L )\n    #define CATCH_INTERNAL_CONFIG_COUNTER\n#endif\n\n#if defined( CATCH_INTERNAL_CONFIG_COUNTER ) && \\\n    !defined( CATCH_CONFIG_NO_COUNTER ) && \\\n    !defined( CATCH_CONFIG_COUNTER )\n#    define CATCH_CONFIG_COUNTER\n#endif\n\n\n#endif // CATCH_CONFIG_COUNTER_HPP_INCLUDED\n#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line\n#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line )\n#ifdef CATCH_CONFIG_COUNTER\n#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ )\n#else\n#  define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ )\n#endif\n\n#endif // CATCH_UNIQUE_NAME_HPP_INCLUDED\n\n\n#ifndef CATCH_INTERFACES_CAPTURE_HPP_INCLUDED\n#define CATCH_INTERFACES_CAPTURE_HPP_INCLUDED\n\n#include <string>\n\n\n\n#ifndef CATCH_STRINGREF_HPP_INCLUDED\n#define CATCH_STRINGREF_HPP_INCLUDED\n\n#include <cstddef>\n#include <string>\n#include <iosfwd>\n#include <cassert>\n\n#include <cstring>\n\nnamespace Catch {\n\n    /// A non-owning string class (similar to the forthcoming std::string_view)\n    /// Note that, because a StringRef may be a substring of another string,\n    /// it may not be null terminated.\n    class StringRef {\n    public:\n        using size_type = std::size_t;\n        using const_iterator = const char*;\n\n        static constexpr size_type npos{ static_cast<size_type>( -1 ) };\n\n    private:\n        static constexpr char const* const s_empty = \"\";\n\n        char const* m_start = s_empty;\n        size_type m_size = 0;\n\n    public: // construction\n        constexpr StringRef() noexcept = default;\n\n        StringRef( char const* rawChars ) noexcept;\n\n        constexpr StringRef( char const* rawChars, size_type size ) noexcept\n        :   m_start( rawChars ),\n            m_size( size )\n        {}\n\n        StringRef( std::string const& stdString ) noexcept\n        :   m_start( stdString.c_str() ),\n            m_size( stdString.size() )\n        {}\n\n        explicit operator std::string() const {\n            return std::string(m_start, m_size);\n        }\n\n    public: // operators\n        auto operator == ( StringRef other ) const noexcept -> bool {\n            return m_size == other.m_size\n                && (std::memcmp( m_start, other.m_start, m_size ) == 0);\n        }\n        auto operator != (StringRef other) const noexcept -> bool {\n            return !(*this == other);\n        }\n\n        constexpr auto operator[] ( size_type index ) const noexcept -> char {\n            assert(index < m_size);\n            return m_start[index];\n        }\n\n        bool operator<(StringRef rhs) const noexcept;\n\n    public: // named queries\n        constexpr auto empty() const noexcept -> bool {\n            return m_size == 0;\n        }\n        constexpr auto size() const noexcept -> size_type {\n            return m_size;\n        }\n\n        // Returns a substring of [start, start + length).\n        // If start + length > size(), then the substring is [start, size()).\n        // If start > size(), then the substring is empty.\n        constexpr StringRef substr(size_type start, size_type length) const noexcept {\n            if (start < m_size) {\n                const auto shortened_size = m_size - start;\n                return StringRef(m_start + start, (shortened_size < length) ? shortened_size : length);\n            } else {\n                return StringRef();\n            }\n        }\n\n        // Returns the current start pointer. May not be null-terminated.\n        constexpr char const* data() const noexcept {\n            return m_start;\n        }\n\n        constexpr const_iterator begin() const { return m_start; }\n        constexpr const_iterator end() const { return m_start + m_size; }\n\n\n        friend std::string& operator += (std::string& lhs, StringRef rhs);\n        friend std::ostream& operator << (std::ostream& os, StringRef str);\n        friend std::string operator+(StringRef lhs, StringRef rhs);\n\n        /**\n         * Provides a three-way comparison with rhs\n         *\n         * Returns negative number if lhs < rhs, 0 if lhs == rhs, and a positive\n         * number if lhs > rhs\n         */\n        int compare( StringRef rhs ) const;\n    };\n\n\n    constexpr auto operator \"\"_sr( char const* rawChars, std::size_t size ) noexcept -> StringRef {\n        return StringRef( rawChars, size );\n    }\n} // namespace Catch\n\nconstexpr auto operator \"\"_catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef {\n    return Catch::StringRef( rawChars, size );\n}\n\n#endif // CATCH_STRINGREF_HPP_INCLUDED\n\n\n#ifndef CATCH_RESULT_TYPE_HPP_INCLUDED\n#define CATCH_RESULT_TYPE_HPP_INCLUDED\n\nnamespace Catch {\n\n    // ResultWas::OfType enum\n    struct ResultWas { enum OfType {\n        Unknown = -1,\n        Ok = 0,\n        Info = 1,\n        Warning = 2,\n        // TODO: Should explicit skip be considered \"not OK\" (cf. isOk)? I.e., should it have the failure bit?\n        ExplicitSkip = 4,\n\n        FailureBit = 0x10,\n\n        ExpressionFailed = FailureBit | 1,\n        ExplicitFailure = FailureBit | 2,\n\n        Exception = 0x100 | FailureBit,\n\n        ThrewException = Exception | 1,\n        DidntThrowException = Exception | 2,\n\n        FatalErrorCondition = 0x200 | FailureBit\n\n    }; };\n\n    constexpr bool isOk( ResultWas::OfType resultType ) {\n        return ( resultType & ResultWas::FailureBit ) == 0;\n    }\n    constexpr bool isJustInfo( int flags ) { return flags == ResultWas::Info; }\n\n\n    // ResultDisposition::Flags enum\n    struct ResultDisposition { enum Flags {\n        Normal = 0x01,\n\n        ContinueOnFailure = 0x02,   // Failures fail test, but execution continues\n        FalseTest = 0x04,           // Prefix expression with !\n        SuppressFail = 0x08         // Failures are reported but do not fail the test\n    }; };\n\n    constexpr ResultDisposition::Flags operator|( ResultDisposition::Flags lhs,\n                                        ResultDisposition::Flags rhs ) {\n        return static_cast<ResultDisposition::Flags>( static_cast<int>( lhs ) |\n                                                      static_cast<int>( rhs ) );\n    }\n\n    constexpr bool isFalseTest( int flags ) {\n        return ( flags & ResultDisposition::FalseTest ) != 0;\n    }\n    constexpr bool shouldSuppressFailure( int flags ) {\n        return ( flags & ResultDisposition::SuppressFail ) != 0;\n    }\n\n} // end namespace Catch\n\n#endif // CATCH_RESULT_TYPE_HPP_INCLUDED\n\n\n#ifndef CATCH_UNIQUE_PTR_HPP_INCLUDED\n#define CATCH_UNIQUE_PTR_HPP_INCLUDED\n\n#include <cassert>\n#include <type_traits>\n\n\nnamespace Catch {\nnamespace Detail {\n    /**\n     * A reimplementation of `std::unique_ptr` for improved compilation performance\n     *\n     * Does not support arrays nor custom deleters.\n     */\n    template <typename T>\n    class unique_ptr {\n        T* m_ptr;\n    public:\n        constexpr unique_ptr(std::nullptr_t = nullptr):\n            m_ptr{}\n        {}\n        explicit constexpr unique_ptr(T* ptr):\n            m_ptr(ptr)\n        {}\n\n        template <typename U, typename = std::enable_if_t<std::is_base_of<T, U>::value>>\n        unique_ptr(unique_ptr<U>&& from):\n            m_ptr(from.release())\n        {}\n\n        template <typename U, typename = std::enable_if_t<std::is_base_of<T, U>::value>>\n        unique_ptr& operator=(unique_ptr<U>&& from) {\n            reset(from.release());\n\n            return *this;\n        }\n\n        unique_ptr(unique_ptr const&) = delete;\n        unique_ptr& operator=(unique_ptr const&) = delete;\n\n        unique_ptr(unique_ptr&& rhs) noexcept:\n            m_ptr(rhs.m_ptr) {\n            rhs.m_ptr = nullptr;\n        }\n        unique_ptr& operator=(unique_ptr&& rhs) noexcept {\n            reset(rhs.release());\n\n            return *this;\n        }\n\n        ~unique_ptr() {\n            delete m_ptr;\n        }\n\n        T& operator*() {\n            assert(m_ptr);\n            return *m_ptr;\n        }\n        T const& operator*() const {\n            assert(m_ptr);\n            return *m_ptr;\n        }\n        T* operator->() noexcept {\n            assert(m_ptr);\n            return m_ptr;\n        }\n        T const* operator->() const noexcept {\n            assert(m_ptr);\n            return m_ptr;\n        }\n\n        T* get() { return m_ptr; }\n        T const* get() const { return m_ptr; }\n\n        void reset(T* ptr = nullptr) {\n            delete m_ptr;\n            m_ptr = ptr;\n        }\n\n        T* release() {\n            auto temp = m_ptr;\n            m_ptr = nullptr;\n            return temp;\n        }\n\n        explicit operator bool() const {\n            return m_ptr;\n        }\n\n        friend void swap(unique_ptr& lhs, unique_ptr& rhs) {\n            auto temp = lhs.m_ptr;\n            lhs.m_ptr = rhs.m_ptr;\n            rhs.m_ptr = temp;\n        }\n    };\n\n    //! Specialization to cause compile-time error for arrays\n    template <typename T>\n    class unique_ptr<T[]>;\n\n    template <typename T, typename... Args>\n    unique_ptr<T> make_unique(Args&&... args) {\n        return unique_ptr<T>(new T(CATCH_FORWARD(args)...));\n    }\n\n\n} // end namespace Detail\n} // end namespace Catch\n\n#endif // CATCH_UNIQUE_PTR_HPP_INCLUDED\n\n\n#ifndef CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED\n#define CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_CLOCK_HPP_INCLUDED\n#define CATCH_CLOCK_HPP_INCLUDED\n\n#include <chrono>\n\nnamespace Catch {\n    namespace Benchmark {\n        using IDuration = std::chrono::nanoseconds;\n        using FDuration = std::chrono::duration<double, std::nano>;\n\n        template <typename Clock>\n        using TimePoint = typename Clock::time_point;\n\n        using default_clock = std::chrono::steady_clock;\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_CLOCK_HPP_INCLUDED\n\nnamespace Catch {\n\n    // We cannot forward declare the type with default template argument\n    // multiple times, so it is split out into a separate header so that\n    // we can prevent multiple declarations in dependees\n    template <typename Duration = Benchmark::FDuration>\n    struct BenchmarkStats;\n\n} // end namespace Catch\n\n#endif // CATCH_BENCHMARK_STATS_FWD_HPP_INCLUDED\n\nnamespace Catch {\n\n    class AssertionResult;\n    struct AssertionInfo;\n    struct SectionInfo;\n    struct SectionEndInfo;\n    struct MessageInfo;\n    struct MessageBuilder;\n    struct Counts;\n    struct AssertionReaction;\n    struct SourceLineInfo;\n\n    class ITransientExpression;\n    class IGeneratorTracker;\n\n    struct BenchmarkInfo;\n\n    namespace Generators {\n        class GeneratorUntypedBase;\n        using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>;\n    }\n\n\n    class IResultCapture {\n    public:\n        virtual ~IResultCapture();\n\n        virtual void notifyAssertionStarted( AssertionInfo const& info ) = 0;\n        virtual bool sectionStarted( StringRef sectionName,\n                                     SourceLineInfo const& sectionLineInfo,\n                                     Counts& assertions ) = 0;\n        virtual void sectionEnded( SectionEndInfo&& endInfo ) = 0;\n        virtual void sectionEndedEarly( SectionEndInfo&& endInfo ) = 0;\n\n        virtual IGeneratorTracker*\n        acquireGeneratorTracker( StringRef generatorName,\n                                 SourceLineInfo const& lineInfo ) = 0;\n        virtual IGeneratorTracker*\n        createGeneratorTracker( StringRef generatorName,\n                                SourceLineInfo lineInfo,\n                                Generators::GeneratorBasePtr&& generator ) = 0;\n\n        virtual void benchmarkPreparing( StringRef name ) = 0;\n        virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0;\n        virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0;\n        virtual void benchmarkFailed( StringRef error ) = 0;\n\n        virtual void pushScopedMessage( MessageInfo const& message ) = 0;\n        virtual void popScopedMessage( MessageInfo const& message ) = 0;\n\n        virtual void emplaceUnscopedMessage( MessageBuilder&& builder ) = 0;\n\n        virtual void handleFatalErrorCondition( StringRef message ) = 0;\n\n        virtual void handleExpr\n                (   AssertionInfo const& info,\n                    ITransientExpression const& expr,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleMessage\n                (   AssertionInfo const& info,\n                    ResultWas::OfType resultType,\n                    std::string&& message,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleUnexpectedExceptionNotThrown\n                (   AssertionInfo const& info,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleUnexpectedInflightException\n                (   AssertionInfo const& info,\n                    std::string&& message,\n                    AssertionReaction& reaction ) = 0;\n        virtual void handleIncomplete\n                (   AssertionInfo const& info ) = 0;\n        virtual void handleNonExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    AssertionReaction &reaction ) = 0;\n\n\n\n        virtual bool lastAssertionPassed() = 0;\n        virtual void assertionPassed() = 0;\n\n        // Deprecated, do not use:\n        virtual std::string getCurrentTestName() const = 0;\n        virtual const AssertionResult* getLastResult() const = 0;\n        virtual void exceptionEarlyReported() = 0;\n    };\n\n    IResultCapture& getResultCapture();\n}\n\n#endif // CATCH_INTERFACES_CAPTURE_HPP_INCLUDED\n\n\n#ifndef CATCH_INTERFACES_CONFIG_HPP_INCLUDED\n#define CATCH_INTERFACES_CONFIG_HPP_INCLUDED\n\n\n\n#ifndef CATCH_NONCOPYABLE_HPP_INCLUDED\n#define CATCH_NONCOPYABLE_HPP_INCLUDED\n\nnamespace Catch {\n    namespace Detail {\n\n        //! Deriving classes become noncopyable and nonmovable\n        class NonCopyable {\n            NonCopyable( NonCopyable const& ) = delete;\n            NonCopyable( NonCopyable&& ) = delete;\n            NonCopyable& operator=( NonCopyable const& ) = delete;\n            NonCopyable& operator=( NonCopyable&& ) = delete;\n\n        protected:\n            NonCopyable() noexcept = default;\n        };\n\n    } // namespace Detail\n} // namespace Catch\n\n#endif // CATCH_NONCOPYABLE_HPP_INCLUDED\n\n#include <chrono>\n#include <iosfwd>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    enum class Verbosity {\n        Quiet = 0,\n        Normal,\n        High\n    };\n\n    struct WarnAbout { enum What {\n        Nothing = 0x00,\n        //! A test case or leaf section did not run any assertions\n        NoAssertions = 0x01,\n        //! A command line test spec matched no test cases\n        UnmatchedTestSpec = 0x02,\n    }; };\n\n    enum class ShowDurations {\n        DefaultForReporter,\n        Always,\n        Never\n    };\n    enum class TestRunOrder {\n        Declared,\n        LexicographicallySorted,\n        Randomized\n    };\n    enum class ColourMode : std::uint8_t {\n        //! Let Catch2 pick implementation based on platform detection\n        PlatformDefault,\n        //! Use ANSI colour code escapes\n        ANSI,\n        //! Use Win32 console colour API\n        Win32,\n        //! Don't use any colour\n        None\n    };\n    struct WaitForKeypress { enum When {\n        Never,\n        BeforeStart = 1,\n        BeforeExit = 2,\n        BeforeStartAndExit = BeforeStart | BeforeExit\n    }; };\n\n    class TestSpec;\n    class IStream;\n\n    class IConfig : public Detail::NonCopyable {\n    public:\n        virtual ~IConfig();\n\n        virtual bool allowThrows() const = 0;\n        virtual StringRef name() const = 0;\n        virtual bool includeSuccessfulResults() const = 0;\n        virtual bool shouldDebugBreak() const = 0;\n        virtual bool warnAboutMissingAssertions() const = 0;\n        virtual bool warnAboutUnmatchedTestSpecs() const = 0;\n        virtual bool zeroTestsCountAsSuccess() const = 0;\n        virtual int abortAfter() const = 0;\n        virtual bool showInvisibles() const = 0;\n        virtual ShowDurations showDurations() const = 0;\n        virtual double minDuration() const = 0;\n        virtual TestSpec const& testSpec() const = 0;\n        virtual bool hasTestFilters() const = 0;\n        virtual std::vector<std::string> const& getTestsOrTags() const = 0;\n        virtual TestRunOrder runOrder() const = 0;\n        virtual uint32_t rngSeed() const = 0;\n        virtual unsigned int shardCount() const = 0;\n        virtual unsigned int shardIndex() const = 0;\n        virtual ColourMode defaultColourMode() const = 0;\n        virtual std::vector<std::string> const& getSectionsToRun() const = 0;\n        virtual Verbosity verbosity() const = 0;\n\n        virtual bool skipBenchmarks() const = 0;\n        virtual bool benchmarkNoAnalysis() const = 0;\n        virtual unsigned int benchmarkSamples() const = 0;\n        virtual double benchmarkConfidenceInterval() const = 0;\n        virtual unsigned int benchmarkResamples() const = 0;\n        virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0;\n    };\n}\n\n#endif // CATCH_INTERFACES_CONFIG_HPP_INCLUDED\n\n\n#ifndef CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED\n#define CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\n\n    class TestCaseHandle;\n    struct TestCaseInfo;\n    class ITestCaseRegistry;\n    class IExceptionTranslatorRegistry;\n    class IExceptionTranslator;\n    class ReporterRegistry;\n    class IReporterFactory;\n    class ITagAliasRegistry;\n    class ITestInvoker;\n    class IMutableEnumValuesRegistry;\n    struct SourceLineInfo;\n\n    class StartupExceptionRegistry;\n    class EventListenerFactory;\n\n    using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;\n\n    class IRegistryHub {\n    public:\n        virtual ~IRegistryHub(); // = default\n\n        virtual ReporterRegistry const& getReporterRegistry() const = 0;\n        virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0;\n        virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0;\n        virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0;\n\n\n        virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0;\n    };\n\n    class IMutableRegistryHub {\n    public:\n        virtual ~IMutableRegistryHub(); // = default\n        virtual void registerReporter( std::string const& name, IReporterFactoryPtr factory ) = 0;\n        virtual void registerListener( Detail::unique_ptr<EventListenerFactory> factory ) = 0;\n        virtual void registerTest(Detail::unique_ptr<TestCaseInfo>&& testInfo, Detail::unique_ptr<ITestInvoker>&& invoker) = 0;\n        virtual void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator ) = 0;\n        virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;\n        virtual void registerStartupException() noexcept = 0;\n        virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0;\n    };\n\n    IRegistryHub const& getRegistryHub();\n    IMutableRegistryHub& getMutableRegistryHub();\n    void cleanUp();\n    std::string translateActiveException();\n\n}\n\n#endif // CATCH_INTERFACES_REGISTRY_HUB_HPP_INCLUDED\n\n\n#ifndef CATCH_BENCHMARK_STATS_HPP_INCLUDED\n#define CATCH_BENCHMARK_STATS_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_ESTIMATE_HPP_INCLUDED\n#define CATCH_ESTIMATE_HPP_INCLUDED\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Type>\n        struct Estimate {\n            Type point;\n            Type lower_bound;\n            Type upper_bound;\n            double confidence_interval;\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_ESTIMATE_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED\n#define CATCH_OUTLIER_CLASSIFICATION_HPP_INCLUDED\n\nnamespace Catch {\n    namespace Benchmark {\n        struct OutlierClassification {\n            int samples_seen = 0;\n            int low_severe = 0;     // more than 3 times IQR below Q1\n            int low_mild = 0;       // 1.5 to 3 times IQR below Q1\n            int high_mild = 0;      // 1.5 to 3 times IQR above Q3\n            int high_severe = 0;    // more than 3 times IQR above Q3\n\n            constexpr int total() const {\n                return low_severe + low_mild + high_mild + high_severe;\n            }\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_OUTLIERS_CLASSIFICATION_HPP_INCLUDED\n// The fwd decl & default specialization needs to be seen by VS2017 before\n// BenchmarkStats itself, or VS2017 will report compilation error.\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    struct BenchmarkInfo {\n        std::string name;\n        double estimatedDuration;\n        int iterations;\n        unsigned int samples;\n        unsigned int resamples;\n        double clockResolution;\n        double clockCost;\n    };\n\n    // We need to keep template parameter for backwards compatibility,\n    // but we also do not want to use the template paraneter.\n    template <class Dummy>\n    struct BenchmarkStats {\n        BenchmarkInfo info;\n\n        std::vector<Benchmark::FDuration> samples;\n        Benchmark::Estimate<Benchmark::FDuration> mean;\n        Benchmark::Estimate<Benchmark::FDuration> standardDeviation;\n        Benchmark::OutlierClassification outliers;\n        double outlierVariance;\n    };\n\n\n} // end namespace Catch\n\n#endif // CATCH_BENCHMARK_STATS_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_ENVIRONMENT_HPP_INCLUDED\n#define CATCH_ENVIRONMENT_HPP_INCLUDED\n\n\nnamespace Catch {\n    namespace Benchmark {\n        struct EnvironmentEstimate {\n            FDuration mean;\n            OutlierClassification outliers;\n        };\n        struct Environment {\n            EnvironmentEstimate clock_resolution;\n            EnvironmentEstimate clock_cost;\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_ENVIRONMENT_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_EXECUTION_PLAN_HPP_INCLUDED\n#define CATCH_EXECUTION_PLAN_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED\n#define CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_CHRONOMETER_HPP_INCLUDED\n#define CATCH_CHRONOMETER_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_OPTIMIZER_HPP_INCLUDED\n#define CATCH_OPTIMIZER_HPP_INCLUDED\n\n#if defined(_MSC_VER) || defined(__IAR_SYSTEMS_ICC__)\n#   include <atomic> // atomic_thread_fence\n#endif\n\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n#if defined(__GNUC__) || defined(__clang__)\n        template <typename T>\n        inline void keep_memory(T* p) {\n            asm volatile(\"\" : : \"g\"(p) : \"memory\");\n        }\n        inline void keep_memory() {\n            asm volatile(\"\" : : : \"memory\");\n        }\n\n        namespace Detail {\n            inline void optimizer_barrier() { keep_memory(); }\n        } // namespace Detail\n#elif defined(_MSC_VER) || defined(__IAR_SYSTEMS_ICC__)\n\n#if defined(_MSVC_VER)\n#pragma optimize(\"\", off)\n#elif defined(__IAR_SYSTEMS_ICC__)\n// For IAR the pragma only affects the following function\n#pragma optimize=disable\n#endif\n        template <typename T>\n        inline void keep_memory(T* p) {\n            // thanks @milleniumbug\n            *reinterpret_cast<char volatile*>(p) = *reinterpret_cast<char const volatile*>(p);\n        }\n        // TODO equivalent keep_memory()\n#if defined(_MSVC_VER)\n#pragma optimize(\"\", on)\n#endif\n\n        namespace Detail {\n            inline void optimizer_barrier() {\n                std::atomic_thread_fence(std::memory_order_seq_cst);\n            }\n        } // namespace Detail\n\n#endif\n\n        template <typename T>\n        inline void deoptimize_value(T&& x) {\n            keep_memory(&x);\n        }\n\n        template <typename Fn, typename... Args>\n        inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t<!std::is_same<void, decltype(fn(args...))>::value> {\n            deoptimize_value(CATCH_FORWARD(fn) (CATCH_FORWARD(args)...));\n        }\n\n        template <typename Fn, typename... Args>\n        inline auto invoke_deoptimized(Fn&& fn, Args&&... args) -> std::enable_if_t<std::is_same<void, decltype(fn(args...))>::value> {\n            CATCH_FORWARD((fn)) (CATCH_FORWARD(args)...);\n        }\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_OPTIMIZER_HPP_INCLUDED\n\n\n#ifndef CATCH_META_HPP_INCLUDED\n#define CATCH_META_HPP_INCLUDED\n\n#include <type_traits>\n\nnamespace Catch {\n    template <typename>\n    struct true_given : std::true_type {};\n\n    struct is_callable_tester {\n        template <typename Fun, typename... Args>\n        static true_given<decltype(std::declval<Fun>()(std::declval<Args>()...))> test(int);\n        template <typename...>\n        static std::false_type test(...);\n    };\n\n    template <typename T>\n    struct is_callable;\n\n    template <typename Fun, typename... Args>\n    struct is_callable<Fun(Args...)> : decltype(is_callable_tester::test<Fun, Args...>(0)) {};\n\n\n#if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703\n    // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is\n    // replaced with std::invoke_result here.\n    template <typename Func, typename... U>\n    using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::invoke_result_t<Func, U...>>>;\n#else\n    template <typename Func, typename... U>\n    using FunctionReturnType = std::remove_reference_t<std::remove_cv_t<std::result_of_t<Func(U...)>>>;\n#endif\n\n} // namespace Catch\n\nnamespace mpl_{\n    struct na;\n}\n\n#endif // CATCH_META_HPP_INCLUDED\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            struct ChronometerConcept {\n                virtual void start() = 0;\n                virtual void finish() = 0;\n                virtual ~ChronometerConcept(); // = default;\n\n                ChronometerConcept() = default;\n                ChronometerConcept(ChronometerConcept const&) = default;\n                ChronometerConcept& operator=(ChronometerConcept const&) = default;\n            };\n            template <typename Clock>\n            struct ChronometerModel final : public ChronometerConcept {\n                void start() override { started = Clock::now(); }\n                void finish() override { finished = Clock::now(); }\n\n                IDuration elapsed() const {\n                    return std::chrono::duration_cast<std::chrono::nanoseconds>(\n                        finished - started );\n                }\n\n                TimePoint<Clock> started;\n                TimePoint<Clock> finished;\n            };\n        } // namespace Detail\n\n        struct Chronometer {\n        public:\n            template <typename Fun>\n            void measure(Fun&& fun) { measure(CATCH_FORWARD(fun), is_callable<Fun(int)>()); }\n\n            int runs() const { return repeats; }\n\n            Chronometer(Detail::ChronometerConcept& meter, int repeats_)\n                : impl(&meter)\n                , repeats(repeats_) {}\n\n        private:\n            template <typename Fun>\n            void measure(Fun&& fun, std::false_type) {\n                measure([&fun](int) { return fun(); }, std::true_type());\n            }\n\n            template <typename Fun>\n            void measure(Fun&& fun, std::true_type) {\n                Detail::optimizer_barrier();\n                impl->start();\n                for (int i = 0; i < repeats; ++i) invoke_deoptimized(fun, i);\n                impl->finish();\n                Detail::optimizer_barrier();\n            }\n\n            Detail::ChronometerConcept* impl;\n            int repeats;\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_CHRONOMETER_HPP_INCLUDED\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename T, typename U>\n            struct is_related\n                : std::is_same<std::decay_t<T>, std::decay_t<U>> {};\n\n            /// We need to reinvent std::function because every piece of code that might add overhead\n            /// in a measurement context needs to have consistent performance characteristics so that we\n            /// can account for it in the measurement.\n            /// Implementations of std::function with optimizations that aren't always applicable, like\n            /// small buffer optimizations, are not uncommon.\n            /// This is effectively an implementation of std::function without any such optimizations;\n            /// it may be slow, but it is consistently slow.\n            struct BenchmarkFunction {\n            private:\n                struct callable {\n                    virtual void call(Chronometer meter) const = 0;\n                    virtual ~callable(); // = default;\n\n                    callable() = default;\n                    callable(callable&&) = default;\n                    callable& operator=(callable&&) = default;\n                };\n                template <typename Fun>\n                struct model : public callable {\n                    model(Fun&& fun_) : fun(CATCH_MOVE(fun_)) {}\n                    model(Fun const& fun_) : fun(fun_) {}\n\n                    void call(Chronometer meter) const override {\n                        call(meter, is_callable<Fun(Chronometer)>());\n                    }\n                    void call(Chronometer meter, std::true_type) const {\n                        fun(meter);\n                    }\n                    void call(Chronometer meter, std::false_type) const {\n                        meter.measure(fun);\n                    }\n\n                    Fun fun;\n                };\n\n            public:\n                BenchmarkFunction();\n\n                template <typename Fun,\n                    std::enable_if_t<!is_related<Fun, BenchmarkFunction>::value, int> = 0>\n                    BenchmarkFunction(Fun&& fun)\n                    : f(new model<std::decay_t<Fun>>(CATCH_FORWARD(fun))) {}\n\n                BenchmarkFunction( BenchmarkFunction&& that ) noexcept:\n                    f( CATCH_MOVE( that.f ) ) {}\n\n                BenchmarkFunction&\n                operator=( BenchmarkFunction&& that ) noexcept {\n                    f = CATCH_MOVE( that.f );\n                    return *this;\n                }\n\n                void operator()(Chronometer meter) const { f->call(meter); }\n\n            private:\n                Catch::Detail::unique_ptr<callable> f;\n            };\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_BENCHMARK_FUNCTION_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_REPEAT_HPP_INCLUDED\n#define CATCH_REPEAT_HPP_INCLUDED\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Fun>\n            struct repeater {\n                void operator()(int k) const {\n                    for (int i = 0; i < k; ++i) {\n                        fun();\n                    }\n                }\n                Fun fun;\n            };\n            template <typename Fun>\n            repeater<std::decay_t<Fun>> repeat(Fun&& fun) {\n                return { CATCH_FORWARD(fun) };\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_REPEAT_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED\n#define CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_MEASURE_HPP_INCLUDED\n#define CATCH_MEASURE_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_COMPLETE_INVOKE_HPP_INCLUDED\n#define CATCH_COMPLETE_INVOKE_HPP_INCLUDED\n\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename T>\n            struct CompleteType { using type = T; };\n            template <>\n            struct CompleteType<void> { struct type {}; };\n\n            template <typename T>\n            using CompleteType_t = typename CompleteType<T>::type;\n\n            template <typename Result>\n            struct CompleteInvoker {\n                template <typename Fun, typename... Args>\n                static Result invoke(Fun&& fun, Args&&... args) {\n                    return CATCH_FORWARD(fun)(CATCH_FORWARD(args)...);\n                }\n            };\n            template <>\n            struct CompleteInvoker<void> {\n                template <typename Fun, typename... Args>\n                static CompleteType_t<void> invoke(Fun&& fun, Args&&... args) {\n                    CATCH_FORWARD(fun)(CATCH_FORWARD(args)...);\n                    return {};\n                }\n            };\n\n            // invoke and not return void :(\n            template <typename Fun, typename... Args>\n            CompleteType_t<FunctionReturnType<Fun, Args...>> complete_invoke(Fun&& fun, Args&&... args) {\n                return CompleteInvoker<FunctionReturnType<Fun, Args...>>::invoke(CATCH_FORWARD(fun), CATCH_FORWARD(args)...);\n            }\n\n        } // namespace Detail\n\n        template <typename Fun>\n        Detail::CompleteType_t<FunctionReturnType<Fun>> user_code(Fun&& fun) {\n            return Detail::complete_invoke(CATCH_FORWARD(fun));\n        }\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_COMPLETE_INVOKE_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_TIMING_HPP_INCLUDED\n#define CATCH_TIMING_HPP_INCLUDED\n\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        template <typename Result>\n        struct Timing {\n            IDuration elapsed;\n            Result result;\n            int iterations;\n        };\n        template <typename Func, typename... Args>\n        using TimingOf = Timing<Detail::CompleteType_t<FunctionReturnType<Func, Args...>>>;\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_TIMING_HPP_INCLUDED\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Clock, typename Fun, typename... Args>\n            TimingOf<Fun, Args...> measure(Fun&& fun, Args&&... args) {\n                auto start = Clock::now();\n                auto&& r = Detail::complete_invoke(CATCH_FORWARD(fun), CATCH_FORWARD(args)...);\n                auto end = Clock::now();\n                auto delta = end - start;\n                return { delta, CATCH_FORWARD(r), 1 };\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_MEASURE_HPP_INCLUDED\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Clock, typename Fun>\n            TimingOf<Fun, int> measure_one(Fun&& fun, int iters, std::false_type) {\n                return Detail::measure<Clock>(fun, iters);\n            }\n            template <typename Clock, typename Fun>\n            TimingOf<Fun, Chronometer> measure_one(Fun&& fun, int iters, std::true_type) {\n                Detail::ChronometerModel<Clock> meter;\n                auto&& result = Detail::complete_invoke(fun, Chronometer(meter, iters));\n\n                return { meter.elapsed(), CATCH_MOVE(result), iters };\n            }\n\n            template <typename Clock, typename Fun>\n            using run_for_at_least_argument_t = std::conditional_t<is_callable<Fun(Chronometer)>::value, Chronometer, int>;\n\n\n            [[noreturn]]\n            void throw_optimized_away_error();\n\n            template <typename Clock, typename Fun>\n            TimingOf<Fun, run_for_at_least_argument_t<Clock, Fun>>\n                run_for_at_least(IDuration how_long,\n                                 const int initial_iterations,\n                                 Fun&& fun) {\n                auto iters = initial_iterations;\n                while (iters < (1 << 30)) {\n                    auto&& Timing = measure_one<Clock>(fun, iters, is_callable<Fun(Chronometer)>());\n\n                    if (Timing.elapsed >= how_long) {\n                        return { Timing.elapsed, CATCH_MOVE(Timing.result), iters };\n                    }\n                    iters *= 2;\n                }\n                throw_optimized_away_error();\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_RUN_FOR_AT_LEAST_HPP_INCLUDED\n\n#include <vector>\n\nnamespace Catch {\n    namespace Benchmark {\n        struct ExecutionPlan {\n            int iterations_per_sample;\n            FDuration estimated_duration;\n            Detail::BenchmarkFunction benchmark;\n            FDuration warmup_time;\n            int warmup_iterations;\n\n            template <typename Clock>\n            std::vector<FDuration> run(const IConfig &cfg, Environment env) const {\n                // warmup a bit\n                Detail::run_for_at_least<Clock>(\n                    std::chrono::duration_cast<IDuration>( warmup_time ),\n                    warmup_iterations,\n                    Detail::repeat( []() { return Clock::now(); } )\n                );\n\n                std::vector<FDuration> times;\n                const auto num_samples = cfg.benchmarkSamples();\n                times.reserve( num_samples );\n                for ( size_t i = 0; i < num_samples; ++i ) {\n                    Detail::ChronometerModel<Clock> model;\n                    this->benchmark( Chronometer( model, iterations_per_sample ) );\n                    auto sample_time = model.elapsed() - env.clock_cost.mean;\n                    if ( sample_time < FDuration::zero() ) {\n                        sample_time = FDuration::zero();\n                    }\n                    times.push_back(sample_time / iterations_per_sample);\n                }\n                return times;\n            }\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_EXECUTION_PLAN_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_ESTIMATE_CLOCK_HPP_INCLUDED\n#define CATCH_ESTIMATE_CLOCK_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_STATS_HPP_INCLUDED\n#define CATCH_STATS_HPP_INCLUDED\n\n\n#include <vector>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            using sample = std::vector<double>;\n\n            double weighted_average_quantile( int k,\n                                              int q,\n                                              double* first,\n                                              double* last );\n\n            OutlierClassification\n            classify_outliers( double const* first, double const* last );\n\n            double mean( double const* first, double const* last );\n\n            double normal_cdf( double x );\n\n            double erfc_inv(double x);\n\n            double normal_quantile(double p);\n\n            Estimate<double>\n            bootstrap( double confidence_level,\n                       double* first,\n                       double* last,\n                       sample const& resample,\n                       double ( *estimator )( double const*, double const* ) );\n\n            struct bootstrap_analysis {\n                Estimate<double> mean;\n                Estimate<double> standard_deviation;\n                double outlier_variance;\n            };\n\n            bootstrap_analysis analyse_samples(double confidence_level,\n                                               unsigned int n_resamples,\n                                               double* first,\n                                               double* last);\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_STATS_HPP_INCLUDED\n\n#include <algorithm>\n#include <vector>\n#include <cmath>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename Clock>\n            std::vector<double> resolution(int k) {\n                const size_t points = static_cast<size_t>( k + 1 );\n                // To avoid overhead from the branch inside vector::push_back,\n                // we allocate them all and then overwrite.\n                std::vector<TimePoint<Clock>> times(points);\n                for ( auto& time : times ) {\n                    time = Clock::now();\n                }\n\n                std::vector<double> deltas;\n                deltas.reserve(static_cast<size_t>(k));\n                for ( size_t idx = 1; idx < points; ++idx ) {\n                    deltas.push_back( static_cast<double>(\n                        ( times[idx] - times[idx - 1] ).count() ) );\n                }\n\n                return deltas;\n            }\n\n            constexpr auto warmup_iterations = 10000;\n            constexpr auto warmup_time = std::chrono::milliseconds(100);\n            constexpr auto minimum_ticks = 1000;\n            constexpr auto warmup_seed = 10000;\n            constexpr auto clock_resolution_estimation_time = std::chrono::milliseconds(500);\n            constexpr auto clock_cost_estimation_time_limit = std::chrono::seconds(1);\n            constexpr auto clock_cost_estimation_tick_limit = 100000;\n            constexpr auto clock_cost_estimation_time = std::chrono::milliseconds(10);\n            constexpr auto clock_cost_estimation_iterations = 10000;\n\n            template <typename Clock>\n            int warmup() {\n                return run_for_at_least<Clock>(warmup_time, warmup_seed, &resolution<Clock>)\n                    .iterations;\n            }\n            template <typename Clock>\n            EnvironmentEstimate estimate_clock_resolution(int iterations) {\n                auto r = run_for_at_least<Clock>(clock_resolution_estimation_time, iterations, &resolution<Clock>)\n                    .result;\n                return {\n                    FDuration(mean(r.data(), r.data() + r.size())),\n                    classify_outliers(r.data(), r.data() + r.size()),\n                };\n            }\n            template <typename Clock>\n            EnvironmentEstimate estimate_clock_cost(FDuration resolution) {\n                auto time_limit = (std::min)(\n                    resolution * clock_cost_estimation_tick_limit,\n                    FDuration(clock_cost_estimation_time_limit));\n                auto time_clock = [](int k) {\n                    return Detail::measure<Clock>([k] {\n                        for (int i = 0; i < k; ++i) {\n                            volatile auto ignored = Clock::now();\n                            (void)ignored;\n                        }\n                    }).elapsed;\n                };\n                time_clock(1);\n                int iters = clock_cost_estimation_iterations;\n                auto&& r = run_for_at_least<Clock>(clock_cost_estimation_time, iters, time_clock);\n                std::vector<double> times;\n                int nsamples = static_cast<int>(std::ceil(time_limit / r.elapsed));\n                times.reserve(static_cast<size_t>(nsamples));\n                for ( int s = 0; s < nsamples; ++s ) {\n                    times.push_back( static_cast<double>(\n                        ( time_clock( r.iterations ) / r.iterations )\n                            .count() ) );\n                }\n                return {\n                    FDuration(mean(times.data(), times.data() + times.size())),\n                    classify_outliers(times.data(), times.data() + times.size()),\n                };\n            }\n\n            template <typename Clock>\n            Environment measure_environment() {\n#if defined(__clang__)\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wexit-time-destructors\"\n#endif\n                static Catch::Detail::unique_ptr<Environment> env;\n#if defined(__clang__)\n#    pragma clang diagnostic pop\n#endif\n                if (env) {\n                    return *env;\n                }\n\n                auto iters = Detail::warmup<Clock>();\n                auto resolution = Detail::estimate_clock_resolution<Clock>(iters);\n                auto cost = Detail::estimate_clock_cost<Clock>(resolution.mean);\n\n                env = Catch::Detail::make_unique<Environment>( Environment{resolution, cost} );\n                return *env;\n            }\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_ESTIMATE_CLOCK_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_ANALYSE_HPP_INCLUDED\n#define CATCH_ANALYSE_HPP_INCLUDED\n\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED\n#define CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED\n\n\n#include <vector>\n\nnamespace Catch {\n    namespace Benchmark {\n        struct SampleAnalysis {\n            std::vector<FDuration> samples;\n            Estimate<FDuration> mean;\n            Estimate<FDuration> standard_deviation;\n            OutlierClassification outliers;\n            double outlier_variance;\n        };\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_SAMPLE_ANALYSIS_HPP_INCLUDED\n\n\nnamespace Catch {\n    class IConfig;\n\n    namespace Benchmark {\n        namespace Detail {\n            SampleAnalysis analyse(const IConfig &cfg, FDuration* first, FDuration* last);\n        } // namespace Detail\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_ANALYSE_HPP_INCLUDED\n\n#include <algorithm>\n#include <chrono>\n#include <exception>\n#include <string>\n#include <cmath>\n\nnamespace Catch {\n    namespace Benchmark {\n        struct Benchmark {\n            Benchmark(std::string&& benchmarkName)\n                : name(CATCH_MOVE(benchmarkName)) {}\n\n            template <class FUN>\n            Benchmark(std::string&& benchmarkName , FUN &&func)\n                : fun(CATCH_MOVE(func)), name(CATCH_MOVE(benchmarkName)) {}\n\n            template <typename Clock>\n            ExecutionPlan prepare(const IConfig &cfg, Environment env) {\n                auto min_time = env.clock_resolution.mean * Detail::minimum_ticks;\n                auto run_time = std::max(min_time, std::chrono::duration_cast<decltype(min_time)>(cfg.benchmarkWarmupTime()));\n                auto&& test = Detail::run_for_at_least<Clock>(std::chrono::duration_cast<IDuration>(run_time), 1, fun);\n                int new_iters = static_cast<int>(std::ceil(min_time * test.iterations / test.elapsed));\n                return { new_iters, test.elapsed / test.iterations * new_iters * cfg.benchmarkSamples(), CATCH_MOVE(fun), std::chrono::duration_cast<FDuration>(cfg.benchmarkWarmupTime()), Detail::warmup_iterations };\n            }\n\n            template <typename Clock = default_clock>\n            void run() {\n                static_assert( Clock::is_steady,\n                               \"Benchmarking clock should be steady\" );\n                auto const* cfg = getCurrentContext().getConfig();\n\n                auto env = Detail::measure_environment<Clock>();\n\n                getResultCapture().benchmarkPreparing(name);\n                CATCH_TRY{\n                    auto plan = user_code([&] {\n                        return prepare<Clock>(*cfg, env);\n                    });\n\n                    BenchmarkInfo info {\n                        CATCH_MOVE(name),\n                        plan.estimated_duration.count(),\n                        plan.iterations_per_sample,\n                        cfg->benchmarkSamples(),\n                        cfg->benchmarkResamples(),\n                        env.clock_resolution.mean.count(),\n                        env.clock_cost.mean.count()\n                    };\n\n                    getResultCapture().benchmarkStarting(info);\n\n                    auto samples = user_code([&] {\n                        return plan.template run<Clock>(*cfg, env);\n                    });\n\n                    auto analysis = Detail::analyse(*cfg, samples.data(), samples.data() + samples.size());\n                    BenchmarkStats<> stats{ CATCH_MOVE(info), CATCH_MOVE(analysis.samples), analysis.mean, analysis.standard_deviation, analysis.outliers, analysis.outlier_variance };\n                    getResultCapture().benchmarkEnded(stats);\n                } CATCH_CATCH_ANON (TestFailureException const&) {\n                    getResultCapture().benchmarkFailed(\"Benchmark failed due to failed assertion\"_sr);\n                } CATCH_CATCH_ALL{\n                    getResultCapture().benchmarkFailed(translateActiveException());\n                    // We let the exception go further up so that the\n                    // test case is marked as failed.\n                    std::rethrow_exception(std::current_exception());\n                }\n            }\n\n            // sets lambda to be used in fun *and* executes benchmark!\n            template <typename Fun, std::enable_if_t<!Detail::is_related<Fun, Benchmark>::value, int> = 0>\n                Benchmark & operator=(Fun func) {\n                auto const* cfg = getCurrentContext().getConfig();\n                if (!cfg->skipBenchmarks()) {\n                    fun = Detail::BenchmarkFunction(func);\n                    run();\n                }\n                return *this;\n            }\n\n            explicit operator bool() {\n                return true;\n            }\n\n        private:\n            Detail::BenchmarkFunction fun;\n            std::string name;\n        };\n    }\n} // namespace Catch\n\n#define INTERNAL_CATCH_GET_1_ARG(arg1, arg2, ...) arg1\n#define INTERNAL_CATCH_GET_2_ARG(arg1, arg2, ...) arg2\n\n#define INTERNAL_CATCH_BENCHMARK(BenchmarkName, name, benchmarkIndex)\\\n    if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \\\n        BenchmarkName = [&](int benchmarkIndex)\n\n#define INTERNAL_CATCH_BENCHMARK_ADVANCED(BenchmarkName, name)\\\n    if( Catch::Benchmark::Benchmark BenchmarkName{name} ) \\\n        BenchmarkName = [&]\n\n#if defined(CATCH_CONFIG_PREFIX_ALL)\n\n#define CATCH_BENCHMARK(...) \\\n    INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))\n#define CATCH_BENCHMARK_ADVANCED(name) \\\n    INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), name)\n\n#else\n\n#define BENCHMARK(...) \\\n    INTERNAL_CATCH_BENCHMARK(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), INTERNAL_CATCH_GET_1_ARG(__VA_ARGS__,,), INTERNAL_CATCH_GET_2_ARG(__VA_ARGS__,,))\n#define BENCHMARK_ADVANCED(name) \\\n    INTERNAL_CATCH_BENCHMARK_ADVANCED(INTERNAL_CATCH_UNIQUE_NAME(CATCH2_INTERNAL_BENCHMARK_), name)\n\n#endif\n\n#endif // CATCH_BENCHMARK_HPP_INCLUDED\n\n\n// Adapted from donated nonius code.\n\n#ifndef CATCH_CONSTRUCTOR_HPP_INCLUDED\n#define CATCH_CONSTRUCTOR_HPP_INCLUDED\n\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Benchmark {\n        namespace Detail {\n            template <typename T, bool Destruct>\n            struct ObjectStorage\n            {\n                ObjectStorage() = default;\n\n                ObjectStorage(const ObjectStorage& other)\n                {\n                    new(&data) T(other.stored_object());\n                }\n\n                ObjectStorage(ObjectStorage&& other)\n                {\n                    new(data) T(CATCH_MOVE(other.stored_object()));\n                }\n\n                ~ObjectStorage() { destruct_on_exit<T>(); }\n\n                template <typename... Args>\n                void construct(Args&&... args)\n                {\n                    new (data) T(CATCH_FORWARD(args)...);\n                }\n\n                template <bool AllowManualDestruction = !Destruct>\n                std::enable_if_t<AllowManualDestruction> destruct()\n                {\n                    stored_object().~T();\n                }\n\n            private:\n                // If this is a constructor benchmark, destruct the underlying object\n                template <typename U>\n                void destruct_on_exit(std::enable_if_t<Destruct, U>* = nullptr) { destruct<true>(); }\n                // Otherwise, don't\n                template <typename U>\n                void destruct_on_exit(std::enable_if_t<!Destruct, U>* = nullptr) { }\n\n#if defined( __GNUC__ ) && __GNUC__ <= 6\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wstrict-aliasing\"\n#endif\n                T& stored_object() { return *reinterpret_cast<T*>( data ); }\n\n                T const& stored_object() const {\n                    return *reinterpret_cast<T const*>( data );\n                }\n#if defined( __GNUC__ ) && __GNUC__ <= 6\n#    pragma GCC diagnostic pop\n#endif\n\n                alignas( T ) unsigned char data[sizeof( T )]{};\n            };\n        } // namespace Detail\n\n        template <typename T>\n        using storage_for = Detail::ObjectStorage<T, true>;\n\n        template <typename T>\n        using destructable_object = Detail::ObjectStorage<T, false>;\n    } // namespace Benchmark\n} // namespace Catch\n\n#endif // CATCH_CONSTRUCTOR_HPP_INCLUDED\n\n#endif // CATCH_BENCHMARK_ALL_HPP_INCLUDED\n\n\n#ifndef CATCH_APPROX_HPP_INCLUDED\n#define CATCH_APPROX_HPP_INCLUDED\n\n\n\n#ifndef CATCH_TOSTRING_HPP_INCLUDED\n#define CATCH_TOSTRING_HPP_INCLUDED\n\n\n#include <vector>\n#include <cstddef>\n#include <type_traits>\n#include <string>\n\n\n\n\n/** \\file\n * Wrapper for the WCHAR configuration option\n *\n * We want to support platforms that do not provide `wchar_t`, so we\n * sometimes have to disable providing wchar_t overloads through Catch2,\n * e.g. the StringMaker specialization for `std::wstring`.\n */\n\n#ifndef CATCH_CONFIG_WCHAR_HPP_INCLUDED\n#define CATCH_CONFIG_WCHAR_HPP_INCLUDED\n\n\n// We assume that WCHAR should be enabled by default, and only disabled\n// for a shortlist (so far only DJGPP) of compilers.\n\n#if defined(__DJGPP__)\n#  define CATCH_INTERNAL_CONFIG_NO_WCHAR\n#endif // __DJGPP__\n\n#if !defined( CATCH_INTERNAL_CONFIG_NO_WCHAR ) && \\\n    !defined( CATCH_CONFIG_NO_WCHAR ) && \\\n    !defined( CATCH_CONFIG_WCHAR )\n#    define CATCH_CONFIG_WCHAR\n#endif\n\n#endif // CATCH_CONFIG_WCHAR_HPP_INCLUDED\n\n\n#ifndef CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED\n#define CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED\n\n\n#include <iosfwd>\n#include <cstddef>\n#include <ostream>\n#include <string>\n\nnamespace Catch {\n\n    class ReusableStringStream : Detail::NonCopyable {\n        std::size_t m_index;\n        std::ostream* m_oss;\n    public:\n        ReusableStringStream();\n        ~ReusableStringStream();\n\n        //! Returns the serialized state\n        std::string str() const;\n        //! Sets internal state to `str`\n        void str(std::string const& str);\n\n#if defined(__GNUC__) && !defined(__clang__)\n#pragma GCC diagnostic push\n// Old versions of GCC do not understand -Wnonnull-compare\n#pragma GCC diagnostic ignored \"-Wpragmas\"\n// Streaming a function pointer triggers Waddress and Wnonnull-compare\n// on GCC, because it implicitly converts it to bool and then decides\n// that the check it uses (a? true : false) is tautological and cannot\n// be null...\n#pragma GCC diagnostic ignored \"-Waddress\"\n#pragma GCC diagnostic ignored \"-Wnonnull-compare\"\n#endif\n\n        template<typename T>\n        auto operator << ( T const& value ) -> ReusableStringStream& {\n            *m_oss << value;\n            return *this;\n        }\n\n#if defined(__GNUC__) && !defined(__clang__)\n#pragma GCC diagnostic pop\n#endif\n        auto get() -> std::ostream& { return *m_oss; }\n    };\n}\n\n#endif // CATCH_REUSABLE_STRING_STREAM_HPP_INCLUDED\n\n\n#ifndef CATCH_VOID_TYPE_HPP_INCLUDED\n#define CATCH_VOID_TYPE_HPP_INCLUDED\n\n\nnamespace Catch {\n    namespace Detail {\n\n        template <typename...>\n        struct make_void { using type = void; };\n\n        template <typename... Ts>\n        using void_t = typename make_void<Ts...>::type;\n\n    } // namespace Detail\n} // namespace Catch\n\n\n#endif // CATCH_VOID_TYPE_HPP_INCLUDED\n\n\n#ifndef CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED\n#define CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED\n\n\n#include <vector>\n\nnamespace Catch {\n\n    namespace Detail {\n        struct EnumInfo {\n            StringRef m_name;\n            std::vector<std::pair<int, StringRef>> m_values;\n\n            ~EnumInfo();\n\n            StringRef lookup( int value ) const;\n        };\n    } // namespace Detail\n\n    class IMutableEnumValuesRegistry {\n    public:\n        virtual ~IMutableEnumValuesRegistry(); // = default;\n\n        virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector<int> const& values ) = 0;\n\n        template<typename E>\n        Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list<E> values ) {\n            static_assert(sizeof(int) >= sizeof(E), \"Cannot serialize enum to int\");\n            std::vector<int> intValues;\n            intValues.reserve( values.size() );\n            for( auto enumValue : values )\n                intValues.push_back( static_cast<int>( enumValue ) );\n            return registerEnum( enumName, allEnums, intValues );\n        }\n    };\n\n} // Catch\n\n#endif // CATCH_INTERFACES_ENUM_VALUES_REGISTRY_HPP_INCLUDED\n\n#ifdef CATCH_CONFIG_CPP17_STRING_VIEW\n#include <string_view>\n#endif\n\n#ifdef _MSC_VER\n#pragma warning(push)\n#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless\n#endif\n\n// We need a dummy global operator<< so we can bring it into Catch namespace later\nstruct Catch_global_namespace_dummy{};\nstd::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy);\n\nnamespace Catch {\n    // Bring in global namespace operator<< for ADL lookup in\n    // `IsStreamInsertable` below.\n    using ::operator<<;\n\n    namespace Detail {\n\n        inline std::size_t catch_strnlen(const char *str, std::size_t n) {\n            auto ret = std::char_traits<char>::find(str, n, '\\0');\n            if (ret != nullptr) {\n                return static_cast<std::size_t>(ret - str);\n            }\n            return n;\n        }\n\n        constexpr StringRef unprintableString = \"{?}\"_sr;\n\n        //! Encases `string in quotes, and optionally escapes invisibles\n        std::string convertIntoString( StringRef string, bool escapeInvisibles );\n\n        //! Encases `string` in quotes, and escapes invisibles if user requested\n        //! it via CLI\n        std::string convertIntoString( StringRef string );\n\n        std::string rawMemoryToString( const void *object, std::size_t size );\n\n        template<typename T>\n        std::string rawMemoryToString( const T& object ) {\n          return rawMemoryToString( &object, sizeof(object) );\n        }\n\n        template<typename T>\n        class IsStreamInsertable {\n            template<typename Stream, typename U>\n            static auto test(int)\n                -> decltype(std::declval<Stream&>() << std::declval<U>(), std::true_type());\n\n            template<typename, typename>\n            static auto test(...)->std::false_type;\n\n        public:\n            static const bool value = decltype(test<std::ostream, const T&>(0))::value;\n        };\n\n        template<typename E>\n        std::string convertUnknownEnumToString( E e );\n\n        template<typename T>\n        std::enable_if_t<\n            !std::is_enum<T>::value && !std::is_base_of<std::exception, T>::value,\n        std::string> convertUnstreamable( T const& ) {\n            return std::string(Detail::unprintableString);\n        }\n        template<typename T>\n        std::enable_if_t<\n            !std::is_enum<T>::value && std::is_base_of<std::exception, T>::value,\n         std::string> convertUnstreamable(T const& ex) {\n            return ex.what();\n        }\n\n\n        template<typename T>\n        std::enable_if_t<\n            std::is_enum<T>::value,\n        std::string> convertUnstreamable( T const& value ) {\n            return convertUnknownEnumToString( value );\n        }\n\n#if defined(_MANAGED)\n        //! Convert a CLR string to a utf8 std::string\n        template<typename T>\n        std::string clrReferenceToString( T^ ref ) {\n            if (ref == nullptr)\n                return std::string(\"null\");\n            auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString());\n            cli::pin_ptr<System::Byte> p = &bytes[0];\n            return std::string(reinterpret_cast<char const *>(p), bytes->Length);\n        }\n#endif\n\n    } // namespace Detail\n\n\n    template <typename T, typename = void>\n    struct StringMaker {\n        template <typename Fake = T>\n        static\n        std::enable_if_t<::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>\n            convert(const Fake& value) {\n                ReusableStringStream rss;\n                // NB: call using the function-like syntax to avoid ambiguity with\n                // user-defined templated operator<< under clang.\n                rss.operator<<(value);\n                return rss.str();\n        }\n\n        template <typename Fake = T>\n        static\n        std::enable_if_t<!::Catch::Detail::IsStreamInsertable<Fake>::value, std::string>\n            convert( const Fake& value ) {\n#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER)\n            return Detail::convertUnstreamable(value);\n#else\n            return CATCH_CONFIG_FALLBACK_STRINGIFIER(value);\n#endif\n        }\n    };\n\n    namespace Detail {\n\n        // This function dispatches all stringification requests inside of Catch.\n        // Should be preferably called fully qualified, like ::Catch::Detail::stringify\n        template <typename T>\n        std::string stringify(const T& e) {\n            return ::Catch::StringMaker<std::remove_cv_t<std::remove_reference_t<T>>>::convert(e);\n        }\n\n        template<typename E>\n        std::string convertUnknownEnumToString( E e ) {\n            return ::Catch::Detail::stringify(static_cast<std::underlying_type_t<E>>(e));\n        }\n\n#if defined(_MANAGED)\n        template <typename T>\n        std::string stringify( T^ e ) {\n            return ::Catch::StringMaker<T^>::convert(e);\n        }\n#endif\n\n    } // namespace Detail\n\n    // Some predefined specializations\n\n    template<>\n    struct StringMaker<std::string> {\n        static std::string convert(const std::string& str);\n    };\n\n#ifdef CATCH_CONFIG_CPP17_STRING_VIEW\n    template<>\n    struct StringMaker<std::string_view> {\n        static std::string convert(std::string_view str);\n    };\n#endif\n\n    template<>\n    struct StringMaker<char const *> {\n        static std::string convert(char const * str);\n    };\n    template<>\n    struct StringMaker<char *> {\n        static std::string convert(char * str);\n    };\n\n#if defined(CATCH_CONFIG_WCHAR)\n    template<>\n    struct StringMaker<std::wstring> {\n        static std::string convert(const std::wstring& wstr);\n    };\n\n# ifdef CATCH_CONFIG_CPP17_STRING_VIEW\n    template<>\n    struct StringMaker<std::wstring_view> {\n        static std::string convert(std::wstring_view str);\n    };\n# endif\n\n    template<>\n    struct StringMaker<wchar_t const *> {\n        static std::string convert(wchar_t const * str);\n    };\n    template<>\n    struct StringMaker<wchar_t *> {\n        static std::string convert(wchar_t * str);\n    };\n#endif // CATCH_CONFIG_WCHAR\n\n    template<size_t SZ>\n    struct StringMaker<char[SZ]> {\n        static std::string convert(char const* str) {\n            return Detail::convertIntoString(\n                StringRef( str, Detail::catch_strnlen( str, SZ ) ) );\n        }\n    };\n    template<size_t SZ>\n    struct StringMaker<signed char[SZ]> {\n        static std::string convert(signed char const* str) {\n            auto reinterpreted = reinterpret_cast<char const*>(str);\n            return Detail::convertIntoString(\n                StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));\n        }\n    };\n    template<size_t SZ>\n    struct StringMaker<unsigned char[SZ]> {\n        static std::string convert(unsigned char const* str) {\n            auto reinterpreted = reinterpret_cast<char const*>(str);\n            return Detail::convertIntoString(\n                StringRef(reinterpreted, Detail::catch_strnlen(reinterpreted, SZ)));\n        }\n    };\n\n#if defined(CATCH_CONFIG_CPP17_BYTE)\n    template<>\n    struct StringMaker<std::byte> {\n        static std::string convert(std::byte value);\n    };\n#endif // defined(CATCH_CONFIG_CPP17_BYTE)\n    template<>\n    struct StringMaker<int> {\n        static std::string convert(int value);\n    };\n    template<>\n    struct StringMaker<long> {\n        static std::string convert(long value);\n    };\n    template<>\n    struct StringMaker<long long> {\n        static std::string convert(long long value);\n    };\n    template<>\n    struct StringMaker<unsigned int> {\n        static std::string convert(unsigned int value);\n    };\n    template<>\n    struct StringMaker<unsigned long> {\n        static std::string convert(unsigned long value);\n    };\n    template<>\n    struct StringMaker<unsigned long long> {\n        static std::string convert(unsigned long long value);\n    };\n\n    template<>\n    struct StringMaker<bool> {\n        static std::string convert(bool b) {\n            using namespace std::string_literals;\n            return b ? \"true\"s : \"false\"s;\n        }\n    };\n\n    template<>\n    struct StringMaker<char> {\n        static std::string convert(char c);\n    };\n    template<>\n    struct StringMaker<signed char> {\n        static std::string convert(signed char value);\n    };\n    template<>\n    struct StringMaker<unsigned char> {\n        static std::string convert(unsigned char value);\n    };\n\n    template<>\n    struct StringMaker<std::nullptr_t> {\n        static std::string convert(std::nullptr_t) {\n            using namespace std::string_literals;\n            return \"nullptr\"s;\n        }\n    };\n\n    template<>\n    struct StringMaker<float> {\n        static std::string convert(float value);\n        CATCH_EXPORT static int precision;\n    };\n\n    template<>\n    struct StringMaker<double> {\n        static std::string convert(double value);\n        CATCH_EXPORT static int precision;\n    };\n\n    template <typename T>\n    struct StringMaker<T*> {\n        template <typename U>\n        static std::string convert(U* p) {\n            if (p) {\n                return ::Catch::Detail::rawMemoryToString(p);\n            } else {\n                return \"nullptr\";\n            }\n        }\n    };\n\n    template <typename R, typename C>\n    struct StringMaker<R C::*> {\n        static std::string convert(R C::* p) {\n            if (p) {\n                return ::Catch::Detail::rawMemoryToString(p);\n            } else {\n                return \"nullptr\";\n            }\n        }\n    };\n\n#if defined(_MANAGED)\n    template <typename T>\n    struct StringMaker<T^> {\n        static std::string convert( T^ ref ) {\n            return ::Catch::Detail::clrReferenceToString(ref);\n        }\n    };\n#endif\n\n    namespace Detail {\n        template<typename InputIterator, typename Sentinel = InputIterator>\n        std::string rangeToString(InputIterator first, Sentinel last) {\n            ReusableStringStream rss;\n            rss << \"{ \";\n            if (first != last) {\n                rss << ::Catch::Detail::stringify(*first);\n                for (++first; first != last; ++first)\n                    rss << \", \" << ::Catch::Detail::stringify(*first);\n            }\n            rss << \" }\";\n            return rss.str();\n        }\n    }\n\n} // namespace Catch\n\n//////////////////////////////////////////////////////\n// Separate std-lib types stringification, so it can be selectively enabled\n// This means that we do not bring in their headers\n\n#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS)\n#  define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER\n#  define CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER\n#endif\n\n// Separate std::pair specialization\n#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER)\n#include <utility>\nnamespace Catch {\n    template<typename T1, typename T2>\n    struct StringMaker<std::pair<T1, T2> > {\n        static std::string convert(const std::pair<T1, T2>& pair) {\n            ReusableStringStream rss;\n            rss << \"{ \"\n                << ::Catch::Detail::stringify(pair.first)\n                << \", \"\n                << ::Catch::Detail::stringify(pair.second)\n                << \" }\";\n            return rss.str();\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER\n\n#if defined(CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_OPTIONAL)\n#include <optional>\nnamespace Catch {\n    template<typename T>\n    struct StringMaker<std::optional<T> > {\n        static std::string convert(const std::optional<T>& optional) {\n            if (optional.has_value()) {\n                return ::Catch::Detail::stringify(*optional);\n            } else {\n                return \"{ }\";\n            }\n        }\n    };\n    template <>\n    struct StringMaker<std::nullopt_t> {\n        static std::string convert(const std::nullopt_t&) {\n            return \"{ }\";\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_OPTIONAL_STRINGMAKER\n\n// Separate std::tuple specialization\n#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER)\n#include <tuple>\nnamespace Catch {\n    namespace Detail {\n        template<\n            typename Tuple,\n            std::size_t N = 0,\n            bool = (N < std::tuple_size<Tuple>::value)\n            >\n            struct TupleElementPrinter {\n            static void print(const Tuple& tuple, std::ostream& os) {\n                os << (N ? \", \" : \" \")\n                    << ::Catch::Detail::stringify(std::get<N>(tuple));\n                TupleElementPrinter<Tuple, N + 1>::print(tuple, os);\n            }\n        };\n\n        template<\n            typename Tuple,\n            std::size_t N\n        >\n            struct TupleElementPrinter<Tuple, N, false> {\n            static void print(const Tuple&, std::ostream&) {}\n        };\n\n    }\n\n\n    template<typename ...Types>\n    struct StringMaker<std::tuple<Types...>> {\n        static std::string convert(const std::tuple<Types...>& tuple) {\n            ReusableStringStream rss;\n            rss << '{';\n            Detail::TupleElementPrinter<std::tuple<Types...>>::print(tuple, rss.get());\n            rss << \" }\";\n            return rss.str();\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER\n\n#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT)\n#include <variant>\nnamespace Catch {\n    template<>\n    struct StringMaker<std::monostate> {\n        static std::string convert(const std::monostate&) {\n            return \"{ }\";\n        }\n    };\n\n    template<typename... Elements>\n    struct StringMaker<std::variant<Elements...>> {\n        static std::string convert(const std::variant<Elements...>& variant) {\n            if (variant.valueless_by_exception()) {\n                return \"{valueless variant}\";\n            } else {\n                return std::visit(\n                    [](const auto& value) {\n                        return ::Catch::Detail::stringify(value);\n                    },\n                    variant\n                );\n            }\n        }\n    };\n}\n#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER\n\nnamespace Catch {\n    // Import begin/ end from std here\n    using std::begin;\n    using std::end;\n\n    namespace Detail {\n        template <typename T, typename = void>\n        struct is_range_impl : std::false_type {};\n\n        template <typename T>\n        struct is_range_impl<T, void_t<decltype(begin(std::declval<T>()))>> : std::true_type {};\n    } // namespace Detail\n\n    template <typename T>\n    struct is_range : Detail::is_range_impl<T> {};\n\n#if defined(_MANAGED) // Managed types are never ranges\n    template <typename T>\n    struct is_range<T^> {\n        static const bool value = false;\n    };\n#endif\n\n    template<typename Range>\n    std::string rangeToString( Range const& range ) {\n        return ::Catch::Detail::rangeToString( begin( range ), end( range ) );\n    }\n\n    // Handle vector<bool> specially\n    template<typename Allocator>\n    std::string rangeToString( std::vector<bool, Allocator> const& v ) {\n        ReusableStringStream rss;\n        rss << \"{ \";\n        bool first = true;\n        for( bool b : v ) {\n            if( first )\n                first = false;\n            else\n                rss << \", \";\n            rss << ::Catch::Detail::stringify( b );\n        }\n        rss << \" }\";\n        return rss.str();\n    }\n\n    template<typename R>\n    struct StringMaker<R, std::enable_if_t<is_range<R>::value && !::Catch::Detail::IsStreamInsertable<R>::value>> {\n        static std::string convert( R const& range ) {\n            return rangeToString( range );\n        }\n    };\n\n    template <typename T, size_t SZ>\n    struct StringMaker<T[SZ]> {\n        static std::string convert(T const(&arr)[SZ]) {\n            return rangeToString(arr);\n        }\n    };\n\n\n} // namespace Catch\n\n// Separate std::chrono::duration specialization\n#include <ctime>\n#include <ratio>\n#include <chrono>\n\n\nnamespace Catch {\n\ntemplate <class Ratio>\nstruct ratio_string {\n    static std::string symbol() {\n        Catch::ReusableStringStream rss;\n        rss << '[' << Ratio::num << '/'\n            << Ratio::den << ']';\n        return rss.str();\n    }\n};\n\ntemplate <>\nstruct ratio_string<std::atto> {\n    static char symbol() { return 'a'; }\n};\ntemplate <>\nstruct ratio_string<std::femto> {\n    static char symbol() { return 'f'; }\n};\ntemplate <>\nstruct ratio_string<std::pico> {\n    static char symbol() { return 'p'; }\n};\ntemplate <>\nstruct ratio_string<std::nano> {\n    static char symbol() { return 'n'; }\n};\ntemplate <>\nstruct ratio_string<std::micro> {\n    static char symbol() { return 'u'; }\n};\ntemplate <>\nstruct ratio_string<std::milli> {\n    static char symbol() { return 'm'; }\n};\n\n    ////////////\n    // std::chrono::duration specializations\n    template<typename Value, typename Ratio>\n    struct StringMaker<std::chrono::duration<Value, Ratio>> {\n        static std::string convert(std::chrono::duration<Value, Ratio> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << ' ' << ratio_string<Ratio>::symbol() << 's';\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<1>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<1>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" s\";\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<60>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<60>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" m\";\n            return rss.str();\n        }\n    };\n    template<typename Value>\n    struct StringMaker<std::chrono::duration<Value, std::ratio<3600>>> {\n        static std::string convert(std::chrono::duration<Value, std::ratio<3600>> const& duration) {\n            ReusableStringStream rss;\n            rss << duration.count() << \" h\";\n            return rss.str();\n        }\n    };\n\n    ////////////\n    // std::chrono::time_point specialization\n    // Generic time_point cannot be specialized, only std::chrono::time_point<system_clock>\n    template<typename Clock, typename Duration>\n    struct StringMaker<std::chrono::time_point<Clock, Duration>> {\n        static std::string convert(std::chrono::time_point<Clock, Duration> const& time_point) {\n            return ::Catch::Detail::stringify(time_point.time_since_epoch()) + \" since epoch\";\n        }\n    };\n    // std::chrono::time_point<system_clock> specialization\n    template<typename Duration>\n    struct StringMaker<std::chrono::time_point<std::chrono::system_clock, Duration>> {\n        static std::string convert(std::chrono::time_point<std::chrono::system_clock, Duration> const& time_point) {\n            auto converted = std::chrono::system_clock::to_time_t(time_point);\n\n#ifdef _MSC_VER\n            std::tm timeInfo = {};\n            gmtime_s(&timeInfo, &converted);\n#else\n            std::tm* timeInfo = std::gmtime(&converted);\n#endif\n\n            auto const timeStampSize = sizeof(\"2017-01-16T17:06:45Z\");\n            char timeStamp[timeStampSize];\n            const char * const fmt = \"%Y-%m-%dT%H:%M:%SZ\";\n\n#ifdef _MSC_VER\n            std::strftime(timeStamp, timeStampSize, fmt, &timeInfo);\n#else\n            std::strftime(timeStamp, timeStampSize, fmt, timeInfo);\n#endif\n            return std::string(timeStamp, timeStampSize - 1);\n        }\n    };\n}\n\n\n#define INTERNAL_CATCH_REGISTER_ENUM( enumName, ... ) \\\nnamespace Catch { \\\n    template<> struct StringMaker<enumName> { \\\n        static std::string convert( enumName value ) { \\\n            static const auto& enumInfo = ::Catch::getMutableRegistryHub().getMutableEnumValuesRegistry().registerEnum( #enumName, #__VA_ARGS__, { __VA_ARGS__ } ); \\\n            return static_cast<std::string>(enumInfo.lookup( static_cast<int>( value ) )); \\\n        } \\\n    }; \\\n}\n\n#define CATCH_REGISTER_ENUM( enumName, ... ) INTERNAL_CATCH_REGISTER_ENUM( enumName, __VA_ARGS__ )\n\n#ifdef _MSC_VER\n#pragma warning(pop)\n#endif\n\n#endif // CATCH_TOSTRING_HPP_INCLUDED\n\n#include <type_traits>\n\nnamespace Catch {\n\n    class Approx {\n    private:\n        bool equalityComparisonImpl(double other) const;\n        // Sets and validates the new margin (margin >= 0)\n        void setMargin(double margin);\n        // Sets and validates the new epsilon (0 < epsilon < 1)\n        void setEpsilon(double epsilon);\n\n    public:\n        explicit Approx ( double value );\n\n        static Approx custom();\n\n        Approx operator-() const;\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        Approx operator()( T const& value ) const {\n            Approx approx( static_cast<double>(value) );\n            approx.m_epsilon = m_epsilon;\n            approx.m_margin = m_margin;\n            approx.m_scale = m_scale;\n            return approx;\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        explicit Approx( T const& value ): Approx(static_cast<double>(value))\n        {}\n\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator == ( const T& lhs, Approx const& rhs ) {\n            auto lhs_v = static_cast<double>(lhs);\n            return rhs.equalityComparisonImpl(lhs_v);\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator == ( Approx const& lhs, const T& rhs ) {\n            return operator==( rhs, lhs );\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator != ( T const& lhs, Approx const& rhs ) {\n            return !operator==( lhs, rhs );\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator != ( Approx const& lhs, T const& rhs ) {\n            return !operator==( rhs, lhs );\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator <= ( T const& lhs, Approx const& rhs ) {\n            return static_cast<double>(lhs) < rhs.m_value || lhs == rhs;\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator <= ( Approx const& lhs, T const& rhs ) {\n            return lhs.m_value < static_cast<double>(rhs) || lhs == rhs;\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator >= ( T const& lhs, Approx const& rhs ) {\n            return static_cast<double>(lhs) > rhs.m_value || lhs == rhs;\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        friend bool operator >= ( Approx const& lhs, T const& rhs ) {\n            return lhs.m_value > static_cast<double>(rhs) || lhs == rhs;\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        Approx& epsilon( T const& newEpsilon ) {\n            const auto epsilonAsDouble = static_cast<double>(newEpsilon);\n            setEpsilon(epsilonAsDouble);\n            return *this;\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        Approx& margin( T const& newMargin ) {\n            const auto marginAsDouble = static_cast<double>(newMargin);\n            setMargin(marginAsDouble);\n            return *this;\n        }\n\n        template <typename T, typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        Approx& scale( T const& newScale ) {\n            m_scale = static_cast<double>(newScale);\n            return *this;\n        }\n\n        std::string toString() const;\n\n    private:\n        double m_epsilon;\n        double m_margin;\n        double m_scale;\n        double m_value;\n    };\n\nnamespace literals {\n    Approx operator \"\"_a(long double val);\n    Approx operator \"\"_a(unsigned long long val);\n} // end namespace literals\n\ntemplate<>\nstruct StringMaker<Catch::Approx> {\n    static std::string convert(Catch::Approx const& value);\n};\n\n} // end namespace Catch\n\n#endif // CATCH_APPROX_HPP_INCLUDED\n\n\n#ifndef CATCH_ASSERTION_INFO_HPP_INCLUDED\n#define CATCH_ASSERTION_INFO_HPP_INCLUDED\n\n\n\n#ifndef CATCH_SOURCE_LINE_INFO_HPP_INCLUDED\n#define CATCH_SOURCE_LINE_INFO_HPP_INCLUDED\n\n#include <cstddef>\n#include <iosfwd>\n\nnamespace Catch {\n\n    struct SourceLineInfo {\n\n        SourceLineInfo() = delete;\n        constexpr SourceLineInfo( char const* _file, std::size_t _line ) noexcept:\n            file( _file ),\n            line( _line )\n        {}\n\n        bool operator == ( SourceLineInfo const& other ) const noexcept;\n        bool operator < ( SourceLineInfo const& other ) const noexcept;\n\n        char const* file;\n        std::size_t line;\n\n        friend std::ostream& operator << (std::ostream& os, SourceLineInfo const& info);\n    };\n}\n\n#define CATCH_INTERNAL_LINEINFO \\\n    ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )\n\n#endif // CATCH_SOURCE_LINE_INFO_HPP_INCLUDED\n\nnamespace Catch {\n\n    struct AssertionInfo {\n        // AssertionInfo() = delete;\n\n        StringRef macroName;\n        SourceLineInfo lineInfo;\n        StringRef capturedExpression;\n        ResultDisposition::Flags resultDisposition;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_ASSERTION_INFO_HPP_INCLUDED\n\n\n#ifndef CATCH_ASSERTION_RESULT_HPP_INCLUDED\n#define CATCH_ASSERTION_RESULT_HPP_INCLUDED\n\n\n\n#ifndef CATCH_LAZY_EXPR_HPP_INCLUDED\n#define CATCH_LAZY_EXPR_HPP_INCLUDED\n\n#include <iosfwd>\n\nnamespace Catch {\n\n    class ITransientExpression;\n\n    class LazyExpression {\n        friend class AssertionHandler;\n        friend struct AssertionStats;\n        friend class RunContext;\n\n        ITransientExpression const* m_transientExpression = nullptr;\n        bool m_isNegated;\n    public:\n        constexpr LazyExpression( bool isNegated ):\n            m_isNegated(isNegated)\n        {}\n        constexpr LazyExpression(LazyExpression const& other) = default;\n        LazyExpression& operator = ( LazyExpression const& ) = delete;\n\n        constexpr explicit operator bool() const {\n            return m_transientExpression != nullptr;\n        }\n\n        friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&;\n    };\n\n} // namespace Catch\n\n#endif // CATCH_LAZY_EXPR_HPP_INCLUDED\n\n#include <string>\n\nnamespace Catch {\n\n    struct AssertionResultData\n    {\n        AssertionResultData() = delete;\n\n        AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression );\n\n        std::string message;\n        mutable std::string reconstructedExpression;\n        LazyExpression lazyExpression;\n        ResultWas::OfType resultType;\n\n        std::string reconstructExpression() const;\n    };\n\n    class AssertionResult {\n    public:\n        AssertionResult() = delete;\n        AssertionResult( AssertionInfo const& info, AssertionResultData&& data );\n\n        bool isOk() const;\n        bool succeeded() const;\n        ResultWas::OfType getResultType() const;\n        bool hasExpression() const;\n        bool hasMessage() const;\n        std::string getExpression() const;\n        std::string getExpressionInMacro() const;\n        bool hasExpandedExpression() const;\n        std::string getExpandedExpression() const;\n        StringRef getMessage() const;\n        SourceLineInfo getSourceInfo() const;\n        StringRef getTestMacroName() const;\n\n    //protected:\n        AssertionInfo m_info;\n        AssertionResultData m_resultData;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_ASSERTION_RESULT_HPP_INCLUDED\n\n\n#ifndef CATCH_CASE_SENSITIVE_HPP_INCLUDED\n#define CATCH_CASE_SENSITIVE_HPP_INCLUDED\n\nnamespace Catch {\n\n    enum class CaseSensitive { Yes, No };\n\n} // namespace Catch\n\n#endif // CATCH_CASE_SENSITIVE_HPP_INCLUDED\n\n\n#ifndef CATCH_CONFIG_HPP_INCLUDED\n#define CATCH_CONFIG_HPP_INCLUDED\n\n\n\n#ifndef CATCH_TEST_SPEC_HPP_INCLUDED\n#define CATCH_TEST_SPEC_HPP_INCLUDED\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\n\n\n#ifndef CATCH_WILDCARD_PATTERN_HPP_INCLUDED\n#define CATCH_WILDCARD_PATTERN_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch\n{\n    class WildcardPattern {\n        enum WildcardPosition {\n            NoWildcard = 0,\n            WildcardAtStart = 1,\n            WildcardAtEnd = 2,\n            WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd\n        };\n\n    public:\n\n        WildcardPattern( std::string const& pattern, CaseSensitive caseSensitivity );\n        bool matches( std::string const& str ) const;\n\n    private:\n        std::string normaliseString( std::string const& str ) const;\n        CaseSensitive m_caseSensitivity;\n        WildcardPosition m_wildcard = NoWildcard;\n        std::string m_pattern;\n    };\n}\n\n#endif // CATCH_WILDCARD_PATTERN_HPP_INCLUDED\n\n#include <iosfwd>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    class IConfig;\n    struct TestCaseInfo;\n    class TestCaseHandle;\n\n    class TestSpec {\n\n        class Pattern {\n        public:\n            explicit Pattern( std::string const& name );\n            virtual ~Pattern();\n            virtual bool matches( TestCaseInfo const& testCase ) const = 0;\n            std::string const& name() const;\n        private:\n            virtual void serializeTo( std::ostream& out ) const = 0;\n            // Writes string that would be reparsed into the pattern\n            friend std::ostream& operator<<(std::ostream& out,\n                                            Pattern const& pattern) {\n                pattern.serializeTo( out );\n                return out;\n            }\n\n            std::string const m_name;\n        };\n\n        class NamePattern : public Pattern {\n        public:\n            explicit NamePattern( std::string const& name, std::string const& filterString );\n            bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            void serializeTo( std::ostream& out ) const override;\n\n            WildcardPattern m_wildcardPattern;\n        };\n\n        class TagPattern : public Pattern {\n        public:\n            explicit TagPattern( std::string const& tag, std::string const& filterString );\n            bool matches( TestCaseInfo const& testCase ) const override;\n        private:\n            void serializeTo( std::ostream& out ) const override;\n\n            std::string m_tag;\n        };\n\n        struct Filter {\n            std::vector<Detail::unique_ptr<Pattern>> m_required;\n            std::vector<Detail::unique_ptr<Pattern>> m_forbidden;\n\n            //! Serializes this filter into a string that would be parsed into\n            //! an equivalent filter\n            void serializeTo( std::ostream& out ) const;\n            friend std::ostream& operator<<(std::ostream& out, Filter const& f) {\n                f.serializeTo( out );\n                return out;\n            }\n\n            bool matches( TestCaseInfo const& testCase ) const;\n        };\n\n        static std::string extractFilterName( Filter const& filter );\n\n    public:\n        struct FilterMatch {\n            std::string name;\n            std::vector<TestCaseHandle const*> tests;\n        };\n        using Matches = std::vector<FilterMatch>;\n        using vectorStrings = std::vector<std::string>;\n\n        bool hasFilters() const;\n        bool matches( TestCaseInfo const& testCase ) const;\n        Matches matchesByFilter( std::vector<TestCaseHandle> const& testCases, IConfig const& config ) const;\n        const vectorStrings & getInvalidSpecs() const;\n\n    private:\n        std::vector<Filter> m_filters;\n        std::vector<std::string> m_invalidSpecs;\n\n        friend class TestSpecParser;\n        //! Serializes this test spec into a string that would be parsed into\n        //! equivalent test spec\n        void serializeTo( std::ostream& out ) const;\n        friend std::ostream& operator<<(std::ostream& out,\n                                        TestSpec const& spec) {\n            spec.serializeTo( out );\n            return out;\n        }\n    };\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n#endif // CATCH_TEST_SPEC_HPP_INCLUDED\n\n\n#ifndef CATCH_OPTIONAL_HPP_INCLUDED\n#define CATCH_OPTIONAL_HPP_INCLUDED\n\n\n#include <cassert>\n\nnamespace Catch {\n\n    // An optional type\n    template<typename T>\n    class Optional {\n    public:\n        Optional(): nullableValue( nullptr ) {}\n        ~Optional() { reset(); }\n\n        Optional( T const& _value ):\n            nullableValue( new ( storage ) T( _value ) ) {}\n        Optional( T&& _value ):\n            nullableValue( new ( storage ) T( CATCH_MOVE( _value ) ) ) {}\n\n        Optional& operator=( T const& _value ) {\n            reset();\n            nullableValue = new ( storage ) T( _value );\n            return *this;\n        }\n        Optional& operator=( T&& _value ) {\n            reset();\n            nullableValue = new ( storage ) T( CATCH_MOVE( _value ) );\n            return *this;\n        }\n\n        Optional( Optional const& _other ):\n            nullableValue( _other ? new ( storage ) T( *_other ) : nullptr ) {}\n        Optional( Optional&& _other ):\n            nullableValue( _other ? new ( storage ) T( CATCH_MOVE( *_other ) )\n                                  : nullptr ) {}\n\n        Optional& operator=( Optional const& _other ) {\n            if ( &_other != this ) {\n                reset();\n                if ( _other ) { nullableValue = new ( storage ) T( *_other ); }\n            }\n            return *this;\n        }\n        Optional& operator=( Optional&& _other ) {\n            if ( &_other != this ) {\n                reset();\n                if ( _other ) {\n                    nullableValue = new ( storage ) T( CATCH_MOVE( *_other ) );\n                }\n            }\n            return *this;\n        }\n\n        void reset() {\n            if ( nullableValue ) { nullableValue->~T(); }\n            nullableValue = nullptr;\n        }\n\n        T& operator*() {\n            assert(nullableValue);\n            return *nullableValue;\n        }\n        T const& operator*() const {\n            assert(nullableValue);\n            return *nullableValue;\n        }\n        T* operator->() {\n            assert(nullableValue);\n            return nullableValue;\n        }\n        const T* operator->() const {\n            assert(nullableValue);\n            return nullableValue;\n        }\n\n        T valueOr( T const& defaultValue ) const {\n            return nullableValue ? *nullableValue : defaultValue;\n        }\n\n        bool some() const { return nullableValue != nullptr; }\n        bool none() const { return nullableValue == nullptr; }\n\n        bool operator !() const { return nullableValue == nullptr; }\n        explicit operator bool() const {\n            return some();\n        }\n\n        friend bool operator==(Optional const& a, Optional const& b) {\n            if (a.none() && b.none()) {\n                return true;\n            } else if (a.some() && b.some()) {\n                return *a == *b;\n            } else {\n                return false;\n            }\n        }\n        friend bool operator!=(Optional const& a, Optional const& b) {\n            return !( a == b );\n        }\n\n    private:\n        T* nullableValue;\n        alignas(alignof(T)) char storage[sizeof(T)];\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_OPTIONAL_HPP_INCLUDED\n\n\n#ifndef CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED\n#define CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED\n\n#include <cstdint>\n\nnamespace Catch {\n\n    enum class GenerateFrom {\n        Time,\n        RandomDevice,\n        //! Currently equivalent to RandomDevice, but can change at any point\n        Default\n    };\n\n    std::uint32_t generateRandomSeed(GenerateFrom from);\n\n} // end namespace Catch\n\n#endif // CATCH_RANDOM_SEED_GENERATION_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED\n#define CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED\n\n\n#include <map>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    enum class ColourMode : std::uint8_t;\n\n    namespace Detail {\n        //! Splits the reporter spec into reporter name and kv-pair options\n        std::vector<std::string> splitReporterSpec( StringRef reporterSpec );\n\n        Optional<ColourMode> stringToColourMode( StringRef colourMode );\n    }\n\n    /**\n     * Structured reporter spec that a reporter can be created from\n     *\n     * Parsing has been validated, but semantics have not. This means e.g.\n     * that the colour mode is known to Catch2, but it might not be\n     * compiled into the binary, and the output filename might not be\n     * openable.\n     */\n    class ReporterSpec {\n        std::string m_name;\n        Optional<std::string> m_outputFileName;\n        Optional<ColourMode> m_colourMode;\n        std::map<std::string, std::string> m_customOptions;\n\n        friend bool operator==( ReporterSpec const& lhs,\n                                ReporterSpec const& rhs );\n        friend bool operator!=( ReporterSpec const& lhs,\n                                ReporterSpec const& rhs ) {\n            return !( lhs == rhs );\n        }\n\n    public:\n        ReporterSpec(\n            std::string name,\n            Optional<std::string> outputFileName,\n            Optional<ColourMode> colourMode,\n            std::map<std::string, std::string> customOptions );\n\n        std::string const& name() const { return m_name; }\n\n        Optional<std::string> const& outputFile() const {\n            return m_outputFileName;\n        }\n\n        Optional<ColourMode> const& colourMode() const { return m_colourMode; }\n\n        std::map<std::string, std::string> const& customOptions() const {\n            return m_customOptions;\n        }\n    };\n\n    /**\n     * Parses provided reporter spec string into\n     *\n     * Returns empty optional on errors, e.g.\n     *  * field that is not first and not a key+value pair\n     *  * duplicated keys in kv pair\n     *  * unknown catch reporter option\n     *  * empty key/value in an custom kv pair\n     *  * ...\n     */\n    Optional<ReporterSpec> parseReporterSpec( StringRef reporterSpec );\n\n}\n\n#endif // CATCH_REPORTER_SPEC_PARSER_HPP_INCLUDED\n\n#include <chrono>\n#include <map>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    class IStream;\n\n    /**\n     * `ReporterSpec` but with the defaults filled in.\n     *\n     * Like `ReporterSpec`, the semantics are unchecked.\n     */\n    struct ProcessedReporterSpec {\n        std::string name;\n        std::string outputFilename;\n        ColourMode colourMode;\n        std::map<std::string, std::string> customOptions;\n        friend bool operator==( ProcessedReporterSpec const& lhs,\n                                ProcessedReporterSpec const& rhs );\n        friend bool operator!=( ProcessedReporterSpec const& lhs,\n                                ProcessedReporterSpec const& rhs ) {\n            return !( lhs == rhs );\n        }\n    };\n\n    struct ConfigData {\n\n        bool listTests = false;\n        bool listTags = false;\n        bool listReporters = false;\n        bool listListeners = false;\n\n        bool showSuccessfulTests = false;\n        bool shouldDebugBreak = false;\n        bool noThrow = false;\n        bool showHelp = false;\n        bool showInvisibles = false;\n        bool filenamesAsTags = false;\n        bool libIdentify = false;\n        bool allowZeroTests = false;\n\n        int abortAfter = -1;\n        uint32_t rngSeed = generateRandomSeed(GenerateFrom::Default);\n\n        unsigned int shardCount = 1;\n        unsigned int shardIndex = 0;\n\n        bool skipBenchmarks = false;\n        bool benchmarkNoAnalysis = false;\n        unsigned int benchmarkSamples = 100;\n        double benchmarkConfidenceInterval = 0.95;\n        unsigned int benchmarkResamples = 100'000;\n        std::chrono::milliseconds::rep benchmarkWarmupTime = 100;\n\n        Verbosity verbosity = Verbosity::Normal;\n        WarnAbout::What warnings = WarnAbout::Nothing;\n        ShowDurations showDurations = ShowDurations::DefaultForReporter;\n        double minDuration = -1;\n        TestRunOrder runOrder = TestRunOrder::Declared;\n        ColourMode defaultColourMode = ColourMode::PlatformDefault;\n        WaitForKeypress::When waitForKeypress = WaitForKeypress::Never;\n\n        std::string defaultOutputFilename;\n        std::string name;\n        std::string processName;\n        std::vector<ReporterSpec> reporterSpecifications;\n\n        std::vector<std::string> testsOrTags;\n        std::vector<std::string> sectionsToRun;\n    };\n\n\n    class Config : public IConfig {\n    public:\n\n        Config() = default;\n        Config( ConfigData const& data );\n        ~Config() override; // = default in the cpp file\n\n        bool listTests() const;\n        bool listTags() const;\n        bool listReporters() const;\n        bool listListeners() const;\n\n        std::vector<ReporterSpec> const& getReporterSpecs() const;\n        std::vector<ProcessedReporterSpec> const&\n        getProcessedReporterSpecs() const;\n\n        std::vector<std::string> const& getTestsOrTags() const override;\n        std::vector<std::string> const& getSectionsToRun() const override;\n\n        TestSpec const& testSpec() const override;\n        bool hasTestFilters() const override;\n\n        bool showHelp() const;\n\n        // IConfig interface\n        bool allowThrows() const override;\n        StringRef name() const override;\n        bool includeSuccessfulResults() const override;\n        bool warnAboutMissingAssertions() const override;\n        bool warnAboutUnmatchedTestSpecs() const override;\n        bool zeroTestsCountAsSuccess() const override;\n        ShowDurations showDurations() const override;\n        double minDuration() const override;\n        TestRunOrder runOrder() const override;\n        uint32_t rngSeed() const override;\n        unsigned int shardCount() const override;\n        unsigned int shardIndex() const override;\n        ColourMode defaultColourMode() const override;\n        bool shouldDebugBreak() const override;\n        int abortAfter() const override;\n        bool showInvisibles() const override;\n        Verbosity verbosity() const override;\n        bool skipBenchmarks() const override;\n        bool benchmarkNoAnalysis() const override;\n        unsigned int benchmarkSamples() const override;\n        double benchmarkConfidenceInterval() const override;\n        unsigned int benchmarkResamples() const override;\n        std::chrono::milliseconds benchmarkWarmupTime() const override;\n\n    private:\n        // Reads Bazel env vars and applies them to the config\n        void readBazelEnvVars();\n\n        ConfigData m_data;\n        std::vector<ProcessedReporterSpec> m_processedReporterSpecs;\n        TestSpec m_testSpec;\n        bool m_hasTestFilters = false;\n    };\n} // end namespace Catch\n\n#endif // CATCH_CONFIG_HPP_INCLUDED\n\n\n#ifndef CATCH_GET_RANDOM_SEED_HPP_INCLUDED\n#define CATCH_GET_RANDOM_SEED_HPP_INCLUDED\n\n#include <cstdint>\n\nnamespace Catch {\n    //! Returns Catch2's current RNG seed.\n    std::uint32_t getSeed();\n}\n\n#endif // CATCH_GET_RANDOM_SEED_HPP_INCLUDED\n\n\n#ifndef CATCH_MESSAGE_HPP_INCLUDED\n#define CATCH_MESSAGE_HPP_INCLUDED\n\n\n\n\n/** \\file\n * Wrapper for the CATCH_CONFIG_PREFIX_MESSAGES configuration option\n *\n * CATCH_CONFIG_PREFIX_ALL can be used to avoid clashes with other macros\n * by prepending CATCH_. This may not be desirable if the only clashes are with\n * logger macros such as INFO and WARN. In this cases\n * CATCH_CONFIG_PREFIX_MESSAGES can be used to only prefix a small subset\n * of relevant macros.\n *\n */\n\n#ifndef CATCH_CONFIG_PREFIX_MESSAGES_HPP_INCLUDED\n#define CATCH_CONFIG_PREFIX_MESSAGES_HPP_INCLUDED\n\n\n#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_PREFIX_MESSAGES)\n    #define CATCH_CONFIG_PREFIX_MESSAGES\n#endif\n\n#endif // CATCH_CONFIG_PREFIX_MESSAGES_HPP_INCLUDED\n\n\n#ifndef CATCH_STREAM_END_STOP_HPP_INCLUDED\n#define CATCH_STREAM_END_STOP_HPP_INCLUDED\n\n\nnamespace Catch {\n\n    // Use this in variadic streaming macros to allow\n    //    << +StreamEndStop\n    // as well as\n    //    << stuff +StreamEndStop\n    struct StreamEndStop {\n        constexpr StringRef operator+() const { return StringRef(); }\n\n        template <typename T>\n        constexpr friend T const& operator+( T const& value, StreamEndStop ) {\n            return value;\n        }\n    };\n\n} // namespace Catch\n\n#endif // CATCH_STREAM_END_STOP_HPP_INCLUDED\n\n\n#ifndef CATCH_MESSAGE_INFO_HPP_INCLUDED\n#define CATCH_MESSAGE_INFO_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\n\n    struct MessageInfo {\n        MessageInfo(    StringRef _macroName,\n                        SourceLineInfo const& _lineInfo,\n                        ResultWas::OfType _type );\n\n        StringRef macroName;\n        std::string message;\n        SourceLineInfo lineInfo;\n        ResultWas::OfType type;\n        unsigned int sequence;\n\n        bool operator == (MessageInfo const& other) const {\n            return sequence == other.sequence;\n        }\n        bool operator < (MessageInfo const& other) const {\n            return sequence < other.sequence;\n        }\n    private:\n        static unsigned int globalCount;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_MESSAGE_INFO_HPP_INCLUDED\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    struct SourceLineInfo;\n    class IResultCapture;\n\n    struct MessageStream {\n\n        template<typename T>\n        MessageStream& operator << ( T const& value ) {\n            m_stream << value;\n            return *this;\n        }\n\n        ReusableStringStream m_stream;\n    };\n\n    struct MessageBuilder : MessageStream {\n        MessageBuilder( StringRef macroName,\n                        SourceLineInfo const& lineInfo,\n                        ResultWas::OfType type ):\n            m_info(macroName, lineInfo, type) {}\n\n        template<typename T>\n        MessageBuilder&& operator << ( T const& value ) && {\n            m_stream << value;\n            return CATCH_MOVE(*this);\n        }\n\n        MessageInfo m_info;\n    };\n\n    class ScopedMessage {\n    public:\n        explicit ScopedMessage( MessageBuilder&& builder );\n        ScopedMessage( ScopedMessage& duplicate ) = delete;\n        ScopedMessage( ScopedMessage&& old ) noexcept;\n        ~ScopedMessage();\n\n        MessageInfo m_info;\n        bool m_moved = false;\n    };\n\n    class Capturer {\n        std::vector<MessageInfo> m_messages;\n        IResultCapture& m_resultCapture;\n        size_t m_captured = 0;\n    public:\n        Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names );\n\n        Capturer(Capturer const&) = delete;\n        Capturer& operator=(Capturer const&) = delete;\n\n        ~Capturer();\n\n        void captureValue( size_t index, std::string const& value );\n\n        template<typename T>\n        void captureValues( size_t index, T const& value ) {\n            captureValue( index, Catch::Detail::stringify( value ) );\n        }\n\n        template<typename T, typename... Ts>\n        void captureValues( size_t index, T const& value, Ts const&... values ) {\n            captureValue( index, Catch::Detail::stringify(value) );\n            captureValues( index+1, values... );\n        }\n    };\n\n} // end namespace Catch\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \\\n        catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \\\n        catchAssertionHandler.complete(); \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \\\n    Catch::Capturer varName( macroName##_catch_sr,        \\\n                             CATCH_INTERNAL_LINEINFO,     \\\n                             Catch::ResultWas::Info,      \\\n                             #__VA_ARGS__##_catch_sr );   \\\n    varName.captureValues( 0, __VA_ARGS__ )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_INFO( macroName, log ) \\\n    const Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_UNSCOPED_INFO( macroName, log ) \\\n    Catch::getResultCapture().emplaceUnscopedMessage( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log )\n\n\n#if defined(CATCH_CONFIG_PREFIX_MESSAGES) && !defined(CATCH_CONFIG_DISABLE)\n\n  #define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( \"CATCH_INFO\", msg )\n  #define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( \"CATCH_UNSCOPED_INFO\", msg )\n  #define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( \"CATCH_WARN\", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )\n  #define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), \"CATCH_CAPTURE\", __VA_ARGS__ )\n\n#elif defined(CATCH_CONFIG_PREFIX_MESSAGES) && defined(CATCH_CONFIG_DISABLE)\n\n  #define CATCH_INFO( msg )          (void)(0)\n  #define CATCH_UNSCOPED_INFO( msg ) (void)(0)\n  #define CATCH_WARN( msg )          (void)(0)\n  #define CATCH_CAPTURE( ... )       (void)(0)\n\n#elif !defined(CATCH_CONFIG_PREFIX_MESSAGES) && !defined(CATCH_CONFIG_DISABLE)\n\n  #define INFO( msg ) INTERNAL_CATCH_INFO( \"INFO\", msg )\n  #define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( \"UNSCOPED_INFO\", msg )\n  #define WARN( msg ) INTERNAL_CATCH_MSG( \"WARN\", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg )\n  #define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), \"CAPTURE\", __VA_ARGS__ )\n\n#elif !defined(CATCH_CONFIG_PREFIX_MESSAGES) && defined(CATCH_CONFIG_DISABLE)\n\n  #define INFO( msg )          (void)(0)\n  #define UNSCOPED_INFO( msg ) (void)(0)\n  #define WARN( msg )          (void)(0)\n  #define CAPTURE( ... )       (void)(0)\n\n#endif // end of user facing macro declarations\n\n\n\n\n#endif // CATCH_MESSAGE_HPP_INCLUDED\n\n\n#ifndef CATCH_SECTION_INFO_HPP_INCLUDED\n#define CATCH_SECTION_INFO_HPP_INCLUDED\n\n\n\n#ifndef CATCH_TOTALS_HPP_INCLUDED\n#define CATCH_TOTALS_HPP_INCLUDED\n\n#include <cstdint>\n\nnamespace Catch {\n\n    struct Counts {\n        Counts operator - ( Counts const& other ) const;\n        Counts& operator += ( Counts const& other );\n\n        std::uint64_t total() const;\n        bool allPassed() const;\n        bool allOk() const;\n\n        std::uint64_t passed = 0;\n        std::uint64_t failed = 0;\n        std::uint64_t failedButOk = 0;\n        std::uint64_t skipped = 0;\n    };\n\n    struct Totals {\n\n        Totals operator - ( Totals const& other ) const;\n        Totals& operator += ( Totals const& other );\n\n        Totals delta( Totals const& prevTotals ) const;\n\n        Counts assertions;\n        Counts testCases;\n    };\n}\n\n#endif // CATCH_TOTALS_HPP_INCLUDED\n\n#include <string>\n\nnamespace Catch {\n\n    struct SectionInfo {\n        // The last argument is ignored, so that people can write\n        // SECTION(\"ShortName\", \"Proper description that is long\") and\n        // still use the `-c` flag comfortably.\n        SectionInfo( SourceLineInfo const& _lineInfo, std::string _name,\n                    const char* const = nullptr ):\n            name(CATCH_MOVE(_name)),\n            lineInfo(_lineInfo)\n            {}\n\n        std::string name;\n        SourceLineInfo lineInfo;\n    };\n\n    struct SectionEndInfo {\n        SectionInfo sectionInfo;\n        Counts prevAssertions;\n        double durationInSeconds;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_SECTION_INFO_HPP_INCLUDED\n\n\n#ifndef CATCH_SESSION_HPP_INCLUDED\n#define CATCH_SESSION_HPP_INCLUDED\n\n\n\n#ifndef CATCH_COMMANDLINE_HPP_INCLUDED\n#define CATCH_COMMANDLINE_HPP_INCLUDED\n\n\n\n#ifndef CATCH_CLARA_HPP_INCLUDED\n#define CATCH_CLARA_HPP_INCLUDED\n\n#if defined( __clang__ )\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wweak-vtables\"\n#    pragma clang diagnostic ignored \"-Wshadow\"\n#    pragma clang diagnostic ignored \"-Wdeprecated\"\n#endif\n\n#if defined( __GNUC__ )\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wsign-conversion\"\n#endif\n\n#ifndef CLARA_CONFIG_OPTIONAL_TYPE\n#    ifdef __has_include\n#        if __has_include( <optional>) && __cplusplus >= 201703L\n#            include <optional>\n#            define CLARA_CONFIG_OPTIONAL_TYPE std::optional\n#        endif\n#    endif\n#endif\n\n\n#include <cassert>\n#include <memory>\n#include <ostream>\n#include <sstream>\n#include <string>\n#include <type_traits>\n#include <vector>\n\nnamespace Catch {\n    namespace Clara {\n\n        class Args;\n        class Parser;\n\n        // enum of result types from a parse\n        enum class ParseResultType {\n            Matched,\n            NoMatch,\n            ShortCircuitAll,\n            ShortCircuitSame\n        };\n\n        struct accept_many_t {};\n        constexpr accept_many_t accept_many {};\n\n        namespace Detail {\n            struct fake_arg {\n                template <typename T>\n                operator T();\n            };\n\n            template <typename F, typename = void>\n            struct is_unary_function : std::false_type {};\n\n            template <typename F>\n            struct is_unary_function<\n                F,\n                Catch::Detail::void_t<decltype(\n                    std::declval<F>()( fake_arg() ) )\n                >\n            > : std::true_type {};\n\n            // Traits for extracting arg and return type of lambdas (for single\n            // argument lambdas)\n            template <typename L>\n            struct UnaryLambdaTraits\n                : UnaryLambdaTraits<decltype( &L::operator() )> {};\n\n            template <typename ClassT, typename ReturnT, typename... Args>\n            struct UnaryLambdaTraits<ReturnT ( ClassT::* )( Args... ) const> {\n                static const bool isValid = false;\n            };\n\n            template <typename ClassT, typename ReturnT, typename ArgT>\n            struct UnaryLambdaTraits<ReturnT ( ClassT::* )( ArgT ) const> {\n                static const bool isValid = true;\n                using ArgType = std::remove_const_t<std::remove_reference_t<ArgT>>;\n                using ReturnType = ReturnT;\n            };\n\n            class TokenStream;\n\n            // Wraps a token coming from a token stream. These may not directly\n            // correspond to strings as a single string may encode an option +\n            // its argument if the : or = form is used\n            enum class TokenType { Option, Argument };\n            struct Token {\n                TokenType type;\n                StringRef token;\n            };\n\n            // Abstracts iterators into args as a stream of tokens, with option\n            // arguments uniformly handled\n            class TokenStream {\n                using Iterator = std::vector<StringRef>::const_iterator;\n                Iterator it;\n                Iterator itEnd;\n                std::vector<Token> m_tokenBuffer;\n                void loadBuffer();\n\n            public:\n                explicit TokenStream( Args const& args );\n                TokenStream( Iterator it, Iterator itEnd );\n\n                explicit operator bool() const {\n                    return !m_tokenBuffer.empty() || it != itEnd;\n                }\n\n                size_t count() const {\n                    return m_tokenBuffer.size() + ( itEnd - it );\n                }\n\n                Token operator*() const {\n                    assert( !m_tokenBuffer.empty() );\n                    return m_tokenBuffer.front();\n                }\n\n                Token const* operator->() const {\n                    assert( !m_tokenBuffer.empty() );\n                    return &m_tokenBuffer.front();\n                }\n\n                TokenStream& operator++();\n            };\n\n            //! Denotes type of a parsing result\n            enum class ResultType {\n                Ok,          ///< No errors\n                LogicError,  ///< Error in user-specified arguments for\n                             ///< construction\n                RuntimeError ///< Error in parsing inputs\n            };\n\n            class ResultBase {\n            protected:\n                ResultBase( ResultType type ): m_type( type ) {}\n                virtual ~ResultBase(); // = default;\n\n\n                ResultBase(ResultBase const&) = default;\n                ResultBase& operator=(ResultBase const&) = default;\n                ResultBase(ResultBase&&) = default;\n                ResultBase& operator=(ResultBase&&) = default;\n\n                virtual void enforceOk() const = 0;\n\n                ResultType m_type;\n            };\n\n            template <typename T>\n            class ResultValueBase : public ResultBase {\n            public:\n                T const& value() const& {\n                    enforceOk();\n                    return m_value;\n                }\n                T&& value() && {\n                    enforceOk();\n                    return CATCH_MOVE( m_value );\n                }\n\n            protected:\n                ResultValueBase( ResultType type ): ResultBase( type ) {}\n\n                ResultValueBase( ResultValueBase const& other ):\n                    ResultBase( other ) {\n                    if ( m_type == ResultType::Ok )\n                        new ( &m_value ) T( other.m_value );\n                }\n                ResultValueBase( ResultValueBase&& other ):\n                    ResultBase( other ) {\n                    if ( m_type == ResultType::Ok )\n                        new ( &m_value ) T( CATCH_MOVE(other.m_value) );\n                }\n\n\n                ResultValueBase( ResultType, T const& value ):\n                    ResultBase( ResultType::Ok ) {\n                    new ( &m_value ) T( value );\n                }\n                ResultValueBase( ResultType, T&& value ):\n                    ResultBase( ResultType::Ok ) {\n                    new ( &m_value ) T( CATCH_MOVE(value) );\n                }\n\n                ResultValueBase& operator=( ResultValueBase const& other ) {\n                    if ( m_type == ResultType::Ok )\n                        m_value.~T();\n                    ResultBase::operator=( other );\n                    if ( m_type == ResultType::Ok )\n                        new ( &m_value ) T( other.m_value );\n                    return *this;\n                }\n                ResultValueBase& operator=( ResultValueBase&& other ) {\n                    if ( m_type == ResultType::Ok ) m_value.~T();\n                    ResultBase::operator=( other );\n                    if ( m_type == ResultType::Ok )\n                        new ( &m_value ) T( CATCH_MOVE(other.m_value) );\n                    return *this;\n                }\n\n\n                ~ResultValueBase() override {\n                    if ( m_type == ResultType::Ok )\n                        m_value.~T();\n                }\n\n                union {\n                    T m_value;\n                };\n            };\n\n            template <> class ResultValueBase<void> : public ResultBase {\n            protected:\n                using ResultBase::ResultBase;\n            };\n\n            template <typename T = void>\n            class BasicResult : public ResultValueBase<T> {\n            public:\n                template <typename U>\n                explicit BasicResult( BasicResult<U> const& other ):\n                    ResultValueBase<T>( other.type() ),\n                    m_errorMessage( other.errorMessage() ) {\n                    assert( type() != ResultType::Ok );\n                }\n\n                template <typename U>\n                static auto ok( U&& value ) -> BasicResult {\n                    return { ResultType::Ok, CATCH_FORWARD(value) };\n                }\n                static auto ok() -> BasicResult { return { ResultType::Ok }; }\n                static auto logicError( std::string&& message )\n                    -> BasicResult {\n                    return { ResultType::LogicError, CATCH_MOVE(message) };\n                }\n                static auto runtimeError( std::string&& message )\n                    -> BasicResult {\n                    return { ResultType::RuntimeError, CATCH_MOVE(message) };\n                }\n\n                explicit operator bool() const {\n                    return m_type == ResultType::Ok;\n                }\n                auto type() const -> ResultType { return m_type; }\n                auto errorMessage() const -> std::string const& {\n                    return m_errorMessage;\n                }\n\n            protected:\n                void enforceOk() const override {\n\n                    // Errors shouldn't reach this point, but if they do\n                    // the actual error message will be in m_errorMessage\n                    assert( m_type != ResultType::LogicError );\n                    assert( m_type != ResultType::RuntimeError );\n                    if ( m_type != ResultType::Ok )\n                        std::abort();\n                }\n\n                std::string\n                    m_errorMessage; // Only populated if resultType is an error\n\n                BasicResult( ResultType type,\n                             std::string&& message ):\n                    ResultValueBase<T>( type ), m_errorMessage( CATCH_MOVE(message) ) {\n                    assert( m_type != ResultType::Ok );\n                }\n\n                using ResultValueBase<T>::ResultValueBase;\n                using ResultBase::m_type;\n            };\n\n            class ParseState {\n            public:\n                ParseState( ParseResultType type,\n                            TokenStream remainingTokens );\n\n                ParseResultType type() const { return m_type; }\n                TokenStream const& remainingTokens() const& {\n                    return m_remainingTokens;\n                }\n                TokenStream&& remainingTokens() && {\n                    return CATCH_MOVE( m_remainingTokens );\n                }\n\n            private:\n                ParseResultType m_type;\n                TokenStream m_remainingTokens;\n            };\n\n            using Result = BasicResult<void>;\n            using ParserResult = BasicResult<ParseResultType>;\n            using InternalParseResult = BasicResult<ParseState>;\n\n            struct HelpColumns {\n                std::string left;\n                StringRef descriptions;\n            };\n\n            template <typename T>\n            ParserResult convertInto( std::string const& source, T& target ) {\n                std::stringstream ss( source );\n                ss >> target;\n                if ( ss.fail() ) {\n                    return ParserResult::runtimeError(\n                        \"Unable to convert '\" + source +\n                        \"' to destination type\" );\n                } else {\n                    return ParserResult::ok( ParseResultType::Matched );\n                }\n            }\n            ParserResult convertInto( std::string const& source,\n                                      std::string& target );\n            ParserResult convertInto( std::string const& source, bool& target );\n\n#ifdef CLARA_CONFIG_OPTIONAL_TYPE\n            template <typename T>\n            auto convertInto( std::string const& source,\n                              CLARA_CONFIG_OPTIONAL_TYPE<T>& target )\n                -> ParserResult {\n                T temp;\n                auto result = convertInto( source, temp );\n                if ( result )\n                    target = CATCH_MOVE( temp );\n                return result;\n            }\n#endif // CLARA_CONFIG_OPTIONAL_TYPE\n\n            struct BoundRef : Catch::Detail::NonCopyable {\n                virtual ~BoundRef() = default;\n                virtual bool isContainer() const;\n                virtual bool isFlag() const;\n            };\n            struct BoundValueRefBase : BoundRef {\n                virtual auto setValue( std::string const& arg )\n                    -> ParserResult = 0;\n            };\n            struct BoundFlagRefBase : BoundRef {\n                virtual auto setFlag( bool flag ) -> ParserResult = 0;\n                bool isFlag() const override;\n            };\n\n            template <typename T> struct BoundValueRef : BoundValueRefBase {\n                T& m_ref;\n\n                explicit BoundValueRef( T& ref ): m_ref( ref ) {}\n\n                ParserResult setValue( std::string const& arg ) override {\n                    return convertInto( arg, m_ref );\n                }\n            };\n\n            template <typename T>\n            struct BoundValueRef<std::vector<T>> : BoundValueRefBase {\n                std::vector<T>& m_ref;\n\n                explicit BoundValueRef( std::vector<T>& ref ): m_ref( ref ) {}\n\n                auto isContainer() const -> bool override { return true; }\n\n                auto setValue( std::string const& arg )\n                    -> ParserResult override {\n                    T temp;\n                    auto result = convertInto( arg, temp );\n                    if ( result )\n                        m_ref.push_back( temp );\n                    return result;\n                }\n            };\n\n            struct BoundFlagRef : BoundFlagRefBase {\n                bool& m_ref;\n\n                explicit BoundFlagRef( bool& ref ): m_ref( ref ) {}\n\n                ParserResult setFlag( bool flag ) override;\n            };\n\n            template <typename ReturnType> struct LambdaInvoker {\n                static_assert(\n                    std::is_same<ReturnType, ParserResult>::value,\n                    \"Lambda must return void or clara::ParserResult\" );\n\n                template <typename L, typename ArgType>\n                static auto invoke( L const& lambda, ArgType const& arg )\n                    -> ParserResult {\n                    return lambda( arg );\n                }\n            };\n\n            template <> struct LambdaInvoker<void> {\n                template <typename L, typename ArgType>\n                static auto invoke( L const& lambda, ArgType const& arg )\n                    -> ParserResult {\n                    lambda( arg );\n                    return ParserResult::ok( ParseResultType::Matched );\n                }\n            };\n\n            template <typename ArgType, typename L>\n            auto invokeLambda( L const& lambda, std::string const& arg )\n                -> ParserResult {\n                ArgType temp{};\n                auto result = convertInto( arg, temp );\n                return !result ? result\n                               : LambdaInvoker<typename UnaryLambdaTraits<\n                                     L>::ReturnType>::invoke( lambda, temp );\n            }\n\n            template <typename L> struct BoundLambda : BoundValueRefBase {\n                L m_lambda;\n\n                static_assert(\n                    UnaryLambdaTraits<L>::isValid,\n                    \"Supplied lambda must take exactly one argument\" );\n                explicit BoundLambda( L const& lambda ): m_lambda( lambda ) {}\n\n                auto setValue( std::string const& arg )\n                    -> ParserResult override {\n                    return invokeLambda<typename UnaryLambdaTraits<L>::ArgType>(\n                        m_lambda, arg );\n                }\n            };\n\n            template <typename L> struct BoundManyLambda : BoundLambda<L> {\n                explicit BoundManyLambda( L const& lambda ): BoundLambda<L>( lambda ) {}\n                bool isContainer() const override { return true; }\n            };\n\n            template <typename L> struct BoundFlagLambda : BoundFlagRefBase {\n                L m_lambda;\n\n                static_assert(\n                    UnaryLambdaTraits<L>::isValid,\n                    \"Supplied lambda must take exactly one argument\" );\n                static_assert(\n                    std::is_same<typename UnaryLambdaTraits<L>::ArgType,\n                                 bool>::value,\n                    \"flags must be boolean\" );\n\n                explicit BoundFlagLambda( L const& lambda ):\n                    m_lambda( lambda ) {}\n\n                auto setFlag( bool flag ) -> ParserResult override {\n                    return LambdaInvoker<typename UnaryLambdaTraits<\n                        L>::ReturnType>::invoke( m_lambda, flag );\n                }\n            };\n\n            enum class Optionality { Optional, Required };\n\n            class ParserBase {\n            public:\n                virtual ~ParserBase() = default;\n                virtual auto validate() const -> Result { return Result::ok(); }\n                virtual auto parse( std::string const& exeName,\n                                    TokenStream tokens ) const\n                    -> InternalParseResult = 0;\n                virtual size_t cardinality() const;\n\n                InternalParseResult parse( Args const& args ) const;\n            };\n\n            template <typename DerivedT>\n            class ComposableParserImpl : public ParserBase {\n            public:\n                template <typename T>\n                auto operator|( T const& other ) const -> Parser;\n            };\n\n            // Common code and state for Args and Opts\n            template <typename DerivedT>\n            class ParserRefImpl : public ComposableParserImpl<DerivedT> {\n            protected:\n                Optionality m_optionality = Optionality::Optional;\n                std::shared_ptr<BoundRef> m_ref;\n                StringRef m_hint;\n                StringRef m_description;\n\n                explicit ParserRefImpl( std::shared_ptr<BoundRef> const& ref ):\n                    m_ref( ref ) {}\n\n            public:\n                template <typename LambdaT>\n                ParserRefImpl( accept_many_t,\n                               LambdaT const& ref,\n                               StringRef hint ):\n                    m_ref( std::make_shared<BoundManyLambda<LambdaT>>( ref ) ),\n                    m_hint( hint ) {}\n\n                template <typename T,\n                          typename = typename std::enable_if_t<\n                              !Detail::is_unary_function<T>::value>>\n                ParserRefImpl( T& ref, StringRef hint ):\n                    m_ref( std::make_shared<BoundValueRef<T>>( ref ) ),\n                    m_hint( hint ) {}\n\n                template <typename LambdaT,\n                          typename = typename std::enable_if_t<\n                              Detail::is_unary_function<LambdaT>::value>>\n                ParserRefImpl( LambdaT const& ref, StringRef hint ):\n                    m_ref( std::make_shared<BoundLambda<LambdaT>>( ref ) ),\n                    m_hint( hint ) {}\n\n                DerivedT& operator()( StringRef description ) & {\n                    m_description = description;\n                    return static_cast<DerivedT&>( *this );\n                }\n                DerivedT&& operator()( StringRef description ) && {\n                    m_description = description;\n                    return static_cast<DerivedT&&>( *this );\n                }\n\n                auto optional() -> DerivedT& {\n                    m_optionality = Optionality::Optional;\n                    return static_cast<DerivedT&>( *this );\n                }\n\n                auto required() -> DerivedT& {\n                    m_optionality = Optionality::Required;\n                    return static_cast<DerivedT&>( *this );\n                }\n\n                auto isOptional() const -> bool {\n                    return m_optionality == Optionality::Optional;\n                }\n\n                auto cardinality() const -> size_t override {\n                    if ( m_ref->isContainer() )\n                        return 0;\n                    else\n                        return 1;\n                }\n\n                StringRef hint() const { return m_hint; }\n            };\n\n        } // namespace detail\n\n\n        // A parser for arguments\n        class Arg : public Detail::ParserRefImpl<Arg> {\n        public:\n            using ParserRefImpl::ParserRefImpl;\n            using ParserBase::parse;\n\n            Detail::InternalParseResult\n                parse(std::string const&,\n                      Detail::TokenStream tokens) const override;\n        };\n\n        // A parser for options\n        class Opt : public Detail::ParserRefImpl<Opt> {\n        protected:\n            std::vector<StringRef> m_optNames;\n\n        public:\n            template <typename LambdaT>\n            explicit Opt(LambdaT const& ref) :\n                ParserRefImpl(\n                    std::make_shared<Detail::BoundFlagLambda<LambdaT>>(ref)) {}\n\n            explicit Opt(bool& ref);\n\n            template <typename LambdaT,\n                      typename = typename std::enable_if_t<\n                          Detail::is_unary_function<LambdaT>::value>>\n            Opt( LambdaT const& ref, StringRef hint ):\n                ParserRefImpl( ref, hint ) {}\n\n            template <typename LambdaT>\n            Opt( accept_many_t, LambdaT const& ref, StringRef hint ):\n                ParserRefImpl( accept_many, ref, hint ) {}\n\n            template <typename T,\n                      typename = typename std::enable_if_t<\n                          !Detail::is_unary_function<T>::value>>\n            Opt( T& ref, StringRef hint ):\n                ParserRefImpl( ref, hint ) {}\n\n            Opt& operator[]( StringRef optName ) & {\n                m_optNames.push_back(optName);\n                return *this;\n            }\n            Opt&& operator[]( StringRef optName ) && {\n                m_optNames.push_back( optName );\n                return CATCH_MOVE(*this);\n            }\n\n            Detail::HelpColumns getHelpColumns() const;\n\n            bool isMatch(StringRef optToken) const;\n\n            using ParserBase::parse;\n\n            Detail::InternalParseResult\n                parse(std::string const&,\n                      Detail::TokenStream tokens) const override;\n\n            Detail::Result validate() const override;\n        };\n\n        // Specifies the name of the executable\n        class ExeName : public Detail::ComposableParserImpl<ExeName> {\n            std::shared_ptr<std::string> m_name;\n            std::shared_ptr<Detail::BoundValueRefBase> m_ref;\n\n        public:\n            ExeName();\n            explicit ExeName(std::string& ref);\n\n            template <typename LambdaT>\n            explicit ExeName(LambdaT const& lambda) : ExeName() {\n                m_ref = std::make_shared<Detail::BoundLambda<LambdaT>>(lambda);\n            }\n\n            // The exe name is not parsed out of the normal tokens, but is\n            // handled specially\n            Detail::InternalParseResult\n                parse(std::string const&,\n                      Detail::TokenStream tokens) const override;\n\n            std::string const& name() const { return *m_name; }\n            Detail::ParserResult set(std::string const& newName);\n        };\n\n\n        // A Combined parser\n        class Parser : Detail::ParserBase {\n            mutable ExeName m_exeName;\n            std::vector<Opt> m_options;\n            std::vector<Arg> m_args;\n\n        public:\n\n            auto operator|=(ExeName const& exeName) -> Parser& {\n                m_exeName = exeName;\n                return *this;\n            }\n\n            auto operator|=(Arg const& arg) -> Parser& {\n                m_args.push_back(arg);\n                return *this;\n            }\n\n            friend Parser& operator|=( Parser& p, Opt const& opt ) {\n                p.m_options.push_back( opt );\n                return p;\n            }\n            friend Parser& operator|=( Parser& p, Opt&& opt ) {\n                p.m_options.push_back( CATCH_MOVE(opt) );\n                return p;\n            }\n\n            Parser& operator|=(Parser const& other);\n\n            template <typename T>\n            friend Parser operator|( Parser const& p, T&& rhs ) {\n                Parser temp( p );\n                temp |= rhs;\n                return temp;\n            }\n\n            template <typename T>\n            friend Parser operator|( Parser&& p, T&& rhs ) {\n                p |= CATCH_FORWARD(rhs);\n                return CATCH_MOVE(p);\n            }\n\n            std::vector<Detail::HelpColumns> getHelpColumns() const;\n\n            void writeToStream(std::ostream& os) const;\n\n            friend auto operator<<(std::ostream& os, Parser const& parser)\n                -> std::ostream& {\n                parser.writeToStream(os);\n                return os;\n            }\n\n            Detail::Result validate() const override;\n\n            using ParserBase::parse;\n            Detail::InternalParseResult\n                parse(std::string const& exeName,\n                      Detail::TokenStream tokens) const override;\n        };\n\n        /**\n         * Wrapper over argc + argv, assumes that the inputs outlive it\n         */\n        class Args {\n            friend Detail::TokenStream;\n            StringRef m_exeName;\n            std::vector<StringRef> m_args;\n\n        public:\n            Args(int argc, char const* const* argv);\n            // Helper constructor for testing\n            Args(std::initializer_list<StringRef> args);\n\n            StringRef exeName() const { return m_exeName; }\n        };\n\n\n        // Convenience wrapper for option parser that specifies the help option\n        struct Help : Opt {\n            Help(bool& showHelpFlag);\n        };\n\n        // Result type for parser operation\n        using Detail::ParserResult;\n\n        namespace Detail {\n            template <typename DerivedT>\n            template <typename T>\n            Parser\n                ComposableParserImpl<DerivedT>::operator|(T const& other) const {\n                return Parser() | static_cast<DerivedT const&>(*this) | other;\n            }\n        }\n\n    } // namespace Clara\n} // namespace Catch\n\n#if defined( __clang__ )\n#    pragma clang diagnostic pop\n#endif\n\n#if defined( __GNUC__ )\n#    pragma GCC diagnostic pop\n#endif\n\n#endif // CATCH_CLARA_HPP_INCLUDED\n\nnamespace Catch {\n\n    struct ConfigData;\n\n    Clara::Parser makeCommandLineParser( ConfigData& config );\n\n} // end namespace Catch\n\n#endif // CATCH_COMMANDLINE_HPP_INCLUDED\n\nnamespace Catch {\n\n    class Session : Detail::NonCopyable {\n    public:\n\n        Session();\n        ~Session();\n\n        void showHelp() const;\n        void libIdentify();\n\n        int applyCommandLine( int argc, char const * const * argv );\n    #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE)\n        int applyCommandLine( int argc, wchar_t const * const * argv );\n    #endif\n\n        void useConfigData( ConfigData const& configData );\n\n        template<typename CharT>\n        int run(int argc, CharT const * const argv[]) {\n            if (m_startupExceptions)\n                return 1;\n            int returnCode = applyCommandLine(argc, argv);\n            if (returnCode == 0)\n                returnCode = run();\n            return returnCode;\n        }\n\n        int run();\n\n        Clara::Parser const& cli() const;\n        void cli( Clara::Parser const& newParser );\n        ConfigData& configData();\n        Config& config();\n    private:\n        int runInternal();\n\n        Clara::Parser m_cli;\n        ConfigData m_configData;\n        Detail::unique_ptr<Config> m_config;\n        bool m_startupExceptions = false;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_SESSION_HPP_INCLUDED\n\n\n#ifndef CATCH_TAG_ALIAS_HPP_INCLUDED\n#define CATCH_TAG_ALIAS_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\n\n    struct TagAlias {\n        TagAlias(std::string const& _tag, SourceLineInfo _lineInfo):\n            tag(_tag),\n            lineInfo(_lineInfo)\n        {}\n\n        std::string tag;\n        SourceLineInfo lineInfo;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_TAG_ALIAS_HPP_INCLUDED\n\n\n#ifndef CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED\n#define CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED\n\n\nnamespace Catch {\n\n    struct RegistrarForTagAliases {\n        RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo );\n    };\n\n} // end namespace Catch\n\n#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n    namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#endif // CATCH_TAG_ALIAS_AUTOREGISTRAR_HPP_INCLUDED\n\n\n#ifndef CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED\n#define CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED\n\n// We need this suppression to leak, because it took until GCC 10\n// for the front end to handle local suppression via _Pragma properly\n// inside templates (so `TEMPLATE_TEST_CASE` and co).\n// **THIS IS DIFFERENT FOR STANDARD TESTS, WHERE GCC 9 IS SUFFICIENT**\n#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ < 10\n#pragma GCC diagnostic ignored \"-Wparentheses\"\n#endif\n\n\n\n\n#ifndef CATCH_TEST_MACROS_HPP_INCLUDED\n#define CATCH_TEST_MACROS_HPP_INCLUDED\n\n\n\n#ifndef CATCH_TEST_MACRO_IMPL_HPP_INCLUDED\n#define CATCH_TEST_MACRO_IMPL_HPP_INCLUDED\n\n\n\n#ifndef CATCH_ASSERTION_HANDLER_HPP_INCLUDED\n#define CATCH_ASSERTION_HANDLER_HPP_INCLUDED\n\n\n\n#ifndef CATCH_DECOMPOSER_HPP_INCLUDED\n#define CATCH_DECOMPOSER_HPP_INCLUDED\n\n\n\n#ifndef CATCH_COMPARE_TRAITS_HPP_INCLUDED\n#define CATCH_COMPARE_TRAITS_HPP_INCLUDED\n\n\n#include <type_traits>\n\nnamespace Catch {\n    namespace Detail {\n\n#if defined( __GNUC__ ) && !defined( __clang__ )\n#    pragma GCC diagnostic push\n    // GCC likes to complain about comparing bool with 0, in the decltype()\n    // that defines the comparable traits below.\n#    pragma GCC diagnostic ignored \"-Wbool-compare\"\n    // \"ordered comparison of pointer with integer zero\" same as above,\n    // but it does not have a separate warning flag to suppress\n#    pragma GCC diagnostic ignored \"-Wextra\"\n    // Did you know that comparing floats with `0` directly\n    // is super-duper dangerous in unevaluated context?\n#    pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n\n#if defined( __clang__ )\n#    pragma clang diagnostic push\n    // Did you know that comparing floats with `0` directly\n    // is super-duper dangerous in unevaluated context?\n#    pragma clang diagnostic ignored \"-Wfloat-equal\"\n#endif\n\n#define CATCH_DEFINE_COMPARABLE_TRAIT( id, op )                               \\\n    template <typename, typename, typename = void>                            \\\n    struct is_##id##_comparable : std::false_type {};                         \\\n    template <typename T, typename U>                                         \\\n    struct is_##id##_comparable<                                              \\\n        T,                                                                    \\\n        U,                                                                    \\\n        void_t<decltype( std::declval<T>() op std::declval<U>() )>>           \\\n        : std::true_type {};                                                  \\\n    template <typename, typename = void>                                      \\\n    struct is_##id##_0_comparable : std::false_type {};                       \\\n    template <typename T>                                                     \\\n    struct is_##id##_0_comparable<T,                                          \\\n                                  void_t<decltype( std::declval<T>() op 0 )>> \\\n        : std::true_type {};\n\n        // We need all 6 pre-spaceship comparison ops: <, <=, >, >=, ==, !=\n        CATCH_DEFINE_COMPARABLE_TRAIT( lt, < )\n        CATCH_DEFINE_COMPARABLE_TRAIT( le, <= )\n        CATCH_DEFINE_COMPARABLE_TRAIT( gt, > )\n        CATCH_DEFINE_COMPARABLE_TRAIT( ge, >= )\n        CATCH_DEFINE_COMPARABLE_TRAIT( eq, == )\n        CATCH_DEFINE_COMPARABLE_TRAIT( ne, != )\n\n#undef CATCH_DEFINE_COMPARABLE_TRAIT\n\n#if defined( __GNUC__ ) && !defined( __clang__ )\n#    pragma GCC diagnostic pop\n#endif\n#if defined( __clang__ )\n#    pragma clang diagnostic pop\n#endif\n\n\n    } // namespace Detail\n} // namespace Catch\n\n#endif // CATCH_COMPARE_TRAITS_HPP_INCLUDED\n\n\n#ifndef CATCH_LOGICAL_TRAITS_HPP_INCLUDED\n#define CATCH_LOGICAL_TRAITS_HPP_INCLUDED\n\n#include <type_traits>\n\nnamespace Catch {\nnamespace Detail {\n\n#if defined( __cpp_lib_logical_traits ) && __cpp_lib_logical_traits >= 201510\n\n    using std::conjunction;\n    using std::disjunction;\n    using std::negation;\n\n#else\n\n    template <class...> struct conjunction : std::true_type {};\n    template <class B1> struct conjunction<B1> : B1 {};\n    template <class B1, class... Bn>\n    struct conjunction<B1, Bn...>\n        : std::conditional_t<bool( B1::value ), conjunction<Bn...>, B1> {};\n\n    template <class...> struct disjunction : std::false_type {};\n    template <class B1> struct disjunction<B1> : B1 {};\n    template <class B1, class... Bn>\n    struct disjunction<B1, Bn...>\n        : std::conditional_t<bool( B1::value ), B1, disjunction<Bn...>> {};\n\n    template <class B>\n    struct negation : std::integral_constant<bool, !bool(B::value)> {};\n\n#endif\n\n} // namespace Detail\n} // namespace Catch\n\n#endif // CATCH_LOGICAL_TRAITS_HPP_INCLUDED\n\n#include <type_traits>\n#include <iosfwd>\n\n/** \\file\n * Why does decomposing look the way it does:\n *\n * Conceptually, decomposing is simple. We change `REQUIRE( a == b )` into\n * `Decomposer{} <= a == b`, so that `Decomposer{} <= a` is evaluated first,\n * and our custom operator is used for `a == b`, because `a` is transformed\n * into `ExprLhs<T&>` and then into `BinaryExpr<T&, U&>`.\n *\n * In practice, decomposing ends up a mess, because we have to support\n * various fun things.\n *\n * 1) Types that are only comparable with literal 0, and they do this by\n *    comparing against a magic type with pointer constructor and deleted\n *    other constructors. Example: `REQUIRE((a <=> b) == 0)` in libstdc++\n *\n * 2) Types that are only comparable with literal 0, and they do this by\n *    comparing against a magic type with consteval integer constructor.\n *    Example: `REQUIRE((a <=> b) == 0)` in current MSVC STL.\n *\n * 3) Types that have no linkage, and so we cannot form a reference to\n *    them. Example: some implementations of traits.\n *\n * 4) Starting with C++20, when the compiler sees `a == b`, it also uses\n *    `b == a` when constructing the overload set. For us this means that\n *    when the compiler handles `ExprLhs<T> == b`, it also tries to resolve\n *    the overload set for `b == ExprLhs<T>`.\n *\n * To accomodate these use cases, decomposer ended up rather complex.\n *\n * 1) These types are handled by adding SFINAE overloads to our comparison\n *    operators, checking whether `T == U` are comparable with the given\n *    operator, and if not, whether T (or U) are comparable with literal 0.\n *    If yes, the overload compares T (or U) with 0 literal inline in the\n *    definition.\n *\n *    Note that for extra correctness, we check  that the other type is\n *    either an `int` (literal 0 is captured as `int` by templates), or\n *    a `long` (some platforms use 0L for `NULL` and we want to support\n *    that for pointer comparisons).\n *\n * 2) For these types, `is_foo_comparable<T, int>` is true, but letting\n *    them fall into the overload that actually does `T == int` causes\n *    compilation error. Handling them requires that the decomposition\n *    is `constexpr`, so that P2564R3 applies and the `consteval` from\n *    their accompanying magic type is propagated through the `constexpr`\n *    call stack.\n *\n *    However this is not enough to handle these types automatically,\n *    because our default is to capture types by reference, to avoid\n *    runtime copies. While these references cannot become dangling,\n *    they outlive the constexpr context and thus the default capture\n *    path cannot be actually constexpr.\n *\n *    The solution is to capture these types by value, by explicitly\n *    specializing `Catch::capture_by_value` for them. Catch2 provides\n *    specialization for `std::foo_ordering`s, but users can specialize\n *    the trait for their own types as well.\n *\n * 3) If a type has no linkage, we also cannot capture it by reference.\n *    The solution is once again to capture them by value. We handle\n *    the common cases by using `std::is_arithmetic` as the default\n *    for `Catch::capture_by_value`, but that is only a some-effort\n *    heuristic. But as with 2), users can specialize `capture_by_value`\n *    for their own types as needed.\n *\n * 4) To support C++20 and make the SFINAE on our decomposing operators\n *    work, the SFINAE has to happen in return type, rather than in\n *    a template type. This is due to our use of logical type traits\n *    (`conjunction`/`disjunction`/`negation`), that we use to workaround\n *    an issue in older (9-) versions of GCC. I still blame C++20 for\n *    this, because without the comparison order switching, the logical\n *    traits could still be used in template type.\n *\n * There are also other side concerns, e.g. supporting both `REQUIRE(a)`\n * and `REQUIRE(a == b)`, or making `REQUIRE_THAT(a, IsEqual(b))` slot\n * nicely into the same expression handling logic, but these are rather\n * straightforward and add only a bit of complexity (e.g. common base\n * class for decomposed expressions).\n */\n\n#ifdef _MSC_VER\n#pragma warning(push)\n#pragma warning(disable:4389) // '==' : signed/unsigned mismatch\n#pragma warning(disable:4018) // more \"signed/unsigned mismatch\"\n#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform)\n#pragma warning(disable:4180) // qualifier applied to function type has no meaning\n#pragma warning(disable:4800) // Forcing result to true or false\n#endif\n\n#ifdef __clang__\n#  pragma clang diagnostic push\n#  pragma clang diagnostic ignored \"-Wsign-compare\"\n#  pragma clang diagnostic ignored \"-Wnon-virtual-dtor\"\n#elif defined __GNUC__\n#  pragma GCC diagnostic push\n#  pragma GCC diagnostic ignored \"-Wsign-compare\"\n#  pragma GCC diagnostic ignored \"-Wnon-virtual-dtor\"\n#endif\n\n#if defined(CATCH_CPP20_OR_GREATER) && __has_include(<compare>)\n#  include <compare>\n#    if defined( __cpp_lib_three_way_comparison ) && \\\n            __cpp_lib_three_way_comparison >= 201907L\n#      define CATCH_CONFIG_CPP20_COMPARE_OVERLOADS\n#    endif\n#endif\n\nnamespace Catch {\n\n    namespace Detail {\n        // This was added in C++20, but we require only C++14 for now.\n        template <typename T>\n        using RemoveCVRef_t = std::remove_cv_t<std::remove_reference_t<T>>;\n    }\n\n    // Note: There is nothing that stops us from extending this,\n    //       e.g. to `std::is_scalar`, but the more encompassing\n    //       traits are usually also more expensive. For now we\n    //       keep this as it used to be and it can be changed later.\n    template <typename T>\n    struct capture_by_value\n        : std::integral_constant<bool, std::is_arithmetic<T>{}> {};\n\n#if defined( CATCH_CONFIG_CPP20_COMPARE_OVERLOADS )\n    template <>\n    struct capture_by_value<std::strong_ordering> : std::true_type {};\n    template <>\n    struct capture_by_value<std::weak_ordering> : std::true_type {};\n    template <>\n    struct capture_by_value<std::partial_ordering> : std::true_type {};\n#endif\n\n    template <typename T>\n    struct always_false : std::false_type {};\n\n    class ITransientExpression {\n        bool m_isBinaryExpression;\n        bool m_result;\n\n    protected:\n        ~ITransientExpression() = default;\n\n    public:\n        constexpr auto isBinaryExpression() const -> bool { return m_isBinaryExpression; }\n        constexpr auto getResult() const -> bool { return m_result; }\n        //! This function **has** to be overriden by the derived class.\n        virtual void streamReconstructedExpression( std::ostream& os ) const;\n\n        constexpr ITransientExpression( bool isBinaryExpression, bool result )\n        :   m_isBinaryExpression( isBinaryExpression ),\n            m_result( result )\n        {}\n\n        constexpr ITransientExpression( ITransientExpression const& ) = default;\n        constexpr ITransientExpression& operator=( ITransientExpression const& ) = default;\n\n        friend std::ostream& operator<<(std::ostream& out, ITransientExpression const& expr) {\n            expr.streamReconstructedExpression(out);\n            return out;\n        }\n    };\n\n    void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs );\n\n    template<typename LhsT, typename RhsT>\n    class BinaryExpr  : public ITransientExpression {\n        LhsT m_lhs;\n        StringRef m_op;\n        RhsT m_rhs;\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            formatReconstructedExpression\n                    ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) );\n        }\n\n    public:\n        constexpr BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs )\n        :   ITransientExpression{ true, comparisonResult },\n            m_lhs( lhs ),\n            m_op( op ),\n            m_rhs( rhs )\n        {}\n\n        template<typename T>\n        auto operator && ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator || ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator == ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator != ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator > ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator < ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator >= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename T>\n        auto operator <= ( T ) const -> BinaryExpr<LhsT, RhsT const&> const {\n            static_assert(always_false<T>::value,\n            \"chained comparisons are not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n    };\n\n    template<typename LhsT>\n    class UnaryExpr : public ITransientExpression {\n        LhsT m_lhs;\n\n        void streamReconstructedExpression( std::ostream &os ) const override {\n            os << Catch::Detail::stringify( m_lhs );\n        }\n\n    public:\n        explicit constexpr UnaryExpr( LhsT lhs )\n        :   ITransientExpression{ false, static_cast<bool>(lhs) },\n            m_lhs( lhs )\n        {}\n    };\n\n\n    template<typename LhsT>\n    class ExprLhs {\n        LhsT m_lhs;\n    public:\n        explicit constexpr ExprLhs( LhsT lhs ) : m_lhs( lhs ) {}\n\n#define CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( id, op )           \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT&& rhs )             \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \\\n                                Detail::negation<capture_by_value<             \\\n                                    Detail::RemoveCVRef_t<RhsT>>>>::value,     \\\n            BinaryExpr<LhsT, RhsT const&>> {                                   \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \\\n    }                                                                          \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs )               \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \\\n                                capture_by_value<RhsT>>::value,                \\\n            BinaryExpr<LhsT, RhsT>> {                                          \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \\\n    }                                                                          \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs )               \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<                                               \\\n                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \\\n                Detail::is_eq_0_comparable<LhsT>,                              \\\n              /* We allow long because we want `ptr op NULL` to be accepted */ \\\n                Detail::disjunction<std::is_same<RhsT, int>,                   \\\n                                    std::is_same<RhsT, long>>>::value,         \\\n            BinaryExpr<LhsT, RhsT>> {                                          \\\n        if ( rhs != 0 ) { throw_test_failure_exception(); }                    \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs };   \\\n    }                                                                          \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs )               \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<                                               \\\n                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \\\n                Detail::is_eq_0_comparable<RhsT>,                              \\\n              /* We allow long because we want `ptr op NULL` to be accepted */ \\\n                Detail::disjunction<std::is_same<LhsT, int>,                   \\\n                                    std::is_same<LhsT, long>>>::value,         \\\n            BinaryExpr<LhsT, RhsT>> {                                          \\\n        if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); }              \\\n        return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs };    \\\n    }\n\n        CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( eq, == )\n        CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR( ne, != )\n\n    #undef CATCH_INTERNAL_DEFINE_EXPRESSION_EQUALITY_OPERATOR\n\n\n#define CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( id, op )         \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT&& rhs )             \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \\\n                                Detail::negation<capture_by_value<             \\\n                                    Detail::RemoveCVRef_t<RhsT>>>>::value,     \\\n            BinaryExpr<LhsT, RhsT const&>> {                                   \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \\\n    }                                                                          \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs )               \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<Detail::is_##id##_comparable<LhsT, RhsT>,      \\\n                                capture_by_value<RhsT>>::value,                \\\n            BinaryExpr<LhsT, RhsT>> {                                          \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \\\n    }                                                                          \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs )               \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<                                               \\\n                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \\\n                Detail::is_##id##_0_comparable<LhsT>,                          \\\n                std::is_same<RhsT, int>>::value,                               \\\n            BinaryExpr<LhsT, RhsT>> {                                          \\\n        if ( rhs != 0 ) { throw_test_failure_exception(); }                    \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op 0 ), lhs.m_lhs, #op##_sr, rhs };   \\\n    }                                                                          \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs )               \\\n        -> std::enable_if_t<                                                   \\\n            Detail::conjunction<                                               \\\n                Detail::negation<Detail::is_##id##_comparable<LhsT, RhsT>>,    \\\n                Detail::is_##id##_0_comparable<RhsT>,                          \\\n                std::is_same<LhsT, int>>::value,                               \\\n            BinaryExpr<LhsT, RhsT>> {                                          \\\n        if ( lhs.m_lhs != 0 ) { throw_test_failure_exception(); }              \\\n        return { static_cast<bool>( 0 op rhs ), lhs.m_lhs, #op##_sr, rhs };    \\\n    }\n\n        CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( lt, < )\n        CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( le, <= )\n        CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( gt, > )\n        CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR( ge, >= )\n\n    #undef CATCH_INTERNAL_DEFINE_EXPRESSION_COMPARISON_OPERATOR\n\n\n#define CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR( op )                        \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT&& rhs )             \\\n        -> std::enable_if_t<                                                   \\\n            !capture_by_value<Detail::RemoveCVRef_t<RhsT>>::value,             \\\n            BinaryExpr<LhsT, RhsT const&>> {                                   \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \\\n    }                                                                          \\\n    template <typename RhsT>                                                   \\\n    constexpr friend auto operator op( ExprLhs&& lhs, RhsT rhs )               \\\n        -> std::enable_if_t<capture_by_value<RhsT>::value,                     \\\n                            BinaryExpr<LhsT, RhsT>> {                          \\\n        return {                                                               \\\n            static_cast<bool>( lhs.m_lhs op rhs ), lhs.m_lhs, #op##_sr, rhs }; \\\n    }\n\n        CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(|)\n        CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(&)\n        CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR(^)\n\n    #undef CATCH_INTERNAL_DEFINE_EXPRESSION_OPERATOR\n\n        template<typename RhsT>\n        friend auto operator && ( ExprLhs &&, RhsT && ) -> BinaryExpr<LhsT, RhsT const&> {\n            static_assert(always_false<RhsT>::value,\n            \"operator&& is not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        template<typename RhsT>\n        friend auto operator || ( ExprLhs &&, RhsT && ) -> BinaryExpr<LhsT, RhsT const&> {\n            static_assert(always_false<RhsT>::value,\n            \"operator|| is not supported inside assertions, \"\n            \"wrap the expression inside parentheses, or decompose it\");\n        }\n\n        constexpr auto makeUnaryExpr() const -> UnaryExpr<LhsT> {\n            return UnaryExpr<LhsT>{ m_lhs };\n        }\n    };\n\n    struct Decomposer {\n        template <typename T,\n                  std::enable_if_t<!capture_by_value<Detail::RemoveCVRef_t<T>>::value,\n                      int> = 0>\n        constexpr friend auto operator <= ( Decomposer &&, T && lhs ) -> ExprLhs<T const&> {\n            return ExprLhs<const T&>{ lhs };\n        }\n\n        template <typename T,\n                  std::enable_if_t<capture_by_value<T>::value, int> = 0>\n        constexpr friend auto operator <= ( Decomposer &&, T value ) -> ExprLhs<T> {\n            return ExprLhs<T>{ value };\n        }\n    };\n\n} // end namespace Catch\n\n#ifdef _MSC_VER\n#pragma warning(pop)\n#endif\n#ifdef __clang__\n#  pragma clang diagnostic pop\n#elif defined __GNUC__\n#  pragma GCC diagnostic pop\n#endif\n\n#endif // CATCH_DECOMPOSER_HPP_INCLUDED\n\n#include <string>\n\nnamespace Catch {\n\n    struct AssertionReaction {\n        bool shouldDebugBreak = false;\n        bool shouldThrow = false;\n        bool shouldSkip = false;\n    };\n\n    class AssertionHandler {\n        AssertionInfo m_assertionInfo;\n        AssertionReaction m_reaction;\n        bool m_completed = false;\n        IResultCapture& m_resultCapture;\n\n    public:\n        AssertionHandler\n            (   StringRef macroName,\n                SourceLineInfo const& lineInfo,\n                StringRef capturedExpression,\n                ResultDisposition::Flags resultDisposition );\n        ~AssertionHandler() {\n            if ( !m_completed ) {\n                m_resultCapture.handleIncomplete( m_assertionInfo );\n            }\n        }\n\n\n        template<typename T>\n        constexpr void handleExpr( ExprLhs<T> const& expr ) {\n            handleExpr( expr.makeUnaryExpr() );\n        }\n        void handleExpr( ITransientExpression const& expr );\n\n        void handleMessage(ResultWas::OfType resultType, std::string&& message);\n\n        void handleExceptionThrownAsExpected();\n        void handleUnexpectedExceptionNotThrown();\n        void handleExceptionNotThrownAsExpected();\n        void handleThrowingCallSkipped();\n        void handleUnexpectedInflightException();\n\n        void complete();\n\n        // query\n        auto allowThrows() const -> bool;\n    };\n\n    void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str );\n\n} // namespace Catch\n\n#endif // CATCH_ASSERTION_HANDLER_HPP_INCLUDED\n\n\n#ifndef CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED\n#define CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED\n\n\n#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION)\n  #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__##_catch_sr\n#else\n  #define CATCH_INTERNAL_STRINGIFY(...) \"Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION\"_catch_sr\n#endif\n\n#endif // CATCH_PREPROCESSOR_INTERNAL_STRINGIFY_HPP_INCLUDED\n\n// We need this suppression to leak, because it took until GCC 10\n// for the front end to handle local suppression via _Pragma properly\n#if defined(__GNUC__) && !defined(__clang__) && !defined(__ICC) && __GNUC__ <= 9\n  #pragma GCC diagnostic ignored \"-Wparentheses\"\n#endif\n\n#if !defined(CATCH_CONFIG_DISABLE)\n\n#if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n\n///////////////////////////////////////////////////////////////////////////////\n// Another way to speed-up compilation is to omit local try-catch for REQUIRE*\n// macros.\n#define INTERNAL_CATCH_TRY\n#define INTERNAL_CATCH_CATCH( capturer )\n\n#else // CATCH_CONFIG_FAST_COMPILE\n\n#define INTERNAL_CATCH_TRY try\n#define INTERNAL_CATCH_CATCH( handler ) catch(...) { (handler).handleUnexpectedInflightException(); }\n\n#endif\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \\\n    do { /* NOLINT(bugprone-infinite-loop) */ \\\n        /* The expression should not be evaluated, but warnings should hopefully be checked */ \\\n        CATCH_INTERNAL_IGNORE_BUT_WARN(__VA_ARGS__); \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \\\n        INTERNAL_CATCH_TRY { \\\n            CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n            CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \\\n            catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); /* NOLINT(bugprone-chained-comparison) */ \\\n            CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \\\n        catchAssertionHandler.complete(); \\\n    } while( (void)0, (false) && static_cast<const bool&>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look\n    // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \\\n    INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \\\n    if( Catch::getResultCapture().lastAssertionPassed() )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \\\n    INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \\\n    if( !Catch::getResultCapture().lastAssertionPassed() )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \\\n        try { \\\n            CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n            CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \\\n            static_cast<void>(__VA_ARGS__); \\\n            CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n            catchAssertionHandler.handleExceptionNotThrownAsExpected(); \\\n        } \\\n        catch( ... ) { \\\n            catchAssertionHandler.handleUnexpectedInflightException(); \\\n        } \\\n        catchAssertionHandler.complete(); \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n                CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \\\n                CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \\\n                static_cast<void>(__VA_ARGS__); \\\n                CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleExceptionThrownAsExpected(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        catchAssertionHandler.complete(); \\\n    } while( false )\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) \", \" CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n                CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \\\n                CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \\\n                static_cast<void>(expr); \\\n                CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( exceptionType const& ) { \\\n                catchAssertionHandler.handleExceptionThrownAsExpected(); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleUnexpectedInflightException(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        catchAssertionHandler.complete(); \\\n    } while( false )\n\n\n\n///////////////////////////////////////////////////////////////////////////////\n// Although this is matcher-based, it can be used with just a string\n#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n                CATCH_INTERNAL_SUPPRESS_UNUSED_RESULT \\\n                CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \\\n                static_cast<void>(__VA_ARGS__); \\\n                CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( ... ) { \\\n                Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher ); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        catchAssertionHandler.complete(); \\\n    } while( false )\n\n#endif // CATCH_CONFIG_DISABLE\n\n#endif // CATCH_TEST_MACRO_IMPL_HPP_INCLUDED\n\n\n#ifndef CATCH_SECTION_HPP_INCLUDED\n#define CATCH_SECTION_HPP_INCLUDED\n\n\n\n\n/** \\file\n * Wrapper for the STATIC_ANALYSIS_SUPPORT configuration option\n *\n * Some of Catch2's macros can be defined differently to work better with\n * static analysis tools, like clang-tidy or coverity.\n * Currently the main use case is to show that `SECTION`s are executed\n * exclusively, and not all in one run of a `TEST_CASE`.\n */\n\n#ifndef CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED\n#define CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED\n\n\n#if defined(__clang_analyzer__) || defined(__COVERITY__)\n    #define CATCH_INTERNAL_CONFIG_STATIC_ANALYSIS_SUPPORT\n#endif\n\n#if defined( CATCH_INTERNAL_CONFIG_STATIC_ANALYSIS_SUPPORT ) && \\\n    !defined( CATCH_CONFIG_NO_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT ) && \\\n    !defined( CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT )\n#    define CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT\n#endif\n\n\n#endif // CATCH_CONFIG_STATIC_ANALYSIS_SUPPORT_HPP_INCLUDED\n\n\n#ifndef CATCH_TIMER_HPP_INCLUDED\n#define CATCH_TIMER_HPP_INCLUDED\n\n#include <cstdint>\n\nnamespace Catch {\n\n    class Timer {\n        uint64_t m_nanoseconds = 0;\n    public:\n        void start();\n        auto getElapsedNanoseconds() const -> uint64_t;\n        auto getElapsedMicroseconds() const -> uint64_t;\n        auto getElapsedMilliseconds() const -> unsigned int;\n        auto getElapsedSeconds() const -> double;\n    };\n\n} // namespace Catch\n\n#endif // CATCH_TIMER_HPP_INCLUDED\n\nnamespace Catch {\n\n    class Section : Detail::NonCopyable {\n    public:\n        Section( SectionInfo&& info );\n        Section( SourceLineInfo const& _lineInfo,\n                 StringRef _name,\n                 const char* const = nullptr );\n        ~Section();\n\n        // This indicates whether the section should be executed or not\n        explicit operator bool() const;\n\n    private:\n        SectionInfo m_info;\n\n        Counts m_assertions;\n        bool m_sectionIncluded;\n        Timer m_timer;\n    };\n\n} // end namespace Catch\n\n#if !defined(CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT)\n#    define INTERNAL_CATCH_SECTION( ... )                                 \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                         \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS                  \\\n        if ( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME(            \\\n                 catch_internal_Section ) =                               \\\n                 Catch::Section( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#    define INTERNAL_CATCH_DYNAMIC_SECTION( ... )                     \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                     \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS              \\\n        if ( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME(        \\\n                 catch_internal_Section ) =                           \\\n                 Catch::SectionInfo(                                  \\\n                     CATCH_INTERNAL_LINEINFO,                         \\\n                     ( Catch::ReusableStringStream() << __VA_ARGS__ ) \\\n                         .str() ) )                                   \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#else\n\n// These section definitions imply that at most one section at one level\n// will be intered (because only one section's __LINE__ can be equal to\n// the dummy `catchInternalSectionHint` variable from `TEST_CASE`).\n\nnamespace Catch {\n    namespace Detail {\n        // Intentionally without linkage, as it should only be used as a dummy\n        // symbol for static analysis.\n        // The arguments are used as a dummy for checking warnings in the passed\n        // expressions.\n        int GetNewSectionHint( StringRef, const char* const = nullptr );\n    } // namespace Detail\n} // namespace Catch\n\n\n#    define INTERNAL_CATCH_SECTION( ... )                                   \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                           \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS                    \\\n        CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS                             \\\n        if ( [[maybe_unused]] const int catchInternalPreviousSectionHint =  \\\n                 catchInternalSectionHint,                                  \\\n             catchInternalSectionHint =                                     \\\n                 Catch::Detail::GetNewSectionHint(__VA_ARGS__);             \\\n             catchInternalPreviousSectionHint == __LINE__ )                 \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#    define INTERNAL_CATCH_DYNAMIC_SECTION( ... )                           \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                           \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS                    \\\n        CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS                             \\\n        if ( [[maybe_unused]] const int catchInternalPreviousSectionHint =  \\\n                 catchInternalSectionHint,                                  \\\n             catchInternalSectionHint = Catch::Detail::GetNewSectionHint(   \\\n                ( Catch::ReusableStringStream() << __VA_ARGS__ ).str());    \\\n             catchInternalPreviousSectionHint == __LINE__ )                 \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#endif\n\n\n#endif // CATCH_SECTION_HPP_INCLUDED\n\n\n#ifndef CATCH_TEST_REGISTRY_HPP_INCLUDED\n#define CATCH_TEST_REGISTRY_HPP_INCLUDED\n\n\n\n#ifndef CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED\n#define CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED\n\nnamespace Catch {\n\n    class ITestInvoker {\n    public:\n        virtual void prepareTestCase();\n        virtual void tearDownTestCase();\n        virtual void invoke() const = 0;\n        virtual ~ITestInvoker(); // = default\n    };\n\n} // namespace Catch\n\n#endif // CATCH_INTERFACES_TEST_INVOKER_HPP_INCLUDED\n\n\n#ifndef CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED\n#define CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED\n\n#define INTERNAL_CATCH_EXPAND1( param ) INTERNAL_CATCH_EXPAND2( param )\n#define INTERNAL_CATCH_EXPAND2( ... ) INTERNAL_CATCH_NO##__VA_ARGS__\n#define INTERNAL_CATCH_DEF( ... ) INTERNAL_CATCH_DEF __VA_ARGS__\n#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF\n\n#define INTERNAL_CATCH_REMOVE_PARENS( ... ) \\\n    INTERNAL_CATCH_EXPAND1( INTERNAL_CATCH_DEF __VA_ARGS__ )\n\n#endif // CATCH_PREPROCESSOR_REMOVE_PARENS_HPP_INCLUDED\n\n// GCC 5 and older do not properly handle disabling unused-variable warning\n// with a _Pragma. This means that we have to leak the suppression to the\n// user code as well :-(\n#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5\n#pragma GCC diagnostic ignored \"-Wunused-variable\"\n#endif\n\n\n\nnamespace Catch {\n\ntemplate<typename C>\nclass TestInvokerAsMethod : public ITestInvoker {\n    void (C::*m_testAsMethod)();\npublic:\n    constexpr TestInvokerAsMethod( void ( C::*testAsMethod )() ) noexcept:\n        m_testAsMethod( testAsMethod ) {}\n\n    void invoke() const override {\n        C obj;\n        (obj.*m_testAsMethod)();\n    }\n};\n\nDetail::unique_ptr<ITestInvoker> makeTestInvoker( void(*testAsFunction)() );\n\ntemplate<typename C>\nDetail::unique_ptr<ITestInvoker> makeTestInvoker( void (C::*testAsMethod)() ) {\n    return Detail::make_unique<TestInvokerAsMethod<C>>( testAsMethod );\n}\n\ntemplate <typename C>\nclass TestInvokerFixture : public ITestInvoker {\n    void ( C::*m_testAsMethod )() const;\n    Detail::unique_ptr<C> m_fixture = nullptr;\n\npublic:\n    constexpr TestInvokerFixture( void ( C::*testAsMethod )() const ) noexcept:\n        m_testAsMethod( testAsMethod ) {}\n\n    void prepareTestCase() override {\n        m_fixture = Detail::make_unique<C>();\n    }\n\n    void tearDownTestCase() override {\n        m_fixture.reset();\n    }\n\n    void invoke() const override {\n        auto* f = m_fixture.get();\n        ( f->*m_testAsMethod )();\n    }\n};\n\ntemplate<typename C>\nDetail::unique_ptr<ITestInvoker> makeTestInvokerFixture( void ( C::*testAsMethod )() const ) {\n    return Detail::make_unique<TestInvokerFixture<C>>( testAsMethod );\n}\n\nstruct NameAndTags {\n    constexpr NameAndTags( StringRef name_ = StringRef(),\n                           StringRef tags_ = StringRef() ) noexcept:\n        name( name_ ), tags( tags_ ) {}\n    StringRef name;\n    StringRef tags;\n};\n\nstruct AutoReg : Detail::NonCopyable {\n    AutoReg( Detail::unique_ptr<ITestInvoker> invoker, SourceLineInfo const& lineInfo, StringRef classOrMethod, NameAndTags const& nameAndTags ) noexcept;\n};\n\n} // end namespace Catch\n\n#if defined(CATCH_CONFIG_DISABLE)\n    #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \\\n        static inline void TestName()\n    #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \\\n        namespace{                        \\\n            struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \\\n                void test();              \\\n            };                            \\\n        }                                 \\\n        void TestName::test()\n#endif\n\n\n#if !defined(CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT)\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \\\n        static void TestName(); \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        namespace{ const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        static void TestName()\n    #define INTERNAL_CATCH_TESTCASE( ... ) \\\n        INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__ )\n\n#else  // ^^ !CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT | vv CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT\n\n\n// Dummy registrator for the dumy test case macros\nnamespace Catch {\n    namespace Detail {\n        struct DummyUse {\n            DummyUse( void ( * )( int ), Catch::NameAndTags const& );\n        };\n    } // namespace Detail\n} // namespace Catch\n\n// Note that both the presence of the argument and its exact name are\n// necessary for the section support.\n\n// We provide a shadowed variable so that a `SECTION` inside non-`TEST_CASE`\n// tests can compile. The redefined `TEST_CASE` shadows this with param.\nstatic int catchInternalSectionHint = 0;\n\n#    define INTERNAL_CATCH_TESTCASE2( fname, ... )                         \\\n        static void fname( int );                                          \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                          \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                           \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS                   \\\n        static const Catch::Detail::DummyUse INTERNAL_CATCH_UNIQUE_NAME(   \\\n            dummyUser )( &(fname), Catch::NameAndTags{ __VA_ARGS__ } );    \\\n        CATCH_INTERNAL_SUPPRESS_SHADOW_WARNINGS                            \\\n        static void fname( [[maybe_unused]] int catchInternalSectionHint ) \\\n            CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n#    define INTERNAL_CATCH_TESTCASE( ... ) \\\n        INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( dummyFunction ), __VA_ARGS__ )\n\n\n#endif // CATCH_CONFIG_EXPERIMENTAL_STATIC_ANALYSIS_SUPPORT\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        namespace{ \\\n            struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \\\n                void test(); \\\n            }; \\\n            const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \\\n            Catch::makeTestInvoker( &TestName::test ),                    \\\n            CATCH_INTERNAL_LINEINFO,                                      \\\n            #ClassName##_catch_sr,                                        \\\n            Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \\\n        } \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        void TestName::test()\n    #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \\\n        INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ )\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE2( TestName, ClassName, ... )      \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                             \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                              \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS                      \\\n        namespace {                                                           \\\n            struct TestName : INTERNAL_CATCH_REMOVE_PARENS( ClassName ) {     \\\n                void test() const;                                            \\\n            };                                                                \\\n            const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \\\n                Catch::makeTestInvokerFixture( &TestName::test ),                    \\\n                CATCH_INTERNAL_LINEINFO,                                      \\\n                #ClassName##_catch_sr,                                        \\\n                Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */             \\\n        }                                                                     \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                              \\\n        void TestName::test() const\n    #define INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE( ClassName, ... )    \\\n        INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), ClassName, __VA_ARGS__ )\n\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        namespace {                                                           \\\n        const Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( \\\n            Catch::makeTestInvoker( &QualifiedMethod ),                   \\\n            CATCH_INTERNAL_LINEINFO,                                      \\\n            \"&\" #QualifiedMethod##_catch_sr,                              \\\n            Catch::NameAndTags{ __VA_ARGS__ } );                          \\\n    } /* NOLINT */ \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \\\n        do { \\\n            CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n            CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n            CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n            Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \\\n            CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        } while(false)\n\n\n#endif // CATCH_TEST_REGISTRY_HPP_INCLUDED\n\n\n// All of our user-facing macros support configuration toggle, that\n// forces them to be defined prefixed with CATCH_. We also like to\n// support another toggle that can minimize (disable) their implementation.\n// Given this, we have 4 different configuration options below\n\n#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE)\n\n  #define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( \"CATCH_REQUIRE\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n  #define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( \"CATCH_REQUIRE_FALSE\", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n\n  #define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( \"CATCH_REQUIRE_THROWS\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n  #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CATCH_REQUIRE_THROWS_AS\", exceptionType, Catch::ResultDisposition::Normal, expr )\n  #define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CATCH_REQUIRE_NOTHROW\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n  #define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK_FALSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n  #define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( \"CATCH_CHECKED_IF\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n  #define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( \"CATCH_CHECKED_ELSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n  #define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( \"CATCH_CHECK_NOFAIL\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n\n  #define CATCH_CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( \"CATCH_CHECK_THROWS\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CATCH_CHECK_THROWS_AS\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )\n  #define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CATCH_CHECK_NOTHROW\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n  #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )\n  #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )\n  #define CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, __VA_ARGS__ )\n  #define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )\n  #define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )\n  #define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )\n  #define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( \"CATCH_FAIL\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n  #define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( \"CATCH_FAIL_CHECK\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( \"CATCH_SUCCEED\", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define CATCH_SKIP( ... ) INTERNAL_CATCH_MSG( \"SKIP\", Catch::ResultWas::ExplicitSkip, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n\n  #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)\n    #define CATCH_STATIC_REQUIRE( ... )       static_assert(   __VA_ARGS__ ,      #__VA_ARGS__ );     CATCH_SUCCEED( #__VA_ARGS__ )\n    #define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), \"!(\" #__VA_ARGS__ \")\" ); CATCH_SUCCEED( #__VA_ARGS__ )\n    #define CATCH_STATIC_CHECK( ... )       static_assert(   __VA_ARGS__ ,      #__VA_ARGS__ );     CATCH_SUCCEED( #__VA_ARGS__ )\n    #define CATCH_STATIC_CHECK_FALSE( ... ) static_assert( !(__VA_ARGS__), \"!(\" #__VA_ARGS__ \")\" ); CATCH_SUCCEED( #__VA_ARGS__ )\n  #else\n    #define CATCH_STATIC_REQUIRE( ... )       CATCH_REQUIRE( __VA_ARGS__ )\n    #define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ )\n    #define CATCH_STATIC_CHECK( ... )       CATCH_CHECK( __VA_ARGS__ )\n    #define CATCH_STATIC_CHECK_FALSE( ... ) CATCH_CHECK_FALSE( __VA_ARGS__ )\n  #endif\n\n\n  // \"BDD-style\" convenience wrappers\n  #define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( \"Scenario: \" __VA_ARGS__ )\n  #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, \"Scenario: \" __VA_ARGS__ )\n  #define CATCH_GIVEN( desc )     INTERNAL_CATCH_DYNAMIC_SECTION( \"    Given: \" << desc )\n  #define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( \"And given: \" << desc )\n  #define CATCH_WHEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     When: \" << desc )\n  #define CATCH_AND_WHEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \" And when: \" << desc )\n  #define CATCH_THEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     Then: \" << desc )\n  #define CATCH_AND_THEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \"      And: \" << desc )\n\n#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) // ^^ prefixed, implemented | vv prefixed, disabled\n\n  #define CATCH_REQUIRE( ... )        (void)(0)\n  #define CATCH_REQUIRE_FALSE( ... )  (void)(0)\n\n  #define CATCH_REQUIRE_THROWS( ... ) (void)(0)\n  #define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)\n  #define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)\n\n  #define CATCH_CHECK( ... )         (void)(0)\n  #define CATCH_CHECK_FALSE( ... )   (void)(0)\n  #define CATCH_CHECKED_IF( ... )    if (__VA_ARGS__)\n  #define CATCH_CHECKED_ELSE( ... )  if (!(__VA_ARGS__))\n  #define CATCH_CHECK_NOFAIL( ... )  (void)(0)\n\n  #define CATCH_CHECK_THROWS( ... )  (void)(0)\n  #define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)\n  #define CATCH_CHECK_NOTHROW( ... ) (void)(0)\n\n  #define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ))\n  #define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ))\n  #define CATCH_METHOD_AS_TEST_CASE( method, ... )\n  #define CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ))\n  #define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0)\n  #define CATCH_SECTION( ... )\n  #define CATCH_DYNAMIC_SECTION( ... )\n  #define CATCH_FAIL( ... ) (void)(0)\n  #define CATCH_FAIL_CHECK( ... ) (void)(0)\n  #define CATCH_SUCCEED( ... ) (void)(0)\n  #define CATCH_SKIP( ... ) (void)(0)\n\n  #define CATCH_STATIC_REQUIRE( ... )       (void)(0)\n  #define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0)\n  #define CATCH_STATIC_CHECK( ... )       (void)(0)\n  #define CATCH_STATIC_CHECK_FALSE( ... ) (void)(0)\n\n  // \"BDD-style\" convenience wrappers\n  #define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ))\n  #define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), className )\n  #define CATCH_GIVEN( desc )\n  #define CATCH_AND_GIVEN( desc )\n  #define CATCH_WHEN( desc )\n  #define CATCH_AND_WHEN( desc )\n  #define CATCH_THEN( desc )\n  #define CATCH_AND_THEN( desc )\n\n#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE) // ^^ prefixed, disabled | vv unprefixed, implemented\n\n  #define REQUIRE( ... ) INTERNAL_CATCH_TEST( \"REQUIRE\", Catch::ResultDisposition::Normal, __VA_ARGS__  )\n  #define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( \"REQUIRE_FALSE\", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n\n  #define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( \"REQUIRE_THROWS\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n  #define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"REQUIRE_THROWS_AS\", exceptionType, Catch::ResultDisposition::Normal, expr )\n  #define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"REQUIRE_NOTHROW\", Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n  #define CHECK( ... ) INTERNAL_CATCH_TEST( \"CHECK\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( \"CHECK_FALSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ )\n  #define CHECKED_IF( ... ) INTERNAL_CATCH_IF( \"CHECKED_IF\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n  #define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( \"CHECKED_ELSE\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n  #define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( \"CHECK_NOFAIL\", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ )\n\n  #define CHECK_THROWS( ... )  INTERNAL_CATCH_THROWS( \"CHECK_THROWS\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( \"CHECK_THROWS_AS\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )\n  #define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( \"CHECK_NOTHROW\", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n\n  #define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ )\n  #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ )\n  #define TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TEST_CASE_PERSISTENT_FIXTURE( className, __VA_ARGS__ )\n  #define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ )\n  #define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ )\n  #define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ )\n  #define FAIL( ... ) INTERNAL_CATCH_MSG( \"FAIL\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n  #define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( \"FAIL_CHECK\", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define SUCCEED( ... ) INTERNAL_CATCH_MSG( \"SUCCEED\", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )\n  #define SKIP( ... ) INTERNAL_CATCH_MSG( \"SKIP\", Catch::ResultWas::ExplicitSkip, Catch::ResultDisposition::Normal, __VA_ARGS__ )\n\n\n  #if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE)\n    #define STATIC_REQUIRE( ... )       static_assert(   __VA_ARGS__,  #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )\n    #define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), \"!(\" #__VA_ARGS__ \")\" ); SUCCEED( \"!(\" #__VA_ARGS__ \")\" )\n    #define STATIC_CHECK( ... )       static_assert(   __VA_ARGS__,  #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ )\n    #define STATIC_CHECK_FALSE( ... ) static_assert( !(__VA_ARGS__), \"!(\" #__VA_ARGS__ \")\" ); SUCCEED( \"!(\" #__VA_ARGS__ \")\" )\n  #else\n    #define STATIC_REQUIRE( ... )       REQUIRE( __VA_ARGS__ )\n    #define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ )\n    #define STATIC_CHECK( ... )       CHECK( __VA_ARGS__ )\n    #define STATIC_CHECK_FALSE( ... ) CHECK_FALSE( __VA_ARGS__ )\n  #endif\n\n  // \"BDD-style\" convenience wrappers\n  #define SCENARIO( ... ) TEST_CASE( \"Scenario: \" __VA_ARGS__ )\n  #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, \"Scenario: \" __VA_ARGS__ )\n  #define GIVEN( desc )     INTERNAL_CATCH_DYNAMIC_SECTION( \"    Given: \" << desc )\n  #define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( \"And given: \" << desc )\n  #define WHEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     When: \" << desc )\n  #define AND_WHEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \" And when: \" << desc )\n  #define THEN( desc )      INTERNAL_CATCH_DYNAMIC_SECTION( \"     Then: \" << desc )\n  #define AND_THEN( desc )  INTERNAL_CATCH_DYNAMIC_SECTION( \"      And: \" << desc )\n\n#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE) // ^^ unprefixed, implemented | vv unprefixed, disabled\n\n  #define REQUIRE( ... )       (void)(0)\n  #define REQUIRE_FALSE( ... ) (void)(0)\n\n  #define REQUIRE_THROWS( ... ) (void)(0)\n  #define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)\n  #define REQUIRE_NOTHROW( ... ) (void)(0)\n\n  #define CHECK( ... ) (void)(0)\n  #define CHECK_FALSE( ... ) (void)(0)\n  #define CHECKED_IF( ... ) if (__VA_ARGS__)\n  #define CHECKED_ELSE( ... ) if (!(__VA_ARGS__))\n  #define CHECK_NOFAIL( ... ) (void)(0)\n\n  #define CHECK_THROWS( ... )  (void)(0)\n  #define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)\n  #define CHECK_NOTHROW( ... ) (void)(0)\n\n  #define TEST_CASE( ... )  INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__)\n  #define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ))\n  #define METHOD_AS_TEST_CASE( method, ... )\n  #define TEST_CASE_PERSISTENT_FIXTURE( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), __VA_ARGS__)\n  #define REGISTER_TEST_CASE( Function, ... ) (void)(0)\n  #define SECTION( ... )\n  #define DYNAMIC_SECTION( ... )\n  #define FAIL( ... ) (void)(0)\n  #define FAIL_CHECK( ... ) (void)(0)\n  #define SUCCEED( ... ) (void)(0)\n  #define SKIP( ... ) (void)(0)\n\n  #define STATIC_REQUIRE( ... )       (void)(0)\n  #define STATIC_REQUIRE_FALSE( ... ) (void)(0)\n  #define STATIC_CHECK( ... )       (void)(0)\n  #define STATIC_CHECK_FALSE( ... ) (void)(0)\n\n  // \"BDD-style\" convenience wrappers\n  #define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ) )\n  #define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEST_ ), className )\n\n  #define GIVEN( desc )\n  #define AND_GIVEN( desc )\n  #define WHEN( desc )\n  #define AND_WHEN( desc )\n  #define THEN( desc )\n  #define AND_THEN( desc )\n\n#endif // ^^ unprefixed, disabled\n\n// end of user facing macros\n\n#endif // CATCH_TEST_MACROS_HPP_INCLUDED\n\n\n#ifndef CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED\n#define CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED\n\n\n\n#ifndef CATCH_PREPROCESSOR_HPP_INCLUDED\n#define CATCH_PREPROCESSOR_HPP_INCLUDED\n\n\n#if defined(__GNUC__)\n// We need to silence \"empty __VA_ARGS__ warning\", and using just _Pragma does not work\n#pragma GCC system_header\n#endif\n\n\n#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__\n#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__)))\n#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__)))\n\n#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__\n// MSVC needs more evaluations\n#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__)))\n#define CATCH_RECURSE(...)  CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__))\n#else\n#define CATCH_RECURSE(...)  CATCH_RECURSION_LEVEL5(__VA_ARGS__)\n#endif\n\n#define CATCH_REC_END(...)\n#define CATCH_REC_OUT\n\n#define CATCH_EMPTY()\n#define CATCH_DEFER(id) id CATCH_EMPTY()\n\n#define CATCH_REC_GET_END2() 0, CATCH_REC_END\n#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2\n#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1\n#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT\n#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0)\n#define CATCH_REC_NEXT(test, next)  CATCH_REC_NEXT1(CATCH_REC_GET_END test, next)\n\n#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST2(f, x, peek, ...)   f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ )\n\n#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ )\n#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...)   f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ )\n\n// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results,\n// and passes userdata as the first parameter to each invocation,\n// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c)\n#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0))\n\n#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0))\n\n#define INTERNAL_CATCH_STRINGIZE(...) INTERNAL_CATCH_STRINGIZE2(__VA_ARGS__)\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_STRINGIZE2(...) #__VA_ARGS__\n#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param))\n#else\n// MSVC is adding extra space and needs another indirection to expand INTERNAL_CATCH_NOINTERNAL_CATCH_DEF\n#define INTERNAL_CATCH_STRINGIZE2(...) INTERNAL_CATCH_STRINGIZE3(__VA_ARGS__)\n#define INTERNAL_CATCH_STRINGIZE3(...) #__VA_ARGS__\n#define INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS(param) (INTERNAL_CATCH_STRINGIZE(INTERNAL_CATCH_REMOVE_PARENS(param)) + 1)\n#endif\n\n#define INTERNAL_CATCH_MAKE_NAMESPACE2(...) ns_##__VA_ARGS__\n#define INTERNAL_CATCH_MAKE_NAMESPACE(name) INTERNAL_CATCH_MAKE_NAMESPACE2(name)\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>())\n#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))\n#else\n#define INTERNAL_CATCH_MAKE_TYPE_LIST2(...) INTERNAL_CATCH_EXPAND_VARGS(decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS_GEN(__VA_ARGS__)>()))\n#define INTERNAL_CATCH_MAKE_TYPE_LIST(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_MAKE_TYPE_LIST2(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)))\n#endif\n\n#define INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(...)\\\n    CATCH_REC_LIST(INTERNAL_CATCH_MAKE_TYPE_LIST,__VA_ARGS__)\n\n#define INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_0) INTERNAL_CATCH_REMOVE_PARENS(_0)\n#define INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_0, _1) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_1_ARG(_1)\n#define INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_0, _1, _2) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_2_ARG(_1, _2)\n#define INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_0, _1, _2, _3) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_3_ARG(_1, _2, _3)\n#define INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_0, _1, _2, _3, _4) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_4_ARG(_1, _2, _3, _4)\n#define INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_0, _1, _2, _3, _4, _5) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_5_ARG(_1, _2, _3, _4, _5)\n#define INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_0, _1, _2, _3, _4, _5, _6) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_6_ARG(_1, _2, _3, _4, _5, _6)\n#define INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_0, _1, _2, _3, _4, _5, _6, _7) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_7_ARG(_1, _2, _3, _4, _5, _6, _7)\n#define INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_8_ARG(_1, _2, _3, _4, _5, _6, _7, _8)\n#define INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_9_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9)\n#define INTERNAL_CATCH_REMOVE_PARENS_11_ARG(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10) INTERNAL_CATCH_REMOVE_PARENS(_0), INTERNAL_CATCH_REMOVE_PARENS_10_ARG(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10)\n\n#define INTERNAL_CATCH_VA_NARGS_IMPL(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, N, ...) N\n\n#define INTERNAL_CATCH_TYPE_GEN\\\n    template<typename...> struct TypeList {};\\\n    template<typename...Ts>\\\n    constexpr auto get_wrapper() noexcept -> TypeList<Ts...> { return {}; }\\\n    template<template<typename...> class...> struct TemplateTypeList{};\\\n    template<template<typename...> class...Cs>\\\n    constexpr auto get_wrapper() noexcept -> TemplateTypeList<Cs...> { return {}; }\\\n    template<typename...>\\\n    struct append;\\\n    template<typename...>\\\n    struct rewrap;\\\n    template<template<typename...> class, typename...>\\\n    struct create;\\\n    template<template<typename...> class, typename>\\\n    struct convert;\\\n    \\\n    template<typename T> \\\n    struct append<T> { using type = T; };\\\n    template< template<typename...> class L1, typename...E1, template<typename...> class L2, typename...E2, typename...Rest>\\\n    struct append<L1<E1...>, L2<E2...>, Rest...> { using type = typename append<L1<E1...,E2...>, Rest...>::type; };\\\n    template< template<typename...> class L1, typename...E1, typename...Rest>\\\n    struct append<L1<E1...>, TypeList<mpl_::na>, Rest...> { using type = L1<E1...>; };\\\n    \\\n    template< template<typename...> class Container, template<typename...> class List, typename...elems>\\\n    struct rewrap<TemplateTypeList<Container>, List<elems...>> { using type = TypeList<Container<elems...>>; };\\\n    template< template<typename...> class Container, template<typename...> class List, class...Elems, typename...Elements>\\\n    struct rewrap<TemplateTypeList<Container>, List<Elems...>, Elements...> { using type = typename append<TypeList<Container<Elems...>>, typename rewrap<TemplateTypeList<Container>, Elements...>::type>::type; };\\\n    \\\n    template<template <typename...> class Final, template< typename...> class...Containers, typename...Types>\\\n    struct create<Final, TemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<TemplateTypeList<Containers>, Types...>::type...>::type; };\\\n    template<template <typename...> class Final, template <typename...> class List, typename...Ts>\\\n    struct convert<Final, List<Ts...>> { using type = typename append<Final<>,TypeList<Ts>...>::type; };\n\n#define INTERNAL_CATCH_NTTP_1(signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)> struct Nttp{};\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    constexpr auto get_wrapper() noexcept -> Nttp<__VA_ARGS__> { return {}; } \\\n    template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...> struct NttpTemplateTypeList{};\\\n    template<template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Cs>\\\n    constexpr auto get_wrapper() noexcept -> NttpTemplateTypeList<Cs...> { return {}; } \\\n    \\\n    template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>> { using type = TypeList<Container<__VA_ARGS__>>; };\\\n    template< template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class Container, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class List, INTERNAL_CATCH_REMOVE_PARENS(signature), typename...Elements>\\\n    struct rewrap<NttpTemplateTypeList<Container>, List<__VA_ARGS__>, Elements...> { using type = typename append<TypeList<Container<__VA_ARGS__>>, typename rewrap<NttpTemplateTypeList<Container>, Elements...>::type>::type; };\\\n    template<template <typename...> class Final, template<INTERNAL_CATCH_REMOVE_PARENS(signature)> class...Containers, typename...Types>\\\n    struct create<Final, NttpTemplateTypeList<Containers...>, TypeList<Types...>> { using type = typename append<Final<>, typename rewrap<NttpTemplateTypeList<Containers>, Types...>::type...>::type; };\n\n#define INTERNAL_CATCH_DECLARE_SIG_TEST0(TestName)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST1(TestName, signature)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_X(TestName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n\n#define INTERNAL_CATCH_DEFINE_SIG_TEST0(TestName)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST1(TestName, signature)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_X(TestName, signature,...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    static void TestName()\n\n#define INTERNAL_CATCH_NTTP_REGISTER0(TestFunc, signature)\\\n    template<typename Type>\\\n    void reg_test(TypeList<Type>, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<Type>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_NTTP_REGISTER(TestFunc, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    void reg_test(Nttp<__VA_ARGS__>, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestFunc<__VA_ARGS__>), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_NTTP_REGISTER_METHOD0(TestName, signature, ...)\\\n    template<typename Type>\\\n    void reg_test(TypeList<Type>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestName<Type>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_NTTP_REGISTER_METHOD(TestName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)>\\\n    void reg_test(Nttp<__VA_ARGS__>, Catch::StringRef className, Catch::NameAndTags nameAndTags)\\\n    {\\\n        Catch::AutoReg( Catch::makeTestInvoker(&TestName<__VA_ARGS__>::test), CATCH_INTERNAL_LINEINFO, className, nameAndTags);\\\n    }\n\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0(TestName, ClassName)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1(TestName, ClassName, signature)\\\n    template<typename TestType> \\\n    struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<TestType> { \\\n        void test();\\\n    }\n\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X(TestName, ClassName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \\\n    struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName)<__VA_ARGS__> { \\\n        void test();\\\n    }\n\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0(TestName)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1(TestName, signature)\\\n    template<typename TestType> \\\n    void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<TestType>::test()\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X(TestName, signature, ...)\\\n    template<INTERNAL_CATCH_REMOVE_PARENS(signature)> \\\n    void INTERNAL_CATCH_MAKE_NAMESPACE(TestName)::TestName<__VA_ARGS__>::test()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n#define INTERNAL_CATCH_NTTP_0\n#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1(__VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_1( __VA_ARGS__),INTERNAL_CATCH_NTTP_1( __VA_ARGS__), INTERNAL_CATCH_NTTP_0)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__)\n#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__)\n#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__)\n#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__)\n#else\n#define INTERNAL_CATCH_NTTP_0(signature)\n#define INTERNAL_CATCH_NTTP_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_1,INTERNAL_CATCH_NTTP_1, INTERNAL_CATCH_NTTP_0)( __VA_ARGS__))\n#define INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD1, INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X,INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD_X, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD1, INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD0)(TestName, ClassName, __VA_ARGS__))\n#define INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD, INTERNAL_CATCH_NTTP_REGISTER_METHOD0, INTERNAL_CATCH_NTTP_REGISTER_METHOD0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_NTTP_REG_GEN(TestFunc, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER, INTERNAL_CATCH_NTTP_REGISTER0, INTERNAL_CATCH_NTTP_REGISTER0)(TestFunc, __VA_ARGS__))\n#define INTERNAL_CATCH_DEFINE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DEFINE_SIG_TEST1, INTERNAL_CATCH_DEFINE_SIG_TEST0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_DECLARE_SIG_TEST(TestName, ...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL( \"dummy\", __VA_ARGS__, INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DEFINE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X,INTERNAL_CATCH_DECLARE_SIG_TEST_X, INTERNAL_CATCH_DECLARE_SIG_TEST1, INTERNAL_CATCH_DECLARE_SIG_TEST0)(TestName, __VA_ARGS__))\n#define INTERNAL_CATCH_REMOVE_PARENS_GEN(...) INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_VA_NARGS_IMPL(__VA_ARGS__, INTERNAL_CATCH_REMOVE_PARENS_11_ARG,INTERNAL_CATCH_REMOVE_PARENS_10_ARG,INTERNAL_CATCH_REMOVE_PARENS_9_ARG,INTERNAL_CATCH_REMOVE_PARENS_8_ARG,INTERNAL_CATCH_REMOVE_PARENS_7_ARG,INTERNAL_CATCH_REMOVE_PARENS_6_ARG,INTERNAL_CATCH_REMOVE_PARENS_5_ARG,INTERNAL_CATCH_REMOVE_PARENS_4_ARG,INTERNAL_CATCH_REMOVE_PARENS_3_ARG,INTERNAL_CATCH_REMOVE_PARENS_2_ARG,INTERNAL_CATCH_REMOVE_PARENS_1_ARG)(__VA_ARGS__))\n#endif\n\n#endif // CATCH_PREPROCESSOR_HPP_INCLUDED\n\n\n// GCC 5 and older do not properly handle disabling unused-variable warning\n// with a _Pragma. This means that we have to leak the suppression to the\n// user code as well :-(\n#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 5\n#pragma GCC diagnostic ignored \"-Wunused-variable\"\n#endif\n\n#if defined(CATCH_CONFIG_DISABLE)\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( TestName, TestFunc, Name, Tags, Signature, ... )  \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature))\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... )    \\\n        namespace{                                                                                  \\\n            namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                      \\\n            INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\\\n        }                                                                                           \\\n        }                                                                                           \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(Name, Tags, ...) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )\n    #endif\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(Name, Tags, Signature, ...) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) )\n    #endif\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( ClassName, Name, Tags,... ) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )\n    #endif\n\n    #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \\\n            INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )\n    #else\n        #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION( ClassName, Name, Tags, Signature, ... ) \\\n            INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )\n    #endif\n#endif\n\n\n    ///////////////////////////////////////////////////////////////////////////////\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \\\n        INTERNAL_CATCH_DECLARE_SIG_TEST(TestFunc, INTERNAL_CATCH_REMOVE_PARENS(Signature));\\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\\\n            INTERNAL_CATCH_TYPE_GEN\\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            INTERNAL_CATCH_NTTP_REG_GEN(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            template<typename...Types> \\\n            struct TestName{\\\n                TestName(){\\\n                    size_t index = 0;                                    \\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)}; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\\\n                    using expander = size_t[]; /* NOLINT(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays,hicpp-avoid-c-arrays) */\\\n                    (void)expander{(reg_test(Types{}, Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static const int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n            TestName<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\\\n            return 0;\\\n        }();\\\n        }\\\n        }\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature))\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename TestType, __VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                      \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                      \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS                \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS       \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \\\n        template<typename TestType> static void TestFuncName();       \\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName) {                                     \\\n            INTERNAL_CATCH_TYPE_GEN                                                  \\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))         \\\n            template<typename... Types>                               \\\n            struct TestName {                                         \\\n                void reg_tests() {                                          \\\n                    size_t index = 0;                                    \\\n                    using expander = size_t[];                           \\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\\\n                    constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\\\n                    constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\\\n                    (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFuncName<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index / num_types]) + '<' + std::string(types_list[index % num_types]) + '>', Tags } ), index++)... };/* NOLINT */\\\n                }                                                     \\\n            };                                                        \\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \\\n                using TestInit = typename create<TestName, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type; \\\n                TestInit t;                                           \\\n                t.reg_tests();                                        \\\n                return 0;                                             \\\n            }();                                                      \\\n        }                                                             \\\n        }                                                             \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                       \\\n        template<typename TestType>                                   \\\n        static void TestFuncName()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T,__VA_ARGS__)\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, typename T, __VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__)\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, Signature, __VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \\\n        template<typename TestType> static void TestFunc();       \\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){\\\n        INTERNAL_CATCH_TYPE_GEN\\\n        template<typename... Types>                               \\\n        struct TestName {                                         \\\n            void reg_tests() {                                          \\\n                size_t index = 0;                                    \\\n                using expander = size_t[];                           \\\n                (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc<Types> ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ Name \" - \" INTERNAL_CATCH_STRINGIZE(TmplList) \" - \" + std::to_string(index), Tags } ), index++)... };/* NOLINT */\\\n            }                                                     \\\n        };\\\n        static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){ \\\n                using TestInit = typename convert<TestName, TmplList>::type; \\\n                TestInit t;                                           \\\n                t.reg_tests();                                        \\\n                return 0;                                             \\\n            }();                                                      \\\n        }}\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION                       \\\n        template<typename TestType>                                   \\\n        static void TestFunc()\n\n    #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \\\n        INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), Name, Tags, TmplList )\n\n\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \\\n            INTERNAL_CATCH_TYPE_GEN\\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            INTERNAL_CATCH_DECLARE_SIG_TEST_METHOD(TestName, ClassName, INTERNAL_CATCH_REMOVE_PARENS(Signature));\\\n            INTERNAL_CATCH_NTTP_REG_METHOD_GEN(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            template<typename...Types> \\\n            struct TestNameClass{\\\n                TestNameClass(){\\\n                    size_t index = 0;                                    \\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, __VA_ARGS__)};\\\n                    using expander = size_t[];\\\n                    (void)expander{(reg_test(Types{}, #ClassName, Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index]), Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n                TestNameClass<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(__VA_ARGS__)>();\\\n                return 0;\\\n        }();\\\n        }\\\n        }\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature))\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \\\n        INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_CLASS_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        template<typename TestType> \\\n            struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \\\n                void test();\\\n            };\\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestNameClass) {\\\n            INTERNAL_CATCH_TYPE_GEN                  \\\n            INTERNAL_CATCH_NTTP_GEN(INTERNAL_CATCH_REMOVE_PARENS(Signature))\\\n            template<typename...Types>\\\n            struct TestNameClass{\\\n                void reg_tests(){\\\n                    std::size_t index = 0;\\\n                    using expander = std::size_t[];\\\n                    constexpr char const* tmpl_types[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TmplTypes))};\\\n                    constexpr char const* types_list[] = {CATCH_REC_LIST(INTERNAL_CATCH_STRINGIZE_WITHOUT_PARENS, INTERNAL_CATCH_REMOVE_PARENS(TypesList))};\\\n                    constexpr auto num_types = sizeof(types_list) / sizeof(types_list[0]);\\\n                    (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ Name \" - \" + std::string(tmpl_types[index / num_types]) + '<' + std::string(types_list[index % num_types]) + '>', Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n                using TestInit = typename create<TestNameClass, decltype(get_wrapper<INTERNAL_CATCH_REMOVE_PARENS(TmplTypes)>()), TypeList<INTERNAL_CATCH_MAKE_TYPE_LISTS_FROM_TYPES(INTERNAL_CATCH_REMOVE_PARENS(TypesList))>>::type;\\\n                TestInit t;\\\n                t.reg_tests();\\\n                return 0;\\\n            }(); \\\n        }\\\n        }\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        template<typename TestType> \\\n        void TestName<TestType>::test()\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, typename T, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) )\n#endif\n\n#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\\\n        INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, Signature, __VA_ARGS__ )\n#else\n    #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\\\n        INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) )\n#endif\n\n    #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS \\\n        CATCH_INTERNAL_SUPPRESS_COMMA_WARNINGS \\\n        template<typename TestType> \\\n        struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName <TestType>) { \\\n            void test();\\\n        };\\\n        namespace {\\\n        namespace INTERNAL_CATCH_MAKE_NAMESPACE(TestName){ \\\n            INTERNAL_CATCH_TYPE_GEN\\\n            template<typename...Types>\\\n            struct TestNameClass{\\\n                void reg_tests(){\\\n                    size_t index = 0;\\\n                    using expander = size_t[];\\\n                    (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName<Types>::test ), CATCH_INTERNAL_LINEINFO, #ClassName##_catch_sr, Catch::NameAndTags{ Name \" - \" INTERNAL_CATCH_STRINGIZE(TmplList) \" - \" + std::to_string(index), Tags } ), index++)... };/* NOLINT */ \\\n                }\\\n            };\\\n            static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\\\n                using TestInit = typename convert<TestNameClass, TmplList>::type;\\\n                TestInit t;\\\n                t.reg_tests();\\\n                return 0;\\\n            }(); \\\n        }}\\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n        template<typename TestType> \\\n        void TestName<TestType>::test()\n\n#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD(ClassName, Name, Tags, TmplList) \\\n        INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), INTERNAL_CATCH_UNIQUE_NAME( CATCH2_INTERNAL_TEMPLATE_TEST_ ), ClassName, Name, Tags, TmplList )\n\n\n#endif // CATCH_TEMPLATE_TEST_REGISTRY_HPP_INCLUDED\n\n\n#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE)\n\n  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n    #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n    #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__)\n    #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #else\n    #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n  #endif\n\n#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE)\n\n  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)\n    #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )\n  #else\n    #define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )\n    #define CATCH_TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )\n    #define CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )\n  #endif\n\n  // When disabled, these can be shared between proper preprocessor and MSVC preprocessor\n  #define CATCH_TEMPLATE_PRODUCT_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n  #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n  #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #define CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #define CATCH_TEMPLATE_LIST_TEST_CASE( ... ) CATCH_TEMPLATE_TEST_CASE(__VA_ARGS__)\n  #define CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n\n#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE)\n\n  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ )\n    #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ )\n    #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n    #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n    #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ )\n    #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ )\n    #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ )\n    #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ )\n    #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(__VA_ARGS__)\n    #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #else\n    #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) )\n    #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG( __VA_ARGS__ ) )\n    #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n    #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n    #define TEMPLATE_PRODUCT_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE( __VA_ARGS__ ) )\n    #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG( __VA_ARGS__ ) )\n    #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n    #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, __VA_ARGS__ ) )\n    #define TEMPLATE_LIST_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE( __VA_ARGS__ ) )\n    #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD( className, __VA_ARGS__ ) )\n  #endif\n\n#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE)\n\n  #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR\n    #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__)\n    #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__)\n    #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__)\n    #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ )\n  #else\n    #define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(__VA_ARGS__) )\n    #define TEMPLATE_TEST_CASE_SIG( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG_NO_REGISTRATION(__VA_ARGS__) )\n    #define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(className, __VA_ARGS__ ) )\n    #define TEMPLATE_TEST_CASE_METHOD_SIG( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG_NO_REGISTRATION(className, __VA_ARGS__ ) )\n  #endif\n\n  // When disabled, these can be shared between proper preprocessor and MSVC preprocessor\n  #define TEMPLATE_PRODUCT_TEST_CASE( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )\n  #define TEMPLATE_PRODUCT_TEST_CASE_SIG( ... ) TEMPLATE_TEST_CASE( __VA_ARGS__ )\n  #define TEMPLATE_PRODUCT_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #define TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n  #define TEMPLATE_LIST_TEST_CASE( ... ) TEMPLATE_TEST_CASE(__VA_ARGS__)\n  #define TEMPLATE_LIST_TEST_CASE_METHOD( className, ... ) TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ )\n\n#endif // end of user facing macro declarations\n\n\n#endif // CATCH_TEMPLATE_TEST_MACROS_HPP_INCLUDED\n\n\n#ifndef CATCH_TEST_CASE_INFO_HPP_INCLUDED\n#define CATCH_TEST_CASE_INFO_HPP_INCLUDED\n\n\n\n#include <cstdint>\n#include <string>\n#include <vector>\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\nnamespace Catch {\n\n    /**\n     * A **view** of a tag string that provides case insensitive comparisons\n     *\n     * Note that in Catch2 internals, the square brackets around tags are\n     * not a part of tag's representation, so e.g. \"[cool-tag]\" is represented\n     * as \"cool-tag\" internally.\n     */\n    struct Tag {\n        constexpr Tag(StringRef original_):\n            original(original_)\n        {}\n        StringRef original;\n\n        friend bool operator< ( Tag const& lhs, Tag const& rhs );\n        friend bool operator==( Tag const& lhs, Tag const& rhs );\n    };\n\n    class ITestInvoker;\n    struct NameAndTags;\n\n    enum class TestCaseProperties : uint8_t {\n        None = 0,\n        IsHidden = 1 << 1,\n        ShouldFail = 1 << 2,\n        MayFail = 1 << 3,\n        Throws = 1 << 4,\n        NonPortable = 1 << 5,\n        Benchmark = 1 << 6\n    };\n\n    /**\n     * Various metadata about the test case.\n     *\n     * A test case is uniquely identified by its (class)name and tags\n     * combination, with source location being ignored, and other properties\n     * being determined from tags.\n     *\n     * Tags are kept sorted.\n     */\n    struct TestCaseInfo : Detail::NonCopyable {\n\n        TestCaseInfo(StringRef _className,\n                     NameAndTags const& _nameAndTags,\n                     SourceLineInfo const& _lineInfo);\n\n        bool isHidden() const;\n        bool throws() const;\n        bool okToFail() const;\n        bool expectedToFail() const;\n\n        // Adds the tag(s) with test's filename (for the -# flag)\n        void addFilenameTag();\n\n        //! Orders by name, classname and tags\n        friend bool operator<( TestCaseInfo const& lhs,\n                               TestCaseInfo const& rhs );\n\n\n        std::string tagsAsString() const;\n\n        std::string name;\n        StringRef className;\n    private:\n        std::string backingTags;\n        // Internally we copy tags to the backing storage and then add\n        // refs to this storage to the tags vector.\n        void internalAppendTag(StringRef tagString);\n    public:\n        std::vector<Tag> tags;\n        SourceLineInfo lineInfo;\n        TestCaseProperties properties = TestCaseProperties::None;\n    };\n\n    /**\n     * Wrapper over the test case information and the test case invoker\n     *\n     * Does not own either, and is specifically made to be cheap\n     * to copy around.\n     */\n    class TestCaseHandle {\n        TestCaseInfo* m_info;\n        ITestInvoker* m_invoker;\n    public:\n        constexpr TestCaseHandle(TestCaseInfo* info, ITestInvoker* invoker) :\n            m_info(info), m_invoker(invoker) {}\n\n        void prepareTestCase() const {\n            m_invoker->prepareTestCase();\n        }\n\n        void tearDownTestCase() const {\n            m_invoker->tearDownTestCase();\n        }\n\n        void invoke() const {\n            m_invoker->invoke();\n        }\n\n        constexpr TestCaseInfo const& getTestCaseInfo() const {\n            return *m_info;\n        }\n    };\n\n    Detail::unique_ptr<TestCaseInfo>\n    makeTestCaseInfo( StringRef className,\n                      NameAndTags const& nameAndTags,\n                      SourceLineInfo const& lineInfo );\n}\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n#endif // CATCH_TEST_CASE_INFO_HPP_INCLUDED\n\n\n#ifndef CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED\n#define CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED\n\n\n\n#ifndef CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED\n#define CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED\n\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\n    using exceptionTranslateFunction = std::string(*)();\n\n    class IExceptionTranslator;\n    using ExceptionTranslators = std::vector<Detail::unique_ptr<IExceptionTranslator const>>;\n\n    class IExceptionTranslator {\n    public:\n        virtual ~IExceptionTranslator(); // = default\n        virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0;\n    };\n\n    class IExceptionTranslatorRegistry {\n    public:\n        virtual ~IExceptionTranslatorRegistry(); // = default\n        virtual std::string translateActiveException() const = 0;\n    };\n\n} // namespace Catch\n\n#endif // CATCH_INTERFACES_EXCEPTION_HPP_INCLUDED\n\n#include <exception>\n\nnamespace Catch {\n    namespace Detail {\n        void registerTranslatorImpl(\n            Detail::unique_ptr<IExceptionTranslator>&& translator );\n    }\n\n    class ExceptionTranslatorRegistrar {\n        template<typename T>\n        class ExceptionTranslator : public IExceptionTranslator {\n        public:\n\n            constexpr ExceptionTranslator( std::string(*translateFunction)( T const& ) )\n            : m_translateFunction( translateFunction )\n            {}\n\n            std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n                try {\n                    if( it == itEnd )\n                        std::rethrow_exception(std::current_exception());\n                    else\n                        return (*it)->translate( it+1, itEnd );\n                }\n                catch( T const& ex ) {\n                    return m_translateFunction( ex );\n                }\n#else\n                return \"You should never get here!\";\n#endif\n            }\n\n        protected:\n            std::string(*m_translateFunction)( T const& );\n        };\n\n    public:\n        template<typename T>\n        ExceptionTranslatorRegistrar( std::string(*translateFunction)( T const& ) ) {\n            Detail::registerTranslatorImpl(\n                Detail::make_unique<ExceptionTranslator<T>>(\n                    translateFunction ) );\n        }\n    };\n\n} // namespace Catch\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \\\n    static std::string translatorName( signature ); \\\n    CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n    CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \\\n    namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \\\n    CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n    static std::string translatorName( signature )\n\n#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )\n\n#if defined(CATCH_CONFIG_DISABLE)\n    #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \\\n            static std::string translatorName( signature )\n#endif\n\n\n// This macro is always prefixed\n#if !defined(CATCH_CONFIG_DISABLE)\n#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )\n#else\n#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature )\n#endif\n\n\n#endif // CATCH_TRANSLATE_EXCEPTION_HPP_INCLUDED\n\n\n#ifndef CATCH_VERSION_HPP_INCLUDED\n#define CATCH_VERSION_HPP_INCLUDED\n\n#include <iosfwd>\n\nnamespace Catch {\n\n    // Versioning information\n    struct Version {\n        Version( Version const& ) = delete;\n        Version& operator=( Version const& ) = delete;\n        Version(    unsigned int _majorVersion,\n                    unsigned int _minorVersion,\n                    unsigned int _patchNumber,\n                    char const * const _branchName,\n                    unsigned int _buildNumber );\n\n        unsigned int const majorVersion;\n        unsigned int const minorVersion;\n        unsigned int const patchNumber;\n\n        // buildNumber is only used if branchName is not null\n        char const * const branchName;\n        unsigned int const buildNumber;\n\n        friend std::ostream& operator << ( std::ostream& os, Version const& version );\n    };\n\n    Version const& libraryVersion();\n}\n\n#endif // CATCH_VERSION_HPP_INCLUDED\n\n\n#ifndef CATCH_VERSION_MACROS_HPP_INCLUDED\n#define CATCH_VERSION_MACROS_HPP_INCLUDED\n\n#define CATCH_VERSION_MAJOR 3\n#define CATCH_VERSION_MINOR 7\n#define CATCH_VERSION_PATCH 1\n\n#endif // CATCH_VERSION_MACROS_HPP_INCLUDED\n\n\n/** \\file\n * This is a convenience header for Catch2's Generator support. It includes\n * **all** of Catch2 headers related to generators.\n *\n * Generally the Catch2 users should use specific includes they need,\n * but this header can be used instead for ease-of-experimentation, or\n * just plain convenience, at the cost of (significantly) increased\n * compilation times.\n *\n * When a new header is added to either the `generators` folder,\n * or to the corresponding internal subfolder, it should be added here.\n */\n\n#ifndef CATCH_GENERATORS_ALL_HPP_INCLUDED\n#define CATCH_GENERATORS_ALL_HPP_INCLUDED\n\n\n\n#ifndef CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED\n#define CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED\n\n#include <exception>\n\nnamespace Catch {\n\n    // Exception type to be thrown when a Generator runs into an error,\n    // e.g. it cannot initialize the first return value based on\n    // runtime information\n    class GeneratorException : public std::exception {\n        const char* const m_msg = \"\";\n\n    public:\n        GeneratorException(const char* msg):\n            m_msg(msg)\n        {}\n\n        const char* what() const noexcept override final;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_GENERATOR_EXCEPTION_HPP_INCLUDED\n\n\n#ifndef CATCH_GENERATORS_HPP_INCLUDED\n#define CATCH_GENERATORS_HPP_INCLUDED\n\n\n\n#ifndef CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED\n#define CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\n\n    namespace Generators {\n        class GeneratorUntypedBase {\n            // Caches result from `toStringImpl`, assume that when it is an\n            // empty string, the cache is invalidated.\n            mutable std::string m_stringReprCache;\n\n            // Counts based on `next` returning true\n            std::size_t m_currentElementIndex = 0;\n\n            /**\n             * Attempts to move the generator to the next element\n             *\n             * Returns true iff the move succeeded (and a valid element\n             * can be retrieved).\n             */\n            virtual bool next() = 0;\n\n            //! Customization point for `currentElementAsString`\n            virtual std::string stringifyImpl() const = 0;\n\n        public:\n            GeneratorUntypedBase() = default;\n            // Generation of copy ops is deprecated (and Clang will complain)\n            // if there is a user destructor defined\n            GeneratorUntypedBase(GeneratorUntypedBase const&) = default;\n            GeneratorUntypedBase& operator=(GeneratorUntypedBase const&) = default;\n\n            virtual ~GeneratorUntypedBase(); // = default;\n\n            /**\n             * Attempts to move the generator to the next element\n             *\n             * Serves as a non-virtual interface to `next`, so that the\n             * top level interface can provide sanity checking and shared\n             * features.\n             *\n             * As with `next`, returns true iff the move succeeded and\n             * the generator has new valid element to provide.\n             */\n            bool countedNext();\n\n            std::size_t currentElementIndex() const { return m_currentElementIndex; }\n\n            /**\n             * Returns generator's current element as user-friendly string.\n             *\n             * By default returns string equivalent to calling\n             * `Catch::Detail::stringify` on the current element, but generators\n             * can customize their implementation as needed.\n             *\n             * Not thread-safe due to internal caching.\n             *\n             * The returned ref is valid only until the generator instance\n             * is destructed, or it moves onto the next element, whichever\n             * comes first.\n             */\n            StringRef currentElementAsString() const;\n        };\n        using GeneratorBasePtr = Catch::Detail::unique_ptr<GeneratorUntypedBase>;\n\n    } // namespace Generators\n\n    class IGeneratorTracker {\n    public:\n        virtual ~IGeneratorTracker(); // = default;\n        virtual auto hasGenerator() const -> bool = 0;\n        virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0;\n        virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0;\n    };\n\n} // namespace Catch\n\n#endif // CATCH_INTERFACES_GENERATORTRACKER_HPP_INCLUDED\n\n#include <vector>\n#include <tuple>\n\nnamespace Catch {\n\nnamespace Generators {\n\nnamespace Detail {\n\n    //! Throws GeneratorException with the provided message\n    [[noreturn]]\n    void throw_generator_exception(char const * msg);\n\n} // end namespace detail\n\n    template<typename T>\n    class IGenerator : public GeneratorUntypedBase {\n        std::string stringifyImpl() const override {\n            return ::Catch::Detail::stringify( get() );\n        }\n\n    public:\n        // Returns the current element of the generator\n        //\n        // \\Precondition The generator is either freshly constructed,\n        // or the last call to `next()` returned true\n        virtual T const& get() const = 0;\n        using type = T;\n    };\n\n    template <typename T>\n    using GeneratorPtr = Catch::Detail::unique_ptr<IGenerator<T>>;\n\n    template <typename T>\n    class GeneratorWrapper final {\n        GeneratorPtr<T> m_generator;\n    public:\n        //! Takes ownership of the passed pointer.\n        GeneratorWrapper(IGenerator<T>* generator):\n            m_generator(generator) {}\n        GeneratorWrapper(GeneratorPtr<T> generator):\n            m_generator(CATCH_MOVE(generator)) {}\n\n        T const& get() const {\n            return m_generator->get();\n        }\n        bool next() {\n            return m_generator->countedNext();\n        }\n    };\n\n\n    template<typename T>\n    class SingleValueGenerator final : public IGenerator<T> {\n        T m_value;\n    public:\n        SingleValueGenerator(T const& value) :\n            m_value(value)\n        {}\n        SingleValueGenerator(T&& value):\n            m_value(CATCH_MOVE(value))\n        {}\n\n        T const& get() const override {\n            return m_value;\n        }\n        bool next() override {\n            return false;\n        }\n    };\n\n    template<typename T>\n    class FixedValuesGenerator final : public IGenerator<T> {\n        static_assert(!std::is_same<T, bool>::value,\n            \"FixedValuesGenerator does not support bools because of std::vector<bool>\"\n            \"specialization, use SingleValue Generator instead.\");\n        std::vector<T> m_values;\n        size_t m_idx = 0;\n    public:\n        FixedValuesGenerator( std::initializer_list<T> values ) : m_values( values ) {}\n\n        T const& get() const override {\n            return m_values[m_idx];\n        }\n        bool next() override {\n            ++m_idx;\n            return m_idx < m_values.size();\n        }\n    };\n\n    template <typename T, typename DecayedT = std::decay_t<T>>\n    GeneratorWrapper<DecayedT> value( T&& value ) {\n        return GeneratorWrapper<DecayedT>(\n            Catch::Detail::make_unique<SingleValueGenerator<DecayedT>>(\n                CATCH_FORWARD( value ) ) );\n    }\n    template <typename T>\n    GeneratorWrapper<T> values(std::initializer_list<T> values) {\n        return GeneratorWrapper<T>(Catch::Detail::make_unique<FixedValuesGenerator<T>>(values));\n    }\n\n    template<typename T>\n    class Generators : public IGenerator<T> {\n        std::vector<GeneratorWrapper<T>> m_generators;\n        size_t m_current = 0;\n\n        void add_generator( GeneratorWrapper<T>&& generator ) {\n            m_generators.emplace_back( CATCH_MOVE( generator ) );\n        }\n        void add_generator( T const& val ) {\n            m_generators.emplace_back( value( val ) );\n        }\n        void add_generator( T&& val ) {\n            m_generators.emplace_back( value( CATCH_MOVE( val ) ) );\n        }\n        template <typename U>\n        std::enable_if_t<!std::is_same<std::decay_t<U>, T>::value>\n        add_generator( U&& val ) {\n            add_generator( T( CATCH_FORWARD( val ) ) );\n        }\n\n        template <typename U> void add_generators( U&& valueOrGenerator ) {\n            add_generator( CATCH_FORWARD( valueOrGenerator ) );\n        }\n\n        template <typename U, typename... Gs>\n        void add_generators( U&& valueOrGenerator, Gs&&... moreGenerators ) {\n            add_generator( CATCH_FORWARD( valueOrGenerator ) );\n            add_generators( CATCH_FORWARD( moreGenerators )... );\n        }\n\n    public:\n        template <typename... Gs>\n        Generators(Gs &&... moreGenerators) {\n            m_generators.reserve(sizeof...(Gs));\n            add_generators(CATCH_FORWARD(moreGenerators)...);\n        }\n\n        T const& get() const override {\n            return m_generators[m_current].get();\n        }\n\n        bool next() override {\n            if (m_current >= m_generators.size()) {\n                return false;\n            }\n            const bool current_status = m_generators[m_current].next();\n            if (!current_status) {\n                ++m_current;\n            }\n            return m_current < m_generators.size();\n        }\n    };\n\n\n    template <typename... Ts>\n    GeneratorWrapper<std::tuple<std::decay_t<Ts>...>>\n    table( std::initializer_list<std::tuple<std::decay_t<Ts>...>> tuples ) {\n        return values<std::tuple<Ts...>>( tuples );\n    }\n\n    // Tag type to signal that a generator sequence should convert arguments to a specific type\n    template <typename T>\n    struct as {};\n\n    template<typename T, typename... Gs>\n    auto makeGenerators( GeneratorWrapper<T>&& generator, Gs &&... moreGenerators ) -> Generators<T> {\n        return Generators<T>(CATCH_MOVE(generator), CATCH_FORWARD(moreGenerators)...);\n    }\n    template<typename T>\n    auto makeGenerators( GeneratorWrapper<T>&& generator ) -> Generators<T> {\n        return Generators<T>(CATCH_MOVE(generator));\n    }\n    template<typename T, typename... Gs>\n    auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators<std::decay_t<T>> {\n        return makeGenerators( value( CATCH_FORWARD( val ) ), CATCH_FORWARD( moreGenerators )... );\n    }\n    template<typename T, typename U, typename... Gs>\n    auto makeGenerators( as<T>, U&& val, Gs &&... moreGenerators ) -> Generators<T> {\n        return makeGenerators( value( T( CATCH_FORWARD( val ) ) ), CATCH_FORWARD( moreGenerators )... );\n    }\n\n    IGeneratorTracker* acquireGeneratorTracker( StringRef generatorName,\n                                                SourceLineInfo const& lineInfo );\n    IGeneratorTracker* createGeneratorTracker( StringRef generatorName,\n                                               SourceLineInfo lineInfo,\n                                               GeneratorBasePtr&& generator );\n\n    template<typename L>\n    auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> typename decltype(generatorExpression())::type {\n        using UnderlyingType = typename decltype(generatorExpression())::type;\n\n        IGeneratorTracker* tracker = acquireGeneratorTracker( generatorName, lineInfo );\n        // Creation of tracker is delayed after generator creation, so\n        // that constructing generator can fail without breaking everything.\n        if (!tracker) {\n            tracker = createGeneratorTracker(\n                generatorName,\n                lineInfo,\n                Catch::Detail::make_unique<Generators<UnderlyingType>>(\n                    generatorExpression() ) );\n        }\n\n        auto const& generator = static_cast<IGenerator<UnderlyingType> const&>( *tracker->getGenerator() );\n        return generator.get();\n    }\n\n} // namespace Generators\n} // namespace Catch\n\n#define CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL( ... ) #__VA_ARGS__##_catch_sr\n#define CATCH_INTERNAL_GENERATOR_STRINGIZE(...) CATCH_INTERNAL_GENERATOR_STRINGIZE_IMPL(__VA_ARGS__)\n\n#define GENERATE( ... ) \\\n    Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \\\n                                 CATCH_INTERNAL_LINEINFO, \\\n                                 [ ]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)\n#define GENERATE_COPY( ... ) \\\n    Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \\\n                                 CATCH_INTERNAL_LINEINFO, \\\n                                 [=]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)\n#define GENERATE_REF( ... ) \\\n    Catch::Generators::generate( CATCH_INTERNAL_GENERATOR_STRINGIZE(INTERNAL_CATCH_UNIQUE_NAME(generator)), \\\n                                 CATCH_INTERNAL_LINEINFO, \\\n                                 [&]{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) //NOLINT(google-build-using-namespace)\n\n#endif // CATCH_GENERATORS_HPP_INCLUDED\n\n\n#ifndef CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED\n#define CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED\n\n\n#include <cassert>\n\nnamespace Catch {\nnamespace Generators {\n\n    template <typename T>\n    class TakeGenerator final : public IGenerator<T> {\n        GeneratorWrapper<T> m_generator;\n        size_t m_returned = 0;\n        size_t m_target;\n    public:\n        TakeGenerator(size_t target, GeneratorWrapper<T>&& generator):\n            m_generator(CATCH_MOVE(generator)),\n            m_target(target)\n        {\n            assert(target != 0 && \"Empty generators are not allowed\");\n        }\n        T const& get() const override {\n            return m_generator.get();\n        }\n        bool next() override {\n            ++m_returned;\n            if (m_returned >= m_target) {\n                return false;\n            }\n\n            const auto success = m_generator.next();\n            // If the underlying generator does not contain enough values\n            // then we cut short as well\n            if (!success) {\n                m_returned = m_target;\n            }\n            return success;\n        }\n    };\n\n    template <typename T>\n    GeneratorWrapper<T> take(size_t target, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<T>(Catch::Detail::make_unique<TakeGenerator<T>>(target, CATCH_MOVE(generator)));\n    }\n\n\n    template <typename T, typename Predicate>\n    class FilterGenerator final : public IGenerator<T> {\n        GeneratorWrapper<T> m_generator;\n        Predicate m_predicate;\n    public:\n        template <typename P = Predicate>\n        FilterGenerator(P&& pred, GeneratorWrapper<T>&& generator):\n            m_generator(CATCH_MOVE(generator)),\n            m_predicate(CATCH_FORWARD(pred))\n        {\n            if (!m_predicate(m_generator.get())) {\n                // It might happen that there are no values that pass the\n                // filter. In that case we throw an exception.\n                auto has_initial_value = next();\n                if (!has_initial_value) {\n                    Detail::throw_generator_exception(\"No valid value found in filtered generator\");\n                }\n            }\n        }\n\n        T const& get() const override {\n            return m_generator.get();\n        }\n\n        bool next() override {\n            bool success = m_generator.next();\n            if (!success) {\n                return false;\n            }\n            while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true);\n            return success;\n        }\n    };\n\n\n    template <typename T, typename Predicate>\n    GeneratorWrapper<T> filter(Predicate&& pred, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<T>(Catch::Detail::make_unique<FilterGenerator<T, Predicate>>(CATCH_FORWARD(pred), CATCH_MOVE(generator)));\n    }\n\n    template <typename T>\n    class RepeatGenerator final : public IGenerator<T> {\n        static_assert(!std::is_same<T, bool>::value,\n            \"RepeatGenerator currently does not support bools\"\n            \"because of std::vector<bool> specialization\");\n        GeneratorWrapper<T> m_generator;\n        mutable std::vector<T> m_returned;\n        size_t m_target_repeats;\n        size_t m_current_repeat = 0;\n        size_t m_repeat_index = 0;\n    public:\n        RepeatGenerator(size_t repeats, GeneratorWrapper<T>&& generator):\n            m_generator(CATCH_MOVE(generator)),\n            m_target_repeats(repeats)\n        {\n            assert(m_target_repeats > 0 && \"Repeat generator must repeat at least once\");\n        }\n\n        T const& get() const override {\n            if (m_current_repeat == 0) {\n                m_returned.push_back(m_generator.get());\n                return m_returned.back();\n            }\n            return m_returned[m_repeat_index];\n        }\n\n        bool next() override {\n            // There are 2 basic cases:\n            // 1) We are still reading the generator\n            // 2) We are reading our own cache\n\n            // In the first case, we need to poke the underlying generator.\n            // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache\n            if (m_current_repeat == 0) {\n                const auto success = m_generator.next();\n                if (!success) {\n                    ++m_current_repeat;\n                }\n                return m_current_repeat < m_target_repeats;\n            }\n\n            // In the second case, we need to move indices forward and check that we haven't run up against the end\n            ++m_repeat_index;\n            if (m_repeat_index == m_returned.size()) {\n                m_repeat_index = 0;\n                ++m_current_repeat;\n            }\n            return m_current_repeat < m_target_repeats;\n        }\n    };\n\n    template <typename T>\n    GeneratorWrapper<T> repeat(size_t repeats, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<T>(Catch::Detail::make_unique<RepeatGenerator<T>>(repeats, CATCH_MOVE(generator)));\n    }\n\n    template <typename T, typename U, typename Func>\n    class MapGenerator final : public IGenerator<T> {\n        // TBD: provide static assert for mapping function, for friendly error message\n        GeneratorWrapper<U> m_generator;\n        Func m_function;\n        // To avoid returning dangling reference, we have to save the values\n        T m_cache;\n    public:\n        template <typename F2 = Func>\n        MapGenerator(F2&& function, GeneratorWrapper<U>&& generator) :\n            m_generator(CATCH_MOVE(generator)),\n            m_function(CATCH_FORWARD(function)),\n            m_cache(m_function(m_generator.get()))\n        {}\n\n        T const& get() const override {\n            return m_cache;\n        }\n        bool next() override {\n            const auto success = m_generator.next();\n            if (success) {\n                m_cache = m_function(m_generator.get());\n            }\n            return success;\n        }\n    };\n\n    template <typename Func, typename U, typename T = FunctionReturnType<Func, U>>\n    GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {\n        return GeneratorWrapper<T>(\n            Catch::Detail::make_unique<MapGenerator<T, U, Func>>(CATCH_FORWARD(function), CATCH_MOVE(generator))\n        );\n    }\n\n    template <typename T, typename U, typename Func>\n    GeneratorWrapper<T> map(Func&& function, GeneratorWrapper<U>&& generator) {\n        return GeneratorWrapper<T>(\n            Catch::Detail::make_unique<MapGenerator<T, U, Func>>(CATCH_FORWARD(function), CATCH_MOVE(generator))\n        );\n    }\n\n    template <typename T>\n    class ChunkGenerator final : public IGenerator<std::vector<T>> {\n        std::vector<T> m_chunk;\n        size_t m_chunk_size;\n        GeneratorWrapper<T> m_generator;\n        bool m_used_up = false;\n    public:\n        ChunkGenerator(size_t size, GeneratorWrapper<T> generator) :\n            m_chunk_size(size), m_generator(CATCH_MOVE(generator))\n        {\n            m_chunk.reserve(m_chunk_size);\n            if (m_chunk_size != 0) {\n                m_chunk.push_back(m_generator.get());\n                for (size_t i = 1; i < m_chunk_size; ++i) {\n                    if (!m_generator.next()) {\n                        Detail::throw_generator_exception(\"Not enough values to initialize the first chunk\");\n                    }\n                    m_chunk.push_back(m_generator.get());\n                }\n            }\n        }\n        std::vector<T> const& get() const override {\n            return m_chunk;\n        }\n        bool next() override {\n            m_chunk.clear();\n            for (size_t idx = 0; idx < m_chunk_size; ++idx) {\n                if (!m_generator.next()) {\n                    return false;\n                }\n                m_chunk.push_back(m_generator.get());\n            }\n            return true;\n        }\n    };\n\n    template <typename T>\n    GeneratorWrapper<std::vector<T>> chunk(size_t size, GeneratorWrapper<T>&& generator) {\n        return GeneratorWrapper<std::vector<T>>(\n            Catch::Detail::make_unique<ChunkGenerator<T>>(size, CATCH_MOVE(generator))\n        );\n    }\n\n} // namespace Generators\n} // namespace Catch\n\n\n#endif // CATCH_GENERATORS_ADAPTERS_HPP_INCLUDED\n\n\n#ifndef CATCH_GENERATORS_RANDOM_HPP_INCLUDED\n#define CATCH_GENERATORS_RANDOM_HPP_INCLUDED\n\n\n\n#ifndef CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED\n#define CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED\n\n#include <cstdint>\n\nnamespace Catch {\n\n    // This is a simple implementation of C++11 Uniform Random Number\n    // Generator. It does not provide all operators, because Catch2\n    // does not use it, but it should behave as expected inside stdlib's\n    // distributions.\n    // The implementation is based on the PCG family (http://pcg-random.org)\n    class SimplePcg32 {\n        using state_type = std::uint64_t;\n    public:\n        using result_type = std::uint32_t;\n        static constexpr result_type (min)() {\n            return 0;\n        }\n        static constexpr result_type (max)() {\n            return static_cast<result_type>(-1);\n        }\n\n        // Provide some default initial state for the default constructor\n        SimplePcg32():SimplePcg32(0xed743cc4U) {}\n\n        explicit SimplePcg32(result_type seed_);\n\n        void seed(result_type seed_);\n        void discard(uint64_t skip);\n\n        result_type operator()();\n\n    private:\n        friend bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs);\n        friend bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs);\n\n        // In theory we also need operator<< and operator>>\n        // In practice we do not use them, so we will skip them for now\n\n\n        std::uint64_t m_state;\n        // This part of the state determines which \"stream\" of the numbers\n        // is chosen -- we take it as a constant for Catch2, so we only\n        // need to deal with seeding the main state.\n        // Picked by reading 8 bytes from `/dev/random` :-)\n        static const std::uint64_t s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_RANDOM_NUMBER_GENERATOR_HPP_INCLUDED\n\n\n\n#ifndef CATCH_UNIFORM_INTEGER_DISTRIBUTION_HPP_INCLUDED\n#define CATCH_UNIFORM_INTEGER_DISTRIBUTION_HPP_INCLUDED\n\n\n\n\n#ifndef CATCH_RANDOM_INTEGER_HELPERS_HPP_INCLUDED\n#define CATCH_RANDOM_INTEGER_HELPERS_HPP_INCLUDED\n\n#include <climits>\n#include <cstddef>\n#include <cstdint>\n#include <type_traits>\n\n// Note: We use the usual enable-disable-autodetect dance here even though\n//       we do not support these in CMake configuration options (yet?).\n//       It is highly unlikely that we will need to make these actually\n//       user-configurable, but this will make it simpler if weend up needing\n//       it, and it provides an escape hatch to the users who need it.\n#if defined( __SIZEOF_INT128__ )\n#    define CATCH_CONFIG_INTERNAL_UINT128\n// Unlike GCC, MSVC does not polyfill umul as mulh + mul pair on ARM machines.\n// Currently we do not bother doing this ourselves, but we could if it became\n// important for perf.\n#elif defined( _MSC_VER ) && defined( _M_X64 )\n#    define CATCH_CONFIG_INTERNAL_MSVC_UMUL128\n#endif\n\n#if defined( CATCH_CONFIG_INTERNAL_UINT128 ) && \\\n    !defined( CATCH_CONFIG_NO_UINT128 ) &&      \\\n    !defined( CATCH_CONFIG_UINT128 )\n#define CATCH_CONFIG_UINT128\n#endif\n\n#if defined( CATCH_CONFIG_INTERNAL_MSVC_UMUL128 ) && \\\n    !defined( CATCH_CONFIG_NO_MSVC_UMUL128 ) &&      \\\n    !defined( CATCH_CONFIG_MSVC_UMUL128 )\n#    define CATCH_CONFIG_MSVC_UMUL128\n#    include <intrin.h>\n#endif\n\n\nnamespace Catch {\n    namespace Detail {\n\n        template <std::size_t>\n        struct SizedUnsignedType;\n#define SizedUnsignedTypeHelper( TYPE )        \\\n    template <>                                \\\n    struct SizedUnsignedType<sizeof( TYPE )> { \\\n        using type = TYPE;                     \\\n    }\n\n        SizedUnsignedTypeHelper( std::uint8_t );\n        SizedUnsignedTypeHelper( std::uint16_t );\n        SizedUnsignedTypeHelper( std::uint32_t );\n        SizedUnsignedTypeHelper( std::uint64_t );\n#undef SizedUnsignedTypeHelper\n\n        template <std::size_t sz>\n        using SizedUnsignedType_t = typename SizedUnsignedType<sz>::type;\n\n        template <typename T>\n        using DoubleWidthUnsignedType_t = SizedUnsignedType_t<2 * sizeof( T )>;\n\n        template <typename T>\n        struct ExtendedMultResult {\n            T upper;\n            T lower;\n            constexpr bool operator==( ExtendedMultResult const& rhs ) const {\n                return upper == rhs.upper && lower == rhs.lower;\n            }\n        };\n\n        /**\n         * Returns 128 bit result of lhs * rhs using portable C++ code\n         *\n         * This implementation is almost twice as fast as naive long multiplication,\n         * and unlike intrinsic-based approach, it supports constexpr evaluation.\n         */\n        constexpr ExtendedMultResult<std::uint64_t>\n        extendedMultPortable(std::uint64_t lhs, std::uint64_t rhs) {\n#define CarryBits( x ) ( x >> 32 )\n#define Digits( x ) ( x & 0xFF'FF'FF'FF )\n            std::uint64_t lhs_low = Digits( lhs );\n            std::uint64_t rhs_low = Digits( rhs );\n            std::uint64_t low_low = ( lhs_low * rhs_low );\n            std::uint64_t high_high = CarryBits( lhs ) * CarryBits( rhs );\n\n            // We add in carry bits from low-low already\n            std::uint64_t high_low =\n                ( CarryBits( lhs ) * rhs_low ) + CarryBits( low_low );\n            // Note that we can add only low bits from high_low, to avoid\n            // overflow with large inputs\n            std::uint64_t low_high =\n                ( lhs_low * CarryBits( rhs ) ) + Digits( high_low );\n\n            return { high_high + CarryBits( high_low ) + CarryBits( low_high ),\n                     ( low_high << 32 ) | Digits( low_low ) };\n#undef CarryBits\n#undef Digits\n        }\n\n        //! Returns 128 bit result of lhs * rhs\n        inline ExtendedMultResult<std::uint64_t>\n        extendedMult( std::uint64_t lhs, std::uint64_t rhs ) {\n#if defined( CATCH_CONFIG_UINT128 )\n            auto result = __uint128_t( lhs ) * __uint128_t( rhs );\n            return { static_cast<std::uint64_t>( result >> 64 ),\n                     static_cast<std::uint64_t>( result ) };\n#elif defined( CATCH_CONFIG_MSVC_UMUL128 )\n            std::uint64_t high;\n            std::uint64_t low = _umul128( lhs, rhs, &high );\n            return { high, low };\n#else\n            return extendedMultPortable( lhs, rhs );\n#endif\n        }\n\n\n        template <typename UInt>\n        constexpr ExtendedMultResult<UInt> extendedMult( UInt lhs, UInt rhs ) {\n            static_assert( std::is_unsigned<UInt>::value,\n                           \"extendedMult can only handle unsigned integers\" );\n            static_assert( sizeof( UInt ) < sizeof( std::uint64_t ),\n                           \"Generic extendedMult can only handle types smaller \"\n                           \"than uint64_t\" );\n            using WideType = DoubleWidthUnsignedType_t<UInt>;\n\n            auto result = WideType( lhs ) * WideType( rhs );\n            return {\n                static_cast<UInt>( result >> ( CHAR_BIT * sizeof( UInt ) ) ),\n                static_cast<UInt>( result & UInt( -1 ) ) };\n        }\n\n\n        template <typename TargetType,\n                  typename Generator>\n            std::enable_if_t<sizeof(typename Generator::result_type) >= sizeof(TargetType),\n            TargetType> fillBitsFrom(Generator& gen) {\n            using gresult_type = typename Generator::result_type;\n            static_assert( std::is_unsigned<TargetType>::value, \"Only unsigned integers are supported\" );\n            static_assert( Generator::min() == 0 &&\n                           Generator::max() == static_cast<gresult_type>( -1 ),\n                           \"Generator must be able to output all numbers in its result type (effectively it must be a random bit generator)\" );\n\n            // We want to return the top bits from a generator, as they are\n            // usually considered higher quality.\n            constexpr auto generated_bits = sizeof( gresult_type ) * CHAR_BIT;\n            constexpr auto return_bits = sizeof( TargetType ) * CHAR_BIT;\n\n            return static_cast<TargetType>( gen() >>\n                                            ( generated_bits - return_bits) );\n        }\n\n        template <typename TargetType,\n                  typename Generator>\n            std::enable_if_t<sizeof(typename Generator::result_type) < sizeof(TargetType),\n            TargetType> fillBitsFrom(Generator& gen) {\n            using gresult_type = typename Generator::result_type;\n            static_assert( std::is_unsigned<TargetType>::value,\n                           \"Only unsigned integers are supported\" );\n            static_assert( Generator::min() == 0 &&\n                           Generator::max() == static_cast<gresult_type>( -1 ),\n                           \"Generator must be able to output all numbers in its result type (effectively it must be a random bit generator)\" );\n\n            constexpr auto generated_bits = sizeof( gresult_type ) * CHAR_BIT;\n            constexpr auto return_bits = sizeof( TargetType ) * CHAR_BIT;\n            std::size_t filled_bits = 0;\n            TargetType ret = 0;\n            do {\n                ret <<= generated_bits;\n                ret |= gen();\n                filled_bits += generated_bits;\n            } while ( filled_bits < return_bits );\n\n            return ret;\n        }\n\n        /*\n         * Transposes numbers into unsigned type while keeping their ordering\n         *\n         * This means that signed types are changed so that the ordering is\n         * [INT_MIN, ..., -1, 0, ..., INT_MAX], rather than order we would\n         * get by simple casting ([0, ..., INT_MAX, INT_MIN, ..., -1])\n         */\n        template <typename OriginalType, typename UnsignedType>\n        constexpr\n        std::enable_if_t<std::is_signed<OriginalType>::value, UnsignedType>\n        transposeToNaturalOrder( UnsignedType in ) {\n            static_assert(\n                sizeof( OriginalType ) == sizeof( UnsignedType ),\n                \"reordering requires the same sized types on both sides\" );\n            static_assert( std::is_unsigned<UnsignedType>::value,\n                           \"Input type must be unsigned\" );\n            // Assuming 2s complement (standardized in current C++), the\n            // positive and negative numbers are already internally ordered,\n            // and their difference is in the top bit. Swapping it orders\n            // them the desired way.\n            constexpr auto highest_bit =\n                UnsignedType( 1 ) << ( sizeof( UnsignedType ) * CHAR_BIT - 1 );\n            return static_cast<UnsignedType>( in ^ highest_bit );\n        }\n\n\n\n        template <typename OriginalType,\n                  typename UnsignedType>\n        constexpr\n        std::enable_if_t<std::is_unsigned<OriginalType>::value, UnsignedType>\n            transposeToNaturalOrder(UnsignedType in) {\n            static_assert(\n                sizeof( OriginalType ) == sizeof( UnsignedType ),\n                \"reordering requires the same sized types on both sides\" );\n            static_assert( std::is_unsigned<UnsignedType>::value, \"Input type must be unsigned\" );\n            // No reordering is needed for unsigned -> unsigned\n            return in;\n        }\n    } // namespace Detail\n} // namespace Catch\n\n#endif // CATCH_RANDOM_INTEGER_HELPERS_HPP_INCLUDED\n\nnamespace Catch {\n\n/**\n * Implementation of uniform distribution on integers.\n *\n * Unlike `std::uniform_int_distribution`, this implementation supports\n * various 1 byte integral types, including bool (but you should not\n * actually use it for bools).\n *\n * The underlying algorithm is based on the one described in \"Fast Random\n * Integer Generation in an Interval\" by Daniel Lemire, but has been\n * optimized under the assumption of reuse of the same distribution object.\n */\ntemplate <typename IntegerType>\nclass uniform_integer_distribution {\n    static_assert(std::is_integral<IntegerType>::value, \"...\");\n\n    using UnsignedIntegerType = Detail::SizedUnsignedType_t<sizeof(IntegerType)>;\n\n    // Only the left bound is stored, and we store it converted to its\n    // unsigned image. This avoids having to do the conversions inside\n    // the operator(), at the cost of having to do the conversion in\n    // the a() getter. The right bound is only needed in the b() getter,\n    // so we recompute it there from other stored data.\n    UnsignedIntegerType m_a;\n\n    // How many different values are there in [a, b]. a == b => 1, can be 0 for distribution over all values in the type.\n    UnsignedIntegerType m_ab_distance;\n\n    // We hoisted this out of the main generation function. Technically,\n    // this means that using this distribution will be slower than Lemire's\n    // algorithm if this distribution instance will be used only few times,\n    // but it will be faster if it is used many times. Since Catch2 uses\n    // distributions only to implement random generators, we assume that each\n    // distribution will be reused many times and this is an optimization.\n    UnsignedIntegerType m_rejection_threshold = 0;\n\n    static constexpr UnsignedIntegerType computeDistance(IntegerType a, IntegerType b) {\n        // This overflows and returns 0 if a == 0 and b == TYPE_MAX.\n        // We handle that later when generating the number.\n        return transposeTo(b) - transposeTo(a) + 1;\n    }\n\n    static constexpr UnsignedIntegerType computeRejectionThreshold(UnsignedIntegerType ab_distance) {\n        // distance == 0 means that we will return all possible values from\n        // the type's range, and that we shouldn't reject anything.\n        if ( ab_distance == 0 ) { return 0; }\n        return ( ~ab_distance + 1 ) % ab_distance;\n    }\n\n    static constexpr UnsignedIntegerType transposeTo(IntegerType in) {\n        return Detail::transposeToNaturalOrder<IntegerType>(\n            static_cast<UnsignedIntegerType>( in ) );\n    }\n    static constexpr IntegerType transposeBack(UnsignedIntegerType in) {\n        return static_cast<IntegerType>(\n            Detail::transposeToNaturalOrder<IntegerType>(in) );\n    }\n\npublic:\n    using result_type = IntegerType;\n\n    constexpr uniform_integer_distribution( IntegerType a, IntegerType b ):\n        m_a( transposeTo(a) ),\n        m_ab_distance( computeDistance(a, b) ),\n        m_rejection_threshold( computeRejectionThreshold(m_ab_distance) ) {\n        assert( a <= b );\n    }\n\n    template <typename Generator>\n    constexpr result_type operator()( Generator& g ) {\n        // All possible values of result_type are valid.\n        if ( m_ab_distance == 0 ) {\n            return transposeBack( Detail::fillBitsFrom<UnsignedIntegerType>( g ) );\n        }\n\n        auto random_number = Detail::fillBitsFrom<UnsignedIntegerType>( g );\n        auto emul = Detail::extendedMult( random_number, m_ab_distance );\n        // Unlike Lemire's algorithm we skip the ab_distance check, since\n        // we precomputed the rejection threshold, which is always tighter.\n        while (emul.lower < m_rejection_threshold) {\n            random_number = Detail::fillBitsFrom<UnsignedIntegerType>( g );\n            emul = Detail::extendedMult( random_number, m_ab_distance );\n        }\n\n        return transposeBack(m_a + emul.upper);\n    }\n\n    constexpr result_type a() const { return transposeBack(m_a); }\n    constexpr result_type b() const { return transposeBack(m_ab_distance + m_a - 1); }\n};\n\n} // end namespace Catch\n\n#endif // CATCH_UNIFORM_INTEGER_DISTRIBUTION_HPP_INCLUDED\n\n\n\n#ifndef CATCH_UNIFORM_FLOATING_POINT_DISTRIBUTION_HPP_INCLUDED\n#define CATCH_UNIFORM_FLOATING_POINT_DISTRIBUTION_HPP_INCLUDED\n\n\n\n\n#ifndef CATCH_RANDOM_FLOATING_POINT_HELPERS_HPP_INCLUDED\n#define CATCH_RANDOM_FLOATING_POINT_HELPERS_HPP_INCLUDED\n\n\n\n#ifndef CATCH_POLYFILLS_HPP_INCLUDED\n#define CATCH_POLYFILLS_HPP_INCLUDED\n\nnamespace Catch {\n\n    bool isnan(float f);\n    bool isnan(double d);\n\n    float nextafter(float x, float y);\n    double nextafter(double x, double y);\n\n}\n\n#endif // CATCH_POLYFILLS_HPP_INCLUDED\n\n#include <cassert>\n#include <cmath>\n#include <cstdint>\n#include <limits>\n#include <type_traits>\n\nnamespace Catch {\n\n    namespace Detail {\n        /**\n         * Returns the largest magnitude of 1-ULP distance inside the [a, b] range.\n         *\n         * Assumes `a < b`.\n         */\n        template <typename FloatType>\n        FloatType gamma(FloatType a, FloatType b) {\n            static_assert( std::is_floating_point<FloatType>::value,\n                           \"gamma returns the largest ULP magnitude within \"\n                           \"floating point range [a, b]. This only makes sense \"\n                           \"for floating point types\" );\n            assert( a <= b );\n\n            const auto gamma_up = Catch::nextafter( a, std::numeric_limits<FloatType>::infinity() ) - a;\n            const auto gamma_down = b - Catch::nextafter( b, -std::numeric_limits<FloatType>::infinity() );\n\n            return gamma_up < gamma_down ? gamma_down : gamma_up;\n        }\n\n        template <typename FloatingPoint>\n        struct DistanceTypePicker;\n        template <>\n        struct DistanceTypePicker<float> {\n            using type = std::uint32_t;\n        };\n        template <>\n        struct DistanceTypePicker<double> {\n            using type = std::uint64_t;\n        };\n\n        template <typename T>\n        using DistanceType = typename DistanceTypePicker<T>::type;\n\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n        /**\n         * Computes the number of equi-distant floats in [a, b]\n         *\n         * Since not every range can be split into equidistant floats\n         * exactly, we actually compute ceil(b/distance - a/distance),\n         * because in those cases we want to overcount.\n         *\n         * Uses modified Dekker's FastTwoSum algorithm to handle rounding.\n         */\n        template <typename FloatType>\n        DistanceType<FloatType>\n        count_equidistant_floats( FloatType a, FloatType b, FloatType distance ) {\n            assert( a <= b );\n            // We get distance as gamma for our uniform float distribution,\n            // so this will round perfectly.\n            const auto ag = a / distance;\n            const auto bg = b / distance;\n\n            const auto s = bg - ag;\n            const auto err = ( std::fabs( a ) <= std::fabs( b ) )\n                                 ? -ag - ( s - bg )\n                                 : bg - ( s + ag );\n            const auto ceil_s = static_cast<DistanceType<FloatType>>( std::ceil( s ) );\n\n            return ( ceil_s != s ) ? ceil_s : ceil_s + ( err > 0 );\n        }\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic pop\n#endif\n\n    }\n\n} // end namespace Catch\n\n#endif // CATCH_RANDOM_FLOATING_POINT_HELPERS_HPP_INCLUDED\n\n#include <cmath>\n#include <type_traits>\n\nnamespace Catch {\n\n    namespace Detail {\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n        // The issue with overflow only happens with maximal ULP and HUGE\n        // distance, e.g. when generating numbers in [-inf, inf] for given\n        // type. So we only check for the largest possible ULP in the\n        // type, and return something that does not overflow to inf in 1 mult.\n        constexpr std::uint64_t calculate_max_steps_in_one_go(double gamma) {\n            if ( gamma == 1.99584030953472e+292 ) { return 9007199254740991; }\n            return static_cast<std::uint64_t>( -1 );\n        }\n        constexpr std::uint32_t calculate_max_steps_in_one_go(float gamma) {\n            if ( gamma == 2.028241e+31f ) { return 16777215; }\n            return static_cast<std::uint32_t>( -1 );\n        }\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic pop\n#endif\n    }\n\n/**\n * Implementation of uniform distribution on floating point numbers.\n *\n * Note that we support only `float` and `double` types, because these\n * usually mean the same thing across different platform. `long double`\n * varies wildly by platform and thus we cannot provide reproducible\n * implementation. Also note that we don't implement all parts of\n * distribution per standard: this distribution is not serializable, nor\n * can the range be arbitrarily reset.\n *\n * The implementation also uses different approach than the one taken by\n * `std::uniform_real_distribution`, where instead of generating a number\n * between [0, 1) and then multiplying the range bounds with it, we first\n * split the [a, b] range into a set of equidistributed floating point\n * numbers, and then use uniform int distribution to pick which one to\n * return.\n *\n * This has the advantage of guaranteeing uniformity (the multiplication\n * method loses uniformity due to rounding when multiplying floats), except\n * for small non-uniformity at one side of the interval, where we have\n * to deal with the fact that not every interval is splittable into\n * equidistributed floats.\n *\n * Based on \"Drawing random floating-point numbers from an interval\" by\n * Frederic Goualard.\n */\ntemplate <typename FloatType>\nclass uniform_floating_point_distribution {\n    static_assert(std::is_floating_point<FloatType>::value, \"...\");\n    static_assert(!std::is_same<FloatType, long double>::value,\n                  \"We do not support long double due to inconsistent behaviour between platforms\");\n\n    using WidthType = Detail::DistanceType<FloatType>;\n\n    FloatType m_a, m_b;\n    FloatType m_ulp_magnitude;\n    WidthType m_floats_in_range;\n    uniform_integer_distribution<WidthType> m_int_dist;\n\n    // In specific cases, we can overflow into `inf` when computing the\n    // `steps * g` offset. To avoid this, we don't offset by more than this\n    // in one multiply + addition.\n    WidthType m_max_steps_in_one_go;\n    // We don't want to do the magnitude check every call to `operator()`\n    bool m_a_has_leq_magnitude;\n\npublic:\n    using result_type = FloatType;\n\n    uniform_floating_point_distribution( FloatType a, FloatType b ):\n        m_a( a ),\n        m_b( b ),\n        m_ulp_magnitude( Detail::gamma( m_a, m_b ) ),\n        m_floats_in_range( Detail::count_equidistant_floats( m_a, m_b, m_ulp_magnitude ) ),\n        m_int_dist(0, m_floats_in_range),\n        m_max_steps_in_one_go( Detail::calculate_max_steps_in_one_go(m_ulp_magnitude)),\n        m_a_has_leq_magnitude(std::fabs(m_a) <= std::fabs(m_b))\n    {\n        assert( a <= b );\n    }\n\n    template <typename Generator>\n    result_type operator()( Generator& g ) {\n        WidthType steps = m_int_dist( g );\n        if ( m_a_has_leq_magnitude ) {\n            if ( steps == m_floats_in_range ) { return m_a; }\n            auto b = m_b;\n            while (steps > m_max_steps_in_one_go) {\n                b -= m_max_steps_in_one_go * m_ulp_magnitude;\n                steps -= m_max_steps_in_one_go;\n            }\n            return b - steps * m_ulp_magnitude;\n        } else {\n            if ( steps == m_floats_in_range ) { return m_b; }\n            auto a = m_a;\n            while (steps > m_max_steps_in_one_go) {\n                a += m_max_steps_in_one_go * m_ulp_magnitude;\n                steps -= m_max_steps_in_one_go;\n            }\n            return a + steps * m_ulp_magnitude;\n        }\n    }\n\n    result_type a() const { return m_a; }\n    result_type b() const { return m_b; }\n};\n\n} // end namespace Catch\n\n#endif // CATCH_UNIFORM_FLOATING_POINT_DISTRIBUTION_HPP_INCLUDED\n\nnamespace Catch {\nnamespace Generators {\nnamespace Detail {\n    // Returns a suitable seed for a random floating generator based off\n    // the primary internal rng. It does so by taking current value from\n    // the rng and returning it as the seed.\n    std::uint32_t getSeed();\n}\n\ntemplate <typename Float>\nclass RandomFloatingGenerator final : public IGenerator<Float> {\n    Catch::SimplePcg32 m_rng;\n    Catch::uniform_floating_point_distribution<Float> m_dist;\n    Float m_current_number;\npublic:\n    RandomFloatingGenerator( Float a, Float b, std::uint32_t seed ):\n        m_rng(seed),\n        m_dist(a, b) {\n        static_cast<void>(next());\n    }\n\n    Float const& get() const override {\n        return m_current_number;\n    }\n    bool next() override {\n        m_current_number = m_dist(m_rng);\n        return true;\n    }\n};\n\ntemplate <>\nclass RandomFloatingGenerator<long double> final : public IGenerator<long double> {\n    // We still rely on <random> for this specialization, but we don't\n    // want to drag it into the header.\n    struct PImpl;\n    Catch::Detail::unique_ptr<PImpl> m_pimpl;\n    long double m_current_number;\n\npublic:\n    RandomFloatingGenerator( long double a, long double b, std::uint32_t seed );\n\n    long double const& get() const override { return m_current_number; }\n    bool next() override;\n\n    ~RandomFloatingGenerator() override; // = default\n};\n\ntemplate <typename Integer>\nclass RandomIntegerGenerator final : public IGenerator<Integer> {\n    Catch::SimplePcg32 m_rng;\n    Catch::uniform_integer_distribution<Integer> m_dist;\n    Integer m_current_number;\npublic:\n    RandomIntegerGenerator( Integer a, Integer b, std::uint32_t seed ):\n        m_rng(seed),\n        m_dist(a, b) {\n        static_cast<void>(next());\n    }\n\n    Integer const& get() const override {\n        return m_current_number;\n    }\n    bool next() override {\n        m_current_number = m_dist(m_rng);\n        return true;\n    }\n};\n\ntemplate <typename T>\nstd::enable_if_t<std::is_integral<T>::value, GeneratorWrapper<T>>\nrandom(T a, T b) {\n    return GeneratorWrapper<T>(\n        Catch::Detail::make_unique<RandomIntegerGenerator<T>>(a, b, Detail::getSeed())\n    );\n}\n\ntemplate <typename T>\nstd::enable_if_t<std::is_floating_point<T>::value,\nGeneratorWrapper<T>>\nrandom(T a, T b) {\n    return GeneratorWrapper<T>(\n        Catch::Detail::make_unique<RandomFloatingGenerator<T>>(a, b, Detail::getSeed())\n    );\n}\n\n\n} // namespace Generators\n} // namespace Catch\n\n\n#endif // CATCH_GENERATORS_RANDOM_HPP_INCLUDED\n\n\n#ifndef CATCH_GENERATORS_RANGE_HPP_INCLUDED\n#define CATCH_GENERATORS_RANGE_HPP_INCLUDED\n\n\n#include <iterator>\n#include <type_traits>\n\nnamespace Catch {\nnamespace Generators {\n\n\ntemplate <typename T>\nclass RangeGenerator final : public IGenerator<T> {\n    T m_current;\n    T m_end;\n    T m_step;\n    bool m_positive;\n\npublic:\n    RangeGenerator(T const& start, T const& end, T const& step):\n        m_current(start),\n        m_end(end),\n        m_step(step),\n        m_positive(m_step > T(0))\n    {\n        assert(m_current != m_end && \"Range start and end cannot be equal\");\n        assert(m_step != T(0) && \"Step size cannot be zero\");\n        assert(((m_positive && m_current <= m_end) || (!m_positive && m_current >= m_end)) && \"Step moves away from end\");\n    }\n\n    RangeGenerator(T const& start, T const& end):\n        RangeGenerator(start, end, (start < end) ? T(1) : T(-1))\n    {}\n\n    T const& get() const override {\n        return m_current;\n    }\n\n    bool next() override {\n        m_current += m_step;\n        return (m_positive) ? (m_current < m_end) : (m_current > m_end);\n    }\n};\n\ntemplate <typename T>\nGeneratorWrapper<T> range(T const& start, T const& end, T const& step) {\n    static_assert(std::is_arithmetic<T>::value && !std::is_same<T, bool>::value, \"Type must be numeric\");\n    return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end, step));\n}\n\ntemplate <typename T>\nGeneratorWrapper<T> range(T const& start, T const& end) {\n    static_assert(std::is_integral<T>::value && !std::is_same<T, bool>::value, \"Type must be an integer\");\n    return GeneratorWrapper<T>(Catch::Detail::make_unique<RangeGenerator<T>>(start, end));\n}\n\n\ntemplate <typename T>\nclass IteratorGenerator final : public IGenerator<T> {\n    static_assert(!std::is_same<T, bool>::value,\n        \"IteratorGenerator currently does not support bools\"\n        \"because of std::vector<bool> specialization\");\n\n    std::vector<T> m_elems;\n    size_t m_current = 0;\npublic:\n    template <typename InputIterator, typename InputSentinel>\n    IteratorGenerator(InputIterator first, InputSentinel last):m_elems(first, last) {\n        if (m_elems.empty()) {\n            Detail::throw_generator_exception(\"IteratorGenerator received no valid values\");\n        }\n    }\n\n    T const& get() const override {\n        return m_elems[m_current];\n    }\n\n    bool next() override {\n        ++m_current;\n        return m_current != m_elems.size();\n    }\n};\n\ntemplate <typename InputIterator,\n          typename InputSentinel,\n          typename ResultType = typename std::iterator_traits<InputIterator>::value_type>\nGeneratorWrapper<ResultType> from_range(InputIterator from, InputSentinel to) {\n    return GeneratorWrapper<ResultType>(Catch::Detail::make_unique<IteratorGenerator<ResultType>>(from, to));\n}\n\ntemplate <typename Container>\nauto from_range(Container const& cnt) {\n    using std::begin;\n    using std::end;\n    return from_range( begin( cnt ), end( cnt ) );\n}\n\n\n} // namespace Generators\n} // namespace Catch\n\n\n#endif // CATCH_GENERATORS_RANGE_HPP_INCLUDED\n\n#endif // CATCH_GENERATORS_ALL_HPP_INCLUDED\n\n\n/** \\file\n * This is a convenience header for Catch2's interfaces. It includes\n * **all** of Catch2 headers related to interfaces.\n *\n * Generally the Catch2 users should use specific includes they need,\n * but this header can be used instead for ease-of-experimentation, or\n * just plain convenience, at the cost of somewhat increased compilation\n * times.\n *\n * When a new header is added to either the `interfaces` folder, or to\n * the corresponding internal subfolder, it should be added here.\n */\n\n\n#ifndef CATCH_INTERFACES_ALL_HPP_INCLUDED\n#define CATCH_INTERFACES_ALL_HPP_INCLUDED\n\n\n\n#ifndef CATCH_INTERFACES_REPORTER_HPP_INCLUDED\n#define CATCH_INTERFACES_REPORTER_HPP_INCLUDED\n\n\n\n#ifndef CATCH_TEST_RUN_INFO_HPP_INCLUDED\n#define CATCH_TEST_RUN_INFO_HPP_INCLUDED\n\n\nnamespace Catch {\n\n    struct TestRunInfo {\n        constexpr TestRunInfo(StringRef _name) : name(_name) {}\n        StringRef name;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_TEST_RUN_INFO_HPP_INCLUDED\n\n#include <map>\n#include <string>\n#include <vector>\n#include <iosfwd>\n\nnamespace Catch {\n\n    struct ReporterDescription;\n    struct ListenerDescription;\n    struct TagInfo;\n    struct TestCaseInfo;\n    class TestCaseHandle;\n    class IConfig;\n    class IStream;\n    enum class ColourMode : std::uint8_t;\n\n    struct ReporterConfig {\n        ReporterConfig( IConfig const* _fullConfig,\n                        Detail::unique_ptr<IStream> _stream,\n                        ColourMode colourMode,\n                        std::map<std::string, std::string> customOptions );\n\n        ReporterConfig( ReporterConfig&& ) = default;\n        ReporterConfig& operator=( ReporterConfig&& ) = default;\n        ~ReporterConfig(); // = default\n\n        Detail::unique_ptr<IStream> takeStream() &&;\n        IConfig const* fullConfig() const;\n        ColourMode colourMode() const;\n        std::map<std::string, std::string> const& customOptions() const;\n\n    private:\n        Detail::unique_ptr<IStream> m_stream;\n        IConfig const* m_fullConfig;\n        ColourMode m_colourMode;\n        std::map<std::string, std::string> m_customOptions;\n    };\n\n    struct AssertionStats {\n        AssertionStats( AssertionResult const& _assertionResult,\n                        std::vector<MessageInfo> const& _infoMessages,\n                        Totals const& _totals );\n\n        AssertionStats( AssertionStats const& )              = default;\n        AssertionStats( AssertionStats && )                  = default;\n        AssertionStats& operator = ( AssertionStats const& ) = delete;\n        AssertionStats& operator = ( AssertionStats && )     = delete;\n\n        AssertionResult assertionResult;\n        std::vector<MessageInfo> infoMessages;\n        Totals totals;\n    };\n\n    struct SectionStats {\n        SectionStats(   SectionInfo&& _sectionInfo,\n                        Counts const& _assertions,\n                        double _durationInSeconds,\n                        bool _missingAssertions );\n\n        SectionInfo sectionInfo;\n        Counts assertions;\n        double durationInSeconds;\n        bool missingAssertions;\n    };\n\n    struct TestCaseStats {\n        TestCaseStats(  TestCaseInfo const& _testInfo,\n                        Totals const& _totals,\n                        std::string&& _stdOut,\n                        std::string&& _stdErr,\n                        bool _aborting );\n\n        TestCaseInfo const * testInfo;\n        Totals totals;\n        std::string stdOut;\n        std::string stdErr;\n        bool aborting;\n    };\n\n    struct TestRunStats {\n        TestRunStats(   TestRunInfo const& _runInfo,\n                        Totals const& _totals,\n                        bool _aborting );\n\n        TestRunInfo runInfo;\n        Totals totals;\n        bool aborting;\n    };\n\n    //! By setting up its preferences, a reporter can modify Catch2's behaviour\n    //! in some regards, e.g. it can request Catch2 to capture writes to\n    //! stdout/stderr during test execution, and pass them to the reporter.\n    struct ReporterPreferences {\n        //! Catch2 should redirect writes to stdout and pass them to the\n        //! reporter\n        bool shouldRedirectStdOut = false;\n        //! Catch2 should call `Reporter::assertionEnded` even for passing\n        //! assertions\n        bool shouldReportAllAssertions = false;\n    };\n\n    /**\n     * The common base for all reporters and event listeners\n     *\n     * Implementing classes must also implement:\n     *\n     *     //! User-friendly description of the reporter/listener type\n     *     static std::string getDescription()\n     *\n     * Generally shouldn't be derived from by users of Catch2 directly,\n     * instead they should derive from one of the utility bases that\n     * derive from this class.\n     */\n    class IEventListener {\n    protected:\n        //! Derived classes can set up their preferences here\n        ReporterPreferences m_preferences;\n        //! The test run's config as filled in from CLI and defaults\n        IConfig const* m_config;\n\n    public:\n        IEventListener( IConfig const* config ): m_config( config ) {}\n\n        virtual ~IEventListener(); // = default;\n\n        // Implementing class must also provide the following static methods:\n        // static std::string getDescription();\n\n        ReporterPreferences const& getPreferences() const {\n            return m_preferences;\n        }\n\n        //! Called when no test cases match provided test spec\n        virtual void noMatchingTestCases( StringRef unmatchedSpec ) = 0;\n        //! Called for all invalid test specs from the cli\n        virtual void reportInvalidTestSpec( StringRef invalidArgument ) = 0;\n\n        /**\n         * Called once in a testing run before tests are started\n         *\n         * Not called if tests won't be run (e.g. only listing will happen)\n         */\n        virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0;\n\n        //! Called _once_ for each TEST_CASE, no matter how many times it is entered\n        virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0;\n        //! Called _every time_ a TEST_CASE is entered, including repeats (due to sections)\n        virtual void testCasePartialStarting( TestCaseInfo const& testInfo, uint64_t partNumber ) = 0;\n        //! Called when a `SECTION` is being entered. Not called for skipped sections\n        virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0;\n\n        //! Called when user-code is being probed before the actual benchmark runs\n        virtual void benchmarkPreparing( StringRef benchmarkName ) = 0;\n        //! Called after probe but before the user-code is being benchmarked\n        virtual void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) = 0;\n        //! Called with the benchmark results if benchmark successfully finishes\n        virtual void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) = 0;\n        //! Called if running the benchmarks fails for any reason\n        virtual void benchmarkFailed( StringRef benchmarkName ) = 0;\n\n        //! Called before assertion success/failure is evaluated\n        virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0;\n\n        //! Called after assertion was fully evaluated\n        virtual void assertionEnded( AssertionStats const& assertionStats ) = 0;\n\n        //! Called after a `SECTION` has finished running\n        virtual void sectionEnded( SectionStats const& sectionStats ) = 0;\n        //! Called _every time_ a TEST_CASE is entered, including repeats (due to sections)\n        virtual void testCasePartialEnded(TestCaseStats const& testCaseStats, uint64_t partNumber ) = 0;\n        //! Called _once_ for each TEST_CASE, no matter how many times it is entered\n        virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;\n        /**\n         * Called once after all tests in a testing run are finished\n         *\n         * Not called if tests weren't run (e.g. only listings happened)\n         */\n        virtual void testRunEnded( TestRunStats const& testRunStats ) = 0;\n\n        /**\n         * Called with test cases that are skipped due to the test run aborting.\n         * NOT called for test cases that are explicitly skipped using the `SKIP` macro.\n         *\n         * Deprecated - will be removed in the next major release.\n         */\n        virtual void skipTest( TestCaseInfo const& testInfo ) = 0;\n\n        //! Called if a fatal error (signal/structured exception) occurred\n        virtual void fatalErrorEncountered( StringRef error ) = 0;\n\n        //! Writes out information about provided reporters using reporter-specific format\n        virtual void listReporters(std::vector<ReporterDescription> const& descriptions) = 0;\n        //! Writes out the provided listeners descriptions using reporter-specific format\n        virtual void listListeners(std::vector<ListenerDescription> const& descriptions) = 0;\n        //! Writes out information about provided tests using reporter-specific format\n        virtual void listTests(std::vector<TestCaseHandle> const& tests) = 0;\n        //! Writes out information about the provided tags using reporter-specific format\n        virtual void listTags(std::vector<TagInfo> const& tags) = 0;\n    };\n    using IEventListenerPtr = Detail::unique_ptr<IEventListener>;\n\n} // end namespace Catch\n\n#endif // CATCH_INTERFACES_REPORTER_HPP_INCLUDED\n\n\n#ifndef CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED\n#define CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\n\n    struct ReporterConfig;\n    class IConfig;\n    class IEventListener;\n    using IEventListenerPtr = Detail::unique_ptr<IEventListener>;\n\n\n    class IReporterFactory {\n    public:\n        virtual ~IReporterFactory(); // = default\n\n        virtual IEventListenerPtr\n        create( ReporterConfig&& config ) const = 0;\n        virtual std::string getDescription() const = 0;\n    };\n    using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;\n\n    class EventListenerFactory {\n    public:\n        virtual ~EventListenerFactory(); // = default\n        virtual IEventListenerPtr create( IConfig const* config ) const = 0;\n        //! Return a meaningful name for the listener, e.g. its type name\n        virtual StringRef getName() const = 0;\n        //! Return listener's description if available\n        virtual std::string getDescription() const = 0;\n    };\n} // namespace Catch\n\n#endif // CATCH_INTERFACES_REPORTER_FACTORY_HPP_INCLUDED\n\n\n#ifndef CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED\n#define CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED\n\n#include <string>\n\nnamespace Catch {\n\n    struct TagAlias;\n\n    class ITagAliasRegistry {\n    public:\n        virtual ~ITagAliasRegistry(); // = default\n        // Nullptr if not present\n        virtual TagAlias const* find( std::string const& alias ) const = 0;\n        virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0;\n\n        static ITagAliasRegistry const& get();\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_INTERFACES_TAG_ALIAS_REGISTRY_HPP_INCLUDED\n\n\n#ifndef CATCH_INTERFACES_TESTCASE_HPP_INCLUDED\n#define CATCH_INTERFACES_TESTCASE_HPP_INCLUDED\n\n#include <vector>\n\nnamespace Catch {\n\n    struct TestCaseInfo;\n    class TestCaseHandle;\n    class IConfig;\n\n    class ITestCaseRegistry {\n    public:\n        virtual ~ITestCaseRegistry(); // = default\n        // TODO: this exists only for adding filenames to test cases -- let's expose this in a saner way later\n        virtual std::vector<TestCaseInfo* > const& getAllInfos() const = 0;\n        virtual std::vector<TestCaseHandle> const& getAllTests() const = 0;\n        virtual std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const = 0;\n    };\n\n}\n\n#endif // CATCH_INTERFACES_TESTCASE_HPP_INCLUDED\n\n#endif // CATCH_INTERFACES_ALL_HPP_INCLUDED\n\n\n#ifndef CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED\n#define CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED\n\n\nnamespace Catch {\n    namespace Detail {\n        //! Provides case-insensitive `op<` semantics when called\n        struct CaseInsensitiveLess {\n            bool operator()( StringRef lhs,\n                             StringRef rhs ) const;\n        };\n\n        //! Provides case-insensitive `op==` semantics when called\n        struct CaseInsensitiveEqualTo {\n            bool operator()( StringRef lhs,\n                             StringRef rhs ) const;\n        };\n\n    } // namespace Detail\n} // namespace Catch\n\n#endif // CATCH_CASE_INSENSITIVE_COMPARISONS_HPP_INCLUDED\n\n\n\n/** \\file\n * Wrapper for ANDROID_LOGWRITE configuration option\n *\n * We want to default to enabling it when compiled for android, but\n * users of the library should also be able to disable it if they want\n * to.\n */\n\n#ifndef CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED\n#define CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED\n\n\n#if defined(__ANDROID__)\n#    define CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE\n#endif\n\n\n#if defined( CATCH_INTERNAL_CONFIG_ANDROID_LOGWRITE ) && \\\n    !defined( CATCH_CONFIG_NO_ANDROID_LOGWRITE ) &&      \\\n    !defined( CATCH_CONFIG_ANDROID_LOGWRITE )\n#    define CATCH_CONFIG_ANDROID_LOGWRITE\n#endif\n\n#endif // CATCH_CONFIG_ANDROID_LOGWRITE_HPP_INCLUDED\n\n\n\n/** \\file\n * Wrapper for UNCAUGHT_EXCEPTIONS configuration option\n *\n * For some functionality, Catch2 requires to know whether there is\n * an active exception. Because `std::uncaught_exception` is deprecated\n * in C++17, we want to use `std::uncaught_exceptions` if possible.\n */\n\n#ifndef CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED\n#define CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED\n\n\n#if defined(_MSC_VER)\n#  if _MSC_VER >= 1900 // Visual Studio 2015 or newer\n#    define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS\n#  endif\n#endif\n\n\n#include <exception>\n\n#if defined(__cpp_lib_uncaught_exceptions) \\\n    && !defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)\n\n#  define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS\n#endif // __cpp_lib_uncaught_exceptions\n\n\n#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) \\\n    && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) \\\n    && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS)\n\n#  define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS\n#endif\n\n\n#endif // CATCH_CONFIG_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED\n\n\n#ifndef CATCH_CONSOLE_COLOUR_HPP_INCLUDED\n#define CATCH_CONSOLE_COLOUR_HPP_INCLUDED\n\n\n#include <iosfwd>\n#include <cstdint>\n\nnamespace Catch {\n\n    enum class ColourMode : std::uint8_t;\n    class IStream;\n\n    struct Colour {\n        enum Code {\n            None = 0,\n\n            White,\n            Red,\n            Green,\n            Blue,\n            Cyan,\n            Yellow,\n            Grey,\n\n            Bright = 0x10,\n\n            BrightRed = Bright | Red,\n            BrightGreen = Bright | Green,\n            LightGrey = Bright | Grey,\n            BrightWhite = Bright | White,\n            BrightYellow = Bright | Yellow,\n\n            // By intention\n            FileName = LightGrey,\n            Warning = BrightYellow,\n            ResultError = BrightRed,\n            ResultSuccess = BrightGreen,\n            ResultExpectedFailure = Warning,\n\n            Error = BrightRed,\n            Success = Green,\n            Skip = LightGrey,\n\n            OriginalExpression = Cyan,\n            ReconstructedExpression = BrightYellow,\n\n            SecondaryText = LightGrey,\n            Headers = White\n        };\n    };\n\n    class ColourImpl {\n    protected:\n        //! The associated stream of this ColourImpl instance\n        IStream* m_stream;\n    public:\n        ColourImpl( IStream* stream ): m_stream( stream ) {}\n\n        //! RAII wrapper around writing specific colour of text using specific\n        //! colour impl into a stream.\n        class ColourGuard {\n            ColourImpl const* m_colourImpl;\n            Colour::Code m_code;\n            bool m_engaged = false;\n\n        public:\n            //! Does **not** engage the guard/start the colour\n            ColourGuard( Colour::Code code,\n                         ColourImpl const* colour );\n\n            ColourGuard( ColourGuard const& rhs ) = delete;\n            ColourGuard& operator=( ColourGuard const& rhs ) = delete;\n\n            ColourGuard( ColourGuard&& rhs ) noexcept;\n            ColourGuard& operator=( ColourGuard&& rhs ) noexcept;\n\n            //! Removes colour _if_ the guard was engaged\n            ~ColourGuard();\n\n            /**\n             * Explicitly engages colour for given stream.\n             *\n             * The API based on operator<< should be preferred.\n             */\n            ColourGuard& engage( std::ostream& stream ) &;\n            /**\n             * Explicitly engages colour for given stream.\n             *\n             * The API based on operator<< should be preferred.\n             */\n            ColourGuard&& engage( std::ostream& stream ) &&;\n\n        private:\n            //! Engages the guard and starts using colour\n            friend std::ostream& operator<<( std::ostream& lhs,\n                                             ColourGuard& guard ) {\n                guard.engageImpl( lhs );\n                return lhs;\n            }\n            //! Engages the guard and starts using colour\n            friend std::ostream& operator<<( std::ostream& lhs,\n                                            ColourGuard&& guard) {\n                guard.engageImpl( lhs );\n                return lhs;\n            }\n\n            void engageImpl( std::ostream& stream );\n\n        };\n\n        virtual ~ColourImpl(); // = default\n        /**\n         * Creates a guard object for given colour and this colour impl\n         *\n         * **Important:**\n         * the guard starts disengaged, and has to be engaged explicitly.\n         */\n        ColourGuard guardColour( Colour::Code colourCode );\n\n    private:\n        virtual void use( Colour::Code colourCode ) const = 0;\n    };\n\n    //! Provides ColourImpl based on global config and target compilation platform\n    Detail::unique_ptr<ColourImpl> makeColourImpl( ColourMode colourSelection,\n                                                   IStream* stream );\n\n    //! Checks if specific colour impl has been compiled into the binary\n    bool isColourImplAvailable( ColourMode colourSelection );\n\n} // end namespace Catch\n\n#endif // CATCH_CONSOLE_COLOUR_HPP_INCLUDED\n\n\n#ifndef CATCH_CONSOLE_WIDTH_HPP_INCLUDED\n#define CATCH_CONSOLE_WIDTH_HPP_INCLUDED\n\n// This include must be kept so that user's configured value for CONSOLE_WIDTH\n// is used before we attempt to provide a default value\n\n#ifndef CATCH_CONFIG_CONSOLE_WIDTH\n#define CATCH_CONFIG_CONSOLE_WIDTH 80\n#endif\n\n#endif // CATCH_CONSOLE_WIDTH_HPP_INCLUDED\n\n\n#ifndef CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED\n#define CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED\n\n\n#include <cstddef>\n#include <initializer_list>\n\n// We want a simple polyfill over `std::empty`, `std::size` and so on\n// for C++14 or C++ libraries with incomplete support.\n// We also have to handle that MSVC std lib will happily provide these\n// under older standards.\n#if defined(CATCH_CPP17_OR_GREATER) || defined(_MSC_VER)\n\n// We are already using this header either way, so there shouldn't\n// be much additional overhead in including it to get the feature\n// test macros\n#include <string>\n\n#  if !defined(__cpp_lib_nonmember_container_access)\n#      define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS\n#  endif\n\n#else\n#define CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS\n#endif\n\n\n\nnamespace Catch {\nnamespace Detail {\n\n#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS)\n    template <typename Container>\n    constexpr auto empty(Container const& cont) -> decltype(cont.empty()) {\n        return cont.empty();\n    }\n    template <typename T, std::size_t N>\n    constexpr bool empty(const T (&)[N]) noexcept {\n        // GCC < 7 does not support the const T(&)[] parameter syntax\n        // so we have to ignore the length explicitly\n        (void)N;\n        return false;\n    }\n    template <typename T>\n    constexpr bool empty(std::initializer_list<T> list) noexcept {\n        return list.size() > 0;\n    }\n\n\n    template <typename Container>\n    constexpr auto size(Container const& cont) -> decltype(cont.size()) {\n        return cont.size();\n    }\n    template <typename T, std::size_t N>\n    constexpr std::size_t size(const T(&)[N]) noexcept {\n        return N;\n    }\n#endif // CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS\n\n} // end namespace Detail\n} // end namespace Catch\n\n\n\n#endif // CATCH_CONTAINER_NONMEMBERS_HPP_INCLUDED\n\n\n#ifndef CATCH_DEBUG_CONSOLE_HPP_INCLUDED\n#define CATCH_DEBUG_CONSOLE_HPP_INCLUDED\n\n#include <string>\n\nnamespace Catch {\n    void writeToDebugConsole( std::string const& text );\n}\n\n#endif // CATCH_DEBUG_CONSOLE_HPP_INCLUDED\n\n\n#ifndef CATCH_DEBUGGER_HPP_INCLUDED\n#define CATCH_DEBUGGER_HPP_INCLUDED\n\n\nnamespace Catch {\n    bool isDebuggerActive();\n}\n\n#ifdef CATCH_PLATFORM_MAC\n\n    #if defined(__i386__) || defined(__x86_64__)\n        #define CATCH_TRAP() __asm__(\"int $3\\n\" : : ) /* NOLINT */\n    #elif defined(__aarch64__)\n        #define CATCH_TRAP() __asm__(\".inst 0xd43e0000\")\n    #elif defined(__POWERPC__)\n        #define CATCH_TRAP() __asm__(\"li r0, 20\\nsc\\nnop\\nli r0, 37\\nli r4, 2\\nsc\\nnop\\n\" \\\n        : : : \"memory\",\"r0\",\"r3\",\"r4\" ) /* NOLINT */\n    #endif\n\n#elif defined(CATCH_PLATFORM_IPHONE)\n\n    // use inline assembler\n    #if defined(__i386__) || defined(__x86_64__)\n        #define CATCH_TRAP()  __asm__(\"int $3\")\n    #elif defined(__aarch64__)\n        #define CATCH_TRAP()  __asm__(\".inst 0xd4200000\")\n    #elif defined(__arm__) && !defined(__thumb__)\n        #define CATCH_TRAP()  __asm__(\".inst 0xe7f001f0\")\n    #elif defined(__arm__) &&  defined(__thumb__)\n        #define CATCH_TRAP()  __asm__(\".inst 0xde01\")\n    #endif\n\n#elif defined(CATCH_PLATFORM_LINUX)\n    // If we can use inline assembler, do it because this allows us to break\n    // directly at the location of the failing check instead of breaking inside\n    // raise() called from it, i.e. one stack frame below.\n    #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64))\n        #define CATCH_TRAP() asm volatile (\"int $3\") /* NOLINT */\n    #else // Fall back to the generic way.\n        #include <signal.h>\n\n        #define CATCH_TRAP() raise(SIGTRAP)\n    #endif\n#elif defined(_MSC_VER)\n    #define CATCH_TRAP() __debugbreak()\n#elif defined(__MINGW32__)\n    extern \"C\" __declspec(dllimport) void __stdcall DebugBreak();\n    #define CATCH_TRAP() DebugBreak()\n#endif\n\n#ifndef CATCH_BREAK_INTO_DEBUGGER\n    #ifdef CATCH_TRAP\n        #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }()\n    #else\n        #define CATCH_BREAK_INTO_DEBUGGER() []{}()\n    #endif\n#endif\n\n#endif // CATCH_DEBUGGER_HPP_INCLUDED\n\n\n#ifndef CATCH_ENFORCE_HPP_INCLUDED\n#define CATCH_ENFORCE_HPP_INCLUDED\n\n\n#include <exception>\n\nnamespace Catch {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    template <typename Ex>\n    [[noreturn]]\n    void throw_exception(Ex const& e) {\n        throw e;\n    }\n#else // ^^ Exceptions are enabled //  Exceptions are disabled vv\n    [[noreturn]]\n    void throw_exception(std::exception const& e);\n#endif\n\n    [[noreturn]]\n    void throw_logic_error(std::string const& msg);\n    [[noreturn]]\n    void throw_domain_error(std::string const& msg);\n    [[noreturn]]\n    void throw_runtime_error(std::string const& msg);\n\n} // namespace Catch;\n\n#define CATCH_MAKE_MSG(...) \\\n    (Catch::ReusableStringStream() << __VA_ARGS__).str()\n\n#define CATCH_INTERNAL_ERROR(...) \\\n    Catch::throw_logic_error(CATCH_MAKE_MSG( CATCH_INTERNAL_LINEINFO << \": Internal Catch2 error: \" << __VA_ARGS__))\n\n#define CATCH_ERROR(...) \\\n    Catch::throw_domain_error(CATCH_MAKE_MSG( __VA_ARGS__ ))\n\n#define CATCH_RUNTIME_ERROR(...) \\\n    Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ ))\n\n#define CATCH_ENFORCE( condition, ... ) \\\n    do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false)\n\n\n#endif // CATCH_ENFORCE_HPP_INCLUDED\n\n\n#ifndef CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED\n#define CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED\n\n\n#include <vector>\n\nnamespace Catch {\n\n    namespace Detail {\n\n        Catch::Detail::unique_ptr<EnumInfo> makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector<int> const& values );\n\n        class EnumValuesRegistry : public IMutableEnumValuesRegistry {\n\n            std::vector<Catch::Detail::unique_ptr<EnumInfo>> m_enumInfos;\n\n            EnumInfo const& registerEnum( StringRef enumName, StringRef allValueNames, std::vector<int> const& values) override;\n        };\n\n        std::vector<StringRef> parseEnums( StringRef enums );\n\n    } // Detail\n\n} // Catch\n\n#endif // CATCH_ENUM_VALUES_REGISTRY_HPP_INCLUDED\n\n\n#ifndef CATCH_ERRNO_GUARD_HPP_INCLUDED\n#define CATCH_ERRNO_GUARD_HPP_INCLUDED\n\nnamespace Catch {\n\n    //! Simple RAII class that stores the value of `errno`\n    //! at construction and restores it at destruction.\n    class ErrnoGuard {\n    public:\n        // Keep these outlined to avoid dragging in macros from <cerrno>\n\n        ErrnoGuard();\n        ~ErrnoGuard();\n    private:\n        int m_oldErrno;\n    };\n\n}\n\n#endif // CATCH_ERRNO_GUARD_HPP_INCLUDED\n\n\n#ifndef CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED\n#define CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED\n\n\n#include <vector>\n#include <string>\n\nnamespace Catch {\n\n    class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry {\n    public:\n        ~ExceptionTranslatorRegistry() override;\n        void registerTranslator( Detail::unique_ptr<IExceptionTranslator>&& translator );\n        std::string translateActiveException() const override;\n\n    private:\n        ExceptionTranslators m_translators;\n    };\n}\n\n#endif // CATCH_EXCEPTION_TRANSLATOR_REGISTRY_HPP_INCLUDED\n\n\n#ifndef CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED\n#define CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED\n\n#include <cassert>\n\nnamespace Catch {\n\n    /**\n     * Wrapper for platform-specific fatal error (signals/SEH) handlers\n     *\n     * Tries to be cooperative with other handlers, and not step over\n     * other handlers. This means that unknown structured exceptions\n     * are passed on, previous signal handlers are called, and so on.\n     *\n     * Can only be instantiated once, and assumes that once a signal\n     * is caught, the binary will end up terminating. Thus, there\n     */\n    class FatalConditionHandler {\n        bool m_started = false;\n\n        // Install/disengage implementation for specific platform.\n        // Should be if-defed to work on current platform, can assume\n        // engage-disengage 1:1 pairing.\n        void engage_platform();\n        void disengage_platform() noexcept;\n    public:\n        // Should also have platform-specific implementations as needed\n        FatalConditionHandler();\n        ~FatalConditionHandler();\n\n        void engage() {\n            assert(!m_started && \"Handler cannot be installed twice.\");\n            m_started = true;\n            engage_platform();\n        }\n\n        void disengage() noexcept {\n            assert(m_started && \"Handler cannot be uninstalled without being installed first\");\n            m_started = false;\n            disengage_platform();\n        }\n    };\n\n    //! Simple RAII guard for (dis)engaging the FatalConditionHandler\n    class FatalConditionHandlerGuard {\n        FatalConditionHandler* m_handler;\n    public:\n        FatalConditionHandlerGuard(FatalConditionHandler* handler):\n            m_handler(handler) {\n            m_handler->engage();\n        }\n        ~FatalConditionHandlerGuard() {\n            m_handler->disengage();\n        }\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_FATAL_CONDITION_HANDLER_HPP_INCLUDED\n\n\n#ifndef CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED\n#define CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED\n\n\n#include <cassert>\n#include <cmath>\n#include <cstdint>\n#include <utility>\n#include <limits>\n\nnamespace Catch {\n    namespace Detail {\n\n        uint32_t convertToBits(float f);\n        uint64_t convertToBits(double d);\n\n        // Used when we know we want == comparison of two doubles\n        // to centralize warning suppression\n        bool directCompare( float lhs, float rhs );\n        bool directCompare( double lhs, double rhs );\n\n    } // end namespace Detail\n\n\n\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic push\n    // We do a bunch of direct compensations of floating point numbers,\n    // because we know what we are doing and actually do want the direct\n    // comparison behaviour.\n#    pragma GCC diagnostic ignored \"-Wfloat-equal\"\n#endif\n\n    /**\n     * Calculates the ULP distance between two floating point numbers\n     *\n     * The ULP distance of two floating point numbers is the count of\n     * valid floating point numbers representable between them.\n     *\n     * There are some exceptions between how this function counts the\n     * distance, and the interpretation of the standard as implemented.\n     * by e.g. `nextafter`. For this function it always holds that:\n     * * `(x == y) => ulpDistance(x, y) == 0` (so `ulpDistance(-0, 0) == 0`)\n     * * `ulpDistance(maxFinite, INF) == 1`\n     * * `ulpDistance(x, -x) == 2 * ulpDistance(x, 0)`\n     *\n     * \\pre `!isnan( lhs )`\n     * \\pre `!isnan( rhs )`\n     * \\pre floating point numbers are represented in IEEE-754 format\n     */\n    template <typename FP>\n    uint64_t ulpDistance( FP lhs, FP rhs ) {\n        assert( std::numeric_limits<FP>::is_iec559 &&\n            \"ulpDistance assumes IEEE-754 format for floating point types\" );\n        assert( !Catch::isnan( lhs ) &&\n                \"Distance between NaN and number is not meaningful\" );\n        assert( !Catch::isnan( rhs ) &&\n                \"Distance between NaN and number is not meaningful\" );\n\n        // We want X == Y to imply 0 ULP distance even if X and Y aren't\n        // bit-equal (-0 and 0), or X - Y != 0 (same sign infinities).\n        if ( lhs == rhs ) { return 0; }\n\n        // We need a properly typed positive zero for type inference.\n        static constexpr FP positive_zero{};\n\n        // We want to ensure that +/- 0 is always represented as positive zero\n        if ( lhs == positive_zero ) { lhs = positive_zero; }\n        if ( rhs == positive_zero ) { rhs = positive_zero; }\n\n        // If arguments have different signs, we can handle them by summing\n        // how far are they from 0 each.\n        if ( std::signbit( lhs ) != std::signbit( rhs ) ) {\n            return ulpDistance( std::abs( lhs ), positive_zero ) +\n                   ulpDistance( std::abs( rhs ), positive_zero );\n        }\n\n        // When both lhs and rhs are of the same sign, we can just\n        // read the numbers bitwise as integers, and then subtract them\n        // (assuming IEEE).\n        uint64_t lc = Detail::convertToBits( lhs );\n        uint64_t rc = Detail::convertToBits( rhs );\n\n        // The ulp distance between two numbers is symmetric, so to avoid\n        // dealing with overflows we want the bigger converted number on the lhs\n        if ( lc < rc ) {\n            std::swap( lc, rc );\n        }\n\n        return lc - rc;\n    }\n\n#if defined( __GNUC__ ) || defined( __clang__ )\n#    pragma GCC diagnostic pop\n#endif\n\n\n} // end namespace Catch\n\n#endif // CATCH_FLOATING_POINT_HELPERS_HPP_INCLUDED\n\n\n#ifndef CATCH_GETENV_HPP_INCLUDED\n#define CATCH_GETENV_HPP_INCLUDED\n\nnamespace Catch {\nnamespace Detail {\n\n    //! Wrapper over `std::getenv` that compiles on UWP (and always returns nullptr there)\n    char const* getEnv(char const* varName);\n\n}\n}\n\n#endif // CATCH_GETENV_HPP_INCLUDED\n\n\n#ifndef CATCH_IS_PERMUTATION_HPP_INCLUDED\n#define CATCH_IS_PERMUTATION_HPP_INCLUDED\n\n#include <algorithm>\n#include <iterator>\n\nnamespace Catch {\n    namespace Detail {\n\n        template <typename ForwardIter,\n                  typename Sentinel,\n                  typename T,\n                  typename Comparator>\n        constexpr\n        ForwardIter find_sentinel( ForwardIter start,\n                                   Sentinel sentinel,\n                                   T const& value,\n                                   Comparator cmp ) {\n            while ( start != sentinel ) {\n                if ( cmp( *start, value ) ) { break; }\n                ++start;\n            }\n            return start;\n        }\n\n        template <typename ForwardIter,\n                  typename Sentinel,\n                  typename T,\n                  typename Comparator>\n        constexpr\n        std::ptrdiff_t count_sentinel( ForwardIter start,\n                                       Sentinel sentinel,\n                                       T const& value,\n                                       Comparator cmp ) {\n            std::ptrdiff_t count = 0;\n            while ( start != sentinel ) {\n                if ( cmp( *start, value ) ) { ++count; }\n                ++start;\n            }\n            return count;\n        }\n\n        template <typename ForwardIter, typename Sentinel>\n        constexpr\n        std::enable_if_t<!std::is_same<ForwardIter, Sentinel>::value,\n                         std::ptrdiff_t>\n        sentinel_distance( ForwardIter iter, const Sentinel sentinel ) {\n            std::ptrdiff_t dist = 0;\n            while ( iter != sentinel ) {\n                ++iter;\n                ++dist;\n            }\n            return dist;\n        }\n\n        template <typename ForwardIter>\n        constexpr std::ptrdiff_t sentinel_distance( ForwardIter first,\n                                                    ForwardIter last ) {\n            return std::distance( first, last );\n        }\n\n        template <typename ForwardIter1,\n                  typename Sentinel1,\n                  typename ForwardIter2,\n                  typename Sentinel2,\n                  typename Comparator>\n        constexpr bool check_element_counts( ForwardIter1 first_1,\n                                             const Sentinel1 end_1,\n                                             ForwardIter2 first_2,\n                                             const Sentinel2 end_2,\n                                             Comparator cmp ) {\n            auto cursor = first_1;\n            while ( cursor != end_1 ) {\n                if ( find_sentinel( first_1, cursor, *cursor, cmp ) ==\n                     cursor ) {\n                    // we haven't checked this element yet\n                    const auto count_in_range_2 =\n                        count_sentinel( first_2, end_2, *cursor, cmp );\n                    // Not a single instance in 2nd range, so it cannot be a\n                    // permutation of 1st range\n                    if ( count_in_range_2 == 0 ) { return false; }\n\n                    const auto count_in_range_1 =\n                        count_sentinel( cursor, end_1, *cursor, cmp );\n                    if ( count_in_range_1 != count_in_range_2 ) {\n                        return false;\n                    }\n                }\n\n                ++cursor;\n            }\n\n            return true;\n        }\n\n        template <typename ForwardIter1,\n                  typename Sentinel1,\n                  typename ForwardIter2,\n                  typename Sentinel2,\n                  typename Comparator>\n        constexpr bool is_permutation( ForwardIter1 first_1,\n                                       const Sentinel1 end_1,\n                                       ForwardIter2 first_2,\n                                       const Sentinel2 end_2,\n                                       Comparator cmp ) {\n            // TODO: no optimization for stronger iterators, because we would also have to constrain on sentinel vs not sentinel types\n            // TODO: Comparator has to be \"both sides\", e.g. a == b => b == a\n            // This skips shared prefix of the two ranges\n            while (first_1 != end_1 && first_2 != end_2 && cmp(*first_1, *first_2)) {\n                ++first_1;\n                ++first_2;\n            }\n\n            // We need to handle case where at least one of the ranges has no more elements\n            if (first_1 == end_1 || first_2 == end_2) {\n                return first_1 == end_1 && first_2 == end_2;\n            }\n\n            // pair counting is n**2, so we pay linear walk to compare the sizes first\n            auto dist_1 = sentinel_distance( first_1, end_1 );\n            auto dist_2 = sentinel_distance( first_2, end_2 );\n\n            if (dist_1 != dist_2) { return false; }\n\n            // Since we do not try to handle stronger iterators pair (e.g.\n            // bidir) optimally, the only thing left to do is to check counts in\n            // the remaining ranges.\n            return check_element_counts( first_1, end_1, first_2, end_2, cmp );\n        }\n\n    } // namespace Detail\n} // namespace Catch\n\n#endif // CATCH_IS_PERMUTATION_HPP_INCLUDED\n\n\n#ifndef CATCH_ISTREAM_HPP_INCLUDED\n#define CATCH_ISTREAM_HPP_INCLUDED\n\n\n#include <iosfwd>\n#include <cstddef>\n#include <ostream>\n#include <string>\n\nnamespace Catch {\n\n    class IStream {\n    public:\n        virtual ~IStream(); // = default\n        virtual std::ostream& stream() = 0;\n        /**\n         * Best guess on whether the instance is writing to a console (e.g. via stdout/stderr)\n         *\n         * This is useful for e.g. Win32 colour support, because the Win32\n         * API manipulates console directly, unlike POSIX escape codes,\n         * that can be written anywhere.\n         *\n         * Due to variety of ways to change where the stdout/stderr is\n         * _actually_ being written, users should always assume that\n         * the answer might be wrong.\n         */\n        virtual bool isConsole() const { return false; }\n    };\n\n    /**\n     * Creates a stream wrapper that writes to specific file.\n     *\n     * Also recognizes 4 special filenames\n     * * `-` for stdout\n     * * `%stdout` for stdout\n     * * `%stderr` for stderr\n     * * `%debug` for platform specific debugging output\n     *\n     * \\throws if passed an unrecognized %-prefixed stream\n     */\n    auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream>;\n\n}\n\n#endif // CATCH_STREAM_HPP_INCLUDED\n\n\n#ifndef CATCH_JSONWRITER_HPP_INCLUDED\n#define CATCH_JSONWRITER_HPP_INCLUDED\n\n\n#include <cstdint>\n#include <sstream>\n\nnamespace Catch {\n    class JsonObjectWriter;\n    class JsonArrayWriter;\n\n    struct JsonUtils {\n        static void indent( std::ostream& os, std::uint64_t level );\n        static void appendCommaNewline( std::ostream& os,\n                                        bool& should_comma,\n                                        std::uint64_t level );\n    };\n\n    class JsonValueWriter {\n    public:\n        JsonValueWriter( std::ostream& os );\n        JsonValueWriter( std::ostream& os, std::uint64_t indent_level );\n\n        JsonObjectWriter writeObject() &&;\n        JsonArrayWriter writeArray() &&;\n\n        template <typename T>\n        void write( T const& value ) && {\n            writeImpl( value, !std::is_arithmetic<T>::value );\n        }\n        void write( StringRef value ) &&;\n        void write( bool value ) &&;\n\n    private:\n        void writeImpl( StringRef value, bool quote );\n\n        // Without this SFINAE, this overload is a better match\n        // for `std::string`, `char const*`, `char const[N]` args.\n        // While it would still work, it would cause code bloat\n        // and multiple iteration over the strings\n        template <typename T,\n                  typename = typename std::enable_if_t<\n                      !std::is_convertible<T, StringRef>::value>>\n        void writeImpl( T const& value, bool quote_value ) {\n            m_sstream << value;\n            writeImpl( m_sstream.str(), quote_value );\n        }\n\n        std::ostream& m_os;\n        std::stringstream m_sstream;\n        std::uint64_t m_indent_level;\n    };\n\n    class JsonObjectWriter {\n    public:\n        JsonObjectWriter( std::ostream& os );\n        JsonObjectWriter( std::ostream& os, std::uint64_t indent_level );\n\n        JsonObjectWriter( JsonObjectWriter&& source ) noexcept;\n        JsonObjectWriter& operator=( JsonObjectWriter&& source ) = delete;\n\n        ~JsonObjectWriter();\n\n        JsonValueWriter write( StringRef key );\n\n    private:\n        std::ostream& m_os;\n        std::uint64_t m_indent_level;\n        bool m_should_comma = false;\n        bool m_active = true;\n    };\n\n    class JsonArrayWriter {\n    public:\n        JsonArrayWriter( std::ostream& os );\n        JsonArrayWriter( std::ostream& os, std::uint64_t indent_level );\n\n        JsonArrayWriter( JsonArrayWriter&& source ) noexcept;\n        JsonArrayWriter& operator=( JsonArrayWriter&& source ) = delete;\n\n        ~JsonArrayWriter();\n\n        JsonObjectWriter writeObject();\n        JsonArrayWriter writeArray();\n\n        template <typename T>\n        JsonArrayWriter& write( T const& value ) {\n            return writeImpl( value );\n        }\n\n        JsonArrayWriter& write( bool value );\n\n    private:\n        template <typename T>\n        JsonArrayWriter& writeImpl( T const& value ) {\n            JsonUtils::appendCommaNewline(\n                m_os, m_should_comma, m_indent_level + 1 );\n            JsonValueWriter{ m_os }.write( value );\n\n            return *this;\n        }\n\n        std::ostream& m_os;\n        std::uint64_t m_indent_level;\n        bool m_should_comma = false;\n        bool m_active = true;\n    };\n\n} // namespace Catch\n\n#endif // CATCH_JSONWRITER_HPP_INCLUDED\n\n\n#ifndef CATCH_LEAK_DETECTOR_HPP_INCLUDED\n#define CATCH_LEAK_DETECTOR_HPP_INCLUDED\n\nnamespace Catch {\n\n    struct LeakDetector {\n        LeakDetector();\n        ~LeakDetector();\n    };\n\n}\n#endif // CATCH_LEAK_DETECTOR_HPP_INCLUDED\n\n\n#ifndef CATCH_LIST_HPP_INCLUDED\n#define CATCH_LIST_HPP_INCLUDED\n\n\n#include <set>\n#include <string>\n\n\nnamespace Catch {\n\n    class IEventListener;\n    class Config;\n\n\n    struct ReporterDescription {\n        std::string name, description;\n    };\n    struct ListenerDescription {\n        StringRef name;\n        std::string description;\n    };\n\n    struct TagInfo {\n        void add(StringRef spelling);\n        std::string all() const;\n\n        std::set<StringRef> spellings;\n        std::size_t count = 0;\n    };\n\n    bool list( IEventListener& reporter, Config const& config );\n\n} // end namespace Catch\n\n#endif // CATCH_LIST_HPP_INCLUDED\n\n\n#ifndef CATCH_OUTPUT_REDIRECT_HPP_INCLUDED\n#define CATCH_OUTPUT_REDIRECT_HPP_INCLUDED\n\n\n#include <cassert>\n#include <string>\n\nnamespace Catch {\n\n    class OutputRedirect {\n        bool m_redirectActive = false;\n        virtual void activateImpl() = 0;\n        virtual void deactivateImpl() = 0;\n    public:\n        enum Kind {\n            //! No redirect (noop implementation)\n            None,\n            //! Redirect std::cout/std::cerr/std::clog streams internally\n            Streams,\n            //! Redirect the stdout/stderr file descriptors into files\n            FileDescriptors,\n        };\n\n        virtual ~OutputRedirect(); // = default;\n\n        // TODO: Do we want to check that redirect is not active before retrieving the output?\n        virtual std::string getStdout() = 0;\n        virtual std::string getStderr() = 0;\n        virtual void clearBuffers() = 0;\n        bool isActive() const { return m_redirectActive; }\n        void activate() {\n            assert( !m_redirectActive && \"redirect is already active\" );\n            activateImpl();\n            m_redirectActive = true;\n        }\n        void deactivate() {\n            assert( m_redirectActive && \"redirect is not active\" );\n            deactivateImpl();\n            m_redirectActive = false;\n        }\n    };\n\n    bool isRedirectAvailable( OutputRedirect::Kind kind);\n    Detail::unique_ptr<OutputRedirect> makeOutputRedirect( bool actual );\n\n    class RedirectGuard {\n        OutputRedirect* m_redirect;\n        bool m_activate;\n        bool m_previouslyActive;\n        bool m_moved = false;\n\n    public:\n        RedirectGuard( bool activate, OutputRedirect& redirectImpl );\n        ~RedirectGuard() noexcept( false );\n\n        RedirectGuard( RedirectGuard const& ) = delete;\n        RedirectGuard& operator=( RedirectGuard const& ) = delete;\n\n        // C++14 needs move-able guards to return them from functions\n        RedirectGuard( RedirectGuard&& rhs ) noexcept;\n        RedirectGuard& operator=( RedirectGuard&& rhs ) noexcept;\n    };\n\n    RedirectGuard scopedActivate( OutputRedirect& redirectImpl );\n    RedirectGuard scopedDeactivate( OutputRedirect& redirectImpl );\n\n} // end namespace Catch\n\n#endif // CATCH_OUTPUT_REDIRECT_HPP_INCLUDED\n\n\n#ifndef CATCH_PARSE_NUMBERS_HPP_INCLUDED\n#define CATCH_PARSE_NUMBERS_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\n\n    /**\n     * Parses unsigned int from the input, using provided base\n     *\n     * Effectively a wrapper around std::stoul but with better error checking\n     * e.g. \"-1\" is rejected, instead of being parsed as UINT_MAX.\n     */\n    Optional<unsigned int> parseUInt(std::string const& input, int base = 10);\n}\n\n#endif // CATCH_PARSE_NUMBERS_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_REGISTRY_HPP_INCLUDED\n#define CATCH_REPORTER_REGISTRY_HPP_INCLUDED\n\n\n#include <map>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    class IEventListener;\n    using IEventListenerPtr = Detail::unique_ptr<IEventListener>;\n    class IReporterFactory;\n    using IReporterFactoryPtr = Detail::unique_ptr<IReporterFactory>;\n    struct ReporterConfig;\n    class EventListenerFactory;\n\n    class ReporterRegistry {\n        struct ReporterRegistryImpl;\n        Detail::unique_ptr<ReporterRegistryImpl> m_impl;\n\n    public:\n        ReporterRegistry();\n        ~ReporterRegistry(); // = default;\n\n        IEventListenerPtr create( std::string const& name,\n                                  ReporterConfig&& config ) const;\n\n        void registerReporter( std::string const& name,\n                               IReporterFactoryPtr factory );\n\n        void\n        registerListener( Detail::unique_ptr<EventListenerFactory> factory );\n\n        std::map<std::string,\n                 IReporterFactoryPtr,\n                 Detail::CaseInsensitiveLess> const&\n        getFactories() const;\n\n        std::vector<Detail::unique_ptr<EventListenerFactory>> const&\n        getListeners() const;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_REGISTRY_HPP_INCLUDED\n\n\n#ifndef CATCH_RUN_CONTEXT_HPP_INCLUDED\n#define CATCH_RUN_CONTEXT_HPP_INCLUDED\n\n\n\n#ifndef CATCH_TEST_CASE_TRACKER_HPP_INCLUDED\n#define CATCH_TEST_CASE_TRACKER_HPP_INCLUDED\n\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\nnamespace TestCaseTracking {\n\n    struct NameAndLocation {\n        std::string name;\n        SourceLineInfo location;\n\n        NameAndLocation( std::string&& _name, SourceLineInfo const& _location );\n        friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) {\n            // This is a very cheap check that should have a very high hit rate.\n            // If we get to SourceLineInfo::operator==, we will redo it, but the\n            // cost of repeating is trivial at that point (we will be paying\n            // multiple strcmp/memcmps at that point).\n            if ( lhs.location.line != rhs.location.line ) { return false; }\n            return lhs.name == rhs.name && lhs.location == rhs.location;\n        }\n        friend bool operator!=(NameAndLocation const& lhs,\n                               NameAndLocation const& rhs) {\n            return !( lhs == rhs );\n        }\n    };\n\n    /**\n     * This is a variant of `NameAndLocation` that does not own the name string\n     *\n     * This avoids extra allocations when trying to locate a tracker by its\n     * name and location, as long as we make sure that trackers only keep\n     * around the owning variant.\n     */\n    struct NameAndLocationRef {\n        StringRef name;\n        SourceLineInfo location;\n\n        constexpr NameAndLocationRef( StringRef name_,\n                                      SourceLineInfo location_ ):\n            name( name_ ), location( location_ ) {}\n\n        friend bool operator==( NameAndLocation const& lhs,\n                                NameAndLocationRef const& rhs ) {\n            // This is a very cheap check that should have a very high hit rate.\n            // If we get to SourceLineInfo::operator==, we will redo it, but the\n            // cost of repeating is trivial at that point (we will be paying\n            // multiple strcmp/memcmps at that point).\n            if ( lhs.location.line != rhs.location.line ) { return false; }\n            return StringRef( lhs.name ) == rhs.name &&\n                   lhs.location == rhs.location;\n        }\n        friend bool operator==( NameAndLocationRef const& lhs,\n                                NameAndLocation const& rhs ) {\n            return rhs == lhs;\n        }\n    };\n\n    class ITracker;\n\n    using ITrackerPtr = Catch::Detail::unique_ptr<ITracker>;\n\n    class ITracker {\n        NameAndLocation m_nameAndLocation;\n\n        using Children = std::vector<ITrackerPtr>;\n\n    protected:\n        enum CycleState {\n            NotStarted,\n            Executing,\n            ExecutingChildren,\n            NeedsAnotherRun,\n            CompletedSuccessfully,\n            Failed\n        };\n\n        ITracker* m_parent = nullptr;\n        Children m_children;\n        CycleState m_runState = NotStarted;\n\n    public:\n        ITracker( NameAndLocation&& nameAndLoc, ITracker* parent ):\n            m_nameAndLocation( CATCH_MOVE(nameAndLoc) ),\n            m_parent( parent )\n        {}\n\n\n        // static queries\n        NameAndLocation const& nameAndLocation() const {\n            return m_nameAndLocation;\n        }\n        ITracker* parent() const {\n            return m_parent;\n        }\n\n        virtual ~ITracker(); // = default\n\n\n        // dynamic queries\n\n        //! Returns true if tracker run to completion (successfully or not)\n        virtual bool isComplete() const = 0;\n        //! Returns true if tracker run to completion successfully\n        bool isSuccessfullyCompleted() const {\n            return m_runState == CompletedSuccessfully;\n        }\n        //! Returns true if tracker has started but hasn't been completed\n        bool isOpen() const;\n        //! Returns true iff tracker has started\n        bool hasStarted() const;\n\n        // actions\n        virtual void close() = 0; // Successfully complete\n        virtual void fail() = 0;\n        void markAsNeedingAnotherRun();\n\n        //! Register a nested ITracker\n        void addChild( ITrackerPtr&& child );\n        /**\n         * Returns ptr to specific child if register with this tracker.\n         *\n         * Returns nullptr if not found.\n         */\n        ITracker* findChild( NameAndLocationRef const& nameAndLocation );\n        //! Have any children been added?\n        bool hasChildren() const {\n            return !m_children.empty();\n        }\n\n\n        //! Marks tracker as executing a child, doing se recursively up the tree\n        void openChild();\n\n        /**\n         * Returns true if the instance is a section tracker\n         *\n         * Subclasses should override to true if they are, replaces RTTI\n         * for internal debug checks.\n         */\n        virtual bool isSectionTracker() const;\n        /**\n         * Returns true if the instance is a generator tracker\n         *\n         * Subclasses should override to true if they are, replaces RTTI\n         * for internal debug checks.\n         */\n        virtual bool isGeneratorTracker() const;\n    };\n\n    class TrackerContext {\n\n        enum RunState {\n            NotStarted,\n            Executing,\n            CompletedCycle\n        };\n\n        ITrackerPtr m_rootTracker;\n        ITracker* m_currentTracker = nullptr;\n        RunState m_runState = NotStarted;\n\n    public:\n\n        ITracker& startRun();\n\n        void startCycle() {\n            m_currentTracker = m_rootTracker.get();\n            m_runState = Executing;\n        }\n        void completeCycle();\n\n        bool completedCycle() const;\n        ITracker& currentTracker() { return *m_currentTracker; }\n        void setCurrentTracker( ITracker* tracker );\n    };\n\n    class TrackerBase : public ITracker {\n    protected:\n\n        TrackerContext& m_ctx;\n\n    public:\n        TrackerBase( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent );\n\n        bool isComplete() const override;\n\n        void open();\n\n        void close() override;\n        void fail() override;\n\n    private:\n        void moveToParent();\n        void moveToThis();\n    };\n\n    class SectionTracker : public TrackerBase {\n        std::vector<StringRef> m_filters;\n        // Note that lifetime-wise we piggy back off the name stored in the `ITracker` parent`.\n        // Currently it allocates owns the name, so this is safe. If it is later refactored\n        // to not own the name, the name still has to outlive the `ITracker` parent, so\n        // this should still be safe.\n        StringRef m_trimmed_name;\n    public:\n        SectionTracker( NameAndLocation&& nameAndLocation, TrackerContext& ctx, ITracker* parent );\n\n        bool isSectionTracker() const override;\n\n        bool isComplete() const override;\n\n        static SectionTracker& acquire( TrackerContext& ctx, NameAndLocationRef const& nameAndLocation );\n\n        void tryOpen();\n\n        void addInitialFilters( std::vector<std::string> const& filters );\n        void addNextFilters( std::vector<StringRef> const& filters );\n        //! Returns filters active in this tracker\n        std::vector<StringRef> const& getFilters() const { return m_filters; }\n        //! Returns whitespace-trimmed name of the tracked section\n        StringRef trimmedName() const;\n    };\n\n} // namespace TestCaseTracking\n\nusing TestCaseTracking::ITracker;\nusing TestCaseTracking::TrackerContext;\nusing TestCaseTracking::SectionTracker;\n\n} // namespace Catch\n\n#endif // CATCH_TEST_CASE_TRACKER_HPP_INCLUDED\n\n#include <string>\n\nnamespace Catch {\n\n    class IGeneratorTracker;\n    class IConfig;\n    class IEventListener;\n    using IEventListenerPtr = Detail::unique_ptr<IEventListener>;\n    class OutputRedirect;\n\n    ///////////////////////////////////////////////////////////////////////////\n\n    class RunContext final : public IResultCapture {\n\n    public:\n        RunContext( RunContext const& ) = delete;\n        RunContext& operator =( RunContext const& ) = delete;\n\n        explicit RunContext( IConfig const* _config, IEventListenerPtr&& reporter );\n\n        ~RunContext() override;\n\n        Totals runTest(TestCaseHandle const& testCase);\n\n    public: // IResultCapture\n\n        // Assertion handlers\n        void handleExpr\n                (   AssertionInfo const& info,\n                    ITransientExpression const& expr,\n                    AssertionReaction& reaction ) override;\n        void handleMessage\n                (   AssertionInfo const& info,\n                    ResultWas::OfType resultType,\n                    std::string&& message,\n                    AssertionReaction& reaction ) override;\n        void handleUnexpectedExceptionNotThrown\n                (   AssertionInfo const& info,\n                    AssertionReaction& reaction ) override;\n        void handleUnexpectedInflightException\n                (   AssertionInfo const& info,\n                    std::string&& message,\n                    AssertionReaction& reaction ) override;\n        void handleIncomplete\n                (   AssertionInfo const& info ) override;\n        void handleNonExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    AssertionReaction &reaction ) override;\n\n        void notifyAssertionStarted( AssertionInfo const& info ) override;\n        bool sectionStarted( StringRef sectionName,\n                             SourceLineInfo const& sectionLineInfo,\n                             Counts& assertions ) override;\n\n        void sectionEnded( SectionEndInfo&& endInfo ) override;\n        void sectionEndedEarly( SectionEndInfo&& endInfo ) override;\n\n        IGeneratorTracker*\n        acquireGeneratorTracker( StringRef generatorName,\n                                 SourceLineInfo const& lineInfo ) override;\n        IGeneratorTracker* createGeneratorTracker(\n            StringRef generatorName,\n            SourceLineInfo lineInfo,\n            Generators::GeneratorBasePtr&& generator ) override;\n\n\n        void benchmarkPreparing( StringRef name ) override;\n        void benchmarkStarting( BenchmarkInfo const& info ) override;\n        void benchmarkEnded( BenchmarkStats<> const& stats ) override;\n        void benchmarkFailed( StringRef error ) override;\n\n        void pushScopedMessage( MessageInfo const& message ) override;\n        void popScopedMessage( MessageInfo const& message ) override;\n\n        void emplaceUnscopedMessage( MessageBuilder&& builder ) override;\n\n        std::string getCurrentTestName() const override;\n\n        const AssertionResult* getLastResult() const override;\n\n        void exceptionEarlyReported() override;\n\n        void handleFatalErrorCondition( StringRef message ) override;\n\n        bool lastAssertionPassed() override;\n\n        void assertionPassed() override;\n\n    public:\n        // !TBD We need to do this another way!\n        bool aborting() const;\n\n    private:\n\n        void runCurrentTest();\n        void invokeActiveTestCase();\n\n        void resetAssertionInfo();\n        bool testForMissingAssertions( Counts& assertions );\n\n        void assertionEnded( AssertionResult&& result );\n        void reportExpr\n                (   AssertionInfo const &info,\n                    ResultWas::OfType resultType,\n                    ITransientExpression const *expr,\n                    bool negated );\n\n        void populateReaction( AssertionReaction& reaction );\n\n    private:\n\n        void handleUnfinishedSections();\n\n        TestRunInfo m_runInfo;\n        TestCaseHandle const* m_activeTestCase = nullptr;\n        ITracker* m_testCaseTracker = nullptr;\n        Optional<AssertionResult> m_lastResult;\n\n        IConfig const* m_config;\n        Totals m_totals;\n        IEventListenerPtr m_reporter;\n        std::vector<MessageInfo> m_messages;\n        std::vector<ScopedMessage> m_messageScopes; /* Keeps owners of so-called unscoped messages. */\n        AssertionInfo m_lastAssertionInfo;\n        std::vector<SectionEndInfo> m_unfinishedSections;\n        std::vector<ITracker*> m_activeSections;\n        TrackerContext m_trackerContext;\n        Detail::unique_ptr<OutputRedirect> m_outputRedirect;\n        FatalConditionHandler m_fatalConditionhandler;\n        bool m_lastAssertionPassed = false;\n        bool m_shouldReportUnexpected = true;\n        bool m_includeSuccessfulResults;\n    };\n\n    void seedRng(IConfig const& config);\n    unsigned int rngSeed();\n} // end namespace Catch\n\n#endif // CATCH_RUN_CONTEXT_HPP_INCLUDED\n\n\n#ifndef CATCH_SHARDING_HPP_INCLUDED\n#define CATCH_SHARDING_HPP_INCLUDED\n\n#include <cassert>\n#include <cmath>\n#include <algorithm>\n\nnamespace Catch {\n\n    template<typename Container>\n    Container createShard(Container const& container, std::size_t const shardCount, std::size_t const shardIndex) {\n        assert(shardCount > shardIndex);\n\n        if (shardCount == 1) {\n            return container;\n        }\n\n        const std::size_t totalTestCount = container.size();\n\n        const std::size_t shardSize = totalTestCount / shardCount;\n        const std::size_t leftoverTests = totalTestCount % shardCount;\n\n        const std::size_t startIndex = shardIndex * shardSize + (std::min)(shardIndex, leftoverTests);\n        const std::size_t endIndex = (shardIndex + 1) * shardSize + (std::min)(shardIndex + 1, leftoverTests);\n\n        auto startIterator = std::next(container.begin(), static_cast<std::ptrdiff_t>(startIndex));\n        auto endIterator = std::next(container.begin(), static_cast<std::ptrdiff_t>(endIndex));\n\n        return Container(startIterator, endIterator);\n    }\n\n}\n\n#endif // CATCH_SHARDING_HPP_INCLUDED\n\n\n#ifndef CATCH_SINGLETONS_HPP_INCLUDED\n#define CATCH_SINGLETONS_HPP_INCLUDED\n\nnamespace Catch {\n\n    struct ISingleton {\n        virtual ~ISingleton(); // = default\n    };\n\n\n    void addSingleton( ISingleton* singleton );\n    void cleanupSingletons();\n\n\n    template<typename SingletonImplT, typename InterfaceT = SingletonImplT, typename MutableInterfaceT = InterfaceT>\n    class Singleton : SingletonImplT, public ISingleton {\n\n        static auto getInternal() -> Singleton* {\n            static Singleton* s_instance = nullptr;\n            if( !s_instance ) {\n                s_instance = new Singleton;\n                addSingleton( s_instance );\n            }\n            return s_instance;\n        }\n\n    public:\n        static auto get() -> InterfaceT const& {\n            return *getInternal();\n        }\n        static auto getMutable() -> MutableInterfaceT& {\n            return *getInternal();\n        }\n    };\n\n} // namespace Catch\n\n#endif // CATCH_SINGLETONS_HPP_INCLUDED\n\n\n#ifndef CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED\n#define CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED\n\n\n#include <vector>\n#include <exception>\n\nnamespace Catch {\n\n    class StartupExceptionRegistry {\n#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS)\n    public:\n        void add(std::exception_ptr const& exception) noexcept;\n        std::vector<std::exception_ptr> const& getExceptions() const noexcept;\n    private:\n        std::vector<std::exception_ptr> m_exceptions;\n#endif\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_STARTUP_EXCEPTION_REGISTRY_HPP_INCLUDED\n\n\n\n#ifndef CATCH_STDSTREAMS_HPP_INCLUDED\n#define CATCH_STDSTREAMS_HPP_INCLUDED\n\n#include <iosfwd>\n\nnamespace Catch {\n\n    std::ostream& cout();\n    std::ostream& cerr();\n    std::ostream& clog();\n\n} // namespace Catch\n\n#endif\n\n\n#ifndef CATCH_STRING_MANIP_HPP_INCLUDED\n#define CATCH_STRING_MANIP_HPP_INCLUDED\n\n\n#include <cstdint>\n#include <string>\n#include <iosfwd>\n#include <vector>\n\nnamespace Catch {\n\n    bool startsWith( std::string const& s, std::string const& prefix );\n    bool startsWith( StringRef s, char prefix );\n    bool endsWith( std::string const& s, std::string const& suffix );\n    bool endsWith( std::string const& s, char suffix );\n    bool contains( std::string const& s, std::string const& infix );\n    void toLowerInPlace( std::string& s );\n    std::string toLower( std::string const& s );\n    char toLower( char c );\n    //! Returns a new string without whitespace at the start/end\n    std::string trim( std::string const& str );\n    //! Returns a substring of the original ref without whitespace. Beware lifetimes!\n    StringRef trim(StringRef ref);\n\n    // !!! Be aware, returns refs into original string - make sure original string outlives them\n    std::vector<StringRef> splitStringRef( StringRef str, char delimiter );\n    bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis );\n\n    /**\n     * Helper for streaming a \"count [maybe-plural-of-label]\" human-friendly string\n     *\n     * Usage example:\n     * ```cpp\n     * std::cout << \"Found \" << pluralise(count, \"error\") << '\\n';\n     * ```\n     *\n     * **Important:** The provided string must outlive the instance\n     */\n    class pluralise {\n        std::uint64_t m_count;\n        StringRef m_label;\n\n    public:\n        constexpr pluralise(std::uint64_t count, StringRef label):\n            m_count(count),\n            m_label(label)\n        {}\n\n        friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser );\n    };\n}\n\n#endif // CATCH_STRING_MANIP_HPP_INCLUDED\n\n\n#ifndef CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED\n#define CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED\n\n\n#include <map>\n#include <string>\n\nnamespace Catch {\n    struct SourceLineInfo;\n\n    class TagAliasRegistry : public ITagAliasRegistry {\n    public:\n        ~TagAliasRegistry() override;\n        TagAlias const* find( std::string const& alias ) const override;\n        std::string expandAliases( std::string const& unexpandedTestSpec ) const override;\n        void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo );\n\n    private:\n        std::map<std::string, TagAlias> m_registry;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_TAG_ALIAS_REGISTRY_HPP_INCLUDED\n\n\n#ifndef CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED\n#define CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED\n\n#include <cstdint>\n\nnamespace Catch {\n\n    struct TestCaseInfo;\n\n    class TestCaseInfoHasher {\n    public:\n        using hash_t = std::uint64_t;\n        TestCaseInfoHasher( hash_t seed );\n        uint32_t operator()( TestCaseInfo const& t ) const;\n\n    private:\n        hash_t m_seed;\n    };\n\n} // namespace Catch\n\n#endif /* CATCH_TEST_CASE_INFO_HASHER_HPP_INCLUDED */\n\n\n#ifndef CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED\n#define CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED\n\n\n#include <vector>\n\nnamespace Catch {\n\n    class IConfig;\n    class ITestInvoker;\n    class TestCaseHandle;\n    class TestSpec;\n\n    std::vector<TestCaseHandle> sortTests( IConfig const& config, std::vector<TestCaseHandle> const& unsortedTestCases );\n\n    bool isThrowSafe( TestCaseHandle const& testCase, IConfig const& config );\n\n    std::vector<TestCaseHandle> filterTests( std::vector<TestCaseHandle> const& testCases, TestSpec const& testSpec, IConfig const& config );\n    std::vector<TestCaseHandle> const& getAllTestCasesSorted( IConfig const& config );\n\n    class TestRegistry : public ITestCaseRegistry {\n    public:\n        void registerTest( Detail::unique_ptr<TestCaseInfo> testInfo, Detail::unique_ptr<ITestInvoker> testInvoker );\n\n        std::vector<TestCaseInfo*> const& getAllInfos() const override;\n        std::vector<TestCaseHandle> const& getAllTests() const override;\n        std::vector<TestCaseHandle> const& getAllTestsSorted( IConfig const& config ) const override;\n\n        ~TestRegistry() override; // = default\n\n    private:\n        std::vector<Detail::unique_ptr<TestCaseInfo>> m_owned_test_infos;\n        // Keeps a materialized vector for `getAllInfos`.\n        // We should get rid of that eventually (see interface note)\n        std::vector<TestCaseInfo*> m_viewed_test_infos;\n\n        std::vector<Detail::unique_ptr<ITestInvoker>> m_invokers;\n        std::vector<TestCaseHandle> m_handles;\n        mutable TestRunOrder m_currentSortOrder = TestRunOrder::Declared;\n        mutable std::vector<TestCaseHandle> m_sortedFunctions;\n    };\n\n    ///////////////////////////////////////////////////////////////////////////\n\n\n} // end namespace Catch\n\n\n#endif // CATCH_TEST_CASE_REGISTRY_IMPL_HPP_INCLUDED\n\n\n#ifndef CATCH_TEST_SPEC_PARSER_HPP_INCLUDED\n#define CATCH_TEST_SPEC_PARSER_HPP_INCLUDED\n\n#ifdef __clang__\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\n\n#include <vector>\n#include <string>\n\nnamespace Catch {\n\n    class ITagAliasRegistry;\n\n    class TestSpecParser {\n        enum Mode{ None, Name, QuotedName, Tag, EscapedName };\n        Mode m_mode = None;\n        Mode lastMode = None;\n        bool m_exclusion = false;\n        std::size_t m_pos = 0;\n        std::size_t m_realPatternPos = 0;\n        std::string m_arg;\n        std::string m_substring;\n        std::string m_patternName;\n        std::vector<std::size_t> m_escapeChars;\n        TestSpec::Filter m_currentFilter;\n        TestSpec m_testSpec;\n        ITagAliasRegistry const* m_tagAliases = nullptr;\n\n    public:\n        TestSpecParser( ITagAliasRegistry const& tagAliases );\n\n        TestSpecParser& parse( std::string const& arg );\n        TestSpec testSpec();\n\n    private:\n        bool visitChar( char c );\n        void startNewMode( Mode mode );\n        bool processNoneChar( char c );\n        void processNameChar( char c );\n        bool processOtherChar( char c );\n        void endMode();\n        void escape();\n        bool isControlChar( char c ) const;\n        void saveLastMode();\n        void revertBackToLastMode();\n        void addFilter();\n        bool separate();\n\n        // Handles common preprocessing of the pattern for name/tag patterns\n        std::string preprocessPattern();\n        // Adds the current pattern as a test name\n        void addNamePattern();\n        // Adds the current pattern as a tag\n        void addTagPattern();\n\n        inline void addCharToPattern(char c) {\n            m_substring += c;\n            m_patternName += c;\n            m_realPatternPos++;\n        }\n\n    };\n\n} // namespace Catch\n\n#ifdef __clang__\n#pragma clang diagnostic pop\n#endif\n\n#endif // CATCH_TEST_SPEC_PARSER_HPP_INCLUDED\n\n\n#ifndef CATCH_TEXTFLOW_HPP_INCLUDED\n#define CATCH_TEXTFLOW_HPP_INCLUDED\n\n\n#include <cassert>\n#include <string>\n#include <vector>\n\nnamespace Catch {\n    namespace TextFlow {\n\n        class Columns;\n\n        /**\n         * Abstraction for a string with ansi escape sequences that\n         * automatically skips over escapes when iterating. Only graphical\n         * escape sequences are considered.\n         *\n         * Internal representation:\n         * An escape sequence looks like \\033[39;49m\n         * We need bidirectional iteration and the unbound length of escape\n         * sequences poses a problem for operator-- To make this work we'll\n         * replace the last `m` with a 0xff (this is a codepoint that won't have\n         * any utf-8 meaning).\n         */\n        class AnsiSkippingString {\n            std::string m_string;\n            std::size_t m_size = 0;\n\n            // perform 0xff replacement and calculate m_size\n            void preprocessString();\n\n        public:\n            class const_iterator;\n            using iterator = const_iterator;\n            // note: must be u-suffixed or this will cause a \"truncation of\n            // constant value\" warning on MSVC\n            static constexpr char sentinel = static_cast<char>( 0xffu );\n\n            explicit AnsiSkippingString( std::string const& text );\n            explicit AnsiSkippingString( std::string&& text );\n\n            const_iterator begin() const;\n            const_iterator end() const;\n\n            size_t size() const { return m_size; }\n\n            std::string substring( const_iterator begin,\n                                   const_iterator end ) const;\n        };\n\n        class AnsiSkippingString::const_iterator {\n            friend AnsiSkippingString;\n            struct EndTag {};\n\n            const std::string* m_string;\n            std::string::const_iterator m_it;\n\n            explicit const_iterator( const std::string& string, EndTag ):\n                m_string( &string ), m_it( string.end() ) {}\n\n            void tryParseAnsiEscapes();\n            void advance();\n            void unadvance();\n\n        public:\n            using difference_type = std::ptrdiff_t;\n            using value_type = char;\n            using pointer = value_type*;\n            using reference = value_type&;\n            using iterator_category = std::bidirectional_iterator_tag;\n\n            explicit const_iterator( const std::string& string ):\n                m_string( &string ), m_it( string.begin() ) {\n                tryParseAnsiEscapes();\n            }\n\n            char operator*() const { return *m_it; }\n\n            const_iterator& operator++() {\n                advance();\n                return *this;\n            }\n            const_iterator operator++( int ) {\n                iterator prev( *this );\n                operator++();\n                return prev;\n            }\n            const_iterator& operator--() {\n                unadvance();\n                return *this;\n            }\n            const_iterator operator--( int ) {\n                iterator prev( *this );\n                operator--();\n                return prev;\n            }\n\n            bool operator==( const_iterator const& other ) const {\n                return m_it == other.m_it;\n            }\n            bool operator!=( const_iterator const& other ) const {\n                return !operator==( other );\n            }\n            bool operator<=( const_iterator const& other ) const {\n                return m_it <= other.m_it;\n            }\n\n            const_iterator oneBefore() const {\n                auto it = *this;\n                return --it;\n            }\n        };\n\n        /**\n         * Represents a column of text with specific width and indentation\n         *\n         * When written out to a stream, it will perform linebreaking\n         * of the provided text so that the written lines fit within\n         * target width.\n         */\n        class Column {\n            // String to be written out\n            AnsiSkippingString m_string;\n            // Width of the column for linebreaking\n            size_t m_width = CATCH_CONFIG_CONSOLE_WIDTH - 1;\n            // Indentation of other lines (including first if initial indent is\n            // unset)\n            size_t m_indent = 0;\n            // Indentation of the first line\n            size_t m_initialIndent = std::string::npos;\n\n        public:\n            /**\n             * Iterates \"lines\" in `Column` and returns them\n             */\n            class const_iterator {\n                friend Column;\n                struct EndTag {};\n\n                Column const& m_column;\n                // Where does the current line start?\n                AnsiSkippingString::const_iterator m_lineStart;\n                // How long should the current line be?\n                AnsiSkippingString::const_iterator m_lineEnd;\n                // How far have we checked the string to iterate?\n                AnsiSkippingString::const_iterator m_parsedTo;\n                // Should a '-' be appended to the line?\n                bool m_addHyphen = false;\n\n                const_iterator( Column const& column, EndTag ):\n                    m_column( column ),\n                    m_lineStart( m_column.m_string.end() ),\n                    m_lineEnd( column.m_string.end() ),\n                    m_parsedTo( column.m_string.end() ) {}\n\n                // Calculates the length of the current line\n                void calcLength();\n\n                // Returns current indentation width\n                size_t indentSize() const;\n\n                // Creates an indented and (optionally) suffixed string from\n                // current iterator position, indentation and length.\n                std::string addIndentAndSuffix(\n                    AnsiSkippingString::const_iterator start,\n                    AnsiSkippingString::const_iterator end ) const;\n\n            public:\n                using difference_type = std::ptrdiff_t;\n                using value_type = std::string;\n                using pointer = value_type*;\n                using reference = value_type&;\n                using iterator_category = std::forward_iterator_tag;\n\n                explicit const_iterator( Column const& column );\n\n                std::string operator*() const;\n\n                const_iterator& operator++();\n                const_iterator operator++( int );\n\n                bool operator==( const_iterator const& other ) const {\n                    return m_lineStart == other.m_lineStart &&\n                           &m_column == &other.m_column;\n                }\n                bool operator!=( const_iterator const& other ) const {\n                    return !operator==( other );\n                }\n            };\n            using iterator = const_iterator;\n\n            explicit Column( std::string const& text ): m_string( text ) {}\n            explicit Column( std::string&& text ):\n                m_string( CATCH_MOVE( text ) ) {}\n\n            Column& width( size_t newWidth ) & {\n                assert( newWidth > 0 );\n                m_width = newWidth;\n                return *this;\n            }\n            Column&& width( size_t newWidth ) && {\n                assert( newWidth > 0 );\n                m_width = newWidth;\n                return CATCH_MOVE( *this );\n            }\n            Column& indent( size_t newIndent ) & {\n                m_indent = newIndent;\n                return *this;\n            }\n            Column&& indent( size_t newIndent ) && {\n                m_indent = newIndent;\n                return CATCH_MOVE( *this );\n            }\n            Column& initialIndent( size_t newIndent ) & {\n                m_initialIndent = newIndent;\n                return *this;\n            }\n            Column&& initialIndent( size_t newIndent ) && {\n                m_initialIndent = newIndent;\n                return CATCH_MOVE( *this );\n            }\n\n            size_t width() const { return m_width; }\n            const_iterator begin() const { return const_iterator( *this ); }\n            const_iterator end() const {\n                return { *this, const_iterator::EndTag{} };\n            }\n\n            friend std::ostream& operator<<( std::ostream& os,\n                                             Column const& col );\n\n            friend Columns operator+( Column const& lhs, Column const& rhs );\n            friend Columns operator+( Column&& lhs, Column&& rhs );\n        };\n\n        //! Creates a column that serves as an empty space of specific width\n        Column Spacer( size_t spaceWidth );\n\n        class Columns {\n            std::vector<Column> m_columns;\n\n        public:\n            class iterator {\n                friend Columns;\n                struct EndTag {};\n\n                std::vector<Column> const& m_columns;\n                std::vector<Column::const_iterator> m_iterators;\n                size_t m_activeIterators;\n\n                iterator( Columns const& columns, EndTag );\n\n            public:\n                using difference_type = std::ptrdiff_t;\n                using value_type = std::string;\n                using pointer = value_type*;\n                using reference = value_type&;\n                using iterator_category = std::forward_iterator_tag;\n\n                explicit iterator( Columns const& columns );\n\n                auto operator==( iterator const& other ) const -> bool {\n                    return m_iterators == other.m_iterators;\n                }\n                auto operator!=( iterator const& other ) const -> bool {\n                    return m_iterators != other.m_iterators;\n                }\n                std::string operator*() const;\n                iterator& operator++();\n                iterator operator++( int );\n            };\n            using const_iterator = iterator;\n\n            iterator begin() const { return iterator( *this ); }\n            iterator end() const { return { *this, iterator::EndTag() }; }\n\n            friend Columns& operator+=( Columns& lhs, Column const& rhs );\n            friend Columns& operator+=( Columns& lhs, Column&& rhs );\n            friend Columns operator+( Columns const& lhs, Column const& rhs );\n            friend Columns operator+( Columns&& lhs, Column&& rhs );\n\n            friend std::ostream& operator<<( std::ostream& os,\n                                             Columns const& cols );\n        };\n\n    } // namespace TextFlow\n} // namespace Catch\n#endif // CATCH_TEXTFLOW_HPP_INCLUDED\n\n\n#ifndef CATCH_TO_STRING_HPP_INCLUDED\n#define CATCH_TO_STRING_HPP_INCLUDED\n\n#include <string>\n\n\nnamespace Catch {\n    template <typename T>\n    std::string to_string(T const& t) {\n#if defined(CATCH_CONFIG_CPP11_TO_STRING)\n        return std::to_string(t);\n#else\n        ReusableStringStream rss;\n        rss << t;\n        return rss.str();\n#endif\n    }\n} // end namespace Catch\n\n#endif // CATCH_TO_STRING_HPP_INCLUDED\n\n\n#ifndef CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED\n#define CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED\n\nnamespace Catch {\n    bool uncaught_exceptions();\n} // end namespace Catch\n\n#endif // CATCH_UNCAUGHT_EXCEPTIONS_HPP_INCLUDED\n\n\n#ifndef CATCH_XMLWRITER_HPP_INCLUDED\n#define CATCH_XMLWRITER_HPP_INCLUDED\n\n\n#include <iosfwd>\n#include <vector>\n#include <cstdint>\n\nnamespace Catch {\n    enum class XmlFormatting : std::uint8_t {\n        None = 0x00,\n        Indent = 0x01,\n        Newline = 0x02,\n    };\n\n    constexpr XmlFormatting operator|( XmlFormatting lhs, XmlFormatting rhs ) {\n        return static_cast<XmlFormatting>( static_cast<std::uint8_t>( lhs ) |\n                                           static_cast<std::uint8_t>( rhs ) );\n    }\n\n    constexpr XmlFormatting operator&( XmlFormatting lhs, XmlFormatting rhs ) {\n        return static_cast<XmlFormatting>( static_cast<std::uint8_t>( lhs ) &\n                                           static_cast<std::uint8_t>( rhs ) );\n    }\n\n\n    /**\n     * Helper for XML-encoding text (escaping angle brackets, quotes, etc)\n     *\n     * Note: doesn't take ownership of passed strings, and thus the\n     *       encoded string must outlive the encoding instance.\n     */\n    class XmlEncode {\n    public:\n        enum ForWhat { ForTextNodes, ForAttributes };\n\n        constexpr XmlEncode( StringRef str, ForWhat forWhat = ForTextNodes ):\n            m_str( str ), m_forWhat( forWhat ) {}\n\n\n        void encodeTo( std::ostream& os ) const;\n\n        friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode );\n\n    private:\n        StringRef m_str;\n        ForWhat m_forWhat;\n    };\n\n    class XmlWriter {\n    public:\n\n        class ScopedElement {\n        public:\n            ScopedElement( XmlWriter* writer, XmlFormatting fmt );\n\n            ScopedElement( ScopedElement&& other ) noexcept;\n            ScopedElement& operator=( ScopedElement&& other ) noexcept;\n\n            ~ScopedElement();\n\n            ScopedElement&\n            writeText( StringRef text,\n                       XmlFormatting fmt = XmlFormatting::Newline |\n                                           XmlFormatting::Indent );\n\n            ScopedElement& writeAttribute( StringRef name,\n                                           StringRef attribute );\n            template <typename T,\n                      // Without this SFINAE, this overload is a better match\n                      // for `std::string`, `char const*`, `char const[N]` args.\n                      // While it would still work, it would cause code bloat\n                      // and multiple iteration over the strings\n                      typename = typename std::enable_if_t<\n                          !std::is_convertible<T, StringRef>::value>>\n            ScopedElement& writeAttribute( StringRef name,\n                                           T const& attribute ) {\n                m_writer->writeAttribute( name, attribute );\n                return *this;\n            }\n\n        private:\n            XmlWriter* m_writer = nullptr;\n            XmlFormatting m_fmt;\n        };\n\n        XmlWriter( std::ostream& os );\n        ~XmlWriter();\n\n        XmlWriter( XmlWriter const& ) = delete;\n        XmlWriter& operator=( XmlWriter const& ) = delete;\n\n        XmlWriter& startElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        ScopedElement scopedElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent);\n\n        //! The attribute content is XML-encoded\n        XmlWriter& writeAttribute( StringRef name, StringRef attribute );\n\n        //! Writes the attribute as \"true/false\"\n        XmlWriter& writeAttribute( StringRef name, bool attribute );\n\n        //! The attribute content is XML-encoded\n        XmlWriter& writeAttribute( StringRef name, char const* attribute );\n\n        //! The attribute value must provide op<<(ostream&, T). The resulting\n        //! serialization is XML-encoded\n        template <typename T,\n                  // Without this SFINAE, this overload is a better match\n                  // for `std::string`, `char const*`, `char const[N]` args.\n                  // While it would still work, it would cause code bloat\n                  // and multiple iteration over the strings\n                  typename = typename std::enable_if_t<\n                      !std::is_convertible<T, StringRef>::value>>\n        XmlWriter& writeAttribute( StringRef name, T const& attribute ) {\n            ReusableStringStream rss;\n            rss << attribute;\n            return writeAttribute( name, rss.str() );\n        }\n\n        //! Writes escaped `text` in a element\n        XmlWriter& writeText( StringRef text,\n                              XmlFormatting fmt = XmlFormatting::Newline |\n                                                  XmlFormatting::Indent );\n\n        //! Writes XML comment as \"<!-- text -->\"\n        XmlWriter& writeComment( StringRef text,\n                                 XmlFormatting fmt = XmlFormatting::Newline |\n                                                     XmlFormatting::Indent );\n\n        void writeStylesheetRef( StringRef url );\n\n        void ensureTagClosed();\n\n    private:\n\n        void applyFormatting(XmlFormatting fmt);\n\n        void writeDeclaration();\n\n        void newlineIfNecessary();\n\n        bool m_tagIsOpen = false;\n        bool m_needsNewline = false;\n        std::vector<std::string> m_tags;\n        std::string m_indent;\n        std::ostream& m_os;\n    };\n\n}\n\n#endif // CATCH_XMLWRITER_HPP_INCLUDED\n\n\n/** \\file\n * This is a convenience header for Catch2's Matcher support. It includes\n * **all** of Catch2 headers related to matchers.\n *\n * Generally the Catch2 users should use specific includes they need,\n * but this header can be used instead for ease-of-experimentation, or\n * just plain convenience, at the cost of increased compilation times.\n *\n * When a new header is added to either the `matchers` folder, or to\n * the corresponding internal subfolder, it should be added here.\n */\n\n#ifndef CATCH_MATCHERS_ALL_HPP_INCLUDED\n#define CATCH_MATCHERS_ALL_HPP_INCLUDED\n\n\n\n#ifndef CATCH_MATCHERS_HPP_INCLUDED\n#define CATCH_MATCHERS_HPP_INCLUDED\n\n\n\n#ifndef CATCH_MATCHERS_IMPL_HPP_INCLUDED\n#define CATCH_MATCHERS_IMPL_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\n\n#ifdef __clang__\n#    pragma clang diagnostic push\n#    pragma clang diagnostic ignored \"-Wsign-compare\"\n#    pragma clang diagnostic ignored \"-Wnon-virtual-dtor\"\n#elif defined __GNUC__\n#    pragma GCC diagnostic push\n#    pragma GCC diagnostic ignored \"-Wsign-compare\"\n#    pragma GCC diagnostic ignored \"-Wnon-virtual-dtor\"\n#endif\n\n    template<typename ArgT, typename MatcherT>\n    class MatchExpr : public ITransientExpression {\n        ArgT && m_arg;\n        MatcherT const& m_matcher;\n    public:\n        constexpr MatchExpr( ArgT && arg, MatcherT const& matcher )\n        :   ITransientExpression{ true, matcher.match( arg ) }, // not forwarding arg here on purpose\n            m_arg( CATCH_FORWARD(arg) ),\n            m_matcher( matcher )\n        {}\n\n        void streamReconstructedExpression( std::ostream& os ) const override {\n            os << Catch::Detail::stringify( m_arg )\n               << ' '\n               << m_matcher.toString();\n        }\n    };\n\n#ifdef __clang__\n#    pragma clang diagnostic pop\n#elif defined __GNUC__\n#    pragma GCC diagnostic pop\n#endif\n\n\n    namespace Matchers {\n        template <typename ArgT>\n        class MatcherBase;\n    }\n\n    using StringMatcher = Matchers::MatcherBase<std::string>;\n\n    void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher );\n\n    template<typename ArgT, typename MatcherT>\n    constexpr MatchExpr<ArgT, MatcherT>\n    makeMatchExpr( ArgT&& arg, MatcherT const& matcher ) {\n        return MatchExpr<ArgT, MatcherT>( CATCH_FORWARD(arg), matcher );\n    }\n\n} // namespace Catch\n\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        INTERNAL_CATCH_TRY { \\\n            catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher ) ); \\\n        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \\\n        catchAssertionHandler.complete(); \\\n    } while( false )\n\n\n///////////////////////////////////////////////////////////////////////////////\n#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \\\n    do { \\\n        Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) \", \" CATCH_INTERNAL_STRINGIFY(exceptionType) \", \" CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \\\n        if( catchAssertionHandler.allowThrows() ) \\\n            try { \\\n                CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \\\n                CATCH_INTERNAL_SUPPRESS_USELESS_CAST_WARNINGS \\\n                static_cast<void>(__VA_ARGS__ ); \\\n                CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \\\n                catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \\\n            } \\\n            catch( exceptionType const& ex ) { \\\n                catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher ) ); \\\n            } \\\n            catch( ... ) { \\\n                catchAssertionHandler.handleUnexpectedInflightException(); \\\n            } \\\n        else \\\n            catchAssertionHandler.handleThrowingCallSkipped(); \\\n        catchAssertionHandler.complete(); \\\n    } while( false )\n\n\n#endif // CATCH_MATCHERS_IMPL_HPP_INCLUDED\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\nnamespace Matchers {\n\n    class MatcherUntypedBase {\n    public:\n        MatcherUntypedBase() = default;\n\n        MatcherUntypedBase(MatcherUntypedBase const&) = default;\n        MatcherUntypedBase(MatcherUntypedBase&&) = default;\n\n        MatcherUntypedBase& operator = (MatcherUntypedBase const&) = delete;\n        MatcherUntypedBase& operator = (MatcherUntypedBase&&) = delete;\n\n        std::string toString() const;\n\n    protected:\n        virtual ~MatcherUntypedBase(); // = default;\n        virtual std::string describe() const = 0;\n        mutable std::string m_cachedToString;\n    };\n\n\n    template<typename T>\n    class MatcherBase : public MatcherUntypedBase {\n    public:\n        virtual bool match( T const& arg ) const = 0;\n    };\n\n    namespace Detail {\n\n        template<typename ArgT>\n        class MatchAllOf final : public MatcherBase<ArgT> {\n            std::vector<MatcherBase<ArgT> const*> m_matchers;\n\n        public:\n            MatchAllOf() = default;\n            MatchAllOf(MatchAllOf const&) = delete;\n            MatchAllOf& operator=(MatchAllOf const&) = delete;\n            MatchAllOf(MatchAllOf&&) = default;\n            MatchAllOf& operator=(MatchAllOf&&) = default;\n\n\n            bool match( ArgT const& arg ) const override {\n                for( auto matcher : m_matchers ) {\n                    if (!matcher->match(arg))\n                        return false;\n                }\n                return true;\n            }\n            std::string describe() const override {\n                std::string description;\n                description.reserve( 4 + m_matchers.size()*32 );\n                description += \"( \";\n                bool first = true;\n                for( auto matcher : m_matchers ) {\n                    if( first )\n                        first = false;\n                    else\n                        description += \" and \";\n                    description += matcher->toString();\n                }\n                description += \" )\";\n                return description;\n            }\n\n            friend MatchAllOf operator&& (MatchAllOf&& lhs, MatcherBase<ArgT> const& rhs) {\n                lhs.m_matchers.push_back(&rhs);\n                return CATCH_MOVE(lhs);\n            }\n            friend MatchAllOf operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf&& rhs) {\n                rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs);\n                return CATCH_MOVE(rhs);\n            }\n        };\n\n        //! lvalue overload is intentionally deleted, users should\n        //! not be trying to compose stored composition matchers\n        template<typename ArgT>\n        MatchAllOf<ArgT> operator&& (MatchAllOf<ArgT> const& lhs, MatcherBase<ArgT> const& rhs) = delete;\n        //! lvalue overload is intentionally deleted, users should\n        //! not be trying to compose stored composition matchers\n        template<typename ArgT>\n        MatchAllOf<ArgT> operator&& (MatcherBase<ArgT> const& lhs, MatchAllOf<ArgT> const& rhs) = delete;\n\n        template<typename ArgT>\n        class MatchAnyOf final : public MatcherBase<ArgT> {\n            std::vector<MatcherBase<ArgT> const*> m_matchers;\n        public:\n            MatchAnyOf() = default;\n            MatchAnyOf(MatchAnyOf const&) = delete;\n            MatchAnyOf& operator=(MatchAnyOf const&) = delete;\n            MatchAnyOf(MatchAnyOf&&) = default;\n            MatchAnyOf& operator=(MatchAnyOf&&) = default;\n\n            bool match( ArgT const& arg ) const override {\n                for( auto matcher : m_matchers ) {\n                    if (matcher->match(arg))\n                        return true;\n                }\n                return false;\n            }\n            std::string describe() const override {\n                std::string description;\n                description.reserve( 4 + m_matchers.size()*32 );\n                description += \"( \";\n                bool first = true;\n                for( auto matcher : m_matchers ) {\n                    if( first )\n                        first = false;\n                    else\n                        description += \" or \";\n                    description += matcher->toString();\n                }\n                description += \" )\";\n                return description;\n            }\n\n            friend MatchAnyOf operator|| (MatchAnyOf&& lhs, MatcherBase<ArgT> const& rhs) {\n                lhs.m_matchers.push_back(&rhs);\n                return CATCH_MOVE(lhs);\n            }\n            friend MatchAnyOf operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf&& rhs) {\n                rhs.m_matchers.insert(rhs.m_matchers.begin(), &lhs);\n                return CATCH_MOVE(rhs);\n            }\n        };\n\n        //! lvalue overload is intentionally deleted, users should\n        //! not be trying to compose stored composition matchers\n        template<typename ArgT>\n        MatchAnyOf<ArgT> operator|| (MatchAnyOf<ArgT> const& lhs, MatcherBase<ArgT> const& rhs) = delete;\n        //! lvalue overload is intentionally deleted, users should\n        //! not be trying to compose stored composition matchers\n        template<typename ArgT>\n        MatchAnyOf<ArgT> operator|| (MatcherBase<ArgT> const& lhs, MatchAnyOf<ArgT> const& rhs) = delete;\n\n        template<typename ArgT>\n        class MatchNotOf final : public MatcherBase<ArgT> {\n            MatcherBase<ArgT> const& m_underlyingMatcher;\n\n        public:\n            explicit MatchNotOf( MatcherBase<ArgT> const& underlyingMatcher ):\n                m_underlyingMatcher( underlyingMatcher )\n            {}\n\n            bool match( ArgT const& arg ) const override {\n                return !m_underlyingMatcher.match( arg );\n            }\n\n            std::string describe() const override {\n                return \"not \" + m_underlyingMatcher.toString();\n            }\n        };\n\n    } // namespace Detail\n\n    template <typename T>\n    Detail::MatchAllOf<T> operator&& (MatcherBase<T> const& lhs, MatcherBase<T> const& rhs) {\n        return Detail::MatchAllOf<T>{} && lhs && rhs;\n    }\n    template <typename T>\n    Detail::MatchAnyOf<T> operator|| (MatcherBase<T> const& lhs, MatcherBase<T> const& rhs) {\n        return Detail::MatchAnyOf<T>{} || lhs || rhs;\n    }\n\n    template <typename T>\n    Detail::MatchNotOf<T> operator! (MatcherBase<T> const& matcher) {\n        return Detail::MatchNotOf<T>{ matcher };\n    }\n\n\n} // namespace Matchers\n} // namespace Catch\n\n\n#if defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE)\n  #define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CATCH_REQUIRE_THROWS_WITH\", Catch::ResultDisposition::Normal, matcher, expr )\n  #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CATCH_REQUIRE_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )\n\n  #define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CATCH_CHECK_THROWS_WITH\", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n  #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CATCH_CHECK_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n\n  #define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CATCH_CHECK_THAT\", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )\n  #define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CATCH_REQUIRE_THAT\", matcher, Catch::ResultDisposition::Normal, arg )\n\n#elif defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE)\n\n  #define CATCH_REQUIRE_THROWS_WITH( expr, matcher )                   (void)(0)\n  #define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n\n  #define CATCH_CHECK_THROWS_WITH( expr, matcher )                     (void)(0)\n  #define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher )   (void)(0)\n\n  #define CATCH_CHECK_THAT( arg, matcher )                             (void)(0)\n  #define CATCH_REQUIRE_THAT( arg, matcher )                           (void)(0)\n\n#elif !defined(CATCH_CONFIG_PREFIX_ALL) && !defined(CATCH_CONFIG_DISABLE)\n\n  #define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"REQUIRE_THROWS_WITH\", Catch::ResultDisposition::Normal, matcher, expr )\n  #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"REQUIRE_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )\n\n  #define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( \"CHECK_THROWS_WITH\", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n  #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( \"CHECK_THROWS_MATCHES\", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )\n\n  #define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"CHECK_THAT\", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )\n  #define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( \"REQUIRE_THAT\", matcher, Catch::ResultDisposition::Normal, arg )\n\n#elif !defined(CATCH_CONFIG_PREFIX_ALL) && defined(CATCH_CONFIG_DISABLE)\n\n  #define REQUIRE_THROWS_WITH( expr, matcher )                   (void)(0)\n  #define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)\n\n  #define CHECK_THROWS_WITH( expr, matcher )                     (void)(0)\n  #define CHECK_THROWS_MATCHES( expr, exceptionType, matcher )   (void)(0)\n\n  #define CHECK_THAT( arg, matcher )                             (void)(0)\n  #define REQUIRE_THAT( arg, matcher )                           (void)(0)\n\n#endif // end of user facing macro declarations\n\n#endif // CATCH_MATCHERS_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED\n#define CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED\n\n\n\n#ifndef CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED\n#define CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED\n\n\n#include <array>\n#include <algorithm>\n#include <string>\n#include <type_traits>\n\nnamespace Catch {\nnamespace Matchers {\n    class MatcherGenericBase : public MatcherUntypedBase {\n    public:\n        MatcherGenericBase() = default;\n        ~MatcherGenericBase() override; // = default;\n\n        MatcherGenericBase(MatcherGenericBase const&) = default;\n        MatcherGenericBase(MatcherGenericBase&&) = default;\n\n        MatcherGenericBase& operator=(MatcherGenericBase const&) = delete;\n        MatcherGenericBase& operator=(MatcherGenericBase&&) = delete;\n    };\n\n\n    namespace Detail {\n        template<std::size_t N, std::size_t M>\n        std::array<void const*, N + M> array_cat(std::array<void const*, N> && lhs, std::array<void const*, M> && rhs) {\n            std::array<void const*, N + M> arr{};\n            std::copy_n(lhs.begin(), N, arr.begin());\n            std::copy_n(rhs.begin(), M, arr.begin() + N);\n            return arr;\n        }\n\n        template<std::size_t N>\n        std::array<void const*, N+1> array_cat(std::array<void const*, N> && lhs, void const* rhs) {\n            std::array<void const*, N+1> arr{};\n            std::copy_n(lhs.begin(), N, arr.begin());\n            arr[N] = rhs;\n            return arr;\n        }\n\n        template<std::size_t N>\n        std::array<void const*, N+1> array_cat(void const* lhs, std::array<void const*, N> && rhs) {\n            std::array<void const*, N + 1> arr{ {lhs} };\n            std::copy_n(rhs.begin(), N, arr.begin() + 1);\n            return arr;\n        }\n\n        template<typename T>\n        using is_generic_matcher = std::is_base_of<\n            Catch::Matchers::MatcherGenericBase,\n            std::remove_cv_t<std::remove_reference_t<T>>\n        >;\n\n        template<typename... Ts>\n        using are_generic_matchers = Catch::Detail::conjunction<is_generic_matcher<Ts>...>;\n\n        template<typename T>\n        using is_matcher = std::is_base_of<\n            Catch::Matchers::MatcherUntypedBase,\n            std::remove_cv_t<std::remove_reference_t<T>>\n        >;\n\n\n        template<std::size_t N, typename Arg>\n        bool match_all_of(Arg&&, std::array<void const*, N> const&, std::index_sequence<>) {\n            return true;\n        }\n\n        template<typename T, typename... MatcherTs, std::size_t N, typename Arg, std::size_t Idx, std::size_t... Indices>\n        bool match_all_of(Arg&& arg, std::array<void const*, N> const& matchers, std::index_sequence<Idx, Indices...>) {\n            return static_cast<T const*>(matchers[Idx])->match(arg) && match_all_of<MatcherTs...>(arg, matchers, std::index_sequence<Indices...>{});\n        }\n\n\n        template<std::size_t N, typename Arg>\n        bool match_any_of(Arg&&, std::array<void const*, N> const&, std::index_sequence<>) {\n            return false;\n        }\n\n        template<typename T, typename... MatcherTs, std::size_t N, typename Arg, std::size_t Idx, std::size_t... Indices>\n        bool match_any_of(Arg&& arg, std::array<void const*, N> const& matchers, std::index_sequence<Idx, Indices...>) {\n            return static_cast<T const*>(matchers[Idx])->match(arg) || match_any_of<MatcherTs...>(arg, matchers, std::index_sequence<Indices...>{});\n        }\n\n        std::string describe_multi_matcher(StringRef combine, std::string const* descriptions_begin, std::string const* descriptions_end);\n\n        template<typename... MatcherTs, std::size_t... Idx>\n        std::string describe_multi_matcher(StringRef combine, std::array<void const*, sizeof...(MatcherTs)> const& matchers, std::index_sequence<Idx...>) {\n            std::array<std::string, sizeof...(MatcherTs)> descriptions {{\n                static_cast<MatcherTs const*>(matchers[Idx])->toString()...\n            }};\n\n            return describe_multi_matcher(combine, descriptions.data(), descriptions.data() + descriptions.size());\n        }\n\n\n        template<typename... MatcherTs>\n        class MatchAllOfGeneric final : public MatcherGenericBase {\n        public:\n            MatchAllOfGeneric(MatchAllOfGeneric const&) = delete;\n            MatchAllOfGeneric& operator=(MatchAllOfGeneric const&) = delete;\n            MatchAllOfGeneric(MatchAllOfGeneric&&) = default;\n            MatchAllOfGeneric& operator=(MatchAllOfGeneric&&) = default;\n\n            MatchAllOfGeneric(MatcherTs const&... matchers) : m_matchers{ {std::addressof(matchers)...} } {}\n            explicit MatchAllOfGeneric(std::array<void const*, sizeof...(MatcherTs)> matchers) : m_matchers{matchers} {}\n\n            template<typename Arg>\n            bool match(Arg&& arg) const {\n                return match_all_of<MatcherTs...>(arg, m_matchers, std::index_sequence_for<MatcherTs...>{});\n            }\n\n            std::string describe() const override {\n                return describe_multi_matcher<MatcherTs...>(\" and \"_sr, m_matchers, std::index_sequence_for<MatcherTs...>{});\n            }\n\n            // Has to be public to enable the concatenating operators\n            // below, because they are not friend of the RHS, only LHS,\n            // and thus cannot access private fields of RHS\n            std::array<void const*, sizeof...( MatcherTs )> m_matchers;\n\n\n            //! Avoids type nesting for `GenericAllOf && GenericAllOf` case\n            template<typename... MatchersRHS>\n            friend\n            MatchAllOfGeneric<MatcherTs..., MatchersRHS...> operator && (\n                    MatchAllOfGeneric<MatcherTs...>&& lhs,\n                    MatchAllOfGeneric<MatchersRHS...>&& rhs) {\n                return MatchAllOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(CATCH_MOVE(lhs.m_matchers), CATCH_MOVE(rhs.m_matchers))};\n            }\n\n            //! Avoids type nesting for `GenericAllOf && some matcher` case\n            template<typename MatcherRHS>\n            friend std::enable_if_t<is_matcher<MatcherRHS>::value,\n            MatchAllOfGeneric<MatcherTs..., MatcherRHS>> operator && (\n                    MatchAllOfGeneric<MatcherTs...>&& lhs,\n                    MatcherRHS const& rhs) {\n                return MatchAllOfGeneric<MatcherTs..., MatcherRHS>{array_cat(CATCH_MOVE(lhs.m_matchers), static_cast<void const*>(&rhs))};\n            }\n\n            //! Avoids type nesting for `some matcher && GenericAllOf` case\n            template<typename MatcherLHS>\n            friend std::enable_if_t<is_matcher<MatcherLHS>::value,\n            MatchAllOfGeneric<MatcherLHS, MatcherTs...>> operator && (\n                    MatcherLHS const& lhs,\n                    MatchAllOfGeneric<MatcherTs...>&& rhs) {\n                return MatchAllOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), CATCH_MOVE(rhs.m_matchers))};\n            }\n        };\n\n\n        template<typename... MatcherTs>\n        class MatchAnyOfGeneric final : public MatcherGenericBase {\n        public:\n            MatchAnyOfGeneric(MatchAnyOfGeneric const&) = delete;\n            MatchAnyOfGeneric& operator=(MatchAnyOfGeneric const&) = delete;\n            MatchAnyOfGeneric(MatchAnyOfGeneric&&) = default;\n            MatchAnyOfGeneric& operator=(MatchAnyOfGeneric&&) = default;\n\n            MatchAnyOfGeneric(MatcherTs const&... matchers) : m_matchers{ {std::addressof(matchers)...} } {}\n            explicit MatchAnyOfGeneric(std::array<void const*, sizeof...(MatcherTs)> matchers) : m_matchers{matchers} {}\n\n            template<typename Arg>\n            bool match(Arg&& arg) const {\n                return match_any_of<MatcherTs...>(arg, m_matchers, std::index_sequence_for<MatcherTs...>{});\n            }\n\n            std::string describe() const override {\n                return describe_multi_matcher<MatcherTs...>(\" or \"_sr, m_matchers, std::index_sequence_for<MatcherTs...>{});\n            }\n\n\n            // Has to be public to enable the concatenating operators\n            // below, because they are not friend of the RHS, only LHS,\n            // and thus cannot access private fields of RHS\n            std::array<void const*, sizeof...( MatcherTs )> m_matchers;\n\n            //! Avoids type nesting for `GenericAnyOf || GenericAnyOf` case\n            template<typename... MatchersRHS>\n            friend MatchAnyOfGeneric<MatcherTs..., MatchersRHS...> operator || (\n                    MatchAnyOfGeneric<MatcherTs...>&& lhs,\n                    MatchAnyOfGeneric<MatchersRHS...>&& rhs) {\n                return MatchAnyOfGeneric<MatcherTs..., MatchersRHS...>{array_cat(CATCH_MOVE(lhs.m_matchers), CATCH_MOVE(rhs.m_matchers))};\n            }\n\n            //! Avoids type nesting for `GenericAnyOf || some matcher` case\n            template<typename MatcherRHS>\n            friend std::enable_if_t<is_matcher<MatcherRHS>::value,\n            MatchAnyOfGeneric<MatcherTs..., MatcherRHS>> operator || (\n                    MatchAnyOfGeneric<MatcherTs...>&& lhs,\n                    MatcherRHS const& rhs) {\n                return MatchAnyOfGeneric<MatcherTs..., MatcherRHS>{array_cat(CATCH_MOVE(lhs.m_matchers), static_cast<void const*>(std::addressof(rhs)))};\n            }\n\n            //! Avoids type nesting for `some matcher || GenericAnyOf` case\n            template<typename MatcherLHS>\n            friend std::enable_if_t<is_matcher<MatcherLHS>::value,\n            MatchAnyOfGeneric<MatcherLHS, MatcherTs...>> operator || (\n                MatcherLHS const& lhs,\n                MatchAnyOfGeneric<MatcherTs...>&& rhs) {\n                return MatchAnyOfGeneric<MatcherLHS, MatcherTs...>{array_cat(static_cast<void const*>(std::addressof(lhs)), CATCH_MOVE(rhs.m_matchers))};\n            }\n        };\n\n\n        template<typename MatcherT>\n        class MatchNotOfGeneric final : public MatcherGenericBase {\n            MatcherT const& m_matcher;\n\n        public:\n            MatchNotOfGeneric(MatchNotOfGeneric const&) = delete;\n            MatchNotOfGeneric& operator=(MatchNotOfGeneric const&) = delete;\n            MatchNotOfGeneric(MatchNotOfGeneric&&) = default;\n            MatchNotOfGeneric& operator=(MatchNotOfGeneric&&) = default;\n\n            explicit MatchNotOfGeneric(MatcherT const& matcher) : m_matcher{matcher} {}\n\n            template<typename Arg>\n            bool match(Arg&& arg) const {\n                return !m_matcher.match(arg);\n            }\n\n            std::string describe() const override {\n                return \"not \" + m_matcher.toString();\n            }\n\n            //! Negating negation can just unwrap and return underlying matcher\n            friend MatcherT const& operator ! (MatchNotOfGeneric<MatcherT> const& matcher) {\n                return matcher.m_matcher;\n            }\n        };\n    } // namespace Detail\n\n\n    // compose only generic matchers\n    template<typename MatcherLHS, typename MatcherRHS>\n    std::enable_if_t<Detail::are_generic_matchers<MatcherLHS, MatcherRHS>::value, Detail::MatchAllOfGeneric<MatcherLHS, MatcherRHS>>\n        operator && (MatcherLHS const& lhs, MatcherRHS const& rhs) {\n        return { lhs, rhs };\n    }\n\n    template<typename MatcherLHS, typename MatcherRHS>\n    std::enable_if_t<Detail::are_generic_matchers<MatcherLHS, MatcherRHS>::value, Detail::MatchAnyOfGeneric<MatcherLHS, MatcherRHS>>\n        operator || (MatcherLHS const& lhs, MatcherRHS const& rhs) {\n        return { lhs, rhs };\n    }\n\n    //! Wrap provided generic matcher in generic negator\n    template<typename MatcherT>\n    std::enable_if_t<Detail::is_generic_matcher<MatcherT>::value, Detail::MatchNotOfGeneric<MatcherT>>\n        operator ! (MatcherT const& matcher) {\n        return Detail::MatchNotOfGeneric<MatcherT>{matcher};\n    }\n\n\n    // compose mixed generic and non-generic matchers\n    template<typename MatcherLHS, typename ArgRHS>\n    std::enable_if_t<Detail::is_generic_matcher<MatcherLHS>::value, Detail::MatchAllOfGeneric<MatcherLHS, MatcherBase<ArgRHS>>>\n        operator && (MatcherLHS const& lhs, MatcherBase<ArgRHS> const& rhs) {\n        return { lhs, rhs };\n    }\n\n    template<typename ArgLHS, typename MatcherRHS>\n    std::enable_if_t<Detail::is_generic_matcher<MatcherRHS>::value, Detail::MatchAllOfGeneric<MatcherBase<ArgLHS>, MatcherRHS>>\n        operator && (MatcherBase<ArgLHS> const& lhs, MatcherRHS const& rhs) {\n        return { lhs, rhs };\n    }\n\n    template<typename MatcherLHS, typename ArgRHS>\n    std::enable_if_t<Detail::is_generic_matcher<MatcherLHS>::value, Detail::MatchAnyOfGeneric<MatcherLHS, MatcherBase<ArgRHS>>>\n        operator || (MatcherLHS const& lhs, MatcherBase<ArgRHS> const& rhs) {\n        return { lhs, rhs };\n    }\n\n    template<typename ArgLHS, typename MatcherRHS>\n    std::enable_if_t<Detail::is_generic_matcher<MatcherRHS>::value, Detail::MatchAnyOfGeneric<MatcherBase<ArgLHS>, MatcherRHS>>\n        operator || (MatcherBase<ArgLHS> const& lhs, MatcherRHS const& rhs) {\n        return { lhs, rhs };\n    }\n\n} // namespace Matchers\n} // namespace Catch\n\n#endif // CATCH_MATCHERS_TEMPLATED_HPP_INCLUDED\n\nnamespace Catch {\n    namespace Matchers {\n\n        class IsEmptyMatcher final : public MatcherGenericBase {\n        public:\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS)\n                using Catch::Detail::empty;\n#else\n                using std::empty;\n#endif\n                return empty(rng);\n            }\n\n            std::string describe() const override;\n        };\n\n        class HasSizeMatcher final : public MatcherGenericBase {\n            std::size_t m_target_size;\n        public:\n            explicit HasSizeMatcher(std::size_t target_size):\n                m_target_size(target_size)\n            {}\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS)\n                using Catch::Detail::size;\n#else\n                using std::size;\n#endif\n                return size(rng) == m_target_size;\n            }\n\n            std::string describe() const override;\n        };\n\n        template <typename Matcher>\n        class SizeMatchesMatcher final : public MatcherGenericBase {\n            Matcher m_matcher;\n        public:\n            explicit SizeMatchesMatcher(Matcher m):\n                m_matcher(CATCH_MOVE(m))\n            {}\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n#if defined(CATCH_CONFIG_POLYFILL_NONMEMBER_CONTAINER_ACCESS)\n                using Catch::Detail::size;\n#else\n                using std::size;\n#endif\n                return m_matcher.match(size(rng));\n            }\n\n            std::string describe() const override {\n                return \"size matches \" + m_matcher.describe();\n            }\n        };\n\n\n        //! Creates a matcher that accepts empty ranges/containers\n        IsEmptyMatcher IsEmpty();\n        //! Creates a matcher that accepts ranges/containers with specific size\n        HasSizeMatcher SizeIs(std::size_t sz);\n        template <typename Matcher>\n        std::enable_if_t<Detail::is_matcher<Matcher>::value,\n        SizeMatchesMatcher<Matcher>> SizeIs(Matcher&& m) {\n            return SizeMatchesMatcher<Matcher>{CATCH_FORWARD(m)};\n        }\n\n    } // end namespace Matchers\n} // end namespace Catch\n\n#endif // CATCH_MATCHERS_CONTAINER_PROPERTIES_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_CONTAINS_HPP_INCLUDED\n#define CATCH_MATCHERS_CONTAINS_HPP_INCLUDED\n\n\n#include <algorithm>\n#include <functional>\n\nnamespace Catch {\n    namespace Matchers {\n        //! Matcher for checking that an element in range is equal to specific element\n        template <typename T, typename Equality>\n        class ContainsElementMatcher final : public MatcherGenericBase {\n            T m_desired;\n            Equality m_eq;\n        public:\n            template <typename T2, typename Equality2>\n            ContainsElementMatcher(T2&& target, Equality2&& predicate):\n                m_desired(CATCH_FORWARD(target)),\n                m_eq(CATCH_FORWARD(predicate))\n            {}\n\n            std::string describe() const override {\n                return \"contains element \" + Catch::Detail::stringify(m_desired);\n            }\n\n            template <typename RangeLike>\n            bool match( RangeLike&& rng ) const {\n                for ( auto&& elem : rng ) {\n                    if ( m_eq( elem, m_desired ) ) { return true; }\n                }\n                return false;\n            }\n        };\n\n        //! Meta-matcher for checking that an element in a range matches a specific matcher\n        template <typename Matcher>\n        class ContainsMatcherMatcher final : public MatcherGenericBase {\n            Matcher m_matcher;\n        public:\n            // Note that we do a copy+move to avoid having to SFINAE this\n            // constructor (and also avoid some perfect forwarding failure\n            // cases)\n            ContainsMatcherMatcher(Matcher matcher):\n                m_matcher(CATCH_MOVE(matcher))\n            {}\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n                for (auto&& elem : rng) {\n                    if (m_matcher.match(elem)) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n\n            std::string describe() const override {\n                return \"contains element matching \" + m_matcher.describe();\n            }\n        };\n\n        /**\n         * Creates a matcher that checks whether a range contains a specific element.\n         *\n         * Uses `std::equal_to` to do the comparison\n         */\n        template <typename T>\n        std::enable_if_t<!Detail::is_matcher<T>::value,\n        ContainsElementMatcher<T, std::equal_to<>>> Contains(T&& elem) {\n            return { CATCH_FORWARD(elem), std::equal_to<>{} };\n        }\n\n        //! Creates a matcher that checks whether a range contains element matching a matcher\n        template <typename Matcher>\n        std::enable_if_t<Detail::is_matcher<Matcher>::value,\n        ContainsMatcherMatcher<Matcher>> Contains(Matcher&& matcher) {\n            return { CATCH_FORWARD(matcher) };\n        }\n\n        /**\n         * Creates a matcher that checks whether a range contains a specific element.\n         *\n         * Uses `eq` to do the comparisons, the element is provided on the rhs\n         */\n        template <typename T, typename Equality>\n        ContainsElementMatcher<T, Equality> Contains(T&& elem, Equality&& eq) {\n            return { CATCH_FORWARD(elem), CATCH_FORWARD(eq) };\n        }\n\n    }\n}\n\n#endif // CATCH_MATCHERS_CONTAINS_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED\n#define CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED\n\n\nnamespace Catch {\nnamespace Matchers {\n\nclass ExceptionMessageMatcher final : public MatcherBase<std::exception> {\n    std::string m_message;\npublic:\n\n    ExceptionMessageMatcher(std::string const& message):\n        m_message(message)\n    {}\n\n    bool match(std::exception const& ex) const override;\n\n    std::string describe() const override;\n};\n\n//! Creates a matcher that checks whether a std derived exception has the provided message\nExceptionMessageMatcher Message(std::string const& message);\n\ntemplate <typename StringMatcherType>\nclass ExceptionMessageMatchesMatcher final\n    : public MatcherBase<std::exception> {\n    StringMatcherType m_matcher;\n\npublic:\n    ExceptionMessageMatchesMatcher( StringMatcherType matcher ):\n        m_matcher( CATCH_MOVE( matcher ) ) {}\n\n    bool match( std::exception const& ex ) const override {\n        return m_matcher.match( ex.what() );\n    }\n\n    std::string describe() const override {\n        return \" matches \\\"\" + m_matcher.describe() + '\"';\n    }\n};\n\n//! Creates a matcher that checks whether a message from an std derived\n//! exception matches a provided matcher\ntemplate <typename StringMatcherType>\nExceptionMessageMatchesMatcher<StringMatcherType>\nMessageMatches( StringMatcherType&& matcher ) {\n    return { CATCH_FORWARD( matcher ) };\n}\n\n} // namespace Matchers\n} // namespace Catch\n\n#endif // CATCH_MATCHERS_EXCEPTION_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED\n#define CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED\n\n\nnamespace Catch {\nnamespace Matchers {\n\n    namespace Detail {\n        enum class FloatingPointKind : uint8_t;\n    }\n\n    class  WithinAbsMatcher final : public MatcherBase<double> {\n    public:\n        WithinAbsMatcher(double target, double margin);\n        bool match(double const& matchee) const override;\n        std::string describe() const override;\n    private:\n        double m_target;\n        double m_margin;\n    };\n\n    //! Creates a matcher that accepts numbers within certain range of target\n    WithinAbsMatcher WithinAbs( double target, double margin );\n\n\n\n    class WithinUlpsMatcher final : public MatcherBase<double> {\n    public:\n        WithinUlpsMatcher( double target,\n                           uint64_t ulps,\n                           Detail::FloatingPointKind baseType );\n        bool match(double const& matchee) const override;\n        std::string describe() const override;\n    private:\n        double m_target;\n        uint64_t m_ulps;\n        Detail::FloatingPointKind m_type;\n    };\n\n    //! Creates a matcher that accepts doubles within certain ULP range of target\n    WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff);\n    //! Creates a matcher that accepts floats within certain ULP range of target\n    WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff);\n\n\n\n    // Given IEEE-754 format for floats and doubles, we can assume\n    // that float -> double promotion is lossless. Given this, we can\n    // assume that if we do the standard relative comparison of\n    // |lhs - rhs| <= epsilon * max(fabs(lhs), fabs(rhs)), then we get\n    // the same result if we do this for floats, as if we do this for\n    // doubles that were promoted from floats.\n    class WithinRelMatcher final : public MatcherBase<double> {\n    public:\n        WithinRelMatcher( double target, double epsilon );\n        bool match(double const& matchee) const override;\n        std::string describe() const override;\n    private:\n        double m_target;\n        double m_epsilon;\n    };\n\n    //! Creates a matcher that accepts doubles within certain relative range of target\n    WithinRelMatcher WithinRel(double target, double eps);\n    //! Creates a matcher that accepts doubles within 100*DBL_EPS relative range of target\n    WithinRelMatcher WithinRel(double target);\n    //! Creates a matcher that accepts doubles within certain relative range of target\n    WithinRelMatcher WithinRel(float target, float eps);\n    //! Creates a matcher that accepts floats within 100*FLT_EPS relative range of target\n    WithinRelMatcher WithinRel(float target);\n\n\n\n    class IsNaNMatcher final : public MatcherBase<double> {\n    public:\n        IsNaNMatcher() = default;\n        bool match( double const& matchee ) const override;\n        std::string describe() const override;\n    };\n\n    IsNaNMatcher IsNaN();\n\n} // namespace Matchers\n} // namespace Catch\n\n#endif // CATCH_MATCHERS_FLOATING_POINT_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_PREDICATE_HPP_INCLUDED\n#define CATCH_MATCHERS_PREDICATE_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\nnamespace Matchers {\n\nnamespace Detail {\n    std::string finalizeDescription(const std::string& desc);\n} // namespace Detail\n\ntemplate <typename T, typename Predicate>\nclass PredicateMatcher final : public MatcherBase<T> {\n    Predicate m_predicate;\n    std::string m_description;\npublic:\n\n    PredicateMatcher(Predicate&& elem, std::string const& descr)\n        :m_predicate(CATCH_FORWARD(elem)),\n        m_description(Detail::finalizeDescription(descr))\n    {}\n\n    bool match( T const& item ) const override {\n        return m_predicate(item);\n    }\n\n    std::string describe() const override {\n        return m_description;\n    }\n};\n\n    /**\n     * Creates a matcher that calls delegates `match` to the provided predicate.\n     *\n     * The user has to explicitly specify the argument type to the matcher\n     */\n    template<typename T, typename Pred>\n    PredicateMatcher<T, Pred> Predicate(Pred&& predicate, std::string const& description = \"\") {\n        static_assert(is_callable<Pred(T)>::value, \"Predicate not callable with argument T\");\n        static_assert(std::is_same<bool, FunctionReturnType<Pred, T>>::value, \"Predicate does not return bool\");\n        return PredicateMatcher<T, Pred>(CATCH_FORWARD(predicate), description);\n    }\n\n} // namespace Matchers\n} // namespace Catch\n\n#endif // CATCH_MATCHERS_PREDICATE_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED\n#define CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED\n\n\nnamespace Catch {\n    namespace Matchers {\n        // Matcher for checking that all elements in range matches a given matcher.\n        template <typename Matcher>\n        class AllMatchMatcher final : public MatcherGenericBase {\n            Matcher m_matcher;\n        public:\n            AllMatchMatcher(Matcher matcher):\n                m_matcher(CATCH_MOVE(matcher))\n            {}\n\n            std::string describe() const override {\n                return \"all match \" + m_matcher.describe();\n            }\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n                for (auto&& elem : rng) {\n                    if (!m_matcher.match(elem)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        };\n\n        // Matcher for checking that no element in range matches a given matcher.\n        template <typename Matcher>\n        class NoneMatchMatcher final : public MatcherGenericBase {\n            Matcher m_matcher;\n        public:\n            NoneMatchMatcher(Matcher matcher):\n                m_matcher(CATCH_MOVE(matcher))\n            {}\n\n            std::string describe() const override {\n                return \"none match \" + m_matcher.describe();\n            }\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n                for (auto&& elem : rng) {\n                    if (m_matcher.match(elem)) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        };\n\n        // Matcher for checking that at least one element in range matches a given matcher.\n        template <typename Matcher>\n        class AnyMatchMatcher final : public MatcherGenericBase {\n            Matcher m_matcher;\n        public:\n            AnyMatchMatcher(Matcher matcher):\n                m_matcher(CATCH_MOVE(matcher))\n            {}\n\n            std::string describe() const override {\n                return \"any match \" + m_matcher.describe();\n            }\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n                for (auto&& elem : rng) {\n                    if (m_matcher.match(elem)) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        };\n\n        // Matcher for checking that all elements in range are true.\n        class AllTrueMatcher final : public MatcherGenericBase {\n        public:\n            std::string describe() const override;\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n                for (auto&& elem : rng) {\n                    if (!elem) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        };\n\n        // Matcher for checking that no element in range is true.\n        class NoneTrueMatcher final : public MatcherGenericBase {\n        public:\n            std::string describe() const override;\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n                for (auto&& elem : rng) {\n                    if (elem) {\n                        return false;\n                    }\n                }\n                return true;\n            }\n        };\n\n        // Matcher for checking that any element in range is true.\n        class AnyTrueMatcher final : public MatcherGenericBase {\n        public:\n            std::string describe() const override;\n\n            template <typename RangeLike>\n            bool match(RangeLike&& rng) const {\n                for (auto&& elem : rng) {\n                    if (elem) {\n                        return true;\n                    }\n                }\n                return false;\n            }\n        };\n\n        // Creates a matcher that checks whether all elements in a range match a matcher\n        template <typename Matcher>\n        AllMatchMatcher<Matcher> AllMatch(Matcher&& matcher) {\n            return { CATCH_FORWARD(matcher) };\n        }\n\n        // Creates a matcher that checks whether no element in a range matches a matcher.\n        template <typename Matcher>\n        NoneMatchMatcher<Matcher> NoneMatch(Matcher&& matcher) {\n            return { CATCH_FORWARD(matcher) };\n        }\n\n        // Creates a matcher that checks whether any element in a range matches a matcher.\n        template <typename Matcher>\n        AnyMatchMatcher<Matcher> AnyMatch(Matcher&& matcher) {\n            return { CATCH_FORWARD(matcher) };\n        }\n\n        // Creates a matcher that checks whether all elements in a range are true\n        AllTrueMatcher AllTrue();\n\n        // Creates a matcher that checks whether no element in a range is true\n        NoneTrueMatcher NoneTrue();\n\n        // Creates a matcher that checks whether any element in a range is true\n        AnyTrueMatcher AnyTrue();\n    }\n}\n\n#endif // CATCH_MATCHERS_QUANTIFIERS_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED\n#define CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED\n\n\n#include <algorithm>\n#include <utility>\n\nnamespace Catch {\n    namespace Matchers {\n\n        /**\n         * Matcher for checking that an element contains the same\n         * elements in the same order\n         */\n        template <typename TargetRangeLike, typename Equality>\n        class RangeEqualsMatcher final : public MatcherGenericBase {\n            TargetRangeLike m_desired;\n            Equality m_predicate;\n\n        public:\n            template <typename TargetRangeLike2, typename Equality2>\n            constexpr\n            RangeEqualsMatcher( TargetRangeLike2&& range,\n                                Equality2&& predicate ):\n                m_desired( CATCH_FORWARD( range ) ),\n                m_predicate( CATCH_FORWARD( predicate ) ) {}\n\n            template <typename RangeLike>\n            constexpr\n            bool match( RangeLike&& rng ) const {\n                auto rng_start = begin( rng );\n                const auto rng_end = end( rng );\n                auto target_start = begin( m_desired );\n                const auto target_end = end( m_desired );\n\n                while (rng_start != rng_end && target_start != target_end) {\n                    if (!m_predicate(*rng_start, *target_start)) {\n                        return false;\n                    }\n                    ++rng_start;\n                    ++target_start;\n                }\n                return rng_start == rng_end && target_start == target_end;\n            }\n\n            std::string describe() const override {\n                return \"elements are \" + Catch::Detail::stringify( m_desired );\n            }\n        };\n\n        /**\n         * Matcher for checking that an element contains the same\n         * elements (but not necessarily in the same order)\n         */\n        template <typename TargetRangeLike, typename Equality>\n        class UnorderedRangeEqualsMatcher final : public MatcherGenericBase {\n            TargetRangeLike m_desired;\n            Equality m_predicate;\n\n        public:\n            template <typename TargetRangeLike2, typename Equality2>\n            constexpr\n            UnorderedRangeEqualsMatcher( TargetRangeLike2&& range,\n                                         Equality2&& predicate ):\n                m_desired( CATCH_FORWARD( range ) ),\n                m_predicate( CATCH_FORWARD( predicate ) ) {}\n\n            template <typename RangeLike>\n            constexpr\n            bool match( RangeLike&& rng ) const {\n                using std::begin;\n                using std::end;\n                return Catch::Detail::is_permutation( begin( m_desired ),\n                                                      end( m_desired ),\n                                                      begin( rng ),\n                                                      end( rng ),\n                                                      m_predicate );\n            }\n\n            std::string describe() const override {\n                return \"unordered elements are \" +\n                       ::Catch::Detail::stringify( m_desired );\n            }\n        };\n\n        /**\n         * Creates a matcher that checks if all elements in a range are equal\n         * to all elements in another range.\n         *\n         * Uses `std::equal_to` to do the comparison\n         */\n        template <typename RangeLike>\n        constexpr\n        std::enable_if_t<!Detail::is_matcher<RangeLike>::value,\n                         RangeEqualsMatcher<RangeLike, std::equal_to<>>>\n        RangeEquals( RangeLike&& range ) {\n            return { CATCH_FORWARD( range ), std::equal_to<>{} };\n        }\n\n        /**\n         * Creates a matcher that checks if all elements in a range are equal\n         * to all elements in another range.\n         *\n         * Uses to provided predicate `predicate` to do the comparisons\n         */\n        template <typename RangeLike, typename Equality>\n        constexpr\n        RangeEqualsMatcher<RangeLike, Equality>\n        RangeEquals( RangeLike&& range, Equality&& predicate ) {\n            return { CATCH_FORWARD( range ), CATCH_FORWARD( predicate ) };\n        }\n\n        /**\n         * Creates a matcher that checks if all elements in a range are equal\n         * to all elements in another range, in some permutation\n         *\n         * Uses `std::equal_to` to do the comparison\n         */\n        template <typename RangeLike>\n        constexpr\n        std::enable_if_t<\n            !Detail::is_matcher<RangeLike>::value,\n            UnorderedRangeEqualsMatcher<RangeLike, std::equal_to<>>>\n        UnorderedRangeEquals( RangeLike&& range ) {\n            return { CATCH_FORWARD( range ), std::equal_to<>{} };\n        }\n\n        /**\n         * Creates a matcher that checks if all elements in a range are equal\n         * to all elements in another range, in some permutation.\n         *\n         * Uses to provided predicate `predicate` to do the comparisons\n         */\n        template <typename RangeLike, typename Equality>\n        constexpr\n        UnorderedRangeEqualsMatcher<RangeLike, Equality>\n        UnorderedRangeEquals( RangeLike&& range, Equality&& predicate ) {\n            return { CATCH_FORWARD( range ), CATCH_FORWARD( predicate ) };\n        }\n    } // namespace Matchers\n} // namespace Catch\n\n#endif // CATCH_MATCHERS_RANGE_EQUALS_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_STRING_HPP_INCLUDED\n#define CATCH_MATCHERS_STRING_HPP_INCLUDED\n\n\n#include <string>\n\nnamespace Catch {\nnamespace Matchers {\n\n    struct CasedString {\n        CasedString( std::string const& str, CaseSensitive caseSensitivity );\n        std::string adjustString( std::string const& str ) const;\n        StringRef caseSensitivitySuffix() const;\n\n        CaseSensitive m_caseSensitivity;\n        std::string m_str;\n    };\n\n    class StringMatcherBase : public MatcherBase<std::string> {\n    protected:\n        CasedString m_comparator;\n        StringRef m_operation;\n\n    public:\n        StringMatcherBase( StringRef operation,\n                           CasedString const& comparator );\n        std::string describe() const override;\n    };\n\n    class StringEqualsMatcher final : public StringMatcherBase {\n    public:\n        StringEqualsMatcher( CasedString const& comparator );\n        bool match( std::string const& source ) const override;\n    };\n    class StringContainsMatcher final : public StringMatcherBase {\n    public:\n        StringContainsMatcher( CasedString const& comparator );\n        bool match( std::string const& source ) const override;\n    };\n    class StartsWithMatcher final : public StringMatcherBase {\n    public:\n        StartsWithMatcher( CasedString const& comparator );\n        bool match( std::string const& source ) const override;\n    };\n    class EndsWithMatcher final : public StringMatcherBase {\n    public:\n        EndsWithMatcher( CasedString const& comparator );\n        bool match( std::string const& source ) const override;\n    };\n\n    class RegexMatcher final : public MatcherBase<std::string> {\n        std::string m_regex;\n        CaseSensitive m_caseSensitivity;\n\n    public:\n        RegexMatcher( std::string regex, CaseSensitive caseSensitivity );\n        bool match( std::string const& matchee ) const override;\n        std::string describe() const override;\n    };\n\n    //! Creates matcher that accepts strings that are exactly equal to `str`\n    StringEqualsMatcher Equals( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes );\n    //! Creates matcher that accepts strings that contain `str`\n    StringContainsMatcher ContainsSubstring( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes );\n    //! Creates matcher that accepts strings that _end_ with `str`\n    EndsWithMatcher EndsWith( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes );\n    //! Creates matcher that accepts strings that _start_ with `str`\n    StartsWithMatcher StartsWith( std::string const& str, CaseSensitive caseSensitivity = CaseSensitive::Yes );\n    //! Creates matcher that accepts strings matching `regex`\n    RegexMatcher Matches( std::string const& regex, CaseSensitive caseSensitivity = CaseSensitive::Yes );\n\n} // namespace Matchers\n} // namespace Catch\n\n#endif // CATCH_MATCHERS_STRING_HPP_INCLUDED\n\n\n#ifndef CATCH_MATCHERS_VECTOR_HPP_INCLUDED\n#define CATCH_MATCHERS_VECTOR_HPP_INCLUDED\n\n\n#include <algorithm>\n\nnamespace Catch {\nnamespace Matchers {\n\n    template<typename T, typename Alloc>\n    class VectorContainsElementMatcher final : public MatcherBase<std::vector<T, Alloc>> {\n        T const& m_comparator;\n\n    public:\n        VectorContainsElementMatcher(T const& comparator):\n            m_comparator(comparator)\n        {}\n\n        bool match(std::vector<T, Alloc> const& v) const override {\n            for (auto const& el : v) {\n                if (el == m_comparator) {\n                    return true;\n                }\n            }\n            return false;\n        }\n\n        std::string describe() const override {\n            return \"Contains: \" + ::Catch::Detail::stringify( m_comparator );\n        }\n    };\n\n    template<typename T, typename AllocComp, typename AllocMatch>\n    class ContainsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> {\n        std::vector<T, AllocComp> const& m_comparator;\n\n    public:\n        ContainsMatcher(std::vector<T, AllocComp> const& comparator):\n            m_comparator( comparator )\n        {}\n\n        bool match(std::vector<T, AllocMatch> const& v) const override {\n            // !TBD: see note in EqualsMatcher\n            if (m_comparator.size() > v.size())\n                return false;\n            for (auto const& comparator : m_comparator) {\n                auto present = false;\n                for (const auto& el : v) {\n                    if (el == comparator) {\n                        present = true;\n                        break;\n                    }\n                }\n                if (!present) {\n                    return false;\n                }\n            }\n            return true;\n        }\n        std::string describe() const override {\n            return \"Contains: \" + ::Catch::Detail::stringify( m_comparator );\n        }\n    };\n\n    template<typename T, typename AllocComp, typename AllocMatch>\n    class EqualsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> {\n        std::vector<T, AllocComp> const& m_comparator;\n\n    public:\n        EqualsMatcher(std::vector<T, AllocComp> const& comparator):\n            m_comparator( comparator )\n        {}\n\n        bool match(std::vector<T, AllocMatch> const& v) const override {\n            // !TBD: This currently works if all elements can be compared using !=\n            // - a more general approach would be via a compare template that defaults\n            // to using !=. but could be specialised for, e.g. std::vector<T> etc\n            // - then just call that directly\n            if ( m_comparator.size() != v.size() ) { return false; }\n            for ( std::size_t i = 0; i < v.size(); ++i ) {\n                if ( !( m_comparator[i] == v[i] ) ) { return false; }\n            }\n            return true;\n        }\n        std::string describe() const override {\n            return \"Equals: \" + ::Catch::Detail::stringify( m_comparator );\n        }\n    };\n\n    template<typename T, typename AllocComp, typename AllocMatch>\n    class ApproxMatcher final : public MatcherBase<std::vector<T, AllocMatch>> {\n        std::vector<T, AllocComp> const& m_comparator;\n        mutable Catch::Approx approx = Catch::Approx::custom();\n\n    public:\n        ApproxMatcher(std::vector<T, AllocComp> const& comparator):\n            m_comparator( comparator )\n        {}\n\n        bool match(std::vector<T, AllocMatch> const& v) const override {\n            if (m_comparator.size() != v.size())\n                return false;\n            for (std::size_t i = 0; i < v.size(); ++i)\n                if (m_comparator[i] != approx(v[i]))\n                    return false;\n            return true;\n        }\n        std::string describe() const override {\n            return \"is approx: \" + ::Catch::Detail::stringify( m_comparator );\n        }\n        template <typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        ApproxMatcher& epsilon( T const& newEpsilon ) {\n            approx.epsilon(static_cast<double>(newEpsilon));\n            return *this;\n        }\n        template <typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        ApproxMatcher& margin( T const& newMargin ) {\n            approx.margin(static_cast<double>(newMargin));\n            return *this;\n        }\n        template <typename = std::enable_if_t<std::is_constructible<double, T>::value>>\n        ApproxMatcher& scale( T const& newScale ) {\n            approx.scale(static_cast<double>(newScale));\n            return *this;\n        }\n    };\n\n    template<typename T, typename AllocComp, typename AllocMatch>\n    class UnorderedEqualsMatcher final : public MatcherBase<std::vector<T, AllocMatch>> {\n        std::vector<T, AllocComp> const& m_target;\n\n    public:\n        UnorderedEqualsMatcher(std::vector<T, AllocComp> const& target):\n            m_target(target)\n        {}\n        bool match(std::vector<T, AllocMatch> const& vec) const override {\n            if (m_target.size() != vec.size()) {\n                return false;\n            }\n            return std::is_permutation(m_target.begin(), m_target.end(), vec.begin());\n        }\n\n        std::string describe() const override {\n            return \"UnorderedEquals: \" + ::Catch::Detail::stringify(m_target);\n        }\n    };\n\n\n    // The following functions create the actual matcher objects.\n    // This allows the types to be inferred\n\n    //! Creates a matcher that matches vectors that contain all elements in `comparator`\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    ContainsMatcher<T, AllocComp, AllocMatch> Contains( std::vector<T, AllocComp> const& comparator ) {\n        return ContainsMatcher<T, AllocComp, AllocMatch>(comparator);\n    }\n\n    //! Creates a matcher that matches vectors that contain `comparator` as an element\n    template<typename T, typename Alloc = std::allocator<T>>\n    VectorContainsElementMatcher<T, Alloc> VectorContains( T const& comparator ) {\n        return VectorContainsElementMatcher<T, Alloc>(comparator);\n    }\n\n    //! Creates a matcher that matches vectors that are exactly equal to `comparator`\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    EqualsMatcher<T, AllocComp, AllocMatch> Equals( std::vector<T, AllocComp> const& comparator ) {\n        return EqualsMatcher<T, AllocComp, AllocMatch>(comparator);\n    }\n\n    //! Creates a matcher that matches vectors that `comparator` as an element\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    ApproxMatcher<T, AllocComp, AllocMatch> Approx( std::vector<T, AllocComp> const& comparator ) {\n        return ApproxMatcher<T, AllocComp, AllocMatch>(comparator);\n    }\n\n    //! Creates a matcher that matches vectors that is equal to `target` modulo permutation\n    template<typename T, typename AllocComp = std::allocator<T>, typename AllocMatch = AllocComp>\n    UnorderedEqualsMatcher<T, AllocComp, AllocMatch> UnorderedEquals(std::vector<T, AllocComp> const& target) {\n        return UnorderedEqualsMatcher<T, AllocComp, AllocMatch>(target);\n    }\n\n} // namespace Matchers\n} // namespace Catch\n\n#endif // CATCH_MATCHERS_VECTOR_HPP_INCLUDED\n\n#endif // CATCH_MATCHERS_ALL_HPP_INCLUDED\n\n\n/** \\file\n * This is a convenience header for Catch2's Reporter support. It includes\n * **all** of Catch2 headers related to reporters, including all reporters.\n *\n * Generally the Catch2 users should use specific includes they need,\n * but this header can be used instead for ease-of-experimentation, or\n * just plain convenience, at the cost of (significantly) increased\n * compilation times.\n *\n * When a new header (reporter) is added to either the `reporter` folder,\n * or to the corresponding internal subfolder, it should be added here.\n */\n\n#ifndef CATCH_REPORTERS_ALL_HPP_INCLUDED\n#define CATCH_REPORTERS_ALL_HPP_INCLUDED\n\n\n\n#ifndef CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED\n#define CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED\n\n\n\n#ifndef CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED\n#define CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED\n\n\n\n#ifndef CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED\n#define CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED\n\n\n#include <map>\n#include <string>\n\nnamespace Catch {\n    class ColourImpl;\n\n    /**\n     * This is the base class for all reporters.\n     *\n     * If are writing a reporter, you must derive from this type, or one\n     * of the helper reporter bases that are derived from this type.\n     *\n     * ReporterBase centralizes handling of various common tasks in reporters,\n     * like storing the right stream for the reporters to write to, and\n     * providing the default implementation of the different listing events.\n     */\n    class ReporterBase : public IEventListener {\n    protected:\n        //! The stream wrapper as passed to us by outside code\n        Detail::unique_ptr<IStream> m_wrapped_stream;\n        //! Cached output stream from `m_wrapped_stream` to reduce\n        //! number of indirect calls needed to write output.\n        std::ostream& m_stream;\n        //! Colour implementation this reporter was configured for\n        Detail::unique_ptr<ColourImpl> m_colour;\n        //! The custom reporter options user passed down to the reporter\n        std::map<std::string, std::string> m_customOptions;\n\n    public:\n        ReporterBase( ReporterConfig&& config );\n        ~ReporterBase() override; // = default;\n\n        /**\n         * Provides a simple default listing of reporters.\n         *\n         * Should look roughly like the reporter listing in v2 and earlier\n         * versions of Catch2.\n         */\n        void listReporters(\n            std::vector<ReporterDescription> const& descriptions ) override;\n        /**\n         * Provides a simple default listing of listeners\n         *\n         * Looks similarly to listing of reporters, but with listener type\n         * instead of reporter name.\n         */\n        void listListeners(\n            std::vector<ListenerDescription> const& descriptions ) override;\n        /**\n         * Provides a simple default listing of tests.\n         *\n         * Should look roughly like the test listing in v2 and earlier versions\n         * of Catch2. Especially supports low-verbosity listing that mimics the\n         * old `--list-test-names-only` output.\n         */\n        void listTests( std::vector<TestCaseHandle> const& tests ) override;\n        /**\n         * Provides a simple default listing of tags.\n         *\n         * Should look roughly like the tag listing in v2 and earlier versions\n         * of Catch2.\n         */\n        void listTags( std::vector<TagInfo> const& tags ) override;\n    };\n} // namespace Catch\n\n#endif // CATCH_REPORTER_COMMON_BASE_HPP_INCLUDED\n\n#include <vector>\n\nnamespace Catch {\n\n    class StreamingReporterBase : public ReporterBase {\n    public:\n        // GCC5 compat: we cannot use inherited constructor, because it\n        //              doesn't implement backport of P0136\n        StreamingReporterBase(ReporterConfig&& _config):\n            ReporterBase(CATCH_MOVE(_config))\n        {}\n        ~StreamingReporterBase() override;\n\n        void benchmarkPreparing( StringRef ) override {}\n        void benchmarkStarting( BenchmarkInfo const& ) override {}\n        void benchmarkEnded( BenchmarkStats<> const& ) override {}\n        void benchmarkFailed( StringRef ) override {}\n\n        void fatalErrorEncountered( StringRef /*error*/ ) override {}\n        void noMatchingTestCases( StringRef /*unmatchedSpec*/ ) override {}\n        void reportInvalidTestSpec( StringRef /*invalidArgument*/ ) override {}\n\n        void testRunStarting( TestRunInfo const& _testRunInfo ) override;\n\n        void testCaseStarting(TestCaseInfo const& _testInfo) override  {\n            currentTestCaseInfo = &_testInfo;\n        }\n        void testCasePartialStarting( TestCaseInfo const&, uint64_t ) override {}\n        void sectionStarting(SectionInfo const& _sectionInfo) override {\n            m_sectionStack.push_back(_sectionInfo);\n        }\n\n        void assertionStarting( AssertionInfo const& ) override {}\n        void assertionEnded( AssertionStats const& ) override {}\n\n        void sectionEnded(SectionStats const& /* _sectionStats */) override {\n            m_sectionStack.pop_back();\n        }\n        void testCasePartialEnded( TestCaseStats const&, uint64_t ) override {}\n        void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override {\n            currentTestCaseInfo = nullptr;\n        }\n        void testRunEnded( TestRunStats const& /* _testRunStats */ ) override;\n\n        void skipTest(TestCaseInfo const&) override {\n            // Don't do anything with this by default.\n            // It can optionally be overridden in the derived class.\n        }\n\n    protected:\n        TestRunInfo currentTestRunInfo{ \"test run has not started yet\"_sr };\n        TestCaseInfo const* currentTestCaseInfo = nullptr;\n\n        //! Stack of all _active_ sections in the _current_ test case\n        std::vector<SectionInfo> m_sectionStack;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_STREAMING_BASE_HPP_INCLUDED\n\n#include <string>\n\nnamespace Catch {\n\n    class AutomakeReporter final : public StreamingReporterBase {\n    public:\n        // GCC5 compat: we cannot use inherited constructor, because it\n        //              doesn't implement backport of P0136\n        AutomakeReporter(ReporterConfig&& _config):\n            StreamingReporterBase(CATCH_MOVE(_config))\n        {}\n        ~AutomakeReporter() override;\n\n        static std::string getDescription() {\n            using namespace std::string_literals;\n            return \"Reports test results in the format of Automake .trs files\"s;\n        }\n\n        void testCaseEnded(TestCaseStats const& _testCaseStats) override;\n        void skipTest(TestCaseInfo const& testInfo) override;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_AUTOMAKE_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_COMPACT_HPP_INCLUDED\n#define CATCH_REPORTER_COMPACT_HPP_INCLUDED\n\n\n\n\nnamespace Catch {\n\n    class CompactReporter final : public StreamingReporterBase {\n    public:\n        using StreamingReporterBase::StreamingReporterBase;\n\n        ~CompactReporter() override;\n\n        static std::string getDescription();\n\n        void noMatchingTestCases( StringRef unmatchedSpec ) override;\n\n        void testRunStarting( TestRunInfo const& _testInfo ) override;\n\n        void assertionEnded(AssertionStats const& _assertionStats) override;\n\n        void sectionEnded(SectionStats const& _sectionStats) override;\n\n        void testRunEnded(TestRunStats const& _testRunStats) override;\n\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_COMPACT_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_CONSOLE_HPP_INCLUDED\n#define CATCH_REPORTER_CONSOLE_HPP_INCLUDED\n\n\nnamespace Catch {\n    // Fwd decls\n    class TablePrinter;\n\n    class ConsoleReporter final : public StreamingReporterBase {\n        Detail::unique_ptr<TablePrinter> m_tablePrinter;\n\n    public:\n        ConsoleReporter(ReporterConfig&& config);\n        ~ConsoleReporter() override;\n        static std::string getDescription();\n\n        void noMatchingTestCases( StringRef unmatchedSpec ) override;\n        void reportInvalidTestSpec( StringRef arg ) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        void assertionEnded(AssertionStats const& _assertionStats) override;\n\n        void sectionStarting(SectionInfo const& _sectionInfo) override;\n        void sectionEnded(SectionStats const& _sectionStats) override;\n\n        void benchmarkPreparing( StringRef name ) override;\n        void benchmarkStarting(BenchmarkInfo const& info) override;\n        void benchmarkEnded(BenchmarkStats<> const& stats) override;\n        void benchmarkFailed( StringRef error ) override;\n\n        void testCaseEnded(TestCaseStats const& _testCaseStats) override;\n        void testRunEnded(TestRunStats const& _testRunStats) override;\n        void testRunStarting(TestRunInfo const& _testRunInfo) override;\n\n    private:\n        void lazyPrint();\n\n        void lazyPrintWithoutClosingBenchmarkTable();\n        void lazyPrintRunInfo();\n        void printTestCaseAndSectionHeader();\n\n        void printClosedHeader(std::string const& _name);\n        void printOpenHeader(std::string const& _name);\n\n        // if string has a : in first line will set indent to follow it on\n        // subsequent lines\n        void printHeaderString(std::string const& _string, std::size_t indent = 0);\n\n        void printTotalsDivider(Totals const& totals);\n\n        bool m_headerPrinted = false;\n        bool m_testRunInfoPrinted = false;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_CONSOLE_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED\n#define CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED\n\n\n#include <string>\n#include <vector>\n\nnamespace Catch {\n\n    namespace Detail {\n\n        //! Represents either an assertion or a benchmark result to be handled by cumulative reporter later\n        class AssertionOrBenchmarkResult {\n            // This should really be a variant, but this is much faster\n            // to write and the data layout here is already terrible\n            // enough that we do not have to care about the object size.\n            Optional<AssertionStats> m_assertion;\n            Optional<BenchmarkStats<>> m_benchmark;\n        public:\n            AssertionOrBenchmarkResult(AssertionStats const& assertion);\n            AssertionOrBenchmarkResult(BenchmarkStats<> const& benchmark);\n\n            bool isAssertion() const;\n            bool isBenchmark() const;\n\n            AssertionStats const& asAssertion() const;\n            BenchmarkStats<> const& asBenchmark() const;\n        };\n    }\n\n    /**\n     * Utility base for reporters that need to handle all results at once\n     *\n     * It stores tree of all test cases, sections and assertions, and after the\n     * test run is finished, calls into `testRunEndedCumulative` to pass the\n     * control to the deriving class.\n     *\n     * If you are deriving from this class and override any testing related\n     * member functions, you should first call into the base's implementation to\n     * avoid breaking the tree construction.\n     *\n     * Due to the way this base functions, it has to expand assertions up-front,\n     * even if they are later unused (e.g. because the deriving reporter does\n     * not report successful assertions, or because the deriving reporter does\n     * not use assertion expansion at all). Derived classes can use two\n     * customization points, `m_shouldStoreSuccesfulAssertions` and\n     * `m_shouldStoreFailedAssertions`, to disable the expansion and gain extra\n     * performance. **Accessing the assertion expansions if it wasn't stored is\n     * UB.**\n     */\n    class CumulativeReporterBase : public ReporterBase {\n    public:\n        template<typename T, typename ChildNodeT>\n        struct Node {\n            explicit Node( T const& _value ) : value( _value ) {}\n\n            using ChildNodes = std::vector<Detail::unique_ptr<ChildNodeT>>;\n            T value;\n            ChildNodes children;\n        };\n        struct SectionNode {\n            explicit SectionNode(SectionStats const& _stats) : stats(_stats) {}\n\n            bool operator == (SectionNode const& other) const {\n                return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo;\n            }\n\n            bool hasAnyAssertions() const;\n\n            SectionStats stats;\n            std::vector<Detail::unique_ptr<SectionNode>> childSections;\n            std::vector<Detail::AssertionOrBenchmarkResult> assertionsAndBenchmarks;\n            std::string stdOut;\n            std::string stdErr;\n        };\n\n\n        using TestCaseNode = Node<TestCaseStats, SectionNode>;\n        using TestRunNode = Node<TestRunStats, TestCaseNode>;\n\n        // GCC5 compat: we cannot use inherited constructor, because it\n        //              doesn't implement backport of P0136\n        CumulativeReporterBase(ReporterConfig&& _config):\n            ReporterBase(CATCH_MOVE(_config))\n        {}\n        ~CumulativeReporterBase() override;\n\n        void benchmarkPreparing( StringRef ) override {}\n        void benchmarkStarting( BenchmarkInfo const& ) override {}\n        void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;\n        void benchmarkFailed( StringRef ) override {}\n\n        void noMatchingTestCases( StringRef ) override {}\n        void reportInvalidTestSpec( StringRef ) override {}\n        void fatalErrorEncountered( StringRef /*error*/ ) override {}\n\n        void testRunStarting( TestRunInfo const& ) override {}\n\n        void testCaseStarting( TestCaseInfo const& ) override {}\n        void testCasePartialStarting( TestCaseInfo const&, uint64_t ) override {}\n        void sectionStarting( SectionInfo const& sectionInfo ) override;\n\n        void assertionStarting( AssertionInfo const& ) override {}\n\n        void assertionEnded( AssertionStats const& assertionStats ) override;\n        void sectionEnded( SectionStats const& sectionStats ) override;\n        void testCasePartialEnded( TestCaseStats const&, uint64_t ) override {}\n        void testCaseEnded( TestCaseStats const& testCaseStats ) override;\n        void testRunEnded( TestRunStats const& testRunStats ) override;\n        //! Customization point: called after last test finishes (testRunEnded has been handled)\n        virtual void testRunEndedCumulative() = 0;\n\n        void skipTest(TestCaseInfo const&) override {}\n\n    protected:\n        //! Should the cumulative base store the assertion expansion for successful assertions?\n        bool m_shouldStoreSuccesfulAssertions = true;\n        //! Should the cumulative base store the assertion expansion for failed assertions?\n        bool m_shouldStoreFailedAssertions = true;\n\n        // We need lazy construction here. We should probably refactor it\n        // later, after the events are redone.\n        //! The root node of the test run tree.\n        Detail::unique_ptr<TestRunNode> m_testRun;\n\n    private:\n        // Note: We rely on pointer identity being stable, which is why\n        //       we store pointers to the nodes rather than the values.\n        std::vector<Detail::unique_ptr<TestCaseNode>> m_testCases;\n        // Root section of the _current_ test case\n        Detail::unique_ptr<SectionNode> m_rootSection;\n        // Deepest section of the _current_ test case\n        SectionNode* m_deepestSection = nullptr;\n        // Stack of _active_ sections in the _current_ test case\n        std::vector<SectionNode*> m_sectionStack;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_CUMULATIVE_BASE_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED\n#define CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED\n\n\nnamespace Catch {\n\n    /**\n     * Base class to simplify implementing listeners.\n     *\n     * Provides empty default implementation for all IEventListener member\n     * functions, so that a listener implementation can pick which\n     * member functions it actually cares about.\n     */\n    class EventListenerBase : public IEventListener {\n    public:\n        using IEventListener::IEventListener;\n\n        void reportInvalidTestSpec( StringRef unmatchedSpec ) override;\n        void fatalErrorEncountered( StringRef error ) override;\n\n        void benchmarkPreparing( StringRef name ) override;\n        void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;\n        void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;\n        void benchmarkFailed( StringRef error ) override;\n\n        void assertionStarting( AssertionInfo const& assertionInfo ) override;\n        void assertionEnded( AssertionStats const& assertionStats ) override;\n\n        void listReporters(\n            std::vector<ReporterDescription> const& descriptions ) override;\n        void listListeners(\n            std::vector<ListenerDescription> const& descriptions ) override;\n        void listTests( std::vector<TestCaseHandle> const& tests ) override;\n        void listTags( std::vector<TagInfo> const& tagInfos ) override;\n\n        void noMatchingTestCases( StringRef unmatchedSpec ) override;\n        void testRunStarting( TestRunInfo const& testRunInfo ) override;\n        void testCaseStarting( TestCaseInfo const& testInfo ) override;\n        void testCasePartialStarting( TestCaseInfo const& testInfo,\n                                      uint64_t partNumber ) override;\n        void sectionStarting( SectionInfo const& sectionInfo ) override;\n        void sectionEnded( SectionStats const& sectionStats ) override;\n        void testCasePartialEnded( TestCaseStats const& testCaseStats,\n                                   uint64_t partNumber ) override;\n        void testCaseEnded( TestCaseStats const& testCaseStats ) override;\n        void testRunEnded( TestRunStats const& testRunStats ) override;\n        void skipTest( TestCaseInfo const& testInfo ) override;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_EVENT_LISTENER_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_HELPERS_HPP_INCLUDED\n#define CATCH_REPORTER_HELPERS_HPP_INCLUDED\n\n#include <iosfwd>\n#include <string>\n#include <vector>\n\n\nnamespace Catch {\n\n    class IConfig;\n    class TestCaseHandle;\n    class ColourImpl;\n\n    // Returns double formatted as %.3f (format expected on output)\n    std::string getFormattedDuration( double duration );\n\n    //! Should the reporter show duration of test given current configuration?\n    bool shouldShowDuration( IConfig const& config, double duration );\n\n    std::string serializeFilters( std::vector<std::string> const& filters );\n\n    struct lineOfChars {\n        char c;\n        constexpr lineOfChars( char c_ ): c( c_ ) {}\n\n        friend std::ostream& operator<<( std::ostream& out, lineOfChars value );\n    };\n\n    /**\n     * Lists reporter descriptions to the provided stream in user-friendly\n     * format\n     *\n     * Used as the default listing implementation by the first party reporter\n     * bases. The output should be backwards compatible with the output of\n     * Catch2 v2 binaries.\n     */\n    void\n    defaultListReporters( std::ostream& out,\n                          std::vector<ReporterDescription> const& descriptions,\n                          Verbosity verbosity );\n\n    /**\n     * Lists listeners descriptions to the provided stream in user-friendly\n     * format\n     */\n    void defaultListListeners( std::ostream& out,\n                               std::vector<ListenerDescription> const& descriptions );\n\n    /**\n     * Lists tag information to the provided stream in user-friendly format\n     *\n     * Used as the default listing implementation by the first party reporter\n     * bases. The output should be backwards compatible with the output of\n     * Catch2 v2 binaries.\n     */\n    void defaultListTags( std::ostream& out, std::vector<TagInfo> const& tags, bool isFiltered );\n\n    /**\n     * Lists test case information to the provided stream in user-friendly\n     * format\n     *\n     * Used as the default listing implementation by the first party reporter\n     * bases. The output is backwards compatible with the output of Catch2\n     * v2 binaries, and also supports the format specific to the old\n     * `--list-test-names-only` option, for people who used it in integrations.\n     */\n    void defaultListTests( std::ostream& out,\n                           ColourImpl* streamColour,\n                           std::vector<TestCaseHandle> const& tests,\n                           bool isFiltered,\n                           Verbosity verbosity );\n\n    /**\n     * Prints test run totals to the provided stream in user-friendly format\n     *\n     * Used by the console and compact reporters.\n     */\n    void printTestRunTotals( std::ostream& stream,\n                      ColourImpl& streamColour,\n                      Totals const& totals );\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_HELPERS_HPP_INCLUDED\n\n\n\n#ifndef CATCH_REPORTER_JSON_HPP_INCLUDED\n#define CATCH_REPORTER_JSON_HPP_INCLUDED\n\n\n#include <stack>\n\nnamespace Catch {\n    class JsonReporter : public StreamingReporterBase {\n    public:\n        JsonReporter( ReporterConfig&& config );\n\n        ~JsonReporter() override;\n\n        static std::string getDescription();\n\n    public: // StreamingReporterBase\n        void testRunStarting( TestRunInfo const& runInfo ) override;\n        void testRunEnded( TestRunStats const& runStats ) override;\n\n        void testCaseStarting( TestCaseInfo const& tcInfo ) override;\n        void testCaseEnded( TestCaseStats const& tcStats ) override;\n\n        void testCasePartialStarting( TestCaseInfo const& tcInfo,\n                                      uint64_t index ) override;\n        void testCasePartialEnded( TestCaseStats const& tcStats,\n                                   uint64_t index ) override;\n\n        void sectionStarting( SectionInfo const& sectionInfo ) override;\n        void sectionEnded( SectionStats const& sectionStats ) override;\n\n        void assertionStarting( AssertionInfo const& assertionInfo ) override;\n        void assertionEnded( AssertionStats const& assertionStats ) override;\n\n        //void testRunEndedCumulative() override;\n\n        void benchmarkPreparing( StringRef name ) override;\n        void benchmarkStarting( BenchmarkInfo const& ) override;\n        void benchmarkEnded( BenchmarkStats<> const& ) override;\n        void benchmarkFailed( StringRef error ) override;\n\n        void listReporters(\n            std::vector<ReporterDescription> const& descriptions ) override;\n        void listListeners(\n            std::vector<ListenerDescription> const& descriptions ) override;\n        void listTests( std::vector<TestCaseHandle> const& tests ) override;\n        void listTags( std::vector<TagInfo> const& tags ) override;\n\n    private:\n        Timer m_testCaseTimer;\n        enum class Writer {\n            Object,\n            Array\n        };\n\n        JsonArrayWriter& startArray();\n        JsonArrayWriter& startArray( StringRef key );\n\n        JsonObjectWriter& startObject();\n        JsonObjectWriter& startObject( StringRef key );\n\n        void endObject();\n        void endArray();\n\n        bool isInside( Writer writer );\n\n        void startListing();\n        void endListing();\n\n        // Invariant:\n        // When m_writers is not empty and its top element is\n        // - Writer::Object, then m_objectWriters is not be empty\n        // - Writer::Array,  then m_arrayWriters shall not be empty\n        std::stack<JsonObjectWriter> m_objectWriters{};\n        std::stack<JsonArrayWriter> m_arrayWriters{};\n        std::stack<Writer> m_writers{};\n\n        bool m_startedListing = false;\n\n        // std::size_t m_sectionDepth = 0;\n        // std::size_t m_sectionStarted = 0;\n    };\n} // namespace Catch\n\n#endif // CATCH_REPORTER_JSON_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_JUNIT_HPP_INCLUDED\n#define CATCH_REPORTER_JUNIT_HPP_INCLUDED\n\n\n\nnamespace Catch {\n\n    class JunitReporter final : public CumulativeReporterBase {\n    public:\n        JunitReporter(ReporterConfig&& _config);\n\n        static std::string getDescription();\n\n        void testRunStarting(TestRunInfo const& runInfo) override;\n\n        void testCaseStarting(TestCaseInfo const& testCaseInfo) override;\n        void assertionEnded(AssertionStats const& assertionStats) override;\n\n        void testCaseEnded(TestCaseStats const& testCaseStats) override;\n\n        void testRunEndedCumulative() override;\n\n    private:\n        void writeRun(TestRunNode const& testRunNode, double suiteTime);\n\n        void writeTestCase(TestCaseNode const& testCaseNode);\n\n        void writeSection( std::string const& className,\n                           std::string const& rootName,\n                           SectionNode const& sectionNode,\n                           bool testOkToFail );\n\n        void writeAssertions(SectionNode const& sectionNode);\n        void writeAssertion(AssertionStats const& stats);\n\n        XmlWriter xml;\n        Timer suiteTimer;\n        std::string stdOutForSuite;\n        std::string stdErrForSuite;\n        unsigned int unexpectedExceptions = 0;\n        bool m_okToFail = false;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_JUNIT_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_MULTI_HPP_INCLUDED\n#define CATCH_REPORTER_MULTI_HPP_INCLUDED\n\n\nnamespace Catch {\n\n    class MultiReporter final : public IEventListener {\n        /*\n         * Stores all added reporters and listeners\n         *\n         * All Listeners are stored before all reporters, and individual\n         * listeners/reporters are stored in order of insertion.\n         */\n        std::vector<IEventListenerPtr> m_reporterLikes;\n        bool m_haveNoncapturingReporters = false;\n\n        // Keep track of how many listeners we have already inserted,\n        // so that we can insert them into the main vector at the right place\n        size_t m_insertedListeners = 0;\n\n        void updatePreferences(IEventListener const& reporterish);\n\n    public:\n        using IEventListener::IEventListener;\n\n        void addListener( IEventListenerPtr&& listener );\n        void addReporter( IEventListenerPtr&& reporter );\n\n    public: // IEventListener\n\n        void noMatchingTestCases( StringRef unmatchedSpec ) override;\n        void fatalErrorEncountered( StringRef error ) override;\n        void reportInvalidTestSpec( StringRef arg ) override;\n\n        void benchmarkPreparing( StringRef name ) override;\n        void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override;\n        void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override;\n        void benchmarkFailed( StringRef error ) override;\n\n        void testRunStarting( TestRunInfo const& testRunInfo ) override;\n        void testCaseStarting( TestCaseInfo const& testInfo ) override;\n        void testCasePartialStarting(TestCaseInfo const& testInfo, uint64_t partNumber) override;\n        void sectionStarting( SectionInfo const& sectionInfo ) override;\n        void assertionStarting( AssertionInfo const& assertionInfo ) override;\n\n        void assertionEnded( AssertionStats const& assertionStats ) override;\n        void sectionEnded( SectionStats const& sectionStats ) override;\n        void testCasePartialEnded(TestCaseStats const& testStats, uint64_t partNumber) override;\n        void testCaseEnded( TestCaseStats const& testCaseStats ) override;\n        void testRunEnded( TestRunStats const& testRunStats ) override;\n\n        void skipTest( TestCaseInfo const& testInfo ) override;\n\n        void listReporters(std::vector<ReporterDescription> const& descriptions) override;\n        void listListeners(std::vector<ListenerDescription> const& descriptions) override;\n        void listTests(std::vector<TestCaseHandle> const& tests) override;\n        void listTags(std::vector<TagInfo> const& tags) override;\n\n\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_MULTI_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_REGISTRARS_HPP_INCLUDED\n#define CATCH_REPORTER_REGISTRARS_HPP_INCLUDED\n\n\n#include <type_traits>\n\nnamespace Catch {\n\n    namespace Detail {\n\n        template <typename T, typename = void>\n        struct has_description : std::false_type {};\n\n        template <typename T>\n        struct has_description<\n            T,\n            void_t<decltype( T::getDescription() )>>\n            : std::true_type {};\n\n        //! Indirection for reporter registration, so that the error handling is\n        //! independent on the reporter's concrete type\n        void registerReporterImpl( std::string const& name,\n                                   IReporterFactoryPtr reporterPtr );\n        //! Actually registers the factory, independent on listener's concrete type\n        void registerListenerImpl( Detail::unique_ptr<EventListenerFactory> listenerFactory );\n    } // namespace Detail\n\n    class IEventListener;\n    using IEventListenerPtr = Detail::unique_ptr<IEventListener>;\n\n    template <typename T>\n    class ReporterFactory : public IReporterFactory {\n\n        IEventListenerPtr create( ReporterConfig&& config ) const override {\n            return Detail::make_unique<T>( CATCH_MOVE(config) );\n        }\n\n        std::string getDescription() const override {\n            return T::getDescription();\n        }\n    };\n\n\n    template<typename T>\n    class ReporterRegistrar {\n    public:\n        explicit ReporterRegistrar( std::string const& name ) {\n            registerReporterImpl( name,\n                                  Detail::make_unique<ReporterFactory<T>>() );\n        }\n    };\n\n    template<typename T>\n    class ListenerRegistrar {\n\n        class TypedListenerFactory : public EventListenerFactory {\n            StringRef m_listenerName;\n\n            std::string getDescriptionImpl( std::true_type ) const {\n                return T::getDescription();\n            }\n\n            std::string getDescriptionImpl( std::false_type ) const {\n                return \"(No description provided)\";\n            }\n\n        public:\n            TypedListenerFactory( StringRef listenerName ):\n                m_listenerName( listenerName ) {}\n\n            IEventListenerPtr create( IConfig const* config ) const override {\n                return Detail::make_unique<T>( config );\n            }\n\n            StringRef getName() const override {\n                return m_listenerName;\n            }\n\n            std::string getDescription() const override {\n                return getDescriptionImpl( Detail::has_description<T>{} );\n            }\n        };\n\n    public:\n        ListenerRegistrar(StringRef listenerName) {\n            registerListenerImpl( Detail::make_unique<TypedListenerFactory>(listenerName) );\n        }\n    };\n}\n\n#if !defined(CATCH_CONFIG_DISABLE)\n\n#    define CATCH_REGISTER_REPORTER( name, reporterType )                      \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                              \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                               \\\n        namespace {                                                            \\\n            Catch::ReporterRegistrar<reporterType> INTERNAL_CATCH_UNIQUE_NAME( \\\n                catch_internal_RegistrarFor )( name );                         \\\n        }                                                                      \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#    define CATCH_REGISTER_LISTENER( listenerType )                            \\\n        CATCH_INTERNAL_START_WARNINGS_SUPPRESSION                              \\\n        CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS                               \\\n        namespace {                                                            \\\n            Catch::ListenerRegistrar<listenerType> INTERNAL_CATCH_UNIQUE_NAME( \\\n                catch_internal_RegistrarFor )( #listenerType##_catch_sr );     \\\n        }                                                                      \\\n        CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION\n\n#else // CATCH_CONFIG_DISABLE\n\n#define CATCH_REGISTER_REPORTER(name, reporterType)\n#define CATCH_REGISTER_LISTENER(listenerType)\n\n#endif // CATCH_CONFIG_DISABLE\n\n#endif // CATCH_REPORTER_REGISTRARS_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_SONARQUBE_HPP_INCLUDED\n#define CATCH_REPORTER_SONARQUBE_HPP_INCLUDED\n\n\n\nnamespace Catch {\n\n    class SonarQubeReporter final : public CumulativeReporterBase {\n    public:\n        SonarQubeReporter(ReporterConfig&& config)\n        : CumulativeReporterBase(CATCH_MOVE(config))\n        , xml(m_stream) {\n            m_preferences.shouldRedirectStdOut = true;\n            m_preferences.shouldReportAllAssertions = false;\n            m_shouldStoreSuccesfulAssertions = false;\n        }\n\n        static std::string getDescription() {\n            using namespace std::string_literals;\n            return \"Reports test results in the Generic Test Data SonarQube XML format\"s;\n        }\n\n        void testRunStarting( TestRunInfo const& testRunInfo ) override;\n\n        void testRunEndedCumulative() override {\n            writeRun( *m_testRun );\n            xml.endElement();\n        }\n\n        void writeRun( TestRunNode const& runNode );\n\n        void writeTestFile(StringRef filename, std::vector<TestCaseNode const*> const& testCaseNodes);\n\n        void writeTestCase(TestCaseNode const& testCaseNode);\n\n        void writeSection(std::string const& rootName, SectionNode const& sectionNode, bool okToFail);\n\n        void writeAssertions(SectionNode const& sectionNode, bool okToFail);\n\n        void writeAssertion(AssertionStats const& stats, bool okToFail);\n\n    private:\n        XmlWriter xml;\n    };\n\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_SONARQUBE_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_TAP_HPP_INCLUDED\n#define CATCH_REPORTER_TAP_HPP_INCLUDED\n\n\nnamespace Catch {\n\n    class TAPReporter final : public StreamingReporterBase {\n    public:\n        TAPReporter( ReporterConfig&& config ):\n            StreamingReporterBase( CATCH_MOVE(config) ) {\n            m_preferences.shouldReportAllAssertions = true;\n        }\n\n        static std::string getDescription() {\n            using namespace std::string_literals;\n            return \"Reports test results in TAP format, suitable for test harnesses\"s;\n        }\n\n        void testRunStarting( TestRunInfo const& testInfo ) override;\n\n        void noMatchingTestCases( StringRef unmatchedSpec ) override;\n\n        void assertionEnded(AssertionStats const& _assertionStats) override;\n\n        void testRunEnded(TestRunStats const& _testRunStats) override;\n\n    private:\n        std::size_t counter = 0;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_TAP_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_TEAMCITY_HPP_INCLUDED\n#define CATCH_REPORTER_TEAMCITY_HPP_INCLUDED\n\n\n#include <cstring>\n\n#ifdef __clang__\n#   pragma clang diagnostic push\n#   pragma clang diagnostic ignored \"-Wpadded\"\n#endif\n\nnamespace Catch {\n\n    class TeamCityReporter final : public StreamingReporterBase {\n    public:\n        TeamCityReporter( ReporterConfig&& _config )\n        :   StreamingReporterBase( CATCH_MOVE(_config) )\n        {\n            m_preferences.shouldRedirectStdOut = true;\n        }\n\n        ~TeamCityReporter() override;\n\n        static std::string getDescription() {\n            using namespace std::string_literals;\n            return \"Reports test results as TeamCity service messages\"s;\n        }\n\n        void testRunStarting( TestRunInfo const& runInfo ) override;\n        void testRunEnded( TestRunStats const& runStats ) override;\n\n\n        void assertionEnded(AssertionStats const& assertionStats) override;\n\n        void sectionStarting(SectionInfo const& sectionInfo) override {\n            m_headerPrintedForThisSection = false;\n            StreamingReporterBase::sectionStarting( sectionInfo );\n        }\n\n        void testCaseStarting(TestCaseInfo const& testInfo) override;\n\n        void testCaseEnded(TestCaseStats const& testCaseStats) override;\n\n    private:\n        void printSectionHeader(std::ostream& os);\n\n        bool m_headerPrintedForThisSection = false;\n        Timer m_testTimer;\n    };\n\n} // end namespace Catch\n\n#ifdef __clang__\n#   pragma clang diagnostic pop\n#endif\n\n#endif // CATCH_REPORTER_TEAMCITY_HPP_INCLUDED\n\n\n#ifndef CATCH_REPORTER_XML_HPP_INCLUDED\n#define CATCH_REPORTER_XML_HPP_INCLUDED\n\n\n\n\nnamespace Catch {\n    class XmlReporter : public StreamingReporterBase {\n    public:\n        XmlReporter(ReporterConfig&& _config);\n\n        ~XmlReporter() override;\n\n        static std::string getDescription();\n\n        virtual std::string getStylesheetRef() const;\n\n        void writeSourceInfo(SourceLineInfo const& sourceInfo);\n\n    public: // StreamingReporterBase\n\n        void testRunStarting(TestRunInfo const& testInfo) override;\n\n        void testCaseStarting(TestCaseInfo const& testInfo) override;\n\n        void sectionStarting(SectionInfo const& sectionInfo) override;\n\n        void assertionStarting(AssertionInfo const&) override;\n\n        void assertionEnded(AssertionStats const& assertionStats) override;\n\n        void sectionEnded(SectionStats const& sectionStats) override;\n\n        void testCaseEnded(TestCaseStats const& testCaseStats) override;\n\n        void testRunEnded(TestRunStats const& testRunStats) override;\n\n        void benchmarkPreparing( StringRef name ) override;\n        void benchmarkStarting(BenchmarkInfo const&) override;\n        void benchmarkEnded(BenchmarkStats<> const&) override;\n        void benchmarkFailed( StringRef error ) override;\n\n        void listReporters(std::vector<ReporterDescription> const& descriptions) override;\n        void listListeners(std::vector<ListenerDescription> const& descriptions) override;\n        void listTests(std::vector<TestCaseHandle> const& tests) override;\n        void listTags(std::vector<TagInfo> const& tags) override;\n\n    private:\n        Timer m_testCaseTimer;\n        XmlWriter m_xml;\n        int m_sectionDepth = 0;\n    };\n\n} // end namespace Catch\n\n#endif // CATCH_REPORTER_XML_HPP_INCLUDED\n\n#endif // CATCH_REPORTERS_ALL_HPP_INCLUDED\n\n#endif // CATCH_ALL_HPP_INCLUDED\n#endif // CATCH_AMALGAMATED_HPP_INCLUDED\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.alpine-base",
    "content": "FROM alpine:latest\n\nRUN apk add --no-cache \\\n  binutils \\\n  cmake \\\n  curl-dev \\\n  docbook2x \\\n  gettext-tiny-dev \\\n  git \\\n  icu-dev \\\n  imlib2-dev \\\n  iw \\\n  libmicrohttpd-dev \\\n  libpulse \\\n  libxdamage-dev \\\n  libxext-dev \\\n  libxft-dev \\\n  libxinerama-dev \\\n  linux-headers \\\n  lua5.3-dev \\\n  make \\\n  musl-dev \\\n  ncurses-dev \\\n  patch\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.alpine-clang",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/arch-base:latest\n\nRUN apk add --no-cache \\\n  clang\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.alpine-gcc",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/alpine-base:latest\n\nRUN apk add --no-cache \\\n  g++ \\\n  gcc\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.archlinux-base",
    "content": "FROM archlinux:base\n\n# Fix from https://www.reddit.com/r/archlinux/comments/lek2ba/arch_linux_on_docker_ci_could_not_find_or_read/\nRUN patched_glibc=glibc-linux4-2.33-4-x86_64.pkg.tar.zst && \\\n  curl -LO \"https://repo.archlinuxcn.org/x86_64/$patched_glibc\" && \\\n  bsdtar -C / -xvf \"$patched_glibc\"\n\nRUN pacman -Syu --noconfirm --needed \\\n  cairo \\\n  cmake \\\n  docbook2x \\\n  git \\\n  glib2 \\\n  imlib2 \\\n  iw \\\n  libical \\\n  libircclient \\\n  libmicrohttpd \\\n  libpulse \\\n  librsvg \\\n  libxdamage \\\n  libxext \\\n  libxft \\\n  libxinerama \\\n  libxnvctrl \\\n  lua \\\n  make \\\n  man-db \\\n  mariadb-libs \\\n  patch \\\n  pkg-config \\\n  wireless_tools \\\n  && git clone https://github.com/linux-test-project/lcov.git \\\n  && cd lcov \\\n  && make install \\\n  && cd .. \\\n  && rm -rf lcov\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.archlinux-clang",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/archlinux-base:latest\n\nRUN pacman -Syu --noconfirm --needed \\\n  clang \\\n  libc++\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.archlinux-gcc",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/archlinux-base:latest\n\nRUN pacman -Syu --noconfirm --needed \\\n  gcc\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.fedora-31-base",
    "content": "FROM fedora:31\n\nRUN dnf update -y -q \\\n  && dnf -y -q install \\\n  audacious-devel \\\n  cairo-devel \\\n  cmake \\\n  dbus-glib-devel \\\n  docbook2X \\\n  freetype-devel \\\n  git \\\n  imlib2-devel \\\n  lcov \\\n  libcurl-devel \\\n  libical-devel \\\n  libircclient-devel \\\n  libmicrohttpd-devel \\\n  librsvg2-devel \\\n  libX11-devel \\\n  libXdamage-devel \\\n  libXext-devel \\\n  libXft-devel \\\n  libXinerama-devel \\\n  libxml2-devel \\\n  libXNVCtrl-devel \\\n  lua-devel \\\n  make \\\n  man \\\n  mysql-devel \\\n  ncurses-devel \\\n  openssl-devel \\\n  patch \\\n  pulseaudio-libs-devel \\\n  readline-devel \\\n  systemd-devel \\\n  xmms2-devel \n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.fedora-31-clang-8",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/fedora-31-base:latest\n\nRUN dnf -y -q install \\\n  llvm \\\n  clang \\\n  libcxx-devel \\\n  libcxxabi-devel \\\n  npm \\\n  && dnf clean all \\\n  && npm cache clean --force\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.fedora-32-base",
    "content": "FROM fedora:32\n\nRUN dnf update -y -q \\\n  && dnf -y -q install \\\n  audacious-devel \\\n  cairo-devel \\\n  cmake \\\n  dbus-glib-devel \\\n  docbook2X \\\n  freetype-devel \\\n  git \\\n  imlib2-devel \\\n  lcov \\\n  libcurl-devel \\\n  libical-devel \\\n  libircclient-devel \\\n  libmicrohttpd-devel \\\n  librsvg2-devel \\\n  libX11-devel \\\n  libXdamage-devel \\\n  libXext-devel \\\n  libXft-devel \\\n  libXinerama-devel \\\n  libxml2-devel \\\n  libXNVCtrl-devel \\\n  lua-devel \\\n  make \\\n  man \\\n  mysql-devel \\\n  ncurses-devel \\\n  openssl-devel \\\n  patch \\\n  pulseaudio-libs-devel \\\n  readline-devel \\\n  systemd-devel \\\n  xmms2-devel\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.fedora-32-clang-10",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/fedora-32-base:latest\n\nRUN dnf -y -q install \\\n  llvm \\\n  clang \\\n  libcxx-devel \\\n  libcxxabi-devel \\\n  npm \\\n  && dnf clean all \\\n  && npm cache clean --force\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.fedora-33-base",
    "content": "FROM fedora:33\n\nRUN dnf update -y -q \\\n  && dnf -y -q install \\\n  audacious-devel \\\n  cairo-devel \\\n  cmake \\\n  dbus-glib-devel \\\n  docbook2X \\\n  freetype-devel \\\n  git \\\n  imlib2-devel \\\n  lcov \\\n  libcurl-devel \\\n  libical-devel \\\n  libircclient-devel \\\n  libmicrohttpd-devel \\\n  librsvg2-devel \\\n  libX11-devel \\\n  libXdamage-devel \\\n  libXext-devel \\\n  libXft-devel \\\n  libXinerama-devel \\\n  libxml2-devel \\\n  libXNVCtrl-devel \\\n  lua-devel \\\n  make \\\n  man \\\n  mysql-devel \\\n  ncurses-devel \\\n  openssl-devel \\\n  patch \\\n  pulseaudio-libs-devel \\\n  readline-devel \\\n  systemd-devel \\\n  xmms2-devel\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.fedora-33-clang-11",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/fedora-33-base:latest\n\nRUN dnf -y -q install \\\n  clang \\\n  gcovr \\\n  libcxx-devel \\\n  libcxxabi-devel \\\n  llvm \\\n  npm \\\n  && dnf clean all \\\n  && npm install -g lcov-summary \\\n  && npm cache clean --force\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-base",
    "content": "FROM ubuntu:focal\n\nRUN apt-get update \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  audacious-dev \\\n  build-essential \\\n  cmake \\\n  docbook2x \\\n  git \\\n  gpg \\\n  gpg-agent \\\n  lcov \\\n  less \\\n  libaudclient-dev \\\n  libcairo2-dev \\\n  libcurl4-openssl-dev \\\n  libical-dev \\\n  libimlib2-dev \\\n  libircclient-dev \\\n  libiw-dev \\\n  liblua5.3-dev \\\n  libmicrohttpd-dev \\\n  libmysqlclient-dev \\\n  libpulse-dev \\\n  librsvg2-dev \\\n  libssl-dev \\\n  libsystemd-dev \\\n  libxdamage-dev \\\n  libxext-dev \\\n  libxft-dev \\\n  libxinerama-dev \\\n  libxml2-dev \\\n  libxmmsclient-dev \\\n  libxnvctrl-dev \\\n  man \\\n  ncurses-dev \\\n  software-properties-common \\\n  wget\n\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-clang-10",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/ubuntu-base:latest\n\nRUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  && apt-key add llvm-snapshot.gpg.key \\\n  && add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-10 main' \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  clang-10 \\\n  lldb-10 \\\n  lld-10 \\\n  libc++-10-dev \\\n  libc++abi-10-dev \\\n  clang-tools-10 \\\n  clang-format-10 \\\n  clang-tidy-10 \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-clang-11",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/ubuntu-base:latest\n\nRUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  && apt-key add llvm-snapshot.gpg.key \\\n  && add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-11 main' \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  clang-11 \\\n  clang-format-11 \\\n  clang-tidy-11 \\\n  clang-tools-11 \\\n  gcovr \\\n  libc++-11-dev \\\n  libc++abi-11-dev \\\n  lld-11 \\\n  lldb-11 \\\n  llvm-11 \\\n  nodejs \\\n  npm \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/* \\\n  && npm install -g lcov-summary \\\n  && npm cache clean --force\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-clang-9",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/ubuntu-base:latest\n\nRUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  && apt-key add llvm-snapshot.gpg.key \\\n  && add-apt-repository 'deb http://apt.llvm.org/focal/ llvm-toolchain-focal-9 main' \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  clang-9 \\\n  lldb-9 \\\n  lld-9 \\\n  libc++-9-dev \\\n  libc++abi-9-dev \\\n  clang-tools-9 \\\n  clang-format-9 \\\n  clang-tidy-9 \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-gcc-10",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/ubuntu-base:latest\n\nRUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  && apt-key add llvm-snapshot.gpg.key \\\n  && add-apt-repository ppa:ubuntu-toolchain-r/test \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  g++-10 \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-gcc-7",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/ubuntu-base:latest\n\nRUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  && apt-key add llvm-snapshot.gpg.key \\\n  && add-apt-repository ppa:ubuntu-toolchain-r/test \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  g++-7 \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-gcc-8",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/ubuntu-base:latest\n\nRUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  && apt-key add llvm-snapshot.gpg.key \\\n  && add-apt-repository ppa:ubuntu-toolchain-r/test \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  g++-8 \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": "tests/dockerfiles/Dockerfile.ubuntu-gcc-9",
    "content": "ARG IMAGE=registry.gitlab.com/brndnmtthws-oss/conky\nFROM ${IMAGE}/builder/ubuntu-base:latest\n\nRUN wget -q https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  && apt-key add llvm-snapshot.gpg.key \\\n  && add-apt-repository ppa:ubuntu-toolchain-r/test \\\n  && DEBIAN_FRONTEND=noninteractive \\\n  apt-get install -qy --no-install-recommends \\\n  g++-9 \\\n  && apt-get clean \\\n  && rm -rf /var/lib/apt/lists/*\n"
  },
  {
    "path": "tests/llvm-gcov.sh",
    "content": "#!/usr/bin/env bash\n\nllvm_version_suffixes=(\n    \"\"\n    -15\n    150\n    -14\n    140\n    -13\n    130\n    -12\n    120\n    -11\n    110\n    100\n    -10\n    90\n    -9\n)\n\nfor suffix in \"${llvm_version_suffixes[@]}\"; do\n    llvm_cov_test=\"llvm-cov${suffix}\"\n    if hash $llvm_cov_test 2>/dev/null; then\n        llvm_cov=$llvm_cov_test\n        break\n    fi\ndone\n\nexec $llvm_cov gcov \"$@\"\n"
  },
  {
    "path": "tests/test-algebra.cc",
    "content": "#include \"catch2/catch.hpp\"\n\n#include <content/algebra.h>\n#include <config.h>\n\nTEST_CASE(\"GetMatchTypeTest - ValidOperators\") {\n  REQUIRE(get_match_type(\"a==b\") == OP_EQ);\n  REQUIRE(get_match_type(\"a!=b\") == OP_NEQ);\n  REQUIRE(get_match_type(\"a>b\") == OP_GT);\n  REQUIRE(get_match_type(\"a>=b\") == OP_GEQ);\n  REQUIRE(get_match_type(\"a<b\") == OP_LT);\n  REQUIRE(get_match_type(\"a<=b\") == OP_LEQ);\n}\n\nTEST_CASE(\"GetMatchTypeTest - InvalidOperators\") {\n  REQUIRE(get_match_type(\"a=b\") == -1);\n  REQUIRE(get_match_type(\"a!b\") == -1);\n  REQUIRE(get_match_type(\"a=b\") == -1);\n}\n\nTEST_CASE(\"GetMatchTypeTest - NoOperators\") {\n  REQUIRE(get_match_type(\"abc\") == -1);\n  REQUIRE(get_match_type(\"123\") == -1);\n  REQUIRE(get_match_type(\"\") == -1);\n}\n\nTEST_CASE(\"find_match_op identifies operators correctly\", \"[find_match_op]\") {\n  SECTION(\"Single character operators\") {\n    REQUIRE(find_match_op(\"a < b\") == 2);\n    REQUIRE(find_match_op(\"a > b\") == 2);\n  }\n\n  SECTION(\"Double character operators\") {\n    REQUIRE(find_match_op(\"a == b\") == 2);\n    REQUIRE(find_match_op(\"a != b\") == 2);\n    REQUIRE(find_match_op(\"a >= b\") == 2);\n    REQUIRE(find_match_op(\"a <= b\") == 2);\n  }\n\n  SECTION(\"No operator present\") { REQUIRE(find_match_op(\"a b\") == -1); }\n\n  SECTION(\"Invalid operators\") {\n    REQUIRE(find_match_op(\"a = b\") == -1);\n    REQUIRE(find_match_op(\"a ! b\") == -1);\n  }\n\n  SECTION(\"Operators at different positions\") {\n    REQUIRE(find_match_op(\"x == y\") == 2);\n    REQUIRE(find_match_op(\"x != y\") == 2);\n    REQUIRE(find_match_op(\"x >= y\") == 2);\n    REQUIRE(find_match_op(\"x <= y\") == 2);\n    REQUIRE(find_match_op(\"x < y\") == 2);\n    REQUIRE(find_match_op(\"x > y\") == 2);\n  }\n\n  SECTION(\"Empty string\") { REQUIRE(find_match_op(\"\") == -1); }\n}\n\nTEST_CASE(\"GetMatchTypeTest - More test cases\") {\n  REQUIRE(get_match_type(\"\\\"a!b\\\" == \\\"ab\\\"\") == OP_EQ);     // \"a!b\" == \"ab\"\n  REQUIRE(get_match_type(\"\\\"a!/b\\\" == \\\"a!/b\\\"\") == OP_EQ);  // \"a!/b\" == \"a!/b\"\n  REQUIRE(get_match_type(\"\\\"a!=/a==b\\\" == \\\"a!=/a==b\\\"\") ==\n          OP_EQ);  // \"a!=/a==b\" == \"a!=/a==b\"\n  REQUIRE(get_match_type(\"\\\"a!=/b==b\\\" == \\\"a!==/a==b\\\"\") ==\n          OP_EQ);  // \"a!=/b==b\" == \"a!==/a==b\"\n  REQUIRE(get_match_type(\"\\\"a!======b\\\" == \\\"!==/==\\\"\") ==\n          OP_EQ);  // \"a!======b\" == \"!==/==\"\n  REQUIRE(get_match_type(\"\\\" !=<>==\\\" == \\\" !=<>==\\\"\") ==\n          OP_EQ);  // \" !=<>==\" == \" !=<>==\"\n  REQUIRE(get_match_type(\"\\\"a!=><==\\\" < \\\"b!=><==\\\"\") ==\n          OP_LT);  // \"a!=><==\" < \"b!=><==\"\n  REQUIRE(get_match_type(\"\\\"!=<>==\\\" == \\\"!=<>==\\\"\") ==\n          OP_EQ);                                      // \"!=<>==\" == \"!=<>==\"\n  REQUIRE(get_match_type(\"\\\"=\\\" == \\\"=\\\"\") == OP_EQ);  // \"=\" == \"=\"\n  REQUIRE(get_match_type(\"\\\"FRITZ!Box 7520 HI\\\" == \\\"off/any\\\"\") ==\n          OP_EQ);  // \"FRITZ!Box 7520 HI\" == \"off/any\"\n}\n\nTEST_CASE(\"CompareTest - ValidOperators\") {\n  REQUIRE(compare(\"\\\"a\\\"==\\\"b\\\"\") == 0);\n  REQUIRE(compare(\"\\\"a\\\"!=\\\"b\\\"\") == 1);\n  REQUIRE(compare(\"\\\"a\\\">\\\"b\\\"\") == 0);\n  REQUIRE(compare(\"\\\"a\\\">=\\\"b\\\"\") == 0);\n  REQUIRE(compare(\"\\\"a\\\"<\\\"b\\\"\") == 1);\n  REQUIRE(compare(\"\\\"a\\\"<=\\\"b\\\"\") == 1);\n}\nTEST_CASE(\"CompareTest - ValidOperators with Integers\") {\n  REQUIRE(compare(\"1==1\") == 1);\n  REQUIRE(compare(\"1!=2\") == 1);\n  REQUIRE(compare(\"2>1\") == 1);\n  REQUIRE(compare(\"2>=1\") == 1);\n  REQUIRE(compare(\"1<2\") == 1);\n  REQUIRE(compare(\"1<=2\") == 1);\n}\n\nTEST_CASE(\"CompareTest - ValidOperators with Doubles\") {\n  REQUIRE(compare(\"1.0==1.0\") == 1);\n  REQUIRE(compare(\"1.0!=2.0\") == 1);\n  REQUIRE(compare(\"2.0>1.0\") == 1);\n  REQUIRE(compare(\"2.0>=1.0\") == 1);\n  REQUIRE(compare(\"1.0<2.0\") == 1);\n  REQUIRE(compare(\"1.0<=2.0\") == 1);\n}\n\nTEST_CASE(\"CompareTest - InvalidOperators\") {\n  REQUIRE(compare(\"\\\"a\\\"=\\\"b\\\"\") == -2);\n  REQUIRE(compare(\"\\\"a\\\"!\\\"b\\\"\") == -2);\n  REQUIRE(compare(\"\\\"a\\\"=\\\"b\\\"\") == -2);\n}\n\nTEST_CASE(\"CompareTest - NoOperators\") {\n  REQUIRE(compare(\"abc\") == -2);\n  REQUIRE(compare(\"123\") == -2);\n  REQUIRE(compare(\"\") == -2);\n}\n\nTEST_CASE(\"CompareTest - More test cases\") {\n  REQUIRE(compare(\"\\\"a!b\\\" == \\\"ab\\\"\") == 0);     // \"a!b\" == \"ab\"\n  REQUIRE(compare(\"\\\"a!/b\\\" == \\\"a!/b\\\"\") == 1);  // \"a!/b\" == \"a!/b\"\n  REQUIRE(compare(\"\\\"a!=/a==b\\\" == \\\"a!=/a==b\\\"\") ==\n          1);  // \"a!=/a==b\" == \"a!=/a==b\"\n  REQUIRE(compare(\"\\\"a!=/b==b\\\" == \\\"a!==/a==b\\\"\") ==\n          0);  // \"a!=/b==b\" == \"a!==/a==b\"\n  REQUIRE(compare(\"\\\"a!======b\\\" == \\\"!==/==\\\"\") ==\n          0);  // \"a!======b\" == \"!==/==\"\n  REQUIRE(compare(\"\\\" !=<>==\\\" == \\\" !=<>==\\\"\") ==\n          1);                                          // \" !=<>==\" == \" !=<>==\"\n  REQUIRE(compare(\"\\\"a!=><==\\\" < \\\"b!=><==\\\"\") == 1);  // \"a!=><==\" < \"b!=><==\"\n  REQUIRE(compare(\"\\\"!=<>==\\\" == \\\"!=<>==\\\"\") == 1);   // \"!=<>==\" == \"!=<>==\"\n  REQUIRE(compare(\"\\\"=\\\" == \\\"=\\\"\") == 1);             // \"=\" == \"=\"\n  REQUIRE(compare(\"\\\"FRITZ!Box 7520 HI\\\" == \\\"off/any\\\"\") ==\n          0);  // \"FRITZ!Box 7520 HI\" == \"off/any\"\n}\n"
  },
  {
    "path": "tests/test-colours.cc",
    "content": "#include \"catch2/catch.hpp\"\n\n#include <content/colours.hh>\n#include <config.h>\n\nTEST_CASE(\"parse_color correctly parses colours\", \"[colours][parse_color]\") {\n  SECTION(\"parsing abbreviated hex color\") {\n    auto colour = parse_color(\"#abc\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 0xaa);\n    REQUIRE(colour.green == 0xbb);\n    REQUIRE(colour.blue == 0xcc);\n  }\n\n  SECTION(\"parsing abbreviated hex color with alpha\") {\n    auto colour = parse_color(\"#4abc\");\n    REQUIRE(colour.alpha == 0x44);\n    REQUIRE(colour.red == 0xaa);\n    REQUIRE(colour.green == 0xbb);\n    REQUIRE(colour.blue == 0xcc);\n  }\n\n  SECTION(\"parsing hex red\") {\n    auto colour = parse_color(\"#ff0000\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 255);\n    REQUIRE(colour.green == 0);\n    REQUIRE(colour.blue == 0);\n  }\n\n  SECTION(\"parsing hex green\") {\n    auto colour = parse_color(\"#00ff00\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 0);\n    REQUIRE(colour.green == 255);\n    REQUIRE(colour.blue == 0);\n  }\n\n  SECTION(\"parsing hex blue\") {\n    auto colour = parse_color(\"#0000ff\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 0);\n    REQUIRE(colour.green == 0);\n    REQUIRE(colour.blue == 255);\n  }\n\n  SECTION(\"parsing red\") {\n    auto colour = parse_color(\"ff0000\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 255);\n    REQUIRE(colour.green == 0);\n    REQUIRE(colour.blue == 0);\n  }\n\n  SECTION(\"parsing green\") {\n    auto colour = parse_color(\"00ff00\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 0);\n    REQUIRE(colour.green == 255);\n    REQUIRE(colour.blue == 0);\n  }\n\n  SECTION(\"parsing blue\") {\n    auto colour = parse_color(\"0000ff\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 0);\n    REQUIRE(colour.green == 0);\n    REQUIRE(colour.blue == 255);\n  }\n\n  SECTION(\"argb values produce the expected result\") {\n    auto colour = Colour::from_argb32(0x11223344);\n    REQUIRE(colour.alpha == 0x11);\n    REQUIRE(colour.red == 0x22);\n    REQUIRE(colour.green == 0x33);\n    REQUIRE(colour.blue == 0x44);\n  }\n\n#ifdef BUILD_COLOUR_NAME_MAP\n  SECTION(\"it parses the colour 'red'\") {\n    auto colour = parse_color(\"red\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 255);\n    REQUIRE(colour.green == 0);\n    REQUIRE(colour.blue == 0);\n  }\n\n  SECTION(\"it parses the colour 'green'\") {\n    auto colour = parse_color(\"green\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 0);\n    REQUIRE(colour.green == 255);\n    REQUIRE(colour.blue == 0);\n  }\n\n  SECTION(\"it parses the colour 'blue'\") {\n    auto colour = parse_color(\"blue\");\n    REQUIRE(colour.alpha == 255);\n    REQUIRE(colour.red == 0);\n    REQUIRE(colour.green == 0);\n    REQUIRE(colour.blue == 255);\n  }\n#endif /* BUILD_COLOUR_NAME_MAP */\n\n  SECTION(\"two identical colours should be equal\") {\n    auto c = GENERATE(take(100, random((uint32_t)0, (uint32_t)0xffffffff)));\n    auto colour1 = Colour::from_argb32(c);\n    auto colour2 = Colour::from_argb32(c);\n    REQUIRE(colour1 == colour2);\n  }\n}\n"
  },
  {
    "path": "tests/test-common.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#define CATCH_CONFIG_MAIN  // This tells Catch to provide a main() - only do\n                           // this in one cpp file\n\n#include \"catch2/catch.hpp\"\n\n#include <common.h>\n#include <conky.h>\n\nusing namespace Catch::Matchers;\n\nextern char **environ;\n\nstd::string get_valid_environment_variable_name() {\n  if (getenv(\"HOME\") != nullptr) { return \"HOME\"; }\n\n  // If HOME is not a valid environment variable name, try to get a valid one.\n  char *env_var = *environ;\n\n  for (int i = 1; env_var; i++) {\n    std::string variable_name(env_var);\n    int variable_name_length = variable_name.find('=');\n    variable_name = variable_name.substr(0, variable_name_length);\n\n    if (getenv(variable_name.c_str()) != nullptr) { return variable_name; }\n\n    env_var = *(environ + i);\n  }\n\n  return \"\";\n}\n\nstd::string get_invalid_environment_variable_name() {\n  std::string variable_name = \"INVALIDVARIABLENAME\";\n\n  while (getenv(variable_name.c_str()) != nullptr) {\n    variable_name += std::to_string(variable_name.length());\n  }\n\n  return variable_name;\n}\n\nTEST_CASE(\"to_real_path simplifies complex paths\", \"[to_real_path]\") {\n  REQUIRE(to_real_path(\"/a/b/c/../d/../../e\") == \"/a/e\");\n}\nTEST_CASE(\"to_real_path resolves variables\", \"[to_real_path]\") {\n  REQUIRE(to_real_path(\"$HOME/test\") == std::string(getenv(\"HOME\")) + \"/test\");\n}\nTEST_CASE(\"to_real_path resolves `~` symbol\", \"[to_real_path]\") {\n  REQUIRE(to_real_path(\"~/test\") == std::string(getenv(\"HOME\")) + \"/test\");\n}\n\nTEST_CASE(\"environment variables are substituted correctly\",\n          \"[variable_substitute]\") {\n  std::string valid_name = get_valid_environment_variable_name();\n  std::string valid_value = getenv(valid_name.c_str());\n  std::string invalid_name = get_invalid_environment_variable_name();\n\n  SECTION(\"an empty string input returns an empty string\") {\n    REQUIRE(variable_substitute(\"\") == \"\");\n  }\n\n  SECTION(\"string in with no $ returns same string\") {\n    std::string string_alpha = \"abcdefghijklmnopqrstuvwxyz\";\n    std::string string_numbers = \"1234567890\";\n    std::string string_special = \"`~!@#$%^&*()-=_+[]{}\\\\|;:'\\\",<.>/?\";\n    std::string string_valid_name = valid_name;\n\n    REQUIRE(variable_substitute(string_alpha) == string_alpha);\n    REQUIRE(variable_substitute(string_numbers) == string_numbers);\n    REQUIRE(variable_substitute(string_special) == string_special);\n    REQUIRE(variable_substitute(string_valid_name) == string_valid_name);\n  }\n\n  SECTION(\"invalid variables are removed from return string\") {\n    std::string string_in_1 = \"a$\" + invalid_name + \" z\";\n    std::string string_in_2 = \"a${\" + invalid_name + \"} z\";\n    std::string string_in_3 = \"a${\" + invalid_name + \" \" + valid_name + \"} z\";\n    std::string string_in_4 = \"a${ \" + valid_name + \"} z\";\n    std::string string_in_5 = \"a${\" + valid_name + \" } z\";\n    std::string string_in_6 = \"a$\" + valid_name + \"z z\";\n    std::string string_in_7 = \"a$\" + invalid_name + \"# z\";\n\n    REQUIRE(variable_substitute(string_in_1) == \"a z\");\n    REQUIRE(variable_substitute(string_in_2) == \"a z\");\n    REQUIRE(variable_substitute(string_in_3) == \"a z\");\n    REQUIRE(variable_substitute(string_in_4) == \"a z\");\n    REQUIRE(variable_substitute(string_in_5) == \"a z\");\n    REQUIRE(variable_substitute(string_in_6) == \"a z\");\n    REQUIRE(variable_substitute(string_in_7) == \"a# z\");\n  }\n\n  SECTION(\"valid variable gets replaced in the return string\") {\n    std::string string_in_1 = \"a$\" + valid_name + \" z\";\n    std::string string_in_2 = \"a${\" + valid_name + \"} z\";\n    std::string string_in_3 = \"a$\" + valid_name + \"# z\";\n\n    std::string string_var_replaced_1 = \"a\" + valid_value + \" z\";\n    std::string string_var_replaced_2 = \"a\" + valid_value + \" z\";\n    std::string string_var_replaced_3 = \"a\" + valid_value + \"# z\";\n\n    REQUIRE(variable_substitute(string_in_1) == string_var_replaced_1);\n    REQUIRE(variable_substitute(string_in_2) == string_var_replaced_2);\n    REQUIRE(variable_substitute(string_in_3) == string_var_replaced_3);\n  }\n\n  SECTION(\"$ without variable is ignored\") {\n    std::string string_in_1 = \"a$#z\";\n    std::string string_in_2 = \"a$2z\";\n\n    REQUIRE(variable_substitute(string_in_1) == string_in_1);\n    REQUIRE(variable_substitute(string_in_2) == string_in_2);\n  }\n\n  SECTION(\"double $ gets converted to single $ and is passed over\") {\n    std::string string_in_1 = \"a$$sz\";\n    std::string string_in_2 = \"a$$\" + valid_name + \"z\";\n    std::string string_out_1 = \"a$sz\";\n    std::string string_out_2 = \"a$\" + valid_name + \"z\";\n\n    REQUIRE(variable_substitute(string_in_1) == string_out_1);\n    REQUIRE(variable_substitute(string_in_2) == string_out_2);\n  }\n\n  SECTION(\"incomplete variable does not get replaced in return string\") {\n    std::string string_in = \"a${\" + valid_name + \" z\";\n\n    REQUIRE(variable_substitute(string_in) == string_in);\n  }\n}\n\nTEST_CASE(\"cpu_percentage and cpu_barval return correct values\") {\n  struct text_object obj0;\n  obj0.data.i = 0;\n  struct text_object obj1;\n  obj1.data.i = 1;\n  // struct text_object obj2;\n  // obj2.data.i = 2;\n  info.cpu_count = 1;\n\n  // SECTION(\"for non-existent cpu\") {\n  // info.cpu_usage = new float[2];\n  // info.cpu_usage[0] = 0.253;\n  // info.cpu_usage[1] = 0.507;\n\n  // This does not exist in Catch2, but would be nice to have since that's\n  // what happens in this case.\n  // REQUIRE_EXIT(cpu_percentage(&obj2));\n  // REQUIRE_EXIT(cpu_barval(&obj2));\n\n  // delete[] info.cpu_usage;\n  // }\n\n  SECTION(\"for cpu_usage == nullptr\") {\n    info.cpu_usage = nullptr;\n\n    REQUIRE(cpu_percentage(&obj0) == 0);\n    REQUIRE(cpu_barval(&obj0) == 0);\n    REQUIRE(cpu_percentage(&obj1) == 0);\n    REQUIRE(cpu_barval(&obj1) == 0);\n  }\n\n  SECTION(\"for cpu_usage has data\") {\n    info.cpu_usage = new float[2];\n    info.cpu_usage[0] = 0.253;\n    info.cpu_usage[1] = 0.507;\n\n    REQUIRE(cpu_percentage(&obj0) == 25);\n    REQUIRE_THAT(cpu_barval(&obj0), WithinRel(0.253, 0.001));\n    REQUIRE(cpu_percentage(&obj1) == 51);\n    REQUIRE_THAT(cpu_barval(&obj1), WithinRel(0.507, 0.001));\n\n    delete[] info.cpu_usage;\n    info.cpu_usage = nullptr;\n  }\n}\n\nTEST_CASE(\"mem_percentage and mem_barval return correct values\") {\n  info.mem = 6;\n\n  SECTION(\"for memmax == 0\") {\n    info.memmax = 0;\n\n    REQUIRE(mem_percentage(nullptr) == 0);\n    REQUIRE(mem_barval(nullptr) == 0);\n  }\n\n  SECTION(\"for memmax > 0\") {\n    info.memmax = 24;\n\n    REQUIRE(mem_percentage(nullptr) == 25);\n    REQUIRE_THAT(mem_barval(nullptr), WithinRel(0.25, 0.005));\n  }\n}\n\nTEST_CASE(\"mem_with_buffers_barval returns correct value\") {\n  info.memwithbuffers = 6;\n\n  SECTION(\"for memmax == 0\") {\n    info.memmax = 0;\n    REQUIRE(mem_with_buffers_barval(nullptr) == 0);\n  }\n\n  SECTION(\"for memmax > 0\") {\n    info.memmax = 24;\n    REQUIRE_THAT(mem_with_buffers_barval(nullptr), WithinRel(0.25, 0.005));\n  }\n}\n\nTEST_CASE(\"swap_percentage and swap_barval return correct values\") {\n  info.swap = 6;\n\n  SECTION(\"for swapmax == 0\") {\n    info.swapmax = 0;\n\n    REQUIRE(swap_percentage(nullptr) == 0);\n    REQUIRE(swap_barval(nullptr) == 0);\n  }\n\n  SECTION(\"for swapmax > 0\") {\n    info.swapmax = 24;\n\n    REQUIRE(swap_percentage(nullptr) == 25);\n    REQUIRE_THAT(swap_barval(nullptr), WithinRel(0.25, 0.005));\n  }\n}\n"
  },
  {
    "path": "tests/test-conky.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#include <conky.h>\n#include <lua/lua-config.hh>\n\nTEST_CASE(\"Expressions can be evaluated\", \"[evaluate]\") {\n  state = std::make_unique<lua::state>();\n  conky::export_symbols(*state);\n\n  SECTION(\"Simple expressions without substitutions can be evaluated\") {\n    constexpr int kMaxSize = 10;\n    const char input[kMaxSize] = \"text\";\n    char result[kMaxSize]{'\\0'};\n\n    evaluate(input, result, kMaxSize);\n    REQUIRE(strncmp(input, result, kMaxSize) == 0);\n  }\n}\n"
  },
  {
    "path": "tests/test-core.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#include <core.h>\n\nTEST_CASE(\"remove_comments returns correct value\") {\n  SECTION(\"for no comments\") {\n    char text[] = \"test text\\n\";\n\n    size_t removed_chars = remove_comments(text);\n\n    REQUIRE(removed_chars == 0);\n  }\n\n  SECTION(\"for no comments but with backslashes\") {\n    char text[] = \"te\\\\st t\\\\ext\\n\";\n\n    size_t removed_chars = remove_comments(text);\n\n    REQUIRE(removed_chars == 0);\n  }\n\n  SECTION(\"for single line of comment\") {\n    char text_with_newline[] = \"#test text\\n\";\n    char text_no_newline[] = \"#test text\";\n\n    size_t removed_chars_with_newline = remove_comments(text_with_newline);\n    size_t removed_chars_no_newline = remove_comments(text_no_newline);\n\n    REQUIRE(removed_chars_with_newline == 11);\n    REQUIRE(removed_chars_no_newline == 10);\n  }\n\n  SECTION(\"for comment starting in middle of line\") {\n    char text[] = \"test #text\\n\";\n\n    size_t removed_chars = remove_comments(text);\n\n    REQUIRE(removed_chars == 6);\n  }\n}\n"
  },
  {
    "path": "tests/test-darwin-top.cc",
    "content": "/*\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"data/os/darwin_top_helpers.h\"\n\n#include <climits>\n\n#include \"catch2/catch_amalgamated.hpp\"\n\nTEST_CASE(\"darwin cpu sample overall totals are reset before summing\",\n          \"[darwin][top]\") {\n  struct cpusample sample[3] = {};\n\n  sample[0].totalUserTime = 100;\n  sample[0].totalSystemTime = 200;\n  sample[0].totalIdleTime = 300;\n\n  sample[1].totalUserTime = 7;\n  sample[1].totalSystemTime = 11;\n  sample[1].totalIdleTime = 13;\n\n  sample[2].totalUserTime = 17;\n  sample[2].totalSystemTime = 19;\n  sample[2].totalIdleTime = 23;\n\n  sum_cpu_sample_overall(sample, 2);\n\n  REQUIRE(sample[0].totalUserTime == 24);\n  REQUIRE(sample[0].totalSystemTime == 30);\n  REQUIRE(sample[0].totalIdleTime == 36);\n}\n\nTEST_CASE(\"darwin cpu total delta initializes safely\", \"[darwin][top]\") {\n  unsigned long previous = ULONG_MAX;\n\n  uint64_t delta = cpu_total_delta(1000, &previous);\n  REQUIRE(delta == 0);\n  REQUIRE(previous == 1000);\n\n  delta = cpu_total_delta(1600, &previous);\n  REQUIRE(delta == 600);\n  REQUIRE(previous == 1600);\n}\n\nTEST_CASE(\"darwin mach ticks convert to centiseconds\", \"[darwin][top]\") {\n  REQUIRE(mach_ticks_to_centis(0, 1, 1) == 0);\n  REQUIRE(mach_ticks_to_centis(10000000, 1, 1) == 1);\n  REQUIRE(mach_ticks_to_centis(20000000, 1, 1) == 2);\n\n  REQUIRE(mach_ticks_to_centis(240000, 125, 3) == 1);\n  REQUIRE(mach_ticks_to_centis(480000, 125, 3) == 2);\n}\n"
  },
  {
    "path": "tests/test-darwin.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#include <data/os/darwin.h>\n\nTEST_CASE(\"get_entropy_avail returns 1\", \"[get_entropy_avail]\") {\n  unsigned int unused = 0;\n  REQUIRE(get_entropy_avail(&unused) == 1);\n}\n"
  },
  {
    "path": "tests/test-diskio.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#include <config.h>\n#include <conky.h>\n#include <data/hardware/diskio.h>\n\n#if BUILD_X11\nTEST_CASE(\"diskiographval returns correct value\") {\n  struct text_object obj;\n\n  SECTION(\"for valid data\") {\n    diskio_stat *diskio = new diskio_stat;\n    diskio->current = 2.5;\n\n    obj.data.opaque = diskio;\n\n    REQUIRE_THAT(diskiographval(&obj), Catch::Matchers::WithinRel(2.5, 0.05));\n\n    delete diskio;\n  }\n}\n#endif\n"
  },
  {
    "path": "tests/test-fs.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#include <data/fs.h>\n\nTEST_CASE(\"fs_free_percentage returns correct value\") {\n  struct text_object obj;\n\n  SECTION(\"for fs size == 0\") {\n    fs_stat *fs = new fs_stat;\n    fs->size = 0;\n    fs->avail = 17;\n    fs->free = 97;\n\n    obj.data.opaque = fs;\n\n    REQUIRE(fs_free_percentage(&obj) == 0);\n\n    delete fs;\n  }\n\n  SECTION(\"for valid data\") {\n    fs_stat *fs = new fs_stat;\n    fs->size = 68;\n    fs->avail = 17;\n    fs->free = 97;\n\n    obj.data.opaque = fs;\n\n    REQUIRE(fs_free_percentage(&obj) == 25);\n\n    delete fs;\n  }\n}\n"
  },
  {
    "path": "tests/test-gradient.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#include <conky.h>\n#include <content/colours.hh>\n#include <content/gradient.hh>\n\n#include <iomanip>\n#include <iostream>\n\nconst int width = 4;\nconst Colour colour = Colour::from_argb32(0xff996633);  // brown\nconst long expected_hue = 256;\nconst long expected_value = 0x99;   // max(0x99, 0x66, 0x33)\nconst long expected_chroma = 0x66;  // (0x99 - 0x33)\nconst long expected_luma = 20712665L;\nconst long expected_saturation = 122880L;\nconst long expected_red = 0x99;\nconst long expected_green = 0x66;\nconst long expected_blue = 0x33;\n\nconst long full_scale = conky::gradient_factory::SCALE360;\n\nstd::ostream& operator<<(std::ostream& s, const Colour& c) {\n  s << '#';\n  s << std::setfill('0');\n  s << std::setw(2);\n  s << std::setbase(16);\n  s << (int)c.alpha << (int)c.red << (int)c.green << (int)c.blue;\n  return s;\n}\n\nTEST_CASE(\"gradient_factory::convert_from_rgb returns correct value\") {\n#ifdef BUILD_X11\n  state = nullptr;\n#endif\n  SECTION(\"rgb_gradient_factory\") {\n    auto factory = new conky::rgb_gradient_factory(width, colour, colour);\n    long result[3];\n\n    factory->convert_from_rgb(colour, result);\n\n    SECTION(\"red\") { REQUIRE(result[0] == expected_red * full_scale); }\n    SECTION(\"green\") { REQUIRE(result[1] == expected_green * full_scale); }\n    SECTION(\"blue\") { REQUIRE(result[2] == expected_blue * full_scale); }\n\n    delete factory;\n  }\n\n  SECTION(\"hsv_gradient_factory\") {\n    auto factory = new conky::hsv_gradient_factory(width, colour, colour);\n    long result[3];\n\n    factory->convert_from_rgb(colour, result);\n\n    SECTION(\"hue\") { REQUIRE(result[0] == expected_hue * 60); }\n    SECTION(\"saturation\") { REQUIRE(result[1] == expected_saturation); }\n    SECTION(\"value\") { REQUIRE(result[2] == expected_value * full_scale); }\n\n    delete factory;\n  }\n\n  SECTION(\"hcl_gradient_factory\") {\n    auto factory = new conky::hcl_gradient_factory(width, colour, colour);\n    long result[3];\n\n    factory->convert_from_rgb(colour, result);\n\n    SECTION(\"hue\") { REQUIRE(result[0] == expected_hue * 60); }\n    SECTION(\"chroma\") { REQUIRE(result[1] == expected_chroma * full_scale); }\n    SECTION(\"luma\") { REQUIRE(result[2] == expected_luma); }\n\n    delete factory;\n  }\n}\n\nTEST_CASE(\n    \"gradient_factory should convert to and from rgb \"\n    \"and get the initial value\") {\n  SECTION(\"rgb_gradient_factory\") {\n    long tmp[3];\n    auto factory = new conky::rgb_gradient_factory(width, colour, colour);\n    factory->convert_from_rgb(colour, tmp);\n    auto result = factory->convert_to_rgb(tmp);\n\n    REQUIRE(result == colour);\n\n    delete factory;\n  }\n\n  SECTION(\"hsv_gradient_factory\") {\n    long tmp[3];\n    auto factory = new conky::hsv_gradient_factory(width, colour, colour);\n    factory->convert_from_rgb(colour, tmp);\n    auto result = factory->convert_to_rgb(tmp);\n\n    REQUIRE(result == colour);\n\n    delete factory;\n  }\n\n  SECTION(\"hcl_gradient_factory\") {\n    long tmp[3];\n    auto factory = new conky::hcl_gradient_factory(width, colour, colour);\n    factory->convert_from_rgb(colour, tmp);\n    auto result = factory->convert_to_rgb(tmp);\n\n    REQUIRE(result == colour);\n\n    delete factory;\n  }\n}\n"
  },
  {
    "path": "tests/test-graph.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include <tuple>\n#include \"catch2/catch.hpp\"\n\n#include <conky.h>\n#include <content/specials.h>\n#include <lua/lua-config.hh>\n\n#ifdef BUILD_GUI\n\n#define SF_SHOWLOG (1 << 1)\n\n// Specific value doesn't matter, but we check if the same one comes back\nconstexpr double default_scale = M_PI;\n\nconstexpr double default_width = 0;\nconstexpr double default_height = 25;\n\nstruct graph {\n  int id;\n  char flags;\n  int width, height;\n  bool colours_set;\n  Colour first_colour, last_colour;\n  double scale;\n  char tempgrad;\n};\n\nstatic std::pair<struct graph, bool> test_parse(const char *s) {\n  struct text_object obj;\n  bool result = scan_graph(&obj, s, default_scale,FALSE);\n  auto g = static_cast<struct graph *>(obj.special_data);\n  struct graph graph = *g;\n  free(g);\n  return {graph, result};\n}\n\nstd::string unquote(const std::string &s) {\n  auto out = s;\n  out.erase(remove(out.begin(), out.end(), '\\\"'), out.end());\n  return out;\n}\n\nTEST_CASE(\"scan_graph correctly parses input strings\") {\n  state = std::make_unique<lua::state>();\n  conky::export_symbols(*state);\n\n  SECTION(\"Trivial parse\") {\n    auto [g, success] = test_parse(\"\");\n\n    REQUIRE(g.width == default_width);\n    REQUIRE(g.height == default_height);\n  }\n\n  /* test parsing combinations of options */\n  const char *size_options[][2] = {{\"30\", \"500\"}, {\"80\", \"\"}, {\"\", \"\"}};\n  const char *color_options[][2] = {{\"orange\", \"blue\"},\n                                    {\"#deadff\", \"#392014\"},\n                                    {\"000000\", \"000000\"},\n                                    {\"\", \"\"}};\n  const char *scale_options[] = {\"0.5\", \"\"};\n\n  SECTION(\"subset of [height,width] [color1 color2] [scale] [-t] [-l]\") {\n    for (auto size : size_options) {\n      for (auto colors : color_options) {\n        for (auto scale : scale_options) {\n          bool ends_at_first_size = false;\n\n          /* build an argument string by combining the selected options */\n          std::string s;\n          if (*size[0] != '\\0') {\n            s += size[0];\n            s += \",\";\n            if (*size[1] == '\\0') {\n              /* if the size is just a height, it has to be the end of the\n               * argument string */\n              ends_at_first_size = true;\n            } else {\n              s += size[1];\n            }\n            s += \" \";\n          }\n          if (!ends_at_first_size) {\n            s += colors[0];\n            s += \" \";\n            s += colors[1];\n            s += \" \";\n            s += scale;\n          }\n\n          /* parse the argument string */\n          auto [g, success] = test_parse(s.c_str());\n\n          printf(\"command: %s\\n\", s.c_str());\n\n          /* validate parsing of each component */\n          if (*size[0] == '\\0') {\n            REQUIRE(g.width == default_width);\n            REQUIRE(g.height == default_height);\n          } else {\n            REQUIRE(g.height == atoi(size[0]));\n            REQUIRE(g.width == atoi(size[1]));\n          }\n\n          /* if second half of size is empty, no subsequent values should be\n           * set\n           */\n          if (ends_at_first_size) {\n            REQUIRE(g.colours_set == false);\n            continue;\n          }\n\n          if (*colors[0] == '\\0') {\n            REQUIRE(g.colours_set == false);\n          } else {\n            REQUIRE(g.colours_set == true);\n            REQUIRE(g.first_colour == parse_color(colors[0]));\n            REQUIRE(g.last_colour == parse_color(colors[1]));\n          }\n\n          if (*scale == '\\0') {\n            REQUIRE(g.scale == default_scale);\n          } else {\n            REQUIRE(g.scale == 0.5);\n          }\n\n          REQUIRE(g.flags == 0);\n          REQUIRE(g.tempgrad == 0);\n        }\n      }\n    }\n  }\n\n  SECTION(\"[height,width] [color1 color2] [scale] [-t] [-l]\") {\n    auto [g, success] = test_parse(\"21,340 orange blue 0.5 -t -l\");\n\n    REQUIRE(success);\n    REQUIRE(g.width == 340);\n    REQUIRE(g.height == 21);\n    REQUIRE(g.colours_set == true);\n    REQUIRE(g.scale == 0.5);\n    REQUIRE(g.flags == SF_SHOWLOG);\n    REQUIRE(g.tempgrad == true);\n  }\n\n  SECTION(\"-t location\") {\n    {\n      auto [g, success] = test_parse(\"21,340 red blue 0.5\");\n      REQUIRE(g.tempgrad == false);\n    }\n    {\n      auto [g, success] = test_parse(\"21,340 red blue 0.5\");\n      REQUIRE(g.tempgrad == false);\n    }\n    {\n      auto [g, success] = test_parse(\"-t 21,340 red blue 0.5\");\n      REQUIRE(g.tempgrad == true);\n    }\n    {\n      auto [g, success] = test_parse(\"21,340 -t red blue 0.5\");\n      REQUIRE(g.tempgrad == true);\n    }\n  }\n}\n\nTEST_CASE(\"scan_command correctly parses input strings\") {\n  SECTION(\"parse commands\") {\n    const char *command_options[][2] = {{\"\\\"foo bar\\\"\", \"foo bar\"},\n                                        {\"\\\"foo bar\\\"\\tbaz\", \"foo bar\"},\n                                        {\"\\\"foo bar\\\"\\nbaz\", \"foo bar\"},\n                                        {\"\\\"foo bar\\\" baz\", \"foo bar\"},\n                                        {\"one two\", \"one\"},\n                                        {\"\\\"ls -t\\\"\", \"ls -t\"},\n                                        {\"\\\"ls -t\\\" 4309\", \"ls -t\"},\n                                        {\"foo-test\", \"foo-test\"},\n                                        {\"foo-test a b c\", \"foo-test\"},\n                                        {\"\", \"\"}};\n    for (auto [command, expected_parsed] : command_options) {\n      auto [parsed, len] = scan_command(command);\n      REQUIRE(std::string(parsed) == expected_parsed);\n      if (command[0] == '\"') {\n        REQUIRE(len == strlen(expected_parsed) + 2);\n      } else {\n        REQUIRE(len == strlen(expected_parsed));\n      }\n    }\n  }\n}\n\n#endif /* BUILD_GUI */\n"
  },
  {
    "path": "tests/test-linux-proc.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#ifdef __linux__\n#include <conky.h>\n#include <content/text_object.h>\n#include <data/proc.h>\n#include <sys/prctl.h>\n#include <sys/wait.h>\n#include <unistd.h>\n#include <lua/lua-config.hh>\n\n#include <array>\n#include <atomic>\n#include <chrono>\n#include <csignal>\n#include <cstdio>\n#include <cstdlib>\n#include <cstring>\n#include <fstream>\n#include <string>\n#include <thread>\n#include <vector>\n\nusing namespace Catch::Matchers;\n\nnamespace {\nvoid ensure_lua_state() {\n  if (state) { return; }\n  state = std::make_unique<lua::state>();\n  conky::export_symbols(*state);\n}\n\nstruct sub_text_object {\n  struct text_object root {};\n  struct text_object obj {};\n\n  explicit sub_text_object(const char *text) {\n    obj_be_plain_text(&obj, text);\n    append_object(&root, &obj);\n  }\n\n  ~sub_text_object() { free(obj.data.s); }\n};\n\nstruct thread_group {\n  std::atomic<bool> running{true};\n  std::vector<std::thread> threads;\n\n  explicit thread_group(size_t count) {\n    threads.reserve(count);\n    for (size_t i = 0; i < count; ++i) {\n      threads.emplace_back([this]() {\n        while (running.load()) {\n          std::this_thread::sleep_for(std::chrono::milliseconds(10));\n        }\n      });\n    }\n  }\n\n  ~thread_group() {\n    running = false;\n    for (auto &thread : threads) {\n      if (thread.joinable()) { thread.join(); }\n    }\n  }\n};\n\nstruct proc_name_guard {\n  char original[16] = {};\n  bool ok = false;\n\n  proc_name_guard() { ok = (prctl(PR_GET_NAME, original) == 0); }\n\n  bool set(const char *name) const {\n    return ok && (prctl(PR_SET_NAME, name) == 0);\n  }\n\n  ~proc_name_guard() {\n    if (ok) { prctl(PR_SET_NAME, original); }\n  }\n};\n\nstd::string read_cmdline() {\n  std::ifstream input(\"/proc/self/cmdline\", std::ios::binary);\n  std::string raw((std::istreambuf_iterator<char>(input)),\n                  std::istreambuf_iterator<char>());\n  for (char &ch : raw) {\n    if (ch == '\\0') { ch = ' '; }\n  }\n  while (!raw.empty() && raw.back() == ' ') { raw.pop_back(); }\n  return raw;\n}\n\nstd::string read_status_value_for_pid(pid_t pid, const std::string &key) {\n  std::string path = \"/proc/\" + std::to_string(pid) + \"/status\";\n  std::ifstream input(path);\n  std::string line;\n  while (std::getline(input, line)) {\n    if (line.rfind(key, 0) == 0) {\n      std::string value = line.substr(key.size());\n      while (!value.empty() &&\n             (value.front() == '\\t' || value.front() == ' ')) {\n        value.erase(value.begin());\n      }\n      return value;\n    }\n  }\n  return {};\n}\n\nstd::string read_status_value(const std::string &key) {\n  return read_status_value_for_pid(getpid(), key);\n}\n\npid_t spawn_stopped_child() {\n  pid_t pid = fork();\n  if (pid == 0) {\n    raise(SIGSTOP);\n    _exit(0);\n  }\n  return pid;\n}\n\nstruct child_guard {\n  pid_t pid = -1;\n\n  ~child_guard() {\n    if (pid > 0) {\n      kill(pid, SIGKILL);\n      int status = 0;\n      waitpid(pid, &status, 0);\n    }\n  }\n};\n\nbool parse_proc_stat_times(const std::string &stat, unsigned long int *utime,\n                           unsigned long int *stime) {\n  if (utime == nullptr || stime == nullptr) { return false; }\n  size_t close = stat.rfind(')');\n  if (close == std::string::npos) { return false; }\n  size_t pos = close + 1;\n  while (pos < stat.size() && stat[pos] == ' ') { ++pos; }\n  const char *after = stat.c_str() + pos;\n  int parsed =\n      sscanf(after, \"%*c %*d %*d %*d %*d %*d %*u %*u %*u %*u %*u %lu %lu\",\n             utime, stime);\n  return parsed == 2;\n}\n}  // namespace\n\nTEST_CASE(\"cmdline_to_pid finds the current process\",\n          \"[proc][cmdline_to_pid]\") {\n  std::string cmdline = read_cmdline();\n  REQUIRE_FALSE(cmdline.empty());\n\n  struct text_object obj {};\n  obj.data.s = strdup(cmdline.c_str());\n\n  char buf[32]{};\n  print_cmdline_to_pid(&obj, buf, sizeof(buf));\n\n  free(obj.data.s);\n\n  REQUIRE(std::string(buf) == std::to_string(getpid()));\n}\n\nTEST_CASE(\"pid_time handles comm with spaces\", \"[proc][pid_time]\") {\n  ensure_lua_state();\n\n  proc_name_guard name_guard;\n  REQUIRE(name_guard.ok);\n  REQUIRE(name_guard.set(\"conky test\"));\n\n  std::ifstream input(\"/proc/self/stat\", std::ios::binary);\n  std::string stat((std::istreambuf_iterator<char>(input)),\n                   std::istreambuf_iterator<char>());\n  REQUIRE_FALSE(stat.empty());\n\n  unsigned long int utime = 0;\n  unsigned long int stime = 0;\n  REQUIRE(parse_proc_stat_times(stat, &utime, &stime));\n\n  double expected = static_cast<double>(utime + stime) / 100.0;\n\n  std::string pid_str = std::to_string(getpid());\n  sub_text_object sub(pid_str.c_str());\n  struct text_object obj {};\n  obj.sub = &sub.root;\n\n  char buf[64]{};\n  print_pid_time(&obj, buf, sizeof(buf));\n\n  double actual = std::stod(buf);\n  REQUIRE_THAT(actual, WithinAbs(expected, 0.01));\n}\n\nTEST_CASE(\"pid_time_kernelmode uses system time\",\n          \"[proc][pid_time_kernelmode]\") {\n  ensure_lua_state();\n\n  std::ifstream input(\"/proc/self/stat\", std::ios::binary);\n  std::string stat((std::istreambuf_iterator<char>(input)),\n                   std::istreambuf_iterator<char>());\n  REQUIRE_FALSE(stat.empty());\n\n  unsigned long int utime = 0;\n  unsigned long int stime = 0;\n  REQUIRE(parse_proc_stat_times(stat, &utime, &stime));\n\n  double expected = static_cast<double>(stime) / 100.0;\n\n  std::string pid_str = std::to_string(getpid());\n  sub_text_object sub(pid_str.c_str());\n  struct text_object obj {};\n  obj.sub = &sub.root;\n\n  char buf[64]{};\n  print_pid_time_kernelmode(&obj, buf, sizeof(buf));\n\n  double actual = std::stod(buf);\n  REQUIRE_THAT(actual, WithinAbs(expected, 0.01));\n}\n\nTEST_CASE(\"pid_time_usermode uses user time\", \"[proc][pid_time_usermode]\") {\n  ensure_lua_state();\n\n  std::ifstream input(\"/proc/self/stat\", std::ios::binary);\n  std::string stat((std::istreambuf_iterator<char>(input)),\n                   std::istreambuf_iterator<char>());\n  REQUIRE_FALSE(stat.empty());\n\n  unsigned long int utime = 0;\n  unsigned long int stime = 0;\n  REQUIRE(parse_proc_stat_times(stat, &utime, &stime));\n\n  double expected = static_cast<double>(utime) / 100.0;\n\n  std::string pid_str = std::to_string(getpid());\n  sub_text_object sub(pid_str.c_str());\n  struct text_object obj {};\n  obj.sub = &sub.root;\n\n  char buf[64]{};\n  print_pid_time_usermode(&obj, buf, sizeof(buf));\n\n  double actual = std::stod(buf);\n  REQUIRE_THAT(actual, WithinAbs(expected, 0.01));\n}\n\nTEST_CASE(\"pid_thread_list does not overflow small buffers\",\n          \"[proc][pid_thread_list]\") {\n  ensure_lua_state();\n\n  thread_group group(4);\n\n  std::string pid_str = std::to_string(getpid());\n  sub_text_object sub(pid_str.c_str());\n  struct text_object obj {};\n  obj.sub = &sub.root;\n\n  constexpr size_t k_buf_size = 8;\n  constexpr char k_sentinel = 'Z';\n  std::array<char, k_buf_size + 4> buffer{};\n  buffer.fill('X');\n  for (size_t i = k_buf_size; i < buffer.size(); ++i) {\n    buffer[i] = k_sentinel;\n  }\n\n  print_pid_thread_list(&obj, buffer.data(), k_buf_size);\n\n  REQUIRE(memchr(buffer.data(), '\\0', k_buf_size) != nullptr);\n  for (size_t i = k_buf_size; i < buffer.size(); ++i) {\n    REQUIRE(buffer[i] == k_sentinel);\n  }\n}\n\nTEST_CASE(\"pid_environ reads values from /proc environ\",\n          \"[proc][pid_environ]\") {\n  ensure_lua_state();\n\n  const char *expected = getenv(\"PATH\");\n  REQUIRE(expected != nullptr);\n\n  std::string pid_str = std::to_string(getpid());\n  std::string arg = pid_str + \" PATH\";\n  sub_text_object sub(arg.c_str());\n  struct text_object obj {};\n  obj.sub = &sub.root;\n\n  std::vector<char> buf(strlen(expected) + 1);\n  print_pid_environ(&obj, buf.data(), static_cast<unsigned int>(buf.size()));\n\n  REQUIRE(std::string(buf.data()) == expected);\n}\n\nTEST_CASE(\"pid_state_short returns the short state\",\n          \"[proc][pid_state_short]\") {\n  ensure_lua_state();\n\n  std::string state = read_status_value(\"State:\");\n  REQUIRE_FALSE(state.empty());\n\n  std::string pid_str = std::to_string(getpid());\n  sub_text_object sub(pid_str.c_str());\n  struct text_object obj {};\n  obj.sub = &sub.root;\n\n  char buf[8]{};\n  print_pid_state_short(&obj, buf, sizeof(buf));\n\n  REQUIRE(buf[0] == state[0]);\n}\n\nTEST_CASE(\"pid_vm values map to correct status entries\", \"[proc][pid_vm]\") {\n  ensure_lua_state();\n\n  pid_t child = spawn_stopped_child();\n  REQUIRE(child > 0);\n  int status = 0;\n  REQUIRE(waitpid(child, &status, WUNTRACED) == child);\n  REQUIRE(WIFSTOPPED(status));\n\n  child_guard guard;\n  guard.pid = child;\n\n  std::string vmrss = read_status_value_for_pid(child, \"VmRSS:\");\n  std::string vmstk = read_status_value_for_pid(child, \"VmStk:\");\n  std::string vmexe = read_status_value_for_pid(child, \"VmExe:\");\n  REQUIRE_FALSE(vmrss.empty());\n  REQUIRE_FALSE(vmstk.empty());\n  REQUIRE_FALSE(vmexe.empty());\n\n  std::string pid_str = std::to_string(child);\n  sub_text_object sub(pid_str.c_str());\n  struct text_object obj {};\n  obj.sub = &sub.root;\n\n  char buf[64]{};\n  print_pid_vmrss(&obj, buf, sizeof(buf));\n  REQUIRE(std::string(buf) == vmrss);\n\n  memset(buf, 0, sizeof(buf));\n  print_pid_vmstk(&obj, buf, sizeof(buf));\n  REQUIRE(std::string(buf) == vmstk);\n\n  memset(buf, 0, sizeof(buf));\n  print_pid_vmexe(&obj, buf, sizeof(buf));\n  REQUIRE(std::string(buf) == vmexe);\n}\n#endif\n"
  },
  {
    "path": "tests/test-linux.cc",
    "content": "/*\n *\n * Conky, a system monitor, based on torsmo\n *\n * Any original torsmo code is licensed under the BSD license\n *\n * All code written since the fork of torsmo is licensed under the GPL\n *\n * Please see COPYING for details\n *\n * Copyright (c) 2005-2024 Brenden Matthews, Philip Kovacs, et. al.\n *\t(see AUTHORS)\n * All rights reserved.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n * You should have received a copy of the GNU General Public License\n * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n *\n */\n\n#include \"catch2/catch.hpp\"\n\n#include <data/os/linux.h>\n\nTEST_CASE(\"get_entropy_avail returns 0\", \"[get_entropy_avail]\") {\n  unsigned int unused = 0;\n  REQUIRE(get_entropy_avail(&unused) == 0);\n}\n"
  },
  {
    "path": "tests/test-security.cc",
    "content": "#include <string>\n\n#include \"catch2/catch.hpp\"\n\n#include <config.h>\n\n#ifdef BUILD_HTTP\n#include <output/display-http.hh>\n#endif\n#ifdef BUILD_RSS\n#include <data/network/rss.h>\n#endif\n#ifdef BUILD_CURL\n#include <common.h>\n#endif\n\n#ifdef BUILD_HTTP\nTEST_CASE(\"html_escape escapes active markup\", \"[security][http]\") {\n  REQUIRE(\n      conky::html_escape(\"<script>alert('x') & \\\"y\\\"</script>\") ==\n      \"&lt;script&gt;alert(&#39;x&#39;) &amp; &quot;y&quot;&lt;/script&gt;\");\n}\n#endif\n\n#ifdef BUILD_RSS\nTEST_CASE(\"rss_safe_append truncates without overflowing\", \"[security][rss]\") {\n  char buffer[8] = \"ab\";\n\n  rss_safe_append(buffer, sizeof(buffer), \"cdef\");\n  REQUIRE(std::string(buffer) == \"abcdef\");\n\n  rss_safe_append(buffer, sizeof(buffer), \"ghijk\");\n  REQUIRE(std::string(buffer) == \"abcdefg\");\n}\n#endif\n\n#ifdef BUILD_CURL\nTEST_CASE(\"github_notifications uses auth header instead of query params\",\n          \"[security][github]\") {\n  REQUIRE(github_notifications_url() == \"https://api.github.com/notifications\");\n  REQUIRE(github_authorization_header(\"secret-token\") ==\n          \"Authorization: Bearer secret-token\");\n}\n#endif\n"
  },
  {
    "path": "web/.gitignore",
    "content": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pnp\n.pnp.js\n\n# testing\n/coverage\n\n# next.js\n/.next/\n/out/\n\n# production\n/build\n*.tsbuildinfo\n\n# misc\n.DS_Store\n*.pem\n\n# debug\nnpm-debug.log*\nyarn-debug.log*\nyarn-error.log*\n\n# local env files\n.env.local\n.env.development.local\n.env.test.local\n.env.production.local\n\n# vercel\n.vercel\n\n# netlify\n.netlify\n\n# IDEs\n.vscode/\n\n# Cypress videos\ncypress/videos\n\n# Fuse.js index (we generate this on the fly)\npublic/static/fuse-index.json\n"
  },
  {
    "path": "web/components/CopyleftIcon.tsx",
    "content": "interface CopyleftIconProps {\n  className?: string\n  width?: number\n  height?: number\n}\n\nexport default function CopyleftIcon({\n  className,\n  width,\n  height,\n}: CopyleftIconProps) {\n  return (\n    <svg\n      xmlns=\"http://www.w3.org/2000/svg\"\n      width={width || 980}\n      height={height || 980}\n      fill=\"none\"\n      viewBox=\"0 0 980 980\"\n      className={className}\n    >\n      <circle\n        cx=\"490\"\n        cy=\"490\"\n        r=\"440\"\n        fill=\"none\"\n        strokeWidth=\"100\"\n        className=\"stroke-current\"\n      />\n      <path\n        d=\"M219,428H350a150,150 0 1 1 0,125H219a275,275 0 1 0 0-125z\"\n        strokeWidth=\"1\"\n        className=\"stroke-current fill-current\"\n      />\n    </svg>\n  )\n}\n"
  },
  {
    "path": "web/components/Docs.tsx",
    "content": "import type { Documentation } from '../utils/doc-utils'\nimport Link from 'next/link'\nimport { Link as LinkIcon } from 'lucide-react'\nimport { useRouter } from 'next/router'\n\nexport interface DocsProps {\n  docs: Documentation\n  braces: boolean\n  assign: boolean\n}\n\nexport default function Docs({ docs, braces, assign }: DocsProps) {\n  const router = useRouter()\n  return (\n    <div className=\"prose dark:prose-invert prose-lg w-full max-w-3xl\">\n      <div className=\"px-2 lg:px-4\" dangerouslySetInnerHTML={{ __html: docs.desc_md }} />\n\n      <div className=\"divide-y divide-gray-700/25 dark:divide-gray-300/25\">\n        {docs.values.map((doc) => {\n          const target = router.asPath.endsWith(`#${doc.name}`)\n          return (\n            <div\n              id={doc.name}\n              key={doc.name}\n              className={\n                'pt-4 scroll-mt-16 overflow-auto ' +\n                (target\n                  ? 'bg-rose-300 dark:bg-rose-900'\n                  : 'bg-slate-200 dark:bg-slate-800 target:bg-rose-300 target:dark:bg-rose-900') +\n                ' hover:bg-opacity-25 dark:hover:bg-opacity-25 hover:ring-1 ring-black dark:ring-white ring-inset'\n              }\n            >\n              <div className=\"flex\">\n                <div className=\"px-2 lg:pl-4 py-3\">\n                  <Link href={`#${doc.name}`} data-anchor-name={doc.name}>\n                    <LinkIcon size={20} strokeWidth={2} />\n                  </Link>\n                </div>\n                <div className=\"flex-col p-1 pr-2 lg:pr-4\">\n                  <div>\n                    {braces && <code>$&#123;</code>}\n                    <code className=\"text-lg p-1 mx-1 bg-fuchsia-200 dark:bg-fuchsia-900 font-bold\">\n                      {doc.name}\n                    </code>\n                    {typeof doc.args !== 'undefined' && doc.args.length > 0 && (\n                      <>\n                        {assign && <code>=</code>}\n                        <em>\n                          {doc.args.map((arg) => (\n                            <code\n                              className=\"text-lg p-1 mx-1 bg-slate-200 dark:bg-slate-800\"\n                              key={arg}\n                            >\n                              {arg}\n                            </code>\n                          ))}\n                        </em>\n                      </>\n                    )}\n                    {braces && <code>&#125;</code>}\n                  </div>\n                  <div\n                    className=\"py-2\"\n                    dangerouslySetInnerHTML={{ __html: doc.desc_md }}\n                  />\n                  {typeof doc.default !== 'undefined' && (\n                    <div>\n                      Default:{' '}\n                      <code className=\"px-1 mx-1 bg-slate-200 dark:bg-slate-800\">\n                        {doc.default}\n                      </code>\n                    </div>\n                  )}\n                </div>\n              </div>\n            </div>\n          )\n        })}\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "web/components/Doggy.tsx",
    "content": "import * as React from 'react'\n\nconst Doggy: React.FunctionComponent = () => {\n  return (\n    // from https://undraw.co/\n    <svg className=\"w-full\" width=\"656\" height=\"447.5061\" viewBox=\"0 0 656 447.5061\">\n      <path\n        d=\"M108.40148,315.94602c-3.16093,.3401-6.60921,.85055-10.27718,1.59744-15.55246,3.16687-15.87526,13.72736-15.73896,16.14847l-.10566-.06586c-1.56382,2.50859-2.54325,5.0473-3.13519,7.44337l-.71221-32.36652c.46052-.9602,.87954-2.04896,1.22889-3.16494,1.16419,3.58504,3.07256,6.97195,4.7176,6.74748,2.13909-.2919,3.07167-6.58596,2.67265-11.05881,2.72016,3.50314,7.2981,7.24972,9.02511,6.09446,1.38001-.92313,.56173-4.72359-.94492-8.17871,3.13929,1.89132,6.61613,3.13439,7.69503,1.93342,1.47227-1.63885-2.05557-7.23082-5.30905-10.35235,4.35496,.40613,9.89372-.28771,10.25684-2.26977,.2992-1.6331-2.99722-3.69384-6.5255-5.02014,3.5439-.93441,6.85789-2.56256,6.74798-4.17324-.13057-1.91338-5.05068-3.19543-9.29526-3.39051,3.20154-2.50471,6.14321-5.96711,5.24362-7.53303-.82704-1.43962-4.67439-.88198-8.22406,.38596,2.10064-3.00326,3.5775-6.38742,2.45277-7.54556-1.40106-1.44266-6.37359,1.04738-9.76711,3.79978,.66062-4.28797,.32665-9.70052-1.59659-10.19022-1.60895-.40967-3.88929,2.73886-5.4527,6.16866-.69097-3.59931-2.08979-7.01645-3.7042-7.01645-2.29982,0-4.16418,6.93399-4.16418,11.45149,0,.25536,.00677,.49574,.01843,.72541-.23083-.26761-.49538-.54719-.79707-.84018-3.24076-3.14728-9.51391-6.64064-11.11616-4.99082-1.12474,1.15814,.35212,4.5423,2.45277,7.54556-3.54967-1.26794-7.39702-1.82559-8.22406-.38596-1.11127,1.93439,3.63883,6.76323,7.4999,9.10499-.2321-.02796-.47595-.0515-.73547-.0692-4.50701-.30752-11.55183,1.08049-11.7084,3.37497-.10991,1.61067,3.20409,3.23883,6.74798,4.17324-3.52829,1.3263-6.8247,3.38704-6.5255,5.02014,.36312,1.98206,5.90188,2.6759,10.25684,2.26977-3.25348,3.12154-6.78132,8.7135-5.30905,10.35235,1.0789,1.20097,4.55573-.0421,7.69503-1.93342-1.50665,3.45512-2.32492,7.25558-.94492,8.17871,1.82373,1.21996,6.82541-3.02601,9.4625-6.67949-.2687,4.46965,.80077,10.61004,2.9228,10.85236,.88742,.10134,1.82777-.84507,2.67643-2.3023l-2.40356,34.79012c-.56184,4.05159,3.03199,6.69542,3.35318,8.36434l.51842,23.5593c-.58508-1.67794-1.37316-3.3952-2.43548-5.09933l-.10566,.0659c.13628-2.42136-.18675-12.98155-15.73896-16.14836-3.66797-.74689-7.11625-1.25734-10.27718-1.59744-3.73116-.40145-5.1866,4.70611-1.81595,6.35581,4.88144,2.38917,9.4733,5.39935,11.86668,8.96403,6.11901,9.11359,14.5737,3.84542,15.77578,3.0275,1.34266,2.23509,2.22306,4.48687,2.77913,6.62945l.27531,12.51144c-.06744,.2959-.11414,.46159-.11777,.47403l.12902,.03782,.66628,30.27884,6.18057-.04965-2.21068-30.94947c.37149-1.66957,1.51435-7.35722,0-13.26406l-2.21068-24.31744h0c-.0055-.01877,.12548,.63842,0,0l-2.8837-9.55504c.41933-2.95604,1.3925-6.28098,3.36894-9.57097,1.20206,.81791,9.65677,6.08611,15.77579-3.0275,2.39338-3.56469,6.98524-6.57486,11.86668-8.96403,3.37065-1.64971,1.91521-6.75726-1.81595-6.35581Zm-28.23342,71.6385l-.11651-5.2952c.23499,2.00214,.2231,3.80933,.11651,5.2952Z\"\n        fill=\"#f2f2f2\"\n      />\n      <path\n        d=\"M581.40148,315.94602c-3.16093,.3401-6.60921,.85055-10.27718,1.59744-15.55246,3.16687-15.87526,13.72736-15.73896,16.14847l-.10566-.06586c-1.56382,2.50859-2.54325,5.0473-3.13519,7.44337l-.71221-32.36652c.46052-.9602,.87954-2.04896,1.22889-3.16494,1.16419,3.58504,3.07256,6.97195,4.7176,6.74748,2.13909-.2919,3.07167-6.58596,2.67265-11.05881,2.72016,3.50314,7.2981,7.24972,9.02511,6.09446,1.38001-.92313,.56173-4.72359-.94492-8.17871,3.13929,1.89132,6.61613,3.13439,7.69503,1.93342,1.47227-1.63885-2.05557-7.23082-5.30905-10.35235,4.35496,.40613,9.89372-.28771,10.25684-2.26977,.2992-1.6331-2.99722-3.69384-6.5255-5.02014,3.5439-.93441,6.85789-2.56256,6.74798-4.17324-.13057-1.91338-5.05068-3.19543-9.29526-3.39051,3.20154-2.50471,6.14321-5.96711,5.24362-7.53303-.82704-1.43962-4.67439-.88198-8.22406,.38596,2.10064-3.00326,3.5775-6.38742,2.45277-7.54556-1.40106-1.44266-6.37359,1.04738-9.76711,3.79978,.66062-4.28797,.32665-9.70052-1.59659-10.19022-1.60895-.40967-3.88929,2.73886-5.4527,6.16866-.69097-3.59931-2.08979-7.01645-3.7042-7.01645-2.29982,0-4.16418,6.93399-4.16418,11.45149,0,.25536,.00677,.49574,.01843,.72541-.23083-.26761-.49538-.54719-.79707-.84018-3.24076-3.14728-9.51391-6.64064-11.11616-4.99082-1.12474,1.15814,.35212,4.5423,2.45277,7.54556-3.54967-1.26794-7.39702-1.82559-8.22406-.38596-1.11127,1.93439,3.63883,6.76323,7.4999,9.10499-.2321-.02796-.47595-.0515-.73547-.0692-4.50701-.30752-11.55183,1.08049-11.7084,3.37497-.10991,1.61067,3.20409,3.23883,6.74798,4.17324-3.52829,1.3263-6.8247,3.38704-6.5255,5.02014,.36312,1.98206,5.90188,2.6759,10.25684,2.26977-3.25348,3.12154-6.78132,8.7135-5.30905,10.35235,1.0789,1.20097,4.55573-.0421,7.69503-1.93342-1.50665,3.45512-2.32492,7.25558-.94492,8.17871,1.82373,1.21996,6.82541-3.02601,9.4625-6.67949-.2687,4.46965,.80077,10.61004,2.9228,10.85236,.88742,.10134,1.82777-.84507,2.67643-2.3023l-2.40356,34.79012c-.56184,4.05159,3.03199,6.69542,3.35318,8.36434l.51842,23.5593c-.58508-1.67794-1.37316-3.3952-2.43548-5.09933l-.10566,.0659c.13628-2.42136-.18675-12.98155-15.73896-16.14836-3.66797-.74689-7.11625-1.25734-10.27718-1.59744-3.73116-.40145-5.1866,4.70611-1.81595,6.35581,4.88144,2.38917,9.4733,5.39935,11.86668,8.96403,6.11901,9.11359,14.5737,3.84542,15.77578,3.0275,1.34266,2.23509,2.22306,4.48687,2.77913,6.62945l.27531,12.51144c-.06744,.2959-.11414,.46159-.11777,.47403l.12902,.03782,.66628,30.27884,6.18057-.04965-2.21068-30.94947c.37149-1.66957,1.51435-7.35722,0-13.26406l-2.21068-24.31744h0c-.0055-.01877,.12548,.63842,0,0l-2.8837-9.55504c.41933-2.95604,1.3925-6.28098,3.36894-9.57097,1.20206,.81791,9.65677,6.08611,15.77579-3.0275,2.39338-3.56469,6.98524-6.57486,11.86668-8.96403,3.37065-1.64971,1.91521-6.75726-1.81595-6.35581Zm-28.23342,71.6385l-.11651-5.2952c.23499,2.00214,.2231,3.80933,.11651,5.2952Z\"\n        fill=\"#f2f2f2\"\n      />\n      <path\n        d=\"M485.44292,216.85712l-2.89819-69.09314s-3.25537-41.01923-5.85986-55.34344c-2.60437-14.32416-20.18408-10.4176-20.18408-10.4176l1.95337,41.01929,8.42773,41.97778,6.55957,57.16211c-.33789,1.6535-.5293,3.45087-.5293,5.33789,0,8.00812,3.34424,14.5,7.46973,14.5s7.46973-6.49188,7.46973-14.5c0-4.21252-.93103-7.99371-2.40869-10.64288Z\"\n        fill=\"#ffb6b6\"\n      />\n      <path\n        d=\"M344.36666,198.95449c3.08175-3.6707,6.77264-6.1651,10.08696-7.12522l38.98077-44.06526s3.2555-41.01927,5.8599-55.34346c2.6044-14.32419,20.18408-10.41759,20.18408-10.41759l-1.9533,41.01927-11.06869,44.27477-45.61337,38.72532c-.79655,1.45114-1.77304,2.90165-2.94266,4.29478-5.54929,6.60955-13.07747,9.42409-16.81477,6.28638-3.73715-3.13771-2.2682-11.03944,3.28109-17.64899Z\"\n        fill=\"#ffb6b6\"\n      />\n      <polygon\n        points=\"430.13131 76.46862 434.65312 59.08516 452.2687 58.23783 457.53901 82.20035 430.13131 76.46862\"\n        fill=\"#ffb6b6\"\n      />\n      <polygon\n        points=\"430.13131 76.46862 434.65312 59.08516 452.2687 58.23783 457.53901 82.20035 430.13131 76.46862\"\n        opacity=\".1\"\n      />\n      <g>\n        <polygon\n          points=\"385.1488 361.25683 368.64994 360.3143 370.81424 410.94912 381.99418 411.58853 385.1488 361.25683\"\n          fill=\"#ffb6b6\"\n        />\n        <path\n          d=\"M369.38449,394.93938l5.72891,2.61332-.00743,3.47275s1.38213-4.01923,8.80109-4.89615l.88559,3.36705s2.87736,3.30264,2.38384,9.27645l-1.8885,15.99763-5.59502-.12882-.90369-11.132s-1.5413-2.52606-8.64068,9.47718c0,0-7.82052,1.9711-19.93118-2.08958-1.66453-.55811-2.82078-2.11212-2.79901-3.86759,.01202-.96878,.39069-1.8641,1.60549-2.18526,3.0922-.8175,6.11176,.21911,8.10866-2.24898,1.9969-2.46809,12.25193-17.656,12.25193-17.656Z\"\n          fill=\"#2f2e41\"\n        />\n      </g>\n      <g>\n        <polygon\n          points=\"473.69834 361.25683 457.19947 360.3143 459.36377 410.94912 470.54371 411.58853 473.69834 361.25683\"\n          fill=\"#ffb6b6\"\n        />\n        <path\n          d=\"M457.93402,394.93938l5.72891,2.61332-.00743,3.47275s1.38213-4.01923,8.80109-4.89615l.88559,3.36705s2.87736,3.30264,2.38384,9.27645l-1.8885,15.99763-5.59502-.12882-.90369-11.132s-1.5413-2.52606-8.64068,9.47718c0,0-7.82052,1.9711-19.93118-2.08958-1.66453-.55811-2.82078-2.11212-2.79901-3.86759,.01202-.96878,.39069-1.8641,1.60549-2.18526,3.0922-.8175,6.11176,.21911,8.10866-2.24898,1.9969-2.46809,12.25193-17.656,12.25193-17.656Z\"\n          fill=\"#2f2e41\"\n        />\n      </g>\n      <circle cx=\"443.67515\" cy=\"49.78935\" r=\"19.53299\" fill=\"#ffb6b6\" />\n      <path\n        d=\"M454.75196,53.03639s-8.58797-14.05193-17.1846-12.50095c-8.59662,1.55098-13.07809,2.95128-13.07809,2.95128,0,0-3.50075-11.20367,8.25239-16.57884,0,0-16.63273-13.92589,1.09406-22.86307,17.72679-8.93718,28.7577-.27561,28.7577-.27561,0,0,14.67194,12.44289-1.59513,23.95832,0,0,14.07934,16.03785-.14106,31.35764,0,0,2.5104-11.66516-.9046-9.27374-3.41501,2.39142-5.20067,3.22497-5.20067,3.22497Z\"\n        fill=\"#2f2e41\"\n      />\n      <path\n        d=\"M456.82639,77.77082l-26.69508-3.2555-20.50963,16.60304s-10.20026,28.4207-2.6044,45.57697c.18201,.4111,.32555,28.97393,.32555,28.97393h56.71743s-.05495-19.44142,2.11224-26.48271c.3096-1.0059,.66455-1.75873,1.07149-2.16567,3.2555-3.2555,11.06869-24.09068,7.16209-33.20607-3.9066-9.11539-17.57969-26.04398-17.57969-26.04398Z\"\n        fill=\"#6c63ff\"\n      />\n      <polygon\n        points=\"407.01728 164.36705 371.20681 278.30947 363.39361 368.1612 385.20545 368.1612 403.76178 284.82046 429.31616 236.57758 454.54754 374.67219 476.56445 374.67219 476.03383 187.80663 464.01412 164.36705 407.01728 164.36705\"\n        fill=\"#2f2e41\"\n      />\n      <rect y=\"422.15664\" width=\"656\" height=\"2\" fill=\"#3f3d56\" />\n      <g>\n        <path\n          d=\"M336.26362,187.42757c-6.50229-10.47037-21.67223-12.93381-32.93992-7.93906-11.26769,4.99475-19.0565,15.64429-24.35105,26.77426-5.29455,11.12996-8.62502,23.12151-14.06681,34.18023-16.01157,32.53845-48.43603,53.78965-68.83256,83.77469-15.32504,22.52941-23.44045,49.88437-22.88108,77.12621,.21426,10.43456,1.9016,21.41209,8.41343,29.56819,9.66535,12.1059,26.77774,14.58924,42.18653,16.18335,8.95057,.92597,19.93647,.89956,24.54601-6.82846,1.82337-3.05693-17.77064-13.72146-17.45627-17.26697,1.69638-19.13259,23.34373-31.28271,25.04011-50.41531,2.6597,13.33132-.7489,27.0942-.2109,40.67759,.53799,13.58339,7.23345,28.94778,20.53418,31.75641,4.10444,.86671,8.73862,.26717,11.84946-2.54713,3.11084-2.81429,4.01941-8.13071,1.24812-11.27992,2.83767,2.89821,7.62638,3.6514,11.21672,1.76422,3.59034-1.88718,5.68538-6.25866,4.90727-10.23943-.5722-2.92733-2.46138-5.38952-4.0973-7.88359-8.86167-13.51019-11.17027-31.11518-6.09158-46.45342,8.97777-27.11391,38.45973-44.81167,43.45404-72.93321,3.70897-20.88416-6.8726-44.54836,4.35624-62.54329,5.06032-8.10949,13.65271-13.22163,20.50586-19.88533,6.85315-6.6637,12.21238-16.85889,8.29043-25.57606l-35.02913-.03819\"\n          fill=\"#3f3d56\"\n        />\n        <path\n          d=\"M228.23833,426.7864c-.87183,0-1.76514-.23291-2.62842-.6958-1.98853-1.06641-3.48804-3.1748-3.82056-5.37207-.55322-3.6543,1.1875-7.20312,2.58618-10.05469,3.82593-7.79883,7.60791-16.13818,8.16528-24.80273,.60889-9.46045-3.22852-18.22949-9.77563-22.34082-4.86572-3.05469-11.36255-3.84033-18.29248-2.21045-6.13794,1.44336-11.6521,4.39404-17.71045,7.81689-.4812,.27197-1.09082,.10254-1.36255-.37891-.27173-.48047-.10205-1.09082,.37866-1.3623,5.96631-3.37109,11.85034-6.521,18.23633-8.02295,7.45483-1.75195,14.49146-.87793,19.81396,2.46436,7.16016,4.49609,11.36328,13.98047,10.70824,24.1626-.58104,9.03027-4.45141,17.57617-8.36596,25.55518-1.34229,2.73682-2.86377,5.83887-2.40405,8.87451,.23779,1.57129,1.35815,3.14209,2.78833,3.90869,.69653,.37402,1.75879,.71045,2.86206,.19727,.50146-.23438,1.0957-.0166,1.32886,.48389s.0166,1.0957-.48413,1.32861c-.64282,.2998-1.32617,.44873-2.02368,.44873Z\"\n          fill=\"#2f2e41\"\n        />\n        <path\n          d=\"M304.87324,186.74131c-1.30944,3.58632,.43745,7.60574,2.85869,10.55768,2.42124,2.95194,5.531,5.3258,7.66451,8.49194,4.47207,6.63654,3.80132,15.70946,.36506,22.93685-3.43625,7.22739-9.22913,13.01799-14.91052,18.65402,.41995-2.41674-.80214-4.85632-2.46745-6.65736s-3.7617-3.13792-5.62402-4.73441c-8.67234-7.43441-11.3852-20.98221-6.24412-31.18266\"\n          fill=\"#2f2e41\"\n        />\n        <path\n          d=\"M186.42241,400.10863c-7.34594-.9001-13.55119,5.70986-20.88233,6.72341-8.47755,1.17204-16.27381-5.53591-20.04567-13.21807-3.77186-7.68216-4.73983-16.40208-7.33471-24.55739-2.59488-8.15531-7.60116-16.41523-15.75739-19.00722-3.42187-1.08745-7.29353-1.02838-10.47242,.64087-3.17889,1.66926-5.50871,5.07712-5.4292,8.66675,.09784,4.41706,3.4851,7.95244,5.53718,11.8651,3.26521,6.2257,3.16378,13.59894,4.60607,20.47941,3.46765,16.54261,16.92397,30.57084,33.30801,34.72366,8.47267,2.14754,17.95749,1.6559,25.29692-3.09078s11.81291-14.30671,9.09603-22.61434\"\n          fill=\"#3f3d56\"\n        />\n      </g>\n    </svg>\n  )\n}\n\nexport default Doggy\n"
  },
  {
    "path": "web/components/Footer.tsx",
    "content": "import Link from 'next/link'\nimport CopyleftIcon from './CopyleftIcon'\nimport { buildMeta } from '../utils/build-meta'\n\nconst Footer: React.FunctionComponent = () => {\n  const { date, year, gitHash } = buildMeta\n  const formattedDate = date\n    ? new Date(date).toLocaleString('en-US', {\n        dateStyle: 'short',\n        timeStyle: 'medium',\n        timeZone: 'UTC',\n      })\n    : 'local dev'\n\n  return (\n    <div className=\"max-w-4xl mx-auto flex items-center px-4 py-6 text-zinc-500 dark:text-zinc-400\">\n      <div className=\"pr-3\">\n        <CopyleftIcon width={20} height={20} />\n      </div>\n      <div className=\"font-sans text-xs\">\n        <p>\n          {year} Conky developers, updated {formattedDate}\n          {gitHash && (\n            <>\n              {' '}\n              <Link\n                target=\"_blank\"\n                href={`https://github.com/brndnmtthws/conky/commit/${gitHash}`}\n                className=\"hover:text-zinc-800 dark:hover:text-zinc-100\"\n              >\n                {`(${gitHash})`}\n              </Link>\n            </>\n          )}\n        </p>\n      </div>\n    </div>\n  )\n}\n\nexport default Footer\n"
  },
  {
    "path": "web/components/Header.tsx",
    "content": "import { Github } from 'lucide-react'\nimport Link from 'next/link'\nimport { useRouter } from 'next/router'\nimport ThemeSwitcher from './ThemeSwitcher'\n\nimport * as React from 'react'\nimport Search from './Search'\n\ntype HeaderProps = {\n  name: string\n  setDarkMode: (state: boolean) => void\n}\n\ninterface NavLinkProps {\n  href: string\n  name: string\n}\n\nconst NavLink: React.FunctionComponent<NavLinkProps> = (props) => {\n  const router = useRouter()\n  const bg = router.asPath.startsWith(props.href)\n    ? 'bg-rose-100 dark:bg-rose-900'\n    : ''\n  return (\n    <Link\n      href={props.href}\n      className={`mx-0.5 inline-flex h-10 items-center rounded px-3 hover:ring-1 ring-black dark:ring-white hover:bg-rose-300 dark:hover:bg-rose-700 ${bg}`}\n    >\n      {props.name}\n    </Link>\n  )\n}\n\nexport default function Header({ name, setDarkMode }: HeaderProps) {\n  const router = useRouter()\n\n  return (\n    <div className=\"border-b border-zinc-900/15 bg-white/80 backdrop-blur-md transition dark:border-white/10 dark:bg-black/40\">\n      <header className=\"mx-auto flex w-full max-w-4xl items-center px-4 py-3\">\n        <h1 className=\"mr-4 text-3xl font-bold leading-none tracking-tight text-zinc-950 dark:text-white\">\n          <Link href=\"/\" data-cy=\"top-link\" className=\"inline-flex h-10 items-center\">\n            {name}\n          </Link>\n        </h1>\n        {router.asPath !== '/' && (\n          <div className=\"mr-2 hidden items-center text-md sm:flex\">\n            <NavLink href=\"/variables\" name=\"Vars\" />\n            <NavLink href=\"/config_settings\" name=\"Config\" />\n            <NavLink href=\"/lua\" name=\"Lua\" />\n          </div>\n        )}\n        <div className=\"flex-grow\" />\n        <div className=\"flex items-center gap-1.5\">\n          <Search />\n          <div className=\"mx-1 flex h-10 items-center border-r border-zinc-900/15 px-2 dark:border-white/10\">\n            <a\n              href=\"https://github.com/brndnmtthws/conky\"\n              className=\"inline-flex h-10 w-10 items-center justify-center text-zinc-950 transition hover:text-zinc-600 dark:text-white dark:hover:text-zinc-300\"\n            >\n              <Github size={28} strokeWidth={2} />\n            </a>\n          </div>\n          <ThemeSwitcher setDarkMode={setDarkMode} />\n        </div>\n      </header>\n      {router.asPath !== '/' && (\n        <div className=\"mx-auto flex max-w-4xl items-center px-3 pb-2 text-md sm:hidden\">\n          <NavLink href=\"/variables\" name=\"Vars\" />\n          <NavLink href=\"/config_settings\" name=\"Config\" />\n          <NavLink href=\"/lua\" name=\"Lua\" />\n        </div>\n      )}\n    </div>\n  )\n}\n"
  },
  {
    "path": "web/components/Layout.tsx",
    "content": "import { useEffect, useState } from 'react'\nimport Footer from './Footer'\nimport Header from './Header'\n\ninterface LayoutProps {\n  children: React.ReactNode\n}\n\nexport default function Layout({ children }: LayoutProps) {\n  const [darkMode, setDarkMode] = useState(\n    () =>\n      typeof document !== 'undefined' &&\n      document.documentElement.classList.contains('dark')\n  )\n\n  useEffect(() => {\n    if (darkMode) {\n      document.documentElement.classList.add('dark')\n      localStorage.setItem('theme', 'dark')\n    } else {\n      document.documentElement.classList.remove('dark')\n      localStorage.setItem('theme', 'light')\n    }\n  }, [darkMode])\n\n  useEffect(() => {\n    const darkQuery = window.matchMedia('(prefers-color-scheme: dark)')\n    const onChange = (event: MediaQueryListEvent) => {\n      if (!window.localStorage.getItem('theme')) {\n        setDarkMode(event.matches)\n      }\n    }\n\n    darkQuery.addEventListener('change', onChange)\n\n    return () => {\n      darkQuery.removeEventListener('change', onChange)\n    }\n  }, [])\n\n  return (\n    <div className=\"min-h-screen bg-transparent text-zinc-950 dark:text-zinc-50\">\n      <div className=\"sticky top-0 z-10\">\n        <Header name=\"Conky\" setDarkMode={setDarkMode} />\n      </div>\n      <div className=\"relative pb-6 pt-4 md:pt-6\">\n        <div className=\"mx-auto flex w-full max-w-4xl flex-col items-center px-4\">\n          {children}\n        </div>\n      </div>\n      <div className=\"relative\">\n        <Footer />\n      </div>\n    </div>\n  )\n}\n"
  },
  {
    "path": "web/components/SEO.tsx",
    "content": "import Head from 'next/head'\n\ninterface SEOProps {\n  title: string\n  description: string\n}\n\nexport default function SEO({ title, description }: SEOProps) {\n  return (\n    <Head>\n      <title>{title}</title>\n      <meta name=\"description\" content={description} />\n      <meta property=\"og:title\" content={title} />\n    </Head>\n  )\n}\n"
  },
  {
    "path": "web/components/Search.tsx",
    "content": "import Fuse from 'fuse.js'\nimport type { FuseResult } from 'fuse.js'\nimport React, {\n  Fragment,\n  useCallback,\n  useEffect,\n  useRef,\n  useState,\n} from 'react'\nimport type { SearchIndex, SearchItem } from '../utils/search'\nimport { Dialog, Transition, Combobox } from '@headlessui/react'\nimport { Search as SearchIcon } from 'lucide-react'\nimport { useRouter } from 'next/router'\n\ninterface SearchResultProps {\n  result: FuseResult<SearchItem>\n  active: boolean\n}\n\nconst KIND_STYLES: Record<string, string> = {\n  var: 'bg-blue-500',\n  config: 'bg-green-500',\n  lua: 'bg-red-500',\n}\n\nconst SearchResult: React.FunctionComponent<SearchResultProps> = ({\n  active,\n  result,\n}) => {\n  const selection = active ? 'bg-slate-300 dark:bg-slate-700' : ''\n  const kindClass = KIND_STYLES[result.item.kind] ?? ''\n  const excerpt =\n    result.item.desc.length <= 120\n      ? result.item.desc\n      : `${result.item.desc.slice(0, 120)}…`\n\n  return (\n    <div className={`m-1 rounded flex flex-col p-2 ${selection}`}>\n      <hr className=\"mb-2 border-black/10 dark:border-white/10\" />\n      <div className=\"flex justify-between\">\n        <div>\n          <code className=\"text-lg p-1 mx-1 bg-fuchsia-200 dark:bg-fuchsia-900 font-bold\">\n            {result.item.name}\n          </code>\n        </div>\n        <div className={`rounded bg-opacity-20 p-1 ${kindClass}`}>\n          {result.item.kind}\n        </div>\n      </div>\n      <div>\n        <p className=\"w-11/12\">{excerpt}</p>\n      </div>\n    </div>\n  )\n}\n\nconst Search: React.FunctionComponent = () => {\n  const router = useRouter()\n  const inputRef = useRef<HTMLInputElement | null>(null)\n  const [searchText, setSearchText] = useState('')\n  const [searchResults, setSearchResults] = useState<FuseResult<SearchItem>[]>(\n    []\n  )\n  const [fuse, setFuse] = React.useState<Fuse<SearchItem>>()\n\n  const loadFuse = async () => {\n    const data = await fetch('/static/fuse-index.json')\n    const searchIndex: SearchIndex = await data.json()\n    return new Fuse(searchIndex.list, {}, Fuse.parseIndex(searchIndex.index))\n  }\n\n  React.useEffect(() => {\n    void loadFuse().then((nextFuse) => setFuse(nextFuse))\n  }, [])\n\n  const [isOpen, setIsOpen] = useState(false)\n  const handleKeyPress = useCallback(\n    (event: KeyboardEvent) => {\n      if (event.key === 'k' && (event.metaKey || event.ctrlKey) && isOpen) {\n        setIsOpen(false)\n        event.preventDefault()\n      } else if (\n        (event.key === '/' ||\n          (event.key === 'k' && (event.metaKey || event.ctrlKey))) &&\n        !isOpen\n      ) {\n        setIsOpen(true)\n        event.preventDefault()\n      }\n    },\n    [isOpen]\n  )\n  useEffect(() => {\n    document.addEventListener('keydown', handleKeyPress)\n\n    return () => {\n      document.removeEventListener('keydown', handleKeyPress)\n    }\n  }, [handleKeyPress])\n\n  useEffect(() => {\n    if (!isOpen) {\n      return\n    }\n\n    const timeoutId = window.setTimeout(() => {\n      inputRef.current?.focus()\n      inputRef.current?.select()\n    }, 0)\n\n    return () => {\n      window.clearTimeout(timeoutId)\n    }\n  }, [isOpen])\n\n  if (!fuse) {\n    return (\n      <div className=\"flex h-10 w-10 items-center justify-center text-zinc-950 dark:text-white\">\n        <SearchIcon size={28} strokeWidth={2} />\n      </div>\n    )\n  }\n\n  const setSearch = (value: string) => {\n    setSearchText(value)\n    const searchResult = fuse.search(value)\n    setSearchResults(searchResult)\n  }\n  const onChange = (value: FuseResult<SearchItem> | null | undefined) => {\n    if (value) {\n      if (value.item.kind === 'var') {\n        void router.push(`/variables#${value.item.name}`, undefined, {\n          scroll: false,\n        })\n      }\n      if (value.item.kind === 'config') {\n        void router.push(`/config_settings#${value.item.name}`, undefined, {\n          scroll: false,\n        })\n      }\n      if (value.item.kind === 'lua') {\n        void router.push(`/lua#${value.item.name}`, undefined, { scroll: false })\n      }\n      setIsOpen(false)\n    }\n  }\n\n  const closeModal = () => {\n    setIsOpen(false)\n  }\n\n  const openModal = () => {\n    setIsOpen(true)\n  }\n\n  return (\n    <>\n      <div className=\"flex items-center\">\n        <button\n          onClick={openModal}\n          title=\"Search (/ or ⌘K)\"\n          className=\"inline-flex h-10 w-10 items-center justify-center text-zinc-950 transition hover:text-zinc-600 dark:text-white dark:hover:text-zinc-300\"\n        >\n          <SearchIcon size={28} strokeWidth={2} />\n        </button>\n      </div>\n\n      <Transition appear show={isOpen} as={Fragment}>\n        <Dialog\n          as=\"div\"\n          className=\"relative z-10\"\n          initialFocus={inputRef}\n          onClose={closeModal}\n        >\n          <Transition.Child\n            as={Fragment}\n            enter=\"ease-out duration-300\"\n            enterFrom=\"opacity-0\"\n            enterTo=\"opacity-100\"\n          >\n            <div className=\"fixed inset-0 bg-black bg-opacity-25 backdrop-blur-sm\" />\n          </Transition.Child>\n\n          <Transition.Child\n            as={Fragment}\n            enter=\"ease-out duration-300\"\n            enterFrom=\"opacity-0 scale-95\"\n            enterTo=\"opacity-100 scale-100\"\n          >\n            <div className=\"fixed inset-0\">\n              <div className=\"flex h-screen w-screen items-start justify-center p-16 text-center\">\n                <Dialog.Panel className=\"flex flex-col max-h-full w-full max-w-2xl p-1 bg-gray-200 dark:bg-gray-800 transform rounded-xl text-left align-middle shadow transition-all border border-gray-800 dark:border-white border-opacity-10 dark:border-opacity-10\">\n                  <Combobox nullable onChange={onChange}>\n                    <div className=\"flex\">\n                      <Combobox.Label className=\"flex items-center ml-2\">\n                        <SearchIcon size={32} strokeWidth={2} />\n                      </Combobox.Label>\n                      <Combobox.Input\n                        ref={inputRef}\n                        placeholder=\"Search docs (/ or ⌘K)\"\n                        className=\"mx-1 p-2 w-full bg-gray-200 dark:bg-gray-800 outline-none\"\n                        onChange={(e) => setSearch(e.target.value)}\n                      />\n                    </div>\n                    <Combobox.Options className=\"flex flex-col h-full overflow-auto\">\n                      {searchResults.length === 0 && searchText !== '' ? (\n                        <div className=\"relative cursor-default select-none py-2 px-4 text-gray-500\">\n                          No results.\n                        </div>\n                      ) : (\n                        searchResults.map((r) => (\n                          <Combobox.Option key={r.refIndex} value={r}>\n                            {({ selected: _selected, active }) => (\n                              <SearchResult\n                                active={active}\n                                result={r}\n                              />\n                            )}\n                          </Combobox.Option>\n                        ))\n                      )}\n                    </Combobox.Options>\n                  </Combobox>\n                </Dialog.Panel>\n              </div>\n            </div>\n          </Transition.Child>\n        </Dialog>\n      </Transition>\n    </>\n  )\n}\n\nexport default Search\n"
  },
  {
    "path": "web/components/ThemeSwitcher.tsx",
    "content": "import { Moon, Sun } from 'lucide-react'\n\ntype Props = {\n  setDarkMode: (state: boolean) => void\n}\nexport default function ThemeSwitcher({ setDarkMode }: Props) {\n  return (\n    <div className=\"flex rounded-full border border-zinc-900/10 bg-zinc-100/90 p-0.5 dark:border-white/10 dark:bg-zinc-900\">\n      <button\n        type=\"button\"\n        aria-label=\"Use Dark Mode\"\n        title=\"Use Dark Mode\"\n        onClick={() => {\n          setDarkMode(true)\n        }}\n        className=\"flex h-9 w-9 items-center justify-center rounded-full text-zinc-500 transition hover:text-zinc-900 dark:bg-zinc-800 dark:text-zinc-200 dark:hover:text-white\"\n      >\n        <Moon size={20} strokeWidth={2} />\n      </button>\n\n      <button\n        type=\"button\"\n        aria-label=\"Use Light Mode\"\n        title=\"Use Light Mode\"\n        onClick={() => {\n          setDarkMode(false)\n        }}\n        className=\"flex h-9 w-9 items-center justify-center rounded-full bg-white text-zinc-900 shadow-sm transition hover:bg-zinc-50 dark:bg-transparent dark:text-zinc-500 dark:shadow-none dark:hover:text-white\"\n      >\n        <Sun size={20} strokeWidth={2} />\n      </button>\n    </div>\n  )\n}\n"
  },
  {
    "path": "web/cypress/e2e/basic.cy.js",
    "content": "describe('check index renders', () => {\n  beforeEach(() => {\n    cy.visit('/')\n  })\n\n  it('displays the title text', () => {\n    cy.get('[data-cy=\"top-link\"]').contains(/^Conky$/)\n  })\n})\ndescribe('check config settings', () => {\n  beforeEach(() => {\n    cy.visit('/config_settings')\n  })\n\n  it('displays the title text', () => {\n    cy.get('[data-cy=\"top-link\"]').contains(/^Conky$/)\n    cy.get('[data-cy=\"page-heading\"]').contains(/^Configuration settings$/)\n  })\n})\ndescribe('check variables', () => {\n  beforeEach(() => {\n    cy.visit('/variables')\n  })\n\n  it('displays the title text', () => {\n    cy.get('[data-cy=\"top-link\"]').contains(/^Conky$/)\n    cy.get('[data-cy=\"page-heading\"]').contains(/^Variables$/)\n  })\n  it('has anchor links and can focus on them', () => {\n    cy.get('[data-anchor-name=\"acpiacadapter\"]').click()\n    cy.get('[data-anchor-name=\"acpiacadapter\"]').and('be.visible')\n  })\n})\ndescribe('check lua', () => {\n  beforeEach(() => {\n    cy.visit('/lua')\n  })\n\n  it('displays the title text', () => {\n    cy.get('[data-cy=\"top-link\"]').contains(/^Conky$/)\n    cy.get('[data-cy=\"page-heading\"]').contains(/^Lua API$/)\n  })\n})\n"
  },
  {
    "path": "web/cypress.config.js",
    "content": "/* eslint-disable @typescript-eslint/no-var-requires */\nconst { defineConfig } = require('cypress')\n\nmodule.exports = defineConfig({\n  scrollBehavior: 'center',\n  e2e: {\n    baseUrl: 'http://localhost:3000',\n    supportFile: false,\n  },\n})\n"
  },
  {
    "path": "web/documents/about.mdx",
    "content": "---\ntitle: About\ndescription: What is Conky, and what can it do?\nindexWeight: -10\n---\n\nConky is a system monitor for X. It can display almost anything, either on the\nroot window or in its own window. In addition to its many built-in objects,\nConky can also display information gathered through scripts and external\nprograms.\n\nConky includes more than 250 built-in objects, with support for a wide range of\nsystem statistics including `uname`, uptime, CPU usage, memory usage, disk\nusage, `top`-style process statistics, and network monitoring. It also includes\nbuilt-in IMAP and POP3 support, integration with several music players such as\nMPD, XMMS2, and Audacious, and much more. Conky can present this information as\ntext or through simple progress bars and graph widgets, using a variety of\nfonts and colors.\n\nIf you would like to get involved, visit the project on GitHub:\nhttps://github.com/brndnmtthws/conky.\n"
  },
  {
    "path": "web/documents/compiling.mdx",
    "content": "---\ntitle: Compiling\ndescription: How to compile Conky from source\nindexWeight: 0\n---\n\nBuilding Conky with CMake is straightforward:\n\n1. From the top-level source directory, create a build directory and change\n   into it:\n\n```shell-session\nmkdir build\ncd build\n```\n\n2. Run the CMake configuration step:\n\n```shell-session\ncmake ../ # pass the path to the sources to cmake\n```\n\nOR\n\n```shell-session\nccmake ../ # use the ncurses interface instead, or try cmake-gui\n```\n\n3. Build and install as usual:\n\n```shell-session\nmake\nsudo make install # optional\n```\n\nConky provides a number of build options. The easiest way to explore them is to\nuse `ccmake` or `cmake-gui`.\n\nSome build-time features, such as documentation generation, require third-party\ntools. CMake will usually tell you when one is missing. For documentation\ngeneration, you will need the `docbook2X` package, which is available on most\ndistributions.\n"
  },
  {
    "path": "web/documents/contributing.mdx",
    "content": "---\ntitle: Contributing\ndescription: How to contribute to Conky\nindexWeight: 0\n---\n\nContributions are welcome from anyone.\n\n## Pull Request Guidelines\n\nWhen submitting PRs, please:\n\n- Describe the changes and explain why they were necessary\n- Describe how the changes affect existing behavior\n- Explain how you tested and validated your changes\n- Include unit tests when appropriate\n- Include relevant screenshots or other evidence showing that the changes work\n- Add a GPLv3 license header to any new source files\n- Ensure that all new code is GPLv3-licensed\n- Try to leave the code better than you found it\n- PRs with failed checks may be ignored or closed; please make sure\n  the build and checks pass if possible, and let someone know when the build\n  system is not working\n\n_Patches submitted in issues, email, or elsewhere may be ignored._\n\n## Coding Style\n\nCode should be formatted with `clang-format`. If you configure Conky with\n`cmake -DCHECK_CODE_QUALITY=ON`, you can run `make clang-format` to format the\ncode automatically.\n\n## Git hooks\n\nTo make life easier, you can use\n[lefthook](https://github.com/evilmartians/lefthook) to handle some basic\nlinting with a pre-commit hook, as defined in [lefthook.yml](lefthook.yml).\nFollow the [installation guide for\nlefthook](https://github.com/evilmartians/lefthook/blob/master/docs/install.md),\nthen run `lefthook install` to enable the hooks.\n\n## Unit Testing\n\nConky uses the [Catch2](https://github.com/catchorg/Catch2) unit testing\nframework. If you add new functions or methods, please consider adding unit\ntests for them. Additional tests for existing code are also welcome.\n"
  },
  {
    "path": "web/documents/docker.mdx",
    "content": "---\ntitle: Docker\ndescription: A guide for running Conky with Docker\nindexWeight: 0\n---\n\n## Getting the image\n\nBuild the image with:\n\n```shell-session\ndocker build --tag=conky .\n```\n\nIf you want the command-line version, use:\n\n```shell-session\ndocker build --build-arg X11=no --tag=conkycmd .\n```\n\n## Running the container\n\nAfter building, you can run the graphical version with:\n\n```shell-session\ndocker run --rm -ti --net=host -e DISPLAY -v ~/.Xauthority:/root/.Xauthority conky\n```\n\nThe command-line version is simpler:\n\n```shell-session\ndocker run --rm -ti conkycmd\n```\n\nTo pass options to Conky, specify `conky` twice: once as the image name and\nonce as the command. For example:\n\n```shell-session\ndocker run --rm -ti --net=host -e DISPLAY -v ~/.Xauthority:/root/.Xauthority conky conky --version\n```\n\nThis prints the Conky version. Because X is not required for this command, you\ncan also run:\n\n```shell-session\ndocker run --rm -ti conkycmd conky --version\n```\n\nIf you want to experiment with the configuration first, run:\n\n```shell-session\ndocker run --rm -ti --net=host -e DISPLAY -v ~/.Xauthority:/root/.Xauthority conky bash\n```\n\n_Make any changes you want in the configuration._\n\n```shell-session\nconky -c configurationfile ; exit\n```\n\nSee the Docker documentation for many other ways to use this container.\n\n## Why?\n\nDisadvantages of using Docker:\n\n- You need to install Docker.\n  This can be done by following the instructions in\n  https://docs.docker.com/install/ to install Docker CE. Installing it through\n  your distribution's package manager may also work.\n- Much of the information displayed will reflect the current container rather\n  than the entire host system.\n- At the moment, the Docker image is still under development.\n\nAdvantages of using Docker:\n\n- During installation, you do not need to worry as much about which compilers\n  and libraries are installed, or how they are configured.\n- Containerizing Conky makes it much less likely that problems with Conky will\n  affect the rest of the system.\n- Your Conky will run in exactly the same environment as everyone else's, so\n  if it works for one person, it should work for others as well, regardless of\n  distribution or host configuration. The Conky configuration itself, and the\n  Conky version, still matter.\n- Problems are easier for developers to reproduce, which can lead to faster\n  debugging.\n"
  },
  {
    "path": "web/documents/syntax-highlighting.mdx",
    "content": "---\ntitle: Syntax Highlighting\ndescription: Enabling conkyrc syntax highlighting\nindexWeight: 0\n---\n\n## Gedit\n\nNote: this highlights syntax only and does **NOT** attempt to validate\narguments or keywords. It is unlikely to be 100% accurate, and improvements are\nwelcome.\n\nSyntax highlighting is automatically applied to files with `conky` in their\nname, for example `my_config.conky`. Unfortunately, it also matches the\n`conky.lang` file itself, which you should set to XML manually.\n\n- [`gtksourceview` Syntax Highlight documentation][1]\n- [Regex Tutorial](http://www.rexegg.com/)\n- [Regex Testing](https://regex101.com/)\n\nDevelopers: the main context (`id=\"conkyrc\"`) is where gedit starts. That\ncontext then references other subcontexts. Each context can apply styles to\nitself, to substrings matched by its regular expressions, or to its contents in\nthe case of `<start><end>` container contexts. If anything is unclear, search\nthe [`gtksourceview` docs][1] for the relevant XML attributes. If you run into\na particularly complex regex, try the Regex Tester linked above, and keep in\nmind that `gtksourceview` adds some extra regex syntax, such as `\\%[ ... ]`\nand `\\%{ ... }`.\n\n---\n\nFor medit v1.1.1:\n`/usr/share/medit/language-specs/conky.lang`\n\nFor older versions of medit:\n`/usr/share/medit-1/language-specs/conky.lang`\n\nFor gedit v2.x:\n`/usr/share/gtksourceview-2.0/language-specs/conky.lang`\nor, for a single user:\n`~/.local/share/gtksourceview-2.0/language-specs/conky.lang`\n\nFor gedit v3.x:\n`/usr/share/gtksourceview-3.0/language-specs/conky.lang`\nor, for a single user:\n`~/.local/share/gtksourceview-3.0/language-specs/conky.lang`\n\n[1]: https://developer.gnome.org/gtksourceview/stable/lang-reference.html\n"
  },
  {
    "path": "web/eslint.config.mjs",
    "content": "import js from '@eslint/js'\nimport nextPlugin from '@next/eslint-plugin-next'\nimport tsPlugin from '@typescript-eslint/eslint-plugin'\nimport tsParser from '@typescript-eslint/parser'\nimport { defineConfig, globalIgnores } from 'eslint/config'\nimport prettier from 'eslint-config-prettier'\nimport jsxA11y from 'eslint-plugin-jsx-a11y'\nimport reactHooks from 'eslint-plugin-react-hooks'\nimport globals from 'globals'\n\nconst tsFiles = ['**/*.{ts,tsx,mts,cts}']\nconst tsRecommendedTypeChecked = tsPlugin.configs[\n  'flat/recommended-type-checked'\n].map((config) => (config.files ? config : { ...config, files: tsFiles }))\n\nexport default defineConfig([\n  {\n    files: ['**/*.{js,jsx,mjs,cjs,ts,tsx,mts,cts}'],\n    languageOptions: {\n      ecmaVersion: 'latest',\n      sourceType: 'module',\n      parserOptions: {\n        ecmaFeatures: {\n          jsx: true,\n        },\n      },\n      globals: {\n        ...globals.browser,\n        ...globals.node,\n      },\n    },\n  },\n  js.configs.recommended,\n  ...tsRecommendedTypeChecked,\n  {\n    files: tsFiles,\n    languageOptions: {\n      parser: tsParser,\n      parserOptions: {\n        projectService: true,\n        tsconfigRootDir: import.meta.dirname,\n      },\n    },\n    plugins: {\n      '@next/next': nextPlugin,\n      'jsx-a11y': jsxA11y,\n      'react-hooks': reactHooks,\n    },\n    rules: {\n      ...reactHooks.configs.flat['recommended-latest'].rules,\n      ...jsxA11y.configs.strict.rules,\n      ...nextPlugin.configs['core-web-vitals'].rules,\n      '@typescript-eslint/consistent-type-imports': 'error',\n      '@typescript-eslint/no-empty-object-type': 'off',\n      '@typescript-eslint/no-unsafe-assignment': 'off',\n      '@typescript-eslint/no-unnecessary-template-expression': 'off',\n      '@typescript-eslint/require-await': 'off',\n      '@typescript-eslint/no-unused-vars': [\n        'error',\n        {\n          argsIgnorePattern: '^_',\n          caughtErrorsIgnorePattern: '^_',\n          destructuredArrayIgnorePattern: '^_',\n          varsIgnorePattern: '^_',\n        },\n      ],\n      curly: ['error', 'all'],\n      eqeqeq: ['error', 'always'],\n      'no-var': 'error',\n      'object-shorthand': ['error', 'always'],\n      'prefer-const': [\n        'error',\n        {\n          destructuring: 'all',\n        },\n      ],\n    },\n  },\n  {\n    files: ['**/*.{js,jsx,mjs,cjs}'],\n    ...tsPlugin.configs['flat/disable-type-checked'],\n    rules: {\n      '@typescript-eslint/no-require-imports': 'off',\n    },\n  },\n  prettier,\n  globalIgnores([\n    '.next/**',\n    '.netlify/**',\n    'cypress/**',\n    'cypress.config.js',\n    'node_modules/**',\n    'out/**',\n    'public/static/**',\n  ]),\n])\n"
  },
  {
    "path": "web/netlify.toml",
    "content": "[build]\ncommand = \"bun run build\"\npublish = \"out\"\n\n[build.environment]\nBUN_VERSION = \"1.3.10\"\n\n# Include the doc dir in the build ignore command\nignore = \"git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF . ../doc/\"\n"
  },
  {
    "path": "web/next-env.d.ts",
    "content": "/// <reference types=\"next\" />\n/// <reference types=\"next/image-types/global\" />\nimport \"./.next/types/routes.d.ts\";\n\n// NOTE: This file should not be edited\n// see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.\n"
  },
  {
    "path": "web/next.config.mjs",
    "content": "// @ts-check\nimport { execFileSync } from 'node:child_process'\n\nfunction getGitHash() {\n  try {\n    return execFileSync('git', ['rev-parse', '--short', 'HEAD'], {\n      encoding: 'utf8',\n    }).trim()\n  } catch {\n    return ''\n  }\n}\n\nconst modifiedDate = new Date().toISOString()\nconst gitHash = getGitHash()\n\n/**\n * @type {import('next').NextConfig}\n */\nconst nextConfig = {\n  output: 'export',\n  env: {\n    NEXT_PUBLIC_BUILD_DATE: modifiedDate,\n    NEXT_PUBLIC_BUILD_YEAR: String(new Date(modifiedDate).getUTCFullYear()),\n    NEXT_PUBLIC_GIT_HASH: gitHash,\n  },\n}\n\nexport default nextConfig\n"
  },
  {
    "path": "web/package.json",
    "content": "{\n  \"name\": \"conky-website\",\n  \"description\": \"Conky website\",\n  \"author\": \"Conky developers\",\n  \"license\": \"GPL-3.0-only\",\n  \"contributors\": [\n    \"Brenden Matthews\"\n  ],\n  \"homepage\": \"https://github.com/brndnmtthws/conky\",\n  \"packageManager\": \"bun@1.3.10\",\n  \"engines\": {\n    \"bun\": \"1.3.10\"\n  },\n  \"bugs\": {\n    \"url\": \"https://github.com/brndnmtthws/conky/issues\"\n  },\n  \"scripts\": {\n    \"dev\": \"bun run write-search-index && next dev\",\n    \"dev:watch\": \"bun run write-search-index && next-remote-watch ./documents\",\n    \"build\": \"bun run write-search-index && next build\",\n    \"start\": \"next start\",\n    \"lint\": \"eslint .\",\n    \"e2e\": \"start-server-and-test \\\"bun run dev\\\" http://localhost:3000 \\\"cypress open --e2e\\\"\",\n    \"e2e:headless\": \"start-server-and-test \\\"bun run dev\\\" http://localhost:3000 \\\"cypress run --e2e\\\"\",\n    \"write-search-index\": \"tsx ./scripts/write-search-index.ts\"\n  },\n  \"dependencies\": {\n    \"@fontsource-variable/fira-code\": \"^5.2.7\",\n    \"@fontsource-variable/inter\": \"^5.2.8\",\n    \"@fontsource-variable/newsreader\": \"^5.2.10\",\n    \"@headlessui/react\": \"^2.2.9\",\n    \"@tailwindcss/typography\": \"^0.5.19\",\n    \"fuse.js\": \"^7.1.0\",\n    \"gray-matter\": \"^4.0.3\",\n    \"lucide-react\": \"^0.542.0\",\n    \"next\": \"^16.1.6\",\n    \"react\": \"^19.2.4\",\n    \"react-dom\": \"^19.2.4\",\n    \"rehype-parse\": \"^9.0.1\",\n    \"rehype-stringify\": \"^10.0.1\",\n    \"remark-gfm\": \"^4.0.1\",\n    \"remark-parse\": \"^11.0.0\",\n    \"remark-rehype\": \"^11.1.2\",\n    \"unified\": \"^11.0.5\"\n  },\n  \"devDependencies\": {\n    \"@eslint/js\": \"^10.0.1\",\n    \"@next/eslint-plugin-next\": \"^16.1.6\",\n    \"@tailwindcss/postcss\": \"^4.2.1\",\n    \"@types/js-yaml\": \"^4.0.9\",\n    \"@types/node\": \"^25.3.5\",\n    \"@types/react\": \"^19.2.14\",\n    \"@types/react-dom\": \"^19.2.3\",\n    \"@typescript-eslint/eslint-plugin\": \"^8.56.1\",\n    \"@typescript-eslint/parser\": \"^8.56.1\",\n    \"autoprefixer\": \"^10.4.27\",\n    \"baseline-browser-mapping\": \"^2.10.0\",\n    \"cypress\": \"^15.11.0\",\n    \"eslint\": \"^10.0.3\",\n    \"eslint-config-prettier\": \"^10.1.8\",\n    \"eslint-plugin-jsx-a11y\": \"^6.10.2\",\n    \"eslint-plugin-react-hooks\": \"^7.0.1\",\n    \"globals\": \"^16.4.0\",\n    \"js-yaml\": \"^4.1.1\",\n    \"next-remote-watch\": \"2.0.0\",\n    \"postcss\": \"^8.5.8\",\n    \"start-server-and-test\": \"^2.1.5\",\n    \"tailwindcss\": \"^4.2.1\",\n    \"tsx\": \"^4.21.0\",\n    \"typescript\": \"^5.9.3\"\n  }\n}\n"
  },
  {
    "path": "web/pages/404.tsx",
    "content": "import Layout from '../components/Layout'\nimport SEO from '../components/SEO'\nimport Doggy from '../components/Doggy'\n\nexport default function FourOhFour() {\n  return (\n    <Layout>\n      <SEO title=\"Conky\" description=\"Conky documentation\" />\n      <main className=\"w-full\">\n        <div className=\"flex flex-col items-center\">\n          <h1 className=\"text-4xl py-8 px-2 lg:px-4 font-extrabold text-center\">404: Not found 😢</h1>\n          <Doggy />\n          <h2 className=\"text-3xl py-4 font-serif mb-8\">Here&rsquo;s a doggy 😀</h2>\n        </div>\n      </main>\n    </Layout>\n  )\n}\n\nexport function getStaticProps() {\n  return { props: {} }\n}\n"
  },
  {
    "path": "web/pages/_app.tsx",
    "content": "import '@fontsource-variable/fira-code'\nimport '@fontsource-variable/inter'\nimport '@fontsource-variable/newsreader'\nimport '../styles/globals.css'\nimport type { AppProps } from 'next/app'\n\nfunction App({ Component, pageProps }: AppProps) {\n  return <Component {...pageProps} />\n}\n\nexport default App\n"
  },
  {
    "path": "web/pages/_document.tsx",
    "content": "import React from 'react'\nimport Document, { Html, Head, Main, NextScript } from 'next/document'\n\nconst themeScript = `\n(() => {\n  const theme = window.localStorage.getItem('theme');\n  const prefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;\n  if (theme === 'dark' || (!theme && prefersDark)) {\n    document.documentElement.classList.add('dark');\n  }\n})();\n`\n\nclass MyDocument extends Document {\n  render() {\n    return (\n      <Html lang=\"en\" className=\"theme-compiled scroll-smooth\" suppressHydrationWarning>\n        <Head>\n          <link rel=\"icon\" href=\"/favicon.svg\" type=\"image/svg+xml\" />\n          <script dangerouslySetInnerHTML={{ __html: themeScript }} />\n        </Head>\n        <body className=\"antialiased leading-base\">\n          <Main />\n          <NextScript />\n        </body>\n      </Html>\n    )\n  }\n}\n\nexport default MyDocument\n"
  },
  {
    "path": "web/pages/config_settings.tsx",
    "content": "import Layout from '../components/Layout'\nimport SEO from '../components/SEO'\nimport {\n  getConfigSettings,\n  filterDesc,\n} from '../utils/doc-utils'\nimport type { Documentation } from '../utils/doc-utils'\nimport Docs from '../components/Docs'\n\nexport interface ConfigSettingsProps {\n  config_settings: Documentation\n}\n\nexport default function ConfigSettings(props: ConfigSettingsProps) {\n  return (\n    <Layout>\n      <SEO\n        title=\"Conky – Config settings\"\n        description=\"Conky configuration settings\"\n      />\n      <main className=\"w-full pt-4\">\n        <div>\n          <h1 className=\"text-2xl px-2 lg:px-4\" data-cy=\"page-heading\">\n            Configuration settings\n          </h1>\n        </div>\n        <Docs docs={props.config_settings} braces={false} assign={true} />\n      </main>\n    </Layout>\n  )\n}\n\nexport function getStaticProps() {\n  const config_settings = filterDesc(getConfigSettings())\n\n  return { props: { config_settings } }\n}\n"
  },
  {
    "path": "web/pages/documents/[slug].tsx",
    "content": "import {\n  getNextDocumentBySlug,\n  getDocumentBySlug,\n  getPreviousDocumentBySlug,\n  documentFilePaths,\n} from '../../utils/mdx-utils'\n\nimport Layout from '../../components/Layout'\nimport SEO from '../../components/SEO'\nimport type { GetStaticProps } from 'next'\n\ninterface FrontMatter {\n  title: string\n  description: string\n}\n\ninterface DocumentPageProps {\n  source: string\n  frontMatter: FrontMatter\n}\n\nexport default function DocumentPage({\n  source,\n  frontMatter,\n}: DocumentPageProps) {\n  return (\n    <Layout>\n      <SEO\n        title={frontMatter.title}\n        description={frontMatter.description}\n      />\n      <article className=\"p-2 pt-4 lg:p-4 w-full\">\n        <header>\n          <h1 className=\"text-3xl md:text-5xl dark:text-white mb-12\">\n            {frontMatter.title}\n          </h1>\n          {frontMatter.description && (\n            <p className=\"text-xl mb-4\">{frontMatter.description}</p>\n          )}\n        </header>\n        <main>\n          <article\n            className=\"prose dark:prose-invert\"\n            dangerouslySetInnerHTML={{ __html: source }}\n          />\n        </main>\n      </article>\n    </Layout>\n  )\n}\n\nexport const getStaticProps: GetStaticProps = async ({ params }) => {\n  if (params) {\n    const { source, data } = await getDocumentBySlug(params.slug as string)\n    const prevDocument = getPreviousDocumentBySlug(params.slug as string)\n    const nextDocument = getNextDocumentBySlug(params.slug as string)\n\n    return {\n      props: {\n        source,\n        frontMatter: data,\n        prevDocument,\n        nextDocument,\n      },\n    }\n  }\n  return { props: {} }\n}\n\nexport const getStaticPaths = async () => {\n  const paths = documentFilePaths\n    // Remove file extensions for page paths\n    .map((path) => path.replace(/\\.mdx?$/, ''))\n    // Map the path into the static paths object required by Next.js\n    .map((slug) => ({ params: { slug } }))\n\n  return {\n    paths,\n    fallback: false,\n  }\n}\n"
  },
  {
    "path": "web/pages/index.tsx",
    "content": "import { ArrowRight } from 'lucide-react'\nimport Link from 'next/link'\nimport { getDocuments } from '../utils/mdx-utils'\nimport type { Document } from '../utils/mdx-utils'\nimport Layout from '../components/Layout'\nimport SEO from '../components/SEO'\n\nconst pages = [\n  {\n    slug: '/variables',\n    title: 'Variables',\n    desc: 'Variables let you define the various objects displayed in Conky including text, bars, graphs, and more.',\n  },\n  {\n    slug: '/config_settings',\n    title: 'Configuration settings',\n    desc: 'Global configuration parameters let you customize how Conky behaves.',\n  },\n  {\n    slug: '/lua',\n    title: 'Lua API',\n    desc: 'Extend Conky with custom behavior by using the Lua API.',\n  },\n]\n\ninterface IndexItemProps {\n  href: string\n  as?: string\n  title: string\n  desc?: string\n}\n\nconst IndexItem: React.FunctionComponent<IndexItemProps> = (props) => {\n  return (\n    <div className=\"backdrop-blur-sm transition first:rounded-t-2xl last:rounded-b-2xl border border-zinc-300/80 bg-white/70 hover:bg-white dark:border-white/10 dark:bg-white/5 dark:hover:bg-white/10 border-b-0 last:border-b hovered-sibling:border-t-0\">\n      <Link\n        as={props.as}\n        href={props.href}\n        className=\"block px-4 py-4 focus:outline-none focus:ring-4 focus:ring-zinc-400/40 lg:px-5 lg:py-5\"\n      >\n        <h2 className=\"text-xl md:text-[2rem] md:leading-tight\">{props.title}</h2>\n        {props.desc && (\n          <p className=\"mt-4 max-w-3xl text-lg leading-8 text-zinc-600 dark:text-zinc-400\">\n            {props.desc}\n          </p>\n        )}\n        <ArrowRight\n          className=\"mt-5 text-zinc-900 dark:text-zinc-100\"\n          size={24}\n          strokeWidth={2}\n        />\n      </Link>\n    </div>\n  )\n}\n\ninterface IndexProps {\n  documents: Document[]\n}\n\nexport default function Index({ documents }: IndexProps) {\n  return (\n    <Layout>\n      <SEO title=\"Conky\" description=\"Conky documentation\" />\n      <main className=\"w-full\">\n        <div className=\"w-full\">\n          {pages.map((p) => (\n            <IndexItem\n              key={p.slug}\n              href={p.slug}\n              title={p.title}\n              desc={p.desc}\n            />\n          ))}\n          {documents.map((document) => (\n            <IndexItem\n              key={document.filePath}\n              as={`/documents/${document.filePath.replace(/\\.mdx?$/, '')}`}\n              href={`/documents/[slug]`}\n              title={document.data.title ?? 'Untitled'}\n              desc={document.data.description}\n            />\n          ))}\n          <IndexItem\n            href=\"https://github.com/brndnmtthws/conky/wiki\"\n            title=\"Wiki\"\n            desc=\"The wiki on GitHub contains user configs, Lua scripts, FAQs, and more.\"\n          />\n        </div>\n      </main>\n    </Layout>\n  )\n}\n\nexport function getStaticProps() {\n  const documents = getDocuments()\n\n  return { props: { documents } }\n}\n"
  },
  {
    "path": "web/pages/lua.tsx",
    "content": "import Layout from '../components/Layout'\nimport SEO from '../components/SEO'\nimport { getLua, filterDesc } from '../utils/doc-utils'\nimport type { Documentation } from '../utils/doc-utils'\nimport Docs from '../components/Docs'\n\nexport interface LuaProps {\n  lua: Documentation\n}\n\nexport default function Lua(props: LuaProps) {\n  return (\n    <Layout>\n      <SEO title=\"Conky – Lua API\" description=\"Conky Lua API documentation\" />\n      <main className=\"w-full pt-4\">\n        <div>\n          <h1 className=\"text-2xl px-2 lg:px-4\" data-cy=\"page-heading\">\n            Lua API\n          </h1>\n        </div>\n        <Docs docs={props.lua} braces={false} assign={false} />\n      </main>\n    </Layout>\n  )\n}\n\nexport function getStaticProps() {\n  const lua = filterDesc(getLua())\n\n  return { props: { lua } }\n}\n"
  },
  {
    "path": "web/pages/variables.tsx",
    "content": "import Layout from '../components/Layout'\nimport SEO from '../components/SEO'\nimport { getVariables, filterDesc } from '../utils/doc-utils'\nimport type { Documentation } from '../utils/doc-utils'\nimport Docs from '../components/Docs'\n\nexport interface VariablesProps {\n  variables: Documentation\n}\n\nexport default function Variables(props: VariablesProps) {\n  return (\n    <Layout>\n      <SEO\n        title=\"Conky – Variables\"\n        description=\"Conky object variables documentation\"\n      />\n      <main className=\"w-full pt-4\">\n        <h1 className=\"text-2xl px-2 lg:px-4\" data-cy=\"page-heading\">\n          Variables\n        </h1>\n        <Docs docs={props.variables} braces={true} assign={false} />\n      </main>\n    </Layout>\n  )\n}\n\nexport function getStaticProps() {\n  const variables = filterDesc(getVariables())\n\n  return { props: { variables } }\n}\n"
  },
  {
    "path": "web/postcss.config.js",
    "content": "// If you want to use other PostCSS plugins, see the following:\n// https://tailwindcss.com/docs/using-with-preprocessors\nmodule.exports = {\n  plugins: {\n    '@tailwindcss/postcss': {},\n  },\n}\n"
  },
  {
    "path": "web/scripts/write-search-index.ts",
    "content": "import { writeSearchIndex } from '../utils/search-serde'\n\nasync function main() {\n  await writeSearchIndex()\n}\n\nvoid main()\n"
  },
  {
    "path": "web/styles/globals.css",
    "content": "@config \"../tailwind.config.js\";\n@import \"tailwindcss\";\n\n@layer base {\n  html {\n    background-color: rgb(250 250 250);\n    color: rgb(17 24 39);\n  }\n\n  html.dark {\n    background-color: rgb(10 10 10);\n    color: rgb(244 244 245);\n  }\n\n  body {\n    min-height: 100vh;\n    background:\n      radial-gradient(circle at top, rgb(255 255 255 / 0.75), transparent 50%),\n      rgb(250 250 250);\n    text-rendering: optimizeLegibility;\n    -webkit-font-smoothing: antialiased;\n  }\n\n  html.dark body {\n    background:\n      radial-gradient(circle at top, rgb(39 39 42 / 0.45), transparent 45%),\n      rgb(10 10 10);\n  }\n}\n\ncode[class*='language-'],\npre[class*='language-'] {\n  font-family: 'Fira Code Variable', 'ui-monospace', 'SFMono-Regular', 'Menlo',\n    'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', 'monospace';\n}\n\n@layer base {\n  code::before,\n  code::after {\n    content: \"\" !important;\n  }\n\n  .prose {\n    font-family: var(--font-sans);\n  }\n}\n"
  },
  {
    "path": "web/tailwind.config.js",
    "content": "module.exports = {\n  content: [\n    './pages/**/*.{js,ts,jsx,tsx,mdx}',\n    './components/**/*.{js,ts,jsx,tsx,mdx}',\n    './utils/**/*.{js,ts,jsx,tsx,mdx}',\n    './styles/**/*.{css}',\n  ],\n  darkMode: 'class',\n  presets: [require('./utils/tailwind-preset')],\n}\n"
  },
  {
    "path": "web/tsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"ES2022\",\n    \"lib\": [\"dom\", \"dom.iterable\", \"es2022\"],\n    \"skipLibCheck\": true,\n    \"strict\": true,\n    \"forceConsistentCasingInFileNames\": true,\n    \"noEmit\": true,\n    \"incremental\": true,\n    \"esModuleInterop\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"bundler\",\n    \"resolveJsonModule\": true,\n    \"isolatedModules\": true,\n    \"jsx\": \"react-jsx\",\n    \"plugins\": [\n      {\n        \"name\": \"next\"\n      }\n    ],\n    \"allowJs\": true\n  },\n  \"include\": [\"next-env.d.ts\", \"**/*.ts\", \"**/*.tsx\", \".next/types/**/*.ts\"],\n  \"exclude\": [\"node_modules\"]\n}\n"
  },
  {
    "path": "web/utils/build-meta.ts",
    "content": "function getEnv(name: string, fallback = '') {\n  return process.env[name] ?? fallback\n}\n\nexport const buildMeta = {\n  date: getEnv('NEXT_PUBLIC_BUILD_DATE'),\n  year: getEnv(\n    'NEXT_PUBLIC_BUILD_YEAR',\n    String(new Date().getUTCFullYear())\n  ),\n  gitHash: getEnv('NEXT_PUBLIC_GIT_HASH'),\n}\n"
  },
  {
    "path": "web/utils/doc-utils.ts",
    "content": "import fs from 'fs'\nimport path from 'path'\nimport yaml from 'js-yaml'\nimport { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkGfm from 'remark-gfm'\nimport remarkRehype from 'remark-rehype'\nimport rehypeStringify from 'rehype-stringify'\n\nconst DOC_PATH = path.join(process.cwd(), '..', 'doc')\n\nexport interface Documentation {\n  desc: string\n  desc_md: string\n  values: DocItem[]\n}\nexport interface DocItem {\n  name: string\n  desc: string\n  desc_md: string\n  default: string | undefined\n  args: string[]\n}\n\nfunction getDocumentation(source: string): Documentation {\n  const configSettingsFile = fs.readFileSync(\n    path.join(DOC_PATH, source),\n    'utf-8'\n  )\n  const parsed = yaml.load(configSettingsFile.toString()) as Documentation\n  const docs = {\n    ...parsed,\n    desc_md: processMarkdown(parsed.desc),\n    values: parsed.values.map((c) => ({\n      ...c,\n      desc_md: processMarkdown(c.desc),\n    })),\n  }\n\n  return docs\n}\n\nexport function filterDesc(docs: Documentation): Documentation {\n  return {\n    ...docs,\n    desc: '',\n    values: docs.values.map((v) => ({\n      ...v,\n      desc: '',\n    })),\n  }\n}\n\nexport function getConfigSettings(): Documentation {\n  return getDocumentation('config_settings.yaml')\n}\n\nexport function getVariables(): Documentation {\n  return getDocumentation('variables.yaml')\n}\nexport function getLua(): Documentation {\n  return getDocumentation('lua.yaml')\n}\n\nfunction processMarkdown(input: string): string {\n  return unified()\n    .use(remarkParse)\n    .use(remarkGfm)\n    .use(remarkRehype, {allowDangerousHtml: true})\n    .use(rehypeStringify, {allowDangerousHtml: true})\n    .processSync(input)\n    .toString()\n}\n"
  },
  {
    "path": "web/utils/mdx-utils.ts",
    "content": "import fs from 'fs'\nimport path from 'path'\nimport matter from 'gray-matter'\nimport { unified } from 'unified'\nimport remarkGfm from 'remark-gfm'\nimport remarkParse from 'remark-parse'\nimport remarkRehype from 'remark-rehype'\nimport rehypeStringify from 'rehype-stringify'\n\n// DOCUMENTS_PATH is useful when you want to get the path to a specific file\nexport const DOCUMENTS_PATH = path.join(process.cwd(), 'documents')\n\n// documentFilePaths is the list of all mdx files inside the DOCUMENTS_PATH directory\nexport const documentFilePaths = fs\n  .readdirSync(DOCUMENTS_PATH)\n  // Only include md(x) files\n  .filter((path) => /\\.mdx?$/.test(path))\n\nexport interface DocumentData {\n  title?: string\n  description?: string\n  indexWeight?: number\n}\n\nexport interface Document {\n  content: string\n  data: DocumentData\n  filePath: string\n}\n\nexport const getDocuments = (): Document[] => {\n  const documents = documentFilePaths.map((filePath) => {\n    const source = fs.readFileSync(path.join(DOCUMENTS_PATH, filePath), 'utf-8')\n    const parsed = matter(source)\n    const data = parsed.data as DocumentData\n\n    return {\n      content: parsed.content,\n      data,\n      filePath,\n    }\n  })\n\n  documents.sort((a, b) => {\n    const leftWeight = a.data.indexWeight ?? 0\n    const rightWeight = b.data.indexWeight ?? 0\n\n    if (leftWeight > rightWeight) {\n      return 1\n    }\n    if (leftWeight < rightWeight) {\n      return -1\n    }\n    const leftTitle = typeof a.data.title === 'string' ? a.data.title : ''\n    const rightTitle = typeof b.data.title === 'string' ? b.data.title : ''\n    return leftTitle.localeCompare(rightTitle)\n  })\n\n  return documents\n}\n\nexport const getDocumentBySlug = async (slug: string) => {\n  const documentFilePath = path.join(DOCUMENTS_PATH, `${slug}.mdx`)\n  const source = fs.readFileSync(documentFilePath, 'utf-8')\n\n  const parsed = matter(source)\n  const data = parsed.data as DocumentData\n\n  const result = await unified()\n    .use(remarkParse)\n    .use(remarkGfm)\n    .use(remarkRehype, {allowDangerousHtml: true})\n    // .use(rehypePrism)\n    .use(rehypeStringify, {allowDangerousHtml: true})\n    .process(parsed.content)\n\n  return { source: result.value, data, documentFilePath }\n}\n\nexport const getNextDocumentBySlug = (slug: string) => {\n  const documents = getDocuments()\n  const currentFileName = `${slug}.mdx`\n  const currentDocument = documents.find(\n    (document) => document.filePath === currentFileName\n  )\n  if (!currentDocument) return null\n  const currentDocumentIndex = documents.indexOf(currentDocument)\n\n  const document = documents[currentDocumentIndex - 1]\n  // no prev document found\n  if (!document) return null\n\n  const nextDocumentSlug = document?.filePath.replace(/\\.mdx?$/, '')\n\n  return {\n    title: document.data.title,\n    slug: nextDocumentSlug,\n  }\n}\n\nexport const getPreviousDocumentBySlug = (slug: string) => {\n  const documents = getDocuments()\n  const currentFileName = `${slug}.mdx`\n  const currentDocument = documents.find(\n    (document) => document.filePath === currentFileName\n  )\n  if (!currentDocument) return null\n  const currentDocumentIndex = documents.indexOf(currentDocument)\n\n  const document = documents[currentDocumentIndex + 1]\n  // no prev document found\n  if (!document) return null\n\n  const previousDocumentSlug = document?.filePath.replace(/\\.mdx?$/, '')\n\n  return {\n    title: document.data.title,\n    slug: previousDocumentSlug,\n  }\n}\n"
  },
  {
    "path": "web/utils/search-serde.ts",
    "content": "import * as fs from 'fs/promises'\nimport { createSearchIndex } from './search'\n\nexport async function writeSearchIndex() {\n  await fs.mkdir('public').catch(() => {})\n  await fs.mkdir('public/static').catch(() => {})\n  const index = createSearchIndex()\n  await fs.writeFile('public/static/fuse-index.json', JSON.stringify(index))\n}\n"
  },
  {
    "path": "web/utils/search.ts",
    "content": "import Fuse from 'fuse.js'\nimport type { FuseIndexRecords } from 'fuse.js'\nimport { getConfigSettings, getLua, getVariables } from './doc-utils'\n\nexport interface SearchItem {\n  kind: string\n  name: string\n  desc: string\n}\n\nexport interface SearchIndex {\n  index: {\n    keys: readonly string[]\n    records: FuseIndexRecords\n  }\n  list: SearchItem[]\n}\n\nexport function createSearchIndex(): SearchIndex {\n  const cs: SearchItem[] = getConfigSettings().values.map((v) => ({\n    kind: 'config',\n    name: v.name,\n    desc: v.desc.substring(0, 121),\n  }))\n  const vars: SearchItem[] = getVariables().values.map((v) => ({\n    kind: 'var',\n    name: v.name,\n    desc: v.desc.substring(0, 121),\n  }))\n  const lua: SearchItem[] = getLua().values.map((v) => ({\n    kind: 'lua',\n    name: v.name,\n    desc: v.desc.substring(0, 121),\n  }))\n  const list: SearchItem[] = [...cs, ...vars, ...lua]\n\n  return {\n    list,\n    index: Fuse.createIndex<SearchItem>(['name', 'desc'], list).toJSON(),\n  }\n}\n"
  },
  {
    "path": "web/utils/tailwind-preset.js",
    "content": "const plugin = require('tailwindcss/plugin')\nconst pluginTypography = require('@tailwindcss/typography')\n\nconst hoveredSiblingPlugin = plugin(function ({ addVariant }) {\n  addVariant('hovered-sibling', ({ container }) => {\n    container.walkRules((rule) => {\n      rule.selector = `:hover + .hovered-sibling\\\\:${rule.selector.slice(1)}`\n    })\n  })\n})\n\nmodule.exports = {\n  theme: {\n    fontFamily: {\n      sans: [\n        'Inter Variable',\n        'ui-sans-serif',\n        'system-ui',\n        '-apple-system',\n        'BlinkMacSystemFont',\n        'Segoe UI',\n        'Roboto',\n        'Helvetica Neue',\n        'Arial',\n        'Noto Sans',\n        'sans-serif',\n        'Apple Color Emoji',\n        'Segoe UI Emoji',\n        'Segoe UI Symbol',\n        'Noto Color Emoji',\n      ],\n      serif: [\n        'Newsreader Variable',\n        'ui-serif',\n        'Georgia',\n        'Cambria',\n        'Times New Roman',\n        'Times',\n        'serif',\n      ],\n      mono: [\n        'Fira Code Variable',\n        'ui-monospace',\n        'SFMono-Regular',\n        'Menlo',\n        'Monaco',\n        'Consolas',\n        'Liberation Mono',\n        'Courier New',\n        'monospace',\n      ],\n    },\n    extend: {\n      typography: (theme) => ({\n        DEFAULT: {\n          css: {\n            code: {\n              '&::before': {\n                content: '\"\" !important',\n              },\n              '&::after': {\n                content: '\"\" !important',\n              },\n            },\n            fontFamily: theme('fontFamily.sans').join(', '),\n          },\n        },\n      }),\n    },\n  },\n  plugins: [hoveredSiblingPlugin, pluginTypography],\n}\n"
  }
]